Until I select a font using \fontspec{ ... }
, XeLaTeX uses the default of Computer Modern. Once I select some font, I have no idea how to re-select Computer Modern. Can anyone help?
[Tex/LaTex] Switching back to Computer Modern within XeLaTeX
computer-modernfontsfontspecxetex
Best Answer
XeLaTeX (via
fontspec
) actually uses the Latin Modern version of Computer Modern. So to change back to it you can do two things:\newfontfamily
\fontfamily...\selectfont
method.Alternatively, if you are mainly using Computer Modern in your document, you can use
\newfontfamily
to define the alternative font.As noted by Andrey Vihrov, the second solution is probably to be preferred, since the optical sizes of Latin Modern are set up when the font is loaded in the regular way. With the first solution, you would need to add the optical size information using the
[SizeFeatures]
option when declaring the\newfontfamily
.If you want to restore the defaults completely (rather than just have access to the Latin Modern fonts with a command) you can redefine
\rmdefault, \sfdefault
and\ttdefault
instead (as suggested by Ulrike Fischer). This will override the\setmainfont
settings.Edit note: Please note that the current version of this answer has been reorganized to reflect the discussion in the comments. Thanks.