TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to design the table of contents aligned to a vertical line near the center of the page. The chapter and section titles need to be flushright, the numbers flushleft, and between titles and numbers, I'd like to place a separating element. It can be done easily by a tabular:

First section title & \textbullet & 27 \tabularnewline

You can see the result of the code above on this image:

But how can I build a tabular with the LaTeX \tableofcontents command? What commands do I need to redefine? After some googling I haven't found any ready solution.

share|improve this question
up vote 7 down vote accepted

For the chapter insert any symbol you like, instead of the \Large\textbullet

\renewcommand*\l@chapter   [2]{\par\MBox{\bfseries\Large#1}{\Large\textbullet}{#2}{5pt}}
\renewcommand*\l@section   [2]{    \MBox{\bfseries\large#1}{\textbullet}{#2}{2pt}}
\renewcommand*\l@subsection[2]{    \MBox{\bfseries      #1}{\textbullet}{#2}{1pt}}


\chapter{First Chapter}
\section{An extraordinary long section title which should have a linebreak
         in the table of contents}


enter image description here

share|improve this answer
wonderful, thanks! i have never thought that it's so simple. – deeenes Mar 2 '11 at 22:04
  • Redefine \tableofcontents to produce the tabular environment

  • Redefine \l@chapter, \l@section etc. to produce the rows of the table. These macros take two arguments. Use makeatletter and \makeatother.

Have a look into the source of your document class, where all mentioned macros are defined. The source is on your local drive, use your search feature or kpsewhich to locate it, such as

kpsewhich book.cls

at the command prompt. On Linux, I often directly use it like

gedit `kpsewhich book.cls`

Actually, I made a shell function for that, to ease the frequent access of source code.

share|improve this answer
thank you! maybe i'll try also this way, because the vertical centering of the numbers in the case of section titles wrapped to more line. – deeenes Mar 2 '11 at 22:06

Your Answer


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.