5

I'm trying to do a minted \newenvironment I looked at this post new-environment-with-minted, but I would like to know if there's a more simple way to do that, like

\newenvironment{matlabcode}
        {\begin{minted}[mathescape,linenos=true]{matlab}}
        {\end{minted}}

In that case, I get a FancyVerbGetLine error As I know, it seems that I should use \CustonVerbatimEnvironment

PerroNoob
  • 641
  • 9
  • 23

2 Answers2

6

Simply use the \newminted command as introduced in Section 6 of the »minted« manual.

\newminted{matlab}{mathescape,linenos=true}

You can use it in the same way as every other environment.

\begin{matlabcode}
% listing content
\end{matlabcode}

Note that the package will append code to the environment name by default as described in the manual.

  • Oh, thanks a lot! I usually I get lost in the manuals with so much information. I'll take a look to that sections :) – PerroNoob Oct 16 '13 at 18:26
4
\newminted{matlabcode}{mathescape,linenos}

\begin{matlabcode}
...
\end{matlabcode}