Commits

Dmitri Gribenko committed 399934e

Define TeX commands in a way that always constructs command name correctly regardless of symbols used.

  • Participants
  • Parent commits 28711fa

Comments (0)

Files changed (1)

File pygments/formatters/latex.py

         cp = self.commandprefix
         styles = []
         for name, definition in self.cmd2def.iteritems():
-            styles.append(r'\def\%s@tok@%s{%s}' % (cp, name, definition))
+            styles.append(r'\expandafter\def\csname %s@tok@%s\endcsname{%s}' % (cp, name, definition))
         return STYLE_TEMPLATE % {'cp': self.commandprefix,
                                  'styles': '\n'.join(styles)}