5

All of the documents I create with LyX have

\usepackage[T1]{fontenc}

in the preamble, which causes problems when I use certain classes or try to switch from pdfLaTaX to XeTeX (for example).

Is there a way to prevent LyX from inserting this line in my documents?

orome
  • 10,459
  • LyX loads fontenc, because usually it is a good idea to use it (in combination with a T1 font like lmodern): http://tex.stackexchange.com/questions/664/why-should-i-use-usepackaget1fontenc Do you have a special reason why you want to NOT load it? – matth Feb 22 '12 at 09:09

2 Answers2

7

As the OP has already figured out, preventing the loading of any font-encoding package is only possible in the global preferences. Unfortunately, LyX misses a per-document setting for this.

However, if you check the "Use non-Tex fonts" option in the LyX document settings, LyX will load fontspec instead of fontenc. So switching to LuaTeX or XeTeX is easy and can be configured on a per-document base.

enter image description here

Daniel
  • 37,517
  • I figured it out after some experimenting. This will indeed replace fontenc with fontspec if checked, but if unchecked it will follow the app preference for LaTeX output and add fontenc if that's enabled. Both can in fact be disabled together (so, no font-encoding related package gets loaded) if both are unchecked. – orome Feb 21 '12 at 22:18
5

The relevant settings are in app preferences under Output > LaTeX. Simply uncheck "Use LaTeX font encoding" and no fontenc line will be added:

LyX UI for disabling inclusion of fontenc

orome
  • 10,459
  • Ah, its not a document setting, but a global setting. This seems strange to be, but probably is better than nothing (but don't forget to switch it back on afterwards). Thanks for sharing this! – Daniel Feb 21 '12 at 22:27
  • 1
    There's no need to label a self-answer as "Community Wiki": self-answers are perfectly acceptable. – egreg Feb 21 '12 at 22:32
  • @egreg: Thanks. Playing it on the safe side. – orome Feb 21 '12 at 22:41