2

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!!!

  • The space between a heading and the following text is at least the same as the space between two paragraphs in the text body. So with afterskip=1sp you get the space of the parskip between your paragraph heading and the following text. If you enlarge afterskip this space is enlarged by the same value. – esdd Feb 10 '16 at 8:46
  • Thank you @esdd for your explanation. At least means that there is no chance to apply additionally a negative value so that there is some kind negative spacing (parskip). I have tried it had no luck so far. – hetsch Feb 10 '16 at 9:31
  • Strange, because I think that in your other answer tex.stackexchange.com/a/232909/46403 it is somehow working that there is the same amount of vertical space between the paragraph headline and the body text, as the amount of lineheight between the body text. – hetsch Feb 10 '16 at 9:43
  • In that question the parskip option is not used while you are setting parskip=half* ;-) – esdd Feb 10 '16 at 9:49
  • 1
    A negative value of afterskip changes the vertical skip to a horizontal skip. So the text would start in the same line as the heading. – esdd Feb 10 '16 at 9:51
3

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.

  • Sorry, @esdd to ask again. I need parskip=half to separate succeeding paragraphs with parskip space between them with no hanging indent. If I remove parskip=half, I solves the problem of the vspace between the paragraph headline and the body text, but it turn gives me no vspace between the succeeding paragraphs and additionally adds a hanging indent. If I understood it right, if I want to have parskip=half, the vspace between the paragraph headline and the following text is ALWAYS parskip, and there is no chance to adapt this behavior.? Sorry for the long comment. – hetsch Feb 26 '16 at 12:23
  • @hetsch See my updated answer. – esdd Feb 27 '16 at 1:35
  • This is absolutely awesome answer! Thank your @esdd, i also understand that it is not recommended, but I need it for subparagraphs. Long story ... Anyways, thank you for your efforts and time, very appreciated! – hetsch Feb 27 '16 at 8:38

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.