0

When I manually set the page number to appear in the \cfoot with scrlayer-scrpage, I get both page numbers: one in the \cfoot and one in the \ofoot. The one in the \ofoot is only triggered by the twoside option of the documentclass. Adding a \clearpairofpagestyles directly after loading scrlayer-scrpage makes the header disappear as well, which I find strange - I thought this option was meant to clear the styles before defining a new style. Why does it make the header which is loaded after it disappear? And how do I get rid of the default page number in the \ofoot?

MWE:

\documentclass[twoside, chapterprefix=true]{scrreprt}

\usepackage[manualmark]{scrlayer-scrpage}
%\clearpairofpagestyles

%%--"Chapter #" in lehead (only for numbered chapters), chapter name in rohead
\renewcommand*\chaptermark[1]{%
    \markboth{\ifnumbered{chapter}{\chaptermarkformat}{}}{#1}%
}

\AfterTOCHead[toc]{\markboth{}{\contentsname}}

\cfoot[\pagemark]{\pagemark}


\usepackage{lipsum}

\begin{document}

\chapter{First}

\lipsum[1-18]

\end{document}
7
  • 1
    In addition to page styles plain, empty, headings and myheading, KOMA adds scrheadings,and plain.scrheadings. There is no easy way to tell what the current page style is, but you can see what happens when you select a different one using \pagestyle or \thispagestyle. May 5 '20 at 13:26
  • 1
    You are not loading or redefining the header in your code. You are only changing the foot. May 5 '20 at 13:34
  • @JohnKormylo headings and scrheadings both print the header and two page numbers, plain and plain.scrheadings only print the two page numbers (as expected) and empty prints no header or footer (as expected). Can I conclude from this that the current page style is either headings or scrheadings? Your comment got me thinking and I simply added \ofoot[]{}, which solved the problem. But I suppose that this isn't very good style? I'm not very good at KOMA-script. I'm trying to learn but I find the documentation a bit hard to grasp, especially the Additonal Information chapters.
    – C.Carl
    May 5 '20 at 14:27
  • 2
    \markboth and \chaptermark stores something in a mark, but this stored material is only used if the header definition contains a command like \headmark or \leftmark. If you clear the header than the marks are simply not used. May 5 '20 at 14:53
  • 1
    and don't worry about not understanding koma script: that is no easy read, even for programmers. May 5 '20 at 14:55
0

Package scrlayer-scrpage sets page style scrheadings automatically. Additionaly it redefines headings as alias of scrheadings (or the main style of the active pair of layer page styles) and plain as alias of plain.scrheadings (or the plain style of the active pair of layer page styles). On chapter pages plain (= the plain style of the active pair of layer page styles) is used.

You could use either

\documentclass[twoside, chapterprefix=true]{scrreprt}
%\providecommand*\Ifstr{\ifstr}% needed up to and including KOMA-Script version 3.27, see https://komascript.de/faq_deprecatedif

\usepackage[manualmark]{scrlayer-scrpage}
\renewcommand*\chaptermark[1]{%
    \markboth{\Ifnumbered{chapter}{\chaptermarkformat}{}}{#1}% <- outdated macro replaced
}
\AfterTOCHead[toc]{\markboth{}{\contentsname}}

\clearpairofpagestyles
\ohead{\headmark}
\cfoot*{\pagemark}% short version of \cfoot[\pagemark]{\pagemark}


\usepackage{blindtext}

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

or

\documentclass[twoside, chapterprefix=true]{scrreprt}
%\providecommand*\Ifstr{\ifstr}% needed up to and including KOMA-Script version 3.27, see https://komascript.de/faq_deprecatedif

\usepackage[manualmark]{scrlayer-scrpage}
\renewcommand*\chaptermark[1]{%
    \markboth{\Ifnumbered{chapter}{\chaptermarkformat}{}}{#1}% <- outdated macro replaced
}
\AfterTOCHead[toc]{\markboth{}{\contentsname}}

\ofoot*{}% short version of \ofoot[\pagemark]{\pagemark}
\cfoot*{\pagemark}% short version of \cfoot[\pagemark]{\pagemark}


\usepackage{blindtext}

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

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.