0

I am currently writing on a thesis and I need your help concerning the Layout of the ToC. The Text in the ToC is set to double spacing like this:

\documentclass[11pt,oneside,a4paper,ngerman]{article}
\usepackage[left=2.5cm,top=3cm,right=2.5cm,bottom=3cm,bindingoffset=0.5cm]
{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{xr}
\usepackage{tocloft}
\usepackage{babel}
\usepackage{times}
\usepackage{filecontents}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amssymb}
\usepackage{caption}
\usepackage[nottoc]{tocbibind}
\usepackage[toc,page]{appendix}
\usepackage{blindtext}    
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false, 
breaklinks=false,pdfborder={0 0 0},backref=false,colorlinks=false] 
{hyperref}
\usepackage[noabbrev]{cleveref}

\makeatletter
\begin{document}
\lstset{style=mystyle}
\renewcommand{\lstlistingname}{Quellcode}
\renewcommand{\lstlistlistingname}{\lstlistingname verzeichnis}
\renewcommand{\refname}{Literaturverzeichnis}
\newcommand{\algrule}[1][.2pt]{\par\vskip.5\baselineskip\hrule height 
 #1\par\vskip.5\baselineskip}
\pagenumbering{roman}
\doublespacing
\tableofcontents
\pagebreak

\listoftables
\pagebreak  
\listoffigures
\pagebreak

\pagenumbering{arabic}
\singlespacing
\begin{figure}
\centering
foo
\caption{foo}
\end{figure}
\begin{table}
\centering
 bar
\caption{bar}
\end{table}
\blinddocument
\end{document}

enter image description here

I would like to change and decrease the spacing between the entries for the LoT, LoF and the List for sourcecodes while the spacing for the rest of the entries in the ToC (sections, subsections) remains at double spacing.

  • Welcome to TeX.SX! For the future, please provide a complete minimal working example (MWE), beginning at \documentclass and ending at \end{document} which recreates your issue but doesn't contain any unnecessary stuff. – Skillmon Aug 17 '17 at 14:57
  • 1
    Welcome! The code that you have provided is not compilable, partially because we do not have access to titlepage.tex. Is this really necessary? Also, cleveref should be loaded after hyperref. – Troy Aug 17 '17 at 16:18
  • @Troy, I edited the code, the titlepage.tex is not neccessary at all. In the original code the cleverref is loaded after hyperref. It should be working now. – Cosimo Aug 18 '17 at 8:56
0

A hacky way could be done by manually inserting negative \vskip into the ToC. The adaption to your newly provided MWE is rather easy. Change the \vskip-1em into \vspace{-1em}. That works:

\documentclass[11pt,oneside,a4paper,ngerman]{article}
\usepackage[left=2.5cm,top=3cm,right=2.5cm,bottom=3cm,bindingoffset=0.5cm]
{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{xr}
\usepackage{tocloft}
\usepackage{babel}
\usepackage{times}
\usepackage{filecontents}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{amssymb}
\usepackage{caption}
\usepackage[nottoc]{tocbibind}
\usepackage[toc,page]{appendix}
\usepackage{blindtext}
\usepackage{listings}
\usepackage[
    unicode=true,
    pdfusetitle,
    bookmarks=true,
    bookmarksnumbered=false,
    bookmarksopen=false,
    breaklinks=false,
    pdfborder={0 0 0},
    backref=false,
    colorlinks=false] 
{hyperref}
\usepackage[noabbrev]{cleveref}

\renewcommand{\lstlistingname}{Quellcode}
\renewcommand{\lstlistlistingname}{\lstlistingname verzeichnis}
\renewcommand{\refname}{Literaturverzeichnis}
\newcommand{\algrule}[1][.2pt]{\par\vskip.5\baselineskip\hrule height 
 #1\par\vskip.5\baselineskip}

\begin{document}
\pagenumbering{roman}
\pagebreak
\doublespacing
\tableofcontents
\pagebreak

\listoftables
\addtocontents{toc}{\vspace{-1em}}
\pagebreak  
\listoffigures
\addtocontents{toc}{\vspace{-1em}}
\pagebreak

\lstlistoflistings
\addcontentsline{toc}{section}{Quellcodeverzeichnis}
\pagebreak

\pagenumbering{arabic}
\singlespacing
\begin{figure}
\centering
foo
\caption{foo}
\end{figure}
\begin{table}
\centering
 bar
\caption{bar}
\end{table}
\blinddocument
\end{document}

enter image description here

  • This somehow just works if i insert \addtocontents{toc}{\vskip-1em} after \tableofcontents but not if for example I insert it after \listoftables. If I set the value for \vskip to -5em the spacing between the header of the ToC and the entries gets even bigger. Is there maybe another way to do this? – Cosimo Aug 17 '17 at 15:34
  • @Cosimo there might (and most likely is), but I can't guess the documentclass and packages you use. So provide a complete MWE, and someone (maybe myself) might give a better answer. – Skillmon Aug 17 '17 at 15:36
  • I just tried to compile the MWE you posted in your answer with all the packages that I use in my document. Without all the packages included your solution works just fine. I deleted one package after the other and it seems like the hyperref package is the cause of the problems. I edited my original post so that you can see how I used this package. Is there a workaround? – Cosimo Aug 17 '17 at 16:11
  • @Cosimo I've updated my answer to incorporate all the packages you provided. Changing \vskip to \vspace works. – Skillmon Aug 17 '17 at 17:29
  • \vspace works just fine. It decreases the spacing between the entries for LoF and LoT successfully. Thanks for your help! – Cosimo Aug 18 '17 at 8:52

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.