1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
% ======================================================================
% 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:
|