我正在尝试运行 Beamer 以获取演示文稿中的列表。我收到了一条神秘的错误消息,如下所示:
! Missing number, treated as zero.
<to be read again>
\let
l.221 \end{frame}
? H
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
我的问题部分在于我的代码中没有 \let,这肯定是宏的扩展。我立即想到的问题是“当 TeX 遇到错误时,我如何才能让它告诉我它正在扩展哪些宏?”这可能会给我一些线索,让我知道下一步该怎么做。
更多背景:我正在尝试在 Beamer 中使用 json 对象的算法列表。
我的标题中有以下内容定义:
\usepackage{algorithmicx}
\usepackage{algorithm}
\floatname{algorithm}{Example}
%--------------------------------------------
%JSON listing mode, from
% https://tex.stackexchange.com/questions/83085/how-to-improve-listings-display-of-json-files#83100
\usepackage{listings}
\usepackage{xcolor}
\colorlet{punct}{red!60!black}
\definecolor{background}{HTML}{EEEEEE}
\definecolor{delim}{RGB}{20,105,176}
\colorlet{numb}{magenta!60!black}
\lstdefinelanguage{json}{
basicstyle=\normalfont\ttfamily,
numbers=left,
numberstyle=\scriptsize,
stepnumber=1,
numbersep=8pt,
showstringspaces=false,
breaklines=true,
frame=lines,
backgroundcolor=\color{background},
literate=
*{0}{{{\color{numb}0}}}{1}
{1}{{{\color{numb}1}}}{1}
{2}{{{\color{numb}2}}}{1}
{3}{{{\color{numb}3}}}{1}
{4}{{{\color{numb}4}}}{1}
{5}{{{\color{numb}5}}}{1}
{6}{{{\color{numb}6}}}{1}
{7}{{{\color{numb}7}}}{1}
{8}{{{\color{numb}8}}}{1}
{9}{{{\color{numb}9}}}{1}
{:}{{{\color{punct}{:}}}}{1}
{,}{{{\color{punct}{,}}}}{1}
{\{}{{{\color{delim}{\{}}}}{1}
{\}}{{{\color{delim}{\}}}}}{1}
{[}{{{\color{delim}{[}}}}{1}
{]}{{{\color{delim}{]}}}}{1},
}
Beamer 文件中框架的代码是:
\begin{frame}{Proc4 Messages}
\begin{columns}
\begin{column}{0.5\textwidth}
\begin{algorithm}
\begin{lstlisting}[language=json]
{
app:"ecd://coe.fsu.edu/EPLS/AssessmentName",
uid:"Student/User ID",
timestamp:"Time at which event occurred",
verb:"Action Keyword",
object:"Object Keyword",
data:{
field1:"Value",
field2:["list","of","values"],
field3:{part1:"complex",part2:"object"}
}
}
\end{lstlisting}
\end{algorithm}
\end{column}
\begin{column}{0.5\textwidth}
\begin{itemize}
\item Application header defines vocabulary used in other
fields.
\item ...
\item Data field can hold any number/kind of object.
\end{itemize}
\end{column}
\end{columns}
\end{frame}
相同的列表在另一个使用 article 而不是 beamer 样式的文档中运行良好,并且框架的其余部分非常标准。
答案1
事实证明,这与在 https://stackoverflow.com/questions/2981008/latex-issue-with-beamer-and-listings
如果我改变\begin{frame}{title...}
它,\begin{frame}[containsverbatim]{title...}
它就会按预期工作。