# How to disable minted highlighting in tcolorbox's dispExample environment?

I'm now making a documentation of a small LaTeX package with documentation library from the tcolorbox package, and having difficulty in printing sample codes without any syntax highlighting.

According to G. Poore's answer, we can set the language as text to turn off the coloring, which can be specified via /tcb/minted language key. Thus, I tried to redefine the corresponding value like the following MWE (the first two are just for comparison).

\documentclass{article}
\usepackage[all]{tcolorbox}
\tcbset{listing engine=minted}
\begin{document}
\begin{tcblisting}{minted language=text}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{tcblisting}
\begin{dispExample}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{dispExample}
\tcbset{
fontlower=\normalsize,
minted language=text,
documentation minted options={
autogobble=true,
fontsize=\small
}
}
}
\begin{dispExample}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{dispExample}
\end{document}


Typesetting this with pdflatex -shell-escape gave me

As you can see, the option minted language=text seems to be invalid in the third box while other key-value settings (e.g., fontlower=\normalsize) works. Also, minted language=text is valid in the normal tcblisting environment.

How can I .add style the minted language key to the docexample style? What am I doing wrong?

I could have directly asked this question at Prof. Thomas F. Sturm's GitHub repository, but I use TeX.SX expecting more people will have a look.

Update:

Thanks to @egreg's answer, I found that my issue lies in the combination of tcolorbox and newtxtt (after some investigation, the same behaviour was confirmed with other monospaced fonts). Consider this MWE:

\documentclass{article}
\usepackage[all]{tcolorbox}
\usepackage{newtxtt}
\tcbset{
listing engine=minted,
fontlower=\normalsize,
minted language=latex,
documentation minted options={
autogobble=true,
fontsize=\small,
style=bw,
}
}
}
\begin{document}
\begin{dispExample}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{dispExample}
\end{document}


This gives control sequences in boldface, which I don't like, although style=bw is specified.

Monospaced fonts that reproduce this problem include

• Courier (\usepackage{courier}),
• DejaVu (\usepackage{dejavu}),
• Fira (\usepackage{firamono}),
• Incondolata (\usepackage{zi4}), and
• Source Code Pro (\usepackage{sourcecodepro}),

while Latin Modern and Droid don't trigger the problem.

Yet Another Update:

The second part of this question now has its own thread.

Currently, the documentation library assumes all (minted) texts to be of latex language. Therefore, minted language has deliberately no effect on dispExample environments.

Nevertheless, I take it as a feature request to make this configurable in the same way as documentation minted options.

The following patch introduces a new option documentation minted language which will be integrated into tcolorbox version 4.03 and higher:

\documentclass{article}
\usepackage[all]{tcolorbox}
\begin{document}

\makeatletter

\tcbset{
documentation minted language/.store in=\kvtcb@docminted@language,
documentation minted language=latex,
}

\def\tcb@minted@doc@usetemplisting{%
\tcb@minted@input@listing{\kvtcb@docmintoptions}{\kvtcb@docminted@language}{\kvtcb@tempfile}{\kvtcb@docmintstyle}%
}

\tcbset{listing engine=minted}

\makeatother

\begin{tcblisting}{minted language=text}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{tcblisting}

\begin{dispExample}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{dispExample}

\tcbset{
fontlower=\normalsize,
documentation minted language=text,
documentation minted options={
autogobble=true,
fontsize=\small
}
}
}

\begin{dispExample}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{dispExample}

\end{document}


• Thank you for your explanation and the patch works well also. Regarding the font weight problem, which still remains, I'll open another question with a reduced MWE later. – yudai-nkt Apr 24 '17 at 17:20

You want to pass style=bw to pygmentize:

\documentclass{article}
\usepackage[all]{tcolorbox}
\tcbset{
listing engine=minted,
fontlower=\normalsize,
minted language=latex, % <--------
documentation minted options={
autogobble=true,
fontsize=\small,
style=bw, % <-------
}
}
}
\begin{document}

\begin{dispExample}
$$\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}$$
\end{dispExample}

\end{document}


• I know the style key but it didn't give me a desired result neither. My actual case is like this, where some control sequences are in boldface. This is why I next tried the minted language. That being said, your code works on my end as well. I'll update the question after investigating a true cause and making a new MWE. – yudai-nkt Dec 28 '16 at 12:59
• I updated the question. – yudai-nkt Dec 28 '16 at 13:20