# [texhax] Integrating LaTeX and external program with auxiliar file

Philipp Stephani st_philipp at yahoo.de
Sat Apr 24 12:36:21 CEST 2010

Am 24.04.2010 um 11:46 schrieb José Romildo Malaquias:

> In order to implement a package for highlighting source code in LaTeX
> with the help of the external program pygmentize
> (http://www.pygments.org), I am considering the following procedure:
>
> 1) first compilation of the document: the contents of every ocorrences
>   of the 'pygments' environment are colected and written to the
>   auxiliar file \jobname.pygments.
>
> 2) an auxiliar program pygmentex processes the auxiliar file
>   \jobname.pygments, replacing every snippet of source code by a
>   highlighted version, using the pygments system, producing a new
>   auxiliar file \jobname.pygmented.
>
> 3) second compilation of the document: the contents of the 'pygments'
>   environment, now already hightlighted, are recovered from the
>   \jobname.pygmented file, and used in the final typesetting of the
>   document.
>
> I am looking for references on how to implement this procedure in
> LaTeX. Any help?

it's already been done, see the minted package