Debian Codegraph @

texmf-dist/tex/latex/memoir/memoir.cls

raw
1 %%
2 %% This is file `memoir.cls',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% memoir.dtx (with options: `class')
8 %%
9 %% Author: Peter Wilson (herries dot press at earthlink dot net)
10 %% Herries Press
11 %% Copyright 2001--2011 Peter R. Wilson
12 %% Copyright 2013-- Lars Madsen
13 %% Maintainer: Lars Madsen (daleif at math dot au dot dk)
14 %%
15 %%
16 %% This work may be distributed and/or modified under the
17 %% conditions of the LaTeX Project Public License, either
18 %% version 1.3 of this license or (at your option) any
19 %% later version.
20 %% The latest version of the license is in
21 %% http://www.latex-project.org/lppl.txt
22 %% and version 1.3 or later is part of all distributions of
23 %% LaTeX version 2003/06/01 or later.
24 %%
25 %% This work has the LPPL maintenance status "maintained".
26 %%
27 %% This work consists of the files listed in the README file.
28 %%
29 \def\mem@atleast@kernel{2023/06/01}
30 \NeedsTeXFormat{LaTeX2e}[\mem@atleast@kernel]
31 \ProvidesClass{memoir}%
32 [2025/11/04 v3.8.4b configurable book, report, article document class]
33 \newcommand\memversion{v3.8.4b, 2025/11/04}
34 \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
35 \IfFormatAtLeastTF{\mem@atleast@kernel}{}{
36 \ClassError{memoir}{%
37 Your LaTeX release is too old.\MessageBreak
38 The memoir class requires at LaTeX format\MessageBreak
39 from at least \mem@atleast@kernel\space onwards.
40 Please update your\MessageBreak
41 entire LaTeX installation instead of manually updating\MessageBreak
42 just memoir}{}
43 \batchmode\read-1to\@tempa% evil mode engaged
44 }
45 \RequirePackage{xpatch}
46 \ExplSyntaxOn
47 \NewDocumentCommand\MarkDeprecated{smm}{
48 % see if macro exists, if so don't give warning
49 \cs_if_exist:cTF {__memoir_deprecated_\cs_to_str:N #2:}{}{% already showed one warning
50 % marker macro did not exist, globally define it and give warning
51 \IfBooleanF{#1}{\cs_gset:cn {__memoir_deprecated_\cs_to_str:N #2:}{}}
52 \@memwarn{
53 \string#2~is~marked~deprecated~and~will~be\MessageBreak
54 removed~#3
55 }
56 }
57 }
58 \ExplSyntaxOff
59
60 \newcommand*{\@ptsize}{}
61 \newcommand*{\@memptsize}{}
62 \newlength{\onelineskip}
63 \newlength{\lxvchars}
64 \newlength{\xlvchars}
65 \newcount\@memcnta
66 \newcounter{@memmarkcntra}
67 \newif\if@restonecol
68 \newif\if@openright
69 \@openrighttrue
70
71 \newif\if@openleft
72 \@openleftfalse
73
74 \newif\if@mainmatter
75 \@mainmattertrue
76
77 \newif\if@memoldfont
78 \@memoldfontfalse
79
80 \newif\ifextrafontsizes
81 \extrafontsizesfalse
82
83 \newcommand*{\@memerror}{\ClassError{memoir}}
84 \newcommand*{\@memwarn}{\ClassWarning{memoir}}
85
86 \newif\ifsamename
87 \newcommand{\nametest}[2]{%
88 \samenamefalse%
89 \begingroup%
90 \def\@memtempa{#1}\def\@memtempb{#2}%
91 \ifx \@memtempa\@memtempb%
92 \endgroup%
93 \samenametrue%
94 \else%
95 \endgroup%
96 \fi}
97
98 \newif\ifm@m@And
99 \newif\ifm@m@Or
100 \newif\ifm@m@Xor
101
102 \newcommand{\@name@p@xdef}[1]{%
103 \expandafter\protected@xdef\csname #1\endcsname}
104 \newcommand{\@name@unresp@xdef}[1]{%
105 \expandafter\unrestored@protected@xdef\csname #1\endcsname}
106 \newcommand{\@namelet}[1]{%
107 \expandafter\let\csname #1\endcsname}
108 \newcommand{\@namelongdef}[1]{%
109 \long\expandafter\def\csname #1\endcsname}
110 \newcommand*{\memletcmdtxt}[2]{\expandafter\let\expandafter#1\csname#2\endcsname}
111 \newcommand*{\memlettxttxt}[1]{\expandafter\memletcmdtxt\csname#1\endcsname}
112 \newcommand*{\memlettxtcmd}[2]{\expandafter\let\csname#1\endcsname#2}
113 \newcommand{\@nameedef}[1]{%
114 \expandafter\protected@edef\csname #1\endcsname}
115
116 \newcommand{\memjustarg}[1]{#1}
117 \newcommand{\memgobble}[1]{}
118
119 \newcommand\memsetmacroused[1]{%
120 \@namedef{mem@macro@used@\expandafter\@gobble\string#1}{00}}
121 \newcommand\memsetmacrounused[1]{%
122 \@namedef{mem@macro@used@\expandafter\@gobble\string#1}{01}}
123 \newcommand\memifmacroused[1]{%
124 \if\@nameuse{mem@macro@used@\expandafter\@gobble\string#1}%
125 \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
126
127 \newcommand\memsetlengthmin[3]{\ifdim#2<#3\setlength{#1}{#2}\else\setlength{#1}{#3}\fi}
128 \newcommand\memsetlengthmax[3]{\ifdim#2>#3\setlength{#1}{#2}\else\setlength{#1}{#3}\fi}
129
130 \NewHook{memoir/subcaption/aftercounter}
131
132 \newcommand*{\@memfakeusepackage}[1]{%
133 \@namelet{ver@#1.sty}\@empty}
134
135 \providecommand*{\EmulatedPackage}{}
136 \renewcommand*{\EmulatedPackage}[1]{%
137 \@ifnextchar[{\@emulated@package{#1}}%
138 {\@emulated@package{#1}[\@empty]}%]
139 }
140 \providecommand*{\EmulatedPackageWithOptions}{}
141 \renewcommand*{\EmulatedPackageWithOptions}[2]{%
142 \PassOptionsToPackage{#1}{#2}%
143 \EmulatedPackage{#2}%
144 }
145 \def\@emulated@package#1[#2]{%
146 \expandafter\xdef\csname ver@#1.\@pkgextension\endcsname{#2}%
147 \@ifundefined{opt@#1.\@pkgextension}%
148 {\@namedef{opt@#1.\@pkgextension}{}}{}%
149 \wlog{Package #1 \ifx\@empty#2\else[#2] \fi
150 \if,\csname opt@#1.\@pkgextension\endcsname,\else
151 (with options \csname opt@#1.\@pkgextension\endcsname) \fi
152 emulated by \@currname.}%
153 }
154 \@onlypreamble\EmulatedPackage
155 \@onlypreamble\EmulatedPackageWithOptions
156 \@onlypreamble\@emulated@package
157
158 \newcommand*{\DisemulatePackage}[1]{%
159 \@namelet{ver@#1.\@pkgextension}\relax
160 }
161 \@onlypreamble\DisemulatePackage
162
163 \newcommand\AtBeginFile[2]{\def\temp{\AddToHook{file/#1/before}{#2}}\temp}
164 \newcommand\AtEndFile[2]{\def\temp{\AddToHook{file/#1/after}{#2}}\temp}
165
166 \newcommand\AtBeginPackage[2]{\def\temp{\AddToHook{package/#1/before}{#2}}\temp}
167 \newcommand\AtEndPackage[2]{\def\temp{\AddToHook{package/#1/after}{#2}}\temp}
168 \newcommand{\RequireAtEndPackage}[2]{%
169 \@ifpackageloaded{#1}{#2}{\AtEndPackage{#1}{#2}}}
170
171 \newcommand\AtBeginClass[2]{\def\temp{\AddToHook{class/#1/before}{#2}}\temp}
172 \newcommand\AtEndClass[2]{\def\temp{\AddToHook{class/#1/after}{#2}}\temp}
173 \newcommand{\RequireAtEndClass}[2]{%
174 \@ifclassloaded{#1}{#2}{\AtEndClass{#1}{#2}}}
175
176 \newcommand{\phantomsection}{}
177
178 \renewcommand*{\nofiles}{%
179 \@fileswfalse% flag for suppressing \immediate \writes
180 \typeout{No auxiliary output files.^^J}%
181 \long\def\protected@write##1##2##3%
182 {\write\m@ne{}\if@nobreak\ifvmode\nobreak\fi\fi}%
183 }
184
185 \newcommand*{\memsetcounter}[2]{\setcounter{#1}{#2}}
186 \AtBeginDocument{\immediate\write\@mainaux{%
187 \string\providecommand*{\string\memsetcounter}[2]{}}}
188
189 \def\bs{\texttt{\char`\\}}
190 \ifx\l@nohyphenation\undefined
191 \newlanguage\l@nohyphenation
192 \fi
193 \DeclareRobustCommand{\meta}[1]{%
194 \ensuremath\langle
195 \ifmmode \expandafter \nfss@text \fi
196 {%
197 \meta@font@select
198 \edef\meta@hyphen@restore
199 {\hyphenchar\the\font\the\hyphenchar\font}%
200 \hyphenchar\font\m@ne
201 \language\l@nohyphenation
202 #1\/%
203 \meta@hyphen@restore
204 }\ensuremath\rangle
205 }
206 \def\meta@font@select{\itshape}
207
208 \DeclareRobustCommand{\marg}[1]{%
209 {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
210 \DeclareRobustCommand{\oarg}[1]{%
211 {\ttfamily\char`\[}\meta{#1}{\ttfamily\char`\]}}
212 \DeclareRobustCommand{\parg}[1]{%
213 {\ttfamily\char`\(}\meta{#1}{\ttfamily\char`\)}}
214 \DeclareRobustCommand{\cs}[1]{\texttt{\char`\\#1}}
215 \newcommand{\cmdprint}[1]{\texttt{\string#1}}
216 \newcommand{\cmd}[1]{\cmdprint{#1}%
217 \index{\expandafter\@gobble\string#1?\string\cmdprint{\string#1}}}
218
219 \RequirePackage{iftex}[2019/11/07]
220 \edef\wo@dmacro{%
221 \string m\string a\string c\string r\string o\string :%
222 }
223
224 \def\wo@difmacro@begingroup#1{%
225 \begingroup
226 \edef\x{%
227 \noexpand\wo@dparsemacro\meaning#1\wo@dmacro\string -%
228 }%
229 \x\@nil{#1}%
230 }
231
232 \begingroup
233 \edef\x{\endgroup
234 \def\noexpand\wo@dparsemacro##1\wo@dmacro##2\string -}%
235 \x#3\@nil#4{%
236 \ifx\\#3\\%
237 \endgroup
238 \@memwarn{\string `\string #4\string ' is not a macro}%
239 \expandafter\@gobble
240 \else
241 \expandafter\@firstofone
242 \fi
243 }
244
245 \def\addtodef{%
246 \MarkDeprecated{\addtodef}{in 2026, use instead \string\patchcmd,\MessageBreak%
247 \string\pretocmd\space or \string\apptocmd\space from the etoolbox package\MessageBreak%
248 (which is autoloaded by the class)}
249 \@star@or@long\wo@daddtodef}
250 \long\def\wo@daddtodef#1#2#3{%
251 \wo@difmacro@begingroup{#1}{%
252 \@temptokena{#2}%
253 \toks@\expandafter{#1#3}%
254 \edef\x{\endgroup
255 \l@ngrel@x\def\noexpand#1{\the\@temptokena \the\toks@}}%
256 \x
257 }%
258 }
259
260 \def\addtoiargdef{%
261 \MarkDeprecated{\addtoiargdef}{in 2026, use instead \string\patchcmd,\MessageBreak%
262 \string\pretocmd\space or \string\apptocmd\space from the etoolbox package\MessageBreak%
263 (which is autoloaded by the class)}
264 \@star@or@long\wo@daddtoiargdef}
265 \long\def\wo@daddtoiargdef#1#2#3{%
266 \wo@difmacro@begingroup{#1}{%
267 \@temptokena{#2}%
268 \toks@\expandafter{#1{##1}#3}%
269 \edef\x{\endgroup
270 \l@ngrel@x\def\noexpand#1####1{\the\@temptokena \the\toks@}}%
271 \x
272 }%
273 }
274
275 %%%%%%%%%%%%%%%% Michael Downes' patchcmd 2000/07/31 v1.03 %%%%%%%%
276 \newcommand{\patchcommand}[1]{%
277 \MarkDeprecated{\patchcommand}{in 2026, use instead \string\patchcmd,\MessageBreak%
278 \string\pretocmd\space or \string\apptocmd\space from the etoolbox package\MessageBreak%
279 (which is autoloaded by the class)}
280 \expandafter\patchcmd@a\meaning#1??->@\@nil#1%
281 }
282 \long\def\patchcmd@a#1#2#3->#4#5\@nil#6{%
283 \ifx @#4\relax \patchcmdError#6#1%
284 \expandafter\@gobbletwo % discard the other two arguments
285 \else
286 \if l#2\toks@{\patchcmd@e{}#6}% l in this position means \long
287 \else \toks@{\patchcmd@e*#6}% not \long
288 \fi
289 \patchcmd@b #3@#4#5 ? ? ? \@nil#6%
290 \expandafter\the\expandafter\toks@
291 \fi}
292 \def\patchcmd@b#1:#2@#3#4 #5#6 #7 #8\@nil#9{%
293 \if \ifx @#7@\expandafter
294 \ifx\csname #6\endcsname#9T\else F\fi\else F\fi T%
295 \toks@\expandafter{\expandafter\patchcommand\csname #6 \endcsname}%
296 \else
297 \ifx @#2@% No arguments
298 \toks@\expandafter{\the\toks@ 0}%
299 \else
300 \patchcmd@c 0#2{\string##}0%
301 \fi
302 \fi}
303 \def\patchcmd@c#1#2#3{%
304 \if\string###2% % yes it's a # token
305 \ifodd 0#31 % and it's followed by a number
306 \if 0#3\patchcmd@d#1\fi % number=0? then we're done
307 \else \patchcmd@d D% # not a number: must be a delimited arg
308 \fi
309 \else \patchcmd@d D% not a # token: must be a delmited arg
310 \fi
311 \patchcmd@c#3}
312 \def\patchcmd@d#1{%
313 \if D#1%
314 %%% \PackageError{patchcmd}{Cannot change a macro that has
315 %%% delimited arguments}\@ehd
316 \@memerror{%
317 Cannot change a macro that has delimited arguments}{\@ehd}
318 \else
319 \toks@\expandafter{\the\toks@ #1}%
320 \fi
321 \begingroup
322 \aftergroup\@gobble
323 \let\patchcmd@c\endgroup}
324 \def\patchcmd@e#1#2#3#4#5{%
325 \begingroup
326 \edef\@##1{%
327 \@temptokena\noexpand\expandafter{%
328 \noexpand#2%
329 \ifnum#3>0 {####1}\ifnum#3>1 {####2}\ifnum#3>2 {####3}%
330 \ifnum#3>3 {####4}\ifnum#3>4 {####5}\ifnum#3>5 {####6}%
331 \ifnum#3>6 {####7}\ifnum#3>7 {####8}\ifnum#3>8 {####9}%
332 \fi\fi\fi\fi\fi\fi\fi\fi\fi
333 ##1%
334 }%
335 }
336 \@{#5}%
337 \edef\@##1{\endgroup
338 \noexpand\renewcommand#1\noexpand#2\ifcase#3 \else [#3]\fi
339 {##1\the\@temptokena}}%
340 \@{#4}%
341 }
342 \long\def\patchcmdError#1#2{%
343 \begingroup
344 \toks@{Not redefinable}%
345 \ifcat\relax\noexpand#1% Is it a control sequence?
346 \begingroup
347 \let#1=?\ifx ?\relax % Is it "\relax"?
348 \endgroup % accept current value of \toks@
349 \else \endgroup
350 \if\ifx\relax#1u\else #2\fi u%
351 \toks@{Not defined}%
352 \fi
353 \fi
354 \fi
355 \edef\@{\endgroup
356 %%% \noexpand\PackageError{patchcmd}{%
357 %%% \the\toks@: \string#1}\noexpand\@ehd}%
358 \noexpand\@memerror{%
359 \the\toks@: \string#1}\noexpand\@ehd}%
360 \@}
361
362 %%%%%%%%%%%%%%%%%%%%% end of patchcmd code %%%%%%%%%%%%%%%%%%%%%%%%%%%
363
364 %%\@memfakeusepackage{patchcmd}
365
366 \newcommand*{\memRTLleftskip}{\leftskip}
367 \newcommand*{\memRTLrightskip}{\rightskip}
368 \newcommand*{\memRTLvleftskip}{\vleftskip}
369 \newcommand*{\memRTLvrightskip}{\vrightskip}
370 \newcommand*{\memRTLraggedright}{\raggedright}
371 \newcommand*{\memRTLraggedleft}{\raggedleft}
372 \newcommand*{\memRTLmainraggedright}{\raggedright}
373 \newcommand*{\memRTLmainraggedleft}{\raggedleft}
374
375 % secret extra option for testing stuff in the wild
376 % caution 1: patching inside \ifmem@devmode ... \fi requires that all
377 % if statements in the patch are blanced
378 % caution 2: pathing inside \mem@devmode@run{ ... }{} does not work
379 % if the search pattern contains #<num>
380 % thus added both variants
381 \newif\ifmem@devmode
382 \let\mem@devmode@run\@secondoftwo
383 \DeclareOption{dev-mode}{\let\mem@devmode@run\@firstoftwo\mem@devmodetrue}
384
385 \@ifundefined{stockwidth}{\newdimen{\stockheight}}{}
386 \@ifundefined{stockwidth}{\newdimen{\stockwidth}}{}
387 \newlength{\trimtop}
388 \newlength{\trimedge}
389
390 \newcommand*{\stockdbill} {\stockheight=7in \stockwidth=3in}
391 \newcommand*{\stockstatement} {\stockheight=8.5in \stockwidth=5.5in}
392 \newcommand*{\stockexecutive} {\stockheight=10.5in \stockwidth=7.25in}
393 \newcommand*{\stockletter} {\stockheight=11in \stockwidth=8.5in}
394 \newcommand*{\stockold} {\stockheight=12in \stockwidth=9in}
395 \newcommand*{\stocklegal} {\stockheight=14in \stockwidth=8.5in}
396 \newcommand*{\stockledger} {\stockheight=17in \stockwidth=11in}
397 \newcommand*{\stockbroadsheet}{\stockheight=22in \stockwidth=17in}
398
399 \newcommand*{\stockpottvo} {\stockheight=6.25in \stockwidth=4in}
400 \newcommand*{\stockfoolscapvo} {\stockheight=6.75in \stockwidth=4.25in}
401 \newcommand*{\stockcrownvo} {\stockheight=7.5in \stockwidth=5in}
402 \newcommand*{\stockpostvo} {\stockheight=8in \stockwidth=5in}
403 \newcommand*{\stocklargecrownvo}{\stockheight=8in \stockwidth=5.25in}
404 \newcommand*{\stocklargepostvo} {\stockheight=8.25in \stockwidth=5.25in}
405 \newcommand*{\stocksmalldemyvo} {\stockheight=8.5in \stockwidth=5.675in}
406 \newcommand*{\stockdemyvo} {\stockheight=8.75in \stockwidth=5.675in}
407 \newcommand*{\stockmediumvo} {\stockheight=9in \stockwidth=5.75in}
408 \newcommand*{\stocksmallroyalvo}{\stockheight=9.25in \stockwidth=6.175in}
409 \newcommand*{\stockroyalvo} {\stockheight=10in \stockwidth=6.25in}
410 \newcommand*{\stocksuperroyalvo}{\stockheight=10.25in \stockwidth=6.75in}
411 \newcommand*{\stockimperialvo} {\stockheight=11in \stockwidth=7.5in}
412
413 \newcommand*{\stockmcrownvo} {\stockheight=186mm \stockwidth=123mm}
414 \newcommand*{\stockmlargecrownvo} {\stockheight=198mm \stockwidth=129mm}
415 \newcommand*{\stockmdemyvo} {\stockheight=216mm \stockwidth=138mm}
416 \newcommand*{\stockmsmallroyalvo} {\stockheight=234mm \stockwidth=156mm}
417
418 \newcommand*{\stockao} {\stockheight=1189mm \stockwidth=841mm}
419 \newcommand*{\stockai} {\stockheight=841mm \stockwidth=594mm}
420 \newcommand*{\stockaii} {\stockheight=594mm \stockwidth=420mm}
421 \newcommand*{\stockaiii}{\stockheight=420mm \stockwidth=297mm}
422 \newcommand*{\stockaiv} {\stockheight=297mm \stockwidth=210mm}
423 \newcommand*{\stockav} {\stockheight=210mm \stockwidth=148mm}
424 \newcommand*{\stockavi} {\stockheight=148mm \stockwidth=105mm}
425 \newcommand*{\stockavii}{\stockheight=105mm \stockwidth=74mm}
426
427 \newcommand*{\stockbo} {\stockheight=1414mm \stockwidth=1000mm}
428 \newcommand*{\stockbi} {\stockheight=1000mm \stockwidth=707mm}
429 \newcommand*{\stockbii} {\stockheight=707mm \stockwidth=500mm}
430 \newcommand*{\stockbiii}{\stockheight=500mm \stockwidth=353mm}
431 \newcommand*{\stockbiv} {\stockheight=353mm \stockwidth=250mm}
432 \newcommand*{\stockbv} {\stockheight=250mm \stockwidth=176mm}
433 \newcommand*{\stockbvi} {\stockheight=176mm \stockwidth=125mm}
434 \newcommand*{\stockbvii}{\stockheight=125mm \stockwidth=88mm}
435
436 \newcommand*{\pagedbill} {\paperheight=7in \paperwidth=3in}
437 \newcommand*{\pagestatement} {\paperheight=8.5in \paperwidth=5.5in}
438 \newcommand*{\pageexecutive} {\paperheight=10.5in \paperwidth=7.25in}
439 \newcommand*{\pageletter} {\paperheight=11in \paperwidth=8.5in}
440 \newcommand*{\pageold} {\paperheight=12in \paperwidth=9in}
441 \newcommand*{\pagelegal} {\paperheight=14in \paperwidth=8.5in}
442 \newcommand*{\pageledger} {\paperheight=17in \paperwidth=11in}
443 \newcommand*{\pagebroadsheet}{\paperheight=22in \paperwidth=17in}
444
445 \newcommand*{\pagepottvo} {\paperheight=6.25in \paperwidth=4in}
446 \newcommand*{\pagefoolscapvo} {\paperheight=6.75in \paperwidth=4.25in}
447 \newcommand*{\pagecrownvo} {\paperheight=7.5in \paperwidth=5in}
448 \newcommand*{\pagepostvo} {\paperheight=8in \paperwidth=5in}
449 \newcommand*{\pagelargecrownvo}{\paperheight=8in \paperwidth=5.25in}
450 \newcommand*{\pagelargepostvo} {\paperheight=8.25in \paperwidth=5.25in}
451 \newcommand*{\pagesmalldemyvo} {\paperheight=8.5in \paperwidth=5.675in}
452 \newcommand*{\pagedemyvo} {\paperheight=8.75in \paperwidth=5.675in}
453 \newcommand*{\pagemediumvo} {\paperheight=9in \paperwidth=5.75in}
454 \newcommand*{\pagesmallroyalvo}{\paperheight=9.25in \paperwidth=6.175in}
455 \newcommand*{\pageroyalvo} {\paperheight=10in \paperwidth=6.25in}
456 \newcommand*{\pagesuperroyalvo}{\paperheight=10.25in \paperwidth=6.75in}
457 \newcommand*{\pageimperialvo} {\paperheight=11in \paperwidth=7.5in}
458
459 \newcommand*{\pagemcrownvo} {\paperheight=186mm \paperwidth=123mm}
460 \newcommand*{\pagemlargecrownvo} {\paperheight=198mm \paperwidth=129mm}
461 \newcommand*{\pagemdemyvo} {\paperheight=216mm \paperwidth=138mm}
462 \newcommand*{\pagemsmallroyalvo} {\paperheight=234mm \paperwidth=156mm}
463
464 \newcommand*{\pageao} {\paperheight=1189mm \paperwidth=841mm}
465 \newcommand*{\pageai} {\paperheight=841mm \paperwidth=594mm}
466 \newcommand*{\pageaii} {\paperheight=594mm \paperwidth=420mm}
467 \newcommand*{\pageaiii}{\paperheight=420mm \paperwidth=297mm}
468 \newcommand*{\pageaiv} {\paperheight=297mm \paperwidth=210mm}
469 \newcommand*{\pageav} {\paperheight=210mm \paperwidth=148mm}
470 \newcommand*{\pageavi} {\paperheight=148mm \paperwidth=105mm}
471 \newcommand*{\pageavii}{\paperheight=105mm \paperwidth=74mm}
472
473 \newcommand*{\pagebo} {\paperheight=1414mm \paperwidth=1000mm}
474 \newcommand*{\pagebi} {\paperheight=1000mm \paperwidth=707mm}
475 \newcommand*{\pagebii} {\paperheight=707mm \paperwidth=500mm}
476 \newcommand*{\pagebiii}{\paperheight=500mm \paperwidth=353mm}
477 \newcommand*{\pagebiv} {\paperheight=353mm \paperwidth=250mm}
478 \newcommand*{\pagebv} {\paperheight=250mm \paperwidth=176mm}
479 \newcommand*{\pagebvi} {\paperheight=176mm \paperwidth=125mm}
480 \newcommand*{\pagebvii}{\paperheight=125mm \paperwidth=88mm}
481
482 \DeclareOption{a0paper}{\stockao}
483 \DeclareOption{a1paper}{\stockai}
484 \DeclareOption{a2paper}{\stockaii}
485 \DeclareOption{a3paper}{\stockaiii}
486 \DeclareOption{a4paper}{\stockaiv}
487 \DeclareOption{a5paper}{\stockav}
488 \DeclareOption{a6paper}{\stockavi}
489 \DeclareOption{a7paper}{\stockavii}
490 \DeclareOption{b0paper}{\stockbo}
491 \DeclareOption{b1paper}{\stockbi}
492 \DeclareOption{b2paper}{\stockbii}
493 \DeclareOption{b3paper}{\stockbiii}
494 \DeclareOption{b4paper}{\stockbiv}
495 \DeclareOption{b5paper}{\stockbv}
496 \DeclareOption{b6paper}{\stockbvi}
497 \DeclareOption{b7paper}{\stockbvii}
498 \DeclareOption{mcrownvopaper}{\stockmcrownvo}
499 \DeclareOption{mlargecrownvopaper}{\stockmlargecrownvo}
500 \DeclareOption{mdemyvopaper}{\stockmdemyvo}
501 \DeclareOption{msmallroyalvopaper}{\stockmsmallroyalvo}
502
503 \DeclareOption{dbillpaper}{\stockdbill}
504 \DeclareOption{statementpaper}{\stockstatement}
505 \DeclareOption{executivepaper}{\stockexecutive}
506 \DeclareOption{letterpaper}{\stockletter}
507 \DeclareOption{oldpaper}{\stockold}
508 \DeclareOption{legalpaper}{\stocklegal}
509 \DeclareOption{ledgerpaper}{\stockledger}
510 \DeclareOption{broadsheetpaper}{\stockbroadsheet}
511
512 \DeclareOption{pottvopaper}{\stockpottvo}
513 \DeclareOption{foolscapvopaper}{\stockfoolscapvo}
514 \DeclareOption{crownvopaper}{\stockcrownvo}
515 \DeclareOption{postvopaper}{\stockpostvo}
516 \DeclareOption{largecrownvopaper}{\stocklargecrownvo}
517 \DeclareOption{largepostvopaper}{\stocklargepostvo}
518 \DeclareOption{smalldemyvopaper}{\stocksmalldemyvo}
519 \DeclareOption{demyvopaper}{\stockdemyvo}
520 \DeclareOption{mediumvopaper}{\stockmediumvo}
521 \DeclareOption{smallroyalvopaper}{\stocksmallroyalvo}
522 \DeclareOption{royalvopaper}{\stockroyalvo}
523 \DeclareOption{superroyalvopaper}{\stocksuperroyalvo}
524 \DeclareOption{imperialvopaper}{\stockimperialvo}
525
526 \DeclareOption{ebook}
527 {\setlength\stockheight {9in}%
528 \setlength\stockwidth {6in}}
529
530 \newif\ifmemlandscape
531 \memlandscapefalse
532 \DeclareOption{landscape}{\memlandscapetrue}
533 \DeclareOption{portrait}{\memlandscapefalse}
534
535 \renewcommand*{\@ptsize}{0}
536 \renewcommand*{\@memptsize}{10}
537 \DeclareOption{9pt}{\renewcommand*{\@ptsize}{9}\renewcommand*{\@memptsize}{9}}
538 \DeclareOption{10pt}{\renewcommand*{\@ptsize}{0}\renewcommand*{\@memptsize}{10}}
539 \DeclareOption{11pt}{\renewcommand*{\@ptsize}{1}\renewcommand*{\@memptsize}{11}}
540 \DeclareOption{12pt}{\renewcommand*{\@ptsize}{2}\renewcommand*{\@memptsize}{12}}
541 \DeclareOption{14pt}{\renewcommand*{\@ptsize}{4}\renewcommand*{\@memptsize}{14}}
542 \DeclareOption{17pt}{\renewcommand*{\@ptsize}{7}\renewcommand*{\@memptsize}{17}}
543 \DeclareOption{20pt}{\renewcommand*{\@ptsize}{20}\renewcommand*{\@memptsize}{20}}
544 \DeclareOption{25pt}{\renewcommand*{\@ptsize}{25}\renewcommand*{\@memptsize}{25}}
545 \DeclareOption{30pt}{\renewcommand*{\@ptsize}{30}\renewcommand*{\@memptsize}{30}}
546 \DeclareOption{36pt}{\renewcommand*{\@ptsize}{36}\renewcommand*{\@memptsize}{36}}
547 \DeclareOption{48pt}{\renewcommand*{\@ptsize}{48}\renewcommand*{\@memptsize}{48}}
548 \DeclareOption{60pt}{\renewcommand*{\@ptsize}{60}\renewcommand*{\@memptsize}{60}}
549
550 \newif\if@nyptsizeopt
551 \@nyptsizeoptfalse
552 \providecommand*{\anyptfilebase}{mem}
553 \providecommand*{\anyptsize}{10}
554 \DeclareOption{*pt}{\@nyptsizeopttrue}
555
556 \DeclareOption{twoside}{\@twosidetrue \@mparswitchtrue}
557 \DeclareOption{oneside}{\@twosidefalse \@mparswitchfalse}
558 \DeclareOption{onecolumn}{\@twocolumnfalse}
559 \DeclareOption{twocolumn}{\@twocolumntrue}
560 \newif\ifdraftdoc\draftdocfalse
561 \setlength{\overfullrule}{\z@}
562 \DeclareOption{final}{\setlength{\overfullrule}{\z@}
563 \draftdocfalse
564 \msdocfalse}
565 \DeclareOption{draft}{\setlength\overfullrule{5pt}%
566 \draftdoctrue
567 \msdocfalse}
568 \newif\ifmsdoc
569 \msdocfalse
570 \DeclareOption{ms}{%
571 \msdoctrue
572 \draftdocfalse
573 \setlength\overfullrule{\z@}
574 }
575
576 \newif\ifshowtrims
577 \showtrimsfalse
578 \DeclareOption{showtrims}{\showtrimstrue}
579
580 \newif\ifartopt
581 \artoptfalse
582 \DeclareOption{article}{\artopttrue}
583
584 \DeclareOption{openright}{\@openrighttrue}
585 \DeclareOption{openany}{\@openrightfalse}
586 \DeclareOption{openleft}{\@openlefttrue}
587 \newcommand{\openright}{\@openrighttrue\@openleftfalse%
588 \gdef\clearforchapter{\cleartorecto}}
589 \newcommand{\openany}{\@openrightfalse\@openleftfalse%
590 \gdef\clearforchapter{\clearpage}}
591 \newcommand{\openleft}{\@openlefttrue
592 \gdef\clearforchapter{\cleartoverso}}
593
594 \DeclareOption{leqno}{\input{leqno.clo}}
595 \DeclareOption{fleqn}{\input{fleqn.clo}}
596 \DeclareOption{openbib}{%
597 \AtEndOfClass{%
598 \renewcommand\@openbib@code{%
599 \advance\leftmargin\bibindent
600 \itemindent -\bibindent
601 \listparindent \itemindent
602 \parsep \z@
603 }%
604 \renewcommand\newblock{\par}}}
605
606 \DeclareOption{oldfontcommands}{\@memoldfonttrue}
607 \DeclareOption{extrafontsizes}{\extrafontsizestrue}
608
609 \newcommand\mem@settopoint[1]{\@settopoint{#1}}
610 \DeclareOption{fullptlayout}{\renewcommand\mem@settopoint{\@gobble}}
611
612 \ExecuteOptions{final,letterpaper,10pt,onecolumn,openright,twoside,
613 portrait}
614 \ProcessOptions*
615
616 \ifmemlandscape
617 \setlength\@tempdima {\stockheight}
618 \setlength\stockheight{\stockwidth}
619 \setlength\stockwidth {\@tempdima}
620 \fi
621
622
623 \providecommand*{\memoirpostopthook}{}
624 \memoirpostopthook
625
626 \def\cleartorecto{\clearpage\if@twoside \ifodd\c@page\else
627 \hbox{}\thispagestyle{cleared}%
628 \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
629
630 \def\cleartoverso{\clearpage\if@twoside
631 \ifodd\c@page\hbox{}\thispagestyle{cleared}%
632 \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
633
634
635 \if@openleft
636 \openleft
637 \else
638 \if@openright
639 \openright
640 \else
641 \openany
642 \fi
643 \fi
644
645 \newcommand*{\@ivpt}{4}
646 \newcommand*{\@xxxpt}{30}
647 \newcommand*{\@xxxvipt}{36}
648 \newcommand*{\@xlviiipt}{48}
649 \newcommand*{\@lxpt}{60}
650 \newcommand*{\@lxxiipt}{72}
651 \newcommand*{\@lxxxivpt}{84}
652 \newcommand*{\@xcvipt}{96}
653 \newcommand*{\@cviiipt}{108}
654 \newcommand*{\@cxxpt}{120}
655 \newcommand*{\@cxxxiipt}{132}
656
657 \providecommand*{\memfontfamily}{lmr}
658 \providecommand*{\memfontenc}{T1}
659 \providecommand*{\memfontpack}{lmodern}
660
661 \if@nyptsizeopt
662 \newcommand*{\@nyptclofile}{\anyptfilebase\anyptsize.clo}
663 \IfFileExists{\@nyptclofile}{\def\@memptsize{\anyptsize}}{%
664 \@memerror{You have used the `*pt' option but \MessageBreak
665 file \@nyptclofile\space can't be found}%
666 {I'll use mem10.clo instead}
667 \renewcommand*{\@nyptclofile}{mem10.clo}%
668 \def\@memptsize{10}%
669 }
670 \renewcommand*{\@ptsize}{\@memptsize}
671 \usefont{\memfontenc}{\memfontfamily}{m}{n}
672 \input{\@nyptclofile}
673 \RequirePackage{\memfontpack}
674 \iftutex\else
675 \RequirePackage[\memfontenc]{fontenc}
676 \fi
677 \else
678 \ifextrafontsizes
679 \usefont{\memfontenc}{\memfontfamily}{m}{n}
680 \input{mem\@memptsize.clo}
681 \RequirePackage{\memfontpack}
682 \iftutex\else
683 \RequirePackage[\memfontenc]{fontenc}
684 \fi
685 \else
686 \ifnum\@memptsize > 17\relax
687 \@memerror{The `extrafontsizes' option is required to use \MessageBreak
688 the `\@memptsize pt' option}%
689 {The 17pt option will be used instead}
690 \input{mem17.clo}
691 \else
692 \ifnum\@ptsize = 9\relax
693 \input{mem\@ptsize.clo}
694 \else
695 \input{mem1\@ptsize.clo}
696 \fi
697 \fi
698 \fi
699 \fi
700
701 \newcommand{\captionsize}{\normalsize}
702 \setlength\lineskip{1\p@}
703 \setlength\normallineskip{1\p@}
704 \renewcommand{\baselinestretch}{}
705 \setlength\parskip{0\p@ \@plus \p@}
706 \@lowpenalty 51
707 \@medpenalty 151
708 \@highpenalty 301
709 \clubpenalty 1000
710 \widowpenalty 1000
711 \newcommand*{\setlxvchars}[1][\normalfont]{\begingroup
712 #1
713 \settowidth{\lxvchars}{abcdefghijklmnopqrstuvwxyz}%
714 \setlength{\lxvchars}{2.042\lxvchars}%
715 \addtolength{\lxvchars}{33.41pt}%
716 \global\lxvchars=\lxvchars
717 \endgroup}
718 \newcommand*{\setxlvchars}[1][\normalfont]{\begingroup
719 #1
720 \settowidth{\xlvchars}{abcdefghijklmnopqrstuvwxyz}%
721 \setlength{\xlvchars}{1.415\xlvchars}%
722 \addtolength{\xlvchars}{23.03pt}%
723 \global\xlvchars=\xlvchars
724 \endgroup}
725
726 \newcommand*{\setrectanglesize}[3]{%
727 \nametest{#1}{*}%
728 \ifsamename % H = *
729 \nametest{#2}{*}%
730 \ifsamename % W = *
731 \@memerror{%
732 The combination of argument values is ambiguous.\MessageBreak
733 The lengths will be set to zero}{\@ehd}%
734 \setlength{\@tempdima}{0pt}%
735 \setlength{\@tempdimb}{0pt}%
736 \else % W
737 \nametest{#3}{*}%
738 \ifsamename % r = *
739 \setlength{\@tempdimb}{#2}%
740 \setlength{\@tempdima}{\@tempdimb}%
741 \else % r
742 \setlength{\@tempdimb}{#2}%
743 \setlength{\@tempdima}{#3\@tempdimb}%
744 \fi
745 \fi
746 \else % H
747 \nametest{#2}{*}%
748 \ifsamename % W = *
749 \nametest{#3}{*}%
750 \ifsamename % r = *
751 \setlength{\@tempdima}{#1}%
752 \setlength{\@tempdimb}{\@tempdima}%
753 \else % r
754 \setlength{\@tempdima}{#1}%
755 \setlength{\@tempdimb}{#3\@tempdima}%
756 \fi
757 \else % W
758 \setlength{\@tempdima}{#1}%
759 \setlength{\@tempdimb}{#2}%
760 \fi
761 \fi}
762
763 \newcommand*{\setfillsize}[5]{%
764 \nametest{#2}{*}%
765 \ifsamename % C = *
766 \nametest{#3}{*}%
767 \ifsamename % L = *
768 \nametest{#4}{*}%
769 \ifsamename % R = *
770 \@memerror{%
771 The combination of argument values is ambiguous.\MessageBreak
772 The lengths will be set to zero}{\@ehd}
773 \setlength{\@tempdima}{0pt}%
774 \setlength{\@tempdimb}{0pt}%
775 \setlength{\@tempdimc}{0pt}%
776 \else % R
777 \nametest{#5}{*}%
778 \ifsamename % r = *
779 \setlength{\@tempdimb}{#4}%
780 \setlength{\@tempdima}{\@tempdimb}%
781 \setlength{\@tempdimc}{#1}%
782 \advance\@tempdimc -\@tempdima
783 \advance\@tempdimc -\@tempdimb
784 \else % r
785 \setlength{\@tempdimb}{#4}%
786 \setlength{\@tempdima}{#5\@tempdimb}%
787 \setlength{\@tempdimc}{#1}%
788 \advance\@tempdimc -\@tempdima
789 \advance\@tempdimc -\@tempdimb
790 \fi
791 \fi
792 \else % L
793 \nametest{#4}{*}%
794 \ifsamename % R = *
795 \nametest{#5}{*}%
796 \ifsamename % r = *
797 \setlength{\@tempdima}{#3}%
798 \setlength{\@tempdimb}{\@tempdima}
799 \setlength{\@tempdimc}{#1}%
800 \advance\@tempdimc -\@tempdima
801 \advance\@tempdimc -\@tempdimb
802 \else % r
803 \setlength{\@tempdima}{#3}%
804 \setlength{\@tempdimb}{#5\@tempdima}
805 \setlength{\@tempdimc}{#1}%
806 \advance\@tempdimc -\@tempdima
807 \advance\@tempdimc -\@tempdimb
808 \fi
809 \else % R
810 \setlength{\@tempdima}{#3}%
811 \setlength{\@tempdimb}{#4}%
812 \setlength{\@tempdimc}{#1}%
813 \advance\@tempdimc -\@tempdima
814 \advance\@tempdimc -\@tempdimb
815 \fi
816 \fi
817 \else % C is valued
818 \nametest{#3}{*}%
819 \ifsamename % L = *
820 \nametest{#4}{*}%
821 \ifsamename % R = *
822 \nametest{#5}{*}%
823 \ifsamename % r = *
824 \setlength{\@tempdimc}{#2}%
825 \setlength{\@tempdima}{#1}%
826 \advance\@tempdima -\@tempdimc
827 \@tempdima = 0.5\@tempdima
828 \@tempdimb = \@tempdima
829 \else % r (CODE PERHAPS FIXED)
830 \setlength{\@tempdimc}{#2} % C
831 \setlength{\@tempdimb}{#1} % T
832 \advance\@tempdimb -\@tempdimc % T - C
833 \@tempdima = 1000sp
834 \setlength{\@tempdima}{#5\@tempdima} % 1000r sp
835 \advance\@tempdima by 1000sp % 1000(1+r)sp
836 \@tempcnta = \@tempdima % 1000(1+r)
837 \@tempdima = \@tempdimb % T - C
838 \divide\@tempdima by \@tempcnta % (T-C)/1000(1+r) pts
839 \@tempdima = 1000\@tempdima % (T-C)/(1+r) pts = L
840 \advance\@tempdimb by -\@tempdima % = R
841 \fi
842 \else % R
843 \setlength{\@tempdimc}{#2}%
844 \setlength{\@tempdimb}{#4}%
845 \setlength{\@tempdima}{#1}%
846 \advance\@tempdima -\@tempdimc
847 \advance\@tempdima -\@tempdimb
848 \fi
849 \else % L
850 \nametest{#4}{*}%
851 \ifsamename % R = *
852 \setlength{\@tempdimc}{#2}%
853 \setlength{\@tempdima}{#3}%
854 \setlength{\@tempdimb}{#1}%
855 \advance\@tempdimb -\@tempdimc
856 \advance\@tempdimb -\@tempdima
857 \else % R
858 \@memerror{%
859 The combination of argument values is ambiguous.\MessageBreak
860 The lengths will be set to zero}{\@ehd}%
861 \setlength{\@tempdima}{0pt}%
862 \setlength{\@tempdimb}{0pt}%
863 \setlength{\@tempdimc}{#2}%
864 \fi
865 \fi
866 \fi}
867
868 \newcommand{\setstocksize}[2]{%
869 \setlength{\stockheight}{#1}%
870 \setlength{\stockwidth}{#2}}
871 \newcommand{\settrims}[2]{%
872 \setlength{\trimtop}{#1}%
873 \setlength{\trimedge}{#2}}
874 \newcommand{\settrimmedsize}[3]{%
875 \setrectanglesize{#1}{#2}{#3}%
876 \setlength{\paperheight}{\@tempdima}%
877 \setlength{\paperwidth}{\@tempdimb}}
878
879 \newcommand{\settypeblocksize}[3]{%
880 \memsetmacroused\settypeblocksize%
881 \setrectanglesize{#1}{#2}{#3}%
882 \setlength{\textheight}{\@tempdima}%
883 \setlength{\textwidth}{\@tempdimb}}
884
885 \newlength{\binding}
886 \newcommand*{\setbinding}[1]{\setlength{\binding}{#1}}
887 \setbinding{0pt}
888
889 \newlength{\spinemargin}
890 \newlength{\foremargin}
891 \newcommand{\setlrmargins}[3]{%
892 \memsetmacroused\setlrmargins%
893 \advance\paperwidth -\binding
894 \setfillsize{\paperwidth}{\textwidth}{#1}{#2}{#3}%
895 \setlength{\textwidth}{\@tempdimc}%
896 \setlength{\spinemargin}{\@tempdima}%
897 \setlength{\foremargin}{\@tempdimb}%
898 \advance\paperwidth \binding
899 \advance\spinemargin \binding}
900
901 \newcommand{\setlrmarginsandblock}[3]{%
902 \advance\paperwidth -\binding
903 \setfillsize{\paperwidth}{*}{#1}{#2}{#3}%
904 \setlength{\textwidth}{\@tempdimc}%
905 \setlength{\spinemargin}{\@tempdima}%
906 \setlength{\foremargin}{\@tempdimb}%
907 \advance\paperwidth \binding
908 \advance\spinemargin \binding}
909
910 \newlength{\uppermargin}
911 \newlength{\lowermargin}
912 \newcommand{\setulmargins}[3]{%
913 \memsetmacroused\setulmargins%
914 \setfillsize{\paperheight}{\textheight}{#1}{#2}{#3}%
915 \setlength{\textheight}{\@tempdimc}%
916 \setlength{\uppermargin}{\@tempdima}%
917 \setlength{\lowermargin}{\@tempdimb}}
918
919 \newcommand{\setulmarginsandblock}[3]{%
920 \setfillsize{\paperheight}{*}{#1}{#2}{#3}%
921 \setlength{\textheight}{\@tempdimc}%
922 \setlength{\uppermargin}{\@tempdima}%
923 \setlength{\lowermargin}{\@tempdimb}}
924
925 \newlength{\headdrop}
926 \newcommand{\setheaderspaces}[3]{%
927 \setfillsize{\uppermargin}{\headheight}{#1}{#2}{#3}%
928 \setlength{\headheight}{\@tempdimc}%
929 \setlength{\headdrop}{\@tempdima}%
930 \setlength{\headsep}{\@tempdimb}}
931
932 \newcommand{\setheadfoot}[2]{%
933 \setlength{\headheight}{#1}%
934 \setlength{\footskip}{#2}}
935
936 \newcommand{\setcolsepandrule}[2]{%
937 \setlength{\columnsep}{#1}%
938 \setlength{\columnseprule}{#2}}
939
940 \newcommand{\setmarginnotes}[3]{%
941 \memsetmacroused\setmarginnotes%
942 \setlength{\marginparsep}{#1}%
943 \setlength{\marginparwidth}{#2}%
944 \setlength{\marginparpush}{#3}}
945
946 \newcommand\setfootins[2]{
947 \setlength{\skip\footins}{#1}
948 \setlength{\skip\footinsv@r}{#1}
949 \setlength{\skip\@mpfootins}{#2}
950 % not explicitly used
951 \setlength{\skip\@mpfootinsv@r}{#2}
952 }
953
954 \settrimmedsize{\stockheight}{\stockwidth}{*}
955 \settrims{\z@}{\z@}
956
957 \setlength{\@tempdimb}{1.14\lxvchars}
958 \setlength\@tempdima{\paperwidth}
959 \addtolength\@tempdima{-2in}
960 \if@twocolumn
961 \ifdim\@tempdima>2\@tempdimb\relax
962 \setlength\textwidth{2\@tempdimb}
963 \else
964 \setlength\textwidth{\@tempdima}
965 \fi
966 \else
967 \ifdim\@tempdima>\@tempdimb\relax
968 \setlength\textwidth{\@tempdimb}
969 \else
970 \setlength\textwidth{\@tempdima}
971 \fi
972 \fi
973 \mem@settopoint\textwidth
974
975 \setlength\@tempdima{\paperheight}
976 \addtolength\@tempdima{-3.5in}
977 \divide\@tempdima\baselineskip
978 \@tempcnta=\@tempdima
979 \setlength\textheight{\@tempcnta\baselineskip}
980 \addtolength\textheight{\topskip}
981
982 \if@twoside
983 \setlength\@tempdima {\paperwidth}
984 \addtolength\@tempdima {-\textwidth}
985 \setlength\oddsidemargin {.4\@tempdima}
986 \addtolength\oddsidemargin {-1in}
987 \setlength\marginparwidth {.6\@tempdima}
988 \addtolength\marginparwidth{-\marginparsep}
989 \addtolength\marginparwidth{-0.4in}
990 \else
991 \setlength\@tempdima {\paperwidth}
992 \addtolength\@tempdima {-\textwidth}
993 \setlength\oddsidemargin {.5\@tempdima}
994 \addtolength\oddsidemargin {-1in}
995 \setlength\marginparwidth {.5\@tempdima}
996 \addtolength\marginparwidth{-\marginparsep}
997 \addtolength\marginparwidth{-0.8in} % don't know why this isn't .4
998 \fi
999 \ifdim\marginparwidth>2in
1000 \setlength\marginparwidth{2in}%
1001 \fi
1002 \mem@settopoint\oddsidemargin
1003 \mem@settopoint\marginparwidth
1004 \ifdim\marginparwidth<1pt \setlength\marginparwidth{1pt}\fi
1005
1006 \setlength\evensidemargin {\paperwidth}
1007 \addtolength\evensidemargin{-2in}
1008 \addtolength\evensidemargin{-\textwidth}
1009 \addtolength\evensidemargin{-\oddsidemargin}
1010 \mem@settopoint\evensidemargin
1011 \setlength\topmargin {\paperheight}
1012 \addtolength\topmargin{-2in}
1013 \addtolength\topmargin{-\headheight}
1014 \addtolength\topmargin{-\headsep}
1015 \addtolength\topmargin{-\textheight}
1016 \addtolength\topmargin{-\footskip}
1017 \addtolength\topmargin{-.5\topmargin}
1018 \mem@settopoint\topmargin
1019
1020 \setlength{\spinemargin}{\oddsidemargin}
1021 \addtolength{\spinemargin}{1in}
1022 \setlrmargins{\spinemargin}{*}{*}
1023
1024 \setlength{\uppermargin}{\topmargin}
1025 \addtolength{\uppermargin}{1in}
1026 \addtolength{\uppermargin}{\headheight}
1027 \addtolength{\uppermargin}{\headsep}
1028 \setulmargins{\uppermargin}{*}{*}
1029
1030 \newcommand*{\@memznegtest}[1]{%
1031 \ifdim#1>\z@\else
1032 \@memwarn{\protect#1\space is zero or negative}%
1033 \fi}
1034 \newcommand*{\@memnegtest}[1]{%
1035 \ifdim#1<\z@
1036 \@memwarn{\protect#1\space is negative}%
1037 \fi}
1038
1039 \newcommand*{\m@mclassicht}{%
1040 \setlength{\@tempdima}{\textheight}%
1041 \divide\@tempdima \baselineskip
1042 \@tempcnta=\@tempdima
1043 \setlength{\textheight}{\@tempcnta\baselineskip}%
1044 \addtolength{\textheight}{\topskip}}
1045
1046 \newcommand*{\m@mlinesht}{%
1047 \setlength{\@tempdima}{\textheight}%
1048 \advance\@tempdima -\baselineskip
1049 \divide\@tempdima \baselineskip
1050 \@tempcnta=\@tempdima
1051 \setlength{\textheight}{\@tempcnta\baselineskip}%
1052 \addtolength{\textheight}{\topskip}}
1053
1054 \newcommand*{\m@mnearestht}{%
1055 \setlength{\@tempdima}{\textheight}%
1056 \advance\@tempdima -\topskip
1057 \advance\@tempdima 0.5\baselineskip
1058 \divide\@tempdima \baselineskip
1059 \@tempcnta=\@tempdima
1060 \setlength{\textheight}{\@tempcnta\baselineskip}%
1061 \addtolength{\textheight}{\topskip}}
1062
1063 \newcommand\mem@autoadjust@marginparwidth{%
1064 \if@twocolumn
1065 \memsetlengthmin\marginparwidth\spinemargin\foremargin
1066 \else
1067 \if@twoside
1068 \ifcase\m@mmpar@margin\relax% 0 - left
1069 \memsetlengthmin\marginparwidth\spinemargin\foremargin
1070 \or% 1 - right
1071 \memsetlengthmin\marginparwidth\spinemargin\foremargin
1072 \or% 2 - outer
1073 \setlength\marginparwidth{\foremargin}
1074 \or% 3 - inner
1075 \setlength\marginparwidth{\spinemargin}
1076 \fi
1077 \else % oneside
1078 \ifnum\m@mmpar@margin=0% left
1079 \setlength\marginparwidth{\spinemargin}
1080 \else% right
1081 \setlength\marginparwidth{\foremargin}
1082 \fi
1083 \fi
1084 \fi
1085 \addtolength\marginparwidth{-2\marginparsep}
1086 \ifdim\marginparwidth<1pt\setlength\marginparwidth{1pt}\fi%
1087 }
1088
1089 \newcommand\mem@reset@used@macros{%
1090 \memsetmacrounused\setmarginnotes
1091 \memsetmacrounused\settypeblocksize
1092 \memsetmacrounused\setulmargins
1093 \memsetmacrounused\setlrmargins
1094 }
1095
1096 \newcommand*{\checkthelayout}[1][classic]{%
1097 \@memnegtest{\trimedge}
1098 \@memnegtest{\trimtop}
1099 \@memznegtest{\stockwidth}
1100 \@memznegtest{\paperwidth}
1101 \@memznegtest{\textwidth}
1102 \@memnegtest{\spinemargin}
1103 \@memnegtest{\foremargin}
1104 \@memznegtest{\marginparsep}
1105 \@memznegtest{\marginparwidth}
1106 \@memznegtest{\stockheight}
1107 \@memznegtest{\paperheight}
1108 \@memznegtest{\textheight}
1109 \@memnegtest{\uppermargin}
1110 \@memnegtest{\lowermargin}
1111 \@memnegtest{\headheight}
1112 \@memnegtest{\headsep}
1113 \@memnegtest{\footskip}
1114 \nametest{#1}{classic}%
1115 \ifsamename
1116 \m@mclassicht
1117 \else
1118 \nametest{#1}{lines}%
1119 \ifsamename
1120 \m@mlinesht
1121 \else
1122 \nametest{#1}{nearest}%
1123 \ifsamename
1124 \m@mnearestht
1125 \else
1126 \nametest{#1}{fixed}
1127 \ifsamename
1128 \else% not classic, lines, nearest, or fixed
1129 \@memerror{Optional argument is not one of:\MessageBreak
1130 classic, fixed, lines, or nearest. \MessageBreak
1131 I will assume the default}%
1132 {\@ehc}%
1133 \fi
1134 \fi
1135 \fi
1136 \fi
1137 \setulmargins{\uppermargin}{*}{*}
1138 \@tempdimb = -1pt
1139 \@tempdima=\stockwidth
1140 \advance\@tempdima -\trimedge
1141 \advance\@tempdima -\paperwidth
1142 \ifdim\@tempdima<\@tempdimb
1143 \@tempdima = -\@tempdima
1144 \@memerror{\protect\paperwidth\space (\the\paperwidth) and/or
1145 \protect\trimedge\space (\the\trimedge)
1146 are too large for \protect\stockwidth\space (\the\stockwidth)
1147 by \the\@tempdima}%
1148 {\@ehd}
1149 \fi
1150 \@tempdima = \paperwidth
1151 \advance\@tempdima -\foremargin
1152 \advance\@tempdima -\textwidth
1153 \advance\@tempdima -\spinemargin
1154 \ifdim\@tempdima<\@tempdimb
1155 \@tempdima = -\@tempdima
1156 \@memerror{\protect\spinemargin\space (\the\spinemargin) and/or
1157 \protect\textwidth\space (\the\textwidth) and/or
1158 \protect\foremargin\space (\the\foremargin)
1159 are too large for \protect\paperwidth\space (\the\paperwidth)
1160 by \the\@tempdima}%
1161 {\@ehd}
1162 \fi
1163 \@tempdima = \stockheight
1164 \advance\@tempdima -\trimtop
1165 \advance\@tempdima -\paperheight
1166 \ifdim\@tempdima<\@tempdimb
1167 \@tempdima = -\@tempdima
1168 \@memerror{\protect\paperheight\space (\the\paperheight) and/or
1169 \protect\trimtop\space (\the\trimtop)
1170 are too large for \protect\stockheight\space (\the\stockheight)
1171 by \the\@tempdima}%
1172 {\@ehd}
1173 \fi
1174 \@tempdima = \paperheight
1175 \advance\@tempdima -\uppermargin
1176 \advance\@tempdima -\textheight
1177 \advance\@tempdima -\lowermargin
1178 \ifdim\@tempdima<\@tempdimb
1179 \@tempdima = -\@tempdima
1180 \@memerror{\protect\uppermargin\space (\the\uppermargin) and/or
1181 \protect\textheight\space (\the\textheight) and/or
1182 \protect\lowermargin\space (\the\lowermargin)
1183 are too large for \protect\paperheight\space (\the\paperheight)
1184 by \the\@tempdima}%
1185 {\@ehd}
1186 \fi
1187 \@tempdima = \uppermargin
1188 \advance\@tempdima -\headheight
1189 \advance\@tempdima -\headsep
1190 \ifdim\@tempdima<\@tempdimb
1191 \@tempdima = -\@tempdima
1192 \@memerror{\protect\headheight\space (\the\headheight) and/or
1193 \protect\headsep\space (\the\headsep)
1194 are too large for \protect\uppermargin\space (\the\uppermargin)
1195 by \the\@tempdima}%
1196 {\@ehd}
1197 \fi
1198 \@tempdima = \lowermargin
1199 \advance\@tempdima -\footskip
1200 \ifdim\@tempdima<\z@
1201 \@tempdima = -\@tempdima
1202 \@memerror{\protect\footskip\space (\the\footskip)
1203 is too large for \protect\lowermargin\space (\the\lowermargin)
1204 by \the\@tempdima}%
1205 {\@ehd}
1206 \fi}
1207
1208 \newcommand*{\fixthelayout}{%
1209 \topmargin = \trimtop
1210 \advance\topmargin \uppermargin
1211 \advance\topmargin -\headsep
1212 \advance\topmargin -\headheight
1213 \advance\topmargin -1in\relax
1214 \oddsidemargin = \stockwidth
1215 \advance\oddsidemargin -\trimedge
1216 \advance\oddsidemargin -\paperwidth
1217 \advance\oddsidemargin \spinemargin
1218 \advance\oddsidemargin -1in\relax
1219 \evensidemargin = \trimedge
1220 \advance\evensidemargin \foremargin
1221 \advance\evensidemargin -1in\relax
1222 \mem@settopoint\textwidth
1223 \mem@settopoint\oddsidemargin
1224 \mem@settopoint\evensidemargin
1225 \fixheaderwidths
1226 \memifmacroused\setmarginnotes{}{\mem@autoadjust@marginparwidth}
1227 \mem@reset@used@macros
1228 }
1229
1230 \ExplSyntaxOn
1231 \newcommand\settypeoutlayoutunit[1]{
1232 \def\mem@tl@unit{#1}
1233 \str_case_e:nnF{#1}{
1234 {pt}{ \def\mem@tl@unitperpt{1.0} }
1235 {pc}{ \def\mem@tl@unitperpt{0.083333} }
1236 {in}{ \def\mem@tl@unitperpt{0.013837} }
1237 {mm}{ \def\mem@tl@unitperpt{0.351459} }
1238 {cm}{ \def\mem@tl@unitperpt{0.0351459} }
1239 {bp}{ \def\mem@tl@unitperpt{0.996264} }
1240 {dd}{ \def\mem@tl@unitperpt{0.9345718} }
1241 {cc}{ \def\mem@tl@unitperpt{0.0778809} }
1242 }{ % or error
1243 \@memerror{Unknown~unit~'#1'~not~suitable~for~layout\MessageBreak listing}{}
1244 }
1245 }
1246 \ExplSyntaxOff
1247
1248 %\newcommand\settypeoutlayoutunit[1]{
1249 % \nametest{#1}{pt}
1250 % \ifsamename
1251 % \def\mem@tl@unit{#1}
1252 % \def\mem@tl@unitperpt{1.0}
1253 % \else
1254 % \nametest{#1}{pc}
1255 % \ifsamename
1256 % \def\mem@tl@unit{#1}
1257 % \def\mem@tl@unitperpt{0.083333}
1258 % \else
1259 % \nametest{#1}{in}
1260 % \ifsamename
1261 % \def\mem@tl@unit{#1}
1262 % \def\mem@tl@unitperpt{0.013837}
1263 % \else
1264 % \nametest{#1}{mm}
1265 % \ifsamename
1266 % \def\mem@tl@unit{#1}
1267 % \def\mem@tl@unitperpt{0.351459}
1268 % \else
1269 % \nametest{#1}{cm}
1270 % \ifsamename
1271 % \def\mem@tl@unit{#1}
1272 % \def\mem@tl@unitperpt{0.0351459}
1273 % \else
1274 % \nametest{#1}{bp}
1275 % \ifsamename
1276 % \def\mem@tl@unit{#1}
1277 % \def\mem@tl@unitperpt{0.996264}
1278 % \else
1279 % \nametest{#1}{dd}
1280 % \ifsamename
1281 % \def\mem@tl@unit{#1}
1282 % \def\mem@tl@unitperpt{0.9345718}
1283 % \else
1284 % \nametest{#1}{cc}
1285 % \ifsamename
1286 % \def\mem@tl@unit{#1}
1287 % \def\mem@tl@unitperpt{0.0778809}
1288 % \else
1289 % \@memerror{Unknown unit '#1' not suitable for layout listing}{}
1290 % \fi
1291 % \fi
1292 % \fi
1293 % \fi
1294 % \fi
1295 % \fi
1296 % \fi
1297 % \fi
1298 %}
1299 \settypeoutlayoutunit{pt}
1300 \newcommand\mem@typeouttwolengths[4]{
1301 % #1 = text before
1302 % #2 = first length
1303 % #3 = text between
1304 % #4 = second length
1305 \setlength\@tempdimc{\mem@tl@unitperpt #2}
1306 \edef\l@first{\strip@pt\@tempdimc}%
1307 \setlength\@tempdimc{\mem@tl@unitperpt #4}
1308 \edef\l@second{\strip@pt\@tempdimc}%
1309 \typeout{#1: \l@first\mem@tl@unit\space#3\space\l@second\mem@tl@unit}
1310 }
1311 \newcommand\mem@typeoutonelength[2]{
1312 % #1 = text before
1313 % #2 = first length
1314 \setlength\@tempdimc{\mem@tl@unitperpt #2}
1315 \edef\l@first{\strip@pt\@tempdimc}%
1316 \typeout{#1: \l@first\mem@tl@unit}
1317 }
1318 \newcommand*{\typeoutlayout}{%
1319 \typeout{}
1320 \typeout{******************************************************}
1321 % \typeout{Stock height and width:
1322 % \the\stockheight\space by \the\stockwidth}
1323 % \typeout{Top and edge trims:
1324 % \the\trimtop\space and \the\trimedge}
1325 % \typeout{Page height and width:
1326 % \the\paperheight\space by \the\paperwidth}
1327 % \typeout{Text height and width:
1328 % \the\textheight\space by \the\textwidth}
1329 % \typeout{Spine and edge margins:
1330 % \the\spinemargin\space and \the\foremargin}
1331 % \typeout{Upper and lower margins:
1332 % \the\uppermargin\space and \the\lowermargin}
1333 % \typeout{Headheight and headsep:
1334 % \the\headheight\space and \the\headsep}
1335 % \typeout{Footskip:
1336 % \the\footskip}
1337 % \typeout{Columnsep and columnseprule:
1338 % \the\columnsep\space and \the\columnseprule}
1339 % \typeout{Marginparsep and marginparwidth:
1340 % \the\marginparsep\space and \the\marginparwidth}
1341 % \typeout{Sidecapsep and sidecapwidth:
1342 % \the\sidecapsep\space and \the\sidecapwidth}
1343 % \typeout{Sidebarhsep and sidebarwidth:
1344 % \the\sidebarhsep\space and \the\sidebarwidth}
1345 % \typeout{Sidebarvsep and sidebartopsep:
1346 % \the\sidebarvsep\space and \the\sidebartopsep}
1347 % \typeout{Sidebarheight:
1348 % \the\dimen\sideins}
1349 % \typeout{Sidefoothsep and sidefootwidth:
1350 % \the\sidefoothsep\space and \the\sidefootwidth}
1351 % \typeout{Sidefootvsep and sidefootheight:
1352 % \the\sidefootvsep\space and \the\sidefootheight}
1353 \mem@typeouttwolengths{Stock height and width}{\stockheight}{by}{\stockwidth}
1354 \mem@typeouttwolengths{Top and edge trims}{\trimtop}{and}{\trimedge}
1355 \mem@typeouttwolengths{Page height and width}{\paperheight}{by}{\paperwidth}
1356 \mem@typeouttwolengths{Text height and width}{\textheight}{by}{\textwidth}
1357 \mem@typeouttwolengths{Spine and edge margins}{\spinemargin}{and}{\foremargin}
1358 \mem@typeouttwolengths{Upper and lower margins}{\uppermargin}{and}{\lowermargin}
1359 \mem@typeouttwolengths{Headheight and headsep}{\headheight}{and}{\headsep}
1360 \mem@typeoutonelength{Footskip}{\footskip}
1361 \mem@typeouttwolengths{Columnsep and columnseprule}{\columnsep}{and}{\columnseprule}
1362 \mem@typeouttwolengths{Marginparsep and marginparwidth}{\marginparsep}{and}{\marginparwidth}
1363 \mem@typeouttwolengths{Sidecapsep and sidecapwidth}{\sidecapsep}{and}{\sidecapwidth}
1364 \mem@typeouttwolengths{Sidebarhsep and sidebarwidth}{\sidebarhsep}{and}{\sidebarwidth}
1365 \mem@typeouttwolengths{Sidebarvsep and sidebartopsep}{\sidebarvsep}{and}{\sidebartopsep}
1366 \mem@typeoutonelength{Sidebarheight}{\dimen\sideins}
1367 \mem@typeouttwolengths{Sidefoothsep and sidefootwidth}{\sidefoothsep}{and}{\sidefootwidth}
1368 \mem@typeouttwolengths{Sidefootvsep and sidefootheight}{\sidefootvsep}{and}{\sidefootheight}
1369 \typeout{******************************************************}
1370 \typeout{}}
1371
1372 \newcommand*{\checkandfixthelayout}[1][classic]{%
1373 \checkthelayout[#1]%
1374 \fixthelayout
1375 \typeoutlayout}
1376
1377 \newcommand\mem@fixpagelayout{%
1378 \@ifundefined{pdfpageheight}{}{\pdfpageheight=\the\stockheight}
1379 \@ifundefined{pdfpagewidth}{}{\pdfpagewidth=\the\stockwidth}
1380 \@ifundefined{pageheight}{}{\pageheight=\the\stockheight}
1381 \@ifundefined{pagewidth}{}{\pagewidth=\the\stockwidth}
1382 \@ifundefined{pdfvorigin}{}{\ifdim\pdfvorigin=0pt\pdfvorigin=1in\fi}
1383 \@ifundefined{pdfhorigin}{}{\ifdim\pdfhorigin=0pt\pdfhorigin=1in\fi}
1384 \ifluatex\else
1385 \ifxetex\else
1386 \ifpdf\else
1387 \AtBeginDvi{\special{papersize=\the\stockwidth,\the\stockheight}}
1388 \fi
1389 \fi
1390 \fi
1391 }
1392
1393 \AtBeginDocument{\mem@fixpagelayout}
1394 \let\refixpagelayout\mem@fixpagelayout
1395
1396 \newcommand*{\fixpdflayout}{%
1397 \ClassWarning{memoir}{As of 2018, \string\fixpdflayout\ is no longer used}
1398 % \pdfpageheight=\the\stockheight
1399 % \pdfpagewidth=\the\stockwidth
1400 % \ifxetex\else
1401 % \ifdim\pdfvorigin=0pt\pdfvorigin=1in\fi
1402 % \ifdim\pdfhorigin=0pt\pdfhorigin=1in\fi
1403 % \fi
1404 }
1405 \newcommand*{\fixdvipslayout}{%
1406 \ClassWarning{memoir}{As of 2018, \string\fixdvipslayout\ is no longer used}
1407 %\AtBeginDvi{\special{papersize=\the\stockwidth,\the\stockheight}}
1408 }
1409
1410
1411 \newcommand{\typeoutstandardlayout}{%
1412 \typeout{}
1413 \typeout{******************************************************}
1414 % \typeout{Page height and width:
1415 % \the\paperheight\space by \the\paperwidth}
1416 \mem@typeouttwolengths{Page height and width}{\paperheight}{by}{\paperwidth}
1417 % \typeout{Text height and width:
1418 % \the\textheight\space by \the\textwidth}
1419 \mem@typeouttwolengths{Text height and width}{\textheight}{by}{\textwidth}
1420 % \typeout{Oddside and evenside margins:
1421 % \the\oddsidemargin\space and \the\evensidemargin}
1422 \mem@typeouttwolengths{Oddside and evenside margins}{\oddsidemargin}{and}{\evensidemargin}
1423 % \typeout{Topmargin and footskip:
1424 % \the\topmargin\space and \the\footskip}
1425 \mem@typeouttwolengths{Topmargin and footskip}{\topmargin}{and}{\footskip}
1426 % \typeout{Headheight and headsep:
1427 % \the\headheight\space and \the\headsep}
1428 \mem@typeouttwolengths{Headheight and headsep}{\headheight}{and}{\headsep}
1429 % \typeout{Columnsep and columnseprule:
1430 % \the\columnsep\space and \the\columnseprule}
1431 \mem@typeouttwolengths{Columnsep and columnseprule}{\columnsep}{and}{\columnseprule}
1432 % \typeout{Marginparsep and marginparwidth:
1433 % \the\marginparsep\space and \the\marginparwidth}
1434 \mem@typeouttwolengths{Marginparsep and marginparwidth}{\marginparsep}{and}{\marginparwidth}
1435 \typeout{******************************************************}
1436 \typeout{}
1437 }
1438
1439 %%%% s = w/#1, t = 1.5s, e = 2s, f = 3s
1440 \newcommand*{\medievalpage}[1][9]{%
1441 \spinemargin=\paperwidth
1442 \divide\spinemargin #1\relax
1443 \uppermargin = 1.5\spinemargin
1444 \setlrmarginsandblock{\spinemargin}{*}{2}
1445 \setulmarginsandblock{\uppermargin}{*}{2}}
1446
1447 \newcommand*{\isopage}[1][9]{%
1448 \spinemargin=\paperwidth
1449 \divide\spinemargin #1\relax
1450 \uppermargin=\paperheight
1451 \divide\uppermargin #1\relax
1452 \setlrmarginsandblock{\spinemargin}{*}{2}
1453 \setulmarginsandblock{\uppermargin}{*}{2}}
1454
1455 %%% s = w/#1, t = s, e = 2s, f = e
1456 \newcommand*{\semiisopage}[1][9]{%
1457 \spinemargin=\paperwidth
1458 \divide\spinemargin #1\relax
1459 \uppermargin=\spinemargin
1460 \setlrmarginsandblock{\spinemargin}{*}{2}
1461 \setulmarginsandblock{\uppermargin}{*}{2}}
1462
1463 \newcommand*{\setpagebl}[3]{%
1464 \settrimmedsize{#1}{#2}{#3}%
1465 \trimtop=\stockheight \advance\trimtop -\paperheight
1466 \trimedge=\stockwidth \advance\trimedge -\paperwidth}
1467 \newcommand*{\setpageml}[3]{%
1468 \settrimmedsize{#1}{#2}{#3}
1469 \trimtop=\stockheight \advance\trimtop -\paperheight
1470 \advance\trimtop -0.5\trimtop
1471 \trimedge=\stockwidth \advance\trimedge -\paperwidth}
1472 \newcommand*{\setpagetl}[3]{%
1473 \settrimmedsize{#1}{#2}{#3}
1474 \trimtop=0pt
1475 \trimedge=\stockwidth \advance\trimedge -\paperwidth}
1476 \newcommand*{\setpagetm}[3]{%
1477 \settrimmedsize{#1}{#2}{#3}%
1478 \trimtop=0pt
1479 \trimedge=\stockwidth \advance\trimedge -\paperwidth
1480 \advance\trimedge -0.5\trimedge}
1481
1482 \newcommand*{\setpagetr}[3]{%
1483 \settrimmedsize{#1}{#2}{#3}%
1484 \trimtop=0pt
1485 \trimedge=0pt}
1486 \newcommand*{\setpagemr}[3]{%
1487 \settrimmedsize{#1}{#2}{#3}%
1488 \trimtop=\stockheight \advance\trimtop -\paperheight
1489 \advance\trimtop -0.5\trimtop
1490 \trimedge=0pt}
1491 \newcommand*{\setpagebr}[3]{%
1492 \settrimmedsize{#1}{#2}{#3}%
1493 \trimtop=\stockheight \advance\trimtop -\paperheight
1494 \trimedge=0pt}
1495 \newcommand*{\setpagebm}[3]{%
1496 \settrimmedsize{#1}{#2}{#3}%
1497 \trimtop=\stockheight \advance\trimtop -\paperheight
1498 \trimedge=\stockwidth \advance\trimedge -\paperwidth
1499 \advance\trimedge -0.5\trimedge}
1500 \newcommand*{\setpagecc}[3]{%
1501 \settrimmedsize{#1}{#2}{#3}%
1502 \trimtop=\stockheight \advance\trimtop -\paperheight
1503 \advance\trimtop -0.5\trimtop
1504 \trimedge=\stockwidth \advance\trimedge -\paperwidth
1505 \advance\trimedge -0.5\trimedge}
1506 \let\setpagemm\setpagecc
1507
1508 \setcounter{topnumber}{3}
1509 \renewcommand{\topfraction}{.85}
1510 \setcounter{bottomnumber}{2}
1511 \renewcommand{\bottomfraction}{.5}
1512 \setcounter{totalnumber}{4}
1513 \renewcommand{\textfraction}{.1}
1514 \renewcommand{\floatpagefraction}{.7}
1515 \setcounter{dbltopnumber}{3}
1516 \renewcommand{\dbltopfraction}{.85}
1517 \renewcommand{\dblfloatpagefraction}{.7}
1518 \newcommand\mem@set@ps@xtra@info[3]{%
1519 \@namedef{ps@#1@aliasfor}{#2}%
1520 \@namedef{ps@#1@isalias}{#3}}
1521
1522 \newcommand\mem@ps@find@real[1]{%
1523 \if\@nameuse{ps@#1@isalias}\relax
1524 \mem@ps@find@real{\@nameuse{ps@#1@aliasfor}}
1525 \else\def\@tempa{#1}\fi}
1526
1527 \newcommand\mem@ps@safe@change[1]{%
1528 \@ifundefined{ps@#1}{%
1529 \@memerror{Undefined pagestyle '#1', so I cannot change it}{}}{}
1530 \if\@nameuse{ps@#1@isalias}\relax \mem@ps@find@real{#1}
1531 \@memerror{The pagestyle '#1' is marked as an alias page style.^^J
1532 Modifying an alias page style may give unexpected results.^^J The
1533 alias chain resolves to the real page style '\@tempa', so try
1534 issuing^^J \string\copypagestyle{#1}{\@tempa}^^J
1535 before modifying '#1'}{} \fi }
1536
1537 \newcommand{\makeevenhead}[4]{%
1538 \mem@ps@safe@change{#1}
1539 \@namedef{#1eheadl}{#2}
1540 \@namedef{#1eheadc}{#3}
1541 \@namedef{#1eheadr}{#4}
1542 }
1543 \newcommand{\makeoddhead}[4]{%
1544 \mem@ps@safe@change{#1}
1545 \@namedef{#1oheadl}{#2}
1546 \@namedef{#1oheadc}{#3}
1547 \@namedef{#1oheadr}{#4}
1548 }
1549 \newcommand{\makeevenfoot}[4]{%
1550 \mem@ps@safe@change{#1}
1551 \@namedef{#1efootl}{#2}
1552 \@namedef{#1efootc}{#3}
1553 \@namedef{#1efootr}{#4}
1554 }
1555 \newcommand{\makeoddfoot}[4]{%
1556 \mem@ps@safe@change{#1}
1557 \@namedef{#1ofootl}{#2}
1558 \@namedef{#1ofootc}{#3}
1559 \@namedef{#1ofootr}{#4}
1560 }
1561
1562 \newcommand*{\makerunningwidth}[1]{%
1563 \mem@ps@safe@change{#1}%
1564 \def\m@mhfstyle{#1}%
1565 \m@mopthfwidth}
1566 \newcommand*{\m@mopthfwidth}[2][\@mpty]{%
1567 \@namedef{\m@mhfstyle headrunwidth}{#2}%
1568 \ifx\@mpty #1
1569 \@namedef{\m@mhfstyle footrunwidth}{#2}%
1570 \else
1571 \@namedef{\m@mhfstyle footrunwidth}{#1}%
1572 \fi}
1573 \newcommand*{\makerunningheadwidth}[2]{%
1574 \mem@ps@safe@change{#1}%
1575 \@namedef{#1headrunwidth}{#2}%
1576 }
1577 \newcommand*{\makerunningfootwidth}[2]{%
1578 \mem@ps@safe@change{#1}%
1579 \@namedef{#1footrunwidth}{#2}%
1580 }
1581
1582 \newlength{\normalrulethickness}
1583 \setlength{\normalrulethickness}{0.4pt}
1584 \newcommand{\footruleheight}{0pt}
1585 \newcommand{\footruleskip}{0.3\normalbaselineskip}
1586 \newcommand{\makeheadrule}[3]{%
1587 \mem@ps@safe@change{#1}%
1588 \@namedef{#1headrule}{%
1589 \hrule\@width #2\@height #3 \vskip-#3}}
1590 \newcommand{\makefootrule}[4]{%
1591 \mem@ps@safe@change{#1}%
1592 \@namedef{#1footrule}{%
1593 \vskip-#4\vskip-#3%
1594 \hrule\@width #2\@height #3 \vskip #4}}
1595
1596 \newcommand\makeheadfootruleprefix[3]{%
1597 \@namedef{#1headruleprefix}{#2}%
1598 \@namedef{#1footruleprefix}{#3}%
1599 }
1600 \newcommand{\makeheadposition}[5]{%
1601 \mem@ps@safe@change{#1}%
1602 \nametest{flushleft}{#2}
1603 \ifsamename
1604 \@namedef{#1evenheadpl}{\relax} \@namedef{#1evenheadpr}{\hss}
1605 \else
1606 \nametest{flushright}{#2}
1607 \ifsamename
1608 \@namedef{#1evenheadpl}{\hss} \@namedef{#1evenheadpr}{\relax}
1609 \else
1610 \@namedef{#1evenheadpl}{\hss} \@namedef{#1evenheadpr}{\hss}
1611 \fi
1612 \fi
1613 \nametest{flushleft}{#3}
1614 \ifsamename
1615 \@namedef{#1oddheadpl}{\relax} \@namedef{#1oddheadpr}{\hss}
1616 \else
1617 \nametest{flushright}{#3}
1618 \ifsamename
1619 \@namedef{#1oddheadpl}{\hss} \@namedef{#1oddheadpr}{\relax}
1620 \else
1621 \@namedef{#1oddheadpl}{\hss} \@namedef{#1oddheadpr}{\hss}
1622 \fi
1623 \fi
1624 \nametest{flushleft}{#4}
1625 \ifsamename
1626 \@namedef{#1evenfootpl}{\relax} \@namedef{#1evenfootpr}{\hss}
1627 \else
1628 \nametest{flushright}{#4}
1629 \ifsamename
1630 \@namedef{#1evenfootpl}{\hss} \@namedef{#1evenfootpr}{\relax}
1631 \else
1632 \@namedef{#1evenfootpl}{\hss} \@namedef{#1evenfootpr}{\hss}
1633 \fi
1634 \fi
1635 \nametest{flushleft}{#5}
1636 \ifsamename
1637 \@namedef{#1oddfootpl}{\relax} \@namedef{#1oddfootpr}{\hss}
1638 \else
1639 \nametest{flushright}{#5}
1640 \ifsamename
1641 \@namedef{#1oddfootpl}{\hss} \@namedef{#1oddfootpr}{\relax}
1642 \else
1643 \@namedef{#1oddfootpl}{\hss} \@namedef{#1oddfootpr}{\hss}
1644 \fi
1645 \fi}
1646
1647 \newcommand{\makepsmarks}[2]{\mem@ps@safe@change{#1}\@namedef{#1pshook}{#2}}
1648
1649 \newcommand*{\m@mhe@dreset}{\def\baselinestretch{1}\normalsize}
1650
1651 \newcommand*\makeheadfootvposition[3]{%
1652 \mem@ps@safe@change{#1}%
1653 \@namedef{#1headvplacement}{#2}\@namedef{#1footvplacement}{#3}}
1654
1655 \newlength\mem@maxheadheight
1656 \newlength\mem@maxfootheight
1657 \newcommand\mem@sayonce@head{00}
1658 \newcommand\mem@sayonce@foot{00}
1659 \newcommand\mem@hf@measure@vbox[4]{%
1660 \setbox0\vbox{#4}%
1661 \ifdim\ht0>#1\relax%
1662 \setlength\@tempdima{\@nameuse{mem@max#2height}}%
1663 \ifdim\ht0>\@tempdima\relax%
1664 \expandafter\global\@nameuse{mem@max#2height}=\ht0%
1665 \expandafter\if\@nameuse{mem@sayonce@#2}\relax%
1666 \@memwarn{#3}%
1667 \global\@namedef{mem@sayonece@#2}{01}%
1668 \fi%
1669 \fi%
1670 \fi%
1671 \box0%
1672 }
1673 \newcommand\mem@toolarge@header@message{%
1674 The material used in the headers is too large^^J%
1675 (\the\mem@maxheadheight) for the given head height
1676 (\the\headheight), it is recommended to^^J%
1677 either increase the head height or redesign the header^^J%
1678 (in both cases you will find help in the memoir manual).%
1679 }
1680 \newcommand\mem@toolarge@footer@message{%
1681 The material used in the footer is too large^^J%
1682 (\the\mem@maxfootheight) for the given foot skip
1683 (\the\footskip), it is recommended to^^J%
1684 either increase the foot skip or redesign the footer^^J%
1685 (in both cases you will find help in the memoir manual).%
1686 }
1687 \newcommand\mem@hvboxm[1]{%
1688 \mem@hf@measure@vbox\headheight{head}\mem@toolarge@header@message{#1}}
1689 \newcommand\mem@fvboxm[1]{%
1690 \mem@hf@measure@vbox\footskip{foot}\mem@toolarge@footer@message{#1}}
1691 \AtEndDocument{
1692 \ifdim\mem@maxheadheight>\headheight
1693 \@memwarn{\mem@toolarge@header@message}
1694 \fi
1695 \ifdim\mem@maxfootheight>\footskip
1696 \@memwarn{\mem@toolarge@footer@message}
1697 \fi
1698 }
1699 \newcommand\mem@ps@entry@wrap{}
1700 \newcommand\mem@ps@HLH[4]{%
1701 % #1 ps name
1702 % #2 type: head, foot
1703 % #3 odd/even
1704 % #4 odd/even short (o,e)
1705 \@namedef{#1@#3#2}{%
1706 \@nameuse{#1#3#2pl}\hb@xt@\@nameuse{#1#2runwidth}{\m@mhe@dreset%
1707 \nametest{#2}{head}\ifsamename\let\mem@hfboxer\mem@hvboxm\else\let\mem@hfboxer\mem@fvboxm\fi%
1708 \mem@hfboxer{\nametest{#2}{foot}\ifsamename%
1709 \begingroup% to prevent colors from bleeding into the footer
1710 \@nameuse{#1#2ruleprefix}%
1711 \@nameuse{#1#2rule}%
1712 \endgroup%
1713 \fi%
1714 \hbox{%
1715 \rlap{%
1716 \parbox[\@nameuse{#1#2vplacement}]{\@nameuse{#1#2runwidth}}{%
1717 \memRTLmainraggedright\@nameuse{#1ps#2strut}%
1718 \mem@ps@entry@wrap{\@nameuse{#1#4#2l}}%
1719 \@nameuse{#1ps#2strut}}}\hfill
1720 \parbox[\@nameuse{#1#2vplacement}]{\@nameuse{#1#2runwidth}}{%
1721 \centering\@nameuse{#1ps#2strut}%
1722 \mem@ps@entry@wrap{\@nameuse{#1#4#2c}}%
1723 \@nameuse{#1ps#2strut}}\hfill
1724 \llap{%
1725 \parbox[\@nameuse{#1#2vplacement}]{\@nameuse{#1#2runwidth}}{%
1726 \memRTLmainraggedleft\@nameuse{#1ps#2strut}%
1727 \mem@ps@entry@wrap{\@nameuse{#1#4#2r}}%
1728 \@nameuse{#1ps#2strut}}}%
1729 }%
1730 \nametest{#2}{head}\ifsamename%
1731 \@nameuse{#1#2ruleprefix}%
1732 \@nameuse{#1#2rule}%
1733 \fi%
1734 }}\@nameuse{#1#3#2pr}}%
1735 \@namedef{@#3#2}{\@nameuse{#1@#3#2}}%
1736 }
1737 \newcommand{\makepagestyle}[1]{%
1738 \mem@set@ps@xtra@info{#1}{}{01}%
1739 \@namedef{ps@#1}{%
1740 \mem@ps@HLH{#1}{head}{even}{e}%
1741 \mem@ps@HLH{#1}{head}{odd}{o}%
1742 \mem@ps@HLH{#1}{foot}{even}{e}%
1743 \mem@ps@HLH{#1}{foot}{odd}{o}%
1744 % \@namedef{#1@evenhead}{%
1745 % \@nameuse{#1evenhpl}\hb@xt@\@nameuse{#1headrunwidth}{\m@mhe@dreset%
1746 % \vbox{\hbox{%
1747 % \rlap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
1748 % \raggedright\@nameuse{#1eheadl}\strut}}\hfill
1749 % \parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
1750 % \centering\@nameuse{#1eheadc}\strut}\hfill
1751 % \llap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
1752 % \raggedleft\@nameuse{#1eheadr}\strut}}}%
1753 % \@nameuse{#1headrule}}}\@nameuse{#1evenhpr}}%
1754 % \@namedef{#1@oddhead}{%
1755 % \@nameuse{#1oddhpl}\hb@xt@\@nameuse{#1headrunwidth}{\m@mhe@dreset%
1756 % \vbox{\hbox{%
1757 % \rlap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
1758 % \raggedright\@nameuse{#1oheadl}\strut}}\hfill
1759 % \parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
1760 % \centering\@nameuse{#1oheadc}\strut}\hfill
1761 % \llap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
1762 % \raggedleft\@nameuse{#1oheadr}\strut}}}%
1763 % \@nameuse{#1headrule}}}\@nameuse{#1oddhpr}}%
1764 % \@namedef{#1@evenfoot}{%
1765 % \@nameuse{#1evenfpl}\hb@xt@\@nameuse{#1footrunwidth}{\m@mhe@dreset%
1766 % \vbox{\@nameuse{#1footrule}\hbox{%
1767 % \rlap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
1768 % \raggedright\@nameuse{#1efootl}\strut}}\hfill
1769 % \parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
1770 % \centering\@nameuse{#1efootc}\strut}\hfill
1771 % \llap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
1772 % \raggedleft\@nameuse{#1efootr}\strut}}}%
1773 % }}\@nameuse{#1evenfpr}}%
1774 % \@namedef{#1@oddfoot}{%
1775 % \@nameuse{#1oddfpl}\hb@xt@\@nameuse{#1footrunwidth}{\m@mhe@dreset%
1776 % \vbox{\@nameuse{#1footrule}\hbox{%
1777 % \rlap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
1778 % \raggedright\@nameuse{#1ofootl}\strut}}\hfill
1779 % \parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
1780 % \centering\@nameuse{#1ofootc}\strut}\hfill
1781 % \llap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
1782 % \raggedleft\@nameuse{#1ofootr}\strut}}}%
1783 % }}\@nameuse{#1oddfpr}}%
1784 % \def\@evenhead{\@nameuse{#1@evenhead}}%
1785 % \def\@oddhead{\@nameuse{#1@oddhead}}%
1786 % \def\@evenfoot{\@nameuse{#1@evenfoot}}%
1787 % \def\@oddfoot{\@nameuse{#1@oddfoot}}%
1788 \@nameuse{#1pshook}}%
1789 \nametest{#1}{empty}%
1790 \ifsamename%
1791 \@namedef{#1psheadstrut}{}\@namedef{#1psfootstrut}{}%
1792 \else%
1793 \@namedef{#1psheadstrut}{\strut}\@namedef{#1psfootstrut}{\strut}%
1794 \fi%
1795 \makeevenhead{#1}{}{}{}%
1796 \makeoddhead{#1}{}{}{}%
1797 \makeevenfoot{#1}{}{}{}%
1798 \makeoddfoot{#1}{}{}{}%
1799 \makerunningwidth{#1}{\textwidth}%
1800 \makeheadposition{#1}{}{}{}{}%
1801 \makeheadrule{#1}{\textwidth}{0pt}%
1802 \makefootrule{#1}{\textwidth}{\footruleheight}{\footruleskip}%
1803 \makeheadfootruleprefix{#1}{}{}
1804 \makeheadfootvposition{#1}{b}{b}%
1805 \makepsmarks{#1}{}}
1806
1807 \newcommand{\aliaspagestyle}[2]{%
1808 \mem@set@ps@xtra@info{#1}{#2}{00}%
1809 \@namedef{ps@#1}{\@nameuse{ps@#2}}}
1810
1811 \newcommand{\copypagestyle}[2]{%
1812 \makepagestyle{#1}%
1813 \makeevenhead{#1}{\@nameuse{#2eheadl}}%
1814 {\@nameuse{#2eheadc}}{\@nameuse{#2eheadr}}%
1815 \makeoddhead{#1}{\@nameuse{#2oheadl}}%
1816 {\@nameuse{#2oheadc}}{\@nameuse{#2oheadr}}%
1817 \makeevenfoot{#1}{\@nameuse{#2efootl}}%
1818 {\@nameuse{#2efootc}}{\@nameuse{#2efootr}}%
1819 \makeoddfoot{#1}{\@nameuse{#2ofootl}}%
1820 {\@nameuse{#2ofootc}}{\@nameuse{#2ofootr}}%
1821 \makerunningwidth{#1}[\@nameuse{#2footrunwidth}]{\@nameuse{#2headrunwidth}}%
1822 \@namedef{#1evenheadpl}{\@nameuse{#2evenheadpl}}%
1823 \@namedef{#1oddheadpl}{\@nameuse{#2oddheadpl}}%
1824 \@namedef{#1evenheadpr}{\@nameuse{#2evenheadpr}}%
1825 \@namedef{#1oddheadpr}{\@nameuse{#2oddheadpr}}%
1826 \makeheadfootvposition{#1}{\@nameuse{#2headvplacement}}{\@nameuse{#2footvplacement}}%
1827 \@namedef{#1evenfootpl}{\@nameuse{#2evenfootpl}}%
1828 \@namedef{#1oddfootpl}{\@nameuse{#2oddfootpl}}%
1829 \@namedef{#1evenfootpr}{\@nameuse{#2evenfootpr}}%
1830 \@namedef{#1oddfootpr}{\@nameuse{#2oddfootpr}}%
1831 \@namedef{#1headrule}{\@nameuse{#2headrule}}%
1832 \@namedef{#1footrule}{\@nameuse{#2footrule}}%
1833 \@namedef{#1headruleprefix}{\@nameuse{#2headruleprefix}}%
1834 \@namedef{#1footruleprefix}{\@nameuse{#2footruleprefix}}%
1835 \@namedef{#1psheadstrut}{\@nameuse{#2psheadstrut}}
1836 \@namedef{#1psfootstrut}{\@nameuse{#2psfootstrut}}
1837 \makepsmarks{#1}{\@nameuse{#2pshook}}}
1838
1839 \newcommand{\ifonlyfloats}[2]{\if@fcolmade #1\else #2\fi}
1840
1841 \newcommand{\mergepagefloatstyle}[3]{%
1842 \@nameuse{ps@#3}\@nameuse{ps@#2}%
1843 \@namedef{ps@#1}{%
1844 \def\@evenhead{\ifonlyfloats{\@nameuse{#3@evenhead}}%
1845 {\@nameuse{#2@evenhead}}}%
1846 \def\@oddhead{\ifonlyfloats{\@nameuse{#3@oddhead}}%
1847 {\@nameuse{#2@oddhead}}}%
1848 \def\@evenfoot{\ifonlyfloats{\@nameuse{#3@evenfoot}}%
1849 {\@nameuse{#2@evenfoot}}}%
1850 \def\@oddfoot{\ifonlyfloats{\@nameuse{#3@oddfoot}}%
1851 {\@nameuse{#2@oddfoot}}}%
1852 \@namedef{#1pshook}{\@nameuse{#2pshook}}%
1853 }}
1854
1855 \newcommand*\makeheadfootstrut[3]{%
1856 \@namedef{#1psheadstrut}{#2}\@namedef{#1psfootstrut}{#3}}
1857 \makepagestyle{empty}
1858
1859 \makepagestyle{plain}
1860 \makeevenfoot{plain}{}{\thepage}{}
1861 \makeoddfoot{plain}{}{\thepage}{}
1862
1863 \makepagestyle{simple}
1864 \makeevenhead{simple}{\thepage}{}{}
1865 \makeoddhead{simple}{}{}{\thepage}
1866
1867 \newcommand*{\nouppercaseheads}{\def\memUChead{}}
1868 \newcommand*{\uppercaseheads}{\def\memUChead{\MakeUppercase}}
1869 \uppercaseheads
1870
1871 \ExplSyntaxOn
1872 \NewDocumentCommand\createplainmark{ mmm }
1873 {
1874 \str_case:nnF {#2}
1875 {
1876 {left} { \@namedef{#1mark}{\markboth{\memUChead{#3}}{}} }
1877 {right}{ \@namedef{#1mark}{\markright{\memUChead{#3}}} }
1878 {both} { \@namedef{#1mark}{\markboth{\memUChead{#3}}{\memUChead{#3}}} }
1879 }
1880 {
1881 \@memerror{
1882 Unknown~ mark~ setting~ type~ `#2'~ for~ #1mark}{
1883 I~ expected~ `left',~ `both'~ or~ `right'. \MessageBreak
1884 I~ will~ assume~ you~ meant~ `both'}
1885 }
1886 }
1887 \ExplSyntaxOff
1888 % \newcommand*{\createplainmark}[3]{%
1889 % \nametest{#2}{left}%
1890 % \ifsamename
1891 % \@namedef{#1mark}{\markboth{\memUChead{#3}}{}}%
1892 % \else
1893 % \nametest{#2}{right}%
1894 % \ifsamename
1895 % \@namedef{#1mark}{\markright{\memUChead{#3}}}%
1896 % \else
1897 % \nametest{#2}{both}%
1898 % \ifsamename\else
1899 % \@memerror{%
1900 % Unknown mark setting type `#2' for #1mark}{%
1901 % I expected `left', `both' or `right'. \MessageBreak
1902 % I will assume you meant `both'}%
1903 % \fi
1904 % \@namedef{#1mark}{\markboth{\memUChead{#3}}{\memUChead{#3}}}%
1905 % \fi
1906 % \fi}
1907
1908 \newcommand\createmark[5]{%
1909 % \def\@tempa{00}
1910 % \nametest{#3}{nonumber}%
1911 % \ifsamename
1912 % \def\@tempa{01}%
1913 % \else
1914 % \nametest{#3}{shownumber}
1915 % \ifsamename\else
1916 % \@memerror{Unknown numbering value `#3' for #1mark}%
1917 % {I expected `shownumber' or `nonumber'.\MessageBreak
1918 % I will assume you meant `shownumber'}%
1919 % \fi
1920 % \fi
1921 % \expandafter\if\@tempa% compares the two \@tempa digits
1922 % \@namedef{#1marksn}##1{##1}%
1923 % \else
1924 % \@namedef{#1marksn}{\@gobble}%
1925 % \fi
1926 \def\@tempa{1}
1927 \nametest{#3}{nonumber}%
1928 \ifsamename
1929 \def\@tempa{0}
1930 \else
1931 \nametest{#3}{shownumber}
1932 \ifsamename
1933 \def\@tempa{1}
1934 \else
1935 \nametest{#3}{notitle}
1936 \ifsamename
1937 \def\@tempa{2}
1938 \else
1939 \@memerror{Unknown numbering value `#3' for
1940 #1mark,\MessageBreak
1941 please use one of 'shownumber', 'nonumber' or 'notitle'}%
1942 {I expected `shownumber', `nonumber' or 'notitle'.\MessageBreak
1943 I will assume you meant `shownumber'}%
1944 \fi
1945 \fi
1946 \fi
1947 \@namedef{#1markst}##1{##1}
1948 \ifcase\@tempa\relax
1949 % nonumber
1950 \@namedef{#1marksn}{\@gobble}%
1951 \or % 1
1952 % shownumber
1953 \@namedef{#1marksn}##1{##1}
1954 \or % 2, 2 implies shownumber
1955 % shownumber
1956 \@namedef{#1marksn}##1{##1}
1957 \@namedef{#1markst}{\@gobble}
1958 \fi
1959 \nametest{#2}{left}%
1960 \ifsamename
1961 \@namedef{#1mark}##1{%
1962 \@setclcnt{#1}{@memmarkcntra}%
1963 \advance\c@@memmarkcntra\m@ne
1964 \markboth{%
1965 \memUChead{%
1966 \ifnum \c@secnumdepth > \c@@memmarkcntra
1967 \if@mainmatter
1968 \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}%
1969 \fi
1970 \fi
1971 \@nameuse{#1markst}{##1}%
1972 }%
1973 }%
1974 {}% just left
1975 }%
1976 \else
1977 \nametest{#2}{right}
1978 \ifsamename
1979 \@namedef{#1mark}##1{%
1980 \@setclcnt{#1}{@memmarkcntra}%
1981 \advance\c@@memmarkcntra\m@ne
1982 \markright{%
1983 \memUChead{%
1984 \ifnum \c@secnumdepth > \c@@memmarkcntra
1985 \if@mainmatter%
1986 \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}%
1987 \fi%
1988 \fi%
1989 \@nameuse{#1markst}{##1}%
1990 }%
1991 }%
1992 }%
1993 \else
1994 \nametest{#2}{both}%
1995 \ifsamename\else
1996 \@memerror{%
1997 Unknown mark setting type `#2' for #1mark}{%
1998 I expected `left', `both' or `right'. \MessageBreak
1999 I will assume you meant `both'}%
2000 \fi
2001 \@namedef{#1mark}##1{%
2002 \@setclcnt{#1}{@memmarkcntra}%
2003 \advance\c@@memmarkcntra\m@ne
2004 \markboth{%
2005 \memUChead{%
2006 \ifnum \c@secnumdepth > \c@@memmarkcntra
2007 \if@mainmatter
2008 \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}%
2009 \fi
2010 \fi
2011 \@nameuse{#1markst}{##1}%
2012 }%
2013 }{%
2014 \memUChead{%
2015 \ifnum \c@secnumdepth > \c@@memmarkcntra
2016 \if@mainmatter
2017 \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}%
2018 \fi
2019 \fi
2020 \@nameuse{#1markst}{##1}%
2021 }%
2022 }%
2023 }%
2024 \fi
2025 \fi
2026 }
2027
2028 \NewDocumentCommand\addtopsmarks{ m m m }
2029 {
2030 \mem@ps@safe@change{#1}
2031 \IfBlankF{#2}{ \ExpandArgs{c}\pretocmd{#1pshook}{#2}{}{\typeout{prepending to #1marks failed}} }
2032 \IfBlankF{#3}{ \ExpandArgs{c}\apptocmd{#1pshook}{#3}{}{\typeout{appending to #1marks failed}} }
2033 }
2034 \newcommand\clearplainmark[1]{%
2035 \@namedef{#1mark}{}}
2036 \newcommand\clearmark[1]{%
2037 \@namedef{#1mark}{\@gobble}}
2038 \if@twoside
2039 \makepagestyle{headings}
2040 % \makepsmarks{headings}{%
2041 % \def\chaptermark##1{%
2042 % \markboth{\memUChead{%
2043 % \ifnum \c@secnumdepth >\m@ne
2044 % \if@mainmatter
2045 % \@chapapp\ \thechapter. \ %
2046 % \fi
2047 % \fi
2048 % ##1}}{}}%
2049 % \def\tocmark{\markboth{\memUChead{\contentsname}}{\memUChead{\contentsname}}}%
2050 % \def\lofmark{\markboth{\memUChead{\listfigurename}}{\memUChead{\listfigurename}}}%
2051 % \def\lotmark{\markboth{\memUChead{\listtablename}}{\memUChead{\listtablename}}}%
2052 % \def\bibmark{\markboth{\memUChead{\bibname}}{\memUChead{\bibname}}}%
2053 % \def\indexmark{\markboth{\memUChead{\indexname}}{\memUChead{\indexname}}}%
2054 % \def\sectionmark##1{%
2055 % \markright{\memUChead{%
2056 % \ifnum \c@secnumdepth > \z@
2057 % \thesection. \ %
2058 % \fi
2059 % ##1}}}}
2060 \makepsmarks{headings}{%
2061 \createmark{chapter}{left}{shownumber}{\@chapapp\ }{. \ }
2062 \createmark{section}{right}{shownumber}{}{. \ }
2063 \createplainmark{toc}{both}{\contentsname}
2064 \createplainmark{lof}{both}{\listfigurename}
2065 \createplainmark{lot}{both}{\listtablename}
2066 \createplainmark{bib}{both}{\bibname}
2067 \createplainmark{index}{both}{\indexname}
2068 \createplainmark{glossary}{both}{\glossaryname}
2069 }
2070 \makeevenhead{headings}{\thepage}{}{\slshape\leftmark}
2071 \makeoddhead{headings}{\slshape\rightmark}{}{\thepage}
2072 \else
2073 \makepagestyle{headings}
2074 % \makepsmarks{headings}{%
2075 % \def\chaptermark##1{%
2076 % \markright{\memUChead{%
2077 % \ifnum \c@secnumdepth >\m@ne
2078 % \if@mainmatter
2079 % \@chapapp\ \thechapter. \ %
2080 % \fi
2081 % \fi
2082 % ##1}}}%
2083 % \def\tocmark{\markright{\memUChead{\contentsname}}}%
2084 % \def\lofmark{\markright{\memUChead{\listfigurename}}}%
2085 % \def\lotmark{\markright{\memUChead{\listtablename}}}%
2086 % \def\bibmark{\markright{\memUChead{\bibname}}}%
2087 % \def\indexmark{\markright{\memUChead{\indexname}}}}
2088 \makepsmarks{headings}{%
2089 \createmark{chapter}{right}{shownumber}{\@chapapp\ }{. \ }
2090 \createplainmark{toc}{right}{\contentsname}
2091 \createplainmark{lof}{right}{\listfigurename}
2092 \createplainmark{lot}{right}{\listtablename}
2093 \createplainmark{bib}{right}{\bibname}
2094 \createplainmark{index}{right}{\indexname}
2095 \createplainmark{glossary}{right}{\glossaryname}
2096 }
2097 \makeoddhead{headings}{\slshape\rightmark}{}{\thepage}
2098 \fi
2099
2100 \makepagestyle{myheadings}
2101 \makepsmarks{myheadings}{%
2102 \let\chaptermark\@gobble
2103 \let\sectionmark\@gobble
2104 \def\tocmark{}%
2105 \def\lofmark{}%
2106 \def\lotmark{}%
2107 \def\bibmark{}%
2108 \def\indexmark{}%
2109 \def\glossarymark{}}
2110 \makeevenhead{myheadings}{\thepage}{}{\slshape\leftmark}
2111 \makeoddhead{myheadings}{\slshape\rightmark}{}{\thepage}
2112
2113 \aliaspagestyle{chapter}{plain}
2114 \aliaspagestyle{part}{plain}
2115 \aliaspagestyle{cleared}{empty}
2116
2117 \def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
2118 \hbox{}\thispagestyle{cleared}%
2119 \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
2120
2121 \makepagestyle{ruled}
2122 \makeevenfoot{ruled}{\thepage}{}{}
2123 \makeoddfoot{ruled}{}{}{\thepage}
2124 \makeheadrule{ruled}{\textwidth}{\normalrulethickness}
2125 % \newcommand{\@ruledmarks}{%
2126 % \def\chaptermark##1{%
2127 % \markboth{%
2128 % \ifnum \c@secnumdepth >\m@ne
2129 % \if@mainmatter
2130 % \thechapter. \ %
2131 % \fi
2132 % \fi
2133 % ##1}{}}
2134 % \def\sectionmark##1{\markright{##1}}
2135 % \def\tocmark{\markboth{\contentsname}{}}
2136 % \def\lofmark{\markboth{\listfigurename}{}}
2137 % \def\lotmark{\markboth{\listtablename}{}}
2138 % \def\bibmark{\markboth{\bibname}{}}
2139 % \def\indexmark{\markboth{\indexname}{}}
2140 % \def\glossarymark{\markboth{\glossaryname}{}}
2141 % }
2142 \newcommand*{\@ruledmarks}{%
2143 \nouppercaseheads
2144 \createmark{chapter}{left}{shownumber}{}{. \space}
2145 \createmark{section}{right}{shownumber}{}{. \space}
2146 \createplainmark{toc}{both}{\contentsname}
2147 \createplainmark{lof}{both}{\listfigurename}
2148 \createplainmark{lot}{both}{\listtablename}
2149 \createplainmark{bib}{both}{\bibname}
2150 \createplainmark{index}{both}{\indexname}
2151 \createplainmark{glossary}{both}{\glossaryname}}
2152 \makepsmarks{ruled}{\@ruledmarks}
2153 \makeevenhead{ruled}{\scshape\leftmark}{}{}
2154 \makeoddhead{ruled}{}{}{\rightmark}
2155
2156 \makepagestyle{Ruled}
2157 \makerunningwidth{Ruled}{1.1\textwidth}
2158 \makeheadposition{Ruled}{flushright}{flushleft}{flushright}{flushleft}
2159 \makeevenfoot{Ruled}{\thepage}{}{}
2160 \makeoddfoot{Ruled}{}{}{\thepage}
2161 \makeheadrule{Ruled}{1.1\textwidth}{\normalrulethickness}
2162 \makepsmarks{Ruled}{\@ruledmarks}
2163 \makeevenhead{Ruled}{\scshape\leftmark}{}{}
2164 \makeoddhead{Ruled}{}{}{\rightmark}
2165
2166 \newlength{\headwidth}
2167
2168 \makepagestyle{companion}
2169 \setlength{\headwidth}{\textwidth}
2170 \addtolength{\headwidth}{\marginparsep}
2171 \addtolength{\headwidth}{\marginparwidth}
2172 \makerunningwidth{companion}{\headwidth}
2173 \makeheadrule{companion}{\headwidth}{\normalrulethickness}
2174 \makeheadposition{companion}{flushright}{flushleft}{}{}
2175 % \makepsmarks{companion}{%
2176 % \def\chaptermark##1{\markboth{##1}{##1}} % left mark & right marks
2177 % \def\sectionmark##1{\markright{%
2178 % \ifnum \c@secnumdepth>\z@
2179 % \thesection. \ %
2180 % \fi
2181 % ##1}}
2182 % \def\tocmark{\markboth{\contentsname}{\contentsname}}
2183 % \def\lofmark{\markboth{\listfigurename}{\listfigurename}}
2184 % \def\lotmark{\markboth{\listtablename}{\listtablename}}
2185 % \def\bibmark{\markboth{\bibname}{\bibname}}
2186 % \def\indexmark{\markboth{\indexname}{\indexname}}}
2187 \makepsmarks{companion}{%
2188 \nouppercaseheads
2189 \createmark{chapter}{both}{nonumber}{}{}
2190 \createmark{section}{right}{shownumber}{}{. \space}
2191 \createplainmark{toc}{both}{\contentsname}
2192 \createplainmark{lof}{both}{\listfigurename}
2193 \createplainmark{lot}{both}{\listtablename}
2194 \createplainmark{bib}{both}{\bibname}
2195 \createplainmark{index}{both}{\indexname}
2196 \createplainmark{glossary}{both}{\glossaryname}}
2197 \makeevenhead{companion}{\normalfont\bfseries\thepage}{}%
2198 {\normalfont\bfseries\leftmark}
2199 \makeoddhead{companion}{\normalfont\bfseries\rightmark}{}%
2200 {\normalfont\bfseries\thepage}
2201
2202 \newif\ifshowheadfootloc
2203 \showheadfootloctrue
2204 \newcommand*{\showheadfootlocon}{\showheadfootloctrue}
2205 \newcommand*{\showheadfootlocoff}{\showheadfootlocfalse}
2206 \newif\ifshowtextblockloc
2207 \showtextblockloctrue
2208 \newcommand*{\showtextblocklocon}{\showtextblockloctrue}
2209 \newcommand*{\showtextblocklocoff}{\showtextblocklocfalse}
2210
2211 \newcommand\framepichook{}
2212 \newcommand*{\framepichead}{%
2213 \ifshowheadfootloc
2214 \begin{picture}(0,0)
2215 \framepichook
2216 \unitlength 1pt
2217 \put(0,0){\line(1,0){\strip@pt\textwidth}}
2218 \end{picture}%
2219 \fi}
2220
2221 \newcommand*{\framepictextfoot}{%
2222 \begin{picture}(0,0)
2223 \framepichook
2224 \unitlength 1pt
2225 \ifshowheadfootloc
2226 \put(0,0){\line(1,0){\strip@pt\textwidth}}
2227 \fi
2228 \ifshowtextblockloc
2229 \put(0,\strip@pt\footskip)%
2230 {\framebox(\strip@pt\textwidth,\strip@pt\textheight){}}
2231 \fi
2232 \end{picture}}
2233
2234 \makepagestyle{showlocs}
2235 \makeevenhead{showlocs}{\framepichead\thepage}{\thepage}{\thepage}
2236 \makeoddhead{showlocs}{\framepichead\thepage}{\thepage}{\thepage}
2237 \makeevenfoot{showlocs}{\framepictextfoot\thepage}{\thepage}{\thepage}
2238 \makeoddfoot{showlocs}{\framepictextfoot\thepage}{\thepage}{\thepage}
2239
2240 \newcommand*{\fixheaderwidths}{%
2241 % companion pagestyle
2242 \setlength{\headwidth}{\textwidth}
2243 \addtolength{\headwidth}{\marginparsep}
2244 \addtolength{\headwidth}{\marginparwidth}
2245 \makerunningwidth{companion}{\headwidth}
2246 \makeheadrule{companion}{\headwidth}{\normalrulethickness}
2247 \makefootrule{companion}{\textwidth}{\footruleheight}{\footruleskip}
2248 }
2249
2250 \RenewDocumentCommand\pagenumbering{sm}{%
2251 \gdef\thepage{\csname @#2\endcsname \c@page}%
2252 \IfBooleanF{#1}{\global\c@page \@ne}% reset counter unless starred
2253 }
2254
2255 \newcounter{storedpagenumber}
2256 \setcounter{storedpagenumber}{1}
2257 \newcommand{\savepagenumber}{\global\c@storedpagenumber \c@page}
2258 \newcommand{\restorepagenumber}{\global\c@page \c@storedpagenumber}
2259
2260 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2261 \newcommand*{\setSpacing}[1]{%
2262 \def\baselinestretch{#1}%
2263 \@currsize}
2264
2265 \newcommand*{\setSingleSpace}[1]{%
2266 \def\m@m@singlespace{#1}%
2267 \def\m@m@footnote@spacing{#1}%
2268 \def\m@m@float@spacing{#1} %
2269 }
2270 \setSingleSpace{1}
2271 \newcommand*\setPagenoteSpacing[1]{\def\m@m@footnote@spacing{#1}}
2272 \newcommand*\setFloatSpacing[1] {\def\m@m@float@spacing{#1}}
2273
2274 \newcommand*{\SingleSpacing}{%
2275 \setSpacing{\m@m@singlespace}%
2276 \edef\m@m@footnote@spacing{\baselinestretch}%
2277 \edef\m@m@float@spacing{\baselinestretch}%
2278 \@ifstar{}{\ifx\@nodocument\relax\vskip\baselineskip\fi}% correction for coming into single spacing
2279 }
2280 \SingleSpacing
2281
2282 \newcommand*{\@OnehalfSpacing}{
2283 \setSpacing{1.25}% default (10pt)
2284 \ifcase \@ptsize \relax % 10pt
2285 \setSpacing{1.25}%
2286 \or% 11pt
2287 \setSpacing{1.213}%
2288 \or% 12pt
2289 \setSpacing{1.241}%
2290 \or\or% 14pt
2291 \setSpacing{1.20}%
2292 \or\or\or% 17pt
2293 \setSpacing{1.16}%
2294 \or\or% 9pt
2295 \setSpacing{1.35}%
2296 \else% the extended sizes
2297 \setSpacing{1.16}%
2298 \fi}
2299 \newcommand*\OnehalfSpacing{%
2300 \@ifstar{%
2301 \@OnehalfSpacing%
2302 \edef\m@m@footnote@spacing{\baselinestretch}%
2303 \edef\m@m@float@spacing{\baselinestretch}%
2304 }{\@OnehalfSpacing}%
2305 }
2306
2307 \newcommand*{\@DoubleSpacing}{
2308 \setSpacing{1.667}% default (10pt)
2309 \ifcase \@ptsize \relax % 10pt
2310 \setSpacing{1.667}%
2311 \or% 11pt
2312 \setSpacing{1.618}%
2313 \or% 12pt
2314 \setSpacing{1.655}%
2315 \or\or% 14pt
2316 \setSpacing{1.60}%
2317 \or\or\or% 17pt
2318 \setSpacing{1.545}%
2319 \or\or% 9pt
2320 \setSpacing{1.8}%
2321 \else% larger sizes
2322 \setSpacing{1.5}%
2323 \fi}
2324 \newcommand*\DoubleSpacing{%
2325 \@ifstar{%
2326 \@DoubleSpacing%
2327 \edef\m@m@footnote@spacing{\baselinestretch}%
2328 \edef\m@m@float@spacing{\baselinestretch}%
2329 }{\@DoubleSpacing}%
2330 }
2331
2332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% check what this does!!!!!!!!
2333 % \renewcommand*{\@setsize}[4]{%
2334 % \@nomath#1%
2335 % \let\@currsize#1%
2336 % \baselineskip #2%
2337 % \baselineskip \baselinestretch\baselineskip
2338 % \parskip \baselinestretch\parskip
2339 % \setbox\strutbox \hbox{%
2340 % \vrule height.7\baselineskip
2341 % depth .3\baselineskip
2342 % width \z@}%
2343 % \skip\footins \baselinestretch\skip\footins
2344 % \normalbaselineskip\baselineskip#3#4}
2345
2346 \newenvironment{SingleSpace}{%
2347 \vskip\baselineskip
2348 \setSpacing{\m@m@singlespace}%
2349 \vskip -\baselineskip
2350 }{\par}
2351
2352 \newenvironment{SingleSpace*}{%
2353 %% \vskip\baselineskip
2354 \setSpacing{\m@m@singlespace}%
2355 \vskip 0.5\baselineskip
2356 }{\vskip -0.5\baselineskip}
2357
2358 \newcommand*{\m@mrestore@spacing}{%
2359 \par
2360 \vskip \parskip
2361 \vskip \baselineskip
2362 \endgroup
2363 \vskip -\parskip
2364 \vskip -\baselineskip}
2365
2366 \newenvironment{Spacing}[1]{%
2367 \par
2368 \begingroup
2369 \setSpacing{#1}}{\m@mrestore@spacing}
2370
2371 \newenvironment{OnehalfSpace}{%
2372 \begingroup
2373 \OnehalfSpacing}{\m@mrestore@spacing}
2374 \newenvironment{OnehalfSpace*}{%
2375 \begingroup
2376 \OnehalfSpacing*}{\m@mrestore@spacing}
2377
2378 \newenvironment{DoubleSpace}{%
2379 \begingroup
2380 \DoubleSpacing}{\m@mrestore@spacing}
2381 \newenvironment{DoubleSpace*}{%
2382 \begingroup
2383 \DoubleSpacing}{\m@mrestore@spacing}
2384
2385 \newcommand*{\memdskipstretch}{0.0}
2386 \newcommand*{\setDisplayskipStretch}[1]{%
2387 \renewcommand*{\memdskipstretch}{#1}}
2388 \newcommand*{\noDisplayskipStretch}{\setDisplayskipStretch{0.0}}
2389
2390 \newcommand*{\memdskips}{%
2391 \advance\abovedisplayskip \memdskipstretch\abovedisplayskip
2392 \advance\belowdisplayskip \memdskipstretch\belowdisplayskip
2393 \advance\abovedisplayshortskip \memdskipstretch\abovedisplayshortskip
2394 \advance\belowdisplayshortskip \memdskipstretch\belowdisplayshortskip}
2395 \everydisplay\expandafter{%
2396 \the\everydisplay
2397 \memdskips}
2398
2399 \AddToHook{cmd/@floatboxreset/after}{%
2400 \def\baselinestretch{\m@m@float@spacing}%
2401 \normalsize%
2402 \@nameuse{\@captype adjustment}%
2403 }
2404
2405 \newdimen\memPD
2406 \newenvironment{vminipage}{%
2407 \par
2408 \@ifnextchar[%]
2409 \@ivminipage
2410 {\@iiiminipage t\relax[s]}
2411 }{%
2412 \par\global\memPD=\prevdepth
2413 \endminipage
2414 \par
2415 \kern-\memPD% no pagebreak allowed here
2416 \hbox{\vrule depth \memPD width \z@}}
2417
2418 \def\@ivminipage[#1]{%
2419 \@ifnextchar[%]
2420 {\@iiminipage{t}}{\@iiiminipage{t}\relax[s]}}
2421 \newif\ifm@mnzpskip
2422 \newcommand*{\traditionalparskip}{%
2423 \setlength\parskip{0\p@ \@plus \p@}
2424 \m@mnzpskipfalse}
2425 \newskip\m@mabparskip
2426 \newcommand*{\abnormalparskip}[1]{%
2427 \setlength{\parskip}{#1}\m@mabparskip=#1\relax
2428 \m@mnzpskiptrue}
2429 \newcommand*{\nonzeroparskip}{\abnormalparskip{%
2430 0.5\baselineskip
2431 \@plus .1\baselineskip \@minus .1\baselineskip% NTG
2432 %% 0.5/baselineskip \@plus 2pt% RF
2433 }}
2434 \traditionalparskip
2435
2436 \newcommand{\pretitle}[1]{\def\@bspretitle{#1}}
2437 \newcommand{\posttitle}[1]{\def\@bsposttitle{#1}}
2438 \newcommand{\preauthor}[1]{\def\@bspreauthor{#1}}
2439 \newcommand{\postauthor}[1]{\def\@bspostauthor{#1}}
2440 \newcommand{\predate}[1]{\def\@bspredate{#1}}
2441 \newcommand{\postdate}[1]{\def\@bspostdate{#1}}
2442
2443 \pretitle{\begin{center}\LARGE}
2444 \posttitle{\par\end{center}\vskip 0.5em}
2445 \preauthor{\begin{center}
2446 \large \lineskip .5em%
2447 \begin{tabular}[t]{c}}
2448 \postauthor{\end{tabular}\par\end{center}}
2449 \predate{\begin{center}\large}
2450 \postdate{\par\end{center}}
2451
2452 \newcommand{\maketitlehooka}{}
2453 \newcommand{\maketitlehookb}{}
2454 \newcommand{\maketitlehookc}{}
2455 \newcommand{\maketitlehookd}{}
2456
2457 \newcommand{\thanksmarkseries}[1]{%
2458 \def\@bsmarkseries{\renewcommand{\thefootnote}%
2459 {\@nameuse{#1}{footnote}}}}
2460 \newcommand{\symbolthanksmark}{\thanksmarkseries{\fnsymbol}}
2461 \newcommand{\@bscontmark}{\setcounter{footnote}{0}}
2462 \newcommand{\continuousmarks}{\def\@bscontmark{}}
2463 \newcommand{\thanksheadextra}[2]{%
2464 \def\@bsthanksheadpre{#1}%
2465 \def\@bsthanksheadpost{#2}}
2466 \DeclareRobustCommand{\thanksmark}[1]{\footnotemark[#1]}
2467 \newcommand{\thanksgap}[1]{\hspace{#1}}
2468 \newcommand{\tamark}{\@thefnmark}
2469
2470 \newlength{\thanksmarkwidth}
2471 \newlength{\thanksmarksep}
2472 \newcommand{\thanksmarkstyle}[1]{\def\thanksscript##1{#1}}
2473 \thanksmarkstyle{\textsuperscript{#1}}
2474 \newcommand{\makethanksmarkhook}{}
2475
2476 \newcommand{\thanksfootmark}{%
2477 \ifdim\thanksmarkwidth < \z@
2478 \llap{\hb@xt@ -\thanksmarkwidth{%
2479 \hss\normalfont\thanksscript{\tamark}}%
2480 \hspace*{-\thanksmarkwidth}}%
2481 \else
2482 \ifdim\thanksmarkwidth = \z@
2483 {\normalfont\thanksscript{\tamark}}%
2484 \else
2485 \hb@xt@\thanksmarkwidth{\hss\normalfont\thanksscript{\tamark}}%
2486 \fi
2487 \fi}
2488
2489 \newcommand{\makethanksmark}{%
2490 \leavevmode%
2491 \parindent 1em\noindent
2492 \memRTLleftskip\thanksmarksep\relax
2493 \advance\memRTLleftskip\thanksmarkwidth
2494 \null\nobreak\hskip-\memRTLleftskip\relax
2495 \makethanksmarkhook\relax
2496 \thanksfootmark}
2497
2498 \newcommand{\usethanksrule}{\let\footnoterule\thanksrule}
2499 \newcommand{\cancelthanksrule}{\let\footnoterule\@bsfootnoterule}
2500
2501 \thanksmarkseries{fnsymbol} % symbols
2502 \thanksheadextra{}{}
2503 \setlength{\thanksmarkwidth}{1.8em}
2504 \setlength{\thanksmarksep}{-\thanksmarkwidth}
2505
2506 \AtBeginDocument{%
2507 \let\thanksrule\footnoterule
2508 \let\@bsfootnoterule\footnoterule
2509 }
2510
2511 \newlength{\droptitle}
2512 \setlength{\droptitle}{0pt}
2513
2514 \newcommand{\maketitle}{\par
2515 \begingroup
2516 \@bsmarkseries
2517 \def\@makefnmark{\@textsuperscript{%
2518 \normalfont\@bsthanksheadpre \tamark \@bsthanksheadpost}}%
2519 \long\def\@makefntext##1{\makethanksmark ##1}
2520 \if@twocolumn
2521 \ifnum \col@number=\@ne
2522 \@maketitle
2523 \else
2524 \twocolumn[\@maketitle]%
2525 \fi
2526 \else
2527 \ifdim\pagetotal>\z@
2528 \newpage
2529 \fi
2530 \global\@topnum\z@
2531 \@maketitle
2532 \fi
2533 \thispagestyle{title}\@thanks
2534 \endgroup
2535 \@bscontmark % \setcounter{footnote}{0}%
2536 }
2537 \aliaspagestyle{title}{plain}
2538
2539 \newcommand*{\@mem@titlefootkill}[1]{%
2540 \@memwarn{Do not use \string\footnote\space in
2541 \string\maketitle.\MessageBreak
2542 Use \protect\thanks\space instead}}
2543
2544 \newcommand{\@maketitle}{%
2545 \let\footnote\@mem@titlefootkill
2546 \ifdim\pagetotal>\z@
2547 \newpage
2548 \fi
2549 \null
2550 \vskip 2em%
2551 \vspace*{\droptitle}
2552 \maketitlehooka
2553 {\@bspretitle \@title \@bsposttitle}
2554 \maketitlehookb
2555 {\@bspreauthor \@author \@bspostauthor}
2556 \maketitlehookc
2557 {\@bspredate \@date \@bspostdate}
2558 \maketitlehookd
2559 \par
2560 \vskip 1.5em}
2561
2562 \NewDocumentCommand\settitlingpagenumbering{m}
2563 { \def\mem@titlingpage@numbering{#1} }
2564 \settitlingpagenumbering\arabic
2565
2566 \newcommand\titlingpageend[2]{%
2567 \def\mem@titlingpage@clear@for@twoside{#1}%
2568 \def\mem@titlingpage@clear@for@oneside{#2}%
2569 }
2570 % default
2571 \titlingpageend{\cleardoublepage}{\clearpage}
2572 \newenvironment{mem@titlingpage}%
2573 {\let\footnoterule\relax
2574 \let\footnotesize\small
2575 \def\thepage{\mem@titlingpage@numbering{page}}
2576 \if@twocolumn
2577 \@restonecoltrue\onecolumn
2578 \else
2579 \@restonecolfalse
2580 \fi
2581 \thispagestyle{titlingpage}%
2582 \if\mem@titlpg@reset\setcounter{page}{\@ne}\fi%
2583 }{%
2584 \thispagestyle{titlingpage}%
2585 \if@restonecol \twocolumn \fi
2586 % \if@twoside \cleardoublepage \else \clearpage \fi
2587 \if@twoside \mem@titlingpage@clear@for@twoside \else \mem@titlingpage@clear@for@oneside \fi
2588 \if\mem@titlpg@reset\setcounter{page}{\@ne}\fi}
2589 \newenvironment{titlingpage}{%
2590 \def\mem@titlpg@reset{00}%
2591 \begin{mem@titlingpage}}{%
2592 \end{mem@titlingpage}}
2593 \newenvironment{titlingpage*}{%
2594 \def\mem@titlpg@reset{01}%
2595 \begin{mem@titlingpage}}{%
2596 \end{mem@titlingpage}}
2597 \aliaspagestyle{titlingpage}{empty}
2598
2599 \newcommand{\emptythanks}{\global\let\@thanks\@empty}
2600
2601 \newcommand*{\andnext}{%
2602 \end{tabular}\\ \begin{tabular}[t]{c}}
2603
2604 \newcommand{\@bsmtitlempty}{%
2605 \global\let\maketitle\relax
2606 \global\let\@maketitle\relax
2607 \global\let\title\relax
2608 \global\let\author\relax
2609 \global\let\date\relax
2610 \global\let\thanksmarkseries\relax
2611 \global\let\thanksfootextra\relax
2612 \global\let\thanksmark\relax
2613 \global\let\thanksgap\relax}
2614
2615 \newcommand{\keepthetitle}{%
2616 \@bsmtitlempty
2617 \global\let\thanks\relax
2618 \global\let\and\relax
2619 \global\let\andnext\relax
2620 \global\let\@thanks\@empty
2621 \global\let\@title\@empty
2622 \global\let\@author\@empty
2623 \global\let\@date\@empty}
2624
2625 \newcommand{\killtitle}{%
2626 \keepthetitle
2627 \global\let\thetitle\relax
2628 \global\let\theauthor\relax
2629 \global\let\thedate\relax}
2630
2631 % \addtoiargdef{\title}{%
2632 % \begingroup\let\footnote\@gobble}{%
2633 % \begingroup
2634 % \renewcommand{\thanks}[1]{}
2635 % \renewcommand{\thanksmark}[1]{}
2636 % \renewcommand{\thanksgap}[1]{}
2637 % \protected@xdef\thetitle{#1}
2638 % \endgroup\endgroup}
2639
2640 \xpretocmd\title{\begingroup\let\footnote\@gobble}{}{\typeout{patch 1 to \string\title\space failed, please inform maintainer}}
2641 \xapptocmd\title{
2642 \begingroup%
2643 \renewcommand{\thanks}[1]{}%
2644 \renewcommand{\thanksmark}[1]{}%
2645 \renewcommand{\thanksgap}[1]{}%
2646 \protected@xdef\thetitle{#1}%
2647 \endgroup\endgroup%
2648 }{}{\typeout{patch 2 to \string\title\space failed, please inform maintainer}}
2649
2650 % \addtoiargdef{\author}{%
2651 % \begingroup\let\footnote\@gobble}{%
2652 % \begingroup
2653 % \renewcommand{\thanks}[1]{}
2654 % \renewcommand{\and}{\unskip, }
2655 % \renewcommand{\andnext}{\unskip, }
2656 % \renewcommand{\thanksmark}[1]{}
2657 % \renewcommand{\thanksgap}[1]{}
2658 % \protected@xdef\theauthor{#1}
2659 % \endgroup\endgroup}
2660
2661 \xpretocmd\author{\begingroup\let\footnote\@gobble}{}{\typeout{patch 1 to \string\author\space failed, please inform maintainer}}
2662 \xapptocmd\author{%
2663 \begingroup%
2664 \renewcommand{\thanks}[1]{}%
2665 \renewcommand{\and}{\unskip, }%
2666 \renewcommand{\andnext}{\unskip, }%
2667 \renewcommand{\thanksmark}[1]{}%
2668 \renewcommand{\thanksgap}[1]{}%
2669 \protected@xdef\theauthor{#1}%
2670 \endgroup\endgroup%
2671 }{}{\typeout{patch 1 to \string\author\space failed, please inform maintainer}}
2672
2673 % \addtoiargdef{\date}{%
2674 % \begingroup\let\footnote\@gobble}{%
2675 % \begingroup
2676 % \renewcommand{\thanks}[1]{}
2677 % \renewcommand{\thanksmark}[1]{}
2678 % \renewcommand{\thanksgap}[1]{}
2679 % \protected@xdef\thedate{#1}
2680 % \endgroup\endgroup}
2681
2682 \xpretocmd\date{\begingroup\let\footnote\@gobble}{}{\typeout{patch 1 to \string\date\space failed, please inform maintainer}}
2683 \xapptocmd\date{%
2684 \begingroup%
2685 \renewcommand{\thanks}[1]{}%
2686 \renewcommand{\thanksmark}[1]{}%
2687 \renewcommand{\thanksgap}[1]{}%
2688 \protected@xdef\thedate{#1}%
2689 \endgroup\endgroup%
2690 }{}{\typeout{patch 2 to \string\date\space failed, please inform maintainer}}
2691
2692 \newcommand*{\bookpagemark}[1]{\markboth{}{}}
2693 \newcommand*{\partmark}[1]{\markboth{}{}}
2694 \newcommand*{\chaptermark}[1]{}
2695
2696 \newcommand*{\bibmark}{}
2697 \newcommand*{\indexmark}{}
2698 \newcommand*{\glossarymark}{}
2699
2700 \setcounter{secnumdepth}{2}
2701 \newcounter{book} \setcounter{book}{0}
2702 \newcounter{part} \setcounter{part}{0}
2703 \newcounter{chapter} \setcounter{chapter}{0}
2704 \newcounter{section}[chapter]
2705 \newcounter{subsection}[section]
2706 \newcounter{subsubsection}[subsection]
2707 \newcounter{paragraph}[subsubsection]
2708 \newcounter{subparagraph}[paragraph]
2709 \renewcommand*{\thebook}{\@Roman\c@book}
2710 \renewcommand*{\thepart}{\@Roman\c@part}
2711 \renewcommand*{\thechapter}{\@arabic\c@chapter}
2712 \renewcommand*{\thesection}{\thechapter.\@arabic\c@section}
2713 \renewcommand*{\thesubsection}{%
2714 \thesection.\@arabic\c@subsection}
2715 \renewcommand*{\thesubsubsection}{%
2716 \thesubsection.\@arabic\c@subsubsection}
2717 \renewcommand*{\theparagraph}{%
2718 \thesubsubsection.\@arabic\c@paragraph}
2719 \renewcommand*{\thesubparagraph}{%
2720 \theparagraph.\@arabic\c@subparagraph}
2721 \newcommand{\@chapapp}{\chaptername}
2722
2723 \newcommand{\frontmatter}{%
2724 \@ifstar{\@smemfront}{\@memfront}}
2725 \newcommand\@memfront@floats{%
2726 \counterwithout{figure}{chapter}
2727 \counterwithout{table}{chapter}
2728 }
2729 \newcommand{\@smemfront}{%
2730 \cleardoublepage
2731 \@mainmatterfalse
2732 \setcounter{secnumdepth}{-10}
2733 \@memfront@floats
2734 }
2735 \newcommand{\@memfront}{%
2736 \@smemfront\pagenumbering{roman}}
2737
2738 \newcommand{\mainmatter}{%
2739 \@ifstar{\@smemmain}{\@memmain}}
2740 \newcommand\@memmain@floats{%
2741 \counterwithin{figure}{chapter}
2742 \counterwithin{table}{chapter}
2743 }
2744 \newcommand*{\@smemmain}{%
2745 \@mainmattertrue
2746 \setcounter{secnumdepth}{\value{maxsecnumdepth}}
2747 \ifartopt
2748 \if@twoside
2749 \cleardoublepage
2750 \else
2751 \clearpage
2752 \fi
2753 \else
2754 \cleardoublepage
2755 \@memmain@floats
2756 \fi}
2757 \newcommand{\@memmain}{%
2758 \@smemmain\pagenumbering{arabic}}
2759
2760 \newcommand\@memback@floats{%
2761 \counterwithout{figure}{chapter}
2762 \counterwithout{table}{chapter}
2763 \setcounter{figure}{0}
2764 \setcounter{table}{0}
2765 }
2766 \newcommand{\backmatter}{%
2767 \ifartopt
2768 \clearpage
2769 \else
2770 \if@openright
2771 \cleardoublepage
2772 \else
2773 \clearpage
2774 \fi
2775 \fi
2776 \@mainmatterfalse
2777 \setcounter{secnumdepth}{-10}
2778 \ifartopt\else
2779 \@memback@floats
2780 \fi}
2781
2782 \def\theHbook{\the\value{book}}
2783 \def\toclevel@book{-2}
2784
2785 \newcommand*{\book}{%
2786 \@setupbook
2787 \secdef\@book\@sbook}
2788 \newcommand*{\beforebookskip}{\null\vfil}
2789 \newcommand*{\midbookskip}{\par\vskip 2\onelineskip}
2790 \newcommand*{\afterbookskip}{\vfil\newpage}
2791
2792 \newcommand{\@setupbook}{%
2793 \if@openright
2794 \cleardoublepage
2795 \else
2796 \clearpage
2797 \fi
2798 \thispagestyle{book}%
2799 \if@twocolumn
2800 \onecolumn
2801 \@tempswatrue
2802 \else
2803 \@tempswafalse
2804 \fi
2805 \beforebookskip}
2806
2807 \newcommand*{\booknamefont}{\normalfont\huge\bfseries}
2808 \newcommand*{\booknumfont}{\normalfont\huge\bfseries}
2809 \newcommand*{\booktitlefont}{\normalfont\Huge\bfseries}
2810
2811 \newcommand*{\printbookname}{\booknamefont \bookname}
2812 \newcommand*{\booknamenum}{\space}
2813 \newcommand*{\printbooknum}{\booknumfont \thebook}
2814 \newcommand*{\printbooktitle}[1]{\booktitlefont #1}
2815
2816 \newcommand{\membookinfo}[3]{}
2817 \newcommand{\membookstarinfo}[1]{}
2818
2819 \long\def\@book[#1]#2{%
2820 \M@gettitle{#1}%
2821 \def\f@rtoc{#1}%
2822 \@nameuse{book@f@rtoc@before@write@hook}%
2823 % \phantomsection
2824 \mempreaddbooktotochook
2825 \ifnum \c@secnumdepth >-3\relax
2826 \refstepcounter{book}%
2827 \addcontentsline{toc}{book}%
2828 {\protect\booknumberline{\thebook}\f@rtoc}%
2829 \membookinfo{\thebook}{\f@rtoc}{#2}%
2830 \else
2831 \MakeLinkTarget[book]{}%
2832 \addcontentsline{toc}{book}{\f@rtoc}%
2833 \membookinfo{}{\f@rtoc}{#2}%
2834 \fi
2835 \mempostaddbooktotochook
2836 \bookpagemark{#1}%
2837 {\centering
2838 \interlinepenalty \@M
2839 \parskip\z@
2840 \normalfont
2841 \ifnum \c@secnumdepth >-3\relax
2842 \printbookname \booknamenum \printbooknum
2843 \midbookskip
2844 \fi
2845 \printbooktitle{#2}\par}%
2846 \@endbook}
2847
2848 \newcommand\mempreaddbooktotochook{}
2849 \newcommand\mempostaddbooktotochook{}
2850
2851 \long\def\@sbook#1{%
2852 \M@gettitle{#1}%
2853 % \phantomsection
2854 \MakeLinkTarget[book]{}%
2855 \membookstarinfo{#1}%
2856 {\centering
2857 \interlinepenalty \@M
2858 \parskip\z@
2859 \normalfont
2860 \printbooktitle{#1}\par}%
2861 \@endbook}
2862
2863 \newif\ifm@mnobooknewpage
2864 \m@mnobooknewpagefalse
2865 \newcommand*{\bookblankpage}{\m@mnobooknewpagefalse}
2866 \newcommand*{\nobookblankpage}{\m@mnobooknewpagetrue}
2867
2868 \newcommand*{\bookpageend}{\afterbookskip
2869 \ifm@mnobooknewpage
2870 \else
2871 \if@twoside
2872 \if@openright
2873 \null
2874 \thispagestyle{afterbook}%
2875 \newpage
2876 \fi
2877 \fi
2878 \fi
2879 \if@tempswa
2880 \twocolumn
2881 \fi}
2882 \def\@endbook{\bookpageend}
2883
2884 \aliaspagestyle{book}{empty}
2885 \aliaspagestyle{afterbook}{empty}
2886
2887 \newcommand{\part}{%
2888 \@setuppart
2889 \secdef\@part\@spart}
2890 \newcommand{\beforepartskip}{\null\vfil}
2891 \newcommand{\midpartskip}{\par\vskip 2\onelineskip}
2892 \newcommand{\afterpartskip}{\vfil\newpage}
2893
2894 \newcommand{\@setuppart}{%
2895 \if@openright
2896 \cleardoublepage
2897 \else
2898 \clearpage
2899 \fi
2900 \thispagestyle{part}%
2901 \if@twocolumn
2902 \onecolumn
2903 \@tempswatrue
2904 \else
2905 \@tempswafalse
2906 \fi
2907 \beforepartskip}
2908
2909 \newcommand{\partnamefont}{\normalfont\huge\bfseries}
2910 \newcommand{\partnumfont}{\normalfont\huge\bfseries}
2911 \newcommand{\parttitlefont}{\normalfont\Huge\bfseries}
2912
2913 \newcommand{\printpartname}{\partnamefont \partname}
2914 \newcommand{\partnamenum}{\space}
2915 \newcommand{\printpartnum}{\partnumfont \thepart}
2916 \newcommand{\printparttitle}[1]{\parttitlefont #1}
2917
2918 \newcommand{\mempartinfo}[3]{}
2919 \newcommand{\mempartstarinfo}[1]{}
2920
2921 \long\def\@part[#1]#2{%
2922 \M@gettitle{#1}%
2923 \def\f@rtoc{#1}%
2924 \@nameuse{part@f@rtoc@before@write@hook}%
2925 %\phantomsection
2926 \mempreaddparttotochook
2927 \ifnum \c@secnumdepth >-2\relax
2928 \refstepcounter{part}%
2929 \addcontentsline{toc}{part}%
2930 {\protect\partnumberline{\thepart}\f@rtoc}%
2931 \mempartinfo{\thepart}{\f@rtoc}{#2}%
2932 \else
2933 \MakeLinkTarget[part]{}%
2934 \addcontentsline{toc}{part}{\f@rtoc}%
2935 \mempartinfo{}{\f@rtoc}{#2}%
2936 \fi
2937 \mempostaddparttotochook
2938 \partmark{#1}%
2939 {\centering
2940 \interlinepenalty \@M
2941 \parskip\z@
2942 \normalfont
2943 \ifnum \c@secnumdepth >-2\relax
2944 \printpartname \partnamenum \printpartnum
2945 \midpartskip
2946 \fi
2947 \printparttitle{#2}\par}%
2948 \@endpart}
2949
2950 \newcommand\mempreaddparttotochook{}
2951 \newcommand\mempostaddparttotochook{}
2952
2953 \long\def\@spart#1{%
2954 \M@gettitle{#1}%
2955 % \phantomsection
2956 \MakeLinkTarget[part]{}%
2957 \mempartstarinfo{#1}%
2958 {\centering
2959 \interlinepenalty \@M
2960 \parskip\z@
2961 \normalfont
2962 \printparttitle{#1}\par}%
2963 \@endpart}
2964
2965 \newif\ifm@mnopartnewpage
2966 \m@mnopartnewpagefalse
2967 \newcommand*{\partblankpage}{\m@mnopartnewpagefalse}
2968 \newcommand*{\nopartblankpage}{\m@mnopartnewpagetrue}
2969
2970 \newcommand*{\partpageend}{\afterpartskip
2971 \ifm@mnopartnewpage
2972 \else
2973 \if@twoside
2974 \if@openright
2975 \null
2976 \thispagestyle{afterpart}%
2977 \newpage
2978 \fi
2979 \fi
2980 \fi
2981 \if@tempswa
2982 \twocolumn
2983 \fi}
2984 \def\@endpart{\partpageend}
2985
2986 \aliaspagestyle{afterpart}{empty}
2987
2988 \newcommand\chapter{%
2989 \ifartopt\par\@nameuse{chapterblock}\else
2990 \clearforchapter
2991 \thispagestyle{chapter}
2992 \global\@topnum\z@
2993 \fi
2994 \m@mindentafterchapter
2995 \@ifstar{\@m@mschapter}{\@m@mchapter}}
2996
2997 \newcommand*\indentafterchapter{\def\m@mindentafterchapter{\@afterindenttrue}}
2998 \newcommand*\noindentafterchapter{\def\m@mindentafterchapter{\@afterindentfalse}}
2999 \noindentafterchapter
3000
3001 \newcommand{\@m@mchapter}[1][]{%
3002 \def\ch@pt@c{#1}% capture first optional arg
3003 \@ifnextchar[{\@chapter}{\@chapter[]}%
3004 }
3005 \def\m@m@empty{\@empty}
3006
3007 \newcommand{\memchapinfo}[4]{}
3008 \newcommand{\memchapstarinfo}[2]{}
3009 \newcommand{\memappchapinfo}[4]{}
3010 \newcommand{\memappchapstarinfo}[2]{}
3011
3012 \newif\ifm@mpn@new@chap
3013 \m@mpn@new@chapfalse
3014 \newif\ifm@mpn@new@schap
3015 \m@mpn@new@schapfalse
3016
3017 \def\@chapter[#1]#2{%
3018 \m@mpn@new@chaptrue%
3019 \m@mpn@new@schapfalse%
3020 \def\f@rbdy{#2}%
3021 \ifx\ch@pt@c\@empty % no optional args
3022 \def\f@rtoc{#2}%
3023 \def\f@rhdr{#2}%
3024 \else % at least one opt arg
3025 \let\f@rtoc\ch@pt@c
3026 \ifx\@empty#1\@empty
3027 \let\f@rhdr\ch@pt@c
3028 \else
3029 \def\f@rhdr{#1}%
3030 \fi
3031 \fi
3032 \m@m@Andfalse
3033 \ifnum \c@secnumdepth >\m@ne
3034 \if@mainmatter
3035 \m@m@Andtrue
3036 \fi
3037 \fi
3038 \ifm@m@And
3039 \refstepcounter{chapter}%
3040 \typeout{\@chapapp\space\thechapter.}%
3041 \else
3042 \MakeLinkTarget[chapter]{}%
3043 \fi
3044 \ifartopt
3045 \@makechapterhead{#2}%
3046 \@afterheading
3047 \chaptermark{\f@rhdr}%
3048 \else
3049 \chaptermark{\f@rhdr}
3050 \insertchapterspace
3051 \if@twocolumn
3052 \@topnewpage[\@makechapterhead{#2}]%
3053 \else
3054 \@makechapterhead{#2}%
3055 \fi
3056 \@afterheading
3057 \fi
3058 \@nameuse{chapter@f@rtoc@before@write@hook}%
3059 \mempreaddchaptertotochook%
3060 \ifm@m@And
3061 \ifanappendix
3062 \addcontentsline{toc}{appendix}{%
3063 \protect\chapternumberline{\thechapter}\f@rtoc}%
3064 \memappchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{#2}%
3065 \else
3066 \addcontentsline{toc}{chapter}{%
3067 \protect\chapternumberline{\thechapter}\f@rtoc}%
3068 \memchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{#2}%
3069 \fi
3070 \else
3071 \addcontentsline{toc}{chapter}{\f@rtoc}%
3072 \ifanappendix
3073 \memappchapinfo{}{\f@rtoc}{\f@rhdr}{#2}%
3074 \else
3075 \memchapinfo{}{\f@rtoc}{\f@rhdr}{#2}%
3076 \fi
3077 \fi
3078 \mempostaddchaptertotochook%
3079 \ifheadnameref\ExpandArgs{V}\M@gettitle\f@rhdr\else\ExpandArgs{V}\M@gettitle\f@rtoc\fi%
3080 \memendofchapterhook%
3081 }
3082
3083 \newcommand\mempreaddchaptertotochook{}
3084 \newcommand\mempostaddchaptertotochook{}
3085 \newcommand\memendofchapterhook{}
3086 \newcommand\settocpreprocessor[2]{%
3087 \MarkDeprecated{\settocpreprocessor}{in 2026, the problem it tried to solve \MessageBreak
3088 (see manual, section 9.2.3),\MessageBreak
3089 has been fixed in the kernel, and the feature is\MessageBreak
3090 no longer needed.}%
3091 \@namedef{#1@f@rtoc@before@write@hook}{#2}}
3092 \def\@makechapterhead#1{%
3093 \chapterheadstart%
3094 {%
3095 \parskip \z@
3096 \parindent \z@ \memRTLraggedright \normalfont
3097 \ifm@m@And
3098 \printchaptername \chapternamenum \printchapternum
3099 \afterchapternum %
3100 \else
3101 \printchapternonum
3102 \fi
3103 \interlinepenalty\@M
3104 \printchaptertitle{#1} %
3105 \afterchaptertitle %
3106 }}
3107
3108 \newcommand*{\insertchapterspace}{%
3109 \addtocontents{lof}{\protect\addvspace{10pt}}%
3110 \addtocontents{lot}{\protect\addvspace{10pt}}}
3111
3112 \newlength{\beforechapskip} \setlength{\beforechapskip}{50pt}
3113 \newlength{\midchapskip} \setlength{\midchapskip}{20pt}
3114 \newlength{\afterchapskip} \setlength{\afterchapskip}{40pt}
3115
3116 \newcommand{\@chs@def@ult}{%
3117 \def\chapterheadstart{\vspace*{\beforechapskip}}%
3118 \def\printchaptername{\chapnamefont \@chapapp}%
3119 \def\chapternamenum{\space}%
3120 \def\printchapternum{\chapnumfont \thechapter}%
3121 \def\afterchapternum{\par\nobreak\vskip \midchapskip}%
3122 \def\printchapternonum{}%
3123 \def\printchaptertitle##1{\chaptitlefont ##1}%
3124 \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}%
3125 \def\chapnamefont{\normalfont\huge\bfseries}%
3126 \def\chapnumfont{\normalfont\huge\bfseries}%
3127 \def\chaptitlefont{\normalfont\Huge\bfseries}%
3128 \setlength{\beforechapskip}{50pt}%
3129 \setlength{\midchapskip}{20pt}%
3130 \setlength{\afterchapskip}{40pt}}
3131
3132 \newcommand{\@m@mschapter}[2][\@empty]{%
3133 \@schapter{#2}%
3134 \ifx \@empty#1
3135 \def\f@rhdr{#2}%
3136 \else% opt arg
3137 \def\f@rhdr{#1}%
3138 \setcounter{secnumdepth}{-10}%
3139 \chaptermark{#1}%
3140 \setcounter{secnumdepth}{\value{maxsecnumdepth}}%
3141 \fi
3142 \ifanappendix
3143 \memappchapstarinfo{\f@rhdr}{#2}%
3144 \else
3145 \memchapstarinfo{\f@rhdr}{#2}%
3146 \fi
3147 \ifheadnameref\ExpandArgs\M@gettitle\f@rhdr\else\M@gettitle{#2}\fi}
3148
3149 \newcommand{\@schapter}[1]{%
3150 \m@mpn@new@schaptrue%
3151 \m@mpn@new@chapfalse%
3152 \MakeLinkTarget[chapter]{}%
3153 \def\f@rbdy{#1}%
3154 \ifartopt
3155 \@makeschapterhead{#1}%
3156 \else
3157 \if@twocolumn
3158 \@topnewpage[\@makeschapterhead{#1}]%
3159 \else
3160 \@makeschapterhead{#1}%
3161 \fi
3162 \fi
3163 \@afterheading}
3164
3165 \def\@makeschapterhead#1{%
3166 \chapterheadstart
3167 {%
3168 \parskip \z@%
3169 \parindent \z@ \memRTLraggedright \normalfont
3170 \printchapternonum
3171 \interlinepenalty\@M
3172 \printchaptertitle{#1}%
3173 \afterchaptertitle}%
3174 }
3175
3176 \newcommand{\makechapterstyle}[2]{\@namedef{chs@#1}{\@chs@def@ult #2}}
3177 \newcommand{\chapterstyle}[1]{\@nameuse{chs@#1}}
3178
3179 \makechapterstyle{default}{}%
3180 %% \setlength{\beforechapskip}{50pt}
3181 %% \def\chapterheadstart{\vspace*{\beforechapskip}}
3182 %% \def\chapnamefont{\normalfont\huge\bfseries}
3183 %% \def\printchaptername{\chapnamefont \@chapapp}
3184 %% \def\chapternamenum{\space}
3185 %% \def\chapnumfont{\normalfont\huge\bfseries}
3186 %% \def\printchapternum{\chapnumfont \thechapter}
3187 %% \setlength{\midchapskip}{20pt}
3188 %% \def\afterchapternum{\par\nobreak\vskip \midchapskip}
3189 %% \def\printchapternonum{}
3190 %% \def\chaptitlefont{\normalfont\Huge\bfseries}
3191 %% \def\printchaptertitle##1{\chaptitlefont ##1}
3192 %% \setlength{\afterchapskip}{40pt}
3193 %% \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}
3194 \chapterstyle{default}
3195
3196 \makechapterstyle{section}{%
3197 \chapterstyle{default}
3198 \renewcommand{\printchaptername}{}
3199 \renewcommand{\chapternamenum}{}
3200 \renewcommand{\chapnumfont}{\normalfont\Huge\bfseries}
3201 \renewcommand{\printchapternum}{\chapnumfont \thechapter\space}
3202 \renewcommand{\afterchapternum}{}}
3203
3204 \makechapterstyle{article}{%
3205 \chapterstyle{default}
3206 \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex}
3207 \renewcommand*{\chapterheadstart}{\addvspace{\beforechapskip}}
3208 \setlength{\afterchapskip}{2.3ex \@plus .2ex}
3209 \renewcommand{\printchaptername}{}
3210 \renewcommand{\chapternamenum}{}
3211 \renewcommand{\chaptitlefont}{\normalfont\Large\bfseries}
3212 \renewcommand{\chapnumfont}{\chaptitlefont}
3213 \renewcommand{\printchapternum}{\chapnumfont \thechapter\quad}
3214 \renewcommand{\afterchapternum}{}}
3215
3216 \makechapterstyle{reparticle}{%
3217 \chapterstyle{default}
3218 \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex}
3219 \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}}
3220 \setlength{\afterchapskip}{2.3ex \@plus .2ex}
3221 \renewcommand*{\printchaptername}{}
3222 \renewcommand*{\chapternamenum}{}
3223 \renewcommand*{\chaptitlefont}{\normalfont\Large\bfseries}
3224 \renewcommand*{\chapnumfont}{\chaptitlefont}
3225 \renewcommand*{\printchapternum}{\@hangfrom{\chapnumfont \thechapter\quad}}%
3226 \renewcommand*{\afterchapternum}{}}
3227
3228 \newcommand*{\reparticle}{%
3229 \chapterstyle{reparticle}
3230 \setsecheadstyle{\normalfont\large\bfseries\memRTLraggedright}%
3231 \setsubsecheadstyle{\normalfont\bfseries\memRTLraggedright}%
3232 }
3233
3234 \makechapterstyle{hangnum}{%
3235 \chapterstyle{default}
3236 \renewcommand*{\chapnumfont}{\chaptitlefont}
3237 \settowidth{\chapindent}{\chapnumfont 999}
3238 \renewcommand*{\printchaptername}{}
3239 \renewcommand*{\chapternamenum}{}
3240 \renewcommand*{\printchapternum}{%
3241 \noindent\llap{\makebox[\chapindent][l]{\chapnumfont \thechapter}}}
3242 \renewcommand*{\afterchapternum}{}}
3243
3244 \newlength{\chapindent}
3245
3246 \makechapterstyle{companion}{%
3247 \chapterstyle{default}
3248 \renewcommand*{\chapnamefont}{\normalfont\LARGE\scshape}
3249 \renewcommand*{\printchaptername}{\raggedleft\chapnamefont \@chapapp}
3250 \renewcommand*{\chapnumfont}{\normalfont\Huge}
3251 \setlength{\chapindent}{\marginparsep}
3252 \addtolength{\chapindent}{\marginparwidth}
3253 \renewcommand*{\printchaptertitle}[1]{%
3254 \begin{adjustwidth}{}{-\chapindent}
3255 \raggedleft \chaptitlefont ##1\par\nobreak
3256 \end{adjustwidth}}}
3257
3258 \makechapterstyle{demo}{%
3259 \chapterstyle{default}
3260 \renewcommand*{\printchaptername}{\centering}
3261 \renewcommand*{\printchapternum}{\chapnumfont \numtoName{\c@chapter}}
3262 \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
3263 \renewcommand*{\printchaptertitle}[1]{%
3264 \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
3265 \renewcommand*{\afterchaptertitle}%
3266 {\vskip\onelineskip \hrule\vskip \afterchapskip}}
3267
3268 \makechapterstyle{bianchi}{%
3269 \chapterstyle{default}
3270 \renewcommand*{\chapnamefont}{\normalfont\Large\sffamily\itshape}
3271 \renewcommand*{\chapnumfont}{\normalfont\huge}
3272 \renewcommand*{\printchaptername}{%
3273 \chapnamefont\centering\@chapapp}
3274 \renewcommand*{\printchapternum}{\chapnumfont \textit{\thechapter}}
3275 \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
3276 \renewcommand*{\printchaptertitle}[1]{%
3277 \hrule\vskip\onelineskip \centering \chaptitlefont\textbf{##1}\par}
3278 \renewcommand*{\afterchaptertitle}{\vskip\onelineskip \hrule\vskip
3279 \afterchapskip}
3280 \renewcommand*{\printchapternonum}{%
3281 \vphantom{\chapnumfont \textit{9}}\afterchapternum}}
3282
3283 \makechapterstyle{bringhurst}{%
3284 \chapterstyle{default}
3285 \renewcommand*{\chapterheadstart}{}
3286 \renewcommand*{\printchaptername}{}
3287 \renewcommand*{\chapternamenum}{}
3288 \renewcommand*{\printchapternum}{}
3289 \renewcommand*{\afterchapternum}{}
3290 \renewcommand*{\printchaptertitle}[1]{%
3291 \memRTLraggedright\Large\scshape\MakeLowercase{##1}}
3292 \renewcommand*{\afterchaptertitle}{%
3293 \vskip\onelineskip \hrule\vskip\onelineskip}}
3294
3295 \makechapterstyle{brotherton}{%
3296 \chapterstyle{default}
3297 \renewcommand*{\printchapternum}{\chapnumfont
3298 \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}}
3299
3300 \makechapterstyle{chappell}{%
3301 \chapterstyle{default}
3302 \setlength{\beforechapskip}{0pt}
3303 \renewcommand*{\chapnamefont}{\large\centering}
3304 \renewcommand*{\chapnumfont}{\large}
3305 \renewcommand*{\printchapternonum}{%
3306 \vphantom{\printchaptername \chapnumfont 1}
3307 \afterchapternum
3308 \vskip \onelineskip \vskip -\topskip}
3309 \renewcommand*{\chaptitlefont}{\Large\itshape}
3310 \renewcommand*{\printchaptertitle}[1]{%
3311 \hrule\vskip\onelineskip \centering\chaptitlefont ##1}}
3312
3313 \makechapterstyle{culver}{%
3314 \chapterstyle{default}
3315 \chapterstyle{article}%
3316 \renewcommand*{\thechapter}{\Roman{chapter}}
3317 \renewcommand*{\printchapternum}{% center number/title
3318 \centering\chapnumfont \thechapter\space\space}%
3319 \renewcommand*{\printchapternonum}{\centering}
3320 \renewcommand*{\clearforchapter}{}% no new page
3321 \aliaspagestyle{chapter}{headings}}% no special pagestyle
3322
3323 \makechapterstyle{dash}{%
3324 \chapterstyle{default}
3325 \setlength{\beforechapskip}{5\onelineskip}
3326 \renewcommand*{\printchaptername}{}
3327 \renewcommand*{\chapternamenum}{}
3328 \renewcommand*{\chapnumfont}{\normalfont\large}
3329 \settoheight{\midchapskip}{\chapnumfont 1}
3330 \renewcommand*{\printchapternum}{\centering \chapnumfont
3331 \rule[0.5\midchapskip]{1em}{0.4pt} \thechapter\
3332 \rule[0.5\midchapskip]{1em}{0.4pt}}
3333 \renewcommand*{\afterchapternum}{\par\nobreak\vskip 0.5\onelineskip}
3334 \renewcommand*{\printchapternonum}{\centering
3335 \vphantom{\chapnumfont 1}\afterchapternum}
3336 \renewcommand*{\chaptitlefont}{\normalfont\Large}
3337 \renewcommand*{\printchaptertitle}[1]{\centering \chaptitlefont ##1}
3338 \setlength{\afterchapskip}{2.5\onelineskip}}
3339
3340 \makechapterstyle{demo2}{%
3341 \chapterstyle{default}
3342 \renewcommand*{\printchaptername}{\centering}
3343 \renewcommand*{\printchapternum}{\chapnumfont
3344 \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}
3345 \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
3346 \renewcommand*{\printchaptertitle}[1]{%
3347 \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
3348 \renewcommand*{\afterchaptertitle}{%
3349 \vskip\onelineskip \hrule\vskip \afterchapskip}
3350 \setlength{\beforechapskip}{3\baselineskip}
3351 \renewcommand*{\printchapternonum}{%
3352 \vphantom{\chapnumfont One}
3353 \afterchapternum%
3354 \vskip\topskip}
3355 \setlength{\beforechapskip}{2\onelineskip}}
3356
3357 \makechapterstyle{demo3}{%
3358 \chapterstyle{default}
3359 \renewcommand*{\printchaptername}{\centering}
3360 \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape}
3361 \renewcommand*{\printchapternum}{\chapnumfont
3362 \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}
3363 \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
3364 \renewcommand*{\printchaptertitle}[1]{%
3365 \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
3366 \renewcommand*{\afterchaptertitle}{%
3367 \vskip\onelineskip \hrule\vskip \afterchapskip}
3368 \setlength{\beforechapskip}{0pt}
3369 \setlength{\midchapskip}{2\onelineskip}
3370 \setlength{\afterchapskip}{2\onelineskip}
3371 \renewcommand*{\printchapternonum}{%
3372 \vphantom{\chapnumfont One}
3373 \afterchapternum%
3374 \vskip\topskip}}
3375
3376 \newcommand\chs@ell@helper[1]{%
3377 \par%
3378 \begin{adjustwidth}{}{-\chapindent}
3379 \begin{tabularx}{\linewidth}{>{\raggedleft\arraybackslash}X|}%|emacs
3380 \leavevmode\chapnumfont #1\vphantom{1}%
3381 \hspace*{3.6pt}%
3382 \rule[-13.5pt]{0pt}{14.8mm}%
3383 \\%
3384 \hline%
3385 \end{tabularx}%
3386 \end{adjustwidth}%
3387 \par%
3388 }%
3389
3390 \makechapterstyle{ell}{%
3391 \chapterstyle{default}
3392 \renewcommand*{\chapnumfont}{\normalfont\HUGE\sffamily}
3393 \renewcommand*{\chaptitlefont}{\normalfont\huge\sffamily}
3394 \settowidth{\chapindent}{\chapnumfont 111}
3395 % \renewcommand*{\chapterheadstart}{\begingroup
3396 % \vspace*{\beforechapskip}%
3397 % \begin{adjustwidth}{}{-\chapindent}%
3398 % \hrulefill
3399 % \smash{\rule{0.4pt}{15mm}}
3400 % \end{adjustwidth}\endgroup}
3401 \renewcommand*{\printchaptername}{}
3402 \renewcommand*{\chapternamenum}{}
3403 \renewcommand*{\printchapternum}{%
3404 % \begin{adjustwidth}{}{-\chapindent}
3405 % \hfill
3406 % \raisebox{10mm}[0pt][0pt]{\chapnumfont \thechapter}%
3407 % \hspace*{1em}
3408 % \end{adjustwidth}\vspace*{-3.0\onelineskip}
3409 \chs@ell@helper{\thechapter}%
3410 }
3411 \renewcommand\printchapternonum{%
3412 \chs@ell@helper{}\afterchapternum}
3413 \renewcommand*{\printchaptertitle}[1]{%
3414 %\vskip\onelineskip
3415 \raggedleft {\chaptitlefont ##1}\par\nobreak}}
3416
3417 \makechapterstyle{ger}{%
3418 \chapterstyle{default}
3419 \renewcommand*{\chapterheadstart}{\vspace*{\beforechapskip}
3420 \mbox{}\\\mbox{}\rule[0pt]{\textwidth}{0.4pt}\par}
3421 \setlength{\midchapskip}{20pt}
3422 \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1
3423 \\\mbox{}\rule[5pt]{\textwidth}{0.4pt}}}
3424
3425 \makechapterstyle{lyhne}{% needs graphicx package
3426 \chapterstyle{default}
3427 \setlength{\beforechapskip}{1.5cm}
3428 \setlength{\afterchapskip}{1cm}
3429 \setlength{\midchapskip}{2cm}
3430 \renewcommand*{\chapnamefont}{\normalfont\normalsize\scshape\raggedleft}
3431 \renewcommand*{\chaptitlefont}{\normalfont\normalsize\bfseries\sffamily\raggedleft}
3432 \renewcommand*{\chapternamenum}{}
3433 \renewcommand*{\printchapternum}{\makebox[0pt][l]{\hspace{0.2em}%
3434 \resizebox{!}{2ex}{\chapnamefont\bfseries\sffamily\thechapter}}}
3435 \renewcommand*{\afterchapternum}{\par\hspace{1.5cm}\hrule\vspace{0.2cm}}
3436 \renewcommand*{\printchapternonum}{\vphantom{\chapnamefont 1}\afterchapternum}
3437 \renewcommand*{\afterchaptertitle}{\vskip 0.2cm
3438 \hrule\vskip\afterchapskip}}
3439
3440 \makechapterstyle{madsen}{% requires graphicx package
3441 \chapterstyle{default}
3442 \renewcommand*{\chapnamefont}{%
3443 \normalfont\Large\scshape\raggedleft}
3444 \renewcommand*{\chaptitlefont}{%
3445 \normalfont\Huge\bfseries\sffamily\raggedleft}
3446 \renewcommand*{\chapternamenum}{}
3447 \renewcommand*{\printchapternum}{%
3448 \makebox[0pt][l]{\hspace{0.4em}%
3449 \resizebox{!}{4ex}{%
3450 \chapnamefont\bfseries\sffamily\thechapter}%
3451 }%
3452 }%
3453 \renewcommand*{\printchapternonum}{%
3454 \chapnamefont \phantom{\printchaptername \chapternamenum%
3455 \makebox[0pt][l]{\hspace{0.4em}%
3456 \resizebox{!}{4ex}{%
3457 \chapnamefont\bfseries\sffamily 1}%
3458 }%
3459 }%
3460 \afterchapternum %
3461 }%
3462 \renewcommand*{\afterchapternum}{%
3463 \par\hspace{1.5cm}\hrule\vskip\midchapskip}}
3464
3465 \newcommand*{\colorchapnum}{}
3466 \newcommand*{\colorchaptitle}{}
3467 \makechapterstyle{pedersen}{%
3468 \chapterstyle{default}
3469 \setlength{\beforechapskip}{-20pt}
3470 \setlength{\afterchapskip}{10pt}
3471 \renewcommand*{\chapnamefont}{\normalfont\LARGE\itshape}
3472 \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape\colorchapnum}
3473 \renewcommand*{\chaptitlefont}{\normalfont\huge\itshape\colorchaptitle}
3474 \renewcommand*{\afterchapternum}{}
3475 \renewcommand*{\printchaptername}{}
3476 \setlength{\midchapskip}{20mm}% was \numberheight
3477 \renewcommand*{\chapternamenum}{}
3478 \renewcommand*{\printchapternum}{%
3479 \sidebar{\raisebox{0pt}[0pt][0pt]{\makebox[0pt][l]{%
3480 \resizebox{!}{\midchapskip}{\chapnumfont\thechapter}}}}}
3481 \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1}}
3482
3483 %% Thomas Dye's southall chapter style
3484 \makechapterstyle{southall}{%
3485 \chapterstyle{default}
3486 \setlength{\afterchapskip}{5\baselineskip}
3487 \setlength{\beforechapskip}{36pt}% \headindent
3488 \setlength{\midchapskip}{\textwidth}% \rightblock
3489 \addtolength{\midchapskip}{-\beforechapskip}
3490 \renewcommand*{\chapterheadstart}{\vspace*{2\baselineskip}}
3491 \renewcommand*{\chaptitlefont}{\huge\rmfamily\memRTLraggedright}
3492 \renewcommand*{\chapnumfont}{\chaptitlefont}
3493 \renewcommand*{\printchaptername}{}
3494 \renewcommand*{\chapternamenum}{}
3495 \renewcommand*{\afterchapternum}{}
3496 \renewcommand*{\printchapternum}{%
3497 \begin{minipage}[t][\baselineskip][b]{\beforechapskip}
3498 {\vspace{0pt}\chapnumfont%%%\figureversion{lining}
3499 \thechapter}
3500 \end{minipage}}
3501 \renewcommand*{\printchaptertitle}[1]{%
3502 \hfill\begin{minipage}[t]{\midchapskip}
3503 {\vspace{0pt}\chaptitlefont ##1\par}\end{minipage}}
3504 \renewcommand*{\afterchaptertitle}{%
3505 \par\vspace{\baselineskip}%
3506 \hrulefill \par\nobreak\noindent \vskip \afterchapskip}}
3507
3508 \makechapterstyle{thatcher}{%
3509 \chapterstyle{default}
3510 \renewcommand*{\chapterheadstart}{}
3511 \renewcommand*{\printchaptername}{%
3512 \centerline{\chapnumfont{\@chapapp\ \thechapter}}}
3513 \renewcommand*{\chapternamenum}{}
3514 \renewcommand*{\chapnumfont}{\normalfont\scshape\MakeLowercase}
3515 \renewcommand*{\printchapternum}{}
3516 \renewcommand*{\afterchapternum}{%
3517 \par\centerline{\parbox{0.5in}{\hrulefill}}\par}
3518 \renewcommand*{\printchapternonum}{%
3519 \vphantom{\chapnumfont \@chapapp 1}\par
3520 \parbox{0.5in}{}\par}
3521 \renewcommand*{\chaptitlefont}{\normalfont\large}
3522 \renewcommand*{\printchaptertitle}[1]{%
3523 \centering \chaptitlefont\MakeUppercase{##1}}}
3524
3525 \makechapterstyle{veelo}{%
3526 \setlength{\afterchapskip}{40pt}
3527 \renewcommand*{\chapterheadstart}{\vspace*{40pt}}
3528 \renewcommand*{\afterchapternum}{\par\nobreak\vskip 25pt}
3529 \renewcommand*{\chapnamefont}{\normalfont\LARGE\flushright}
3530 \renewcommand*{\chapnumfont}{\normalfont\HUGE}
3531 \renewcommand*{\chaptitlefont}{\normalfont\HUGE\bfseries\flushright}
3532 \renewcommand*{\printchaptername}{%
3533 \chapnamefont\MakeUppercase{\@chapapp}}
3534 \renewcommand*{\chapternamenum}{}
3535 \setlength{\beforechapskip}{18mm}% \numberheight
3536 \setlength{\midchapskip}{\paperwidth}% \barlength
3537 \addtolength{\midchapskip}{-\textwidth}
3538 \addtolength{\midchapskip}{-\spinemargin}
3539 \renewcommand*{\printchapternum}{%
3540 \makebox[0pt][l]{%
3541 \hspace{.8em}%
3542 \resizebox{!}{\beforechapskip}{\chapnumfont \thechapter}%
3543 \hspace{.8em}%
3544 \rule{\midchapskip}{\beforechapskip}%
3545 }%
3546 }%
3547 \makeoddfoot{plain}{}{}{\thepage}}
3548
3549 \makechapterstyle{verville}{%
3550 % \chapterstyle{default}
3551 \setlength{\beforechapskip}{0pt}
3552 \renewcommand*{\printchaptername}{}
3553 \renewcommand*{\printchapternum}{%
3554 \hrule \vskip 0.5\onelineskip
3555 \Huge \centering \thechapter.\ }
3556 \renewcommand*{\printchapternonum}{%
3557 \hrule \vskip 0.5\onelineskip
3558 \Huge \centering}
3559 \renewcommand*{\afterchapternum}{}
3560 \setlength{\midchapskip}{0pt}
3561 \renewcommand*{\printchaptertitle}[1]{%
3562 ##1 \par
3563 \vskip 0.5\onelineskip
3564 \hrule}}
3565
3566 \makechapterstyle{crosshead}{%
3567 \setlength{\beforechapskip}{2\onelineskip}%
3568 \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}}%
3569 \setlength{\afterchapskip}{2\onelineskip \@plus .2\onelineskip
3570 \@minus 0.2\onelineskip}%
3571 \renewcommand*{\printchaptername}{}%
3572 \renewcommand*{\chapternamenum}{}%
3573 \renewcommand*{\chapnumfont}{\normalfont\LARGE\bfseries}%
3574 \renewcommand*{\chaptitlefont}{\chapnumfont}%
3575 \renewcommand*{\printchapternum}{%
3576 \centering\chapnumfont \thechapter\quad}%
3577 \renewcommand{\afterchapternum}{}%
3578 \renewcommand*{\printchapternonum}{\centering}}
3579
3580 \makechapterstyle{dowding}{%
3581 \setlength{\beforechapskip}{2\onelineskip}%
3582 \setlength{\afterchapskip}{1.5\onelineskip \@plus .1\onelineskip
3583 \@minus 0.167\onelineskip}%
3584 \renewcommand*{\chapnamefont}{\normalfont}%
3585 \renewcommand*{\chapnumfont}{\chapnamefont}%
3586 \renewcommand*{\printchapternum}{\centering\chapnumfont \ifanappendix \thechapter
3587 \else \numtoName{\c@chapter}\fi}%
3588 \renewcommand*{\chaptitlefont}{\normalfont\itshape\huge\centering}%
3589 \renewcommand*{\printchapternonum}{%
3590 \vphantom{\printchaptername}\vskip\midchapskip}}
3591
3592 \makechapterstyle{komalike}{%
3593 \setlength{\beforechapskip}{2\onelineskip}%
3594 \setlength{\afterchapskip}{1.5\onelineskip \@plus .1\onelineskip
3595 \@minus 0.167\onelineskip}%
3596 \renewcommand*{\printchaptername}{}%
3597 \renewcommand*{\chapternamenum}{}%
3598 \renewcommand*{\chapnumfont}{\normalfont\LARGE\sffamily\bfseries}%
3599 \renewcommand*{\printchapternum}{\chapnumfont \thechapter\space}%
3600 \renewcommand*{\afterchapternum}{}%
3601 \renewcommand*{\chaptitlefont}{\normalfont\LARGE\sffamily\bfseries}}
3602
3603 \makechapterstyle{ntglike}{%
3604 \setlength{\beforechapskip}{50pt \@plus 20pt}%
3605 \renewcommand*{\chapnamefont}{\normalfont\Large\bfseries}%
3606 \renewcommand*{\chapnumfont}{\normalfont\Large\bfseries}%
3607 \renewcommand*{\chaptitlefont}{\normalfont\Large\bfseries}}
3608
3609 \makechapterstyle{tandh}{%
3610 \setlength{\beforechapskip}{1\onelineskip}%
3611 \setlength{\afterchapskip}{2\onelineskip \@plus .1\onelineskip
3612 \@minus 0.167\onelineskip}%
3613 \renewcommand*{\printchaptername}{}%
3614 \renewcommand*{\chapternamenum}{}%
3615 \renewcommand*{\chapnumfont}{\normalfont\huge\bfseries}%
3616 \renewcommand*{\printchapternum}{\chapnumfont \thechapter\quad}%
3617 \renewcommand*{\afterchapternum}{}%
3618 \renewcommand*{\chaptitlefont}{\chapnumfont\memRTLraggedright}}
3619
3620 \makechapterstyle{wilsondob}{%
3621 \setlength{\beforechapskip}{2\onelineskip}%
3622 \setlength{\afterchapskip}{4\onelineskip \@plus .1\onelineskip
3623 \@minus 0.167\onelineskip}%
3624 \renewcommand*{\printchaptername}{}%
3625 \renewcommand*{\chapternamenum}{}%
3626 \renewcommand*{\chapnumfont}{\normalfont\Huge\itshape}%
3627 \renewcommand*{\printchapternum}{\raggedleft\chapnumfont \thechapter\quad}%
3628 \renewcommand*{\afterchapternum}{}%
3629 \renewcommand*{\chaptitlefont}{\chapnumfont}%
3630 \renewcommand*{\printchapternonum}{\raggedleft}}
3631
3632 \newif\ifraggedbottomsection
3633 \raggedbottomsectionfalse
3634 \newcommand*{\raggedbottomsection}{\raggedbottomsectiontrue}
3635 \newcommand*{\normalbottomsection}{\raggedbottomsectionfalse}
3636 \newcommand*{\bottomsectionpenalty}{\z@}
3637
3638 \newlength{\bottomsectionskip}
3639 \setlength{\bottomsectionskip}{10mm}
3640
3641 \newcommand{\@trplargomm}[1]{%
3642 \@ifnextchar[{\@xtrplargomm{#1}}%
3643 {\@xxtrplarg{#1}}}
3644 \long\def\@xtrplargomm#1[#2]{\@dblarg{#1[#2]}}
3645 \newcommand{\@xxtrplarg}[2]{#1[{#2}][{#2}]{#2}}
3646 \newcommand{\@trplargoom}[1]{%
3647 \@ifnextchar[{\@xtrplargoom{#1}}%
3648 {\@xxtrplarg{#1}}}
3649 \long\def\@xtrplargoom#1[#2]{%
3650 \@ifnextchar[{#1[{#2}]}%
3651 {#1[{#2}][{#2}]}}
3652
3653 \newcommand{\memsecinfo}[5]{}
3654 \newcommand{\memsecstarinfo}[2]{}
3655
3656 \ifmem@devmode
3657
3658 \patchcmd\@startsection{%
3659 \if@noskipsec \leavevmode \fi%
3660 }{%
3661 \@nameuse{#1block}%
3662 \ifraggedbottomsection\if@nobreak\else
3663 \vskip\z@\@plus\bottomsectionskip
3664 \penalty\bottomsectionpenalty
3665 \vskip\z@\@plus -\bottomsectionskip
3666 \fi\fi
3667 \def\m@msecn@me{#1}%
3668 \if@noskipsec \leavevmode \fi%
3669 }%
3670 {\typeout{\string\@startsection\space patch 1 success}}
3671 {\typeout{\string\@startsection\space patch 1 failed}}
3672
3673 \patchcmd\@startsection{%
3674 \addpenalty\@secpenalty\addvspace\@tempskipa%
3675 }{%
3676 \addpenalty\@secpenalty\addvspace\@tempskipa
3677 \addvspace{-\parskip}% <--- added 2011/03/02
3678 }%
3679 {\typeout{\string\@startsection\space patch 2 success}}
3680 {\typeout{\string\@startsection\space patch 2 failed}}
3681
3682 \patchcmd\@startsection{%
3683 \@ifstar%
3684 {\@ssect{#3}{#4}{#5}{#6}}%
3685 {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}%
3686 }{%
3687 \@ifstar%
3688 {\@ssect{#3}{#4}{#5}{#6}}%
3689 {\@trplargoom{\M@sect{#1}{#2}{#3}{#4}{#5}{#6}}}%
3690 }%
3691 {\typeout{\string\@startsection\space patch 3 success}}
3692 {\typeout{\string\@startsection\space patch 3 failed}}
3693
3694 \else % standard branch for dev-mode false
3695 \renewcommand{\@startsection}[6]{%
3696 \@nameuse{#1block}%
3697 \ifraggedbottomsection\if@nobreak\else
3698 \vskip\z@\@plus\bottomsectionskip
3699 \penalty\bottomsectionpenalty
3700 \vskip\z@\@plus -\bottomsectionskip
3701 \fi\fi
3702 \def\m@msecn@me{#1}%
3703 \if@noskipsec \leavevmode \fi
3704 \par
3705 \@tempskipa #4\relax
3706 \@afterindenttrue
3707 \ifdim \@tempskipa <\z@
3708 \@tempskipa -\@tempskipa \@afterindentfalse
3709 \fi
3710 \if@nobreak
3711 \everypar{}%
3712 \else
3713 \addpenalty\@secpenalty\addvspace\@tempskipa
3714 \addvspace{-\parskip}% <--- added 2011/03/02
3715 \fi
3716 \@ifstar
3717 {\@ssect{#3}{#4}{#5}{#6}}%
3718 {\@trplargoom{\M@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
3719
3720
3721 \fi % en dev-mode else branch
3722
3723 % \def\@xsect#1{%
3724 % \@tempskipa #1\relax
3725 % \ifdim \@tempskipa>\z@
3726 % \par \nobreak
3727 % \vskip \@tempskipa
3728 % \vskip-\parskip%<--- added 2011/03/02
3729 % \@afterheading
3730 % \else
3731 % \@nobreakfalse
3732 % \global\@noskipsectrue
3733 % \everypar{%
3734 % \if@noskipsec
3735 % \global\@noskipsecfalse
3736 % {\setbox\z@\lastbox}%
3737 % \clubpenalty\@M
3738 % \begingroup \@svsechd \endgroup
3739 % \unskip
3740 % \@tempskipa #1\relax
3741 % \hskip -\@tempskipa
3742 % \else
3743 % \clubpenalty \@clubpenalty
3744 % \everypar{}%
3745 % \fi}%
3746 % \fi
3747 % \ignorespaces}
3748 \ExplSyntaxOn
3749 \xpatchcmd{\@xsect}{\@afterheading}
3750 {\vskip-\parskip\@afterheading}{}{\typeout{Patching~of~\string\@xsect~failed}}
3751 \ExplSyntaxOff
3752
3753 \def\M@sect#1#2#3#4#5#6[#7][#8]#9{%
3754 \ifheadnameref\M@gettitle{#8}\else\M@gettitle{#7}\fi
3755 \ifnum #2>\c@secnumdepth
3756 \let\@svsec\@empty
3757 \memsecinfo{#1}{}{#7}{#8}{#9}%
3758 \else
3759 \refstepcounter{#1}%
3760 \protected@edef\@svsec{\@seccntformat{#1}\relax}%
3761 \memsecinfo{#1}{\@nameuse{the#1}}{#7}{#8}{#9}%
3762 \fi
3763 \@tempskipa #5\relax
3764 \ifdim \@tempskipa>\z@
3765 \begingroup
3766 #6{%
3767 \@hangfrom{\hskip #3\relax\@svsec}%
3768 \interlinepenalty \@M #9\@@par}%
3769 \endgroup
3770 \csname #1mark\endcsname{#8}%
3771 \addcontentsline{toc}{#1}{%
3772 \ifnum #2>\c@secnumdepth \else
3773 \protect\numberline{\csname the#1\endcsname}%
3774 \fi
3775 #7}%
3776 \else
3777 \def\@svsechd{%
3778 #6{\hskip #3\relax
3779 \@svsec #9}%
3780 \csname #1mark\endcsname{#8}%
3781 \addcontentsline{toc}{#1}{%
3782 \ifnum #2>\c@secnumdepth \else
3783 \protect\numberline{\csname the#1\endcsname}%
3784 \fi
3785 #7}}%
3786 \fi
3787 \@xsect{#5}}
3788
3789 \def\@sect#1#2#3#4#5#6[#7]#8{\M@sect{#1}{#2}{#3}{#4}{#5}{#6}[{#7}][{#7}]{#8}}
3790
3791 \let\@mem@old@ssect\@ssect
3792 \def\@ssect#1#2#3#4#5{%
3793 \M@gettitle{#5}%
3794 \memsecstarinfo{\m@msecn@me}{#5}%
3795 \@mem@old@ssect{#1}{#2}{#3}{#4}{#5}}
3796
3797 \newcommand{\section}{%
3798 \sechook%
3799 \@startsection{section}{1}% level 1
3800 {\secindent}% heading indent
3801 {\beforesecskip}% skip before the heading
3802 {\aftersecskip}% skip after the heading
3803 {\normalfont\secheadstyle}} % font
3804 \newcommand{\sechook}{}
3805 \newcommand{\setsechook}[1]{\renewcommand{\sechook}{#1}}
3806 \newlength{\secindent}
3807 \newcommand{\setsecindent}[1]{\setlength{\secindent}{#1}}
3808 \setsecindent{\z@}
3809 \newskip\beforesecskip
3810 \newcommand{\setbeforesecskip}[1]{\setlength{\beforesecskip}{#1}}
3811 \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}
3812 \newskip\aftersecskip
3813 \newcommand{\setaftersecskip}[1]{\setlength{\aftersecskip}{#1}}
3814 \setaftersecskip{2.3ex \@plus .2ex}
3815 \newcommand{\secheadstyle}{}
3816 \newcommand{\setsecheadstyle}[1]{\renewcommand{\secheadstyle}{#1}}
3817 \setsecheadstyle{\Large\bfseries\memRTLraggedright}
3818
3819 \newcommand{\subsection}{%
3820 \subsechook%
3821 \@startsection{subsection}{2}% level 2
3822 {\subsecindent}% heading indent
3823 {\beforesubsecskip}% skip before the heading
3824 {\aftersubsecskip}% skip after the heading
3825 {\normalfont\subsecheadstyle}} % font
3826 \newcommand{\subsechook}{}
3827 \newcommand{\setsubsechook}[1]{\renewcommand{\subsechook}{#1}}
3828 \newlength{\subsecindent}
3829 \newcommand{\setsubsecindent}[1]{\setlength{\subsecindent}{#1}}
3830 \setsubsecindent{\z@}
3831 \newskip\beforesubsecskip
3832 \newcommand{\setbeforesubsecskip}[1]{\setlength{\beforesubsecskip}{#1}}
3833 \setbeforesubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}
3834 \newskip\aftersubsecskip
3835 \newcommand{\setaftersubsecskip}[1]{\setlength{\aftersubsecskip}{#1}}
3836 \setaftersubsecskip{1.5ex \@plus .2ex}
3837 \newcommand{\subsecheadstyle}{}
3838 \newcommand{\setsubsecheadstyle}[1]{\renewcommand{\subsecheadstyle}{#1}}
3839 \setsubsecheadstyle{\large\bfseries\memRTLraggedright}
3840
3841 \newcommand{\subsubsection}{%
3842 \subsubsechook%
3843 \@startsection{subsubsection}{3}% level 3
3844 {\subsubsecindent}% heading indent
3845 {\beforesubsubsecskip}% skip before the heading
3846 {\aftersubsubsecskip}% skip after the heading
3847 {\normalfont\subsubsecheadstyle}} % font
3848 \newcommand{\subsubsechook}{}
3849 \newcommand{\setsubsubsechook}[1]{\renewcommand{\subsubsechook}{#1}}
3850 \newlength{\subsubsecindent}
3851 \newcommand{\setsubsubsecindent}[1]{%
3852 \setlength{\subsubsecindent}{#1}}
3853 \setsubsubsecindent{\z@}
3854 \newskip\beforesubsubsecskip
3855 \newcommand{\setbeforesubsubsecskip}[1]{%
3856 \setlength{\beforesubsubsecskip}{#1}}
3857 \setbeforesubsubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}
3858 \newskip\aftersubsubsecskip
3859 \newcommand{\setaftersubsubsecskip}[1]{%
3860 \setlength{\aftersubsubsecskip}{#1}}
3861 \setaftersubsubsecskip{1.5ex \@plus .2ex}
3862 \newcommand{\subsubsecheadstyle}{}
3863 \newcommand{\setsubsubsecheadstyle}[1]{%
3864 \renewcommand{\subsubsecheadstyle}{#1}}
3865 \setsubsubsecheadstyle{\normalsize\bfseries\memRTLraggedright}
3866
3867 \newcommand{\paragraph}{%
3868 \parahook%
3869 \@startsection{paragraph}{4}% level 4
3870 {\paraindent}% heading indent
3871 {\beforeparaskip}% skip before the heading
3872 {\afterparaskip}% skip after the heading
3873 {\normalfont\paraheadstyle}} % font
3874 \newcommand{\parahook}{}
3875 \newcommand{\setparahook}[1]{\renewcommand{\parahook}{#1}}
3876 \newlength{\paraindent}
3877 \newcommand{\setparaindent}[1]{\setlength{\paraindent}{#1}}
3878 \setparaindent{\z@}
3879 \newskip\beforeparaskip
3880 \newcommand{\setbeforeparaskip}[1]{\setlength{\beforeparaskip}{#1}}
3881 \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}
3882 \newskip\afterparaskip
3883 \newcommand{\setafterparaskip}[1]{\setlength{\afterparaskip}{#1}}
3884 \setafterparaskip{-1em}
3885 \newcommand{\paraheadstyle}{}
3886 \newcommand{\setparaheadstyle}[1]{\renewcommand{\paraheadstyle}{#1}}
3887 \setparaheadstyle{\normalsize\bfseries}
3888
3889 \newcommand{\subparagraph}{%
3890 \subparahook%
3891 \@startsection{subparagraph}{5}% level 5
3892 {\subparaindent}% heading indent
3893 {\beforesubparaskip}% skip before the heading
3894 {\aftersubparaskip}% skip after the heading
3895 {\normalfont\subparaheadstyle}} % font
3896 \newcommand{\subparahook}{}
3897 \newcommand{\setsubparahook}[1]{\renewcommand{\subparahook}{#1}}
3898 \newlength{\subparaindent}
3899 \newcommand{\setsubparaindent}[1]{%
3900 \setlength{\subparaindent}{#1}}
3901 \setsubparaindent{\parindent}
3902 \newskip\beforesubparaskip
3903 \newcommand{\setbeforesubparaskip}[1]{%
3904 \setlength{\beforesubparaskip}{#1}}
3905 \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}
3906 \newskip\aftersubparaskip
3907 \newcommand{\setaftersubparaskip}[1]{%
3908 \setlength{\aftersubparaskip}{#1}}
3909 \setaftersubparaskip{-1em}
3910 \newcommand{\subparaheadstyle}{}
3911 \newcommand{\setsubparaheadstyle}[1]{%
3912 \renewcommand{\subparaheadstyle}{#1}}
3913 \setsubparaheadstyle{\normalsize\bfseries}
3914
3915 \newcommand{\sethangfrom}[1]{\renewcommand{\@hangfrom}[1]{#1}}
3916 \newcommand{\setsecnumformat}[1]{\renewcommand{\@seccntformat}[1]{#1}}
3917 \newcommand{\hangsecnum}{%
3918 \def\@seccntformat##1{\llap{\csname the##1\endcsname\quad}}}
3919 \newcommand{\defaultsecnum}{%
3920 \def\@seccntformat##1{\csname the##1\endcsname\quad}}
3921
3922 \newcommand{\plainbreak}{\@ifstar{\@spbreak}{\@pbreak}}
3923 \newcommand*{\@pbreak}[1]{\par
3924 \penalty -100
3925 \vskip #1\onelineskip \@plus 2\onelineskip
3926 \penalty -20
3927 \vskip \z@ \@plus -2\onelineskip
3928 \@afterindentfalse
3929 \@afterheading}
3930 \newcommand*{\@spbreak}[1]{\par
3931 \penalty -100
3932 \vskip #1\onelineskip \@plus 2\onelineskip
3933 \penalty -20
3934 \vskip \z@ \@plus -2\onelineskip
3935 \@afterindenttrue
3936 \@afterheading}
3937
3938 \newcommand{\fancybreak}{\@ifstar{\@sfbreak}{\@fbreak}}
3939 \newcommand{\@fbreak}[1]{\par
3940 \penalty -100
3941 \noindent\parbox{\linewidth}{\centering #1}%%\null
3942 \par
3943 %% \penalty -20
3944 %% \vskip -\onelineskip
3945 \@afterindentfalse
3946 \@afterheading}
3947 \newcommand{\@sfbreak}[1]{\par
3948 \penalty -100
3949 \noindent\parbox{\linewidth}{\centering #1}%%\null
3950 \par
3951 %% \penalty -20
3952 %% \vskip -\onelineskip
3953 \@afterindenttrue
3954 \@afterheading}
3955
3956 \newcommand{\plainfancybreak}{\@ifstar{\@spfbreak}{\@pfbreak}}
3957 \newcommand{\@pfbreak}[3]{\par
3958 \@tempdimc\pagegoal \advance\@tempdimc-\pagetotal
3959 \ifdim #1>\@tempdimc \@fbreak{#3}\else \@pbreak{#2}\fi}
3960 \newcommand{\@spfbreak}[3]{\par
3961 \@tempdimc\pagegoal \advance\@tempdimc-\pagetotal
3962 \ifdim #1>\@tempdimc \@sfbreak{#3}\else \@spbreak{#2}\fi}
3963
3964 \newcommand*{\pen@ltyabovepfbreak}{2}
3965 \newcommand*{\pen@ltybelowpfbreak}{-4}
3966
3967 \newlength{\pfbreakskip}
3968 \setlength{\pfbreakskip}{2\baselineskip}
3969 \newcommand{\pfbreakdisplay}{*\quad*\quad*}
3970
3971 \def\pfbre@kdispl@y{\vbox to 1\pfbreakskip{\vss
3972 \hb@xt@ \columnwidth{\hss \pfbreakdisplay \hss}%
3973 \vss}}
3974
3975 \edef\nopfbreakOutput{\the\output}
3976 \def\pfbreakOutput{%
3977 \ifnum\outputpenalty=\pen@ltyabovepfbreak
3978 \nopfbreakOutput
3979 \pfbre@kdispl@y
3980 \nobreak
3981 \vskip-\pfbreakskip
3982 \else\ifnum\outputpenalty=\pen@ltybelowpfbreak
3983 \unvbox 255\relax
3984 \nobreak
3985 \vskip-\pfbreakskip
3986 \pfbre@kdispl@y
3987 \break
3988 \else
3989 \nopfbreakOutput
3990 \fi
3991 \fi}
3992 \output={\pfbreakOutput}
3993
3994 \newcommand{\pfbreak}{\@ifstar{\@spfbreakgap}{\@pfbreakgap}}
3995 \newcommand{\@pfbreakgap}{%
3996 \par {%
3997 \skip@\lastskip
3998 \nobreak
3999 \vskip -\ifdim\prevdepth>\maxdepth \maxdepth
4000 \else\ifdim\prevdepth>-1000pt\prevdepth
4001 \else\ifinner 0pt
4002 \else \pagedepth
4003 \fi \fi \fi
4004 \vskip -\skip@
4005 \ifdim\skip@<\pfbreakskip
4006 \advance\skip@ -1\skip@ \advance\skip@ 1\pfbreakskip
4007 \fi
4008 \penalty\pen@ltyabovepfbreak
4009 \prevdepth\z@ % added
4010 \vskip\skip@
4011 \penalty\pen@ltybelowpfbreak
4012 }
4013 \@afterindentfalse
4014 \@afterheading
4015 }
4016 \newcommand{\@spfbreakgap}{%
4017 \par {%
4018 \skip@\lastskip
4019 \nobreak
4020 \vskip -\ifdim\prevdepth>\maxdepth \maxdepth
4021 \else\ifdim\prevdepth>-1000pt\prevdepth
4022 \else\ifinner 0pt
4023 \else \pagedepth
4024 \fi \fi \fi
4025 \vskip -\skip@
4026 \ifdim\skip@<\pfbreakskip
4027 \advance\skip@ -1\skip@ \advance\skip@ 1\pfbreakskip
4028 \fi
4029 \penalty\pen@ltyabovepfbreak
4030 \prevdepth\z@ % added
4031 \vskip\skip@
4032 \penalty\pen@ltybelowpfbreak
4033 }
4034 \@afterindenttrue
4035 \@afterheading
4036 }
4037
4038 \newcommand*{\noprelistbreak}{\@nobreaktrue\nopagebreak}
4039
4040 \newcommand{\makeheadstyles}[2]{%
4041 \@namedef{hds@#1}{\@hds@def@ult #2}}
4042 \newcommand*{\headstyles}[1]{\@nameuse{hds@#1}}
4043 \newcommand*{\@hds@def@ult}{%
4044 \renewcommand*{\beforebookskip}{\null\vfil}%
4045 \renewcommand*{\midbookskip}{\par\vskip 20pt}%
4046 \renewcommand*{\afterbookskip}{\vfil\newpage}%
4047 \renewcommand*{\booknamefont}{\normalfont\huge\bfseries}%
4048 \renewcommand*{\booknumfont}{\normalfont\huge\bfseries}%
4049 \renewcommand*{\booktitlefont}{\normalfont\Huge\bfseries}%
4050 \renewcommand*{\printbookname}{\booknamefont \bookname}%
4051 \renewcommand*{\booknamenum}{\space}%
4052 \renewcommand*{\printbooknum}{\booknumfont \thebook}%
4053 \renewcommand*{\printbooktitle}[1]{\booktitlefont{##1}}%
4054 \renewcommand*{\beforepartskip}{\null\vfil}%
4055 \renewcommand*{\midpartskip}{\par\vskip 20pt}%
4056 \renewcommand*{\afterpartskip}{\vfil\newpage}%
4057 \renewcommand*{\partnamefont}{\normalfont\huge\bfseries}%
4058 \renewcommand*{\partnumfont}{\normalfont\huge\bfseries}%
4059 \renewcommand*{\parttitlefont}{\normalfont\Huge\bfseries}%
4060 \renewcommand*{\printpartname}{\partnamefont \partname}%
4061 \renewcommand*{\partnamenum}{\space}%
4062 \renewcommand*{\printpartnum}{\partnumfont \thepart}%
4063 \renewcommand*{\printparttitle}[1]{\parttitlefont{##1}}%
4064 \@chs@def@ult% default chapterstyle
4065 \setsechook{}
4066 \setsecindent{\z@}%
4067 \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}%
4068 \setaftersecskip{2.3ex \@plus .2ex}%
4069 \setsecheadstyle{\Large\bfseries\memRTLraggedright}%
4070 \setsubsechook{}%
4071 \setsubsecindent{\z@}%
4072 \setbeforesubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}%
4073 \setaftersubsecskip{1.5ex \@plus .2ex}%
4074 \setsubsecheadstyle{\large\bfseries\memRTLraggedright}%
4075 \setsubsubsechook{}%
4076 \setsubsubsecindent{\z@}%
4077 \setbeforesubsubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}%
4078 \setaftersubsubsecskip{1.5ex \@plus .2ex}%
4079 \setsubsubsecheadstyle{\normalsize\bfseries\memRTLraggedright}%
4080 \setparahook{}%
4081 \setparaindent{\z@}%
4082 \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}%
4083 \setafterparaskip{-1em}%
4084 \setparaheadstyle{\normalsize\bfseries}%
4085 \setsubparahook{}%
4086 \setsubparaindent{\parindent}%
4087 \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}%
4088 \setaftersubparaskip{-1em}%
4089 \setsubparaheadstyle{\normalsize\bfseries}}
4090
4091 \makeheadstyles{default}{}
4092 \headstyles{default}
4093
4094 \newcommand*{\addperiod}[1]{#1.}
4095
4096 \makeheadstyles{memman}{%
4097 \renewcommand*{\booknamefont}{\normalfont\huge\sffamily}
4098 \renewcommand*{\booknumfont}{\normalfont\huge\sffamily}
4099 \renewcommand*{\booktitlefont}{\normalfont\Huge\sffamily}
4100 \renewcommand*{\midbookskip}{\par\vskip 2\onelineskip}%
4101 \renewcommand*{\partnamefont}{\normalfont\huge\sffamily}
4102 \renewcommand*{\partnumfont}{\normalfont\huge\sffamily}
4103 \renewcommand*{\parttitlefont}{\normalfont\Huge\sffamily}
4104 \renewcommand*{\midpartskip}{\par\vskip 2\onelineskip}%
4105 \chapterstyle{demo3}
4106 \setbeforesecskip{-1.333\onelineskip
4107 \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
4108 \setaftersecskip{0.667\onelineskip \@plus 0.1\onelineskip}%
4109 \setsecheadstyle{\normalfont\scshape\memRTLraggedright}%
4110 \setbeforesubsecskip{-0.667\onelineskip
4111 \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
4112 \setaftersubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
4113 \setsubsecheadstyle{\normalfont\bfseries\memRTLraggedright}%
4114 \setbeforesubsubsecskip{-0.667\onelineskip
4115 \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
4116 \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
4117 \setsubsubsecheadstyle{\normalfont\normalsize\itshape\memRTLraggedright}%
4118 \setbeforeparaskip{1.0\onelineskip
4119 \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
4120 \setafterparaskip{-1em}%
4121 \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
4122 \setsubparaindent{\parindent}%
4123 \setbeforesubparaskip{1.0\onelineskip
4124 \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
4125 \setaftersubparaskip{-1em}%
4126 \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
4127
4128 \makeheadstyles{bringhurst}{%
4129 \chapterstyle{bringhurst}
4130 \setbeforesecskip{-1\onelineskip
4131 \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
4132 \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}%
4133 \setsecheadstyle{\normalfont\memRTLraggedright\scshape\MakeLowercase}%
4134 \setbeforesubsecskip{-1.0\onelineskip
4135 \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
4136 \setaftersubsecskip{1.0\onelineskip \@plus 0.1\onelineskip}%
4137 \setsubsecheadstyle{\sethangfrom{\noindent ####1}\normalfont\itshape\memRTLraggedright}%
4138 \setbeforesubsubsecskip{1.0\onelineskip
4139 \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
4140 \setaftersubsubsecskip{-1em}%
4141 \setsubsubsecheadstyle{\normalfont\normalsize\scshape\MakeLowercase}%
4142 \setbeforeparaskip{1.0\onelineskip
4143 \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
4144 \setafterparaskip{-1em}%
4145 \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
4146 \setsubparaindent{\parindent}%
4147 \setbeforesubparaskip{1.0\onelineskip
4148 \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
4149 \setaftersubparaskip{-1em}%
4150 \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
4151
4152 \makeheadstyles{crosshead}{%
4153 \chapterstyle{crosshead}
4154 \setbeforesecskip{-1.25\onelineskip
4155 \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
4156 \setaftersecskip{0.75\onelineskip \@plus 0.1\onelineskip}%
4157 \setsecheadstyle{\normalfont\centering\MakeUppercase}%
4158 \setbeforesubsecskip{-1.25\onelineskip
4159 \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
4160 \setaftersubsecskip{0.75\onelineskip \@plus 0.1\onelineskip}%
4161 \setsubsecheadstyle{\normalfont\centering\bfseries}%
4162 \setbeforesubsubsecskip{-.667\onelineskip
4163 \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
4164 \setaftersubsubsecskip{.333\onelineskip \@plus 0.1\onelineskip}%
4165 \setsubsubsecheadstyle{\normalfont\normalsize\centering\scshape\MakeLowercase}%
4166 \setbeforeparaskip{-.667\onelineskip
4167 \@plus -02.5\onelineskip \@minus -0.25\onelineskip}%
4168 \setafterparaskip{.333\onelineskip \@plus 0.1\onelineskip}%
4169 \setparaheadstyle{\normalfont\normalsize\centering\itshape}%
4170 \setsubparaindent{\parindent}%
4171 \setbeforesubparaskip{1.0\onelineskip
4172 \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
4173 \setaftersubparaskip{-1em}%
4174 \setsubparaheadstyle{\normalfont\normalsize\scshape\MakeLowercase}}
4175
4176 \makeheadstyles{dowding}{%
4177 \chapterstyle{dowding}
4178 \setbeforesecskip{-2\onelineskip
4179 \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
4180 \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}%
4181 \setsecheadstyle{\normalfont\centering\MakeUppercase}%
4182 \setbeforesubsecskip{-1.2\onelineskip
4183 \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
4184 \setaftersubsecskip{0.8\onelineskip \@plus 0.1\onelineskip}%
4185 \setsubsecheadstyle{\normalfont\scshape\centering\MakeLowercase}%
4186 \setbeforesubsubsecskip{-0.667\onelineskip
4187 \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
4188 \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
4189 \setsubsubsecheadstyle{\normalfont\normalsize\centering\itshape}%
4190 \setbeforeparaskip{1.0\onelineskip
4191 \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
4192 \setafterparaskip{-1em}%
4193 \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
4194 \setsubparaindent{\parindent}%
4195 \setbeforesubparaskip{1.0\onelineskip
4196 \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
4197 \setaftersubparaskip{-1em}%
4198 \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
4199
4200 \makeheadstyles{komalike}{%
4201 \renewcommand*{\partnamefont}{\huge\sffamily\bfseries}%
4202 \renewcommand*{\partnumfont}{\huge\sffamily\bfseries}%
4203 \renewcommand*{\parttitlefont}{\huge\sffamily\bfseries}%
4204 \chapterstyle{komalike}
4205 \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}%
4206 \setaftersecskip{2.3ex \@plus .2ex}%
4207 \setsecheadstyle{\normalfont\Large\sffamily\bfseries\memRTLraggedright}%
4208 \setbeforesubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}%
4209 \setaftersubsecskip{1.5ex \@plus .2ex}%
4210 \setsubsecheadstyle{\normalfont\large\sffamily\bfseries\memRTLraggedright}%
4211 \setbeforesubsubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}%
4212 \setaftersubsubsecskip{1.5ex \@plus .2ex}%
4213 \setsubsubsecheadstyle{\normalfont\normalsize\sffamily\bfseries\memRTLraggedright}%
4214 \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}%
4215 \setafterparaskip{-1em}%
4216 \setparaheadstyle{\normalfont\normalsize\sffamily\bfseries}%
4217 \setsubparaindent{\parindent}%
4218 \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}%
4219 \setaftersubparaskip{-1em}%
4220 \setsubparaheadstyle{\normalfont\normalsize\sffamily\bfseries}}
4221
4222 \makeheadstyles{ntglike}{%
4223 \renewcommand*{\partnamefont}{\Large\bfseries\MakeUppercase}%
4224 \renewcommand*{\partnumfont}{\Large\bfseries}%
4225 \renewcommand*{\parttitlefont}{\Large\MakeUppercase}%
4226 \chapterstyle{ntglike}
4227 \setbeforesecskip{-2\onelineskip
4228 \@plus -1\onelineskip \@minus -.5\onelineskip}%
4229 \setaftersecskip{0.5\onelineskip}%
4230 \setsecheadstyle{\normalfont\large\bfseries}%
4231 \setbeforesubsecskip{-1\onelineskip
4232 \@plus -.5\onelineskip \@minus -.25\onelineskip}%
4233 \setaftersubsecskip{0.01\onelineskip}%
4234 \setsubsecheadstyle{\normalfont\normalsize\bfseries}%
4235 \setbeforesubsubsecskip{-1\onelineskip
4236 \@plus -.5\onelineskip \@minus -.25\onelineskip}%
4237 \setaftersubsubsecskip{0.01\onelineskip}%
4238 \setsubsubsecheadstyle{\normalfont\normalsize\slshape}%
4239 \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}%
4240 \setafterparaskip{-1em}%
4241 \setparaheadstyle{\normalfont\normalsize\slshape}%
4242 \setsubparaindent{\parindent}%
4243 \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}%
4244 \setaftersubparaskip{-1em}%
4245 \setsubparaheadstyle{\normalfont\normalsize\slshape}}
4246
4247 \makeheadstyles{tandh}{%
4248 \chapterstyle{tandh}
4249 \setbeforesecskip{-2\onelineskip
4250 \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
4251 \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}%
4252 \setsecheadstyle{\normalfont\memRTLraggedright\MakeUppercase}%
4253 \setbeforesubsecskip{-1.2\onelineskip
4254 \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
4255 \setaftersubsecskip{0.8\onelineskip \@plus 0.1\onelineskip}%
4256 \setsubsecheadstyle{\normalfont\Large\itshape\memRTLraggedright}%
4257 \setbeforesubsubsecskip{-0.667\onelineskip
4258 \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
4259 \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
4260 \setsubsubsecheadstyle{\normalfont\normalsize\bfseries\memRTLraggedright}%
4261 \setbeforeparaskip{1.0\onelineskip
4262 \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
4263 \setafterparaskip{-1em}%
4264 \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
4265 \setsubparaindent{\parindent}%
4266 \setbeforesubparaskip{1.0\onelineskip
4267 \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
4268 \setaftersubparaskip{-1em}%
4269 \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
4270
4271 \makeheadstyles{wilsondob}{%
4272 \chapterstyle{wilsondob}
4273 \setbeforesecskip{-1.333\onelineskip
4274 \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
4275 \setaftersecskip{0.667\onelineskip \@plus 0.1\onelineskip}%
4276 \setsecheadstyle{\normalfont\memRTLraggedright\MakeUppercase}%
4277 \setbeforesubsecskip{-0.667\onelineskip
4278 \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
4279 \setaftersubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
4280 \setsubsecheadstyle{\normalfont\Large\itshape\memRTLraggedright}%
4281 \setbeforesubsubsecskip{-0.667\onelineskip
4282 \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
4283 \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
4284 \setsubsubsecheadstyle{\normalfont\normalsize\memRTLraggedright\scshape\MakeLowercase}%
4285 \setbeforeparaskip{1.0\onelineskip
4286 \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
4287 \setafterparaskip{-1em}%
4288 \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
4289 \setsubparaindent{\parindent}%
4290 \setbeforesubparaskip{1.0\onelineskip
4291 \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
4292 \setaftersubparaskip{-1em}%
4293 \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
4294
4295 \newif\ifanappendix
4296 \anappendixfalse
4297 \newcommand{\appendix}{\par
4298 \setcounter{chapter}{0}%
4299 \setcounter{section}{0}%
4300 \gdef\@chapapp{\appendixname}%
4301 \gdef\thechapter{\@Alph\c@chapter}%
4302 \anappendixtrue}
4303
4304 \newcommand{\appendixpage}{%
4305 \@ifstar{\@sapppage}{\@apppage}}
4306 \newcommand{\memapppageinfo}[1]{}
4307 \newcommand{\memapppagestarinfo}[1]{}
4308
4309 \def\@apppage{%
4310 \@setuppart
4311 \mempreaddapppagetotochook
4312 \addappheadtotoc
4313 \mempostaddapppagetotochook
4314 \partmark{\appendixpagename}%
4315 \memapppageinfo{\appendixpagename}%
4316 {\centering
4317 \interlinepenalty \@M
4318 \normalfont
4319 \printparttitle{\appendixpagename}\par}%
4320 \@endpart}
4321 \newcommand\mempreaddapppagetotochook{}
4322 \newcommand\mempostaddapppagetotochook{}
4323
4324 \def\@sapppage{%
4325 \@setuppart
4326 \partmark{\appendixpagename}%
4327 \memapppagestarinfo{\appendixpagename}%
4328 {\centering
4329 \interlinepenalty \@M
4330 \normalfont
4331 \printparttitle{\appendixpagename}\par}%
4332 \@endpart}
4333
4334 \def\addappheadtotoc{%
4335 % \phantomsection
4336 \MakeLinkTarget[chapter]{}%
4337 \addcontentsline{toc}{chapter}{\appendixtocname}}
4338 \newcounter{@ppsavesec}
4339 \newcounter{@ppsaveapp}
4340 \setcounter{@ppsaveapp}{0}
4341 \newcommand{\@ppsavesec}{%
4342 \setcounter{@ppsavesec}{\value{chapter}}}
4343 \newcommand{\@pprestoresec}{%
4344 \setcounter{chapter}{\value{@ppsavesec}}}
4345 \newcommand{\@ppsaveapp}{%
4346 \setcounter{@ppsaveapp}{\value{chapter}}}
4347 \newcommand{\restoreapp}{%
4348 \setcounter{chapter}{\value{@ppsaveapp}}}
4349
4350 \newcommand{\@resets@pp}{%
4351 \par
4352 \@ppsavesec
4353 \setcounter{section}{0}%
4354 \setcounter{chapter}{0}%
4355 \renewcommand\@chapapp{\appendixname}%
4356 \renewcommand\thechapter{\@Alph\c@chapter}%
4357 \restoreapp
4358 \def\theHchapter{\Alph{chapter}}
4359 }
4360
4361 \newenvironment{appendices}%
4362 {\@resets@pp\anappendixtrue}%
4363 {\@ppsaveapp\@pprestoresec\anappendixfalse}
4364
4365 \newcommand{\setthesection}{\thechapter.\Alph{section}}
4366
4367 \newcommand{\@resets@ppsub}{
4368 \par
4369 \setcounter{section}{0}
4370 \renewcommand{\thesection}{\setthesection}
4371 \def\theHsection{\theHchapter.\Alph{section}}
4372 }
4373
4374 \newif\ifnamesubappendix
4375 \namesubappendixfalse
4376 \newcommand*{\namedsubappendices}{\namesubappendixtrue}
4377 \newcommand*{\unnamedsubappendices}{\namesubappendixfalse}
4378
4379 \newenvironment{subappendices}{%
4380 \@resets@ppsub
4381 \def\addappheadtotoc{%
4382 %\phantomsection
4383 \MakeLinkTarget[section]{}%
4384 \addcontentsline{toc}{section}{\appendixtocname}}
4385 \ifnamesubappendix
4386 \def\sectionname{\appendixname}
4387 \def\@seccntformat##1{\@ifundefined{##1name}%
4388 {}{\csname ##1name\endcsname\ }%
4389 \csname the##1\endcsname\quad}
4390 \fi
4391 }{%
4392 \def\theHsection{\theHchapter.\the\value{section}}
4393 }
4394
4395 \newcommand*{\leadpagetoclevel}{chapter}
4396 \newcommand*{\newleadpage}[3][empty]{%
4397 \@namedef{#2}{\@ifstar{\dlfm@msapppage{#1}{#2}{#3}}%
4398 {\dlfm@mapppage{#1}{#2}{#3}}}}
4399 \newcommand*{\renewleadpage}[3][empty]{%
4400 \@namedef{#2}{\@ifstar{\dlfm@msapppage{#1}{#2}{#3}}%
4401 {\dlfm@mapppage{#1}{#2}{#3}}}}
4402
4403 \newcommand{\memleadpageinfo}[3]{}
4404 \newcommand{\memleadpagestarinfo}[3]{}
4405
4406 \newcommand*{\dlfm@msapppage}[3]{%
4407 \@setuppart
4408 \partmark{#3}%
4409 \MakeLinkTarget[part]{}%
4410 \memleadpagestarinfo{#1}{#2}{#3}%
4411 {\centering
4412 \interlinepenalty \@M
4413 \normalfont
4414 \printparttitle{#3}\par
4415 \thispagestyle{#1}}%
4416 \dlfm@m@endpart{#1}}
4417 \newcommand*{\dlfm@mapppage}[3]{%
4418 \@setuppart
4419 % \phantomsection
4420 \MakeLinkTarget[part]{}%
4421 \addcontentsline{toc}{\leadpagetoclevel}{#3}%
4422 \partmark{#3}%
4423 \memleadpageinfo{#1}{#2}{#3}%
4424 {\centering
4425 \interlinepenalty \@M
4426 \normalfont
4427 \printparttitle{#3}\par
4428 \thispagestyle{#1}}%
4429 \dlfm@m@endpart{#1}}
4430
4431 \newcommand*{\dlfm@m@endpart}[1]{%
4432 \if@twoside
4433 \if@openright
4434 \null
4435 \thispagestyle{#1}%
4436 \newpage
4437 \fi
4438 \fi
4439 \if@tempswa
4440 \twocolumn
4441 \fi}
4442
4443 \let\memorigdbs\\
4444 \let\memorigpar\par
4445 \let\atcentercr\@centercr
4446
4447 \newcommand*{\flushleftright}{%
4448 \let\\\memorigdbs
4449 \leftskip\z@skip
4450 \rightskip\leftskip
4451 \parfillskip\@flushglue
4452 \everypar{}}
4453
4454 \newcommand*{\linenottooshort}[1][4em]{%
4455 \@tempdima=\hsize
4456 \advance\@tempdima -#1
4457 \leftskip\z@skip
4458 \rightskip\leftskip
4459 \parfillskip=\@tempdima \@minus \@tempdima}
4460
4461 \newcommand*{\russianpar}{\ifhmode\unskip
4462 \strut\vadjust{}\nobreak
4463 \discretionary{}%
4464 {\hbox{\hskip2\parindent
4465 \vrule depth 273sp width 0sp height \ht\strutbox}}%
4466 {\hbox{\hskip\parindent}}%
4467 \hskip-2\parindent \@minus 2\parindent
4468 \hskip\hsize \@minus \hsize
4469 \kern\z@ \parfillskip\z@
4470 \memorigpar
4471 \ifdim\prevdepth=273sp
4472 \nobreak
4473 \vskip-2\baselineskip
4474 \hbox{\strut}%
4475 \fi\fi}
4476
4477 \newcommand*{\lastlineparrule}{%
4478 \hrule height 0.5ex depth \@tempdimb\relax}
4479 \newcommand*{\lastlinerulefill}{%
4480 \let\\\@centercr
4481 \@tempdimb=-0.5ex \advance\@tempdimb 0.4pt
4482 \unskip\nobreak\space
4483 \leaders\lastlineparrule\hskip\@flushglue
4484 \vadjust{}{\parfillskip\z@\memorigpar}}
4485
4486 \newcommand*{\centerlastline}{%
4487 \memRTLleftskip\@flushglue
4488 \memRTLrightskip=\z@ plus -1fil
4489 \parfillskip=\z@ plus 2fil}
4490
4491 \newcommand*{\leftcenterright}{%;
4492 \let\\\break
4493 \parindent\z@
4494 \leftskip\@flushglue
4495 \rightskip\leftskip
4496 \parfillskip \z@ \@plus -1fil
4497 \everypar={\hskip \z@ \@plus -1fil}}
4498
4499 \newcommand*{\centerfloat}{%
4500 \parindent \z@
4501 \leftskip \z@ \@plus 1fil \@minus \textwidth
4502 \rightskip\leftskip
4503 \parfillskip \z@skip}
4504
4505 \newdimen\ragrparindent
4506 \setlength{\ragrparindent}{\parindent}
4507 \newcommand{\raggedyright}[1][2em]{%
4508 \let\\\@centercr\@rightskip \z@ \@plus #1\relax
4509 \memRTLrightskip\@rightskip
4510 \memRTLleftskip\z@skip
4511 \parindent\ragrparindent}
4512
4513 \newcommand*{\justlastraggedleft}{%
4514 \memRTLleftskip\@flushglue
4515 \memRTLrightskip-\memRTLleftskip
4516 \parfillskip\leftskip
4517 \parindent \z@}
4518
4519 \newcommand*{\raggedrightthenleft}{%
4520 \parindent \z@
4521 \memRTLleftskip \z@ \@plus 1fill
4522 \memRTLrightskip\@flushglue
4523 \parfillskip \z@
4524 \everypar{\hskip \z@ \@plus -1fill}}
4525
4526 \newcommand*{\raggedwrap}{%
4527 \@rightskip\@flushglue
4528 %%% \rightskip\@rightskip
4529 \memRTLrightskip\@rightskip
4530 %%% \leftskip\@totalleftmargin
4531 \memRTLleftskip\@totalleftmargin
4532 \parindent\ragrparindent}
4533
4534 \newcommand{\hangfrom}[1]{%
4535 \setbox\@tempboxa\hbox{{#1}}%
4536 \hangindent \wd\@tempboxa\noindent\box\@tempboxa}
4537
4538 \newcommand{\hangpara}[2]{\hangindent#1\hangafter#2\noindent}
4539 \newenvironment{hangparas}[2]{\setlength{\parindent}{\z@}
4540 \everypar={\hangpara{#1}{#2}}}{\par}
4541
4542 \newcommand{\leftspringright}[4]{%
4543 \@tempdimb=\hsize
4544 \par\noindent\hbox to\@tempdimb{%
4545 \vtop{\hsize=#1\@tempdimb \flushleft#3\par}\hss
4546 \vtop{\hsize=#2\@tempdimb \flushright#4\par}}}
4547
4548 \newcommand*{\sourceatright}[2][2em]{{%
4549 \unskip\nobreak\hfil\penalty50
4550 \hskip#1\hbox{}\nobreak\hfil{#2}
4551 \parfillskip\z@\finalhyphendemerits=0\par}}
4552
4553 \if@twocolumn
4554 \setlength{\leftmargini}{2em}
4555 \else
4556 \setlength{\leftmargini}{2.5em}
4557 \fi
4558 \leftmargin \leftmargini
4559 \setlength{\leftmarginii}{2.2em}
4560 \setlength{\leftmarginiii}{1.87em}
4561 \setlength{\leftmarginiv}{1.7em}
4562 \if@twocolumn
4563 \setlength{\leftmarginv}{.5em}
4564 \setlength{\leftmarginvi}{.5em}
4565 \else
4566 \setlength{\leftmarginv}{1em}
4567 \setlength{\leftmarginvi}{1em}
4568 \fi
4569 \setlength{\itemindent}{\z@}
4570 \setlength{\labelsep}{0.5em}
4571 \setlength{\labelwidth}{\leftmargini}
4572 \addtolength{\labelwidth}{-\labelsep}
4573 \@beginparpenalty -\@lowpenalty
4574 \@endparpenalty -\@lowpenalty
4575 \@itempenalty -\@lowpenalty
4576
4577 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4578 \newdimen\everylistparindent
4579 \everylistparindent \z@
4580 \renewcommand*{\list}[2]{%
4581 \ifnum \@listdepth >5\relax
4582 \@toodeep
4583 \else
4584 \global\advance\@listdepth\@ne
4585 \fi
4586 \rightmargin\z@
4587 \listparindent\everylistparindent
4588 \itemindent\z@
4589 \csname @list\romannumeral\the\@listdepth\endcsname
4590 \def\@itemlabel{#1}%
4591 \let\makelabel\@mklab
4592 \@nmbrlistfalse
4593 #2\relax
4594 \@trivlist
4595 \parskip\parsep
4596 \parindent\listparindent
4597 \advance\linewidth -\rightmargin
4598 \advance\linewidth -\leftmargin
4599 \advance\@totalleftmargin \leftmargin
4600 \parshape \@ne \@totalleftmargin \linewidth
4601 \ignorespaces}
4602
4603 \newlength{\parsepi}
4604 \newlength{\topsepi}
4605 \newlength{\itemsepi}
4606 \newlength{\parsepii}
4607 \newlength{\topsepii}
4608 \newlength{\topsepiii}
4609
4610 \newlength{\itemsepii}
4611 \newlength{\itemsepiii}
4612 \newlength{\partopsepii}
4613 \newlength{\partopsepiii}
4614 \newcommand*{\setnzplist}{%
4615 \partopsep \p@ \@plus\z@ \@minus\p@
4616 \topsepi\z@
4617 \parsepi\parskip
4618 \itemsepi\z@
4619 \topsepii\z@
4620 \parsepii\parskip
4621 \itemsepii\z@
4622 \topsepiii\z@
4623 %% \parsepiii\parskip
4624 \itemsepiii\z@}
4625
4626 \newcommand*{\defaultlists}{%
4627 \setlength{\partopsep}{0.2\onelineskip \@plus 0.1\onelineskip
4628 \@minus 0.1\onelineskip}%
4629 \parsepi = 0.3333\onelineskip \@plus 0.1667\onelineskip \@minus \p@
4630 \itemsepi = \parsepi
4631 \topsepi = 0.6667\onelineskip \@plus 0.3333\onelineskip
4632 \@minus 0.2\onelineskip
4633 \parsepii = 0.1667\onelineskip \@plus \p@ \@minus \p@
4634 \topsepii = \parsepi
4635 \topsepiii = \parsepii
4636 \everylistparindent \listparindent
4637 \itemsepii\parsepii
4638 \itemsepiii\topsepiii
4639 \partopsepiii \p@ \@plus\z@ \@minus\p@
4640 \ifm@mnzpskip
4641 \setnzplist
4642 \fi}
4643 \defaultlists
4644
4645 \newcommand*{\firmlists}{%
4646 \@ifstar{\m@msfirmlists}{\m@mfirmlists}}
4647
4648 \newcommand*{\m@msfirmlists}{
4649 \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}%
4650 \parsepi = 0.1667\onelineskip \@plus 0.0833\onelineskip \@minus \p@
4651 \itemsepi = \parsepi
4652 \topsepi = \parsepi
4653 \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@
4654 \topsepii = \parsepi
4655 \topsepiii = \parsepii
4656 \everylistparindent\listparindent}
4657
4658 \newcommand*{\m@mfirmlists}{
4659 \setlength{\partopsep}{0.1\onelineskip \@plus 0.05\onelineskip
4660 \@minus 0.05\onelineskip}%
4661 \parsepi = 0.1667\onelineskip \@plus 0.0833\onelineskip \@minus \p@
4662 \itemsepi = \parsepi
4663 \topsepi = \parsepi
4664 \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@
4665 \topsepii = \parsepi
4666 \topsepiii = \parsepii
4667 \everylistparindent\listparindent}
4668
4669 \newcommand*{\tightlists}{%
4670 \@ifstar{\m@mstightlists}{\m@mtightlists}}
4671
4672 \newcommand*{\m@mstightlists}{%
4673 \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}%
4674 \parsepi = \z@ \@plus \p@ \@minus \p@
4675 \itemsepi = \parsepi
4676 \topsepi = \z@ \@plus \p@ \@minus \p@
4677 \parsepii = \z@ \@plus \p@ \@minus \p@
4678 \topsepii = \parsepi
4679 \topsepiii = \parsepii
4680 \everylistparindent\parindent
4681 \ifm@mnzpskip
4682 \setnzplist
4683 \partopsepiii\partopsep
4684 \fi}
4685
4686 \newcommand*{\m@mtightlists}{%
4687 \setlength{\partopsep}{0.5\onelineskip \@plus \p@ \@minus \p@}%
4688 \parsepi = \z@ \@plus \p@ \@minus \p@
4689 \itemsepi = \parsepi
4690 \topsepi = \z@ \@plus \p@ \@minus \p@
4691 \parsepii = \z@ \@plus \p@ \@minus \p@
4692 \topsepii = \parsepi
4693 \topsepiii = \parsepii
4694 \everylistparindent\parindent
4695 \ifm@mnzpskip
4696 \setnzplist
4697 \partopsepiii\partopsep
4698 \fi}
4699
4700 \newcommand{\firmlist}{%
4701 \setlength{\itemsep}{0.5\itemsep}\setlength{\parskip}{0.5\parskip}}
4702 \newcommand{\tightlist}{%
4703 \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
4704
4705 \newskip\m@msavetopsep
4706 \newskip\m@msavepartopsep
4707 \newcommand*{\savetrivseps}{%
4708 \m@msavetopsep\topsep
4709 \m@msavepartopsep\partopsep}
4710 \newcommand*{\restoretrivseps}{%
4711 \topsep\m@msavetopsep
4712 \partopsep\m@msavepartopsep}
4713 \savetrivseps
4714
4715 \newcommand*{\zerotrivseps}{%
4716 \topsep\z@
4717 \partopsep\z@}
4718
4719 \def\@listi{\leftmargin\leftmargini
4720 \parsep\parsepi
4721 \topsep\topsepi
4722 \itemsep\itemsepi}
4723 \let\@listI\@listi
4724 \defaultlists
4725 \@listi
4726
4727 \def\@listii{\leftmargin\leftmarginii
4728 \labelwidth\leftmarginii
4729 \advance\labelwidth-\labelsep
4730 \topsep\topsepii
4731 \parsep\parsepii
4732 \itemsep\itemsepii}
4733
4734 \def\@listiii{\leftmargin\leftmarginiii
4735 \labelwidth\leftmarginiii
4736 \advance\labelwidth-\labelsep
4737 \topsep\topsepiii
4738 \parsep\z@
4739 %%% \itemsep\topsep
4740 %%% \partopsep \p@ \@plus\z@ \@minus\p@
4741 \itemsep\itemsepiii
4742 \partopsep\partopsepiii}
4743
4744 \def\@listiv{\leftmargin\leftmarginiv
4745 \labelwidth\leftmarginiv
4746 \advance\labelwidth-\labelsep}
4747
4748 \def\@listv{\leftmargin\leftmarginv
4749 \labelwidth\leftmarginv
4750 \advance\labelwidth-\labelsep}
4751
4752 \def\@listvi{\leftmargin\leftmarginvi
4753 \labelwidth\leftmarginvi
4754 \advance\labelwidth-\labelsep}
4755
4756 \renewcommand{\theenumi}{\@arabic\c@enumi}
4757 \renewcommand{\theenumii}{\@alph\c@enumii}
4758 \renewcommand{\theenumiii}{\@roman\c@enumiii}
4759 \renewcommand{\theenumiv}{\@Alph\c@enumiv}
4760 \newcommand{\labelenumi}{\theenumi.}
4761 \newcommand{\labelenumii}{\theenumii)}
4762 \newcommand{\labelenumiii}{\theenumiii.}
4763 \newcommand{\labelenumiv}{\theenumiv.}
4764 \renewcommand{\p@enumii}{\theenumi}
4765 \renewcommand{\p@enumiii}{\theenumi(\theenumii)}
4766 \renewcommand{\p@enumiv}{\p@enumiii\theenumiii}
4767 \newtoks\@enLab
4768 \def\@enQmark{?}
4769 \def\@enLabel#1#2{%
4770 \edef\@enThe{\noexpand#1{\@enumctr}}%
4771 \@enLab\expandafter{\the\@enLab\csname the\@enumctr\endcsname}%
4772 \@enloop}
4773 \def\@enSpace{\afterassignment\@enSp@ce\let\@memtempa= }
4774 \def\@enSp@ce{\@enLab\expandafter{\the\@enLab\space}\@enloop}
4775 \def\@enGroup#1{\@enLab\expandafter{\the\@enLab{#1}}\@enloop}
4776 \def\@enOther#1{\@enLab\expandafter{\the\@enLab#1}\@enloop}
4777 \def\@enloop{\futurelet\@entemp\@enloop@}
4778 \def\@enloop@{%
4779 \ifx A\@entemp \def\@memtempa{\@enLabel\Alph }\else
4780 \ifx a\@entemp \def\@memtempa{\@enLabel\alph }\else
4781 \ifx i\@entemp \def\@memtempa{\@enLabel\roman }\else
4782 \ifx I\@entemp \def\@memtempa{\@enLabel\Roman }\else
4783 \ifx 1\@entemp \def\@memtempa{\@enLabel\arabic}\else
4784 \ifx \@sptoken\@entemp \let\@memtempa\@enSpace \else
4785 \ifx \bgroup\@entemp \let\@memtempa\@enGroup \else
4786 \ifx \@enum@\@entemp \let\@memtempa\@gobble \else
4787 \let\@memtempa\@enOther
4788 \@enhook
4789 \fi\fi\fi\fi\fi\fi\fi\fi
4790 \@memtempa}
4791 %% \providecommand\@enhook{}
4792 \newcommand\@enhook{}
4793 \def\enumerate{%
4794 \ifnum \@enumdepth >3 \@toodeep\else
4795 \advance\@enumdepth \@ne
4796 \edef\@enumctr{enum\romannumeral\the\@enumdepth}\fi
4797 \@ifnextchar[{\@@enum@}{\@enum@}}
4798 \def\@@enum@[#1]{%
4799 \@enLab{}\let\@enThe\@enQmark
4800 \@enloop#1\@enum@
4801 \ifx\@enThe\@enQmark\@warning{The counter will not be printed.%
4802 ^^J\space\@spaces\@spaces\@spaces The label is: \the\@enLab}\fi
4803 \expandafter\edef\csname label\@enumctr\endcsname{\the\@enLab}%
4804 \expandafter\let\csname the\@enumctr\endcsname\@enThe
4805 \csname c@\@enumctr\endcsname7
4806 \expandafter\settowidth
4807 \csname leftmargin\romannumeral\@enumdepth\endcsname
4808 {\the\@enLab\hspace{\labelsep}}%
4809 \@enum@}
4810 \def\@enum@{\list{\csname label\@enumctr\endcsname}%
4811 {\usecounter{\@enumctr}\def\makelabel##1{\hss\llap{##1}}}}
4812
4813 \newcommand{\labelitemi}{\textbullet}
4814 \newcommand{\labelitemii}{\normalfont\bfseries \textendash}
4815 \newcommand{\labelitemiii}{\textasteriskcentered}
4816 \newcommand{\labelitemiv}{\textperiodcentered}
4817 \renewcommand{\itemize}[1][\@empty]{%
4818 \ifnum \@itemdepth >\thr@@\@toodeep\else
4819 \advance\@itemdepth\@ne
4820 \ifx \@empty #1\else % optional argument
4821 \@namedef{labelitem\romannumeral\the\@itemdepth}{#1}%
4822 \fi
4823 \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
4824 \expandafter
4825 \list
4826 \csname\@itemitem\endcsname
4827 {\def\makelabel##1{\hss\llap{##1}}}%
4828 \fi}
4829 \let\enditemize =\endlist
4830
4831 \newenvironment{description}%
4832 {\list{}{\labelwidth\z@ \itemindent-\leftmargin
4833 \let\makelabel\descriptionlabel}}%
4834 {\endlist}
4835 \newcommand*{\descriptionlabel}[1]{\hspace\labelsep
4836 \normalfont\bfseries #1}
4837 \newenvironment{blockdescription}%
4838 {\list{}{\labelwidth\z@ \itemindent 0.5em \labelsep 0.5em
4839 \let\makelabel\blockdescriptionlabel}}%
4840 {\endlist}
4841 \newcommand*{\blockdescriptionlabel}[1]{%%% \hspace\labelsep
4842 \normalfont\bfseries #1}
4843 \newenvironment{labelled}[1]%
4844 {\list{}{\labelwidth\z@ \itemindent-\leftmargin
4845 \def\m@malabel{\@nameuse{#1}} \let\makelabel\m@malabel}}%
4846 {\endlist}
4847
4848 \newenvironment{flexlabelled}[6]%
4849 {\list{}{\nametest{#2}{*}%
4850 \ifsamename\else \labelwidth #2 \fi
4851 \nametest{#3}{*}%
4852 \ifsamename\else \labelsep #3 \fi
4853 \nametest{#4}{*}%
4854 \ifsamename\else \itemindent #4 \fi
4855 \nametest{#5}{*}%
4856 \ifsamename\else \leftmargin #5 \fi
4857 \nametest{#6}{*}%
4858 \ifsamename\else \rightmargin #6 \fi
4859 \def\m@malabel{\@nameuse{#1}} \let\makelabel\m@malabel}}%
4860 {\endlist}
4861
4862 \newenvironment{quotation}%
4863 {\list{}{\listparindent 1.5em%
4864 \itemindent \listparindent
4865 \rightmargin \leftmargin
4866 \parsep \z@ \@plus\p@}%
4867 \item[]}%
4868 {\endlist}
4869 \newenvironment{quote}%
4870 {\list{}{\rightmargin\leftmargin}%
4871 \item[]}%
4872 {\endlist}
4873 \newcommand{\symbollabel}[1]{{#1 \hfill}}
4874 \newenvironment{symbols}{\list{}%
4875 {\itemindent 0em \leftmargin 8em
4876 \labelsep 1em \labelwidth 5em
4877 \let\makelabel\symbollabel}}%
4878 {\endlist}
4879 \newcommand{\symboldef}[2]{\item[#1] #2}
4880 \newif\if@bsonecol
4881 \@bsonecoltrue
4882 \newif\ifadd@bstotoc
4883 \add@bstotocfalse
4884 \newif\ifnumber@bs
4885 \number@bsfalse
4886 \newif\if@bsrunin
4887 \@bsruninfalse
4888
4889 \newcommand{\abstractcol}{\@bsonecolfalse}
4890 \newcommand{\abstractintoc}{\add@bstotoctrue}
4891 \newcommand{\abstractnum}{\number@bstrue\@bsruninfalse}
4892 \newcommand{\abstractrunin}{\@bsrunintrue\number@bsfalse}
4893
4894 \newcommand{\abstractnamefont}{\normalfont\small\bfseries}
4895 \newcommand{\abstracttextfont}{\normalfont\small}
4896 \newcommand{\abscolnamefont}{\normalfont\Large\bfseries}
4897 \newcommand{\abscoltextfont}{\normalfont}
4898
4899 \newcommand{\absnamepos}{center}
4900 \newlength{\abstitleskip} \setlength{\abstitleskip}{-0.5em}
4901 \newlength{\absleftindent}
4902 \absleftindent=\leftmargin
4903 \newdimen\abs@leftindent
4904 \abs@leftindent=\leftmargin
4905 \newlength{\absrightindent}
4906 \absrightindent=\leftmargin
4907 \newlength{\absparindent}
4908 \newlength{\absparsep}
4909
4910 \newcommand{\abslabeldelim}[1]{\def\@bslabeldelim{#1}}
4911 \abslabeldelim{}
4912 \newcommand{\@bsrunintitle}{%
4913 \hspace*{\abstitleskip}{\abstractnamefont\abstractname\@bslabeldelim}}
4914
4915 \newcommand{\setup@bstract}{%
4916 \abs@leftindent=\absleftindent
4917 \if@twocolumn
4918 \if@bsonecol
4919 \else
4920 \abs@leftindent=\z@
4921 \absrightindent=\z@
4922 \renewcommand*{\abstractnamefont}{\abscolnamefont}
4923 \renewcommand*{\abstracttextfont}{\abscoltextfont}
4924 \renewcommand*{\absnamepos}{flushleft}
4925 \setlength{\abstitleskip}{-2ex}
4926 \fi
4927 \fi}
4928
4929 \AtBeginDocument{\setlength{\absparindent}{\parindent}
4930 \setlength{\absparsep}{\parskip}}
4931
4932 \newenvironment{@bstr@ctlist}{%
4933 \list{}{%
4934 %%\topsep \z@
4935 \partopsep \z@
4936 \listparindent \absparindent
4937 \itemindent \listparindent
4938 \leftmargin \abs@leftindent
4939 \rightmargin \absrightindent
4940 \parsep \absparsep}%
4941 \item\relax}
4942 {\endlist}
4943
4944 \newcommand{\put@bsintoc}{%
4945 \ifadd@bstotoc
4946 \ifnumber@bs\else
4947 % \phantomsection
4948 \MakeLinkTarget[chapter]{}%
4949 \addcontentsline{toc}{chapter}{\abstractname}
4950 \fi
4951 \fi}
4952
4953 \newcommand{\num@bs}{\chapter{\abstractname}}
4954
4955 \newenvironment{abstract}{%
4956 \setup@bstract
4957 \if@bsrunin\else
4958 \ifnumber@bs \num@bs \else
4959 \begin{\absnamepos}\abstractnamefont\abstractname\end\absnamepos%
4960 \vspace{\abstitleskip}%
4961 \fi
4962 \fi
4963 \put@bsintoc%
4964 \begin{@bstr@ctlist}\if@bsrunin\@bsrunintitle\fi\abstracttextfont}%
4965 {\par\end{@bstr@ctlist}}
4966
4967 \newenvironment{onecolabstract}{%
4968 \begin{@twocolumnfalse}\begin{abstract}}{%
4969 \end{abstract}\end{@twocolumnfalse}}
4970
4971 % \addtoiargdef{\thanks}{}{%
4972 % \protected@xdef\@bs@thanks{\@bs@thanks
4973 % \protect\footnotetext[\the\c@footnote]{#1}}%
4974 % }
4975 \xapptocmd\thanks{%
4976 \protected@xdef\@bs@thanks{\@bs@thanks
4977 \protect\footnotetext[\the\c@footnote]{#1}}%
4978 }{}{\typeout{Patch to \string\thanks\space failed, please inform maintainer}}
4979 \let\@bs@thanks\@empty
4980
4981 \newcommand{\saythanks}{\begingroup
4982 \renewcommand{\thefootnote}{\fnsymbol{footnote}}\@bs@thanks
4983 \endgroup\global\let\@bs@thanks\@empty}
4984
4985 \newcounter{vslineno}
4986 \newcounter{poemline}
4987 \newcounter{modulo@vs}
4988 \newcounter{memfvsline}
4989
4990 \newcommand{\linenumberfont}[1]{\def\vlvnumfont{#1}}
4991 %%% \linenumberfont{\small\rmfamily}
4992
4993 \newif\ifbvcountlines% TRUE to print line numbers of (boxed) verbatim lines
4994 \bvcountlinesfalse
4995
4996 \newcommand{\linenumberfrequency}[1]{%
4997 \ifnum #1< \@ne
4998 \def\linemodnum{0\relax}
4999 \bvcountlinesfalse
5000 \else
5001 \def\linemodnum{#1\relax}
5002 \bvcountlinestrue
5003 \fi}
5004
5005 %%%%\linenumberfrequency{0}
5006
5007 \newcommand*{\setverselinenums}[2]{%
5008 \c@poemline #1\relax \advance\c@poemline \m@ne
5009 \refstepcounter{poemline}%
5010 \ifnum\z@<\linemodnum% we are printing line numbers
5011 \@tempcnta #2\relax
5012 \divide\@tempcnta\linemodnum
5013 \multiply\@tempcnta\linemodnum
5014 \c@memfvsline #2\relax
5015 \advance\c@memfvsline-\@tempcnta
5016 \fi}
5017
5018 \newcommand{\getthelinenumber}[2]{%
5019 \ifnum\@ne>\linemodnum% no line numbers
5020 \else
5021 \ifnum\@ne=\linemodnum% every line numbered
5022 \@nameuse{the#1}%
5023 \else
5024 \@tempcnta=\@nameuse{c@#1}%
5025 \advance\@tempcnta -\@nameuse{c@#2}%
5026 \divide\@tempcnta \linemodnum
5027 \multiply\@tempcnta \linemodnum
5028 \advance\@tempcnta \@nameuse{c@#2}%
5029 \ifnum\@tempcnta=\@nameuse{c@#1}\@nameuse{the#1}\fi
5030 \fi
5031 \fi}
5032
5033 \newif\ifaltindent
5034 \altindentfalse
5035 \newif\ifpattern
5036 \patternfalse
5037 \newif\ifstarpattern
5038 \starpatternfalse
5039
5040 \newlength{\vleftskip}
5041 \setlength{\vleftskip}{3em}
5042 \newlength{\vrightskip}
5043 \setlength{\vrightskip}{1em}
5044
5045 \newlength{\stanzaskip}
5046 \setlength{\stanzaskip}{\onelineskip}
5047
5048 \newcommand{\flagverse}[1]{%
5049 %%% \hskip-\vleftskip\llap{#1}\hskip\vleftskip\ignorespaces}
5050 \hskip-\memRTLvleftskip\llap{#1}\hskip\memRTLvleftskip\ignorespaces}
5051
5052 \newlength{\versewidth}
5053 \newlength{\vgap} \setlength{\vgap}{1.5em}
5054 \newcommand{\vin}{\hspace*{\vgap}}
5055 \newlength{\vindent} \setlength{\vindent}{2\vgap}
5056 \newcommand{\vinphantom}[1]{\leavevmode\phantom{#1}}
5057 \newcommand*{\vleftofline}[1]{\leavevmode\llap{#1}}
5058 \newdimen\vleftmargin
5059 \vleftmargin=\leftmargini
5060
5061 \newcommand{\verselinebreak}[1][\z@]{\newline\hspace*{#1}\ignorespaces}
5062
5063 \newcommand{\incr@vsline}{%
5064 \refstepcounter{poemline}%
5065 \stepcounter{vslineno}}
5066
5067 \newcommand{\@vsifbang}[1]{\@ifnextchar !{\@firstoftwo{#1}}}
5068 \newcommand{\@vsifgt}[1]{\@ifnextchar >{\@firstoftwo{#1}}}
5069
5070 \newcommand*{\verselinenumbersright}{\def\@vstypelinenum{\@vslnumright}}
5071 \newcommand*{\verselinenumbersleft}{\def\@vstypelinenum{\@vslnumleft}}
5072 \verselinenumbersright
5073
5074 \newcommand*{\@vslnumright}{%
5075 %\nobreak%
5076 %\hfill\rlap{%\kern\vrightskip\kern\rightmargin%
5077 % \kern\memRTLvrightskip\kern\rightmargin%
5078 % \vlvnumfont\getthelinenumber{poemline}{memfvsline}}
5079 \rlap{%
5080 \hspace{\dimexpr-\@totalleftmargin+\textwidth+\memRTLvrightskip}%
5081 {\vlvnumfont\getthelinenumber{poemline}{memfvsline}}%
5082 }%
5083 }
5084 \newcommand*{\@vslnumleft}{%
5085 % \nobreak%
5086 % \hfill\rlap{%\kern-\textwidth\kern-\vrightskip%
5087 % \kern-\textwidth\kern-\memRTLvrightskip%
5088 % \vlvnumfont\getthelinenumber{poemline}{memfvsline}}
5089 \llap{%
5090 \llap{\vlvnumfont\getthelinenumber{poemline}{memfvsline}}%
5091 \hspace{\dimexpr\@totalleftmargin+\memRTLvrightskip}%
5092 }%
5093 }
5094 \newcommand{\@vscentercr}{%
5095 \ifhmode \unskip\else \@nolnerr\fi
5096 % \@vstypelinenum% outcommented 2024/02/06
5097 \@vsifgt{\verselinebreak}{%
5098 \incr@vsline
5099 \par\@ifstar{\nobreak\@vsxcentercr}{%
5100 \@vsifbang{\@ifnextchar[ {\@vsicentercr}{}}{\@vsxcentercr}}}}
5101 \newcommand{\@vsxcentercr}{\addvspace{-\parskip}%
5102 \@ifnextchar[ {\@vsicentercr}{\start@vsline}}
5103 \def\@vsicentercr[#1]{\vskip #1\ignorespaces \start@vsline}
5104 \newcommand{\start@vsline}{%
5105 \ifaltindent\ifodd\c@vslineno\else\vin\fi\fi%
5106 \ifpattern\get@vsindent\fi%
5107 \ifstarpattern\getstar@vsindent\fi}
5108
5109 \newcounter{verse}
5110 \setcounter{verse}{0}
5111 \def\theHpoemline{\theverse.\thepoemline}
5112
5113 \newenvironment{verse}[1][\linewidth]{%
5114 \refstepcounter{verse}%
5115 \setcounter{poemline}{0}\refstepcounter{poemline}%
5116 \setcounter{vslineno}{1}%
5117 \let\\=\@vscentercr
5118 \list{}{\itemsep \z@
5119 \itemindent -\vindent
5120 \listparindent\itemindent
5121 \leftmargin \vleftmargin
5122 \parsep \stanzaskip
5123 \ifdim #1<\linewidth% %% short line
5124 \rightmargin \z@
5125 \leftmargin \linewidth
5126 \advance\leftmargin -#1\relax
5127 \advance\leftmargin -0.5\leftmargin
5128 \advance\leftmargin \vindent
5129 \else
5130 \ifdim #1>\linewidth% %% long line
5131 \rightmargin \z@
5132 \leftmargin \vindent
5133 \else% %% default
5134 \rightmargin \leftmargin
5135 \advance\leftmargin \vindent
5136 \fi
5137 \fi}
5138 \item[]}{\endlist}
5139
5140 \AddToHook{env/verse/begin}{%
5141 \AddToHook{para/begin}[memoir/versenum]{\@vstypelinenum}}
5142 \AddToHook{env/verse/end}{\RemoveFromHook{para/begin}[memoir/versenum]}
5143
5144 \newenvironment{altverse}%
5145 {\starpatternfalse\patternfalse\altindenttrue
5146 \setcounter{vslineno}{1}}%
5147 {\altindentfalse}
5148
5149 \newif\ifbounderror
5150 \bounderrorfalse
5151 \newif\ifinteger
5152
5153 \newcounter{chrsinstr} % CHARactersINSTRing
5154
5155 \newcommand{\newarray}[3]{%
5156 \@nameedef{#1-low}{#2}%
5157 \@nameedef{#1-high}{#3}%
5158 \ifnum #3<#2
5159 \@memerror{Limits for array #1 are in reverse order}{\@ehc}%
5160 \fi}
5161
5162 \newcommand{\stringtoarray}[2]{%
5163 \def\@vsarrayname{#1}%
5164 \protected@edef\the@vsstring{#2}%
5165 \newarray{\@vsarrayname}{1}{1}%
5166 \@ifmtarg{#2}{%
5167 \c@chrsinstr \z@
5168 \@namedef{\@vsarrayname-1}{}
5169 }{%
5170 \c@chrsinstr \@ne
5171 \expandafter\@vsstringtoarray \the@vsstring\@vsend
5172 }}
5173
5174 \def\@vsstringtoarray #1#2\@vsend{%
5175 \@namedef{\@vsarrayname-\the\c@chrsinstr}{#1}
5176 \@nameedef{\@vsarrayname-high}{\the\c@chrsinstr}
5177 \@ifmtarg{#2}{%
5178 \def\@vsinext{}%
5179 }{%
5180 \advance\c@chrsinstr \@ne
5181 \def\@vsinext{%
5182 \@vsstringtoarray #2\@vsend%
5183 }%
5184 }
5185 \@vsinext}
5186
5187 \newcommand{\setarrayelement}[3]{%
5188 \checkarrayindex{#1}{#2}%
5189 \@nameedef{#1-#2}{#3}}
5190 \newcommand{\getarrayelement}[3]{%
5191 \checkarrayindex{#1}{#2}%
5192 \protected@edef#3{\@nameuse{#1-#2}}}
5193
5194 \newcommand{\checkarrayindex}[2]{%
5195 \bounderrorfalse
5196 \expandafter\ifx\csname #1-low\endcsname\relax%
5197 \ifpattern\else
5198 \@memerror{No array called #1}{\@ehc}%
5199 \fi
5200 \bounderrortrue
5201 \fi
5202 \ifnum #2<\@nameuse{#1-low}\relax%
5203 \ifpattern\else
5204 \@memerror{Index #2 outside limits for array #1}{\@ehc}%
5205 \fi
5206 \bounderrortrue
5207 \fi
5208 \ifnum #2>\@nameuse{#1-high}\relax%
5209 \ifpattern\else
5210 \@memerror{Index #2 outside limits for array #1}{\@ehc}%
5211 \fi
5212 \bounderrortrue
5213 \fi}
5214
5215 \newcommand{\arraytostring}[2]{%
5216 \def#2{}%
5217 \c@chrsinstr = \@nameuse{#1-low}%
5218 \@vsarraytostring{#1}{#2}}
5219
5220 \newcommand{\@vsarraytostring}[2]{%
5221 \ifnum\c@chrsinstr>\@nameuse{#1-high}\else
5222 \protected@edef#2{#2\@nameuse{#1-\thechrsinstr}}%
5223 \advance\c@chrsinstr\@ne%
5224 \@vsarraytostring{#1}{#2}%
5225 \fi}
5226
5227 \newcommand{\checkifinteger}[1]{%
5228 \protected@edef\@vsa{#1}%
5229 \ifcat _\ifnum9<1\gobm{#1} _\else A\fi
5230 \integertrue%
5231 \else
5232 \integerfalse%
5233 \fi}
5234 \newcommand{\gobm}[1]{#1}
5235
5236 \newcommand{\indentpattern}[1]{%
5237 \stringtoarray{Array@vs}{#1}}
5238 \newcommand{\get@vsindent}{%
5239 \getarrayelement{Array@vs}{\number\value{vslineno}}{\@vspat}%
5240 \ifbounderror
5241 \arraytostring{Array@vs}{\@vsp@t}%
5242 \@memwarn{%
5243 Index `\thevslineno' for pattern `\@vsp@t' is out of bounds}%
5244 \def\@vspat{0}%
5245 \else
5246 \checkifinteger{\@vspat}%
5247 \ifinteger\else
5248 \arraytostring{Array@vs}{\@vsp@t}%
5249 \@memwarn{%
5250 `\@vspat' at index `\thevslineno' in pattern `\@vsp@t'
5251 is not a digit}%
5252 \def\@vspat{0}%
5253 \fi
5254 \fi
5255 \ifcase\@vspat\else\hspace*{\@vspat\vgap}\fi}
5256 \newcommand{\getstar@vsindent}{%
5257 \expandafter\ifx\csname Array@vs-high\endcsname\relax
5258 \@memerror{A pattern has not been specified}{\@ehc}
5259 \else
5260 \ifnum\c@vslineno>\@nameuse{Array@vs-high}%
5261 \setcounter{vslineno}{1}%
5262 \fi
5263 \get@vsindent
5264 \fi}
5265
5266 \newenvironment{patverse}%
5267 {\starpatternfalse\patterntrue\altindentfalse
5268 \setcounter{vslineno}{1}}%
5269 {\patternfalse}
5270
5271 \newenvironment{patverse*}%
5272 {\starpatterntrue\patternfalse\altindentfalse
5273 \setcounter{vslineno}{1}}%
5274 {\starpatternfalse}
5275
5276 \newcommand{\poemtitle}{\par%
5277 \secdef\@vsptitle\@vssptitle}
5278 \newcommand{\poemtoc}{section}
5279
5280 \newcommand{\mempoeminfo}[1]{}
5281 \newcommand{\mempoemstarinfo}[1]{}
5282
5283 \long\def\@vsptitle[#1]#2{%
5284 % \phantomsection
5285 \M@gettitle{#1}%
5286 \MakeLinkTarget[\poemtoc]{}%
5287 \addcontentsline{toc}{\poemtoc}{#1}%
5288 \mempoeminfo{#1}%
5289 \poemtitlemark{#1}%
5290 \@vstypeptitle{#2}%
5291 \@afterheading}
5292
5293 \long\def\@vssptitle#1{%
5294 \M@gettitle{#1}%
5295 \MakeLinkTarget[\poemtoc]{}%
5296 \mempoemstarinfo{#1}%
5297 \@vstypeptitle{#1}%
5298 \@afterheading}
5299
5300 \newcommand{\@vstypeptitle}[1]{%
5301 \vspace{\beforepoemtitleskip}%
5302 {\poemtitlefont #1\par}%
5303 \vspace{\afterpoemtitleskip}%
5304 }
5305
5306 \newcommand{\poemtitlefont}{\normalfont\large\bfseries\centering}
5307 \newcommand{\poemtitlemark}[1]{}
5308
5309 \newlength{\beforepoemtitleskip}
5310 \setlength{\beforepoemtitleskip}{3.5ex \@plus 1ex \@minus .2ex}
5311 \newlength{\afterpoemtitleskip}
5312 \setlength{\afterpoemtitleskip}{2.3ex \@plus.2ex}
5313
5314 \newif\if@numptitle
5315 \newcommand*{\NumberPoemTitle}{\@numptitletrue}
5316 \newcommand*{\PlainPoemTitle}{\@numptitlefalse}
5317 \NumberPoemTitle
5318
5319 \newcounter{poem}\setcounter{poem}{0}
5320 \renewcommand*{\thepoem}{\@arabic\c@poem}
5321 \providecommand*{\theHpoem}{\the\value{poem}}
5322
5323 \newcommand*{\poemtitlestarmark}[1]{}
5324 \newcommand*{\poemtitlepstyle}{}
5325 \newcommand*{\poemtitlestarpstyle}{}
5326
5327 \newcommand\PoemTitle{%
5328 \par
5329 \@afterindentfalse
5330 \@ifstar{\@m@msPoemTitle}{\@m@mPoemTitle}}
5331
5332 \newcommand{\@m@mPoemTitle}[1][]{%
5333 \def\poemt@c{#1}% capture first optional arg
5334 \@ifnextchar[{\@PoemTitle}{\@PoemTitle[]}%
5335 }
5336
5337 \newcommand{\memPoemTitleinfo}[4]{}
5338 \newcommand{\memPoemTitlestarinfo}[2]{}
5339
5340 \def\@PoemTitle[#1]#2{%
5341 %\phantomsection
5342 \ifx\poemt@c\@empty % no optional args
5343 \def\poemf@rtoc{#2}%
5344 \def\poemf@rhdr{#2}%
5345 \else % at least one opt arg
5346 \let\poemf@rtoc\poemt@c
5347 \ifx\@empty#1\@empty
5348 \let\poemf@rhdr\poemt@c
5349 \else
5350 \def\poemf@rhdr{#1}%
5351 \fi
5352 \fi
5353 \m@m@Andfalse
5354 \if@numptitle
5355 \if@mainmatter
5356 \m@m@Andtrue
5357 \fi
5358 \fi
5359 \ifm@m@And
5360 \refstepcounter{poem}%
5361 \else
5362 \MakeLinkTarget[poem]{}%
5363 \fi
5364 \@makePoemTitlehead{#2}%
5365 \@afterheading
5366 \poemtitlemark{\poemf@rhdr}%
5367 \poemtitlepstyle
5368 \ifm@m@And
5369 \addcontentsline{toc}{\poemtoc}{%
5370 \protect\numberline{\thepoem}\poemf@rtoc}%
5371 \memPoemTitleinfo{\thepoem}{\poemf@rtoc}{\poemf@rhdr}{#2}%
5372 \else
5373 \addcontentsline{toc}{\poemtoc}{\poemf@rtoc}%
5374 \memPoemTitleinfo{}{\poemf@rtoc}{\poemf@rhdr}{#2}%
5375 \fi
5376 \ifheadnameref\ExpandArgs{V}\M@gettitle\poemf@rhdr\else\ExpandArgs{V}\M@gettitle\poemf@rtoc\fi}
5377
5378 \def\@makePoemTitlehead#1{{%
5379 \PoemTitleheadstart
5380 \parindent \z@ \normalfont
5381 \ifm@m@And
5382 \printPoemTitlenum
5383 \afterPoemTitlenum
5384 \else
5385 \printPoemTitlenonum
5386 \fi
5387 \interlinepenalty\@M
5388 \printPoemTitletitle{#1}%
5389 \afterPoemTitle}}
5390
5391 \newcommand{\@PTchs@def@ult}{%
5392 \def\PoemTitleheadstart{\vspace{\beforePoemTitleskip}}
5393 \def\printPoemTitlenum{\PoemTitlenumfont \thepoem}
5394 \def\afterPoemTitlenum{\par\nobreak\vskip \midPoemTitleskip}
5395 \def\printPoemTitlenonum{}
5396 \def\printPoemTitletitle##1{\PoemTitlefont ##1}
5397 \def\afterPoemTitle{\par\nobreak\vskip \afterPoemTitleskip}}
5398 \@PTchs@def@ult
5399
5400 \newcommand*{\PoemTitlenumfont}{\normalfont\large\centering}
5401 \newcommand*{\PoemTitlefont}{\normalfont\large\centering}
5402 \newlength{\beforePoemTitleskip}
5403 \setlength{\beforePoemTitleskip}{1\onelineskip}
5404 \newlength{\midPoemTitleskip}
5405 \setlength{\midPoemTitleskip}{0pt}
5406 \newlength{\afterPoemTitleskip}
5407 \setlength{\afterPoemTitleskip}{1\onelineskip}
5408
5409 \newcommand{\@m@msPoemTitle}[2][\@empty]{%
5410 \@sPoemTitle{#2}%
5411 \ifx \@empty#1
5412 \def\poemf@rhdr{#2}%
5413 \else % opt arg
5414 \def\poemf@rhdr{#1}%
5415 \fi
5416 \poemtitlestarmark{\poemf@rhdr}%
5417 \poemtitlestarpstyle
5418 \memPoemTitlestarinfo{\poemf@rhdr}{#2}}
5419
5420 \newcommand{\@sPoemTitle}[1]{%
5421 \@makesPoemTitlehead{#1}%
5422 \@afterheading
5423 \M@gettitle{#1}}
5424
5425 \def\@makesPoemTitlehead#1{{%
5426 \PoemTitleheadstart
5427 \parindent \z@ \normalfont
5428 \printPoemTitlenonum
5429 \interlinepenalty\@M
5430 \printPoemTitletitle{#1}
5431 \afterPoemTitle}}
5432
5433 \setlength\arraycolsep{5\p@}
5434 \setlength\tabcolsep{6\p@}
5435 \setlength\arrayrulewidth{.4\p@}
5436 \setlength\doublerulesep{2\p@}
5437 \setlength\tabbingsep{\labelsep}
5438
5439 \newcommand{\@minipagerestore}{%
5440 \let\@verbfootnotetext\@verbmpfootnotetext
5441 \m@mdoextrafeetmini
5442 \ifm@mnzpskip \parskip=\m@mabparskip\fi}
5443
5444 \skip\@mpfootins = \skip\footins
5445
5446 \setlength\fboxsep{3\p@}
5447 \setlength\fboxrule{.4\p@}
5448
5449 \@addtoreset{equation}{chapter}
5450 \renewcommand{\theequation}{%
5451 \ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@equation}
5452
5453 \RequirePackage{array}[2018/04/30]
5454 \newif \@iffirstamp
5455 \let\m@mold@addamp\@addamp
5456 \newcommand*{\m@m@addamp}{%
5457 \if@firstamp
5458 \@firstampfalse
5459 \global\@curtab\@ne
5460 \else
5461 \@addtopreamble{&}%
5462 \global\advance\@curtab\@ne
5463 \fi}
5464 \let\@addamp\m@m@addamp
5465
5466
5467 \RequirePackage{dcolumn}[2014/10/28]
5468 \RequirePackage{delarray}[2014/10/28]
5469 \RequirePackage{tabularx}[2016/02/03]
5470 \newcommand*{\bktabrule}[1]{%
5471 \hrule \@height#1}
5472
5473 \RequirePackage{booktabs}[2020/01/12]
5474 \newskip\ctableftskip \ctableftskip=\fill
5475 \newskip\ctabrightskip \ctabrightskip=\fill
5476
5477 \expandafter\def\csname ctabular*\endcsname{%
5478 \@ifnextchar[ {\@ctabularstar}{\@ctabularstar[c]}}
5479 \def\@ctabularstar[#1]#2{\global\@curtab\@ne
5480 \ctableftskip\fill
5481 \ctabrightskip\fill
5482 \if l#1% left
5483 \ctableftskip\z@
5484 \else
5485 \if r#1% right
5486 \ctabrightskip\z@
5487 \fi
5488 \fi
5489 \setlength\dimen@{#2}%
5490 \xdef\@halignto{to\the\dimen@}\NC@tabular}
5491 \newcommand*{\ctabular}[1][c]{\global\@curtab\@ne
5492 \ctableftskip\fill
5493 \ctabrightskip\fill
5494 \if l#1% left
5495 \ctableftskip\z@
5496 \else
5497 \if r#1% right
5498 \ctabrightskip\z@
5499 \fi
5500 \fi
5501 \gdef\@halignto{to\hsize}\NC@tabular}
5502
5503 \newcommand*{\NC@tabular}{%
5504 \par
5505 \addvspace{\topsep}
5506 \col@sep\tabcolsep
5507 \let\d@llarbegin\begingroup
5508 \let\d@llarend\endgroup
5509 \@NCtabarray}
5510
5511 \newcommand*{\@NCialign}{\everycr{}\tabskip\ctableftskip\halign}
5512
5513 \newcommand*{\@NCtabarray}[1]{%
5514 \@tempdima \ht\strutbox
5515 \advance\@tempdima\extrarowheight
5516 \setbox \@arstrutbox \hbox{\vrule
5517 \@height \arraystretch \@tempdima
5518 \@depth \arraystretch \dp\strutbox
5519 \@width\z@}%
5520 \begingroup
5521 %% \@mkpream{@{\hspace{\@totalleftmargin}}#1@{}}%
5522 \@mkpream{#1}%
5523 \xdef\@preamble{\@NCialign \@halignto
5524 \bgroup & \tabskip\z@
5525 \@arstrut
5526 \@preamble
5527 \tabskip\ctabrightskip
5528 \cr}%
5529 \endgroup
5530 \let\@sharp ##\let\protect\relax
5531 \lineskip\z@
5532 \baselineskip\z@
5533 \let\\\@arraycr
5534 \let\tabularnewline\\%
5535 \let\par\@empty
5536 \ctabsetlines
5537 \@preamble
5538 }
5539
5540 \def\endctabular{%
5541 \crcr \egroup
5542 \gdef\@preamble{}%
5543 \addvspace{\topsep}
5544 \noindent}
5545 \expandafter\let\csname endctabular*\endcsname=\endctabular
5546
5547 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5548 \newcommand*{\memcline}[2]{\m@m@cline[#1]#2\@nil}
5549 \def\m@m@cline[#1]#2-#3\@nil{%
5550 \omit
5551 \@multicnt#2%
5552 \advance\@multispan\m@ne
5553 \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
5554 \@multicnt#3%
5555 \advance\@multicnt-#2%
5556 \advance\@multispan\@ne
5557 \leaders\hrule\@height #1\hfill % <- variable \@height value
5558 \cr
5559 \noalign{\vskip- #1}} % <- variable \@height value
5560
5561 \newcommand*{\memhline}[1][\arrayrulewidth]{\memcline{#1}{1-\@curtab}}
5562 \newcommand*{\m@mhline}{\cline{1-\@curtab}}
5563 \def\m@m@BTnormal{%
5564 \ifnum0=`{\fi} % closes the \noalign
5565 \multispan{\@curtab} \leaders\bktabrule{\@thisrulewidth}\hfill\cr
5566 \noalign{\ifnum0=`}\fi
5567 \futurenonspacelet\@tempa\@BTendrule}
5568
5569 \def\ctabsetlines{%
5570 \let\hline\m@mhline
5571 \let\@BTnormal\m@m@BTnormal}
5572
5573 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5574 \newcount\abovecolumnspenalty
5575 \abovecolumnspenalty=10000
5576 \newcount\@linestogo % lines remaining to be procesed
5577 \newcount\@cellstogo % cells remaining in column or row
5578 \newcount\@cellsincolumn % number of lines per column
5579 \newtoks\crtok
5580 \crtok = {\cr}%
5581
5582 \newdimen\@mincolumnwidth
5583 \let\c@lleftskip\hfil % left skip within a column
5584 \let\c@lrightskip\hfil % right skip within a column
5585
5586 \let\preautotab\relax
5587 \let\postautotab\relax
5588
5589 \newcommand{\autocols}[5][0pt]{\par\begingroup
5590 \ctabsetlines
5591 \if l#2
5592 \raggedright
5593 \else
5594 \if r#2
5595 \raggedleft
5596 \else
5597 \centering
5598 \fi
5599 \fi
5600 \let\c@lleftskip\hfil
5601 \let\c@lrightskip\hfil
5602 \if l#4
5603 \let\c@lleftskip\relax
5604 \else
5605 \if r#4
5606 \let\c@lrightskip\relax
5607 \fi
5608 \fi
5609 \@mincolumnwidth\z@
5610 \TX@cols=#3
5611 \@curtab=#3
5612 \@linestogo\z@
5613 \@for\@tempa:=#5\do{
5614 \advance\@linestogo\@ne
5615 \settowidth{\@tempdima}{\@tempa}
5616 \ifdim\@tempdima>\@mincolumnwidth
5617 \@mincolumnwidth=\@tempdima
5618 \fi
5619 }
5620 \advance\@mincolumnwidth\tabcolsep
5621 \linespercol
5622 \def\@endcolumnactions{%
5623 \global\advance\@linestogo\m@ne
5624 \ifnum\@cellstogo<\tw@
5625 \global\advance\TX@cols\m@ne
5626 \ifnum\TX@cols>\z@\linespercol\fi
5627 \the\crtok
5628 \else
5629 &\global\advance\@cellstogo\m@ne
5630 \fi}%
5631 \ifdim #1 > \z@
5632 \TX@col@width=#1
5633 \divide\TX@col@width \TX@cols
5634 \else
5635 \TX@col@width=\@mincolumnwidth
5636 \fi
5637 \penalty\abovecolumnspenalty
5638 \noindent% usually not a paragraph
5639 \def\@preamble{}%
5640 \begingroup
5641 \let\@sharp\relax
5642 \ifnum\@cellsincolumn>\@ne
5643 \loop
5644 \g@addto@macro{\@preamble}{%
5645 \hb@xt@ \TX@col@width{%
5646 \c@lleftskip\strut\@sharp\c@lrightskip} &}%
5647 \advance\@cellsincolumn\m@ne
5648 \ifnum\@cellsincolumn>\@ne
5649 \repeat
5650 \fi
5651 \g@addto@macro{\@preamble}{%
5652 \hb@xt@ \TX@col@width{\c@lleftskip\strut\@sharp\c@lrightskip}}%
5653 \endgroup
5654 \let\@sharp ##
5655 \tabskip\ctableftskip
5656 %% \tabskip\z@
5657 \valign \bgroup
5658 \tabskip\z@
5659 \@preamble
5660 \tabskip\ctabrightskip\cr
5661 \@for\@tempa:=#5\do{
5662 \@tempa\unskip\space\@endcolumnactions}%
5663 \the\crtok \egroup \par \endgroup}
5664
5665 \newcommand*{\linespercol}{%
5666 \@cellsincolumn=\@linestogo
5667 \divide\@cellsincolumn \TX@cols
5668 \@cellstogo=\@cellsincolumn
5669 \multiply\@cellstogo \TX@cols
5670 \@tempcnta=\@linestogo
5671 \advance\@tempcnta -\@cellstogo
5672 \ifnum \@tempcnta>\z@
5673 \advance\@cellsincolumn \@ne
5674 \fi
5675 \global\@cellstogo=\@cellsincolumn}
5676
5677 \newcommand{\autorows}[5][0pt]{\par\begingroup
5678 \ctabsetlines
5679 \ctableftskip\fill
5680 \ctabrightskip\fill
5681 \if l#2
5682 \ctableftskip\z@
5683 \else
5684 \if r#2
5685 \ctabrightskip\z@
5686 \fi
5687 \fi
5688 \let\c@lleftskip\hfil
5689 \let\c@lrightskip\hfil
5690 \if l#4
5691 \let\c@lleftskip\relax
5692 \else
5693 \if r#4
5694 \let\c@lrightskip\relax
5695 \fi
5696 \fi
5697 \TX@cols=#3\relax
5698 \@curtab=#3\relax
5699 \@cellstogo = \TX@cols
5700 \@mincolumnwidth\z@
5701 \@linestogo\z@
5702 \@for\@tempa:=#5\do{%
5703 \advance\@linestogo\@ne
5704 \settowidth{\@tempdima}{\@tempa}
5705 \ifdim\@tempdima>\@mincolumnwidth
5706 \@mincolumnwidth=\@tempdima
5707 \fi}%
5708 \advance\@mincolumnwidth\tabcolsep
5709 \def\@endcolumnactions{%
5710 \global\advance\@linestogo\m@ne
5711 \global\advance\@cellstogo\m@ne
5712 \ifnum\@cellstogo<\@ne
5713 \global\@cellstogo=\TX@cols
5714 \the\crtok
5715 \else
5716 &
5717 \fi}%
5718 \ifdim #1>\z@
5719 \TX@col@width=#1
5720 \else
5721 \TX@col@width=\hsize
5722 \fi
5723 \divide\TX@col@width \TX@cols
5724 \ifdim #1=\z@
5725 \TX@col@width=\@mincolumnwidth
5726 \fi
5727 \penalty\abovecolumnspenalty
5728 \noindent % usually not a paragraph
5729 \vskip -\z@ % don't know why we need this, but looks bad without it
5730 \def\@preamble{}%
5731 \begingroup
5732 \let\@sharp\relax
5733 \ifnum\TX@cols>\@ne
5734 \loop
5735 \ifdim #1<\z@
5736 \g@addto@macro{\@preamble}{%
5737 \strut\c@lleftskip\@sharp\c@lrightskip &}%
5738 \else
5739 \g@addto@macro{\@preamble}{%
5740 \hb@xt@ \TX@col@width{%
5741 \strut\c@lleftskip\@sharp\c@lrightskip} &}%
5742 \fi
5743 \advance\TX@cols\m@ne
5744 \ifnum\TX@cols>\@ne
5745 \repeat
5746 \fi
5747 \ifdim #1<\z@
5748 \g@addto@macro{\@preamble}{%
5749 \strut\c@lleftskip\@sharp\c@lrightskip}%
5750 \else
5751 \g@addto@macro{\@preamble}{%
5752 \hb@xt@ \TX@col@width{\strut\c@lleftskip\@sharp\c@lrightskip}}%
5753 \fi
5754 \endgroup
5755 \let\@sharp ##
5756 \tabskip\ctableftskip
5757 \halign to \hsize \bgroup
5758 \tabskip\z@
5759 \@preamble
5760 %% \tabskip\ctabrightskip\cr \preautotab
5761 \tabskip\ctabrightskip\cr
5762 \@for\@tempa:=#5\do{%
5763 \@tempa\unskip\space\@endcolumnactions}%
5764 %% \the\crtok \postautotab \the\crtok \egroup \endgroup \par
5765 \the\crtok \egroup \endgroup \par}
5766
5767 \newcounter{newflo@tctr}
5768 \setcounter{newflo@tctr}{1}
5769
5770 \newcommand{\newfloat}[4][\@empty]{%
5771 %%% \@namedef{ftype@#2}{\value{newflo@tctr}}
5772 %%% \addtocounter{newflo@tctr}{\value{newflo@tctr}}
5773 \expandafter\edef\csname ftype@#2\endcsname{\the\c@newflo@tctr}%
5774 \advance\c@newflo@tctr \c@newflo@tctr
5775 \@ifundefined{c@#2}{% counter is not defined
5776 \ifx \@empty#1\relax
5777 \newcounter{#2}
5778 \else
5779 \newcounter{#2}[#1]
5780 \expandafter\edef\csname the#2\endcsname{%
5781 \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}
5782 \fi}{}
5783 \setcounter{#2}{0}
5784
5785 \@namedef{ext@#2}{#3}% file extension
5786 \@ifundefined{c@#3depth}{\newcounter{#3depth}}{}
5787 \setcounter{#3depth}{1}
5788
5789 \@namedef{fps@#2}{tbp} % position
5790 \@namedef{fnum@#2}{#4~\@nameuse{the#2}} % caption naming
5791 \@namedef{fleg#2}{#4} % legend naming
5792 \@namedef{flegtoc#2}##1{} % legend name in ToC
5793
5794 \newenvironment{#2}{\@float{#2}}{\end@float}
5795 \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}
5796 } % end \newfloat
5797
5798 \newcommand*{\setfloatlocations}[2]{\@namedef{fps@#1}{#2}}
5799
5800 \newcommand*\setfloatadjustment[2]{\@namedef{#1adjustment}{#2}}
5801
5802 \newcommand{\newsubfloat}[1]{%
5803 \newlistentry[#1]{sub#1}{\@nameuse{ext@#1}}{1}
5804 \@namedef{ext@sub#1}{\csname ext@#1\endcsname}
5805 \@namedef{thesub#1}{(\alph{sub#1})}
5806 \@namedef{@thesub#1}{\@nameuse{thesub#1}%
5807 \if@tightsubcap\hskip\subfloatlabelskip\else\space\fi}
5808 \@namedef{@@thesub#1}{\@nameuse{thesub#1}}
5809 \@namedef{p@sub#1}{\csname the#1\endcsname}
5810 \@namedef{toclevel@sub#1}{1}}
5811
5812 \newif\ifdonemaincaption
5813 \donemaincaptionfalse
5814
5815 \let\@memoldfloat\@float
5816 \renewcommand{\@float}[1]{\donemaincaptionfalse
5817 \@memresetsubcounter{#1}%
5818 \@memoldfloat{#1}}
5819 \let\@memolddblfloat\@dblfloat
5820 \renewcommand{\@dblfloat}[1]{\donemaincaptionfalse
5821 \@memresetsubcounter{#1}%
5822 \@memolddblfloat{#1}}
5823 \newcommand{\@memresetsubcounter}[1]{%
5824 \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax}}
5825
5826 %\let\@memoldefloat\end@float
5827 %\def\end@float{%
5828 % \@memlistsubcaptions{\@captype}\@memoldefloat}
5829 % \let\@memoldedblfloat\end@dblfloat
5830 % \def\end@dblfloat{%
5831 % \@memlistsubcaptions{\@captype}\@memoldedblfloat}
5832 \AddToHook{cmd/end@float/before}{\@memlistsubcaptions{\@captype}}
5833 \AddToHook{cmd/end@dblfloat/before}{\@memlistsubcaptions{\@captype}}
5834
5835 \def\mem@fb@botlist{\@botlist}
5836 \def\mem@fb@topblock{\suppressfloats[t]}
5837 \def\FloatBlock{\par\begingroup \let\@elt\relax
5838 \edef\@tempa{\mem@fb@botlist\@deferlist\@dbldeferlist}%
5839 \ifx\@tempa\@empty
5840 \else
5841 \ifx\@fltovf\relax % my indicator of recursion
5842 \if@firstcolumn
5843 \clearpage
5844 \else
5845 \null\newpage\FloatBlock
5846 \fi
5847 \else
5848 \newpage \let\@fltovf\relax
5849 \FloatBlock % recurse once only
5850 \fi\fi \endgroup
5851 \mem@fb@topblock}
5852 \newcommand*\FloatBlockAllowAbove{\def\mem@fb@topblock{}}
5853 \newcommand*\FloatBlockAllowBelow{\def\mem@fb@botlist{}}
5854
5855 \newcommand\setFloatBlockFor[1]{%
5856 \@namedef{#1block}{\FloatBlock}}
5857 \newsavebox{\mem@margin@floatbox}
5858 \newcommand\marginfloatmarginmacro{\marginpar}
5859 \newenvironment{mem@margin@float}[2][-1.2ex]%
5860 {\FloatBlock%
5861 \begin{lrbox}{\mem@margin@floatbox}%
5862 \begin{minipage}{\marginparwidth}%
5863 \def\@captype{#2}%
5864 \hbox{}\vspace*{#1}%
5865 \@nameuse{margin#2adjustment}%
5866 \@nameuse{margin#2captionadjustment}%
5867 \noindent%
5868 }
5869 {\end{minipage}%
5870 \end{lrbox}%
5871 \marginfloatmarginmacro{\usebox{\mem@margin@floatbox}}%
5872 }
5873 \newenvironment{marginfigure}[1][-1.2ex]{%
5874 \begin{mem@margin@float}[#1]{figure}}
5875 {\end{mem@margin@float}}
5876 \newenvironment{margintable}[1][-1.2ex]{%
5877 \begin{mem@margin@float}[#1]{table}}
5878 {\end{mem@margin@float}}
5879 \setfloatadjustment{marginfigure}{\centering}
5880 \setfloatadjustment{margintable}{\centering}
5881
5882 \newcommand*\setmarginfloatcaptionadjustment[2]{%
5883 \@namedef{margin#1captionadjustment}{#2}}
5884
5885 \newcommand\setmpjustification[2]{%
5886 \@namedef{mem@mp@justification}{%
5887 \ifm@msetmp\else\@memerror{In order to use
5888 \string\marginCmdAdjust,^^J%
5889 please make sure to specify into which margin the^^J%
5890 \string\marginpar\space should go, using \string\marginparmargin}{}\fi
5891 \m@mwhich@margin{\m@mmpar@margin}%
5892 \ifmemtortm #2 \else #1\fi}%
5893 }
5894 \newcommand\mpjustification{%
5895 \@nameuse{mem@mp@justification}}
5896 \setmpjustification{\raggedleft}{\raggedright}
5897
5898 \newif\if@contcw
5899 \newif\if@conthang
5900 \newif\if@contindent
5901
5902 \newcommand{\captiondelim}[1]{\def\@contdelim{#1}}
5903 \captiondelim{: }
5904
5905 \newcommand{\captionnamefont}[1]{\def\@contnfont{#1}}
5906 \captionnamefont{}
5907
5908 \newcommand{\captiontitlefont}[1]{\def\@conttfont{#1}}
5909 \captiontitlefont{}
5910
5911 \newcommand*{\captionstyle}[1]{\def\@contcstyle{#1}}
5912 \captionstyle{}
5913
5914 \renewcommand{\captionstyle}{%
5915 \@ifnextchar[{\@memcshort}{\@memcnorm}}
5916 \def\@memcshort[#1]#2{%
5917 \def\@contcshortstyle{#1}%
5918 \def\@contcstyle{#2}}
5919 \def\@memcnorm#1{%
5920 \def\@contcshortstyle{#1}%
5921 \def\@contcstyle{#1}}
5922 \captionstyle{}
5923
5924 \newlength{\@contcwidth}
5925 \newcommand{\captionwidth}[1]{\setlength{\@contcwidth}{#1}}
5926 \captionwidth{\linewidth}
5927 \newcommand{\changecaptionwidth}{\@contcwtrue}
5928 \newcommand{\normalcaptionwidth}{\@contcwfalse}
5929 \normalcaptionwidth
5930
5931 \newlength{\@contindw}
5932 \newcommand{\hangcaption}{\@conthangtrue\@contindentfalse}
5933 \newcommand{\indentcaption}[1]{\setlength{\@contindw}{#1}%
5934 \@conthangfalse\@contindenttrue}
5935 \newcommand{\normalcaption}{\@conthangfalse\@contindentfalse}
5936 \normalcaption
5937
5938 \newcommand{\precaption}[1]{\def\@contpre{#1}}
5939 \precaption{}
5940 \newcommand{\postcaption}[1]{\def\@contpost{#1}}
5941 \postcaption{}
5942 \newcommand{\midbicaption}[1]{\def\@contmidbi{#1}}
5943 \midbicaption{}
5944
5945 \newcommand*{\captiontitlefinal}[1]{\def\@contfinal{#1}}
5946 \captiontitlefinal{}
5947
5948 \newlength{\abovecaptionskip}
5949 \setlength{\abovecaptionskip}{0.5\onelineskip}
5950 \newlength{\belowcaptionskip}
5951 \setlength{\belowcaptionskip}{0.5\onelineskip}
5952
5953 \let\@memoldcaption\caption
5954 \def\caption{\donemaincaptiontrue\@memoldcaption}
5955
5956 \newcommand{\memcaptioninfo}[4]{}
5957
5958 \let\@memold@caption\@caption
5959 \long\def\@caption#1[#2]#3{%
5960 \M@gettitle{#2}%
5961 \memcaptioninfo{#1}{\csname the#1\endcsname}{#2}{#3}%
5962 \@memold@caption{#1}[{#2}]{#3}}
5963
5964 \long\def\@makecaption#1#2{\let\@memtempa\relax
5965 \ifdim\prevdepth>-99\p@ \vskip\abovecaptionskip
5966 \else \def\@memtempa{\vbox to\topskip{}}\fi
5967 \@@makecaption{#1}{#2}%
5968 \vskip\belowcaptionskip}
5969
5970 \long\def\@@makecaption#1#2{%
5971 \let\@contfnote\footnote \renewcommand{\footnote}[2][]{}
5972 \let\@contfmark\footnotemark \renewcommand{\footnotemark}[1][]{}
5973 \let\@contpnote\pagenote\renewcommand\pagenote[2][]{}
5974 \sbox\@tempboxa{{\@contnfont #1\@contdelim}\@conttfont #2\@contfinal}
5975 \let\footnote\@contfnote
5976 \let\footnotemark\@contfmark
5977 \let\pagenote\@contpnote
5978 \ifdim\wd\@tempboxa<\linewidth \centering \fi
5979 \if@contcw
5980 \centering
5981 \parbox[t]{\@contcwidth}{%
5982 \ifdim\wd\@tempboxa<\@contcwidth \centering \fi
5983 \fi
5984 \ifdim\wd\@tempboxa<\linewidth
5985 \@contpre
5986 {\@contnfont #1\@contdelim}\@memtempa
5987 {\@contcshortstyle \@conttfont #2\@contfinal\par}
5988 \else
5989 \if@conthang
5990 \sbox\@tempboxa{\@contnfont #1\@contdelim}
5991 \@contpre%
5992 {\@contcstyle\hangindent=\wd\@tempboxa
5993 \noindent\box\@tempboxa\@memtempa \@conttfont #2\@contfinal\par}
5994 \else
5995 \if@contindent
5996 \@contpre%
5997 {\@contnfont #1\@contdelim}\@memtempa
5998 {\@contcstyle\hangindent=\@contindw
5999 \hangafter=\@ne\@conttfont #2\@contfinal\par}% <- v1.4
6000 \else
6001 \@contpre%
6002 {\@contnfont #1\@contdelim}\@memtempa
6003 {\@contcstyle \@conttfont #2\@contfinal\par}
6004 \fi
6005 \fi
6006 \fi
6007 \@contpost
6008 \if@contcw
6009 \par
6010 } % end of the \parbox
6011 \fi
6012 }
6013
6014 \newcommand{\contcaption}{%
6015 \addtocounter{\@captype}{\m@ne}\refstepcounter{\@captype}%
6016 \@contcaption\@captype}
6017
6018 \long\def\@@contcaption#1#2{%
6019 \par
6020 \begingroup
6021 \@parboxrestore
6022 \if@minipage
6023 \@setminipage
6024 \fi
6025 \normalsize
6026 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #2}\par
6027 \endgroup}
6028
6029 \long\def\@contcaption#1#2{%
6030 \if@contbotsub
6031 \@memlistsubcaptions{#1}%
6032 \@@contcaption{#1}{#2}%
6033 \else
6034 \@@contcaption{#1}{#2}%
6035 \@memlistsubcaptions{#1}%
6036 \fi}
6037
6038 \newcommand{\memlegendinfo}[1]{}
6039 \newcommand{\legend}[1]{%
6040 \M@gettitle{#1}%
6041 \memlegendinfo{#1}%
6042 \par
6043 \begingroup
6044 \@parboxrestore
6045 \if@minipage
6046 \@setminipage
6047 \fi
6048 \normalsize
6049 \captiondelim{\mbox{}}
6050 \@makecaption{}{\ignorespaces #1}\par
6051 \endgroup}
6052
6053 \newcommand{\namedlegend}{\@dblarg{\@legend\@captype}}
6054 \newcommand{\memnamedlegendinfo}[3]{}
6055
6056 \long\def\@legend#1[#2]#3{%
6057 \M@gettitle{#2}%
6058 \memnamedlegendinfo{#1}{#2}{#3}%
6059 \par
6060 \csname flegtoc#1\endcsname{#2}%
6061 \begingroup
6062 \@parboxrestore
6063 \if@minipage
6064 \@setminipage
6065 \fi
6066 \normalsize
6067 \@makecaption{\csname fleg#1\endcsname}{\ignorespaces #3}\par
6068 \endgroup}
6069
6070 \newcommand{\newfixedcaption}[3][\caption]{%
6071 \newcommand{#2}{\def\@captype{#3}#1}}
6072 \newcommand{\renewfixedcaption}[3][\caption]{%
6073 \renewcommand{#2}{\def\@captype{#3}#1}}
6074 \newcommand{\providefixedcaption}[3][\caption]{%
6075 \providecommand{#2}{\def\@captype{#3}#1}}
6076
6077 \newcommand{\membitwonumcaptioninfo}[7]{}
6078 \newcommand{\membionenumcaptioninfo}[7]{}
6079 \newcommand{\membicaptioninfo}[6]{}
6080
6081 \newcommand{\bitwonumcaption}[6][\@empty]{%
6082 \begingroup
6083 \let\memcaptioninfo\@gobblefour
6084 \@ifmtarg{#2}{\def\m@mscapi{#3}\caption{#3}}%
6085 {\def\m@mscapi{#2}\caption[#2]{#3}}%
6086 \ifx \@empty #1\else
6087 \label{#1}%
6088 \fi
6089 \setlength{\abovecaptionskip}{0pt}%
6090 \setlength{\belowcaptionskip}{0pt}%
6091 \edef\@memtempc{#4}%
6092 \expandafter\renewcommand\csname \@captype name\endcsname{\@memtempc}%
6093 \addtocounter{\@captype}{-1}%
6094 \ExpandArgs{c}\edef{theH\@captype}{\csname theH\@captype\endcsname-bitwonum-#4}%
6095 \@contmidbi
6096 \@ifmtarg{#5}{\def\m@mscapii{#6}\caption{#6}}%
6097 {\def\m@mscapii{#5}\caption[#5]{#6}}%
6098 \membitwonumcaptioninfo{\@captype}{\@nameuse{the\@captype}}%
6099 {\m@mscapi}{#3}{#4}{\m@mscapii}{#6}%
6100 \endgroup}
6101
6102 \newcommand{\bionenumcaption}[6][\@empty]{%
6103 \begingroup
6104 \let\memcaptioninfo\@gobblefour
6105 \@ifmtarg{#2}{\def\m@mscapi{#3}\caption{#3}}%
6106 {\def\m@mscapi{#2}\caption[#2]{#3}}%
6107 \ifx \@empty #1\else
6108 \label{#1}%
6109 \fi
6110 \setlength{\abovecaptionskip}{0pt}%
6111 \setlength{\belowcaptionskip}{0pt}%
6112 \edef\@memtempc{#4}%
6113 \expandafter\renewcommand\csname \@captype name\endcsname{\@memtempc}
6114 \@contmidbi
6115 \contcaption{#6}%
6116 \@ifmtarg{#5}{%
6117 \def\m@mscapii{#6}%
6118 \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
6119 {\protect\numberline{}{\ignorespaces #6}}}{%
6120 \def\m@mscapii{#5}%
6121 \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
6122 {\protect\numberline{}{\ignorespaces #5}}}%
6123 \membionenumcaptioninfo{\@captype}{\@nameuse{the\@captype}}%
6124 {\m@mscapi}{#3}{#4}{\m@mscapii}{#6}%
6125 \endgroup}
6126
6127 \newcommand{\bicaption}[5][\@empty]{%
6128 \begingroup
6129 \let\memcaptioninfo\@gobblefour
6130 \@ifmtarg{#2}{\def\m@mscapi{#3}\caption{#3}}%
6131 {\def\m@mscapi{#2}\caption[#2]{#3}}%
6132 \ifx \@empty #1\else
6133 \label{#1}%
6134 \fi
6135 \setlength{\abovecaptionskip}{0pt}%
6136 \setlength{\belowcaptionskip}{0pt}%
6137 \edef\@memtempc{#4}
6138 \expandafter\renewcommand\csname \@captype name\endcsname{\@memtempc}%
6139 \@contmidbi
6140 \contcaption{#5}%
6141 \membicaptioninfo{\@captype}{\@nameuse{the\@captype}}%
6142 {\m@mscapi}{#3}{#4}{#5}%
6143 \endgroup}
6144
6145 \newcommand{\bicontcaption}[3]{%
6146 \begingroup
6147 \contcaption{#1}%
6148 \setlength{\abovecaptionskip}{0pt}%
6149 \setlength{\belowcaptionskip}{0pt}%
6150 \edef\@memtempc{#2}%
6151 \expandafter\renewcommand\csname \@captype name\endcsname{\@memtempc}%
6152 \@contmidbi
6153 \contcaption{#3}%
6154 \endgroup}
6155
6156 \newcommand{\subcaptionstyle}[1]{\def\@contsubcstyle{#1}}
6157 \subcaptionstyle{}
6158
6159 \newif\if@shortsubcap
6160 \newif\if@hangsubcap
6161 \newcommand*{\shortsubcaption}{\@shortsubcaptrue}
6162 \newcommand*{\hangsubcaption}{\@hangsubcaptrue}
6163 \newcommand*{\normalsubcaption}{\@shortsubcapfalse\@hangsubcapfalse}
6164 \normalsubcaption
6165
6166 \newskip\subfloattopskip
6167 \newskip\subfloatcapskip
6168 \newskip\subfloatcaptopadj
6169 \newskip\subfloatbottomskip
6170 \newskip\subfloatlabelskip
6171 \newdimen\subfloatcapmargin
6172 \newif\if@tightsubcap
6173 \newcommand{\loosesubcaptions}{%
6174 \subfloattopskip = 10\p@
6175 \subfloatcapskip = 10\p@
6176 \subfloatcaptopadj = \z@
6177 \subfloatbottomskip = 10\p@
6178 \subfloatlabelskip = 0.33em
6179 \subfloatcapmargin = 10\p@
6180 \@tightsubcapfalse
6181 }
6182
6183 \newcommand{\tightsubcaptions}{%
6184 \subfloattopskip = 5\p@
6185 \subfloatcapskip = \z@
6186 \subfloatcaptopadj = 3\p@
6187 \subfloatbottomskip = 5\p@
6188 \subfloatlabelskip = 0.33em \@plus 0.07em \@minus 0.03em
6189 \subfloatcapmargin = \z@
6190 \@tightsubcaptrue
6191 }
6192 \tightsubcaptions
6193
6194 \newcommand*{\subcaptionsize}[1]{\def\@subcapsize{#1}}
6195 \newcommand*{\subcaptionlabelfont}[1]{\def\@subcaplabelfont{#1}}
6196 \newcommand*{\subcaptionfont}[1]{\def\@subcapfont{#1}}
6197 \subcaptionsize{\footnotesize}
6198 \subcaptionlabelfont{\normalfont}
6199 \subcaptionfont{\normalfont}
6200
6201 \newcounter{@contsubnum}
6202 \newcommand{\@contkeep}{%
6203 \setcounter{@contsubnum}{\value{sub\@captype}}}
6204 \newcommand{\@contset}{%
6205 \setcounter{sub\@captype}{\value{@contsubnum}}}
6206 \newcommand{\subconcluded}{%
6207 \setcounter{sub\@captype}{0}}
6208 \newif\if@contbotsub
6209 \@contbotsubtrue
6210
6211 \AddToHookWithArguments{label}{\mem@addto@label@hook{#1}}
6212 \let\mem@addto@label@hook\@gobble
6213 \newcommand\memsub@addto@label@hook[1]{%
6214 \begingroup%
6215 \protected@edef\@currentlabelname{%
6216 Sub\@captype\space%
6217 \@nameuse{p@sub\@captype}%
6218 \@nameuse{thesub\@captype}%
6219 }%
6220 \protected@edef\@currentlabel{\@nameuse{@@thesub\@captype}}%
6221 \protected@write\@auxout{}%
6222 {%
6223 \string\newlabel{sub@#1}{%
6224 {\@currentlabel}%
6225 {\thepage}%
6226 {\@currentlabelname}%x
6227 {\@currentHref}%
6228 {\@kernel@reserved@label@data}%
6229 }%
6230 }%
6231 \endgroup%
6232 }
6233 \newcommand{\subcaption}{%
6234 \par
6235 \bgroup
6236 % \let\label=\memsub@label
6237 \let\mem@addto@label@hook\memsub@addto@label@hook
6238 \ifdonemaincaption\else
6239 \advance\csname c@\@captype\endcsname\@ne
6240 \fi
6241 \mem@step@subcounter%
6242 \@ifnextchar [%
6243 {\@memsubcap{sub\@captype}}%
6244 {\@memsubcap{sub\@captype}[\@empty]}}
6245 \long\def\@memsubcap#1[#2]#3{%
6246 \@tempdima=\hsize
6247 \vskip\subfloatcapskip
6248 \ifx \@empty #2
6249 \@memsubcaption{#1}{#3}{#3}%
6250 \else
6251 \@memsubcaption{#1}{#2}{#3}%
6252 \fi
6253 \vskip\subfloatcapskip
6254 \egroup}
6255 \newcommand{\@memsubcaption}[3]{%
6256 \ifx \relax#2\relax \else
6257 \bgroup
6258 \let\label\@gobble
6259 \let\protect\string
6260 \def\@memsubcaplabel{\@nameuse{@@the#1}}%
6261 \xdef\@memsubfigcaptionlist{%
6262 \@memsubfigcaptionlist,%
6263 {\protect\numberline{\@memsubcaplabel}\noexpand{\ignorespaces #2}}}%
6264 \egroup
6265 \fi
6266 \@makesubfloatcaption{\@nameuse{@the#1}}{#3}}
6267
6268 \newcommand{\contsubcaption}{%
6269 \bgroup%
6270 % \let\label=\memsub@label
6271 \let\mem@addto@label@hook\memsub@addto@label@hook
6272 \@contset%
6273 \mem@step@subcounter%
6274 \@ifnextchar [%
6275 {\@memsubcap{sub\@captype}}%
6276 {\@memsubcap{sub\@captype}[\@empty]}}
6277 \newenvironment{subfloat}{}{}
6278
6279 \newcommand\mem@step@subcounter{%
6280 \refstepcounter{sub\@captype}\@contkeep%
6281 \UseHook{memoir/subcaption/aftercounter}%
6282 }
6283 \newcommand{\subbottom}{%
6284 \@contbotsubtrue
6285 \@memsubbody}
6286
6287 \newcommand{\@memsubbody}{%
6288 \bgroup
6289 % \let\label=\memsub@label
6290 \let\mem@addto@label@hook\memsub@addto@label@hook
6291 \ifdonemaincaption\else
6292 \advance\csname c@\@captype\endcsname\@ne
6293 \fi
6294 % \refstepcounter{sub\@captype}\@contkeep%
6295 \leavevmode
6296 \@ifnextchar [%
6297 {\@memsubfig}%
6298 {\@memsubfig[\@empty]}}
6299
6300 \newcommand{\contsubbottom}{%
6301 \@contbotsubtrue
6302 \@memcontsubbody}
6303
6304 \newcommand{\@memcontsubbody}{%
6305 \bgroup
6306 % \let\label=\memsub@label
6307 \let\mem@addto@label@hook\memsub@addto@label@hook
6308 \@contset
6309 % \refstepcounter{sub\@captype}\@contkeep%
6310 \leavevmode
6311 \@ifnextchar [%
6312 {\@memsubfig}%
6313 {\@memsubfig[\@empty]}}
6314
6315 \newcommand{\subtop}{%
6316 \@contbotsubfalse
6317 \@memsubbody}
6318
6319 \newcommand{\contsubtop}{%
6320 \@contbotsubfalse
6321 \@memcontsubbody}
6322
6323 \def\@memsubfig[#1]{%
6324 \@ifnextchar [%
6325 {\@memsubfloat{sub\@captype}[#1]}%
6326 {\@memsubfloat{sub\@captype}[\@empty #1][#1]}}
6327
6328 \long\def\@memsubfloat#1[#2][#3]#4{%
6329 \@tempcnta=\@ne
6330 \if@tightsubcap
6331 \if@minipage
6332 \@tempcnta=\z@
6333 \else
6334 \ifdim\lastskip=\z@
6335 \@tempcnta=\@ne
6336 \else
6337 \@tempcnta=\tw@
6338 \fi
6339 \fi
6340 \fi
6341 \if@contbotsub
6342 \def\subfig@top{\subfloattopskip}%
6343 \def\subfig@bottom{\subfloatbottomskip}%
6344 \else
6345 \def\subfig@top{\subfloatbottomskip}%
6346 \def\subfig@bottom{\subfloattopskip}%
6347 \fi
6348 \vbox\bgroup%
6349 \mem@step@subcounter%
6350 \setbox\@tempboxa \hbox{#4}%
6351 \@tempdima=\wd\@tempboxa
6352 \vbox\bgroup
6353 \ifcase\@tempcnta
6354 \@minipagefalse
6355 \or
6356 \vspace{\subfig@top}
6357 \or
6358 \ifdim \lastskip=\z@ \else
6359 \@tempskipb\subfig@top\@xaddvskip
6360 \fi
6361 \fi
6362 \if@contbotsub
6363 \box\@tempboxa\egroup
6364 \ifx \@empty#3\relax \else
6365 \vskip\subfloatcapskip
6366 \@memsubcaption{#1}{#2}{#3}%
6367 \fi
6368 \else
6369 \ifx \@empty#3\relax \else
6370 \@memsubcaption{#1}{#2}{#3}%
6371 \vskip\subfloatcapskip
6372 \vskip\subfloatcaptopadj
6373 \fi\egroup
6374 \box\@tempboxa
6375 \fi
6376 \vspace{\subfig@bottom}
6377 \egroup
6378 \egroup}
6379
6380 \newcommand*{\@memsubfigcaptionlist}{}
6381 \newcommand*{\memlistsubcaptions}{%
6382 \@ifstar
6383 {\gdef\@memsubfigcaptionlist{}}%
6384 {\@memlistsubcaptions{\@captype}}}
6385
6386 \newcommand*{\@memlistsubcaptions}[1]{%
6387 \@ifundefined{@captype}{}{%
6388 \@ifundefined{ext@sub#1}{}{%
6389 \@for \@tempa:=\@memsubfigcaptionlist \do {%
6390 \ifx \@empty\@tempa\relax \else
6391 \addcontentsline{\@nameuse{ext@sub#1}}{sub#1}{\@tempa}%
6392 \fi}}}%
6393 \gdef\@memsubfigcaptionlist{}}
6394
6395 \newcommand{\@makesubfloatcaption}[2]{%
6396 \setbox\@tempboxa\hbox{%
6397 \@subcapsize
6398 {\@subcaplabelfont #1}{\@subcapfont\ignorespaces #2}\unskip}%
6399 \@tempdimb=-\subfloatcapmargin
6400 \multiply\@tempdimb\tw@
6401 \advance\@tempdimb\@tempdima
6402 \hb@xt@\@tempdima{%
6403 \hss
6404 \ifdim \wd\@tempboxa >\@tempdimb
6405 \memsubfig@caption{#1}{#2}%
6406 \else
6407 \if@shortsubcap
6408 \memsubfig@caption{#1}{#2}%
6409 \else
6410 \box\@tempboxa
6411 \fi
6412 \fi
6413 \hss}}
6414
6415 \newcommand{\memsubfig@caption}[2]{%
6416 \if@hangsubcap
6417 \sbox{\@tempboxa}{\@subcapsize\@subcaplabelfont #1}%
6418 \addtolength{\@tempdimb}{-\wd\@tempboxa}%
6419 \usebox{\@tempboxa}%
6420 \memsubfig@captionpar{\@tempdimb}{%
6421 {\@subcapfont\ignorespaces #2}\unskip}%
6422 \else
6423 \memsubfig@captionpar{\@tempdimb}{{\@subcaplabelfont #1}%
6424 {\@subcapfont\ignorespaces #2}\unskip}%
6425 \fi}
6426
6427 \newcommand{\memsubfig@captionpar}[2]{%
6428 \parbox[t]{#1}{\@subcapsize\@contsubcstyle #2}}
6429
6430 % \newcommand{\memsub@label}{%
6431 % \@ifnextchar (%
6432 % {\sf@memsub@label}%
6433 % {\sf@memsub@label(Sub\@captype\space
6434 % \@nameuse{p@sub\@captype}%
6435 % \@nameuse{thesub\@captype})}}
6436 % \def\sf@memsub@label(#1)#2{%
6437 % \protected@edef\@currentlabelname{#1}%
6438 % % if available we can also use % \ExpandArgs{x}\mem@set@cln{#1}
6439 % \sf@@memsub@label{#2}}
6440
6441 % \AtBeginDocument{
6442 % \let\mem@kernel@label\label
6443 % }
6444
6445 % \newcommand\sf@@memsub@label[1]{%
6446 % \@bsphack%
6447 % \mem@kernel@label{#1}% normal label
6448 % \begingroup%
6449 % % \ExpandArgs{x}\mem@set@cln{\@nameuse{@@thesub\@captype}}
6450 % \protected@edef\@currentlabel{\@nameuse{@@thesub\@captype}}% sub@label
6451 % \def\showkeyslabelformat##1{}% disable showkeys for this extra label
6452 % \mem@kernel@label{sub@#1}% internally generated sub@label
6453 % \endgroup%
6454 % \@esphack%
6455 % }
6456
6457 \DeclareRobustCommand{\subcaptionref}{%
6458 \@ifstar{\ssc@ref}{\sc@ref}}
6459 \newcommand*{\ssc@ref}[1]{\ref{sub@#1}}
6460 \newcommand*{\sc@ref}[1]{{\@subcaplabelfont\ref{sub@#1}}}
6461
6462 \newsavebox{\m@mscap@capbox}
6463 \newsavebox{\m@mscap@fbox}
6464
6465 \newdimen\sidecapsep
6466 \sidecapsep=\marginparsep
6467 \newdimen\sidecapwidth
6468 \sidecapwidth=\marginparwidth
6469 \newcommand*{\setsidecaps}[2]{%
6470 \setlength{\sidecapsep}{#1}\@memznegtest{\sidecapsep}%
6471 \setlength{\sidecapwidth}{#2}\@memznegtest{\sidecapwidth}}
6472
6473 \newdimen\m@m@tempdima
6474 \newdimen\m@mscapraise
6475 \newdimen\sidecapraise
6476 \sidecapraise \z@
6477
6478 \newcommand*{\setsidecappos}[1]{%
6479 \def\m@mscappos{#1}\def\@tempb{t}%
6480 \ifx\@tempb\m@mscappos
6481 \else
6482 \def\@tempb{b}%
6483 \ifx\@tempb\m@mscappos
6484 \else
6485 \def\@tempb{c}%
6486 \ifx\@tempb\m@mscappos
6487 \else
6488 \@memerror{Argument to \string\setsidecappos\space is not t or c or b.
6489 \MessageBreak Set to c}{\@ehc}%
6490 \def\m@mscappos{c}%
6491 \fi
6492 \fi
6493 \fi}
6494 \setsidecappos{c}
6495
6496 \newcommand{\sidecapmargin}[1]{%
6497 \def\@tempa{#1}\def\@tempb{left}%
6498 \ifx\@tempb\@tempa
6499 \def\m@mscapmarg{0}% left
6500 \else
6501 \def\@tempb{right}%
6502 \ifx\@tempb\@tempa
6503 \def\m@mscapmarg{1}% right
6504 \else
6505 \def\@tempb{outer}%
6506 \ifx\@tempb\@tempa
6507 \def\m@mscapmarg{2}% outer
6508 \else
6509 \def\@tempb{inner}%
6510 \ifx\@tempb\@tempa
6511 \def\m@mscapmarg{3}% inner
6512 \else
6513 \@memerror{Unrecognized argument for \string\sidecapmargin}%
6514 {\@ehc}%
6515 \def\m@mscapmarg{-1}% error
6516 \fi
6517 \fi
6518 \fi
6519 \fi}
6520 \sidecapmargin{left}
6521
6522 \newif\ifscapmargleft
6523
6524 \def\sidecapfloatwidth{\linewidth}
6525 \newdimen\m@mscapmainwidth
6526
6527 \newdimen\m@mscaplkern
6528 \newcommand*{\setm@mscaplkern}{%
6529 \m@mscaplkern=\sidecapwidth
6530 \advance\m@mscaplkern \sidecapsep
6531 \advance\m@mscaplkern \m@mscapmainwidth}
6532
6533 \newcommand*{\sidecapstyle}{%
6534 \ifscapmargleft
6535 \captionstyle{\raggedleft}%
6536 \else
6537 \captionstyle{\raggedright}%
6538 \fi}
6539
6540 \newcommand*{\sidecaption}{%
6541 \@ifnextchar [{\@sidecaption}{\@sidecaption[]}}
6542 \def\@sidecaption[#1]#2{%
6543 \@ifnextchar [{\@@sidecaption{#1}{#2}}{\@@sidecaption{#1}{#2}[]}}
6544 \newcommand\@mem@scap@beforehook{}
6545 \newcommand\@mem@scap@afterhook{}
6546
6547 \def\@@sidecaption#1#2[#3]{%
6548 \ifx\@empty#1\@empty
6549 \def\m@mscap@fortoc{#2}%
6550 \else
6551 \def\m@mscap@fortoc{#1}%
6552 \fi
6553 \def\m@mscap@forcap{#2}%
6554 \ifx\@empty#3\@empty
6555 \def\m@mscaplabel{}%
6556 \else
6557 \def\m@mscaplabel{\@bsphack\label{#3}\@esphack}%
6558 \fi
6559 \m@mscapstart@fbox}
6560
6561 \newcommand*{\m@mscapstart@fbox}{%
6562 \@mem@scap@beforehook%
6563 \setlength{\m@mscapmainwidth}{\sidecapfloatwidth}%
6564 \setm@mscaplkern
6565 \begin{lrbox}{\m@mscap@fbox}%
6566 \begin{minipage}[c]{\m@mscapmainwidth}}
6567 \newcommand*{\m@mscapend@fbox}{%
6568 \end{minipage}%
6569 \end{lrbox}}
6570
6571
6572 \newcommand*\sidecaption@refstepcounter[2]{\refstepcounter{#1}}
6573 \def\endsidecaption{%
6574 \m@mscapend@fbox
6575 \sidecaption@refstepcounter\@captype\@captype
6576 \m@mscaplabel
6577 \m@mscapcheckside%
6578 \begin{lrbox}{\m@mscap@capbox}%
6579 \begin{minipage}[c]{\sidecapwidth}%
6580 \sidecapstyle
6581 \@caption\@captype[\m@mscap@fortoc]{\m@mscap@forcap}
6582 \end{minipage}%
6583 \end{lrbox}%
6584 \m@mscapopboxes}
6585 \newcommand*{\m@mscapopboxes}{%
6586 \m@mcalcscapraise
6587 \usebox{\m@mscap@fbox}%\m@mscapcheckside
6588 \ifscapmargleft%
6589 \rlap{\kern-\m@mscaplkern
6590 \raisebox{\m@mscapraise}{\usebox{\m@mscap@capbox}}}%
6591 \else%
6592 \rlap{\kern\sidecapsep
6593 \raisebox{\m@mscapraise}{\usebox{\m@mscap@capbox}}}%
6594 \fi
6595 \gdef\m@mscapthisside{}%
6596 \@mem@scap@afterhook%
6597 }
6598
6599 \newcommand*{\m@mcalcscapraise}{%
6600 \def\@tempb{t}%
6601 \ifx\m@mscappos\@tempb
6602 \settoheight{\m@m@tempdima}{\strut\usebox{\m@mscap@capbox}}%
6603 \settoheight{\m@mscapraise}{\usebox{\m@mscap@fbox}}%
6604 \advance\m@mscapraise -\m@m@tempdima
6605 \advance\m@mscapraise 0.5ex
6606 \else
6607 \def\@tempb{b}%
6608 \ifx\m@mscappos\@tempb
6609 \settodepth{\m@m@tempdima}{\usebox{\m@mscap@fbox}}%
6610 \settodepth{\m@mscapraise}{\strut\usebox{\m@mscap@capbox}}%
6611 \advance\m@mscapraise -\m@m@tempdima
6612 \else
6613 \m@mscapraise=\z@
6614 \advance\m@mscapraise 0.25ex
6615 \fi
6616 \fi
6617 \advance\m@mscapraise \sidecapraise}
6618
6619 \newcommand*{\m@mscapcheckside}{%
6620 \if@twocolumn
6621 \ifdim\hsize=\textwidth% float*
6622 \m@mscapcheckregside
6623 \else
6624 \if@firstcolumn
6625 \scapmarglefttrue
6626 \else
6627 \scapmargleftfalse
6628 \fi
6629 \fi
6630 \else
6631 \m@mscapcheckregside
6632 \fi
6633 \m@mscapthisside}
6634 \newcommand*{\m@mscapcheckregside}{%
6635 \if@twoside
6636 \checkoddpage
6637 \ifnum\m@mscapmarg<\@ne% % left
6638 \scapmarglefttrue
6639 \else
6640 \ifnum\m@mscapmarg=\@ne% % right
6641 \scapmargleftfalse
6642 \else
6643 \ifnum\m@mscapmarg=\tw@% % outer
6644 \scapmarglefttrue
6645 \ifoddpage
6646 \scapmargleftfalse
6647 \fi
6648 \else% % inner
6649 \scapmargleftfalse
6650 \ifoddpage
6651 \scapmarglefttrue
6652 \fi
6653 \fi
6654 \fi
6655 \fi
6656 \else% oneside
6657 % \scapmarglefttrue% 0 and 3
6658 % \ifnum\m@mscapmarg>\@ne
6659 % \ifnum\m@mscapmarg<\thr@@
6660 % \scapmargleftfalse
6661 % \fi
6662 % \fi
6663 \ifcase\m@mscapmarg\relax% 0
6664 \scapmarglefttrue%
6665 \or% 1
6666 \scapmargleftfalse%
6667 \or% 2
6668 \scapmargleftfalse%
6669 \or% 3
6670 \scapmarglefttrue%
6671 \fi%
6672 \fi}
6673
6674 \newcommand*{\overridescapmargin}[1]{%
6675 \def\@tempb{#1}\def\@tempa{left}%
6676 \ifx\@tempa\@tempb
6677 \def\m@mscapthisside{\scapmarglefttrue}%
6678 \else
6679 \def\@tempa{right}%
6680 \ifx\@tempa\@tempb
6681 \def\m@mscapthisside{\scapmargleftfalse}%
6682 \else
6683 \@memerror{Argument to \string\overridescapmargin\space neither
6684 left nor right}{\@ehc}%
6685 \def\m@mscapthisside{}%
6686 \fi
6687 \fi}
6688 \newcommand*{\m@mscapthisside}{}
6689
6690 \newcommand*{\sidecontcaption}{%
6691 \@sidecontcaption}
6692 \def\@sidecontcaption#1{%
6693 \@ifnextchar [{\@@sidecontcaption{#1}}{\@@sidecontcaption{#1}[]}}
6694 \def\@@sidecontcaption#1[#2]{%
6695 \def\m@mscap@forcap{#1}%
6696 \ifx\@empty#2\@empty
6697 \def\m@mscaplabel{}%
6698 \else
6699 \def\m@mscaplabel{\@bsphack\label{#2}\@esphack}%
6700 \fi
6701 \m@mscapstart@fbox}
6702
6703 \def\endsidecontcaption{%
6704 \m@mscapend@fbox
6705 \addtocounter{\@captype}{\m@ne}
6706 \sidecaption@refstepcounter\@captype{memhycontfloat}
6707 %\refstepcounter\@captype
6708 \m@mscaplabel
6709 \m@mscapcheckside %<--- added 2013/05/30
6710 \begin{lrbox}{\m@mscap@capbox}%
6711 \begin{minipage}[c]{\sidecapwidth}%
6712 \sidecapstyle
6713 \@contcaption\@captype{\m@mscap@forcap}
6714 \end{minipage}%
6715 \end{lrbox}%
6716 \m@mscapopboxes}
6717
6718 \newcommand*{\sidenamedlegend}{%
6719 \@ifnextchar [{\@sidenamedlegend}{\@sidenamedlegend[]}}
6720 \def\@sidenamedlegend[#1]#2{%
6721 \@@sidenamedlegend{#1}{#2}}
6722 \def\@@sidenamedlegend#1#2{%
6723 \ifx\@empty#1\@empty
6724 \def\m@mscap@fortoc{#2}%
6725 \else
6726 \def\m@mscap@fortoc{#1}%
6727 \fi
6728 \def\m@mscap@forcap{#2}%
6729 \def\m@mscaplabel{}%
6730 \m@mscapstart@fbox}
6731
6732 \def\endsidenamedlegend{%
6733 \m@mscapend@fbox
6734 \begin{lrbox}{\m@mscap@capbox}%
6735 \begin{minipage}[c]{\sidecapwidth}%
6736 \sidecapstyle
6737 \@legend\@captype[\m@mscap@fortoc]{\m@mscap@forcap}
6738 \end{minipage}%
6739 \end{lrbox}%
6740 \m@mscapopboxes}
6741
6742 \newcommand*{\sidelegend}{%
6743 \@@sidelegend}
6744 \def\@@sidelegend#1{%
6745 \def\m@mscap@forcap{#1}%
6746 \m@mscapstart@fbox}
6747
6748 \def\endsidelegend{%
6749 \m@mscapend@fbox
6750 \begin{lrbox}{\m@mscap@capbox}%
6751 \begin{minipage}[c]{\sidecapwidth}%
6752 \sidecapstyle
6753 \legend{\m@mscap@forcap}
6754 \end{minipage}%
6755 \end{lrbox}%
6756 \m@mscapopboxes}
6757
6758 \AtBeginDocument{
6759 \@ifpackageloaded{longtable}{
6760 \@ifpackageloaded{ltcaption}{}{%
6761 \def\LT@makecaption#1#2#3{%
6762 \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
6763 \let\@memtempa\relax%
6764 % starred form -> #1 = \@gobble
6765 \ifx#1\@gobble%
6766 \let\@contnfont\@empty%
6767 \let\@contdelim\@empty%
6768 \@@makecaption{}{#3}%
6769 \else%
6770 \@@makecaption{#2}{#3}%
6771 \fi%
6772 \endgraf\vskip\belowcaptionskip}%
6773 \hss}}}
6774 }
6775 }{}
6776 }
6777 \newlength{\beforeepigraphskip}
6778 \setlength{\beforeepigraphskip}{.5\baselineskip}
6779 \newlength{\afterepigraphskip}
6780 \setlength{\afterepigraphskip}{.5\baselineskip}
6781 \newlength{\epigraphwidth}
6782 \setlength{\epigraphwidth}{.4\textwidth}
6783 \newlength{\epigraphrule}
6784 \setlength{\epigraphrule}{.4\p@}
6785 \newcommand{\epigraphsize}{\small}
6786 \newcommand{\epigraphflush}{flushright}
6787 \newcommand{\textflush}{flushleft}
6788 \newcommand{\sourceflush}{flushright}
6789 \newcommand{\epigraphfontsize}[1]{\def\epigraphsize{#1}}
6790 \newcommand{\epigraphposition}[1]{\long\def\epigraphflush{#1}}
6791 \newcommand{\epigraphtextposition}[1]{\def\textflush{#1}}
6792 \newcommand{\epigraphsourceposition}[1]{\def\sourceflush{#1}}
6793
6794 \newcommand{\@epirule}{\rule[.5ex]{\epigraphwidth}{\epigraphrule}}
6795 \newcommand{\@epitext}[1]{%
6796 \begin{minipage}{\epigraphwidth}\begin{\textflush} #1\par
6797 \ifdim\epigraphrule>\z@ \@epirule \else \vspace*{1ex} \fi
6798 \end{\textflush}\end{minipage}}
6799 \newcommand{\@episource}[1]{%
6800 \begin{minipage}{\epigraphwidth}
6801 \begin{\sourceflush} #1\par
6802 \end{\sourceflush}\end{minipage}}
6803
6804 \newcommand{\epigraph}[2]{\vspace{\beforeepigraphskip}
6805 {\epigraphsize\begin{\epigraphflush}\begin{minipage}{\epigraphwidth}
6806 \@epitext{#1}\\ \@episource{#2}
6807 \end{minipage}\end{\epigraphflush}
6808 \vspace{\afterepigraphskip}}}
6809 \newcommand{\qitem}[2]{{%
6810 \raggedright\item \begin{minipage}{\epigraphwidth}
6811 \@epitext{#1}\\ \@episource{#2}
6812 \end{minipage}}}
6813 \newcommand{\qitemlabel}[1]{\hfill}
6814 \newenvironment{epigraphs}{%
6815 \vspace{\beforeepigraphskip}\begin{\epigraphflush}
6816 \epigraphsize
6817 \begin{minipage}{\epigraphwidth}
6818 \list{}%
6819 {\itemindent\z@ \labelwidth\z@ \labelsep\z@
6820 \leftmargin\z@ \rightmargin\z@
6821 \let\makelabel\qitemlabel}}%
6822 {\endlist\end{minipage}\end{\epigraphflush}
6823 \vspace{\afterepigraphskip}}
6824 \newcommand{\dropchapter}[1]{%
6825 \let\@epichapapp\@chapapp
6826 \renewcommand{\@chapapp}{\vspace*{#1}\@epichapapp}}
6827 \newcommand{\undodrop}{\let\@chapapp\@epichapapp}
6828 \newif\if@epirhs \@epirhstrue
6829 \newif\if@epicenter \@epicentertrue
6830 \newcommand{\@epipos}{
6831 \long\def\@ept{flushleft}
6832 \ifx\epigraphflush\@ept
6833 \@epirhsfalse \@epicenterfalse
6834 \else
6835 \long\def\@ept{center}
6836 \ifx\epigraphflush\@ept
6837 \@epirhsfalse \@epicentertrue
6838 \else
6839 \@epirhstrue \@epicenterfalse
6840 \fi
6841 \fi}
6842 \newcommand{\epigraphhead}[2][95]{%
6843 \def\@epitemp{\begin{minipage}{\epigraphwidth}#2\end{minipage}}
6844 \def\ps@epigraph{\let\@mkboth\@gobbletwo
6845 \@epipos
6846 \if@epirhs
6847 \def\@oddhead{\hfil\begin{picture}(0,0)
6848 \put(0,-#1){\makebox(0,0)[r]{\@epitemp}}
6849 \end{picture}}
6850 \else
6851 \if@epicenter
6852 \def\@oddhead{\hfil\begin{picture}(0,0)
6853 \put(0,-#1){\makebox(0,0)[b]{\@epitemp}}
6854 \end{picture}\hfil}
6855 \else
6856 \def\@oddhead{\begin{picture}(0,0)
6857 \put(0,-#1){\makebox(0,0)[l]{\@epitemp}}
6858 \end{picture}\hfil}
6859 \fi
6860 \fi
6861 \let\@evenhead\@oddhead
6862 \def\@oddfoot{\reset@font\hfil\thepage\hfil}
6863 \let\@evenfoot\@oddfoot}
6864 \thispagestyle{epigraph}}
6865
6866 \newcommand{\the@epigraph}{}
6867 \newcommand{\@epidrop}{95}
6868 \newcommand{\epigraphforheader}[2][95]{%
6869 \def\@epidrop{#1}\long\def\the@epigraph{#2}}
6870
6871 \newcommand{\epigraphpicture}{%
6872 \def\@epitemp{%
6873 \begin{minipage}{\epigraphwidth}\the@epigraph\end{minipage}}%
6874 \@epipos
6875 \if@epirhs
6876 \begin{picture}(0,0)%
6877 \put(0,-\@epidrop){\makebox(0,0)[r]{\@epitemp}}%
6878 \end{picture}%
6879 \else
6880 \if@epicenter
6881 \begin{picture}(0,0)%
6882 \put(0,-\@epidrop){\makebox(0,0)[b]{\@epitemp}}%
6883 \end{picture}%
6884 \else
6885 \begin{picture}(0,0)%
6886 \put(0,-\@epidrop){\makebox(0,0)[l]{\@epitemp}}%
6887 \end{picture}%
6888 \fi
6889 \fi}
6890
6891 \newcommand*{\@memoldfonterr}[3]{%
6892 \@memerror{Font command \protect#1\space is not supported}{%
6893 Use \protect#2, or \protect#3{...}, or the oldfontcommands option}}
6894 \newcommand*{\@memoldfontwarn}[3]{%
6895 \@memwarn{The \protect#1\space font command is deprecated.
6896 \MessageBreak Use \protect#2{...} or {\protect#3... } instead}}
6897
6898 \if@memoldfont
6899 \def\@mem@rmwarn{\@memoldfontwarn{\rm}{\textrm}{\rmfamily}}
6900 \DeclareOldFontCommand{\rm}{\@mem@rmwarn\gdef\@mem@rmwarn{}%
6901 \normalfont\rmfamily}{\mathrm}
6902 \else
6903 \def\rm{\@memoldfonterr{\rm}{\textrm}{\rmfamily}}
6904 \fi
6905
6906 \if@memoldfont
6907 \def\@mem@sfwarn{\@memoldfontwarn{\sf}{\textsf}{\sffamily}}
6908 \DeclareOldFontCommand{\sf}{\@mem@sfwarn\gdef\@mem@sfwarn{}%
6909 \normalfont\sffamily}{\mathsf}
6910 \else
6911 \def\sf{\@memoldfonterr{\sf}{\textsf}{\sffamily}}
6912 \fi
6913
6914 \if@memoldfont
6915 \def\@mem@ttwarn{\@memoldfontwarn{\tt}{\texttt}{\ttfamily}}
6916 \DeclareOldFontCommand{\tt}{\@mem@ttwarn\gdef\@mem@ttwarn{}%
6917 \normalfont\ttfamily}{\mathtt}
6918 \else
6919 \def\tt{\@memoldfonterr{\tt}{\texttt}{\ttfamily}}
6920 \fi
6921
6922 \if@memoldfont
6923 \def\@mem@bfwarn{\@memoldfontwarn{\bf}{\textbf}{\bfseries}}
6924 \DeclareOldFontCommand{\bf}{\@mem@bfwarn\gdef\@mem@bfwarn{}%
6925 \normalfont\bfseries}{\mathbf}
6926 \else
6927 \def\bf{\@memoldfonterr{\bf}{\textbf}{\bfseries}}
6928 \fi
6929
6930 \if@memoldfont
6931 \def\@mem@itwarn{\@memoldfontwarn{\it}{\textit}{\itshape}}
6932 \DeclareOldFontCommand{\it}{\@mem@itwarn\gdef\@mem@itwarn{}%
6933 \normalfont\itshape}{\mathit}
6934 \else
6935 \def\it{\@memoldfonterr{\it}{\textit}{\itshape}}
6936 \fi
6937
6938 \if@memoldfont
6939 \def\@mem@slwarn{\@memoldfontwarn{\sl}{\textsl}{\slshape}}
6940 \DeclareOldFontCommand{\sl}{\@mem@slwarn\gdef\@mem@slwarn{}%
6941 \normalfont\slshape}{\@nomath\sl}
6942 \else
6943 \def\sl{\@memoldfonterr{\sl}{\textsl}{\slshape}}
6944 \fi
6945
6946 \if@memoldfont
6947 \def\@mem@scwarn{\@memoldfontwarn{\sc}{\textsc}{\scshape}}
6948 \DeclareOldFontCommand{\sc}{\@mem@scwarn\gdef\@mem@scwarn{}%
6949 \normalfont\scshape}{\@nomath\sc}
6950 \else
6951 \def\sc{\@memoldfonterr{\sc}{\textsc}{\scshape}}
6952 \fi
6953
6954 \if@memoldfont
6955 \def\@mem@calwarn{%
6956 \@memwarn{The \protect\cal\space font command is deprecated.
6957 \MessageBreak Try to use \protect\mathcal\space instead}}
6958 \DeclareRobustCommand*\cal{\@mem@calwarn\gdef\@mem@calwarn{}%
6959 \@fontswitch\relax\mathcal}
6960 \else
6961 \def\cal{%
6962 \@memerror{Font command \protect\cal\space is not supported}{%
6963 Use \protect\mathcal, or the oldfontcommands option}}
6964 \fi
6965
6966 \if@memoldfont
6967 \def\@mem@mitwarn{%
6968 \@memwarn{The \protect\mit\space font command is deprecated.
6969 \MessageBreak Try to use \protect\mathnormal\space instead}}
6970 \DeclareRobustCommand*\mit{\@mem@mitwarn\gdef\@mem@mitwarn{}%
6971 \@fontswitch\relax\mathnormal}
6972 \else
6973 \def\mit{%
6974 \@memerror{Font command \protect\mit\space is not supported}{%
6975 Use \protect\mathnormal, or the oldfontcommands option}}
6976 \fi
6977
6978 \ExplSyntaxOn
6979 % helper function
6980 \cs_new_protected:Npn \memoir_make_deprecated_ref_cmds:nNNN #1#2#3#4#5
6981 {% #1 = starred (adds nobreakspace if not); #2: macro name; #3: ref macro; #4: macro name recommended in comment; #5: macro name we actually use
6982 \cs_if_exist:NF #2
6983 {
6984 \newcommand#2[1]{%
6985 \MarkDeprecated{#2}{from~memoir~in~2026.\MessageBreak%
6986 Define~your~own~version~in~the~preamble.~E.g.~via\MessageBreak%
6987 \string\newcommand\string#2[1]{\string#4\c_tilde_str\string#3{\c_hash_str1}}%
6988 \MessageBreak}%
6989 \IfBooleanTF{#1}
6990 {#5\ref{##1}}
6991 {#5\nobreakspace\ref{##1}}
6992 }
6993 }
6994 }
6995 \NewDocumentCommand\memoir@setup@deprecated@macros{smmm}{
6996 \memoir_make_deprecated_ref_cmds:nNNN {#1}#2#3#4
6997 }
6998 \ExplSyntaxOff
6999
7000 \AtBeginDocument{
7001 \memoir@setup@deprecated@macros\fref\ref\figurename\figurerefname
7002 \memoir@setup@deprecated@macros\tref\ref\tablename\tablerefname
7003 \memoir@setup@deprecated@macros\pref\pageref\pagename\pagerefname
7004 \memoir@setup@deprecated@macros\Aref\ref\appendixname\appendixrefname
7005 \memoir@setup@deprecated@macros\Bref\ref\bookname\bookrefname
7006 \memoir@setup@deprecated@macros\Pref\ref\partname\partrefname
7007 \memoir@setup@deprecated@macros\Cref\ref\chaptername\chapterrefname
7008 \memoir@setup@deprecated@macros*\Sref\ref\sectionname\sectionrefname
7009 }
7010
7011 % \newcommand*{\fref}[1]{\figurerefname~\ref{#1}}
7012 % \newcommand*{\tref}[1]{\tablerefname~\ref{#1}}
7013 % \newcommand*{\pref}[1]{\pagerefname~\pageref{#1}}
7014 % \newcommand*{\Aref}[1]{\appendixrefname~\ref{#1}}
7015 % \newcommand*{\Bref}[1]{\bookrefname~\ref{#1}}
7016 % \newcommand*{\Pref}[1]{\partrefname~\ref{#1}}
7017 % \newcommand*{\Cref}[1]{\chapterrefname~\ref{#1}}
7018 % \newcommand*{\Sref}[1]{\sectionrefname\ref{#1}}
7019
7020 \def\NR@nopatch@sectioning{set}
7021 \def\NR@nopatch@caption{set}
7022 \RequirePackage{nameref}
7023 \newcommand\titleref{\nameref}
7024
7025 \def\mem@set@cln{\NR@gettitle}
7026 \newcommand\M@gettitle[1]{\mem@set@cln{#1}}
7027 \newif\ifheadnameref
7028 \newcommand*{\headnameref}{\headnamereftrue}
7029 \newcommand*{\tocnameref}{\headnamereffalse}
7030 \tocnameref
7031 \providecommand\namerefon{\@memwarn{\protect\namerefon\space no longer does anything}}
7032 \providecommand\namerefoff{\@memwarn{\protect\namerefoff\space no longer does anything}}
7033 \providecommand\currenttitle{%
7034 \@memerror{The \protect\currenttitle\space command is no longer\MessageBreak
7035 available}{%
7036 Place a label and use \protect\titleref{label} instead
7037 }
7038 }
7039 \providecommand\theTitleReference[2]{%
7040 \@memwarn{\protect\theTitleReference\space is no longer available}
7041 }
7042 \let\M@TitleReference\@gobbletwo
7043 \newcommand{\@pnumwidth}{1.55em}
7044 \newcommand{\@tocrmarg} {2.55em}
7045 \newcommand{\@dotsep}{4.5}
7046 \newlength{\tocentryskip} \setlength{\tocentryskip}{1em}
7047 \newlength{\tocbaseline} \setlength{\tocbaseline}{20pt}
7048 \newcommand{\tocskip}[1]{%
7049 \addtocontents{toc}{\protect\vspace{#1}}}
7050 \newcommand*{\onecoltocetc}{%
7051 \def\ensureonecol{%
7052 \if@twocolumn
7053 \@restonecoltrue\onecolumn
7054 \else
7055 \@restonecolfalse
7056 \fi}%
7057 \def\restorefromonecol{\if@restonecol\twocolumn\fi}}
7058 \newcommand*{\twocoltocetc}{%
7059 \def\ensureonecol{%
7060 \if@twocolumn
7061 \@restonecoltrue
7062 \else
7063 \@restonecolfalse\twocolumn
7064 \fi}%
7065 \def\restorefromonecol{\if@restonecol\else\onecolumn\fi}}
7066 \newcommand*{\doccoltocetc}{%
7067 \let\ensureonecol\relax
7068 \let\restorefromonecol\relax}
7069 \onecoltocetc
7070
7071 \newlength{\cftparskip}
7072 \setlength{\cftparskip}{0pt}
7073
7074 \newcommand{\newlistof}[3]{%
7075 \@namedef{ext@#2}{#2}
7076 \@ifundefined{c@#2depth}{\newcounter{#2depth}}{}
7077 \setcounter{#2depth}{1}
7078 \@namedef{#2mark}{\markboth{#3}{#3}}
7079 \@namedef{#1}{\@ifstar{\@nameuse{mem@#1}{01}}{\@nameuse{mem@#1}{00}}}
7080 \@namedef{cft#2beforelisthook}{}%
7081 \@namedef{cft#2afterlisthook}{}%
7082 \@namedef{mem@#1}##1{%
7083 \ensureonecol
7084 \par
7085 \begingroup
7086 % \phantomsection
7087 \MakeLinkTarget[chapter]{}%
7088 \if##1
7089 \ifmem@em@starred@listof\else
7090 \addcontentsline{toc}{chapter}{#3}
7091 \fi
7092 \fi
7093 \@nameuse{@#2maketitle}
7094 \parskip\cftparskip
7095 \@nameuse{cft#2beforelisthook}%
7096 \@starttoc{#2}%
7097 \@nameuse{cft#2afterlisthook}%
7098 \endgroup
7099 \restorefromonecol}
7100 \@namedef{@#2maketitle}{%
7101 \@nameuse{#2headstart}
7102 {\parindent\z@
7103 \parskip\z@
7104 %%%% \parskip\cftparskip
7105 \interlinepenalty\@M
7106 \@nameuse{print#2nonum}%
7107 \@nameuse{print#2title}{#3}%
7108 \@nameuse{#2mark}%
7109 \thispagestyle{chapter}%
7110 \@nameuse{after#2title}
7111 }
7112 \@afterheading}
7113 \@namedef{#2headstart}{\chapterheadstart}
7114 \@namedef{after#2title}{\afterchaptertitle}
7115 \@namedef{print#2nonum}{\printchapternonum}
7116 \@namedef{print#2title}##1{\printchaptertitle{##1}}
7117 } % end \newlistof
7118
7119 \newif\ifmem@em@starred@listof
7120 \newcommand\KeepFromToc{\mem@em@starred@listoftrue}
7121 \renewcommand{\@starttoc}[1]{%
7122 \begingroup\makeatletter
7123 \@input{\jobname.#1}%
7124 \if@filesw
7125 \AtEndDocument{%
7126 \expandafter\ifx\csname tf@#1\endcsname\relax
7127 \expandafter\newwrite\csname tf@#1\endcsname
7128 \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
7129 \fi
7130 }%
7131 \fi
7132 \@nobreakfalse
7133 \endgroup}
7134
7135 \newlistof{tableofcontents}{toc}{\contentsname}
7136 \newcommand*{\setpnumwidth}[1]{\renewcommand{\@pnumwidth}{#1}}
7137 \newcommand*{\setrmarg}[1]{\renewcommand{\@tocrmarg}{#1}}
7138 \providecommand{\cftdot}{.}
7139 \providecommand{\cftdotfill}[1]{%
7140 \leaders\hbox{$\m@th\mkern #1 mu\hbox{\cftdot}\mkern #1 mu$}\hfill}
7141 \providecommand{\cftdotsep}{4.5}
7142 \newcommand{\cftnodots}{2000}
7143 \newcommand*{\cftparfillskip}{\parfillskip=0pt plus1fil}
7144 \newcommand*{\@cftn@me}{}
7145
7146 \newcommand\mem@cft@hb@xt@[2]{\hb@xt@#1{#2\hfil}}
7147 \let\numberlinebox\mem@cft@hb@xt@
7148 \let\partnumberlinebox\mem@cft@hb@xt@
7149 \let\chapternumberlinebox\mem@cft@hb@xt@
7150 \let\booknumberlinebox\mem@cft@hb@xt@
7151
7152 \newcommand*\numberlinehook[1]{}
7153 \renewcommand*{\numberline}[1]{%
7154 \numberlinehook{#1}%
7155 %\hb@xt@\@tempdima{\@cftn@me\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}
7156 \numberlinebox\@tempdima{\@cftn@me\@cftbsnum #1\@cftasnum}\@cftasnumb}
7157 \newcommand{\@cftbsnum}{}
7158 \newcommand{\@cftasnum}{}
7159 \newcommand{\@cftasnumb}{}
7160 \newcommand\setcftvspacecmd[1]{\def\mem@cft@vspace@cmd{#1}}
7161 \setcftvspacecmd{\vskip}
7162 \newcommand{\newlistentry}[4][\@empty]{%
7163 \@ifundefined{c@#2}{% check & set the counter
7164 \ifx \@empty#1\relax
7165 \newcounter{#2}
7166 \else
7167 \newcounter{#2}[#1]%
7168 \expandafter\edef\csname the#2\endcsname{%
7169 \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}
7170 \fi}{}
7171 \setcounter{#2}{0}
7172 \@namedef{l@#2}##1##2{%
7173 \ifnum \@nameuse{c@#3depth} > #4\relax
7174 % \vskip \@nameuse{cftbefore#2skip}
7175 % \mem@cft@vspace@cmd \@nameuse{cftbefore#2skip}
7176 \ExpandArgs{c}\mem@cft@vspace@cmd{cftbefore#2skip}
7177 {%\leftskip \@nameuse{cft#2indent}\relax
7178 \newcommand*\cftwhatismyname{#2}%
7179 \memRTLleftskip \@nameuse{cft#2indent}\relax
7180 %%% \rightskip \@tocrmarg
7181 \memRTLrightskip \@tocrmarg
7182 %%% \parfillskip -\rightskip
7183 \parfillskip -\memRTLrightskip
7184 \parindent \@nameuse{cft#2indent}\relax\@afterindenttrue
7185 \interlinepenalty\@M
7186 \leavevmode
7187 \settowidth{\@tempdima}{\@nameuse{cft#2font}{\@nameuse{cft#2name}}}%
7188 \addtolength{\@tempdima}{\@nameuse{cft#2numwidth}}%
7189 \expandafter\let\expandafter\@cftbsnum\csname cft#2presnum\endcsname
7190 \expandafter\let\expandafter\@cftasnum\csname cft#2aftersnum\endcsname
7191 \expandafter\let\expandafter\@cftasnumb\csname cft#2aftersnumb\endcsname
7192 \expandafter\let\expandafter\@cftn@me\csname cft#2name\endcsname
7193 %%% \advance\leftskip\@tempdima \null\nobreak\hskip -\leftskip
7194 \advance\memRTLleftskip\@tempdima \null\nobreak\hskip -\memRTLleftskip
7195 {\@nameuse{cft#2font}{##1}}\nobreak
7196 \@nameuse{cft#2fillnum}{##2}}
7197 \fi
7198 }% end of \l@#2
7199
7200 \expandafter\newlength\csname cftbefore#2skip\endcsname
7201 \setlength{\@nameuse{cftbefore#2skip}}{\z@ \@plus .2\p@}
7202 \expandafter\newlength\csname cft#2indent\endcsname
7203 \expandafter\newlength\csname cft#2numwidth\endcsname
7204 \ifcase #4\relax % 0 (level 1)
7205 \setlength{\@nameuse{cft#2indent}}{0em}
7206 \setlength{\@nameuse{cft#2numwidth}}{2.3em}
7207 \or % 1 (level 2)
7208 \setlength{\@nameuse{cft#2indent}}{2.3em}
7209 \setlength{\@nameuse{cft#2numwidth}}{3.2em}
7210 \or % 2 (level 3)
7211 \setlength{\@nameuse{cft#2indent}}{5.5em}
7212 \setlength{\@nameuse{cft#2numwidth}}{4.1em}
7213 \or % 3 (level 4)
7214 \setlength{\@nameuse{cft#2indent}}{8.5em}
7215 \setlength{\@nameuse{cft#2numwidth}}{5.0em}
7216 \else % anything else
7217 \setlength{\@nameuse{cft#2indent}}{10.5em}
7218 \setlength{\@nameuse{cft#2numwidth}}{6.0em}
7219 \fi
7220 \@namedef{cft#2font}{\normalfont}
7221 \@namedef{cft#2name}{}
7222 \@namedef{cft#2presnum}{}
7223 \@namedef{cft#2aftersnum}{}
7224 \@namedef{cft#2aftersnumb}{}
7225 \@namedef{cft#2dotsep}{\cftdotsep}
7226 \@namedef{cft#2leader}{\normalfont\cftdotfill{\@nameuse{cft#2dotsep}}}
7227 \@namedef{cft#2pagefont}{\normalfont}
7228 \@namedef{cft#2afterpnum}{}
7229 \@namedef{toclevel@#2}{#4}
7230 \@namedef{cft#2formatpnumhook}##1{}
7231 \@namedef{cft#2formatpnum}##1{%
7232 \@nameuse{cft#2formatpnumhook}{##1}%
7233 \hb@xt@\@pnumwidth{\hfil\@nameuse{cft#2pagefont}##1}}
7234 \@namedef{cft#2fillnum}##1{%
7235 {\@nameuse{cft#2leader}}\nobreak
7236 %%% \hb@xt@\@pnumwidth{%
7237 %%% \hfil\@nameuse{cft#2pagefont}##1}
7238 \@nameuse{cft#2formatpnum}{##1}%
7239 \@nameuse{cft#2afterpnum}\par}
7240 } % end \newlistentry
7241
7242 \newcommand*{\cftsetindents}[3]{%
7243 \setlength{\@nameuse{cft#1indent}}{#2}
7244 \setlength{\@nameuse{cft#1numwidth}}{#3}}
7245
7246 \newcommand*{\cftbookname}{}
7247
7248 \newcommand*{\cftbookbreak}{%
7249 \addpenalty{\cftbeforebookpenalty}%
7250 \addvspace{\cftbeforebookskip}%
7251 }
7252 \newcommand*{\l@book}[2]{%
7253 \ifnum\c@tocdepth >-3\relax
7254 \cftbookbreak
7255 \begingroup
7256 {%\leftskip \cftbookindent\relax
7257 \memRTLleftskip \cftbookindent\relax
7258 %%% \rightskip \@tocrmarg
7259 \memRTLrightskip \@tocrmarg
7260 %%% \parfillskip -\rightskip
7261 \parfillskip -\memRTLrightskip
7262 \parindent \cftbookindent\relax\@afterindenttrue
7263 \interlinepenalty\@M
7264 \leavevmode
7265 \settowidth{\@tempdima}{\cftbookfont\cftbookname}%
7266 \addtolength{\@tempdima}{\cftbooknumwidth}%
7267 \let\@cftbsnum \cftbookpresnum
7268 \let\@cftasnum \cftbookaftersnum
7269 \let\@cftasnumb \cftbookaftersnumb
7270 %%% \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
7271 \advance\memRTLleftskip \@tempdima \null\nobreak\hskip -\memRTLleftskip
7272 {\cftbookfont {#1}}%
7273 \cftbookfillnum{#2}}
7274 \nobreak
7275 \global\@nobreaktrue
7276 \everypar{\global\@nobreakfalse\everypar{}}%
7277 \endgroup
7278 \fi}
7279 \newcommand*\booknumberlinehook[1]{}
7280 \newcommand{\booknumberline}[1]{%
7281 \booknumberlinehook{#1}%
7282 % \hb@xt@\@tempdima{%
7283 % \cftbookname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}%%\space}
7284 \booknumberlinebox\@tempdima{%
7285 \cftbookname\@cftbsnum #1\@cftasnum}\@cftasnumb}%%\space}
7286
7287 \newlength{\cftbeforebookskip}
7288 \setlength{\cftbeforebookskip}{2.25em \@plus\p@}
7289 \newcommand\cftbeforebookpenalty{-\@highpenalty}
7290 \newdimen\cftbookindent
7291 \setlength{\cftbookindent}{0em}
7292 \newdimen\cftbooknumwidth
7293 \setlength{\cftbooknumwidth}{1.5em}
7294 \newcommand*{\cftbookfont}{\large\bfseries}
7295 \newcommand*{\cftbookpresnum}{}
7296 \newcommand*{\cftbookaftersnum}{}
7297 \newcommand*{\cftbookaftersnumb}{}
7298 \newcommand*{\cftbookleader}{%
7299 \large\bfseries\cftdotfill{\cftbookdotsep}}
7300 \newcommand*{\cftbookdotsep}{\cftnodots}
7301 \newcommand*{\cftbookpagefont}{\large\bfseries}
7302 \newcommand{\cftbookafterpnum}{}
7303 \newcommand{\cftbookfillnum}[1]{%
7304 {\cftbookleader}%
7305 %%%% {\hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}}%
7306 \cftbookformatpnum{#1}%
7307 \cftbookafterpnum\par}
7308 \newcommand{\cftbookformatpnumhook}[1]{}
7309 \newcommand{\cftbookformatpnum}[1]{%
7310 \cftbookformatpnumhook{#1}%
7311 \hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}}
7312
7313 \newcommand*{\cftpartname}{}
7314
7315 \newcommand*{\cftpartbreak}{%
7316 \addpenalty{\cftbeforepartpenalty}%
7317 \addvspace{\cftbeforepartskip}%
7318 }
7319 \newcommand*{\l@part}[2]{%
7320 \ifnum \c@tocdepth >-2\relax
7321 \cftpartbreak
7322 \begingroup
7323 {%\leftskip \cftpartindent\relax
7324 \memRTLleftskip \cftpartindent\relax
7325 %%% \rightskip \@tocrmarg
7326 \memRTLrightskip \@tocrmarg
7327 %%% \parfillskip -\rightskip
7328 \parfillskip -\memRTLrightskip
7329 \parindent \cftpartindent\relax\@afterindenttrue
7330 \interlinepenalty\@M
7331 \leavevmode
7332 \settowidth{\@tempdima}{\cftpartfont\cftpartname}%
7333 \addtolength{\@tempdima}{\cftpartnumwidth}%
7334 \let\@cftbsnum \cftpartpresnum
7335 \let\@cftasnum \cftpartaftersnum
7336 \let\@cftasnumb \cftpartaftersnumb
7337 %%% \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
7338 \advance\memRTLleftskip \@tempdima \null\nobreak\hskip -\memRTLleftskip
7339 {\cftpartfont {#1}}%
7340 \cftpartfillnum{#2}}
7341 \nobreak
7342 \global\@nobreaktrue
7343 \everypar{\global\@nobreakfalse\everypar{}}%
7344 \endgroup
7345 \fi}
7346
7347 \def\toclevel@part{-1}
7348
7349 \newcommand*\partnumberlinehook[1]{}
7350 \newcommand{\partnumberline}[1]{%
7351 \partnumberlinehook{#1}%
7352 % \hb@xt@\@tempdima{%
7353 % \cftpartname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}%%\space}
7354 \partnumberlinebox\@tempdima{%
7355 \cftpartname\@cftbsnum #1\@cftasnum}\@cftasnumb}%%\space}
7356
7357 \newlength{\cftbeforepartskip}
7358 \setlength{\cftbeforepartskip}{2.25em \@plus\p@}
7359 \newcommand\cftbeforepartpenalty{-\@highpenalty}
7360 \newlength{\cftpartindent}
7361 \setlength{\cftpartindent}{0em}
7362 \newlength{\cftpartnumwidth}
7363 \setlength{\cftpartnumwidth}{1.5em}
7364 \newcommand{\cftpartfont}{\large\bfseries}
7365 \newcommand{\cftpartpresnum}{}
7366 \newcommand{\cftpartaftersnum}{}
7367 \newcommand{\cftpartaftersnumb}{}
7368 \newcommand{\cftpartleader}{%
7369 \large\bfseries\cftdotfill{\cftpartdotsep}}
7370 \newcommand{\cftpartdotsep}{\cftnodots}
7371 \newcommand{\cftpartpagefont}{\large\bfseries}
7372 \newcommand{\cftpartafterpnum}{}
7373 \newcommand{\cftpartformatpnumhook}[1]{}
7374 \newcommand*{\cftpartformatpnum}[1]{%
7375 \cftpartformatpnumhook{#1}%
7376 \hb@xt@\@pnumwidth{\hss {\cftpartpagefont #1}}}
7377 \newcommand{\cftpartfillnum}[1]{%
7378 {\cftpartleader}%
7379 {\cftpartformatpnum{#1}}%
7380 \cftpartafterpnum\par}
7381
7382 \newcommand*{\cftchaptername}{}
7383
7384 \newcommand*{\l@chapapp}[3]{%
7385 \ifnum \c@tocdepth >\m@ne
7386 \cftchapterbreak
7387 % \vskip \cftbeforechapterskip
7388 {%\leftskip \cftchapterindent\relax
7389 \memRTLleftskip \cftchapterindent\relax
7390 %%% \rightskip \@tocrmarg
7391 \memRTLrightskip \@tocrmarg
7392 %%% \parfillskip -\rightskip
7393 \parfillskip -\memRTLrightskip
7394 \parindent \cftchapterindent\relax
7395 \@afterindenttrue
7396 \interlinepenalty\@M
7397 \leavevmode
7398 \let\@cftbsnum \cftchapterpresnum
7399 \let\@cftasnum \cftchapteraftersnum
7400 \let\@cftasnumb \cftchapteraftersnumb
7401 \def\@chapapp@head{#3}%
7402 \settowidth{\@tempdima}{\cftchapterfont\@chapapp@head}%
7403 \addtolength{\@tempdima}{\cftchapternumwidth}%
7404 %%% \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
7405 \advance\memRTLleftskip \@tempdima \null\nobreak\hskip -\memRTLleftskip
7406 {\cftchapterfont {#1}}\nobreak
7407 \cftchapterfillnum{#2}}
7408 \fi}
7409
7410 \newcommand*{\l@chapter}[2]{%
7411 \l@chapapp{#1}{#2}{\cftchaptername}}
7412
7413 \def\toclevel@chapter{0}
7414
7415 \newcommand*{\cftappendixname}{}
7416
7417 \newcommand*{\l@appendix}[2]{%
7418 \l@chapapp{#1}{#2}{\cftappendixname}}
7419 \def\toclevel@appendix{0}
7420
7421 \newcommand*\chapternumberlinehook[1]{}
7422 \newcommand{\chapternumberline}[1]{%
7423 \chapternumberlinehook{#1}%
7424 % \hb@xt@\@tempdima{\@chapapp@head\@cftbsnum #1\@cftasnum\hfil}%
7425 % \@cftasnumb}
7426 \chapternumberlinebox\@tempdima{\@chapapp@head\@cftbsnum #1\@cftasnum}%
7427 \@cftasnumb}
7428
7429 \newlength{\cftbeforechapterskip}
7430 \setlength{\cftbeforechapterskip}{1.0em \@plus\p@}
7431 \newcommand\cftbeforechapterpenalty{-\@highpenalty}
7432 \newlength{\cftchapterindent}
7433 \setlength{\cftchapterindent}{0em}
7434 \newlength{\cftchapternumwidth}
7435 \setlength{\cftchapternumwidth}{1.5em}
7436 \newcommand{\cftchapterfont}{\bfseries}
7437 \newcommand{\cftchapterpresnum}{}
7438 \newcommand{\cftchapteraftersnum}{}
7439 \newcommand{\cftchapteraftersnumb}{}
7440 \newcommand{\cftchapterleader}{%
7441 \bfseries\cftdotfill{\cftchapterdotsep}}
7442 \newcommand{\cftchapterdotsep}{\cftnodots}
7443 \newcommand{\cftchapterpagefont}{\bfseries}
7444 \newcommand{\cftchapterafterpnum}{}
7445 \newcommand{\cftchapterformatpnumhook}[1]{}
7446 \newcommand*{\cftchapterformatpnum}[1]{%
7447 \cftchapterformatpnumhook{#1}%
7448 \hb@xt@\@pnumwidth{\hfil\cftchapterpagefont #1}}
7449 \newcommand*{\cftchapterfillnum}[1]{%
7450 {\cftchapterleader}\nobreak
7451 \cftchapterformatpnum{#1}%
7452 \cftchapterafterpnum\par}
7453 \newcommand{\cftchapterbreak}{%
7454 \addpenalty{\cftbeforechapterpenalty}%
7455 \mem@cft@vspace@cmd \cftbeforechapterskip%
7456 }
7457
7458 \newlistentry[chapter]{section}{toc}{0}
7459 \cftsetindents{section}{1.5em}{2.3em}
7460 \newlistentry[section]{subsection}{toc}{1}
7461 \cftsetindents{subsection}{3.8em}{3.2em}
7462 \newlistentry[subsection]{subsubsection}{toc}{2}
7463 \cftsetindents{subsubsection}{7.0em}{4.1em}
7464 \newlistentry[subsubsection]{paragraph}{toc}{3}
7465 \cftsetindents{paragraph}{10.0em}{5.0em}
7466 \newlistentry[paragraph]{subparagraph}{toc}{4}
7467 \cftsetindents{subparagraph}{12.0em}{6.0em}
7468
7469 \newcommand*{\@cftl@subfigtab}{
7470 \newlistentry[figure]{subfigure}{lof}{1}
7471 \cftsetindents{subfigure}{2.3em}{2.5em}
7472 \newlistentry[table]{subtable}{lot}{1}
7473 \cftsetindents{subtable}{2.3em}{2.5em}}
7474 \renewcommand*{\@cftl@subfigtab}{}
7475
7476 \AtBeginDocument{\@ifpackageloaded{subfigure}{\@cftl@subfigtab}{}}
7477
7478 \DeclareRobustCommand{\cftpagenumbersoff}[1]{%
7479 \@namedef{cft#1fillnum}##1{%
7480 \cftparfillskip\@nameuse{cft#1afterpnum}\par}}
7481
7482 \DeclareRobustCommand{\cftpagenumberson}[1]{%
7483 \@namedef{cft#1fillnum}##1{%
7484 \@nameuse{cft#1leader}\nobreak
7485 \@nameuse{cft#1formatpnum}{##1}%
7486 \@nameuse{cft#1afterpnum}\par}}
7487
7488 \newcommand{\chapterprecis}[1]{%
7489 \chapterprecishere{#1}
7490 \chapterprecistoc{#1}}
7491 \newcommand{\chapterprecishere}[1]{%
7492 \prechapterprecis #1\postchapterprecis}
7493 \newdimen\prechapterprecisshift
7494 \ifartopt
7495 \prechapterprecisshift=0pt
7496 \else
7497 \prechapterprecisshift=-2\baselineskip
7498 \fi
7499 \newcommand*{\precisfont}{\normalfont\itshape}
7500 \newcommand{\prechapterprecis}{%
7501 \vspace*{\prechapterprecisshift}%
7502 \begin{quote}\precisfont}
7503 \newcommand*{\postchapterprecis}{%
7504 \end{quote}%
7505 \par\m@mindentafterchapter%
7506 \@afterheading}
7507
7508 \newcommand{\precistocfont}{\normalfont\itshape}
7509 \newcommand{\precistocformat}{\noindent}
7510 \newcommand{\chapterprecistoc}[1]{%
7511 \addtocontents{toc}{\precistoctext{#1}}}
7512 \DeclareRobustCommand{\precistoctext}[1]{%
7513 {%\nopagebreak\leftskip \cftchapterindent\relax
7514 \nopagebreak\memRTLleftskip \cftchapterindent\relax
7515 %%% \advance\leftskip \cftchapternumwidth\relax
7516 \advance\memRTLleftskip \cftchapternumwidth\relax
7517 %%% \rightskip \@tocrmarg\relax
7518 \memRTLrightskip \@tocrmarg\relax
7519 \precistocformat\precistocfont #1\par}}
7520 \newcommand{\cftlocalchange}[3]{%
7521 \addtocontents{#1}{\protect\setpnumwidth{#2} \protect\setrmarg{#3}}}
7522 \newcommand{\cftaddtitleline}[4]{%
7523 \addtocontents{#1}{\protect\contentsline{#2}{#3}{#4}{}}}
7524 \newcommand{\cftaddnumtitleline}[5]{%
7525 \addtocontents{#1}%
7526 {\protect\contentsline{#2}{\protect\numberline{#3}%
7527 {\protect\ignorespaces #4}}{#5}{}}}
7528 \newcommand*{\cftinsert}[1]{\@nameuse{cftinsert#1}}
7529 \newcommand{\cftinsertcode}[2]{\@namedef{cftinsert#1}{#2}}
7530 \NewDocumentCommand\cftinserthook{smm}{
7531 \IfBooleanTF{#1}{
7532 \ifdim\pagetotal>\z@
7533 \addtocontents{#2}{\protect\cftinsert\protect{#3\protect}}
7534 \clearpage
7535 \else
7536 \immediateaddtocontents{#2}{\noexpand\cftinsert{#3}}
7537 \fi
7538 }{%
7539 \addtocontents{#2}{\protect\cftinsert\protect{#3\protect}}%
7540 }%
7541 }
7542
7543 \ExplSyntaxOn
7544 \newcommand*{\@setclcnt}[2]{%
7545 \str_case_e:nnF{#1}{
7546 {none}{ \setcounter{#2}{-10}}
7547 {book}{ \setcounter{#2}{-2} }
7548 {part}{ \setcounter{#2}{-1} }
7549 {chapter}{ \setcounter{#2}{0} }
7550 {section}{ \setcounter{#2}{1} }
7551 {subsection}{ \setcounter{#2}{2} }
7552 {subsubsection}{ \setcounter{#2}{3} }
7553 {paragraph}{ \setcounter{#2}{4} }
7554 {subparagraph}{ \setcounter{#2}{5} }
7555 {all}{ \setcounter{#2}{50} }
7556 }{
7557 \@memerror{%
7558 Unknown~document~division~name~(#1)
7559 }{%
7560 I'll~ignore~it.~
7561 Type~<return>~and~I'll~continue.\MessageBreak
7562 If~you~haven't~mistyped~the~name~then~ use~
7563 \protect\setcounter~instead.}%
7564 }
7565 }
7566 \ExplSyntaxOff
7567 % \newcommand*{\@setclcnt}[2]{%
7568 % \def\@setclcntok{0}% = false
7569 % \nametest{#1}{none}%
7570 % \ifsamename
7571 % \setcounter{#2}{-10}%
7572 % \def\@setclcntok{1}% = true
7573 % \fi
7574 % \nametest{#1}{book}%
7575 % \ifsamename
7576 % \setcounter{#2}{-2}%
7577 % \def\@setclcntok{1}%
7578 % \fi
7579 % \nametest{#1}{part}%
7580 % \ifsamename
7581 % \setcounter{#2}{-1}%
7582 % \def\@setclcntok{1}%
7583 % \fi
7584 % \nametest{#1}{chapter}%
7585 % \ifsamename
7586 % \setcounter{#2}{0}%
7587 % \def\@setclcntok{1}%
7588 % \fi
7589 % \nametest{#1}{section}%
7590 % \ifsamename
7591 % \setcounter{#2}{1}%
7592 % \def\@setclcntok{1}%
7593 % \fi
7594 % \nametest{#1}{subsection}%
7595 % \ifsamename
7596 % \setcounter{#2}{2}%
7597 % \def\@setclcntok{1}%
7598 % \fi
7599 % \nametest{#1}{subsubsection}%
7600 % \ifsamename
7601 % \setcounter{#2}{3}%
7602 % \def\@setclcntok{1}%
7603 % \fi
7604 % \nametest{#1}{paragraph}%
7605 % \ifsamename
7606 % \setcounter{#2}{4}%
7607 % \def\@setclcntok{1}%
7608 % \fi
7609 % \nametest{#1}{subparagraph}%
7610 % \ifsamename
7611 % \setcounter{#2}{5}%
7612 % \def\@setclcntok{1}%
7613 % \fi
7614 % \nametest{#1}{all}%
7615 % \ifsamename
7616 % \setcounter{#2}{50}%
7617 % \def\@setclcntok{1}%
7618 % \fi
7619 % %% \if@tempswa\else
7620 % \ifnum \@setclcntok = 0\relax
7621 % \@memerror{%
7622 % Unknown document division name (#1)
7623 % }{%
7624 % I'll ignore it.
7625 % Type \space <return> and I'll continue.\MessageBreak
7626 % If you haven't mistyped the name then use
7627 % \protect\setcounter\space instead.}%
7628 % \fi}
7629 %
7630 \ExplSyntaxOn
7631 \newcommand*{\settocdepth@}[2]{%
7632 \str_case_e:nnTF{#2}{
7633 {none}{ #1{toc}{\changetocdepth{-10}}}
7634 {book}{ #1{toc}{\changetocdepth{-2}} }
7635 {part}{ #1{toc}{\changetocdepth{-1}} }
7636 {chapter}{ #1{toc}{\changetocdepth{0}} }
7637 {section}{ #1{toc}{\changetocdepth{1}} }
7638 {subsection}{ #1{toc}{\changetocdepth{2}} }
7639 {subsubsection}{ #1{toc}{\changetocdepth{3}} }
7640 {paragraph}{ #1{toc}{\changetocdepth{4}} }
7641 {subparagraph}{ #1{toc}{\changetocdepth{5}} }
7642 {all}{ #1{toc}{\changetocdepth{50}} }
7643 }{
7644 \@ifundefined{toclevel@#2}{%
7645 \@memwarn{Unknown~toclevel~for~#2}%
7646 }{%
7647 \setcounter{tocdepth}{\@nameuse{toclevel@#2}}%
7648 }
7649 }{
7650 \@memerror{%
7651 Unknown~document~division~name~(#2)
7652 }{%
7653 I'll~ignore~ it.~
7654 Type~<return>~and~I'll~continue.}%
7655 }
7656 }
7657 \ExplSyntaxOff
7658 \NewDocumentCommand\settocdepth{sm}{%
7659 \IfBooleanTF{#1}{%
7660 \ifdim\pagetotal>\z@%
7661 \settocdepth@{\addtocontents}{#2}%
7662 \clearpage%
7663 \else%
7664 \settocdepth@{\immediateaddtocontents}{#2}%
7665 \fi%
7666 }{%
7667 \settocdepth@{\addtocontents}{#2}%
7668 }%
7669 }
7670
7671 % \def\@chtodok{0}% false
7672 % \nametest{#1}{none}%
7673 % \ifsamename
7674 % \addtocontents{toc}{\changetocdepth{-10}}%
7675 % \def\@chtodok{1}% true
7676 % \fi
7677 % \nametest{#1}{book}%
7678 % \ifsamename
7679 % \addtocontents{toc}{\changetocdepth{-2}}%
7680 % \def\@chtodok{1}%
7681 % \fi
7682 % \nametest{#1}{part}%
7683 % \ifsamename
7684 % \addtocontents{toc}{\changetocdepth{-1}}%
7685 % \def\@chtocdok{1}%
7686 % \fi
7687 % \nametest{#1}{chapter}%
7688 % \ifsamename
7689 % \addtocontents{toc}{\changetocdepth{0}}%
7690 % \def\@chtocdok{1}%
7691 % \fi
7692 % \nametest{#1}{section}%
7693 % \ifsamename
7694 % \addtocontents{toc}{\changetocdepth{1}}%
7695 % \def\@chtocdok{1}%
7696 % \fi
7697 % \nametest{#1}{subsection}%
7698 % \ifsamename
7699 % \addtocontents{toc}{\changetocdepth{2}}%
7700 % \def\@chtocdok{1}%
7701 % \fi
7702 % \nametest{#1}{subsubsection}%
7703 % \ifsamename
7704 % \addtocontents{toc}{\changetocdepth{3}}%
7705 % \def\@chtocdok{1}%
7706 % \fi
7707 % \nametest{#1}{paragraph}%
7708 % \ifsamename
7709 % \addtocontents{toc}{\changetocdepth{4}}%
7710 % \def\@chtocdok{1}%
7711 % \fi
7712 % \nametest{#1}{subparagraph}%
7713 % \ifsamename
7714 % \addtocontents{toc}{\changetocdepth{5}}%
7715 % \def\@chtocdok{1}%
7716 % \fi
7717 % \nametest{#1}{all}%
7718 % \ifsamename
7719 % \addtocontents{toc}{\changetocdepth{50}}%
7720 % \def\@chtocdok{1}%
7721 % \fi
7722 % \ifnum\@chtocdok=1\relax
7723 % \@ifundefined{toclevel@#1}{%
7724 % \@memwarn{Unknown toclevel for #1}%
7725 % }{%
7726 % \setcounter{tocdepth}{\@nameuse{toclevel@#1}}%
7727 % }
7728 % \else
7729 % \@memerror{%
7730 % Unknown document division name (#1)
7731 % }{%
7732 % I'll ignore it.
7733 % Type \space <return> and I'll continue.}%
7734 % \fi}
7735
7736 \def\toclevel@none{-10}
7737 \def\toclevel@all{50}
7738
7739 \DeclareRobustCommand{\changetocdepth}[1]{\setcounter{tocdepth}{#1}}
7740
7741 \newcommand{\maxtocdepth}[1]{%
7742 \@setclcnt{#1}{tocdepth}}
7743 \newcounter{maxsecnumdepth}
7744 \newcommand{\maxsecnumdepth}[1]{%
7745 \@setclcnt{#1}{secnumdepth}\@setclcnt{#1}{maxsecnumdepth}}
7746
7747 \newcommand{\setsecnumdepth}[1]{%
7748 \ifx\@nodocument\relax% after the preamble
7749 \@setclcnt{#1}{secnumdepth}%
7750 \else
7751 \@setclcnt{#1}{secnumdepth}%
7752 \@setclcnt{#1}{maxsecnumdepth}%
7753 \fi}
7754 \setsecnumdepth{section}
7755
7756 \newdimen\bibindent
7757 \setlength\bibindent{1.5em}
7758 \newlength{\bibitemsep}
7759 \setlength{\bibitemsep}{\itemsep}
7760 \newcommand{\biblistextra}{\itemsep=\bibitemsep}
7761
7762 \newenvironment{bibitemlist}[1]{%
7763 \typeout{bibitemlist}
7764 \list{\@biblabel{\@arabic\c@enumiv}}%
7765 {\settowidth\labelwidth{\@biblabel{#1}}%
7766 \leftmargin\labelwidth
7767 \advance\leftmargin\labelsep
7768 \@openbib@code
7769 \usecounter{enumiv}%
7770 \let\p@enumiv\@empty
7771 \renewcommand\theenumiv{\@arabic\c@enumiv}%
7772 \biblistextra}%
7773 \sloppy
7774 \clubpenalty4000
7775 \@clubpenalty \clubpenalty
7776 \widowpenalty4000%
7777 \sfcode`\.\@m}%
7778 {\def\@noitemerr
7779 {\@latex@warning{Empty `thebibliography' environment}}%
7780 \endlist}
7781
7782 \newcommand{\newblock}{\hskip .11em\@plus.33em\@minus.07em}
7783 \let\@openbib@code\@empty
7784 \newcommand*{\setbiblabel}[1]{%
7785 \renewcommand*{\@biblabel}[1]{#1}}
7786 \setbiblabel{[#1]\hfill}
7787 \newcommand{\@memb@bchap}{%
7788 \chapter*{\bibname}%
7789 \bibmark
7790 \ifnobibintoc\else
7791 % \phantomsection
7792 \addcontentsline{toc}{chapter}{\bibname}%
7793 \fi
7794 \prebibhook}
7795 \newcommand{\@memb@bsec}{\section{\bibname}\prebibhook}
7796 \newcommand{\bibsection}{\@memb@bchap}
7797
7798 \newenvironment{thebibliography}[1]{%
7799 \bibsection
7800 \begin{bibitemlist}{#1}}{\end{bibitemlist}\postbibhook}
7801 \newif\ifnobibintoc
7802 \newcommand*{\bibintoc}{\nobibintocfalse}
7803 \newcommand*{\nobibintoc}{\nobibintoctrue}
7804 \bibintoc
7805
7806 \newcommand{\prebibhook}{}
7807 \newcommand{\postbibhook}{}
7808
7809 \AtBeginDocument{%
7810 \@ifpackageloaded{natbib}{% natbib is loaded
7811 \addtodef{\endthebibliography}{}{\vskip-\lastskip\postbibhook}
7812 \@ifpackagewith{natbib}{sectionbib}{% with sectionbib option
7813 \renewcommand{\bibsection}{\@memb@bsec}}%
7814 {\renewcommand{\bibsection}{\@memb@bchap}}}%
7815 {}
7816 \@ifpackagewith{chapterbib}{sectionbib}{%
7817 \renewcommand{\sectionbib}[2]{}
7818 \renewcommand{\bibsection}{\@memb@bsec}}{}
7819 }
7820
7821 \newif\ifonecolindex
7822 \onecolindexfalse
7823
7824 \newcommand*{\onecolindex}{\onecolindextrue}
7825 \newcommand*{\twocolindex}{\onecolindexfalse}
7826
7827 \newenvironment{theindex}{%
7828 \clearforchapter
7829 \if@twocolumn
7830 \@restonecolfalse
7831 \else
7832 \@restonecoltrue
7833 \fi
7834 \ifonecolindex
7835 \onecolumn
7836 \chapter*{\indexname}
7837 \preindexhook
7838 \else
7839 \setlength{\columnseprule}{\indexrule}%
7840 \setlength{\columnsep}{\indexcolsep}%
7841 \MakeLinkTarget[chapter]{}% <-- new 2025
7842 \twocolumn[%
7843 \@makeschapterhead{\indexname}
7844 \preindexhook]%
7845 \fi
7846 \indexmark
7847 \ifnoindexintoc\else
7848 %\phantomsection
7849 \addcontentsline{toc}{chapter}{\indexname}%
7850 \fi
7851 \thispagestyle{indextitlepagestyle}\parindent\z@
7852 \parskip\z@ \@plus .3\p@\relax
7853 \let\item\@idxitem}%
7854 {\if@restonecol\onecolumn\else\twocolumn\fi}
7855
7856 \aliaspagestyle{indextitlepagestyle}{chapter}
7857
7858 \newif\ifnoindexintoc
7859 \newcommand*{\indexintoc}{\noindexintocfalse}
7860 \newcommand*{\noindexintoc}{\noindexintoctrue}
7861 \indexintoc
7862
7863 \newlength{\indexcolsep} \setlength{\indexcolsep}{35pt}
7864 \newlength{\indexrule} \setlength{\indexrule}{0pt}
7865
7866 \newcommand{\preindexhook}{}
7867 \newcommand{\l@index}{\@dottedtocline{1}{0em}{0pt}}
7868 \newcommand{\@idxitem} {\par\hangindent 40\p@}
7869 \newcommand{\subitem} {\par\hangindent 40\p@ \hspace*{20\p@}}
7870 \newcommand{\subsubitem}{\par\hangindent 40\p@ \hspace*{30\p@}}
7871 \newcommand{\indexspace}{\par \vskip 10\p@ \@plus5\p@ \@minus3\p@\relax}
7872
7873 \newcommand*{\makememindexhook}{}
7874 \providecommand*{\makeindex}{}
7875 \renewcommand*{\makeindex}[1][\jobname]{%
7876 \if@filesw
7877 \def\index{\@bsphack%
7878 \@ifnextchar [{\@index}{\@index[\jobname]}}
7879 \def\specialindex{\@bsphack\@spindex}%
7880 \makememindexhook
7881 \expandafter\newwrite\csname #1@idxfile\endcsname
7882 \expandafter\immediate\openout \csname #1@idxfile\endcsname #1.idx\relax
7883 \typeout{Writing index file #1.idx }%
7884 \fi}
7885
7886 \renewcommand{\index}[2][\jobname]{\@bsphack\@esphack}
7887 \newcommand{\specialindex}[3]{\@bsphack\@esphack}
7888
7889 \newcommand{\printindex}[1][\jobname]{\@input@{#1.ind}}
7890
7891 \newif\ifreportnoidxfile
7892 \newcommand*{\reportnoidxfile}{\reportnoidxfiletrue}
7893 \newcommand*{\ignorenoidxfile}{\reportnoidxfilefalse}
7894 \ignorenoidxfile
7895 \newif\ifshowindexmark
7896 \newcommand*{\showindexmarks}{\showindexmarktrue}
7897 \newcommand*{\hideindexmarks}{\showindexmarkfalse}
7898 \hideindexmarks
7899
7900 \def\@index[#1]{%
7901 \@ifundefined{#1@idxfile}%
7902 {\ifreportnoidxfile
7903 \@memwarn{Undefined index file #1}%
7904 \fi
7905 \begingroup
7906 \@sanitize
7907 \@nowrindex}%
7908 {\def\@idxfile{#1}%
7909 \begingroup
7910 \@sanitize
7911 \@wrindexm@m}}
7912 \newcommand{\@nowrindex}[1]{%
7913 \ifshowindexmark\@showidx{#1}\fi\endgroup\@esphack}
7914
7915 \newcommand{\@wrindexm@m}[1]{\@@wrindexhyp#1||\\}
7916 \def\@@wrindexhyp#1|#2|#3\\{%
7917 \ifshowindexmark\@showidx{#1}\fi
7918 \ifx\\#2\\%
7919 \protected@write\@auxout{}%
7920 {\string\@@wrindexm@m{\@idxfile}{#1|hyperpage}{\thepage}}%
7921 \else
7922 \def\Hy@temp@A{#2}%
7923 \ifx\Hy@temp@A\HyInd@ParenLeft
7924 \protected@write\@auxout{}%
7925 {\string\@@wrindexm@m{\@idxfile}{#1|#2hyperpage}{\thepage}}%
7926 \else
7927 \ifx\Hy@temp@A\HyInd@ParenRight
7928 \protected@write\@auxout{}%
7929 {\string\@@wrindexm@m{\@idxfile}{#1|#2hyperpage}{\thepage}}%
7930 \else
7931 \protected@write\@auxout{}%
7932 {\string\@@wrindexm@m{\@idxfile}{#1|#2}{\thepage}}%
7933 \fi
7934 \fi
7935 \fi
7936 \endgroup
7937 \@esphack}
7938 \newcommand{\hyperpage}[1]{#1}
7939 \newcommand{\hyperlink}[2]{#2}
7940
7941 \newcommand{\@@wrindexm@m}[1]{\begingroup
7942 \def\@idxfile{\@nameuse{#1@idxfile}}
7943 \@sanitize
7944 \@@@wrindexm@m}
7945
7946 \newcommand{\@@@wrindexm@m}[2]{\endgroup}
7947 \AtBeginDocument{%
7948 \def\@@@wrindexm@m#1#2{%
7949 \if@filesw
7950 %\immediate\write \@idxfile{\string\indexentry{#1}{#2}}%
7951 \immediate@protected@write\@idxfile{}{\string\indexentry{#1}{#2}}%
7952 \fi
7953 \endgroup}%
7954 }
7955 \newcommand{\@spindex}[2]{%
7956 \@ifundefined{#1@idxfile}%
7957 {\ifreportnoidxfile
7958 \@memwarn{Undefined index file #1}%
7959 \fi
7960 \begingroup
7961 \@sanitize
7962 \@nowrindex}%
7963 {\def\@idxfile{#1}%
7964 \def\@sptheidx{#2}%
7965 \begingroup
7966 \@sanitize
7967 \@wrspindex}}
7968
7969 \newcommand{\@wrspindex}[1]{\@@wrspindexhyp#1||\\}
7970 \def\@@wrspindexhyp#1|#2|#3\\{%
7971 \ifshowindexmark\@showidx{#1}\fi
7972 \ifx\\#2\\%
7973 \protected@write\@auxout{}%
7974 {\string\@@wrindexm@m{\@idxfile}%
7975 {#1|hyperspindexpage(\thepage)}%
7976 {\@nameuse{the\@sptheidx}}}%
7977 \else
7978 \def\Hy@temp@A{#2}%
7979 \ifx\Hy@temp@A\HyInd@ParenLeft
7980 \protected@write\@auxout{}%
7981 {\string\@@wrindexm@m{\@idxfile}%
7982 {#1|#2hyperspindexpage(\thepage)}%
7983 {\@nameuse{the\@sptheidx}}}%
7984 \else
7985 \protected@write\@auxout{}%
7986 {\string\@@wrindexm@m{\@idxfile}{#1|#2}%
7987 {\@nameuse{the\@sptheidx}}}%
7988 \fi
7989 \fi
7990 \endgroup
7991 \@esphack}
7992 \def\hyperspindexpage(#1)#2{\hyperlink{page.#1}{#2}}
7993
7994 \newif\ifmemhyperindex
7995 \memhyperindextrue
7996
7997 \newif\ifm@mxindy
7998 \m@mxindyfalse
7999 \newcommand*{\xindyindex}{\m@mxindytrue}
8000 \def\@@wrspindexhyp#1|#2|#3\\{%
8001 \ifshowindexmark\@showidx{#1}\fi
8002 \ifx\\#2\\%
8003 \protected@write\@auxout{}%
8004 {\string\@@wrindexm@m{\@idxfile}%
8005 \ifm@mxindy{#1}\else{#1|hyperspindexpage(\thepage)}\fi
8006 {\@nameuse{the\@sptheidx}}}%
8007 \else
8008 \def\Hy@temp@A{#2}%
8009 \ifx\Hy@temp@A\HyInd@ParenLeft
8010 \protected@write\@auxout{}%
8011 {\string\@@wrindexm@m{\@idxfile}%
8012 \ifm@mxindy{#1|#2}\else{#1|#2hyperspindexpage(\thepage)}\fi
8013 {\@nameuse{the\@sptheidx}}}%
8014 \else
8015 \protected@write\@auxout{}%
8016 {\string\@@wrindexm@m{\@idxfile}{#1|#2}%
8017 {\@nameuse{the\@sptheidx}}}%
8018 \fi
8019 \fi
8020 \endgroup
8021 \@esphack}
8022
8023 \AtBeginDocument{%
8024 \@ifpackageloaded{hyperref}{}{\memhyperindexfalse}%
8025 \ifmemhyperindex\else
8026 \def\@@wrindexhyp#1||\\{%
8027 \ifshowindexmark\@showidx{#1}\fi
8028 \protected@write\@auxout{}%
8029 {\string\@@wrindexm@m{\@idxfile}{#1}{\thepage}}%
8030 \endgroup
8031 \@esphack}%
8032 \def\@@wrspindexhyp#1||\\{%
8033 \ifshowindexmark\@showidx{#1}\fi
8034 \protected@write\@auxout{}%
8035 {\string\@@wrindexm@m{\@idxfile}{#1}{\@nameuse{the\@sptheidx}}}%
8036 \endgroup
8037 \@esphack}%
8038 \fi
8039 }
8040
8041 \newcommand*{\see}[2]{\emph{\seename} #1}
8042 \newcommand*{\seename}{see}
8043 \newcommand*{\seealso}[2]{\emph{\alsoname} #1}
8044 \newcommand*{\alsoname}{see also}
8045
8046 \newcommand{\citeindexfile}{\jobname}
8047 \AtBeginDocument{\@ifpackageloaded{natbib}{%
8048 \def\NAT@index{\index[\citeindexfile]{\NAT@idxtxt}}}{}}
8049
8050 \newtoks\indexmarkstyle
8051 \indexmarkstyle{\normalfont\footnotesize\ttfamily}
8052 \newinsert\@indexbox
8053 \dimen\@indexbox\maxdimen
8054
8055 \begingroup
8056 \catcode`\@\active
8057 \expandafter\gdef\csname\string @sanitizeat\endcsname
8058 {\def @{\char`\@}}
8059 \endgroup
8060
8061 \newcommand{\@showidx}[1]{%
8062 \insert\@indexbox{%
8063 \@sanitizeat
8064 \the\indexmarkstyle
8065 \hsize\marginparwidth
8066 \hangindent\marginparsep \parindent\z@
8067 \everypar{}\let\par\@@par \parfillskip\@flushglue
8068 \lineskip\normallineskip
8069 \baselineskip .8\normalbaselineskip\sloppy
8070 \raggedright \leavevmode
8071 \vrule \@height .7\normalbaselineskip \@width \z@\relax
8072 #1\relax
8073 \vrule \@height \z@ \@depth .3\normalbaselineskip \@width \z@\relax
8074 }%
8075 \ifhmode\penalty\@M \hskip\z@skip\fi}
8076
8077 \newcommand{\@leftidx}{\hskip-\marginparsep \hskip-\marginparwidth}
8078 \newcommand{\@rightidx}{\hskip\columnwidth \hskip\marginparsep}
8079
8080 \newcommand{\@mkidx}{\vbox to \z@{%
8081 \rlap{%
8082 \if@twocolumn
8083 \if@firstcolumn \@leftidx \else \@rightidx \fi
8084 \else
8085 \if@twoside
8086 \ifodd\c@page \@rightidx \else \@leftidx \fi
8087 \else
8088 \@rightidx
8089 \fi
8090 \fi
8091 \box\@indexbox
8092 }%
8093 \vss}}
8094
8095 \DeclareRobustCommand{\raggedbottom}{%
8096 \def\mem@flshbot{01}%
8097 \def\@textbottom{\vskip\z@ plus.0001fil}%
8098 \let\@texttop\@mkidx}
8099 \DeclareRobustCommand{\flushbottom}{%
8100 \def\mem@flshbot{00}%
8101 \let\@textbottom\relax
8102 \let\@texttop\@mkidx}
8103 \let\@texttop\@mkidx
8104 \flushbottom
8105
8106 \newcommand*{\sloppybottom}{%
8107 \def\mem@flshbot{01}%
8108 \def\@textbottom{\vskip \z@ \@plus.0001fil \@minus .95\topskip}%
8109 \topskip=1\topskip \@plus 0.625\topskip \@minus .95\topskip
8110 \def\@texttop{\vskip \z@ \@plus -0.625\topskip \@minus -0.95\topskip}}
8111
8112 \newif\ifonecolglossary
8113 \onecolglossarytrue
8114 \newcommand*{\onecolglossary}{\onecolglossarytrue}
8115 \newcommand*{\twocolglossary}{\onecolglossaryfalse}
8116
8117 \newenvironment{theglossary}{%
8118 \if@twocolumn
8119 \@restonecolfalse
8120 \else
8121 \@restonecoltrue
8122 \fi
8123 \ifonecolglossary
8124 \onecolumn
8125 \chapter*{\glossaryname}
8126 \preglossaryhook
8127 \else
8128 \setlength{\columnseprule}{\glossaryrule}
8129 \setlength{\columnsep}{\glossarycolsep}
8130 \MakeLinkTarget[chapter]{}%
8131 \twocolumn[%
8132 \@makeschapterhead{\glossaryname}
8133 \preglossaryhook
8134 ]%
8135 \fi
8136 \glossarymark
8137 \ifnoglossaryintoc\else
8138 %\phantomsection
8139 \addcontentsline{toc}{chapter}{\glossaryname}
8140 \fi
8141 \thispagestyle{chapter}\parindent\z@
8142 \parskip\z@ \@plus .3\p@\relax
8143 \begintheglossaryhook}%
8144 {\atendtheglossaryhook\if@restonecol\onecolumn\else\twocolumn\fi}
8145
8146 \newcommand*{\begintheglossaryhook}{}
8147 \newcommand*{\atendtheglossaryhook}{}
8148 \newcommand*{\preglossaryhook}{}
8149
8150 \newif\ifnoglossaryintoc
8151 \newcommand*{\glossaryintoc}{\noglossaryintocfalse}
8152 \newcommand*{\noglossaryintoc}{\noglossaryintoctrue}
8153 \glossaryintoc
8154
8155 \newdimen\glossarycolsep \glossarycolsep=35\p@
8156 \newdimen\glossaryrule \glossaryrule=0\p@
8157 \newcommand*{\glossaryspace}{%
8158 \par \vskip 1.0\onelineskip \@plus 5\p@ \@minus3\p@\relax}
8159
8160 \providecommand*{\makeglossary}{}
8161 \renewcommand*{\makeglossary}[1][\jobname]{%
8162 \makememglossaryhook
8163 \@namedef{memglsact#1}{@}% actual
8164 \@namedef{memglsnx#1}{}% no ref
8165 \@namedef{memglsn#1}{\thepage}% num by page
8166 \@namedef{memglsnf#1}{|memjustarg}% no special number format | emacs
8167 \if@filesw \expandafter\newwrite\csname #1memglofile\endcsname
8168 \expandafter\immediate\openout \csname #1memglofile\endcsname #1.glo\relax
8169 \typeout{Writing glossary file #1.glo }%
8170 \fi}
8171
8172 \newcommand*{\makememglossaryhook}{}
8173
8174 \def\glossary{\@bsphack%
8175 \@ifnextchar [{\@glossary}{\@glossary[\jobname]}}%
8176 \def\@glossary[#1]{%
8177 \@ifnextchar ({\@@glossary[#1]}{\@@glossary[#1]()}}
8178 \def\@@glossary[#1](#2)#3#4{%
8179 \@ifundefined{#1memglofile}{%
8180 \begingroup
8181 \@sanitize
8182 \endgroup
8183 \@esphack%
8184 }{%
8185 \def\memglofile{#1}%
8186 \begingroup
8187 \@sanitize
8188 \ifx\@empty#2\@empty
8189 \@wrglom@m{#3}{#3}{#4}%
8190 \else
8191 \@wrglom@m{#2}{#3}{#4}%
8192 \fi}}
8193
8194 \newcommand{\@wrglom@m}[3]{%
8195 \protected@write\@auxout{}%
8196 {\string\@@wrglom@m{\memglofile}{#1}{#2}{#3}{\@nameuse{memglsnx\memglofile}}{\@nameuse{memglsn\memglofile}}}%
8197 \endgroup
8198 \@esphack}
8199
8200 \newcommand{\@@wrglom@m}[1]{\begingroup
8201 \def\memglofile{\@nameuse{#1memglofile}}%
8202 \def\m@mgf{#1}%
8203 \@sanitize
8204 \memwritetoglo}
8205
8206 \newcommand{\memwritetoglo}[5]{\endgroup}
8207 \newcommand{\@ctualm@mwritetoglo}[5]{%
8208 %\immediate\write \memglofile%
8209 \immediate@protected@write\memglofile{}%
8210 {\string\glossaryentry{#1\@nameuse{memglsact\m@mgf}
8211 {\string\memgloterm{#2}}{\string\memglodesc{#3}}
8212 {\string\memgloref{#4}}\@nameuse{memglsnf\m@mgf}}{#5}}%
8213 \endgroup}
8214 \AtBeginDocument{%
8215 \let\memwritetoglo\@ctualm@mwritetoglo}
8216
8217 \newcommand*{\changeglossactual}[2][\jobname]{%
8218 \@namedef{memglsact#1}{#2}}
8219 \newcommand*{\changeglossref}[2][\jobname]{%
8220 \@namedef{memglsnx#1}{#2}}
8221 \newcommand*{\changeglossnum}[2][\jobname]{%
8222 \@namedef{memglsn#1}{#2}}
8223 \newcommand*{\changeglossnumformat}[2][\jobname]{%
8224 \@namedef{memglsnf#1}{#2}}
8225
8226 \newcommand{\glossitem}[4]{#1 #2 #3 #4\par}
8227
8228 \newcommand*{\memgloterm}[1]{#1}
8229 \newcommand*{\memglodesc}[1]{#1}
8230 \newcommand*{\memgloref}[1]{#1}
8231 \newcommand*{\memglonum}[1]{#1}
8232
8233 \newcommand*{\printglossary}[1][\jobname]{\@input@{#1.gls}}
8234
8235 \newcommand*{\m@msetm@argin}[1]{%
8236 \def\@tempa{#1}\def\@tempb{left}%
8237 \ifx\@tempa\@tempb
8238 \def\m@mm@argin{0}%
8239 \else
8240 \def\@tempb{right}%
8241 \ifx\@tempa\@tempb
8242 \def\m@mm@argin{1}%
8243 \else
8244 \def\@tempb{outer}%
8245 \ifx\@tempa\@tempb
8246 \def\m@mm@argin{2}%
8247 \else
8248 \def\@tempb{inner}%
8249 \ifx\@tempa\@tempb
8250 \def\m@mm@argin{3}%
8251 \else
8252 \def\m@mm@argin{-1}%
8253 \fi
8254 \fi
8255 \fi
8256 \fi}
8257
8258 \newif\ifmemtortm
8259 \memtortmtrue
8260 \newcommand*{\m@mwhich@margin}[1]{%
8261 \memtortmtrue
8262 \if@twocolumn
8263 \if@firstcolumn% left
8264 \memtortmfalse
8265 \else% right
8266 \memtortmtrue
8267 \fi
8268 \else
8269 \if@twoside
8270 \checkoddpage
8271 \ifcase #1\relax% 0 left
8272 \memtortmfalse
8273 \or% 1 right
8274 \memtortmtrue
8275 \or% 2 outer
8276 \ifoddpage
8277 \memtortmtrue
8278 \else
8279 \memtortmfalse
8280 \fi
8281 \or% 3 inner
8282 \ifoddpage
8283 \memtortmfalse
8284 \else
8285 \memtortmtrue
8286 \fi
8287 \fi% end ifcase
8288 \else% oneside
8289 \ifnum #1=\z@% 0 left, all else right
8290 \memtortmfalse
8291 \else
8292 \memtortmtrue
8293 \fi
8294 \fi% end if@twoside
8295 \fi}
8296
8297 \def\@addmarginpar{%
8298 \checkoddpage
8299 \@next\@marbox\@currlist{\@cons\@freelist\@marbox
8300 \@cons\@freelist\@currbox}\@latexbug\@tempcnta\@ne
8301 \if@twocolumn
8302 \if@firstcolumn \@tempcnta\m@ne \fi
8303 \else
8304 \ifm@msetmp%
8305 % \@tempcnta > 0 => right side of page
8306 % \@tempcnta < 0 => left side of page
8307 \m@mwhich@margin{\m@mmpar@margin}% set left or right margin
8308 \ifmemtortm%
8309 \@tempcnta\@ne\relax%
8310 \else%
8311 \@tempcnta\m@ne\relax%
8312 \fi%
8313 \else%
8314 \if@mparswitch
8315 \ifoddpage \else \@tempcnta\m@ne \fi%
8316 \fi%
8317 \if@reversemargin \@tempcnta -\@tempcnta \fi%
8318 \fi%
8319 \fi%
8320 \ifnum\@tempcnta <\z@ \global\setbox\@marbox\box\@currbox \fi
8321 \@tempdima\@mparbottom
8322 \advance\@tempdima -\@pageht
8323 \advance\@tempdima\ht\@marbox
8324 \ifdim\@tempdima >\z@
8325 \@latex@warning@no@line {Marginpar on page
8326 \thepage\space moved by \the\@tempdima}%
8327 \else
8328 \@tempdima\z@
8329 \fi
8330 \global\@mparbottom\@pageht
8331 \global\advance\@mparbottom\@tempdima
8332 \global\advance\@mparbottom\dp\@marbox
8333 \global\advance\@mparbottom\marginparpush
8334 \advance\@tempdima -\ht\@marbox
8335 \global\setbox \@marbox
8336 \vbox {\vskip \@tempdima
8337 \box \@marbox}%
8338 \global \ht\@marbox \z@
8339 \global \dp\@marbox \z@
8340 \kern -\@pagedp
8341 \nointerlineskip
8342 \hb@xt@\columnwidth
8343 {\ifnum \@tempcnta >\z@
8344 \hskip\columnwidth \hskip\marginparsep
8345 \else
8346 \hskip -\marginparsep \hskip -\marginparwidth
8347 \fi
8348 \box\@marbox \hss}%
8349 \nointerlineskip
8350 \hbox{\vrule \@height\z@ \@width\z@ \@depth\@pagedp}%
8351 }
8352
8353 \newif\ifm@msetmp
8354 \m@msetmpfalse
8355 \newcommand*{\marginparmargin}[1]{%
8356 \m@msetmptrue
8357 \m@msetm@argin{#1}%
8358 \ifnum\m@mm@argin<\z@
8359 \@memwarn{Bad \string\marginparmargin\space argument `#1'\MessageBreak
8360 set to `outer'}%
8361 \gdef\m@mmpar@margin{2}% set as outer
8362 \else
8363 \global\let\m@mmpar@margin\m@mm@argin
8364 \fi
8365 \setmpbools}
8366
8367 \if@twocolumn\else
8368 \if@twoside
8369 \def\m@mmpar@margin{2}
8370 \else
8371 \def\m@mmpar@margin{1}
8372 \fi
8373 \fi
8374
8375 \newcommand*{\setmpbools}{%
8376 \if@twoside
8377 \@mparswitchtrue
8378 \else
8379 \@mparswitchfalse
8380 \fi
8381 \ifcase\m@mmpar@margin\relax% 0 left
8382 \@reversemargintrue% \sideparswitchfalse \reversesidepartrue
8383 \or% 1 right
8384 \@reversemarginfalse% \sideparswitchfalse \reversesideparfalse
8385 \or% 2 outer
8386 \@reversemarginfalse% \sideparswitchtrue \reversesideparfalse
8387 \or% 3 inner
8388 \@reversemargintrue% \sideparswitchtrue \reversesidepartrue
8389 \fi}
8390
8391 \newcommand*{\m@msetmpcodes}{%
8392 \if@mparswitch% 2 sided
8393 \if@reversemargin% inner
8394 \def\m@mmpar@margin{3}%
8395 \else% outer
8396 \def\m@mmpar@margin{2}%
8397 \fi
8398 \else% 1 sided
8399 \if@reversemargin% left
8400 \def\m@mmpar@margin{0}%
8401 \else% right
8402 \def\m@mmpar@margin{1}%
8403 \fi
8404 \fi}
8405
8406 \newcommand*{\parnopar}{{\parfillskip=0pt\par\parskip=0pt\noindent}}
8407
8408 \newif\ifreversesidepar
8409 \reversesidepartrue
8410 \newif\ifsideparswitch
8411 \sideparswitchfalse
8412 \if@twoside \sideparswitchtrue \fi
8413
8414 %% true if \sideparmargin used
8415 \newif\ifm@msetsp
8416 \m@msetspfalse
8417 \newcommand*{\sideparmargin}[1]{%
8418 \m@msetsptrue
8419 \m@msetm@argin{#1}%
8420 \ifnum\m@mm@argin<\z@
8421 \@memwarn{Bad \string\sideparmargin\space argument `#1'\MessageBreak
8422 set to `outer'}%
8423 \gdef\m@mspar@margin{2}% set as outer
8424 \else
8425 \global\let\m@mspar@margin\m@mm@argin
8426 \fi}
8427
8428 \newcommand*{\m@msidepar@left}{%
8429 \@tempdimc\marginparwidth
8430 \advance\@tempdimc\marginparsep
8431 \kern-\@tempdimc}
8432 \newcommand*{\m@msidepar@right}{%
8433 \@tempdimc\columnwidth
8434 \advance\@tempdimc\marginparsep
8435 \kern\@tempdimc}
8436
8437 \newcommand*{\setspbools}{%
8438 \ifcase\m@mspar@margin\relax% 0 left
8439 \sideparswitchfalse \reversesidepartrue
8440 \or% 1 right
8441 \sideparswitchfalse \reversesideparfalse
8442 \or% 2 outer
8443 \sideparswitchtrue \reversesideparfalse
8444 \or% 3 inner
8445 \sideparswitchtrue \reversesidepartrue
8446 \fi}
8447
8448 \newcommand*{\setspcode}{%
8449 \ifsideparswitch
8450 \ifreversesidepar
8451 \def\m@mspar@margin{3}% inner
8452 \else
8453 \def\m@mspar@margin{2}% outer
8454 \fi
8455 \else
8456 \ifreversesidepar
8457 \def\m@mspar@margin{0}% left
8458 \else
8459 \def\m@mspar@margin{1}% right
8460 \fi
8461 \fi}
8462
8463 \newcommand*{\sideparfont}{\normalfont\normalsize}
8464 \newcommand*{\sideparform}{\ifmemtortm\raggedright\else\raggedleft\fi}
8465
8466 \newcommand{\sidepar}{\@dblarg{\@sidepar}}
8467 \long\def\@sidepar[#1]#2{\leavevmode\@bsphack\strut\vadjust{%
8468 \checkoddpage
8469 \ifm@msetsp% \sideparmargin used
8470 %%%% \setspbools
8471 \else% \sideparmargin not used, set the \m@mspar@margin code
8472 \setspcode
8473 \fi
8474 \rlap{\kern-\parindent
8475 \m@mwhich@margin{\m@mspar@margin}% set left or right margin
8476 \ifmemtortm
8477 \m@msidepar@right
8478 \else
8479 \m@msidepar@left
8480 \fi
8481 \setbox0=\vtop to 0pt{%
8482 \begin{minipage}[t]{\marginparwidth}%
8483 \def\baselinestretch{\m@m@footnote@spacing}%
8484 \sideparform\sideparfont%
8485 \ifmemtortm #2\else #1\fi
8486 \end{minipage}%
8487 \vss}%
8488 \vtop to 0pt{\kern\sideparvshift% default should be 0pt
8489 \kern-\dp\strutbox
8490 \kern-\ht0
8491 \box0 \vss}}}%
8492 \@esphack}
8493
8494 \newlength{\sideparvshift}
8495 \setlength{\sideparvshift}{0pt}
8496 %%%% \setlength{\sideparvshift}{-2.08ex}% seems to work for all font sizes
8497
8498 \newinsert\sideins
8499 \skip\sideins=0pt
8500 \count\sideins=0
8501
8502 \newlength{\sidebartopsep}
8503 \setlength{\sidebartopsep}{0pt}
8504 \newcommand{\setsidebarheight}[1]{%
8505 \setlength{\dimen\sideins}{#1}%
8506 \advance\dimen\sideins-\topskip
8507 \advance\dimen\sideins\ht\strutbox}
8508
8509 \newlength{\sidebarhsep}
8510 \newlength{\sidebarvsep}
8511 \newlength{\sidebarwidth}
8512 \newcommand{\sidebarfont}{\normalfont\normalsize}
8513 \newcommand*{\setsidebars}[6]{%
8514 \nametest{#1}{*}\ifsamename\else
8515 \setlength{\sidebarhsep}{#1}\@memznegtest{\sidebarhsep}%
8516 \fi
8517 \nametest{#2}{*}\ifsamename\else
8518 \setlength{\sidebarwidth}{#2}\@memznegtest{\sidebarwidth}%
8519 \fi
8520 \nametest{#3}{*}\ifsamename\else
8521 \setlength{\sidebarvsep}{#3}\@memnegtest{\sidebarvsep}%
8522 \fi
8523 \nametest{#4}{*}\ifsamename\else
8524 \setlength{\sidebartopsep}{#4}%
8525 \fi
8526 \nametest{#5}{*}\ifsamename\else
8527 \def\sidebarfont{#5}%
8528 \fi
8529 \nametest{#6}{*}\ifsamename\else
8530 \setsidebarheight{#6}%
8531 \ifdim\dimen\sideins>\z@\else
8532 %%%% \@memerror{\protect\sidebarheight\space is zero or negative}{\@ehd}%
8533 \@memwarn{\protect\sidebarheight\space is zero or negative}%
8534 \fi
8535 \fi}
8536 \setsidebars{\marginparsep}% sidebarhsep
8537 {\marginparwidth}% sidebarwidth
8538 {\onelineskip}% sidebarvsep
8539 {0pt}% sidebartopsep
8540 {\normalsize\normalfont}% sidebarfont
8541 {\textheight}% sidebarheight
8542
8543 \newcommand{\sidebarform}{%\rightskip=\z@ \@plus 2em}
8544 %\memRTLrightskip=\z@ \@plus 2em
8545 \ifmemtortm\raggedright\else\raggedleft\fi%
8546 % \ifmemtortm\memRTLrightskip=\z@ \@plus 2em\else\memRTLleftskip=\z@ \@plus 2em\fi
8547 }
8548
8549 \newif\ifsidebaroneside
8550 \if@twoside\sidebaronesidefalse\else\sidebaronesidetrue\fi
8551
8552 \newcommand*{\sidebarmargin}[1]{%
8553 \m@msetm@argin{#1}%
8554 \ifnum\m@mm@argin<\z@
8555 \@memwarn{Bad \string\sidebarmargin\space argument `#1'\MessageBreak
8556 set to `outer'}%
8557 \gdef\m@msidebar@margin{2}% set as outer
8558 \else
8559 \global\let\m@msidebar@margin\m@mm@argin
8560 \fi}
8561 %%%% default outer
8562 \gdef\m@msidebar@margin{2}
8563 \newcommand*{\m@sideb@left}{%
8564 \@tempdimc \sidebarwidth
8565 \advance\@tempdimc\sidebarhsep
8566 \kern-\@tempdimc}
8567 \newcommand*{\m@sideb@right}{%
8568 \@tempdimc \columnwidth% or \hsize
8569 \advance\@tempdimc\sidebarhsep
8570 \kern\@tempdimc}
8571
8572 \newcommand{\sidecontents}{\hbox to \z@{%
8573 \m@mwhich@margin{\m@msidebar@margin}%
8574 \ifmemtortm
8575 \m@sideb@right
8576 \else
8577 \m@sideb@left
8578 \fi
8579 \vtop to0pt{%
8580 \normalsize\normalfont\sidebarfont% select font so we know the strut size
8581 \vskip\topskip \vskip-\ht\strutbox
8582 \vskip\sidebartopsep% extra vertical shift
8583 \unvbox\sideins \vss}%
8584 \hss}}
8585
8586 \newcommand{\sidebar}[1]{%
8587 \insert\sideins{%
8588 \hsize\sidebarwidth
8589 \@parboxrestore
8590 \def\baselinestretch{\m@m@footnote@spacing}%
8591 \m@mwhich@margin{\m@msidebar@margin}%
8592 \sidebarform\sidebarfont
8593 \splittopskip=\ht\strutbox
8594 \splitmaxdepth=\dp\strutbox % doesn't do anything useful
8595 \allowbreak
8596 \prevdepth=\dp\strutbox % supersedes a "top-strut"
8597 \vskip-\parskip
8598 #1%
8599 \ifvmode\else
8600 \unskip\@finalstrut\strutbox
8601 \fi\par
8602 \ifdim\prevdepth>\dp\strutbox \prevdepth=\dp\strutbox \fi
8603 \ifdim\prevdepth>99\p@
8604 \nobreak
8605 \vskip-\prevdepth
8606 \allowbreak
8607 \vskip\dp\strutbox
8608 \fi
8609 \vskip\sidebarvsep}}
8610
8611 \renewcommand{\footnoterule}{%
8612 \kern-3\p@
8613 \normalcolor% added 2013/05/08
8614 \hrule width .4\columnwidth
8615 \kern 2.6\p@}
8616 \skip\footins=\bigskipamount
8617 \@addtoreset{footnote}{chapter}
8618 \newcommand*{\multfootsep}{\textsuperscript{\normalfont,}}
8619 \newcommand*{\multiplefootnotemarker}{3sp}
8620 \newcommand*{\m@mmf@prepare}{%
8621 \kern-\multiplefootnotemarker
8622 \kern\multiplefootnotemarker\relax}
8623 \newcommand*{\m@mmf@check}{%
8624 \ifdim\lastkern=\multiplefootnotemarker\relax
8625 \edef\@x@sf{\the\spacefactor}%
8626 \unkern
8627 \multfootsep
8628 \spacefactor\@x@sf\relax
8629 \fi}
8630
8631 \renewcommand*{\@footnotemark}{%
8632 \leavevmode
8633 \ifhmode
8634 \edef\@x@sf{\the\spacefactor}%
8635 \m@mmf@check
8636 \nobreak
8637 \fi
8638 \@makefnmark
8639 \m@mmf@prepare
8640 \ifhmode\spacefactor\@x@sf\fi
8641 \relax}
8642
8643 \newcommand{\mem@pn@multiple@marker}[1]{%
8644 \leavevmode
8645 \ifhmode
8646 \edef\@x@sf{\the\spacefactor}%
8647 \m@mmf@check
8648 \nobreak
8649 \fi
8650 \@nameuse{mem@pnmm@start@hook}%
8651 #1%
8652 \@nameuse{mem@pnmm@end@hook}%
8653 \m@mmf@prepare
8654 \ifhmode\spacefactor\@x@sf\fi
8655 \relax}
8656
8657 \newlength{\footmarkwidth}
8658 \newlength{\footmarksep}
8659 \newlength{\footparindent}
8660 \newcommand*{\footmarkstyle}[1]{\def\footscript##1{#1}}
8661 \newcommand{\makefootmarkhook}{}
8662
8663 \newcommand{\footfootmark}{%
8664 \ifdim\footmarkwidth < \z@
8665 \llap{\hb@xt@ -\footmarkwidth{%
8666 \hss\normalfont\footscript{\@thefnmark}}%
8667 \hspace*{-\footmarkwidth}}%
8668 \else
8669 \ifdim\footmarkwidth = \z@
8670 {\normalfont\footscript{\@thefnmark}}%
8671 \else
8672 \hb@xt@\footmarkwidth{\hss\normalfont\footscript{\@thefnmark}}%
8673 \fi
8674 \fi}
8675
8676 \newcommand{\makefootmark}[1]{%
8677 \leavevmode
8678 \parindent \footparindent\noindent
8679 \leftskip\footmarksep\relax
8680 \advance\leftskip \footmarkwidth \null\nobreak\hskip -\leftskip\relax
8681 \makefootmarkhook\relax
8682 \footfootmark #1}
8683 \newcommand{\@makefntext}[1]{\makefootmark #1}
8684 \footmarkstyle{\textsuperscript{#1}}
8685 \setlength{\footmarkwidth}{1.8em}
8686 \setlength{\footmarksep}{-1.8em}
8687 \setlength{\footparindent}{1em}
8688
8689 \providecommand{\footref}[1]{%
8690 \begingroup
8691 \unrestored@protected@xdef\@thefnmark{\ref{#1}}%
8692 \endgroup
8693 \@footnotemark}
8694
8695 \def\verbfootnote{\@ifnextchar[\@xverbfootnote{\stepcounter\@mpfn
8696 \protected@xdef\@thefnmark{\thempfn}%
8697 \@footnotemark\@verbfootnotetext}}
8698
8699 \def\@xverbfootnote[#1]{%
8700 \begingroup
8701 \csname c@\@mpfn\endcsname #1\relax
8702 \unrestored@protected@xdef\@thefnmark{\thempfn}%
8703 \endgroup
8704 \@footnotemark\@verbfootnotetext}
8705
8706 \long\def\@verbfootnotetext{%
8707 \insert\footins\bgroup
8708 \foottextfont%
8709 \interlinepenalty\interfootnotelinepenalty
8710 \splittopskip\footnotesep
8711 \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
8712 \hsize\columnwidth \@parboxrestore
8713 \def\@currentcounter{footnote}%
8714 \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}%
8715 %%%% \color@begingroup
8716 \@makefntext{\rule{\z@}{\footnotesep}\ignorespaces}%
8717 \futurelet\next\fo@t
8718 }
8719 \def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
8720 \else \let\next\f@t\fi \next}
8721 \def\f@@t{\bgroup\aftergroup\@foot\let\next}
8722 \def\f@t#1{%
8723 \color@begingroup
8724 #1\@foot
8725 \color@endgroup}
8726 \def\@foot{%
8727 \strut\egroup
8728 %%%% \color@endgroup
8729 \m@mmf@prepare
8730 }
8731
8732 \long\def\@verbmpfootnotetext{%
8733 \global\setbox\@mpfootins\vbox{%
8734 \reset@font\foottextfont
8735 \unvbox\@mpfootins
8736 \bgroup
8737 \hsize\columnwidth
8738 \@parboxrestore
8739 \def\@currentcounter{mpfootnote}%
8740 \edef\@currentlabel{\csname p@mpfootnote\endcsname\@thefnmark}%
8741 \color@begingroup
8742 \@makefntext{\rule{\z@}{\footnotesep}\ignorespaces}%
8743 }
8744 \futurelet\next\fo@t
8745 }
8746
8747 %%%%%%%%%%%%%% major extension to footnoting
8748
8749 \newcommand*{\setfootnoterule}[4][]{%
8750 \def\footnoterule{\kern -#2\relax #1\relax
8751 \normalcolor% added 2013/05/08
8752 \hrule width #3\relax
8753 \kern #2\kern-#4}}
8754 \setfootnoterule{3pt}{0.4\columnwidth}{\normalrulethickness}
8755
8756 \newcommand{\m@mdoextrafeet}{\extrafeetins}
8757 \newcommand*{\extrafeetins}{%
8758 \setbox\@outputbox \vbox{%
8759 \boxmaxdepth \@maxdepth
8760 \unvbox\@outputbox
8761 \ifvoid\footinsv@r\else\@footstartv@r\@footgroupv@r\fi
8762 \extrafeetinshook}}
8763 \newcommand{\extrafeetinshook}{}
8764
8765 \newcommand{\m@mdodoreinextrafeet}{%
8766 \ifvoid\footinsv@r\else\insert\footinsv@r{\unvbox\footinsv@r}\fi
8767 \extrafeetreinshook}
8768 \newcommand{\extrafeetreinshook}{}
8769
8770 \newcommand{\foottextfont}{\footnotesize}
8771 \newlength{\footinsdim}
8772 \setlength{\footinsdim}{8in} % standard for \dimen\footins
8773 \newcommand{\@preamfntext}{%
8774 \interlinepenalty\interfootnotelinepenalty
8775 \floatingpenalty \@MM
8776 \splittopskip=\footnotesep
8777 \splitmaxdepth=\dp\strutbox
8778 \@parboxrestore}
8779
8780 \renewcommand{\@mpfootnotetext}[1]{%
8781 \global\setbox\@mpfootins\vbox{%
8782 \unvbox\@mpfootins
8783 \def\baselinestretch{\m@m@footnote@spacing}%
8784 \foottextfont \hsize\columnwidth \@parboxrestore
8785 \def\@currentcounter{mpfootnote}%
8786 \protected@edef\@currentlabel{%
8787 \csname p@mpfootnote\endcsname\@thefnmark}%
8788 \color@begingroup
8789 \reset@font%
8790 \@makefntext{%
8791 \rule\z@\footnotesep\ignorespaces\foottextfont #1%
8792 \@finalstrut\strutbox}%
8793 \color@endgroup}}
8794
8795 \let\@plainmpfootnotetext\@mpfootnotetext
8796
8797 \newcommand{\m@mdoextrafeetmini}{%
8798 \extrafeetminihook}
8799 \newcommand{\extrafeetminihook}{}
8800 %%%%\renewcommand{\@minipagerestore}{\m@mdoextrafeetmini}
8801
8802 \newcommand{\extrafeetendmini}{%
8803 \ifvoid\@mpfootinsv@r\else
8804 \vskip\skip\@mpfootins
8805 \normalcolor\footnoterule\mp@footgroupv@r
8806 \fi
8807 \extrafeetendminihook}
8808 \newcommand{\extrafeetendminihook}{}
8809
8810 \newcommand{\m@mdoextrafeetendmini}{\extrafeetendmini}
8811 \def\endminipage{%
8812 \par
8813 \unskip
8814 \ifvoid\@mpfootins\else
8815 \vskip\skip\@mpfootins
8816 \normalcolor
8817 \footnoterule
8818 \unvbox\@mpfootins
8819 \fi
8820 \m@mdoextrafeetendmini
8821 \@minipagefalse
8822 \color@endgroup
8823 \egroup
8824 \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}}
8825
8826 \newcommand{\plainfootnotes}{%
8827 \let\@footnotetext\@plainfootnotetext
8828 \let\@mpfootnotetext\@plainmpfootnotetext}
8829
8830 \newcommand{\newfootnoteseries}[1]{%
8831 \expandafter\newinsert\csname footins#1\endcsname% -> \footins#1
8832 \expandafter\skip\csname footins#1\endcsname \bigskipamount%
8833 %%% - > \skip\footins#1 % [RS]
8834 \newcounter{footnote#1}% -> \c@footnote#1
8835 \@nameuse{c@footnote#1} \z@% -> \c@footnote#1=0
8836 \global\@namelet{p@footnote#1} \@empty% -> \p@footnote#1
8837 \@namedef{thefootnote#1}{\arabic{footnote#1}}% -> \thefootnote#1
8838 \@namedef{foottextfont#1}{\foottextfont}% -> \foottextfont#1
8839 \m@makefootnote{#1}% -> \footnote#1
8840 \m@make@xfootnote{#1}% -> \@xfootnote#1
8841 \m@make@footnotetext{#1}% -> \@footnotetext#1
8842 \m@makefootnotemark{#1}% -> \footnotemark#1
8843 \m@make@xfootnotemark{#1}% -> \@xfootnotemark#1
8844 \m@make@footnotemark{#1}% -> \@footnotemark#1
8845 \m@makefootnotetext{#1}% -> \footnotetext#1
8846 \m@make@xfootnotenext{#1}% -> \@xfootnotenext#1
8847 \m@make@mpfn{#1}% -> \@mpfn#1
8848 \m@makethempfn{#1}% -> \thempfn#1
8849 \m@make@makefnmark{#1}% -> \@makefnmark#1
8850 \m@makefootref{#1}% -> \footref#1
8851 \m@makefootfootmark{#1}% -> \footfootmark#1
8852 \m@makemakefootmark{#1}% -> \makefootmark#1
8853 \m@makefootmarkstyle{#1}% -> \footmarkstyle#1
8854 \@namelongdef{@makefntext#1}##1{\@nameuse{makefootmark#1} ##1}%
8855 \m@make@footstart{#1}% -> \@footstart#1
8856 \m@make@footgroup{#1}% -> \@footgroup#1
8857 \expandafter\newinsert\csname @mpfootins#1\endcsname% -> \@mpfootins#1
8858 \newcounter{mpfootnote#1}% -> \c@mpfootnote#1
8859 \global\@namelet{p@mpfootnote#1}\@empty
8860 \@namedef{thempfootnote#1}{\itshape\alph{mpfootnote#1}}%
8861 \m@make@mpfootnotetext{#1}% -> \@mpfootnotetext#1
8862 \ifartopt\else% [RS]
8863 \expandafter\@cons\csname cl@chapter\endcsname {{footnote#1}}%
8864 \fi
8865 \g@addto@macro{\extrafeetinshook}{%
8866 \ifvoid\@nameuse{footins#1}\else
8867 \@nameuse{@footstart#1}\@nameuse{@footgroup#1}\fi}
8868 \g@addto@macro{\extrafeetreinshook}{%
8869 \ifvoid\@nameuse{footins#1}\else
8870 \insert\@nameuse{footins#1}{\unvbox\@nameuse{footins#1}}\fi}
8871 \g@addto@macro{\extrafeetendminihook}{%
8872 \ifvoid\@nameuse{@mpfootins#1}\else
8873 \vskip\skip\@mpfootins
8874 \normalcolor\footnoterule\@nameuse{mp@footgroup#1}\fi}
8875 \g@addto@macro{\extrafeetminihook}{%
8876 \@namedef{@mpfn#1}{mpfootnote#1}
8877 \@namedef{thempfn#1}{\@nameuse{thempfootnote#1}}
8878 \csname c@mpfootnote#1\endcsname\z@
8879 \expandafter\let\expandafter\@t@mp \csname @mpfootnotetext#1\endcsname
8880 \expandafter\let \csname @footnotetext#1\endcsname \@t@mp}
8881 \g@addto@macro{\@mem@extranofeet}{% % [RS]
8882 \ifvoid\@nameuse{footins#1}\else\@mem@nofootfalse\fi}
8883 \plainfootstyle{#1}%
8884 }
8885
8886 \newcommand{\m@makefootnote}[1]{
8887 \@namedef{footnote#1}{\@ifnextchar[
8888 {\@nameuse{@xfootnote#1}}{%\advance \@nameuse{c@\@mpfn#1} by \@ne
8889 \stepcounter{\@mpfn#1}%
8890 \@name@p@xdef{@thefnmark#1}{\@nameuse{thempfn#1}}%
8891 \@nameuse{@footnotemark#1}\@nameuse{@footnotetext#1}}}}
8892
8893 \newcommand{\m@make@xfootnote}[1]{
8894 \@namedef{@xfootnote#1}[##1]{%
8895 \begingroup
8896 \csname c@\@mpfn#1\endcsname ##1\relax
8897 \@name@unresp@xdef{@thefnmark#1}{\@nameuse{thempfn#1}}%
8898 \endgroup
8899 \@nameuse{@footnotemark#1}\@nameuse{@footnotetext#1}}}
8900
8901 \newcommand{\m@make@footnotetext}[1]{%
8902 \@namelongdef{@footnotetext#1}##1{%
8903 \insert\@nameuse{footins#1}{%
8904 \def\baselinestretch{\m@m@footnote@spacing}%
8905 \reset@font\@nameuse{foottextfont#1}%
8906 \@preamfntext
8907 \hsize\columnwidth
8908 \def\@currentcounter{footnote}%
8909 \protected@edef\@currentlabel{%
8910 \csname p@footnote#1\endcsname\@nameuse{@thefnmark#1}}%
8911 \color@begingroup
8912 \@nameuse{@makefntext#1}{%
8913 \rule\z@\footnotesep\ignorespaces\@nameuse{foottextfont#1}##1%
8914 \@finalstrut\strutbox}%
8915 \color@endgroup}%
8916 \m@mmf@prepare}%
8917 }
8918
8919 \newcommand{\m@make@mpfootnotetext}[1]{%
8920 \@namelongdef{@mpfootnotetext#1}##1{%
8921 \global\setbox\@nameuse{@mpfootins#1}\vbox{%
8922 \unvbox\@nameuse{@mpfootins#1}%
8923 \def\baselinestretch{\m@m@footnote@spacing}%
8924 \reset@font\@nameuse{foottextfont#1}%
8925 \hsize\columnwidth \@parboxrestore
8926 \def\@currentcounter{mpfootnote}%
8927 \protected@edef\@currentlabel{%
8928 \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
8929 \color@begingroup
8930 \@nameuse{@makefntext#1}{%
8931 \rule\z@\footnotesep\ignorespaces\@nameuse{foottextfont#1}##1%
8932 \@finalstrut\strutbox}%
8933 \color@endgroup}%
8934 \m@mmf@prepare}}
8935
8936 \newcommand{\m@makefootnotemark}[1]{
8937 \@namedef{footnotemark#1}{%
8938 \@ifnextchar[ {\@nameuse{@xfootnotemark#1}}
8939 {%\advance\@nameuse{c@footnote#1} by \@ne%
8940 \stepcounter{footnote#1}%
8941 \@name@p@xdef{@thefnmark#1}{\@nameuse{thefootnote#1}}%
8942 \@nameuse{@footnotemark#1}}}}
8943
8944 \newcommand{\m@make@xfootnotemark}[1]{%
8945 \@namedef{@xfootnotemark#1}[##1]{%
8946 \begingroup
8947 \@nameuse{c@footnote#1} ##1\relax
8948 \@name@unresp@xdef{@thefnmark#1}{\@nameuse{thefootnote#1}}%
8949 \endgroup
8950 \@nameuse{@footnotemark#1}}}
8951
8952 \newcommand{\m@make@footnotemark}[1]{%
8953 \@namedef{@footnotemark#1}{%
8954 \leavevmode
8955 \ifhmode
8956 \edef\@x@sf{\the\spacefactor}%
8957 \m@mmf@check
8958 \nobreak
8959 \fi
8960 \@nameuse{@makefnmark#1}%
8961 \m@mmf@prepare
8962 \ifhmode\spacefactor\@x@sf\fi
8963 \relax}}
8964
8965 \newcommand{\m@makefootmarkstyle}[1]{%
8966 \@namedef{footmarkstyle#1}##1{%
8967 \@namedef{footscript#1}####1{##1}}}
8968
8969 \newcommand{\m@makefootnotetext}[1]{%
8970 \@namedef{footnotetext#1}{%
8971 \@ifnextchar[ {\@nameuse{@xfootnotenext#1}}%
8972 {\@name@p@xdef{@thefnmark#1}{\@nameuse{thempfn#1}}%
8973 \@nameuse{@footnotetext#1}}}}
8974
8975 \newcommand{\m@make@xfootnotenext}[1]{
8976 \@namedef{@xfootnotenext#1}[##1]{%
8977 \begingroup
8978 \csname c@\@mpfn#1\endcsname ##1\relax
8979 \@name@unresp@xdef{@thefnmark#1}{\@nameuse{thempfn#1}}%
8980 \endgroup
8981 \@nameuse{@footnotetext#1}}}
8982
8983 \newcommand{\m@make@mpfn}[1]{%
8984 \@namedef{@mpfn#1}{\@nameuse{footnote#1}}}
8985
8986 \newcommand{\m@makethempfn}[1]{%
8987 \@namedef{thempfn#1}{\@nameuse{thefootnote#1}}}
8988
8989 \newcommand{\m@make@makefnmark}[1]{%
8990 \@namedef{@makefnmark#1}{%
8991 \hbox{\@textsuperscript{\normalfont\@nameuse{@thefnmark#1}}}}}
8992
8993 \newcommand{\m@makefootref}[1]{%
8994 \@namedef{footref#1}##1{%
8995 \begingroup
8996 \@name@unresp@xdef{@thefnmark#1}{\ref{##1}}%
8997 \endgroup
8998 \@nameuse{@footnotemark#1}}}
8999
9000 \newcommand{\m@makefootfootmark}[1]{%
9001 \@namedef{footfootmark#1}{%
9002 \ifdim\footmarkwidth < \z@
9003 \llap{\hb@xt@ -\footmarkwidth{%
9004 \hss\normalfont\@nameuse{footscript#1}%
9005 {\@nameuse{@thefnmark#1}}}%
9006 \hspace*{-\footmarkwidth}}%
9007 \else
9008 \ifdim\footmarkwidth = \z@
9009 {\normalfont\@nameuse{footscript#1}{\@nameuse{@thefnmark#1}}}%
9010 \else
9011 \hb@xt@\footmarkwidth{%
9012 \hss\normalfont\@nameuse{footscript#1}%
9013 {\@nameuse{@thefnmark#1}}}%
9014 \fi
9015 \fi}}
9016
9017 \newcommand{\m@makemakefootmark}[1]{%
9018 \@namedef{makefootmark#1}##1{%
9019 \leavevmode
9020 \parindent \footparindent\noindent
9021 \leftskip\footmarksep\relax
9022 \advance\leftskip \footmarkwidth
9023 \null\nobreak\hskip -\leftskip\relax
9024 \makefootmarkhook\relax
9025 \@nameuse{footfootmark#1}##1}}
9026
9027 \newcommand{\m@make@footgroup}[1]{%
9028 \@namedef{@footgroup#1}{\unvbox\@nameuse{footins#1}}}
9029
9030 \newcommand{\m@makemp@footgroup}[1]{%
9031 \@namedef{mp@footgroup#1}{\unvbox\@nameuse{@mpfootins#1}}}
9032
9033 \newcommand{\m@make@footstart}[1]{%
9034 \@namedef{@footstart#1}{%
9035 %\vskip\bigskipamount
9036 \mem@if@flushbottomF\m@mopfn@bottom
9037 \vskip\skip\csname footins#1\endcsname
9038 \leftskip=\z@
9039 \rightskip=\z@
9040 \footnoterule}}
9041
9042 \newcommand{\plainfootstyle}[1]{%
9043 \m@make@footnotetext{#1}%
9044 \m@make@footgroup{#1}%
9045 \m@make@footstart{#1}%
9046 \m@make@mpfootnotetext{#1}%
9047 \m@makemp@footgroup{#1}%
9048 \@nameuse{footmarkstyle#1}{\textsuperscript{##1}}
9049 \expandafter\dimen\csname footins#1\endcsname=\footinsdim
9050 \expandafter\count\csname footins#1\endcsname=1000\relax}
9051
9052 \newinsert\footinsv@r
9053 \skip\footinsv@r\bigskipamount
9054 \count\footinsv@r=1000 % no magnifcation
9055 \dimen\footinsv@r=\footinsdim
9056 \m@make@footstart{v@r}
9057 \newcommand{\@footgroupv@r}{}
9058
9059 \newinsert\@mpfootinsv@r
9060 \newcommand{\mp@footgroupv@r}{}
9061
9062 \newcount\m@m@k \newdimen\m@m@h
9063 \newcommand*{\m@mrigidbalance}[3]{\setbox0=\box#1 \m@m@k=#2 \m@m@h=#3
9064 \@@line{\splittopskip=\m@m@h \vbadness=\@M \hfilneg
9065 \valign{##\vfill\cr\m@mdosplits}}}
9066 \newcommand*{\m@mdosplits}{\ifnum\m@m@k>0 \noalign{\hfil}\m@msplitoff
9067 \global\advance\m@m@k-1\cr\m@mdosplits\fi}
9068 \newcommand*{\m@msplitoff}{\dimen0=\ht0
9069 \divide\dimen0 by\m@m@k \advance\dimen0 by\m@m@h
9070 \setbox2 \vsplit0 to \dimen0
9071 \unvbox2 }
9072
9073 \newcommand{\twocolumnfootnotes}{%
9074 \@namedef{foottextfontv@r}{\foottextfont}% % [RS]
9075 \let\@footnotetext\@twocolfootnotetext
9076 \dimen\footinsv@r=2\footinsdim
9077 \count\footinsv@r=500\relax
9078 \m@make@twocol@footgroup{v@r}%
9079 \let\@footgroupv@r\@twocol@footgroupv@r
9080 \let\@mpfootnotetext\@mptwocolfootnotetext
9081 \m@make@mptwocol@footgroup{v@r}%
9082 \let\mp@footgroupv@r\@mptwocol@footgroupv@r}
9083
9084 \newcommand{\@twocolfootnotetext}[1]{\insert\footinsv@r{%
9085 \def\baselinestretch{\m@m@footnote@spacing}%
9086 \reset@font\foottextfont
9087 \@preamfntext
9088 \def\@currentcounter{footnote}%
9089 \protected@edef\@currentlabel{%
9090 \csname p@footnote\endcsname\@thefnmark}%
9091 \color@begingroup
9092 \@twocolfootfmt{#1}%
9093 \color@endgroup}%
9094 \m@mmf@prepare}
9095
9096 \newcommand{\@preamtwofmt}{%
9097 \hsize .45\hsize
9098 \parindent=\z@
9099 \tolerance=5000\relax
9100 \raggedright
9101 \leavevmode}
9102
9103 \newcommand{\@twocolfootfmt}[1]{%
9104 \@preamtwofmt
9105 {\footfootmark\strut \foottextfont #1\strut\par}\allowbreak}
9106
9107 \newcommand{\@mptwocolfootnotetext}[1]{%
9108 \global\setbox\@mpfootinsv@r\vbox{%
9109 \unvbox\@mpfootinsv@r
9110 \def\baselinestretch{\m@m@footnote@spacing}%
9111 \reset@font\foottextfont
9112 \hsize\columnwidth \@parboxrestore
9113 \def\@currentcounter{mpfootnote}%
9114 \protected@edef\@currentlabel{%
9115 \csname p@mpfootnote\endcsname\@thefnmark}%
9116 \color@begingroup
9117 \@twocolfootfmt{#1}%
9118 \color@endgroup}%
9119 \m@mmf@prepare}
9120
9121 \newcommand{\twocolumnfootstyle}[1]{%
9122 \m@make@twocolfootnotetext{#1}%
9123 \m@make@mptwocolfootnotetext{#1}%
9124 \m@make@twocolfootfmt{#1}%
9125 \m@make@twocol@footgroup{#1}%
9126 \m@make@mptwocol@footgroup{#1}%
9127 \m@make@footstart{#1}%
9128 \@namelongdef{@footnotetext#1}##1{%
9129 \@nameuse{@twocolfootnotetext#1}{##1}}%
9130 \@namelongdef{@mpfootnotetext#1}##1{%
9131 \@nameuse{@mptwocolfootnotetext#1}{##1}}%
9132 \@namedef{@footgroup#1}{\@nameuse{@twocol@footgroup#1}}%
9133 \@namedef{mp@footgroup#1}{\@nameuse{@mptwocol@footgroup#1}}%
9134 \expandafter\dimen\csname footins#1\endcsname=2\footinsdim
9135 \expandafter\count\csname footins#1\endcsname=500\relax}
9136
9137 \newcommand{\m@make@twocolfootnotetext}[1]{%
9138 \@namelongdef{@twocolfootnotetext#1}##1{%
9139 \insert\@nameuse{footins#1}{%
9140 \def\baselinestretch{\m@m@footnote@spacing}%
9141 \reset@font\@nameuse{foottextfont#1}%
9142 \@preamfntext
9143 \def\@currentcounter{footnote}%
9144 \protected@edef\@currentlabel{%
9145 \csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}%
9146 \color@begingroup
9147 \@nameuse{@twocolfootfmt#1}{##1}%
9148 \color@endgroup}%
9149 \m@mmf@prepare}}
9150
9151 \newcommand{\m@make@mptwocolfootnotetext}[1]{%
9152 \@namelongdef{@mptwocolfootnotetext#1}##1{%
9153 \global\setbox\@nameuse{@mpfootins#1}\vbox{%
9154 \unvbox\@nameuse{@mpfootins#1}
9155 \def\baselinestretch{\m@m@footnote@spacing}%
9156 \reset@font\@nameuse{foottextfont#1}%
9157 \hsize\columnwidth \@parboxrestore
9158 \def\@currentcounter{mpfootnote}%
9159 \protected@edef\@currentlabel{%
9160 \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
9161 \color@begingroup
9162 \@nameuse{@twocolfootfmt#1}{##1}%
9163 \color@endgroup}\m@mmf@prepare}}
9164
9165 \newcommand{\m@make@twocolfootfmt}[1]{%
9166 \@namedef{@twocolfootfmt#1}##1{%
9167 \@preamtwofmt
9168 {\@nameuse{footfootmark#1}\strut
9169 \@nameuse{foottextfont#1}##1\strut\par}\allowbreak}}
9170
9171 \newcommand{\m@make@twocol@footgroup}[1]{%
9172 \@namedef{@twocol@footgroup#1}{{%
9173 \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
9174 \m@mrigidbalance{\@nameuse{footins#1}}{\tw@}{\splittopskip}}}}
9175
9176 \newcommand{\m@make@mptwocol@footgroup}[1]{%
9177 \@namedef{@mptwocol@footgroup#1}{{%
9178 \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
9179 \m@mrigidbalance{\@nameuse{@mpfootins#1}}{\tw@}{\splittopskip}}}}
9180
9181 \newcommand{\threecolumnfootnotes}{%
9182 \@namedef{foottextfontv@r}{\foottextfont}% % [RS]
9183 \let\@footnotetext\@threecolfootnotetext
9184 \dimen\footinsv@r=3\footinsdim
9185 \count\footinsv@r=333\relax
9186 \m@make@threecol@footgroup{v@r}%
9187 \let\@footgroupv@r\@threecol@footgroupv@r
9188 \let\@mpfootnotetext\@mpthreecolfootnotetext
9189 \m@make@mpthreecol@footgroup{v@r}%
9190 \let\mp@footgroupv@r\@mpthreecol@footgroupv@r}
9191
9192 \newcommand{\@threecolfootnotetext}[1]{\insert\footinsv@r{%
9193 \def\baselinestretch{\m@m@footnote@spacing}%
9194 \reset@font\foottextfont
9195 \@preamfntext
9196 \def\@currentcounter{footnote}%
9197 \protected@edef\@currentlabel{%
9198 \csname p@footnote\endcsname\@thefnmark}%
9199 \color@begingroup
9200 \@threecolfootfmt{#1}%
9201 \color@endgroup}\m@mmf@prepare}
9202
9203 \newcommand{\@preamthreefmt}{%
9204 \hsize .3\hsize
9205 \parindent=\z@
9206 \tolerance=5000\relax
9207 \raggedright
9208 \leavevmode}
9209
9210 \newcommand{\@threecolfootfmt}[1]{%
9211 \@preamthreefmt
9212 {\footfootmark\strut \foottextfont #1\strut\par}\allowbreak}
9213
9214 \newcommand{\@mpthreecolfootnotetext}[1]{%
9215 \global\setbox\@mpfootinsv@r\vbox{%
9216 \unvbox\@mpfootinsv@r
9217 \def\baselinestretch{\m@m@footnote@spacing}%
9218 \reset@font\foottextfont
9219 \hsize\columnwidth \@parboxrestore
9220 \def\@currentcounter{mpfootnote}%
9221 \protected@edef\@currentlabel{%
9222 \csname p@mpfootnote\endcsname\@thefnmark}%
9223 \color@begingroup
9224 \@threecolfootfmt{#1}%
9225 \color@endgroup}\m@mmf@prepare}
9226
9227 \newcommand{\threecolumnfootstyle}[1]{%
9228 \m@make@threecolfootnotetext{#1}%
9229 \m@make@mpthreecolfootnotetext{#1}%
9230 \m@make@threecolfootfmt{#1}%
9231 \m@make@threecol@footgroup{#1}%
9232 \m@make@mpthreecol@footgroup{#1}%
9233 \m@make@footstart{#1}%
9234 \@namelongdef{@footnotetext#1}##1{%
9235 \@nameuse{@threecolfootnotetext#1}{##1}}%
9236 \@namelongdef{@mpfootnotetext#1}##1{%
9237 \@nameuse{@mpthreecolfootnotetext#1}{##1}}%
9238 \@namedef{@footgroup#1}{\@nameuse{@threecol@footgroup#1}}%
9239 \@namedef{mp@footgroup#1}{\@nameuse{@mpthreecol@footgroup#1}}%
9240 \expandafter\dimen\csname footins#1\endcsname=3\footinsdim
9241 \expandafter\count\csname footins#1\endcsname=333\relax}
9242
9243 \newcommand{\m@make@threecolfootnotetext}[1]{%
9244 \@namelongdef{@threecolfootnotetext#1}##1{%
9245 \insert\@nameuse{footins#1}{%
9246 \def\baselinestretch{\m@m@footnote@spacing}%
9247 \reset@font\@nameuse{foottextfont#1}%
9248 \@preamfntext
9249 \def\@currentcounter{footnote}%
9250 \protected@edef\@currentlabel{%
9251 \csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}%
9252 \color@begingroup
9253 \@nameuse{@threecolfootfmt#1}{##1}%
9254 \color@endgroup}\m@mmf@prepare}}
9255
9256 \newcommand{\m@make@mpthreecolfootnotetext}[1]{%
9257 \@namelongdef{@mpthreecolfootnotetext#1}##1{%
9258 \global\setbox\@nameuse{@mpfootins#1}\vbox{%
9259 \unvbox\@nameuse{@mpfootins#1}
9260 \def\baselinestretch{\m@m@footnote@spacing}%
9261 \reset@font\@nameuse{foottextfont#1}%
9262 \hsize\columnwidth \@parboxrestore
9263 \def\@currentcounter{mpfootnote}%
9264 \protected@edef\@currentlabel{%
9265 \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
9266 \color@begingroup
9267 \@nameuse{@threecolfootfmt#1}{##1}%
9268 \color@endgroup}\m@mmf@prepare}}
9269
9270 \newcommand{\m@make@threecolfootfmt}[1]{%
9271 \@namelongdef{@threecolfootfmt#1}##1{%
9272 \@preamthreefmt
9273 {\@nameuse{footfootmark#1}\strut
9274 \@nameuse{foottextfont#1}##1\strut\par}\allowbreak}}
9275
9276 \newcommand{\m@make@threecol@footgroup}[1]{%
9277 \@namedef{@threecol@footgroup#1}{{%
9278 \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
9279 \m@mrigidbalance{\@nameuse{footins#1}}{\thr@@}{\splittopskip}}}}
9280
9281 \newcommand{\m@make@mpthreecol@footgroup}[1]{%
9282 \@namedef{@mpthreecol@footgroup#1}{{%
9283 \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
9284 \m@mrigidbalance{\@nameuse{@mpfootins#1}}{\thr@@}{\splittopskip}}}}
9285
9286 \newcommand{\m@munvxh}[1]{%
9287 \setbox0=\vbox{\unvbox#1%
9288 \global\setbox1=\lastbox}%
9289 \unhbox1
9290 \unskip
9291 \unskip
9292 \unpenalty
9293 \hskip\m@mipn@skip}
9294
9295 \newcommand{\m@mungebox}{%
9296 \setbox0=\hbox{\m@munvxh0}%
9297 \dp0=\z@
9298 \ht0=\footfudgefactor\wd0
9299 \box0
9300 \penalty0}
9301
9302 \newskip\m@mipn@skip
9303 \newcommand*{\m@minterparanoteglue}[1]{%
9304 {\foottextfont\global\m@mipn@skip=#1\relax}}
9305 \m@minterparanoteglue{1em plus.4em minus.4em}
9306
9307 \newcommand*{\m@mmakehboxofhboxes}{\setbox0=\hbox{}%
9308 \loop
9309 \unpenalty
9310 \setbox2=\lastbox
9311 \ifhbox2
9312 \setbox0=\hbox{\box2\unhbox0}
9313 \repeat}
9314
9315 \newcommand*{\m@mremovehboxes}{\setbox0=\lastbox
9316 \ifhbox0{\m@mremovehboxes}\unhbox0 \fi}
9317
9318 \newcommand*{\footfudgefiddle}{64}
9319
9320 \newcommand{\paragraphfootnotes}{%
9321 \@namedef{foottextfontv@r}{\foottextfont}% % [RS]
9322 \let\@footnotetext\@parafootnotetext
9323 \dimen\footinsv@r=\footinsdim
9324 \count\footinsv@r=1000\relax
9325 \m@make@para@footgroup{v@r}%
9326 \let\@footgroupv@r\@para@footgroupv@r
9327 \let\@mpfootnotetext\@mpparafootnotetext
9328 \m@make@mppara@footgroup{v@r}%
9329 \let\mp@footgroupv@r\@mppara@footgroupv@r
9330 {\foottextfont
9331 \dimen0=\baselineskip
9332 %\multiply\dimen0 by 1024
9333 \multiply\dimen0 by 256
9334 \divide\dimen0 by \hsize
9335 \multiply\dimen0 by 4
9336 \multiply\dimen0 by \footfudgefiddle
9337 \xdef\footfudgefactor{\expandafter\strip@pt\dimen0 }}}
9338
9339 \newcommand{\@parafootnotetext}[1]{\insert\footinsv@r{
9340 \def\baselinestretch{\m@m@footnote@spacing}%
9341 \reset@font\foottextfont
9342 \@preamfntext
9343 \def\@currentcounter{footnote}%
9344 \protected@edef\@currentlabel{%
9345 \csname p@footnote\endcsname\@thefnmark}%
9346 \setbox0=\vbox{\hsize=\maxdimen
9347 \color@begingroup
9348 \noindent \@parafootfmt{#1}%
9349 \color@endgroup}%
9350 \m@mungebox}\m@mmf@prepare}
9351
9352 \newcommand{\@parafootfmt}[1]{%
9353 \parindent=\z@
9354 \parfillskip=0pt \@plus 1fil
9355 {\footfootmark\strut \foottextfont #1\penalty-10}}
9356
9357 \newcommand{\@mpparafootnotetext}[1]{%
9358 \global\setbox\@mpfootinsv@r\vbox{%
9359 \unvbox\@mpfootinsv@r
9360 \def\baselinestretch{\m@m@footnote@spacing}%
9361 \reset@font\foottextfont
9362 \hsize\columnwidth \@parboxrestore
9363 \def\@currentcounter{mpfootnote}%
9364 \protected@edef\@currentlabel{%
9365 \csname p@mpfootnote\endcsname\@thefnmark}%
9366 \setbox0=\vbox{\hsize=\maxdimen
9367 \color@begingroup
9368 \noindent \@parafootfmt{#1}%
9369 \color@endgroup}%
9370 \m@mungebox}\m@mmf@prepare}
9371
9372 \newcommand{\paragraphfootstyle}[1]{%
9373 \m@make@parafootnotetext{#1}%
9374 \m@make@mpparafootnotetext{#1}%
9375 \m@make@parafootfmt{#1}%
9376 \m@make@para@footgroup{#1}%
9377 \m@make@mppara@footgroup{#1}%
9378 \m@make@para@footstart{#1}%
9379 \@namelongdef{@footnotetext#1}##1{%
9380 \@nameuse{@parafootnotetext#1}{##1}}%
9381 \@namelongdef{@mpfootnotetext#1}##1{%
9382 \@nameuse{@mpparafootnotetext#1}{##1}}%
9383 \@namedef{@footgroup#1}{\@nameuse{@para@footgroup#1}}%
9384 \@namedef{mp@footgroup#1}{\@nameuse{@mppara@footgroup#1}}%
9385 \@namedef{@footstart#1}{\@nameuse{@para@footstart#1}}%
9386 \expandafter\dimen\csname footins#1\endcsname=\footinsdim
9387 \expandafter\count\csname footins#1\endcsname=1000\relax
9388 {\@nameuse{foottextfont#1}%
9389 \dimen0=\baselineskip
9390 %\multiply\dimen0 by 1024
9391 \multiply\dimen0 by 256
9392 \divide\dimen0 by \hsize
9393 \multiply\dimen0 by 4
9394 \multiply\dimen0 by \footfudgefiddle
9395 \xdef\footfudgefactor{\expandafter\strip@pt\dimen0 }}}
9396
9397 \newcommand{\m@make@parafootnotetext}[1]{%
9398 \@namelongdef{@parafootnotetext#1}##1{%
9399 \insert\@nameuse{footins#1}{
9400 \def\baselinestretch{\m@m@footnote@spacing}%
9401 \reset@font\@nameuse{foottextfont#1}%
9402 \@preamfntext
9403 \def\@currentcounter{footnote}%
9404 \protected@edef\@currentlabel{%
9405 \csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}%
9406 \setbox0=\vbox{\hsize=\maxdimen
9407 \color@begingroup
9408 \noindent \@nameuse{@parafootfmt#1}{##1}%
9409 \color@endgroup}%
9410 \m@mungebox}\m@mmf@prepare}}
9411
9412 \newcommand{\m@make@mpparafootnotetext}[1]{%
9413 \@namelongdef{@mpparafootnotetext#1}##1{%
9414 \global\setbox\@nameuse{@mpfootins#1}\vbox{%
9415 \unvbox\@nameuse{@mpfootins#1}
9416 \def\baselinestretch{\m@m@footnote@spacing}%
9417 \reset@font\@nameuse{foottextfont#1}%
9418 \hsize\columnwidth \@parboxrestore
9419 \def\@currentcounter{mpfootnote}%
9420 \protected@edef\@currentlabel{%
9421 \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
9422 \setbox0=\vbox{\hsize=\maxdimen
9423 \color@begingroup
9424 \noindent \@nameuse{@parafootfmt#1}{##1}%
9425 \color@endgroup}%
9426 \m@mungebox}\m@mmf@prepare}}
9427
9428 \newcommand{\m@make@parafootfmt}[1]{%
9429 \@namelongdef{@parafootfmt#1}##1{%
9430 \parindent=\z@
9431 \parfillskip=0pt \@plus 1fil
9432 {\@nameuse{footfootmark#1}\strut
9433 \@nameuse{foottextfont#1}##1\penalty-10}}}
9434
9435 \newcommand{\m@make@para@footgroup}[1]{%
9436 \@namedef{@para@footgroup#1}{%
9437 \unvbox\@nameuse{footins#1}
9438 \m@mmakehboxofhboxes
9439 \setbox0=\hbox{\unhbox0 \m@mremovehboxes}%
9440 \@nameuse{foottextfont#1}%
9441 \noindent\unhbox0\par}}
9442
9443 \newcommand{\m@make@mppara@footgroup}[1]{%
9444 \@namedef{@mppara@footgroup#1}{%
9445 \unvbox\@nameuse{@mpfootins#1}
9446 \m@mmakehboxofhboxes
9447 \setbox0=\hbox{\unhbox0 \m@mremovehboxes}%
9448 \@nameuse{foottextfont#1}%
9449 \noindent\unhbox0\par}}
9450
9451 \newcommand{\m@make@para@footstart}[1]{%
9452 \@namedef{@para@footstart#1}{%
9453 \vskip\bigskipamount
9454 \leftskip=\z@
9455 \rightskip=\z@
9456 \parindent=\z@
9457 \vskip\skip\@nameuse{footins#1}%
9458 \footnoterule}}
9459
9460 \newif\if@mem@nofoot
9461 \newcommand*{\@mem@testifnofoot}{%
9462 \@mem@nofoottrue
9463 \ifvoid\footins\else\@mem@nofootfalse\fi
9464 \ifvoid\footinsv@r\else\@mem@nofootfalse\fi
9465 \ifvoid\sideins\else\@mem@nofootfalse\fi
9466 \@mem@extranofeet}
9467 \newcommand*{\@mem@extranofeet}{}
9468
9469 \let\memold@doclearpage\@doclearpage
9470 \newcommand{\mem@doclearpage}{%
9471 \@mem@testifnofoot
9472 \if@mem@nofoot
9473 \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
9474 \setbox\@tempboxa\box\@cclv
9475 \xdef\@deferlist{\@toplist\@botlist\@deferlist}%
9476 \global \let \@toplist \@empty
9477 \global \let \@botlist \@empty
9478 \global \@colroom \@colht
9479 \ifx \@currlist\@empty
9480 \else
9481 \@latexerr{Float(s) lost}\@ehb
9482 \global \let \@currlist \@empty
9483 \fi
9484 \@makefcolumn\@deferlist
9485 \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}%
9486 \if@twocolumn
9487 \if@firstcolumn
9488 \xdef\@deferlist{\@dbltoplist\@deferlist}%
9489 \global \let \@dbltoplist \@empty
9490 \global \@colht \textheight
9491 \begingroup
9492 \@dblfloatplacement
9493 \@makefcolumn\@deferlist
9494 \@whilesw\if@fcolmade \fi{\@outputpage
9495 \@makefcolumn\@deferlist}%
9496 \endgroup
9497 \else
9498 \vbox{}\clearpage
9499 \fi
9500 \fi
9501 \ifx\@deferlist\@empty \else\clearpage \fi
9502 \else
9503 \setbox\@cclv\vbox{\box\@cclv\vfil}%
9504 \@makecol\@opcol
9505 \clearpage
9506 \fi
9507 % older version
9508 % \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
9509 % \setbox\@tempboxa\box\@cclv
9510 % \xdef\@deferlist{\@toplist\@botlist\@deferlist}%
9511 % \global\let\@toplist\@empty
9512 % \global\let\@botlist\@empty
9513 % \global\@colroom\@colht
9514 % \ifx \@currlist\@empty
9515 % \else
9516 % \@latexerr{Float(s) lost}\@ehb
9517 % \global\let\@currlist\@empty
9518 % \fi
9519 % \@makefcolumn\@deferlist
9520 % \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}%
9521 % \if@twocolumn
9522 % \if@firstcolumn
9523 % \xdef\@dbldeferlist{\@dbltoplist\@dbldeferlist}%
9524 % \global\let\@dbltoplist\@empty
9525 % \global\@colht\textheight
9526 % \begingroup
9527 % \@dblfloatplacement
9528 % \@makefcolumn\@dbldeferlist
9529 % \@whilesw\if@fcolmade \fi{\@outputpage
9530 % \@makefcolumn\@dbldeferlist}%
9531 % \endgroup
9532 % \else
9533 % \vbox{}\clearpage
9534 % \fi
9535 % \fi
9536 % \else
9537 % \setbox\@cclv\vbox{\box\@cclv\vfil}%
9538 % \@makecol\@opcol
9539 % \clearpage
9540 % \fi
9541 }
9542 \gdef\@doclearpage{\mem@doclearpage}
9543
9544 \newcommand*{\m@m@makecolfloats}{%
9545 \let\@elt\relax%
9546 \xdef\@freelist{\@freelist\@midlist}%
9547 \global\let\@midlist\@empty
9548 \@combinefloats}
9549 \newcommand*{\m@m@makecoltext}{%
9550 \ifvbox\@kludgeins
9551 \@make@specialcolbox
9552 \else
9553 \setbox\@outputbox \vbox to\@colht{%
9554 \@texttop
9555 \dimen@ \dp\@outputbox
9556 \unvbox \@outputbox
9557 \vskip -\dimen@
9558 \@textbottom}%
9559 \fi}
9560
9561 \newcommand*{\m@m@makecolintro}{}
9562
9563 \newcommand*{\m@mopfootnote}{\setbox\@outputbox \vbox{%
9564 \boxmaxdepth\@maxdepth
9565 \@tempdima\dp\@cclv
9566 \unvbox\@cclv
9567 \vskip-\@tempdima
9568 \mem@if@flushbottomF\m@mopfn@bottom
9569 \vskip \skip\footins
9570 \color@begingroup
9571 \normalcolor
9572 \footnoterule
9573 \unvbox \footins
9574 \color@endgroup}}
9575
9576 \newcommand*{\m@mopfootnotebf}{%
9577 \setbox\@outputbox \vbox{%
9578 \boxmaxdepth\@maxdepth
9579 \unvbox\@outputbox
9580 \mem@if@flushbottomF\m@mopfn@bottom
9581 \vskip\skip\footins
9582 \color@begingroup
9583 \normalcolor
9584 \footnoterule
9585 \unvbox \footins
9586 \color@endgroup}}
9587
9588 \newcommand*{\m@mopsidebar}{%
9589 \ifvoid\sideins\else
9590 \setbox\@outputbox \vbox{%
9591 \sidecontents
9592 \unvbox\@outputbox}
9593 \fi}
9594
9595 % \gdef\mem@makecol{%
9596 % \m@m@makecolintro
9597 % \ifvoid\footins
9598 % \setbox\@outputbox \box\@cclv
9599 % \else
9600 % \m@mopfootnote
9601 % \fi
9602 % \m@mdoextrafeet
9603 % \m@m@makecolfloats
9604 % \m@mopsidebar
9605 % \m@m@makecoltext
9606 % \global \maxdepth \@maxdepth}
9607
9608 % \gdef\mem@makecolbf{%
9609 % \m@m@makecolintro
9610 % \setbox\@outputbox \box\@cclv
9611 % \m@m@makecolfloats
9612 % \ifvoid\footins\else
9613 % \m@mopfootnotebf
9614 % \fi
9615 % \m@mdoextrafeet
9616 % \m@mopsidebar
9617 % \m@m@makecoltext
9618 % \global\maxdepth \@maxdepth}
9619
9620 \gdef\mem@makecoldblf{%
9621 \m@m@makecolintro
9622 \setbox\@outputbox \box\@cclv
9623 \m@m@makecolfloats
9624 \m@mopsidebar% <- added
9625 \ifvoid\footins
9626 \else
9627 \m@mopfootnote
9628 \fi
9629 \m@mdoextrafeet
9630 \m@m@makecoltext
9631 \global \maxdepth \@maxdepth}
9632
9633 \newcommand{\feetabovefloat}{\gdef\@makecol{\mem@makecol}}
9634 \newcommand{\feetbelowfloat}{\gdef\@makecol{\mem@makecolbf}}
9635 \feetabovefloat
9636
9637 \newcommand\feetatbottom{\def\m@mopfn@bottom{\vfill\relax}}
9638 \newcommand\feetbelowragged{\let\m@mopfn@bottom\relax}
9639 \feetbelowragged
9640 \newcommand\mem@if@flushbottomF[1]{%
9641 \if\mem@flshbot\else#1\fi%
9642 }
9643
9644 % \gdef\@reinserts{%
9645 % \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi
9646 % \m@mdodoreinextrafeet
9647 % \ifvbox\@kludgeins\insert\@kludgeins{\unvbox\@kludgeins}\fi
9648 % \ifvoid\sideins\else\insert\sideins{\unvbox\sideins}\fi}
9649
9650 \newif\ifm@mfnmargin
9651 \newcommand*{\footnotesatfoot}{\m@mfnmarginfalse}
9652 \newcommand*{\footnotesinmargin}{\m@mfnmargintrue}
9653 \footnotesatfoot
9654
9655 \renewcommand{\@footnotetext}[1]{%
9656 \ifm@mfnmargin% use marginpar
9657 \marginpar{%
9658 \def\baselinestretch{\m@m@footnote@spacing}%
9659 \reset@font
9660 \foottextfont
9661 \def\@currentcounter{footnote}%
9662 \protected@edef\@currentlabel{%
9663 \csname p@footnote\endcsname\@thefnmark}%
9664 \color@begingroup
9665 \@makefntext{\ignorespaces#1}%
9666 \color@endgroup}%
9667 \else% regular feet
9668 \insert\footins{%
9669 \def\baselinestretch{\m@m@footnote@spacing}%
9670 \reset@font
9671 \foottextfont
9672 \@preamfntext
9673 \hsize\columnwidth
9674 \def\@currentcounter{footnote}%
9675 \protected@edef\@currentlabel{%
9676 \csname p@footnote\endcsname\@thefnmark}%
9677 \color@begingroup
9678 \@makefntext{%
9679 \rule\z@\footnotesep\ignorespaces\foottextfont #1%
9680 \@finalstrut\strutbox}%
9681 \color@endgroup}%
9682 \fi%
9683 \m@mmf@prepare}
9684 \let\@plainfootnotetext\@footnotetext
9685
9686 \newcommand*{\sidefootmargin}[1]{%
9687 \m@msetm@argin{#1}%
9688 \ifnum\m@mm@argin<\z@
9689 \@memwarn{Bad \string\sidefootmargin\space argument `#1'\MessageBreak
9690 set to `outer'}%
9691 \gdef\m@msidefoot@margin{2}% set as outer
9692 \else
9693 \global\let\m@msidefoot@margin\m@mm@argin
9694 \fi}
9695 \sidefootmargin{outer}
9696
9697 \newinsert\sidefootins
9698 \skip\sidefootins=0pt
9699 \count\sidefootins=0\relax
9700
9701 \newlength{\sidefootadjust}
9702 \setlength{\sidefootadjust}{0pt}
9703 \newlength{\sidefootheight}
9704 \newcommand*{\setsidefootheight}[1]{%
9705 \setlength{\dimen\sidefootins}{#1}%
9706 \advance\dimen\sidefootins -\topskip
9707 \advance\dimen\sidefootins \ht\strutbox
9708 \setlength{\sidefootheight}{\dimen\sidefootins}}
9709 \setsidefootheight{\textheight}
9710
9711 \newlength{\sidefoothsep}
9712 \newlength{\sidefootvsep}
9713 \newlength{\sidefootwidth}
9714
9715 \newcommand*{\setsidefeet}[6]{%
9716 \nametest{#1}{*}\ifsamename\else
9717 \setlength{\sidefoothsep}{#1}\@memznegtest{\sidefoothsep}%
9718 \fi
9719 \nametest{#2}{*}\ifsamename\else
9720 \setlength{\sidefootwidth}{#2}\@memznegtest{\sidefootwidth}%
9721 \fi
9722 \nametest{#3}{*}\ifsamename\else
9723 \setlength{\sidefootvsep}{#3}\@memznegtest{\sidefootvsep}%
9724 \fi
9725 \nametest{#4}{*}\ifsamename\else
9726 \setlength{\sidefootadjust}{#4}%
9727 \fi
9728 \nametest{#5}{*}\ifsamename\else
9729 \def\sidefoottextfont{#5}%
9730 \fi
9731 \nametest{#6}{*}\ifsamename\else
9732 \setsidefootheight{#6}%
9733 \ifdim\dimen\sidefootins>\z@\else
9734 \@memerror{\protect\sidefootheight\space is zero or negative}{\@ehd}%
9735 \fi
9736 \fi}
9737 \setsidefeet{\marginparsep}{\marginparwidth}%
9738 {\onelineskip}{0pt}%
9739 {\normalfont\footnotesize}{\textheight}%
9740
9741 \newcommand*{\sidefootform}{\rightskip=\z@ \@plus 2em}
9742
9743 \newcommand*{\m@sideft@left}{%
9744 \@tempdimc \sidefootwidth
9745 \advance\@tempdimc\sidefoothsep
9746 \kern-\@tempdimc}
9747 \newcommand*{\m@sideft@right}{%
9748 \@tempdimc \columnwidth% or \hsize
9749 \advance\@tempdimc\sidefoothsep
9750 \kern\@tempdimc}
9751
9752 \newlength{\m@mdownsf}
9753
9754 \newcommand*{\sidefootcontents}{\hbox to \z@{%
9755 \m@mwhich@margin{\m@msidefoot@margin}%
9756 \ifmemtortm
9757 \m@sideft@right
9758 \else
9759 \m@sideft@left
9760 \fi
9761 \vtop to 0pt{% original
9762 \normalsize\normalfont\sidefoottextfont
9763 \vskip\topskip \vskip-\ht\strutbox
9764 \vskip\sidefootadjust% use this for minor vertical adjustment
9765 \m@mdownsf=\dimen\sidefootins
9766 \advance\m@mdownsf-\ht\sidefootins
9767 \advance\m@mdownsf-\dp\sidefootins
9768 \ifdim\m@mdownsf>\sidefootvsep
9769 \advance\m@mdownsf\sidefootvsep
9770 \advance\m@mdownsf 0.5\ht\strutbox
9771 \fi
9772 \vskip\m@mdownsf% --- basically works
9773 \unvbox\sidefootins%
9774 \vss}%
9775 \hss}}
9776
9777 \newcommand*{\m@mopsidefoot}{%
9778 \ifvoid\sidefootins\else
9779 \setbox\@outputbox \vbox{%
9780 \sidefootcontents
9781 \unvbox\@outputbox}
9782 \fi}
9783
9784 \gdef\mem@makecol{%
9785 \m@m@makecolintro
9786 \ifvoid\footins
9787 \setbox\@outputbox \box\@cclv
9788 \else
9789 \m@mopfootnote
9790 \fi
9791 \m@mdoextrafeet
9792 \m@m@makecolfloats
9793 \m@mopsidebar
9794 \m@mopsidefoot
9795 \m@m@makecoltext
9796 \global \maxdepth \@maxdepth}
9797
9798 % adding to "hook" in footmisc
9799 \AddToHook{cmd/@makecol@appendblocks/after}{\m@mdoextrafeet\m@mopsidefoot\m@mopsidebar}
9800
9801 \gdef\mem@makecolbf{%
9802 \m@m@makecolintro
9803 \setbox\@outputbox \box\@cclv
9804 \m@m@makecolfloats
9805 \ifvoid\footins
9806 \else
9807 \m@mopfootnotebf
9808 \fi
9809 \m@mdoextrafeet
9810 \m@mopsidebar
9811 \m@mopsidefoot
9812 \m@m@makecoltext
9813 \global \maxdepth \@maxdepth}
9814
9815 \gdef\@reinserts{%
9816 \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi
9817 \m@mdodoreinextrafeet
9818 \ifvbox\@kludgeins\insert\@kludgeins{\unvbox\@kludgeins}\fi
9819 \ifvoid\sideins\else\insert\sideins{\unvbox\sideins}\fi
9820 \ifvoid\sidefootins\else\insert\sidefootins{\unvbox\sidefootins}\fi}
9821
9822 \renewcommand*{\@mem@testifnofoot}{%
9823 \@mem@nofoottrue
9824 \ifvoid\footins\else\@mem@nofootfalse\fi
9825 \ifvoid\footinsv@r\else\@mem@nofootfalse\fi
9826 \ifvoid\sideins\else\@mem@nofootfalse\fi
9827 \ifvoid\sidefootins\else\@mem@nofootfalse\fi
9828 \@mem@extranofeet}
9829
9830 \newcounter{sidefootnote}
9831 \renewcommand{\thesidefootnote}{\@arabic\c@sidefootnote}
9832 \@addtoreset{sidefootnote}{chapter}
9833
9834
9835 \newcommand*{\@sidempfn}{sidefootnote}
9836 \newcommand*{\thesidempfn}{\thesidefootnote}
9837
9838 \newcommand*{\@makesidefnmark}{\hbox{\@textsuperscript{%
9839 \normalfont\@thesidefnmark}}}
9840
9841 \newcommand{\@preamsidefntext}{%
9842 \interlinepenalty\interfootnotelinepenalty
9843 \floatingpenalty \@MM
9844 \splittopskip=\footnotesep
9845 \splitmaxdepth=\dp\strutbox
9846 \@parboxrestore}
9847
9848 \newcommand{\@sidefootnotetext}[1]{\insert\sidefootins{%
9849 \hsize\sidefootwidth
9850 \@parboxrestore
9851 \def\baselinestretch{\m@m@footnote@spacing}%
9852 \sidefootform \normalsize\normalfont\sidefoottextfont
9853 \splittopskip=\ht\strutbox
9854 \splitmaxdepth=\dp\strutbox
9855 \allowbreak
9856 \prevdepth=\dp\strutbox
9857 \vskip-\parskip
9858 \def\@currentcounter{sidefootnote}%
9859 \protected@edef\@currentlabel{%
9860 \csname p@sidefootnote\endcsname\@thesidefnmark}%
9861 \color@begingroup
9862 \@makesidefntext{{\sidefoottextfont #1}}%
9863 \color@endgroup
9864 \ifvmode\else
9865 \unskip\@finalstrut\strutbox
9866 \fi
9867 \par
9868 \ifdim\prevdepth>\dp\strutbox \prevdepth=\dp\strutbox\fi
9869 \ifdim\prevdepth>99\p@
9870 \nobreak
9871 \vskip-\prevdepth
9872 \allowbreak
9873 \vskip\dp\strutbox
9874 \fi
9875 \vskip\sidefootvsep}%
9876 \m@mmf@prepare}
9877
9878 \newcommand*{\@sidefootnotemark}{%
9879 \leavevmode
9880 \ifhmode
9881 \edef\@x@sf{\the\spacefactor}%
9882 \m@mmf@check
9883 \nobreak
9884 \fi
9885 \@makesidefnmark
9886 \m@mmf@prepare
9887 \ifhmode\spacefactor\@x@sf\fi
9888 \relax}
9889
9890 \newcommand*{\sidefootnote}{\@ifnextchar[
9891 \@xsidefootnote{\stepcounter\@sidempfn
9892 \protected@xdef\@thesidefnmark{\thesidempfn}%
9893 \@sidefootnotemark\@sidefootnotetext}}
9894 \def\@xsidefootnote[#1]{%
9895 \begingroup
9896 \csname c@\@sidempfn\endcsname #1\relax
9897 \unrestored@protected@xdef\@thesidefnmark{\thesidempfn}%
9898 \endgroup
9899 \@sidefootnotemark\@sidefootnotetext}
9900
9901 \newcommand{\sidefootnotemark}{%
9902 \@ifnextchar[
9903 \@xsidefootnotemark
9904 {\stepcounter{sidefootnote}%
9905 \protected@xdef\@thesidefnmark{\thesidefootnote}%
9906 \@sidefootnotemark}}
9907 \def\@xsidefootnotemark[#1]{%
9908 \begingroup
9909 \c@sidefootnote #1\relax
9910 \unrestored@protected@xdef\@thesidefnmark{\thesidefootnote}%
9911 \endgroup
9912 \@sidefootnotemark}
9913
9914 \newcommand*{\sidefootnotetext}{%
9915 \@ifnextchar[
9916 \@xsidefootnotetext
9917 {\protected@xdef\@thesidefnmark{\thesidempfn}%
9918 \@sidefootnotetext}}
9919 \def\@xsidefootnotetext[#1]{%
9920 \begingroup
9921 \csname c@\@sidempfn\endcsname #1\relax
9922 \unrestored@protected@xdef\@thesidefnmark{\thesidempfn}%
9923 \endgroup
9924 \@sidefootnotetext}
9925
9926 \newcommand*{\sidefootmarkstyle}[1]{\def\sidefootscript##1{#1}}
9927 \newcommand*{\makesidefootmarkhook}{}
9928 \newcommand*{\sidefootfootmark}{%
9929 \ifdim\sidefootmarkwidth < \z@
9930 \llap{\hb@xt@ -\sidefootmarkwidth{%
9931 \hss\normalfont\sidefootscript{\@thesidefnmark}}%
9932 \hspace*{-\sidefootmarkwidth}}%
9933 \else
9934 \ifdim\sidefootmarkwidth = \z@
9935 {\normalfont\sidefootscript{\@thesidefnmark}}%
9936 \else
9937 \hb@xt@\sidefootmarkwidth{\hss\normalfont\sidefootscript{\@thesidefnmark}}%
9938 \fi
9939 \fi}
9940
9941 \newcommand{\makesidefootmark}[1]{%
9942 \leavevmode
9943 \parindent \sidefootparindent\noindent
9944 \leftskip\sidefootmarksep\relax
9945 \advance\leftskip \sidefootmarkwidth \null\nobreak\hskip -\leftskip\relax
9946 \makesidefootmarkhook\relax
9947 \sidefootfootmark #1}
9948
9949 \newcommand{\@makesidefntext}[1]{\makesidefootmark #1}
9950
9951 \newlength{\sidefootmarkwidth}
9952 \setlength{\sidefootmarkwidth}{0em}
9953 \newlength{\sidefootmarksep}
9954 \setlength{\sidefootmarksep}{0em}
9955 \newlength{\sidefootparindent}
9956 \setlength{\sidefootparindent}{1em}
9957 \sidefootmarkstyle{\textsuperscript{#1}}
9958
9959 \newif\ifm@mpnpageopt
9960 \m@mpnpageoptfalse
9961 \newif\ifm@mpncontopt
9962 \m@mpncontoptfalse
9963 \newcounter{pagenote}[chapter]
9964 \renewcommand{\thepagenote}{\arabic{pagenote}}
9965 \setcounter{pagenote}{0}
9966
9967 \newcommand*{\notepageref}{\m@mpnpageopttrue}
9968 \@onlypreamble\notepageref
9969 \newcommand*{\continuousnotenums}{%
9970 \counterwithout{pagenote}{chapter}
9971 \renewcommand{\thepagenote}{\arabic{pagenote}}}
9972 \@onlypreamble\continuousnotenums
9973
9974 \newif\ifmempagenotes
9975 \mempagenotesfalse
9976
9977 \newcommand*{\makepagenote}{%
9978 \newwrite\@notefile
9979 \immediate\openout\@notefile=\jobname.ent
9980 \mempagenotestrue
9981 \DeclareRobustCommand\pagenote{\@bsphack\begingroup
9982 \rem@special{\ }% <--- added
9983 \@sanitize
9984 \m@m@wrpnote}%
9985 \DeclareRobustCommand\mem@footto@pagenote{\@bsphack\begingroup
9986 \rem@special{\ }% <--- added
9987 \@sanitize
9988 \def\mem@pn@step{01}%
9989 \m@m@wrpnote}%
9990 \typeout{Writing note file \jobname.ent}%
9991 \let\makepagenote\@empty}
9992
9993 \providecommand{\immediate@protected@write}[3]{%
9994 \begingroup
9995 #2%
9996 \let\protect\@unexpandable@protect
9997 %\edef\reserved@a{\immediate\write#1{#3}}%
9998 %\reserved@a
9999 \immediate\write#1{#3}%
10000 \endgroup
10001 %\if@nobreak\ifvmode\nobreak\fi\fi%
10002 }
10003
10004 % \long\def\immediateaddtocontents#1#2{%
10005 % \immediate@protected@write\@auxout%
10006 % {\let\label\@gobble \let\index\@gobble \let\glossary\@gobble \let\thepage\relax}%
10007 % {\string\@writefile{#1}{#2}}}
10008 \NewCommandCopy\immediateaddtocontents\addtocontents
10009 \patchcmd{\immediateaddtocontents}
10010 {\protected@write}%
10011 {\immediate@protected@write}%
10012 {}%
10013 {\typeout{patch 1 for \string\immediateaddtocontents\space failed}}
10014 \@ifundefined{@gobble@om}{
10015 \patchcmd{\immediateaddtocontents}%
10016 {\let\glossary\@gobble}%
10017 {\let\glossary\@gobble\let\thepage\relax}%
10018 {}%
10019 {\typeout{patch 2 for \string\immediateaddtocontents\space failed}}
10020 }{
10021 \patchcmd{\immediateaddtocontents}%
10022 {\let\glossary\@gobble@om}%
10023 {\let\glossary\@gobble\let\thepage\relax}%
10024 {}%
10025 {\typeout{patch 2 for \string\immediateaddtocontents\space failed}}
10026 }
10027 \newcommand{\m@m@pnwrite}[3]{\immediate\write#1{#3}}
10028 \newcommand{\m@m@pnwrited}[3]{\immediate\write#1{\detokenize{#3}\@percentchar}}
10029
10030 \newcommand*{\pnchap}{\f@rtoc}
10031 \newcommand*{\pnschap}{\f@rbdy}
10032
10033 \newcounter{pagenoteshadow}
10034 \setcounter{pagenoteshadow}{0}
10035 \newcommand\mem@pn@step{00} % i.e. true
10036 \newlength\mem@pn@lastkern
10037 \newcommand\m@m@pnwrite@fourtharg[1]{\m@m@pnwrited\@notefile{}{{}}}
10038 \newcommand\m@m@pnwrite@fourtharg@hyperref[1]{%
10039 \@ifmtarg{#1}{%
10040 \m@m@pnwrite\@notefile{}{{\Hy@pagenote@currentHref}}%
10041 }{%
10042 \m@m@pnwrited\@notefile{}{{}}%
10043 }}
10044
10045 \newcommand{\m@m@wrpnote}[2][]{%
10046 \mem@pn@lastkern=\lastkern%
10047 \refstepcounter{pagenoteshadow}%
10048 \ifm@mpnpageopt%
10049 %\phantomsection%
10050 \label{pagenote\thepagenoteshadow-\thesheetsequence}%
10051 \fi%
10052 \if\mem@pn@step%
10053 \@ifmtarg{#1}{%
10054 \refstepcounter{pagenote}%
10055 % this enables the ^{1,2} feature
10056 \ifdim\mem@pn@lastkern=\multiplefootnotemarker%
10057 \m@mmf@prepare% rerun
10058 \fi%
10059 \mem@pn@multiple@marker{\notenumintext{\thepagenote}}%
10060 }{\m@mmf@prepare}%
10061 \fi%
10062 \ifm@mpn@new@chap%
10063 \global\m@mpn@new@chapfalse%
10064 \addtonotes{\string\pagenotesubhead{\@chapapp}{\thechapter}{\pnchap}}%
10065 \fi%
10066 \ifm@mpn@new@schap%
10067 \global\m@mpn@new@schapfalse%
10068 \addtonotes{\string\pagenotesubheadstarred{\@chapapp}{}{\pnschap}}%
10069 \fi%
10070 \m@m@pnwrite\@notefile{}%
10071 {\string\startnoteentry{\thepagenote}}%
10072 \m@m@pnwrited\@notefile{}{{#1}}%
10073 \m@m@pnwrite\@notefile{}%
10074 {{pagenote\thepagenoteshadow-\thesheetsequence}}%
10075 \m@m@pnwrite@fourtharg{#1}%
10076 \begingroup%
10077 \newlinechar='40%
10078 \m@m@pnwrited\@notefile{}{#2}%
10079 \endgroup%
10080 \m@m@pnwrite\@notefile{}%
10081 {\string\endnoteentry}%
10082 \endgroup%
10083 \@esphack}
10084
10085 \def\pagenote{\@bsphack\begingroup \@sanitize\m@m@pagenote}
10086 \let\mem@footto@pagenote\pagenote
10087 \newcommand{\m@m@pagenote}[2][]{\endgroup\@esphack}
10088
10089 \newcommand*{\pagetofootnote}{%
10090 \let\memsavepagenote\pagenote
10091 \renewcommand{\pagenote}[2][]{\footnote{##2}}
10092 \ifmempagenotes\else%
10093 \AtEndDocument{%
10094 \ifmempagenotes%
10095 \@memerror{The use of \string\pagetofootnote\space before
10096 \string\makepagenote\space^^Jdoes not make
10097 sense. \string\makepagenote\space make some redefinitions that
10098 are not picked up if \string\pagetofootnote\space is issued
10099 before \string\makepagenote
10100 }{}
10101 \fi
10102 }
10103 \fi
10104 }
10105 \newcommand*{\foottopagenote}{%
10106 \let\memsavefootnote\footnote
10107 \counterwithout{footnote}{chapter}
10108 \letcountercounter{footnote}{pagenote}
10109 \renewcommand\footnotetext[2][]{\mem@footto@pagenote{##2}}
10110 \renewcommand{\footnote}[2][]{\pagenote{##2}}
10111 }
10112
10113 \newcommand{\addtonotes}[1]{\ifmempagenotes
10114 \IfFileExists{\jobname.ent}{\immediate@protected@write\@notefile{}{#1}}{\mempnofilewarn}%
10115 \fi}
10116
10117 \newcommand{\notenumintext}[1]{%
10118 \textsuperscript{#1}}
10119 \newcommand{\notenuminnotes}[1]{%
10120 {\normalfont #1.}\space}
10121 %\newcommand{\noteentry}[4]{} % not used any more!
10122
10123 \newcommand{\idtextinnotes}[1]{%
10124 [#1]\space}
10125 \newcommand{\noteidinnotes}[2]{%
10126 \@ifmtarg{#2}{%
10127 \notenuminnotes{#1}}{\idtextinnotes{#2}}}
10128 \newcommand{\pageinnotes}[1]{%
10129 \ifm@mpnpageopt \printpageinnotes{#1}\fi}
10130 \newcommand*{\printpageinnotes}[1]{%
10131 (\pagerefname\ \pageref{#1})\space}
10132 \newcommand\printpageinnoteshyperref[1]{%
10133 (\hyperref[#1]{\pagerefname\ \pageref*{#1}})\space}
10134 \newcommand{\noteinnotes}[1]{#1} % not used anymore!
10135
10136 \newcommand{\prenoteinnotes}{\par\noindent}
10137 \newcommand{\postnoteinnotes}{\par}
10138
10139 \newcommand\prenotetext{}
10140 \newcommand\postnotetext{}
10141
10142 \providecommand*{\notesname}{Notes}
10143 \newcommand*{\notedivision}{\chapter{\notesname}}
10144
10145 \newcommand*{\printpagenotes}{\@ifstar{\mem@printpagenotes{00}}{\mem@printpagenotes{01}}}
10146 \newcommand*{\mempnofilewarn}{%
10147 \ClassWarning{memoir}{There is no .ent file}}
10148
10149 \newcommand\startnoteentrystart[4]{% number; manual id; auto label; href anchor
10150 \prenoteinnotes%
10151 \noteidinnotes{#1}{#2}%
10152 % \phantomsection%
10153 \MakeLinkTarget[pagenote]{}%
10154 \@ifmtarg{#2}{\def\@currentlabel{#1}}{\def\@currentlabel{#2}}%
10155 \def\@currentcounter{pagenote}%
10156 \pagenoteanchor{#4}%
10157 \pageinnotes{#3}%
10158 \prenotetext%
10159 }
10160 \def\endnoteentryend{\postnotetext\postnoteinnotes}
10161 \let\pagenoteanchor\@gobble
10162 \newcommand\pagenotehyperanchor[1]{%
10163 \expandafter\@ifmtarg\expandafter{#1}{}{%
10164 \Hy@raisedlink{\hyper@@anchor{#1}{\relax}}}}%
10165
10166 \newcommand\mem@printpagenotes[1]{%
10167 \ifmempagenotes
10168 \notedivision
10169 \IfFileExists{\jobname.ent}{%
10170 \begingroup
10171 \long\def\startnoteentry####1####2####3####4{%
10172 \begingroup
10173 \startnoteentrystart{####1}{####2}{####3}{####4}%
10174 }
10175 \long\def\endnoteentry{\endnoteentryend\endgroup}
10176 \immediate\closeout\@notefile
10177 \input{\jobname.ent}%
10178 \if#1\immediate\openout\@notefile=\jobname.ent\fi%
10179 \endgroup
10180 }{%
10181 \mempnofilewarn
10182 }%
10183 \fi%
10184 }
10185
10186 % \newcommand*{\@sprintpagenotes}{%
10187 % \ifmempagenotes
10188 % \notedivision
10189 % \IfFileExists{\jobname.ent}{%
10190 % \immediate\closeout\@notefile
10191 % \input{\jobname.ent}%
10192 % \immediate\openout\@notefile=\jobname.ent%
10193 % }{%
10194 % \mempnofilewarn
10195 % }%
10196 % \fi}
10197
10198 % \newcommand*{\@printpagenotes}{%
10199 % \ifmempagenotes
10200 % \notedivision
10201 % \IfFileExists{\jobname.ent}{%
10202 % \immediate\closeout\@notefile
10203 % \input{\jobname.ent}%
10204 % }{%
10205 % \mempnofilewarn
10206 % }
10207 % \fi}
10208
10209 \newcommand*{\pagenotesubhead}[3]{%
10210 \section*{#1 #2 #3}}
10211 \newcommand\pagenotesubheadstarred{\pagenotesubhead}
10212 \newif\ifchangemarks\changemarksfalse
10213 \newcommand*{\changemarks}{\changemarkstrue}
10214 \newcommand*{\nochangemarks}{\changemarksfalse}
10215
10216 \newcommand{\v@rid}[2]{%
10217 \@bsphack
10218 \ifchangemarks
10219 \ifdraftdoc
10220 \marginpar[#1]{#2}%
10221 \fi\fi
10222 \@esphack}
10223
10224 \newcommand{\added}[1]{%
10225 \@bsphack
10226 \ifchangemarks
10227 \v@rid{\small$\oplus$ #1}{\small$\oplus$ #1}%
10228 \fi
10229 \@esphack}
10230 \newcommand{\deleted}[1]{%
10231 \@bsphack
10232 \ifchangemarks
10233 \v@rid{\small$\neq$ #1}{\small$\neq$ #1}%
10234 \fi
10235 \@esphack}
10236 \newcommand{\changed}[1]{%
10237 \@bsphack
10238 \ifchangemarks
10239 \v@rid{\small$\Leftrightarrow$ #1}{\small$\Leftrightarrow$ #1}%
10240 \fi
10241 \@esphack}
10242
10243 \newcommand*{\showtrimsoff}{\showtrimsfalse}
10244 \newcommand*{\showtrimson}{\showtrimstrue}
10245
10246 \newcommand*{\trimmark}{%
10247 \begin{picture}(0,0)
10248 \unitlength 1cm
10249 \thinlines
10250 \put(-2,0){\line(1,0){4}}
10251 \put(0,-2){\line(0,1){4}}
10252 \end{picture}}
10253
10254 \newcommand*{\Ltrimpictl}{%
10255 \begin{picture}(0,0)
10256 \unitlength 1mm
10257 \thinlines
10258 \put(-2,0){\line(-1,0){18}}
10259 \put(0,2){\line(0,1){18}}
10260 \end{picture}}
10261 \newcommand*{\Ltrimpictr}{%
10262 \begin{picture}(0,0)
10263 \unitlength 1mm
10264 \thinlines
10265 \put(2,0){\line(1,0){18}}
10266 \put(0,2){\line(0,1){18}}
10267 \end{picture}}
10268 \newcommand*{\Ltrimpicbl}{%
10269 \begin{picture}(0,0)
10270 \unitlength 1mm
10271 \thinlines
10272 \put(-2,0){\line(-1,0){18}}
10273 \put(0,-2){\line(0,-1){18}}
10274 \end{picture}}
10275 \newcommand*{\Ltrimpicbr}{%
10276 \begin{picture}(0,0)
10277 \unitlength 1mm
10278 \thinlines
10279 \put(2,0){\line(1,0){18}}
10280 \put(0,-2){\line(0,-1){18}}
10281 \end{picture}}
10282
10283 \newcommand*{\Ftrimpicbl}{%
10284 \begin{picture}(0,0)
10285 \unitlength 1pt
10286 \thinlines
10287 \put(0,0){\framebox(\strip@pt\paperwidth,\strip@pt\paperheight){}}
10288 \end{picture}}
10289
10290 \newcommand*{\tmarktl}{\trimmark}
10291 \newcommand*{\tmarktr}{\trimmark}
10292 \newcommand*{\tmarkbl}{\trimmark}
10293 \newcommand*{\tmarkbr}{\trimmark}
10294
10295 \newcommand*{\tmarktm}{%
10296 \begin{picture}(0,0)%
10297 \unitlength 1mm
10298 \thinlines
10299 \put(0,2){\line(0,1){10}}
10300 \end{picture}}
10301 \newcommand*{\tmarkml}{%
10302 \begin{picture}(0,0)%
10303 \unitlength 1mm
10304 \thinlines
10305 \put(-2,0){\line(-1,0){10}}
10306 \end{picture}}
10307 \newcommand*{\tmarkmr}{%
10308 \begin{picture}(0,0)%
10309 \unitlength 1mm
10310 \thinlines
10311 \put(2,0){\line(1,0){10}}
10312 \end{picture}}
10313 \newcommand*{\tmarkbm}{%
10314 \begin{picture}(0,0)%
10315 \unitlength 1mm
10316 \thinlines
10317 \put(0,-12){\line(0,1){10}}
10318 \end{picture}}
10319
10320 \newcommand*{\trimXmarks}{%
10321 \let\tmarktl\trimmark
10322 \let\tmarktr\trimmark
10323 \let\tmarkbl\trimmark
10324 \let\tmarkbr\trimmark}
10325 \newcommand*{\trimLmarks}{%
10326 \let\tmarktl\Ltrimpictl
10327 \let\tmarktr\Ltrimpictr
10328 \let\tmarkbl\Ltrimpicbl
10329 \let\tmarkbr\Ltrimpicbr}
10330 \newcommand*{\trimFrame}{%
10331 \let\tmarktl\null
10332 \let\tmarktr\null
10333 \let\tmarkbl\Ftrimpicbl
10334 \let\tmarkbr\null}
10335 \newcommand*{\trimNone}{%
10336 \let\tmarktl\relax
10337 \let\tmarktr\relax
10338 \let\tmarkbl\relax
10339 \let\tmarkbr\relax
10340 \let\tmarktm\relax
10341 \let\tmarkml\relax
10342 \let\tmarkmr\relax
10343 \let\tmarkbm\relax}
10344
10345 \newcommand*\trimmarkscolor{}
10346 \newcommand\mem@trimmarks@initial@vskip{\vskip-1in}
10347 \newcommand\mem@trimmarks@initial@hskip{\hskip-1in}
10348 \newcommand*{\trimmarks}{%
10349 \vbox to \z@{%
10350 \mem@trimmarks@initial@vskip%
10351 \vskip\trimtop % top of logical page
10352 \hb@xt@\z@{%
10353 \mem@trimmarks@initial@hskip%
10354 \ifodd\c@page
10355 \hskip\stockwidth
10356 \hskip-\trimedge
10357 \hskip-\paperwidth
10358 \else
10359 \if@twoside
10360 \hskip\trimedge % left of logical page
10361 \else
10362 \hskip\stockwidth
10363 \hskip-\trimedge
10364 \hskip-\paperwidth
10365 \fi
10366 \fi
10367 \vbox to \paperheight{%
10368 \let\protect\relax % <- v1.4 addition
10369 \hb@xt@\paperwidth{\trimmarkscolor\tmarktl\hfil\tmarktm\hfil\tmarktr}%
10370 \vfil
10371 \hb@xt@\paperwidth{\trimmarkscolor\tmarkml\hfil\tmarkmr}%
10372 \vfil
10373 \hb@xt@\paperwidth{\trimmarkscolor\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
10374 \hss}%
10375 \vss}}
10376
10377 \newcommand*{\registrationColour}[1]{#1}
10378 \newcommand*{\quarkmarks}{%
10379 \renewcommand*{\tmarktl}{\registrationColour{%
10380 \begin{picture}(0,0)
10381 \setlength{\unitlength}{1bp}\thicklines
10382 \put(-36,0){\line(1,0){24}}
10383 \put(0,12){\line(0,1){24}}
10384 \put(3,27){\normalfont\ttfamily\fontsize{8bp}{10bp}\selectfont\jobname\ \
10385 \today\ \ \printtime\ \ Page \thepage}
10386 \end{picture}}}
10387 \renewcommand*{\tmarktm}{\registrationColour{%
10388 \begin{picture}(0,0)
10389 \setlength{\unitlength}{1bp}\thicklines
10390 \put(-24,24){\line(1,0){48}}
10391 \put(0,12){\line(0,1){24}}
10392 \put(0,24){\oval(12,12)}
10393 \end{picture}}}
10394 \renewcommand*{\tmarktr}{\registrationColour{%
10395 \begin{picture}(0,0)
10396 \setlength{\unitlength}{1bp}\thicklines
10397 \put(12,0){\line(1,0){24}}
10398 \put(0,12){\line(0,1){24}}
10399 \end{picture}}}
10400 \renewcommand*{\tmarkmr}{\registrationColour{%
10401 \begin{picture}(0,0)
10402 \setlength{\unitlength}{1bp}\thicklines
10403 \put(12,0){\line(1,0){24}}
10404 \put(24,-24){\line(0,1){48}}
10405 \put(24,0){\oval(12,12)}
10406 \end{picture}}}
10407 \renewcommand*{\tmarkbr}{\registrationColour{%
10408 \begin{picture}(0,0)
10409 \setlength{\unitlength}{1bp}\thicklines
10410 \put(12,0){\line(1,0){24}}
10411 \put(0,-36){\line(0,1){24}}
10412 \end{picture}}}
10413 \renewcommand*{\tmarkbm}{\registrationColour{%
10414 \begin{picture}(0,0)
10415 \setlength{\unitlength}{1bp}\thicklines
10416 \put(-24,-24){\line(1,0){48}}
10417 \put(0,-36){\line(0,1){24}}
10418 \put(0,-24){\oval(12,12)}
10419 \end{picture}}}
10420 \renewcommand*{\tmarkbl}{\registrationColour{%
10421 \begin{picture}(0,0)
10422 \setlength{\unitlength}{1bp}\thicklines
10423 \put(-36,0){\line(1,0){24}}
10424 \put(0,-36){\line(0,1){24}}
10425 \end{picture}}}
10426 \renewcommand*{\tmarkml}{\registrationColour{%
10427 \begin{picture}(0,0)
10428 \setlength{\unitlength}{1bp}\thicklines
10429 \put(-36,0){\line(1,0){24}}
10430 \put(-24,-24){\line(0,1){48}}
10431 \put(-24,0){\oval(12,12)}
10432 \end{picture}}}
10433 %% \renewcommand*{\trimmarks}{%
10434 %% %% \special{papersize=\the\stockwidth,\the\stockheight}
10435 %% {%
10436 %% \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page
10437 %% \hb@xt@\z@{\hskip-1in
10438 %% \ifodd\c@page
10439 %% \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
10440 %% \else
10441 %% \if@twoside
10442 %% \hskip\trimedge % left of logical page
10443 %% \else
10444 %% \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
10445 %% \fi
10446 %% \fi
10447 %% \vbox to \paperheight{%
10448 %% \let\protect\relax % <- v1.4 addition
10449 %% \hb@xt@\paperwidth{\trimmarkscolor\tmarktl\hfil\tmarktm\hfil\tmarktr}%
10450 %% \vfil
10451 %% \hb@xt@\paperwidth{\trimmarkscolor\tmarkml\hfil\tmarkmr}%
10452 %% \vfil
10453 %% \hb@xt@\paperwidth{\trimmarkscolor\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
10454 %% \hss}%
10455 %% \vss}}%
10456 %% }
10457 }
10458
10459 \renewcommand\mem@trimmarks@initial@vskip{}
10460 \renewcommand\mem@trimmarks@initial@hskip{}
10461 \ifshowtrims
10462 \AddToHook{shipout/background}[./trimmarks]{%
10463 \ifshowtrims\put(0,0){\trimmarks}\fi
10464 }
10465 \fi
10466
10467 \RequirePackage{verbatim}
10468 \@ifpackagelater{verbatim}{2024/01/21}{}{
10469 \def\verbatiminput{\begingroup
10470 \@ifstar{\verbatim@input{\@setupverbvisiblespace\@vobeyspaces}}%
10471 {\verbatim@input{\frenchspacing\@vobeyspaces}}}
10472 }
10473
10474 \newcommand{\setverbatimfont}[1]{\def\m@mverbfont{#1}}
10475 \setverbatimfont{\normalfont\ttfamily}
10476 \patchcmd\verbatim@font{\normalfont\ttfamily}%
10477 {\m@mverbfont}%
10478 {}%
10479 {\typeout{Paching \string\verbatim@font\space failed}}
10480
10481 \newcommand{\setupcomment}{%
10482 \let\do\@makeother\dospecials\catcode`\^^M\active
10483 \let\verbatim@startline\relax
10484 \let\verbatim@addtoline\@gobble
10485 \let\verbatim@processline\relax
10486 \let\verbatim@finish\relax}
10487 \newcommand{\newcomment}[1]{%
10488 \expandafter\def\csname #1\endcsname{\@bsphack\setupcomment\verbatim@}%
10489 \expandafter\let\csname end#1\endcsname=\@esphack}
10490 \newcommand{\commentsoff}[1]{%
10491 \expandafter\def\csname #1\endcsname{}%
10492 \expandafter\def\csname end#1\endcsname{}}
10493 \newcommand{\commentson}[1]{\newcomment{#1}}
10494
10495 \newcommand*\tabsoff{} % defined to do nothing
10496 \newcommand*\tabson{
10497 \@memwarn{As of January 2024, \string\tabson\space has been discontinued.}
10498 }
10499
10500 \newlength\verbatimindent
10501 \newcommand*\verbatimbreakchar{} % silently does nothing as it
10502 % needs \wrappingon to be enabled
10503 \newcommand*\setverbatimbreak{} % never used
10504 \newcommand*\wrappingon{
10505 \@memwarn{As of January 2024, \string\wrappingon\space has been discontinued.}
10506 }
10507 \newcommand*\wrappingoff{} % defined to do nothing
10508 \def\wrapright{} % internal macro no longer used
10509 \newwrite \verbatim@out
10510 \def\verbatimoutput#1{%
10511 \@bsphack
10512 \immediate\openout \verbatim@out #1
10513 \let\do\@makeother\dospecials
10514 \catcode`\^^M\active %% \catcode`\^^I=12
10515 \def\verbatim@processline{%
10516 \immediate\write\verbatim@out
10517 {\the\verbatim@line}}%
10518 \verbatim@start}
10519 \def\endverbatimoutput{%
10520 \immediate\closeout\verbatim@out
10521 \@esphack}
10522 \def\fboxverbatim{\begingroup%
10523 \tabsoff %% PW otherwise box fills the width
10524 \def\verbatim@processline{%
10525 {\setbox0=\hbox{\the\verbatim@line}%
10526 \hsize=\wd0 \the\verbatim@line\par}}%
10527 \@minipagetrue%%%DPC%%%
10528 \@tempswatrue%%%DPC%%%
10529 \setbox0=\vbox\bgroup \verbatim
10530 }
10531 \def\endfboxverbatim{%
10532 \endverbatim
10533 \unskip\setbox0=\lastbox %%%DPC%%%
10534 \egroup
10535 \fbox{\box0}% <<<=== change here for centering,...
10536 \endgroup}
10537
10538 % load shortvrb instead of embedding it
10539 \RequirePackage{shortvrb}
10540
10541 \def\boxverbflag{14 }
10542 \newlength{\bvboxsep} % user can change this
10543 \setlength{\bvboxsep}{1em}
10544
10545 \newif\ifbvperpage % start/end lines on every page of multipage verbatim
10546 \bvperpagetrue
10547
10548 \newcommand{\bvtopofpage}[1]{%
10549 \long\def\b@vtop{#1}}
10550 \def\b@vtop{} % used in \boxverb@split for heading
10551
10552 \newcounter{memfbvline}
10553 \c@memfbvline=\z@
10554 \newcounter{bvlinectr}
10555 \newcommand*{\setbvlinenums}[2]{%
10556 \c@bvlinectr #1\relax \advance\c@bvlinectr \m@ne
10557 \ifnum\z@<\linemodnum% we are printing line numbers
10558 \@tempcnta #2\relax
10559 \divide\@tempcnta\linemodnum
10560 \multiply\@tempcnta\linemodnum
10561 \c@memfbvline #2\relax
10562 \advance\c@memfbvline-\@tempcnta
10563 \fi}
10564
10565 \def\theb@vlinenumber{\getthelinenumber{bvlinectr}{memfbvline}}
10566 \newcommand*{\resetbvlinenumber}{\setcounter{bvlinectr}{0}}
10567
10568 \def\b@vdocount{\ifbvcountlines\stepcounter{bvlinectr}\fi}
10569 \newlength{\bvnumlength}
10570 %% \settowidth{\bvnumlength}{\vlvnumfont 9999}
10571 \settowidth{\bvnumlength}{\normalfont 999}
10572
10573 \newif\ifbvcountinside % TRUE if line numbers inside box
10574 \bvcountinsidetrue
10575 \newcommand*{\bvnumbersinside}{\bvcountinsidetrue}
10576 \newcommand*{\bvnumbersoutside}{\bvcountinsidefalse}
10577
10578 \def\b@vdoinside{%
10579 \ifbvcountlines\ifbvcountinside%
10580 \makebox[\bvnumlength][r]{%
10581 \vlvnumfont \theb@vlinenumber\space}%
10582 \fi\fi}
10583
10584 \def\b@vdooutside{%
10585 \ifbvcountlines\ifbvcountinside\else%
10586 \llap{\makebox[\bvnumlength][r]{%
10587 \vlvnumfont \theb@vlinenumber\space}}%
10588 \fi\fi}
10589
10590 \newcommand*{\@@m@mline}{\hb@xt@\linewidth}
10591
10592 \newcommand{\setupboxverb@line}{%
10593 \par
10594 \ifbvperpage
10595 \output=\expandafter{\expandafter\boxverb@split \the\output}
10596 \fi
10597 \def\verbatim@processline{\leavevmode
10598 \b@vdocount%
10599 \bvleftsidehook\vbox{\advance% \hsize-.8\p@ \@@line % changed to \linewidth
10600 \linewidth-.8\p@ \@@line
10601 {\b@vdooutside\strut\kern\bvboxsep%
10602 \b@vdoinside%
10603 %\ift@bs
10604 % \tabverbatim@processline
10605 %\else
10606 \the\verbatim@line
10607 %\fi
10608 \hss}%
10609 \kern\bvboxsep}\bvrightsidehook\par}}
10610
10611 \newcommand{\setupbox@verb}{%
10612 \leftskip\z@skip \rightskip\z@skip
10613 \interlinepenalty\boxverbflag
10614 \parfillskip\z@ plus\p@ minus\p@
10615 \lineskip-\bvboxsep \baselineskip\z@skip
10616 \frenchspacing\@vobeyspaces%\@maybeobeytabs
10617 \boxverb@toprule}
10618
10619 \def\boxedverbatim{\begingroup
10620 \let\@@line\@@m@mline% new from mempatch v4.9
10621 \setupboxverb@line
10622 \@verbatim
10623 \setupbox@verb
10624 \verbatim@start}
10625 \def\endboxedverbatim{\bvendrulehook\endtrivlist\endgroup\@doendpe}
10626 \@namedef{boxedverbatim*}{\let\frenchspacing\@gobble \boxedverbatim}
10627 \@namelet{endboxedverbatim*}\endboxverbatim
10628
10629 \def\boxverb@toprule{\bvtoprulehook
10630 \@@line{\bvleftsidehook \bvtopmidhook \bvrightsidehook}}
10631
10632 \newcommand*{\bvendofpage}[1]{%
10633 \def\boxverb@botpage{#1}}
10634 %%%%\bvendofpage{\hrule\kern-.4pt}
10635 \bvendofpage{\hrule width\linewidth\kern-.4pt}
10636
10637 \def\boxverb@split{\ifnum\outputpenalty=\boxverbflag
10638 \ifdim\dp\@cclv=\z@
10639 %%%% \setbox\@cclv\vbox{\unvbox\@cclv\hrule\kern-.4pt}%
10640 \setbox\@cclv\vbox{\unvbox\@cclv\boxverb@botpage}%
10641 \null \kern-.7\topskip \b@vtop \boxverb@toprule
10642 \fi
10643 \fi}
10644
10645 \def\bvtoprulehook{\hrule width\linewidth \nobreak\vskip-.1\p@}
10646 \def\bvendrulehook{\hrule width\linewidth}
10647 \def\bvleftsidehook{\vrule}
10648 \def\bvrightsidehook{\vrule}
10649 \def\bvtopmidhook{\rule{0\p@}{2\bvboxsep} \hss}
10650
10651 \newcommand{\boxedverbatiminput}{\begingroup
10652 \@ifstar{\let\frenchspacing\@gobble
10653 \boxedverbatim@input\relax}%
10654 {\boxedverbatim@input{\frenchspacing\@vobeyspaces}}}
10655
10656 \def\boxedverbatim@input#1#2{%
10657 \setupboxverb@line
10658 \IfFileExists{#2}{\@verbatim #1\relax
10659 \setupbox@verb
10660 \verbatim@readfile{\@filef@und}%
10661 \bvendrulehook\endtrivlist\endgroup\@doendpe}%
10662 {\typeout {No file #2.}\endgroup}}
10663
10664 \newcommand{\bvbox}{%
10665 \bvperpagetrue%
10666 \renewcommand{\bvtoprulehook}{\hrule \nobreak \vskip-.1\p@}%
10667 \renewcommand{\bvleftsidehook}{\vrule}%
10668 \renewcommand{\bvrightsidehook}{\vrule}%
10669 \renewcommand{\bvendrulehook}{\hrule}}
10670
10671 \newcommand{\nobvbox}{%
10672 \bvperpagefalse%
10673 \renewcommand{\bvtoprulehook}{}%
10674 \renewcommand{\bvleftsidehook}{}%
10675 \renewcommand{\bvrightsidehook}{}%
10676 \renewcommand{\bvendrulehook}{}}
10677
10678 \newcommand{\bvtopandtail}{%
10679 \bvperpagefalse%
10680 \renewcommand{\bvtoprulehook}{\hrule \nobreak \vskip-.1\p@}%
10681 \renewcommand{\bvleftsidehook}{}%
10682 \renewcommand{\bvrightsidehook}{}%
10683 \renewcommand{\bvendrulehook}{\hrule}}
10684
10685 \newcommand{\bvsides}{%
10686 \bvperpagefalse%
10687 \renewcommand{\bvtoprulehook}{\vskip 3ex}%
10688 \renewcommand{\bvleftsidehook}{\vrule}%
10689 \renewcommand{\bvrightsidehook}{\vrule}%
10690 \renewcommand{\bvendrulehook}{}}
10691
10692 \let\framed\relax \let\endframed\relax
10693 \let\shaded\relax \let\endshaded\relax
10694
10695 \chardef\FrameRestore=\catcode`\| % for debug
10696 \catcode`\|=\catcode`\% % (debug: insert space after backslash)
10697
10698 \def\MakeFramed#1{\par
10699 \fb@sizeofframe\FrameCommand
10700 \let\width\fb@frw \let\height\fb@frh
10701 \begingroup
10702 \skip@\lastskip
10703 \if@nobreak\else
10704 \penalty9999 % updates \page parameters
10705 \ifdim\pagefilstretch=\z@ \ifdim\pagefillstretch=\z@
10706 \edef\@tempa{\the\skip@}%
10707 \ifx\@tempa\zero@glue \penalty-30
10708 \else \vskip-\skip@ \penalty-30 \vskip\skip@
10709 \fi\fi\fi
10710 \penalty\z@
10711 \advance\skip@ \z@ plus-.5\baselineskip
10712 \advance\skip@ \z@ plus-.231\height
10713 \advance\skip@ \z@ plus-.231\skip@
10714 \advance\skip@ \z@ plus-.231\topsep
10715 \vskip-\skip@ \penalty 1800 \vskip\skip@
10716 \fi
10717 \addvspace{\topsep}%
10718 \endgroup
10719 \penalty\@M \vskip 2\baselineskip \vskip\height
10720 \penalty9999 \vskip -2\baselineskip \vskip-\height
10721 \penalty9999 % updates \pagetotal
10722 |\message{After clearout, \pagetotal=\the\pagetotal,
10723 | \pagegoal=\the\pagegoal. }%
10724 \fb@adjheight
10725 \setbox\@tempboxa\vbox\bgroup
10726 #1% Modifications to \hsize (can use \width and \height)
10727 \textwidth\hsize \columnwidth\hsize}
10728
10729 \def\endMakeFramed{\par
10730 \kern\z@
10731 \hrule\@width\hsize\@height\z@
10732 \penalty-100 % put depth into height
10733 \egroup
10734 % {\showoutput\showbox\@tempboxa}%
10735 \begingroup
10736 \fb@put@frame\FrameCommand\FirstFrameCommand
10737 \endgroup}
10738
10739 \def\fb@put@frame#1#2{\relax
10740 \ifdim\pagegoal=\maxdimen \pagegoal\vsize \fi
10741 \ifinner
10742 \fb@putboxa#1%
10743 \fb@afterframe
10744 \else
10745 \dimen@\pagegoal \advance\dimen@-\pagetotal % natural space left on page
10746 \ifdim\dimen@<2\baselineskip % Too little room on page
10747 | \message{Page has only \the\dimen@\space room left; eject. }%
10748 \eject \fb@adjheight \fb@put@frame#1#2%
10749 \else % there's appreciable room left on the page
10750 \fb@sizeofframe#1%
10751 | \message{\string\pagetotal=\the\pagetotal,
10752 | \string\pagegoal=\the\pagegoal,
10753 | \string\pagestretch=\the\pagestretch,
10754 | \string\pageshrink=\the\pageshrink,
10755 | \string\fb@frh=\fb@frh. \space}
10756 | \message{Box of size \the\ht\@tempboxa\space + \fb@frh}%
10757 \begingroup % temporarily set \dimen@ to be...
10758 \advance\[email protected]\pageshrink % maximum space available on page
10759 \advance\dimen@-\fb@frh\relax % space available for frame's contents
10760 \expandafter\endgroup
10761 \ifdim\dimen@>\ht\@tempboxa % whole box does fit
10762 | \message{fits in \the\dimen@. }%
10763 \fb@putboxa#1%
10764 \fb@afterframe
10765 \else % box must be split
10766 | \message{must be split to fit in \the\dimen@. }%
10767 \fb@sizeofframe#2%
10768 \setbox\@tempboxa\vbox{% simulate frame and flexiblity of the page:
10769 \vskip \fb@frh \@plus\pagestretch \@minus.8\pageshrink
10770 \kern137sp\kern-137sp\penalty-30
10771 \unvbox\@tempboxa}%
10772 \edef\fb@resto@set{\boxmaxdepth\the\boxmaxdepth
10773 \splittopskip\the\splittopskip}%
10774 \boxmaxdepth\z@ \splittopskip\z@
10775 | \message{Padded box of size \the\ht\@tempboxa\space split
10776 | to \the\dimen@}%
10777 \setbox\tw@\vsplit\@tempboxa to\dimen@
10778 | \toks99\expandafter{\splitfirstmark}%
10779 | \toks98\expandafter{\splitbotmark}%
10780 | \message{Marks are: \the\toks99, \the\toks98. }%
10781 \setbox\tw@\vbox{\unvbox\tw@}% natural-sized
10782 | \message{Natural height of split box is \the\ht\tw@, leaving
10783 | \the\ht\@tempboxa\space remainder. }%
10784 \begingroup
10785 \advance\dimen@\topskip
10786 \expandafter\endgroup
10787 \ifdim\dimen@>\pagegoal
10788 | \message{Frame is big -- Use up the full column. }%
10789 \dimen@ii\pagegoal
10790 \advance\dimen@ii -\topskip
10791 \advance\dimen@ii \FrameHeightAdjust\relax
10792 \else % suspect this is wrong:
10793 \advance\[email protected]\pageshrink
10794 \ifdim\ht\tw@>\dimen@
10795 | \message{Box too tall; rebox it to \the\dimen@. }%
10796 \dimen@ii\dimen@
10797 \else % use natural size
10798 \dimen@ii\ht\tw@
10799 \fi
10800 \fi
10801 \advance\dimen@ii -\fb@frh
10802 \setbox\tw@\vbox to\dimen@ii \bgroup
10803 \vskip -\fb@frh \@plus-\pagestretch \@minus-.8\pageshrink
10804 \unvbox\tw@ \unpenalty\unpenalty
10805 \ifdim\lastkern=-137sp % whole box went to next page
10806 | \message{box split at beginning! }%
10807 % need work here???
10808 \egroup \fb@resto@set \eject % (\vskip for frame size was discarded)
10809 \fb@adjheight
10810 \fb@put@frame#1#2% INSERTED ???
10811 \else % Got material split off at the head
10812 \egroup \fb@resto@set
10813 \ifvoid\@tempboxa % it all fit after all
10814 | \message{box split at end! }%
10815 \setbox\@tempboxa\box\tw@
10816 \fb@putboxa#1%
10817 \fb@afterframe
10818 \else % it really did split
10819 | \message{box split as expected. Its reboxed height
10820 | is \the\ht\tw@. }%
10821 \ifdim\wd\tw@>\z@
10822 \wd\tw@\wd\@tempboxa
10823 \memfblineboxtwo{#2{\box\tw@}}% ??? \centerline bad idea? \\
10824 \else
10825 | \message{Zero width means likely blank.
10826 | Don't frame it (guess)}%
10827 \box\tw@
10828 \fi
10829 \hrule \@height\z@ \@width\hsize
10830 \eject
10831 \fb@adjheight
10832 \fb@put@frame\LastFrameCommand\MidFrameCommand
10833 \fi\fi\fi\fi\fi}
10834
10835 \newcommand{\memfblineboxtwo}[1]{\centerline{#1}}
10836 \newcommand{\memfblineboxa}[1]{\centerline{#1}}
10837
10838 \def\fb@putboxa#1{%
10839 \ifvoid\@tempboxa
10840 %%%% PackageWarning{framed}{Boxa is void -- discard it. }%
10841 \@memwarn{Boxa is void -- discard it. }%
10842 \else
10843 | \message{Frame and place boxa. }%
10844 | %{\showoutput\showbox\@tempboxa}%
10845 %%%%%%% \centerline{#1{\box\@tempboxa}}%
10846 \memfblineboxa{#1{\box\@tempboxa}}%
10847 \fi}
10848
10849 \def\fb@afterframe{%
10850 \nointerlineskip \null %{\showoutput \showlists}
10851 \penalty-30 \vskip\topsep \relax}
10852
10853 \newdimen\fb@frw
10854 \newdimen\fb@frh
10855 \def\fb@sizeofframe#1{\begingroup
10856 \setbox\z@\vbox{\vskip-5in \hbox{\hskip-5in
10857 #1{\hbox{\vrule \@height 4.7in \@depth.3in \@width 5in}}}%
10858 \vskip\z@skip}%
10859 | \message{Measuring frame addition for \string#1 in \@currenvir\space
10860 | gives ht \the\ht\z@\space and wd \the\wd\z@. }%
10861 \global\fb@frw\wd\z@ \global\fb@frh\ht\z@
10862 \endgroup}
10863
10864 \def\fb@adjheight{%
10865 \vbox to\FrameHeightAdjust{}% get proper baseline skip from above.
10866 \penalty\@M \nointerlineskip
10867 \vskip-\FrameHeightAdjust
10868 \penalty\@M} % useful for tops of pages
10869
10870 \edef\zero@glue{\the\z@skip}
10871
10872 \catcode`\|=\FrameRestore
10873
10874 \providecommand\FrameCommand{%
10875 \setlength\fboxrule{\FrameRule}\setlength\fboxsep{\FrameSep}%
10876 \fbox}
10877 \@ifundefined{FrameRule}{\newdimen\FrameRule \FrameRule=\fboxrule}{}
10878 \@ifundefined{FrameSep} {\newdimen\FrameSep \FrameSep =3\fboxsep}{}
10879 \providecommand\FirstFrameCommand{\FrameCommand}
10880 \providecommand\MidFrameCommand{\FrameCommand}
10881 \providecommand\LastFrameCommand{\FrameCommand}
10882 \providecommand\FrameHeightAdjust{6pt}
10883
10884 \def\FrameRestore{%
10885 \let\if@nobreak\iffalse
10886 \let\if@noskipsec\iffalse
10887 \let\-\@dischyph
10888 \let\'\@acci\let\`\@accii\let\=\@acciii
10889 % \message{FrameRestore:
10890 % \@totalleftmargin=\the \@totalleftmargin,
10891 % \rightmargin=\the\rightmargin,
10892 % \@listdepth=\the\@listdepth. }%
10893 \ifnum \ifdim\@totalleftmargin>\z@ 1\fi
10894 \ifdim\rightmargin>\z@ 1\fi
10895 \ifnum\@listdepth>0 1\fi 0>\z@
10896 % \message{In a list: \linewidth=\the\linewidth,
10897 % \@totalleftmargin=\the\@totalleftmargin,
10898 % \parshape=\the\parshape, \columnwidth=\the\columnwidth,
10899 % \hsize=\the\hsize,
10900 % \labelwidth=\the\labelwidth. }%
10901 %%% \@setminipage % snug fit around the item
10902 %%% \advance\linewidth-\columnwidth \advance\linewidth\hsize
10903 %%% \parshape\@ne \@totalleftmargin \linewidth
10904 \memfblistfixparams
10905 \else % Not in list
10906 \linewidth=\hsize
10907 %\message{No list, set \string\linewidth=\the\hsize. }%
10908 \fi
10909 \sloppy}
10910
10911 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10912
10913 \newcommand*{\memfblistfixparams}{%
10914 \@setminipage % snug fit around the item
10915 \advance\linewidth-\columnwidth \advance\linewidth\hsize
10916 \parshape\@ne \@totalleftmargin \linewidth}
10917
10918 \newenvironment{framed}% using default \FrameCommand
10919 {\MakeFramed {\advance\hsize-\width \FrameRestore}}%
10920 {\endMakeFramed}
10921
10922 \newenvironment{shaded}{%
10923 \def\FrameCommand{\fboxsep=\FrameSep \colorbox{shadecolor}}%
10924 \MakeFramed {\FrameRestore}}%
10925 {\endMakeFramed}
10926
10927 \newenvironment{leftbar}{%
10928 \def\FrameCommand{\vrule width 3pt \hspace{10pt}}%
10929 \MakeFramed {\advance\hsize-\width \FrameRestore}}%
10930 {\endMakeFramed}
10931
10932 \newenvironment{snugshade}{%
10933 \def\FrameCommand{\colorbox{shadecolor}}%
10934 \MakeFramed {\FrameRestore\@setminipage}}%
10935 {\par\unskip\endMakeFramed}
10936
10937 \AtBeginPackage{framed}{%
10938 \let\framed\relax \let\endframed\relax
10939 \let\shaded\relax \let\endshaded\relax
10940 \let\leftbar\relax \let\endleftbar\relax
10941 \let\snugshade\relax \let\endsnugshade\relax}
10942
10943 \newenvironment{qframe}{%
10944 \def\FrameCommand##1{\fboxrule=\FrameRule\fboxsep=\FrameSep
10945 \hskip\@totalleftmargin\fbox{##1}% There is no \@totalrightmargin, so...
10946 \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
10947 \MakeFramed{\advance\hsize-\width
10948 \advance\hsize \FrameSep
10949 \@totalleftmargin\z@ \linewidth=\hsize}}%
10950 {\endMakeFramed}
10951
10952 \newenvironment{qshade}{%
10953 \def\FrameCommand##1{\fboxsep=\FrameSep
10954 \hskip\@totalleftmargin
10955 \hskip -1\FrameSep
10956 \colorbox{shadecolor}{##1}%
10957 \hskip-\linewidth \hskip-\@totalleftmargin
10958 \hskip -1\FrameSep
10959 \hskip\columnwidth}%
10960 \MakeFramed{\advance\hsize-\width
10961 \advance\hsize 3\FrameSep
10962 \@totalleftmargin\z@ \linewidth=\hsize}}%
10963 {\endMakeFramed}
10964
10965 \newcommand*{\newoutputstream}[1]{%
10966 \@ifundefined{#1outstre@m}%
10967 {\expandafter\newwrite\csname #1outstre@m\endcsname
10968 \csname newif\expandafter\endcsname
10969 \csname ifstre@m#1open\endcsname
10970 \global\csname stre@m#1openfalse\endcsname
10971 \expandafter\ifx\csname atstreamopen#1\endcsname\relax
10972 \global\@namedef{atstreamopen#1}{}%
10973 \fi
10974 \expandafter\ifx\csname atstreamclose#1\endcsname\relax
10975 \global\@namedef{atstreamclose#1}{}%
10976 \fi
10977 }%
10978 {\@memwarn{Output stream #1\space is already defined}}}
10979
10980 \newcommand*{\newinputstream}[1]{%
10981 \@ifundefined{#1instre@m}%
10982 {\expandafter\newread\csname #1instre@m\endcsname
10983 \csname newif\expandafter\endcsname
10984 \csname ifstre@m#1open\endcsname
10985 \global\csname stre@m#1openfalse\endcsname
10986 \expandafter\ifx\csname atstreamopen#1\endcsname\relax
10987 \global\@namedef{atstreamopen#1}{}%
10988 \fi
10989 \expandafter\ifx\csname atstreamclose#1\endcsname\relax
10990 \global\@namedef{atstreamclose#1}{}%
10991 \fi
10992 }%
10993 {\@memwarn{Input stream #1\space is already defined}}}
10994
10995 \newcommand{\IfStreamOpen}[3]{%
10996 \csname ifstre@m#1open\endcsname#2\else#3\fi}
10997 \newcommand{\instre@mandopen}[2]{%
10998 \@ifundefined{#1instre@m}{%
10999 \@memwarn{#1\space is not an input stream}}%
11000 {\IfStreamOpen{#1}{#2}{%
11001 \@memwarn{Input stream #1\space is not open}}}}
11002
11003 \newcommand{\instre@mandclosed}[2]{%
11004 \@ifundefined{#1instre@m}{%
11005 \@memwarn{#1\space is not an input stream}}%
11006 {\IfStreamOpen{#1}{%
11007 \@memwarn{Input stream #1\space is open}}{#2}}}
11008
11009 \newcommand{\outstre@mandopen}[2]{%
11010 \@ifundefined{#1outstre@m}{%
11011 \@memwarn{#1\space is not an output stream}}%
11012 {\IfStreamOpen{#1}{#2}{%
11013 \@memwarn{Output stream #1\space is not open}}}}
11014
11015 \newcommand{\outstre@mandclosed}[2]{%
11016 \@ifundefined{#1outstre@m}{%
11017 \@memwarn{#1\space is not an output stream}}%
11018 {\IfStreamOpen{#1}{%
11019 \@memwarn{Output stream #1\space is open}}{#2}}}
11020
11021 \newcommand*{\openoutputfile}[2]{%
11022 \outstre@mandclosed{#2}{%
11023 \global\@namedef{#1@filename}{#1}%
11024 \if@filesw
11025 \immediate\openout\@nameuse{#2outstre@m}=\@nameuse{#1@filename}%
11026 \fi
11027 \global\csname stre@m#2opentrue\endcsname%
11028 \@nameuse{atstreamopen#2}}}
11029
11030 \newcommand*{\closeoutputstream}[1]{%
11031 \outstre@mandopen{#1}{%
11032 \@nameuse{atstreamclose#1}%
11033 \immediate\closeout\@nameuse{#1outstre@m}%
11034 \global\csname stre@m#1openfalse\endcsname}}
11035
11036 \newcommand{\openinputfile}[2]{%
11037 \IfFileExists{#1}{% file exists
11038 \instre@mandclosed{#2}{%
11039 \@addtofilelist{#1}%
11040 \global\@namedef{#1@filename}{#1}%
11041 \immediate\openin\@nameuse{#2instre@m}=\@nameuse{#1@filename}%
11042 \global\csname stre@m#2opentrue\endcsname%
11043 \@nameuse{atstreamopen#2}}}%
11044 {% file not found
11045 \typeout{No file #1.}
11046 }}
11047
11048 \newcommand{\closeinputstream}[1]{%
11049 \instre@mandopen{#1}{%
11050 \@nameuse{atstreamclose#1}%
11051 \immediate\closein\@nameuse{#1instre@m}%
11052 \global\csname stre@m#1openfalse\endcsname}}
11053
11054 \def\writeverbatim#1{%
11055 \@bsphack
11056 \let\do\@makeother\dospecials
11057 \catcode`\^^M\active
11058 \def\verbatim@processline{%
11059 \immediate\write\@nameuse{#1outstre@m}{\the\verbatim@line}}%
11060 \verbatim@start}
11061 \def\endwriteverbatim{\@esphack}
11062
11063 \newcommand{\addtostream}[2]{%
11064 \@bsphack
11065 \outstre@mandopen{#1}{%
11066 {\let\protect\string
11067 \immediate\write\@nameuse{#1outstre@m}{#2}%
11068 }}%
11069 \@esphack}
11070
11071 \newif\ifstre@mnoteof
11072 \newcommand{\checkstre@meof}[1]{%
11073 \stre@mnoteoftrue\ifeof\@nameuse{#1instre@m}\stre@mnoteoffalse\fi}
11074
11075 \def\readstream#1{
11076 \instre@mandopen{#1}{%
11077 \loop \checkstre@meof{#1} \ifstre@mnoteof
11078 \read\@nameuse{#1instre@m} to\temptokstre@m
11079 \temptokstre@m
11080 \repeat
11081 }}
11082
11083 \def\readaline#1{
11084 \instre@mandopen{#1}{%
11085 \ifeof\@nameuse{#1instre@m}
11086 \@memwarn{No more to read from stream #1}
11087 \else
11088 \read\@nameuse{#1instre@m} to\temptokstre@m
11089 \temptokstre@m
11090 \fi}}
11091
11092 \def\readverbatim{\begingroup
11093 %\ift@bs
11094 % \def\verbatim@processline{\tabverbatim@processline}%
11095 %\fi
11096 \@ifstar{\stre@mverb@input{\@setupverbvisiblespace\@vobeyspaces}}%{\@maybeobeytabs}}%
11097 {\stre@mverb@input{\frenchspacing\@vobeyspaces}}}%\@maybeobeytabs}}}
11098
11099 \newcommand{\stre@mverb@input}[2]{%
11100 \IfStreamOpen{#2}%
11101 {\@verbatim #1\relax
11102 \def\@verbinstre@m{\@nameuse{#2instre@m}}
11103 \verb@readstre@m\endtrivlist\endgroup\@doendpe}%
11104 {\@memwarn{Stream #2\space is not open}\endgroup}}
11105
11106 \newcommand{\verb@readstre@m}{%
11107 \verbatim@startline
11108 \expandafter\endlinechar\expandafter\m@ne
11109 \expandafter\verbatim@read@stre@m
11110 \expandafter\endlinechar\the\endlinechar\relax
11111 \verbatim@finish}
11112
11113 \newcommand{\verbatim@read@stre@m}{%
11114 \read\@verbinstre@m to\next
11115 \ifeof\@verbinstre@m
11116 \else
11117 \expandafter\verbatim@addtoline\expandafter{\next}%
11118 \verbatim@processline
11119 \verbatim@startline
11120 \expandafter\verbatim@read@stre@m
11121 \fi}
11122
11123 \newcommand{\readboxedverbatim}{\begingroup
11124 \@ifstar{\stre@mbvin\relax}%
11125 {\stre@mbvin{\frenchspacing\@vobeyspaces}}}
11126
11127 \newcommand{\stre@mbvin}[2]{%
11128 \IfStreamOpen{#2}%
11129 {\setupboxverb@line
11130 \@verbatim #1\relax
11131 \def\@verbinstre@m{\@nameuse{#2instre@m}}%
11132 \setupbox@verb
11133 \verb@readstre@m\bvendrulehook\endtrivlist\endgroup\@doendpe}%
11134 {\@memwarn{Stream #2\space is not open}\endgroup}}
11135
11136 \newcommand{\provideenvironment}{\@star@or@long\m@mprovenv}
11137 \newcommand{\m@mprovenv}[1]{\@ifundefined{#1}%
11138 {\new@environment{#1}}% % create new environment
11139 {\@memwarn{Environment `#1' already defined}%
11140 \m@mgobbleoptsandtwo}}
11141 \newcommand{\m@mgobbleoptsandtwo}{%
11142 \@ifnextchar [{\m@mgobbleoptandtwo}{\@gobbletwo}}
11143 \def\m@mgobbleoptandtwo[#1]{%
11144 \@ifnextchar [{\m@mgobbleoptandtwo}{\@gobbletwo}}
11145
11146 \newcommand*{\providecounter}[1]{%
11147 \@ifundefined{c@#1}%
11148 {\newcounter{#1}}%
11149 {\@memwarn{Counter `#1' already defined}%
11150 \@ifnextchar[{\m@mgobbleopt}{}}}
11151
11152 \def\m@mgobbleopt[#1]{}
11153
11154 \newcommand*{\providelength}[1]{%
11155 \begingroup
11156 \escapechar\m@ne\xdef\@gtempa{{\string#1}}%
11157 \endgroup
11158 \expandafter\@ifundefined\@gtempa
11159 {\newlength{#1}}%
11160 {\@memwarn{Length #1 already defined}}}
11161
11162 \newcommand*{\newloglike}{%
11163 \MarkDeprecated{\newloglike}{in 2026. We recommand using\MessageBreak%
11164 \string\DeclareMathOperator\space from amsopn (amsmath) instead.}%
11165 \@ifstar{\m@mnewlogs}{\m@mnewlog}}
11166 \newcommand*{\m@mnewlogs}[2]{%
11167 \newcommand*{#1}{\mathop{\operator@font #2}}}
11168 \newcommand*{\m@mnewlog}[2]{%
11169 \newcommand*{#1}{\mathop{\operator@font #2}\nolimits}}
11170
11171 \newcommand*{\provideloglike}{%
11172 \MarkDeprecated*{\provideloglike}{in 2026}
11173 \@ifstar{\m@mprovlogs}{\m@mprovlog}}
11174 \newcommand*{\m@mprovlogs}[2]{%
11175 \providecommand*{#1}{\mathop{\operator@font #2}}}
11176 \newcommand*{\m@mprovlog}[2]{%
11177 \providecommand*{#1}{\mathop{\operator@font #2}\nolimits}}
11178
11179 \newcommand*{\letcountercounter}[2]{%
11180 \expandafter\let\csname c@m@morig@ctr#1\expandafter\endcsname%
11181 \csname c@#1\endcsname
11182 \expandafter\let\csname c@#1\expandafter\endcsname%
11183 \csname c@#2\endcsname}
11184 \newcommand*{\unletcounter}[1]{%
11185 \expandafter\let\csname c@#1\expandafter\endcsname%
11186 \csname c@m@morig@ctr#1\endcsname}
11187
11188 \newif\ifoddpage
11189 \newif\ifstrictpagecheck
11190 \strictpagecheckfalse
11191 \newcommand*{\strictpagecheck}{\strictpagechecktrue}
11192 \newcommand*{\easypagecheck}{\strictpagecheckfalse}
11193
11194 \newcounter{cp@cntr}
11195 \newcommand{\cplabel}{^_}
11196 \DeclareRobustCommand{\checkoddpage}{%
11197 \oddpagefalse%
11198 \ifstrictpagecheck%
11199 \stepcounter{cp@cntr}\pmemlabel{\cplabel\thecp@cntr}%
11200 \@memcnta=\pmemlabelref{\cplabel\thecp@cntr}\relax
11201 \ifodd\@memcnta\oddpagetrue\fi
11202 \else
11203 \ifodd\c@page\oddpagetrue\fi
11204 \fi}
11205
11206 \gdef\thepmemc@@page{\the\c@page}
11207
11208 \long\def\pmemprotected@write#1#2#3{%
11209 \begingroup
11210 \let\thepmemc@@page\relax
11211 #2%
11212 \let\protect\@unexpandable@protect
11213 \edef\reserved@a{\write#1{#3}}%
11214 \reserved@a
11215 \endgroup
11216 \if@nobreak\ifvmode\nobreak\fi\fi}
11217
11218 \newcommand{\pmemlabel}[1]{\@bsphack
11219 \pmemprotected@write\@auxout{}%
11220 {\string\newpmemlabel{#1}{\thepmemc@@page}}%
11221 \@esphack}
11222 \newcommand{\newpmemlabel}[2]{{\global\@namedef{m@#1}{#2}}}
11223 \newcommand{\pmemlabelref}[1]{%
11224 \expandafter\ifx\csname m@#1\endcsname\relax
11225 0%
11226 \else
11227 \csname m@#1\endcsname
11228 \fi}
11229
11230 \begingroup
11231 \catcode`\Q=3
11232 \long\gdef\@ifmtarg#1{\@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil}
11233 \long\gdef\@xifmtarg#1#2Q#3#4#5\@nil{#4}
11234 \long\gdef\@ifnotmtarg#1{\@xifmtarg#1QQ\@firstofone\@gobble\@nil}
11235 \endgroup
11236
11237 \DeclareRobustCommand{\ch@ngetext}{%
11238 \setlength{\@colht}{\textheight}\setlength{\@colroom}{\textheight}%
11239 \setlength{\vsize}{\textheight}\setlength{\columnwidth}{\textwidth}%
11240 \if@twocolumn%
11241 \advance\columnwidth-\columnsep \divide\columnwidth\tw@%
11242 \@firstcolumntrue%
11243 \fi%
11244 \setlength{\hsize}{\columnwidth}%
11245 \setlength{\linewidth}{\hsize}}
11246
11247 \DeclareRobustCommand{\changetext}[5]{%
11248 \@ifmtarg{#1}{}{\addtolength{\textheight}{#1}}%
11249 \@ifmtarg{#2}{}{\addtolength{\textwidth}{#2}}%
11250 \@ifmtarg{#3}{}{\addtolength{\evensidemargin}{#3}}%
11251 \@ifmtarg{#4}{}{\addtolength{\oddsidemargin}{#4}}%
11252 \@ifmtarg{#5}{}{\addtolength{\columnsep}{#5}}%
11253 \ch@ngetext}
11254
11255 \DeclareRobustCommand{\changepage}[9]{%
11256 \@ifmtarg{#1}{}{\addtolength{\textheight}{#1}}%
11257 \@ifmtarg{#2}{}{\addtolength{\textwidth}{#2}}%
11258 \@ifmtarg{#3}{}{\addtolength{\evensidemargin}{#3}}%
11259 \@ifmtarg{#4}{}{\addtolength{\oddsidemargin}{#4}}%
11260 \@ifmtarg{#5}{}{\addtolength{\columnsep}{#5}}%
11261 \ch@ngetext
11262 \@ifmtarg{#6}{}{\addtolength{\topmargin}{#6}}%
11263 \@ifmtarg{#7}{}{\addtolength{\headheight}{#7}}%
11264 \@ifmtarg{#8}{}{\addtolength{\headsep}{#8}}%
11265 \@ifmtarg{#9}{}{\addtolength{\footskip}{#9}}}
11266
11267 \newenvironment{adjustwidth}[2]{%
11268 \begin{list}{}{%
11269 \topsep\z@%
11270 \listparindent\parindent%
11271 \parsep\parskip%
11272 \@ifmtarg{#1}{\setlength{\leftmargin}{\z@}}%
11273 {\setlength{\leftmargin}{#1}}%
11274 \@ifmtarg{#2}{\setlength{\rightmargin}{\z@}}%
11275 {\setlength{\rightmargin}{#2}}%
11276 }
11277 \item[]}{\end{list}}
11278
11279 \newenvironment{adjustwidth*}[2]{%
11280 \begin{list}{}{%
11281 \topsep\z@%
11282 \listparindent\parindent%
11283 \parsep\parskip%
11284 \checkoddpage
11285 \ifoddpage % odd numbered page
11286 \@ifmtarg{#1}{\setlength{\leftmargin}{\z@}}%
11287 {\setlength{\leftmargin}{#1}}%
11288 \@ifmtarg{#2}{\setlength{\rightmargin}{\z@}}%
11289 {\setlength{\rightmargin}{#2}}%
11290 \else % even numbered page
11291 \@ifmtarg{#2}{\setlength{\leftmargin}{\z@}}%
11292 {\setlength{\leftmargin}{#2}}%
11293 \@ifmtarg{#1}{\setlength{\rightmargin}{\z@}}%
11294 {\setlength{\rightmargin}{#1}}%
11295 \fi
11296 }
11297 \item[]}{\end{list}}
11298
11299 \newcommand{\calccentering}[1]{
11300 #1 = \paperwidth
11301 \advance #1 by -\textwidth
11302 \divide #1 by \tw@
11303 \advance #1 by -\spinemargin}
11304
11305 \newenvironment{vplace}[1][1]{%
11306 \par\vspace*{\stretch{#1}}%
11307 }{%
11308 \vspace*{\stretch{1}}%
11309 \par}
11310
11311 \newcommand{\cleartoevenpage}[1][\@empty]{%
11312 \clearpage%
11313 \ifodd\c@page\hbox{}#1\clearpage\fi}
11314
11315 \newcommand{\movetoevenpage}[1][\@empty]{%
11316 \newpage%
11317 \ifodd\c@page\hbox{}#1\newpage\fi}
11318
11319 \newcommand{\cleartooddpage}[1][\@empty]{%
11320 \clearpage%
11321 \ifodd\c@page\else\hbox{}#1\clearpage\fi}
11322
11323 \newcommand{\movetooddpage}[1][\@empty]{%
11324 \newpage%
11325 \ifodd\c@page\else\hbox{}#1\newpage\fi}
11326
11327 \newcommand{\needspace}[1]{\begingroup\setlength{\dimen@}{#1}%
11328 \vskip\z@\@plus\dimen@\penalty -100\vskip\z@\@plus-\dimen@
11329 \vskip\dimen@\penalty 9999\vskip-\dimen@\vskip\z@skip\endgroup}
11330
11331 \newcommand{\Needspace}{\@ifstar{\M@sneedsp@}{\M@needsp@}}
11332 \newcommand{\M@sneedsp@}[1]{\par \penalty-100\begingroup
11333 \setlength{\dimen@}{#1}%
11334 \dimen@ii\pagegoal \advance\dimen@ii-\pagetotal
11335 \ifdim \dimen@>\dimen@ii
11336 \break
11337 \fi\endgroup}
11338 \newcommand{\M@needsp@}[1]{\par \penalty-100\begingroup
11339 \setlength{\dimen@}{#1}%
11340 \dimen@ii\pagegoal \advance\dimen@ii-\pagetotal
11341 \ifdim \dimen@>\dimen@ii
11342 \ifdim \dimen@ii>\z@
11343 \vfil
11344 \fi
11345 \break
11346 \fi\endgroup}
11347
11348 \newcommand*{\midsloppy}{%
11349 \tolerance 5000%
11350 \hbadness 4000%
11351 \emergencystretch 1.5em%
11352 \hfuzz .1\p@
11353 \vfuzz\hfuzz}
11354 \newenvironment{midsloppypar}{\par\midsloppy}{\par}
11355
11356 \@ifl@t@r\fmtversion{2020-10-01}{
11357 % nothing to do with newer kernel
11358 }{%
11359 \providecommand{\medspace}{\kern .22222em }
11360 \DeclareRobustCommand{\:}{%
11361 \relax\ifmmode\mskip\medmuskip\else\medspace\fi}
11362 \DeclareRobustCommand{\!}{%
11363 \relax\ifmmode\mskip-\thinmuskip\else\negthinspace\fi}
11364
11365 } % end kernel version wrapper
11366 \DeclareRobustCommand*{\slashfracstyle}[1]{%
11367 {\m@th\ensuremath{\mbox{\fontsize\sf@size\z@\selectfont #1}}}}
11368 \DeclareRobustCommand*{\slashfrac}[2]{\leavevmode
11369 \raise.5ex\hbox{\slashfracstyle{#1}}\kern-.13em/%
11370 \kern-.15em\lower.25ex\hbox{\slashfracstyle{#2}}}
11371
11372 %%%%%%%%%%%%%%%%%%%% number formatting
11373
11374 \newif\iflowernumtoname
11375 \lowernumtonamefalse
11376 \newif\ifpriornum
11377 \newif\ifminusnumber
11378 \newif\ifnotnumtonameallcaps
11379 \newif\ifmakeordinal
11380
11381 \newcommand*{\namenumberand}{ and }
11382 \newcommand*{\namenumbercomma}{, }
11383 \newcommand*{\lcminusname}{minus }
11384 \newcommand*{\ucminusname}{Minus }
11385 \let\minusname\lcminusname
11386 \newcommand*{\fnumbersep}{,}
11387 \newcommand*\tensunitsep{-}
11388 \newcommand*{\nthstring}{th} % nth
11389 \newcommand*{\iststring}{st} % 1st
11390 \newcommand*{\iindstring}{nd} % 2nd
11391 \newcommand*{\iiirdstring}{rd} % 3rd
11392 \newcommand*{\tiethstring}{tieth} % tieth
11393 \newcommand*{\teenstring}{teen} % teen
11394 \newcommand{\ordscript}[1]{#1}
11395
11396 \chardef\m@mten=10 % shorthand for 10
11397
11398 \newcounter{ism@mctr} % units
11399 \newcounter{xsm@mctr} % tens
11400 \newcounter{csm@mctr} % hundreds
11401 \newcounter{ksm@mctr} % thousands
11402 \newcounter{xksm@mctr} % ten thousands
11403 \newcounter{cksm@mctr} % hundred thousands
11404 \newcounter{msm@mctr} % millions
11405 \newcounter{xmsm@mctr} % ten millions
11406 \newcounter{cmsm@mctr} % hundred millions
11407 \newcounter{bsm@mctr} % billions
11408 \newcounter{workm@mctr}
11409
11410 \newcommand*{\numdigits}[1]{%
11411 \setcounter{ism@mctr}{0}%
11412 \setcounter{xsm@mctr}{0}%
11413 \setcounter{csm@mctr}{0}%
11414 \setcounter{ksm@mctr}{0}%
11415 \setcounter{xksm@mctr}{0}%
11416 \setcounter{cksm@mctr}{0}%
11417 \setcounter{msm@mctr}{0}%
11418 \setcounter{xmsm@mctr}{0}%
11419 \setcounter{cmsm@mctr}{0}%
11420 \setcounter{bsm@mctr}{0}%
11421 \setcounter{workm@mctr}{#1}%
11422 \minusnumberfalse
11423 \ifnum \c@workm@mctr < \z@ % negative
11424 \minusnumbertrue
11425 \c@workm@mctr = -\c@workm@mctr
11426 \fi
11427 \ifnum \c@workm@mctr > \m@ne % units
11428 \c@ism@mctr = \c@workm@mctr
11429 \divide \c@workm@mctr by \m@mten
11430 \multiply \c@workm@mctr by \m@mten
11431 \advance \c@ism@mctr by -\c@workm@mctr
11432 \divide \c@workm@mctr by \m@mten
11433 \fi
11434 \ifnum \c@workm@mctr > \z@ % tens
11435 \c@xsm@mctr = \c@workm@mctr
11436 \divide \c@workm@mctr by \m@mten
11437 \multiply \c@workm@mctr by \m@mten
11438 \advance \c@xsm@mctr by -\c@workm@mctr
11439 \divide \c@workm@mctr by \m@mten
11440 \fi
11441 \ifnum \c@workm@mctr > \z@ % hundreds
11442 \c@csm@mctr = \c@workm@mctr
11443 \divide \c@workm@mctr by \m@mten
11444 \multiply \c@workm@mctr by \m@mten
11445 \advance \c@csm@mctr by -\c@workm@mctr
11446 \divide \c@workm@mctr by \m@mten
11447 \fi
11448 \ifnum \c@workm@mctr > \z@ % thousands
11449 \c@ksm@mctr = \c@workm@mctr
11450 \divide \c@workm@mctr by \m@mten
11451 \multiply \c@workm@mctr by \m@mten
11452 \advance \c@ksm@mctr by -\c@workm@mctr
11453 \divide \c@workm@mctr by \m@mten
11454 \fi
11455 \ifnum \c@workm@mctr > \z@ % ten thousands
11456 \c@xksm@mctr = \c@workm@mctr
11457 \divide \c@workm@mctr by \m@mten
11458 \multiply \c@workm@mctr by \m@mten
11459 \advance \c@xksm@mctr by -\c@workm@mctr
11460 \divide \c@workm@mctr by \m@mten
11461 \fi
11462 \ifnum \c@workm@mctr > \z@ % hundred thousands
11463 \c@cksm@mctr = \c@workm@mctr
11464 \divide \c@workm@mctr by \m@mten
11465 \multiply \c@workm@mctr by \m@mten
11466 \advance \c@cksm@mctr by -\c@workm@mctr
11467 \divide \c@workm@mctr by \m@mten
11468 \fi
11469 \ifnum \c@workm@mctr > \z@ % millions
11470 \c@msm@mctr = \c@workm@mctr
11471 \divide \c@workm@mctr by \m@mten
11472 \multiply \c@workm@mctr by \m@mten
11473 \advance \c@msm@mctr by -\c@workm@mctr
11474 \divide \c@workm@mctr by \m@mten
11475 \fi
11476 \ifnum \c@workm@mctr > \z@ % ten millions
11477 \c@xmsm@mctr = \c@workm@mctr
11478 \divide \c@workm@mctr by \m@mten
11479 \multiply \c@workm@mctr by \m@mten
11480 \advance \c@xmsm@mctr by -\c@workm@mctr
11481 \divide \c@workm@mctr by \m@mten
11482 \fi
11483 \ifnum \c@workm@mctr > \z@ % hundred millions
11484 \c@cmsm@mctr = \c@workm@mctr
11485 \divide \c@workm@mctr by \m@mten
11486 \multiply \c@workm@mctr by \m@mten
11487 \advance \c@cmsm@mctr by -\c@workm@mctr
11488 \divide \c@workm@mctr by \m@mten
11489 \fi
11490 \ifnum \c@workm@mctr > \z@% billions
11491 \c@bsm@mctr = \c@workm@mctr
11492 \divide \c@workm@mctr by \m@mten
11493 \multiply \c@workm@mctr by \m@mten
11494 \advance \c@bsm@mctr by -\c@workm@mctr
11495 \fi}
11496
11497 \newcommand*{\form@tnumber}[1]{%
11498 \numdigits{#1}%
11499 \ifminusnumber-\fi
11500 \priornumfalse
11501 \ifnum \c@bsm@mctr > \z@ % billions
11502 \priornumtrue
11503 \thebsm@mctr\fnumbersep
11504 \fi
11505 \ifpriornum % hundred millions
11506 \thecmsm@mctr
11507 \else
11508 \ifnum \c@cmsm@mctr > \z@
11509 \priornumtrue
11510 \thecmsm@mctr
11511 \fi
11512 \fi
11513 \ifpriornum % ten millions
11514 \thexmsm@mctr
11515 \else
11516 \ifnum \c@xmsm@mctr > \z@
11517 \priornumtrue
11518 \thexmsm@mctr
11519 \fi
11520 \fi
11521 \ifpriornum % millions
11522 \themsm@mctr\fnumbersep
11523 \else
11524 \ifnum \c@msm@mctr > \z@
11525 \priornumtrue
11526 \themsm@mctr\fnumbersep
11527 \fi
11528 \fi
11529 \ifpriornum % hundred thousands
11530 \thecksm@mctr
11531 \else
11532 \ifnum \c@cksm@mctr > \z@
11533 \priornumtrue
11534 \thecksm@mctr
11535 \fi
11536 \fi
11537 \ifpriornum % ten thousands
11538 \thexksm@mctr
11539 \else
11540 \ifnum \c@xksm@mctr > \z@
11541 \priornumtrue
11542 \thexksm@mctr
11543 \fi
11544 \fi
11545 \ifpriornum % thousands
11546 \theksm@mctr\fnumbersep
11547 \else
11548 \ifnum \c@ksm@mctr > \z@
11549 \priornumtrue
11550 \theksm@mctr\fnumbersep
11551 \fi
11552 \fi
11553 \ifpriornum % hundreds
11554 \thecsm@mctr
11555 \else
11556 \ifnum \c@csm@mctr > \z@
11557 \priornumtrue
11558 \thecsm@mctr
11559 \fi
11560 \fi
11561 \ifpriornum % tens
11562 \thexsm@mctr
11563 \else
11564 \ifnum \c@xsm@mctr > \z@
11565 \priornumtrue
11566 \thexsm@mctr
11567 \fi
11568 \fi
11569 \theism@mctr} % units
11570
11571 \newcommand*{\cardinal}[1]{%
11572 \begingroup
11573 \let\fnumbersep\relax
11574 \form@tnumber{#1}%
11575 \endgroup}
11576 \newcommand*{\fcardinal}[1]{%
11577 \begingroup
11578 \form@tnumber{#1}%
11579 \endgroup}
11580
11581 \newcommand*{\ordinal}[1]{%
11582 \begingroup
11583 \let\fnumbersep\relax
11584 \form@tnumber{#1}%
11585 \let\ordstring\nthstring
11586 \ifnum \c@xsm@mctr=\@ne\else
11587 \ifcase \c@ism@mctr
11588 \or \let\ordstring\iststring% 1st
11589 \or \let\ordstring\iindstring% 2nd
11590 \or \let\ordstring\iiirdstring% 3rd
11591 \fi
11592 \fi
11593 \ordscript{\ordstring}%
11594 \endgroup
11595 }
11596 \newcommand*{\fordinal}[1]{%
11597 \begingroup
11598 \form@tnumber{#1}%
11599 \let\ordstring\nthstring
11600 \ifnum \c@xsm@mctr=\@ne\else
11601 \ifcase \c@ism@mctr
11602 \or \let\ordstring\iststring% 1st
11603 \or \let\ordstring\iindstring% 2nd
11604 \or \let\ordstring\iiirdstring% 3rd
11605 \fi
11606 \fi
11607 \ordscript{\ordstring}%
11608 \endgroup
11609 }
11610
11611 \newcommand*\nNameo{\iflowernumtoname z\else Z\fi ero}
11612 \newcommand*\nNamec{\iflowernumtoname h\else H\fi undred}
11613 \newcommand*\nNamem{\iflowernumtoname t\else T\fi housand}
11614 \newcommand*\nNamemm{\iflowernumtoname m\else M\fi illion}
11615 \newcommand*\nNamemmm{\iflowernumtoname b\else B\fi illion}
11616
11617 \newcommand*\nNamei{\iflowernumtoname o\else O\fi ne}
11618 \newcommand*\nNameii{\iflowernumtoname t\else T\fi wo}
11619 \newcommand*\nNameiii{\iflowernumtoname t\else T\fi hree}
11620 \newcommand*\nNameiv{\iflowernumtoname f\else F\fi our}
11621 \newcommand*\nNamev{\iflowernumtoname f\else F\fi ive}
11622 \newcommand*\nNamevi{\iflowernumtoname s\else S\fi ix}
11623 \newcommand*\nNamevii{\iflowernumtoname s\else S\fi even}
11624 \newcommand*\nNameviii{\iflowernumtoname e\else E\fi ight}
11625 \newcommand*\nNameix{\iflowernumtoname n\else N\fi ine}
11626 \newcommand*\nNamex{\iflowernumtoname t\else T\fi en}
11627 \newcommand*\nNamexi{\iflowernumtoname e\else E\fi leven}
11628 \newcommand*\nNamexii{\iflowernumtoname t\else T\fi welve}
11629 \newcommand*\nNamexiii{\iflowernumtoname t\else T\fi hir\teenstring}
11630 \newcommand*\nNamexiv{\iflowernumtoname f\else F\fi our\teenstring}
11631 \newcommand*\nNamexv{\iflowernumtoname f\else F\fi if\teenstring}
11632 \newcommand*\nNamexvi{\iflowernumtoname s\else S\fi ix\teenstring}
11633 \newcommand*\nNamexvii{\iflowernumtoname s\else S\fi even\teenstring}
11634 \newcommand*\nNamexviii{\iflowernumtoname e\else E\fi igh\teenstring}
11635 \newcommand*\nNamexix{\iflowernumtoname n\else N\fi ine\teenstring}
11636 \newcommand*\nNamexx{\iflowernumtoname t\else T\fi wenty}
11637 \newcommand*\nNamexxx{\iflowernumtoname t\else T\fi hirty}
11638 \newcommand*\nNamexl{\iflowernumtoname f\else F\fi orty}
11639 \newcommand*\nNamel{\iflowernumtoname f\else F\fi ifty}
11640 \newcommand*\nNamelx{\iflowernumtoname s\else S\fi ixty}
11641 \newcommand*\nNamelxx{\iflowernumtoname s\else S\fi eventy}
11642 \newcommand*\nNamelxxx{\iflowernumtoname e\else E\fi ighty}
11643 \newcommand*\nNamexc{\iflowernumtoname n\else N\fi inety}
11644
11645 \newcommand*{\unitnumbername}[1]{%
11646 \ifcase #1 \nNameo\or
11647 \nNamei\or
11648 \nNameii\or
11649 \nNameiii\or
11650 \nNameiv\or
11651 \nNamev\or
11652 \nNamevi\or
11653 \nNamevii\or
11654 \nNameviii\or
11655 \nNameix\fi}
11656
11657 \newcommand*{\teennumbername}[1]{%
11658 \ifcase #1 \nNamex\or
11659 \nNamexi\or
11660 \nNamexii\or
11661 \nNamexiii\or
11662 \nNamexiv\or
11663 \nNamexv\or
11664 \nNamexvi\or
11665 \nNamexvii\or
11666 \nNamexviii\or
11667 \nNamexix\fi}
11668
11669 \newcommand*{\tensnumbername}[2]{%
11670 \ifnum #1=\@ne
11671 \teennumbername{#2}\ifnotnumtonameallcaps\lowernumtonametrue\fi
11672 \else
11673 \ifcase #1
11674 \or
11675 \or \nNamexx
11676 \or \nNamexxx
11677 \or \nNamexl
11678 \or \nNamel
11679 \or \nNamelx
11680 \or \nNamelxx
11681 \or \nNamelxxx
11682 \or \nNamexc
11683 \fi
11684 \ifnotnumtonameallcaps\lowernumtonametrue\fi
11685 \ifnum #2 > \z@ \tensunitsep\unitnumbername{#2}\fi
11686 \fi}
11687
11688 \newcommand*\nthNameo{\nNameo\nthstring}
11689 \newcommand*\nthNamei{\iflowernumtoname f\else F\fi irst}
11690 \newcommand*\nthNameii{\iflowernumtoname s\else S\fi econd}
11691 \newcommand*\nthNameiii{\iflowernumtoname t\else T\fi hird}
11692 \newcommand*\nthNameiv{\nNameiv\nthstring}
11693 \newcommand*\nthNamev{\iflowernumtoname f\else F\fi if\nthstring}
11694 \newcommand*\nthNamevi{\nNamevi\nthstring}
11695 \newcommand*\nthNamevii{\nNamevii\nthstring}
11696 \newcommand*\nthNameviii{\iflowernumtoname e\else E\fi igh\nthstring}
11697 \newcommand*\nthNameix{\iflowernumtoname n\else N\fi in\nthstring}
11698 \newcommand*\nthNamexii{\iflowernumtoname t\else T\fi welf\nthstring}
11699
11700 \newcommand*{\unitordinalname}[1]{%
11701 \ifcase #1 \nthNameo\or
11702 \nthNamei\or
11703 \nthNameii\or
11704 \nthNameiii\or
11705 \nthNameiv\or
11706 \nthNamev\or
11707 \nthNamevi\or
11708 \nthNamevii\or
11709 \nthNameviii\or
11710 \nthNameix\fi}
11711
11712 \newcommand*{\teenordinalname}[1]{%
11713 \ifcase #1 \nNamex\nthstring\or
11714 \nNamexi\nthstring\or
11715 \nthNamexii\or
11716 \nNamexiii\nthstring\or
11717 \nNamexiv\nthstring\or
11718 \nNamexv\nthstring\or
11719 \nNamexvi\nthstring\or
11720 \nNamexvii\nthstring\or
11721 \nNamexviii\nthstring\or
11722 \nNamexix\nthstring\fi}
11723
11724 \newcommand*{\tensordinalname}[2]{%
11725 \ifnum #1=\@ne
11726 \teenordinalname{#2}\ifnotnumtonameallcaps\lowernumtonametrue\fi
11727 \else
11728 \ifnum #2> \z@
11729 \ifcase #1
11730 \or
11731 \or \nNamexx
11732 \or \nNamexxx
11733 \or \nNamexl
11734 \or \nNamel
11735 \or \nNamelx
11736 \or \nNamelxx
11737 \or \nNamelxxx
11738 \or \nNamexc
11739 \fi
11740 \ifnotnumtonameallcaps\lowernumtonametrue\fi
11741 \tensunitsep\unitordinalname{#2}
11742 \else
11743 \ifcase #1
11744 \or
11745 \or \nthNamexx
11746 \or \nthNamexxx
11747 \or \nthNamexl
11748 \or \nthNamel
11749 \or \nthNamelx
11750 \or \nthNamelxx
11751 \or \nthNamelxxx
11752 \or \nthNamexc
11753 \fi
11754 \ifnotnumtonameallcaps\lowernumtonametrue\fi
11755 \fi
11756 \fi}
11757
11758 \newcommand*\nthNamexx{\iflowernumtoname t\else T\fi wen\tiethstring}
11759 \newcommand*\nthNamexxx{\iflowernumtoname t\else T\fi hir\tiethstring}
11760 \newcommand*\nthNamexl{\iflowernumtoname f\else F\fi or\tiethstring}
11761 \newcommand*\nthNamel{\iflowernumtoname f\else F\fi if\tiethstring}
11762 \newcommand*\nthNamelx{\iflowernumtoname s\else S\fi ix\tiethstring}
11763 \newcommand*\nthNamelxx{\iflowernumtoname s\else S\fi even\tiethstring}
11764 \newcommand*\nthNamelxxx{\iflowernumtoname e\else E\fi igh\tiethstring}
11765 \newcommand*\nthNamexc{\iflowernumtoname n\else N\fi ine\tiethstring}
11766
11767 \newcommand*{\n@me@number}[1]{%
11768 \begingroup
11769 \numdigits{#1}%
11770 \ifminusnumber\minusname\fi
11771 \priornumfalse
11772 %% billions
11773 \ifnum \c@bsm@mctr > \z@
11774 \unitnumbername{\thebsm@mctr}\space
11775 \ifnotnumtonameallcaps\lowernumtonametrue\fi\nNamemmm
11776 \priornumtrue
11777 \fi
11778 %% hundred millions
11779 \ifnum \c@cmsm@mctr > \z@
11780 \ifpriornum\namenumbercomma\fi
11781 \unitnumbername{\thecmsm@mctr}\space
11782 \ifnotnumtonameallcaps\lowernumtonametrue\fi\nNamec
11783 \priornumtrue
11784 \fi
11785 %% tens/units millions
11786 \ifnum \c@xmsm@mctr > \z@
11787 \ifpriornum
11788 \ifnum\c@cmsm@mctr>\z@\namenumberand\else\namenumbercomma\fi
11789 \fi
11790 \tensnumbername{\thexmsm@mctr}{\themsm@mctr}%
11791 \priornumtrue
11792 \else
11793 \ifnum \c@msm@mctr > \z@
11794 \ifpriornum
11795 \ifnum\c@cmsm@mctr>\z@\namenumberand\else\namenumbercomma\fi
11796 \fi
11797 \unitnumbername{\themsm@mctr}%
11798 \ifnotnumtonameallcaps\lowernumtonametrue\fi
11799 \priornumtrue
11800 \fi
11801 \fi
11802 \ifnum \c@cmsm@mctr > \z@
11803 \ifpriornum\space\fi
11804 \nNamemm
11805 \else
11806 \ifnum \c@xmsm@mctr > \z@
11807 \ifpriornum\space\fi
11808 \nNamemm
11809 \else
11810 \ifnum \c@msm@mctr > \z@
11811 \ifpriornum\space\fi
11812 \nNamemm
11813 \fi
11814 \fi
11815 \fi
11816 %% hundred thousands
11817 \ifnum \c@cksm@mctr > \z@
11818 \ifpriornum\namenumbercomma\fi
11819 \unitnumbername{\thecksm@mctr}\space
11820 \ifnotnumtonameallcaps\lowernumtonametrue\fi\nNamec
11821 \priornumtrue
11822 \fi
11823 %% tens/units thousands
11824 \ifnum \c@xksm@mctr > \z@
11825 \ifpriornum
11826 \ifnum\c@cksm@mctr>\z@\namenumberand\else\namenumbercomma\fi
11827 \fi
11828 \tensnumbername{\thexksm@mctr}{\theksm@mctr}%
11829 \priornumtrue
11830 \else
11831 \ifnum \c@ksm@mctr > \z@
11832 \ifpriornum
11833 \ifnum\c@cksm@mctr>\z@\namenumberand\else\namenumbercomma\fi
11834 \fi
11835 \unitnumbername{\theksm@mctr}%
11836 \ifnotnumtonameallcaps\lowernumtonametrue\fi
11837 \priornumtrue
11838 \fi
11839 \fi
11840 \ifnum \c@cksm@mctr > \z@
11841 \ifpriornum\space\fi
11842 \nNamem
11843 \else
11844 \ifnum \c@xksm@mctr > \z@
11845 \ifpriornum\space\fi
11846 \nNamem
11847 \else
11848 \ifnum \c@ksm@mctr > \z@
11849 \ifpriornum\space\fi
11850 \nNamem
11851 \fi
11852 \fi
11853 \fi
11854 %% hundreds
11855 \ifnum \c@csm@mctr > \z@
11856 \ifpriornum\namenumbercomma\fi
11857 \unitnumbername{\thecsm@mctr}\space
11858 \ifnotnumtonameallcaps\lowernumtonametrue\fi\nNamec
11859 \priornumtrue
11860 \fi
11861 %% tens/units
11862 \ifmakeordinal
11863 \ifnum \c@xsm@mctr > \z@
11864 \ifpriornum\namenumberand\fi
11865 \tensordinalname{\thexsm@mctr}{\theism@mctr}%
11866 \else
11867 \ifnum \c@ism@mctr > \z@
11868 \ifpriornum\namenumberand\fi
11869 \unitordinalname{\theism@mctr}%
11870 \else
11871 \ifpriornum\nthstring\else\unitordinalname{\theism@mctr}\fi
11872 \fi
11873 \fi
11874 \else % not ordinal
11875 \ifnum \c@xsm@mctr > \z@
11876 \ifpriornum\namenumberand\fi
11877 \tensnumbername{\thexsm@mctr}{\theism@mctr}%
11878 \else
11879 \ifnum \c@ism@mctr > \z@
11880 \ifpriornum\namenumberand\fi
11881 \unitnumbername{\theism@mctr}%
11882 \else
11883 \ifpriornum\else\unitnumbername{\theism@mctr}\fi
11884 \fi
11885 \fi
11886 \fi % end ifmakeordinal
11887 \endgroup}
11888
11889 \DeclareRobustCommand{\numtoname}[1]{%
11890 \makeordinalfalse
11891 \notnumtonameallcapstrue%
11892 \lowernumtonametrue%
11893 \n@me@number{#1}}
11894
11895 \DeclareRobustCommand{\numtoName}[1]{%
11896 \makeordinalfalse
11897 \notnumtonameallcapstrue%
11898 \lowernumtonamefalse%
11899 \n@me@number{#1}}
11900
11901 \DeclareRobustCommand{\NumToName}[1]{%
11902 \makeordinalfalse
11903 \notnumtonameallcapsfalse%
11904 \lowernumtonamefalse%
11905 \n@me@number{#1}}
11906
11907 \DeclareRobustCommand{\ordinaltoname}[1]{%
11908 \makeordinaltrue
11909 \notnumtonameallcapstrue%
11910 \lowernumtonametrue%
11911 \n@me@number{#1}}
11912
11913 \DeclareRobustCommand{\ordinaltoName}[1]{%
11914 \makeordinaltrue
11915 \notnumtonameallcapstrue%
11916 \lowernumtonamefalse%
11917 \n@me@number{#1}}
11918
11919 \DeclareRobustCommand{\OrdinalToName}[1]{%
11920 \makeordinaltrue
11921 \notnumtonameallcapsfalse%
11922 \lowernumtonamefalse%
11923 \n@me@number{#1}}
11924
11925 \long\def \@topnewpage [#1]{%
11926 \@nodocument
11927 \@next\@currbox\@freelist{}{}%
11928 \global \setbox\@currbox
11929 \vbox {%
11930 \break
11931 \prevdepth\z@
11932 \begingroup
11933 \normalcolor
11934 \hsize\textwidth
11935 \@parboxrestore
11936 \col@number \@ne
11937 #1%
11938 \vskip -\dbltextfloatsep
11939 \endgroup
11940 \null % ordinary \baselineskip
11941 \vskip -\topskip
11942 }%
11943 \begingroup %% \showbox\@currbox
11944 \splitmaxdepth\maxdepth \splittopskip\topskip
11945 \setbox\@tempboxa \vsplit\@currbox to \z@
11946 \endgroup %% \showbox\@currbox
11947 \ifdim \ht\@currbox>\textheight
11948 \ht\@currbox \textheight
11949 \fi
11950 \global \count\@currbox \tw@
11951 \@tempdima -\ht\@currbox
11952 \advance \@tempdima -\dbltextfloatsep
11953 \global \advance \@colht \@tempdima
11954 \ifx \@dbltoplist \@empty
11955 \else
11956 \@latexerr{Float(s) lost}\@ehb
11957 \let \@dbltoplist \@empty
11958 \fi
11959 \@cons \@dbltoplist \@currbox
11960 \global \@dbltopnum \m@ne
11961 \ifdim \@colht<2.5\baselineskip
11962 \@latex@warning@no@line {Optional argument of \noexpand\twocolumn
11963 too tall on page \thepage}%
11964 \@emptycol
11965 \if@firstcolumn
11966 \else
11967 \@emptycol
11968 \fi
11969 \else
11970 \global \vsize \@colht
11971 \global \@colroom \@colht
11972 \@floatplacement
11973 \fi}
11974
11975 \newcommand*{\m@mcalchm}{%
11976 \count0 = \time \divide \count0 by 60\relax
11977 \count2 = \count0\relax% the hour
11978 \count4 = \time \multiply\count0 by 60\relax
11979 \advance\count4 by -\count0\relax% the minute
11980 \ifnum\count4<10 \toks1 = {0}% make a leading zero
11981 \else \toks1 = {}%
11982 \fi}
11983 %%% punctuation, am and pm for \printtime
11984 \newcommand*{\hmpunct}{:}% hours minutes separator
11985 \newcommand*{\amname}{am}% ante meridiem
11986 \newcommand*{\pmname}{pm}% post meridiem
11987
11988 \newcommand*{\printtime}{%
11989 \@ifstar{\m@msprtime}{\m@mprtime}}
11990 \newcommand*{\m@mprtime}{\begingroup
11991 \m@mcalchm
11992 \number\count2\hmpunct\the\toks1 \number\count4
11993 \endgroup}
11994 \newcommand*{\m@msprtime}{\begingroup
11995 \m@mcalchm
11996 \def\@mpm{\pmname}%
11997 \ifnum\count2<1\relax% early in the morning
11998 \count2=12\relax
11999 \ifnum\count4>0\relax% not midnight
12000 \def\@mpm{\amname}%
12001 \fi
12002 \else
12003 \ifnum\time<721\relax% noon or earlier
12004 \def\@mpm{\amname}%
12005 \else
12006 \ifnum\time>779\relax% 1300 hrs or later
12007 \advance\count2 by -12\relax
12008 \fi
12009 \fi
12010 \fi
12011 \number\count2\hmpunct\the\toks1 \number\count4\ \@mpm
12012 \endgroup}
12013
12014 \newcounter{sheetsequence}
12015 \setcounter{sheetsequence}{1}
12016 \renewcommand{\thesheetsequence}{\@arabic\c@sheetsequence}
12017 \g@addto@macro{\@outputpage}{\stepcounter{sheetsequence}}
12018
12019 \newcounter{lastsheet}
12020 \setcounter{lastsheet}{0}
12021 \newcounter{lastpage}
12022 \setcounter{lastpage}{0}
12023
12024 \newcommand{\dol@stsheet}{%
12025 \if@filesw
12026 \addtocounter{sheetsequence}{-1}%
12027 \immediate\write\@auxout%
12028 {\string\memsetcounter{lastsheet}{\the\c@sheetsequence}}%
12029 \stepcounter{sheetsequence}%
12030 \fi}
12031 \newcommand{\dol@stpage}{%
12032 \if@filesw
12033 \addtocounter{page}{-1}%
12034 \immediate\write\@auxout%
12035 {\string\memsetcounter{lastpage}{\the\c@page}}%
12036 \stepcounter{page}%
12037 \fi}
12038 \AtBeginDocument{\AtEndDocument{\clearpage\dol@stsheet\dol@stpage}}
12039
12040 \newif\ifcntrmod
12041 \newif\ifnotcntrmod
12042 \newcommand*{\iscntrmod}[2]{
12043 \@tempcnta=\@nameuse{c@#1}%
12044 \@tempcntb=\@tempcnta
12045 \divide\@tempcnta #2\relax
12046 \multiply\@tempcnta #2\relax
12047 \advance\@tempcntb-\@tempcnta
12048 \ifnum\@tempcntb=0\relax
12049 \cntrmodtrue
12050 \notcntrmodfalse
12051 \else
12052 \cntrmodfalse
12053 \notcntrmodtrue
12054 \fi}
12055
12056 \newcommand*{\@memensuresigpages}{%
12057 \ifnum\@mempagespersig<\@ne
12058 \else
12059 \iscntrmod{sheetsequence}{\@mempagespersig}
12060 \ifcntrmod
12061 \else
12062 \clearpage
12063 \pagestyle{empty}
12064 \mbox{}
12065 \loop
12066 \iscntrmod{sheetsequence}{\@mempagespersig}
12067 \ifnotcntrmod
12068 \clearpage
12069 \pagestyle{empty}
12070 \mbox{}
12071 \repeat
12072 \fi
12073 \fi}
12074
12075 \newcommand*{\leavespergathering}[1]{\@memcnta=#1\relax
12076 \ifnum\@memcnta<\tw@
12077 \def\@mempagespersig{-1}%
12078 \else
12079 \multiply\@memcnta \tw@
12080 \edef\@mempagespersig{\@memcnta}%
12081 \fi}
12082 \leavespergathering{0}
12083
12084 \AtEndDocument{\@memensuresigpages}
12085
12086 \AtBeginDocument{
12087 \providecommand\MakeTextUppercase{\MakeUppercase}
12088 \providecommand\MakeTextLowercase{\MakeLowercase}
12089 }
12090 \newcommand\MemRestoreOrigMakecase{
12091 \@memarn{\string\MemRestoreOrigMakecase\ no longer does anything and can be removed}
12092 }
12093 \newcommand*{\abstractname}{Abstract}
12094 \newcommand*{\contentsname}{Contents}
12095 \newcommand*{\listfigurename}{List of Figures}
12096 \newcommand*{\listtablename}{List of Tables}
12097 \newcommand*{\bookname}{Book}
12098 \newcommand*{\partname}{Part}
12099 \newcommand*{\chaptername}{Chapter}
12100 \newcommand*{\appendixname}{Appendix}
12101 \newcommand*{\appendixtocname}{Appendices}
12102 \newcommand*{\appendixpagename}{Appendices}
12103 \newcommand*{\bibname}{Bibliography}
12104 \newcommand*{\indexname}{Index}
12105 \newcommand*{\glossaryname}{Glossary}
12106 \newcommand*{\figurename}{Figure}
12107 \newcommand*{\tablename}{Table}
12108 \newcommand*{\figurerefname}{\figurename}
12109 \newcommand*{\tablerefname}{\tablename}
12110 \newcommand*{\pagename}{page}
12111 \newcommand*{\pagerefname}{\pagename}
12112 \newcommand*{\bookrefname}{\bookname}
12113 \newcommand*{\partrefname}{\partname}
12114 \newcommand*{\chapterrefname}{\chaptername}
12115 \newcommand*{\sectionrefname}{\S}
12116 \newcommand*{\appendixrefname}{\appendixname}
12117
12118 \newcommand{\today}{\ifcase\month\or
12119 January\or February\or March\or April\or May\or June\or
12120 July\or August\or September\or October\or November\or December\fi
12121 \space\number\day, \number\year}
12122 \setlength\columnsep{10\p@}
12123 \setlength\columnseprule{0\p@}
12124 \setcounter{part}{0}
12125 \setcounter{chapter}{0}
12126 \setcounter{tocdepth}{1}
12127 \setcounter{secnumdepth}{2}
12128 \maxsecnumdepth{section}
12129
12130 \linenumberfrequency{0}
12131 \linenumberfont{\small\rmfamily}
12132 \settowidth{\bvnumlength}{\vlvnumfont 9999}
12133
12134 \if@twoside
12135 \else
12136 \raggedbottom
12137 \fi
12138 \if@twocolumn
12139 \twocolumn
12140 \sloppy
12141 \flushbottom
12142 \else
12143 \onecolumn
12144 \fi
12145
12146 \newfloat[chapter]{figure}{lof}{\figurename}
12147 \renewcommand{\thefigure}{\thechapter.\@arabic\c@figure}
12148
12149 \newlistof{listoffigures}{lof}{\listfigurename}
12150 \newlistentry[chapter]{figure}{lof}{0}
12151 \cftsetindents{figure}{0em}{2.3em}
12152
12153 \newfloat[chapter]{table}{lot}{\tablename}
12154 \renewcommand{\thetable}{\thechapter.\@arabic\c@table}
12155
12156 \newlistof{listoftables}{lot}{\listtablename}
12157 \newlistentry[chapter]{table}{lot}{0}
12158 \cftsetindents{table}{0em}{2.3em}
12159
12160 %%%\AtBeginDocument{%
12161 %%% \@ifundefined{c@lofdepth}%
12162 %%% {\newcounter{lofdepth}\setcounter{lofdepth}{1}}{}
12163 %%% \@ifundefined{c@lotdepth}%
12164 %%% {\newcounter{lotdepth}\setcounter{lotdepth}{1}}{}}
12165
12166 \ifartopt
12167 \chapterstyle{article}
12168 \counterwithout{figure}{chapter}
12169 \counterwithout{table}{chapter}
12170 \counterwithout{footnote}{chapter}
12171 \counterwithout{equation}{chapter}
12172 %\renewcommand{\chaptername}{}
12173 \if@twoside
12174 \addtopsmarks{headings}{}{%
12175 \createmark{chapter}{left}{shownumber}{}{. \ }
12176 }
12177 \else
12178 \addtopsmarks{headings}{}{%
12179 \createmark{chapter}{right}{shownumber}{}{. \ }
12180 }
12181 \fi
12182 \renewcommand{\maketitlehookb}{%
12183 \vskip -1.5\topsep\vskip -1.5\partopsep}
12184 \renewcommand{\maketitlehookc}{%
12185 \vskip -1.5\topsep\vskip -1.5\partopsep}
12186 \fi
12187
12188 \newcommand{\msdoublespacing}{}
12189 \newcommand{\mssinglespacing}{}
12190 \ifmsdoc
12191 \renewcommand{\msdoublespacing}{%
12192 \renewcommand{\baselinestretch}{1.6}\large\normalsize}
12193 \renewcommand{\mssinglespacing}{%
12194 \renewcommand{\baselinestretch}{1.0}\large\normalsize}
12195 \renewcommand{\familydefault}{cmtt}
12196 \renewcommand{\rmdefault}{cmtt}
12197 \renewcommand{\sfdefault}{cmtt}
12198 \renewcommand{\bfdefault}{m}
12199 \renewcommand{\itdefault}{n}
12200 \renewcommand{\sldefault}{n}
12201 \renewcommand{\scdefault}{n}
12202 \renewcommand{\baselinestretch}{1.6}
12203 \@twocolumnfalse
12204 \onecolumn
12205 \sloppy
12206 \@twosidefalse
12207 \raggedbottom
12208 \pagestyle{plain}
12209 \fi
12210
12211 \EmulatedPackage{abstract}[2008/07/23]
12212 \EmulatedPackage{appendix}[2008/07/23]
12213 % \EmulatedPackage{array}[2016/10/06]
12214 % \EmulatedPackage{booktabs}[2016/05/16]
12215 \EmulatedPackage{ccaption}[2008/07/23]
12216 \EmulatedPackage{changepage}[2008/07/23]
12217 \EmulatedPackage{chngcntr}[2008/07/23]
12218 \EmulatedPackage{chngpage}[2008/07/23]
12219 \EmulatedPackage{crop}
12220 % \EmulatedPackage{dcolumn}[2008/07/23]
12221 % \EmulatedPackage{delarray}[2014/10/28]
12222 \EmulatedPackage{enumerate}[2008/07/23]
12223 \EmulatedPackage{epigraph}[2008/07/23]
12224 %%%%%\EmulatedPackage{framed}[2008/07/23]
12225 \EmulatedPackage{ifmtarg}[2008/07/23]
12226 %\ifm@mifetex\EmulatedPackage{ifetex}[2008/07/23]\fi
12227 %\ifm@mifluatex\EmulatedPackage{ifluatex}[2008/07/23]\fi
12228 %\ifm@mifpdf\EmulatedPackage{ifpdf}[2008/07/23]\fi
12229 %\ifm@mifxetex\EmulatedPackage{ifxetex}[2008/07/23]\fi
12230 \EmulatedPackage{index}[2008/07/23]
12231 \EmulatedPackage{makeidx}[2008/07/23]
12232 \EmulatedPackage{moreverb}[2008/07/23]
12233 % \if@twocolumn
12234 % \RequirePackage{mparhack}
12235 % \fi
12236 %\EmulatedPackage{mparhack}[2008/07/23]
12237 \EmulatedPackage{needspace}[2008/07/23]
12238 \EmulatedPackage{newfile}[2008/07/23]
12239 \EmulatedPackage{nextpage}[2008/07/23]
12240 \EmulatedPackage{pagenote}[2008/07/23]
12241 \EmulatedPackage{parskip}[2008/07/23]
12242 \EmulatedPackage{patchcmd}[2008/07/23]
12243 \EmulatedPackage{setspace}[2008/07/23]
12244 % \EmulatedPackage{shortvrb}[2008/07/23]
12245 \EmulatedPackage{showidx}[2008/07/23]
12246 % \EmulatedPackage{tabularx}[2016/02/03]
12247 \EmulatedPackage{titleref}[2008/07/23]
12248 \EmulatedPackage{titling}[2008/07/23]
12249 \EmulatedPackage{tocbibind}[2008/07/23]
12250 \EmulatedPackage{tocloft}[2008/07/23]
12251 \EmulatedPackage{tocvsec2}[2008/07/23]
12252 % \EmulatedPackage{verbatim}[2008/07/23]
12253 \EmulatedPackage{verse}[2008/07/23]
12254
12255 \AtBeginPackage{float}{\let\newfloat\relax}
12256
12257 \AtEndPackage{hyperref}{\RequirePackage{memhfixc}}
12258 \AtBeginPackage{fancyhdr}{
12259 \@memwarn{The fancyhdr package is not
12260 recommended with memoir.\MessageBreak
12261 We have our own well integrated interface
12262 to handle\MessageBreak headers and footers. See the manual
12263 section 7.3\MessageBreak onwards for details.}
12264 }
12265 \AtBeginPackage{titlesec}{
12266 \@memwarn{The titlesec package is not
12267 recommended with memoir.\MessageBreak
12268 With it we loose some of the features provides by the\MessageBreak
12269 class. We provide our own interface to adjust how \MessageBreak
12270 sections and chapters should look like.\MessageBreak
12271 See the manual sections 6.4 through 6.6 for details.
12272 }
12273 }
12274 \AtBeginPackage{titleps}{
12275 \@memwarn{The titleps package is not
12276 recommended with memoir.\MessageBreak
12277 It cannot really work properly without the titlesec\MessageBreak
12278 package, which is already incomparible with memoir.\MessageBreak
12279 We have our own well integrated interface to \MessageBreak
12280 handle headers and footers.\MessageBreak
12281 See the manual section 7.3 onwards for details.
12282 }
12283 }
12284 \AtBeginPackage{sectsty}{
12285 \@memwarn{%
12286 The sectsty package is super old (has not been updated\MessageBreak
12287 since 2002) and is unlikely to be compatible with modern\MessageBreak
12288 LaTeX. We provide our own interface to adjust how \MessageBreak
12289 sections and chapters should look like.\MessageBreak
12290 See the manual sections 6.4 through 6.6 for details.
12291 }
12292 }
12293 \AtBeginPackage{subfigure}{
12294 \@memwarn{%
12295 The subfigure package is marked obsolete,\MessageBreak
12296 consider using the subcaption package instead.
12297 }
12298 }
12299 \AtBeginPackage{subfig}{
12300 \@memwarn{%
12301 The subfig package hasn't been updated since 2005.\MessageBreak
12302 Consider using the subcaption package instead.
12303 }
12304 }
12305 \ifartopt
12306 \pagestyle{plain}
12307 \else
12308 \pagestyle{headings}
12309 \fi
12310 \pagenumbering{arabic}
12311
12312
12313 \endinput
12314 %%
12315 %% End of file `memoir.cls'.