Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
1  
Have you thought about using arara? –  StrongBad Apr 9 at 16:54
2  
You could use arara with the directive % arara: pdflatex: { shell: yes }. –  Henri Menke Apr 9 at 16:54
    
By coincide or not, I stumbled upon arara some half hour ago, before asking my question. I admit it is a solution, and I am glad with it, but arara seems like a heavy solution for such a simple operation? –  user3498676 Apr 9 at 17:03
3  
There is not/should not be a solution at TeX macro level. Otherwise it would be easy for malicious code to turn on shell escape. –  Heiko Oberdiek Apr 9 at 17:06
    
@cmhughes Done. –  Henri Menke Apr 9 at 17:38

1 Answer 1

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
share|improve this answer
    
I believe that MiKTeX's implementation can specify options in the first input line. –  egreg Apr 9 at 17:51
    
@egreg I never used MikTeX. If want to write some lines about this, feel free to edit. –  Henri Menke Apr 9 at 17:55
    
I've never used it either. I believe to have seen something like that. –  egreg Apr 9 at 17:58
    
@egreg Some googling revealed, that %& --enable-write18 as the first line should work, but I can't test it. From: docs.miktex.org/manual/tex.html –  Henri Menke Apr 9 at 18:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.