3

I want to add some math symbols into the escaped contents, minted works well for languages like Python, but not LaTeX. A sample code:

\documentclass{article}
\usepackage{minted}

\begin{document}

\begin{minted}[escapeinside=||]{latex}
|$\theta$|
\end{minted}

\begin{minted}[escapeinside=||]{py}
|$\theta$|
\end{minted}

\end{document}

The output is:

escapeinside doesn't work for latex

Any hint?

1
  • 1
    Neither mathescape works. – egreg Sep 4 '20 at 16:40
0

An awkward workaround:

\documentclass{article}
\usepackage{minted}

\begin{document}

\newcommand{\mytheta}{$\theta^2$}
\begin{minted}[escapeinside=||]{latex}
|this is \mytheta.|
\end{minted}

\begin{minted}[escapeinside=||]{py}
|$\theta$|
\end{minted}

\end{document}

The output is:

enter image description here

Still trying to find a better method...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.