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}
\begin{equation}
\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}
\end{equation}
\end{tcblisting}
\begin{dispExample}
\begin{equation}
\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}
\end{equation}
\end{dispExample}
\tcbset{
docexample/.add style={}{
fontlower=\normalsize,
minted language=text,
documentation minted options={
autogobble=true,
fontsize=\small
}
}
}
\begin{dispExample}
\begin{equation}
\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}
\end{equation}
\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 (after some investigation, the same behaviour was confirmed with other monospaced fonts).
Consider this MWE:newtxtt
\documentclass{article}
\usepackage[all]{tcolorbox}
\usepackage{newtxtt}
\tcbset{
listing engine=minted,
docexample/.add style={}{
fontlower=\normalsize,
minted language=latex,
documentation minted options={
autogobble=true,
fontsize=\small,
style=bw,
}
}
}
\begin{document}
\begin{dispExample}
\begin{equation}
\int_{-\infty}^{\infty} \exp (-x^2) \, dx = \sqrt{\pi}
\end{equation}
\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.



