6

I'm using the KOMA-Script to define my headings and I would like to show only the page number in the chapter start pages. I got this by creating a new style and using it with \thispagestyle{ChapterStyle} after the \chapter{}, but I have many chapters. Is there a way to add only the page number automatically to all the chapter start pages? Thanks for your attention and help! Here follows what I've done:

\documentclass[a4paper,12pt,twoside]{report}
\usepackage{lipsum}

\usepackage[automark,headsepline,headtopline,footsepline,footbotline,nouppercase]{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\chead{\normalfont{\thechapter. \headmark}}
\cfoot{\pagemark}

% To define a page style
\deftripstyle{ChapterStyle}{}{}{}{}{\pagemark}{}

\begin{document}

\chapter{Chapter One}
\thispagestyle{ChapterStyle}
\lipsum

\chapter{Chapter Two}
\lipsum

\chapter{Chapter Three}
\lipsum

\chapter{Chapter Four}
\lipsum

\end{document}
  • What is a chapter page? The chapter start page? – user31729 Nov 8 '14 at 18:07
  • @ChristianHupfer yes, the chapter start page! Edited! Thanks! – hehe_br Nov 8 '14 at 18:41
  • 2
    Please be aware that scrpage is officially deprecated and replaced by scrlayer-scrpage. Please have that in mind for your next document. – Johannes_B Nov 9 '14 at 14:46
  • 2
    btw, the most simple solution to the problem stated would be \cfoot[\pagemark]{\pagemark}. With the newest version (v3.14) \cfoot*{\pagemark}. There is absolutely no need to fiddle with page styles. – Johannes_B Nov 9 '14 at 14:55
  • @Johannes_B thanks for the remind on scrpage2 I'll have a look into it! I have tried \cfoot[\pagemark]{\pagemark} before I asked the question, but the problem is that it adds a page number to my other headings, and it is not easy to define where to stop using it with \cfoot[]{}. If I have a \lefoot{\pagemark} for the heading \pagestyle{scrheadings} which is my real case, with \cfoot[\pagemark]{\pagemark} I get two page numbers in that heading one left and another in the center, if I have got you right! – hehe_br Nov 10 '14 at 12:22
8

In report the page style for \chapter is plain by default. To change this you either need to change the plain page style, which may well have undesired side effects for other formatting in your document, or to patch the \chapter command to use your own style:

\usepackage{etoolbox}
\patchcmd{\chapter}{plain}{ChapterStyle}{}{}

If you had been using scrreprt instead then there would be the easier mechanism of issuing

\renewcommand*{\chapterpagestyle}{ChapterStyle}

A complete document for your report case is now:

Sample output

\documentclass[a4paper,12pt,twoside]{report}
\usepackage{lipsum}

\usepackage[automark,headsepline,headtopline,footsepline,footbotline,nouppercase]{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\chead{\normalfont{\thechapter. \headmark}}
\cfoot{\pagemark}

% To define a page style
\deftripstyle{ChapterStyle}{}{}{}{}{\pagemark}{}

\usepackage{etoolbox}
\patchcmd{\chapter}{plain}{ChapterStyle}{}{}

\begin{document}

\chapter{Chapter One}
\lipsum

\chapter{Chapter Two}
\lipsum

\chapter{Chapter Three}
\lipsum

\chapter{Chapter Four}
\lipsum

\end{document}
| improve this answer | |
  • A very easy (and clever solution) -- But could not some other plain occur in the definition of KOMA \chapter etc. (I did not check, actually) – user31729 Nov 8 '14 at 20:00
  • Andrew this is indeed a clever solution! I had found the solution for the case in scrreprt, but I was struggling with the report as I need to stick to it for now. Thanks for your help and attention! – hehe_br Nov 8 '14 at 20:23
  • @ChristianHupfer The path solution is dealing with the standard report class and there in the standard definition the first occurrance of plain is the page style specification. One could write \patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{ChapterStyle}}{}{} if you wanted to be certain about the match. For KOMA \chapter one should use the other solution I mentioned. – Andrew Swann Nov 9 '14 at 12:05

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.