1

In my Document, I'm using scrlayer-scrpage to generate a page header on all pages. However, one chapter name is too long to display it, so I want to replace it with a shorter version. Heres my relevant commands (not a working example):

\documentclass[11pt,paper=a4]{scrreprt}
\usepackage[headsepline = on,
footsepline = on,
plainheadsepline = on, 
plainfootsepline = on]{scrlayer-scrpage}

\renewcommand*{\chaptermarkformat}{}
\automark{chapter}

\lohead*{\textup{Document Name}}
\chead{}
\rohead*{\textup{\rightmark}}

\cfoot*{\textup{Page \pagemark}}

\begin{document}
\pagestyle{headings}

\chapter{Very long chapter name}\chaptermark{Shorter chapter name}

This works fine for the following pages of the chapter, but not for the first one. On the first page of the chapter it displays the 'Very long chapter name'. Does anyone know why this happens? How can this be fixed?

2
  • You are using \rightmark, and \rightmark gives the first mark, and this set by the \chapter command. Use \leftmark instead. Nov 18, 2019 at 20:14
  • This solved the problem ✓
    – julian
    Nov 18, 2019 at 21:19

1 Answer 1

1

I would suggest to set the KOMA-Script class option headings=optiontoheadandtoc. Then you can use the advanced functionality of the optional argument of the sectioning commands.

Example:

\documentclass[
  %11pt,paper=a4,% default
  headings=optiontoheadandtoc% <- added
  ]{scrreprt}
\usepackage[
  headsepline = on,plainheadsepline = on,
  footsepline = on,plainfootsepline = on,
]{scrlayer-scrpage}% sets automatically pagestyle scrheadings (headings is only an alias of scrheadings}
\automark{chapter}
\renewcommand*{\chaptermarkformat}{}
\addtokomafont{pageheadfoot}{\upshape}
\ihead*{Document Name}
\chead{}
\ohead*{\rightmark}
\renewcommand\pagemark{{\usekomafont{pagenumber}Page \thepage}}

\begin{document}
\tableofcontents
\chapter[head={Shorter chapter name}]{Very long chapter name}
\end{document}

Result:

enter image description here

Note that package scrlayer-scrpage sets page style scrheadings automatically and it redefines headings as an alias style of scrheadings.

You must log in to answer this question.

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