[texhax] Calling an external command from source

Victor Ivrii vivrii at gmail.com
Thu Mar 15 17:34:37 CET 2007

On 3/15/07, Justin C. Walker <justin at mac.com> wrote:
> On Mar 15, 2007, at 09:02 , ap wrote:
> > Hi,
> >
> > I was wondering if there's any way of executing a system command from
> > withing a TeX source. I want to create a LaTeX command that can
> > automatically have a given file be processed and then use the result.
> > I couldn't figure any way of doing that. Of course, I could
> > externally call the system command before calling the compiler
> > itself, but for various reasons I would much more prefer this being
> > done transparently.

Easy, As long as system calls are enabled  (pdf)[la]tex --shell-escape
in UNIX-like environments \write18{  put your shell command here}

will be executed. Sometimes it is better to precede by \immediate

This is why shell-escape should not be enabled unless you trust the source

Victor Ivrii, Department of Mathematics, University of Toronto

More information about the texhax mailing list