1

The result of an escapeinside in minted is typeset as-is, and not fed into the lexer. This is by design, as I understand. How can I change minted's behavior so that the result of the escapeinside is lexed together with the rest of the code?

In other words, how can I generate source code dynamically and feed it into the lexer?

Example:

\documentclass{article}
\usepackage{minted}
\begin{document}
\newcommand{\something}{bbb}
\begin{minted}[escapeinside=||]{mask}
aaa|\something|aaa
aaabbbaaa
\end{minted}
\end{document}

generates two different lines, whereas I would like it to generate twice exactly the same line:

enter image description here

From the above code (first line), minted generates the fancyvrb line

\PYG{n+nt}{aaa}\PYG{esc}{\something}\PYG{n+nt}{aaa}

whereas what I want is the \something command inside the \PYG call, something like

\PYG{n+na}{aaa\something{}aaa}

Your Answer

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

Browse other questions tagged or ask your own question.