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'm currently writing a LaTeX document in the book documentclass. In my ToC I want the actual titles of certain entries (parts in my case) to come in a newline after a generic name of the section-type ('Part') followed by the number ('I', 'II', ...), so it should look like this:

Part I

Title of first part

Part II

Title of second part

I'm using the tocloft package to customize the ToC and its manual actually has an example that excactly describes how to achieve this. Apparently, for whatever reason, the newline command (see MWE) has no effect with the book class. Any suggestions on what is the problem here?

\documentclass{book}
\usepackage{tocloft}
\renewcommand{\cftpartpresnum}{\partname\ }
\renewcommand{\cftpartaftersnumb}{\\ }
\begin{document}
  \tableofcontents
  \part{Title of first part}
  \part{Title of second part}
\end{document}

EDIT 1: I've followed @locksteps advice and tried to implement a solution with the titletocpackage. However, now I'm stuck with the problem that for part entries for whatever reason the lablenummer is always attached to the actual title, for chapter and so on one can call the label independently

\documentclass{book}
\usepackage{titletoc}
\titlecontents{part}[0pt]{}{}{\Large\bfseries Part\\*}{}[]
\titlecontents{chapter}[0pt]{}{Chapter \thecontentslabel\\*}{}{}[]
\begin{document}
   \tableofcontents
   \part{The first part}
   \chapter{The first chapter}
\end{document}
share|improve this question
add comment

2 Answers

toclofts \cftXaftersnumb macro family doesn't work for X = part in the book class. Quoting from the tocloft manual, p. 9:

In the standard classes the ToC entry for a \part is just typeset as the number and title, followed by the page number, with the \cftpartpresnum macro being called before typesetting the number and title. When a standard class is used the \cftpartaftersnum and \cftpartaftersnumb macros have no effect, but they may do something if a non-standard class is used.

share|improve this answer
    
Oh...I missed this one completly, explains a lot. I guess there is no 'easy' workaround? –  Paul Hanson Oct 31 '11 at 19:03
    
@PaulHanson: Probably not (though I'd like to be proved wrong). Have a look at the titletoc package. –  lockstep Oct 31 '11 at 19:08
    
Thank you for the tip –  Paul Hanson Nov 1 '11 at 22:35
    
I've played around with titletoc but without success, see my edited question –  Paul Hanson Nov 19 '11 at 0:28
    
If you prefer to use the tocloft package, you might try using the KOMA scrbook class and/or titlesec as I suggested in my answer. This might be enough to get \cftpartaftersnum and \cftpartaftersnumb back into the game. –  mforbes Nov 19 '11 at 1:28
show 1 more comment

The problem is that the way the standard classes send information to the ToC is different for parts and chapters. This is discussed in the titletoc documentation: To get a consistent behaviour for parts you need to redefine the \part command.

One way is to use a different document class like the KOMA scripts scrbook. Another is to use the titlesec package with the newparttoc option and issue one of the commands that redefines \part (like \titleformat). The second option is shown below in the commented region:

\documentclass{scrbook}

% If you really want the standard book class, uncomment the following:
%\documentclass{book}
%\usepackage[newparttoc]{titlesec}
%\titleformat{\part}[display]{\center\normalfont\huge\bfseries}
%                            {\partname\ \thepart}{20pt}{\Huge} 
\usepackage{titletoc}
\titlecontents{part}[0pt]{}{\Large\bfseries Part \thecontentslabel\\*}
                           {\Large\bfseries Unnumbered Part\\*}{}[]
\titlecontents{chapter}[0pt]{}{Chapter \thecontentslabel\\*}
                              {Unnumbered Chapter\\*}{}[]
\begin{document}
  \tableofcontents
  \part{The first part}
  \chapter{The first chapter}
\end{document}
share|improve this answer
add comment

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.