1

I was wondering if it was possible to edit the packages that LyX load before the preamble. When I use XeLaTeX, LyX loads the package fontspec. The problem is that I load in the preamble the package cmbright and if I do it in this order the text turn to serif. From the exported TeX file from LyX I switched the order of the two packages (first cmbright and then fontspec) and it works perfectly. So does anybody know how to edit the packages that LyX automatically load?

Thanks!

1

I do not know this, as I'm not really familiar with the internals of LyX, but I suspect that the answer is no - you cannot (easily) edit the loading order of packages.

A workaround is however possible:

I assume you have selected Use non-TeX fonts in Document --> Settings --> Fonts. This adds, as you say, the fontspec package to the preamble. It may also have added \setmainfont{..}, \setsansfont{..}, and/or \setmonofont{..}. Copy all of these lines, and paste them into the LaTeX preamble in the document settings. Then add the cmbright package in the correct location.

You can now unselect the Use non-TeX fonts option. Finally, go to the Output section of the document settings, and choose PDF (XeTeX) as default output format. That way, Ctrl + R will use XeLaTeX to build your PDF.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.