Processing the following .tex file with LaTeX:


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



results in the following error:

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

When the \lstlistoflistings line is commented out, the file compiles successfully.

  • 2
    Looks like some leftovers from the previous latex runs. Remove all the generated auxiliary files and run latex again. May 22, 2017 at 12:56
  • Though looks like \lstlistoflistings uses some macros which aren't defined in the amsart document class. If you define \@dotsep (as \def\@dotsep{4.5} for example) then it starts working again. May 22, 2017 at 13:13
  • 2
    \@dotsep, not \@dostep. This works: \makeatletter \def\@dotsep{4.5} \makeatother May 22, 2017 at 13:24
  • 2
    It's distance between two consecutive dots in a TOC line. Apparently it isn't defined in answer. Might be because it doesn't use dotted TOCs. May 22, 2017 at 13:32
  • 1
    @SergeiGolovan -- you've got the right answer. please post it as an answer. (you can add the note that toc lines in amsart are not dotted by default.) Jun 3, 2017 at 21:09


You must log in to answer this question.

Browse other questions tagged .