Debian Codegraph @

texmf-dist/source/latex/koma-script/doc/typearea-experts-en.tex

raw
1 % ======================================================================
2 % typearea-experts-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 % Chapter about typearea for experts of the KOMA-Script guide
22 % Maintained by Markus Kohm
23 %
24 % ======================================================================
25
26 \KOMAProvidesFile{typearea-experts-en.tex}
27 [$Date: 2022-06-05 12:40:11 +0200 (So, 05. Jun 2022) $
28 KOMA-Script guide (chapter: typearea)]
29 \translator{Markus Kohm\and Gernot Hassenpflug\and Karl Hagen}
30
31 \chapter{Additional Information about the \Package{typearea} package}
32 \labelbase{typearea-experts}
33 \BeginIndexGroup
34 \BeginIndex{Package}{typearea}
35
36 This chapter provides additional information about the \Package{typearea}
37 package. \iffree{Some parts of the chapter are found only in the German
38 \KOMAScript{} book \cite{book:komascript}. This should not be a problem,
39 because the}{The} average user, who only wants to use the package, will not
40 normally need this information. Part of this material is intended for users
41 who want to solve unusual problems or write their own packages using
42 \Package{typearea}. Another part covers \Package{typearea} features that exist
43 only for compatibility with earlier versions of \KOMAScript{} or with the
44 standard classes. The features that exist only for compatibility with earlier
45 versions of \KOMAScript{} are printed in a sans serif font. You should not use
46 them any longer.
47
48
49 \section{Experimental Features}
50 \seclabel{experimental}
51
52 This section describes experimental features. Experimental, in this context,
53 means that correct functioning cannot be guaranteed. There can be two reasons
54 for designating something experimental. First, the final function is not yet
55 defined or its implementation is not yet finalised. Second, a feature may
56 depend on internal functions of other packages and therefore the feature can
57 not be guaranteed, if the other packages change.
58
59 \begin{Declaration}
60 \OptionVName{usegeometry}{simple switch}
61 \end{Declaration}
62 Usually \Package{typearea} does not care much if you use it with the
63 \Package{geometry}\IndexPackage{geometry} package (see
64 \cite{package:geometry}) in any configuration. In particular, this means that
65 \Package{geometry} does not recognise any changes to the page parameters done
66 with \Package{typearea}, for example when it changes the paper size\,---\,a
67 feature not provided by \Package{geometry} itself.
68
69 Once\ChangedAt{v3.17}{\Package{typearea}} you set option \Option{usegeometry},
70 \Package{typearea} tries to translate all of its options into options of
71 \Package{geometry}. If you activate new parameters inside the document,
72 \Package{typearea} even calls \Macro{newgeometry} (see
73 \DescRef{\LabelBase.cmd.activateareas} in the following section). Since
74 \Package{geometry} does not support changes of paper size or page orientation
75 with \Macro{newgeometry}, \Package{typearea} uses internal commands and
76 \Package{geometry} lengths to provide such changes as needed. This has been
77 tested with \Package{geometry}~5.3 through 5.6.
78
79 Note that using \Package{geometry} and changing page size or orientation with
80 \Package{typearea} does not mean that \Package{geometry} will automatically
81 use the new paper size in an expected manner. For convenience,
82 \Package{geometry} provides far more options to adjust the page than are
83 required to determine the type area, margins, header, footer, etc.\,---\,this
84 is called \emph{overdetermination}\,---\, and at the same time
85 \Macro{newgeometry} derives missing information from the known
86 values\,---\,known as \emph{value preservation}\,---\,so you often must
87 explicitly specify all new values completely when you call \Macro{newgeometry}
88 on your own. Nevertheless, when \Package{typearea} takes \Package{geometry}
89 into consideration, it opens up additional possibilities.%
90 \EndIndexGroup
91
92
93 \begin{Declaration}
94 \OptionVName{areasetadvanced}{simple switch}
95 \Macro{areaset}\OParameter{BCOR}\Parameter{width}\Parameter{height}
96 \end{Declaration}
97 Usually, \DescRef{typearea.cmd.areaset} does not handle options to define the
98 height of the header or footer, or whether margin elements should count as
99 part of the type area in the same way as \DescRef{typearea.cmd.typearea}. With
100 the \Option{areasetadvanced}\ChangedAt{v3.11}{\Package{typearea}} option, you
101 can make \DescRef{typearea.cmd.areaset} behave more like
102 \DescRef{typearea.cmd.typearea} in this regard. Nevertheless, settings for the
103 two commands that result in type areas of equal size still can differ because
104 \DescRef{typearea.cmd.typearea} always adjusts the type area so that it
105 contains an integer number of lines, potentially making the bottom margin up
106 to one line smaller, whereas \DescRef{typearea.cmd.areaset} always sets the
107 ratio between the top and bottom margins at 1:2. The type area can therefore
108 be slightly shifted vertically depending on which command was used.%
109 \EndIndexGroup
110
111
112 \section{Expert Commands}
113 \seclabel{experts}
114
115 This section describes commands that are of little or no interest to average
116 users. These commands give experts additional possibilities. Because this
117 information is addressed to experts, it appears in condensed form.
118
119 \begin{Declaration}
120 \Macro{activateareas}
121 \end{Declaration}%
122 The \Package{typearea} package uses this command convert the settings for the
123 type area and margins to internal \LaTeX{} lengths whenever the type area has
124 been recalculated inside of the document, that is after
125 \Macro{begin}\PParameter{document}. If the \DescRef{typearea.option.pagesize}
126 option has been used, it will be executed again with the same value. Thus, for
127 example, the page size may actually vary within PDF documents.
128
129 Experts can also use this command if they have manually changed lengths like
130 \Length{textwidth} or \Length{textheight} inside a document for any reason. If
131 you do so, however, you are responsible for any necessary page breaks before
132 or after you call \Macro{activateareas}. Moreover, all changes made by
133 \Macro{activateareas} are local.%
134 %
135 \EndIndexGroup
136
137
138 \begin{Declaration}
139 \Macro{storeareas}\Parameter{\textMacro{command}}%
140 \Macro{BeforeRestoreareas}\Parameter{code}%
141 \Macro{BeforeRestoreareas*}\Parameter{code}%
142 \Macro{AfterRestoreareas}\Parameter{code}%
143 \Macro{AfterRestoreareas*}\Parameter{code}
144 \end{Declaration}
145 \Macro{storeareas} defines a \PName{\Macro{command}} which you can use to
146 restore all current type-area settings. So you can save the current settings,
147 change them, and then restore the previous settings afterwards.
148
149 \begin{Example}
150 Time and again, users ask about the possibility of inserting an A3 page in
151 landscape format in an A4 document while retaining the margin settings. The
152 text area should therefore only be widened by the extra paper width. With
153 \Macro{storeareas}, \DescRef{\LabelBase.cmd.areaset} and the previously
154 explained option \DescRef{\LabelBase.option.areasetadvanced} this is very
155 easily possible:
156
157 \begin{lstcode}
158 \documentclass[areasetadvanced]{scrartcl}
159 \areaset[current]{\textwidth}{\textheight}
160
161 \begin{document}
162 \noindent\rule{\textwidth}{\textheight}
163
164 \storeareas\MySavedTypingArea
165 \KOMAoption{paper}{a3,landscape}
166 \areaset[current]
167 {\dimexpr\textwidth+.5\paperwidth\relax}
168 {\textheight}
169 \noindent\rule{\textwidth}{\textheight}
170
171 \clearpage
172 \MySavedTypingArea
173 \noindent\rule{\textwidth}{\textheight}
174 \end{document}
175 \end{lstcode}
176 The \DescRef{\LabelBase.cmd.areaset} command\IndexCmd{areaset} in the
177 document preamble is used together with the
178 \DescRef{\LabelBase.option.areasetadvanced}\IndexOption{areasetadvanced}
179 option to compensate for the differences between the
180 \DescRef{typearea.cmd.typearea} preset and the later use of
181 \DescRef{\LabelBase.cmd.areaset}, as already explained on
182 \DescPageRef{\LabelBase.option.areasetadvanced}. Without this, there could
183 be significant differences in margin settings, especially when using options
184 like \DescRef{typearea.option.headinclude} and
185 \DescRef{typearea.option.headheight}.
186
187 It's\textnote{Attention} important to call \DescRef{maincls.cmd.clearpage}
188 before \Macro{MySavedTypingArea} so that the saved values are restored on
189 the next page. With two-sided documents, changes to the paper format should
190 even use
191 \DescRef{maincls.cmd.cleardoubleoddpage}\IndexCmd{cleardoubleoddpage}
192 or\,---\,if you are not using a \KOMAScript{}
193 class\,---\,\DescRef{maincls.cmd.cleardoublepage}%
194 \IndexCmd{cleardoublepage}.%
195 \iffree{\par In addition, \Macro{noindent} is used to avoid paragraph
196 indents of the black boxes. Otherwise, you would not produce a correct
197 image of the type area.}{}%
198 \end{Example}
199
200 Note\textnote{Attention!} that neither \Macro{storeareas} nor the defined
201 \PName{\Macro{command}} defined with it should be used inside a group.
202 Internally,
203 \Macro{newcommand}\IndexCmd{newcommand*}\important{\Macro{newcommand*}} is
204 used to define the \PName{\Macro{command}}. So reusing a
205 \PName{\Macro{command}} to store settings again would result in a
206 corresponding error message.
207
208 Often\ChangedAt{v3.18}{\Package{typearea}}, it is useful to automatically
209 execute commands like \DescRef{maincls.cmd.cleardoubleoddpage} before
210 restoring the settings of a \Macro{command} generated by \Macro{storeareas}.
211 You can do so using \Macro{BeforeRestoreareas} or \Macro{BeforeRestoreareas*}.
212 Similarly, you can use \Macro{AfterRestoreareas} or \Macro{AfterRestoreareas*}
213 to automatically execute \PName{code} after restoring the settings. The
214 variants with and without the star differ in that the starred variant only
215 applies the \PName{code} to future \PName{command}s generated by
216 \Macro{storeareas}, whereas the regular variant also adds the \PName{code} to
217 previously defined \PName{command}s.%
218 \EndIndexGroup
219
220
221 \begin{Declaration}
222 \Macro{AfterCalculatingTypearea}\Parameter{code}%
223 \Macro{AfterCalculatingTypearea*}\Parameter{code}%
224 \Macro{AfterSettingArea}\Parameter{cod}%
225 \Macro{AfterSettingArea*}\Parameter{code}
226 \end{Declaration}%
227 These commands serve to manage two hooks\Index{hook}. The first two,
228 \Macro{AfterCalculatingTypearea} and its starred variant let experts execute
229 \PName{code} each time \Package{typearea} recalculates the type area and
230 margins, that is after every implicitly or explicit invocation of
231 \DescRef{typearea.cmd.typearea}. Similarly,
232 \Macro{AfterSettingArea}\ChangedAt{v3.11}{\Package{typearea}} and its starred
233 variant allow for executing \PName{code} every time
234 \DescRef{typearea.cmd.areaset} has been used. The normal versions have a
235 global scope, while changes made in the starred versions are only local. The
236 \PName{code} is executed immediately before \Macro{activateareas}.\iffree{}{
237 In \autoref{cha:modernletters}, The letter-class-option file
238 \File{asymTypB.lco} uses it to change the distribution of the margins.}%
239 %
240 \EndIndexGroup
241
242
243 \section{Local Settings with the \File{typearea.cfg} File}
244 \seclabel{cfg}
245 \BeginIndexGroup
246 \BeginIndex{File}{typearea.cfg}
247
248 \LoadNonFree{typearea-experts}{0}
249 %
250 \EndIndexGroup
251
252 \section{More or Less Obsolete Options and Commands}
253 \seclabel{obsolete}
254 \LoadNonFree{typearea-experts}{1}
255 %
256 \EndIndexGroup
257
258 \endinput
259
260 %%% Local Variables:
261 %%% mode: latex
262 %%% TeX-master: "scrguide-en.tex"
263 %%% coding: utf-8
264 %%% ispell-local-dictionary: "en_GB"
265 %%% eval: (flyspell-mode 1)
266 %%% End: