I've just started using matlab-prettifier
. Since the line \begin{lstlisting}[style=Matlab-editor]
is a lot to type, I created my own environment:
\newenvironment{myMP}
{\begin{samepage}\begin{lstlisting}[style=Matlab-editor]}
{\end{lstlisting}\end{samepage}}
I've used this syntax many times before, but in this case it doesn't work. Is there any reason why I can't enclose the lstlisting
inside my own one?
Here's sample code, illustrating the problem.
\documentclass{minimal}
\usepackage[framed]{matlab-prettifier}%For matlab code
\newenvironment{myMP}
{\begin{samepage} \begin{lstlisting}[style=Matlab-editor]}
{\end{lstlisting} \end{samepage}}
\begin{document}
\begin{myMP}
matlab word
\end{myMP}
\end{document}
When I run this with pdflatex
it returns a *, indicating that the environment wasn't closed properly.
Thanks!