Re: Using babel package and setting babelfont

Ehud via lyx-users <[email protected]> Tue, 13 Jan 2026 12:20:15 +0000
Newsgroups gmane.editors.lyx.general
Message-ID <[email protected]>
ChatGPT suggestions is to add the following to the document preamble:
```
\usepackage{fontspec}
\AfterPackage{babel}{%
\babelfont[hebrew]{rm}[Script=Hebrew]{Arial}%

}

```

OR

```
\usepackage{fontspec}
\usepackage{etoolbox}

\AtEndPreamble{\babelfont[hebrew]{rm}[Script=Hebrew]{Arial}}

```

which seem to work.
But I am a bit suruprised to learn that LyX forces me to do such workarounds.
On Monday, January 12th, 2026 at 5:16 PM, Ehud via lyx-users <[email protected]> wrote:

> I want to have the following preamble for my document:
> ```
> \documentclass{book}
> \usepackage{fontspec}
> \usepackage[english,hebrew,provide=*,bidi=default]{babel}
> \babelfont[hebrew]{rm}[Script=Hebrew]{Arial}
> \begin{document}
>
> ```
> 1. LyX doesn't allow the user to insert the babelfont macro AFTER the uspackage{babel} macro, so in Document Settings->LaTeX Preamble, I added the babelfont macro with AtBeginDocument:
> ```
> \AtBeginDocument{
> \babelfont[hebrew]{rm}[Script=Hebrew]{Arial}
> }
>
> ```
> but I tend to think that at the moment `AtBeginDocument` is defined, babel has not yet been loaded because of the way babel is built and implemented.
> 2. LyX doesn't allow to pass to babel the provide and bidi options that way, so I think that adding them to documentclass options is ok:
> Document Settings->Document Class->custom-> add in this field `provide=*,bidi=default`.
> But I would like to verify whether this is correct as I haven't seen in the babel manual that passing babel options to document class is correct.
>
> Any ideas for how I can use the babelfont macro(s) in my LyX document?

-- 
lyx-users mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-users