Single-quote character in LaTeX formatter in Pygments 1.6
Before Pygments 1.6, there were no TeX macros for quote characters. In 1.6, there are macros for both the single-quote and the double-quote characters.
The double-quote character seems to work fine under all LaTeX engines (pdftex, luatex, xetex). However, the single-quote character is problematic under pdftex, which is probably the most-used engine. It appears as a right-hand curly quote,
’, rather than a straight quote,
'. A standard LaTeX way to get straight quotes in typeset code is to use the
upquote package (http://www.ctan.org/pkg/upquote), but it doesn't work because of the way Pygments is hardcoding the quote character. This is requiring TeX users to resort to hacking the Pygments macros.
Is there a particular reason that the quote character macros were added? If so, then going back to the old approach (no macros) won't be an option.
If quote macros are needed, an alternative would be
However, this will only work with pdftex if the
textcomp package is used.
Another possibility is to use
That will require
etex, but it's built into all current TeX distributions.
Another option is to define the macro conditionally, with code inspired by the