You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
151 lines
5.4 KiB
151 lines
5.4 KiB
% ======================================================================
|
|
% common-oddorevenpage.tex
|
|
% Copyright (c) Markus Kohm, 2001-2019
|
|
%
|
|
% 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.txt.
|
|
% ----------------------------------------------------------------------
|
|
% common-oddorevenpage.tex
|
|
% Copyright (c) Markus Kohm, 2001-2019
|
|
%
|
|
% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz,
|
|
% Version 1.3c, verteilt und/oder veraendert werden.
|
|
% Die neuste Version dieser Lizenz ist
|
|
% http://www.latex-project.org/lppl.txt
|
|
% und Version 1.3c ist Teil aller Verteilungen von LaTeX
|
|
% Version 2005/12/01 oder spaeter und dieses Werks.
|
|
%
|
|
% Dieses Werk hat den LPPL-Verwaltungs-Status "author-maintained"
|
|
% (allein durch den Autor verwaltet).
|
|
%
|
|
% Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm.
|
|
%
|
|
% Dieses Werk besteht aus den in manifest.txt aufgefuehrten Dateien.
|
|
% ======================================================================
|
|
%
|
|
% Paragraphs that are common for several chapters of the KOMA-Script guide
|
|
% Maintained by Markus Kohm
|
|
%
|
|
% ----------------------------------------------------------------------
|
|
%
|
|
% Absaetze, die mehreren Kapiteln der KOMA-Script-Anleitung gemeinsam sind
|
|
% Verwaltet von Markus Kohm
|
|
%
|
|
% ======================================================================
|
|
|
|
\KOMAProvidesFile{common-oddorevenpage.tex}
|
|
[$Date: 2019-11-19 12:56:28 +0100 (Tue, 19 Nov 2019) $
|
|
KOMA-Script guide (common paragraph: Detection of Odd and
|
|
Even Pages)]
|
|
\translator{Markus Kohm\and Krickette Murabayashi\and Karl Hagen}
|
|
|
|
% Date of the translated German file: 2019-11-19
|
|
|
|
\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
|
|
%%% coding: us-ascii
|
|
%%% TeX-master: "../guide"
|
|
%%% End:
|
|
|