Page Layoutmultiple page numbers on the same page

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
stormy
Posts: 4
Joined: Mon Jun 14, 2010 9:55 pm

multiple page numbers on the same page

Post by stormy »

Hello,

I have a large document, and I would like chapter page numbers at the top of the page--for example, I want the pages in chapter 1 numbered 1-1, 1-2, 1-3, and the pages in chapter 2 numbered 2-1,2-2,2-3 etc. However, I would also like global page numbers on the bottom of the page, so if chapter 2 starts on the 10th page of the document it would display '2-1' at the top of the page but '10' at the bottom. I can accomplish either of these page numberings separately by redefining \thepage, but not both at the same time.

The only thing I can think to do is define some counter for the chapter page number, and increment it whenever a new page is started. Is there any way to define a counter that is not the 'page' counter, but is incremented whenever a new page begins?

Thanks
Last edited by stormy on Thu Jun 17, 2010 4:05 pm, edited 1 time in total.

Recommended reading 2024:

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

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

multiple page numbers on the same page

Post by localghost »

Take a look at the below code. It defines a new counter for the total number of pages and add the command to increase on every page by means of the eso-pic package. The chappg package does the numbering of the page counter.

Code: Select all

\documentclass[11pt,a4paper,english]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{chappg}
\usepackage{eso-pic}
\usepackage{blindtext}

\newcounter{totpage}
\setcounter{totpage}{1}
\AddToShipoutPicture{%
  \stepcounter{totpage}
}

\begin{document}
  \blinddocument \thetotpage
  \blinddocument \thetotpage
\end{document}
I'm sure that there is a solution that only needs some (La)TeX internal commands instead of a whole package. But I can't figure out this at the moment. The placement of the two page counters can be done either with fancyhdr or titlesec.


Thorsten
stormy
Posts: 4
Joined: Mon Jun 14, 2010 9:55 pm

Re: multiple page numbers on the same page

Post by stormy »

The \AddToShipoutPicture command was the one I needed, and it worked well. I didn't end up needing the chappg package, I was able to insert my page number simply by putting \thetotpage in the header.

Thanks for the help
Post Reply