Debian Codegraph @

texmf-dist/source/latex/koma-script/scrkernel-typearea.dtx

raw
1 % \iffalse meta-comment
2 % ======================================================================
3 % scrkernel-typearea.dtx
4 % Copyright (c) Markus Kohm, 2002-2025
5 %
6 % This file is part of the LaTeX2e KOMA-Script bundle.
7 %
8 % This work may be distributed and/or modified under the conditions of
9 % the LaTeX Project Public License, version 1.3c of the license.
10 % The latest version of this license is in
11 % http://www.latex-project.org/lppl.txt
12 % and version 1.3c or later is part of all distributions of LaTeX
13 % version 2005/12/01 or later and of this work.
14 %
15 % This work has the LPPL maintenance status "author-maintained".
16 %
17 % The Current Maintainer and author of this work is Markus Kohm.
18 %
19 % This work consists of all files listed in MANIFEST.md.
20 % ======================================================================
21 %%% From File: $Id: scrkernel-typearea.dtx 4181 2025-06-14 09:11:13Z kohm $
22 %<identify>%%% (run: identify)
23 %<init>%%% (run: init)
24 %<options>%%% (run: options)
25 %<body>%%% (run: body)
26 %<final>%%% (run: final)
27 %<package&identify>\NeedsTeXFormat{LaTeX2e}[2022/06/01]
28 %<*dtx>
29 \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
30 \begingroup
31 \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
32 \filedate$Date: 2025-06-14 11:11:13 +0200 (Sa, 14. Jun 2025) $
33 \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
34 \filerevision$Revision: 4181 $
35 \edef\reserved@a{%
36 \noexpand\endgroup
37 \noexpand\ProvidesFile{scrkernel-typearea.dtx}[%
38 \filedate\space\filerevision\space
39 KOMA-Script
40 }
41 \reserved@a
42 %</dtx>
43 %<*dtx|(package&typearea&identify)>
44 %<package>\ProvidesPackage{typearea}[%
45 %!KOMAScriptVersion
46 package
47 %<*dtx>
48 source
49 %</dtx>
50 (type area)]
51 %</dtx|(package&typearea&identify)>
52 %<*dtx>
53 \ifx\documentclass\undefined
54 \input scrdocstrip.tex
55 \@@input scrkernel-version.dtx
56 \@@input scrstrip.inc
57 \generate{\usepreamble\defaultpreamble
58 \file{typearea.sty}{%
59 \from{scrkernel-version.dtx}{package,typearea}%
60 \from{scrkernel-typearea.dtx}{package,typearea,identify}%
61 \from{scrkernel-basics.dtx}{load}%
62 \from{scrkernel-compatibility.dtx}{package,typearea,init}%
63 \from{scrkernel-typearea.dtx}{package,typearea,init}%
64 \from{scrkernel-compatibility.dtx}{package,typearea,option}%
65 \from{scrkernel-typearea.dtx}{package,typearea,options}%
66 \from{scrkernel-compatibility.dtx}{package,typearea,body}%
67 \from{scrkernel-typearea.dtx}{package,typearea,body}%
68 \from{scrkernel-typearea.dtx}{package,typearea,final}%
69 \from{scrlogo.dtx}{logo}%
70 }%
71 }
72 \@@input scrstrop.inc
73 \else
74 \let\endbatchfile\relax
75 \fi
76 \endbatchfile
77 \documentclass[USenglish]{koma-script-source-doc}
78 \usepackage{babel}
79 \setcounter{StandardModuleDepth}{2}
80 \begin{document}
81 \DocInput{scrkernel-typearea.dtx}
82 \end{document}
83 %</dtx>
84 % \fi^^A meta-comment
85 %
86 % \changes{v2.95}{2002/06/20}{first version after splitting \file{scrclass.dtx}}
87 % \changes{v3.24}{2017/07/23}{reorganization of code into semantic portions}
88 % \changes{v3.24}{2017/07/23}{start of English translation}
89 % \changes{v3.36}{2022/02/11}{switch over from \cls*{scrdoc} to
90 % \cls*{koma-script-source-doc}}
91 % \changes{v3.36}{2022/02/11}{whole implementation documentation in English}
92 % \changes{v3.40}{2023/04/17}{guide names changed}
93 %
94 % \GetFileInfo{scrkernel-typearea.dtx}
95 % \title{Calculation of the Typeing Area with
96 % \href{https://komascript.de}{\KOMAScript} Package \pkg*{typearea}
97 % and Additional Commands for the \href{https://komascript.de}{\KOMAScript}
98 % Classes}
99 % \author{\href{mailto:[email protected]}{Markus Kohm}}
100 % \date{Revision \fileversion{} of \filedate}
101 % \maketitle
102 % \begin{abstract}
103 % \filename{} contains macros for the typing area. These result not only in
104 % the package \pkg*{typearea} but also provide features for the
105 % \KOMAScript{} classes.
106 % \end{abstract}
107 % \tableofcontents
108 %
109 % \section{User Manual}
110 %
111 % You can find the user documentation of package \pkg*{typearea} and the
112 % commands implemented here in the \KOMAScript{} manual, either the German
113 % \file{scrguide-de.pdf} or the English \file{scrguide-en.pdf}.
114 %
115 % \subsection{Options not yet in the Manual}
116 % Some options commands are not documented in the \KOMAScript{} manuals, e.g.,
117 % because they are not stable enough to be used by average users or more or
118 % less for internal usage only. Some are only not documented in the
119 % \KOMAScript{} manual, because nobody has done it yet.
120 %
121 % \DescribeOption{typeareawarnlimit=\meta{integer}}
122 % \marginpar{\raggedleft\tiny Added: 2023-02-10}%
123 % \SpecialOptionIndex{typeareawarnlimit}%
124 % If the text area of the typing area is more than \meta{integer}\% larger
125 % than the estimated good line width \pkg{typearea} would warn:
126 %\begin{verbatim}
127 % Package typearea Warning: Bad type area settings!
128 % (typearea) The detected line width is about ...%
129 % (typearea) larger than the heuristically estimated maximum
130 % (typearea) limit of typographical good line width.
131 % (typearea) You should e.g. decrease DIV, increase fontsize
132 % (typearea) or change papersize.
133 %\end{verbatim}
134 % The default of \meta{integer} is 15. This was also the static value used for
135 % \KOMAScript{} before version 3.39. A negative \meta{integer} deactivates the
136 % warning.
137 %
138 % \DescribeOption{typeareainfolimit=\meta{integer}}
139 % \marginpar{\raggedleft\tiny Added: 2023-02-10}%
140 % \SpecialOptionIndex{typeareainfolimit}%
141 % If the text area of the typing area is more than \meta{integer}\% smaller
142 % than the estimated good line width \pkg{typearea} would write an information:
143 %\begin{verbatim}
144 % Package typearea Info: Maybe no optimal type area settings!
145 % (typearea) The detected line width is about ...%
146 % (typearea) smaller than the heuristically estimated maximum
147 % (typearea) limit of typographical good line width.
148 % (typearea) You could e.g. increase DIV, decrease fontsize
149 % (typearea) or change the papersize.
150 %\end{verbatim}
151 % The default of \meta{integer} is 15. This was also the static value used for
152 % \KOMAScript before version 3.39. A negative \meta{integer} deactivates the
153 % warning.
154 %
155 % \DescribeOption{typeareawarninfolimit=\meta{integer}}
156 % \marginpar{\raggedleft\tiny Added: 2023-02-10}%
157 % \SpecialOptionIndex{typeareawarninfolimit}%
158 % This is the same like
159 % \opt{typeareawarnlimit=\meta{integer},typeareainfolimit=\meta{integer}}.
160 %
161 % \MaybeStop{\PrintIndex}
162 %
163 % \section{Implementation of Package \pkg*{typearea} and Additional Class
164 % Features}
165 %
166 %
167 % \subsection{Loading packages}
168 %
169 % Package \pkg*{typearea} needs package \pkg*{scrkbase}. But this will
170 % be loaded by \file{scrkernel-basics.dtx} just after the identify run of this
171 % file. It does not need other packages.
172 %
173 % The \KOMAScript{} classes need package \pkg*{typearea}. This will be
174 % loaded here as an early body action. Nevertheless, at this state the typing
175 % area option code for the classes has already been loaded. So before loading
176 % the almost identical option code of the package, some macros have to be
177 % reset:
178 % \begin{macrocode}
179 %<*class&body>
180 \let\@BCOR =\relax
181 \let\@@BCOR =\relax
182 \let\@DIV =\relax
183 \let\@@DIV =\relax
184 \let\@headlines =\relax
185 \let\@@headlines =\relax
186 \let\x@paper =\relax
187 \let\x@@paper =\relax
188 \let\scr@pti@nerr@r =\relax
189 % \end{macrocode}
190 % Now we can load \pkg*{typearea}:
191 % \changes{v2.95}{2002/06/22}{Use \cs{KOMAScriptVersion} while loading
192 % \pkg*{typearea}}
193 % We use \cs{KOMAScriptVersion} to verify the identical versions of
194 % \KOMAScript{} and the package. See \file{scrkernel-version.dtx} for more
195 % information about this verification.
196 % \begin{macrocode}
197 \RequirePackage{typearea}[\KOMAScriptVersion]
198 %</class&body>
199 % \end{macrocode}
200 %
201 % \subsection{Selection of paper size}
202 %
203 % Before we can define page margins and a typing area, we have to define the
204 % paper size. Beside \pkg*{typearea} also \pkg*{scrletter} uses some of
205 % this code, because it needs the paper size, too.
206 %
207 % \begin{command}{\PaperNameToSize}
208 % \changes{v3.23}{2017/02/22}{added}
209 % \changes{v3.28}{2019/11/18}{\cs{ifstr} umbenannt in \cs{Ifstr}}
210 % This command sets \cs{paperheight} and \cs{paperwidth} depending on
211 % the name of a paper size. It currently supports the ISO formats of the
212 % series A, B, C and D and the American formats letter, legal and
213 % executive. The command is defined using \cs{providecommand} so a class
214 % can define it different before loading \pkg*{typearea}. The first
215 % optional argument is the error class. Error classes will be defined using
216 % \cs{ProvideUnknownPaperSizeError} later. The second argument is the name
217 % of the paper size.
218 % \begin{macrocode}
219 %<*package&options>
220 \providecommand*{\PaperNameToSize}[2][warning]{%
221 \Ifstr{#2}{letter}{%
222 \setlength\paperheight{11in}%
223 \setlength\paperwidth {8.5in}%
224 }{%
225 \Ifstr{#2}{legal}{%
226 \setlength\paperheight{14in}%
227 \setlength\paperwidth {8.5in}%
228 }{%
229 \Ifstr{#2}{executive}{%
230 \setlength\paperheight{10.5in}%
231 \setlength\paperwidth {7.25in}%
232 }{%
233 \Ifstr{#2}{}{%
234 \ISO@PaperNameToSize[#1]{}{}\@nil
235 }{%
236 \edef\reserved@a{\noexpand\ISO@PaperNameToSize[#1]#2 \noexpand\@nil}%
237 \reserved@a
238 }%
239 }%
240 }%
241 }%
242 }
243 % \end{macrocode}
244 % \begin{macro}{\ISO@PaperNameToSize}
245 % \changes{v3.23}{2017/02/22}{new (internal)}
246 % \changes{v3.28}{2019/11/18}{\cs{ifnumber} umbenannt in \cs{Ifnumber}}
247 % For ISO paper sizes a sub-macro is used. It has to split the series and the
248 % root.
249 % \begin{macrocode}
250 \scr@ifundefinedorrelax{ISO@PaperNameToSize}{%
251 \def\ISO@PaperNameToSize[#1]#2#3\@nil{%
252 \lowercase{\edef\reserved@a{#2}}%
253 \@tempswafalse
254 \if \reserved@a a%
255 \Ifnumber{#3}{%
256 \setlength{\paperwidth}{841sp}%
257 \setlength{\paperheight}{1189sp}%
258 \@tempswatrue
259 }{}%
260 \else
261 \if \reserved@a b%
262 \Ifnumber{#3}{%
263 \setlength{\paperwidth}{1000sp}%
264 \setlength{\paperheight}{1414sp}%
265 \@tempswatrue
266 }{}%
267 \else
268 \if \reserved@a c%
269 \Ifnumber{#3}{%
270 \setlength{\paperwidth}{917sp}%
271 \setlength{\paperheight}{1297sp}%
272 \@tempswatrue
273 }{}%
274 \else
275 \if \reserved@a d%
276 \Ifnumber{#3}{%
277 \setlength{\paperwidth}{771sp}%
278 \setlength{\paperheight}{1090sp}%
279 \@tempswatrue
280 }{}%
281 \fi
282 \fi
283 \fi
284 \fi
285 \if@tempswa
286 \@tempcnta=#3\relax
287 \@whilenum\@tempcnta>\z@
288 \do{\setlength{\@tempdima}{\paperwidth}%
289 \setlength{\paperwidth}{.5\paperheight}%
290 \setlength{\paperheight}{\@tempdima}%
291 \advance\@tempcnta by\m@ne
292 }%
293 \multiply\paperwidth by186468
294 \multiply\paperheight by186468
295 \else
296 % \end{macrocode}
297 % The paper size is not a supported ISO format. If
298 % \cs{scr@UnknownPaperSize@}\meta{errorclass} is defined, use it to show
299 % the error. If not, use \cs{scr@UnknownPaperSize@error}. This means,
300 % \meta{errorclass} \texttt{error} has to be defined.
301 % \begin{macrocode}
302 \scr@ifundefinedorrelax{scr@UnknownPaperSize@#1}{%
303 \scr@UnknownPaperSize@error{#2#3}%
304 }{%
305 \@nameuse{scr@UnknownPaperSize@#1}{#2#3}%
306 }%
307 \fi
308 }%
309 }{}
310 % \end{macrocode}
311 % \begin{command}{\ProvideUnknownPaperSizeError}
312 % \changes{v3.23}{2017/02/22}{added}
313 % Define a new error class for unknown paper formats. The argument is the new
314 % error class. Each error class is represented by a command
315 % \cs{scr@UnknownPaperSize@}\meta{errorclass}. That command also has
316 % exactly one argument, the unknown paper size.
317 % \begin{macrocode}
318 \providecommand*{\ProvideUnknownPaperSizeError}[1]{%
319 \expandafter\providecommand\expandafter*%
320 \csname scr@UnknownPaperSize@#1\endcsname[1]%
321 }
322 % \end{macrocode}
323 % \begin{macro}{\scr@UnkownPaperSize@error,\scr@UnkownPaperSize@warning,
324 % \scr@UnkownPaperSize@info,\scr@UnkownPaperSize@ignore}
325 % \changes{v3.23}{2017/02/22}{new (internal)}
326 % Error handling (error classes) for \cs{PaperNameToSize}.
327 % \begin{macrocode}
328 \ProvideUnknownPaperSizeError{error}{%
329 \PackageError{%
330 %<typearea> typearea%
331 %<letter> scrletter%
332 }{Unknown paper size #1}{%
333 \string\paperwidth\space and \string\paperheight\space stay unchanged,
334 because of unknown paper size.%
335 }%
336 }
337 %<*typearea>
338 \ProvideUnknownPaperSizeError{warning}{%
339 \PackageWarning{typearea}{%
340 \string\paperwidth\space and \string\paperheight\space stay
341 unchanged, because\MessageBreak
342 of unknown paper size #1%
343 }%
344 }
345 \ProvideUnknownPaperSizeError{info}{%
346 \PackageInfo{typearea}{%
347 \string\paperwidth\space and \string\paperheight\space stay
348 unchanged, because\MessageBreak
349 of unknown paper size #1%
350 }%
351 }
352 \ProvideUnknownPaperSizeError{ignore}{}
353 %</typearea>
354 %</package&options>
355 % \end{macrocode}
356 % \end{macro}^^A \scr@UnknownPaperSize@error … \scr@UnknownPaperSize@ignore
357 % \end{command}^^A \ProvideUnknownPaperSizeError
358 % \end{macro}^^A \ISO@PaperNameToSize
359 % \end{command}^^A \PaperNameToSize
360 %
361 % \begin{option}{a4paper,a5paper,b5paper,letterpaper,legalpaper,executivepaper,
362 % landscape,portrait}
363 % \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by \cs{PackageInfoNoLine}}
364 % \changes{v3.01a}{2008/11/21}{the option is standard but not deprecated}
365 % The paper sizes of the standard classes are a special case. For
366 % compatibility they are declared explicitly. Note: There is still a pattern
367 % matching implementation for other paper size options, but the usage of those
368 % is hardly deprecated.
369 % \begin{macrocode}
370 %<*package&typearea&options>
371 \KOMA@DeclareStandardOption[typearea]{a4paper}{paper=a4}
372 \KOMA@DeclareStandardOption[typearea]{a5paper}{paper=a5}
373 \KOMA@DeclareStandardOption[typearea]{b5paper}{paper=b5}
374 \KOMA@DeclareStandardOption[typearea]{letterpaper}{paper=letter}
375 \KOMA@DeclareStandardOption[typearea]{legalpaper}{paper=legal}
376 \KOMA@DeclareStandardOption[typearea]{executivepaper}{paper=executive}
377 \KOMA@DeclareStandardOption[typearea]{landscape}{paper=landscape}
378 \KOMA@DeclareStandardOption[typearea]{portrait}{paper=portrait}
379 %</package&typearea&options>
380 % \end{macrocode}
381 % \end{option}^^A a4paper … portrait
382 %
383 % \begin{option}{paper}
384 % \changes{v2.95}{2002/12/03}{added}
385 % \changes{v3.01b}{2008/12/09}{height and width swapped}
386 % \changes{v3.02c}{2009/02/12}{new \opt{paper\quotechar=seascape}}
387 % \changes{v3.12}{2013/03/05}{status signaling using \cs{FamilyKeyState}}
388 % \changes{v3.22}{2016/07/29}{paper orientation depends on format name}
389 % \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
390 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
391 % option storage commands}
392 % Normally, the paper size should be set using this option. It provides the
393 % ISO series A, B, C, D, value pairs
394 % \opt{(\meta{width},\meta{height})} and the orientations
395 % \opt{portrait}, \opt{landscape} and \opt{seascape}.
396 % \begin{macrocode}
397 %<*package&typearea&options>
398 \KOMA@key{paper}{%
399 \Ifstr{#1}{seascape}{%
400 \@seascapetrue
401 %<!v4> \expandafter\ifnum\scr@ta@v@is@ge{3.22}\relax
402 \@landscapetrue
403 \scr@setpaperorientation
404 %<!v4> \else
405 %<!v4> \if@landscape\else\scr@switchpapersizes\@landscapetrue\fi
406 %<!v4> \fi
407 \FamilyKeyStateProcessed
408 \KOMA@kav@remove{typearea.\scr@pkgextension}{paper}{landscape}%
409 \KOMA@kav@remove{typearea.\scr@pkgextension}{paper}{portrait}%
410 \KOMA@kav@remove{typearea.\scr@pkgextension}{paper}{seascape}%
411 \KOMA@kav@add{typearea.\scr@pkgextension}{paper}{seascape}%
412 }{%
413 \Ifstr{#1}{landscape}{%
414 \@seascapefalse
415 %<!v4> \expandafter\ifnum\scr@ta@v@is@ge{3.22}\relax
416 \@landscapetrue
417 \scr@setpaperorientation
418 %<!v4> \else
419 %<!v4> \if@landscape\else\scr@switchpapersizes\@landscapetrue\fi
420 %<!v4> \fi
421 \FamilyKeyStateProcessed
422 \KOMA@kav@remove{typearea.\scr@pkgextension}{paper}{landscape}%
423 \KOMA@kav@remove{typearea.\scr@pkgextension}{paper}{portrait}%
424 \KOMA@kav@remove{typearea.\scr@pkgextension}{paper}{seascape}%
425 \KOMA@kav@add{typearea.\scr@pkgextension}{paper}{landscape}%
426 }{%
427 \Ifstr{#1}{portrait}{%
428 %<!v4> \expandafter\ifnum\scr@ta@v@is@ge{3.22}\relax
429 \@landscapefalse
430 \scr@setpaperorientation
431 %<!v4> \else
432 %<!v4> \if@landscape\scr@switchpapersizes\@landscapefalse\fi
433 %<!v4> \fi
434 \FamilyKeyStateProcessed
435 \KOMA@kav@remove{typearea.\scr@pkgextension}{paper}{landscape}%
436 \KOMA@kav@remove{typearea.\scr@pkgextension}{paper}{portrait}%
437 \KOMA@kav@remove{typearea.\scr@pkgextension}{paper}{seascape}%
438 \KOMA@kav@add{typearea.\scr@pkgextension}{paper}{portrait}%
439 }{%
440 \Ifstr{#1}{letter}{%
441 \if@landscape
442 \setlength\paperheight{8.5in}%
443 \setlength\paperwidth {11in}%
444 \else
445 \setlength\paperheight{11in}%
446 \setlength\paperwidth {8.5in}%
447 \fi
448 \FamilyKeyStateProcessed
449 \KOMA@kav@removekey{typearea.\scr@pkgextension}{paper}%
450 \KOMA@kav@add{typearea.\scr@pkgextension}{paper}{letter}%
451 \KOMA@kav@xadd{typearea.\scr@pkgextension}{paper}{%
452 \if@seascape seascape\else
453 \if@landscape landscape\else portrait\fi\fi
454 }%
455 }{%
456 \Ifstr{#1}{legal}{%
457 \if@landscape
458 \setlength\paperheight{8.5in}%
459 \setlength\paperwidth {14in}%
460 \else
461 \setlength\paperheight{14in}%
462 \setlength\paperwidth {8.5in}%
463 \fi
464 \FamilyKeyStateProcessed
465 \KOMA@kav@removekey{typearea.\scr@pkgextension}{paper}%
466 \KOMA@kav@add{typearea.\scr@pkgextension}{paper}{legal}%
467 \KOMA@kav@xadd{typearea.\scr@pkgextension}{paper}{%
468 \if@seascape seascape\else
469 \if@landscape landscape\else portrait\fi\fi
470 }%
471 }{%
472 \Ifstr{#1}{executive}{%
473 \if@landscape
474 \setlength\paperheight{7.25in}%
475 \setlength\paperwidth {10.5in}%
476 \else
477 \setlength\paperheight{10.5in}%
478 \setlength\paperwidth {7.25in}%
479 \fi
480 \FamilyKeyStateProcessed
481 \KOMA@kav@removekey{typearea.\scr@pkgextension}{paper}%
482 \KOMA@kav@add{typearea.\scr@pkgextension}{paper}{executive}%
483 \KOMA@kav@xadd{typearea.\scr@pkgextension}{paper}{%
484 \if@seascape seascape\else
485 \if@landscape landscape\else portrait\fi\fi
486 }%
487 }{%
488 \iso@paper{#1}%
489 \if@tempswa
490 \FamilyKeyStateProcessed
491 \KOMA@kav@removekey{typearea.\scr@pkgextension}{paper}%
492 \KOMA@kav@xadd{typearea.\scr@pkgextension}{paper}{#1}%
493 \KOMA@kav@xadd{typearea.\scr@pkgextension}{paper}{%
494 \if@seascape seascape\else
495 \if@landscape landscape\else portrait\fi\fi
496 }%
497 \else
498 \expandafter\maybe@pair#1::\@nil
499 \if@tempswa
500 \FamilyKeyStateProcessed
501 \KOMA@kav@removekey{typearea.\scr@pkgextension}{paper}%
502 %<*!v4>
503 \expandafter\ifnum \scr@ta@v@is@lt{3.01b}\relax
504 \PackageWarningNoLine{typearea}{%
505 You may have to exchange height and width!\MessageBreak
506 Until KOMA-Script version 3.01b the semantic\MessageBreak
507 of option `paper' was `paper=height:width'\MessageBreak
508 instead of `paper=width:height'.\MessageBreak
509 I've switched back to that old interpretation\MessageBreak
510 because of the given compatiblity settings}%
511 \setlength\paperwidth{\@tempb}%
512 \setlength\paperheight{\@tempa}%
513 \else
514 %</!v4>
515 \setlength\paperwidth{\@tempa}%
516 \setlength\paperheight{\@tempb}%
517 %<*!v4>
518 \fi
519 \expandafter\ifnum \scr@ta@v@is@lt{3.22}\relax
520 \if@landscape
521 \KOMA@kav@xadd{typearea.\scr@pkgextension}{paper}{\@tempa:\@tempb}%
522 \else
523 \KOMA@kav@xadd{typearea.\scr@pkgextension}{paper}{\@tempb:\@tempa}%
524 \fi
525 \else
526 %</!v4>
527 \scr@setpaperorientation
528 \KOMA@kav@xadd{typearea.\scr@pkgextension}{paper}{%
529 \the\paperwidth:\the\paperheight}%
530 %<!v4> \fi
531 \KOMA@kav@xadd{typearea.\scr@pkgextension}{paper}{%
532 \if@seascape seascape\else
533 \if@landscape landscape\else portrait\fi\fi
534 }%
535 \else
536 \KOMA@unknown@keyval{paper}{#1}{%
537 `letter', `legal', `executive', `a'<nr>, `b'<nr>,
538 `c'<nr>, `d'<nr>,\MessageBreak
539 <width>`:'<height>, `landscape' and `portrait'%
540 }%
541 \fi
542 \fi
543 }%
544 }%
545 }%
546 }%
547 }%
548 }%
549 }
550 % \end{macrocode}
551 % \begin{macro}{\if@seascape,\@seascapetrue,\@seascapefalse}
552 % \changes{v3.02c}{2009/02/12}{added}
553 % This switch stores only whether or not the landscape orientation should be
554 % up-side-down. Currently this makes sense only using \file{dvips}.
555 % \begin{macrocode}
556 \newif\if@seascape
557 % \end{macrocode}
558 % \end{macro}
559 % \begin{macro}{\if@landscape,\@landscapetrue,\@landscapefalse}
560 % This switch stores whether using portrait or landscape orientation.
561 % \begin{macrocode}
562 \newif\if@landscape
563 % \end{macrocode}
564 % \end{macro}
565 % \begin{macro}{\maybe@pair}
566 % \changes{v2.95}{2002/12/03}{added}
567 % \changes{v2.97e}{2007/11/26}{works really}
568 % Test whether the following parameter is of kind \texttt{\meta{first
569 % argument}:\meta{second argument}}. If so \cs{@tempa} will become \meta{first
570 % argument} and \cs{@tempb} will become \meta{second argument} and
571 % \cs{if@tempswa} will become \cs{iftrue}. Otherwise \cs{if@tempswa} is
572 % \cs{iffalse} and \cs{@tempa} and \cs{@tempb} are not specified.
573 % \begin{macrocode}
574 \newcommand*{\maybe@pair}{}
575 \def\maybe@pair#1:#2:#3\@nil{%
576 \edef\@tempa{#1}\edef\@tempb{#2}%
577 \ifx\@tempa\@empty\@tempswafalse\else
578 \ifx\@tempb\@empty\@tempswafalse\else\@tempswatrue\fi
579 \fi
580 }
581 %</package&typearea&options>
582 % \end{macrocode}
583 % \end{macro}^^A \maybe@pair
584 % \end{option}^^A paper
585 %
586 % \subsection{Special handling of \pkg*{geometry}}
587 %
588 % \begin{option}{usegeometry}
589 % \changes{v3.17}{2015/02/07}{added}
590 % \pkg*{typearea} optionally can pass several settings to package
591 % \pkg{geometry}. The user decides whether or not to use this.
592 % \begin{macrocode}
593 %<*package&typearea&options>
594 \KOMA@ifkey{usegeometry}{@ta@usegeometry}
595 %</package&typearea&options>
596 % \end{macrocode}
597 % \end{option}
598 %
599 %
600 % \subsection{Setting the output paper size}
601 %
602 % The document paper format of option \opt{paper} is one thing. It is used
603 % only for calculation of the dimensions used by \TeX{}. Originally
604 % \textsc{dvi} does not know something like a paper size. It just contained
605 % relative movements from the current position starting with the
606 % origin. Setting up a page size depends on the output driver or back-end.
607 %
608 % \begin{option}{pagesize}
609 % \changes{v2.7g}{2001/04/17}{added}
610 % \changes{v2.95}{2002/08/27}{new implementation}
611 % \changes{v3.02c}{2009/02/14}{new \opt{pagesize\quotechar=false}}
612 % \changes{v3.05a}{2010/03/18}{new \opt{pagesize\quotechar=dvipdfmx}}
613 % \changes{v3.12}{2013/03/05}{status signaling using \cs{FamilyKeyState}}
614 % \changes{v3.17a}{2015/05/03}{logic redesigned}
615 % \changes{v3.20}{2015/07/10}{\file{luatex} as a synonym of \file{pdftex}}
616 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
617 % option storage commands}
618 % This option is the main element for telling pdf\TeX, \file{dvips} or V\TeX{}
619 % which paper size to use. It is also used by some deprecated options. Here
620 % are the values and their meanings:
621 % \begin{labeling}[~--]{\opt{automedia}}
622 % \item[\opt{auto}] combination of options \opt{pdftex} and
623 % \opt{dvips}.
624 % \item[\opt{automedia}] like \opt{auto} with additional setting of
625 % \cs{mediawidth} and \cs{mediaheight} if available.
626 % \item[\opt{dvips}] adds a \file{dvips} \cs{special} to set the paper
627 % size. This should be done only once in the document preamble. Usage inside
628 % the document body is not fully supported and will raise a warning.
629 % \item[\opt{dvipdfmx}] adds a \file{dvipdfmx} \cs{special} to set the
630 % paper size.
631 % \item[\opt{false}] switch of the automatic driver page size setting,
632 % i.e., if there are changes inside the document.
633 % \item[\opt{pdftex}] set \cs{pdfpagewidth} and \cs{pdfpageheight} if
634 % available.
635 % \end{labeling}
636 % \begin{macrocode}
637 %<*package&typearea&options>
638 \KOMA@key{pagesize}[auto]{%
639 \KOMA@set@ncmdkey{pagesize}{@pagesizelast}{%
640 {off}{-1},{no}{-1},{false}{-1},%
641 {auto}{0},{automedia}{1},{dvips}{2},{pdftex}{3},{luatex}{3},{dvipdfmx}{4}%
642 }{#1}%
643 \ifx\FamilyKeyState\FamilyKeyStateProcessed
644 \ifcase\number\@pagesizelast\relax
645 \edef\@pagesizelast{auto}%
646 \if@atdocument
647 \set@pdftexpagesize
648 \set@dvipspagesize
649 \fi
650 \or
651 \edef\@pagesizelast{automedia}%
652 \if@atdocument
653 \set@pdftexpagesize
654 \set@vtexpagesize
655 \set@dvipspagesize
656 \fi
657 \or
658 \edef\@pagesizelast{dvips}%
659 \if@atdocument
660 \set@dvipspagesize
661 \fi
662 \or
663 \edef\@pagesizelast{pdftex}%
664 \if@atdocument
665 \set@pdftexpagesize
666 \fi
667 \or
668 \edef\@pagesizelast{dvipdfmx}%
669 \if@atdocument
670 \set@dvipdfmxpagesize
671 \fi
672 \else
673 \edef\@pagesizelast{false}%
674 \fi
675 \KOMA@kav@xreplacevalue{typearea.\scr@pkgextension}%
676 {pagesize}{\@pagesizelast}%
677 \fi
678 }
679 % \end{macrocode}
680 % \begin{macro}{\@pagesizelast}
681 % \changes{v3.39}{2022/11/11}{initial dot in member argument of
682 % \cs{KOMAExecuteOptions} removed}
683 % This internal macro stores the current value of option \opt{pagesize} and
684 % is needed to use the correct signalling if option \opt{paper} is used
685 % inside the document and the initial setup in |\begin{document}|.
686 % \begin{macrocode}
687 \newcommand\@pagesizelast{auto}
688 \AtBeginDocument{%
689 \KOMAExecuteOptions[typearea.\scr@pkgextension]{pagesize=\@pagesizelast}%
690 % \end{macrocode}
691 % \end{macro}^^A \@pagesizelast
692 %
693 % \begin{macro}{\set@pdftexpagesize}
694 % \changes{v2.95}{2002/08/27}{added}
695 % \changes{v3.20}{2015/07/10}{if \cs{pdfpage\dots} does not exist
696 % \cs{page\dots} will be tried (needed for lua\TeX{}~0.80.1)}
697 % \begin{macro}{\set@dvipspagesize}
698 % \changes{v2.95}{2002/08/27}{added}
699 % \changes{v3.02c}{2009/02/13}{respecting \opt{seascape}}
700 % \changes{v3.02c}{2009/02/14}{can be used inside the document}
701 % \changes{v3.12}{2012/02/06}{not expanded
702 % \cs{let}\cs{if@tempswa}\cs{if@dvips} does even work is the later is not
703 % yet defined}
704 % \changes{v3.28}{2019/11/18}{\cs{ifnotundefined} renamed into
705 % \cs{Ifnotundefined}}
706 % \begin{macro}{\setnot@dvipspagesize}
707 % \changes{v2.95}{2002/08/27}{added}
708 % \begin{macro}{\set@dvipdfmxpagesize}
709 % \changes{v3.05a}{2010/03/18}{added}
710 % \begin{macro}{\set@vtexpagesize}
711 % \changes{v2.95}{2002/08/27}{added}
712 % \changes{v3.28}{2019/11/18}{\cs{ifnotundefined} renamed into
713 % \cs{Ifnotundefined}}
714 % \begin{macro}{\scr@updatedvipspagesize}
715 % \changes{v3.02c}{2009/02/14}{added}
716 % \changes{v3.12}{2013/05/10}{deactivated, if \cs{XeTeXversion} exists}
717 % Option \opt{pagesize} needs some internal macros.
718 % \begin{description}
719 % \item{Attention:} The definition of these macros may change at usage of
720 % themselves or at |\begin{document}|.
721 % \end{description}
722 % First of all the definition from |\begin{document}|:
723 % \begin{macrocode}
724 %<!v4> \expandafter\ifnum\scr@ta@v@is@gt{3.02b}\relax
725 \renewcommand*{\set@dvipspagesize}{%
726 % \end{macrocode}
727 % \changes{v3.12}{2012/11/23}{use paper size update only for DVI and PS}
728 % \changes{v3.12}{2012/02/06}{not expanded
729 % \cs{let}\cs{if@tempswa}\cs{if@dvips} does even work if the later is not
730 % yet defined}
731 % Test whether unspecified \textsc{dvi} output or specified \textsc{ps} output
732 % is used. Only in that cases the \textsc{ps} code for paper size updates will
733 % be used.
734 % \begin{macrocode}
735 \begingroup
736 \@tempswafalse
737 \scr@ifdvioutput{\@tempswatrue}{%
738 \Ifnotundefined{if@dvips}{%
739 \expandafter\let\csname if@tempswa\expandafter\endcsname
740 \csname if@dvips\endcsname
741 }{}%
742 }%
743 \if@tempswa
744 \endgroup
745 \scr@ifundefinedorrelax{AtNextShipout}{%
746 \scr@ifundefinedorrelax{AtBeginShipoutNext}{%
747 \begingroup
748 \protected@edef\reserved@a{\endgroup
749 \scr@updatedvipspagesize}%
750 \reserved@a
751 }{%
752 % \end{macrocode}
753 % If \cs{AtBeginShipoutNext} is available (mostly because of loading package
754 % \pkg{atbegshi}) use it so execute the code at least before other code
755 % that has been added to \cs{shipout}. Unfortunately this is not reliable. If
756 % \cs{AtBeginShipout} is used after \cs{set@dvipspagesize} (this means the
757 % recalculation of the typing area and the margins) but before the current
758 % page has been shipped out the code of such \cs{AtBeginShipout} will be lost!
759 % \begin{macrocode}
760 \begingroup
761 \protected@edef\reserved@a{\endgroup
762 \protect\AtBeginShipoutNext{%
763 \protect\bgroup
764 \protect\global\protect\setbox\AtBeginShipoutBox
765 \protect\vbox{%
766 \scr@updatedvipspagesize
767 \protect\box\AtBeginShipoutBox
768 }%
769 \protect\egroup
770 }}%
771 \reserved@a
772 }%
773 }{%
774 % \end{macrocode}
775 % If \cs{AtNextShipout} is available (mostly because of loading package
776 % \pkg{everyshi} use it to execute the code at least before other code
777 % that has been added to \cs{shipout}. Unfortunately this is not reliable. If
778 % \cs{AtNextShipout} or \cs{EveryShipout} is used after \cs{set@dvipspagesize}
779 % (this means the recalculation of the typing area and the margins) but before
780 % the current page has been shipped out the code of such \cs{AtNextShipout} or
781 % \cs{EveryShipout} will be lost!
782 % \begin{macrocode}
783 \begingroup
784 \protected@edef\reserved@a{\endgroup
785 \protect\AtNextShipout{%
786 \protect\bgroup
787 \protect\global\protect\setbox\protect\@cclv\protect\vbox{%
788 \scr@updatedvipspagesize
789 \protect\box\protect\@cclv
790 }%
791 \protect\egroup
792 }}%
793 \reserved@a
794 }%
795 \else
796 % \end{macrocode}
797 % In this case (neither \textsc{DVI} nor \textsc{PS} output) we only have to
798 % finish the group that has been used to keep changes of \cs{if@tempswa}
799 % local.
800 % \begin{macrocode}
801 \endgroup
802 \fi
803 }%
804 %<!v4> \else
805 %<!v4> \let\set@dvipspagesize=\setnot@dvipspagesize
806 %<!v4> \fi
807 \renewcommand*{\set@dvipdfmxpagesize}{%
808 \scr@ifdvioutput{%
809 \special{papersize=\the\paperwidth,\the\paperheight}%
810 }{}%
811 }%
812 }
813 % \end{macrocode}
814 % And now the definition that is used before |\begin{document}| but executed
815 % the first time inside |\begin{document}|.
816 % \changes{v3.21}{2016/05/27}{two missing backslashs added}
817 % \begin{macrocode}
818 \newcommand*{\set@pdftexpagesize}{%
819 \scr@ifundefinedorrelax{pdfpagewidth}{%
820 \scr@ifundefinedorrelax{pagewidth}{}{\pagewidth=\paperwidth}%
821 }{\pdfpagewidth=\paperwidth}%
822 \scr@ifundefinedorrelax{pdfpageheight}{%
823 \scr@ifundefinedorrelax{pageheight}{}{\pageheight=\paperheight}%
824 }{\pdfpageheight=\paperheight}%
825 }
826 \newcommand*{\set@dvipspagesize}{%
827 \begingroup
828 \@tempswafalse
829 \scr@ifdvioutput{\@tempswatrue}{%
830 \Ifnotundefined{if@dvips}{%
831 \expandafter\let\csname if@tempswa\expandafter\endcsname
832 \csname if@dvips\endcsname
833 }{}%
834 }{}%
835 % \end{macrocode}
836 % \changes{v3.22}{2016/08/04}{\pkg{preview} workaround}
837 % If package \pkg{preview} has been loaded with option \opt{tightpage},
838 % which can be recognized by a defined macro \cs{pr@nextbb}, and if the
839 % package is active, we do not add \textsc{dvi} specials, because it would
840 % disturb Xe\LaTeX.
841 % \begin{macrocode}
842 \scr@ifundefinedorrelax{pr@nextbb}{}{%
843 \expandafter\ifx\csname ifPreview\expandafter\endcsname
844 \csname iftrue\endcsname
845 \PackageInfo{typearea}{%
846 package `preview' with option `tightpage' detected.\MessageBreak
847 initial page size special deactivated%
848 }%
849 \@tempswafalse
850 \fi
851 }%
852 \if@tempswa
853 \endgroup
854 \AtBeginDvi{%
855 \special{papersize=\the\paperwidth,\the\paperheight}%
856 \if@seascape\special{! TeXDict begin /landplus90{true}store end }\fi
857 }%
858 %<!v4> \expandafter\ifnum\scr@ta@v@is@gt{3.02b}\relax
859 \let\set@dvipspagesize=\@empty
860 %<!v4> \else
861 %<!v4> \let\set@dvipspagesize=\setnot@dvipspagesize
862 %<!v4> \fi
863 \else
864 \endgroup
865 \fi
866 }
867 \newcommand*{\setnot@dvipspagesize}{%
868 \scr@ifdvioutput{%
869 \PackageWarning{%
870 typearea%
871 }{%
872 With dvi output option `pagesize=auto',\MessageBreak
873 `pagesize=automedia' or `pagesize=dvips'\MessageBreak
874 may be used only once at preamble.\MessageBreak
875 Option ignored%
876 }%
877 }{}%
878 }
879 \newcommand*{\set@dvipdfmxpagesize}{%
880 \scr@ifdvioutput{%
881 \AtBeginDvi{%
882 \special{papersize=\the\paperwidth,\the\paperheight}%
883 }%
884 }{}%
885 }
886 \newcommand*{\set@vtexpagesize}{%
887 \Ifnotundefined{mediawith}{\mediawidth=\paperwidth}{}%
888 \Ifnotundefined{mediaheight}{\mediaheight=\paperheight}{}%
889 }
890 \newcommand*{\scr@updatedvipspagesize}{%
891 \scr@ifundefinedorrelax{XeTeXversion}{%
892 \special{ps::\@percentchar\@percentchar
893 PageBoundingBox: 0 0 \the\numexpr\paperwidth/\dimexpr 1bp\relax\relax
894 \space \the\numexpr\paperheight/\dimexpr 1bp\relax\relax^^J%
895 \@percentchar\@percentchar BeginPageSetup^^J%
896 << /PageSize [\the\numexpr\paperwidth/\dimexpr 1bp\relax\relax\space
897 \the\numexpr\paperheight/\dimexpr 1bp\relax\relax]
898 >> setpagedevice^^J%<<
899 0 0 bop^^J%
900 \@percentchar\@percentchar EndPageSetup}%
901 }{}%
902 }
903 %</package&typearea&options>
904 % \end{macrocode}
905 % \end{macro}
906 % \end{macro}
907 % \end{macro}
908 % \end{macro}
909 % \end{macro}
910 % \end{macro}
911 % \end{option}
912 %
913 % \begin{option}{dvips}
914 % \changes{v2.7g}{2001/04/17}{added}
915 % \changes{v2.95}{2002/08/27}{new implementation}
916 % \changes{v2.98c}{2008/04/09}{replacement changed}
917 % \changes{v2.98c}{2008/04/09}{info instead of warning}
918 % \changes{v3.01a}{2008/11/21}{it's a standard option not deprecated}
919 % This option is a kind of obsolete. It is now implemented using
920 % \opt{pagesize}. But because this is a standard option using several other
921 % packages we only show a standard option information instead of a deprecated
922 % option warning. Note: Usage of \opt{pagesize=automedia} can still result
923 % in a warning message!
924 % \begin{macrocode}
925 %<*package&typearea&options>
926 \KOMA@DeclareStandardOption[typearea]{dvips}{%
927 pagesize=automedia%
928 }
929 %</package&typearea&options>
930 % \end{macrocode}
931 % \end{option}
932 %
933 % \begin{option}{pdftex}
934 % \changes{v2.7g}{2001/04/17}{added}
935 % \changes{v2.95}{2002/08/27}{new implementation}
936 % \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by \cs{PackageInfoNoLine}}
937 % \changes{v3.01a}{2008/11/21}{it's a standard option not deprecated}
938 % This option is a kind of obsolete. It is now implemented using
939 % \opt{pagesize}. But because this is a standard option using several other
940 % packages we only show a standard option information instead of a deprecated
941 % option warning.
942 % \begin{macrocode}
943 %<*package&typearea&options>
944 \KOMA@DeclareStandardOption[typearea]{pdftex}{%
945 pagesize=pdftex%
946 }
947 %</package&typearea&options>
948 % \end{macrocode}
949 % \end{option}
950 %
951 % \subsection{Influencing left and right margin proportions}
952 %
953 % Options like \opt{twoside} or \opt{twocolumn} influence the
954 % proportions of the left and right margin and indirectly also the top and the
955 % bottom margin. They are also very important for the document classes.
956 %
957 % \begin{option}{oneside}
958 % \changes{v2.97e}{2007/11/23}{pass option from class to \pkg*{typearea}}
959 % \changes{v3.01a}{2008/11/21}{it's a standard option not deprecated}
960 % \begin{option}{twoside}
961 % \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by \cs{PackageInfoNoLine}}
962 % \changes{v2.97e}{2007/11/23}{pass option from class to \pkg*{typearea}}
963 % \changes{v3.00}{2008/07/09}{new option \opt{twoside\quotechar=semi}}
964 % \changes{v3.12}{2013/03/05}{status signaling using \cs{FamilyKeyState}}
965 % \changes{v3.13a}{2014/04/09}{the class also uses status signaling with
966 % \cs{FamilyKeyStateProcessed}}
967 % \changes{v3.17}{2015/03/17}{automatic usage of \cs{flushbottom} and
968 % \cs{raggedbottom}}
969 % \changes{v3.17}{2015/03/17}{early setting of default}
970 % \changes{v3.17}{2015/03/18}{use \cs{cleardoubleoddpage} if available}
971 % \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
972 % \begin{macro}{\if@semitwoside,\@semitwosidetrue,\@semitwosidefalse}
973 % \changes{v3.00}{2008/07/09}{new boolean switch (intern)}
974 % \begin{macro}{\if@twoside,\@twosidetrue,\@twosidefalse}
975 % \changes{v3.00}{2008/07/09}{switch also sets \cs{if@semitwoside}}
976 % Do we have a single sided or double sided layout?
977 % \begin{macrocode}
978 %<*package&typearea&options>
979 \newif\if@semitwoside
980 \g@addto@macro\@twosidetrue\@semitwosidefalse
981 \g@addto@macro\@twosidefalse\@semitwosidefalse
982 %</package&typearea&options>
983 % \end{macrocode}
984 % \end{macro}
985 % \end{macro}
986 % \begin{macrocode}
987 %<*(class|(package&typearea))&options>
988 \KOMA@key{twoside}[true]{%
989 %<class> \if@atdocument\else\PassOptionsToPackage{twoside=#1}{typearea}\fi%
990 %<*package>
991 \if@atdocument\if@twoside
992 \scr@ifundefinedorrelax{cleardoubleoddpage}{%
993 \cleardoublepage
994 }{%
995 \cleardoubleoddpage
996 }%
997 \else\clearpage\fi\fi
998 %</package>
999 \Ifstr{#1}{semi}{%
1000 \@twosidetrue
1001 %<package> \@semitwosidetrue
1002 \FamilyKeyStateProcessed
1003 }{%
1004 \def\FamilyElseValue{, `semi'}%
1005 \KOMA@set@ifkey{twoside}{%
1006 % \end{macrocode}
1007 % \changes{v3.20}{2015/11/02}{not existing order dependency of
1008 % \opt{twocolumn} and \opt{twoside} fixed}
1009 % \changes{v3.27}{2019/03/05}{no special treatment for letters}
1010 % \changes{v3.27}{2019/03/05}{missing \cs{sloppy} in twocolumn mode added}
1011 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
1012 % option storage commands}
1013 % From v3.17 until 3.19a the classes used a local switch
1014 % \cs{if@tempswa}. As a result of this option \opt{twocolumn} was not
1015 % able to recognize double sided layout. Because of this it was essential to
1016 % handle option \opt{twocolumn} before option \opt{twoside}. This has
1017 % been solved using \cs{if@twoside} in the classes too. Another solution
1018 % could have been to move the implementation and execution of
1019 % \opt{twocolumn} before \opt{twoside}. But I don't know whether or not
1020 % this would have been reliable and the solution here is more simple.
1021 % \begin{macrocode}
1022 @twoside%
1023 }{#1}%
1024 }%
1025 \ifx\FamilyKeyState\FamilyKeyStateProcessed
1026 %<*class>
1027 %<!v4> \expandafter\ifnum\scr@v@is@ge{3.17}%
1028 \if@twoside\flushbottom
1029 \else
1030 \if@twocolumn\sloppy\flushbottom\else\raggedbottom\fi
1031 \fi
1032 %<!v4> \fi
1033 %</class>
1034 \KOMA@kav@xreplacevalue
1035 %<class> {\KOMAClassFileName}%
1036 %<package> {typearea.\scr@pkgextension}%
1037 {twoside}{#1}%
1038 %<*package>
1039 \if@twoside
1040 \if@semitwoside
1041 \@mparswitchfalse
1042 \else
1043 \@mparswitchtrue
1044 \fi
1045 \else
1046 \@mparswitchfalse
1047 \fi%
1048 \csname recalctypearea\endcsname
1049 %</package>
1050 \fi
1051 }
1052 %<*class>
1053 %<book>\KOMAExecuteOptions{twoside=true}
1054 %<!book>\KOMAExecuteOptions{twoside=false}
1055 %</class>
1056 %<*package>
1057 \KOMA@kav@xadd{typearea.\scr@pkgextension}{twoside}{%
1058 \if@twoside true\else false\fi
1059 }
1060 %</package>
1061 \KOMA@DeclareStandardOption%
1062 %<package> [typearea]%
1063 {oneside}{twoside=false}
1064 %</(class|(package&typearea))&options>
1065 % \end{macrocode}
1066 % \end{option}^^A twoside
1067 % \end{option}^^A oneside
1068 %
1069 % \begin{option}{onecolumn}
1070 % \changes{v2.95}{2002/12/04}{option moved to package \pkg*{typearea}}
1071 % \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by \cs{PackageInfoNoLine}}
1072 % \changes{v2.97e}{2007/11/23}{the classes pass the option to \pkg*{typearea}}
1073 % \changes{v3.01a}{2008/11/21}{standard option but not deprecated}
1074 % \begin{option}{twocolumn}
1075 % \changes{v2.95}{2002/12/04}{option moved to package \pkg*{typearea}}
1076 % \changes{v2.97e}{2007/11/23}{the classes pass the option to \pkg*{typearea}}
1077 % \changes{v2.98a}{2007/01/08}{passing the correct option}
1078 % \changes{v3.12}{2013/03/05}{status signaling using \cs{FamilyKeyState}}
1079 % \changes{v3.13a}{2014/04/09}{the class also uses status signaling with
1080 % \cs{FamilyKeyStateProcessed}}
1081 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
1082 % option storage commands}
1083 % \changes{v3.20}{2016/02/16}{\cs{sloppy}, \cs{raggedbottom} and
1084 % \cs{flushbottom} delayed}
1085 % \changes{v3.27}{2019/03/05}{no extra treatment for letters}
1086 % Do we have a single column or two columns layout?
1087 % \begin{macrocode}
1088 %<*(class|(package&typearea))&options>
1089 \KOMA@key{twocolumn}[true]{%
1090 %<class> \if@atdocument\else\PassOptionsToPackage{twocolumn=#1}{typearea}\fi%
1091 %<*package>
1092 \if@atdocument\clearpage\fi
1093 %</package>
1094 \KOMA@set@ifkey{twocolumn}{@twocolumn}{#1}%
1095 \ifx\FamilyKeyState\FamilyKeyStateProcessed
1096 \KOMA@kav@replacebool
1097 %<class> {\KOMAClassFileName}%
1098 %<package> {typearea.\scr@pkgextension}%
1099 {twocolumn}{@twocolumn}%
1100 %<package> \csname recalctypearea\endcsname
1101 %<*class>
1102 \if@atdocument\expandafter\@firstofone
1103 \else\IfPackageLoadedTF{typearea}{\expandafter\@firstofone}
1104 {\expandafter\AtEndOfClass}\fi
1105 {%
1106 %<!v4> \expandafter\ifnum\scr@v@is@ge{3.17}%
1107 \if@twocolumn\twocolumn\sloppy\flushbottom
1108 \else
1109 \onecolumn
1110 \if@twoside\flushbottom\else
1111 \raggedbottom
1112 \fi
1113 \fi
1114 %<!v4> \fi
1115 }%
1116 %</class>
1117 \fi
1118 }
1119 %<*class>
1120 %<*!v4>
1121 \AtEndOfClass{%
1122 \expandafter\ifnum\scr@v@is@lt{3.17}%
1123 %<*!letter>
1124 \if@twocolumn\twocolumn\sloppy\flushbottom
1125 \else\onecolumn\if@twoside\flushbottom\else\raggedbottom\fi\fi
1126 %</!letter>
1127 %<letter> \raggedbottom
1128 \fi
1129 }
1130 %</!v4>
1131 \KOMAExecuteOptions{twocolumn=false}
1132 %</class>
1133 %<*package>
1134 \KOMA@kav@xadd{typearea.\scr@pkgextension}{twocolumn}{%
1135 \if@twocolumn true\else false\fi
1136 }
1137 %</package>
1138 \KOMA@DeclareStandardOption%
1139 %<package> [typearea]%
1140 {onecolumn}{twocolumn=false}
1141 %</(class|(package&typearea))&options>
1142 % \end{macrocode}
1143 % \end{option}^^A twocolumn
1144 % \end{option}^^A onecolumn
1145 %
1146 %
1147 % \subsection{Influencing size of head and foot and margins}
1148 %
1149 % We have several options to influence the head hight and the foot height and
1150 % whether or not these are part of the typing area or the margins. We have also
1151 % an option to decide whether or not the margin notes are part of the typing
1152 % area or not.
1153 %
1154 % \begin{option}{headlines}
1155 % \changes{v2.95}{2002/12/06}{new implementation using \pkg{keyval}}
1156 % \changes{v3.12}{2013/03/05}{status signaling using \cs{FamilyKeyState}}
1157 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
1158 % option storage commands}
1159 % \begin{option}{footlines}
1160 % \changes{v3.12}{2013/03/26}{added}
1161 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
1162 % option storage commands}
1163 % These are two of the recommended options to set the height of the page head
1164 % and footer. Here we set the height by the number of base lines. The number
1165 % is a factor to \cs{baselineskip} and therefore a real number.
1166 % \begin{macrocode}
1167 %<*package&typearea&options>
1168 \KOMA@key{headlines}{%
1169 \begingroup
1170 \setlength{\@tempdima}{#1\baselineskip}%
1171 \endgroup
1172 \def\ta@hh{#1\baselineskip}%
1173 \FamilyKeyStateProcessed
1174 \KOMA@kav@replacevalue{typearea.\scr@pkgextension}{headlines}{#1}%
1175 \KOMA@kav@replacevalue{typearea.\scr@pkgextension}{headheight}{#1\baselineskip}%
1176 }
1177 \KOMA@key{footlines}{%
1178 \begingroup
1179 \setlength{\@tempdima}{#1\baselineskip}%
1180 \endgroup
1181 \def\ta@fh{#1\baselineskip}%
1182 \FamilyKeyStateProcessed
1183 \KOMA@kav@replacevalue{typearea.\scr@pkgextension}{footlines}{#1}%
1184 \KOMA@kav@replacevalue{typearea.\scr@pkgextension}{footheight}{#1\baselineskip}%
1185 }
1186 %</package&typearea&options>
1187 % \end{macrocode}
1188 % \end{option}
1189 % \end{option}
1190 %
1191 % \begin{option}{headheight}
1192 % \changes{v2.98c}{2008/04/06}{added}
1193 % \changes{v3.12}{2013/03/05}{status signaling using \cs{FamilyKeyState}}
1194 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
1195 % option storage commands}
1196 % \begin{option}{footheight}
1197 % \changes{v3.12}{2013/03/26}{added}
1198 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
1199 % option storage commands}
1200 % Instead of setting the height of the page head or footer by the number of
1201 % base lines, we can set it also using a length or length value. Note, via
1202 % \cs{documenclass} or \cs{usepackage} only length values are supported
1203 % (due to an expansion problem by the \LaTeX{} kernel with both commands).
1204 % \begin{macrocode}
1205 %<*package&typearea&options>
1206 \KOMA@key{headheight}{%
1207 \begingroup
1208 \setlength{\@tempdima}{#1}%
1209 \endgroup
1210 \def\ta@hh{#1}%
1211 \FamilyKeyStateProcessed
1212 \KOMA@kav@replacevalue{typearea.\scr@pkgextension}{headheight}{#1}%
1213 \KOMA@kav@removekey{typearea.\scr@pkgextension}{headlines}%
1214 }
1215 \KOMA@key{footheight}{%
1216 \begingroup
1217 \setlength{\@tempdima}{#1}%
1218 \endgroup
1219 \def\ta@fh{#1}%
1220 \FamilyKeyStateProcessed
1221 \KOMA@kav@replacevalue{typearea.\scr@pkgextension}{footheight}{#1}%
1222 \KOMA@kav@removekey{typearea.\scr@pkgextension}{footlines}%
1223 }
1224 %</package&typearea&options>
1225 % \end{macrocode}
1226 % \end{option}
1227 % \end{option}
1228 %
1229 % \begin{option}{headinclude}
1230 % \changes{v2.95}{2002/07/08}{new implementation using \pkg{keyval}}
1231 % This options determines whether or not the head is part of the typing
1232 % area.
1233 % \begin{option}{headexclude}
1234 % \changes{v2.95}{2002/07/08}{new implementation using \pkg{keyval}}
1235 % \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by \cs{PackageInfoNoLine}}
1236 % \changes{v3.01a}{2008/11/21}{deprecated}
1237 % \changes{v3.99}{2022/11/16}{not with \KOMAScript~4}
1238 % \begin{macro}{\if@hincl,\@hincltrue,\@hinclfalse}
1239 % \changes{v2.95}{2002/07/08}{new implementation using \pkg{keyval}}
1240 % \changes{v2.97c}{2007/04/19}{direct initialization via \cs{if@hsl},
1241 % if already defined}
1242 % We use a boolean switch to store the decision.
1243 % \begin{macrocode}
1244 %<*package&typearea&options>
1245 \newif\if@hincl\@ifundefined{if@hsl}{}{\let\if@hincl\if@hsl}
1246 \KOMA@ifkey{headinclude}{@hincl}
1247 %<!v4>\KOMA@DeclareDeprecatedOption[typearea]{headexclude}{headinclude=false}
1248 %</package&typearea&options>
1249 % \end{macrocode}
1250 % \end{macro}
1251 % \end{option}
1252 % \end{option}
1253 %
1254 % \begin{option}{headsepline}
1255 % \changes{v3.20}{2015/12/12}{\pkg*{typearea} itself reacts on \opt{headsepline}}
1256 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
1257 % option storage commands}
1258 % Until \KOMAScript{} v3.20 \pkg*{typearea} was not able to handle
1259 % sequences of options \opt{headsepline} and \opt{headinclude} to get
1260 % always a correct result. Until v3.18a \opt{headinclude} was prioritized
1261 % against \opt{headsepline} if used as global options but not if used via
1262 % \cs{KOMAoptions}. In v3.18a a bug has been fixed with the result that
1263 % \opt{headsepline} was prioritized against \opt{headinclude} if used
1264 % as global options. But intentionally
1265 % \opt{headinclude=false,}\opt{headsepline} or
1266 % \opt{headinclude=true,}\opt{headsepline=false} always should use the
1267 % setting of option \opt{headsepline} independent of setting this as
1268 % global options or using \cs{KOMAoptions}. Similar with
1269 % \opt{headsepline,}\opt{headinclude=false} or
1270 % \opt{headsepline=false,},\opt{headinclude} the setting of
1271 % \opt{headinclude} should be used. To achieve this \pkg*{typearea}
1272 % itself has to interpret not only \opt{headinclude} but also
1273 % \opt{headsepline} (as an alias of \opt{headinclude}).
1274 % \begin{macrocode}
1275 %<*package&typearea&options>
1276 \KOMA@key{headsepline}[true]{%
1277 \KOMA@set@ifkey{headinclude}{@hincl}{#1}%
1278 \ifx\FamilyKeyState\FamilyKeyStateProcessed
1279 \KOMA@kav@replacebool{typearea.\scr@pkgextension}{headinclude}{@hincl}%
1280 \fi
1281 }
1282 %</package&typearea&options>
1283 % \end{macrocode}
1284 % \end{option}^^A headsepline
1285 %
1286 % \begin{option}{footinclude}
1287 % \changes{v2.95}{2002/07/08}{new implementation using \pkg{keyval}}
1288 % \begin{option}{footexclude}
1289 % \changes{v2.95}{2002/07/08}{new implementation using \pkg{keyval}}
1290 % \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by \cs{PackageInfoNoLine}}
1291 % \changes{v3.01a}{2008/11/21}{deprecated}
1292 % \changes{v3.99}{2022/11/16}{not with \KOMAScript~4}
1293 % This options determines whether or not the page footer is part of the typing
1294 % area.
1295 % \begin{macro}{\if@fincl,\@fincltrue,\@finclfalse}
1296 % \changes{v2.95}{2002/07/08}{new implementation using \pkg{keyval}}
1297 % \changes{v2.97c}{2007/04/19}{direct initialization via \cs{if@fsl},
1298 % if already defined}
1299 % We use a boolean switch to store the decision.
1300 % \begin{macrocode}
1301 %<*package&typearea&options>
1302 \newif\if@fincl\@ifundefined{if@fsl}{}{\let\if@fincl\if@fsl}
1303 \KOMA@ifkey{footinclude}{@fincl}
1304 %<!v4>\KOMA@DeclareDeprecatedOption[typearea]{footexclude}{footinclude=false}
1305 %</package&typearea&options>
1306 % \end{macrocode}
1307 % \end{macro}
1308 % \end{option}
1309 % \end{option}
1310 %
1311 % \begin{option}{footsepline}
1312 % \changes{v3.23}{2017/03/03}{has to set \cs{if@fincl} instead of \cs{if@hincl}}
1313 % \changes{v3.20}{2015/12/12}{\pkg*{typearea} itself reacts on \opt{footsepline}}
1314 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
1315 % option storage commands}
1316 % Until \KOMAScript{} v3.20 \pkg*{typearea} was not able to handle
1317 % sequences of options \opt{footsepline} and \opt{footinclude} to get
1318 % always a correct result. Until v3.18a \opt{footinclude} was prioritized
1319 % against \opt{footsepline} if used as global options but not if used via
1320 % \cs{KOMAoptions}. In v3.18a a bug has been fixed with the result that
1321 % \opt{footsepline} was prioritized against \opt{footinclude} if used
1322 % as global options. But intentionally
1323 % \opt{footinclude=false,}\opt{footsepline} or
1324 % \opt{footinclude=true,}\opt{footsepline=false} always should use the
1325 % setting of option \opt{footsepline} independent of setting this as
1326 % global options or using \cs{KOMAoptions}. Similar with
1327 % \opt{footsepline,}\opt{footinclude=false} or
1328 % \opt{footsepline=false,},\opt{footinclude} the setting of
1329 % \opt{footinclude} should be used. To achieve this \pkg*{typearea}
1330 % itself has to interpret not only \opt{footinclude} but also
1331 % \opt{footsepline} (as an alias of \opt{footinclude}).
1332 % \begin{macrocode}
1333 %<*package&typearea&options>
1334 \KOMA@key{footsepline}[true]{%
1335 \KOMA@set@ifkey{footinclude}{@fincl}{#1}%
1336 \ifx\FamilyKeyState\FamilyKeyStateProcessed
1337 \KOMA@kav@replacebool{typearea.\scr@pkgextension}{footinclude}{@fincl}%
1338 \fi
1339 }
1340 %</package&typearea&options>
1341 % \end{macrocode}
1342 % \end{option}^^A footsepline
1343 %
1344 % \begin{option}{mpinclude}
1345 % \changes{v2.8q}{2002/03/28}{added}
1346 % \changes{v2.95}{2002/07/08}{new implementation using \pkg{keyval}}
1347 % \begin{option}{mpexclude}
1348 % \changes{v2.8q}{2002/03/28}{added}
1349 % \changes{v2.95}{2002/07/08}{new implementation using \pkg{keyval}}
1350 % \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by \cs{PackageInfoNoLine}}
1351 % \changes{v3.01a}{2008/11/21}{deprecated}
1352 % \changes{v3.99}{2022/11/16}{not with \KOMAScript~4}
1353 % Some documents have a lot of large margin notes. Optical these margin notes
1354 % are more part of the typing area than the margin. This options determines
1355 % whether or not margin notes should be part of the typing area.
1356 % \begin{macro}{\if@mincl,\@mincltrue,\@minclfalse}
1357 % \changes{v2.95}{2002/07/08}{new implementation using \pkg{keyval}}
1358 % We use a boolean switch to store the decision. Note, if the margin notes are
1359 % part of the typing area, you should increase the divisor.
1360 % \begin{macrocode}
1361 %<*package&typearea&options>
1362 \KOMA@ifkey{mpinclude}{@mincl}
1363 %<!v4>\KOMA@DeclareDeprecatedOption[typearea]{mpexclude}{mpinclude=false}
1364 %</package&typearea&options>
1365 % \end{macrocode}
1366 % \end{macro}
1367 % \end{option}
1368 % \end{option}
1369 %
1370 %
1371 % \subsection{Typing area for the emulation of the standard classes}
1372 %
1373 % For the emulation of the standard classes we need a dedicated size of the
1374 % typing area, if and only if no explicit \opt{DIV} has been given by
1375 % option. The emulation of the standard classes is a class feature. We could
1376 % do it before \pkg*{typearea} and then deactivate initial setting of
1377 % margins and typing area. But it is more easy to use \cs{areaset} after
1378 % loading \pkg*{typearea}. The standard letter class cannot be emulated.
1379 % \begin{macrocode}
1380 %<*class&body&!letter>
1381 \if@scr@emulatestandardclasses
1382 \Ifstr{\@lastdiv}{areaset}{}{%
1383 \ifnum\@lastdiv=\z@
1384 \setlength{\textwidth}{\dimexpr \paperwidth-2in\relax}
1385 \ifdim \f@size\p@<10.5\p@
1386 \setlength{\@tempdimb}{345\p@}
1387 \else\ifdim \f@size\p@<11.5\p@
1388 \setlength{\@tempdimb}{360\p@}
1389 \else
1390 \setlength{\@tempdimb}{390\p@}
1391 \fi
1392 \fi
1393 \if@twocolumn
1394 \ifdim\@textwidth>2\@tempdimb\relax
1395 \setlength{\textwidth}{2\@tempdimb}
1396 \fi
1397 \else
1398 \ifdim\textwidth>\@tempdimb
1399 \setlength{\textwidth}{\@tempdimb}
1400 \fi
1401 \fi
1402 \@settopoint\textwidth
1403 \setlength{\@tempdima}{\dimexpr \paperheight-3.5in\relax}
1404 \divide\@tempdima\baselineskip
1405 \@tempcnta=\@tempdima
1406 \setlength{\textheight}{\@tempcnta\baselineskip}
1407 \addtolength{\textheight}{\topskip}
1408 \edef\reserved@a{%
1409 \noexpand\@areasetadvancedtrue
1410 \noexpand\areaset[current]{\noexpand\textwidth}{\noexpand\textheight}%
1411 \if@areasetadvanced\else\noexpand\@areasetadvancedfalse\fi
1412 }\reserved@a
1413 \fi
1414 }%
1415 \fi
1416 %</class&body&!letter>
1417 % \end{macrocode}
1418 %
1419 % \subsection{Using a predefined divisor depending on the font size}
1420 %
1421 % Some years ago \pkg*{typearea} provides the feature to use a hard coded
1422 % or user defined divisor depending on the document font size. The feature to
1423 % define such predefined divisors is deprecated, because it can be used only
1424 % for integer font sizes in pt. Nevertheless, for compatibility reasons it is
1425 % still implemented.
1426 %
1427 % \begin{macro}{\ta@divlist}
1428 % \changes{v2.0e}{1994/10/28}{added}
1429 % \changes{v2.6}{2000/01/04}{the list provides values from font size 1\,pt}
1430 % \begin{macro}{\ta@divlistelse}
1431 % \changes{v2.6}{2000/01/04}{added}
1432 % We need a default settings for 10\,pt, 11\,pt and 12\,pt. But we define it
1433 % only if they has not been defined before. So classes could define other
1434 % defaults before loading \pkg*{typearea}.
1435 % \begin{macrocode}
1436 %<*package&typearea&init>
1437 \providecommand\ta@divlist{{}{}{}{}{}{}{}{}{}{8}{10}{12}}
1438 % \end{macrocode}
1439 % \end{macro}
1440 % If a font size does not have a predefined divisor, the following default
1441 % will be used:
1442 % \begin{macrocode}
1443 \providecommand\ta@divlistelse{1}
1444 %</package&typearea&init>
1445 % \end{macrocode}
1446 % \end{macro}
1447 %
1448 % \begin{macro}{\ta@divfor}
1449 % We also need a macro to get one of the values stored at \cs{ta@divlist}
1450 % depending on the font size given by the real number argument. The real
1451 % number will be rounded to the nearest integer.
1452 % \changes{v2.4g}{1996/11/04}{usage of the default value list}
1453 % \changes{v2.6}{2000/01/04}{usage of the extended list}
1454 % \changes{v2.8q}{2002/03/28}{respect option \opt{mpinclude}}
1455 % \changes{v2.96}{2006/08/11}{font size does not need to be an integer}
1456 % \changes{v3.25}{2018/03/05}{paper size test added}
1457 % \begin{macrocode}
1458 %<*package&typearea&body>
1459 \newcommand*{\ta@divfor}[1]{%
1460 \ta@div=\z@
1461 %<!v4> \expandafter\ifnum\scr@ta@v@is@ge{3.25}\relax
1462 \ifnum \z@=\ifdim \paperwidth<207mm \z@\else\ifdim \paperwidth>213mm \z@
1463 \else\ifdim \paperheight<294mm \z@\else
1464 \ifdim \paperheight>300mm \z@\else \@ne\fi\fi\fi\fi
1465 \PackageInfoNoLine{typearea}{%
1466 With paper sizes other than (almost) `A4' predefined\MessageBreak
1467 DIV values do not exist. Using DIV calculation for good\MessageBreak
1468 line width (unless using `version=3.24` or prior)%
1469 }%
1470 \ta@div=\tw@
1471 \fi
1472 %<!v4> \fi
1473 \if@mincl
1474 \PackageInfo{typearea}{%
1475 With option `mpinclude' there are no predefined\MessageBreak
1476 DIV values. Using DIV calculation for good line\MessageBreak
1477 width%
1478 }%
1479 \ta@div=\tw@
1480 \fi
1481 \ifnum \ta@div=\z@
1482 \xdef\@tempa{\ta@divlist{}}%
1483 \@tempdima=#1pt
1484 \addtolength{\@tempdima}{.5\p@}%
1485 \divide\@tempdima by\p@
1486 \setlength{\@tempdimb}{\@tempdima}%
1487 \multiply\@tempdimb by\p@
1488 \ifdim \@tempdimb=#1pt
1489 \ta@div=#1\relax
1490 \@whilenum \ta@div >-9 \do {%
1491 \ifx\@tempa\empty
1492 \else \xdef\@tempa{\expandafter\@cdr\@tempa\@nil}\fi
1493 \advance\ta@div by-1
1494 }%
1495 \else
1496 \let\@tempa\empty
1497 \fi
1498 \ifx\@tempa\empty
1499 % \end{macrocode}
1500 % If there is not default in the list we use the general default.
1501 % \begin{macrocode}
1502 \setlength{\@tempdima}{#1\p@}%
1503 \addtolength{\@tempdima}{10\p@}%
1504 \PackageWarningNoLine{typearea}{%
1505 DIV for \the\@tempdima\space and used papersize\MessageBreak
1506 not defined!\MessageBreak
1507 Using DIV=\ifnum\number\ta@divlistelse>\m@ne
1508 \ifcase \ta@divlistelse default%
1509 \or calc%
1510 \or calc%
1511 \or classic%
1512 \else\ta@divlistelse\fi\else\ta@divlistelse\fi
1513 }%
1514 \ta@div=\ta@divlistelse\relax
1515 \else
1516 % \end{macrocode}
1517 % Otherwise we use the default of the list.
1518 % \begin{macrocode}
1519 \xdef\@tempa{\expandafter\@car\@tempa\@nil}%
1520 \ifx\@tempa\empty
1521 \ta@div=\ta@divlistelse\relax
1522 \else
1523 \ta@div=\@tempa\relax
1524 \fi
1525 \fi
1526 \fi
1527 }
1528 %</package&typearea&body>
1529 % \end{macrocode}
1530 % \end{macro}
1531 %
1532 %
1533 % \begin{command}{\SetDIVList}
1534 % \changes{v2.1a}{1994/10/28}{added}
1535 % \changes{v2.6}{2000/01/04}{\cs{ta@divlist} holds values for font sizes from 1\,pt}
1536 % \changes{v3.24}{2017/07/23}{deprecated}
1537 % The command is deprecated. Don't use it any longer.
1538 % \begin{macrocode}
1539 %<*package&typearea&body>
1540 \newcommand*\SetDIVList[1]{%
1541 \PackageWarning{typearea}{\string\SetDIVList\space is
1542 deprecated!\MessageBreak
1543 This command supports only integer font sizes\MessageBreak
1544 in pt equal or greater than 10pt.\MessageBreak
1545 Since version 2.6 the command is implemented\MessageBreak
1546 for compatibility only. You should not use it\MessageBreak
1547 any longer}%
1548 \def\ta@divlist{{}{}{}{}{}{}{}{}{}#1}}
1549 % \end{macrocode}
1550 % \end{command}^^A \SetDIVList
1551 %
1552 % \begin{command}{\SetXDIVList}
1553 % \changes{v2.6}{2000/01/04}{neu}
1554 % \changes{v3.24}{2017/07/23}{deprecated}
1555 % The command is deprecated. Don't use it any longer.
1556 % \begin{macrocode}
1557 \newcommand*\SetXDIVList[1]{%
1558 \PackageWarning{typearea}{\string\SetXDIVList\space is
1559 deprecated!\MessageBreak
1560 This command supports only integer font sizes\MessageBreak
1561 in pt equal or greater than 10pt.\MessageBreak
1562 Since version 3.0 the command is implemented\MessageBreak
1563 for compatibility only. You should not use it\MessageBreak
1564 any longer}%
1565 \def\ta@divlist{#1}}
1566 %</package&typearea&body>
1567 % \end{macrocode}
1568 % \end{command}^^A \SetXDIVList
1569 %
1570 %
1571 % \subsection{Calculation of typing area and margins}
1572 %
1573 % The main purpose of the package is the calculation of the size of the
1574 % typeing area and the margins depending on a divisor. As an addition a
1575 % binding correction is included.
1576 %
1577 % The parameters and the calculation is needed before the options can be
1578 % processed.
1579 %
1580 % \begin{ilength}{\ta@bcor}
1581 % \changes{v2.2a}{1995/01/25}{definition of the dimension before option
1582 % \opt{BCOR}}
1583 % \changes{v2.7g}{2001/04/17}{definition using \cs{newlength} instead of
1584 % \cs{newdimen}}
1585 % We need a length to store the binding correction. It is initializes to 0\,pt
1586 % implicitly by \cs{newlength}.
1587 % \begin{macrocode}
1588 %<*package&typearea&options>
1589 \newlength{\ta@bcor}
1590 % \end{macrocode}
1591 % \end{ilength}
1592 %
1593 % \begin{macro}{\ta@div}
1594 % \changes{v2.2a}{1995/01/25}{definition of the dimension before option
1595 % \opt{BCOR}}
1596 % We need a counter for the divisor (aka \emph{DIV}). It is initializes to
1597 % 0\,pt implicitly by \cs{newcount}. So it is not a \LaTeX{} counter but a
1598 % \TeX{} counter.
1599 % \begin{macrocode}
1600 \newcount\ta@div
1601 %</package&typearea&options>
1602 % \end{macrocode}
1603 % \end{macro}
1604 %
1605 % \begin{ilength}{\ta@hblk,\ta@vblk}
1606 % Width of one horizontal resp. height of one vertical block.
1607 % \begin{macrocode}
1608 %<*package&typearea&body>
1609 \newlength{\ta@hblk}
1610 \newlength{\ta@vblk}
1611 %</package&typearea&body>
1612 % \end{macrocode}
1613 % \end{ilength}
1614 %
1615 % \begin{ilength}{\ta@temp}
1616 % Used several times instead of \cs{@tempdima}, \cs{@tempdimb} or another
1617 % temporary dimension or glue of the LaTeX{} kernel. Nevertheless I should
1618 % think about not using this temporary length any longer.
1619 % \begin{macrocode}
1620 %<*package&typearea&body>
1621 \newlength{\ta@temp}
1622 %</package&typearea&body>
1623 % \end{macrocode}
1624 % \end{ilength}
1625 %
1626 % \begin{option}{BCOR}
1627 % \changes{v2.2a}{1995/01/25}{added}
1628 % \changes{v2.95}{2002/12/04}{new implementation using \pkg{keyval}}
1629 % \changes{v3.12}{2013/03/05}{status signaling using \cs{FamilyKeyState}}
1630 % \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
1631 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
1632 % option storage commands}
1633 % The value is written into the length \cs{ta@bcor}. Several symbolic values
1634 % are supported that have to be converted into a length. Note, while loading
1635 % the package symbolic values are nonsense.
1636 % \begin{macrocode}
1637 %<*package&typearea&options>
1638 \KOMA@key{BCOR}{%
1639 \Ifstr{#1}{current}{}{%
1640 \setlength{\ta@bcor}{#1}%
1641 }%
1642 \FamilyKeyStateProcessed
1643 \KOMA@kav@xreplacevalue{typearea.\scr@pkgextension}{BCOR}{#1}%
1644 }
1645 % \end{macrocode}
1646 % After loading the package we have to do a little bit more, because we need
1647 % to recalculate the areas.
1648 % \changes{v3.13}{2014/06/30}{\cs{FamilyKeyStateProcessed} added}
1649 % \changes{v3.24}{2017/07/23}{\cs{KOMA@kav@xreplacevalue} added}
1650 % \begin{macrocode}
1651 \AtEndOfPackage{%
1652 \KOMA@key{BCOR}{%
1653 \typearea[{#1}]{last}
1654 \FamilyKeyStateProcessed
1655 \KOMA@kav@xreplacevalue{typearea.\scr@pkgextension}{BCOR}{#1}%
1656 }%
1657 }
1658 %</package&typearea&options>
1659 % \end{macrocode}
1660 % \end{option}
1661 %
1662 % \begin{option}{DIV}
1663 % \changes{v2.2a}{1995/01/25}{new option}
1664 % \changes{v2.95}{2002/12/04}{new implementation using \pkg{keyval}}
1665 % \changes{v3.12}{2013/03/05}{status signaling using \cs{FamilyKeyState}}
1666 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
1667 % option storage commands}
1668 % The value is written into the counter \cs{ta@div}. Several symbolic values
1669 % are supported and have to be converted into a counter. Note, while loading
1670 % the package symbolic values are nonsense.
1671 % \begin{macro}{\@lastdiv}
1672 % \changes{v3.30}{2020/03/24}{init the internal macro}
1673 % This internal macro stores the last value to option \opt{DIV}. It is
1674 % initialized with \cs{relax}.
1675 % \begin{macrocode}
1676 %<package&typearea&init>\newcommand*{\@lastdiv}{\z@}\let\@lastdiv\relax
1677 % \end{macrocode}
1678 % \end{macro}^^A \@lastdiv
1679 % \begin{macrocode}
1680 %<*package&typearea&options>
1681 \def\movet@reserved@a@to@nnil#1\@nnil{\def\reserved@a{#1}}%
1682 \KOMA@key{DIV}[calc]{%
1683 \edef\@tempa{#1}%
1684 \def\@tempb{last}\ifx\@tempa\@tempb\let\@tempa=\@lastdiv
1685 \ifx\@tempa\relax\def\@tempa{current}\fi
1686 \fi
1687 \def\@tempb{current}\ifx\@tempa\@tempb\else
1688 \def\@tempb{default}\ifx\@tempa\@tempb\ta@div=\z@ \else
1689 \def\@tempb{calc}\ifx\@tempa\@tempb\ta@div=\tw@ \else
1690 \def\@tempb{classic}\ifx\@tempa\@tempb\ta@div=\thr@@ \else
1691 \expandafter\def\expandafter\@tempa\expandafter{\expandafter0\@tempa}%
1692 \afterassignment\movet@reserved@a@to@nnil
1693 \@tempcnta=\@tempa\relax\@nnil
1694 \def\@tempb{\relax}\ifx\reserved@a\@tempb
1695 \ta@div=\@tempcnta
1696 \edef\@tempa{\the\ta@div}%
1697 \else
1698 \let\@tempa\relax
1699 \fi
1700 \fi
1701 \fi
1702 \fi
1703 \fi
1704 \ifx\@tempa\relax
1705 \FamilyKeyStateUnknownValue
1706 \else
1707 \FamilyKeyStateProcessed
1708 \KOMA@kav@xreplacevalue{typearea.\scr@pkgextension}{DIV}{\@tempa}%
1709 \fi
1710 }
1711 % \end{macrocode}
1712 % After loading the package we have to do a little bit more, because we need
1713 % to recalculate the areas.
1714 % \changes{v3.13}{2014/06/30}{\cs{FamilyKeyStateProcessed} added}
1715 % \changes{v3.24}{2017/07/23}{\cs{KOMA@kav@xreplacevalue} added}
1716 % \begin{macrocode}
1717 \AtEndOfPackage{%
1718 \KOMA@key{DIV}{%
1719 \typearea[current]{#1}%
1720 \FamilyKeyStateProcessed
1721 \KOMA@kav@xreplacevalue{typearea.\scr@pkgextension}{DIV}{#1}%
1722 }%
1723 }
1724 %</package&typearea&options>
1725 % \end{macrocode}
1726 % \end{option}
1727 %
1728 % \begin{option}{typeareawarninfolimit,typeareawarnlimit,typeareainfolimit}
1729 % \changes{v3.39}{2023/02/10}{added}
1730 % \begin{macro}{\ta@warnlimit,\ta@infolimit}
1731 % \changes{v3.39}{2023/02/10}{added}
1732 % This option can be used to set the warning limits for inappropriate
1733 % typesetting settings. There are two limits, one for too small text area and
1734 % one for too large text area. They values are integer percentages. By default
1735 % both of them are 15. Negative values deactivate the warning messages.
1736 % \begin{macrocode}
1737 %<*package&typearea&options>
1738 \newcommand*{\ta@warnlimit}{\numexpr 15\relax}
1739 \newcommand*{\ta@infolimit}{\numexpr 15\relax}
1740 \KOMA@key{typeareawarnlimit}{%
1741 \FamilySetCounterMacro{KOMA}{typeareawarnlimit}{\ta@warnlimit}{#1}%
1742 \ifx\FamilyKeyState\FamilyKeyStateProcessed
1743 \KOMA@kav@removekey{typearea.\scr@pkgextension}{typeareawarninfolimit}%
1744 \KOMA@kav@replacevalue{typearea.\scr@pkgextension}{typeareawarnlimit}{#1}%
1745 \fi
1746 }
1747 \KOMA@key{typeareainfolimit}{%
1748 \FamilySetCounterMacro{KOMA}{typeareainfolimit}{\ta@infolimit}{#1}%
1749 \ifx\FamilyKeyState\FamilyKeyStateProcessed
1750 \KOMA@kav@removekey{typearea.\scr@pkgextension}{typeareawarninfolimit}%
1751 \KOMA@kav@replacevalue{typearea.\scr@pkgextension}{typeareainfolimit}{#1}%
1752 \fi
1753 }
1754 \KOMA@key{typeareawarninfolimit}{%
1755 \FamilySetCounterMacro{KOMA}{typeareawarninfolimit}{\ta@warnlimit}{#1}%
1756 \ifx\FamilyKeyState\FamilyKeyStateProcessed
1757 \let\ta@infolimit\ta@warnlimit
1758 \KOMA@kav@replacevalue{typearea.\scr@pkgextension}{typeareawarninfolimit}{#1}%
1759 \KOMA@kav@replacevalue{typearea.\scr@pkgextension}{typeareawarnlimit}{#1}%
1760 \KOMA@kav@replacevalue{typearea.\scr@pkgextension}{typeareainfolimit}{#1}%
1761 \fi
1762 }
1763 %</package&typearea&options>
1764 % \end{macrocode}
1765 % \end{macro}
1766 % \end{option}
1767 %
1768 % \begin{command}{\typearea}
1769 % This is the real reason for the package: calculation of typing area and
1770 % margins providing an optional binding correction and depending on a
1771 % divisor.
1772 % \begin{macro}{\@typearea}
1773 % \changes{v2.4n}{1997/05/28}{moved main calculation into \cs{@typearea}}
1774 % \changes{v2.95}{2002/08/20}{\cs{selectfont} added}
1775 % The calculation itself is done in \cs{@typearea}. This command does not need
1776 % any parameters because it uses \cs{ta@div} and \cs{ta@bcor}.
1777 % \begin{macrocode}
1778 %<*package&typearea&body>
1779 \newcommand*\@typearea{%
1780 % \end{macrocode}
1781 % First of all we have to take care to select the correct font. Because
1782 % otherwise we cannot depend on, e.g., \cs{baselineskip}.
1783 % \begin{macrocode}
1784 \selectfont
1785 % \end{macrocode}
1786 % First calculation is about the horizontal block element size:
1787 % \begin{macrocode}
1788 \ta@hblk=\paperwidth
1789 \advance \ta@hblk by-\ta@bcor
1790 \divide\ta@hblk by\ta@div
1791 % \end{macrocode}
1792 % The with of the margin note column depends in the horizontal block size,
1793 % whether or not is should be part of the typing area and whether of not we
1794 % have a double sided document.
1795 % \changes{v2.8q}{2002/03/28}{\cs{marginparwidth} depends on
1796 % \opt{mpinclude}}
1797 % \begin{macrocode}
1798 \if@mincl
1799 \marginparwidth=\ta@hblk
1800 \advance\marginparwidth by-\marginparsep
1801 \else
1802 \if@twoside
1803 \if@semitwoside
1804 \marginparwidth=\ta@hblk
1805 \else
1806 \marginparwidth=1.5\ta@hblk
1807 \fi
1808 \else
1809 \marginparwidth=\ta@hblk
1810 \fi
1811 \fi
1812 % \end{macrocode}
1813 % The left and right margin resp. the left margin of odd and even pages
1814 % depends also on the horizontal block width. The relation depends on whether
1815 % or not the document is double sided.
1816 % \begin{macrocode}
1817 \oddsidemargin=-1in
1818 \evensidemargin=-1in
1819 \if@twoside
1820 \if@semitwoside
1821 \advance\oddsidemargin by1.5\ta@hblk
1822 \advance\oddsidemargin by\ta@bcor
1823 % \end{macrocode}
1824 % \changes{v3.12}{2013/10/15}{use alternating \opt{BCOR} with
1825 % \opt{twoside\quotechar=semi}}
1826 % From v3.12 the binding correction is part of the inner margin also for
1827 % \opt{twoside=semi}. If compatibility to earlier release is selected the
1828 % binding correction with \opt{twoside=semi} is always added to the left
1829 % margin.
1830 % \begin{macrocode}
1831 %<!v4> \expandafter\ifnum\scr@ta@v@is@lt{3.12}\relax
1832 %<!v4> \evensidemargin=\oddsidemargin
1833 %<!v4> \else
1834 \advance\evensidemargin by1.5\ta@hblk
1835 %<!v4> \fi
1836 \else
1837 \advance\oddsidemargin by\ta@hblk
1838 \advance\oddsidemargin by\ta@bcor
1839 \advance\evensidemargin by2\ta@hblk
1840 \if@mincl
1841 \advance\evensidemargin by\marginparwidth
1842 \advance\evensidemargin by\marginparsep
1843 \fi
1844 \fi
1845 \else
1846 \advance\oddsidemargin by1.5\ta@hblk
1847 \advance\oddsidemargin by\ta@bcor
1848 \evensidemargin=\oddsidemargin
1849 \fi
1850 % \end{macrocode}
1851 % The width of the typing area is the paper width without the three blocks
1852 % used for the margins and without the binding correction.
1853 % \begin{macrocode}
1854 \textwidth=\paperwidth
1855 \advance\textwidth by-\ta@bcor
1856 \advance\textwidth by-3\ta@hblk
1857 % \end{macrocode}
1858 % But, if the margin note column should be part of the typing area, it's width
1859 % has to be subtracted from the width of the typing area. We assume to place
1860 % the margin notes at the outer margin. But if the typing area is to narrow
1861 % for the margin note column, the width of margin note column will be
1862 % reduced. This can be done easily be swapping the two lengths.
1863 % \changes{v3.30}{2020/02/25}{orphan line break at end of warning message
1864 % removed}
1865 % \begin{macrocode}
1866 \if@mincl
1867 \advance\textwidth by-\marginparwidth
1868 \advance\textwidth by-\marginparsep
1869 \ifdim\textwidth <\marginparwidth
1870 \PackageWarningNoLine{typearea}{%
1871 Width of text (\the\textwidth) less than width of\MessageBreak
1872 marginpar (\the\marginparwidth) while using option\MessageBreak
1873 `mpinclude'.\MessageBreak
1874 Because of this, I'm exchanging the values.\MessageBreak
1875 You should increase DIV to avoid such problems%
1876 }%
1877 \@tempskipa=\marginparwidth
1878 \marginparwidth=\textwidth
1879 \textwidth=\@tempskipa
1880 \fi
1881 \fi
1882 % \end{macrocode}
1883 % Next the vertical size of a block.
1884 % \begin{macrocode}
1885 \ta@vblk=\paperheight
1886 \divide\ta@vblk by\ta@div
1887 % \end{macrocode}
1888 % The top margin depends on this vertical block size. But note, \TeX{} will
1889 % increase it by 1\,in.
1890 % \begin{macrocode}
1891 \topmargin=-1in
1892 \advance\topmargin by\ta@vblk
1893 % \end{macrocode}
1894 % And if head is not part of the typing area, the top margin has to be reduced
1895 % by the head size.
1896 % \begin{macrocode}
1897 \if@hincl \else
1898 \advance\topmargin by-\headheight
1899 \advance\topmargin by-\headsep
1900 \fi
1901 % \end{macrocode}
1902 % For the height of the typing area we use the paper size without the height
1903 % of head and footer. The head and footer may be part of the typing area or
1904 % not. If they are part of the typing area they reduce the height of it.
1905 % \begin{macrocode}
1906 \ta@temp=\paperheight
1907 \advance\ta@temp by-3\ta@vblk
1908 \if@hincl
1909 \advance\ta@temp by-\headheight
1910 \advance\ta@temp by-\headsep
1911 \fi
1912 \if@fincl
1913 \advance\ta@temp by-\footskip
1914 \fi
1915 % \end{macrocode}
1916 % Last but not least we have take care that the typing area consists of an
1917 % integer number of text lines.
1918 % \changes{v2.96}{2006/09/12}{setting \cs{topskip}}
1919 % \changes{v2.97c}{2007/07/04}{setting \cs{maxdepth}}
1920 % \begin{macrocode}
1921 \scr@ifundefinedorrelax{@ptsize}{%
1922 \topskip=\f@size\p@
1923 }{%
1924 \topskip=\@ptsize\p@
1925 \advance\topskip by 10\p@
1926 }%
1927 \maxdepth=.5\topskip
1928 \textheight=\topskip
1929 \@whiledim\textheight <\ta@temp
1930 \do{\advance\textheight by\baselineskip}%
1931 }
1932 % \end{macrocode}
1933 % \end{macro}^^A \@typearea
1934 %
1935 % \begin{macro}{\ta@modiv}
1936 % Needed by \cs{typearea}. The first parameter will be divided by the second
1937 % one. \cs{ta@div} is set to the rounded result. Internally \cs{@tempdima} and
1938 % \cs{@tempdimb} are used.
1939 % \begin{macrocode}
1940 \newcommand*\ta@modiv[2]{
1941 \setlength{\@tempdima}{#1}
1942 \divide\@tempdima by#2
1943 \ta@div\@tempdima
1944 \ifnum \ta@div<4
1945 \ta@div=4
1946 \else
1947 \setlength{\@tempdimb}{#1}%
1948 \divide\@tempdimb by\ta@div
1949 \addtolength{\@tempdima}{\@tempdima}%
1950 \addtolength{\@tempdima}{-\@tempdimb}%
1951 \advance\ta@div by\@ne
1952 \setlength{\@tempdimb}{#1}%
1953 \divide\@tempdimb by\ta@div
1954 % \end{macrocode}
1955 % \changes{v2.5a}{1997/06/22}{\cs{ifdim} instead of \cs{ifnum}}
1956 % \begin{macrocode}
1957 \ifdim \@tempdima<\@tempdimb
1958 \advance\ta@div by\m@ne
1959 \fi
1960 \fi
1961 }
1962 % \end{macrocode}
1963 % \end{macro}^^A \ta@modiv
1964 %
1965 % \begin{macro}{\ta@temp@goodwidth}
1966 % Sets \cs{ta@temp} to the heuristic optimal line width depending on the
1967 % current font. An optimal line width has 66 up to 72 characters. Here we use
1968 % a value of 69 characters. We assume that such a line consists of 66 lower
1969 % case letters (minors) and three upper case letters (majors). Normally the
1970 % weight of a letter depends on the language but we use same weight for each
1971 % letter.
1972 % \changes{v2.7i}{2001/05/17}{avoid overflows if a very large font is used}
1973 % \changes{v2.8q}{2002/03/06}{\cs{normalfont} \cs{normalsize} added}
1974 % \changes{v2.95a}{2006/07/20}{fix of large font calculation}
1975 % \begin{macrocode}
1976 \newcommand*\ta@temp@goodwidth{%
1977 \settowidth{\ta@temp}{\normalfont\normalsize
1978 abcdefghijklmnopqrstuvwxyz}%
1979 \ifdim\ta@temp >200\p@
1980 \setlength{\ta@temp}{2.53846\ta@temp}%
1981 \settowidth{\@tempdima}{\normalfont\normalsize
1982 ABCDEFGHIJKLMNOPQRSTUVWXYZ}%
1983 \setlength{\@tempdima}{.11538\@tempdima}%
1984 \addtolength{\ta@temp}{\@tempdima}%
1985 \else
1986 \multiply\ta@temp by66
1987 \settowidth{\@tempdima}{\normalfont\normalsize
1988 ABCDEFGHIJKLMNOPQRSTUVWXYZ}%
1989 \multiply\@tempdima by3
1990 \addtolength{\ta@temp}{\@tempdima}%
1991 \divide\ta@temp by26
1992 \fi
1993 }
1994 % \end{macrocode}
1995 % \end{macro}^^A \ta@temp@goodwidth
1996 %
1997 % \begin{command}{\AfterCalculatingTypearea}
1998 % \changes{v2.96a}{2006/11/29}{added}
1999 % \changes{v3.20}{2016/04/12}{\cs{@ifstar} replaced by
2000 % \cs{kernel@ifstar}}
2001 % Users can influence the behaviour of \cs{typearea} by a hook. The star
2002 % variation adds the code locally the non-star variation globally.
2003 % \begin{macrocode}
2004 \newcommand*{\AfterCalculatingTypearea}{%
2005 \kernel@ifstar \l@addto@macro \g@addto@macro \@typearea@end
2006 }
2007 % \end{macrocode}
2008 % \begin{macro}{\@typearea@end}
2009 % \changes{v2.96a}{2006/11/29}{defined again but completely different}
2010 % Macro \cs{@typearea@end} is a hook that is executed at the end of
2011 % \cs{typearea} but before the activation of the new settings. So you can
2012 % change the result of \cs{typearea}.
2013 % \begin{macrocode}
2014 \newcommand*{\@typearea@end}{}
2015 % \end{macrocode}
2016 % \end{macro}^^A \@typearea@end
2017 % \end{command}^^A \AfterCalculatingTypearea
2018 %
2019 % \begin{command}{\activateareas}
2020 % \changes{v2.96a}{2006/11/29}{new name for old macro}
2021 % \changes{v3.17}{2015/02/07}{respect option \opt{usegeometry}}
2022 % This macro is used to activate the new typing area and margin settings
2023 % inside the document body. It is a hack, because is uses internal \LaTeX{}
2024 % kernel code.
2025 % \begin{macrocode}
2026 \newcommand*{\activateareas}{%
2027 % \end{macrocode}
2028 % First of all test, whether or not we are inside the document body. If not do
2029 % nothing.
2030 % \begin{macrocode}
2031 \if@atdocument
2032 % \end{macrocode}
2033 % \changes{v3.23}{2017/04/03}{info instead of warning if used inside the
2034 % document body}
2035 % But if, we show an info, because it is a hack. It depends in the \LaTeX{}
2036 % release. Nevertheless, it seems to be stable from the very first \LaTeXe{}
2037 % release. So we use an info only. Before v3.23 we have used a warning.
2038 % \begin{macrocode}
2039 \PackageInfo{typearea}{%
2040 Using dirty hack to recalculate internal output\MessageBreak
2041 dimensions of LaTeX%
2042 }%
2043 % \end{macrocode}
2044 % Now, set several internal and none internal \LaTeX{}lengths to the new
2045 % dimensions.
2046 % \begin{macrocode}
2047 \@colht=\textheight
2048 \@colroom=\textheight
2049 \vsize=\textheight
2050 \columnwidth=\textwidth
2051 \if@twocolumn
2052 \advance\columnwidth by-\columnsep
2053 \divide\columnwidth by\tw@
2054 \hsize=\columnwidth
2055 \@firstcolumntrue
2056 \fi
2057 \hsize=\columnwidth
2058 \linewidth\hsize
2059 \scr@ifundefinedorrelax{@pagesizelast}{}{%
2060 \KOMAoptions{pagesize=\@pagesizelast}%
2061 }%
2062 % \end{macrocode}
2063 % \changes{v3.17}{2015/03/18}{adapt the \opt{parskip} settings}
2064 % From v3.17 changes of the typing area can immediately change some of the
2065 % \opt{parskip} settings. Before |\begin{document}| the change will be done
2066 % automatically at |\begin{document}| and therefore adding it here is correct.
2067 % \begin{macrocode}
2068 %<!v4> \expandafter\ifnum\scr@ta@v@is@ge{3.17}%
2069 \csname par@updaterelative\endcsname
2070 %<!v4> \fi
2071 \fi
2072 % \end{macrocode}
2073 % \changes{v3.17}{2015/02/07}{new code for option \opt{usegeometry}}
2074 % If option \opt{usegeometry} is active we need to setup several options of
2075 % package \pkg{geometry}. We use \cs{scr@geometryargs} to store them. And
2076 % we either have to pass these options to \pkg{geometry} or define a new
2077 % geometry. In the second case we also need some hacks to make the new paper
2078 % size available for \pkg{geometry}.
2079 % \begin{macrocode}
2080 \edef\scr@geometryargs{%
2081 bindingoffset=\the\ta@bcor,
2082 lmargin=\the\dimexpr 1in+\oddsidemargin-\ta@bcor\relax,
2083 textwidth=\the\textwidth,
2084 \if@hincl
2085 includehead,%
2086 top=\the\dimexpr 1in+\topmargin\relax,
2087 \else
2088 includehead=false,%
2089 top=\the\dimexpr 1in+\topmargin+\headheight+\headsep\relax,
2090 \fi
2091 headheight=\the\headheight,
2092 headsep=\the\headsep,
2093 textheight=\the\textheight,
2094 \if@fincl
2095 includefoot,
2096 \else
2097 includefoot=false,
2098 \fi
2099 footskip=\the\footskip,
2100 \if@mincl
2101 includemp,
2102 \else
2103 includemp=false,
2104 \fi
2105 marginparwidth=\the\marginparwidth,
2106 marginparsep=\the\marginparsep
2107 }%
2108 \if@ta@usegeometry
2109 \@ifundefined{Gm@save}{%
2110 \if@atdocument\else
2111 \edef\scr@geometryargs{%
2112 paperwidth=\the\paperwidth,paperheight=\the\paperheight,%
2113 \scr@geometryargs
2114 }%
2115 \PassOptionsToPackage{\scr@geometryargs}{geometry}%
2116 \fi
2117 }{%
2118 \edef\Gm@restore@org{\Gm@restore}%
2119 \if@atdocument
2120 \expandafter\newgeometry\expandafter{\scr@geometryargs}%
2121 \else
2122 \edef\scr@geometryargs{%
2123 paperwidth=\the\paperwidth,paperheight=\the\paperheight,%
2124 \scr@geometryargs
2125 }%
2126 \expandafter\geometry\expandafter{\scr@geometryargs}%
2127 \fi
2128 }%
2129 \fi
2130 }
2131 % \end{macrocode}
2132 % \begin{macro}{\scr@geometryargs}
2133 % \changes{v3.16}{2015/02/07}{neu (intern)}
2134 % The initialization of the \pkg{geometry} options is empty. It will be
2135 % filled automatically by \cs{activateareas}.
2136 % \begin{macrocode}
2137 \newcommand*{\scr@geometryargs}{}
2138 % \end{macrocode}
2139 % \end{macro}^^A \scr@geometryargs
2140 % \end{command}^^A \activateareas
2141 %
2142 % \changes{v2.4g}{1996/11/04}{waste comments removed}
2143 % \changes{v2.7g}{2001/04/17}{new symbolic values \opt{current},
2144 % \opt{default}, \opt{calc}, \opt{classic}}
2145 % \changes{v2.8q}{2001/11/06}{new symbolic value \opt{last}}
2146 % \changes{v2.96}{2006/08/21}{warn if \cs{typearea} is used inside a group}
2147 % \changes{v3.10}{2011/09/13}{using \cs{scr@grouplevel@test}}
2148 % \changes{v3.12}{2013/03/26}{page footer height configurable}
2149 % \changes{v3.30}{2020/03/24}{\opt{current} after \cs{areaset} is \opt{areaset}}
2150 %
2151 % The symbolic values of the obligatory argument of \cs{typearea}:
2152 % \begin{center}\begin{tabular}{lll}
2153 % Symbol & Value & Meaning \\\hline\\[-2ex]
2154 % \opt{calc} & 2 & calculate a good value \\
2155 % \opt{classic} & 3 & \emph{mittelalterlicher Buchseitenkanon} \\
2156 % \opt{current} & --- & use the current value \\
2157 % \opt{default} & 0 & use a value from the list \\
2158 % \opt{last} & --- & use the value from the last usage of
2159 % \cs{typearea} \\
2160 % \opt{areaset} & --- & replace the current typing area \\
2161 % \end{tabular}\end{center}
2162 %
2163 % There is only one symbolic value that can be used as the optional argument:
2164 % \opt{current}.
2165 % \begin{macrocode}
2166 \newcommand*\typearea[2][\z@]{%
2167 \scr@grouplevel@test\typearea
2168 \edef\@tempa{#1}\edef\@tempb{current}\ifx\@tempa\@tempb\else
2169 \setlength{\ta@bcor}{#1}%
2170 \fi
2171 \edef\@tempa{#2}%
2172 \def\@tempb{last}\ifx\@tempa\@tempb\let\@tempa=\@lastdiv
2173 \ifx\@tempa\relax \def\@tempa{current}\fi
2174 \fi
2175 \Ifstr{\@tempa}{current}{%
2176 \Ifstr{\@lastdiv}{areaset}{\let\@tempa\@lastdiv}{}%
2177 }{}%
2178 \def\@tempb{areaset}\ifx\@tempa\@tempb
2179 \areaset[current]{\textwidth}{\textheight}%
2180 \else
2181 \def\@tempb{current}\ifx\@tempa\@tempb
2182 \else
2183 \def\@tempb{default}\ifx\@tempa\@tempb\ta@div=\z@ \else
2184 \def\@tempb{calc}\ifx\@tempa\@tempb\ta@div=\tw@ \else
2185 \def\@tempb{classic}\ifx\@tempa\@tempb\ta@div=\thr@@ \else
2186 \ta@div=\@tempa
2187 \fi
2188 \fi
2189 \fi
2190 \fi
2191 \edef\@lastdiv{\the\ta@div}%
2192 % \end{macrocode}
2193 % Before we do the calculation we need to start a new page if we are inside
2194 % the document's body.
2195 % \changes{v3.37}{2022/06/09}{fix for \LaTeX's build in two-column mode}%
2196 % Unfortunately a simple \cs{newpage} maybe not enough, because this only
2197 % starts a new page in \LaTeX's one-column mode. In \LaTeX's two-column mode
2198 % it only starts a new column, which could be a new page or not.
2199 % \begin{description}
2200 % \item[ToDo:] Maybe a simple \cs{clearpage} would be better, but less
2201 % compatible with \KOMAScript{} before version 3.37.
2202 % \end{description}
2203 % \begin{macrocode}
2204 \if@atdocument
2205 \newpage
2206 \if@twocolumn\ifnum\@colnum=\z@\else\null\newpage\fi\fi
2207 \fi
2208 % \end{macrocode}
2209 % \changes{v2.95a}{2006/07/20}{select document font size}%
2210 % And we need to select the document font size.
2211 % \begin{macrocode}
2212 \normalsize
2213 % \end{macrocode}
2214 % Is the height of the page head already given or do we need to calculate
2215 % it. If we need to calculate it we use 1.25 of the base lines distance. This
2216 % gives enough room for optional separation lines (which are set outside if
2217 % use \pkg*{scrlayer-scrpage}).
2218 % \changes{v2.4n}{1997/05/28}{page head height depends on base line
2219 % distance}
2220 % \begin{macrocode}
2221 \@ifundefined{ta@hh}{%
2222 \headheight=1.25\baselineskip
2223 }{%
2224 \headheight=\ta@hh
2225 }%
2226 % \end{macrocode}
2227 % The distance between the head and the text is always the same. Different
2228 % typographers recommend different values. A good value would result in a grid
2229 % that would be used for all lines of the page. But the distance should not to
2230 % large. Supposedly a good value would be the height of one text line. But
2231 % with head separation rule this wouldn't be a good value. So we use a
2232 % compromise.
2233 % \begin{macrocode}
2234 \headsep=1.5\baselineskip
2235 % \end{macrocode}
2236 % The foot is a similar problem. But we have to setup also \len{footskip} not
2237 % only \len{footheight}.
2238 % \begin{macrocode}
2239 \@ifundefined{footheight}{%
2240 \newlength\footheight
2241 }{}%
2242 \@ifundefined{ta@fh}{%
2243 \footheight=1.25\baselineskip
2244 }{%
2245 \footheight=\ta@fh
2246 }%
2247 \footskip=\dimexpr\footheight+2.25\baselineskip
2248 % \end{macrocode}
2249 % Some values also independent from the divisor and the binding correction.
2250 % \begin{macrocode}
2251 \marginparsep=1cc
2252 \marginparpush=0.45\baselineskip
2253 % \end{macrocode}
2254 % \changes{v2.4g}{1996/11/04}{\opt{DIV\quotechar=0} tries to use a value from the
2255 % default list}
2256 % Before we do the calculation we test, whether the resulting divisor is
2257 % 0. Values from 0 up to 3 are not possible because we use three parts for the
2258 % margins. So we can use 0 to get a value from the default value list if
2259 % available.
2260 % \changes{v2.5h}{1999/12/29}{warning message changed}
2261 % \begin{macrocode}
2262 \ifnum\ta@div=\z@
2263 \@ifundefined{@ptsize}{%
2264 \@tempdima=\f@size\p@
2265 \advance\@tempdima by.5pt
2266 \ta@div=\@tempdima
2267 \divide\ta@div by65536
2268 \advance\ta@div by-10
2269 \xdef\@ptsize{\the\ta@div}%
2270 \PackageWarningNoLine{typearea}{%
2271 \string\@ptsize\space not defined!\MessageBreak
2272 Fontsize is \f@size pt.\MessageBreak
2273 Defining \string\@ptsize\space to \@ptsize%
2274 }%
2275 }{}%
2276 \ta@divfor{\@ptsize}%
2277 \fi
2278 % \end{macrocode}
2279 % \changes{v2.4n}{1997/05/28}{optional \emph{klassischer Buchseitenkanon}}
2280 % Another special case is if the divisor is 3. In this case we calculate a
2281 % divisor near to the \emph{klassischer Buchseitenkanon}. This means we try to
2282 % have the height of the typing area is as near as possible the width of the
2283 % paper. For classic paper size this should be a harmonious result.
2284 % \changes{v3.42}{2024/02/01}{\cs{typeout} replaced by either
2285 % \cs{PackageNote} or \cs{PackageInfo}}
2286 % \begin{macrocode}
2287 \ifnum\ta@div=3
2288 \@ifundefined{PackageNote}{\PackageInfo}{\PackageNote}%
2289 {typearea}{DIV calculation for classic typearea.}%
2290 \setlength{\ta@temp}{\paperwidth}%
2291 \addtolength{\ta@temp}{-\ta@bcor}%
2292 % \end{macrocode}
2293 % Here we also need to take care for whether the head is part of the typing
2294 % area or the margin.
2295 % \begin{macrocode}
2296 \if@hincl\else
2297 \addtolength{\ta@temp}{\headheight}%
2298 \addtolength{\ta@temp}{\headsep}%
2299 \fi
2300 \if@fincl\else
2301 \addtolength{\ta@temp}{\footskip}%
2302 \fi
2303 % \end{macrocode}
2304 % Sometimes we need more vertical space than available. In this case we use
2305 % another calculation. This will be defined later.
2306 % \changes{v2.5a}{1997/06/22}{\cs{ifdim} instead of \cs{ifnum}}
2307 % \begin{macrocode}
2308 \ifdim \ta@temp >\paperheight
2309 \PackageWarningNoLine{typearea}{%
2310 No classic typearea with this papersize!\MessageBreak
2311 Using calculated DIV%
2312 }%
2313 \ta@div=\@ne
2314 % \end{macrocode}
2315 % Otherwise we can calculate the height of all vertical margins by the height
2316 % of the paper width (without binding correction)
2317 % \begin{macrocode}
2318 \else
2319 \setlength{\ta@temp}{\paperheight}%
2320 \addtolength{\ta@temp}{-\paperwidth}%
2321 \addtolength{\ta@temp}{\ta@bcor}%
2322 % \end{macrocode}
2323 % and from this the height of one block
2324 % \begin{macrocode}
2325 \divide\ta@temp by3
2326 % \end{macrocode}
2327 % and this will result in a divisor.
2328 % \begin{macrocode}
2329 \ta@modiv{\paperheight}{\ta@temp}%
2330 \fi
2331 % \end{macrocode}
2332 % Here we do not need to respect \opt{mpinclude} because we do not use the
2333 % width of the typing area but the height of the paper.
2334 % \begin{macrocode}
2335 \fi
2336 % \end{macrocode}
2337 % If we did not found a good value until this point, we try to calculate the
2338 % optimal divisor.
2339 % \changes{v2.4n}{1997/05/28}{improved optimal divisor calculation}
2340 % \begin{macrocode}
2341 \ifnum\ta@div <4
2342 \@ifundefined{PackageNote}{\PackageInfo}{\PackageNote}%
2343 {typearea}{DIV calculation for classic typearea.}%
2344 % \end{macrocode}
2345 % The width of the typing area could at most be the width of the paper without
2346 % the binding correction.
2347 % \begin{macrocode}
2348 \setlength{\textwidth}{\paperwidth}%
2349 \addtolength{\textwidth}{-\ta@bcor}%
2350 % \end{macrocode}
2351 % The optimal width would be the optimal line width.
2352 % \begin{macrocode}
2353 \ta@temp@goodwidth
2354 % \end{macrocode}
2355 % In two column mode each text line has two such columns plus the column
2356 % separation width.
2357 % \changes{v2.8q}{2001/12/13}{\opt{DIVcalc} uses wider columns in two
2358 % column mode}
2359 % \begin{macrocode}
2360 \if@twocolumn
2361 \addtolength{\ta@temp}{\ta@temp}%
2362 \addtolength{\ta@temp}{\columnsep}%
2363 \fi
2364 % \end{macrocode}
2365 % Former releases used an iterative approach to get the best
2366 % divisor. Depending on the \TeX{} implementation and the paper size this
2367 % could be more or less slow. So we do a direct calculation starting with the
2368 % width of the left and right margin.
2369 % \begin{macrocode}
2370 \setlength{\ta@hblk}{\paperwidth}%
2371 \addtolength{\ta@hblk}{-\ta@temp}%
2372 % \end{macrocode}
2373 % This can be used to calculate the width of a block.
2374 % \begin{macrocode}
2375 \divide\ta@hblk by3
2376 % \end{macrocode}
2377 % If this width is negative, we use a minimum width of 5\,mm.
2378 % \changes{v2.5a}{1997/06/22}{\cs{ifdim} instead of \cs{ifnum}.}
2379 % \begin{macrocode}
2380 \ifdim \ta@hblk <\z@
2381 \setlength{\ta@hblk}{5mm}%
2382 \fi
2383 % \end{macrocode}
2384 % The width of block and the width of the paper can be used to calculate the
2385 % divisor.
2386 % \changes{v2.8q}{2002/03/28}{respect \opt{mpinclude} at the calculation
2387 % of the best divisor}
2388 % If option \opt{mpinclude} is active, we have to multiply the divisor with
2389 % $\frac{3}{3+m}$. $m$ is the number of blocks used for the margin notes. If
2390 % $m=1$ we have an factor of $\frac{3}{4}=0.75$. More difficult would be not
2391 % to use a number of blocks for the margin note column but a dedicated value
2392 % for the width of the margin note column.
2393 % \begin{macrocode}
2394 \if@mincl
2395 \setlength{\ta@temp}{.75\ta@hblk}%
2396 \else
2397 \setlength{\ta@temp}{\ta@hblk}%
2398 \fi
2399 \ta@modiv{\paperwidth}{\ta@temp}%
2400 % \end{macrocode}
2401 % Another difficulty would be, if the divisor now is optimal for the width but
2402 % result in a to large height. To find this out, we first calculate the typing
2403 % area and margins with the found divisor.
2404 % \begin{macrocode}
2405 \@typearea
2406 % \end{macrocode}
2407 % Now, we test the vertical sizes. Again a minimum block size is of 5\,mm will
2408 % be used. But we have to take care the 1\,in of \TeX!
2409 % \changes{v2.5a}{1997/06/22}{\cs{ifdim} instead of \cs{ifnum}}
2410 % \begin{macrocode}
2411 \setlength{\ta@temp}{-1in}%
2412 \addtolength{\ta@temp}{5mm}%
2413 \ifdim\topmargin <\ta@temp
2414 % \end{macrocode}
2415 % This would be the minimum top margin. If the margin is less, we need another
2416 % divisor. In this case we also have to recognize whether the page head and
2417 % footer are part of the margins or the typing area.
2418 % \changes{v2.5b}{1997/06/29}{take care for \opt{headinclude} and
2419 % \opt{footinclude} while calculating the divisor for minimum top
2420 % margin}
2421 % \begin{macrocode}
2422 \setlength{\ta@temp}{15mm}%
2423 \if@hincl\else
2424 \addtolength{\ta@temp}{\headheight}%
2425 \addtolength{\ta@temp}{\headsep}%
2426 \fi
2427 \if@fincl\else
2428 \addtolength{\ta@temp}{\footskip}%
2429 \fi
2430 \divide\ta@temp by3
2431 \ta@modiv{\paperheight}{\ta@temp}%
2432 \fi
2433 % \end{macrocode}
2434 % A solution for this difficulty has been found.
2435 % \begin{macrocode}
2436 \fi
2437 % \end{macrocode}
2438 % So now we have the final divisor and can do the final calculation.
2439 % \begin{macrocode}
2440 \@typearea
2441 % \end{macrocode}
2442 % \changes{v2.0e}{1994/10/28}{write layout values to the \file{log} file}
2443 % \changes{v2.4i}{1996/11/11}{write to the \file{log} file later}
2444 % \changes{v2.4i}{1996/11/11}{execute \cs{@typearea@end} at the end of \cs{typearea}}
2445 % \changes{v2.4j}{1996/12/04}{\file{log} output with only one
2446 % \cs{textheight} but additional \cs{baselineskip}}
2447 % \changes{v2.5}{1997/06/17}{"`arithmetic overflow"' with \opt{landscape} fixed}
2448 % \changes{v2.95}{2004/01/30}{warning in two column mode fixed}
2449 % \changes{v3.00}{2008/10/08}{use \cs{ta@layoutinfo} to write the layout
2450 % values into the \file{log} file}
2451 % \changes{v3.01b}{2008/12/09}{warning for sub-optimal settings changed}
2452 % \changes{v3.26}{2018/07/16}{warning about long lines changed}
2453 % \changes{v3.26}{2018/07/16}{warning about small lines changed and
2454 % replaced by an info}
2455 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
2456 % option storage commands}
2457 % Last but not least we write some layout values into the \file{log} file. For
2458 % some of the information we need additional calculations, e.g., of a good
2459 % line width.
2460 % \begin{macrocode}
2461 \ta@temp@goodwidth
2462 \if@twocolumn
2463 \addtolength{\ta@temp}{\ta@temp}%
2464 \addtolength{\ta@temp}{\columnsep}%
2465 \fi
2466 \setlength{\@tempdima}{\ta@temp}%
2467 \addtolength{\ta@temp}{-\textwidth}%
2468 \divide\@tempdima by100
2469 \divide\ta@temp by\@tempdima
2470 \@tempcnta=\ta@temp
2471 \ifnum\@tempcnta <5
2472 \ifnum\@tempcnta >-5
2473 \@tempcnta=0
2474 \else
2475 \advance\@tempcnta by4
2476 \fi
2477 \else
2478 \advance\@tempcnta by-4
2479 \fi
2480 \ifnum \ta@warnlimit<\z@\else
2481 \ifnum\@tempcnta <-\numexpr \ta@warnlimit\relax
2482 \@tempcnta=-\@tempcnta
2483 \PackageWarningNoLine{typearea}{%
2484 Bad type area settings!\MessageBreak
2485 The detected line width is about
2486 \the\@tempcnta\@percentchar\MessageBreak
2487 larger than the heuristically estimated maximum\MessageBreak
2488 limit of typographical good line width.\MessageBreak
2489 You should e.g.
2490 \ifnum\ta@div >6 decrease DIV, \fi
2491 \ifdim\f@size\p@<\@xiipt\p@ increase fontsize\else
2492 (increase fontsize)\fi\MessageBreak
2493 or change papersize%
2494 }%
2495 \@tempcnta=-\@tempcnta
2496 \fi
2497 \fi
2498 \ifnum \ta@infolimit<\z@\else
2499 \ifnum\@tempcnta>\numexpr \ta@infolimit\relax
2500 \PackageInfoNoLine{typearea}{%
2501 Maybe no optimal type area settings!\MessageBreak
2502 The detected line width is about
2503 \the\@tempcnta\@percentchar\MessageBreak
2504 smaller than the heuristically estimated maximum\MessageBreak
2505 limit of typographical good line width.\MessageBreak
2506 You could e.g. increase DIV%
2507 \ifdim\f@size\p@>\@xpt\p@, decrease fontsize\fi\MessageBreak
2508 or change the papersize%
2509 }%
2510 \fi
2511 \fi
2512 \ifnum\ta@div <6
2513 \PackageWarningNoLine{typearea}{%
2514 Very low DIV value!\MessageBreak
2515 DIV values less than 6 result in textwidth/-height\MessageBreak
2516 smaller than total marginwidth/-height.\MessageBreak
2517 You should e.g. increase DIV, increase fontsize or\MessageBreak
2518 change papersize%
2519 }
2520 \fi
2521 \ta@layoutinfo{\number\ta@div}{\the\@tempcnta}%
2522 \KOMA@kav@removekey{typearea.\scr@pkgextension}{DIV}%
2523 \KOMA@kav@xadd{typearea.\scr@pkgextension}{DIV}{\@lastdiv}%
2524 \KOMA@kav@removekey{typearea.\scr@pkgextension}{BCOR}%
2525 \KOMA@kav@xadd{typearea.\scr@pkgextension}{BCOR}{\the\ta@bcor}%
2526 \@typearea@end
2527 \activateareas
2528 \ifdim \dimexpr 1in+\topmargin
2529 +\headheight+\headsep
2530 +\textheight
2531 +\footskip+\dp\strutbox\relax
2532 >\paperheight
2533 \PackageWarningNoLine{typearea}{%
2534 page content and margins higher than paper.\MessageBreak
2535 This may result in page footer out of paper.\MessageBreak
2536 You should decrease DIV, decrease foot height,\MessageBreak
2537 or include footer into type area%
2538 }%
2539 \fi
2540 \fi
2541 }
2542 % \end{macrocode}
2543 %
2544 % \begin{macro}{\ta@layoutinfo}
2545 % \changes{v3.00}{2008/10/08}{added}
2546 % Write several layout information into the \file{log} file. The first
2547 % argument is the current divisor and the second the discrepancy from the
2548 % optimal divisor or empty or \cs{relax}.
2549 % \begin{macrocode}
2550 \newcommand*{\ta@layoutinfo}[2]{%
2551 \PackageInfo{typearea}{%
2552 These are the values describing the layout:\MessageBreak
2553 DIV\space\space=\space#1\MessageBreak
2554 BCOR\space=\space\the\ta@bcor\MessageBreak
2555 \string\paperwidth\space\space\space\space\space\space=%
2556 \space\the\paperwidth\MessageBreak
2557 \space\string\textwidth\space\space\space\space\space\space=%
2558 \space\the\textwidth\MessageBreak
2559 \ifx\relax#2\relax\else
2560 \space DIV departure\space\space\space=%
2561 \space#2\@percentchar\MessageBreak
2562 \fi
2563 \space\string\evensidemargin\space=%
2564 \space\the\evensidemargin\MessageBreak
2565 \space\string\oddsidemargin\space\space=%
2566 \space\the\oddsidemargin\MessageBreak
2567 \string\paperheight\space\space\space\space\space=%
2568 \space\the\paperheight\MessageBreak
2569 \space\string\textheight\space\space\space\space\space=%
2570 \space\the\textheight\MessageBreak
2571 \space\string\topmargin\space\space\space\space\space\space=%
2572 \space\the\topmargin\MessageBreak
2573 \space\string\headheight\space\space\space\space\space=%
2574 \space\the\headheight\MessageBreak
2575 \space\string\headsep\space\space\space\space\space\space\space\space=%
2576 \space\the\headsep\MessageBreak
2577 \space\string\topskip\space\space\space\space\space\space\space\space=%
2578 \space\the\topskip\MessageBreak
2579 \space\string\footskip\space\space\space\space\space\space\space=%
2580 \space\the\footskip\MessageBreak
2581 \space\string\baselineskip\space\space\space=%
2582 \space\the\baselineskip\MessageBreak
2583 }%
2584 }
2585 % \end{macrocode}
2586 % \end{macro}^^A \ta@layoutinfo
2587 % \end{command}^^A \typearea
2588 %
2589 % \begin{command}{\recalctypearea}
2590 % \changes{v2.95}{2002/12/04}{added}
2591 % This command can be used to recalculate the typing area and the margins with
2592 % the divisor and the binding correction that has been used last. The command
2593 % is available only after loading the package. So it is an indicator if we
2594 % are in the load or the run-time phase of the package.
2595 % \begin{macrocode}
2596 \AtEndOfPackage{\newcommand*{\recalctypearea}{\typearea[current]{last}}}
2597 %</package&typearea&body>
2598 % \end{macrocode}
2599 % \end{command}
2600 %
2601 % Initially \cs{ta@bcor} and \cs{ta@div} are zero if is has not been set using
2602 % one of the options. The 0 divisor stands for using a value from the default
2603 % list. So the final initialization of the typing area and margins is very
2604 % easy.
2605 % \changes{v2.8q}{2001/11/06}{initialization using symbolic values \opt{current}}
2606 % \begin{macrocode}
2607 %<*package&typearea&final>
2608 \typearea[current]{current}
2609 %</package&typearea&final>
2610 % \end{macrocode}
2611 %
2612 % \subsection{Storage and reactivation of typing area and margin settings}
2613 %
2614 % \begin{command}{\storeareas}
2615 % \changes{v3.10}{2011/09/13}{added}
2616 % \changes{v3.18}{2015/05/20}{Hooks at the beginning and end of the defined macro}
2617 % You can store the current settings of the typing area and the margins in a
2618 % macro. If you use the macro later the stored settings will be restored.
2619 % \begin{macro}{\scr@grouplevel@test}
2620 % \changes{v3.10}{2011/09/13}{added}
2621 % Warn if restoring the settings is used inside a group.
2622 % \begin{macrocode}
2623 %<*package&typearea&body>
2624 \newcommand*{\scr@grouplevel@test}[1]{%
2625 \ifcase\currentgrouptype\else
2626 \PackageWarning{typearea}{%
2627 \string#1\space used at group level
2628 \the\currentgrouplevel.\MessageBreak
2629 Using \string#1\space inside any group, e.g.\MessageBreak
2630 environments, math mode, boxes, etc. may result in\MessageBreak
2631 many type setting problems.\MessageBreak
2632 You should move the command \string#1\MessageBreak
2633 outside all groups%
2634 }%
2635 \fi
2636 }
2637 \newcommand*{\storeareas}[1]{%
2638 \edef\reserved@a{%
2639 \noexpand\newcommand*{\unexpanded{#1}}{%
2640 \noexpand\scr@grouplevel@test\unexpanded{#1}%
2641 \noexpand\csname scr@storeareas@before@hook\noexpand\endcsname
2642 \unexpanded\expandafter\expandafter\expandafter{%
2643 \csname scr@storeareas@before@current@hook\endcsname}%
2644 \noexpand\paperheight=\the\paperheight\space
2645 \noexpand\paperwidth=\the\paperwidth\space
2646 \noexpand\topmargin=\the\topmargin\space
2647 \noexpand\headheight=\the\headheight\space
2648 \noexpand\headsep=\the\headsep\space
2649 \noexpand\textheight=\the\textheight\space
2650 \noexpand\vsize=\the\vsize\space
2651 \noexpand\footskip=\the\footskip\space
2652 \noexpand\@colht=\the\@colht\space
2653 \noexpand\@colroom=\the\@colroom\space
2654 \noexpand\textwidth=\the\textwidth\space
2655 \noexpand\columnwidth=\the\columnwidth\space
2656 \noexpand\hsize=\the\hsize\space
2657 \noexpand\oddsidemargin=\the\oddsidemargin\space
2658 \noexpand\evensidemargin=\if@twoside
2659 \the\evensidemargin
2660 \else
2661 \the\oddsidemargin
2662 \fi\space
2663 \noexpand\linewidth=\the\linewidth\space
2664 \noexpand\maxdepth=\the\maxdepth\space
2665 \scr@ifundefinedorrelax{@pagesizelast}{}{%
2666 \noexpand\KOMAoptions{pagesize=\@pagesizelast}}%
2667 \noexpand\ta@div=\the\ta@div\space
2668 \noexpand\ta@bcor=\the\ta@bcor\space
2669 \noexpand\def\noexpand\@lastdiv{\@lastdiv}%
2670 \noexpand\marginparsep=\the\marginparsep\space
2671 \noexpand\marginparwidth=\the\marginparwidth\space
2672 \noexpand\def
2673 \expandafter\noexpand\csname scr@[email protected].\scr@pkgextension\endcsname{%
2674 \unexpanded\expandafter\expandafter\expandafter{%
2675 \csname scr@[email protected].\scr@pkgextension\endcsname}%
2676 }%
2677 \unexpanded\expandafter\expandafter\expandafter{%
2678 \csname scr@storeareas@after@current@hook\endcsname}%
2679 \noexpand\csname scr@storeareas@after@hook\noexpand\endcsname
2680 }%
2681 }%
2682 \reserved@a
2683 }
2684 % \end{macrocode}
2685 % \begin{command}{\BeforeRestoreareas,\AfterRestoreareas}
2686 % \changes{v3.18}{2015/05/20}{added}
2687 % \changes{v3.20}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
2688 % \begin{macro}{\scr@storeareashook,\scr@storeareas@before@hook,
2689 % \scr@storeareas@before@current@hook,\scr@storeareas@after@hook,
2690 % \scr@storeareas@after@current@hook}
2691 % \changes{v3.18}{2015/05/20}{added}
2692 % Adds code to one of the hooks of the macros defined by \cs{storeareas}.
2693 % The star variants adds code only to not yet defined macros. The non-star
2694 % variant also changes already defined macros.
2695 % \begin{macrocode}
2696 \newcommand*{\BeforeRestoreareas}{%
2697 \kernel@ifstar{\scr@storeareashook{before@current}}%
2698 {\scr@storeareashook{before}}%
2699 }
2700 \newcommand*{\AfterRestoreareas}{%
2701 \kernel@ifstar{\scr@storeareashook{after@current}}%
2702 {\scr@storeareashook{after}}%
2703 }
2704 \newcommand*{\scr@storeareashook}[2]{%
2705 \expandafter\l@addto@macro\csname scr@storeareas@#1@hook\endcsname{#2}%
2706 }
2707 \newcommand*{\scr@storeareas@before@hook}{}
2708 \newcommand*{\scr@storeareas@before@current@hook}{}
2709 \newcommand*{\scr@storeareas@after@hook}{}
2710 \newcommand*{\scr@storeareas@after@current@hook}{}
2711 %</package&typearea&body>
2712 % \end{macrocode}
2713 % \end{macro}^^A \scr@storeareashook … \scr@storeareas@after@current@hook
2714 % \end{command}^^A \BeforeRestoreareas,\AfterRestoreareas
2715 % \end{macro}^^A \scr@grouplevel@test
2716 % \end{command}^^A \storeareas
2717 %
2718 % \subsection{Calculation of margins for a given typing area}
2719 %
2720 % Beside the calculation of the typing area and the margins by a divisor
2721 % \pkg*{typearea} also provides the calculation of margins for a given
2722 % typing area.
2723 %
2724 % \begin{option}{areasetadvanced}
2725 % \changes{v3.11}{2012/04/17}{added}
2726 % Switch to advanced version of \cs{areaset}. This does calculate margins
2727 % more like \cs{typearea}. Nevertheless, there's still a difference at the top
2728 % margin, because \cs{typerea} doesn't balance differences in calculated
2729 % height of margins and resulting height of margins but reduces only the
2730 % bottom margin.
2731 % \begin{macrocode}
2732 %<*package&typearea&options>
2733 \KOMA@ifkey{areasetadvanced}{@areasetadvanced}
2734 %</package&typearea&options>
2735 % \end{macrocode}
2736 % \end{option}
2737 %
2738 % \begin{command}{\areaset}
2739 % \changes{v2.1b}{1994/12/31}{\cs{headheight} depends on \cs{@ptsize}}
2740 % \changes{v2.6}{2000/01/04}{\cs{headheight} depends on \cs{f@size} instead
2741 % of \cs{@ptsize}}
2742 % \changes{v2.7g}{2001/04/17}{symbolic value \opt{current} for the
2743 % optional argument}
2744 % \changes{v2.95}{2002/12/05}{execute \cs{@typearea@end} at the end of
2745 % \cs{areaset}}
2746 % If we have given width and height of the typing area we still can calculate
2747 % the margins. Again we want to use this not only in the document preamble but
2748 % also in the document body.
2749 % \begin{macrocode}
2750 %<*package&typearea&body>
2751 \newcommand*\areaset[3][\z@]{%
2752 \edef\@tempa{#1}\edef\@tempb{current}\ifx\@tempa\@tempb\else
2753 \setlength{\ta@bcor}{#1}%
2754 \fi
2755 % \end{macrocode}
2756 % We have to start a new page if we are inside the document body.
2757 % \begin{macrocode}
2758 \if@atdocument\newpage\fi
2759 % \end{macrocode}
2760 % Then we do the calculation.
2761 % \changes{v2.96}{2006/09/12}{set \cs{topskip}}
2762 % \changes{v3.00}{2008/10/08}{use \cs{ta@layoutinfo} to write layout
2763 % information into the \file{log} file}
2764 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
2765 % option storage commands}
2766 % \begin{macrocode}
2767 \setlength{\textwidth}{#2}%
2768 \setlength{\textheight}{#3}%
2769 \def\@lastdiv{areaset}%
2770 \KOMA@kav@removekey{typearea.\scr@pkgextension}{DIV}%
2771 \KOMA@kav@add{typearea.\scr@pkgextension}{DIV}{areaset}%
2772 \KOMA@kav@removekey{typearea.\scr@pkgextension}{BCOR}%
2773 \KOMA@kav@add{typearea.\scr@pkgextension}{BCOR}{\the\ta@bcor}%
2774 \ta@hblk=\paperwidth
2775 \advance\ta@hblk by-\ta@bcor
2776 \advance\ta@hblk by-\textwidth
2777 % \end{macrocode}
2778 % \changes{v3.11}{2012/04/17}{advanced version with different margin widths}%
2779 % With v3.11 we will have an advanced version of \cs{areaset}. This
2780 % version takes care to option \opt{mpinclude}.
2781 % \begin{macrocode}
2782 \if@areasetadvanced
2783 \if@mincl
2784 \divide\ta@hblk by4
2785 \else
2786 \divide\ta@hblk by3
2787 \fi
2788 \else
2789 \divide\ta@hblk by3
2790 \fi
2791 \oddsidemargin=-1in
2792 \evensidemargin=-1in
2793 \if@twoside
2794 \if@semitwoside
2795 \advance\oddsidemargin by1.5\ta@hblk
2796 \advance\oddsidemargin by\ta@bcor
2797 % \end{macrocode}
2798 % \changes{v3.12}{2013/10/15}{use alternating \opt{BCOR} with
2799 % \opt{twoside\quotechar=semi}}
2800 % If \opt{twoside=semi} is used, form v3.12 we add the binding correction
2801 % to the inner margin. If compatibility to version less than 3.12 has been
2802 % selected the binding correction will be added to the left margin.
2803 % \begin{macrocode}
2804 %<!v4> \expandafter\ifnum\scr@ta@v@is@lt{3.12}\relax
2805 %<!v4> \evensidemargin=\oddsidemargin
2806 %<!v4> \else
2807 \advance\evensidemargin by1.5\ta@hblk
2808 %<!v4> \fi
2809 \else
2810 \advance\oddsidemargin by\ta@hblk
2811 \advance\oddsidemargin by\ta@bcor
2812 \advance\evensidemargin by2\ta@hblk
2813 \fi
2814 \else
2815 \advance\oddsidemargin by1.5\ta@hblk
2816 \advance\oddsidemargin by\ta@bcor
2817 \evensidemargin\oddsidemargin
2818 \fi
2819 \scr@ifundefinedorrelax{@ptsize}{%
2820 \topskip=\f@size\p@
2821 }{%
2822 \topskip=\@ptsize\p@
2823 \advance\topskip by 10\p@
2824 }%
2825 % \end{macrocode}
2826 % \changes{v3.11}{2012/04/17}{advanced version with different margin widths}%
2827 % With v3.11 we will have an advanced version of \cs{areaset}. This
2828 % version uses the head height algorithm of \cs{typearea}.
2829 % \begin{macrocode}
2830 \if@areasetadvanced
2831 \normalsize
2832 \@ifundefined{ta@hh}{%
2833 \headheight=1.25\baselineskip
2834 }{%
2835 \headheight=\ta@hh
2836 }%
2837 \else
2838 \headheight=15\p@
2839 \advance\headheight by\f@size\p@
2840 \advance\headheight by-10\p@
2841 \fi
2842 \headsep=1.5\baselineskip
2843 % \end{macrocode}
2844 % \changes{v3.12}{2013/03/26}{changes for height of foot}
2845 % \begin{macrocode}
2846 \@ifundefined{footheight}{\newlength\footheight}{}
2847 \if@areasetadvanced
2848 \@ifundefined{ta@fh}{%
2849 \footheight=1.25\baselineskip
2850 \footskip=3.5\baselineskip
2851 }{%
2852 \footheight=\ta@fh
2853 \footskip=\dimexpr \footheight+2.25\baselineskip\relax
2854 }%
2855 \else
2856 \footheight=1.25\baselineskip
2857 \footskip=3.5\baselineskip
2858 \fi
2859 \ta@vblk=\paperheight
2860 \advance\ta@vblk by-\textheight
2861 \divide\ta@vblk by3
2862 \if@hincl
2863 \advance\textheight by-\headheight
2864 \advance\textheight by-\headsep
2865 \fi
2866 \if@fincl
2867 \advance\textheight by-\footskip
2868 \fi
2869 \topmargin=-1in
2870 \advance\topmargin by\ta@vblk
2871 \if@hincl \else
2872 \advance\topmargin by-\headheight
2873 \advance\topmargin by-\headsep
2874 \fi
2875 \if@twoside
2876 \if@semitwoside
2877 \marginparwidth=\ta@hblk
2878 \else
2879 \marginparwidth=1.5\ta@hblk
2880 \fi
2881 \else
2882 \marginparwidth=\ta@hblk
2883 \fi
2884 \marginparsep=1cc
2885 % \end{macrocode}
2886 % \changes{v3.11}{2012/04/17}{advanced version with different
2887 % \cs{marginparwidth} and unchanged \cs{marginparsep}}%
2888 % With version 3.11 we will have an advanced version of \cs{areaset}. This
2889 % version supports \opt{mpinclude} option like \cs{typearea}.
2890 % \begin{macrocode}
2891 \if@areasetadvanced
2892 \if@mincl
2893 \marginparwidth=\ta@hblk
2894 \if@twoside\if@semitwoside\else
2895 \advance\evensidemargin by\marginparwidth
2896 \fi\fi
2897 \advance\marginparwidth by-\marginparsep
2898 \fi
2899 \fi
2900 \marginparpush=0.45\baselineskip
2901 \ta@layoutinfo{areaset}{}%
2902 % \end{macrocode}
2903 % \changes{v3.11}{2012/04/17}{using \cs{@areaset@end}}
2904 % \changes{v3.16a}{2015/02/11}{using \cs{footheight} for calculation of
2905 % page usage}
2906 % Since v3.11 we also support \cs{AfterSettingArea} analogous to
2907 % \cs{AfterCalculatingTypearea}:
2908 % \begin{macrocode}
2909 \@areaset@end
2910 \activateareas
2911 \ifdim \dimexpr 1in+\topmargin
2912 +\headheight+\headsep
2913 +\textheight
2914 +\footskip+\footheight-\ht\strutbox\relax
2915 >\paperheight
2916 \PackageWarningNoLine{typearea}{%
2917 page content and margins higher than paper.\MessageBreak
2918 This may result in page footer out of paper.\MessageBreak
2919 You should decrease DIV, decrease foot height,\MessageBreak
2920 or decreate height of text area%
2921 }%
2922 \fi
2923 }
2924 % \end{macrocode}
2925 % \end{command}
2926 %
2927 % \begin{command}{\AfterSettingArea}
2928 % \changes{v3.11}{2012/04/17}{added}
2929 % \changes{v3.20}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
2930 % The user may influence the result of \cs{areaset}. The star version works
2931 % local while the non-star version is global.
2932 % \begin{macrocode}
2933 \newcommand*{\AfterSettingArea}{%
2934 \kernel@ifstar \l@addto@macro \g@addto@macro \@areaset@end
2935 }
2936 % \end{macrocode}
2937 % \begin{macro}{\@areaset@end}
2938 % \changes{v3.11}{2012/04/17}{added}
2939 % Macro \cs{@areaset@end} is a hook to make it possible to add some
2940 % instructions to the end of the \cs{areaset} command. This will be executed
2941 % before the activation of the settings inside a document.
2942 % \begin{macrocode}
2943 \newcommand*{\@areaset@end}{}
2944 %</package&typearea&body>
2945 % \end{macrocode}
2946 % \end{macro}
2947 % \end{command}
2948 %
2949 % \subsection{Deprecated options}
2950 %
2951 % Former versions of \KOMAScript{} had some options that are completely
2952 % deprecated since \KOMAScript{} 3.00. Most of them but not all are pattern
2953 % matching options.
2954 %
2955 % \begin{option}{DIVcalc,DIVclassic}
2956 % \changes{v2.4g}{1996/11/04}{added}
2957 % \changes{v2.95}{2002/12/04}{implemented using option \opt{DIV}}
2958 % \changes{v2.97d}{2007/10/03}{\cs{PackageInfo} replaced by \cs{PackageInfoNoLine}}
2959 % \changes{v3.01a}{2008/11/21}{deprecated}
2960 % \changes{v3.99}{2022/11/16}{not with \KOMAScript~4}
2961 % The former form of \opt{DIV=}\opt{calc} and \opt{DIV=}\opt{classic}.
2962 % \begin{macrocode}
2963 %<*package&typearea&options&!v4>
2964 \KOMA@DeclareDeprecatedOption[typearea]{DIVcalc}{DIV=calc}
2965 \KOMA@DeclareDeprecatedOption[typearea]{DIVclassic}{DIV=classic}
2966 %</package&typearea&options&!v4>
2967 % \end{macrocode}
2968 % \end{option}^^A DIVcalc,DIVclassic
2969 %
2970 % \begin{option}{a...paper,b...paper,c...paper,d...paper}
2971 % Formerly \opt{a}\meta{integer}\opt{paper},
2972 % \opt{b}\meta{integer}\opt{paper},
2973 % \opt{c}\meta{integer}\opt{paper},
2974 % \opt{d}\meta{integer}\opt{paper} has been documented. Since
2975 % \KOMAScript{} v3.00 most of them are deprecated and has been replaced by
2976 % option \opt{paper}. Nevertheless, for compatibility these options and the
2977 % commands needed to recognize and handle them are still implemented.
2978 %
2979 %
2980 % \begin{macro}{\x@paper}
2981 % \begin{macro}{\x@@paper}
2982 % \changes{v2.5}{1997/06/17}{pattern matching of paper sizes}
2983 % \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
2984 % \changes{v3.28}{2019/11/18}{\cs{ifnumber} renamed to \cs{Ifnumber}}
2985 % This macros will be needed when the paper size will be generated.
2986 % \begin{command}{\isopaper}
2987 % \changes{v2.5}{1997/06/17}{added}
2988 % \changes{v2.95}{2002/12/03}{upper case letters are also allowed}
2989 % \changes{v3.23}{2017/02/22}{using \cs{ISO@PaperNameToSize}}
2990 % Because \cs{isopaper} is used inside the paper size detection by pattern
2991 % matching to select a specific ISO/DIN paper size, it has to be defined
2992 % before the pattern matching will be done.
2993 % \begin{macrocode}
2994 %<*package&typearea&options>
2995 \newcommand\isopaper[2][a]{%
2996 % \end{macrocode}
2997 % The command has to parameters. The first one is optional and the basic size
2998 % given by one of the letters:
2999 % \begin{description}
3000 % \item[a] -- ISO/DIN A sizes
3001 % \item[b] -- ISO/DIN B sizes
3002 % \item[c] -- ISO/DIN C sizes
3003 % \item[d] -- ISO/DIN D sizes
3004 % \end{description}
3005 % The second and mandatory argument is the scale number
3006 % \begin{macrocode}
3007 \ISO@PaperNameToSize[typearea]#1#2\@nil
3008 % \end{macrocode}
3009 % Select either landscape or portrait:
3010 % \changes{v2.97e}{2007/10/23}{landscape or portrait}
3011 % \changes{v3.22}{2016/07/29}{adapting paper orientation}
3012 % \begin{macrocode}
3013 %<!v4> \expandafter\ifnum\scr@ta@v@is@ge{3.22}\relax
3014 \scr@setpaperorientation
3015 %<!v4> \else
3016 %<!v4> \if@landscape\scr@switchpapersizes\fi
3017 %<!v4> \fi
3018 }
3019 % \end{macrocode}
3020 % \pkg*{typearea} uses its own error message.
3021 % \begin{macro}{\scr@UnknownPaperSize@typearea}
3022 % \changes{v3.23}{2017/02/22}{added}
3023 % \begin{macrocode}
3024 \ProvideUnknownPaperSizeError{typearea}{%
3025 \PackageError{typearea}{%
3026 Unknown ISO/DIN-papersize-letter #1%
3027 }{%
3028 There are only four defined paper scalings:\MessageBreak
3029 a = ISO/DIN-A, b = ISO/DIN-B, c = ISO/DIN-C,
3030 d = ISO/DIN-D\MessageBreak
3031 Read KOMA-Script-documentation for further information.%
3032 }%
3033 \setlength{\paperwidth}{841sp}%
3034 \setlength{\paperheight}{1189sp}%
3035 }
3036 % \end{macrocode}
3037 % \end{macro}^^A \scr@UnknownPaperSize@typearea
3038 % \end{command}^^A \isopaper
3039 % \begin{macro}{\scr@setpaperorientation}
3040 % \changes{v3.22}{2016/07/29}{added}
3041 % Setup the paper orientation depending on \cs{if@landscape}.
3042 % \begin{macrocode}
3043 \newcommand*\scr@setpaperorientation{%
3044 \ifdim\paperheight>\paperwidth
3045 \if@landscape\scr@switchpapersizes\fi
3046 \else
3047 \if@landscape\else\scr@switchpapersizes\fi
3048 \fi
3049 }
3050 % \end{macrocode}
3051 % \begin{macro}{\scr@switchpapersizes}
3052 % \changes{v3.22}{2016/07/29}{added}
3053 % Switches the two lengths \len{paperwidth} and \len{paperheight}.
3054 % \begin{macrocode}
3055 \newcommand*\scr@switchpapersizes{%
3056 \@tempdima\paperwidth\paperwidth\paperheight\paperheight\@tempdima
3057 }
3058 % \end{macrocode}
3059 % \end{macro}^^A \scr@switchlength
3060 % \end{macro}^^A \scr@setpaperorientation
3061 % \begin{macro}{\iso@paper}
3062 % \changes{v2.95}{2002/12/03}{added}
3063 % Similar to \cs{isopaper} but with only one argument for the base size and
3064 % the scale number.
3065 % \begin{macro}{\iso@@paper}
3066 % \changes{v2.95}{2002/12/03}{added}
3067 % \changes{v3.28}{2019/11/18}{\cs{ifnumber} renamed to \cs{Ifnumber}}
3068 % The single argument is split into base size letter and scale number by
3069 % pattern matching.
3070 % \begin{macrocode}
3071 \newcommand*{\iso@paper}[1]{\expandafter\iso@@paper#1\@nil}
3072 \newcommand*{\iso@@paper}{}
3073 \def\iso@@paper#1#2\@nil{%
3074 \@tempswafalse
3075 \if #1a\@tempswatrue
3076 \else\if #1A\@tempswatrue
3077 \else\if #1b\@tempswatrue
3078 \else\if #1B\@tempswatrue
3079 \else\if #1c\@tempswatrue
3080 \else\if #1C\@tempswatrue
3081 \else\if #1d\@tempswatrue
3082 \else\if #1D\@tempswatrue
3083 \fi\fi\fi\fi\fi\fi\fi\fi
3084 \if@tempswa
3085 \Ifnumber{#2}{\isopaper[#1]{#2}}{\@tempswafalse}%
3086 \fi
3087 }
3088 %</package&typearea&options>
3089 % \end{macrocode}
3090 % \end{macro}^^A \iso@@paper
3091 % \end{macro}^^A \iso@paper
3092 %
3093 % \begin{option}{DIV...}
3094 % \begin{option}{BCOR...}
3095 % Formerly \opt{DIV}\meta{integer}, \opt{BCOR}\meta{length},
3096 % \opt{headlines}\meta{real} has been documented as options. Since
3097 % \KOMAScript{} 3.00 these have been replaced by \opt{DIV=}\meta{integer},
3098 % \opt{BCOR=}\meta{length} and
3099 % \opt{headlines=}\meta{real}. Nevertheless, for compatibility the
3100 % deprecated options are still handled by \cs{DeclareOption*} and so we
3101 % need several helper macros to recognize them.
3102 %
3103 %
3104 % \begin{macro}{\@BCOR}
3105 % \begin{macro}{\@@BCOR}
3106 % \changes{v2.5}{1997/06/17}{Single letter scanner replaced by pattern matching}
3107 % \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
3108 % Macro \cs{@BCOR} it needed to handle option \opt{BCOR\emph{BCOR}}. The
3109 % option is recognized by pattern matching.
3110 % \begin{macrocode}
3111 %<*(class|(package&typearea))&options>
3112 \newcommand*{\@BCOR}{\expandafter\@@BCOR\CurrentOption BCORBCOR\@@BCOR}
3113 \newcommand*{\@@BCOR}{}
3114 \def\@@BCOR #1BCOR#2BCOR#3\@@BCOR{%
3115 % \end{macrocode}
3116 % If it is option \opt{BCOR} the first argument is empty.
3117 % \begin{macrocode}
3118 \Ifstr{#1}{}{%
3119 % \end{macrocode}
3120 % Additionally the third argument is |BCOR|.
3121 % \begin{macrocode}
3122 \Ifstr{#3}{BCOR}{%
3123 % \end{macrocode}
3124 % Now, the second argument should be the size. If this is not the case, an
3125 % error has to be reported.
3126 % \changes{v3.22}{2016/07/29}{missing deprecated option warning added}
3127 % \changes{v3.28}{2019/11/18}{\cs{ifdimen} renamed to \cs{Ifdimen}}
3128 % \changes{v3.30}{2020/03/24}{avoid error message for unknown \opt{BCOR}
3129 % value to \cs{documentclass}}
3130 % \changes{v3.31}{2020/04/27}{improved valid value recognization}
3131 % \changes{v3.99}{2022/11/16}{deprecated option not with \KOMAScript~4}
3132 % \begin{macrocode}
3133 %<*class>
3134 \Ifstrstart{#2}{=}{%
3135 \edef\reserved@a{\noexpand\Ifdimen{\@gobble#2}}%
3136 \reserved@a{\PassOptionsToPackage{BCOR#2}{typearea}}{\OptionNotUsed}%
3137 }{%
3138 \Ifdimen{#2}{\PassOptionsToPackage{BCOR#2}{typearea}}{\OptionNotUsed}%
3139 }%
3140 %</class>
3141 %<*package>
3142 %<!v4> \Ifdimen{#2}{%
3143 %<!v4> \KOMA@UseDeprecatedOption{%
3144 %<!v4> \PackageWarningNoLine{typearea}}{BCOR#2}{BCOR=#2}%
3145 %<!v4> }{%
3146 \scr@pti@nerr@r
3147 %<!v4> }%
3148 %</package>
3149 % \end{macrocode}
3150 % In all other cases it is not this option. So we report an error. Instead of
3151 % the error another option could be tested.
3152 % \begin{macrocode}
3153 }{\scr@pti@nerr@r}%
3154 }{\scr@pti@nerr@r}%
3155 }
3156 % \end{macrocode}
3157 % \end{macro}
3158 % \end{macro}
3159 %
3160 % \begin{macro}{\@DIV}
3161 % \begin{macro}{\@@DIV}
3162 % \changes{v2.5}{1997/06/17}{Single letter scanner replaced by pattern matching}
3163 % \changes{v3.22}{2016/07/29}{missing deprecated option warning added}
3164 % \changes{v3.28}{2019/11/18}{\cs{ifnumber} renamed to \cs{Ifnumber}}
3165 % \changes{v3.30}{2020/03/24}{avoid error message for unknown \opt{DIV}
3166 % value to \cs{documentclass}}
3167 % \changes{v3.31}{2020/04/27}{improved valid value recognization}
3168 % \changes{v3.99}{2022/11/16}{deprecated option not with \KOMAScript~4}
3169 % Here we use more or less the same functionality as with \cs{@BCOR} and \cs{@@BCOR}.
3170 % \begin{macrocode}
3171 \newcommand*{\@DIV}{\expandafter\@@DIV\CurrentOption DIVDIV\@@DIV}
3172 \newcommand*{\@@DIV}{}
3173 \def\@@DIV #1DIV#2DIV#3\@@DIV{%
3174 \edef\@tempa{#1}\ifx\@tempa\@empty
3175 \edef\@tempa{#3}\def\@tempb{DIV}\ifx\@tempa\@tempb
3176 %<*class>
3177 \Ifstrstart{#2}{=}{%
3178 \edef\reserved@a{\noexpand\Ifnumber{\@gobble#2}}%
3179 \reserved@a{\PassOptionsToPackage{DIV#2}{typearea}}{\OptionNotUsed}%
3180 }{%
3181 \Ifnumber{#2}{\PassOptionsToPackage{DIV#2}{typearea}}{\OptionNotUsed}%
3182 }%
3183 %</class>
3184 %<*package>
3185 %<!v4> \Ifnumber{#2}{%
3186 %<!v4> \KOMA@UseDeprecatedOption{%
3187 %<!v4> \PackageWarningNoLine{typearea}}{DIV#2}{DIV=#2}%
3188 %<!v4> }{%
3189 \scr@pti@nerr@r
3190 %<!v4> }%
3191 %</package>
3192 \else\scr@pti@nerr@r\fi
3193 % \end{macrocode}
3194 % The only difference is, that we do not report an error but also test for
3195 % \opt{BCOR}.
3196 % \begin{macrocode}
3197 \else\@BCOR\fi
3198 }
3199 % \end{macrocode}
3200 % \end{macro}^^A \@@DIV
3201 % \end{macro}^^A \@DIV
3202 %
3203 % \begin{option}{headlines...}
3204 % \begin{macro}{\@headlines}
3205 % \begin{macro}{\@@headlines}
3206 % \changes{v2.7g}{2001/04/17}{neW pattern matching for the number of headlines}
3207 % The macros are needed to recognize the deprecated option
3208 % \opt{headlines\meta{integer}}.
3209 % \begin{macrocode}
3210 \newcommand{\@headlines}{%
3211 \expandafter\@@headlines\CurrentOption headlines\@@headlines%
3212 }
3213 \newcommand*{\@@headlines}{}
3214 \def\@@headlines #1headlines#2\@@headlines{
3215 \edef\@tempa{#2}\edef\@tempb{headlines}\ifx\@tempa\@tempb
3216 %<class> \PassOptionsToPackage{#1headlines}{typearea}
3217 %<package> \setlength{\@tempdima}{#1\baselineskip}%
3218 %<package> \def\ta@hh{#1\baselineskip}%
3219 \else\@DIV\fi
3220 }
3221 %</(class|(package&typearea))&options>
3222 % \end{macrocode}
3223 % \end{macro}^^A \@headlines
3224 % \end{macro}^^A \@@headlines
3225 %
3226 % Starting point for all the deprecated pattern matching options is
3227 % \cs{DeclareOption*} for command \cs{x@paper} that uses pattern
3228 % matching with \cs{x@@paper} to recognize the deprecated options. These
3229 % are needed not only for package \pkg*{typearea} but also for the classes.
3230 %
3231 % Back to the pattern matching. This one is the most simple of all.
3232 % \changes{v2.97e}{2007/10/23}{passing options \pkg*{typearea} using the new syntax}
3233 % \begin{macrocode}
3234 %<*(class|(package&typearea))&options>
3235 \newcommand*{\x@paper}{%
3236 \expandafter\x@@paper\CurrentOption paper\x@@paper%
3237 }
3238 \newcommand*{\x@@paper}{}
3239 \def\x@@paper #1#2paper#3\x@@paper{%
3240 \Ifstr{#3}{paper}{%
3241 \Ifnumber{#2}{%
3242 \Ifstr{#1}{a}{%
3243 %<class> \PassOptionsToPackage{#3=#1#2}{typearea}%
3244 %<package> \isopaper[a]{#2}%
3245 }{%
3246 \Ifstr{#1}{b}{%
3247 %<class> \PassOptionsToPackage{#3=#1#2}{typearea}%
3248 %<package> \isopaper[b]{#2}%
3249 }{%
3250 \Ifstr{#1}{c}{%
3251 %<class> \PassOptionsToPackage{#3=#1#2}{typearea}%
3252 %<package> \isopaper[c]{#2}%
3253 }{%
3254 \Ifstr{#1}{d}{%
3255 %<class> \PassOptionsToPackage{#3=#1#2}{typearea}%
3256 %<package> \isopaper[d]{#2}%
3257 }{\scr@pti@nerr@r}%
3258 }%
3259 }%
3260 }%
3261 }{\scr@pti@nerr@r}%
3262 }{%
3263 %<class> \@pt@scan
3264 %<package> \@headlines
3265 }%
3266 }
3267 % \end{macrocode}
3268 %
3269 % \begin{macro}{\scr@pti@nerr@r}
3270 % \changes{v2.95}{2002/06/20}{\cs{OptionNotUsed} instead of \cs{PackageError}}
3271 % If the addition option is neither \opt{BCOR\dots} nor \opt{DIV\dots} nor
3272 % \opt{headlines} nor a known paper size, it is still unused.
3273 % \begin{macrocode}
3274 \newcommand*{\scr@pti@nerr@r}{
3275 %<class> \OptionNotUsed
3276 %<package> \@unknownoptionerror
3277 }
3278 % \end{macrocode}
3279 % \end{macro}
3280 %
3281 % \changes{v2.97c}{2007/09/12}{\cs{lco@test} added to before pattern matching
3282 % of options}
3283 % \begin{macrocode}
3284 \DeclareOption*{%
3285 %<letter> \lco@test
3286 \x@paper}
3287 %</(class|(package&typearea))&options>
3288 % \end{macrocode}
3289 % \end{option}^^A headline...
3290 % \end{option}^^A DIV...
3291 % \end{option}^^A BCOR...
3292 % \end{macro}^^A \x@paper
3293 % \end{macro}^^A \x@@paper
3294 % \end{option}^^A a...paper … d...paper
3295 %
3296 %
3297 % ^^A This part should stay at the end of the source file!
3298 % \subsection{Configuration file}
3299 %
3300 % At the very ending of the option section just before executing and
3301 % processing the options you can add additional options the
3302 % \pkg*{typearea}. This is a very seldom used feature and I recommend to
3303 % not use it any longer. If you need additional options use
3304 % |\BeforeFamilyProcessOptions[.typearea.sty]{KOMA}{...}|.
3305 %
3306 % \changes{v2.0e}{1994/10/28}{configuration file \file{typearea.cfg}}
3307 % \changes{v3.42}{2024/02/01}{\cs{typeout} replaced by either
3308 % \cs{PackageNote} or \cs{PackageInfo}}
3309 % \begin{macrocode}
3310 %<*package&typearea&options>
3311 \InputIfFileExists{typearea.cfg}{%
3312 \@ifundefined{PackageNote}{\PackageInfo}{\PackageNote}%
3313 {typearea}{Local configuration file typearea.cfg loaded}%
3314 }{}
3315 %</package&typearea&options>
3316 % \end{macrocode}
3317 %
3318 % \subsection{Option execution}
3319 %
3320 % The paper size and telling the back-end driver information about the paper
3321 % size are default. The default for the default paper size will be \opt{A4}
3322 % if nothing else was defined by a class. Execution of option \opt{twoside}
3323 % depends already on the setting of \cs{if@twoside} and
3324 % \cs{if@semitwoside}. This may be surprising but nevertheless is correct.
3325 % \changes{v2.3h}{1995/01/19}{\cs{relax} after \cs{ProcessOptions} added}
3326 % \changes{v2.96}{2006/08/18}{processing options in order of usage instead of
3327 % order of declaration}
3328 % \changes{v2.97c}{2007/04/19}{Usage of \cs{KOMAExecuteOptions} instead of
3329 % \cs{KOMAoptions}}
3330 % \changes{v2.97c}{2007/04/19}{Usage of \cs{KOMAProcessOptions} instead of
3331 % \cs{ProcessOptions}}
3332 % \changes{v2.97c}{2007/04/19}{set only options that are not an implicit
3333 % default}
3334 % \changes{v2.97c}{2007/07/18}{explicit setting of a valid value to
3335 % \opt{twoside}}
3336 % \changes{v3.12}{2013/11/11}{the default paper size is given by
3337 % \cs{defaultpagesize}}
3338 % \changes{v3.17}{2015/03/02}{\opt{pagesize} is default}
3339 % \begin{macro}{\defaultpapersize}
3340 % \changes{v3.12}{2013/11/11}{added}
3341 % The default paper size. Defined using \cs{providecommand} so it can be
3342 % changed by a class or wrapper package or \file{typearea.cfg} or somewhere
3343 % else before loading \pkg*{typearea}.
3344 % \begin{macrocode}
3345 %<*package&typearea&options>
3346 \providecommand*{\defaultpapersize}{A4}
3347 %</package&typearea&options>
3348 % \end{macrocode}
3349 % \end{macro}
3350 % \begin{macrocode}
3351 %<*package&typearea&options>
3352 \KOMAExecuteOptions{paper=\defaultpapersize,pagesize}
3353 \if@twoside
3354 \if@semitwoside
3355 \KOMAExecuteOptions{twoside=semi}
3356 \else
3357 \KOMAExecuteOptions{twoside}
3358 \fi
3359 \else
3360 \KOMAExecuteOptions{twoside=false}
3361 \fi
3362 \KOMAProcessOptions\relax
3363 %</package&typearea&options>
3364 % \end{macrocode}
3365 %
3366 % \Finale
3367 % \PrintChanges
3368 %
3369 \endinput
3370 % Local Variables:
3371 % mode: doctex
3372 % ispell-local-dictionary: "en_US"
3373 % eval: (flyspell-mode 1)
3374 % TeX-master: t
3375 % TeX-engine: luatex-dev
3376 % eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx"))
3377 % End: