[Tex/LaTex] KOMA-Script and vertical spacing after paragraph headline

koma-script

I'm currently having troubles changing the vertical spacing from a paragraph headline to the succeeding body text. What I want to have is a newline after the paragraph heading. As I understood the new \RedeclareSectionCommand applies afterskip=1sp a newline (singlespacing) between the paragraph section and its body text. Somehow this is not working the way I want it to have. My code looks right now something like (MWE):

\documentclass[12pt,english,parskip=half*,listof=nochaptergap,final]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage{setspace}

\RedeclareSectionCommands[
    beforeskip=-3.25ex plus -1ex minus -0.2ex,
    afterskip=1sp,
    %indent=0pt
]{paragraph,subparagraph}

\onehalfspacing

\begin{document}
\paragraph{Test paragraph}
Test test test test test \\
Test test test test test
\end{document}

What I want to have is a newline after a paragraph and if it is possible, an option to customize the vertical spacing myself.

— SOLUTION —

Just in case someone is as weird as me, just remove parskip=half* from the document options, and you are good to go! THANK YOU @esdd!!!

Best Answer

Update

KOMA-Script version 3.26 introduces two new keys to \RedeclareSectionCommand and \RedeclareSectionCommands: runin and afterindent. Possible values for both keys are bysign, true and false. 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 value false¹ it is possible to remove the \parskip between the heading and the following text by afterskip=-\parskip.

Example:

\documentclass[12pt,english,parskip=half*,listof=nochaptergap,final]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[onehalfspacing]{setspace}

\RedeclareSectionCommands[
    beforeskip=-3.25ex plus -1ex minus -0.2ex,
    runin=false,
    afterskip=-\parskip
]{paragraph,subparagraph}

\usepackage{blindtext}
\begin{document}
\paragraph{Test paragraph}
\Blindtext[2]
\end{document}

screenshot

¹ Default setting is runin=bysign which results in the same behavior as in the original answer.


Original answer

The vertical space between a heading and the following text is at least the same as the space between two paragraphs in the text body. That means if you are using a parskip instead a parindent (because of parskip=half*) the space between a heading and the following text is at least the same as this parskip.

enter image description here

Code:

\documentclass[12pt,english,parskip=half*,listof=nochaptergap,final]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[onehalfspacing]{setspace}

\RedeclareSectionCommands[
    beforeskip=-3.25ex plus -1ex minus -0.2ex,
    afterskip=1sp,% smallest possible positive value
]{paragraph,subparagraph}

\usepackage{blindtext}
\begin{document}
\paragraph{Test paragraph}
\Blindtext[2]
\end{document}

A positive value of afterskip for a section command enlarges the vertical skip by this value. With negative value of afterskip the text the starts in the same line as the heading and the value of afterskip is used as a horizontal skip.

enter image description here

Code:

\documentclass[12pt,english,parskip=half*,listof=nochaptergap,final]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[onehalfspacing]{setspace}

\RedeclareSectionCommands[
    beforeskip=-3.25ex plus -1ex minus -0.2ex,
    afterskip=-1em,% works as horizontal skip of 1em
]{paragraph,subparagraph}

\usepackage{blindtext}
\begin{document}
\paragraph{Test paragraph}
\Blindtext[2]
\end{document}

So remove parskip=half* from your class options. Then parindent is used instead parskip and only the positive value of afterskip is used as vertical skip between the heading and the following text.

enter image description here

Code:

\documentclass[12pt,english,
    %parskip=half*,% <- commented, so parskip=false is used
    listof=nochaptergap,final
]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[onehalfspacing]{setspace}

\RedeclareSectionCommands[
    beforeskip=-3.25ex plus -1ex minus -0.2ex,
    afterskip=1sp,
]{paragraph,subparagraph}

\usepackage{blindtext}
\begin{document}
\paragraph{Test paragraph}
\Blindtext[2]
\end{document}

If you really want or need parkip=half and remove the parskip between the paragraph heading you could use

\documentclass[12pt,english,parskip=half,listof=nochaptergap,final]{scrreprt}
\usepackage[utf8]{inputenc}

\RedeclareSectionCommands[
beforeskip=-3.25ex plus -1ex minus -0.2ex,
afterskip=1sp,
%indent=0pt
]{paragraph,subparagraph}

\usepackage{xpatch}
\xapptocmd{\sectionlinesformat}{%
\ifstr{#1}{paragraph}{\vspace*{-\parskip}}{}%
\ifstr{#1}{subparagraph}{\vspace*{-\parskip}}{}%
}{}{}

\usepackage{blindtext}
\begin{document}
\paragraph{Test paragraph}
\Blindtext[2]
\end{document}

enter image description here

But I do not recommend this, because it is unusual to have a smaller space between a heading and the following text as between two paragraphs in the text body.