[OS X TeX] Conditional typesetting engine selection

Jonathan Kew jonathan_kew at sil.org
Fri Nov 25 07:21:09 EST 2005

On 25 Nov 2005, at 12:01 pm, Paul Vickers wrote:

> Hi
> I am writing a document which I am typesetting in XeLaTeX using  
> TeXshop 2.03 on OS X Tiger 10.4.3. However, as the XeLaTeX engine  
> is much slower on my PowerBook than LaTeX, for small updates I use  
> the LaTeX engine for proofing purposes. I've set up a variable  
> 'xetex':
> <....snip....>
>  Being extraordinarily lazy, I would like to have the engine  
> selected depending on the value of the variable 'xetex'. I have  
> tried the following at the top of the document
> \newif\ifxetex
> \xetexfalse
> %\xetextrue
> \ifxetex
>    %!TEX TS-program = xelatex
> \else
>    %!TEX TS-program = pdflatex
> \fi
> %!TEX encoding = UTF-8 Unicode
> %!TEX root = ./Main.tex
> However, this does not work. Is there any way to selectively set %! 
> TEX TS-program from within a document?

I don't see how this would work, as \ifxetex here is a TeX macro,  
which has to be processed/evaluated by the TeX engine ... by which  
time the choice of which engine you're using has (necessarily)  
already been made.

However, why not take the opposite approach: make the decision by  
choosing an engine from TeXShop's pop-up menu, and let that choice  
influence the conditional sections in the document? Your document can  
detect whether it's being processed by xetex (for example by testing  
whether the primitive \XeTeXversion is defined) and behave accordingly.

So you'd have "encoding" and "root" lines as before, but *no* "TS- 
program" in the source document; choose the engine you want to use  
via the TeXShop interface, and replace your existing use of \ifxetex  
with \ifx\XeTeXversion\undefined or some such construction.



------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/

More information about the MacOSX-TeX mailing list