I'm using KOMA-Script scrbook class. And scrpage2 package for headings:


I want to add an extra pagemark on ofoot. The extra pagemark I need is like this: pp. 181-195, where 181 is the page number where current chapter starts and 195 is where chapter ends. Of course, I need this to change in every chapter.


I am not aware of a drop-in solution. However, you could do the following:

0) Define \currchapternick at the beginning of your document:


1) Surround each chapter by the following:


2) Set ofoot as follows:


I have tested the use of macros inside \label and \ref -- works. The code will produce the desired results if the contents of the footer are expanded lazily, which I presume. If not, you could still call \ofoot at the beginning of each chapter, as above.

According to this discussion in the mail archives, there is no such thing as \AtBeginChapter or \AtEndChapter, and hence no way to further automate this unless you delve deeply into TeX internals.

  • Note that this problem and its solution also works outside of KOMA and scrpage2. – krlmlr Sep 23 '11 at 21:42
  • Thank you! That works fine. Note: \rfoot is not an existing option. I've changed it on my question. – Gastón Sep 24 '11 at 11:38
  • ...so I've edited my answer. Do you have to call \ofoot for each chapter, or does it suffice to call it once? – krlmlr Sep 24 '11 at 11:41
  • 1
    It suffice to call it once. – Gastón Sep 24 '11 at 11:44
  • @user946850: Note that your solution doesn't work perfectly if \chapter (or, more precisely, \cleardoublepage) inserts an empty page before the chapter heading. – mhp Sep 24 '11 at 22:58

For this task and similar ones, the zref package comes in handy. Based on the abspage and thepage modules provided by this package, you can define a macro \chappagerangelabel as follows:


\usepackage[abspage, thepage]{zref}
\usepackage{lipsum}% lorem ipsum placeholder text


\newcounter{chappagerange}% auxiliary counter

\newcounter{chappointer}% auxiliary counter
\stepcounter{chappointer}% value 1 for first chapter

  \edef\thechappagerange{\zthepage{\the\value{chappagerange}}}% first page
  \edef\thechappagerange{pp.~\thechappagerange--\zthepage{\the\value{chappagerange}}}% first page--last page

Now, define a macro \pagerangemark modelled after \pagemark:



Put \chappagerangelabel at the very beginning of each chapter and immediately after the last chapter and use \pagerangemark in \ofoot:








\chapter{A Chapter}


\chapter{Another Chapter}







Note that this solution does not allow for the case that the last page of the last chapter is also the last page of the whole document. Apart from that, it should work smoothly.

  • Now we're halfway towards a new, fully generic sectionranges package, aren't we? :-) Given that you forgot \makeatletter... – krlmlr Sep 25 '11 at 0:10
  • Now I see, you call \makeatletter in your preamble. Missed that. Anyway, it would be nice to see a package that encapsulates and automates the above logic. – krlmlr Sep 25 '11 at 8:47

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.