TransWikia.com

Space between headers and title Content in ToC

TeX - LaTeX Asked by Sharpcfc on November 30, 2020

I was looking all day for some alternative in ToC space between header and title Content. I found setlengthcftaftertoctitleskip, but it’s useless in my case cause I already use package fancyhd and tocloft. I somewhere read that fancy doesn’t like tocloft and code cftaftertoctitleskip etc. are useless.

I am using two side doc. report, a4 paper and babel czech. I am curious about addtocontents{toc}{vspace{-10pt}} if exists some similar code that can control spacing between title Content and header.

There is some example my code:

documentclass[12pt,     % velikost zakladniho pisma
               a4paper,  % papir A4
               twoside,  % jednostranny tisk (default)
               czech     % originalni jazyk  cz
               ]{report} % dokument tridy zprava
% Nastaveni obsahu
usepackage[titles]{tocloft} 
renewcommand{cftsecfont}{bfseries} 
renewcommand{cftsecpagefont}{bfseries}  
setlength{cftbeforesecskip}{10pt} 
setlength{cftbeforesubsecskip}{2.5pt}
setlength{cftbeforesubsubsecskip}{2.5pt}
cftsetindents{section}{0em}{2em}
cftsetindents{subsection}{2em}{2.5em}
cftsetindents{subsubsection}{4.5em}{3.5em}


begin{document} 
setcounter{tocdepth}{3}  
tableofcontentsthispagestyle{fancy} 
addtocontents{toc}
  unexpanded{unexpanded{renewcommand{cftsecdotsep}{cftnodots}}}%
}
addtocontents{toc}{vspace{-10pt}}
end{document}

Adding photo for better understanding my problem.
Thanks everyone for responding 🙂

enter image description here

2 Answers

Try the negative space before the title if the table of contents:

documentclass[12pt,    % velikost zakladniho pisma
               a4paper,  % papir A4
               twoside,  % jednostranny tisk (default)
               czech     % originalni jazyk  cz
               ]{report} % dokument tridy zprava
% Nastaveni obsahu
usepackage[titles]{tocloft} 
renewcommand{cftsecfont}{bfseries} 
renewcommand{cftsecpagefont}{bfseries}

setlength{cftbeforesecskip}{10pt} 
setlength{cftbeforesubsecskip}{2.5pt}
setlength{cftbeforesubsubsecskip}{2.5pt}
cftsetindents{section}{0em}{2em}
cftsetindents{subsection}{2em}{2.5em}
cftsetindents{subsubsection}{4.5em}{3.5em}



renewcommand{contentsname}{vspace*{-4cm}Contents}

begin{document} 

tableofcontents

section{title}
end{document}

Answered by Dynamite on November 30, 2020

Dynamite,

This doesn't work. It has do nothing with spacing.renewcommand{contentsname}{vspace*{-4cm}Contents}

EDIT: This is code with titlesec

usepackage{titlesec} titleformat*{section}{Hugebfseriesraggedright} titleformat*{subsection}{Largebfseries} titleformat*{subsubsection}{largebfseries} titlespacing*{section} {0pt}{4.5ex plus 1ex minus .1ex}{3.3ex plus .1ex} titlespacing*{subsection} {0pt}{3.5ex plus 1ex minus .1ex}{2.3ex plus .1ex} titlespacing*{subsubsection} {0pt}{3.0ex plus 1ex minus .0ex}{1.7ex plus .1ex}

Answered by Sharpcfc on November 30, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP