[texhax] Stretchable line skip in scrartcl?

Ulrike Fischer news3 at nililand.de
Thu May 18 16:47:41 CEST 2017


Am Wed, 17 May 2017 19:13:38 +0000 schrieb Aleksandar Zec:

> Hi all,
> 
> I have successfully used many times this method, provided by Heiko
> Oberdiek, to stretch line skip in cases of emergency:
> http://tug.org/pipermail/texhax/2010-October/015736.html


> However, it doesn't work with koma classes, say scrartcl.

KOMA redefines \baselinestretch from "nothing" to 1. 

This means that in the code somewhere the calculation

\baselineskip= 1\baselineskip

is done. And it this case TeX force the glue (with stretchable
space) into a dimen (without it). You would get the same effect with
article, if you would add a \renewcommand\baselinestretch{1} to your
document.

You could try \renewcommand\baselinestretch{}, but it could fail if
KOMA uses the command in places where a number is expected. Or you
could use \glueexpr in \set at fontsize:

\RequirePackage{etoolbox}
\makeatletter

\patchcmd\set at fontsize{\baselineskip\f at linespread\baselineskip}{%
 \ifdefempty{\f at linespread}%
 {\baselineskip=\baselineskip}% 
 {\baselineskip=\glueexpr \baselineskip *
\f at linespread\relax}}{}{\fail}

\let\org at set@fontsize\set at fontsize
\def\set at fontsize#1#2#3{%
  \@defaultunits\@tempskipa#3pt\relax\@nnil
  \advance\@tempskipa by 0pt\@plus 1pt\relax
  %\advance\@tempskipa by 0pt\@plus .2\@tempskipa\relax
  \expandafter\set at fontsize@i\the\@tempskipa\@nil{#1}{#2}%
}
\def\set at fontsize@i#1\@nil#2#3{%
  \org at set@fontsize{#2}{#3}{#1}%
}
\makeatother

\documentclass[a4paper,11pt]{scrartcl}
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}

\flushbottom
\blindtext\par
\blindtext\par
\blindtext\par
\blindtext\par

\rule{1cm}{10cm} %to force a page break

\blindtext\par
\blindtext\par
\end{document}







-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/



More information about the texhax mailing list