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 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?

share|improve this question
1  
Which document class are you sing? –  Gonzalo Medina Dec 11 '11 at 18:20

2 Answers 2

up vote 12 down vote accepted

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}​
share|improve this answer
    
Thank you again, it is exactly what I needed.. –  Yetty Dec 11 '11 at 18:27
    
you might want to also include a \mathboth statement after the section command so to get running headers for any followup pages (if the TOC is long). –  Frank Mittelbach Dec 19 '11 at 17:09
4  
I'm too slow for this system it doesn't allow me to correct my comments after 5 min ... this should have come first: @Werner For the sake of separating document structure from document layout I would recommend to redefine \tableofcontents to include both \section* and the multicols environment. Then your source stays clean and you only have additions/changes in the preamble. –  Frank Mittelbach Dec 19 '11 at 17:17
    
@FrankMittelbach: Thanks - good and clean suggestion! –  Werner Dec 19 '11 at 18:10

For a ToC in multiple columns you can simply use the multitoc package.

\documentclass[11pt,english]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[margin=1in]{geometry}
\usepackage[toc]{multitoc}
\usepackage{blindtext}

\begin{document}
  \tableofcontents

  \Blinddocument
\end{document} 
share|improve this answer
    
This is much simpler than the accepted answer. –  Mk12 May 20 '13 at 15:14
    
The package conflicts with the tocbasic package from KOMA-script. Which is not that surprising... –  Keks Dose Apr 16 at 16:08

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.