[Tex/LaTex] Need to restart TeXShop to use XeLaTeX

pdftextexshopxetex

I have a document that must be compiled using XeLaTeX. If I open TeXshop and compile this file first, everything is fine and it works. However, if I open a different file that is normally compiled with pdflatex, it will compile that fine. But if I now try to compile the file that requires xelatex, I get an error, since the console shows that it is trying to use pdflatex. I tried looking in preferences and telling it to use the xelatex command, but it doesn't seem to do anything. Also, if I compile the xelatex file first, and then try compiling the other one, it works fine, but the console shows that it was compiled using xelatex.

Any ideas on why it is behaving like this, and what I can do to switch between behaviors without restarting Texshop?

Best Answer

If your document to be compiled with XeLaTeX is in the front window, go to the “Macros” menu and select “Program”. A selection box appears

enter image description here

Choose the XeLaTeX line by clicking on it. TeXShop will add, as the first line in the document,

% !TEX TS-program = XeLaTeX

(which will appear colored in red). This will have the effect that XeLaTeX will be used to compile the document irrespective of what's shown on the drop down menu next to the “Typeset” button. It will be sufficient to push the “Typeset” button and the selected engine will be used.

Related Question