According to the luatex docs, you shouldn't use fontenc
with luatex. People swear up and down that fontenc is incompatible, but I haven't been able to find an example where loading the package causes problems.
(I'm curious about this because it can be easier to load the same base set of packages for pdftex/luatex/xetex, and add fontspec
only when handling the latter two.)
I know fontenc
is not the right way to deal with fonts in luatex or xelatex, but I'm specifically looking for cases where it's detrimental to load the fontenc package. Do you know of any?
Best Answer
fontenc
is loaded byfontspec
(you can check this in the log). So in itself the package is not a problem.But fontenc is a special package: You can load it more than once with different options without getting option clash errors. It will then load font encoding definitions for all the options. E.g.
will load
t1enc.def
,lgrenc.def
andt2enc.def
.This also is not problematic with lualatex and xelatex.
But fontenc will also set the last encoding option as the encoding default. And quite a number of encodings are not suitable for lualatex and xelatex. These engines need the
TU
encoding (fontspec sets this encoding). Other encodings can lead to quite wrong outputs:So you can use
fontenc
in your document (I need it to usechessfonts
), but you should be careful to load it so that TU remains the default encoding. This here e.g. is wrong:Moving the
\setmainfont
resolves the problem: