Random Wisdom

Tag: shell

LaTeX Shell Escape

by on Mar.13, 2011, under How To ..., LaTeX

One of the lesser known features of LaTeX is its “shell-escape” mode. This is achieved using the LaTeX command \write18{cmdlist} in the document. This facility can be used to incorporate dynamic content or simply run additional processes during the compilation phase. An example document may look something like:

  \immediate\write18{date > tmpdate.tex}
  \immediate\write18{rm tmpdate.tex}

As \write18 is usually disabled on most systems for obvious security reasons, it must be enabled explicitly:

$ latex -shell-escape input_file

More details are available in the MiKTeX documentation under the heading “Running Programs From Within TeX“.

1 Comment :, more...