12

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.com Nov 2 '12 at 2:51

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

2

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]{}
\newcommand\thisPageKilometerReading[1]{\markright{#1}}

\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[LE,RO]{km \rightmark}
\pagestyle{fancy}

\usepackage{lipsum} % dummy text generator

\begin{document}

\thisPageKilometerReading{50}

\lipsum[1-3]

\thisPageKilometerReading{70}

\lipsum[4-6]

\thisPageKilometerReading{90}

\lipsum[7-9]

\thisPageKilometerReading{110}

\lipsum[10-12]

\thisPageKilometerReading{130}

\lipsum[13-15]

\thisPageKilometerReading{150}

\end{document}
  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy