Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I changed my documentclass from report to amsbook (from AMSLaTeX) and everything was fine. Then I decided to change it back to the report document class, but it will not compile. In order for it to compile, I am forced to comment out the \tableofcontents command. It gives the error message undefined control sequence. Any help would be much appreciated.

share|improve this question
10  
Remove all auxiliary files and compile again. –  lockstep Apr 11 '12 at 20:02
add comment

1 Answer

Let's see what happens when we compile the following file

\documentclass{report}
\begin{document}
\tableofcontents
\chapter{Title}
\section{X}
\end{document}

Here's the contents of the .toc file:

\contentsline {chapter}{\numberline {1}Title}{2}
\contentsline {section}{\numberline {1.1}X}{2}

When we change the first line of the file to be

\documentclass{amsbook}

the .toc file becomes

\contentsline {chapter}{\tocchapter {Chapter}{1}{Title}}{3}
\contentsline {section}{\tocsection {}{1}{X}}{3}

Thus we see that the amsbook class inserts some commands (\tocchapter and \tocsection) which are not understood by the standard class report; moreover it organizes the information in a slight different way.

One should also observe that the AMS classes are incompatible with tocloft, for a similar reason: they manage the .toc file in a different way.

Solution

Remove the .toc file before compiling after having changed the class. This is a good thing to do in such circumstances with all auxiliary files, so that we start afresh with the new document class.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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