# [texhax] Nested macro definition problem

José Romildo Malaquias j.romildo at gmail.com
Fri Apr 23 16:19:14 CEST 2010

```Pygments (http://pygments.org/) is an application written in Python for
syntax highlighting of source code, with support for many languages. It
produces ouput in many formats, including LaTeX. Pygments uses styles to
define how the final formatted source code looks like. There are many
available styles.

With the LaTeX formatter, which produces a LaTeX document or a snippet
of a LaTeX document, the style definition is a set of macros used to
typset the source code.

The attached file pyg.sty contains the set of macro definitions
corresponding to the default style, generated by the application.

In order to allow the use of more than one highlighting style in the
same LaTeX document, I would like to define a macro for each available
style. The expansion of each macro would be set of macro definitions
specific for that style.

As I do not have much experience in complex macro definitions, I am not
being successfull in making this definitions.

The attached file pyg1.sty has my attempt of defining \styledefault for
the default style.

The attached file test1.tex is a document for testing. When test1.tex is
compiled using pyg1.sty instead of pyg.sty, compilation stops with the
error message:

Illegal parameter number in definition of \PY at tok@gd.
1
l.3 \styledefault

Would anybody help me to solve this problem?

Regards,

Romildo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pyg.sty
Type: text/x-tex
Size: 5071 bytes
Desc: not available
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pyg1.sty
Type: text/x-tex
Size: 5090 bytes
Desc: not available