listings 包的 \lstlistoflistings 命令生成错误

listings 包的 \lstlistoflistings 命令生成错误

使用 LaTeX 处理以下 .tex 文件:

\documentclass{amsart}
\usepackage{listings}
\begin{document}

\begin{lstlisting}[caption={An example}]
Hello, world!
\end{lstlisting}

\lstlistoflistings

\end{document}

导致以下错误:

ERROR: Undefined control sequence.

--- TeX said ---
\@dottedtocline ... \hbox {$\m@th \mkern \@dotsep 
                                                  mu\hbox {.}\mkern \@dotsep...l.1 ...lstlisting}{\numberline {1}An Example}{1}

--- HELP ---
TeX encountered an unknown command name. You probably misspelled the
name. If this message occurs when a LaTeX command is being processed,
the command is probably in the wrong place---for example, the error
can be produced by an \item command that's not inside a list-making
environment. The error can also be caused by a missing \documentclass
command.

当该\lstlistoflistings行被注释掉时,文件编译成功。

相关内容