0

I am writing a long document with two main parts and appendices, and I am struggling to customize the table of contents. I have the following code:

\documentclass[12pt,twoside,a4paper,openright]{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\usepackage[bindingoffset=1.5cm,margin=2.5cm]{geometry}
\setlength{\textwidth}{14,5cm}
\setlength{\textheight}{23.5cm}
\setlength{\topmargin}{0cm}

\usepackage{tabularx}
\usepackage{fancyhdr}
\usepackage{emptypage}
\usepackage{nonumonpart}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{booktabs}
\usepackage{adjustbox}
\usepackage{multirow}
\usepackage[width=0.9\textwidth]{caption}
\usepackage{subcaption}
\usepackage{notoccite}
\usepackage{cite}
\usepackage{afterpage}
\usepackage{epstopdf}
\usepackage{float}
\usepackage{bigstrut}
\usepackage{subfigure}
\usepackage{easylist}
\usepackage{courier}
\usepackage{color}
\usepackage{resizegather}
\usepackage{dcolumn}
\usepackage{bm}
\usepackage{CJK}
\usepackage{relsize}
\usepackage{cancel}
\usepackage{sidecap}

\usepackage{hyperref}
\usepackage{titlepic}
\usepackage{titling}
\usepackage[toc,page]{appendix}
\usepackage{pdfpages}
\usepackage{textcomp}
\usepackage{rotating}
\usepackage{bookmark}
\bookmarksetup{open,numbered}

\usepackage[none]{hyphenat}%avoid word breaking

\usepackage[compact]{titlesec}

\setlength\textfloatsep{2.5\baselineskip}% space after a figure

\titlespacing{\section}{0pt}{2ex plus .2ex minus .2ex}{2ex plus .2ex}
\titlespacing{\subsection}{0pt}{2ex plus .2ex minus .2ex}{2ex plus .2ex}

\usepackage{palatino}

\allowdisplaybreaks
\renewcommand*{\thefootnote}{\fnsymbol{footnote}}
\newcommand{\atoc}[1]{\addtocontents{toc}{#1\par}}
\newcommand{\me}{\mathrm{e}}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}

\newcommand{\vect}[1]{\boldsymbol{#1}}%vector bold but italic

\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{\clearpage{\pagestyle{empty}\origdoublepage}}

\setlength{\parskip}{0.8em}% distance between paragraphs

\renewcommand{\baselinestretch}{1.1}%distance between lines

\setlength{\belowcaptionskip}{-10pt}

\frenchspacing

\renewcommand{\partname}{Results. Part}

\title{Bla bla bla}
\author{Bla bla bla}
\date{Bla bla bla}

\begin{document}

\includepdf{COVER}

\newpage\null\thispagestyle{empty}\newpage

\includepdf{LOGO}

\newpage\null\thispagestyle{empty}\newpage

\pagenumbering{roman}

\input{Laburpena/Laburpena}

\input{Abstract/Abstract}

\tableofcontents

\input{Chapters/Chapter1/Chapter1.tex}
\input{Chapters/Chapter2/Chapter2.tex}
\input{Chapters/Chapter3/Chapter3.tex}

\part{Bla bla}

\input{Chapters/Chapter4/Chapter4.tex}
\input{Chapters/Chapter5/Chapter5.tex}

\part{Bla bla}

\input{Chapters/Chapter6/Chapter6.tex}
\input{Chapters/Chapter7/Chapter7.tex}
\input{Chapters/Chapter8/Chapter8.tex}

\input{Chapters/Chapter9/Chapter9.tex}

\bookmarksetupnext{level=part}

\appendix
\part*{Appendices}
\addcontentsline{toc}{part}{Appendices}

\input{Appendices/AppendixA/AppendixA.tex}
\input{Appendices/AppendixB/AppendixB.tex}
\input{Appendices/AppendixC/AppendixC.tex}

\bibliographystyle{h-physrev}
\bibliography{biblio}

\bookmarksetupnext{level=part}

\input{Publications/Publications}

\bookmarksetupnext{level=part}

\input{Acknowledgements/Acknowledgements}

\end{document}

With this code, I obtain a table of contents as follows with the parts appearing as

"I Bla bla bla.......(page number)".

[...]

"II Bla bla bla......(page number)".

[...]

"Appendices..........(page number)".

What I would like to have is something like:

"Results. Part I

Bla bla bla"

[...]

"Results. Part II

Bla bla bla"

[...]

"Appendices"

All of them with no dots and no page number, and the first two in two lines. I have already tried several things; for example I have tried to use the following for removing the page number and dots:

\usepackage{tocloft}
\addtocontents{toc}{\cftpagenumbersoff{part}}
\renewcommand{\cftdot}{}

but for some reason it does not work for me. I would really appreciate some help on this. I think I have posted the complete code but if some additional information is needed please let me know.

Many thanks in advance!

  • Please reduce your document to the minimal working version, especially kick those \includepdf and \input statements out of the document -we can't compile it otherwise – user31729 Mar 3 '16 at 12:55
  • Sorry... I have posted it as a new answer, as it did not fit as a comment (please see below) – user92796 Mar 4 '16 at 14:24
1

That should do.

texsxPartsInToc

\documentclass{report}

\makeatletter
\renewcommand*\l@part[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty{-\@highpenalty}%
    \addvspace{2.25em \@plus\p@}%
    \setlength\@tempdima{3em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
       \large \bfseries Results. Part #1\hfill\null}\par
       \nobreak
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}%
    \endgroup
  \fi}
\makeatother

\begin{document}

\tableofcontents

\part{Wombat}
\part{Capybara}
\end{document}

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.