Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Using the scrartcl class for a report I am writing, I would like to have only the sections show up in the table of contents. Although I manage to do that, the linespread looks too big in my eyes, and I think this is a consequence of the reduced toc depth:

alt text

For this reason, I would like to reduce the linespread locally. I tried to put a {spacing} around my code like this:

\begin{spacing}{0.5}
   \setcounter{tocdepth}{1}
   \rule{\textwidth}{1pt}
   \vspace*{-1cm}
   \tableofcontents
   \vspace*{-0.5cm}
   \rule{\textwidth}{1pt}
\end{spacing}

Which will not work, however. What is the easiest way to decrease the linespread here?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

You could use the tocstyle package that comes with the KOMA Script bundle. But you will get a warning about the Alpha state of the package so you should use it with caution. At least the below code works as desired.

\documentclass[english]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tocstyle}
\usepackage{babel}
\usepackage{blindtext}

\setcounter{tocdepth}{1}
\newtocstyle{compact}{%
  \settocfeature[1]{entryhook}{\bfseries}%
  \settocfeature[1]{entryvskip}{0pt plus 2pt}%
  \settocfeature[1]{leaders}{\hfill}%
}
\usetocstyle{compact}

\begin{document}
  \tableofcontents

  \bigskip
  \Blinddocument
\end{document}

And as always, the blindtext package is only for creating dummy text thus not part of the solution.


alt text

share|improve this answer
1  
The package generating the alpha warning is named tocstyle. –  lockstep Dec 11 '10 at 21:28
    
Thanks. Corrected. –  Thorsten Donig Dec 11 '10 at 21:31
    
That leaves nothing unanswered. Thanks! –  Ingo Dec 12 '10 at 10:26

You may use the etoolbox package to patch the command \l@section which is (beside other things) responsible for setting the vertical space before a section entry in the ToC.

\documentclass{scrartcl}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\l@section}{1.0em}{\z@}{}{}
\makeatother

\setcounter{tocdepth}{1}

\begin{document}

\tableofcontents

\section{bla}

\section{blubb}

\section{foo}

\subsection{bar}

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.