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 use the tocloft package to design the Table of Contents. I wanted to add the word Part before the numbers of parts in TOC (f.e. using \cftpartpresnum), but I want to add it only for numbered parts. For example I want to have:

Intro ..... 1
Part I Lalala ...2
Part II Lalalala...4
Conclusion ....6

Is it possible? \cftpartpresnum adds to all parts.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Probably not the most elegant way: Add appropriate redefinitions of \cftpartpresnum to the .toc file using the \addtocontents macro. (Note: I'm using the tocvsec2 package to add unnumbered parts to the ToC.)

\documentclass{book}

\usepackage{tocloft}
\usepackage{tocvsec2}

\begin{document}

\setsecnumdepth{none}
\addtocontents{toc}{\protect\renewcommand{\protect\cftpartpresnum}{}}

\tableofcontents

\part{Intro}

\resetsecnumdepth
\addtocontents{toc}{\protect\renewcommand{\protect\cftpartpresnum}{\partname~}}

\part{First part}

\part{Second part}

\setsecnumdepth{none}
\addtocontents{toc}{\protect\renewcommand{\protect\cftpartpresnum}{}}

\part{Conclusion}

\end{document}
share|improve this answer
    
Thank you for the answer! Unfortunately, I can not make it, I copy-paste into LaTex and it gives the following error: "Undefined control sequence \resetsecnumdepth"... –  Natalia Oct 13 '11 at 21:00
    
@Natalia: You have to load the tocvsec2 package. –  lockstep Oct 14 '11 at 5:21
    
Thank you!!! It works on my desktop at work, don't know why it did not work yesterday at my laptop. But here I have been already using the \tocvsec2 package (following your advise with \minitoc). Should I download manually \tocvsec2 in such case to my laptop? where should i copy it? –  Natalia Oct 14 '11 at 8:57
    
@Natalia: See tex.stackexchange.com/questions/1137/… –  lockstep Oct 14 '11 at 15:14
    
Thank you for your help! –  Natalia Oct 15 '11 at 9:17

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.