Page LayoutPage numbering like "chapter-page"

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
eulenspiegel
Posts: 2
Joined: Wed Dec 09, 2009 1:44 pm

Page numbering like "chapter-page"

Post by eulenspiegel »

Hello.

How to make page numbering for each chapter in style of "chapternum-pagenum"? For ex., page 5-23 is the 23d page of chapter 5.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Page numbering like "chapter-page"

Post by gmedina »

Hi,

you can redefine the \thepage command to include the chapter number, and then to restart the page counter every time a new chapter begins you can use the chngcntr package. Take a look at the following example:

Code: Select all

\documentclass{book}
\usepackage{chngcntr}
\usepackage{lipsum} % just to generate some text

\counterwithin{page}{chapter}
\renewcommand\thepage{\thechapter--\arabic{page}}

\begin{document}

\chapter{Test chapter one}
\stepcounter{page}
\lipsum[1-30]
\chapter{Test chapter two}
\stepcounter{page}
\lipsum[1-30]

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
eulenspiegel
Posts: 2
Joined: Wed Dec 09, 2009 1:44 pm

Re: Page numbering like "chapter-page"

Post by eulenspiegel »

Thank you very much!
Post Reply