Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to include some Erlang code samples in a document using the minted package which include the ? operator to denote a message being received from a process. The code

A ! Msg1,
    A ? Msg2 ->

produces the following output:

LaTeX output

with the ? operator being treated differently to the ! operator, and having a red box drawn around it. How can I remove this box and have it treated in the same way as the ! operator? I presumed pygmentize would treat them similarly in this context. Is there any way I can check that this assertion is true, and if it's not, modify how pygmentize treats it accordingly?

share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted

Normally the red box indicates syntax errors in your source code (here Erlang). However, the language specific parsers used by Pygments (which in turn is used by minted) are incomplete. Apparently the Erlang parser cannot cope with the question mark as an identifier.

The best course of action is to file a bug with the maintainer of the Erlang lexer, Jeremy Thurgood or the Pocoo team who maintain Pygments.

Or you can fix the error yourself in your local Pygments installation by modifying pygments/lexers/functional.py – the error is probably just a missing question mark on line 659.

share|improve this answer
Thanks; that worked a treat - it was that line and simply adding an escaped ? term did the trick nicely. I'll email Jeremy. –  Edd Mar 29 '11 at 8:10
add comment

You may also override the pygments error command like this:

\expandafter\def\csname PY@tok@err\endcsname{}

That's not exactly the better solution, because it will hide all syntax errors of your code, but works perfectly for me. I still don't know what that line above means exactly, it just works.

I discover that by running pygments on command line and reading the output generated, like this (in my case I was working with html instead of Erlang):

pygmentize -f latex -O full -l html test.html
share|improve this answer
I found that the \expandafter invocation needs to not be in the preamble. –  Paul Stansifer Mar 29 '13 at 17:14
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.