5

I want to make a dictionary which is based on an old print version from the 18th century.

The style is to have a two column layout and on top of each page

  • on the left side the page number plus the guide word from the first entry of this page
  • on the right side the page number increased by one plus the guide word from the last entry of this page

So the page number increases by 2 for each page.

I found something in the web for the package fancyhdr, but I'm using KOMA script and do not want to change my complete code.

Here is a small working excample:

\documentclass[%
    12pt,
    parskip=false,
]{scrbook}

\usepackage{scrlayer-scrpage}

\usepackage[german]{babel} % Old rules

\usepackage{fontspec}
\usepackage[babel=true]{microtype}
\setmainfont[Numbers={Proportional,OldStyle},Ligatures={Common,Rare,Historic}]{Libertinus Serif}
\setsansfont[Numbers={Proportional,OldStyle}]{GilliusADF}
\fontspec{inconsolata}

\usepackage{ragged2e}

\usepackage{multicol}

\usepackage{lipsum}

% Double page numbering based on: https://tex.stackexchange.com/questions/18156/figures-on-left-pages-text-on-right-ones-with-class-book-numbering-only-on-rig
\renewcommand\thepage{\number\numexpr ((2*\the\value{page})-1)\relax} % Die Seitennummer wird immer um 2 erhöht
\newcommand{\theEvenPage}{\number\numexpr (\thepage+1)\relax} % Die gerade Seitenzahl rechts
 
\lehead{\pagemark}
\rehead{\theEvenPage}
\lefoot{}
 
\lohead{\pagemark}
\rohead{\theEvenPage}
\rofoot{}

% Dictionary entry. Based on: https://de.overleaf.com/latex/examples/dictionary-template/pdztbwjxrpmz
\newcommand{\entry}[3]{%
    \lehead{\pagemark\ {#2}}%
    \lohead{\pagemark\ {#2}}%
    \rehead{\theEvenPage\ {#2}}%
    \rohead{\theEvenPage\ {#2}}%
    \textbf{#1}\ {#3}}

\begin{document}
\lipsum[1-2]

\clearpage

\begin{multicols}{2}
    \entry{Panama}{PAN}{\lipsum[1]}

    \entry{Paternoster}{PAT}{\lipsum[2]}

    \entry{Performance}{PER}{\lipsum[3]}

    \entry{Peter}{PET}{\lipsum[4]}

    \entry{Petersberg}{PET}{\lipsum[5]}

    \entry{Pfanne}{PFA}{\lipsum[6]}

    \entry{Pfirsich}{PFI}{\lipsum[7]}

    \entry{Pflaume}{PFL}{\lipsum[8]}

    \entry{Pisa}{PIS}{\lipsum[9]}

    \entry{Planung}{PLA}{\lipsum[1]}

    \entry{Po}{PO}{\lipsum[2]}

    \entry{Polen}{POL}{\lipsum[3]}

    \entry{Portugal}{POR}{\lipsum[4]}

    \entry{Primel}{PRI}{\lipsum[5]}

    \entry{Punkt}{PUN}{\lipsum[6]}
\end{multicols}
\end{document}

The guide-words are showing the first entry from the next page and not the once I need.

Does anybody has an idea how this can be resolved?

enter image description here

0

1 Answer 1

7

Because of the asynchronous output, you should always use the mark-mechanism to put content depending text in the page header or footer:

\documentclass[%
    12pt,
    parskip=false,
]{scrbook}

\usepackage[manualmark]{scrlayer-scrpage}

\usepackage[german]{babel} % Old rules

\usepackage{fontspec}
\usepackage[babel=true]{microtype}
\setmainfont[Numbers={Proportional,OldStyle},Ligatures={Common,Rare,Historic}]{Libertinus Serif}
\setsansfont[Numbers={Proportional,OldStyle}]{GilliusADF}
\fontspec{inconsolata}

\usepackage{ragged2e}

\usepackage{multicol}

\usepackage{lipsum}

% Double page numbering based on: https://tex.stackexchange.com/questions/18156/figures-on-left-pages-text-on-right-ones-with-class-book-numbering-only-on-rig
\renewcommand\thepage{\number\numexpr ((2*\the\value{page})-1)\relax} % Die Seitennummer wird immer um 2 erhöht
\newcommand{\theEvenPage}{\number\numexpr (\thepage+1)\relax} % Die gerade Seitenzahl rechts
\newcommand*{\EvenPageMark}{{\usekomafont{pagenumber}{\theEvenPage}}}% analogous to the definition of \pagemark

\clearpairofpagestyles
\lehead{\pagemark\ \rightmark}
\rehead{\leftmark\ \EvenPageMark}
\lohead{\pagemark\ \rightmark}
\rohead{\leftmark\ \EvenPageMark}


% Dictionary entry. Based on: https://de.overleaf.com/latex/examples/dictionary-template/pdztbwjxrpmz
\newcommand{\entry}[3]{%
  \par% added, because each entry should start a new paragraph
  \markdouble{#2}% added for the mark → KOMA-Script manual
  \textbf{#1}\ {#3}}

\begin{document}
\lipsum[1-2]

\clearpage

\begin{multicols}{2}
    \entry{Panama}{PAN}{\lipsum[1]}

    \entry{Paternoster}{PAT}{\lipsum[2]}

    \entry{Performance}{PER}{\lipsum[3]}

    \entry{Peter}{PET}{\lipsum[4]}

    \entry{Petersberg}{PET}{\lipsum[5]}

    \entry{Pfanne}{PFA}{\lipsum[6]}

    \entry{Pfirsich}{PFI}{\lipsum[7]}

    \entry{Pflaume}{PFL}{\lipsum[8]}

    \entry{Pisa}{PIS}{\lipsum[9]}

    \entry{Planung}{PLA}{\lipsum[1]}

    \entry{Po}{PO}{\lipsum[2]}

    \entry{Polen}{POL}{\lipsum[3]}

    \entry{Portugal}{POR}{\lipsum[4]}

    \entry{Primel}{PRI}{\lipsum[5]}

    \entry{Punkt}{PUN}{\lipsum[6]}
\end{multicols}
\end{document}

two pages of the example

See the KOMA-Script manual for more information on using \leftmark, \rightmark, \markdouble etc.

BTW: There would even be an alternative using \automark and a standard sectioning command:

\documentclass[%
    12pt,
    parskip=false,
    headings=optiontohead,
]{scrbook}

\usepackage{scrlayer-scrpage}

\usepackage[german]{babel} % Old rules

\usepackage{fontspec}
\usepackage[babel=true]{microtype}
\setmainfont[Numbers={Proportional,OldStyle},Ligatures={Common,Rare,Historic}]{Libertinus Serif}
\setsansfont[Numbers={Proportional,OldStyle}]{GilliusADF}
\fontspec{inconsolata}

\usepackage{ragged2e}

\usepackage{multicol}

\usepackage{lipsum}

% Double page numbering based on: https://tex.stackexchange.com/questions/18156/figures-on-left-pages-text-on-right-ones-with-class-book-numbering-only-on-rig
\renewcommand\thepage{\number\numexpr ((2*\the\value{page})-1)\relax} % Die Seitennummer wird immer um 2 erhöht
\newcommand{\theEvenPage}{\number\numexpr (\thepage+1)\relax} % Die gerade Seitenzahl rechts
\newcommand*{\EvenPageMark}{{\usekomafont{pagenumber}{\theEvenPage}}}% analogous to the definition of \pagemark

\clearpairofpagestyles
\automark[subparagraph]{subparagraph}
\lehead{\pagemark\ \rightmark}
\rehead{\leftmark\ \EvenPageMark}
\lohead{\pagemark\ \rightmark}
\rohead{\leftmark\ \EvenPageMark}


% Dictionary entry. Based on: https://de.overleaf.com/latex/examples/dictionary-template/pdztbwjxrpmz
\newcommand{\entry}[3]{%
  \subparagraph[{#2}]{#1}#3%
}
\RedeclareSectionCommand[beforeskip=0pt]{subparagraph}
\setkomafont{subparagraph}{\rmfamily}

\begin{document}
\lipsum[1-2]

\clearpage

\begin{multicols}{2}
    \entry{Panama}{PAN}{\lipsum[1]}

    \entry{Paternoster}{PAT}{\lipsum[2]}

    \entry{Performance}{PER}{\lipsum[3]}

    \entry{Peter}{PET}{\lipsum[4]}

    \entry{Petersberg}{PET}{\lipsum[5]}

    \entry{Pfanne}{PFA}{\lipsum[6]}

    \entry{Pfirsich}{PFI}{\lipsum[7]}

    \entry{Pflaume}{PFL}{\lipsum[8]}

    \entry{Pisa}{PIS}{\lipsum[9]}

    \entry{Planung}{PLA}{\lipsum[1]}

    \entry{Po}{PO}{\lipsum[2]}

    \entry{Polen}{POL}{\lipsum[3]}

    \entry{Portugal}{POR}{\lipsum[4]}

    \entry{Primel}{PRI}{\lipsum[5]}

    \entry{Punkt}{PUN}{\lipsum[6]}
\end{multicols}
\end{document}
1
  • Wow, this is a great answer and solution. Thank you very much
    – Dieter
    Commented Jun 6 at 10:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .