0

My document contains pages where the \parskip has been stretched. A consequence of this is that the text below section titles is too far away from the text which follows it. How can I make the section titles a constant distance away from the following paragraph?

MWE:

\documentclass[12pt]{scrbook}
\usepackage[top=80mm]{geometry}
\usepackage{calc}


\RedeclareSectionCommand[%
  beforeskip= 0.5\baselineskip plus 2\baselineskip minus 0.1\baselineskip,
  afterskip=\parskip]{section}

\setparsizes{0em}{0.1\baselineskip plus 1\baselineskip}{0.5em plus 1fil} 

\newcommand{\lsec}{%
\section{Small sec}
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par}

\newcommand{\msec}{%
\section{Medium sec}
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\par}

\begin{document}
\lsec\lsec\lsec\msec\lsec\lsec
\end{document}

enter image description here

That is, the AAAs should be equally distant from each heading, though the paragraphs may be unequally spaced.

I tried changing afterskip=1sp, but this still leaves the \parskip or parfillskip value (I can't tell which is which from the cls file.)

  • 1
    Is there a reason why you use \setparsizes{0em}{0.1\baselineskip plus 1\baselineskip}{0.5em plus 1fil}. Then you have a really small par skip (.1\baselineskip) with a large glue (1\baselineskip). So there is a big difference between stretched and non stretched par skips. Maybe you can decrease the glue to .1\baselineskip. Note that \section itself uses a \par command and inserts a par skip. With afterskip=\parskip the glue is inserted twice. – esdd Jun 22 '16 at 22:25
  • The extreme values were just to demonstrate a MWE. My document does use setparsizes but with more plausible values. However I found it hard to make a MWE with those values. – Hugh Jun 23 '16 at 1:19
  • You can try \usepackage{xpatch}\xapptocmd{\sectionlinesformat}{\vspace*{-\parskip}}{}{\PatchFailed} – esdd Jun 30 '16 at 6:54
  • Is there any news here? – Johannes_B May 7 '17 at 9:24
  • @Johannes_B : esdd's comment answered the question. – Hugh May 7 '17 at 10:02
1

Applying the following patch appears to solve the problem:

% Removes glue around section titles. 
\RequirePackage{xpatch}
\xapptocmd{\sectionlinesformat}{\vspace*{-\parskip}}{}{\PatchFailed}
  • you can accept own answer. however this will not increase your reputation points :-) – Zarko Feb 10 '18 at 8:30

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.