Change footskip in koma-script with scrlayer-scrpage pagestyle

footerkoma-scriptpagestylescrlayer-scrpage

I feel like this is somewhat of a common problem where most people just give up on. What I want, is to reduce the space between the the text area and the footer. So there is less white space between the text area and the blue line.
enter image description here

Btw, why is there no box around the footer?


What I don't want to do:

  • Not using koma-script. See here.

  • Use geometry package, because from what I understand, it doesn't go well with koma-script. What is even to point to use koma then? I know that there is the usegeometry option in the newer versions. Like in this question.

  • Use enlargefirstpage, because this only works on the first page. See here.


Looking through $texdoc koma-script:

I found this nice picture of the page geometry and from there it looks like the value to change here is \footskip.
enter image description here

Additionally, scrlayer-scrpage interprets \footskip to be the distance from the last baseline of the text area to the first normal baseline of the footer.

Good to know, so if I could set \footskip to 0 there should be no space between the text area and the footer. But would this space be added to the text area or would the footer just move up?

footskip
This composite option sets hoffset, voffset, width, height, and align so that the layer spans the vertical distance between the text area and the page footer over the width of the text area. Note, however, that although the height of this area depends on \footskip, it is not the same. This option does not expect or allow a value.

That is in some table for layer options with scrlayer-scrpage. I'm not rally sure how this could help, because as it says: This option does not expect or allow a value.

What I tried so far:

  • I played with \setlength{\textheight}{1.1\textheight} (after \typearea[current]{last}) and the KOMAoptions footheight. This doesn't change \footskip at all, but could be used to select where the space would be added.

My Solution \setlength{\footskip}{0\baselineskip}

For some unknown reason, the footer ends up overlapping the end of the text area. So \footskip should be \TheFootSkipDescribedInTheKomaDocs + \footheigh + \BottomRuleWith (2mm in my example).

With this it is possible to move the footer up and down, but the text area won't expand. Now \setlength{\textheight}{1.1\textheight} comes into play as well, and we have a complete solution.

Because of how everything 'works', I can't help but feel like, that I've done a hack-job here and there is probably a much cleaner way of doing this and if not this would at least help some other person on the internet, because I searched for hours.

The still open questions:

  1. Is there a better solution?
  2. Why is there no show box around the footer with \usepackage{showframe}?
  3. Why doesn't \setlength{\footskip}{0\baselineskip} result in this: "[…] if I could set \footskip to 0 there should be no space between the text area and the footer." I think it is the same reason as Question 2, because latex thinks the footer is empty or something and uses the length from the text area to the "box" that has no height at the bottom as \footskip. But why?
\documentclass[fontsize=12pt, paper=a4, ngerman, listof=numbered, headinclude, headsepline, parskip=half, DIV=19]{scrreport}
\usepackage{scrhack}

\RequirePackage[ngerman]{babel}
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{setspace}
\onehalfspacing

\let\raggedsection\centering
\RedeclareSectionCommands[
    beforeskip=0mm,
    runin=false,
    afterskip=-0.5\parskip
]{section,paragraph,subparagraph}

\usepackage{scrlayer-scrpage}
\usepackage[table,xcdraw]{xcolor}

\definecolor{red}{HTML}{D01010}
\definecolor{blue}{HTML}{1010D0}
\setkomafont{headsepline}{\color{red}}
\setkomafont{footsepline}{\color{blue}}

\KOMAoptions{
    onpsinit={\linespread{1}\selectfont},
    headheight=20mm,
    footinclude,
    footheight=25mm,
    footwidth=foot
}

\newpagestyle{mystyle}
{ % header
    % optional - top rule
    {} % two-side - left page
    {} % two-side - right page
    { % one-side
        Header
    }
    % optional - bottom rule
    (\textwidth,2mm)
}
{ % footer
    % optional - top rule
    (\textwidth,2mm)
    {} % two-side - left page
    {} % two-side - right page
    { % one-side
        {
            Footer
        }
    }
    % optional - bottom rule
}

% recalc typearea
\typearea[current]{last}

\pagestyle{mystyle}

\usepackage{showframe}
\usepackage{lipsum}

\begin{document}
    \section*{Test 1}
    \lipsum[1-2]
    \section*{Test 2}
    \lipsum[3-4]
    \section*{Test}
    \lipsum[5-6]
\end{document}

Best Answer

  • \enlargefirstpage and the pseudolength firstfootvpos (shown in the picture in the question) are provided by class scrlttr2 and package scrletter. They are not relevant with scrreprt. As you mentioned, \footskip is the distance from the last baseline of the text area to the first normal baseline of the footer. The position of this first normal baseline of the footer is shown by package showframe.
  • Package showframe does not show a box around the footer, because eg. standard classes do not provide an opiton footheight and the length \footheight. Package typearea sets \footskip to \footheight+2.25\baselineskip. Therefore the space between the text area and your footer in your example ca. 2.25\baselineskip.
  • You can visualize the position of your footer using the following code in the preamble (after definition of page style mystyle):
% visualize the footer layer:
\DeclareNewLayer[
  clone=mystyle.foot.oneside,
  contents=\textcolor{red!50}{\layercontentsmeasure}
]{measuremyfooter}
\AddLayersToPageStyle{mystyle}{measuremyfooter}

enter image description here

  • From the KOMA-Script documentation:

If you have concrete specifications for the margins, typearea is not suitable. In this case, you should use the geometry package.

So the KOMA-Script documentation itself suggests to use package geometry if you have special requirements for the page layout. Additionally, you should use class option usegeometry. (It is not recommended to change \textheight and \footskip manually.)

Example:

\documentclass[
  fontsize=12pt, paper=a4,
  ngerman,
  listof=numbered,
  headinclude,headsepline,headheight=20mm,
  footinclude,footheight=25mm,
  parskip=half,
  DIV=19,
  usegeometry%<- added
]{scrreport}
\usepackage{scrhack}

\usepackage{babel}
%\usepackage[utf8]{inputenc}% needed with outdated TeX distributions
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{setspace}
\onehalfspacing

\usepackage{geometry}
\geometry{
  footskip=\dimexpr\footheight+2mm\relax,
  bottom=\baselineskip,
  heightrounded
}

\usepackage[table,xcdraw]{xcolor}
\definecolor{red}{HTML}{D01010}
\definecolor{blue}{HTML}{1010D0}

\usepackage[singlespacing=true]{scrlayer-scrpage}
\setkomafont{headsepline}{\color{red}}
\setkomafont{footsepline}{\color{blue}}

\newpagestyle{mystyle}
{ % header
    % optional - top rule
    {} % two-side - left page
    {} % two-side - right page
    { % one-side
        Header
    }
    % optional - bottom rule
    (\textwidth,2mm)
}
{ % footer
    % optional - top rule
    (\textwidth,2mm)
    {} % two-side - left page
    {} % two-side - right page
    { % one-side
        {
            Footer
        }
    }
    % optional - bottom rule
}

\pagestyle{mystyle}

\renewcommand*{\raggedsection}\centering
\RedeclareSectionCommands[
    beforeskip=0mm,
    runin=false,
    afterskip=-0.5\parskip
]{section,paragraph,subparagraph}

\usepackage{showframe}% to show the page layout
% visualize the footer layer:
\DeclareNewLayer[
  clone=mystyle.foot.oneside,
  contents=\textcolor{red!50}{\layercontentsmeasure}
]{measuremyfooter}
\AddLayersToPageStyle{mystyle}{measuremyfooter}

\usepackage{lipsum}% dummy text

\begin{document}
\addsec*{Test 1}
\lipsum[1-2]
\addsec*{Test 2}
\lipsum[3-4]
\addsec*{Test}
\lipsum[5-8]
\end{document}

enter image description here

Related Question