Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
You want a polyglot document? –  Seamus Apr 6 '11 at 14:35
    
related question: tex.stackexchange.com/questions/2984/… –  matth May 2 '12 at 9:26
add comment

1 Answer

up vote 29 down vote accepted

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
share|improve this answer
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.