4

I would like to add "Partie" before the part's number it only appears in the text and not in the table of contents. It works for sections, subsections etc. but not part with renew command.

This is the MWE:

\documentclass[12pt,a4paper]{report}
\usepackage[utf8x]{inputenc}
\usepackage{ucs}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\author{...}
\usepackage{setspace}
\setcounter{secnumdepth}{5}
\usepackage{tocloft}
\makeatletter
\@addtoreset{section}{part}
\makeatother
\renewcommand{\thepart}{\Roman{part} :}
\renewcommand{\cftpartpresnum}{Partie~}
\usepackage{titlesec}
\titleformat{\part}{\huge\bfseries}{}{0pt}{Partie \thepart\quad}
\begin{document}
\tableofcontents
\part{Test}
test test
\part{Test}
test test

Thank you in advance for your help.

  • 1
    So you want it to appear in the ToC? See Table of Contents: Titles for Parts with tocloft – Werner May 3 '14 at 19:42
  • yes I want it to appear in the ToC. When I use the same code for sections, subsections, sub subsections andn paragraphs it works fine. – esmitex May 3 '14 at 20:31
  • It shows "partie" in my ToC but it is not capitalized and I would like to change it to "Partie" is this possible? I would also like to change the way parts tittle are formatted. I could do that with \renewcommand but it is not working with parts. – esmitex May 3 '14 at 20:37
3

From the tocloft documentation (section 2.3 Typesetting the entries):

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. Due to LaTeX ideosyncracies, \cftpartpresnum may become doubled in the output if a third-party package behaves differently to that of the default internal LaTeX commands. The tocloft package contains specific code to prevent this in the case of the KomaScript classes and for the titlesec package; please contact the maintainer to add further corrections if you discover other packages which also exhibit this misbehaviour.

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.

At least with this, we know there is some compatibility concerns between tocloft and titlesec (giving motivation for the titlesec-specific ToC package titletoc).

Adding

\renewcommand{\cftpartpresnum}{Partie~}
\let\cftoldpartfont\cftpartfont
\renewcommand{\cftpartfont}{\cftoldpartfont\cftpartpresnum}

to your document preamble adds \cftpartpresnum just after \cftpartfont in the ToC:

enter image description here

  • 1
    Note that the redefinition of \thepart to include " :" implies that " :" will become part of all references to parts. – Werner May 4 '14 at 0:17
2

Is this what you are after? It now shows Partie before the part number, both in text as well as in TOC.

Note: I've cleaned up your MWE a little to focus on the issue onhand. You don't even need the tocloft package for this.

\documentclass[12pt,a4paper]{report}

\renewcommand{\thepart}{Partie \Roman{part} :}

\usepackage{titlesec}
\titleformat{\part}{\huge\bfseries}{}{0pt}{\thepart\quad}

\begin{document}
\tableofcontents

\part{Test}
test test

\part{Test}
test test

\end{document}

enter image description here enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.