[texhax] listings causing: Command invalid in math modeCommand invalid in math mode
Jeremy C. Reed
reed at reedmedia.net
Wed Apr 15 15:47:35 CEST 2009
I am using listings package version 1.3 as available in teTeX-texmf-3.0.
(pkgsrc packages teTeX-texmf-3.0nb5 and teTeX-bin-3.0nb14)
My document (the final PDF) has:
11Command invalid in math modeCommand invalid in math mode
Doesn't say what command. My logging has:
%%%%%%%%%%%%%%%%%%
LaTeX Font Info: ... okay on input line 10.
! Missing \endcsname inserted.
<to be read again>
\relax
l.12 \begin{lstlisting}{basicstyle=\footnotesize}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Extra \endcsname.
\lst at SetFirstNumber ...no@\lst at intname \endcsname
\relax \ifnum \@tempcnta
=...
l.12 \begin{lstlisting}{basicstyle=\footnotesize}
I'm ignoring this, since I wasn't doing a \csname.
! Missing \endcsname inserted.
<to be read again>
\relax
l.17 \end{lstlisting}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Extra \fi.
\lst at SaveFirstNumber ...@ \else @\lst at intname \fi
\endcsname {\the
\c at lstnum...
l.17 \end{lstlisting}
I'm ignoring this; it doesn't match any \if.
! Extra \endcsname.
\lst at SaveFirstNumber ...st at intname \fi \endcsname
{\the \c at lstnumber }
l.17 \end{lstlisting}
I'm ignoring this, since I wasn't doing a \csname.
! Missing \endcsname inserted.
<to be read again>
\relax
l.21 \begin{lstlisting}{basicstyle=\footnotesize}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Extra \endcsname.
\lst at SetFirstNumber ...no@\lst at intname \endcsname
\relax \ifnum \@tempcnta
=...
l.21 \begin{lstlisting}{basicstyle=\footnotesize}
I'm ignoring this, since I wasn't doing a \csname.
! Extra \fi.
\lst at SetFirstNumber ...\@tempcnta \relax }\fi \fi
l.21 \begin{lstlisting}{basicstyle=\footnotesize}
I'm ignoring this; it doesn't match any \if.
! Missing \endcsname inserted.
<to be read again>
\relax
l.24 \end{lstlisting}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Extra \fi.
\lst at SaveFirstNumber ...@ \else @\lst at intname \fi
\endcsname {\the
\c at lstnum...
l.24 \end{lstlisting}
I'm ignoring this; it doesn't match any \if.
! Extra \endcsname.
\lst at SaveFirstNumber ...st at intname \fi \endcsname
{\the \c at lstnumber }
l.24 \end{lstlisting}
I'm ignoring this, since I wasn't doing a \csname.
[1
%%%%%%%%%%%%%%%%%%
I can reproduce this when I have two lstlisting blocks that define a
custom basicstyle. So my workaround is to simply change one of them to:
\begin{lstlisting}{basicstyle=\footnotesize}
to:
\begin{lstlisting}
Here is a minimum example for me to reproduce this problem:
%%%%%%%%%%%%%%%%
%&LaTeX
\documentclass{article}
\usepackage{listings}
\lstset{
columns=fixed
}
\begin{document}
\begin{lstlisting}{basicstyle=\footnotesize}
A B C
9 8 7
6 5 4
D E F
\end{lstlisting}
TEXT HERE
\begin{lstlisting}{basicstyle=\footnotesize}
this is a test
ofth ee m ergency
\end{lstlisting}
\end{document}
%%%%%%%%%%%%%%%%
I assume I am using this wrong, but I have found examples like that and
also I thought that is what I read in the Listings package documentation.
The above generates (copy and paste from xpdf):
%%%%%%%%%%%%%%%%%%
A B C
9 8 7
6 5 4
D E F
5
TEXT HERE
Command invalid in math modeCommand invalid in math mode
this is a test
ofth ee m ergency
3
%%%%%%%%%%%%%%%%%%
I do not know where the "5" and "3" come from or the repeated error
message. Also notice how at the "5" and later it is indented.
Any suggestions?
I don't want to set the smaller font size for all listings.
Maybe listings package is not what I need. I want simply to have verbatim
text to be in the same font as the rest of my document while keeping a
fixed spacing (for formatting).
Also I could accept using the default font size in the listings (no
\footnotesize) if the fixed text in there didn't wrap.
Thank you,
Jeremy C. Reed
echo 'EhZ[h ^jjf0%%h[[Zc[Z_W$d[j%Xeeai%ZW[ced#]dk#f[d]k_d%' | \
tr '#-~' '\-.-{'
More information about the texhax
mailing list