kaobook icon indicating copy to clipboard operation
kaobook copied to clipboard

Changing page numbering style

Open matteobettini opened this issue 1 year ago • 1 comments

Hello,

Instead of having the front matter numbered in roman and the main matter reset in arabic, i would like to only have arabic from start to end, how can I do This?

Thanks

matteobettini avatar Oct 14 '24 20:10 matteobettini

Hi, one possibility is to edit kaobook.cls, look for the definitions of \frontmatter and \mainmatter, and remove the lines that call \oldfrontmatter and \oldmainmatter . (The links point to the lines that should be removed).

Instead of modifying kaobook.cls, you could replace \frontmatter and \mainmatter in your main.tex with the corresponding definitions from that file, but without calling \oldfrontmatter and \oldmainmatter.

Note that, in KOMA-script, frontmatter and mainmatter change the page layout (wide vs margin), the page header (no headers vs chapter title in header), but also the numbering of the chapters, which start at zero in the front matter. So if you have numbered chapters in the front matter (which is unlikely) you may see something weird.

The other possibility does not require you to change the kao files and preserves all the differences between front and main matters. You can just edit the main.tex as follows.

  1. Add \pagestyle{arabic} after \frontmatter
  2. Replace \mainmatter with
\cleardoubleoddpage
\makeatletter
\edef\curpage{\the\c@page}
\makeatother
\mainmatter
\setcounter{page}{\curpage}

This saves the page number at the end of the frontmatter into \curpage and sets the page counter to that value after \mainmatter.

fmarotta avatar Oct 26 '24 07:10 fmarotta