2

I'm using the shorttoc package for a second table of contents of my book. Here's a minimal example:

\documentclass{scrbook}
\usepackage{shorttoc}
\begin{document}

\shorttoc{Contents at a Glance}{0}

\renewcommand*\contentsname{Table of Contents}
\tableofcontents

\chapter{Foo}
\section{Foo1}
\section{Foo2}
\section{Foo3}
\chapter{Bar}
\section{Bar1}
\section{Bar2}
\chapter{Baz}
\section{Baz1}
\section{Baz2}
\section{Baz3}

\end{document}

This works fine except that the short table of contents has an empty line after each chapter which I don't want. (The book as approximately 20 chapters which would all fit onto one page if it weren't for the blank lines.)

I do want to keep the formatting of the normal (long) ToC, though.

  • Have you tried the tight option when loading the package? – cfr Dec 28 '15 at 4:13
  • 1
    You might want to consider using something like etoc. Otherwise, you need to redefine the formatting of chapter contents lines for the short ToC, I think. I can't get the tight option to do anything no matter what I try. – cfr Dec 28 '15 at 4:28
1

Following cfr's idea here is a solution: the changes are local to shorttoc

\documentclass{scrbook}
\usepackage{shorttoc}
\usepackage{etoolbox}
\begin{document}
\makeatletter
{\patchcmd{\l@chapter}{\vskip 1.0em \@plus\p@}{}{}{\errmessage{paching \string\l@chapter fail}}
\patchcmd{\l@chapter}{\addvspace{1.0em \@plus\p@}}{}{}{\errmessage{paching \string\l@chapter fail}}
\shorttoc{Contents at a Glance}{0}}
\makeatother
\renewcommand*\contentsname{Table of Contents}
\tableofcontents

\chapter{Foo}
\section{Foo1}
\section{Foo2}
\section{Foo3}
\chapter{Bar}
\section{Bar1}
\section{Bar2}
\chapter{Baz}
\section{Baz1}
\section{Baz2}
\section{Baz3}

\end{document}
  • This works, thanks. And I can confirm that the tight option has no effect. – Frunobulax Dec 28 '15 at 18:02

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.