1

I need to increase the vertical space between two labels, specifically the vertical space in between any label (section or subsection) and the next Part.

The code that I using for the table of contents is the following:

\documentclass[11pt,fleqn,x11names,table]{book} 

\usepackage{xcolor, tcolorbox, multicol} 
\usepackage{tikz,tkz-tab}
\usepackage{kpfonts}
\usepackage{titletoc}

\titlecontents{part}
[8em]{\centering\Large\sc\bfseries\contentslabel{3em}}{}{}
{}{}

\titlecontents{chapter}[0pc]
{\addvspace{30pt}
    \begin{tikzpicture}[remember picture, overlay]
    \draw[fill=orange,draw=orange] (-4,-.1) rectangle (0.0,0.5);
    \pgftext[left,x=-1.5 cm,y=0.2cm]{\color{white}\Huge\sc\bfseries \ \thecontentslabel};%
    \end{tikzpicture}\color{orange}\large\sc\bfseries}
{}{}
{\;\titlerule\;\large\sc\bfseries Página \thecontentspage
    \begin{tikzpicture}[remember picture, overlay]
    \draw[fill=orange,draw=orange] (2pt,0) rectangle (6,0.1pt);
    \end{tikzpicture}}

\titlecontents{section}[2.4pc]
{\addvspace{1pt}}
{\contentslabel[\color{blue}\thecontentslabel]{2.4pc}}
{}
{\hfill\small \color{blue}\thecontentspage}
[]

\titlecontents*{subsection}[4pc]
{\addvspace{-1pt}\small}
{}
{}
{\hfill\small \color{blue}\thecontentspage}
[\\][]
\makeatletter

\renewcommand{\tableofcontents}{

    \chapter*{
        \vspace*{-20\p@}%
        \begin{tikzpicture}[remember picture, overlay]%
        \pgftext[right,x=15cm,y=0.2cm]{\color{black}\Huge\sc\bfseries \contentsname};%
        \draw[fill=orange,draw=orange] (13,-.75) rectangle (20,1);%
        \clip (13,-.75) rectangle (20,1);
        \pgftext[right,x=15cm,y=0.2cm]{\color{black}\Huge\sc\bfseries \contentsname};%
        \end{tikzpicture}}
    \@starttoc{toc}}
\makeatother

\begin{document}
\tableofcontents
\thispagestyle{empty}
    \part{Part I}
      \chapter{Chapter 1}
       \section{section 1}
         \subsection{subsection 1}
          \subsection{subsection 2}

\part{Part 2}
        \chapter{Chapter 2}
         \section{section 1}
           \subsection{subsection 1}
            \subsection{subsection 2}

\part{Part 3}
         \chapter{Chapter 3}
         \section{section 1}
         \subsection{subsection 1}
         \subsection{subsection 2}

\end{document}

Finally, this generates the following table:

enter image description here

But, what I really need to generate is the following:

enter image description here

Is there any way to make it work? Thanks!!!

6
  • 1
    Please add a complete minimal working example (MWE)!
    – CarLaTeX
    Sep 21, 2017 at 6:15
  • Probably use this: \titlecontents{part} [8em]{\addvspace{some length}\centering\Large\sc\bfseries\contentslabel{3em}}{}{}{}
    – Bernard
    Sep 21, 2017 at 8:01
  • 1
    @Bernard, Thanks! That is the solution! My problem was that I added \addvspace{somelength} between in {} i.e. \titlecontents{part} [8em]{\addvspace{28pt}}\centering\Large\sc\bfseries\contentslabel{3em}{}{}{}. Sep 21, 2017 at 16:58
  • Glad I could help!
    – Bernard
    Sep 21, 2017 at 17:29
  • @Bernard could you write an answer?
    – Bobyandbob
    Nov 11, 2017 at 10:50

1 Answer 1

0

It was only necessary to add the following line of code:

\titlecontents{part} [8em]{\addvspace{some length}\centering\Large\sc\bfseries\contentslabel{3em}}{}{}{‌​}

You must log in to answer this question.

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