Optionally enable escaping to LaTeX anywhere with the LaTeX formatter
Most of the documents I write in LaTeX are related to my classes (lecture notes, exercises, exams, projects). Frequently I need to include pretty printed source code in them.
Sometimes I want LaTeX to format snippets of the source code. For instance, when I want to write a general name for something, like the condition and the two alternatives in a conditional command:
if (e) c_1 else c_2
In this example I would let LaTeX typeset e, c_1 and c_2 in math mode. The reader would have a clue that they are placeholder where they would write an expression and two commands. The remaining of the source code should be highlited normally.
This feature is present in tools like the listings package for LaTeX. But for some reasons I want to use pygments, which misses the feature.
So I propose the following new option to pygments, related to the LaTeX formatter:
escapeinside If set to a string of length 2, enables escaping to LaTeX. Text delimited by these 2 characters is read as LaTeX code and typeset accordingly. It has no effect in string literals. It has no effect in comments if `texcomments` or `mathescape` is set. (default: ``''``). *New in Pygments 1.3.2*
Reported by romildo