[Tex/LaTex] Table of contents without title

multicolsectioningtable of contents

I would like to have two-columned table of contents:

    \begin{multicols}{2}
          \tableofcontents
    \end{multicols}

But it looks wierd if I have a title included in two columns – second column is above the title. So I would like to have something like that:

    \section*{My content}
    \begin{multicols}{2}
          % table of contents without title
          \tableofcontents
    \end{multicols}

Is there any way to do this?

Best Answer

The article document class defined \tableofcontents as

\newcommand\tableofcontents{%
    \section*{\contentsname
        \@mkboth{%
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
    \@starttoc{toc}%
    }

This prints both the \contentsname as a \section* and marks the headers, after which it typesets the actual ToC (via \@starttoc{toc}). If you forego the header adjustments, merely renewing the \tableofcontents command to

\renewcommand{\tableofcontents}[1][\contentsname]{%
  \section*{#1}
  \begin{multicols}{2}
    \@starttoc{toc}
  \end{multicols}
}

would suffice. This typesets a \section* with the contents name provided as an optional argument (default is \contentsname, which is Contents in article). Afterwards, if starts a two-column multicol environment and inserts the ToC. Here's a minimal example:

enter image description here

\documentclass{article}
\usepackage{multicol}% http://ctan.org/pkg/multicol
\makeatletter
\renewcommand{\tableofcontents}[1][\contentsname]{%
  \section*{#1}
  \begin{multicols}{2}
    \@starttoc{toc}
  \end{multicols}
}
\makeatother
\begin{document}
\tableofcontents[Table of Contents]
\section{First section}%
\subsection{First subsection}%
\subsection{Second subsection}%
\subsection{Third subsection}%
\subsection{Last subsection}%
\section{Second section}%
\subsection{First subsection}%
\subsection{Second subsection}%
\subsection{Third subsection}%
\subsection{Last subsection}%
\section{Last section}%
\subsection{First subsection}%
\subsection{Second subsection}%
\subsection{Third subsection}%
\subsection{Last subsection}%
\end{document}​