Red box drawn around question-mark operator in minted Erlang code

In my case, the solutions above does not work. I was trying to print the following Python 3 line, using minted 2.1:

>>> print("Instalação!")
Instalação!

I ended by disable the color boxes around "çã" e "!", by inserting in the preamble:

\AtBeginEnvironment{minted}{%
  \renewcommand{\fcolorbox}[4][]{#4}}

This solution I found here.


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

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.