For a private project of mine (more or less "The Story of my Life") I am preparing lots of inputfiles like '1986.tex' with (for me) interesting items of my life, so as vacations, special dates and meeting with important people.

All those small files will be input into a main file. Here different indices (for people, places and events of the different years) are produced, and then the resulting PDF file will come out of this process. Many things work well, but when a page (say for the aforementioned year 1986) gets too full, it will of course be split into two pages (or more).

Now here is my problem: As I (ab)use the page number counter for the year (printing its value into the page head and into all the indices), the numbers will get wrong on the second page for e. g. 1986.

Does anybody see a solution? Here is my (I hope) MWE, where I replaced the inputfile with a short example of a possible event:

    \begingroup % hold following extension local to this group
        \makeatletter % allow @ at macro names
        \extendtheindex% some changes of theindex environment
        {\let\twocolumn\@firstoptofone % deactivate \twocolumn
        \let\onecolumn\@firstoptofone % deactivate \twocolumn
        \let\clearpage\relax % deactivate \clearpage
        }% changes before beginning
        {}% no change after beginning
        {}% no change before ending
        {}% no change after ending
        \makeatother % deactivate \makeatletter
    \printindex % print index
    \endgroup % end group with extended theindex environ

% Spezielle Makros für den Lebenslauf
    \newcommand{\HKereignis}[2]{\setcounter{page}{#1}\item[##1] ##2}
    \newcommand{\HKname}[1]{\textsc{\bfseries ##1}\sindex[name]{##1}}
    \markright{\dotfill\ \rlap{#1}}


\printindex* % print indices

  \HKereignis{7. September}{\HKname{Helmut} wird in \HKort{Köln} geboren.}

  • 2
    You will be better off, if you dont abuse the page number, you can write a ps@year function and say \pagestyke{year} to have the yar on the header, alternatively also you can use the new hook system of LaTex to add it as a backgound somewhere use the hook shipout /before. There are many possibilities Mar 9 at 17:04
  • You could use \renewcommand{\thepage}{1986}, but that would confuse the TOC, any \pageref and possibly hyperref. Mar 9 at 17:07
  • A simpler approach is dont allocate thepage to the year, just change the \markright to \markright{\dotfill\ {#1}\space\rlap{\thepage}} remove rlap etc to disappear it altogether Mar 9 at 18:24
  • Naturally I have thought about NOT abusing the page number, but I think the indices (giving the year of each place, person etc) rely heavily on that counter. Or don't they?
    – H.K.
    Mar 9 at 18:53


You must log in to answer this question.

Browse other questions tagged .