This question already has an answer here:

I was working with a Tex file in the standard font, and another in Calibri in Tex Studio.

The problem is that I have to switch compiler between the two files.

I don't want to use Configure -> Build -> Default Compiler. When I do that, it sets the default compiler for every Tex file. So I would need to switch between PdfLatex and XeLatex (and back) every time I work on the files.

enter image description here

So instead I would need to go into Tools every time I work on the one with Calibri font to compile using XeLatex. I cannot click on "compile" because that will run the PdfTex compiler and I will get an error involving fontspec package.

enter image description here

Is there a way to set the compiler for just a single Tex file? So I can work on different files with different fonts without having to do extra steps?

marked as duplicate by David Carlisle, Mensch, Werner, Romain Picot, Andrew Jun 10 '16 at 20:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    You can tell TeXstudio to use a specific compiler for a document with special comments added to the top, see e.g. How to invoke latex with the -shell-escape flag in TeXMakerX? (couldn't find any better links at the moment) – Torbjørn T. May 30 '16 at 6:35
  • I suggest that you provide a minimum working example and describe that what sort of complicated compilation you are doing, and the reason why you have to do it by using combined TeX engine. – Spaceship May 30 '16 at 7:20
  • 5
    See tex.stackexchange.com/questions/236747/…. You can add also shortcuts (like the F5 for build and view) to the other commands too. Or you could use arara for all documents and add the needed arara rule at the begin of your document. – Ulrike Fischer May 30 '16 at 7:34
  • on the commandline I use pdflatex file if I want to use pdflatex and xelatex file if i want to use xelatex. If you find getting the editor to type this for you is easier then that is fine, but if it is not easier then you don't have to do it. – David Carlisle May 30 '16 at 8:14
  • @UlrikeFischer Worked like a charm, thank you professor – Carlos - the Mongoose - Danger May 30 '16 at 14:33