I'm trying to add MATLAB code to a beamer presentation, but using matlab-prettifier
package numbering isn't showing. Does anybody knows why this is happening?
I'm not even sure that using matlab-prettifier
is the best option, but I wasn't able to use matlab-prettifier
or anything else. If someone has a better option to add MATLAB code on a beamer presentation, please tell me.
This is what I wrote:
\documentclass{beamer}
\usetheme{Boadilla}
\title{Titolo Presentazione}
\subtitle{Sottotitolo Presentazione}
\author{Author}
\institute{Università di Pisa}
\date{\today}
\usepackage{listings}
\usepackage[framed,numbered]{matlab-prettifier}
\begin{document}
\begin{frame}[fragile]
\frametitle{MATLAB code}
{\fontencoding{T1}\selectfont
\begin{lstlisting}[
style=Matlab-editor,
basicstyle=\mlttfamily,
]
% create a file for output
!touch testFile.txt
fid = fopen('testFile.text', 'w')
for i=1:10
fprintf(fid,'%6.2f \n', i);
end
\end{lstlisting}
}
\end{frame}
\end{document}