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?

  • 2
    If you have % !TEX TS-program = XeLaTeX at the start of your file, or % !TEX TS-program = pdflatex, then TeXShop will set the engine for the file independently of what it is by default or in other open files. – egreg Dec 5 '14 at 22:58
  • 1
    Welcome to TeX.SE. I think you just need to use the pull down menu and select the appropriate engine when you are compiling, either LaTeX or XeLaTeX. Also, which version of TeXShop do you have? It is possible that if you compile a document with LaTeX, that that becomes the default engine for the next compilation. – Peter Grill Dec 5 '14 at 23:09
  • @PeterGrill ah okay, I feel a little silly but that seems to do it. For some reason I've never had to worry about that before, and so I guess I didn't know the drop-down menu existed... – asperanz Dec 6 '14 at 0:52
  • @asperanz: You probably didn't notice before because you have the default (which can be changed via Preferences/Typesetting') set to LaTeX` and now that you need to switch back and forth between LaTeX and XeLaTeX you are encountering the issue. – Peter Grill Dec 6 '14 at 2:22

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.

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.