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?

• Do you have some code for us to work on? Please post it.
– user11232
Oct 22, 2014 at 15:53
• This is the .cls file we've been instructed to use, followed by the example .tex file we were given. Does that help? semanticweb.cs.vu.nl/KM2011/Files/acm_proc_10ptArticle-sp.cls semanticweb.cs.vu.nl/KM2011/Files/sigproc-sample.tex Oct 22, 2014 at 15:55
• We need a minimal working example (MWE) so that we need not try to recreate the scenario.
– user11232
Oct 22, 2014 at 15:57
• BTW, Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
– user11232
Oct 22, 2014 at 15:57
• Thanks Harish, I have updated to reflect hopefully as much information as I can. I did not create the .cls file myself, so I would not know where to look if that is what I need to modify. Oct 22, 2014 at 17:52

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:

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