Debian Codegraph @

texmf-dist/source/latex/koma-script/doc/common-oddorevenpage-en.tex

raw
1 % ======================================================================
2 % common-oddorevenpage-en.tex
3 % Copyright (c) Markus Kohm, 2001-2022
4 %
5 % This file is part of the LaTeX2e KOMA-Script bundle.
6 %
7 % This work may be distributed and/or modified under the conditions of
8 % the LaTeX Project Public License, version 1.3c of the license.
9 % The latest version of this license is in
10 % http://www.latex-project.org/lppl.txt
11 % and version 1.3c or later is part of all distributions of LaTeX
12 % version 2005/12/01 or later and of this work.
13 %
14 % This work has the LPPL maintenance status "author-maintained".
15 %
16 % The Current Maintainer and author of this work is Markus Kohm.
17 %
18 % This work consists of all files listed in MANIFEST.md.
19 % ======================================================================
20 %
21 % Paragraphs that are common for several chapters of the KOMA-Script guide
22 % Maintained by Markus Kohm
23 %
24 % ======================================================================
25
26 \KOMAProvidesFile{common-oddorevenpage-en.tex}
27 [$Date: 2022-06-05 12:40:11 +0200 (So, 05. Jun 2022) $
28 KOMA-Script guide (common paragraph: Detection of Odd and
29 Even Pages)]
30 \translator{Markus Kohm\and Krickette Murabayashi\and Karl Hagen}
31
32 \section{Detecting Odd and Even Pages}
33 \seclabel{oddOrEven}%
34 \BeginIndexGroup%
35 \BeginIndex{}{page>odd}%
36 \BeginIndex{}{page>even}%
37
38 \IfThisCommonFirstRun{}{%
39 The information in \autoref{sec:maincls.oddOrEven} applies equally to this
40 chapter. So if you have already read and understood
41 \autoref{sec:\ThisCommonFirstLabelBase.oddOrEven}, you can skip ahead to
42 \autopageref{sec:\ThisCommonLabelBase.oddOrEven.next},
43 \autopageref{sec:\ThisCommonLabelBase.oddOrEven.next}.%
44 }
45
46 In two-sided documents we distinguish left and right pages. Left pages always
47 have an even page number, and right pages always have an odd page number. %
48 \IfThisCommonLabelBase{maincls}{%
49 Identifying right and left pages is equivalent to identifying even- or
50 odd-numbered pages, and so we normally refer to them as even and odd pages
51 in this \iffree{guide}{book}.
52
53 % Umbruchkorrekturtext
54 \iftrue%
55 In one-sided documents, the distinction between left and right pages does
56 not exist. Nevertheless, there are still pages with even and odd page
57 numbers.%
58 \fi%
59 }{%
60 \IfThisCommonLabelBase{scrlttr2}{%
61 As a rule, letters will be set one-sided. However, if you need to print
62 letters using both sides of the paper or, in exceptional cases, are
63 generating real two-sided letters, it may be useful to know whether you
64 are currently on an even or odd page.%
65 }{}%
66 }
67
68
69 \begin{Declaration}
70 \Macro{Ifthispageodd}\Parameter{true part}\Parameter{false part}
71 \end{Declaration}%
72 If\IfThisCommonLabelBase{maincls}{%
73 \ChangedAt{v3.28}{\Class{scrbook}\and \Class{scrreprt}\and
74 \Class{scrartcl}}%
75 }{%
76 \IfThisCommonLabelBase{scrlttr2}{%
77 \ChangedAt{v3.28}{\Class{scrlttr2}}%
78 }{%
79 \IfThisCommonLabelBase{scrextend}{%
80 \ChangedAt{v3.28}{\Package{scrextend}}%
81 }{}%
82 }%
83 } %
84 you want to determine whether text appears on an even or odd page,
85 \KOMAScript{} provides the \Macro{Ifthispageodd} command. The \PName{true
86 part} argument is executed only if you are currently on an odd page.
87 Otherwise the \PName{false part} argument is executed.
88 %
89 \IfThisCommonLabelBase{scrextend}{\iffalse}{\csname iftrue\endcsname}%
90 \begin{Example}
91 Suppose you simply want to show whether a text will be placed onto an
92 even or odd page. You may achieve that
93 using{\phantomsection\xmpllabel{Ifthispageodd}}
94 \begin{lstcode}
95 This page has an \Ifthispageodd{odd}{even}
96 page number.
97 \end{lstcode}
98 This results in the output
99 \begin{quote}
100 This page has an \Ifthispageodd{odd}{even} page number.
101 \end{quote}
102 \end{Example}
103 \fi
104
105 Because the \Macro{Ifthispageodd} command uses a mechanism that is very
106 similar to a label and a reference to it, at least two {\LaTeX} runs are
107 required after each change to the text. Only then will the decision be
108 correct. In the first run, a heuristic is used to make the initial choice.
109
110 In \autoref{sec:maincls-experts.addInfos},
111 \DescPageRef{maincls-experts.cmd.Ifthispageodd}, advanced users can find more
112 information about the problems of detecting left and right pages, or even and
113 odd page numbers.%
114 \IfThisCommonLabelBase{scrextend}{%
115 An example for \Macro{Ifthispageodd} is shown on
116 \PageRefxmpl{maincls.Ifthispageodd} in \autoref{sec:maincls.oddOrEven}.%
117 }{}%
118 %
119 \EndIndexGroup
120 %
121 \EndIndexGroup
122
123 %%% Local Variables:
124 %%% mode: latex
125 %%% TeX-master: "scrguide-en.tex"
126 %%% coding: utf-8
127 %%% ispell-local-dictionary: "en_GB"
128 %%% eval: (flyspell-mode 1)
129 %%% End: