1

I have created my own chapter command sheet and want to use it in the same document as a normal chapter. Both should have separate pagestyles. For the first pages of the both chapter types I found a solution. But is there a way to change the pagestyle for the rest of the sheet?

\documentclass{scrbook}
\usepackage{scrlayer-scrpage}
\RequirePackage{pageslts}
\pagenumbering{arabic}
\usepackage{lipsum}

\DeclareNewSectionCommand[%
level=0,
font=\usekomafont{chapter},
tocindent=0em,
tocnumwidth=5.75em,
style=chapter,%
tocstyle=chapter%
]{sheet}

\newpairofpagestyles[scrheadings]{sheet}{%
    \chead*{\currentpagestyle}
    \ofoot*{\pagemark/\lastpageref{LastPage}}
}

\chead*{\currentpagestyle}

\newpairofpagestyles[scrheadings]{chapter}{%
    \chead*{\currentpagestyle}
    \ofoot*{\pagemark}
}

\renewcommand*{\chapterpagestyle}{chapter}
\renewcommand*{\sheetpagestyle}{sheet}
\pagestyle{chapter}
\begin{document}
    \chapter{Chapter 1}
    \lipsum[1-10]
    \sheet{Sheet 1}
    \lipsum[1-10]
    \chapter{Chapter 2} 
    \lipsum[1-10]
    \sheet{Sheet 2}
    \lipsum[1-10]
\end{document}

I know the pagenumbering seems to make no sense in this example. I just wanted to have a little difference to keep the example as simple as possible.

1

KOMA-Script classes scrbook and scrreprt provide commands and options only for the first page of a heading with style=chapter or style=part. AFAIK there is no simple command or option to change the page style of the following pages.

But you could patch \chapter and \sheet and maybe \part to change the page style of following pages:

\usepackage{xpatch}
\xpretocmd\part{\clearpage\pagestyle{scrheadings}}{}{}
\xpretocmd\chapter{\clearpage\pagestyle{chapter}}{}{}
\xpretocmd\sheet{\clearpage\pagestyle{sheet}}{}{}

The \clearpage ensures that the page style is not changed on the last page of the previous chapter or sheet.

Example:

\documentclass{scrbook}
\usepackage{lipsum}% only for dummy text

\usepackage{scrlayer-scrpage}
\usepackage{pageslts}
\pagenumbering{arabic}

\DeclareNewSectionCommand[%
  level=\chapternumdepth,
  font=\usekomafont{chapter},
  tocindent=0em,
  tocnumwidth=5.75em,
  style=chapter,%
  tocstyle=chapter,%
  pagestyle=sheet% <- added
]{sheet}

\renewcommand*\chapterpagestyle{chapter}

\chead*{\currentpagestyle}

\newpairofpagestyles[scrheadings]{sheet}{%
  \ofoot*{\pagemark/\lastpageref{LastPage}}
}

\newpairofpagestyles[scrheadings]{chapter}{%
  \ofoot*{\pagemark}
}

\usepackage{xpatch}
\xpretocmd\part{\clearpage\pagestyle{scrheadings}}{}{}
\xpretocmd\chapter{\clearpage\pagestyle{chapter}}{}{}
\xpretocmd\sheet{\clearpage\pagestyle{sheet}}{}{}

\begin{document}
  \chapter{Chapter 1}
  \lipsum[1-10]
  \sheet{Sheet 1}
  \lipsum[1-10]
  \chapter{Chapter 2} 
  \lipsum[1-10]
  \sheet{Sheet 2}
  \lipsum[1-10]
\end{document}

Result:

enter image description here

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.