3

I'm generating a short table of contents using the shorttoc-package.

\documentclass{scrartcl}
\usepackage[tight]{shorttoc}

\begin{document}

\shorttoc{Shorttoc}{1}
\tableofcontents

\section{Sec1}
\subsection{Subs1}
\section{Sec2}
\subsection{Subs2}
\section{Sec3}
\subsection{Subs3}

\end{document}

The package documentation states, that the option tight should reduce the vertical spacing between the entries in the shorttoc, but in my example it doesn't. I suspect, this is due to this part of shorttoc.sty?

\newif\if@tightshtoc \@tightshtocfalse
\def\shorttableofcontents#1#2{\bgroup\c@tocdepth=#2\@restonecolfalse
  \if@tightshtoc
     \parsep\z@
  \fi

What do I have to do to resize the vertical spacing?

1 Answer 1

2

As \parsep is the vertical space between paragraphs of a list item, I'm at a loss why redefining it should change the spacing between ToC lines. For section entries, the latter is controlled by the \l@section macro (which contains the line \addvspace{1.0em \@plus\p@}), and this macro needs to be redefined. If you want to change the spacing only for the short ToC, the redefinition must be done inside a group. (Note: I'm using the etoolbox package and its \patchcmd macro for convenience.)

\documentclass{scrartcl}

\usepackage{shorttoc}
\usepackage{etoolbox}

\begin{document}

\begingroup
\makeatletter
\patchcmd{\l@section}{%
  \addvspace{1.0em \@plus\p@}% original code line
}{%
  \addvspace{0.3em \@plus 0.3\p@}% substitute code line
}{}{}
\makeatother
\shorttoc{Shorttoc}{1}
\endgroup

\tableofcontents

\section{Sec1}
\subsection{Subs1}
\section{Sec2}
\subsection{Subs2}
\section{Sec3}
\subsection{Subs3}

\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .