23

I have just started to have a look at XeTeX and I am wondering whether to make the switch, however I am a bit scared... ...and I am basically wondering if I have to take the step fully or if I can have my document running on both engines somehow?

There seems to be some problems with utf8 encodings but can they be solved?

30

You can use ifxetex to insert code meant only for one engine. Basically you will have to adapt inputenc (don't load it with xetex), font loading, perhaps language setup (babel/polyglossia), perhaps some driver options (but in general packages load the correct driver automatically).

\usepackage{ifxetex}
\ifxetex
 \usepackage{fontspec}
 %font commands
\else
 \usepackage[utf8]{inputenc}
 \usepackage[T1]{fontenc}
 %font packages
\fi
  • 4
    \ifxetex requires the ifxetex package, of course. – wasteofspace Apr 6 '11 at 18:28
  • 1
    And there's \ifluatex all the same. – ℝaphink Aug 7 '12 at 14:54
  • Maybe a little problem with the aux files, like .toc by example, if you use non ascii character. – jpayansomet Mar 21 '13 at 19:35

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.