% ======================================================================
% common-oddorevenpage-en.tex
% Copyright (c) Markus Kohm, 2001-2022
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, version 1.3c of the license.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX 
% version 2005/12/01 or later and of this work.
%
% This work has the LPPL maintenance status "author-maintained".
%
% The Current Maintainer and author of this work is Markus Kohm.
%
% This work consists of all files listed in MANIFEST.md.
% ======================================================================
%
% Paragraphs that are common for several chapters of the KOMA-Script guide
% Maintained by Markus Kohm
%
% ======================================================================

\KOMAProvidesFile{common-oddorevenpage-en.tex}
                 [$Date: 2022-06-05 12:40:11 +0200 (So, 05. Jun 2022) $
                  KOMA-Script guide (common paragraph: Detection of Odd and
                                     Even Pages)]
\translator{Markus Kohm\and Krickette Murabayashi\and Karl Hagen}

\section{Detecting Odd and Even Pages}
\seclabel{oddOrEven}%
\BeginIndexGroup%
\BeginIndex{}{page>odd}%
\BeginIndex{}{page>even}%

\IfThisCommonFirstRun{}{%
  The information in \autoref{sec:maincls.oddOrEven} applies equally to this
  chapter. So if you have already read and understood
  \autoref{sec:\ThisCommonFirstLabelBase.oddOrEven}, you can skip ahead to
  \autopageref{sec:\ThisCommonLabelBase.oddOrEven.next},
  \autopageref{sec:\ThisCommonLabelBase.oddOrEven.next}.%
}

In two-sided documents we distinguish left and right pages. Left pages always
have an even page number, and right pages always have an odd page number. %
\IfThisCommonLabelBase{maincls}{%
  Identifying right and left pages is equivalent to identifying even- or
  odd-numbered pages, and so we normally refer to them as even and odd pages
  in this \iffree{guide}{book}.

  % Umbruchkorrekturtext
  \iftrue%
    In one-sided documents, the distinction between left and right pages does
    not exist. Nevertheless, there are still pages with even and odd page 
    numbers.%
  \fi%
}{%
  \IfThisCommonLabelBase{scrlttr2}{%
    As a rule, letters will be set one-sided. However, if you need to print
    letters using both sides of the paper or, in exceptional cases, are
    generating real two-sided letters, it may be useful to know whether you
    are currently on an even or odd page.%
  }{}%
}


\begin{Declaration}
  \Macro{Ifthispageodd}\Parameter{true part}\Parameter{false part}
\end{Declaration}%
If\IfThisCommonLabelBase{maincls}{%
  \ChangedAt{v3.28}{\Class{scrbook}\and \Class{scrreprt}\and
    \Class{scrartcl}}%
}{%
  \IfThisCommonLabelBase{scrlttr2}{%
    \ChangedAt{v3.28}{\Class{scrlttr2}}%
  }{%
    \IfThisCommonLabelBase{scrextend}{%
      \ChangedAt{v3.28}{\Package{scrextend}}%
    }{}%
  }%
} %
you want to determine whether text appears on an even or odd page,
\KOMAScript{} provides the \Macro{Ifthispageodd} command. The \PName{true
	part} argument is executed only if you are currently on an odd page. 
Otherwise the \PName{false part} argument is executed.
%
\IfThisCommonLabelBase{scrextend}{\iffalse}{\csname iftrue\endcsname}%
\begin{Example}
  Suppose you simply want to show whether a text will be placed onto an
  even or odd page. You may achieve that
  using{\phantomsection\xmpllabel{Ifthispageodd}}
\begin{lstcode}
  This page has an \Ifthispageodd{odd}{even} 
  page number.
\end{lstcode}
  This results in the output
  \begin{quote}
    This page has an \Ifthispageodd{odd}{even} page number.
  \end{quote}
\end{Example}
\fi

Because the \Macro{Ifthispageodd} command uses a mechanism that is very
similar to a label and a reference to it, at least two {\LaTeX} runs are
required after each change to the text. Only then will the decision be
correct. In the first run, a heuristic is used to make the initial choice.

In \autoref{sec:maincls-experts.addInfos},
\DescPageRef{maincls-experts.cmd.Ifthispageodd}, advanced users can find more
information about the problems of detecting left and right pages, or even and
odd page numbers.%
\IfThisCommonLabelBase{scrextend}{%
  An example for \Macro{Ifthispageodd} is shown on
  \PageRefxmpl{maincls.Ifthispageodd} in \autoref{sec:maincls.oddOrEven}.%
}{}%
%
\EndIndexGroup
%
\EndIndexGroup

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "scrguide-en.tex"
%%% coding: utf-8
%%% ispell-local-dictionary: "en_GB"
%%% eval: (flyspell-mode 1)
%%% End: 
