0

I have to do this table of contents :

enter image description here

Sorry for the terrible picture, I hope it is understandable.

Here is a few explanations :

  • The toc has two columns. But toc's title ("TABLE ANALYTIQUE") and subtitle ("Les chiffres renvoient aux numéros de pages") are on the middle. I have found this, but when I try it here is the result : enter image description here

  • Some titles have page numbers (\subsection, \subsubsection, \paragraph), others don't (\part \chapter and \section).

  • \part, \chapter and \section have this little underline and are centred.

  • My paragraphs are numbered using \setcounter{secnumdepth}{4}

  • My document : \documentclass[10pt,twoside]{book}

Does anyone know how to do this? Thanks in advance!

1 Answer 1

3

Combining packages tocloft, multitoc, titlesec, and titletoc:

\documentclass[12pt,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[margin=1in]{geometry}
\usepackage{helvet}

% Show Everything in ToC (https://tex.stackexchange.com/questions/17877/how-to-show-subsubsections-and-paragraphs-in-toc)
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}

% Redefine \contentsname. Do this before loading multitoc, otherwise a warning pops up (don't ask me about the details)
\usepackage{tocloft}
\renewcommand{\contentsname}{\parbox{\linewidth}{\centerline{\textsf{TABLE ANALYTIQUE}}~\\[-1.5cm]\centerline{\normalfont\itshape\footnotesize\textsf{Les chiffres renvoient aux num\'eros de pages}}}}

% Multi-column ToC
\usepackage[toc]{multitoc}
\renewcommand*{\multicolumntoc}{2}
\setlength{\columnsep}{1cm}

% Redefine Part (https://tex.stackexchange.com/questions/219819/customize-part-in-toc-by-titletoc)
\usepackage[newparttoc]{titlesec}
\titleformat{\part}[display]{}{}{0pt}{} % We're gonna redefine this with titletoc anyways

% Format Section Numbers
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\arabic{subsection}}
\renewcommand{\thesubsubsection}{\arabic{subsubsection}}
\renewcommand{\theparagraph}{\Roman{paragraph}}

% The Fun Begins (see page 15 of http://mirrors.ctan.org/macros/latex/contrib/titlesec/titlesec.pdf)
\usepackage{titletoc}
\titlecontents{part}[0pt]
    {\addvspace{1pc}\filcenter}%
    {\footnotesize\textsf{Livre \thecontentslabel}\\*[-1ex]\rule{5cm}{0.5pt}\\*[0.5em]\hfill\large\bfseries}
    {}
    {\hfill~}[\addvspace{.5pc}]
\titlecontents{chapter}[0pt]
    {\addvspace{1pc}\filcenter}%
    {\footnotesize\textsf{Partie \thecontentslabel}\\*[-1ex]\rule{7cm}{0.5pt}\\*[0.5em]\hfill\Large\bfseries}
    {}
    {\hfill~}[\addvspace{.5pc}]
\titlecontents{section}[0pt]
    {\addvspace{1pc}\filcenter}%
    {\footnotesize\textsf{Titre \thecontentslabel}\\*[-1ex]\rule{7cm}{0.5pt}\\*[0.5em]\hfill\large\bfseries}
    {}
    {\hfill~}[\addvspace{.5pc}]
\titlecontents{subsection}[0pt]
    {\addvspace{1pc}}%
    {\bfseries\contentspush{\textsf{\underline{\footnotesize Chapitre \thecontentslabel}\enspace}\large}}
    {}
    {\hfill\contentspage}[\addvspace{.5pc}]
\titlecontents{subsubsection}[0pt]
    {\addvspace{.2pc}}%
    {{\scriptsize\textsf{Section \thecontentslabel\enspace}}\small\bfseries}
    {}
    {\hfill\small\contentspage}[\addvspace{.2pc}]
\titlecontents{paragraph}[0pt]
    {\addvspace{.2pc}}%
    {{\footnotesize{\quad\thecontentslabel.\enspace}}\small\bfseries}
    {}
    {\hfill\small\contentspage}[\addvspace{.2pc}]

\begin{document}

\tableofcontents

\part{Part}\chapter{Chapter}\section{Section}\subsection{Subsection}\subsubsection{Subsubsection}\subsubsection{Subsubsection}\subsection{Subsection}\subsubsection{Subsubsection}\paragraph{Paragraph}\paragraph{Paragraph}\subsubsection{Subsubsection}\subsubsection{Subsubsection}\subsection{Subsection}\paragraph{Paragraph}\subsubsection{Subsubsection}\paragraph{Paragraph}\subsubsection{Subsubsection}\subsubsection{Subsubsection}\subsection{Subsection}\subsubsection{Subsubsection}\paragraph{Paragraph}\subsubsection{Subsubsection}\part{Part}\chapter{Chapter}\section{Section}\subsection{Subsection}\subsubsection{Subsubsection}\subsubsection{Subsubsection}\subsection{Subsection}\subsubsection{Subsubsection}\paragraph{Paragraph}\subsubsection{Subsubsection}

\end{document}

screenshot

1
  • Hey @ABlueChameleon, thank you very much for this ! It looks perfect !
    – Guliup
    Apr 19, 2020 at 12:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .