# Custom “counter” as page number substitute

I'm trying to typeset a book, covering a world trip. Instead of standard page numbers, I want each page to correspond with a digit representing driven kilometers. Of course I can't manually set that on each page, but I know on certain pages (looking at my GPS tracks) what the kilometer reading on that page would be. So imagine I know 2-3 certain numbers per chapter. The rest needs to be interpolated and rounded (or simply post-comma digits dropped) and spaces out evenly between the pages with known "counter" pages. Any ideas on how to do that? :)

I would probably need a new command, like \thisPageKilometerReading{12345}. The rest could/should be done automatically. I could also set the max. kilometers which would always appear on the last page.

Hope this is not toooo much to wish for?

(I'm using XeLaTeX and a KOMA-Script document class.)

-

## migrated from stackoverflow.comNov 2 '12 at 2:51

This question came from our site for professional and enthusiast programmers.

Hi Tiger, Welcome to TeX.SE! Have a look at http://tex.stackexchange.com/questions/78117/replace-individual-page-numbers-wi‌​th-mathematical-expressions/78118#78118, as it seems very similar. Don't forget to register on this site too, and welcome! – cmhughes Nov 2 '12 at 2:54
Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Nov 2 '12 at 4:37
Should \pageref also return the kilometer value? – clemens Dec 28 '12 at 14:20

You can use the \markright macros that are meant to typeset the section/chapter marks in the header. We first make \section not modify \rightmark, then we introduce a new command to set the right mark, and by fancyhdr package we change the headers/footers. See the example:

\documentclass[12pt,a5paper]{article} % so that the pages are small

\renewcommand\sectionmark[1]{}

\usepackage{fancyhdr}
\fancyhf{}
\pagestyle{fancy}

\usepackage{lipsum} % dummy text generator

\begin{document}

\lipsum[1-3]

\lipsum[4-6]

\lipsum[7-9]

\lipsum[10-12]


I provided an example in article class, because (1) I'm not a KOMA user at all and (2) you didn't provided a MWE. – yo' Nov 2 '12 at 10:02