0

I tried a lot, but couldn't find a solution:

Im using the package scrlayer-scrpage and the article class

\clearscrheadfoot
\lehead*{\textcolor{white}{\headmark}}
\lohead*{\textcolor{white}{\headmark}}
\chead*{\begin{tcolorbox}[enhanced,
            width=\textwidth,
            height=1.5cm,
            arc=0mm,
            boxrule=0mm,
            /tcb/size=minimal,
            watermark graphics=graphics/comein_header, watermark stretch=1,]
        \end{tcolorbox}
        \vspace{0.3cm}
}

What do I have to change, that in the top left corner the section title is displayed?

1 Answer 1

1

Unfortunaly there is no MWE in the question.

Using scrheadings the header consits of 3 elements: a left-aligned, a centered and a right-aligned. The centered element overlays the left one and the right element overlays the centered element. Therefore your text (or header) width picture in the centered element overlays the left-aligned \headmark.

As a workaround you can use the right-aligned element:

Example:

\documentclass{article}
\usepackage{blindtext}% only for dummy text
\usepackage{xcolor}
\usepackage[automark]{scrlayer-scrpage}
\setlength{\headheight}{50pt}
\clearpairofpagestyles
\ohead*{\headmark\hfill}
\chead*{\textcolor{black}{\rule{\textwidth}{1.5cm}}}
\addtokomafont{pagehead}{\bfseries\color{white}}
\begin{document}
\blinddocument
\end{document}

Note that in one-sided printing, only right-hand pages exist, and LATEX designates these as odd pages regardless of their page number. Therefore \rohead (right on odd pages) or \ohead (outer on all pages) is enough.

You could also define a new layer for the background picture and add this new layer before the other ones.

Example:

\documentclass{article}
\usepackage{blindtext}% only for dummy text
\usepackage{xcolor}
\usepackage[automark]{scrlayer-scrpage}
\setlength{\headheight}{50pt}
\DeclareNewLayer[
  head,
  background,
  contents={\rule{\textwidth}{1.5cm}}
]{headerbackground}
\AddLayersAtBeginOfPageStyle{scrheadings}{headerbackground}
\AddLayersAtBeginOfPageStyle{plain.scrheadings}{headerbackground}
\clearpairofpagestyles
\ihead*{\headmark}
\chead*{\rule{0pt}{1.5cm}}
\addtokomafont{pagehead}{\bfseries\color{white}}
\begin{document}
\blinddocument
\end{document}

enter image description here

1
  • That worked perfectly! Thank you a lot :) Commented Mar 16, 2022 at 13:10

You must log in to answer this question.

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