[Tex/LaTex] Page header too high with scrlayer-scrpage

koma-script

I'm designing an exercise sheet and need some help with the header. It looks as it should with my code, but is way too high on the page. Changing the headheight does not seem to have any effect, only that LaTeX complains if i choose it too low.

Is there a way to get it lower onto the page? Or do i have to do the two-line header in another way?

Additionally, i'd like to know if there's an easy possibility to only show the header on those pages where a new section begins, and not on the other pages (e.g. on the first two pages, but not the last one in the example).

\documentclass[paper=a4, twoside=true, fontsize=11pt, parskip=half, headheight=1cm, DIV=12]{scrartcl}

% Designing the head of the page
\usepackage[automark,headsepline]{scrlayer-scrpage}
\pagestyle{scrheadings}
\ihead{{\normalfont\bfseries Exercise Sheet \thesection\  for some Lecture, Summer 2015}\\
    \normalfont Due date: Thursday, 01. January 2015, 10:00}
\ohead{{\normalfont\bfseries Prof. Dr. John Doe}\\
    \normalfont email@professor.com}
\chead{}

\usepackage{blindtext}

\begin{document}
\blinddocument
\end{document}

Best Answer

Maybe you are looking for the headinclude=true option. You can set this option explicitly \documentclass[...,headinclude=true,...]{scrartcl}. Or you can set the headsepline option as an class option. Then headinclude=true will be set automatically.

If there should only be a header in case a section starts on the page use the plain pagestyle and switch to scrheadings using \thispagestyle{scrheadings} after the \section command

\documentclass[
  twoside=true,
  parskip=half,
  headlines=2,
  headsepline,% headinclude=true is also set
  DIV=12
  ]{scrartcl}
% Designing the head of the page
\usepackage[
    %automark,% why? \headmark etc. are not used in your code
    %headsepline
  ]{scrlayer-scrpage}
\ihead{\textbf{Exercise Sheet \thesection\  for some Lecture, Summer 2015}\\
    Due date: Thursday, 01. January 2015, 10:00}
\ohead{\textbf{Prof. Dr. John Doe}\\
    email@professor.com}
\chead{}

\setkomafont{pagehead}{\normalfont}

\pagestyle{plain}

\usepackage{blindtext}

\begin{document}
\section{First section}\thispagestyle{scrheadings}
\subsection{First subsection}
\Blindtext
\subsection{Second subsection}
\Blindtext
\section{Second section}\thispagestyle{scrheadings}
\subsection{First subsection}
\Blindtext
\subsection{Second subsection}
\Blindtext
\end{document}

enter image description here

Alternatively you can load etoolbox to patch the \section command

\documentclass[
  twoside=true,
  parskip=half,
  headlines=2,
  headsepline,% headinclude=true is also set
  DIV=12
  ]{scrartcl}
% Designing the head of the page
\usepackage[
    %automark,% why? you define the header manually in your code
    %headsepline
  ]{scrlayer-scrpage}
\ihead{\textbf{Exercise Sheet \thesection\  for some Lecture, Summer 2015}\\
    Due date: Thursday, 01. January 2015, 10:00}
\ohead{\textbf{Prof. Dr. John Doe}\\
    email@professor.com}
\chead{}

\setkomafont{pagehead}{\normalfont}

\pagestyle{plain}

\usepackage{etoolbox}
\pretocmd\section{\thispagestyle{scrheadings}}{}{}

\usepackage{blindtext}

\begin{document}
\section{First section}
\subsection{First subsection}
\Blindtext
\subsection{Second subsection}
\Blindtext
\section{Second section}
\subsection{First subsection}
\Blindtext
\subsection{Second subsection}
\Blindtext
\end{document}
Related Question