1

I am using the minted package to display LaTeX commands in my LaTeX courses.

I noticed, that minted uses two different colors, depending on text or math mode.

Compare the output of this MWE:

\documentclass{scrartcl}
\usepackage{minted}
 
\begin{document}
\mintinline{latex}{$\sin \alpha$} vs. \mintinline{latex}{\sin \alpha}.

It would be nice, if output of \mintinline[mode=math]{latex}{\sin \alpha} 
would be in blue color,  as in \mintinline{latex}{$\sin \alpha$}.
\end{document}

This is the result: different colors used by minted based on text or math mode

Is there any way, to provide an option or something similar to the minted-commands, that ensure, that minted uses the math mode colors but without showing the $ in the output?

1 Answer 1

2

You can kind of cheat by utilizing the different styles that are available for minted. For example, setting [style=borland] provides you with a nice blue colour on what is technically a text example, but for your display purposes coloured in blue as math:

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

\mintinline{latex}{$\sin \alpha$}  

\mintinline{latex}{\sin \alpha}

\mintinline[style=borland]{latex}{\sin \alpha} 

\end{document}

enter image description here

2
  • Kind of an idea :-) Unless I feel, I want to change the color scheme. But thank you very much for this suggestion. Why didn't I think of that?
    – Jan
    Apr 22, 2021 at 7:05
  • @Jan Well, then you'd just have to pick two "reverse" schemes. :p
    – Plergux
    Apr 22, 2021 at 7:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .