2

Currently the page numbers are missing on pages where a chapter starts. I assume this is a setting inherited by \pagestyle{scrheadings}. But how can I add page numbers to chapter start pages too?

\documentclass[chapterprefix=true, 12pt, a4paper, oneside, parskip=half, listof=totoc, bibliography=totoc, numbers=noendperiod]{scrbook}
\usepackage{blindtext}

\usepackage[automark,headsepline]{scrlayer-scrpage}
\automark{chapter}
\ihead{\leftmark}
\chead{}
\ohead{\thepage}
\ifoot*{}
\cfoot[\thepage]{}
\cfoot*{}
\ofoot*{}
\pagestyle{scrheadings}

\begin{document}
\pagenumbering{arabic}
\chapter{One}
\Blindtext
\end{document}

Chapter start page header: Chapter page header

Default page header: Default page header

  • Hi, can you modify your MWE to be compilable? – Sango Oct 10 '19 at 10:45
  • OK, demo code is now working as is. – Michael Oct 10 '19 at 10:58
2

By default chapter pages use page style plain. \ihead, \ohead etc. have a optional argument for the content on plain pages. If the content is the same on both plain and scrheadings pages, you can use the starred version, eg \ohead*{\pagemark} is a short version of \ohead[\pagemark]{\pagemark}.

I would suggest to use \pagemark for the page number in header and footer. Then the font element pagenumber (default is \normalfont\normalcolor) is taken into account.

Using \clearpairofpagestyles the predefined content of header and footer for page styles plain and scrheadings can be removed.

Note that package scrlayer-scrpage sets page style scrheadings automatically.

For onesided documents option automark does the same as \automark{chapter}.

Example:

\documentclass[chapterprefix=true,12pt, a4paper, oneside, parskip=half, listof=totoc, bibliography=totoc, numbers=noendperiod]{scrbook}
\usepackage{blindtext}

\usepackage[automark,headsepline]{scrlayer-scrpage}% sets page style scrheadings automatically
\clearpairofpagestyles
\ihead{\leftmark}
\ohead*{\pagemark}
\setkomafont{pagenumber}{}% default is \normalfont\normalcolor

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

Result:

enter image description here


Additional remarks:

If there should be a headsepline on plain pages too, add option plainheadsepline.

If you would use headsepline as class option, option headinclude would be set too (automatically).

After loading scrlayer-scrpage page style plain is an alias page style of plain.scrheadings.

  • Well explained, thanks. It's working. I'll do it like this. – Michael Oct 10 '19 at 12:20
1

OK, I found the solution. \ohead command has {} for default pages and [] for the chapter start pages. According to the manual it has another meaning but it does what I want:

\documentclass[chapterprefix=true, 12pt, a4paper, oneside, parskip=half, listof=totoc, bibliography=totoc, numbers=noendperiod]{scrbook}
\usepackage{blindtext}

\usepackage[automark,headsepline]{scrlayer-scrpage}
\automark{chapter}
\ihead{\leftmark}
\chead{}
\ohead[\thepage]{\thepage} % <- HERE: page number on chapter page and default pages
\ifoot*{}
\cfoot*{}
\ofoot*{}
\pagestyle{scrheadings}

\begin{document}
\pagenumbering{arabic}
\chapter{One}
\Blindtext
\end{document}
0

Another solution is from the documentation. http://www.pirbot.com/mirrors/ctan/macros/latex/contrib/koma-script/doc/scrguide.pdf and this link: https://golatex.de/renewcommandchapterpagestyle-t3048.html

\documentclass[chapterprefix=true, 12pt, a4paper, oneside, parskip=half, listof=totoc, bibliography=totoc, numbers=noendperiod]{scrbook}
\usepackage{blindtext}

\usepackage[automark,headsepline]{scrlayer-scrpage}
\automark{chapter}
\ihead{\leftmark}
\chead{}
\ohead{\thepage}
\ifoot*{}
\cfoot[\thepage]{}
\cfoot*{}
\ofoot*{}
\pagestyle{scrheadings}
\renewcommand{\chapterpagestyle}{scrheadings}{
}

\begin{document}
\pagenumbering{arabic}
\chapter{One}
\Blindtext
\end{document}

Edit: after comment

enter image description here

  • Thanks, i changed my answer accordingly. – Sango Oct 10 '19 at 12:25
  • 1
    The \cfoot is in the group too, so in the resulting pdf there is no page number in footer. Additionally the OP does not want a page number in footer. Therefore remove {\cfoot{-{ }\pagemark{ }-}} too. – esdd Oct 10 '19 at 12:36

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.