0

I'm trying to prepare a beamer document using the matlab-prettifier package but I come across errors whenever I include a frame where I use code. I always get the following log:

! Missing \endcsname inserted.
<to be read again> 
               \relax 
l.2 ...atlab-editor, basicstyle=\mlttfamily,\tiny]

The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

! Extra \endcsname.
\KV@split ...csname \KV@prefix \@tempa \endcsname 
                                              \ifx \@tempc \relax \KV@er...
l.2 ...atlab-editor, basicstyle=\mlttfamily,\tiny]

I'm ignoring this, since I wasn't doing a \csname.


! Package keyval Error: \relax \fontsize {6}{7}\selectfont  undefined.

Here's a minimal example:

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage[framed,numbered]{matlab-prettifier}

\begin{document}

\begin{frame} [fragile]
\frametitle{STEP 2: Parameters extraction - application}
\begin{lstlisting}[style=Matlab-editor, basicstyle=\mlttfamily,\tiny]
par_out.T(1:r, 1:r*p)    = Eaa_FB(1:r, :)/Eaa_BB;
par_out.Q(1:r, 1:r)      = (Eaa(1:r, 1:r) - par_out.T(1:r, 
1:r*p)*Eaa_FB(1:r, :)')/m;
par_out.P0(1:r*p, 1:r*p) = Ps(1:r*p, 1:r*p, 1);

%% Idiosyncratic components
% Get kalman output and initialise estimation
for i=1:n   
ind_start  = r*p+1+(i-1)*q; 
ind_vec    = ind_start:ind_start+q-1;
as_i       = as(ind_vec, :);
Ps_i       = Ps(ind_vec, ind_vec, :);
PPs_lag1_i = PPs_lag1(ind_vec, ind_vec, :);
as_i_t     = as_i(:, 2:end);
as_i_t_1   = as_i(:, 1:end-1);
end 
\end{lstlisting}
\end{frame}    

\end{document}

1 Answer 1

0

Your problem is a simple comma that is not allowed there. Just use \mlttfamily\tiny.

\documentclass{beamer}
\usepackage[framed,numbered]{matlab-prettifier}

\begin{document}

\begin{frame} [fragile]
\frametitle{STEP 2: Parameters extraction - application}
\begin{lstlisting}[style=Matlab-editor, basicstyle=\mlttfamily\tiny]
par_out.T(1:r, 1:r*p)    = Eaa_FB(1:r, :)/Eaa_BB;
par_out.Q(1:r, 1:r)      = (Eaa(1:r, 1:r) - par_out.T(1:r, 
1:r*p)*Eaa_FB(1:r, :)')/m;
par_out.P0(1:r*p, 1:r*p) = Ps(1:r*p, 1:r*p, 1);

%% Idiosyncratic components
% Get kalman output and initialise estimation
for i=1:n   
ind_start  = r*p+1+(i-1)*q; 
ind_vec    = ind_start:ind_start+q-1;
as_i       = as(ind_vec, :);
Ps_i       = Ps(ind_vec, ind_vec, :);
PPs_lag1_i = PPs_lag1(ind_vec, ind_vec, :);
as_i_t     = as_i(:, 2:end);
as_i_t_1   = as_i(:, 1:end-1);
end 
\end{lstlisting}
\end{frame}    

\end{document}
2
  • Thank you!! The time I spent trying to fix this seems so stupid now :D
    – ladyp
    Jun 1, 2017 at 14:23
  • @ezgikurt If that solved your problem consider accepting the answer (green button on the left).
    – TeXnician
    Jun 1, 2017 at 14:29

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.