Permitting LaTeX to execute shell code (aka -enable-write-18) is dangerous. But I sometimes need it due to dot2texi. So in my IDE (which in my case is WinEdt) I manually switch it on when I work with dot2texi, and switch it off when when I do not longer work with dot2texi AND (important) do not forget it (weak spot). I vaguely recall that switching on shell escapes can be done as per document. That would be nice. Does anyone remember how?
1 Answers
The tool arara is a great piece of software by our fellow duck-loving StackExchanger Paulo Cereda. It works somewhat like the TeXworks magic comments (see below) in that sense, that you can control the sequence of your typesetting process.
For example, to get the citation right, you normally need to run latex to generate the aux-file, then bibtex to generate the bbl-file, then again latex to include the bbl-file and to regenerate the aux-file with now right labels, and then a third time latex to get your references right. Phew!
Because this is a lot of typing exercise in your terminal, or a lot of keystrokes in your editor, there is arara. You just insert comments right in the first lines of your file, à la
% arara: pdflatex
% arara: bibtex
% arara: pdflatex
% arara: pdflatex
and then run arara on that file, e.g. arara example.tex. Hopefully you then see
__ _ _ __ __ _ _ __ __ _
/ _` | '__/ _` | '__/ _` |
| (_| | | | (_| | | | (_| |
\__,_|_| \__,_|_| \__,_|
Running PDFLaTeX... SUCCESS
Running BibTeX... SUCCESS
Running PDFLaTeX... SUCCESS
Running PDFLaTeX... SUCCESS
You can also add further options to the single tasks, like shell escape:
% arara: pdflatex: { shell: yes }
% arara: bibtex
% arara: pdflatex: { shell: yes }
% arara: pdflatex: { shell: yes }
For more info read the magnificent documentation, or see this tutorial on texdev.net: http://www.texdev.net/2012/04/24/arara-making-latex-files-your-way/
With TeXworks magic comments you can set typesetting engine, encoding, etc. Here an example:
% !TeX program = LuaLaTeX
% !TeX encoding = UTF-8
% !TeX root = example.tex
% !TeX spellcheck = en_GB
- 109,596
-
I believe that MiKTeX's implementation can specify options in the first input line. – egreg Apr 09 '14 at 17:51
-
@egreg I never used MikTeX. If want to write some lines about this, feel free to edit. – Henri Menke Apr 09 '14 at 17:55
-
-
@egreg Some googling revealed, that
%& --enable-write18as the first line should work, but I can't test it. From: http://docs.miktex.org/manual/tex.html – Henri Menke Apr 09 '14 at 18:04
arara? – StrongBad Apr 09 '14 at 16:54ararawith the directive% arara: pdflatex: { shell: yes }. – Henri Menke Apr 09 '14 at 16:54