2

I was looking all day for some alternative in ToC space between header and title Content. I found \setlength\cftaftertoctitleskip, 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}  
\tableofcontents\thispagestyle{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

0

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}
0

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}{\Huge\bfseries\raggedright} \titleformat*{\subsection}{\Large\bfseries} \titleformat*{\subsubsection}{\large\bfseries} \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}

  • Do you use other packages that you omit in your question? – Dynamite Jun 16 at 19:11
  • Yeah. I think maybe package titlesec could be a problem. I have normal classic package like modern, hyperref... – Sharpcfc Jun 16 at 19:13
  • Can you please add the relevant code to your question that reproduces the problem? – Dynamite Jun 16 at 19:48
  • I added to EDIT comment above. – Sharpcfc Jun 16 at 19:58
  • Btw, can you tell me how to write correctly code on stackexchange? I cannot fullfil yellow color on \usepackage etc. Thank you very much. – Sharpcfc Jun 16 at 20:15

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.