1

I'm a bit lost using the scrlayer-scrpage package.

I want to have have an \ohead{...} header on the first page of a chapter that slightly differs from the other headers.

So I started by using the scrlayer-scrpag package:

\documentclass[a4paper,ngerman]{scrreprt}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[paper=a4paper, top=3.5cm]{geometry}
\usepackage{blindtext}
\usepackage[headsepline=0pt,automark]{scrlayer-scrpage}

\clearpairofpagestyles
%%%%% Right Header
\ohead{
\leftmark \thepage
}

\begin{document}
\Blinddocument
\end{document}

In my document, the \ohead{} field is a little bit more complex and there are \lhead{} and \ofoot{} definitions too, but this should just fit for our example right now.

Now, as intended by LaTeX, the first page of every chapter looks different to the other pages, because there are neither headers and footers.

So I used the

\renewcommand\chapterpagestyle{scrheadings}

command to apply the same style to all pages.

That's kind of pretty near to where I want to go, but I just don't want to have the \leftmark (meaning the title) in the header of the first page of every chapter due to the fact that it is standing right below in the "normal" text.

So for the first page of every chapter, the header shall look like that:

\ohead{
\\thepage
}

On on the other pages, it should look like that:

\ohead{
\leftmark \thepage
}

So is there a possibility to make LaTeX just make ignore the \leftmark on every first page of a chapter? Or, alternatively, is there a possibility to define a seperate \ohead{} for the first page of every chapter?

BR, Toni

2 Answers 2

1

By default (without any change of \chapterpagestyle) chapter pages use page style plain.

You can use the optional argument of \ihead, \ohead etc. to set the content of header and footer for pages with page style plain:

\documentclass[ngerman]{scrreprt}% paper=a4 is default

\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc}% only needed with outdated TeX distributions
\usepackage[top=3.5cm]{geometry}
\usepackage{blindtext}
\usepackage[headsepline=0pt,automark]{scrlayer-scrpage}

\clearpairofpagestyles
%%%%% Outer Header
\ohead
  [\pagemark]% <- added
  {\leftmark\ \pagemark}
\setkomafont{pagenumber}{}

\begin{document}
\Blinddocument
\end{document}

enter image description here

Additional remark: If the content of a header or footer element should be the same for both page styles plain and scrheadings, you can use the starred version for this element. Eg. \ohead*{<content>} is the short version of \ohead[<content>]{<content>}.

0

Answer found by myself:

\newpairofpagestyles[scrheadings]{specialchapter}{\ohead*{\thepage}}
\renewcommand\chapterpagestyle{specialchapter}

Makes a new "specialchapter" style I can apply on chapterpagestyle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.