[Tex/LaTex] Define \tableofcontents in document class that doesn’t support it

document-classestable of contents

I'm required to use the sigchi document class for a paper: https://github.com/sigchi/Document-Formats/blob/master/LaTeX/sigchi.cls

I'm also required to include a table of contents on the first page, but using the standard \tableofcontents produces a stack overflow:

TeX capacity exceeded, sorry [input stack size=5000].
\@latexerr #1#2->\GenericError

Turns out a table of contents is usually prohibited in this template, as seen in the .cls file:

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

If I comment out this bit from the .cls file, I get an undefined control sequence error.

I guess, then, that the \tableofcontents command needs to be explicitly defined by a document class? In my case, it isn't. How do I add it? Would I be able to grab the source of the command definition from a standard article document class and stick it into my sigchi.cls? Or is there a package I could use?


Here's a MWE with just a few sections. This will not compile as soon as you add a \tableofcontents.



\section{First section}

\section{Second section}


Best Answer

The sigchi.cls is not meant for a thesis, it misses several features necessary for typesetting a thesis (or has redefined it strangely)

The easiest way is to use a 'copy' of the \tableofcontents version provided by article.cls

Please note that the page layout is awkward, but this is another question too.


% Perhaps useful?

\newcommand{\contentsname}{Contents}% For example

% sigchi.cls does \let\thepage\relax (don't ask!), so define it again


\section{First section}

\section{Second section}

Related Question