# Automated Marginal Documentation of Page Changes

I have a recollection of having seen this answered here before, but I spent the last hour looking for it and failed, so I'm asking (maybe again):

I'm translating a document. I'd like to keep track, in the new document containing the translation, of the pagination of the original document. Ideally, this would be done as follows:

Suppose in the original document, we have

"Chciałbym, aby kupić (pagebreak) kanapkę, proszę", powiedział młody człowiek.

I would like to, in the source for my translation, be able to type

"I would like to buy \pb a sandwich, please,'' said the young man.

And have in the compiled document, at the line containing the word "buy", a mark in the margins that looks like

n

--

n+1

(except smallish and compactish and whatever else you find aesthetic -- you all have fairly good taste in such matters, I've always found) Where n is the page number the first part of the sentence occurs on and n+1 is the page number the second part of the sentence occurs on. Ideally, the tex would keep track of such matters for me.

It would be nice, in addition, if I could specify somehow to start on page 28, e.g. instead of one.

That will be all.

The simplest implementation would combine a custom counter with a \marginpar. You can define a command that sets the counter to the start page, and another that both increments the counter and prints it in the margins in the style of your choice.

\documentclass{article}

% count source pages
\newcounter{spp}

% format marginal note
\newcommand{\marginparfont}{\tiny} % or what have you

% set start page
\newcommand{\startp}[1]{\setcounter{spp}{#1}}

% note original page number in margin
\newcommand{\pb}{\marginpar{\marginparfont \thespp \stepcounter{spp}--\thespp}}

\begin{document}
\startp{28}
Tell me, Jenny, do you still walk?'' he said.
Do you still get into \pb sandwiches in a big way?''

I still walk,'' she \pb responded, but I don't get as much into sandwiches as I used to.''%
\footnote{Probably quoted incorrectly from \emph{Jenny}, by Flight of the Conchords.}
\end{document}


• This works exactly as I'd hoped. – Shay Nov 17 '14 at 21:50
• I'm glad to hear it! It was a well-written specification for something that LaTeX is good at. It's also a great example of something that is easy in LaTeX (once you know how), without any packages, but nearly impossible in a program like Word. – musarithmia Nov 17 '14 at 22:01