Suggesting `tocafterskip` option for `\RedeclareSectionCommand`
KOMA-Script is a bundle of versatile LaTeX classes and packages
Brought to you by:
kohm
I had to imitate a layout of a book as shown in the attachment. As can be seen, there is quite a large vertical gap before and after the 'KAPITEL' headings (in spite of being called 'KAPITEL' it is actually implemented as \part
). While it was easy to adjust the space before the heading with tocbeforeskip
, I couldn't do such an adjustment for the space after the heading because tocafterskip
doesn't exist. Instead, I had to do
\renewcommand\addparttocentry[2]{%
\addtocentrydefault{part}{#1}{#2}%
\addtocontents{toc}{\protect\vspace{7mm}}%
}
Is there a reason why tocafterskip
doesn't exist? Otherwise I suggest to add it.
The reason is simple: Nobody asked for it before and I did not need it, because I was able to add the needed vertical space in ToCs using
beforeskip
(in\DeclareTOCStyleEntry
syntax). BTW: As a workaround you should be able to useonstarthigherlevel
forchapter
to add additional space only, if a chapter entries follows a part entry.OK, thanks.
I've seen
onstarthigherlevel
in the documentation after modifying\addparttocentry
, and I was too lazy to improve the code :-)Last edit: Werner LEMBERG 2025-08-20
I must correct myself. There is a good reason for not to do this:
When adding a vertical space TeX resets
\lastpenalty
to 0. When adding a penalty, TeX resets\lastskip
to 0. So either\addvspace
(used to add the vertical distance ofbeforeskip
) wouldn't be able to recognize a previous vertical skip (of a newafterskip
option) or the penalty handling of consecutive entries (of different level) would not work. And because the penalty handling is a documented feature, I don't want to break it.What I could do it to document, that using
afterskip
does break the penalty handling. But if I'd do so, I'd never the less expect several support effort because of it. I could also replace the penalty handling by something else, but this would also break existing documents using the penalty handling or even documents ignoring the penalty handling doing something like you are doing with your\addtocontents{toc}{\protect\vspace{7mm}}
.So, at the moment I reject your feature request.
OK, thanks