0

In my Document is a picture on the left side of the header (\ihead) and some text on the right side (\ohead). My problem is that the picture moves the text up from the headsepline and I have no idea how to move it down again.

MWE:

\documentclass[
oneside
]{scrreprt}

\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{geometry}
\geometry{                      
    a4paper,
    left=25mm,
    right=25mm,
    top=25mm,
    bottom=20mm,
    foot=10mm,
    headsep=5mm,
    heightrounded,
    %showframe
}
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\KOMAoptions{headsepline=0.5pt}
\ihead{\includegraphics[scale=0.3]{pics/hsb}}   % Kopfzeile links
\ohead{SAMPLE}
\begin{document}
    \lipsum[1-5]
\end{document}

The result is: with picture in header

The result without including the picture:

without the picture

How can i get the SAMPLE text back to the headsepline?

1 Answer 1

2

The default of scrlayer-scrpage is to vertically center the three header/footer boxes. So one suggestion would be to set the height of the image to the height of a standard text line using \ht\strutbox as (first) optional argument of a \raisebox:

\documentclass[
oneside% default and therefore not needed
]{scrreprt}

\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{geometry}
\geometry{                      
    a4paper,% default of scrreprt and therefore not needed
    left=25mm,
    right=25mm,
    top=25mm,
    bottom=20mm,
    foot=10mm,
    headsep=5mm,
    heightrounded,
    %showframe
}
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\KOMAoptions{headsepline=0.5pt}
\ihead{\raisebox{0pt}[\ht\strutbox]{\includegraphics[scale=0.3]{example-image}}}   % Kopfzeile links
\ohead{SAMPLE}
\begin{document}
    \lipsum[1-5]
\end{document}

Using \smash instead of \raisebox{0pt}[\ht\strutbox] would also work.

Both suggestions also remove the warning:

Package scrlayer-scrpage Warning: \headheight to low.

2
  • That worked perfectly! Is the warning coming from the definition of the margins?
    – reneas
    Commented Jan 5 at 20:02
  • The warning was, because the image is higher than \headheight. But my \raisebox reduces the logical height and \smash even sets it to 0.
    – cabohah
    Commented Jan 6 at 9:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .