When using KOMA-Script, one has \RedeclareSectionCommand
available to adjust the spacing before/after section titles, as described in this question.
I want the content of the section to appear on the immediate next line under the section title, without any extra vertical space. The following mwe shows the content as I want it:
\documentclass{scrartcl}
\begin{document}
\RedeclareSectionCommand[afterskip=1pt]{section} %the magic happens here
\section{Foo}
This is some text to show off
\section{Bar}
This is some text to show off
\section{Baz}
This is some text to show off
\end{document}
In my actual document however, I use parskip=full-
as argument to \documentclass
. This has the effect, that there will be an empty line between the section title and the section content, which I don't want. The mwe also shows this behaviour. Every allowed value for parskip with starts with full
or half
shows this behaviour.
I think this is the normal and expected behaviour, as the german documentation explicitly states that the whitespace preceedes the paragraph.
Because time is an issue right now, I hacked it by putting \vspace*{-\baselineskip}
after every \section{}
, but this is of course unacceptable for long term use.
How do I get the behaviour of parskip=full-
and \RedeclareSectionCommand[afterskip=1pt]{section}
, with the exception that I don't want any vertical space between the section title and the corresponsing content?
Best Answer
Update
It is still not recommanded but now possible without patching a command because KOMA-Script version 3.26 introduces two new keys to
\RedeclareSectionCommand
and\RedeclareSectionCommands
:runin
andafterindent
. Possible values for both keys arebysign
,true
andfalse
. For more information see the KOMA-Script documentation or eg Adjusting spacing around section/subsection titles with koma-script.Using the new key
runin
with valuefalse
¹ it is possible to remove the\parskip
between the heading and the following text byafterskip=-\parskip
.Example:
The (ugly) result is the same as in the original answer below.
¹ Default setting is
runin=bysign
which results in the same behavior as in the original answer.Original answer
It is not recommended - see tex.stackexchange.com/a/300541/43317 and komascript.de/node/2039 (German) - but possible with KOMA-Script version 3.19 or newer:
As you can see the result looks weird: