5

Is there a way to decrease the vertical space between part title and chapter titles and also decrease the space between chapters and the following part? I looked for a solution but most people seem to use some special toc-packages are those packages necessary or is it possible to do this just with koma-script?

\documentclass[
final,
paper=a4,
listof=totoc,
captions=tableheading,
listof=totoc,
numbers=noenddot,
headings=big,
chapterprefix=false]
{scrreprt}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} 

\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{hyperref}

\begin{document}
    \tableofcontents
    \listoffigures
    \listoftables
    \cleardoubleoddpage 
    \part{Stuff}
    \blinddocument  
    \part{More Stuff}
    \blinddocument
\end{document}

enter image description here


Update My aim is to emulate the classicthesis-toc style, therefore I added some more space between the listoftable, figures listings and the bibliography in the header-file to esdd's solution (by adding \addtocontents{toc}{\protect\vspace{.25\baselineskip}}). Is there a more elegant way to achieve the same result?

    \documentclass[
final,
fontsize=12pt,              
open=right,     
twoside = true,
paper=a4,
listof=totoc,
captions=tableheading,
listof=totoc,
numbers=noenddot,
headings=big,
DIV=calc,
BCOR=8.72mm,
chapterprefix=false
]
{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{xcolor}% <- load this package before tocstyle
\usepackage{biblatex}
\usepackage{ebgaramond}
\usepackage{microtype}
%\usepackage[fullfamily,opticals,minionint,footnotefigures]{MinionPro} 
\recalctypearea
\definecolor{red}{RGB}{192,0,0}
\definecolor{halfgray}{gray}{0.55} 

\setkomafont{disposition}{\rmfamily}
\addtokomafont{chapter}{\normalsize\scshape}
\addtokomafont{section}{\normalsize\scshape}
\addtokomafont{subsection}{\normalsize\itshape}     
\setkomafont{chapterentrypagenumber}{\normalfont}
\setkomafont{chapterentry}{\mdseries\scshape\lowercase}
\setkomafont{chapterentrypagenumber}{\normalfont}
\setkomafont{part}{\large\color{red}\scshape\MakeUppercase} 

\renewcommand*{\partpagestyle}{empty}
\setkomafont{part}{\large\color{red}\scshape\MakeUppercase} 
\setkomafont{partnumber}{\large}
\setkomafont{partentry}{\color{red}}
\renewcommand\addparttocentry[2]{%
    \addtocentrydefault{part}{\protect\large\textsc{\lowercase{#1}}}{%
        \protect\texorpdfstring{\large\scshape\lowercase{#2}}{#2}}}
\setkomafont{partentrypagenumber}{\normalfont\color{red}}
\RedeclareSectionCommand[tocnumwidth=1.3em,innerskip=2mm]{part} 

%%%%%%%%%%%%%%%%%%%%
\usepackage{xpatch} 
\xapptocmd\appendix{% 
    \addtocontents{toc}{\value{tocdepth}=0}% 
}{}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{textcase}
\usepackage{fontaxes}
\usepackage{pdfpages}
\usepackage{etoolbox}
\usepackage{bm}

\DeclareMathAlphabet\EuRoman{U}{eur}{m}{n}
\SetMathAlphabet\EuRoman{bold}{U}{eur}{b}{n}
\newcommand{\eurom}{\EuRoman}

\makeatletter
\newsavebox{\feline@chapter}
\newcommand\feline@chapter@marker[1][4cm]{%
    \sbox\feline@chapter{%
        \resizebox{!}{#1}{\setlength{\fboxsep}{0pt}%
            \colorbox{white}{\color{halfgray}$\bm{\eurom\thechapter}$}}}%!!!!!Error?
    \raisebox{\depth}{\usebox{\feline@chapter}}%
}
\renewcommand\chapterformat{\sbox\feline@chapter{\feline@chapter@marker[1.61cm]}%
    \makebox[0pt][l]{\hspace*{\marginparsep}\usebox\feline@chapter}}

\renewcommand\chapterlinesformat[3]{%
    \parbox[t]{\textwidth}{\raggedchapter\MakeUppercase{#3}}%
    #2%
    \\\rule{\textwidth}{.4pt}
}

\renewcommand*{\sectionlinesformat}[4]{%
    \@hangfrom{\hskip #2#3}{\ifstr{#1}{section}{\MakeTextLowercase{#4}}{#4}}%
}
\makeatother


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tocstyle}
\newtocstyle
[KOMAlike]% parent style
[entryvskip]% exclude the initial vertical skip
{myown}% name of the new style
{\settocstylefeature[-1]{entryvskip}{12pt}}% set the vertical skip before a part entry
\usetocstyle{myown}

\usepackage[hidelinks]{hyperref}

\areaset[current]{336pt}{747pt}% 609 + 33 + 42 head \the\footskip
\setlength{\marginparwidth}{7.5em}%
\setlength{\marginparsep}{2em}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
\renewcommand*{\chapterheadendvskip}{%  
    \vspace{-.5\baselineskip}%
}
\begin{document}
    \microtypesetup{protrusion=false}
    \tableofcontents
    \listoffigures
    \addtocontents{toc}{\protect\vspace{.25\baselineskip}}%%%%%%%%%%%%%%%%%%!!!
    \listoftables
%   \addtocontents{toc}{\protect\vspace{.25\baselineskip}}
    %\lstlistoflistings
    \cleardoubleoddpage
    \microtypesetup{protrusion=true}
    \part{Stuff}
    \blinddocument
    \part{More Stuff}
    \blinddocument
    \blinddocument
    \microtypesetup{protrusion=false}
    \addtocontents{toc}{\protect\vspace{12pt}}%%%%%%%%%%%%%%%%%%%!!!
    \printbibliography
    \addcontentsline{toc}{chapter}{Bibliography} 
    \microtypesetup{protrusion=true}
    \part{Additional Stuff}
    \appendix
    \chapter{Even More Stuff}
\end{document}  

enter image description here

4

Update

With the current KOMA-Script Version 3.20 new styles for toc entries can be easily declared. So you can define an own style for unnumbered chapters with more vertical space before.

\documentclass[
final,
paper=a4,
listof=totoc,
bibliography=totoc,
captions=tableheading,
numbers=noenddot,
headings=big,
chapterprefix=false
]
{scrreprt}[2016/05/10]% needs version 3.20 or newer
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{xcolor}

\usepackage[backend=biber]{biblatex} 
\addbibresource{biblatex-examples.bib}% example bibdatei 

\RedeclareSectionCommand[
  tocbeforeskip=1.25em plus 1pt
]{part}
\addtokomafont{partentry}{\color{red!70!black}}

\RedeclareSectionCommand[
  tocbeforeskip=0pt plus .2pt,
]{chapter}
\DeclareTOCStyleEntry[
  beforeskip=.75em plus 1pt,
  level=0,
  indent=0pt,
  numwidth=0pt,
]{chapter}{unnumberedchapter}

\renewcommand\addchaptertocentry[2]{%
  \ifstr{#1}{}
    {\addtocentrydefault{unnumberedchapter}{#1}{#2}}
    {\addtocentrydefault{chapter}{#1}{#2}}
}

%\usepackage{hyperref}
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\cleardoubleoddpage
\part{Stuff}
\blinddocument
\part{More Stuff}
\blinddocument
\blinddocument
\nocite{westfahl:space}% nur für Beispielbibliography
\printbibliography
\addpart{Additional Stuff}
\end{document}

enter image description here


Original answer

Here is a suggestion using package tocstyle that is an alpha version but part of the KOMA-Script bundle. It works also with \addpart.

    \documentclass[
    final,
    paper=a4,
    listof=totoc,
    captions=tableheading,
    listof=totoc,
    numbers=noenddot,
    headings=big,
    chapterprefix=false
    ]
    {scrreprt}
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{blindtext}
    \usepackage{xcolor}% <- load this package before tocstyle
    \usepackage{tocstyle}
    \newtocstyle
         [KOMAlike]% parent style
         [entryvskip]% exclude the initial vertical skip
         {myown}% name of the new style
         {%
           \settocstylefeature[-1]{entryvskip}{12pt}% set the vertical skip before a part entry
           %\settocstylefeature[0]{entryvskip}{2pt}% set the vertical skip before a chapter entry
         }

    \usetocstyle{myown}
    \usepackage{hyperref}
    \begin{document}
             \tableofcontents
             \listoffigures
             \listoftables
             \cleardoubleoddpage
             \part{Stuff}
             \blinddocument
             \part{More Stuff}
             \blinddocument
             \blinddocument
             \addpart{Additional Stuff}
    \end{document}

Run several times to get

enter image description here

Another possibility is redefining \addparttocentry and \addchaptertocentry but then there could be page breaks at unfavorable points.

    \documentclass[
    final,
    paper=a4,
    listof=totoc,
    captions=tableheading,
    listof=totoc,
    numbers=noenddot,
    headings=big,
    chapterprefix=false
    ]
    {scrreprt}
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{blindtext}
    \usepackage{xcolor}
    \usepackage{hyperref}
    \renewcommand\addparttocentry[2]{%
        \addtocontents{toc}{\protect\vspace{-4ex}}%
        \addtocentrydefault{part}{#1}{#2}%
    }
  \renewcommand\addchaptertocentry[2]{%
        \addtocontents{toc}{\protect\vspace{-2ex}}%
        \addtocentrydefault{chapter}{#1}{#2}%
    }   
    \begin{document}
             \tableofcontents
             \listoffigures
             \listoftables
             \cleardoubleoddpage
             \part{Stuff}
             \blinddocument
             \part{More Stuff}
             \blinddocument
             \blinddocument
             \addpart{Additional Stuff}
    \end{document}

Result:

enter image description here

  • Hi, thanks you very much for your solution. in your solution the space between the list of's and the bibliography is pretty small -- so I added same space with \addtocontents{toc}{\protect\vspace{.25\baselineskip}}. Do you know a more elegant way to achieve this? (I extended my example in the question) – jlk Nov 21 '15 at 13:17
  • LOF, LOT and the bibliography are at chapter level. So the vertical skip before them have the same value as before chapters. If there should be a small vertical skip before every chapter entry in the TOC you can uncomment the line \settocstylefeature[0]{entryvskip}{2pt}% set the vertical skip before a chapter entry in my first example. (I have just added this line.) – esdd Nov 22 '15 at 0:02
  • @harryhaller With the new version 3.20 it is possible. See my updated answer. – esdd May 11 '16 at 23:40
1

Here's a way to do it (version 2 would decrease inter-part space as well):

\documentclass[
final,
paper=a4,
captions=tableheading,
listof=totoc,
numbers=noenddot,
headings=big,
chapterprefix=false]
{scrreprt}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} 

\usepackage{blindtext}
\usepackage{xcolor}
\usepackage{hyperref}

\let\origpart\part
\renewcommand{\part}[1]{\origpart{#1}\addtocontents{toc}{\protect\vspace{-2ex}}}% comment this line in version 2
%\renewcommand{\part}[1]{\addtocontents{toc}{\protect\vspace{-\baselineskip}}\origpart{#1}\addtocontents{toc}{\protect\vspace{-2ex}}}% uncomment this line in version 2

\begin{document}
    \tableofcontents
    \listoffigures
    \listoftables
    \cleardoubleoddpage
    \addtocontents{toc}{\protect\vspace{-\baselineskip}}% comment this line in version 2
    \part{Stuff}
    \blinddocument  
    \part{More Stuff}
    \blinddocument
\end{document}
  • Note that this breaks \addpart and \part*. – esdd Nov 20 '15 at 12:46

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.