# Red box around characters when using escapeinside option with minted

I'm trying to typeset Elixir code using minted. I run into problems when I want to color a custom keyword. More in particular, I run into errors when I use the escapeinside option.

As soon as I pass the escapeinside option to the minted listing every right-hand curly brace is outlined by a red box, even when I'm not actually escaping text in the source code. Below is a MWE and a screenshot of the output.

I have tried passing in multiple delimiters: |, \#, \%, <an actual backtick> and so on. But all of them cause the red outlining on curly braces. I also tried ruby as language, and that seems to work fine. Although not every keyword is highlighted properly in that case.

Is there perhaps another approach to this? I'm going to assume that when I submit this paper I will have no control over the pygments version or the compiler they use, so any modification on that end is not an option.

## Input

\documentclass{article}
\usepackage{minted}
\begin{document}

\begin{figure}[htb]
\begin{minted}{elixir}
def foo() do
{:bar, :baz}
end
\end{minted}
\end{figure}

\definecolor{wgreen}{HTML}{158915}
\begin{figure}[htb]
\begin{minted}[escapeinside=||]{elixir}
|\textcolor{wgreen}{\textbf{customkeyword}}| foo() do
{:bar, :baz}
end
\end{minted}
\end{figure}

\end{document}


## Output

• Related: Minted red box around greek characters. The red box represents a highlighting error and is produced by \fcolorbox. Hence the workaround is to redefine \fcolorbox inside minted environment. – muzimuzhi Z Sep 19 '20 at 22:35