[XeTeX] Testing for XeTeX

Michiel Kamermans pomax at nihongoresources.com
Wed Feb 3 07:29:14 CET 2010


HI Phil,
> OK, thanks Ulrike/Wolfgang : I can therefore just   my existing code 
> to read :
>
>     \ifcsname XeTeXrevision\endcsname
>         \font \tenrm = "Optima" \rm
>     \fi
>
> which does indeed work satisfactorily.

You can, but now you're testing for XeTeX and then issuing plain TeX 
when you're indeed in it, which seems a little odd (the TeX code will 
compile fine regardless of which TeX flavour you use...). Why do you 
need the XeTeX test here?

That said, since XeTeX has fontspec for all matters fonty, you might 
want to use the following code in your .sty file instead:

\RequirePackage{ifxetex}
...
\ifxetex
\usepackage{xltxtra} % implicitly loads the xetex packges xunicode and 
fontspec
\setmainfont{Optima} % from the fontspec package
\else
\font\tenrm = "Optima" \rm % plain TeX code for changing a font
\fi

- Mike "Pomax" Kamermans
nihongoresources.com


More information about the XeTeX mailing list