2

I have been instructed to use the ACM style latex template for an assignment. In the .cls file they provide, I can find the following warning:

%%% 4) Marginal paragraphs, tables of contents, lists of figures and tables,

%%% and page headings are all forbidden.

Even though we have been instructed to use the ACM template, however silly it may be, we are required to insert a table of contents.

I attempt to add \tableofcontents as follows:

\documentclass{acm_proc_10ptArticle-sp}
\begin{document}
\clearpage
\tableofcontents
\newpage
\section{Introduction}
Lipsum
\section{Conclusion}
Lipsum
\end{document}

When I compile, I receive the following error:

! TeX capacity exceeded, sorry [input stack size=5000].
\@latexerr #1#2->\GenericError 
                              {\space \space \space \@spaces  \@spaces \@spa...
l.38 \tableofcontents

If you really absolutely need more capacity,
you can ask a wizard to enlarge me.

Additionally, i find the following section in the .cls file:

\def\tableofcontents{\@latexerr{\tableofcontents: Tables of contents are not
 allowed in the `acmconf' document style.}\@eha}

I was hoping to find a solution for this without having to use a different template file. Is there anything I can do to add a table of contents regardless of their warning?

5

1 Answer 1

4

The .cls file you provided defines \tableofcontents to produce an error message (the class designers really wanted to discourage producing a ToC):

\def\tableofcontents{\@latexerr{\tableofcontents: Tables of contents are not
  allowed in the `acmconf' document style.}\@eha}

You can override this by providing (in your .tex file) a sensible definition for \tableofcontents; something along the lines

\def\contentsname{Contents}
\def\tableofcontents{%
    \section*{\MakeUppercase{\contentsname}}%
    \@starttoc{toc}%
    }

A complete example:

\documentclass{acm_proc_10ptArticle-sp}

\makeatletter
\setcounter{tocdepth}{3}
\def\contentsname{Contents}
\def\tableofcontents{%
    \section*{\MakeUppercase{\contentsname}}%
    \@starttoc{toc}%
    }
\makeatother

\begin{document}

\tableofcontents
\section{Introduction}
Lipsum
\section{Conclusion}
Lipsum

\end{document}

The result, showing the generated ToC:

enter image description here

1
  • This was it! So simple. Thank you! I would upvote, but it seems I don't have enough reputation.
    – Bastronaut
    Oct 22, 2014 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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