I have a presentation that I would like to include some matlab code in. For that purpose I have included the mcode package, that basically configures the listings package. My problem is that the environment mode does not work inside a frame.
When I run the code below as it is (or with article documentclass) everything is as expected.
\documentclass{beamer}
\usepackage[framed,autolinebreaks,useliterate]{mcode}
\begin{document}
%\begin{frame} % code breaks if I include theese
\begin{lstlisting}
for i = 1:3
disp('cool'); % comment with some §\mcommentfont\LaTeX in it: $\mcommentfont\pi x^2$§
end
\end{lstlisting}
%\end{frame} % code breaks if I include theese
\end{document}
If I uncomment the begin/end frame lines I get the following error:
Runaway argument?
! File ended while scanning use of \lst@next
! Emergency stop
! ==> Fatal error occurred, no output PDF file produced!
The same happens if I use \frame{...} instead of \begin{frame}...\end{frame}.
[fragile]should help. – Claudio Fiandrino Feb 28 '14 at 14:56matlab-prettifierpackage instead ofm-code. – jub0bs Feb 28 '14 at 15:56