TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.)

share|improve this question

migrated from stackoverflow.com Nov 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


\fancyhead[LE,RO]{km \rightmark}

\usepackage{lipsum} % dummy text generator













share|improve this answer
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
This of course does not deal with the “The rest needs to be interpolated” request... – clemens Dec 28 '12 at 14:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.