[Tex/LaTex] How to force KOMA-Script use headers/footers as standard classes

header-footerkoma-script

It is known that KOMA-Script has more flexibility than standard classes. One example is the ability to use any font size (e.g., 11.5pt). One problem appears though, which is headers and footers placing. In the standard classes, page numbers, e.g., in the bottom are placed wisely but in KOMA it is too close to the paper edge.

The question is how to force KOMA use the same distance for footers, headers, rules and margins as standard classes. Here is a MWE:

\documentclass[12pt,a4paper]{article}
\usepackage[margin=2cm]{geometry}
\begin{document}
A test document
\end{document}

which outputs the footer correctly:

enter image description here

Whereas using KOMA-Script:

\documentclass[12pt,a4paper]{scrartcl}
\usepackage[margin=2cm]{geometry}
\begin{document}
A test document
\end{document}

outputs this (undesired) behavior:

enter image description here

Any idea? Thank you.

EDIT:

The strange behavior in headers also can be shown by this example:

\documentclass[12pt,a4paper,headsepline,twoside=false]{scrbook}
\usepackage[left=3.50cm, right=2.50cm, top=2.5cm, bottom=2.5cm]{geometry}
\usepackage{pagegrid}
\begin{document}

\mainmatter
\chapter{Test Chapter}
\noindent 
Some plain text just to fill paragraph lines. Some plain text just to fill paragraph lines.

\newpage     
\noindent 
Some plain text just to fill paragraph lines. Some plain text just to fill paragraph lines. Some plain text just to fill paragraph lines. Some plain text just to fill paragraph lines. Some plain text just to fill paragraph lines. Some plain text just to fill paragraph lines. Some plain text just to fill paragraph lines. Some plain text just to fill paragraph lines. Some plain text just to fill paragraph lines. 

\end{document}

Problems in the header are shown in the following image:

enter image description here

Best Answer

If you want the same footskip as ​used by the standard class article then change it to 30pt:

\documentclass[12pt,a4paper]{scrartcl}
\usepackage[margin=2cm,
  footskip=30pt% <- added
]{geometry}
\begin{document}
A test document: \the\footskip
\end{document}

enter image description here


Explanation:

With a KOMA-Script class the \footskip is set to 3.5\baselineskip. The standard classes article and report use 30pt as \footskip while the book class uses .35in with fontsize 10pt, .38in with 11pt and 30pt with fontsize 12pt. If you change only the margins using package geometry the \footskip is not changed even if you use a standard class. See the following example:

\documentclass[12pt,a4paper]{article}
\usepackage[
  margin=30pt,
  showframe% to show the page layout
  ]{geometry}
\begin{document}
A test document: \the\footskip
\end{document}

Result:

enter image description here

As you can see the page number can be also too close to the paper edge even if the standard class article is used. Hence the page number is not placed wisely by the standard class - its baseline is simple placed 30pt below the text body.

So if you change the margins manually it is your task to manually adjust the footskip.

If the baseline of the page number should be in the middle of the white space you can use footskip=1cm (= half of the bottom margin). Or choose something like footskip=\dimexpr1cm+.7ex\relax if the page number should be nearly centered in the white space at the bottom.


Update/Addition (regarding the changed question and a comment)

Here is your second example using the packages showframe and layout:

\documentclass[12pt,a4paper,headsepline,twoside=false]{scrbook}
\usepackage[left=3.50cm, right=2.50cm, top=2.5cm, bottom=2.5cm,
%includehead,
]{geometry}
\usepackage{pagegrid}
\pagegridsetup{tl,firstcolor=blue!50}
\usepackage{showframe}
\usepackage{layout}
\usepackage{lipsum}
\begin{document}
\layout
\chapter{Test Chapter}
\lipsum[10]
\clearpage
\noindent\lipsum[10]
\end{document}

Result:

enter image description here

As you can see the text body starts 2.5cm below of the paper edge. Note that the KOMA option headsepline sets the KOMAoption headinclude for the KOMA package typearea. But you change your layout using geometry. So you have to tell this package that the header should be included. If you uncomment its option includehead in the example you get

enter image description here

Now the top of the header is 2.5cm below of the paper edge.

The command \layout from the package layout shows us the exact values

enter image description here

The top of the header is 1inch+\voffset+\topmargin below of the paper edge. Note that \voffset is normally 0pt. With option includehead this results in your 2.5cm (set by geometry).

The text body starts 1inch+\voffset+\topmargin+\headheight+\headskip below of the paper edge. Without option includehead this results in 2.5cm (set by geometry).

Using geometry you can controll:

  • the distance to the text body (without includehead) or the distance to the top of the header by the geometry option top
  • the height of the head by the geometry option headheight
  • the sep between header and text body by the geometry option headsep

See the documentation of geometry for more Information.