0

I am looking for a way to set the vertical space after headers, end of paragraphs, etc., to specific values, using koma script. I checked previous answers, but the closest I found was the following: Adjusting spacing around section/subsection titles with koma-script which I found quite confusing. My code for testing:

\documentclass[12pt]{scrreprt}
\usepackage{setspace}
\usepackage{lipsum}

\RedeclareSectionCommands[ beforeskip=-.5\baselineskip, afterskip=.25\baselineskip ]{section,subsection,subsubsection} \RedeclareSectionCommands[ beforeskip=.5\baselineskip, afterskip=-1em]{paragraph,subparagraph} \doublespacing \begin{document} \section{Hello} \lipsum \end{document}

So lets say I want to have exactly 12 pt vertical space after each header (chapters, sections, subsections, etc), and also 12 pt space after the end of a paragraph and before a new section, is that possible to obtain? In my case the space always seems to be a bit larger when there is both a paragraph ending and a new section beginning.

It would be very helpful to know the case with zero space to start from, and then put in values from there. I am confused by the before- and afterskips, which dont tell me what is the base and what I will end up with eventually.

ghx12
  • 15
  • 4
  • @DavidCarlisle I see, 0 makes no sense, but there must be the case where you have as little vertical space as possible? My plan was to start from there, and then increase the distance until it looks good, but doesnt use too much space of my document – ghx12 Aug 09 '23 at 21:14
  • I think this is confusing with the syntax in Komascript. For example, here it is very easy by adjusting some inputs: https://tex.stackexchange.com/questions/371983/some-definitions-parskip-baselineskip-topskip So in this case, I know what the skips are. In Koma I do not (if I am not mistaken), because all values are recomputed? – ghx12 Aug 09 '23 at 21:22
  • 1
    my answer was more accurate than my comments – David Carlisle Aug 09 '23 at 21:41

1 Answers1

2

You can see the effect using \showoutput

\documentclass[12pt]{scrreprt}
%\usepackage{setspace}% use koma functions not this
\usepackage{lipsum}
\showoutput
\showboxdepth=4
\RedeclareSectionCommands[
beforeskip=11.1pt,
afterskip=22.2pt
]{section,subsection,subsubsection}

%\doublespacing \begin{document} \section{Hello} \lipsum \end{document}

produces

...\hbox(12.0+0.0)x448.13095, glue set 186.72131fil
....\hbox(12.0+0.0)x33.79214 []
....\OT1/cmss/bx/n/17.28 H
....\OT1/cmss/bx/n/17.28 e
....\OT1/cmss/bx/n/17.28 l
....\OT1/cmss/bx/n/17.28 l
....\OT1/cmss/bx/n/17.28 o
....\penalty 10000
....\glue(\parfillskip) 0.0 plus 1.0fil
....\glue(\rightskip) 0.0 plus 1.0fil
...\write1{\@writefile{toc}{\protect \contentsline {section}{\protect \numberli
ne \ETC.}
...\penalty 10000
...\glue 22.2
...\glue(\parskip) 0.0 plus 1.0
...\glue(\parskip) 0.0
...\glue(\baselineskip) 6.16669
...\hbox(8.33331+2.33331)x448.13095, glue set - 0.63269
....\hbox(0.0+0.0)x11.74988
....\OT1/cmr/m/n/12 L
....\OT1/cmr/m/n/12 o
....\OT1/cmr/m/n/12 r
....\OT1/cmr/m/n/12 e
....\OT1/cmr/m/n/12 m
....\glue 3.91663 plus 1.95831 minus 1.30554

so between Hello and Lorem you get 22.2pt (here) in addition to the \parskip of 0pt plus 1pt and \baselineskip of 6.16669pt which combined with the height 8.33331pt of L gives the 14.5pt baselineskip set by the class

David Carlisle
  • 757,742