9

I want the typesetting engine of my tex file be "XeLaTex" by default.

I can do this by changing the engine in a console, however, I am wondering how I can do such a work by adding some code to my tex file.

Lets say we have an online tex compiler and we have no choice to select the typesetting engine manually and we want to add some codes to our tex file to make it clear for the compiler which engine to use.

Edit: It is worth pointing out that I use TexWorks editor, however I also want my code to work properly for (TeX Live 2013/W32TeX) that is for the Springer Editorial Manager system.

Thanks

Pedram
  • 421
  • Which front-end editor do you use? – Mico Feb 03 '15 at 21:03
  • 1
    run texdoc arara – Fran Feb 03 '15 at 21:03
  • @Mico I use TexWorks. My problem is this: I want to upload my paper for Springer on editorial manager website. I guess the website is not able to recognize that the engine should be "xelatex" and I want to add some code to automatically make it clear for the system which engine it should use to compile my tex file. – Pedram Feb 03 '15 at 21:10
  • 1
    Have you verified if Springer's upload site has xelatex as a compilation option? – Mico Feb 03 '15 at 21:16
  • 4
    You will need to ask the maintainers of that site, there is no general system. Some editors interpret comments at the head of the file to control such things, but there is no general syntax they are all system-specific – David Carlisle Feb 03 '15 at 21:17
  • @Mico yeah, the site does have xelatex, but it starts from Pdftex go to the next option one by one. However, apparently it does not work properly! – Pedram Feb 03 '15 at 21:26
  • @Fran may you give me an example of the way of using arara? – Pedram Feb 03 '15 at 21:27
  • 1
    @Pedram -- it would be good to add your requirement about uploading to the springer site to the question itself. – barbara beeton Feb 03 '15 at 21:38
  • @barbarabeeton I agree. I added some information about it. – Pedram Feb 03 '15 at 22:23
  • @Pedram Of course, see my answer, but it is all in the manual. – Fran Feb 03 '15 at 23:56

2 Answers2

7

If indeed you use TeXworks, this line

% !TEX program = XeLaTeX

placed at the beginning of every file you mean to typeset with XeLaTeX, should do the job.

On my OS (Mac OS X Mountain Lion), which contains the Zapfino font, the following code, when typeset with TeXworks 0.4.5,

% !TEX program = XeLaTeX
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Zapfino}
\begin{document}
Zapfino!
\end{document}

makes TeXworks switch to XeLaTeX automatically (whatever the typesetting engine previously selected) and gives the expected result:

enter image description here

Of course it is an editor-specific feature. (Although the same line also works with the TeXShop editor on Mac OS X.)

Franck Pastor
  • 18,756
  • 1
    Thanks for your response. May you give me a also clue on changing the typesetting engine in (TeX Live 2013/W32TeX) too? The problem still exist for these two. – Pedram Feb 03 '15 at 22:19
  • The % !TEX program line should work equally well for any of these distributions, as long as TeXworks is used, and configured to use the chosen distribution. This line-feature depends only on TeXworks, which is a front-end editor, and not at all on the TeX distribution. But the same line may not work at all with another editor. – Franck Pastor Feb 03 '15 at 22:25
4

The simplest example of use of arara:

Make this mydoc.tex file:

% arara: pdflatex
\documentclass{article}
\begin{document}
    Hello world.
\end{document}

Then run arara mydoc. You must see:

 $ arara mydoc
  __ _ _ __ __ _ _ __ __ _ 
 / _` | '__/ _` | '__/ _` |
| (_| | | | (_| | | | (_| |
 \__,_|_|  \__,_|_|  \__,_|

 Running PDFLaTeX... SUCCESS
 $ 

Now you can open your mydoc.pdf. That is all.

For a more complex file you can use a chain of orders like:

% arara: pdflatex
% arara: bibtex
% arara: pdflatex
% arara: pdflatex

Note that arara can be also integrated with TEXworks (see section 4.1,page 33)

Fran
  • 80,769