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.

With the following example, I get a different vertical distance between "Contents" and "1 bar 5" and "foo" and "Lorem". How do I get the first entry of the TOC to the same height as "Lorem ipsum", that is the base line should be the red rule in the image below:

enter image description here

\documentclass{book}
\begin{document}
\tableofcontents

\chapter*{foo}
Lorem ipsum

\chapter{bar}
Lorem ipsum 

\end{document}
share|improve this question

1 Answer 1

up vote 4 down vote accepted

The command \l@chapter in book.cls typesets the chapter entry in the table of contents. It adds 1.0 em vertically before the entry. So, to remove that space before the first entry, you could redefine that macro or add a negative vertical skip before you start the first chapter, such as

\addtocontents{toc}{\vskip -1.0em}
\tableofcontents
\chapter*{foo}

Actually, the macro contains also a glue of 1 pt. From book.cls:

\newcommand*\l@chapter[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \vskip 1.0em \@plus\p@
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
      \penalty\@highpenalty
    \endgroup
  \fi}
share|improve this answer

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.