Debian Codegraph @

texmf-dist/source/latex/flowfram/flowfram.dtx

raw
1 %\iffalse
2 % flowfram.dtx generated using makedtx version 1.2 (c) Nicola Talbot
3 % Command line args:
4 % -author "Nicola Talbot"
5 % -doc "flowfram-codedoc.tex"
6 % -codetitle "Main Package Code"
7 % -src "(flowfram.sty)\Z=>\1"
8 % -src "(flowframtkutils.sty)\Z=>\1"
9 % -src "(flowfram-[0-9]+-[0-9]+-[0-9]+.sty)\Z=>\1"
10 % flowfram
11 % Created on 2026/4/25 12:33
12 %\fi
13 %\iffalse
14 %<*package>
15 %% \CharacterTable
16 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
17 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
18 %% Digits \0\1\2\3\4\5\6\7\8\9
19 %% Exclamation \! Double quote \" Hash (number) \#
20 %% Dollar \$ Percent \% Ampersand \&
21 %% Acute accent \' Left paren \( Right paren \)
22 %% Asterisk \* Plus \+ Comma \,
23 %% Minus \- Point \. Solidus \/
24 %% Colon \: Semicolon \; Less than \<
25 %% Equals \= Greater than \> Question mark \?
26 %% Commercial at \@ Left bracket \[ Backslash \\
27 %% Right bracket \] Circumflex \^ Underscore \_
28 %% Grave accent \` Left brace \{ Vertical bar \|
29 %% Right brace \} Tilde \~}
30 %</package>
31 %\fi
32 % \iffalse
33 % Doc-Source file to use with LaTeX2e
34 % Copyright (C) 2026 Nicola Talbot, all rights reserved.
35 % \fi
36 % \iffalse
37 %<*driver>
38 \iffalse
39 flowfram-codedoc.tex is a stub file used by makedtx to create
40 flowfram.dtx
41 \fi
42
43 \documentclass{article}
44
45 \usepackage[T1]{fontenc}
46 \usepackage{tcolorbox}
47 \RequirePackage{hologo}
48
49 \usepackage{doc}
50 \usepackage[nomain]{glossaries-extra}
51
52 \CheckSum{37358}
53
54 \RecordChanges
55 \PageIndex
56
57 \SetupDoc{reportchangedates}
58 \setcounter{IndexColumns}{2}
59
60 \newglossary*{terms}{Terms}
61
62 \MakeShortVerb"
63 \DeleteShortVerb|
64
65 \newglossaryentry{bbox}{name=bounding box,plural=bounding boxes,
66 description={The smallest
67 possible rectangle that completely encompasses the object},
68 type=terms}
69
70 \newglossaryentry{dynamic}{name=dynamic frame,description={Frames
71 in which text is fixed in place, but the contents are re-typeset
72 after each page},type=terms}
73
74 \newglossaryentry{flow}{name=flow frame,description={The frames in
75 a document such that the contents of the \env{document}
76 environment flow from one frame to the next in the order
77 that they were defined. There must be at least one flow frame on
78 every page},type=terms}
79
80 \newglossaryentry{frame}{name=frame,description={A rectangular
81 area of the page in which text can be placed (not to be
82 confused with a frame making command). There are three types:
83 flow, static and dynamic},type=terms}
84
85 \newglossaryentry{fcmd}{name=frame making command,description={A
86 \LaTeX\ command which places some kind of border around its
87 argument. For example: \cs{fbox}},type=terms}
88
89 \newabbreviation[name={identification label (IDL)},
90 description={A unique
91 label which can be assigned to a frame, enabling you to
92 refer to the frame by label instead of by its
93 IDN}]{idl}{IDL}{identification label}
94
95 \newabbreviation[name={identification number (IDN)},
96 description={A unique
97 number assigned to each frame, which you can use to identify
98 the frame when modifying its appearance. Example: if you
99 have defined 3 flow frames, 2 static frames and 1 dynamic
100 frame, the flow frames will have IDNs 1, 2 and 3, the static
101 frames will have IDNs 1 and 2, and the dynamic frame will
102 have IDN 1}]{idn}{IDN}{identification number}
103
104 \newglossaryentry{pglist}{name=page list,description={A list of
105 pages. This can either be a single keyword: \texttt{all},
106 \texttt{odd}, \texttt{even} or \texttt{none}, or it can
107 be a comma-separated list of individual page numbers or
108 page ranges. For example: \texttt{\textless3,5,7-11,\textgreater15}
109 indicates pages 1,2,5,7,8,9,10,11 and all pages after page 15.
110 Note that these numbers refer to the actual value of the
111 page counter, not the absolute physical page number},
112 type=terms}
113
114 \newglossaryentry{pgrange}{name=page range,description={Page
115 ranges can be closed, e.g.\ \texttt{5-10}, or open, e.g.
116 \texttt{\textless7} or \texttt{\textgreater9}},
117 type=terms}
118
119 \newglossaryentry{static}{name=static frame,description={Frames
120 in which text is fixed in place. The contents are fixed until
121 explicitly changed},type=terms}
122
123 \newglossaryentry{typeblock}{name=typeblock,description={The
124 area of the page where the main body of the text goes.
125 The width and height of this area are given by \cs{textwidth}
126 and \cs{textheight}},type=terms}
127
128 \definecolor{defbackground}{rgb}{1,1,0.75}
129
130 \newtcolorbox{definition}{halign=flush left,
131 colframe=black,colback=defbackground,
132 fontupper=\ttfamily,
133 before upper={\frenchspacing\obeylines},
134 after={\par\noindent\ignorespacesafterend}
135 }
136
137 \NewDocElement{Option}{option}
138 \NewDocElement{Counter}{counter}
139
140 \providecommand{\sty}[1]{\textsf{#1}}
141 \providecommand{\cls}[1]{\textsf{#1}}
142 \providecommand{\env}[1]{\textsf{#1}}
143 \providecommand{\opt}[1]{\textsf{#1}}
144 \providecommand{\file}[1]{\nolinkurl{#1}}
145
146 \providecommand\marg[1]{%
147 \texorpdfstring{\allowbreak{\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
148 {\{#1\}}}
149 \providecommand\oarg[1]{%
150 \texorpdfstring{\allowbreak{\ttfamily[}\meta{#1}{\ttfamily]}}
151 {[#1]}}
152
153 \newcommand*{\LuaLaTeX}{\hologo{LuaLaTeX}}
154 \newcommand*{\pdfLaTeX}{\hologo{pdfLaTeX}}
155
156 \begin{document}
157 \DocInput{flowfram.dtx}
158 \end{document}
159 %</driver>
160 %\fi
161 %
162 %\title{Documented Source Code for flowfram.sty v2.2}
163 %\author{Nicola L. C. Talbot}
164 %\date{2026-04-25}
165 %\maketitle
166 %
167 %This is the documented source code for the flowfram package.
168 %For a user manual, see \url{flowfram-manual.pdf} (or do \texttt{texdoc
169 %flowfram-manual}).
170 %
171 %\tableofcontents
172 %
173 %\printunsrtglossary[type=terms]
174 %
175 %\StopEventually{\clearpage\PrintChanges\PrintIndex}
176 %
177 %
178 %\section{Main Package Code}
179 %\iffalse
180 % \begin{macrocode}
181 %<*flowfram.sty>
182 % \end{macrocode}
183 %\fi
184 % \subsection{Package Initialisation}
185 % Declare package, and identify it as a \LaTeXe\ package.
186 % \begin{macrocode}
187 \NeedsTeXFormat{LaTeX2e}
188 % \end{macrocode}
189 % Rollback release:
190 % \begin{macrocode}
191 \DeclareRelease{v1.17}{2014-09-30}{flowfram-2014-09-30.sty}
192 \DeclareRelease{v1.18}{2025-08-23}{flowfram-2025-08-23.sty}
193 \DeclareCurrentRelease{v2.2}{2026-04-25}
194 % \end{macrocode}
195 %Declare package:
196 % \begin{macrocode}
197 \ProvidesPackage{flowfram}[2026/04/25 v2.2 (NLCT)]
198 % \end{macrocode}
199 %Version 2.0 now loaded rerunfilecheck package:
200 % \begin{macrocode}
201 \RequirePackage{rerunfilecheck}
202 % \end{macrocode}
203 % No longer loading xfor, ifthen or xkeyval.
204 %\changes{2.0}{2025-11-24}{no longer loading xfor, ifthen, xkeyval}
205 % \begin{macrocode}
206 \RequirePackage{graphics}
207 \RequirePackage{afterpage}
208 % \end{macrocode}
209 %\changes{1.14}{2012-11-10}{now loading xfor and etoolbox}
210 % \begin{macrocode}
211 \RequirePackage{etoolbox}
212 % \end{macrocode}
213 %
214 % Version 2.0: switching to \LaTeX3 commands but some old code
215 % still remains.
216 % \begin{macrocode}
217 \ExplSyntaxOn
218 % \end{macrocode}
219 %
220 % The colour of the \gls{bbox} borders when the draft
221 % option is specified is given by the commands:
222 %\begin{macro}{\setffdraftcolor}
223 % \begin{macrocode}
224 \newcommand{\setffdraftcolor}{\color[gray]{0.8}}
225 % \end{macrocode}
226 %\end{macro}
227 %\begin{macro}{\setffdrafttypeblockcolor}
228 % \begin{macrocode}
229 \newcommand{\setffdrafttypeblockcolor}{\color[gray]{0.9}}
230 % \end{macrocode}
231 %\end{macro}
232 %\begin{macro}{\fflabelsep}
233 % In draft mode, each \gls{bbox} (apart from the one indicating
234 % the \gls{typeblock}), has a label positioned to the right of the
235 % box, at a distance of "\fflabelsep" from the right hand
236 % border.
237 % \begin{macrocode}
238 \newlength\fflabelsep
239 \setlength\fflabelsep{1pt}
240 % \end{macrocode}
241 %\end{macro}
242 %\begin{macro}{\fflabelfont}
243 % The appearance of the label is set by the declaration:
244 % \begin{macrocode}
245 \newcommand*{\fflabelfont}{\small\sffamily}
246 % \end{macrocode}
247 %\end{macro}
248 % Allow user the option to show particular types of bounding
249 % boxes.
250 % \begin{macrocode}
251 \newif\ifshowtypeblock
252 \newif\ifshowmargins
253 \newif\ifshowframebbox
254 % \end{macrocode}
255 %\begin{macro}{\@ffdraft}
256 %\changes{2.0}{2025-11-24}{renamed}
257 % Set all draft settings.
258 %Version 2.0 renamed \cs{@ffdraft}.
259 % \begin{macrocode}
260 \cs_new:Nn \__flowfram_set_draft:
261 {
262 \showtypeblocktrue
263 \showmarginstrue
264 \showframebboxtrue
265 }
266 % \end{macrocode}
267 %\end{macro}
268 %\begin{macro}{\@ffnodraft}
269 %\changes{2.0}{2025-11-24}{renamed}
270 % Unset all draft settings.
271 %Version 2.0 renamed \cs{@ffnodraft}.
272 % \begin{macrocode}
273 \cs_new:Nn \__flowfram_set_final:
274 {
275 \showtypeblockfalse
276 \showmarginsfalse
277 \showframebboxfalse
278 }
279 % \end{macrocode}
280 % Set the default to \opt{final}:
281 % \begin{macrocode}
282 \__flowfram_set_final:
283 % \end{macrocode}
284 %\end{macro}
285 %
286 %Just in case something has redefined \cs{frame} (for example,
287 %\cls{beamer}, although it would be a unusual to use \sty{flowfram}
288 %with that).
289 % \begin{macrocode}
290 \cs_new_protected:Nn \flowfram_frame:n
291 {
292 \leavevmode
293 \hbox
294 {
295 \hskip -\@wholewidth
296 \vbox
297 {
298 \vskip -\@wholewidth
299 \hrule \@height \@wholewidth
300 \hbox
301 {
302 \vrule \@width \@wholewidth
303 #1
304 \vrule \@width \@wholewidth
305 }
306 \hrule \@height \@wholewidth
307 \vskip -\@wholewidth
308 }
309 \hskip -\@wholewidth
310 }
311 }
312 % \end{macrocode}
313 %
314 %\begin{macro}{\flf@message}
315 % Messaging system (to help debugging):
316 %\changes{1.14}{2012-11-10}{new}
317 %\changes{2.0}{2025-11-24}{removed}
318 %Version 2.0 removed \cs{flf@message}.
319 % \begin{macrocode}
320 \cs_new:Nn \__flowfram_message:n
321 {
322 \flf@doifverbose
323 {
324 \msg_note:nn { flowfram } { #1 }
325 }
326 }
327 \cs_new:Nn \__flowfram_message:nn
328 {
329 \flf@doifverbose
330 {
331 \msg_note:nnn { flowfram } { #1 } { #2 }
332 }
333 }
334 \cs_new:Nn \__flowfram_message:nnn
335 {
336 \flf@doifverbose
337 {
338 \msg_note:nnnn { flowfram } { #1 } { #2 } { #3 }
339 }
340 }
341 \cs_generate_variant:Nn \__flowfram_message:nnn { nen , nee }
342 \cs_new:Nn \__flowfram_message:nnnn
343 {
344 \flf@doifverbose
345 {
346 \msg_note:nnnnn { flowfram } { #1 } { #2 } { #3 } { #4 }
347 }
348 }
349 \cs_generate_variant:Nn \__flowfram_message:nnnn { neee }
350 \cs_new:Nn \__flowfram_message:nnnnn
351 {
352 \flf@doifverbose
353 {
354 \msg_note:nnnnnn { flowfram } { #1 } { #2 } { #3 } { #4 } { #5 }
355 }
356 }
357 \cs_generate_variant:Nn \__flowfram_message:nnnnn
358 { nnnen , nnneV , nnnev }
359 % \end{macrocode}
360 %\end{macro}
361 %
362 % \begin{macrocode}
363 \cs_new:Nn \__flowfram_error:nnn
364 {
365 \msg_error:nnnn { flowfram } { #1 } { #2 } { #3 }
366 }
367 \cs_generate_variant:Nn \__flowfram_error:nnn
368 { eee }
369 % \end{macrocode}
370 %
371 % \begin{macrocode}
372 \cs_new:Nn \__flowfram_error:nnnn
373 {
374 \msg_error:nnnnn { flowfram } { #1 } { #2 } { #3 } { #4 }
375 }
376 \cs_generate_variant:Nn \__flowfram_error:nnnn
377 { eeee }
378 % \end{macrocode}
379 %
380 % \begin{macrocode}
381 \cs_new:Nn \__flowfram_error:nnnnn
382 {
383 \msg_error:nnnnnn { flowfram } { #1 } { #2 } { #3 } { #4 } { #5 }
384 }
385 \cs_generate_variant:Nn \__flowfram_error:nnnnn
386 { eeeee }
387 % \end{macrocode}
388 %
389 %\begin{macro}{\flf@doifverbose}
390 %\changes{1.14}{2012-11-10}{new}
391 % Initialise:
392 % \begin{macrocode}
393 \newcommand{\flf@doifverbose}[1]{}
394 % \end{macrocode}
395 %\end{macro}
396 %
397 % \begin{macrocode}
398 \char_set_catcode_space:n { `\ }
399
400 \msg_new:nnnn {flowfram} {label-defined}
401 {Label `#1' already defined for frame type `#2'}
402 {You can't assign this label, as it is already defined
403 for #2 frame IDN #3}
404
405 \msg_new:nnnn {flowfram} {label-undefined}
406 {Label `#1' is not defined for any #2 frame}
407 {Check that you have spelt the label correctly and that
408 the label corresponds to a #2 frame}
409
410 \msg_new:nnnn {flowfram} {invalid-width}
411 {Invalid width #1 for #2 frame (using #3 instead)}
412 {A #2 frame width must be greater than 0pt}
413
414 \msg_new:nnnn {flowfram} {invalid-height}
415 {Invalid height #1 for #2 frame (using #3 instead)}
416 {A #2 frame height must be greater than 0pt}
417
418 \msg_new:nnnn {flowfram} {idn-undefined}
419 {No #1 frame with IDN #2}
420 {Identification numbers start from 1 to the number of defined #1 frames}
421
422 \msg_new:nnnn {flowfram} {invalid-id}
423 {Invalid IDN #1}
424 {Identification numbers start from 1}
425
426 \msg_new:nnnn {flowfram} {attribute-type-change}
427 {Frame attribute #1 of type '#2' now being defined as '#3'}
428 {Frame attribute #1 has already been defined as type '#2' but
429 now this attribute is being defined as type '#3'}
430
431 \msg_new:nnnn {flowfram} {invalid-frame-type}
432 {Unknown frame type `#1'}
433 {Frame types can be one of: flow, static or dynamic}
434
435 \msg_new:nnnn {flowfram} {invalid-frame-typeid}
436 {Unknown frame type ID `#1'}
437 {Frame type IDs can be one of: 1 (flow), 2 (static) or 3 (dynamic)}
438
439 \msg_new:nnn {flowfram} {frame-unsupported-options}
440 {Frame type `#1' does not support option(s): #2}
441
442 \msg_new:nnnn {flowfram} {frame-unknown-tag}
443 {Frame type `#1' does not have #4 attribute #2 defined (IDN #3)}
444 {Check that you have correctly spelt the attribute `#2' and have
445 correctly identified the type of frame and its numeric identifier.
446 The other possibility is that there is a bug in the code that's
447 incorrectly identified the underlying data type (#4).}
448
449 \msg_new:nnn {flowfram} {non-void-box}
450 {Box #1 is not void. Dumping. This page: #2.
451 Page list: "#3". Exclusion list: "#4".
452 (Maybe the page list was changed after this frame was
453 selected or maybe you should use package option pages=absolute)}
454
455 \msg_new:nnn {flowfram} {invalid-bool}
456 {Invalid boolean setting `#1' for attribute `#2' applied to #3 frame IDN #4}
457
458 \msg_new:nnnn {flowfram} {invalid-pagelist}
459 {Invalid page list `#1'}
460 {A page list may be one of the keywords `all', `none', `even' or
461 `odd', or may be an ordered comma-separated list of individual
462 numbers (e.g. `2'), a closed range (e.g. `12-18'), or an
463 open-ended range (e.g. `<3' or `>5'). Overlapping ranges are not
464 permitted and items must be listed in increasing numerical order
465 (e.g. `<4,9-12,15,>20')}
466
467 \msg_new:nnnn {flowfram} {cant-set-column}
468 {Can't set current column to frame `#1' (so such frame)}
469 {There is no frame defined with the IDN `#1'}
470
471 \msg_new:nnn {flowfram} {unequal-cols}
472 {Moving to flow frame of unequal width, use of
473 \token_to_str:N \framebreak \c_space_tl advised,
474 or text might not appear correctly (difference = #1,
475 tolerance = #2)}
476
477 \msg_new:nnn {flowfram} {no-page1-col}
478 {Can't find a flow frame on page 1.
479 Attempting to find the first page with a flow frame}
480
481 \msg_new:nnn {flowfram} {no-cols}
482 {No flow frames, adding #1}
483
484 \msg_new:nnn {flowfram} {no-more-cols-on-page}
485 {Run out of flows frames on page #1, adding new one}
486
487 \msg_new:nnn {flowfram} {misplaced-col-cmd}
488 {Found #1 in document environment with
489 column-changes=switch option set but no frame
490 has been identified to use with #1}
491
492 \msg_new:nnnn {flowfram} {doc-env-only}
493 {Command #1 only permitted in document environment}
494 {You can't use #1 in the preamble}
495
496 \msg_new:nnn {flowfram} {background-not-first}
497 {Background frame is not first static frame to be
498 defined. All previously defined static frames may be
499 obscured.}
500
501 \msg_new:nnn {flowfram} {ignoring-multiple-makethumbtabs}
502 {Ignoring repeated instance of \makethumbtabs}
503
504 \msg_new:nnn {flowfram} {no-thumbtabs-missing-makethumbtabs}
505 {No thumb tabs defined: missing \makethumbtabs}
506
507 \msg_new:nnn {flowfram} {no-thumbtabs-rerun}
508 {No thumb tabs defined. Rerun may be required}
509
510 \msg_new:nnn {flowfram} {cant-find-thumbtab}
511 {Can't find thumbtab number `#1', ttb file may not be
512 up-to-date}
513
514 \msg_new:nnnn {flowfram} {cant-find-thumbtab-index}
515 {Can't find thumbtab index number `#1'}
516 {Something's gone wrong. The thumbtab `#1' exists but
517 thumbtab index `#1' doesn't}
518
519 \msg_new:nnnn {flowfram} {invalid-thumbtab-index}
520 {Invalid thumbtab index `#1'}
521 {Thumbtab indexing starts at 1}
522
523 \msg_new:nnn {flowfram} {section-unit-not-defined}
524 {Sectioning type `#1' not defined}
525
526 \msg_new:nnn {flowfram} {unknown-heading-cmd}
527 {Unknown heading command `#1'}
528
529 \msg_new:nnn {flowfram} {unknown-shape}
530 {Unknown shape #1}
531
532 \msg_new:nnn {flowfram} {forbidden-cmd-in-shape}
533 {You can't use #1 within a paragraph shaped with #2}
534
535 \msg_new:nnnn {flowfram} {cant-continue}
536 {Can't continue to new frame: either not in static or dynamic frame or attempting to append content}
537 {\token_to_str:N \continueonframe \c_space_tl may only
538 be used inside `staticcontents' or `dynamiccontents'
539 environments (or their starred versions) or in the commands
540 \token_to_str:N \setstaticcontents \c_space_tl or
541 \token_to_str:N \setdynamiccontents}
542
543 \msg_new:nnnn {flowfram} {invalid-num-frames}
544 {You have requested #2 #1 frames!}
545 {The number of frames must be greater than 0}
546
547 \msg_new:nnnn {flowfram} {no-chapters}
548 {Chapters aren't defined}
549 {The document class you are using does not support chapters}
550
551 \msg_new:nnnn {flowfram} {option-too-late}
552 {Option #1 occurring too late (has no effect after #2)}
553 {If you want to set this option, you need to do so earlier}
554
555 \msg_new:nnn {flowfram} {relloc-label-already-defined}
556 {Relative location label `#1' multiply defined}
557
558 \msg_new:nnn {flowfram} {relloc-label-not-defined}
559 {Relative location label `#1' undefined}
560
561 \msg_new:nnn {flowfram} {data-changed-rerun}
562 {Label or frame data has changed. Rerun required}
563
564 \msg_new:nnn {flowfram} {info-set-excludelist}
565 {Setting exclusion list for #1 frame IDN #2 to `#3'}
566
567 \msg_new:nnn {flowfram} {info-switching-col}
568 {Switching to flow frame #1 on page #2}
569
570 \msg_new:nnn {flowfram} {info-setting-col}
571 {Setting contents of box for flow frame #1}
572
573 \msg_new:nnn {flowfram} {info-doing-col}
574 {Doing flow frame #1 (page #2)}
575
576 \msg_new:nnn {flowfram} {info-col-not-required}
577 {Flow frame #1 is not required on page #2}
578
579 \msg_new:nnn {flowfram} {info-col-list}
580 {List of defined flow frames: #1}
581
582 \msg_new:nnn {flowfram} {info-static-frame-hidden}
583 {Static frame IDN #1 is hidden (#2=true)}
584
585 \msg_new:nnn {flowfram} {info-dynamic-frame-hidden}
586 {Dynamic frame IDN #1 is hidden (#2=true)}
587
588 \msg_new:nnn {flowfram} {info-no-file}
589 {No file #1.}
590
591 \msg_new:nnn {flowfram} {info-no-rotation}
592 {Frame rotation has been disable.
593 Attempt to rotate frame has been ignored.}
594
595 \msg_new:nnn {flowfram} {info-found-thumbtab}
596 {Found thumbtab data { #1 } { #2 } { #3 } { #4 }}
597
598 \msg_new:nnn {flowfram} {info-thumbtab}
599 {Thumbtab #1 dynamic frame #2 (IDN #3)}
600
601 \msg_new:nnn {flowfram} {info-thumbtab-index}
602 {Thumbtab index #1 dynamic frame #2 (IDN #3)}
603
604 \msg_new:nnn {flowfram} {info-setting-frame-attribute}
605 {Setting #1 attribute for #2 frame #3 to #4}
606
607 \msg_new:nnn {flowfram} {show-frame-attributes}
608 {Frame type #1 IDN #2 has the following attributes:\\#3}
609
610 \msg_new:nnn {flowfram} {show-all-frames-none}
611 {There are no frames of type #1}
612
613 \msg_new:nnn {flowfram} {show-all-frames}
614 {Showing all #1 frames.
615 Each frame will be shown separately.
616 Total number of #1 frames: \\#2}
617
618 \char_set_catcode_ignore:n { `\ }
619 % \end{macrocode}
620 %
621 %Separate option to rotate thumbtab text from option to inhibit all
622 %frame rotation.
623 % \begin{macrocode}
624 \bool_new:N \l__flowfram_allow_frame_rotation_bool
625 \bool_set_true:N \l__flowfram_allow_frame_rotation_bool
626 % \end{macrocode}
627 %
628 %\begin{macro}{\if@ttb@rotate}
629 % Settings to adjust rotation support in the thumbtabs.
630 %\changes{1.14}{2012-11-10}{changed to boolean key}
631 % Version 2.0 replaced \cs{if@ttb@rotate},
632 %\changes{2.0}{2025-11-24}{removed}
633 %\end{macro}
634 %No rotation (the frame will need to be wide enough to accommodate
635 %the text or have rotation applied):
636 % \begin{macrocode}
637 \cs_new:Nn \__flowfram_thumbtab_fmt:nn
638 {
639 \__flowfram_thumbtab_fmt_sideways:nn { #1 } { #2 }
640 }
641 % \end{macrocode}
642 %Rotate for right / odd pages.
643 % \begin{macrocode}
644 \cs_new:Nn \__flowfram_thumbtab_fmt_sideways_oneside_right:nn
645 {
646 \rotatebox { -90 }
647 {
648 \parbox [ c ] [ \thumbtabwidth ] { #2 }
649 {
650 \centering #1
651 }
652 }
653 }
654 % \end{macrocode}
655 %Rotate for left / even pages.
656 % \begin{macrocode}
657 \cs_new:Nn \__flowfram_thumbtab_fmt_sideways_oneside_left:nn
658 {
659 \rotatebox { 90 }
660 {
661 \parbox [ c ] [ \thumbtabwidth ] { #2 }
662 {
663 \centering #1
664 }
665 }
666 }
667 % \end{macrocode}
668 %Rotate according to one or two-sided documents.
669 % \begin{macrocode}
670 \cs_new:Nn \__flowfram_thumbtab_fmt_sideways:nn
671 {
672 \if@twoside
673 \int_if_odd:nTF { \c@page }
674 {
675 \__flowfram_thumbtab_fmt_sideways_oneside_right:nn
676 { #1 } { #2 }
677 }
678 {
679 \__flowfram_thumbtab_fmt_sideways_oneside_left:nn
680 { #1 } { #2 }
681 }
682 \else
683 \__flowfram_thumbtab_fmt_sideways_oneside_right:nn
684 \fi
685 }
686 % \end{macrocode}
687 % Stack the letters vertically (this
688 % doesn't look very good).
689 % \begin{macrocode}
690 \cs_new:Nn \__flowfram_thumbtab_fmt_stack:nn
691 {
692 \parbox [ c ] [ #2 ] { \thumbtabwidth }
693 {
694 \centering
695 \flowfram_thumbtab_stack:n { #1 }
696 }
697 }
698 % \end{macrocode}
699 %
700 % Should the thumbtabs include number, title, both or
701 % neither?
702 %\begin{macro}{\if@ttb@num}
703 % Version 2.0 removed \cs{if@ttb@num}.
704 %\changes{2.0}{2025-11-24}{removed}
705 % \begin{macrocode}
706 \bool_new:N \l__flowfram_ttb_show_number_bool
707 \bool_set_false:N \l__flowfram_ttb_show_number_bool
708 % \end{macrocode}
709 %\end{macro}
710 %\begin{macro}{\if@ttb@title}
711 % \begin{macrocode}
712 \bool_new:N \l__flowfram_ttb_show_title_bool
713 \bool_set_true:N \l__flowfram_ttb_show_title_bool
714 % \end{macrocode}
715 %\end{macro}
716 %
717 %\begin{macro}{\@ff@pages@countreg}
718 %\changes{1.14}{2012-11-10}{new}
719 % The default is relative (for backwards compatibility).
720 %\changes{2.0}{2025-11-24}{renamed}
721 %Version 2.0 renamed \cs{@ff@pages@countreg}.
722 % \begin{macrocode}
723 \tl_new:N \g__flowfram_pagecounter_tl
724 \tl_gset:Nn \g__flowfram_pagecounter_tl { \c@page }
725 % \end{macrocode}
726 %\end{macro}
727 %\begin{macro}{\theFramePageCounter}
728 %\changes{2.0}{2025-11-24}{new}
729 %For use when the page/absolutepage counter needs to be written as
730 %its actual value (not formatted) but must be deferred.
731 % \begin{macrocode}
732 \newcommand \theFramePageCounter
733 {
734 \int_eval:n { \g__flowfram_pagecounter_tl }
735 }
736 % \end{macrocode}
737 %\end{macro}
738 %\begin{counter}{absolutepage}
739 %\changes{1.14}{2012-11-10}{new}
740 % \begin{macrocode}
741 \newcounter{absolutepage}
742 % \end{macrocode}
743 %\end{counter}
744 %
745 %\begin{macro}{\flowfram@thepagenumber}
746 %\changes{2.0}{2025-11-24}{new}
747 % \begin{macrocode}
748 \newcommand \flowfram@thepagenumber { \int_use:N \c@page }
749 % \end{macrocode}
750 %\end{macro}
751 %Constants.
752 % \begin{macrocode}
753 \tl_const:Nn \c_flowfram_all_tl { all }
754 \tl_const:Nn \c_flowfram_odd_tl { odd }
755 \tl_const:Nn \c_flowfram_even_tl { even }
756 \tl_const:Nn \c_flowfram_none_tl { none }
757 \tl_const:Nn \c_flowfram_color_none_tl { { none } }
758 \tl_const:Nn \c_flowfram_color_black_tl { { black } }
759 \tl_const:Nn \c_flowfram_inner_tl { inner }
760 \tl_const:Nn \c_flowfram_outer_tl { outer }
761 \tl_const:Nn \c_flowfram_left_tl { left }
762 \tl_const:Nn \c_flowfram_right_tl { right }
763 \tl_const:Nn \c_flowfram_compute_tl { compute}
764 % \end{macrocode}
765 %\changes{2.1}{2026-02-23}{added frame type label constants}
766 % \begin{macrocode}
767 \tl_const:Nn \c_flowfram_flow_tl { flow }
768 \tl_const:Nn \c_flowfram_dynamic_tl { dynamic }
769 \tl_const:Nn \c_flowfram_static_tl { static }
770 % \end{macrocode}
771 %Integer constants:
772 % \begin{macrocode}
773 \int_const:Nn \c_flowfram_max_page_int { 100000 }
774 \int_const:Nn \c_flowfram_shape_type_parshape_int { 1 }
775 \int_const:Nn \c_flowfram_shape_type_shapepar_int { 2 }
776 \int_const:Nn \c_flowfram_shape_type_none_int { 0 }
777 \int_const:Nn \c_flowfram_frame_type_flow_int { 1 }
778 \int_const:Nn \c_flowfram_frame_type_static_int { 2 }
779 \int_const:Nn \c_flowfram_frame_type_dynamic_int { 3 }
780 % \end{macrocode}
781 %
782 %\begin{macro}{\flowframecol}
783 %Default frame border colour.
784 % \begin{macrocode}
785 \newcommand \flowframecol { }
786 % \end{macrocode}
787 %\end{macro}
788 %
789 %\begin{macro}{\flowframetextcol}
790 %Default text colour.
791 % \begin{macrocode}
792 \newcommand \flowframetextcol { }
793 % \end{macrocode}
794 %\end{macro}
795 %
796 %\begin{macro}{\@fr@meifdraft}
797 % Draw \gls{bbox}.
798 %Version 2.0 renamed \cs{@fr@meifdraft}.
799 % \begin{macrocode}
800 \cs_new:Nn \__flowfram_do_if_draft:nnn
801 {
802 \tl_set_eq:NN
803 \l__flowfram_backcolor_tl
804 \c_flowfram_color_none_tl
805 #1
806 \flowfram_frame:n { #2 }
807 \tl_if_empty:nF { #3 }
808 {
809 \makebox [ 0pt ] [ l ]
810 {
811 \hskip \fflabelsep
812 \fflabelfont { #3 }
813 }
814 }
815 }
816 \cs_new:Nn \__flowfram_do_if_draft:nn
817 {
818 \__flowfram_do_if_draft:nnn
819 { \setffdraftcolor } { #1 } { #2 }
820 }
821 % \end{macrocode}
822 %\end{macro}
823 %
824 % \begin{macrocode}
825 \cs_new:Nn \flowfram_draft_annote:nnn
826 {
827 [ #1 : #2 ; #3 ]
828 }
829 \cs_new:Nn \flowfram_draft_annote:nn
830 {
831 [ #1 : #2 ]
832 }
833 % \end{macrocode}
834 % Colour setting commands, do nothing by default:
835 %\begin{macro}{\@s@tffcol}
836 %Set frame border colour.
837 %Version 2.0 renamed \cs{@s@tffcol}
838 % \begin{macrocode}
839 \cs_new:Nn \__flowfram_set_border_color: { }
840 \tl_new:N \l__flowfram_bordercolor_tl
841 % \end{macrocode}
842 %\end{macro}
843 %\begin{macro}{\@s@tfftextcol}
844 %\changes{2.0}{2025-11-24}{renamed}
845 %Set text colour.
846 %Version 2.0 renamed \cs{@s@tfftextcol}
847 % \begin{macrocode}
848 \cs_new:Nn \__flowfram_set_text_color: { }
849 \tl_new:N \l__flowfram_textcolor_tl
850 % \end{macrocode}
851 %\begin{macro}{\@ffbackground}
852 % Deal with \gls{frame} background colour. Note that the background colour only
853 % extends to the limit of the \gls{frame}['s] \gls{bbox}. If you want the background
854 % colour to be flush with the \glspl{frame} border, you will have to create your own
855 % customised border.
856 % Version 2.0 renamed \cs{@ffbackground}.
857 % \begin{macrocode}
858 \cs_new:Nn \__flowfram_background_box:n { #1 }
859 \tl_new:N \l__flowfram_backcolor_tl
860 % \end{macrocode}
861 %\end{macro}
862 %
863 %\begin{macro}{\@ff@enablecolor}
864 %\changes{1.14}{2012-11-10}{new}
865 %\changes{2.0}{2025-11-24}{removed}
866 % Enable colour commands.
867 % Version 2.0 renamed \cs{@ff@enablecolor}.
868 % \begin{macrocode}
869 \cs_new:Nn \__flowfram_enable_color:
870 {
871 \tl_set_eq:NN \flowframecol \c_flowfram_color_black_tl
872 \tl_set_eq:NN \flowframetextcol \c_flowfram_color_black_tl
873 \cs_set:Nn \__flowfram_set_border_color:
874 {
875 \exp_args:Ne \__flowfram_color:n
876 { \l__flowfram_bordercolor_tl }
877 }
878 \cs_set:Nn \__flowfram_set_text_color:
879 {
880 \exp_args:Ne \__flowfram_color:n
881 { \l__flowfram_textcolor_tl }
882 }
883 \cs_set:Nn \__flowfram_background_box:n
884 {
885 \exp_args:Ne
886 \__flowfram_background_box:nn
887 { \l__flowfram_backcolor_tl } { ##1 }
888 }
889 }
890 % \end{macrocode}
891 %
892 % \begin{macrocode}
893 \prg_new_conditional:Nnn \__flowfram_if_no_color:n
894 { T, F, TF }
895 {
896 \tl_if_empty:nTF { #1 }
897 { \prg_return_true: }
898 {
899 \tl_if_eq:NnTF \c_flowfram_color_none_tl { #1 }
900 { \prg_return_true: }
901 { \prg_return_false: }
902 }
903 }
904 \cs_new:Nn \__flowfram_color:n
905 {
906 \__flowfram_if_no_color:nF
907 { #1 }
908 { \color #1 }
909 }
910 \cs_new:Nn \__flowfram_background_box:nn
911 {
912 \__flowfram_if_no_color:nTF { #1 }
913 { #2 }
914 {
915 \group_begin:
916 \dim_zero:N \fboxsep
917 \colorbox #1 { #2 }
918 \group_end:
919 }
920 }
921 % \end{macrocode}
922 %\end{macro}
923 %\begin{macro}{\@ff@disablecolor}
924 %\changes{1.14}{2012-11-10}{new}
925 % Disable colour commands.
926 % Version 2.0 renamed \cs{@ff@disablecolor}.
927 % \begin{macrocode}
928 \cs_new:Nn \__flowfram_disable_color:
929 {
930 \tl_clear:N \flowframetextcol
931 \tl_clear:N \flowframecol
932 \cs_set:Nn \__flowfram_set_border_color: { }
933 \cs_set:Nn \__flowfram_set_text_color: { }
934 \cs_set_eq:NN \__flowfram_background_box:n \use:n
935 }
936 % \end{macrocode}
937 %\end{macro}
938 %
939 %\begin{macro}{\iflefttorightcolumns}
940 % Determine whether to define the Ncolumn style frames from left
941 % to right or from right to left.
942 %\changes{1.12}{2009/11/25}{new}
943 % \begin{macrocode}
944 \newif\iflefttorightcolumns
945 \lefttorightcolumnstrue
946 % \end{macrocode}
947 %\end{macro}
948 %
949 %To minimize the number of output routine kernel commands that need
950 %to be redefined in order to place all frames in their chosen
951 %locations (including header and footer frames), version 2.0 now
952 %switches on two column mode. This can cause some standard commands
953 %to switch back and forth between one column and two column mode
954 %(for example, \cs{tableofcontents} with the book or report class).
955 %Since \cs{onecolumn} and \cs{twocolumn} are changed by
956 %\sty{flowfram} to create one or two column layouts, this can be
957 %problematic. So v2.0 now has the "column-changes" option, which
958 %governs what to do if \cs{onecolumn} or \cs{twocolumn} are
959 %encountered in the document. The default is to do just clear the
960 %page but don't switch the layout (if the
961 %optional argument of \cs{twocolumn} is present then that is simply
962 %added to the current frame).
963 % \begin{macrocode}
964 \bool_new:N \g__flowfram_ignore_column_changes_bool
965 \bool_gset_true:N \g__flowfram_ignore_column_changes_bool
966 % \end{macrocode}
967 %Determine whether or not to clear page (not applicable if switcher
968 %columns identified).
969 % \begin{macrocode}
970 \bool_new:N \g__flowfram_clearpage_column_changes_bool
971 \bool_gset_false:N \g__flowfram_clearpage_column_changes_bool
972 % \end{macrocode}
973 %
974 %Only make thumbtabs for unnumbered units if the following boolean
975 %is set.
976 % \begin{macrocode}
977 \bool_new:N \g__flowfram_save_nonum_thumbtabs_bool
978 % \end{macrocode}
979 %\begin{macro}{\ifaligntoc}
980 %This is now moved into options. Instead of using
981 %\cs{tocandthumbtabindex}, use the toc-thumbtab option.
982 % \begin{macrocode}
983 \newif\ifaligntoc
984 \aligntocfalse
985 \bool_new:N \l__flowfram_thumbtabs_in_toc_bool
986 \bool_set_false:N \l__flowfram_thumbtabs_in_toc_bool
987 \bool_new:N \l__flowfram_thumbtabs_span_toc_bool
988 \bool_set_false:N \l__flowfram_thumbtabs_span_toc_bool
989 % \end{macrocode}
990 %\end{macro}
991 %Indicates whether or not the sectioning commands have a second
992 %optional argument.
993 % \begin{macrocode}
994 \bool_new:N \l__flowfram_section_header_opt_bool
995 \IfClassLoadedTF { memoir }
996 {
997 \bool_set_true:N \l__flowfram_section_header_opt_bool
998 }
999 {
1000 \bool_set_false:N \l__flowfram_section_header_opt_bool
1001 }
1002 \bool_new:N \l__flowfram_section_header_opt_thumbtab_bool
1003 \bool_set_true:N \l__flowfram_section_header_opt_thumbtab_bool
1004 % \end{macrocode}
1005 %Indicates whether or not the section unit first optional argument
1006 %may be a key=value list (for example with KOMA's
1007 %headings=optiontoheadandtoc setting).
1008 % \begin{macrocode}
1009 \bool_new:N \l__flowfram_section_keyval_opt_bool
1010 \bool_set_false:N \l__flowfram_section_keyval_opt_bool
1011 % \end{macrocode}
1012 %Provide keys if the above is true:
1013 % \begin{macrocode}
1014 \tl_new:N \l__flowfram_section_opti_tl
1015 \tl_new:N \l__flowfram_section_optii_tl
1016 \tl_new:N \l__flowfram_section_toc_tl
1017 \tl_new:N \l__flowfram_section_head_tl
1018 \keys_define:nn { flowfram / section }
1019 {
1020 head .tl_set:N = \l__flowfram_section_head_tl ,
1021 tocentry .tl_set:N = \l__flowfram_section_toc_tl ,
1022 toc .tl_set:N = \l__flowfram_section_toc_tl ,
1023 }
1024 % \end{macrocode}
1025 %If \sty{hyperref} package is loaded, automatically enable
1026 %hyperlinks for thumtab index.
1027 %\begin{macro}{\thumbtabhyperlinkformat}
1028 %\changes{2.0}{2025-11-24}{new}
1029 % \begin{macrocode}
1030 \NewDocumentCommand \thumbtabhyperlinkformat { m m m }
1031 {
1032 \thumbtabformat { #2 } { #3 }
1033 }
1034 % \end{macrocode}
1035 %\end{macro}
1036 %
1037 % \begin{macrocode}
1038 \AddToHook
1039 { package / hyperref / after }
1040 {
1041 \RenewDocumentCommand \thumbtabhyperlinkformat { m m m }
1042 {
1043 \hyperlink { #1 } { \thumbtabformat { #2 } { #3 } }
1044 }
1045 }
1046 % \end{macrocode}
1047 %
1048 %By default, only the thumbtab indexes have hyperlinks (if
1049 %supported).
1050 %\begin{macro}{\thumbtabindexformat}
1051 % Thumbtab format. If hyperlinks are defined,
1052 % use a hyperlink in the thumbtab index.
1053 % Syntax: \cs{thumbtabindexformat}\marg{link}\marg{text}\marg{height}
1054 % \begin{macrocode}
1055 \newcommand \thumbtabindexformat [ 3 ]
1056 {
1057 \thumbtabhyperlinkformat { #1 } { #2 } { #3 }
1058 }
1059 % \end{macrocode}
1060 %\end{macro}
1061 %\begin{macro}{\thumbtabregularformat}
1062 %\changes{2.0}{2025-11-24}{new}
1063 %Format for non-index thumbtabs.
1064 % \begin{macrocode}
1065 \newcommand \thumbtabregularformat [ 3 ]
1066 {
1067 \thumbtabformat { #2 } { #3 }
1068 }
1069 % \end{macrocode}
1070 %\end{macro}
1071 %
1072 %Should thumbtabs be created outside the main matter?
1073 % \begin{macrocode}
1074 \bool_new:N \g__flowfram_frontmatter_bool
1075 \bool_gset_false:N \g__flowfram_frontmatter_bool
1076 \bool_new:N \g__flowfram_backmatter_bool
1077 \bool_gset_false:N \g__flowfram_backmatter_bool
1078 \cs_if_exist:cTF { if@mainmatter }
1079 {
1080 \prg_new_conditional:Nnn \flowfram_if_mainmatter:
1081 { T, F, TF }
1082 {
1083 \legacy_if:nTF { @mainmatter }
1084 { \prg_return_true: }
1085 { \prg_return_false: }
1086 }
1087 \cs_if_exist:NT \frontmatter
1088 {
1089 \appto \frontmatter
1090 {
1091 \bool_gset_true:N \g__flowfram_frontmatter_bool
1092 \bool_gset_false:N \g__flowfram_backmatter_bool
1093 }
1094 }
1095 \cs_if_exist:NT \backmatter
1096 {
1097 \appto \backmatter
1098 {
1099 \bool_gset_false:N \g__flowfram_frontmatter_bool
1100 \bool_gset_true:N \g__flowfram_backmatter_bool
1101 \__flowfram_write_backmatter_ttb:
1102 \__flowfram_backmatter_setsecnumdepth:
1103 }
1104 }
1105 \cs_if_exist:NT \mainmatter
1106 {
1107 \appto \mainmatter
1108 {
1109 \bool_gset_false:N \g__flowfram_frontmatter_bool
1110 \bool_gset_false:N \g__flowfram_backmatter_bool
1111 }
1112 }
1113 }
1114 {
1115 \prg_new_conditional:Nnn \flowfram_if_mainmatter:
1116 { T, F, TF }
1117 {
1118 \prg_return_true:
1119 }
1120 }
1121 \cs_new:Nn \__flowfram_ttb_notmainmatter_num:n
1122 {
1123 \bool_if:NF \g__flowfram_frontmatter_bool
1124 {
1125 \__flowfram_ttb_num:n { #1 }
1126 }
1127 }
1128 % \end{macrocode}
1129 % change the secnumdepth counter in the backmatter if applicable
1130 % \begin{macrocode}
1131 \cs_new:Nn \__flowfram_backmatter_setsecnumdepth:
1132 {
1133 \setcounter { secnumdepth } { -1 }
1134 }
1135 % \end{macrocode}
1136 %Case changing command used by dynamic header.
1137 % \begin{macrocode}
1138 \cs_new:Nn \flowfram_header_case:n { #1 }
1139 \cs_new:Nn \flowfram_subheader_case:n { #1 }
1140 % \end{macrocode}
1141 %Font used by dynamic header.
1142 % \begin{macrocode}
1143 \cs_new:Nn \flowfram_header_font:n { \emph { #1 } }
1144 \cs_new:Nn \flowfram_subheader_font:n { \flowfram_header_font:n { #1 } }
1145 \cs_new:Nn \__flowfram_adjust_page_styles:n
1146 {
1147 #1
1148 }
1149 % \end{macrocode}
1150 %Header separator:
1151 % \begin{macrocode}
1152 \ExplSyntaxOff
1153 \ifdef\chapter
1154 {
1155 \newcommand{\flowframheaderchapprefix}{\@chapapp \ }
1156 \newcommand{\flowframheadersep}{.\ }
1157 }
1158 {
1159 \newcommand{\flowframheaderchapprefix}{}
1160 \newcommand{\flowframheadersep}{\quad}
1161 }
1162 \ExplSyntaxOn
1163 % \end{macrocode}
1164 %Table of contents header.
1165 % \begin{macrocode}
1166 \renewcommand \tableofcontents
1167 {
1168 \__flowfram_tableofcontents:
1169 }
1170 % \end{macrocode}
1171 %
1172 % \begin{macrocode}
1173 \cs_if_exist:NTF \chapter
1174 {
1175 \cs_new:Nn \__flowfram_adjusted_toc:
1176 {
1177 \chapter * { \contentsname }
1178 \chaptermark { \contentsname }
1179 \@starttoc { toc }
1180 }
1181 }
1182 {
1183 \cs_new:Nn \__flowfram_adjusted_toc:
1184 {
1185 \section * { \contentsname }
1186 \sectionmark { \contentsname }
1187 \@starttoc { toc }
1188 }
1189 }
1190 \cs_new:Nn \flowfram_toc:
1191 {
1192 \__flowfram_adjusted_toc:
1193 }
1194 % \end{macrocode}
1195 %
1196 %By default, ffempty style clears the header and footer.
1197 % \begin{macrocode}
1198 \tl_new:N \l__flowfram_ffempty_style_tl
1199 \tl_set:Nn \l__flowfram_ffempty_style_tl { \__flowfram_ps_empty: }
1200 % \end{macrocode}
1201 % and hides the dynamic frames:
1202 % \begin{macrocode}
1203 \bool_new:N \l__flowfram_ps_ffempty_hides_bool
1204 \bool_set_true:N \l__flowfram_ps_ffempty_hides_bool
1205 % \end{macrocode}
1206 %
1207 % \begin{macrocode}
1208 \cs_new:Nn \__flowfram_only_pre_makedfheaderfooter:nn { #2 }
1209 % \end{macrocode}
1210 %
1211 %Save original definition of \cs{tableofcontents}:
1212 % \begin{macrocode}
1213 \cs_set_eq:NN \__flowfram_org_tableofcontents: \tableofcontents
1214 % \end{macrocode}
1215 %
1216 %The new \LaTeX\ hook management system and sophisticated classes
1217 %now make the old \sty{flowfram} pre-chapter hooks somewhat redundant.
1218 %These are retained for backward-compatibility but provide a way of
1219 %omitting them.
1220 % \begin{macrocode}
1221 \cs_new:Nn \__flowfram_do_addto_prechap:
1222 {
1223 \__flowfram_addto_prechap:
1224 }
1225 \cs_new:Nn \__flowfram_addto_prechap:
1226 {
1227 % \end{macrocode}
1228 %First check if \cs{chapter} exists:
1229 % \begin{macrocode}
1230 \cs_if_exist:NT \chapter
1231 {
1232 % \end{macrocode}
1233 %\begin{macro}{\chapterfirstpagestyle}
1234 % User may want a non standard style for the first page of
1235 % each chapter, so modify chapter commands to take this into
1236 % account.
1237 % \begin{macrocode}
1238 \newcommand*{\chapterfirstpagestyle}{plain}%
1239 % \end{macrocode}
1240 %\end{macro}
1241 %
1242 % \begin{macrocode}
1243 \AddToHook { cmd / chapter / before }
1244 {
1245 \ffprechapterhook
1246 \thispagestyle { \chapterfirstpagestyle }
1247 }
1248 % \end{macrocode}
1249 %\end{macro}
1250 %\begin{macro}{\ffprechapterhook}
1251 %\changes{1.14}{2012-11-10}{new}
1252 % Hook at start of chapter (before page break issued)
1253 %This is redundant now that hook are available but retained for
1254 %backward-compatibility.
1255 % \begin{macrocode}
1256 \newcommand*{\ffprechapterhook}{}
1257 % \end{macrocode}
1258 %\end{macro}
1259 %
1260 % End of test if \cs{chapter} defined:
1261 % \begin{macrocode}
1262 }
1263 % \end{macrocode}
1264 %
1265 % \begin{macrocode}
1266 }
1267 % \end{macrocode}
1268 %
1269 % Now declare the options.
1270 % NB v2.0 has switched from xkeyval to l3keys.
1271 % \begin{macrocode}
1272 \keys_define:nn { flowfram }
1273 {
1274 % \end{macrocode}
1275 % Should the table of contents be adjusted.
1276 % \begin{macrocode}
1277 adjust-toc .choice: ,
1278 % \end{macrocode}
1279 % adjust the table of contents including the header (default):
1280 % \begin{macrocode}
1281 adjust-toc / header .code:n =
1282 {
1283 \cs_set:Nn \flowfram_toc:
1284 {
1285 \__flowfram_adjusted_toc:
1286 }
1287 \renewcommand \tableofcontents
1288 {
1289 \__flowfram_tableofcontents:
1290 }
1291 } ,
1292 % \end{macrocode}
1293 % adjust the table of contents but retain original header:
1294 % \begin{macrocode}
1295 adjust-toc / notheader .code:n =
1296 {
1297 \cs_set:Nn \flowfram_toc:
1298 {
1299 \__flowfram_org_tableofcontents:
1300 }
1301 \renewcommand \tableofcontents
1302 {
1303 \__flowfram_tableofcontents:
1304 }
1305 } ,
1306 % \end{macrocode}
1307 % don't adjust the table of contents (no support for thumbtab index
1308 % or minitocs):
1309 % \begin{macrocode}
1310 adjust-toc / off .code:n =
1311 {
1312 \let \tableofcontents \__flowfram_org_tableofcontents:
1313 } ,
1314 % \end{macrocode}
1315 % If the header and footer are converted into dynamic frames,
1316 % indicate how to adjust the page styles.
1317 % \begin{macrocode}
1318 dynamic-page-style .choice: ,
1319 dynamic-page-style .usage:n = { preamble } ,
1320 dynamic-page-style / adjust .code:n =
1321 {
1322 \__flowfram_only_pre_makedfheaderfooter:nn
1323 { dynamic-page-style = adjust }
1324 {
1325 \cs_set_eq:NN \__flowfram_adjust_page_styles:n \use:n
1326 }
1327 } ,
1328 dynamic-page-style / noadjust .code:n =
1329 {
1330 \__flowfram_only_pre_makedfheaderfooter:nn
1331 { dynamic-page-style = noadjust }
1332 {
1333 \cs_set_eq:NN \__flowfram_adjust_page_styles:n \use_none:n
1334 }
1335 } ,
1336 dynamic-header-case .choice: ,
1337 dynamic-header-case / uc .code:n =
1338 {
1339 \cs_set:Nn \flowfram_header_case:n
1340 {
1341 \MakeUppercase { ##1 }
1342 }
1343 } ,
1344 dynamic-header-case / no-change .code:n =
1345 {
1346 \cs_set:Nn \flowfram_header_case:n { ##1 }
1347 } ,
1348 dynamic-subheader-case .choice: ,
1349 dynamic-subheader-case / uc .code:n =
1350 {
1351 \cs_set:Nn \flowfram_subheader_case:n
1352 {
1353 \MakeUppercase { ##1 }
1354 }
1355 } ,
1356 dynamic-subheader-case / no-change .code:n =
1357 {
1358 \cs_set:Nn \flowfram_subheader_case:n { ##1 }
1359 } ,
1360 dynamic-page-style-header-font .code:n =
1361 {
1362 \tl_if_empty:nTF { #1 }
1363 {
1364 \cs_set:Nn \flowfram_header_font:n { ##1 }
1365 }
1366 {
1367 \cs_set:Nn \flowfram_header_font:n { #1 { ##1 } }
1368 }
1369 } ,
1370 dynamic-page-style-subheader-font .code:n =
1371 {
1372 \tl_if_empty:nTF { #1 }
1373 {
1374 \cs_set:Nn \flowfram_subheader_font:n { ##1 }
1375 }
1376 {
1377 \cs_set:Nn \flowfram_subheader_font:n { #1 { ##1 } }
1378 }
1379 } ,
1380 % \end{macrocode}
1381 %How should ffempty page style behave?
1382 % \begin{macrocode}
1383 dynamic-empty-page-style .choice: ,
1384 dynamic-empty-page-style / empty .code:n =
1385 {
1386 \tl_set:Nn \l__flowfram_ffempty_style_tl { \__flowfram_ps_empty: }
1387 \bool_set_false:N \l__flowfram_ps_ffempty_hides_bool
1388 } ,
1389 dynamic-empty-page-style / plain .code:n =
1390 {
1391 \tl_set:Nn \l__flowfram_ffempty_style_tl { \__flowfram_ps_plain: }
1392 \bool_set_false:N \l__flowfram_ps_ffempty_hides_bool
1393 } ,
1394 dynamic-empty-page-style / headings .code:n =
1395 {
1396 \tl_set:Nn \l__flowfram_ffempty_style_tl { \__flowfram_ps_headings: }
1397 \bool_set_false:N \l__flowfram_ps_ffempty_hides_bool
1398 } ,
1399 dynamic-empty-page-style / myheadings .code:n =
1400 {
1401 \tl_set:Nn \l__flowfram_ffempty_style_tl { \__flowfram_ps_myheadings: }
1402 \bool_set_false:N \l__flowfram_ps_ffempty_hides_bool
1403 } ,
1404 dynamic-empty-page-style / ignore .code:n =
1405 {
1406 \tl_clear:N \l__flowfram_ffempty_style_tl
1407 \bool_set_false:N \l__flowfram_ps_ffempty_hides_bool
1408 } ,
1409 dynamic-empty-page-style / hide .code:n =
1410 {
1411 \bool_set_true:N \l__flowfram_ps_ffempty_hides_bool
1412 } ,
1413 dynamic-empty-page-style / show .code:n =
1414 {
1415 \bool_set_false:N \l__flowfram_ps_ffempty_hides_bool
1416 } ,
1417 % \end{macrocode}
1418 %If backmatter is supported, adjust the secnumdepth counter:
1419 % \begin{macrocode}
1420 backmatter-sections .choice: ,
1421 backmatter-sections / no-number .code:n =
1422 {
1423 \cs_set:Nn \__flowfram_backmatter_setsecnumdepth:
1424 {
1425 \setcounter { secnumdepth } { -1 }
1426 }
1427 } ,
1428 backmatter-sections / no-change .code:n =
1429 {
1430 \cs_set:Nn \__flowfram_backmatter_setsecnumdepth:
1431 {
1432 }
1433 } ,
1434 % \end{macrocode}
1435 % Indicate if unstarred units outside of the main matter should have
1436 % thumbtabs.
1437 % \begin{macrocode}
1438 matter-thumbtabs .choice: ,
1439 matter-thumbtabs / main-only .code:n =
1440 {
1441 \cs_set:Nn \__flowfram_ttb_notmainmatter_num:n
1442 {
1443 }
1444 },
1445 matter-thumbtabs / all .code:n =
1446 {
1447 \cs_set:Nn \__flowfram_ttb_notmainmatter_num:n
1448 {
1449 \__flowfram_ttb_num:n { ##1 }
1450 }
1451 },
1452 matter-thumbtabs / not-front .code:n =
1453 {
1454 \cs_set:Nn \__flowfram_ttb_notmainmatter_num:n
1455 {
1456 \bool_if:NF \g__flowfram_frontmatter_bool
1457 {
1458 \__flowfram_ttb_num:n { ##1 }
1459 }
1460 }
1461 },
1462 matter-thumbtabs / not-back .code:n =
1463 {
1464 \cs_set:Nn \__flowfram_ttb_notmainmatter_num:n
1465 {
1466 \bool_if:NF \g__flowfram_backmatter_bool
1467 {
1468 \__flowfram_ttb_num:n { ##1 }
1469 }
1470 }
1471 },
1472 % \end{macrocode}
1473 % Indicate which thumbtabs should have hyperlinks (if supported).
1474 % \begin{macrocode}
1475 thumbtab-links .choice: ,
1476 thumbtab-links / toc-only .code:n =
1477 {
1478 \renewcommand \thumbtabindexformat [ 3 ]
1479 {
1480 \thumbtabhyperlinkformat { ##1 } { ##2 } { ##3 }
1481 }
1482 \renewcommand \thumbtabregularformat [ 3 ]
1483 {
1484 \thumbtabformat { ##2 } { ##3 }
1485 }
1486 } ,
1487 thumbtab-links / all .code:n =
1488 {
1489 \renewcommand \thumbtabindexformat [ 3 ]
1490 {
1491 \thumbtabhyperlinkformat { ##1 } { ##2 } { ##3 }
1492 }
1493 \renewcommand \thumbtabregularformat [ 3 ]
1494 {
1495 \thumbtabhyperlinkformat { ##1 } { ##2 } { ##3 }
1496 }
1497 } ,
1498 thumbtab-links / none .code:n =
1499 {
1500 \renewcommand \thumbtabindexformat [ 3 ]
1501 {
1502 \thumbtabformat { ##2 } { ##3 }
1503 }
1504 \renewcommand \thumbtabregularformat [ 3 ]
1505 {
1506 \thumbtabformat { ##2 } { ##3 }
1507 }
1508 } ,
1509 % \end{macrocode}
1510 % Indicate whether or not unstarred units should have thumbtabs.
1511 % \begin{macrocode}
1512 unstarred-thumbtabs .bool_gset:N =
1513 \g__flowfram_save_nonum_thumbtabs_bool ,
1514 % \end{macrocode}
1515 % Indicate whether or not thumbtab indexes should appear in the
1516 % table of contents and, if so, whether or not to align them.
1517 % \begin{macrocode}
1518 toc-thumbtabs .choice: ,
1519 toc-thumbtabs / aligned .code:n =
1520 {
1521 \aligntoctrue
1522 \bool_set_true:N \l__flowfram_thumbtabs_in_toc_bool
1523 \bool_set_false:N \l__flowfram_thumbtabs_span_toc_bool
1524 } ,
1525 toc-thumbtabs / unaligned .code:n =
1526 {
1527 \aligntocfalse
1528 \bool_set_true:N \l__flowfram_thumbtabs_in_toc_bool
1529 \bool_set_false:N \l__flowfram_thumbtabs_span_toc_bool
1530 } ,
1531 toc-thumbtabs / false .code:n =
1532 {
1533 \bool_set_false:N \l__flowfram_thumbtabs_in_toc_bool
1534 } ,
1535 toc-thumbtabs / true .code:n =
1536 {
1537 \aligntocfalse
1538 \bool_set_true:N \l__flowfram_thumbtabs_in_toc_bool
1539 \bool_set_true:N \l__flowfram_thumbtabs_span_toc_bool
1540 } ,
1541 toc-thumbtabs .default:n = { true } ,
1542 sections-extra-option .choice: ,
1543 sections-extra-option / as-original .code:n =
1544 {
1545 \bool_set_true:N \l__flowfram_section_header_opt_bool
1546 \bool_set_false:N \l__flowfram_section_header_opt_thumbtab_bool
1547 } ,
1548 sections-extra-option / thumbtab-only .code:n =
1549 {
1550 \bool_set_false:N \l__flowfram_section_header_opt_bool
1551 \bool_set_true:N \l__flowfram_section_header_opt_thumbtab_bool
1552 } ,
1553 sections-extra-option / original-and-thumbtab .code:n =
1554 {
1555 \bool_set_true:N \l__flowfram_section_header_opt_bool
1556 \bool_set_true:N \l__flowfram_section_header_opt_thumbtab_bool
1557 } ,
1558 sections-option-keyval .bool_set:N = \l__flowfram_section_keyval_opt_bool ,
1559 column-changes .choice: ,
1560 column-changes / ignore .code:n =
1561 {
1562 \bool_gset_true:N \g__flowfram_ignore_column_changes_bool
1563 \bool_gset_false:N \g__flowfram_clearpage_column_changes_bool
1564 } ,
1565 column-changes / clearpage .code:n =
1566 {
1567 % \end{macrocode}
1568 %Clear the page but otherwise ignore the column change command.
1569 % \begin{macrocode}
1570 \bool_gset_true:N \g__flowfram_clearpage_column_changes_bool
1571 \bool_gset_true:N \g__flowfram_ignore_column_changes_bool
1572 } ,
1573 column-changes / switch .code:n =
1574 {
1575 % \end{macrocode}
1576 %Switch to designated frames, if set up.
1577 % \begin{macrocode}
1578 \bool_gset_true:N \g__flowfram_clearpage_column_changes_bool
1579 \bool_gset_false:N \g__flowfram_ignore_column_changes_bool
1580 } ,
1581 draft .code:n = { \__flowfram_set_draft: } ,
1582 final .code:n = { \__flowfram_set_final: } ,
1583 verbose .choice: ,
1584 verbose / true .code:n =
1585 {
1586 \let \flf@doifverbose \@firstofone
1587 } ,
1588 verbose / false .code:n =
1589 {
1590 \let \flf@doifverbose \@gobble
1591 } ,
1592 verbose .default:n = { true } ,
1593 thumbtab-text .choice: ,
1594 thumbtab-text / normal .code:n =
1595 {
1596 \cs_set_eq:NN \__flowfram_thumbtab_fmt:nn \use_i:nn
1597 } ,
1598 thumbtab-text / stack .code:n =
1599 {
1600 \cs_set_eq:NN
1601 \__flowfram_thumbtab_fmt:nn
1602 \__flowfram_thumbtab_fmt_stack:nn
1603 } ,
1604 thumbtab-text / rotate-right .code:n =
1605 {
1606 \cs_set_eq:NN
1607 \__flowfram_thumbtab_fmt:nn
1608 \__flowfram_thumbtab_fmt_sideways_oneside_right:nn
1609 } ,
1610 thumbtab-text / rotate-left .code:n =
1611 {
1612 \cs_set_eq:NN
1613 \__flowfram_thumbtab_fmt:nn
1614 \__flowfram_thumbtab_fmt_sideways_oneside_left:nn
1615 } ,
1616 thumbtab-text / rotate .code:n =
1617 {
1618 \cs_set_eq:NN
1619 \__flowfram_thumbtab_fmt:nn
1620 \__flowfram_thumbtab_fmt_sideways:nn
1621 } ,
1622 % \end{macrocode}
1623 % Provide a way of inhibiting frame rotation.
1624 % \begin{macrocode}
1625 prohibit-frame-rotation .bool_set_inverse:N =
1626 \l__flowfram_allow_frame_rotation_bool ,
1627 % \end{macrocode}
1628 % Provide old option for backward compatibility.
1629 % \begin{macrocode}
1630 rotate .choice: ,
1631 rotate / true .code:n =
1632 {
1633 \bool_set_true:N \l__flowfram_allow_frame_rotation_bool
1634 \cs_set_eq:NN
1635 \__flowfram_thumbtab_fmt:nn
1636 \__flowfram_thumbtab_fmt_sideways_oneside_right:nn
1637 } ,
1638 rotate / false .code:n =
1639 {
1640 \bool_set_false:N \l__flowfram_allow_frame_rotation_bool
1641 \cs_set_eq:NN
1642 \__flowfram_thumbtab_fmt:nn
1643 \__flowfram_thumbtab_fmt_stack:nn
1644 } ,
1645 rotate .default:n = { true } ,
1646 norotate .code:n =
1647 {
1648 \bool_set_false:N \l__flowfram_allow_frame_rotation_bool
1649 \cs_set_eq:NN
1650 \__flowfram_thumbtab_fmt:nn
1651 \__flowfram_thumbtab_fmt_stack:nn
1652 } ,
1653 % \end{macrocode}
1654 %\changes{1.14}{2012-11-10}{new}
1655 % The \opt{thumbtabs} option replaces the \opt{ttbtitle},
1656 % \opt{ttbnotitle}, \opt{ttbnum} and \opt{ttbnonum}
1657 % options.
1658 % \begin{macrocode}
1659 thumbtabs .choice: ,
1660 thumbtabs / title .code:n =
1661 {
1662 \bool_set_false:N \l__flowfram_ttb_show_number_bool
1663 \bool_set_true:N \l__flowfram_ttb_show_title_bool
1664 } ,
1665 thumbtabs / number .code:n =
1666 {
1667 \bool_set_true:N \l__flowfram_ttb_show_number_bool
1668 \bool_set_false:N \l__flowfram_ttb_show_title_bool
1669 } ,
1670 thumbtabs / both .code:n =
1671 {
1672 \bool_set_true:N \l__flowfram_ttb_show_number_bool
1673 \bool_set_true:N \l__flowfram_ttb_show_title_bool
1674 } ,
1675 thumbtabs / none .code:n =
1676 {
1677 \bool_set_false:N \l__flowfram_ttb_show_number_bool
1678 \bool_set_false:N \l__flowfram_ttb_show_title_bool
1679 } ,
1680 thumbtabs .default:n = { title } ,
1681 thumbtabs .usage:n = { preamble } ,
1682 % \end{macrocode}
1683 % Provide old options for backward compatibility:
1684 % \begin{macrocode}
1685 ttbtitle .code:n =
1686 {
1687 \bool_set_true:N \l__flowfram_ttb_show_title_bool
1688 } ,
1689 ttbtitle .usage:n = { preamble } ,
1690 ttbnotitle .code:n =
1691 {
1692 \bool_set_false:N \l__flowfram_ttb_show_title_bool
1693 } ,
1694 ttbnotitle .usage:n = { preamble } ,
1695 ttbnum .code:n =
1696 {
1697 \bool_set_true:N \l__flowfram_ttb_show_number_bool
1698 } ,
1699 ttbnum .usage:n = { preamble } ,
1700 ttbnonum .code:n =
1701 {
1702 \bool_set_false:N \l__flowfram_ttb_show_number_bool
1703 } ,
1704 ttbnonum .usage:n = { preamble } ,
1705 % \end{macrocode}
1706 % Determine whether the pages key when defining frames refers to the
1707 % page number as given by \cs{c@page} or the absolute
1708 % page number as given by \cs{c@absolutepage}.
1709 % \begin{macrocode}
1710 pages .choice: ,
1711 pages / relative .code:n =
1712 {
1713 \tl_gset:Nn \g__flowfram_pagecounter_tl { \c@page }
1714 } ,
1715 pages / absolute .code:n =
1716 {
1717 \tl_gset:Nn \g__flowfram_pagecounter_tl { \c@absolutepage }
1718 } ,
1719 pages .usage:n = { preamble } ,
1720 % \end{macrocode}
1721 %\changes{1.14}{2012-11-10}{changed color to boolean option}
1722 % If color=true option specified, set up the default colours
1723 % for the borders and text for all frame types. Note that
1724 % the colour name has to be grouped within the definition
1725 % of \cs{flowframecol} and \cs{flowframetextcol}. This
1726 % was done so that you could do, for example,
1727 % \verb"\renewcommand{\flowframecol}{[rgb]{1,1,0}}" so that
1728 % you can specify the colour model as well.
1729 % The commands \cs{@s@tffcol} and \cs{@s@tfftextcol}
1730 % switch to the border and text colour, respectively. They
1731 % both assume that \cs{ff@col} has been set to the
1732 % relevant colour before use.
1733 % \begin{macrocode}
1734 color .choice: ,
1735 color / true .code:n =
1736 {
1737 \__flowfram_enable_color:
1738 } ,
1739 color / false .code:n =
1740 {
1741 % \end{macrocode}
1742 % Option set to false, ensure that the colour changing
1743 % commands do nothing:
1744 % \begin{macrocode}
1745 \__flowfram_disable_color:
1746 } ,
1747 color .default:n = { true } ,
1748 color .usage:n = { preamble } ,
1749 % \end{macrocode}
1750 % Provide \opt{nocolor} option for backward compatibility:
1751 % \begin{macrocode}
1752 nocolor .code:n =
1753 {
1754 \__flowfram_disable_color:
1755 } ,
1756 nocolor .usage:n = { preamble } ,
1757 % \end{macrocode}
1758 % Define options that set the direction.
1759 % \begin{macrocode}
1760 LR .code:n = { \lefttorightcolumnstrue } ,
1761 LR .usage:n = { preamble } ,
1762 RL .code:n = { \lefttorightcolumnsfalse } ,
1763 RL .usage:n = { preamble } ,
1764 adjust-pre-chapter .choice: ,
1765 adjust-pre-chapter / true .code:n =
1766 {
1767 \cs_set:Nn \__flowfram_do_addto_prechap:
1768 {
1769 \__flowfram_addto_prechap:
1770 }
1771 } ,
1772 adjust-pre-chapter / false .code:n =
1773 {
1774 \cs_set:Nn \__flowfram_do_addto_prechap: { }
1775 } ,
1776 adjust-pre-chapter .default:n = { true },
1777 adjust-pre-chapter .usage:n = { load },
1778 }
1779 % \end{macrocode}
1780 %
1781 %For options that can be set after the package has loaded:
1782 % \begin{macrocode}
1783 \NewDocumentCommand \flowframsetup { m }
1784 {
1785 \keys_set:nn { flowfram } { #1 }
1786 }
1787 % \end{macrocode}
1788 %
1789 %Set the defaults. Version 2.0 color now initialised to on.
1790 %(NB original version of flowfram was
1791 %released in 2005 when there was less support for colour and
1792 %rotation.)
1793 % \begin{macrocode}
1794 \flowframsetup{color}
1795 % \end{macrocode}
1796 %
1797 %Apply any options set via flowframtkutils::
1798 % \begin{macrocode}
1799 \IfPackageLoadedT { flowframtkutils }
1800 {
1801 \clist_if_empty:NF \g__flowframtk_options_clist
1802 {
1803 \keys_set:nV { flowfram } \g__flowframtk_options_clist
1804 }
1805 }
1806 % \end{macrocode}
1807 %Switch off L3 syntax:
1808 % \begin{macrocode}
1809 \ExplSyntaxOff
1810 % \end{macrocode}
1811 %Now load color package to support grey.
1812 % \begin{macrocode}
1813 \RequirePackage{color}
1814 % \end{macrocode}
1815 % Now the defaults have all been set, the package options
1816 % specified by the user can be processed.
1817 % \begin{macrocode}
1818 \ProcessKeyOptions[flowfram]
1819 % \end{macrocode}
1820 %
1821 % \begin{macrocode}
1822 \ExplSyntaxOn
1823 % \end{macrocode}
1824 %Prior to v2.0, \cs{textwidth} and \cs{textheight} were used to
1825 %keep track of the typeblock. This causes a problem when the output
1826 %routine commands set \cs{vsize} to \cs{textheight}. Now there are
1827 %two new lengths to keep track of the typeblock, which are
1828 %initialised to \cs{textwidth} and \cs{textheight}. The frames may
1829 %be the exact height of the typeblock or may overlap, but this
1830 %provides a base for commands that need to know the default area.
1831 % \begin{macrocode}
1832 \newlength \typeblockwidth
1833 \newlength \typeblockheight
1834 \newlength \typeblockoffsety
1835 % \end{macrocode}
1836 % \begin{macrocode}
1837 \cs_new:Nn \flowfram_update_typeblock:
1838 {
1839 \global \setlength \typeblockwidth \textwidth
1840 \global \setlength \typeblockheight \textheight
1841 \dim_gset:Nn \typeblockoffsety
1842 {
1843 \topmargin
1844 + \headheight
1845 + \headsep
1846 + \voffset
1847 }
1848 }
1849 \flowfram_update_typeblock:
1850 % \end{macrocode}
1851 %Ideally geometry needs to be set first.
1852 % \begin{macrocode}
1853 \AddToHook
1854 { package / geometry / after }
1855 {
1856 \flowfram_update_typeblock:
1857 }
1858 % \end{macrocode}
1859 %Add pre-chapter hook if required:
1860 % \begin{macrocode}
1861 \__flowfram_do_addto_prechap:
1862 % \end{macrocode}
1863 %
1864 %\begin{counter}{maxflow}
1865 % Now get on with the package. First we need to set up
1866 % a register to store the number of \glspl{flow} that have been defined:
1867 % \begin{macrocode}
1868 \newcounter{maxflow}
1869 % \end{macrocode}
1870 %\end{counter}
1871 %
1872 %\begin{counter}{thisframe}
1873 % Next define a counter to keep track of the \gls{idn} of the current
1874 % \gls{flow}.
1875 %\changes{2.0}{2025-11-24}{replaced \cs{thepage} with
1876 %\cs{theabsolutepage}}
1877 % \begin{macrocode}
1878 \newcounter{thisframe}
1879 \AddToHook
1880 { package / hyperref / after }
1881 {
1882 \def \theHthisframe { \theabsolutepage . \arabic {thisframe} }
1883 }
1884 % \end{macrocode}
1885 %\end{counter}
1886 %
1887 %\begin{macro}{\labelflowidn}
1888 %\changes{1.11}{2008/06/27}{new}
1889 %\changes{2.0}{2025-11-24}{changed to document command}
1890 % Define a command to label the current \gls{flow} so that its
1891 % \gls{idn} can be referenced:
1892 % \begin{macrocode}
1893 \NewDocumentCommand \labelflowidn { m }
1894 {
1895 \group_begin:
1896 \def \@currentlabel { \thethisframe }
1897 \label { #1 }
1898 \group_end:
1899 }
1900 % \end{macrocode}
1901 %\end{macro}
1902 %
1903 %\begin{counter}{displayedframe}
1904 % Define a counter to store the current frame index for the current
1905 % page. This will be the same as the \gls{idn} if all \glspl{flow}
1906 % are displayed on the current page, but may be different to the
1907 % \gls{idn} if some \glspl{flow} are not displayed.
1908 %\changes{1.11}{2008/06/27}{displayedframe counter added}
1909 % \begin{macrocode}
1910 \newcounter{displayedframe}
1911 \AddToHook
1912 { package / hyperref / after }
1913 {
1914 \def \theHdisplayedframe { \thepage . \arabic{displayedframe} }
1915 }
1916 % \end{macrocode}
1917 %\end{counter}
1918 %
1919 %\begin{macro}{\labelflow}
1920 %\changes{1.11}{2008/06/27}{new}
1921 %\changes{2.0}{2025-11-24}{changed to document command}
1922 % Define a command to label the current \gls{flow} so that its
1923 % displayed index can be referenced:
1924 % \begin{macrocode}
1925 \NewDocumentCommand \labelflow { m }
1926 {
1927 \group_begin:
1928 \def \@currentlabel { \thedisplayedframe }
1929 \label { #1 }
1930 \group_end:
1931 }
1932 % \end{macrocode}
1933 %\end{macro}
1934 %\begin{counter}{maxstatic}
1935 % Define a counter to store the total number of \glspl{static}:
1936 % \begin{macrocode}
1937 \newcounter{maxstatic}
1938 % \end{macrocode}
1939 %\end{counter}
1940 %\begin{counter}{maxdynamic}
1941 % Define a counter to store the total number of \glspl{dynamic}:
1942 % \begin{macrocode}
1943 \newcounter{maxdynamic}
1944 % \end{macrocode}
1945 %\end{counter}
1946 %
1947 % Define some temporary variables. These have been changed to L3
1948 % integer variables in v2.0.
1949 % \begin{macrocode}
1950 \int_new:N \l__flowfram_current_frame_int
1951 \int_new:N \l__flowfram_current_abspage_int
1952 \int_new:N \l__flowfram_current_static_int
1953 \int_new:N \l__flowfram_current_dynamic_int
1954 \int_new:N \l__flowfram_col_int
1955 \int_new:N \l__flowfram_tmpa_int
1956 \int_new:N \l__flowfram_tmpb_int
1957 \int_new:N \l__flowfram_id_int
1958 \int_new:N \l__flowfram_id_ii_int
1959 \int_new:N \l__flowfram_type_int
1960 \int_new:N \l__flowfram_type_ii_int
1961 \int_new:N \l__flowfram_range_start_int
1962 \int_new:N \l__flowfram_range_end_int
1963 \int_new:N \l__flowfram_shape_int
1964 \dim_new:N \l__flowfram_tmpa_dim
1965 \dim_new:N \l__flowfram_tmpb_dim
1966 \clist_new:N \l__flowfram_tmp_clist
1967 % \end{macrocode}
1968 %Dimensions used for both static and dynamic frames:
1969 % \begin{macrocode}
1970 \dim_new:N \l__flowfram_sfdf_height_dim
1971 \dim_new:N \l__flowfram_sfdf_width_dim
1972 \tl_new:N \l__flowfram_tmpa_tl
1973 \bool_new:N \l__flowfram_found_bool
1974 \tl_new:N \g__flowfram_next_tl
1975 % \end{macrocode}
1976 %
1977 % \begin{macrocode}
1978 \dim_new:N \l__flowfram_x_dim
1979 \dim_new:N \l__flowfram_evenx_dim
1980 \dim_new:N \l__flowfram_y_dim
1981 \dim_new:N \l__flowfram_eveny_dim
1982 \dim_new:N \l__flowfram_width_dim
1983 \dim_new:N \l__flowfram_height_dim
1984 \dim_new:N \l__flowfram_offset_dim
1985 % \end{macrocode}
1986 %
1987 % \begin{macrocode}
1988 \tl_new:N \l__flowfram_remainder_tl
1989 \tl_new:N \l__flowfram_pages_tl
1990 \tl_new:N \l__flowfram_next_pages_tl
1991 \tl_new:N \l__flowfram_exclude_pages_tl
1992 \clist_new:N \l__flowfram_pages_clist
1993 \clist_new:N \l__flowfram_even_pages_clist
1994 \clist_new:N \l__flowfram_odd_pages_clist
1995 \clist_new:N \l__flowfram_exclude_pages_clist
1996 \tl_new:N \l__flowfram_label_tl
1997 \tl_new:N \l__flowfram_frametype_tl
1998 \tl_new:N \l__flowfram_style_tl
1999 \tl_new:N \l__flowfram_parindent_tl
2000 \tl_new:N \l__flowfram_shape_tl
2001 \tl_new:N \l__flowfram_valign_tl
2002 \tl_new:N \l__flowfram_minipage_tl
2003 \tl_new:N \l__flowfram_contents_tl
2004 % \end{macrocode}
2005 %Empty if not set:
2006 % \begin{macrocode}
2007 \tl_new:N \l__flowfram_width_tl
2008 \tl_new:N \l__flowfram_height_tl
2009 \tl_new:N \l__flowfram_x_tl
2010 \tl_new:N \l__flowfram_y_tl
2011 \tl_new:N \l__flowfram_evenx_tl
2012 \tl_new:N \l__flowfram_eveny_tl
2013 \tl_new:N \l__flowfram_oddx_tl
2014 \tl_new:N \l__flowfram_oddy_tl
2015 \tl_new:N \l__flowfram_offset_tl
2016 \tl_new:N \l__flowfram_angle_tl
2017 \tl_new:N \l__flowfram_margin_tl
2018 % \end{macrocode}
2019 %Empty if not set otherwise "true" or "false":
2020 % \begin{macrocode}
2021 \tl_new:N \l__flowfram_frameflag_tl
2022 \tl_new:N \l__flowfram_clearflag_tl
2023 \tl_new:N \l__flowfram_hideflag_tl
2024 \tl_new:N \l__flowfram_hidethisflag_tl
2025 % \end{macrocode}
2026 %
2027 %\begin{macro}{\sdfparindent}
2028 % Define a length to govern default paragraph indentation within
2029 % static and dynamic frames.
2030 % This is initially 0pt.
2031 % \begin{macrocode}
2032 \newlength\sdfparindent
2033 % \end{macrocode}
2034 %\end{macro}
2035 %
2036 %Utility command. Iterate over frame IDs in the list but the list
2037 %may just be the keywords "all", "odd" or "even" or may contain
2038 %ranges. The id can be referenced in \meta{code} with
2039 %"\l__flowfram_id_int".
2040 %Syntax \marg{clist}\marg{type}\marg{code}
2041 % \begin{macrocode}
2042 \cs_new:Nn \__flowfram_map_idns:nnn
2043 {
2044 \tl_if_eq:NnTF \c_flowfram_all_tl { #1 }
2045 {
2046 \int_step_inline:nn { \value { max #2 } }
2047 {
2048 \int_set:Nn \l__flowfram_id_int { ##1 }
2049 #3
2050 }
2051 }
2052 {
2053 \tl_if_eq:NnTF \c_flowfram_odd_tl { #1 }
2054 {
2055 \int_step_inline:nnn { \c_one_int } { 2 } { \value { max #2 } }
2056 {
2057 \int_set:Nn \l__flowfram_id_int { ##1 }
2058 #3
2059 }
2060 }
2061 {
2062 \tl_if_eq:NnTF \c_flowfram_even_tl { #1 }
2063 {
2064 \int_step_inline:nnn { 2 } { 2 } { \value { max #2 } }
2065 {
2066 \int_set:Nn \l__flowfram_id_int { ##1 }
2067 #3
2068 }
2069 }
2070 {
2071 \clist_map_inline:nn { #1 }
2072 {
2073 \__flowfram_get_range:n { ##1 }
2074 \int_compare:nNnT { \l__flowfram_range_start_int } < { \c_one_int }
2075 {
2076 \int_set_eq:NN \l__flowfram_range_start_int \c_one_int
2077 }
2078 \int_compare:nNnT
2079 { \l__flowfram_range_end_int } > { \value { max #2 } }
2080 {
2081 \int_set_eq:Nc \l__flowfram_range_end_int { c@max #2}
2082 }
2083 \int_compare:nNnTF
2084 { \l__flowfram_range_start_int } < { \l__flowfram_range_end_int }
2085 {
2086 \int_step_inline:nNnTF
2087 { \l__flowfram_range_start_int }
2088 { \l__flowfram_range_end_int }
2089 {
2090 \int_set:Nn \l__flowfram_id_int { ##1 }
2091 #3
2092 }
2093 }
2094 {
2095 \int_set_eq:NN
2096 \l__flowfram_id_int
2097 \l__flowfram_range_start_int
2098 #3
2099 }
2100 }
2101 }
2102 }
2103 }
2104 }
2105 \cs_generate_variant:Nn \__flowfram_map_idns:nnn { enn }
2106 % \end{macrocode}
2107 %
2108 %\subsection{Frame Attributes}
2109 %Convenient commands to define frames and set and access frame attributes.
2110 %
2111 %Determine the frame type from its label. The integer variable
2112 %provided will be set to one of the constants if valid otherwise
2113 %trigger an error and set to -1.
2114 % \begin{macrocode}
2115 \cs_new:Nn \__flowfram_get_frame_type:Nn
2116 {
2117 \int_if_exist:cTF { c_flowfram_frame_type_ #2 _int }
2118 {
2119 \int_set_eq:Nc #1 { c_flowfram_frame_type_ #2 _int }
2120 }
2121 {
2122 \int_set:Nn #1 { - \c_one_int }
2123 \msg_error:nnn { flowfram } { invalid-frame-type } { #2 }
2124 }
2125 }
2126 \cs_new:Nn \__flowfram_get_frame_type:n
2127 {
2128 \__flowfram_get_frame_type:Nn
2129 \l__flowfram_type_int
2130 { #1 }
2131 }
2132 % \end{macrocode}
2133 %
2134 %Store a list of all flow frame labels:
2135 % \begin{macrocode}
2136 \seq_new:N \g__flowfram_flowlabels_seq
2137 % \end{macrocode}
2138 %
2139 %Store a list of all static frame labels:
2140 % \begin{macrocode}
2141 \seq_new:N \g__flowfram_staticlabels_seq
2142 % \end{macrocode}
2143 %
2144 %Store a list of all dynamic frame labels:
2145 % \begin{macrocode}
2146 \seq_new:N \g__flowfram_dynamiclabels_seq
2147 % \end{macrocode}
2148 %
2149 % Set up the keys for use with "\setflowframe",
2150 % "\setstaticframe" and "\setdynamicframe".
2151 % Version 2.0: switched to l3keys.
2152 %
2153 % \begin{macrocode}
2154 \keys_define:nn { flowfram / frame }
2155 {
2156 % \end{macrocode}
2157 % Frame width. (Dimensions are temporarily stored in a token list
2158 % variable which is initialised to empty to determine whether or not
2159 % the dimension has been updated.)
2160 % \begin{macrocode}
2161 width .tl_set:N = \l__flowfram_width_tl ,
2162 width .groups:n = { flow , static , dynamic } ,
2163 % \end{macrocode}
2164 % Frame height.
2165 % \begin{macrocode}
2166 height .tl_set:N = \l__flowfram_height_tl ,
2167 height .groups:n = { flow , static , dynamic } ,
2168 % \end{macrocode}
2169 % Frame $x$ co-ordinate (odd and even pages):
2170 % \begin{macrocode}
2171 x .tl_set:N = \l__flowfram_x_tl ,
2172 x .groups:n = { flow , static , dynamic } ,
2173 % \end{macrocode}
2174 % Frame $y$ co-ordinate (odd and even pages):
2175 % \begin{macrocode}
2176 y .tl_set:N = \l__flowfram_y_tl ,
2177 y .groups:n = { flow , static , dynamic } ,
2178 % \end{macrocode}
2179 % Frame $x$ co-ordinate (even pages only):
2180 % \begin{macrocode}
2181 evenx .tl_set:N = \l__flowfram_evenx_tl ,
2182 evenx .groups:n = { flow , static , dynamic } ,
2183 % \end{macrocode}
2184 % Frame $y$ co-ordinate (even pages only):
2185 % \begin{macrocode}
2186 eveny .tl_set:N = \l__flowfram_eveny_tl ,
2187 eveny .groups:n = { flow , static , dynamic } ,
2188 % \end{macrocode}
2189 % Frame $x$ co-ordinate (odd pages only if twoside implemented):
2190 % \begin{macrocode}
2191 oddx .tl_set:N = \l__flowfram_oddx_tl ,
2192 oddx .groups:n = { flow , static , dynamic } ,
2193 % \end{macrocode}
2194 % Frame $y$ co-ordinate (odd pages only if twoside implemented):
2195 % \begin{macrocode}
2196 oddy .tl_set:N = \l__flowfram_oddy_tl ,
2197 oddy .groups:n = { flow , static , dynamic } ,
2198 % \end{macrocode}
2199 % New \gls{idl} for \gls{frame}:
2200 % \begin{macrocode}
2201 label .tl_set_e:N = \l__flowfram_label_tl ,
2202 label .groups:n = { flow , static , dynamic } ,
2203 % \end{macrocode}
2204 % Frame border. If "none", define "\l__flowfram_frameflag_tl" as "false",
2205 % otherwise define "\l__flowfram_frameflag_tl" as "true". If "plain", define
2206 % "\l__flowfram_frametype_tl" as "fbox", otherwise define it to be
2207 % the specified type, which should be the name of a
2208 % \gls{fcmd} without the preceding backslash.
2209 % \begin{macrocode}
2210 border .choice: ,
2211 border .default:n = { plain } ,
2212 border / plain .code:n =
2213 {
2214 \tl_set:Nn \l__flowfram_frameflag_tl { true }
2215 \tl_set:Nn \l__flowfram_frametype_tl { fbox }
2216 } ,
2217 border / none .code:n =
2218 {
2219 \tl_set:Nn \l__flowfram_frameflag_tl { false }
2220 } ,
2221 border / unknown .code:n =
2222 {
2223 \tl_set:Nn \l__flowfram_frameflag_tl { true }
2224 \tl_set:Ne \l__flowfram_frametype_tl { #1 }
2225 } ,
2226 border .groups:n = { flow , static , dynamic } ,
2227 % \end{macrocode}
2228 % Frame's border colour. (This may not work for non-standard
2229 % \glspl{fcmd}.)
2230 % \begin{macrocode}
2231 bordercolor .tl_set_e:N = \l__flowfram_bordercolor_tl ,
2232 bordercolour .tl_set_e:N = \l__flowfram_bordercolor_tl ,
2233 border-color .tl_set_e:N = \l__flowfram_bordercolor_tl ,
2234 border-colour .tl_set_e:N = \l__flowfram_bordercolor_tl ,
2235 bordercolor .groups:n = { flow , static , dynamic } ,
2236 bordercolour .groups:n = { flow , static , dynamic } ,
2237 border-color .groups:n = { flow , static , dynamic } ,
2238 border-colour .groups:n = { flow , static , dynamic } ,
2239 % \end{macrocode}
2240 % Frame's text colour.
2241 % \begin{macrocode}
2242 textcolor .tl_set_e:N = \l__flowfram_textcolor_tl ,
2243 textcolour .tl_set_e:N = \l__flowfram_textcolor_tl ,
2244 text-color .tl_set_e:N = \l__flowfram_textcolor_tl ,
2245 text-colour .tl_set_e:N = \l__flowfram_textcolor_tl ,
2246 textcolor .groups:n = { flow , static , dynamic } ,
2247 textcolour .groups:n = { flow , static , dynamic } ,
2248 text-color .groups:n = { flow , static , dynamic } ,
2249 text-colour .groups:n = { flow , static , dynamic } ,
2250 % \end{macrocode}
2251 % The background colour of the \gls{frame}. Note this only covers
2252 % the region of the \gls{bbox}, not any extra space between
2253 % the \gls{bbox} and the border. If you want the background
2254 % colour to go right up to the border, you will need to
2255 % define your own customised border.
2256 % \begin{macrocode}
2257 backcolor .tl_set_e:N = \l__flowfram_backcolor_tl ,
2258 backcolour .tl_set_e:N = \l__flowfram_backcolor_tl ,
2259 back-color .tl_set_e:N = \l__flowfram_backcolor_tl ,
2260 back-colour .tl_set_e:N = \l__flowfram_backcolor_tl ,
2261 backcolor .groups:n = { flow , static , dynamic } ,
2262 backcolour .groups:n = { flow , static , dynamic } ,
2263 back-color .groups:n = { flow , static , dynamic } ,
2264 back-colour .groups:n = { flow , static , dynamic } ,
2265 % \end{macrocode}
2266 % \Gls{pglist} for which the \gls{frame} should appear:
2267 % \begin{macrocode}
2268 pages .tl_set_e:N = \l__flowfram_pages_tl ,
2269 pages .groups:n = { flow , static , dynamic } ,
2270 % \end{macrocode}
2271 % Exclusion list:
2272 % \begin{macrocode}
2273 excludepages .tl_set_e:N = \l__flowfram_exclude_pages_tl ,
2274 excludepages .groups:n = { flow , static , dynamic } ,
2275 % \end{macrocode}
2276 % The border takes up extra space, which needs to be
2277 % adjusted. This can be done for standard border types,
2278 % but non-standard borders may require some help.
2279 %%Value may be "compute" or a length.
2280 % \begin{macrocode}
2281 offset .tl_set:N = \l__flowfram_offset_tl ,
2282 offset .groups:n = { flow , static , dynamic } ,
2283 % \end{macrocode}
2284 % Angle to rotate frame (if allowed):
2285 % \begin{macrocode}
2286 angle .code:n =
2287 {
2288 \bool_if:NTF \l__flowfram_allow_frame_rotation_bool
2289 {
2290 \tl_set:Ne \l__flowfram_angle_tl { #1 }
2291 }
2292 {
2293 \tl_if_eq:enF { #1 } { 0 }
2294 {
2295 \msg_info:nn { flowfram } { info-no-rotation }
2296 }
2297 }
2298 } ,
2299 angle .groups:n = { flow , static , angle } ,
2300 % \end{macrocode}
2301 % This key is only for \glspl{flow}:
2302 % \begin{macrocode}
2303 margin .choice: ,
2304 margin / inner .code:n =
2305 { \tl_set:Nn \l__flowfram_margin_tl { inner } } ,
2306 margin / outer .code:n =
2307 { \tl_set:Nn \l__flowfram_margin_tl { outer } } ,
2308 margin / left .code:n =
2309 { \tl_set:Nn \l__flowfram_margin_tl { left } } ,
2310 margin / right .code:n =
2311 { \tl_set:Nn \l__flowfram_margin_tl { right } } ,
2312 margin .groups:n = { flow } ,
2313 % \end{macrocode}
2314 % This key is only for \gls{static} and \glspl{dynamic}.
2315 % (Not using a boolean as the token list is initially clear to
2316 % indicate no change.)
2317 % \begin{macrocode}
2318 clear .choice: ,
2319 clear / true .code:n =
2320 {
2321 \tl_set:Nn \l__flowfram_clearflag_tl { true }
2322 } ,
2323 clear / false .code:n =
2324 {
2325 \tl_set:Nn \l__flowfram_clearflag_tl { false }
2326 } ,
2327 clear .default:n = { true } ,
2328 clear .groups:n = { static, dynamic } ,
2329 % \end{macrocode}
2330 % This key is only for \glspl{dynamic}:
2331 % \begin{macrocode}
2332 style .choice: ,
2333 style / none .code:n =
2334 {
2335 \tl_set:Nn \l__flowfram_style_tl { @firstofone }
2336 } ,
2337 style / unknown .code:n =
2338 {
2339 \tl_set:Ne \l__flowfram_style_tl { #1 }
2340 } ,
2341 style .groups:n = { dynamic } ,
2342 % \end{macrocode}
2343 % This key is only for \glspl{static} and \glspl{dynamic}.
2344 % \begin{macrocode}
2345 shape .tl_set:N = \l__flowfram_shape_tl ,
2346 shape .groups:n = { static, dynamic } ,
2347 % \end{macrocode}
2348 % This key is only for \glspl{static} and \glspl{dynamic}.
2349 % \begin{macrocode}
2350 parindent .tl_set:N = \l__flowfram_parindent_tl ,
2351 parindent .groups:n = { static, dynamic } ,
2352 % \end{macrocode}
2353 % These keys are only for \glspl{static} and \glspl{dynamic}.
2354 % \begin{macrocode}
2355 valign .choice: ,
2356 valign / c .code:n =
2357 { \tl_set:Nn \l__flowfram_valign_tl { c } } ,
2358 valign / t .code:n =
2359 { \tl_set:Nn \l__flowfram_valign_tl { t } } ,
2360 valign / b .code:n =
2361 { \tl_set:Nn \l__flowfram_valign_tl { b } } ,
2362 valign .groups:n = { static, dynamic } ,
2363 % \end{macrocode}
2364 %\changes{2014-06-04}{1.16}{added `hide' and `hidethis' keys}
2365 %(Not using a boolean as token list variables initially clear to
2366 %indicate no change.)
2367 % \begin{macrocode}
2368 hide .choice: ,
2369 hide / true .code:n =
2370 { \tl_set:Nn \l__flowfram_hideflag_tl { true } } ,
2371 hide / false .code:n =
2372 { \tl_set:Nn \l__flowfram_hideflag_tl { false } } ,
2373 hide .default:n = { true } ,
2374 hide .groups:n = { static, dynamic } ,
2375 hidethis .choice: ,
2376 hidethis / true .code:n =
2377 { \tl_set:Ne \l__flowfram_hidethisflag_tl { true } } ,
2378 hidethis / false .code:n =
2379 { \tl_set:Ne \l__flowfram_hidethisflag_tl { false } } ,
2380 hidethis .default:n = { true } ,
2381 hidethis .groups:n = { static, dynamic } ,
2382 % \end{macrocode}
2383 %The following is reserved for \LaTeX\ to HTML parsers.
2384 %With \TeX\ engines, they just write information to the aux file.
2385 %The value should be the options to pass to the parser.
2386 %Suggested options: show=\meta{bool} (if true, put the frame contents in a
2387 %div element at this point), style=\marg{css-style} (if set, add
2388 %the style attribute to the div element), class=\marg{css-class}
2389 %(if set, add the class attribute to the div element),
2390 %image=\marg{bool} (if true, convert the frame contents to an
2391 %image), image-type=\marg{mime type} (if image=true, the image
2392 %should be this type).
2393 % \begin{macrocode}
2394 html .tl_set:N = \l__flowfram_html_tl ,
2395 html .groups:n = { static, dynamic } ,
2396 }
2397 % \end{macrocode}
2398 %
2399 %Syntax \marg{options}\marg{type}\marg{idn}
2400 % \begin{macrocode}
2401 \cs_new:Nn \__flowfram_set_keys_for_type:nnn
2402 {
2403 \tl_clear:N \l__flowfram_frameflag_tl
2404 \tl_clear:N \l__flowfram_width_tl
2405 \tl_clear:N \l__flowfram_height_tl
2406 \tl_clear:N \l__flowfram_margin_tl
2407 \tl_clear:N \l__flowfram_x_tl
2408 \tl_clear:N \l__flowfram_y_tl
2409 \tl_clear:N \l__flowfram_frametype_tl
2410 \tl_clear:N \l__flowfram_bordercolor_tl
2411 \tl_clear:N \l__flowfram_valign_tl
2412 \tl_clear:N \l__flowfram_style_tl
2413 \tl_clear:N \l__flowfram_hideflag_tl
2414 \tl_clear:N \l__flowfram_hidethisflag_tl
2415 \tl_clear:N \l__flowfram_textcolor_tl
2416 \tl_clear:N \l__flowfram_clearflag_tl
2417 \tl_clear:N \l__flowfram_offset_tl
2418 \tl_clear:N \l__flowfram_pages_tl
2419 \tl_clear:N \l__flowfram_label_tl
2420 \tl_clear:N \l__flowfram_backcolor_tl
2421 \tl_clear:N \l__flowfram_evenx_tl
2422 \tl_clear:N \l__flowfram_eveny_tl
2423 \tl_clear:N \l__flowfram_oddx_tl
2424 \tl_clear:N \l__flowfram_oddy_tl
2425 \tl_clear:N \l__flowfram_angle_tl
2426 \tl_set_eq:NN \l__flowfram_exclude_pages_tl \c_novalue_tl
2427 \tl_set_eq:NN \l__flowfram_shape_tl \c_novalue_tl
2428 \tl_set_eq:NN \l__flowfram_parindent_tl \c_novalue_tl
2429 \tl_clear:N \l__flowfram_html_tl
2430 \keys_set_groups:nnnN { flowfram / frame } { #2 } { #1 }
2431 \l__flowfram_remainder_tl
2432 \tl_if_empty:NF \l__flowfram_remainder_tl
2433 {
2434 \__flowfram_error:eee
2435 { frame-unsupported-options }
2436 { #2 } { \l__flowfram_remainder_tl }
2437 }
2438 % \end{macrocode}
2439 %Set common options.
2440 % \begin{macrocode}
2441 \tl_if_empty:NF \l__flowfram_frameflag_tl
2442 {
2443 \flowfram_frame_set_bool_from_option:nnnV
2444 { #2 } { hasframe } { #3 }
2445 \l__flowfram_frameflag_tl
2446 }
2447 \tl_if_empty:NF \l__flowfram_width_tl
2448 {
2449 \flowfram_frame_set_dim:nnnn { #2 } { width } { #3 }
2450 { \l__flowfram_width_tl }
2451 }
2452 \tl_if_empty:NF \l__flowfram_height_tl
2453 {
2454 \flowfram_frame_set_dim:nnnn { #2 } { height } { #3 }
2455 { \l__flowfram_height_tl }
2456 }
2457 \tl_if_empty:NF \l__flowfram_x_tl
2458 {
2459 \flowfram_frame_set_dim:nnnn { #2 } { posx } { #3 }
2460 { \l__flowfram_x_tl }
2461 \flowfram_frame_set_dim:nnnn { #2 } { evenx } { #3 }
2462 { \l__flowfram_x_tl }
2463 }
2464 \tl_if_empty:NF \l__flowfram_y_tl
2465 {
2466 \flowfram_frame_set_dim:nnnn { #2 } { posy } { #3 }
2467 { \l__flowfram_y_tl }
2468 \flowfram_frame_set_dim:nnnn { #2 } { eveny } { #3 }
2469 { \l__flowfram_y_tl }
2470 }
2471 \tl_if_empty:NF \l__flowfram_evenx_tl
2472 {
2473 \flowfram_frame_set_dim:nnnn { #2 } { evenx } { #3 }
2474 { \l__flowfram_evenx_tl }
2475 }
2476 \tl_if_empty:NF \l__flowfram_eveny_tl
2477 {
2478 \flowfram_frame_set_dim:nnnn { #2 } { eveny } { #3 }
2479 { \l__flowfram_eveny_tl }
2480 }
2481 \tl_if_empty:NF \l__flowfram_oddx_tl
2482 {
2483 \flowfram_frame_set_dim:nnnn { #2 } { posx } { #3 }
2484 { \l__flowfram_oddx_tl }
2485 }
2486 \tl_if_empty:NF \l__flowfram_oddy_tl
2487 {
2488 \flowfram_frame_set_dim:nnnn { #2 } { posy } { #3 }
2489 { \l__flowfram_oddy_tl }
2490 }
2491 \tl_if_empty:NF \l__flowfram_label_tl
2492 {
2493 \__flowfram_set_frame_id:nnV { #2 } { #3 } \l__flowfram_label_tl
2494 }
2495 \tl_if_empty:NF \l__flowfram_frametype_tl
2496 {
2497 \flowfram_frame_set_tl:nnnV
2498 { #2 } { frametype } { #3 }
2499 \l__flowfram_frametype_tl
2500 }
2501 \tl_if_empty:NF \l__flowfram_bordercolor_tl
2502 {
2503 \exp_after:wN \__flowfram_set_frame_color:w
2504 \l__flowfram_bordercolor_tl
2505 \q_stop { #2 } { bordercolor } { #3 }
2506 }
2507 \tl_if_empty:NF \l__flowfram_textcolor_tl
2508 {
2509 \exp_after:wN \__flowfram_set_frame_color:w
2510 \l__flowfram_textcolor_tl
2511 \q_stop { #2 } { textcolor } { #3 }
2512 }
2513 \tl_if_empty:NF \l__flowfram_backcolor_tl
2514 {
2515 \exp_after:wN \__flowfram_set_frame_color:w
2516 \l__flowfram_backcolor_tl
2517 \q_stop { #2 } { backcolor } { #3 }
2518 }
2519 \tl_if_empty:NF \l__flowfram_pages_tl
2520 {
2521 \flowfram_set_frame_pagelist:nnV
2522 { #2 } { #3 } \l__flowfram_pages_tl
2523 }
2524 \exp_args:NV \tl_if_novalue:nF \l__flowfram_exclude_pages_tl
2525 {
2526 \flowfram_set_frame_excludelist:nnV
2527 { #2 } { #3 } \l__flowfram_exclude_pages_tl
2528 }
2529 \tl_if_empty:NF \l__flowfram_offset_tl
2530 {
2531 \flowfram_frame_set_tl:nnnV
2532 { #2 } { offset } { #3 }
2533 \l__flowfram_offset_tl
2534 }
2535 \tl_if_empty:NF \l__flowfram_angle_tl
2536 {
2537 \flowfram_frame_set_tl:nnnV
2538 { #2 } { angle } { #3 }
2539 \l__flowfram_angle_tl
2540 }
2541 \tl_if_empty:NF \l__flowfram_html_tl
2542 {
2543 \dim_zero:N \l__flowfram_sfdf_width_dim
2544 \dim_zero:N \l__flowfram_sfdf_height_dim
2545 \flowfram_set_dim_to_frame_dim:Nnnn
2546 \l__flowfram_sfdf_width_dim
2547 { #2 } { width } { #3 }
2548 \flowfram_set_dim_to_frame_dim:Nnnn
2549 \l__flowfram_sfdf_height_dim
2550 { #2 } { height } { #3 }
2551 \tl_put_left:Ne \l__flowfram_html_tl
2552 {
2553 width = \dim_eval:n { \l__flowfram_sfdf_width_dim } ,
2554 height = \dim_eval:n { \l__flowfram_sfdf_height_dim } ,
2555 }
2556 \exp_args:NV \__flowfram_write_html_opts:nnn
2557 \l__flowfram_html_tl { #2 } { \int_eval:n { #3 } }
2558 }
2559 }
2560 % \end{macrocode}
2561 %For the benefit of \LaTeX\ to HTML parsers.
2562 % \begin{macrocode}
2563 \int_new:N \g__flowfram_html_opts_int
2564 % \end{macrocode}
2565 %Each option set has a unique numeric identifier to help match up
2566 %the information in the aux file with the setting in the \LaTeX\
2567 %document. The following starts by using the preamble command but
2568 %will be changed in the begin document hook to use the document
2569 %command.
2570 % \begin{macrocode}
2571 \cs_new:Nn \__flowfram_write_html_opts:nnn
2572 {
2573 \__flowfram_preamble_write_html_opts:nnn { #1 } { #2 } { #3 }
2574 }
2575 % \end{macrocode}
2576 %The command used in the preamble:
2577 % \begin{macrocode}
2578 \cs_new:Nn \__flowfram_preamble_write_html_opts:nnn
2579 {
2580 \int_gincr:N \g__flowfram_html_opts_int
2581 \protected@write \@auxout
2582 { \let \theabsolutepage \relax }
2583 {
2584 \string \flowfram@preamble@htmlopts
2585 { \int_use:N \g__flowfram_html_opts_int }
2586 { #2 } { #3 } { #1 }
2587 { \thepage }
2588 { \theabsolutepage }
2589 }
2590 }
2591 % \end{macrocode}
2592 %The command used in the document:
2593 % \begin{macrocode}
2594 \cs_new:Nn \__flowfram_doc_write_html_opts:nnn
2595 {
2596 \int_gincr:N \g__flowfram_html_opts_int
2597 \protected@write \@auxout
2598 { \let \theabsolutepage \relax }
2599 {
2600 \string \flowfram@doc@htmlopts
2601 { \int_use:N \g__flowfram_html_opts_int }
2602 { #2 } { #3 } { #1 }
2603 { \thepage }
2604 { \theabsolutepage }
2605 }
2606 }
2607 % \end{macrocode}
2608 %
2609 %\begin{macro}{\flowfram@preamble@htmlopts}
2610 %\changes{2.0}{2025-11-24}{new}
2611 %Syntax:
2612 %\marg{opt-id}\marg{frame-type}\marg{idn}\marg{options}\marg{page}\marg{absolute-page}
2613 % \begin{macrocode}
2614 \newcommand*\flowfram@preamble@htmlopts[6]{}
2615 % \end{macrocode}
2616 %\end{macro}
2617 %
2618 %\begin{macro}{\flowfram@doc@htmlopts}
2619 %\changes{2.0}{2025-11-24}{new}
2620 %Syntax:
2621 %\marg{opt-id}\marg{frame-type}\marg{idn}\marg{options}\marg{page}\marg{absolute-page}
2622 % \begin{macrocode}
2623 \newcommand*\flowfram@doc@htmlopts[6]{}
2624 % \end{macrocode}
2625 %\end{macro}
2626 %
2627 %\begin{macro}{\@setframecol}
2628 %\changes{2.0}{2025-11-24}{renamed}
2629 % Set the colour of the frame, this is a little tricky
2630 % because the model may need to be specified in square
2631 % brackets but the specs might not be grouped
2632 % (e.g. "[rgb]1,0,0" vs "[named]red" vs "red").
2633 % First check to see if a colour model has been
2634 % specified.
2635 %Version 2.0 renamed \cs{@setframecol}
2636 %\oarg{model}\marg{specs}\verb"\q_stop"
2637 %\marg{type}\marg{attr}\marg{idn}
2638 % \begin{macrocode}
2639 \cs_new:Npn \__flowfram_set_frame_color:w
2640 {
2641 \@ifnextchar [
2642 \__flowfram_set_frame_color:wnnnn
2643 \__flowfram_set_frame_color:wnnn
2644 }
2645 % \end{macrocode}
2646 %\end{macro}
2647 %\begin{macro}{\@@setframecol}
2648 % A colour model has been specified.
2649 %Version 2.0 renamed \cs{@@setframecol}.
2650 % \begin{macrocode}
2651 \cs_new:Npn \__flowfram_set_frame_color:wnnnn
2652 [ #1 ] #2 \q_stop #3 #4 #5
2653 {
2654 \flowfram_frame_set_tl:nnne
2655 { #3 } { #4 } { #5 }
2656 { [ #1 ] { #2 } }
2657 }
2658 % \end{macrocode}
2659 %\end{macro}
2660 %\begin{macro}{\@@setfr@mecol}
2661 % A colour model has not been specified.
2662 % Version 2.0 renamed \cs{@@setfr@mecol}.
2663 % \begin{macrocode}
2664 \cs_new:Npn \__flowfram_set_frame_color:wnnn
2665 #1 \q_stop #2 #3 #4
2666 {
2667 \flowfram_frame_set_tl:nnne
2668 { #2 } { #3 } { #4 }
2669 { { #1 } }
2670 }
2671 % \end{macrocode}
2672 %\end{macro}
2673 %
2674 %Syntax:
2675 %\marg{page list}\marg{width}\marg{height}\marg{x}\marg{y}\marg{label}\marg{type}
2676 % \begin{macrocode}
2677 \cs_new_nopar:Nn \__flowfram_new_frame:nnnnnnn
2678 {
2679 \int_gincr:c { c@max #7 }
2680 % \end{macrocode}
2681 %Set common attributes.
2682 % \begin{macrocode}
2683 \flowfram_frame_new_bool:nnnN
2684 { #7 } { hasframe } { \int_use:c { c@max #7 } } \c_false_bool
2685 % \end{macrocode}
2686 %Dimension checks are only required for flow frames. Static or
2687 %dynamic frames may simply be decorative.
2688 % \begin{macrocode}
2689 \tl_if_eq:NnTF \c_flowfram_flow_tl { #7 }
2690 {
2691 % \end{macrocode}
2692 %\changes{2.1}{2026-02-23}{add dimension check}
2693 %Sanity check on width. If all defined flow frames accidentally have the width
2694 %set to zero it can trigger an infinite number of pages.
2695 % \begin{macrocode}
2696 \dim_compare:nNnTF { #2 } > { \c_zero_dim }
2697 {
2698 \flowfram_frame_new_dim:nnnn
2699 { #7 } { width } { \int_use:c { c@max #7 } } { #2 }
2700 }
2701 {
2702 \__flowfram_error:eeee { invalid-width }
2703 { \dim_eval:n { #2 } } { #7 } { \token_to_str:N \typeblockwidth }
2704 \flowfram_frame_new_dim:nnnn
2705 { #7 } { width } { \int_use:c { c@max #7 } } { \typeblockwidth }
2706 }
2707 \dim_compare:nNnTF { #3 } > { \c_zero_dim }
2708 {
2709 \flowfram_frame_new_dim:nnnn
2710 { #7 } { height } { \int_use:c { c@max #7 } } { #3 }
2711 }
2712 {
2713 \__flowfram_error:eeee { invalid-height }
2714 { \dim_eval:n { #3 } } { #7 } { \token_to_str:N \typeblockheight }
2715 \flowfram_frame_new_dim:nnnn
2716 { #7 } { height } { \int_use:c { c@max #7 } } { \typeblockheight }
2717 }
2718 }
2719 {
2720 \flowfram_frame_new_dim:nnnn
2721 { #7 } { width } { \int_use:c { c@max #7 } } { #2 }
2722 \flowfram_frame_new_dim:nnnn
2723 { #7 } { height } { \int_use:c { c@max #7 } } { #3 }
2724 }
2725 \flowfram_frame_new_dim:nnnn
2726 { #7 } { posx } { \int_use:c { c@max #7 } } { #4 }
2727 \flowfram_frame_new_dim:nnnn
2728 { #7 } { posy } { \int_use:c { c@max #7 } } { #5 }
2729 \flowfram_frame_new_dim:nnnn
2730 { #7 } { evenx } { \int_use:c { c@max #7 } } { #4 }
2731 \flowfram_frame_new_dim:nnnn
2732 { #7 } { eveny } { \int_use:c { c@max #7 } } { #5 }
2733 \flowfram_frame_new_tl:nnnn
2734 { #7 } { frametype } { \int_use:c { c@max #7 } } { fbox }
2735 \flowfram_frame_new_tl:nnnn
2736 { #7 } { bordercolor } { \int_use:c { c@max #7 } } { \flowframecol }
2737 \flowfram_frame_new_tl:nnnn
2738 { #7 } { textcolor } { \int_use:c { c@max #7 } } { \flowframetextcol }
2739 \flowfram_frame_new_tl:nnnn
2740 { #7 } { backcolor } { \int_use:c { c@max #7 } } { { none } }
2741 \flowfram_frame_new_tl:nnnn
2742 { #7 } { angle } { \int_use:c { c@max #7 } } { 0 }
2743 \clist_set:Ne \l__flowfram_pages_clist { #1 }
2744 \exp_args:NV
2745 \flowfram_if_valid_pagelist:nTF \l__flowfram_pages_clist
2746 {
2747 \flowfram_frame_new_clist:nnnV
2748 { #7 } { pagelist } { \int_use:c { c@max #7 } }
2749 \l__flowfram_pages_clist
2750 }
2751 {
2752 \msg_error:nnn { flowfram } { invalid-pagelist } { #1 }
2753 \flowfram_frame_new_clist:nnnn
2754 { #7 } { pagelist } { \int_use:c { c@max #7 } } { all }
2755 }
2756 % \end{macrocode}
2757 % Page exclusion list:
2758 %\changes{1.14}{2012-11-10}{added page exclusion list}
2759 % \begin{macrocode}
2760 \flowfram_frame_new_clist:nnnn
2761 { #7 } { excludelist } { \int_use:c { c@max #7 } } { }
2762 \flowfram_frame_new_tl:nnnn
2763 { #7 } { offset } { \int_use:c { c@max #7 } } { compute }
2764 \__flowfram_set_frame_id:nnn { #7 } { \int_use:c { c@max #7 } } { #6 }
2765 }
2766 % \end{macrocode}
2767 %Set the frame's label.
2768 %\marg{type}\marg{idn}\marg{label}
2769 % \begin{macrocode}
2770 \cs_new:Nn \__flowfram_set_frame_id:nnn
2771 {
2772 \tl_set:Ne \l__flowfram_label_tl { #3 }
2773 \int_compare:nNnTF
2774 { #2 } > { \seq_count:c { g__flowfram_ #1 labels_seq } }
2775 {
2776 % \end{macrocode}
2777 %This is a label for a new frame.
2778 % \begin{macrocode}
2779 \exp_args:NnV
2780 \__flowfram_checkunique_frame_idl:nnF { #1 } \l__flowfram_label_tl
2781 {
2782 % \end{macrocode}
2783 %Not unique so fallback on IDN (which isn't guaranteed to be unique
2784 %if another frame has confusingly been given a numeric label).
2785 % \begin{macrocode}
2786 \tl_set:Ne \l__flowfram_label_tl { \int_eval:n { #2 } }
2787 }
2788 \seq_gput_right:cV { g__flowfram_ #1 labels_seq } \l__flowfram_label_tl
2789 \flowfram_frame_new_tl:nnnV
2790 { #1 } { label } { #2 }
2791 \l__flowfram_label_tl
2792 }
2793 {
2794 % \end{macrocode}
2795 %This is a label for an existing flow frame.
2796 %Temporarily set the corresponding sequence item to empty before
2797 %checking uniqueness.
2798 % \begin{macrocode}
2799 \seq_set_item:cnn { g__flowfram_ #1 labels_seq } { #2 } { }
2800 \exp_args:NnV
2801 \__flowfram_checkunique_frame_idl:nnF { #1 } \l__flowfram_label_tl
2802 {
2803 \tl_set:Ne \l__flowfram_label_tl { \int_eval:n { #2 } }
2804 }
2805 \exp_args:NcnV
2806 \seq_gset_item:Nnn
2807 { g__flowfram_ #1 labels_seq }
2808 { #2 }
2809 \l__flowfram_label_tl
2810 \flowfram_frame_set_tl:nnnV
2811 { #1 } { label } { #2 }
2812 \l__flowfram_label_tl
2813 }
2814 }
2815 \cs_generate_variant:Nn \__flowfram_set_frame_id:nnn { nne , nnV }
2816 % \end{macrocode}
2817 %
2818 %Check if label is unique for given frame type.
2819 %Syntax \marg{type}\marg{label}
2820 % \begin{macrocode}
2821 \prg_new_conditional:Nnn \__flowfram_checkunique_frame_idl:nn
2822 { T, F, TF }
2823 {
2824 \seq_if_in:cnTF { g__flowfram_ #1 labels_seq } { #2 }
2825 {
2826 % \end{macrocode}
2827 % Label already exists.
2828 % Find the index number to help with the error message.
2829 % \begin{macrocode}
2830 \exp_args:Nc
2831 \seq_map_indexed_inline:Nn
2832 { g__flowfram_ #1 labels_seq }
2833 {
2834 \tl_if_eq:nnT { ##2 } { #2 }
2835 {
2836 \msg_error:nnnnn { flowfram } { label-defined }
2837 { #2 } { #1 } { ##1 }
2838 \seq_map_break:
2839 }
2840 }
2841 \prg_return_false:
2842 }
2843 { \prg_return_true: }
2844 }
2845 % \end{macrocode}
2846 %
2847 %Test if label exists for given type of frame.
2848 %Syntax \marg{type}\marg{label}\meta{int-var}
2849 %If true, the corresponding IDN is stored in the \meta{int-vat}
2850 % \begin{macrocode}
2851 \prg_new_conditional:Nnn \__flowfram_if_frame_label_exists:nnN
2852 { TF , T , F }
2853 {
2854 \int_zero:N #3
2855 \exp_args:Nc \seq_map_indexed_inline:Nn
2856 { g__flowfram_ #1 labels_seq }
2857 {
2858 \tl_if_eq:neT { ##2 } { #2 }
2859 {
2860 \int_set:Nn #3 { ##1 }
2861 \seq_map_break:
2862 }
2863 }
2864 \int_if_zero:nTF { #3 }
2865 { \prg_return_false: }
2866 { \prg_return_true: }
2867 }
2868 % \end{macrocode}
2869 %
2870 %The simplest way of determining if a frame identified by its number has been defined is to
2871 %test if the label attribute is set.
2872 %Syntax \marg{frame-type}{idn}
2873 % \begin{macrocode}
2874 \prg_new_conditional:Nnn \__flowfram_if_frame_idn_exists:nn
2875 { p , T , F, TF }
2876 {
2877 \tl_if_exist:cTF
2878 { g__flowfram_ #1 _ label _ \romannumeral #2 _ tl }
2879 { \prg_return_true: }
2880 { \prg_return_false: }
2881 }
2882 % \end{macrocode}
2883 %
2884 %\begin{macro}{\@getframeid}
2885 % \cs{@getframeid}\marg{type}\marg{idl}
2886 %
2887 % Gets the \gls{idl} for the frame of type \meta{type} whose \gls{idl}
2888 % is given by \meta{idl}. The \gls{idn} is stored in "\l__flowfram_id_int".
2889 % Version 2.0 renamed \cs{@getframeid}.
2890 %\changes{2.0}{2025-11-24}{renamed}
2891 % \begin{macrocode}
2892 \cs_new:Nn \__flowfram_get_frame_id:nn
2893 {
2894 \__flowfram_if_frame_label_exists:nnNF
2895 { #1 } { #2 } \l__flowfram_id_int
2896 {
2897 \__flowfram_error:eee { label-undefined } { #2 } { #1 }
2898 }
2899 }
2900 \cs_generate_variant:Nn \__flowfram_get_frame_id:nn { ne, nV }
2901 % \end{macrocode}
2902 %\end{macro}
2903 %
2904 %Frame attributes.
2905 % \begin{macrocode}
2906 \prop_new:N \g__flowfram_flow_attributes_prop
2907 \prop_new:N \g__flowfram_static_attributes_prop
2908 \prop_new:N \g__flowfram_dynamic_attributes_prop
2909 % \end{macrocode}
2910 %
2911 %Show flow frame attributes:
2912 % \begin{macrocode}
2913 \cs_new:Nn \flowfram_show_flow_frame_by_idl:n
2914 {
2915 \__flowfram_if_flow_label_exists:nTF { #1 }
2916 {
2917 \__flowfram_show_flow_frame:
2918 }
2919 {
2920 \__flowfram_error:eee { label-undefined } { #1 } { flow }
2921 }
2922 }
2923 \cs_new:Nn \flowfram_show_flow_frame_by_idn:n
2924 {
2925 \int_set:Nn \l__flowfram_id_int { #1 }
2926 \tl_if_exist:cTF
2927 { g__flowfram_flow_label_ \romannumeral \l__flowfram_id_int _ tl }
2928 {
2929 \__flowfram_show_flow_frame:
2930 }
2931 {
2932 \msg_error:nnee { flowfram } { idn-undefined }
2933 { flow } { \int_use:N \l__flowfram_id_int }
2934 }
2935 }
2936 % \end{macrocode}
2937 %
2938 %Show all flow frames:
2939 % \begin{macrocode}
2940 \cs_new:Nn \flowfram_show_all_flow_frames:
2941 {
2942 \int_if_zero:nTF { \c@maxflow }
2943 {
2944 \msg_show:nnne { flowfram } { show-all-frames-none }
2945 { flow }
2946 }
2947 {
2948 \msg_show:nnne { flowfram } { show-all-frames }
2949 { flow }
2950 {
2951 \exp_args:NV \msg_show_item_unbraced:n
2952 \c@maxflow
2953 }
2954 \int_step_inline:nn { \c@maxflow }
2955 {
2956 \int_set:Nn \l__flowfram_id_int { ##1 }
2957 \__flowfram_show_flow_frame:
2958 }
2959 }
2960 }
2961 % \end{macrocode}
2962 %
2963 % \begin{macrocode}
2964 \cs_new:Nn \__flowfram_show_flow_frame:
2965 {
2966 \msg_show:nneee { flowfram } { show-frame-attributes }
2967 { flow } { \int_use:N \l__flowfram_id_int }
2968 {
2969 \prop_map_function:NN
2970 \g__flowfram_flow_attributes_prop
2971 \__flowfram_show_flow_attribute:nn
2972 }
2973 }
2974 \cs_new:Nn \__flowfram_show_flow_attribute:nn
2975 {
2976 \exp_args:Ne \msg_show_item_unbraced:n
2977 {
2978 \__flowfram_show_attribute:nnnn
2979 { flow } { #1 } { \l__flowfram_id_int } { #2 }
2980 }
2981 }
2982 % \end{macrocode}
2983 %
2984 %Show static frame attributes:
2985 % \begin{macrocode}
2986 \cs_new:Nn \flowfram_show_static_frame_by_idl:n
2987 {
2988 \__flowfram_if_static_label_exists:nTF { #1 }
2989 {
2990 \__flowfram_show_static_frame:
2991 }
2992 {
2993 \__flowfram_error:eee { label-undefined } { #1 } { static }
2994 }
2995 }
2996 \cs_new:Nn \flowfram_show_static_frame_by_idn:n
2997 {
2998 \int_set:Nn \l__flowfram_id_int { #1 }
2999 \tl_if_exist:cTF
3000 { g__flowfram_static_label_ \romannumeral \l__flowfram_id_int _ tl }
3001 {
3002 \__flowfram_show_static_frame:
3003 }
3004 {
3005 \msg_error:nnee { flowfram } { idn-undefined }
3006 { static } { \int_use:N \l__flowfram_id_int }
3007 }
3008 }
3009 % \end{macrocode}
3010 %
3011 %Show all static frames:
3012 % \begin{macrocode}
3013 \cs_new:Nn \flowfram_show_all_static_frames:
3014 {
3015 \int_if_zero:nTF { \c@maxstatic }
3016 {
3017 \msg_show:nnne { flowfram } { show-all-frames-none }
3018 { static }
3019 }
3020 {
3021 \msg_show:nnne { flowfram } { show-all-frames }
3022 { static }
3023 {
3024 \exp_args:NV \msg_show_item_unbraced:n
3025 \c@maxstatic
3026 }
3027 \int_step_inline:nn { \c@maxstatic }
3028 {
3029 \int_set:Nn \l__flowfram_id_int { ##1 }
3030 \__flowfram_show_static_frame:
3031 }
3032 }
3033 }
3034 % \end{macrocode}
3035 %
3036 % \begin{macrocode}
3037 \cs_new:Nn \__flowfram_show_static_frame:
3038 {
3039 \msg_show:nneee { flowfram } { show-frame-attributes }
3040 { static } { \int_use:N \l__flowfram_id_int }
3041 {
3042 \prop_map_function:NN
3043 \g__flowfram_static_attributes_prop
3044 \__flowfram_show_static_attribute:nn
3045 }
3046 }
3047 \cs_new:Nn \__flowfram_show_static_attribute:nn
3048 {
3049 \exp_args:Ne \msg_show_item_unbraced:n
3050 {
3051 \__flowfram_show_attribute:nnnn
3052 { static } { #1 } { \l__flowfram_id_int } { #2 }
3053 }
3054 }
3055 % \end{macrocode}
3056 %
3057 %Show dynamic frame attributes:
3058 % \begin{macrocode}
3059 \cs_new:Nn \flowfram_show_dynamic_frame_by_idl:n
3060 {
3061 \__flowfram_if_dynamic_label_exists:nTF { #1 }
3062 {
3063 \__flowfram_show_dynamic_frame:
3064 }
3065 {
3066 \__flowfram_error:eee { label-undefined } { #1 } { dynamic }
3067 }
3068 }
3069 \cs_new:Nn \flowfram_show_dynamic_frame_by_idn:n
3070 {
3071 \int_set:Nn \l__flowfram_id_int { #1 }
3072 \tl_if_exist:cTF
3073 { g__flowfram_dynamic_label_ \romannumeral \l__flowfram_id_int _ tl }
3074 {
3075 \__flowfram_show_dynamic_frame:
3076 }
3077 {
3078 \msg_error:nnee { flowfram } { idn-undefined }
3079 { dynamic } { \int_use:N \l__flowfram_id_int }
3080 }
3081 }
3082 % \end{macrocode}
3083 %Show all dynamic frames:
3084 % \begin{macrocode}
3085 \cs_new:Nn \flowfram_show_all_dynamic_frames:
3086 {
3087 \int_if_zero:nTF { \c@maxdynamic }
3088 {
3089 \msg_show:nnne { flowfram } { show-all-frames-none }
3090 { dynamic }
3091 }
3092 {
3093 \msg_show:nnne { flowfram } { show-all-frames }
3094 { dynamic }
3095 {
3096 \exp_args:NV \msg_show_item_unbraced:n
3097 \c@maxdynamic
3098 }
3099 \int_step_inline:nn { \c@maxdynamic }
3100 {
3101 \int_set:Nn \l__flowfram_id_int { ##1 }
3102 \__flowfram_show_dynamic_frame:
3103 }
3104 }
3105 }
3106 % \end{macrocode}
3107 %
3108 % \begin{macrocode}
3109 \cs_new:Nn \__flowfram_show_dynamic_frame:
3110 {
3111 \msg_show:nneee { flowfram } { show-frame-attributes }
3112 { dynamic } { \int_use:N \l__flowfram_id_int }
3113 {
3114 \prop_map_function:NN
3115 \g__flowfram_dynamic_attributes_prop
3116 \__flowfram_show_dynamic_attribute:nn
3117 }
3118 }
3119 \cs_new:Nn \__flowfram_show_dynamic_attribute:nn
3120 {
3121 \exp_args:Ne \msg_show_item_unbraced:n
3122 {
3123 \__flowfram_show_attribute:nnnn
3124 { dynamic } { #1 } { \l__flowfram_id_int } { #2 }
3125 }
3126 }
3127 % \end{macrocode}
3128 %
3129 % \begin{macrocode}
3130 \cs_new:Nn \__flowfram_show_bool_attribute:nnn
3131 {
3132 \bool_if:cTF
3133 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ bool }
3134 { true }
3135 { false }
3136 }
3137 \cs_new:Nn \__flowfram_show_box_attribute:nnn
3138 {
3139 \box_if_empty:cTF
3140 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ box }
3141 { empty }
3142 { not ~ empty }
3143 }
3144 \cs_new:Nn \__flowfram_show_attribute:nnnn
3145 {
3146 #2 ~ ( #4 ) : ~
3147 \cs_if_exist:cTF { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ #4 }
3148 {
3149 \cs_if_exist:cTF { __flowfram_show_ #4 _attribute:nnn }
3150 {
3151 \use:c { __flowfram_show_ #4 _attribute:nnn }
3152 { #1 } { #2 } { #3 }
3153 }
3154 {
3155 \use:c { #4 _use:c }
3156 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ #4 }
3157 }
3158 }
3159 { undefined }
3160 }
3161 % \end{macrocode}
3162 %
3163 %\meta{prop-var}\marg{tag}\marg{var type}
3164 % \begin{macrocode}
3165 \cs_new:Nn \__flowfram_add_frame_attribute:Nnn
3166 {
3167 \prop_get:NnNTF #1 { #2 } \l__flowfram_tmpa_tl
3168 {
3169 \tl_if_eq:NnF \l__flowfram_tmpa_tl { #3 }
3170 {
3171 \msg_error:nneee { flowfram } {attribute-type-change}
3172 { #2 } { \l__flowfram_tmpa_tl } { #3 }
3173 }
3174 }
3175 {
3176 \prop_gput:Nnn #1 { #2 } { #3 }
3177 }
3178 }
3179 \cs_generate_variant:Nn \__flowfram_add_frame_attribute:Nnn { cen }
3180 % \end{macrocode}
3181 %
3182 %Syntax: \marg{frame type}\marg{tag}\marg{idn}
3183 % \begin{macrocode}
3184 \cs_new:Nn \flowfram_frame_new_dim:nnn
3185 {
3186 \prop_if_exist:cTF
3187 { g__flowfram_ #1 _attributes_prop }
3188 {
3189 \dim_new:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ dim }
3190 \__flowfram_add_frame_attribute:cen
3191 { g__flowfram_ #1 _attributes_prop }
3192 { #2 } { dim }
3193 }
3194 {
3195 \msg_error:nne { flowfram } {invalid-frame-type} { #1 }
3196 }
3197 }
3198 % \end{macrocode}
3199 %
3200 %Syntax: \marg{frame type}\marg{tag}\marg{idn}\marg{value}
3201 % \begin{macrocode}
3202 \cs_new:Nn \flowfram_frame_new_dim:nnnn
3203 {
3204 \prop_if_exist:cTF
3205 { g__flowfram_ #1 _attributes_prop }
3206 {
3207 \dim_new:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ dim }
3208 \dim_gset:cn
3209 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ dim }
3210 { #4 }
3211 \__flowfram_add_frame_attribute:cen
3212 { g__flowfram_ #1 _attributes_prop }
3213 { #2 } { dim }
3214 }
3215 {
3216 \msg_error:nne { flowfram } {invalid-frame-type} { #1 }
3217 }
3218 }
3219 % \end{macrocode}
3220 %
3221 % \begin{macrocode}
3222 \cs_new:Nn \flowfram_frame_use_dim:nnn
3223 {
3224 \dim_use:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ dim }
3225 }
3226 % \end{macrocode}
3227 %
3228 %Syntax: \marg{frame type}\marg{tag}\marg{idn}\marg{value}
3229 % \begin{macrocode}
3230 \cs_new:Nn \flowfram_frame_set_dim:nnnn
3231 {
3232 \dim_if_exist:cTF
3233 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ dim }
3234 {
3235 \dim_gset:cn
3236 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ dim }
3237 { #4 }
3238 }
3239 {
3240 \__flowfram_error:eeeee { frame-unknown-tag }
3241 { #1 } { #2 } { \int_eval:n { #3 } } { dim }
3242 }
3243 }
3244 % \end{macrocode}
3245 %
3246 %Syntax: \meta{dim}\marg{frame type}\marg{tag}\marg{idn}
3247 % \begin{macrocode}
3248 \cs_new:Nn \flowfram_set_dim_to_frame_dim:Nnnn
3249 {
3250 \dim_if_exist:cTF
3251 { g__flowfram_ #2 _ #3 _ \romannumeral #4 _ dim }
3252 {
3253 \dim_set_eq:Nc
3254 #1
3255 { g__flowfram_ #2 _ #3 _ \romannumeral #4 _ dim }
3256 }
3257 {
3258 \__flowfram_error:eeeee { frame-unknown-tag }
3259 { #2 } { #3 } { \int_eval:n { #4 } } { dim }
3260 }
3261 }
3262 % \end{macrocode}
3263 %
3264 %Syntax: \meta{dim}\marg{frame type}\marg{tag}\marg{idn}
3265 % \begin{macrocode}
3266 \cs_new:Nn \flowfram_gset_dim_to_frame_dim:Nnnn
3267 {
3268 \dim_if_exist:cTF
3269 { g__flowfram_ #2 _ #3 _ \romannumeral #4 _ dim }
3270 {
3271 \dim_gset_eq:Nc
3272 #1
3273 { g__flowfram_ #2 _ #3 _ \romannumeral #4 _ dim }
3274 }
3275 {
3276 \__flowfram_error:eeeee { frame-unknown-tag }
3277 { #2 } { #3 } { \int_eval:n { #4 } } { dim }
3278 }
3279 }
3280 % \end{macrocode}
3281 %
3282 %Syntax: \meta{dim}\marg{frame type}\marg{tag}\marg{idn}
3283 % \begin{macrocode}
3284 \cs_new:Nn \flowfram_set_dim_to_frame_tl:Nnnn
3285 {
3286 \dim_if_exist:cTF
3287 { g__flowfram_ #2 _ #3 _ \romannumeral #4 _ tl }
3288 {
3289 \dim_set:Nn
3290 #1
3291 { \tl_use:c { g__flowfram_ #2 _ #3 _ \romannumeral #4 _ tl } }
3292 }
3293 {
3294 \__flowfram_error:eeeee { frame-unknown-tag }
3295 { #2 } { #3 } { \int_eval:n { #4 } } { tl }
3296 }
3297 }
3298 % \end{macrocode}
3299 %
3300 %Syntax: \marg{frame type}\marg{tag1}\marg{tag2}\marg{idn}
3301 % \begin{macrocode}
3302 \cs_new:Nn \flowfram_frame_swap_dim:nnnn
3303 {
3304 \dim_set_eq:Nc \l__flowfram_tmpa_dim
3305 { g__flowfram_ #1 _ #2 _ \romannumeral #4 _ dim }
3306 \dim_gset_eq:cc
3307 { g__flowfram_ #1 _ #2 _ \romannumeral #4 _ dim }
3308 { g__flowfram_ #1 _ #3 _ \romannumeral #4 _ dim }
3309 \dim_gset_eq:cN
3310 { g__flowfram_ #1 _ #3 _ \romannumeral #4 _ dim }
3311 \l__flowfram_tmpa_dim
3312 }
3313 % \end{macrocode}
3314 %
3315 %Syntax: \marg{frame type}\marg{tag}\marg{idn}
3316 % \begin{macrocode}
3317 \cs_new:Nn \flowfram_frame_new_box:nnn
3318 {
3319 \prop_if_exist:cTF
3320 { g__flowfram_ #1 _attributes_prop }
3321 {
3322 \box_new:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ box }
3323 \__flowfram_add_frame_attribute:cen
3324 { g__flowfram_ #1 _attributes_prop }
3325 { #2 } { box }
3326 }
3327 {
3328 \msg_error:nne { flowfram } {invalid-frame-type} { #1 }
3329 }
3330 }
3331 % \end{macrocode}
3332 %
3333 % \begin{macrocode}
3334 \cs_new:Nn \flowfram_frame_set_box_eq:nnnN
3335 {
3336 \tl_if_exist:cTF
3337 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ box }
3338 {
3339 \box_gset_eq:cN
3340 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ box }
3341 #4
3342 }
3343 {
3344 \__flowfram_error:eeeee { frame-unknown-tag }
3345 { #1 } { #2 } { \int_eval:n { #3 } } { box }
3346 }
3347 }
3348 % \end{macrocode}
3349 %
3350 % \begin{macrocode}
3351 \cs_new:Nn \flowfram_frame_clear_box:nnn
3352 {
3353 \tl_if_exist:cTF
3354 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ box }
3355 {
3356 \box_gclear:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ box }
3357 }
3358 {
3359 \__flowfram_error:eeeee { frame-unknown-tag }
3360 { #1 } { #2 } { \int_eval:n { #3 } } { box }
3361 }
3362 }
3363 % \end{macrocode}
3364 %
3365 % \begin{macrocode}
3366 \cs_new:Nn \flowfram_frame_use_box:nnn
3367 {
3368 \tl_if_exist:cTF
3369 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ box }
3370 {
3371 \leavevmode
3372 \box_use:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ box }
3373 }
3374 {
3375 \__flowfram_error:eeeee { frame-unknown-tag }
3376 { #1 } { #2 } { \int_eval:n { #3 } } { box }
3377 }
3378 }
3379 % \end{macrocode}
3380 %
3381 % \begin{macrocode}
3382 \cs_new:Nn \flowfram_frame_use_drop_box:nnn
3383 {
3384 \tl_if_exist:cTF
3385 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ box }
3386 {
3387 \box_use_drop:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ box }
3388 }
3389 {
3390 \__flowfram_error:eeeee { frame-unknown-tag }
3391 { #1 } { #2 } { \int_eval:n { #3 } } { box }
3392 }
3393 }
3394 % \end{macrocode}
3395 %
3396 % \begin{macrocode}
3397 \prg_new_conditional:Nnn \flowfram_frame_if_box_empty:nnn
3398 { T, F, TF }
3399 {
3400 \exp_args:Nc \if_box_empty:N
3401 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ box }
3402 \prg_return_true:
3403 \else:
3404 \prg_return_false:
3405 \fi:
3406 }
3407 % \end{macrocode}
3408 %
3409 %Syntax: \marg{frame type}\marg{tag}\marg{idn}
3410 % \begin{macrocode}
3411 \cs_new:Nn \flowfram_frame_new_tl:nnn
3412 {
3413 \prop_if_exist:cTF
3414 { g__flowfram_ #1 _attributes_prop }
3415 {
3416 \tl_new:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3417 \__flowfram_add_frame_attribute:cen
3418 { g__flowfram_ #1 _attributes_prop }
3419 { #2 } { tl }
3420 }
3421 {
3422 \msg_error:nne { flowfram } {invalid-frame-type} { #1 }
3423 }
3424 }
3425 % \end{macrocode}
3426 %
3427 %Syntax: \marg{frame type}\marg{tag}\marg{idn}\marg{value}
3428 % \begin{macrocode}
3429 \cs_new:Nn \flowfram_frame_new_tl:nnnn
3430 {
3431 \prop_if_exist:cTF
3432 { g__flowfram_ #1 _attributes_prop }
3433 {
3434 \tl_new:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3435 \tl_gset:cn
3436 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3437 { #4 }
3438 \__flowfram_add_frame_attribute:cen
3439 { g__flowfram_ #1 _attributes_prop }
3440 { #2 } { tl }
3441 }
3442 {
3443 \msg_error:nne { flowfram } {invalid-frame-type} { #1 }
3444 }
3445 }
3446 \cs_generate_variant:Nn \flowfram_frame_new_tl:nnnn
3447 { nnnn , nnnV , nnne }
3448 % \end{macrocode}
3449 %
3450 % \begin{macrocode}
3451 \cs_new:Nn \flowfram_frame_use_tl:nnn
3452 {
3453 \tl_use:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3454 }
3455 % \end{macrocode}
3456 %
3457 %Syntax: \marg{frame type}\marg{tag}\marg{idn}\marg{value}
3458 % \begin{macrocode}
3459 \cs_new:Nn \flowfram_frame_set_tl:nnnn
3460 {
3461 \tl_if_exist:cTF
3462 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3463 {
3464 \__flowfram_message:nnnen
3465 { info-setting-frame-attribute }
3466 { #2 } { #1 } { \int_eval:n { #3 } } { #4 }
3467 \tl_gset:cn
3468 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3469 { #4 }
3470 }
3471 {
3472 \__flowfram_error:eeeee{ frame-unknown-tag }
3473 { #1 } { #2 } { \int_eval:n { #3 } } { tl }
3474 }
3475 }
3476 \cs_generate_variant:Nn \flowfram_frame_set_tl:nnnn { nnne , nnnV }
3477 % \end{macrocode}
3478 %
3479 %Syntax: \marg{frame type}\marg{tag}\marg{idn}
3480 % \begin{macrocode}
3481 \cs_new:Nn \flowfram_frame_clear_tl:nnn
3482 {
3483 \tl_if_exist:cTF
3484 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3485 {
3486 \__flowfram_message:nnnen
3487 { info-setting-frame-attribute }
3488 { #2 } { #1 } { \int_eval:n { #3 } } { }
3489 \tl_gclear:c
3490 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3491 }
3492 {
3493 \__flowfram_error:eeeee { frame-unknown-tag }
3494 { #1 } { #2 } { \int_eval:n { #3 } } { tl }
3495 }
3496 }
3497 % \end{macrocode}
3498 %
3499 %Syntax: \marg{frame type}\marg{tag}\marg{idn}\marg{value}
3500 % \begin{macrocode}
3501 \cs_new:Nn \flowfram_frame_put_right_tl:nnnn
3502 {
3503 \tl_if_exist:cTF
3504 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3505 {
3506 \tl_gput_right:cn
3507 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3508 { #4 }
3509 \__flowfram_message:nnnev
3510 { info-setting-frame-attribute }
3511 { #2 } { #1 } { \int_eval:n { #3 } }
3512 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3513 }
3514 {
3515 \__flowfram_error:eeeee { frame-unknown-tag }
3516 { #1 } { #2 } { \int_eval:n { #3 } } { tl }
3517 }
3518 }
3519 \cs_generate_variant:Nn \flowfram_frame_put_right_tl:nnnn { nnne , nnnV }
3520 % \end{macrocode}
3521 %
3522 %Syntax: \meta{tl}\marg{frame type}\marg{tag}\marg{idn}
3523 % \begin{macrocode}
3524 \cs_new:Nn \flowfram_set_tl_to_frame_tl:Nnnn
3525 {
3526 \tl_if_exist:cTF
3527 { g__flowfram_ #2 _ #3 _ \romannumeral #4 _ tl }
3528 {
3529 \tl_set_eq:Nc
3530 #1
3531 { g__flowfram_ #2 _ #3 _ \romannumeral #4 _ tl }
3532 }
3533 {
3534 \__flowfram_error:eeeee { frame-unknown-tag }
3535 { #2 } { #3 } { \int_eval:n { #4 } } { tl }
3536 }
3537 }
3538 % \end{macrocode}
3539 %
3540 %Syntax: \marg{frame type}\marg{tag}\marg{idn}\meta{tl}
3541 % \begin{macrocode}
3542 \cs_new:Nn \flowfram_set_frame_tl_to_tl:Nnnn
3543 {
3544 \tl_if_exist:cTF
3545 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3546 {
3547 \__flowfram_message:nnneV
3548 { info-setting-frame-attribute }
3549 { #2 } { #1 } { \int_eval:n { #3 } } #4
3550 \tl_gset_eq:cN
3551 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3552 #4
3553 }
3554 {
3555 \__flowfram_error:eeeee { frame-unknown-tag }
3556 { #2 } { #3 } { \int_eval:n { #4 } } { tl }
3557 }
3558 }
3559 % \end{macrocode}
3560 %
3561 % \begin{macrocode}
3562 \prg_new_conditional:Nnn \flowfram_if_tl_eq_frame_tl:Nnnn
3563 { T, F, TF }
3564 {
3565 \tl_if_eq:NcTF
3566 #1
3567 { g__flowfram_ #2 _ #3 _ \romannumeral #4 _ tl }
3568 { \prg_return_true: }
3569 { \prg_return_false: }
3570 }
3571 % \end{macrocode}
3572 %
3573 % \begin{macrocode}
3574 \prg_new_conditional:Nnn \flowfram_if_tl_eq_frame_tl:nnnn
3575 { T, F, TF }
3576 {
3577 \tl_if_eq:cnTF
3578 { g__flowfram_ #2 _ #3 _ \romannumeral #4 _ tl }
3579 { #1 }
3580 { \prg_return_true: }
3581 { \prg_return_false: }
3582 }
3583 % \end{macrocode}
3584 %
3585 % \begin{macrocode}
3586 \prg_new_conditional:Nnn \flowfram_if_frame_tl_exist:nnn
3587 { T, F, TF }
3588 {
3589 \tl_if_exist:cTF
3590 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3591 { \prg_return_true: }
3592 { \prg_return_false: }
3593 }
3594 % \end{macrocode}
3595 %
3596 % \begin{macrocode}
3597 \prg_new_conditional:Nnn \flowfram_if_frame_tl_empty:nnn
3598 { T, F, TF }
3599 {
3600 \tl_if_empty:cTF
3601 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ tl }
3602 { \prg_return_true: }
3603 { \prg_return_false: }
3604 }
3605 % \end{macrocode}
3606 %
3607 %Syntax: \marg{frame type}\marg{tag}\marg{idn}\marg{value}
3608 % \begin{macrocode}
3609 \cs_new:Nn \flowfram_frame_new_clist:nnnn
3610 {
3611 \prop_if_exist:cTF
3612 { g__flowfram_ #1 _attributes_prop }
3613 {
3614 \clist_new:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ clist }
3615 \clist_gset:cn
3616 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ clist }
3617 { #4 }
3618 \__flowfram_add_frame_attribute:cen
3619 { g__flowfram_ #1 _attributes_prop }
3620 { #2 } { clist }
3621 }
3622 {
3623 \msg_error:nne { flowfram } {invalid-frame-type} { #1 }
3624 }
3625 }
3626 \cs_generate_variant:Nn \flowfram_frame_new_clist:nnnn
3627 { nnne , nnnV }
3628 % \end{macrocode}
3629 %
3630 % \begin{macrocode}
3631 \cs_new:Nn \flowfram_frame_use_clist:nnn
3632 {
3633 \clist_use:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ clist }
3634 }
3635 % \end{macrocode}
3636 %
3637 %Syntax: \marg{frame type}\marg{tag}\marg{idn}\marg{value}
3638 % \begin{macrocode}
3639 \cs_new:Nn \flowfram_frame_set_clist:nnnn
3640 {
3641 \clist_if_exist:cTF
3642 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ clist }
3643 {
3644 \__flowfram_message:nnnen
3645 { info-setting-frame-attribute }
3646 { #2 } { #1 } { \int_eval:n { #3 } } { #4 }
3647 \clist_gset:cn
3648 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ clist }
3649 { #4 }
3650 }
3651 {
3652 \__flowfram_error:eeeee { frame-unknown-tag }
3653 { #1 } { #2 } { \int_eval:n { #3 } } { clist }
3654 }
3655 }
3656 \cs_generate_variant:Nn \flowfram_frame_set_clist:nnnn { nnne , nnnV }
3657 % \end{macrocode}
3658 %
3659 %Syntax: \marg{frame type}\marg{tag}\marg{idn}\marg{value}
3660 % \begin{macrocode}
3661 \cs_new:Nn \flowfram_frame_put_right_clist:nnnn
3662 {
3663 \clist_if_exist:cTF
3664 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ clist }
3665 {
3666 \clist_gput_right:cn
3667 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ clist }
3668 { #4 }
3669 \__flowfram_message:nnnev
3670 { info-setting-frame-attribute }
3671 { #2 } { #1 } { \int_eval:n { #3 } }
3672 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ clist }
3673 }
3674 {
3675 \__flowfram_error:eeeee { frame-unknown-tag }
3676 { #1 } { #2 } { \int_eval:n { #3 } } { clist }
3677 }
3678 }
3679 \cs_generate_variant:Nn \flowfram_frame_put_right_clist:nnnn { nnne , nnnV }
3680 % \end{macrocode}
3681 %
3682 %Syntax: \marg{frame type}\marg{tag}\marg{idn}\marg{clist var}
3683 % \begin{macrocode}
3684 \cs_new:Nn \flowfram_frame_concat_clist:nnnN
3685 {
3686 \clist_if_exist:cTF
3687 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ clist }
3688 {
3689 \exp_args:Ncc
3690 \clist_gconcat:NNN
3691 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ clist }
3692 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ clist }
3693 #4
3694 \__flowfram_message:nnnev
3695 { info-setting-frame-attribute }
3696 { #2 } { #1 } { \int_eval:n { #3 } }
3697 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ clist }
3698 }
3699 {
3700 \__flowfram_error:eeeee { frame-unknown-tag }
3701 { #1 } { #2 } { \int_eval:n { #3 } } { clist }
3702 }
3703 }
3704 \cs_generate_variant:Nn \flowfram_frame_concat_clist:nnnN { nnnc }
3705 % \end{macrocode}
3706 %
3707 %Syntax: \meta{clist}\marg{frame type}\marg{tag}\marg{idn}
3708 % \begin{macrocode}
3709 \cs_new:Nn \flowfram_set_clist_to_frame_clist:Nnnn
3710 {
3711 \clist_if_exist:cTF
3712 { g__flowfram_ #2 _ #3 _ \romannumeral #4 _ clist }
3713 {
3714 \clist_set_eq:Nc
3715 #1
3716 { g__flowfram_ #2 _ #3 _ \romannumeral #4 _ clist }
3717 }
3718 {
3719 \__flowfram_error:eeeee { frame-unknown-tag }
3720 { #2 } { #3 } { \int_eval:n { #4 } } { clist }
3721 }
3722 }
3723 % \end{macrocode}
3724 %
3725 % \begin{macrocode}
3726 \prg_new_conditional:Nnn \flowfram_if_tl_eq_frame_clist:Nnnn
3727 { T, F, TF }
3728 {
3729 \tl_if_eq:cNTF
3730 { g__flowfram_ #2 _ #3 _ \romannumeral #4 _ clist }
3731 #1
3732 { \prg_return_true: }
3733 { \prg_return_false: }
3734 }
3735 % \end{macrocode}
3736 %
3737 %Syntax: \marg{frame type}\marg{tag}\marg{idn}\marg{code}
3738 % \begin{macrocode}
3739 \cs_new:Nn \flowfram_frame_clist_map_inline:nnnn
3740 {
3741 \clist_if_exist:cTF
3742 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ clist }
3743 {
3744 \clist_map_inline:cn
3745 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ clist }
3746 { #4 }
3747 }
3748 {
3749 \__flowfram_error:eeeee { frame-unknown-tag }
3750 { #1 } { #2 } { \int_eval:n { #3 } } { clist }
3751 }
3752 }
3753 % \end{macrocode}
3754 %
3755 % \begin{macrocode}
3756 \prg_new_conditional:Nnn \flowfram_if_in_frame_clist:nnnn
3757 { T, F, TF }
3758 {
3759 \clist_if_in:cnTF
3760 { g__flowfram_ #2 _ #3 _ \romannumeral #4 _ clist }
3761 { #1 }
3762 { \prg_return_true: }
3763 { \prg_return_false: }
3764 }
3765 % \end{macrocode}
3766 %
3767 %\marg{page num}\marg{frame type}\marg{idn}
3768 % \begin{macrocode}
3769 \prg_new_conditional:Nnn \flowfram_if_frame_excludedpage:nnn
3770 { T, F, TF}
3771 {
3772 \flowfram_if_in_frame_clist:nnnnTF
3773 { #1 } { #2 } { excludelist } { #3 }
3774 { \prg_return_true: }
3775 { \prg_return_false: }
3776 }
3777 % \end{macrocode}
3778 %
3779 %Syntax: \marg{page num}\marg{frame type}\marg{idn}
3780 %Check if given page is in the page list for a frame.
3781 % \begin{macrocode}
3782 \prg_new_conditional:Nnn \flowfram_if_in_frame_pagelist:nnn
3783 { T, F, TF}
3784 {
3785 \flowfram_if_frame_allpages:nnTF { #2 } { #3 }
3786 { \prg_return_true: }
3787 {
3788 \flowfram_if_frame_nopages:nnTF { #2 } { #3 }
3789 { \prg_return_false: }
3790 {
3791 \flowfram_if_frame_oddpages_only:nnTF { #2 } { #3 }
3792 {
3793 \int_if_odd:nTF { #1 }
3794 { \prg_return_true: }
3795 { \prg_return_false: }
3796 }
3797 {
3798 \flowfram_if_frame_evenpages_only:nnTF { #2 } { #3 }
3799 {
3800 \int_if_even:nTF { #1 }
3801 { \prg_return_true: }
3802 { \prg_return_false: }
3803 }
3804 {
3805 \flowfram_if_in_frame_clist:nnnnTF
3806 { #1 } { #2 } { pagelist } { #3 }
3807 { \prg_return_true: }
3808 {
3809 \bool_set_false:N \l__flowfram_found_bool
3810 \flowfram_frame_clist_map_inline:nnnn
3811 { #2 } { pagelist } { #3 }
3812 {
3813 \flowfram_if_in_pagerange:nnT { #1 } { ##1 }
3814 {
3815 \clist_map_break:n
3816 {
3817 \bool_set_true:N \l__flowfram_found_bool
3818 }
3819 }
3820 }
3821 \bool_if:NTF \l__flowfram_found_bool
3822 { \prg_return_true: }
3823 { \prg_return_false: }
3824 }
3825 }
3826 }
3827 }
3828 }
3829 }
3830 % \end{macrocode}
3831 %
3832 %\marg{num}\marg{range}
3833 % \begin{macrocode}
3834 \prg_new_conditional:Nnn \flowfram_if_in_pagerange:nn
3835 { T, F, TF }
3836 {
3837 \__flowfram_get_range:n { #2 }
3838 \bool_lazy_or:nnTF
3839 {
3840 \int_compare_p:nNn { #1 } < { \l__flowfram_range_start_int }
3841 }
3842 {
3843 \int_compare_p:nNn { #1 } > { \l__flowfram_range_end_int }
3844 }
3845 { \prg_return_false: }
3846 { \prg_return_true: }
3847 }
3848 % \end{macrocode}
3849 %
3850 %Syntax: \marg{page num}\marg{frame type}\marg{idn}
3851 %Check if there is at least one more page in the page list after the
3852 %given number.
3853 % \begin{macrocode}
3854 \prg_new_conditional:Nnn \flowfram_if_frame_has_morepages:nnn
3855 { T, F, TF}
3856 {
3857 \flowfram_if_frame_allpages:nnTF { #2 } { #3 }
3858 { \prg_return_true: }
3859 {
3860 \flowfram_if_frame_nopages:nnTF { #2 } { #3 }
3861 { \prg_return_false: }
3862 {
3863 \flowfram_if_frame_oddpages_only:nnTF { #2 } { #3 }
3864 { \prg_return_true: }
3865 {
3866 \flowfram_if_frame_evenpages_only:nnTF { #2 } { #3 }
3867 { \prg_return_true: }
3868 {
3869 % \end{macrocode}
3870 %Get the last range in the page list.
3871 % \begin{macrocode}
3872 \exp_args:Ne
3873 \__flowfram_get_range:n
3874 {
3875 \clist_item:cn
3876 { g__flowfram_ #2 _ pagelist _ \romannumeral #3 _ clist }
3877 {
3878 \clist_count:c
3879 { g__flowfram_ #2 _ pagelist _ \romannumeral #3 _ clist }
3880 }
3881 }
3882 \int_compare:nNnTF
3883 { \l__flowfram_range_end_int } > { #1 }
3884 { \prg_return_true: }
3885 { \prg_return_false: }
3886 }
3887 }
3888 }
3889 }
3890 }
3891 % \end{macrocode}
3892 %
3893 %\meta{int-var}\marg{type}\marg{idn}
3894 %Gets the starting page and stores in \meta{int-var}.
3895 % \begin{macrocode}
3896 \cs_new:Nn \flowfram_frame_get_start_page:Nnn
3897 {
3898 \flowfram_if_frame_allpages:nnTF { #2 } { #3 }
3899 {
3900 \int_set_eq:NN #1 \c_one_int
3901 }
3902 {
3903 \flowfram_if_frame_nopages:nnTF { #2 } { #3 }
3904 {
3905 \int_set:Nn #1
3906 { \c_flowfram_max_page_int + \c_one_int }
3907 }
3908 {
3909 \flowfram_if_frame_oddpages_only:nnTF { #2 } { #3 }
3910 {
3911 \int_set_eq:NN #1 \c_one_int
3912 }
3913 {
3914 \flowfram_if_frame_evenpages_only:nnTF { #2 } { #3 }
3915 {
3916 \int_set:Nn #1 { 2 }
3917 }
3918 {
3919 % \end{macrocode}
3920 %Get the first range in the page list.
3921 % \begin{macrocode}
3922 \exp_args:Ne
3923 \__flowfram_get_range:n
3924 {
3925 \clist_item:cn
3926 { g__flowfram_ #2 _ pagelist _ \romannumeral #3 _ clist }
3927 { \c_one_int }
3928 }
3929 \int_if_zero:nT { #1 }
3930 {
3931 \int_set_eq:NN #1 \c_one_int
3932 }
3933 }
3934 }
3935 }
3936 }
3937 }
3938 % \end{macrocode}
3939 %
3940 %Gets the starting page (stored in "\l__flowfram_range_start_int").
3941 %\marg{type}\marg{idn}
3942 % \begin{macrocode}
3943 \cs_new:Nn \__flowfram_frame_get_start_page:nn
3944 {
3945 \flowfram_frame_get_start_page:Nnn
3946 \l__flowfram_range_start_int { #1 } { #2 }
3947 }
3948 % \end{macrocode}
3949 %
3950 % \begin{macrocode}
3951 \cs_new:Nn \flowfram_set_frame_pagelist:nnn
3952 {
3953 \flowfram_if_valid_pagelist:nTF { #3 }
3954 {
3955 \flowfram_frame_set_clist:nnnn
3956 { #1 } { pagelist } { #2 } { #3 }
3957 }
3958 {
3959 \msg_error:nnn { flowfram } { invalid-pagelist } { #3 }
3960 }
3961 }
3962 \cs_generate_variant:Nn \flowfram_set_frame_pagelist:nnn
3963 { nne , nnV }
3964 % \end{macrocode}
3965 %
3966 %Check if value is a valid page list.
3967 % \begin{macrocode}
3968 \prg_new_conditional:Nnn \flowfram_if_valid_pagelist:n
3969 { T, F, TF }
3970 {
3971 \tl_if_blank:nTF { #1 }
3972 { \prg_return_false: }
3973 {
3974 \flowfram_if_all_or_odd:nTF { #1 }
3975 { \prg_return_true: }
3976 {
3977 \flowfram_if_none_or_even:nTF { #1 }
3978 { \prg_return_true: }
3979 {
3980 \bool_set_false:N \l__flowfram_found_bool
3981 \int_set_eq:NN \l__flowfram_tmpa_int \c_zero_int
3982 \clist_map_inline:nn { #1 }
3983 {
3984 \__flowfram_get_range:n { ##1 }
3985 \int_if_zero:nT { \l__flowfram_range_start_int }
3986 {
3987 \int_set_eq:NN \l__flowfram_range_start_int \c_one_int
3988 }
3989 \bool_lazy_or:nnT
3990 {
3991 \int_compare_p:nNn
3992 { \l__flowfram_range_start_int } > { \l__flowfram_range_end_int }
3993 }
3994 {
3995 \bool_not_p:n
3996 {
3997 \int_compare_p:nNn
3998 { \l__flowfram_range_start_int } > { \l__flowfram_tmpa_int }
3999 }
4000 }
4001 {
4002 \clist_map_break:n
4003 {
4004 \bool_set_true:N \l__flowfram_found_bool
4005 }
4006 }
4007 \int_set_eq:NN \l__flowfram_tmpa_int \l__flowfram_range_end_int
4008 }
4009 \bool_if:NTF \l__flowfram_found_bool
4010 { \prg_return_false: }
4011 { \prg_return_true: }
4012 }
4013 }
4014 }
4015 }
4016 % \end{macrocode}
4017 %
4018 % \begin{macrocode}
4019 \cs_new:Nn \flowfram_set_frame_excludelist:nnn
4020 {
4021 \flowfram_frame_set_clist:nnnn
4022 { #1 } { excludelist } { #2 } { #3 }
4023 }
4024 \cs_generate_variant:Nn \flowfram_set_frame_excludelist:nnn
4025 { nne , nnV }
4026 % \end{macrocode}
4027 %
4028 % \begin{macrocode}
4029 \cs_new:Nn \flowfram_concat_frame_excludelist:nnN
4030 {
4031 \flowfram_frame_concat_clist:nnnN
4032 { #1 } { excludelist } { #2 } #3
4033 }
4034 \cs_generate_variant:Nn \flowfram_concat_frame_excludelist:nnN { nnc }
4035 % \end{macrocode}
4036 %
4037 % \begin{macrocode}
4038 \cs_new:Nn \flowfram_concat_frame_excludelist:nnn
4039 {
4040 \clist_set:Nn \l__flowfram_exclude_pages_clist { #3 }
4041 \flowfram_concat_frame_excludelist:nnN
4042 { #1 } { #2 } \l__flowfram_exclude_pages_clist
4043 }
4044 \cs_generate_variant:Nn \flowfram_concat_frame_excludelist:nnn { nne }
4045 % \end{macrocode}
4046 %
4047 %Syntax: \marg{frame type}\marg{idn}
4048 % If frame's page list is set to "odd":
4049 % \begin{macrocode}
4050 \prg_new_conditional:Nnn \flowfram_if_frame_oddpages_only:nn
4051 { p , T , F , TF }
4052 {
4053 \flowfram_if_tl_eq_frame_clist:NnnnTF
4054 \c_flowfram_odd_tl
4055 { #1 } { pagelist } { #2 }
4056 { \prg_return_true: }
4057 { \prg_return_false: }
4058 }
4059 % \end{macrocode}
4060 %
4061 % If frame's page list is set to "even":
4062 % \begin{macrocode}
4063 \prg_new_conditional:Nnn \flowfram_if_frame_evenpages_only:nn
4064 { p , T , F , TF }
4065 {
4066 \flowfram_if_tl_eq_frame_clist:NnnnTF
4067 \c_flowfram_even_tl
4068 { #1 } { pagelist } { #2 }
4069 { \prg_return_true: }
4070 { \prg_return_false: }
4071 }
4072 % \end{macrocode}
4073 %
4074 % If frame's page list is set to "all":
4075 % \begin{macrocode}
4076 \prg_new_conditional:Nnn \flowfram_if_frame_allpages:nn
4077 { p , T , F , TF }
4078 {
4079 \flowfram_if_tl_eq_frame_clist:NnnnTF
4080 \c_flowfram_all_tl
4081 { #1 } { pagelist } { #2 }
4082 { \prg_return_true: }
4083 { \prg_return_false: }
4084 }
4085 % \end{macrocode}
4086 %
4087 % If frame's page list is set to "none":
4088 % \begin{macrocode}
4089 \prg_new_conditional:Nnn \flowfram_if_frame_nopages:nn
4090 { p , T , F , TF }
4091 {
4092 \flowfram_if_tl_eq_frame_clist:NnnnTF
4093 \c_flowfram_none_tl
4094 { #1 } { pagelist } { #2 }
4095 { \prg_return_true: }
4096 { \prg_return_false: }
4097 }
4098 % \end{macrocode}
4099 %
4100 % \begin{macrocode}
4101 \prg_new_conditional:Nnn \flowfram_if_all_or_odd:N
4102 { p, T, F, TF }
4103 {
4104 \bool_lazy_or:nnTF
4105 {
4106 \tl_if_eq_p:NN #1 \c_flowfram_all_tl
4107 }
4108 {
4109 \tl_if_eq_p:NN #1 \c_flowfram_odd_tl
4110 }
4111 { \prg_return_true: }
4112 { \prg_return_false: }
4113 }
4114 % \end{macrocode}
4115 %
4116 % \begin{macrocode}
4117 \prg_new_conditional:Nnn \flowfram_if_all_or_odd:n
4118 { T, F, TF }
4119 {
4120 \tl_if_eq:NnTF \c_flowfram_all_tl { #1 }
4121 { \prg_return_true: }
4122 {
4123 \tl_if_eq:NnTF \c_flowfram_odd_tl { #1 }
4124 { \prg_return_true: }
4125 { \prg_return_false: }
4126 }
4127 }
4128 % \end{macrocode}
4129 %
4130 % \begin{macrocode}
4131 \prg_new_conditional:Nnn \flowfram_if_none_or_even:N
4132 { p, T, F, TF }
4133 {
4134 \bool_lazy_or:nnTF
4135 {
4136 \tl_if_eq_p:NN #1 \c_flowfram_none_tl
4137 }
4138 {
4139 \tl_if_eq_p:NN #1 \c_flowfram_even_tl
4140 }
4141 { \prg_return_true: }
4142 { \prg_return_false: }
4143 }
4144 % \end{macrocode}
4145 %
4146 % \begin{macrocode}
4147 \prg_new_conditional:Nnn \flowfram_if_none_or_even:n
4148 { T, F, TF }
4149 {
4150 \tl_if_eq:NnTF \c_flowfram_none_tl { #1 }
4151 { \prg_return_true: }
4152 {
4153 \tl_if_eq:NnTF \c_flowfram_even_tl { #1 }
4154 { \prg_return_true: }
4155 { \prg_return_false: }
4156 }
4157 }
4158 % \end{macrocode}
4159 %
4160 %
4161 %\begin{macro}{\@ff@getrange}
4162 %\changes{2.0}{2025-11-24}{renamed \cs{@ff@getrange} command}
4163 % Find out what kind of range the argument is (for example, a single
4164 % number "24" or a closed range "30-40" or an open range, "<10" or
4165 % ">25") and set integer variables to start and end. Version 2.0 renamed command.
4166 % \begin{macrocode}
4167 \cs_new:Nn \__flowfram_get_range:n
4168 {
4169 \flowfram_if_all_or_odd:nTF { #1 }
4170 {
4171 \int_set_eq:NN \l__flowfram_range_start_int \c_one_int
4172 \int_set_eq:NN
4173 \l__flowfram_range_end_int
4174 \c_flowfram_max_page_int
4175 }
4176 {
4177 \tl_if_eq:nnTF { #1 } { even }
4178 {
4179 \int_set:Nn \l__flowfram_range_start_int { 2 }
4180 \int_set_eq:NN
4181 \l__flowfram_range_end_int
4182 \c_flowfram_max_page_int
4183 }
4184 {
4185 \tl_if_eq:nnTF { #1 } { none }
4186 {
4187 \int_zero:N \l__flowfram_range_start_int
4188 \int_zero:N \l__flowfram_range_end_int
4189 }
4190 {
4191 \__flowfram_get_range:w #1 - \q_nil \q_stop
4192 }
4193 }
4194 }
4195 }
4196 \cs_generate_variant:Nn \__flowfram_get_range:n { e }
4197 % \end{macrocode}
4198 %\end{macro}
4199 %\begin{macro}{\@ff@@getrange}
4200 %\changes{2.0}{2025-11-24}{renamed \cs{\@ff@@getrange}}
4201 % The ranges can now be picked out. If the first character
4202 % is a "<" or ">" it is an open ended range, otherwise it
4203 % is either a single value, or a close ended range.
4204 % \begin{macrocode}
4205 \cs_new:Npn \__flowfram_get_range:w #1 - #2 \q_stop
4206 {
4207 \quark_if_nil:nTF { #2 }
4208 {
4209 \tl_if_head_eq_meaning:nNTF { #1 } <
4210 {
4211 \int_zero:N \l__flowfram_range_start_int
4212 \int_set:Nn \l__flowfram_range_end_int
4213 {
4214 \tl_tail:n { #1 } - \c_one_int
4215 }
4216 }
4217 {
4218 \tl_if_head_eq_meaning:nNTF { #1 } >
4219 {
4220 \int_set:Nn \l__flowfram_range_start_int
4221 {
4222 \tl_tail:n { #1 } + \c_one_int
4223 }
4224 \int_set_eq:NN
4225 \l__flowfram_range_end_int
4226 \c_flowfram_max_page_int
4227 }
4228 {
4229 \int_set:Nn \l__flowfram_range_start_int { #1 }
4230 \int_set:Nn \l__flowfram_range_end_int { #1 }
4231 }
4232 }
4233 }
4234 {
4235 \int_set:Nn \l__flowfram_range_start_int { #1 }
4236 \__flowfram_get_end_range:w #2 - \q_stop
4237 }
4238 }
4239 % \end{macrocode}
4240 %\end{macro}
4241 %Discard trailing content.
4242 % \begin{macrocode}
4243 \cs_new:Npn \__flowfram_get_end_range:w #1 - #2 \q_stop
4244 {
4245 \int_set:Nn \l__flowfram_range_end_int { #1 }
4246 }
4247 % \end{macrocode}
4248 %
4249 %Syntax: \marg{frame type}\marg{tag}\marg{idn}
4250 % \begin{macrocode}
4251 \cs_new:Nn \flowfram_frame_new_bool:nnn
4252 {
4253 \prop_if_exist:cTF
4254 { g__flowfram_ #1 _attributes_prop }
4255 {
4256 \bool_new:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ bool }
4257 \__flowfram_add_frame_attribute:cen
4258 { g__flowfram_ #1 _attributes_prop }
4259 { #2 } { bool }
4260 }
4261 {
4262 \msg_error:nne { flowfram } {invalid-frame-type} { #1 }
4263 }
4264 }
4265 % \end{macrocode}
4266 %
4267 %Syntax: \marg{frame type}\marg{tag}\marg{idn}\marg{value}
4268 % \begin{macrocode}
4269 \cs_new:Nn \flowfram_frame_new_bool:nnnN
4270 {
4271 \prop_if_exist:cTF
4272 { g__flowfram_ #1 _attributes_prop }
4273 {
4274 \bool_new:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ bool }
4275 \bool_gset_eq:cN
4276 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ bool }
4277 #4
4278 \__flowfram_add_frame_attribute:cen
4279 { g__flowfram_ #1 _attributes_prop }
4280 { #2 } { bool }
4281 }
4282 {
4283 \msg_error:nne { flowfram } {invalid-frame-type} { #1 }
4284 }
4285 }
4286 % \end{macrocode}
4287 %
4288 % \begin{macrocode}
4289 \prg_new_conditional:Nnn \flowfram_if_frame_bool:nnn
4290 { T, F, TF }
4291 {
4292 \bool_if_exist:cTF
4293 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ bool }
4294 {
4295 \bool_if:cTF
4296 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ bool }
4297 { \prg_return_true: }
4298 { \prg_return_false: }
4299 }
4300 {
4301 \__flowfram_error:eeeee { frame-unknown-tag }
4302 { #1 } { #2 } { \int_eval:n { #3 } } { bool }
4303 \prg_return_false:
4304 }
4305 }
4306 % \end{macrocode}
4307 %
4308 %Syntax: \marg{frame type}\marg{tag}\marg{idn}
4309 % \begin{macrocode}
4310 \cs_new:Nn \flowfram_frame_set_bool_true:nnn
4311 {
4312 \bool_if_exist:cTF
4313 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ bool }
4314 {
4315 \bool_gset_true:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ bool }
4316 }
4317 {
4318 \__flowfram_error:eeeee { frame-unknown-tag }
4319 { #1 } { #2 } { \int_eval:n { #3 } } { bool }
4320 }
4321 }
4322 % \end{macrocode}
4323 %
4324 %Syntax: \marg{frame type}\marg{tag}\marg{idn}
4325 % \begin{macrocode}
4326 \cs_new:Nn \flowfram_frame_set_bool_false:nnn
4327 {
4328 \bool_if_exist:cTF
4329 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ bool }
4330 {
4331 \bool_gset_false:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ bool }
4332 }
4333 {
4334 \__flowfram_error:eeeee { frame-unknown-tag }
4335 { #1 } { #2 } { \int_eval:n { #3 } } { bool }
4336 }
4337 }
4338 % \end{macrocode}
4339 %
4340 %Syntax: \marg{frame type}\marg{tag}\marg{idn}\marg{choice value}
4341 %The \meta{choice value} should be either "true" or "false".
4342 % \begin{macrocode}
4343 \cs_new:Nn \flowfram_frame_set_bool_from_option:nnnn
4344 {
4345 \bool_if_exist:cTF
4346 { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ bool }
4347 {
4348 \tl_if_eq:nnTF { #4 } { true }
4349 {
4350 \bool_gset_true:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ bool }
4351 }
4352 {
4353 \tl_if_eq:nnTF { #4 } { false }
4354 {
4355 \bool_gset_false:c { g__flowfram_ #1 _ #2 _ \romannumeral #3 _ bool }
4356 }
4357 {
4358 \msg_error:nnnnnn { flowfram } { invalid-bool }
4359 { #4 } { #2 } { #1 } { #3 }
4360 }
4361 }
4362 }
4363 {
4364 \__flowfram_error:eeeee { frame-unknown-tag }
4365 { #1 } { #2 } { \int_eval:n { #3 } } { bool }
4366 }
4367 }
4368 \cs_generate_variant:Nn \flowfram_frame_set_bool_from_option:nnnn
4369 { nnnV , nnne }
4370 % \end{macrocode}
4371 %
4372 %Frames may only be defined in the preamble although the output
4373 %routine will create one if there are none available.
4374 % \begin{macrocode}
4375 \cs_new:Nn \__flowfram_only_preamble:Nn { #2 }
4376 \cs_new:Nn \__flowfram_forbidden:Nn
4377 {
4378 \msg_error:nnn { flowfram } { misplaced-col-cmd } { #1 }
4379 }
4380 % \end{macrocode}
4381 %
4382 %Document only commands:
4383 % \begin{macrocode}
4384 \cs_new:Nn \__flowfram_only_document_env:Nn
4385 {
4386 \msg_error:nnn { flowfram } { doc-env-only } { #1 }
4387 }
4388 % \end{macrocode}
4389 %
4390 % \subsection{Flow Frames}
4391 %\begin{macro}{\flowframesep}
4392 % Set up default lengths. The gap between the text and the
4393 % border is given by:
4394 % \begin{macrocode}
4395 \newlength\flowframesep
4396 \flowframesep=\fboxsep
4397 % \end{macrocode}
4398 %\end{macro}
4399 %\begin{macro}{\flowframerule}
4400 % The width of the frame is given by:
4401 % \begin{macrocode}
4402 \newlength\flowframerule
4403 \flowframerule=\fboxrule
4404 % \end{macrocode}
4405 %\end{macro}
4406 %\begin{macro}{\flowframeshowlayout}
4407 %\changes{2.0}{2025-11-24}{changed to document command}
4408 % Define command to show page layout. This finishes the current
4409 % page, temporarily sets draft mode, and prints an empty page.
4410 % Only the \glspl{frame} for that page will be shown.
4411 % \begin{macrocode}
4412 \NewDocumentCommand \flowframeshowlayout { }
4413 {
4414 \finishthispage
4415 \group_begin:
4416 \__flowfram_set_draft:
4417 \mbox{}
4418 \finishthispage
4419 \clearpage
4420 \group_end:
4421 }
4422 % \end{macrocode}
4423 %\end{macro}
4424 %\begin{macro}{\framebreak}
4425 % If the \glspl{flow} are not all of the same width, the change
4426 % in "\hsize" will not come into effect until the end
4427 % of the paragraph. Provide a command to simulate a paragraph
4428 % break, without making it look as though there is a paragraph.
4429 % Provides an optional argument that is passed to
4430 % "\pagebreak". Make sure it is grouped to localise
4431 % the change in "\parfillskip" and "\parskip".
4432 %\changes{1.14}{2012-11-10}{made change to switch global}
4433 %\changes{2.0}{2025-11-24}{changed to document command}
4434 % \begin{macrocode}
4435 \newif\ifusedframebreak
4436 \usedframebreaktrue
4437 \NewDocumentCommand \framebreak { O{4} }
4438 {
4439 \global \usedframebreaktrue
4440 \group_begin:
4441 \dim_zero:N \parfillskip
4442 \pagebreak [ #1 ]
4443 \dim_zero:N \parskip
4444 \par
4445 \noindent
4446 \group_end:
4447 }
4448 % \end{macrocode}
4449 %\end{macro}
4450 %\begin{macro}{\finishthispage}
4451 % The commands \cs{newpage} and
4452 % \cs{pagebreak} can be used to move on to the next
4453 % \gls{flow}, but to finish the entire page, use
4454 % "\finishthispage". This is (loosely) based on the code for
4455 % \cs{clearpage}. (\cs{@dbltopnum} not required as we can't have
4456 % column-spanning floats.)
4457 %\changes{1.14}{2012-11-10}{change \cs{c@page} to
4458 %\cs{@ff@pages@countreg}}
4459 %\changes{2.0}{2025-11-24}{changed to document command}
4460 % \begin{macrocode}
4461 \NewDocumentCommand \finishthispage { }
4462 {
4463 \ifvmode
4464 \int_set_eq:NN \l__flowfram_current_frame_int \c@thisframe
4465 \int_set_eq:NN \l__flowfram_current_abspage_int \c@absolutepage
4466 \dim_compare:nNnT { \pagetotal } < { \topskip }
4467 {
4468 \hbox { }
4469 }
4470 \newpage
4471 \write \m@ne { }
4472 \vbox { }
4473 \penalty -\@Mi
4474 % \end{macrocode}
4475 % If that was the last \gls{flow} on the page, then we're done,
4476 % otherwise iterate through the remaining \glspl{flow}.
4477 % \begin{macrocode}
4478 \int_compare:nNnT
4479 { \l__flowfram_current_abspage_int } = { \c@absolutepage }
4480 {
4481 \bool_while_do:nn
4482 {
4483 \bool_not_p:n
4484 {
4485 \int_compare_p:nNn
4486 { \l__flowfram_current_frame_int } > { \c@maxflow }
4487 }
4488 }
4489 {
4490 \__flowfram_check_if_this_page:nn
4491 { \g__flowfram_pagecounter_tl } { \l__flowfram_current_frame_int }
4492 \bool_if:NF \g__flowfram_not_this_frame_bool
4493 {
4494 \int_gset:Nn \c@thisframe { \l__flowfram_current_frame_int }
4495 \hbox { }
4496 \newpage
4497 }
4498 \int_incr:N \l__flowfram_current_frame_int
4499 }
4500 }
4501 \fi
4502 }
4503 % \end{macrocode}
4504 %\end{macro}
4505 %
4506 %\begin{macro}{\cleardoublepage}
4507 % Modify the definition of "\cleardoublepage". This may
4508 % or may not be defined.
4509 %\changes{2.0}{2025-11-24}{changed to document command}
4510 % \begin{macrocode}
4511 \providecommand\cleardoublepage{}
4512 \RenewDocumentCommand \cleardoublepage { }
4513 {
4514 \clearpage
4515 \if@twoside
4516 \ifodd \c@page
4517 \else
4518 \hbox { }
4519 \clearpage
4520 \fi
4521 \fi
4522 }
4523 % \end{macrocode}
4524 %\end{macro}
4525 %
4526 %\begin{macro}{\cleartoevenpage}
4527 %\changes{2.0}{2025-11-24}{new}
4528 % \begin{macrocode}
4529 \NewDocumentCommand \cleartoevenpage { }
4530 {
4531 \clearpage
4532 \if@twoside
4533 \ifodd \c@page
4534 \hbox { }
4535 \clearpage
4536 \fi
4537 \fi
4538 }
4539 % \end{macrocode}
4540 %\end{macro}
4541 %
4542 %\begin{macro}{\newpage}
4543 % Modify the definition of \cs{newpage} so that it sets the
4544 % "usedframebreak" flag.
4545 %\changes{1.14}{2012-11-10}{Modified definition of \cs{newpage}}
4546 % \begin{macrocode}
4547 \preto\newpage{\global\usedframebreaktrue}
4548 % \end{macrocode}
4549 %\end{macro}
4550 %Need to prevent \cs{@topnewpage} from pushing things out of
4551 %whack as \cs{twocolumn} now behaves differently.
4552 % \begin{macrocode}
4553 \long\def\@topnewpage[#1]{#1}
4554 % \end{macrocode}
4555 % Disable "@mparswitch" flag, as each \gls{flow} has
4556 % its own predefined margin setting.
4557 % \begin{macrocode}
4558 \@mparswitchfalse
4559 % \end{macrocode}
4560 %\begin{macro}{\globalreversemargin}
4561 % The margins get switched during the output routine, so
4562 % need the effect to be global.
4563 %\changes{2.0}{2025-11-24}{changed to document command}
4564 % \begin{macrocode}
4565 \NewDocumentCommand \globalreversemargin { }
4566 {
4567 \global \@mparbottom \z@
4568 \global \@reversemargintrue
4569 }
4570 % \end{macrocode}
4571 %\end{macro}
4572 %\begin{macro}{\globalnormalmargin}
4573 %\changes{2.0}{2025-11-24}{changed to document command}
4574 % \begin{macrocode}
4575 \NewDocumentCommand \globalnormalmargin { }
4576 {
4577 \global \@mparbottom \z@
4578 \global \@reversemarginfalse
4579 }
4580 % \end{macrocode}
4581 %\end{macro}
4582 %\begin{macro}{\@getmarginpos}
4583 % Determine whether the margin should be on the right
4584 % or left. This depends on the setting, which can either
4585 % be "right" or "left" (to the right or left) or "inner" (on the
4586 % spine side, so left for odd pages and right for even
4587 % pages) or "outer" (on the outside of the page, so right
4588 % for odd pages and left for even pages.) The setting
4589 % is stored in "\l__flowfram_margin_tl".
4590 % Version 2.0 renamed \cs{@getmarginpos}.
4591 % \begin{macrocode}
4592 \cs_new:Nn \__flowfram_get_margin_pos:n
4593 {
4594 \tl_if_eq:NnTF \c_flowfram_inner_tl { #1 }
4595 {
4596 \legacy_if:nTF { @twoside }
4597 {
4598 \int_if_odd:nTF { \c@page }
4599 {
4600 \tl_set_eq:NN
4601 \l__flowfram_margin_tl
4602 \c_flowfram_left_tl
4603 }
4604 {
4605 \tl_set_eq:NN
4606 \l__flowfram_margin_tl
4607 \c_flowfram_right_tl
4608 }
4609 }
4610 {
4611 \tl_set_eq:NN
4612 \l__flowfram_margin_tl
4613 \c_flowfram_left_tl
4614 }
4615 }
4616 {
4617 \tl_if_eq:NnTF \c_flowfram_outer_tl { #1 }
4618 {
4619 \legacy_if:nTF { @twoside }
4620 {
4621 \int_if_odd:nTF { \c@page }
4622 {
4623 \tl_set_eq:NN
4624 \l__flowfram_margin_tl
4625 \c_flowfram_right_tl
4626 }
4627 {
4628 \tl_set_eq:NN
4629 \l__flowfram_margin_tl
4630 \c_flowfram_left_tl
4631 }
4632 }
4633 {
4634 \tl_set_eq:NN
4635 \l__flowfram_margin_tl
4636 \c_flowfram_right_tl
4637 }
4638 }
4639 {
4640 \tl_set:Nn \l__flowfram_margin_tl { #1 }
4641 }
4642 }
4643 }
4644 \cs_generate_variant:Nn \__flowfram_get_margin_pos:n { e }
4645 % \end{macrocode}
4646 %\end{macro}
4647 %
4648 %\begin{macro}{\setmargin}
4649 % Set the margin for current \gls{flow}.
4650 %\changes{2.0}{2025-11-24}{changed to document command}
4651 % \begin{macrocode}
4652 \NewDocumentCommand \setmargin { }
4653 {
4654 \__flowfram_get_margin_pos:e
4655 {
4656 \flowfram_frame_use_tl:nnn { flow } { margin } { \c@thisframe }
4657 }
4658 \tl_if_eq:NNTF \l__flowfram_margin_tl \c_flowfram_left_tl
4659 {
4660 \globalreversemargin
4661 }
4662 {
4663 \globalnormalmargin
4664 }
4665 }
4666 % \end{macrocode}
4667 %\end{macro}
4668 %
4669 %\begin{macro}{\newflowframe}
4670 % Create a new \gls{flow}. Syntax:\newline
4671 % \cs{newflowframe}\oarg{pages}\marg{width}\marg{height}\marg{x}\marg{y}\oarg{label}
4672 %
4673 % First increment "\c@maxflow", and define boolean
4674 % to indicate whether or not the \gls{flow} has a border,
4675 % Then check to see whether or not the starred version is
4676 % begin used. All the settings must be global: the
4677 % output routine will create a new \gls{flow}, if there are no
4678 % more defined, and since changes made in the output routine
4679 % are localised, the new \gls{frame} will be lost unless it is
4680 % globally defined. Flow frames should only be set up in the
4681 % preamble, but if there are not enough \glspl{frame} to fit all
4682 % the document text, the output routine will create a new \gls{flow}.
4683 % \begin{macrocode}
4684 \NewDocumentCommand \newflowframe
4685 { s O{all} m m m m O { \int_use:N \c@maxflow } }
4686 {
4687 \__flowfram_only_preamble:Nn \newflowframe
4688 {
4689 \__flowfram_new_flow:nnnnnn
4690 { #2 } { #3 } { #4 } { #5 } { #6 } { #7 }
4691 % \end{macrocode}
4692 %If the starred version was used, enable the border frame setting.
4693 % \begin{macrocode}
4694 \IfBooleanT { #1 }
4695 {
4696 % \end{macrocode}
4697 %\changes{2.1}{2026-02-23}{corrected function name}
4698 % \begin{macrocode}
4699 \flowfram_frame_set_bool_true:nnn { flow } { hasframe } { \c@maxflow }
4700 }
4701 }
4702 }
4703 % \end{macrocode}
4704 %\end{macro}
4705 %
4706 %\begin{macro}{\@n@wflowframe}
4707 %\changes{2.0}{2025-11-24}{removed}
4708 %Version 2.0 removed \cs{@n@wflowframe}
4709 %\end{macro}
4710 %\begin{macro}{\@snewflowframe}
4711 % Starred version sets boolean flag to indicate a border
4712 %Version 2.0 removed \cs{@snewflowframe}.
4713 %\end{macro}
4714 %\begin{macro}{\@newflowframe}
4715 %\changes{2.0}{2025-11-24}{removed}
4716 %Version 2.0 removed \cs{@newflowframe}.
4717 %\end{macro}
4718 %
4719 %\begin{macro}{\@@newflowframe}
4720 % Now get on with initialising the \gls{flow}. By default, it
4721 % will apply the \gls{flow} to all pages, the optional argument
4722 % can override this.
4723 % Version 2.0 removed \cs{@@newflowframe}
4724 %
4725 %\marg{page list}\marg{width}\marg{height}\marg{x}\marg{y}
4726 % \begin{macrocode}
4727 \cs_new_nopar:Nn \__flowfram_new_flow:nnnnn
4728 {
4729 \__flowfram_new_flow:nnnnnn
4730 { #1 } { #2 } { #3 } { #4 } { #5 } { \int_use:N \c@maxflow }
4731 }
4732 % \end{macrocode}
4733 %
4734 %\marg{page list}\marg{width}\marg{height}\marg{x}\marg{y}\marg{label}
4735 % \begin{macrocode}
4736 \cs_new:Nn \__flowfram_new_flow:nnnnnn
4737 {
4738 \__flowfram_new_frame:nnnnnnn
4739 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { flow }
4740 % \end{macrocode}
4741 %Define content box.
4742 % \begin{macrocode}
4743 \flowfram_frame_new_box:nnn { flow } { column } { \c@maxflow }
4744 % \end{macrocode}
4745 %Define attributes specific to flow frames.
4746 % \begin{macrocode}
4747 \flowfram_frame_new_tl:nnnn { flow } { margin } { \c@maxflow } { right }
4748 % \end{macrocode}
4749 %Initialise if first (frame may have been created on the fly by the output
4750 %routine).
4751 % \begin{macrocode}
4752 \int_if_zero:nT { \c@thisframe }
4753 {
4754 \__flowfram_frame_get_start_page:nn { flow } { \c@maxflow }
4755 \int_compare:nNnT
4756 { \l__flowfram_range_start_int } = { \c_one_int }
4757 {
4758 \int_gset_eq:NN \c@thisframe \c@maxflow
4759 \__flowfram_set_column:n { \c@maxflow }
4760 \global\usedframebreaktrue
4761 }
4762 }
4763 }
4764 % \end{macrocode}
4765 %\end{macro}
4766 %\begin{macro}{\@s@tflowframeid}
4767 %\changes{2.0}{2025-11-24}{removed}
4768 % If square brackets occur after "\newflowframe", take
4769 % the contents to be the label, otherwise the label will be
4770 % the \gls{flow} number.
4771 % Version 2.0 removed \cs{@s@tflowframeid}.
4772 %\end{macro}
4773 %
4774 %\begin{macro}{\@ff@checkuniqueidl}
4775 %\changes{2.0}{2025-11-24}{removed}
4776 %\marg{flow-id}\marg{label}
4777 % Check proposed label for flow frame is unique.
4778 %Version 2.0 removed \cs{@ff@checkuniqueidl}.
4779 %\end{macro}
4780 %
4781 %\begin{macro}{\getflowlabel}
4782 %\changes{1.11}{2008/06/27}{new}
4783 %\cs{getflowlabel}\marg{idn}
4784 % Gets the \gls{idl} for the \gls{flow} identified by its
4785 % \gls{idn}.
4786 % \begin{macrocode}
4787 \newcommand*{\getflowlabel}[1]{%
4788 \flowfram_frame_use_tl:nnn { flow } { label } { #1 }
4789 }
4790 % \end{macrocode}
4791 %\end{macro}
4792 %
4793 %\begin{macro}{\getflowid}
4794 %\changes{1.11}{2008/06/27}{new}
4795 %\changes{2.0}{2025-11-24}{changed to document command}
4796 %\cs{getflowid}\marg{cmd}\marg{idl}
4797 % Gets the \gls{idn} for the \gls{flow} identified by its
4798 % \gls{idl} and stores in \meta{cmd} which must be a control
4799 % sequence.
4800 % \begin{macrocode}
4801 \NewDocumentCommand \getflowid { m m }
4802 {
4803 \__flowfram_get_flow_id:e { #2 }
4804 \tl_set:Ne #1 { \int_use:N \l__flowfram_id_int }
4805 }
4806 % \end{macrocode}
4807 %\end{macro}
4808 %
4809 %\begin{macro}{\@flowframeid}
4810 %\changes{2.0}{2025-11-24}{renamed}
4811 % Work out the flow frame IDN from the label. This
4812 % iterates through the flow frames, so if you have a lot of
4813 % them it is quicker to identify them by their \gls{idn}
4814 % rather than their \gls{idl}.
4815 % The \gls{idn} will be stored in "\l__flowfram_id_int".
4816 %Version 2.0 renamed \cs{@flowframeid}.
4817 % \begin{macrocode}
4818 \cs_new:Nn \__flowfram_get_flow_id:n
4819 {
4820 \__flowfram_if_flow_label_exists:nF { #1 }
4821 {
4822 \__flowfram_error:eee { label-undefined } { #1 } { flow }
4823 }
4824 }
4825 \cs_generate_variant:Nn \__flowfram_get_flow_id:n { e, V }
4826 % \end{macrocode}
4827 %\end{macro}
4828 %
4829 % \begin{macrocode}
4830 \prg_new_conditional:Nnn \__flowfram_if_flow_label_exists:n
4831 { TF , T , F }
4832 {
4833 \__flowfram_if_frame_label_exists:nnNTF
4834 { flow } { #1 } \l__flowfram_id_int
4835 { \prg_return_true: }
4836 { \prg_return_false: }
4837 }
4838 % \end{macrocode}
4839 %
4840 %\begin{macro}{\setallflowframes}
4841 %\changes{2.0}{2025-11-24}{changed to document command}
4842 % Provide a command to change the settings for all flow
4843 % frames. This just iterates through all the \glspl{flow},
4844 % and sets each one in turn.
4845 % \begin{macrocode}
4846 \NewDocumentCommand \setallflowframes { m }
4847 {
4848 \int_step_inline:nn { \c@maxflow }
4849 {
4850 \__flowfram_set_flow_by_idn:nn { ##1 } { #1 }
4851 }
4852 }
4853 % \end{macrocode}
4854 %\end{macro}
4855 %\begin{macro}{\setflowframe}
4856 % Define "\setflowframe" command. Check to see
4857 % whether or not the starred version is being used.
4858 % \begin{macrocode}
4859 \NewDocumentCommand \setflowframe { s m m }
4860 {
4861 \IfBooleanTF { #1 }
4862 {
4863 \exp_args:Ne \clist_map_inline:nn { #2 }
4864 {
4865 \__flowfram_if_flow_label_exists:nTF { ##1 }
4866 {
4867 \__flowfram_set_flow_by_idn:nn { \l__flowfram_id_int } { #3 }
4868 }
4869 {
4870 \__flowfram_error:eee { label-undefined } { ##1 } { flow }
4871 }
4872 }
4873 }
4874 {
4875 \__flowfram_map_idns:enn { #2 } { flow }
4876 {
4877 \__flowfram_set_flow_by_idn:nn { \l__flowfram_id_int } { #3 }
4878 }
4879 }
4880 }
4881 % \end{macrocode}
4882 %\end{macro}
4883 %
4884 %\begin{macro}{\@ssetflowframe}
4885 %\changes{2.0}{2025-11-24}{removed}
4886 %Version 2.0 removed \cs{@ssetflowframe}.
4887 %\end{macro}
4888 %
4889 %\begin{macro}{\@setflowframe}
4890 %\changes{2.0}{2025-11-24}{removed}
4891 %Version 2.0 removed \cs{@setflowframe}.
4892 %\end{macro}
4893 %
4894 %\begin{macro}{\@@setflowframe}
4895 % This is the command that actually sets the values for
4896 % the \gls{flow} whose \gls{idn} is specified by the first
4897 % parameter.
4898 %\changes{1.11}{2008/06/27}{removed unwanted spaces}
4899 %\changes{2.0}{2025-11-24}{renamed}
4900 %Version 2.0 renamed from \cs{@@setflowframe}.
4901 % \begin{macrocode}
4902 \cs_new:Nn \__flowfram_set_flow_by_idn:nn
4903 {
4904 \__flowfram_set_keys_for_type:nnn { #2 } { flow } { #1 }
4905 % \end{macrocode}
4906 %Option specific to flow frames:
4907 % \begin{macrocode}
4908 \tl_if_empty:NF \l__flowfram_margin_tl
4909 {
4910 \flowfram_frame_set_tl:nnnV
4911 { flow } { margin } { #1 }
4912 \l__flowfram_margin_tl
4913 }
4914 }
4915 % \end{macrocode}
4916 %\end{macro}
4917 %
4918 %\begin{macro}{\flowsetpagelist}
4919 % Sets the page list for the \gls{flow} given by "#1" (the
4920 % \gls{idn}).
4921 %\changes{1.14}{2012-11-10}{new}
4922 %\changes{2.0}{2025-11-24}{changed to document command}
4923 % \begin{macrocode}
4924 \NewDocumentCommand \flowsetpagelist { m m }
4925 {
4926 \flowfram_set_frame_pagelist:nne { flow } { #1 } { #2 }
4927 }
4928 % \end{macrocode}
4929 %\end{macro}
4930 %\begin{macro}{\flowsetexclusion}
4931 % Sets the exclusion list for the \gls{flow} given by "#1" (the
4932 % \gls{idn}).
4933 %\changes{1.14}{2012-11-10}{new}
4934 %\changes{2.0}{2025-11-24}{changed to document command}
4935 % \begin{macrocode}
4936 \NewDocumentCommand \flowsetexclusion { m m }
4937 {
4938 \flowfram_set_frame_excludelist:nne { flow } { #1 } { #2 }
4939 }
4940 % \end{macrocode}
4941 %\end{macro}
4942 %\begin{macro}{\flowaddexclusion}
4943 % Adds to the exclusion list for the \gls{flow} given by "#1" (the
4944 % \gls{idn}).
4945 %\changes{1.14}{2012-11-10}{new}
4946 %\changes{2.0}{2025-11-24}{changed to document command}
4947 % \begin{macrocode}
4948 \NewDocumentCommand \flowaddexclusion { m m }
4949 {
4950 \flowfram_concat_frame_excludelist:nne
4951 { flow } { #1 } { #2 }
4952 }
4953 % \end{macrocode}
4954 %\end{macro}
4955 %
4956 %\begin{macro}{\@@flowframeswapcoords}
4957 % Swap odd and even offsets for a given \gls{flow}. Do the main stuff for
4958 % a given \gls{flow} \gls{idn}.
4959 % Version 2.0 renamed \cs{@@flowframeswapcoords}.
4960 % \begin{macrocode}
4961 \cs_new:Nn \__flowfram_flow_swap_coords:n
4962 {
4963 \flowfram_frame_swap_dim:nnnn
4964 { flow } { posx } { evenx } { #1 }
4965 \flowfram_frame_swap_dim:nnnn
4966 { flow } { posy } { eveny } { #1 }
4967 }
4968 % \end{macrocode}
4969 %\end{macro}
4970 %\begin{macro}{\ffswapoddeven}
4971 % Allow user to specify \gls{flow} either by \gls{idn} or \gls{idl}:
4972 % \begin{macrocode}
4973 \NewDocumentCommand \ffswapoddeven { s m }
4974 {
4975 \IfValueTF { #1 }
4976 {
4977 \exp_args:Ne \clist_map_inline:nn { #2 }
4978 {
4979 \__flowfram_get_flow_id:n { ##1 }
4980 \__flowfram_flow_swap_coords:n { \l__flowfram_id_int }
4981 }
4982 }
4983 {
4984 \__flowfram_map_idns:enn { #2 } { flow }
4985 {
4986 \__flowfram_flow_swap_coords:n { \l__flowfram_id_int }
4987 }
4988 }
4989 }
4990 % \end{macrocode}
4991 %\end{macro}
4992 %\begin{macro}{\@sflowframeswapcoords}
4993 %\changes{2.0}{2025-11-24}{removed}
4994 %Version 2.0 removed \cs{@sflowframeswapcoords}.
4995 %\end{macro}
4996 %\begin{macro}{\@flowframeswapcoords}
4997 %\changes{2.0}{2025-11-24}{removed}
4998 %Version 2.0 removed \cs{@flowframeswapcoords}.
4999 %\end{macro}
5000 %
5001 % Allow user to get the dimensions of \gls{flow} (useful for
5002 % \glspl{flow} created using "\Ncolumn" etc.) Only the \gls{idn} can
5003 % be used for these commands.
5004 %\begin{macro}{\flowframex}
5005 % \begin{macrocode}
5006 \newcommand*{\flowframex}[1]{%
5007 \flowfram_frame_use_dim:nnn { flow } { posx } { #1 }
5008 }
5009 % \end{macrocode}
5010 %\end{macro}
5011 %\begin{macro}{\flowframey}
5012 % \begin{macrocode}
5013 \newcommand*{\flowframey}[1]{%
5014 \flowfram_frame_use_dim:nnn { flow } { posy } { #1 }
5015 }
5016 % \end{macrocode}
5017 %\end{macro}
5018 %\begin{macro}{\flowframeevenx}
5019 % \begin{macrocode}
5020 \newcommand*{\flowframeevenx}[1]{%
5021 \flowfram_frame_use_dim:nnn { flow } { evenx } { #1 }
5022 }
5023 % \end{macrocode}
5024 %\end{macro}
5025 %\begin{macro}{\flowframeeveny}
5026 % \begin{macrocode}
5027 \newcommand*{\flowframeeveny}[1]{%
5028 \flowfram_frame_use_dim:nnn { flow } { eveny } { #1 }
5029 }
5030 % \end{macrocode}
5031 %\end{macro}
5032 %
5033 %\begin{macro}{\flowframewidth}
5034 % \begin{macrocode}
5035 \newcommand{\flowframewidth}[1]{%
5036 \flowfram_frame_use_dim:nnn { flow } { width } { #1 }
5037 }
5038 % \end{macrocode}
5039 %\end{macro}
5040 %\begin{macro}{\flowframeheight}
5041 % \begin{macrocode}
5042 \newcommand*{\flowframeheight}[1]{%
5043 \flowfram_frame_use_dim:nnn { flow } { height } { #1 }
5044 }
5045 % \end{macrocode}
5046 %\end{macro}
5047 %
5048 % \subsection{Static Frames}
5049 %\begin{macro}{\newstaticframe}
5050 % Now deal with setting up the \glspl{static}. This is
5051 % similar to the \glspl{flow}, except it has an
5052 % associated \LaTeX\ savebox rather than a \TeX\ box.
5053 % Syntax:\newline
5054 % \cs{newstaticframe}\oarg{pages}\marg{width}\marg{height}\marg{x}\marg{y}\oarg{label}\par
5055 % As with "\newflowframe", the final optional argument is
5056 % dealt with at the end.
5057 %\changes{2.0}{2025-11-24}{changed to document command}
5058 % \begin{macrocode}
5059 \NewDocumentCommand \newstaticframe
5060 { s O{all} m m m m O { \int_use:N \c@maxstatic } }
5061 {
5062 \__flowfram_new_static:nnnnnn
5063 { #2 } { #3 } { #4 } { #5 } { #6 } { #7 }
5064 \IfBooleanT { #1 }
5065 {
5066 % \end{macrocode}
5067 %\changes{2.1}{2026-02-23}{corrected function name}
5068 % \begin{macrocode}
5069 \flowfram_frame_set_bool_true:nnn
5070 { static } { hasframe } { \c@maxstatic }
5071 }
5072 }
5073 % \end{macrocode}
5074 %\end{macro}
5075 %
5076 % \begin{macrocode}
5077 \cs_new:Nn \__flowfram_new_static:nnnnn
5078 {
5079 \__flowfram_new_static:nnnnnn
5080 { #1 } { #2 } { #3 } { #4 } { #5 } { \int_use:N \c@maxstatic }
5081 }
5082 % \end{macrocode}
5083 %
5084 %\begin{macro}{\@n@wstaticframe}
5085 %\changes{2.0}{2025-11-24}{removed}
5086 %Version 2.0 removed \cs{@n@wstaticframe}.
5087 %\end{macro}
5088 %\begin{macro}{\@snewstaticframe}
5089 %\changes{2.0}{2025-11-24}{removed}
5090 %Version 2.0 removed \cs{@snewstaticframe}.
5091 %\end{macro}
5092 %\begin{macro}{\@newstaticframe}
5093 %\changes{2.0}{2025-11-24}{removed}
5094 %Version 2.0 removed \cs{@newstaticframe}.
5095 %\end{macro}
5096 %\begin{macro}{\@@newstaticframe}
5097 % Now set up the \gls{static}:
5098 %Version 2.0 renamed \cs{@@newstaticframe}.
5099 %\changes{2.0}{2025-11-24}{renamed}
5100 % \begin{macrocode}
5101 \cs_new_nopar:Nn \__flowfram_new_static:nnnnnn
5102 {
5103 \__flowfram_new_frame:nnnnnnn
5104 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { static }
5105 % \end{macrocode}
5106 %Define content box.
5107 % \begin{macrocode}
5108 \flowfram_frame_new_box:nnn { static } { content } { \c@maxstatic }
5109 % \end{macrocode}
5110 %Define attributes specific to static frames.
5111 % \begin{macrocode}
5112 \flowfram_frame_new_bool:nnnN
5113 { static } { clear } { \c@maxstatic } \c_false_bool
5114 \flowfram_frame_new_bool:nnnN
5115 { static } { hide } { \c@maxstatic } \c_false_bool
5116 \flowfram_frame_new_bool:nnnN
5117 { static } { hidethis } { \c@maxstatic } \c_false_bool
5118 % \end{macrocode}
5119 %Inner position argument for minipage environment:
5120 % \begin{macrocode}
5121 \flowfram_frame_new_tl:nnnn
5122 { static } { valign } { \c@maxstatic } { c }
5123 % \end{macrocode}
5124 %Paragraph shaping declaration.
5125 % \begin{macrocode}
5126 \flowfram_frame_new_tl:nnnn
5127 { static } { shape } { \c@maxstatic } { \relax }
5128 % \end{macrocode}
5129 %Paragraph indentation defaults to \cs{sdfparindent}.
5130 %This is stored as a token list variable rather than a dimension to
5131 %allow it to pick up changes if \cs{sdfparindent} is changed
5132 %afterwards.
5133 % \begin{macrocode}
5134 \flowfram_frame_new_tl:nnnn
5135 { static } { parindent } { \c@maxstatic } { \sdfparindent }
5136 }
5137 % \end{macrocode}
5138 %\end{macro}
5139 %\begin{macro}{\@s@tstaticframeid}
5140 %\changes{2.0}{2025-11-24}{removed}
5141 %Removed \cs{@s@tstaticframeid}
5142 %\end{macro}
5143 %\begin{macro}{\@sf@checkuniqueidl}
5144 %\changes{2.0}{2025-11-24}{removed}
5145 % Removed \cs{@sf@checkuniqueidl}
5146 %\end{macro}
5147 %
5148 %\begin{macro}{\getstaticlabel}
5149 %\changes{1.11}{2008/06/27}{new}
5150 %\cs{getstaticlabel}\marg{idn}
5151 % Gets the \gls{idl} for the \gls{static} identified by its
5152 % \gls{idn}.
5153 % \begin{macrocode}
5154 \newcommand*{\getstaticlabel}[1]{%
5155 \flowfram_frame_use_tl:nnn { static } { label } { #1 }
5156 }
5157 % \end{macrocode}
5158 %\end{macro}
5159 %
5160 %\begin{macro}{\getstaticid}
5161 %\changes{1.11}{2008/06/27}{new}
5162 %\cs{getstaticid}\marg{cmd}\marg{idl}
5163 % Gets the \gls{idn} for the \gls{static} identified by its
5164 % \gls{idl} and stores in \meta{cmd} which must be a control
5165 % sequence.
5166 %\changes{2.0}{2025-11-24}{changed to document command}
5167 % \begin{macrocode}
5168 \NewDocumentCommand \getstaticid { m m }
5169 {
5170 \__flowfram_get_static_id:e { #2 }
5171 \tl_set:Ne #1 { \int_use:N \l__flowfram_id_int }
5172 }
5173 % \end{macrocode}
5174 %\end{macro}
5175 %
5176 %\begin{macro}{\@staticframeid}
5177 % Work out the \gls{idn} of the \gls{static} with the
5178 % given label. This iterates through each \gls{static},
5179 % so if there are a lot of \glspl{static}, it may take a while.
5180 % The \gls{idn} stored in "\l__flowfram_id_int".
5181 %Version 2.0 renamed \cs{@staticframeid}.
5182 %\changes{2.0}{2025-11-24}{renamed}
5183 % \begin{macrocode}
5184 \cs_new:Nn \__flowfram_get_static_id:n
5185 {
5186 \__flowfram_if_static_label_exists:nF { #1 }
5187 {
5188 \__flowfram_error:eee { label-undefined } { #1 } { static }
5189 }
5190 }
5191 \cs_generate_variant:Nn \__flowfram_get_static_id:n { e, V }
5192 % \end{macrocode}
5193 %\end{macro}
5194 %
5195 % \begin{macrocode}
5196 \prg_new_conditional:Nnn \__flowfram_if_static_label_exists:n
5197 { TF , T , F }
5198 {
5199 \__flowfram_if_frame_label_exists:nnNTF
5200 { static } { #1 } \l__flowfram_id_int
5201 { \prg_return_true: }
5202 { \prg_return_false: }
5203 }
5204 % \end{macrocode}
5205 %
5206 % Make it easier to get the x and y values for static
5207 % frames.
5208 %\begin{macro}{\staticframex}
5209 % \begin{macrocode}
5210 \newcommand*{\staticframex}[1]{%
5211 \flowfram_frame_use_dim:nnn { static } { posx } { #1 }
5212 }
5213 % \end{macrocode}
5214 %\end{macro}
5215 %\begin{macro}{\staticframey}
5216 % \begin{macrocode}
5217 \newcommand*{\staticframey}[1]{%
5218 \flowfram_frame_use_dim:nnn { static } { posy } { #1 }
5219 }
5220 % \end{macrocode}
5221 %\end{macro}
5222 %\begin{macro}{\staticframeevenx}
5223 % \begin{macrocode}
5224 \newcommand*{\staticframeevenx}[1]{%
5225 \flowfram_frame_use_dim:nnn { static } { evenx } { #1 }
5226 }
5227 % \end{macrocode}
5228 %\end{macro}
5229 %\begin{macro}{\staticframeeveny}
5230 % \begin{macrocode}
5231 \newcommand*{\staticframeeveny}[1]{%
5232 \flowfram_frame_use_dim:nnn { static } { eveny } { #1 }
5233 }
5234 % \end{macrocode}
5235 %\end{macro}
5236 %
5237 %\begin{macro}{\staticframewidth}
5238 %\changes{2.0}{2025-11-24}{new}
5239 % \begin{macrocode}
5240 \newcommand*{\staticframewidth}[1]{%
5241 \flowfram_frame_use_dim:nnn { static } { width } { #1 }
5242 }
5243 % \end{macrocode}
5244 %\end{macro}
5245 %
5246 %\begin{macro}{\staticframeheight}
5247 %\changes{2.0}{2025-11-24}{new}
5248 % \begin{macrocode}
5249 \newcommand*{\staticframeheight}[1]{%
5250 \flowfram_frame_use_dim:nnn { static } { height } { #1 }
5251 }
5252 % \end{macrocode}
5253 %\end{macro}
5254 %
5255 %\begin{macro}{\setallstaticframes}
5256 % Modify the settings for all the \glspl{static}:
5257 %\changes{2.0}{2025-11-24}{changed to document command}
5258 % \begin{macrocode}
5259 \NewDocumentCommand \setallstaticframes { m }
5260 {
5261 \int_step_inline:nn { \c@maxstatic }
5262 {
5263 \__flowfram_set_static_by_idn:nn { ##1 } { #1 }
5264 }
5265 }
5266 % \end{macrocode}
5267 %\end{macro}
5268 %\begin{macro}{\setstaticframe}
5269 % Modify the settings for the specified \glspl{static}:
5270 %\changes{2.0}{2025-11-24}{changed to document command}
5271 % \begin{macrocode}
5272 \NewDocumentCommand \setstaticframe { s m m }
5273 {
5274 \IfBooleanTF { #1 }
5275 {
5276 \exp_args:Ne \clist_map_inline:nn { #2 }
5277 {
5278 \__flowfram_if_static_label_exists:nTF { ##1 }
5279 {
5280 \__flowfram_set_static_by_idn:nn { \l__flowfram_id_int } { #3 }
5281 }
5282 {
5283 \__flowfram_error:eee { label-undefined } { ##1 } { static }
5284 }
5285 }
5286 }
5287 {
5288 \__flowfram_map_idns:enn { #2 } { static }
5289 {
5290 \__flowfram_set_static_by_idn:nn { \l__flowfram_id_int } { #3 }
5291 }
5292 }
5293 }
5294 % \end{macrocode}
5295 %\end{macro}
5296 %\begin{macro}{\@ssetstaticframe}
5297 %\changes{2.0}{2025-11-24}{removed}
5298 %Version 2.0 removed \cs{@ssetstaticframe}.
5299 %\end{macro}
5300 %\begin{macro}{\@setstaticframe}
5301 %\changes{2.0}{2025-11-24}{removed}
5302 %Version 2.0 removed \cs{@setstaticframe}.
5303 %\end{macro}
5304 %\begin{macro}{\@@setstaticframe}
5305 %\changes{2.0}{2025-11-24}{renamed}
5306 % Modify the settings for the \gls{static} whose \gls{idn}
5307 % is given by the first argument.
5308 % Version 2.0 renamed \cs{@@setstaticframe}.
5309 % \begin{macrocode}
5310 \cs_new:Nn \__flowfram_set_static_by_idn:nn
5311 {
5312 \__flowfram_set_keys_for_type:nnn { #2 } { static } { #1 }
5313 % \end{macrocode}
5314 %Option specific to static frames:
5315 % \begin{macrocode}
5316 \tl_if_empty:NF \l__flowfram_clearflag_tl
5317 {
5318 \flowfram_frame_set_bool_from_option:nnnV
5319 { static } { clear } { #1 }
5320 \l__flowfram_clearflag_tl
5321 }
5322 \tl_if_empty:NF \l__flowfram_hideflag_tl
5323 {
5324 \flowfram_frame_set_bool_from_option:nnnV
5325 { static } { hide } { #1 }
5326 \l__flowfram_hideflag_tl
5327 }
5328 \tl_if_empty:NF \l__flowfram_hidethisflag_tl
5329 {
5330 \flowfram_frame_set_bool_from_option:nnnV
5331 { static } { hidethis } { #1 }
5332 \l__flowfram_hidethisflag_tl
5333 }
5334 \exp_args:NV \tl_if_novalue:nF \l__flowfram_shape_tl
5335 {
5336 \flowfram_frame_set_tl:nnnV
5337 { static } { shape } { #1 } \l__flowfram_shape_tl
5338 }
5339 \exp_args:NV \tl_if_novalue:nF \l__flowfram_parindent_tl
5340 {
5341 \flowfram_frame_set_tl:nnnV
5342 { static } { parindent } { #1 } \l__flowfram_parindent_tl
5343 }
5344 \tl_if_empty:NF \l__flowfram_valign_tl
5345 {
5346 \flowfram_frame_set_tl:nnnV
5347 { static } { valign } { #1 }
5348 \l__flowfram_valign_tl
5349 }
5350 }
5351 % \end{macrocode}
5352 %\end{macro}
5353 %
5354 %\begin{macro}{\FLFsimpar}
5355 %\changes{2.0}{2025-11-24}{new}
5356 % Simulate paragraph break inside "\shapepar".
5357 %Version 2.0: the command is now called \cs{FLFsimpar}
5358 %to reduce the chances of a name clash.
5359 % \begin{macrocode}
5360 \NewDocumentCommand \FLFsimpar { }
5361 {
5362 \hfill \newline
5363 \hspace* { \parindent }
5364 }
5365 % \end{macrocode}
5366 %\end{macro}
5367 %\begin{macro}{\simpar}
5368 %Provide old command for backward-compatibility if it doesn't clash.
5369 % \begin{macrocode}
5370 \providecommand*{\simpar}{\FLFsimpar}
5371 % \end{macrocode}
5372 %\end{macro}
5373 %\begin{macro}{\ffpshpar}
5374 % Provide means to allow parshape to be carried over a paragraph
5375 % break. Deprecated as from v2.0.
5376 % Does nothing now. Marked for removal.
5377 %\changes{2.0}{2025-11-24}{deprecated}
5378 % \begin{macrocode}
5379 \newcommand \ffpshpar { }
5380 % \end{macrocode}
5381 %\end{macro}
5382 %\begin{macro}{\FLForgpar}
5383 %Version 2.0: no longer used.
5384 %\changes{2.0}{2025-11-24}{deprecated}
5385 % \begin{macrocode}
5386 \let\FLForgpar\par
5387 % \end{macrocode}
5388 %\end{macro}
5389 %
5390 % Provide a means to have section headings within "\parshape".
5391 %\begin{macro}{\@ff@parshape}
5392 %\changes{2.0}{2025-11-24}{renamed}
5393 %Version 2.0 renamed \cs{@ff@parshape}.
5394 % \begin{macrocode}
5395 \tl_new:N \l__flowfram_parshape_tl
5396 \tl_set:Nn \l__flowfram_parshape_tl { \parshape = 0 }
5397 % \end{macrocode}
5398 %\end{macro}
5399 %
5400 %\begin{macro}{\@ff@sectionhead}
5401 % Version 2.0 removed \cs{@ff@sectionhead}.
5402 %\changes{2.0}{2025-11-24}{removed}
5403 %\end{macro}
5404 %\begin{macro}{\@s@ff@heading}
5405 % Version 2.0 removed \cs{@s@ff@heading}.
5406 %\changes{2.0}{2025-11-24}{removed}
5407 %\end{macro}
5408 %\begin{macro}{\@ff@heading}
5409 % Version 2.0 removed \cs{@ff@heading}.
5410 %\changes{2.0}{2025-11-24}{removed}
5411 %\end{macro}
5412 %
5413 % \begin{macrocode}
5414 \tl_new:N \l__flowfram_current_pre_section_tl
5415 \tl_new:N \@@flowfram@current@pre@section@title
5416 \tl_new:N \l__flowfram_current_post_section_tl
5417 % \end{macrocode}
5418 %
5419 %If a document class supports an optional argument for sectioning
5420 %units, redefine to include the second argument in square brackets.
5421 % \begin{macrocode}
5422 \cs_new:Nn \flowfram_nonum_section:Nnn
5423 {
5424 #1 * { #3 }
5425 }
5426 \cs_generate_variant:Nn \flowfram_nonum_section:Nnn { cVn }
5427 % \end{macrocode}
5428 %
5429 %\begin{macro}{\addtocontents}
5430 %\changes{2.0}{2025-11-24}{added redefinition}
5431 % \begin{macrocode}
5432 \renewcommand \addtocontents [2]
5433 {
5434 \protected@write \@auxout
5435 {
5436 \let \label \@gobble@om
5437 \let \index \@gobble@som
5438 \let \glossary \@gobble@om
5439 \let \@@flowfram@current@pre@section@title \empty
5440 \let \theFramePageCounter \relax
5441 }
5442 {
5443 \string \@writefile { #1 } { #2 }
5444 }
5445 }
5446 % \end{macrocode}
5447 %\end{macro}
5448 %
5449 %\begin{macro}{\FlowFramSectionUnit}
5450 %Do the original sectioning command but take into account the
5451 %current paragraph shape and thumb tab settings. This has an extra
5452 %optional argument for the thumbtab title. NB memoir also has an
5453 %extra optional argument for the header so include option to allow
5454 %for this. The KOMA-Script classes now support a key=value optional
5455 %argument, so also need an option to allow for that.
5456 % \begin{macrocode}
5457 \bool_new:N \l__flowfram_starred_section_bool
5458 \tl_new:N \l__flowfram_section_thumbtab_title_tl
5459 \NewDocumentCommand \FlowFramSectionUnit { m s o o m }
5460 {
5461 \tl_clear:N \l__flowfram_section_toc_tl
5462 \tl_clear:N \l__flowfram_section_head_tl
5463 \tl_clear:N \l__flowfram_section_opti_tl
5464 \tl_clear:N \l__flowfram_section_optii_tl
5465 \tl_clear:N \l__flowfram_section_thumbtab_title_tl
5466 \cs_if_exist:cTF { __flowfram_org_ #1 : }
5467 {
5468 % \end{macrocode}
5469 %Do initial hook.
5470 % \begin{macrocode}
5471 \l__flowfram_current_pre_section_tl
5472 % \end{macrocode}
5473 %Initialise header and toc variables:
5474 % \begin{macrocode}
5475 \IfValueTF { #3 }
5476 {
5477 \tl_if_empty:nTF { #3 }
5478 {
5479 \tl_set:Nn \l__flowfram_section_opti_tl { #5 }
5480 \tl_set:Nn \l__flowfram_section_toc_tl { #5 }
5481 }
5482 {
5483 \tl_set:Nn \l__flowfram_section_opti_tl { #3 }
5484 \tl_set:Nn \l__flowfram_section_toc_tl { #3 }
5485 }
5486 \bool_if:NT \l__flowfram_section_keyval_opt_bool
5487 {
5488 % \end{macrocode}
5489 %The first optional argument may be a key=value list.
5490 % \begin{macrocode}
5491 \tl_if_in:NnT = { #3 }
5492 {
5493 \keys_set_known:nn { flowfram / section } { #3 }
5494 }
5495 }
5496 }
5497 {
5498 \tl_set:Nn \l__flowfram_section_opti_tl { #5 }
5499 }
5500 \tl_if_empty:NT \l__flowfram_section_toc_tl
5501 {
5502 \tl_set:Nn \l__flowfram_section_toc_tl { #5 }
5503 }
5504 \IfValueT { #4 }
5505 {
5506 % \end{macrocode}
5507 % Second optional argument has been provided.
5508 % \begin{macrocode}
5509 \bool_if:NT \l__flowfram_section_header_opt_bool
5510 {
5511 % \end{macrocode}
5512 % Second optional argument should be passed to original command.
5513 % \begin{macrocode}
5514 \tl_set:Nn \l__flowfram_section_optii_tl { #4 }
5515 }
5516 \bool_if:NTF \l__flowfram_section_header_opt_thumbtab_bool
5517 {
5518 % \end{macrocode}
5519 % Second optional argument should be used as the thumbtab title.
5520 % \begin{macrocode}
5521 \tl_set:Nn \l__flowfram_section_thumbtab_title_tl { #4 }
5522 }
5523 {
5524 \tl_set_eq:NN
5525 \l__flowfram_section_thumbtab_title_tl
5526 \l__flowfram_section_toc_tl
5527 }
5528 }
5529 \tl_if_empty:NT \l__flowfram_section_head_tl
5530 {
5531 \tl_set_eq:NN
5532 \l__flowfram_section_head_tl
5533 \l__flowfram_section_toc_tl
5534 }
5535 \tl_if_empty:NT \l__flowfram_section_thumbtab_title_tl
5536 {
5537 \tl_set_eq:NN
5538 \l__flowfram_section_thumbtab_title_tl
5539 \l__flowfram_section_head_tl
5540 }
5541 % \end{macrocode}
5542 %Starred?
5543 % \begin{macrocode}
5544 \IfBooleanTF { #2 }
5545 {
5546 \bool_set_true:N \l__flowfram_starred_section_bool
5547 \__flowfram_if_df_chapter:nTF { #1 }
5548 {
5549 % \end{macrocode}
5550 %Ensure arguments are expanded in case they contain placeholder
5551 %commands, such as \cs{glossarytitle}.
5552 % \begin{macrocode}
5553 \exp_args:Nee
5554 \__flowfram_df_chapter_star:nn
5555 { \l__flowfram_section_opti_tl }
5556 { #5 }
5557 }
5558 {
5559 \flowfram_nonum_section:cVn
5560 { __flowfram_org_ #1 : }
5561 \l__flowfram_section_opti_tl
5562 {
5563 \@@flowfram@current@pre@section@title
5564 #5
5565 }
5566 }
5567 }
5568 {
5569 \bool_set_false:N \l__flowfram_starred_section_bool
5570 \__flowfram_if_df_chapter:nTF { #1 }
5571 {
5572 % \end{macrocode}
5573 %Ensure arguments are expanded in case they contain placeholder
5574 %commands, such as \cs{glossarytitle}.
5575 % \begin{macrocode}
5576 \tl_if_empty:NTF \l__flowfram_section_optii_tl
5577 {
5578 \exp_args:Nee
5579 \__flowfram_df_chapter:nn
5580 { \l__flowfram_section_opti_tl }
5581 { #5 }
5582 }
5583 {
5584 \exp_args:Neee
5585 \__flowfram_df_chapter:nnn
5586 { \l__flowfram_section_opti_tl }
5587 { \l__flowfram_section_optii_tl }
5588 { #5 }
5589 }
5590 }
5591 {
5592 \__flowfram_use_original_sec:cVVn
5593 { __flowfram_org_ #1 : }
5594 \l__flowfram_section_opti_tl
5595 \l__flowfram_section_optii_tl
5596 { #5 }
5597 }
5598 }
5599 \cs_if_exist:cF { __flowfram_org_end_ #1 : }
5600 {
5601 \__flowfram_post_section_unit:n { #1 }
5602 }
5603 \l__flowfram_current_post_section_tl
5604 }
5605 {
5606 \msg_error:nne { flowfram } { unknown-heading-cmd }
5607 { #1 }
5608 }
5609 \@afterheading
5610 }
5611 % \end{macrocode}
5612 %\end{macro}
5613 %Use original section command:
5614 % \begin{macrocode}
5615 \cs_new:Nn \__flowfram_use_original_sec:Nnnn
5616 {
5617 \tl_if_empty:nTF { #3 }
5618 {
5619 #1 [ #2 ]
5620 {
5621 \@@flowfram@current@pre@section@title
5622 #4
5623 }
5624 }
5625 {
5626 #1 [ #2 ] [ #3 ]
5627 {
5628 \@@flowfram@current@pre@section@title
5629 #4
5630 }
5631 }
5632 }
5633 \cs_generate_variant:Nn \__flowfram_use_original_sec:Nnnn
5634 { cVVn , cVnn , cnnn }
5635 % \end{macrocode}
5636 % \begin{macrocode}
5637 \cs_new:Nn \__flowfram_post_section_unit:n
5638 {
5639 % \end{macrocode}
5640 % Add thumbtab if applicable.
5641 % \begin{macrocode}
5642 \__flowfram_add_thumbtab:n { #1 }
5643 % \end{macrocode}
5644 %Do minitoc if supported.
5645 % \begin{macrocode}
5646 \bool_if:NF \l__flowfram_starred_section_bool
5647 {
5648 \__flowfram_minitoc_post_section_unit:n { #1 }
5649 }
5650 }
5651 % \end{macrocode}
5652 %Does nothing until redefined by \cs{enablethumbtabs}:
5653 % \begin{macrocode}
5654 \cs_new:Nn \__flowfram_add_thumbtab:n { }
5655 \cs_new:Nn \__flowfram_actual_add_thumbtab:n
5656 {
5657 \tl_if_eq:eeT \g__flowfram_thumbtab_type_tl { #1 }
5658 {
5659 \bool_if:NTF \l__flowfram_starred_section_bool
5660 {
5661 \__flowfram_ttb_nonum:n { \l__flowfram_section_thumbtab_title_tl }
5662 }
5663 {
5664 \flowfram_if_mainmatter:TF
5665 {
5666 \__flowfram_ttb_num:n
5667 { \l__flowfram_section_thumbtab_title_tl }
5668 }
5669 {
5670 \__flowfram_ttb_notmainmatter_num:n
5671 { \l__flowfram_section_thumbtab_title_tl }
5672 }
5673 }
5674 }
5675 }
5676 % \end{macrocode}
5677 %Hook for minitocs (redefined by \cs{enableminitoc}):
5678 % \begin{macrocode}
5679 \cs_new:Nn \__flowfram_minitoc_post_section_unit:n
5680 {
5681 }
5682 % \end{macrocode}
5683 %
5684 %Adjust sectioning commands definitions.
5685 % \begin{macrocode}
5686 \cs_new:Nn \__flowfram_provide_section_unit:n
5687 {
5688 \cs_if_exist:cT { #1 }
5689 {
5690 \cs_set_eq:cc { __flowfram_org_ #1 : } { #1 }
5691 \cs_set:cpn { #1 }
5692 {
5693 \FlowFramSectionUnit { #1 }
5694 }
5695 % \end{macrocode}
5696 % For parts in books or reports, the thumbtab needs to be
5697 % saved after the part counter has been incremented, but
5698 % before the page break so that the page number and part
5699 % numbers are correct. If "\@endpart" is not defined, then
5700 % the document class probably does not start a new page after
5701 % "\part". (This can't be guaranteed for non standard class
5702 % files, but there's nothing that can be done about that.)
5703 % \begin{macrocode}
5704 \cs_if_exist:cT { @end #1 }
5705 {
5706 \cs_set_eq:cc { __flowfram_org_end_ #1 : } { @end #1 }
5707 \cs_set:cpn { @end #1 }
5708 {
5709 \__flowfram_post_section_unit:n { #1 }
5710 \use:c { __flowfram_org_end_ #1 : }
5711 }
5712 }
5713 }
5714 }
5715 \__flowfram_provide_section_unit:n { part }
5716 \__flowfram_provide_section_unit:n { chapter }
5717 \__flowfram_provide_section_unit:n { section }
5718 \__flowfram_provide_section_unit:n { subsection }
5719 \__flowfram_provide_section_unit:n { subsubsection }
5720 \__flowfram_provide_section_unit:n { paragraph }
5721 \__flowfram_provide_section_unit:n { subparagraph }
5722 % \end{macrocode}
5723 %
5724 %\begin{macro}{\@ff@setsecthead}
5725 % Define command to switch to adjusted section headings:
5726 % Version 2.0 renamed \cs{@ff@setsecthead}.
5727 %\changes{2.0}{2025-11-24}{renamed}
5728 % \begin{macrocode}
5729 \cs_new:Nn \__flowfram_set_shaped_section_headings:
5730 {
5731 \tl_set:Nn \l__flowfram_current_pre_section_tl
5732 {
5733 \FLFsimpar
5734 \begin { minipage } { \linewidth }
5735 \let \par \endgraf
5736 }
5737 \tl_set:Nn \l__flowfram_current_post_section_tl
5738 {
5739 \end { minipage }
5740 \FLFsimpar
5741 }
5742 }
5743 % \end{macrocode}
5744 %\end{macro}
5745 %\begin{macro}{\@ff@getshape}
5746 %\changes{2.0}{2025-11-24}{renamed}
5747 % Determine what shape command is being used:
5748 % Version 2.0 renamed \cs{@ff@getshape}.
5749 % \begin{macrocode}
5750 \cs_new:Nn \__flowfram_get_shape:n
5751 {
5752 \tl_if_head_eq_meaning:nNTF { #1 } \parshape
5753 {
5754 \int_set_eq:NN
5755 \l__flowfram_shape_int
5756 \c_flowfram_shape_type_parshape_int
5757 }
5758 {
5759 \tl_if_head_eq_meaning:nNTF { #1 } \shapepar
5760 {
5761 \int_set_eq:NN
5762 \l__flowfram_shape_int
5763 \c_flowfram_shape_type_shapepar_int
5764 }
5765 {
5766 \tl_if_head_eq_meaning:nNTF { #1 } \Shapepar
5767 {
5768 \int_set_eq:NN
5769 \l__flowfram_shape_int
5770 \c_flowfram_shape_type_shapepar_int
5771 }
5772 {
5773 \tl_if_head_eq_meaning:nNTF { #1 } \relax
5774 {
5775 \int_set_eq:NN
5776 \l__flowfram_shape_int
5777 \c_flowfram_shape_type_none_int
5778 }
5779 {
5780 \msg_error:nnn { flowfram } { unknown-shape } { #1 }
5781 \int_set_eq:NN
5782 \l__flowfram_shape_int
5783 \c_flowfram_shape_type_shapepar_int
5784 }
5785 }
5786 }
5787 }
5788 }
5789 \cs_generate_variant:Nn \__flowfram_get_shape:n { V }
5790 % \end{macrocode}
5791 %\end{macro}
5792 %
5793 % \begin{macrocode}
5794 \cs_new:Nn \__flowfram_disabled_sec:NN
5795 {
5796 \msg_error:nnnn { flowfram } { forbidden-cmd-in-shape } { #1 } { #2 }
5797 \@gobble@som
5798 }
5799 % \end{macrocode}
5800 %
5801 %\begin{macro}{\@ff@disablesec}
5802 % Disable sectioning commands
5803 % \begin{macrocode}
5804 \newcommand*{\@ff@disablesec}{%
5805 \def\section{
5806 \__flowfram_disabled_sec:NN \section \shapepar
5807 }
5808 \def\subsection{
5809 \__flowfram_disabled_sec:NN \subsection \shapepar
5810 }
5811 \def\subsubsection{
5812 \__flowfram_disabled_sec:NN \subsubsection \shapepar
5813 }
5814 \def\paragraph{
5815 \__flowfram_disabled_sec:NN \paragraph \shapepar
5816 }
5817 \def\subparagraph{
5818 \__flowfram_disabled_sec:NN \subparagraph \shapepar
5819 }
5820 }
5821 % \end{macrocode}
5822 %\end{macro}
5823 %
5824 %\begin{environment}{staticcontents}
5825 % Set the contents of the \gls{static} given by its \gls{idn}.
5826 % Syntax: "\begin{staticcontents}"\marg{idn}.
5827 %\changes{2.0}{2025-11-24}{changed to document environment}
5828 %Version 2.0 added optional argument to also set frame options at
5829 %the same time. (All settings are global so this shouldn't be
5830 %localised by the environment.)
5831 % \begin{macrocode}
5832 \newbox\staticframe
5833 \NewDocumentEnvironment { staticcontents } { o m }
5834 {
5835 \IfValueT { #1 }
5836 {
5837 \__flowfram_set_static_by_idn:nn { #2 } { #1 }
5838 }
5839 \RenewDocumentCommand \continueonframe { o m }
5840 {
5841 \__flowfram_static_continue_idn:nn { ##1 } { ##2 }
5842 }
5843 \__flowfram_static_contents_begin:n { #2 }
5844 }
5845 {
5846 \__flowfram_static_contents_end:
5847 \ignorespacesafterend
5848 }
5849 % \end{macrocode}
5850 %\end{environment}
5851 %\begin{environment}{staticcontents*}
5852 % Set the contents of the \gls{static} given by its \gls{idl}.
5853 % Syntax: "\begin{staticcontents*}"\marg{label}.
5854 %Version 2.0 added optional argument to also set frame options at
5855 %the same time. (All settings are global so this shouldn't be
5856 %localised by the environment.)
5857 %\changes{2.0}{2025-11-24}{changed to document environment}
5858 % \begin{macrocode}
5859 \NewDocumentEnvironment { staticcontents* } { o m }
5860 {
5861 \__flowfram_get_static_id:n { #2 }
5862 \IfValueT { #1 }
5863 {
5864 \__flowfram_set_static_by_idn:nn
5865 { \l__flowfram_id_int }
5866 { #1 }
5867 }
5868 \RenewDocumentCommand \continueonframe { o m }
5869 {
5870 \__flowfram_static_continue_idl:nn { ##1 } { ##2 }
5871 }
5872 \__flowfram_static_contents_begin:n { \l__flowfram_id_int }
5873 }
5874 {
5875 \__flowfram_static_contents_end:
5876 \ignorespacesafterend
5877 }
5878 % \end{macrocode}
5879 %\end{environment}
5880 %
5881 %\begin{macro}{\@beginstaticcontents}
5882 %\changes{2.0}{2025-11-24}{renamed}
5883 % Begin staticcontents stuff.
5884 %Version 2.0 renamed \cs{@beginstaticcontents}.
5885 % \begin{macrocode}
5886 \cs_new:Nn \__flowfram_static_contents_begin:n
5887 {
5888 \int_zero:N \l__flowfram_current_static_int
5889 \box_if_exist:cTF
5890 { g__flowfram_static_content_ \romannumeral #1 _box }
5891 {
5892 \int_set:Nn \l__flowfram_current_static_int { #1 }
5893 \tl_set:Ne \l__flowfram_minipage_tl
5894 {
5895 \exp_not:N \begin { minipage }
5896 [ c ]
5897 [
5898 \staticframeheight { #1 }
5899 ]
5900 [
5901 \flowfram_frame_use_tl:nnn
5902 { static } { valign } { #1 }
5903 ]
5904 {
5905 \staticframewidth { #1 }
5906 }
5907 }
5908 \flowfram_set_tl_to_frame_tl:Nnnn
5909 \l__flowfram_parindent_tl
5910 { static } { parindent } { #1 }
5911 \flowfram_set_tl_to_frame_tl:Nnnn
5912 \l__flowfram_parshape_tl
5913 { static } { shape } { #1 }
5914 \__flowfram_get_shape:V \l__flowfram_parshape_tl
5915 \int_case:nnF { \l__flowfram_shape_int }
5916 {
5917 { \c_flowfram_shape_type_none_int }
5918 % \end{macrocode}
5919 % No shape (nothing extra to do)
5920 % \begin{macrocode}
5921 { }
5922 { \c_flowfram_shape_type_parshape_int }
5923 {
5924 % \end{macrocode}
5925 % \cs{parshape}:
5926 % \begin{macrocode}
5927 \tl_put_right:NV
5928 \l__flowfram_minipage_tl
5929 \l__flowfram_parshape_tl
5930 \tl_put_right:Nn \l__flowfram_minipage_tl
5931 {
5932 \let \par \FLFsimpar
5933 \__flowfram_set_shaped_section_headings:
5934 }
5935 }
5936 }
5937 {
5938 % \end{macrocode}
5939 % \cs{shapepar} or \cs{Shapepar}:
5940 % \begin{macrocode}
5941 \tl_put_right:Nn \l__flowfram_minipage_tl
5942 {
5943 \@ff@disablesec
5944 }
5945 \tl_put_right:NV
5946 \l__flowfram_minipage_tl
5947 \l__flowfram_parshape_tl
5948 }
5949 \UseHook { flowfram / staticbox / before }
5950 \begin { lrbox } { \staticframe }
5951 \flowfram_set_tl_to_frame_tl:Nnnn
5952 \l__flowfram_textcolor_tl
5953 { static } { textcolor } { #1 }
5954 \__flowfram_set_text_color:
5955 \noindent
5956 \l__flowfram_minipage_tl
5957 \dim_set:Nn \parindent { \l__flowfram_parindent_tl }
5958 }
5959 {
5960 \msg_error:nnnn { flowfram } { idn-undefined } { static } { #1 }
5961 }
5962 }
5963 % \end{macrocode}
5964 %\end{macro}
5965 %
5966 %Hooks used before and after lrbox environment when static contents
5967 %are set. Since the box is set within the \env{staticcontents} or
5968 %\env{staticcontents*} environments, it will be within a scoped
5969 %context.
5970 % \begin{macrocode}
5971 \NewMirroredHookPair
5972 { flowfram / staticbox / before }
5973 { flowfram / staticbox / after }
5974 % \end{macrocode}
5975 %
5976 %\begin{macro}{\@endstaticcontents}
5977 %\changes{2.0}{2025-11-24}{renamed}
5978 % End staticcontents stuff.
5979 % Version 2.0 renamed \cs{@endstaticcontents}.
5980 % \begin{macrocode}
5981 \cs_new:Nn \__flowfram_static_contents_end:
5982 {
5983 \int_if_zero:nF { \l__flowfram_current_static_int }
5984 {
5985 \endgraf
5986 % \end{macrocode}
5987 %Grouping has been removed as it interferes with \cs{shapepar} but
5988 %the environment already provides scoping.
5989 % \begin{macrocode}
5990 \end { minipage }
5991 \end { lrbox }
5992 \UseHook { flowfram / staticbox / after }
5993 \flowfram_frame_set_box_eq:nnnN
5994 { static } { content } { \l__flowfram_current_static_int }
5995 \staticframe
5996 }
5997 }
5998 % \end{macrocode}
5999 %\end{macro}
6000 %
6001 %\begin{macro}{\setstaticcontents}
6002 % Provide a command version.
6003 % Syntax: \cs{setstaticcontents}\oarg{options}\marg{idn}\marg{text}.
6004 %\changes{2.0}{2025-11-24}{changed to document command}
6005 %Version 2.0 added optional argument to also set frame options at
6006 %the same time.
6007 % \begin{macrocode}
6008 \NewDocumentCommand \setstaticcontents { s o m +m }
6009 {
6010 \IfBooleanTF { #1 }
6011 {
6012 \__flowfram_get_static_id:n { #3 }
6013 \IfValueT { #2 }
6014 {
6015 \__flowfram_set_static_by_idn:nn
6016 { \l__flowfram_id_int }
6017 { #2 }
6018 }
6019 \begin { staticcontents } { \l__flowfram_id_int }
6020 #4
6021 \end { staticcontents }
6022 }
6023 {
6024 \IfValueT { #2 }
6025 {
6026 \__flowfram_set_static_by_idn:nn { #3 } { #2 }
6027 }
6028 \begin { staticcontents } { #3 }
6029 #4
6030 \end { staticcontents }
6031 }
6032 }
6033 % \end{macrocode}
6034 %\end{macro}
6035 %
6036 %\begin{macro}{\@sstaticconts}
6037 %Version 2.0 removed \cs{@sstaticconts}.
6038 %\end{macro}
6039 %\begin{macro}{\@staticconts}
6040 %Version 2.0 removed \cs{@staticconts}.
6041 %\end{macro}
6042 %
6043 %\begin{macro}{\staticsetpagelist}
6044 % Sets the page list for the \gls{static} given by "#1" (the
6045 % \gls{idn}).
6046 %\changes{1.14}{2012-11-10}{new}
6047 %\changes{2.0}{2025-11-24}{changed to document command}
6048 % \begin{macrocode}
6049 \NewDocumentCommand \staticsetpagelist { m m }
6050 {
6051 \flowfram_set_frame_pagelist:nne { static } { #1 } { #2 }
6052 }
6053 % \end{macrocode}
6054 %\end{macro}
6055 %\begin{macro}{\staticsetexclusion}
6056 % Sets the exclusion list for the \gls{static} given by "#1" (the
6057 % \gls{idn}).
6058 %\changes{1.14}{2012-11-10}{new}
6059 %\changes{2.0}{2025-11-24}{changed to document command}
6060 % \begin{macrocode}
6061 \NewDocumentCommand \staticsetexclusion { m m }
6062 {
6063 \flowfram_set_frame_excludelist:nne { static } { #1 } { #2 }
6064 }
6065 % \end{macrocode}
6066 %\end{macro}
6067 %\begin{macro}{\staticaddexclusion}
6068 % Adds to the exclusion list for the \gls{static} given by "#1" (the
6069 % \gls{idn}).
6070 %\changes{1.14}{2012-11-10}{new}
6071 %\changes{2.0}{2025-11-24}{changed to document command}
6072 % \begin{macrocode}
6073 \NewDocumentCommand \staticaddexclusion { m m }
6074 {
6075 \flowfram_concat_frame_excludelist:nne
6076 { static } { #1 } { #2 }
6077 }
6078 % \end{macrocode}
6079 %\end{macro}
6080 %
6081 %\begin{macro}{\@@staticframeswapcoords}
6082 %\changes{2.0}{2025-11-24}{removed}
6083 %Version 2.0 removed \cs{@@staticframeswapcoords}.
6084 %\end{macro}
6085 %\begin{macro}{\sfswapoddeven}
6086 % Swap odd and even offsets for a given \gls{static}.
6087 % Allow user to specify \gls{static} either by \gls{idn} or \gls{idl}:
6088 % \begin{macrocode}
6089 \NewDocumentCommand \sfswapoddeven { s m }
6090 {
6091 \IfValueTF { #1 }
6092 {
6093 \exp_args:Ne \clist_map_inline:nn { #2 }
6094 {
6095 \__flowfram_get_static_id:n { ##1 }
6096 \__flowfram_static_swap_coords:n { \l__flowfram_id_int }
6097 }
6098 }
6099 {
6100 \__flowfram_map_idns:enn { #2 } { static }
6101 {
6102 \__flowfram_static_swap_coords:n { \l__flowfram_id_int }
6103 }
6104 }
6105 }
6106 % \end{macrocode}
6107 %\end{macro}
6108 %\begin{macro}{\@sstaticframeswapcoords}
6109 %\changes{2.0}{2025-11-24}{removed}
6110 % Version 2.0 removed \cs{@sstaticframeswapcoords}.
6111 %\end{macro}
6112 %\begin{macro}{\@staticframeswapcoords}
6113 %\changes{2.0}{2025-11-24}{renamed}
6114 % Version 1.18 renamed \cs{@staticframeswapcoords}.
6115 % \begin{macrocode}
6116 \cs_new:Nn \__flowfram_static_swap_coords:n
6117 {
6118 \flowfram_frame_swap_dim:nnnn
6119 { static } { posx } { evenx } { #1 }
6120 \flowfram_frame_swap_dim:nnnn
6121 { static } { posy } { eveny } { #1 }
6122 }
6123 % \end{macrocode}
6124 %\end{macro}
6125 %
6126 %\begin{macro}{\continueonframe}
6127 % \cs{continueonframe}\oarg{text}\marg{id}
6128 % Ends current \env{staticcontents} or \env{dynamiccontents}
6129 % environment and starts environment of the same type for frame
6130 % given by \meta{id}. Can only be used inside \env{staticcontents}
6131 % or \env{dynamiccontents} environments. If the starred version of
6132 % the environment is used, \marg{id} refers to the \gls{idl}, otherwise
6133 % it refers to the \gls{idn} of the new frame.
6134 % Version 2.0 now allows \cs{continueonframe} in
6135 % \cs{setdynamiccontents} but not in
6136 % \cs{appenddynamiccontents}.
6137 %\changes{2.0}{2025-11-24}{changed to document command}
6138 % \begin{macrocode}
6139 \NewDocumentCommand \continueonframe { O{} m }
6140 {
6141 \msg_error:nn { flowfram } { cant-continue }
6142 }
6143 % \end{macrocode}
6144 %\end{macro}
6145 % \cs{@scontinueonframe} and \cs{@continueonframe} are set
6146 % by \env{staticcontents} and \env{dynamiccontents} environments
6147 % (and their starred forms).
6148 %
6149 %\begin{macro}{\@staticscontinueonframe}
6150 % Static starred version uses \gls{idl}
6151 %\changes{2.0}{2025-11-24}{renamed}
6152 %Version 2.0 replaced \cs{@staticscontinueonframe}.
6153 % \begin{macrocode}
6154 \cs_new:Nn \__flowfram_static_continue_idl:nn
6155 {
6156 \IfValueTF { #1 }
6157 {
6158 \ffcontinuedtextlayout { #1 }
6159 }
6160 {
6161 \ffcontinuedtextlayout
6162 {
6163 \flowfram_continue_on_static_frame_idl:Nn
6164 \l__flowfram_current_static_int
6165 { #2 }
6166 }
6167 }
6168 \exp_args:NnNV
6169 \end { staticcontents* }
6170 \__flowfram_set_post_continued:nnn
6171 \l__flowfram_current_static_int
6172 { \l__flowfram_current_static_int }
6173 { \c_flowfram_frame_type_static_int }
6174 \tl_put_left:Nn \l__flowfram_postcontinued_tl
6175 { \begin { staticcontents* } { #2 } }
6176 \l__flowfram_postcontinued_tl
6177 }
6178 % \end{macrocode}
6179 %\end{macro}
6180 %\begin{macro}{\@staticcontinueonframe}
6181 % Static unstarred version uses \gls{idn}
6182 %\changes{2.0}{2025-11-24}{renamed}
6183 %Version 2.0 replaced \cs{@staticcontinueonframe}.
6184 % \begin{macrocode}
6185 \cs_new:Nn \__flowfram_static_continue_idn:nn
6186 {
6187 \IfValueTF { #1 }
6188 {
6189 \ffcontinuedtextlayout { #1 }
6190 }
6191 {
6192 \ffcontinuedtextlayout
6193 {
6194 \flowfram_continue_on_static_frame_idn:Nn
6195 \l__flowfram_current_static_int
6196 { #2 }
6197 }
6198 }
6199 \exp_args:NnNV
6200 \end { staticcontents }
6201 \__flowfram_set_post_continued:nnn
6202 \l__flowfram_current_static_int
6203 { \l__flowfram_current_static_int }
6204 { \c_flowfram_frame_type_static_int }
6205 \tl_put_left:Nn \l__flowfram_postcontinued_tl
6206 { \begin { staticcontents } { #1 } }
6207 \l__flowfram_postcontinued_tl
6208 }
6209 % \end{macrocode}
6210 %\end{macro}
6211 %
6212 % \begin{macrocode}
6213 \tl_new:N \l__flowfram_postcontinued_tl
6214 \cs_new:Nn \__flowfram_set_post_continued:nnn
6215 {
6216 \int_case:nnF { #3 }
6217 {
6218 { \c_flowfram_frame_type_static_int }
6219 {
6220 \tl_set:Nn \l__flowfram_postcontinued_tl
6221 {
6222 \ffstaticpostcontinued { #1 } { #2 }
6223 }
6224 }
6225 { \c_flowfram_frame_type_dynamic_int }
6226 {
6227 \tl_set:Nn \l__flowfram_postcontinued_tl
6228 {
6229 \ffdynamicpostcontinued { #1 } { #2 }
6230 }
6231 }
6232 }
6233 {
6234 \tl_clear:N \l__flowfram_postcontinued_tl
6235 }
6236 }
6237 % \end{macrocode}
6238 %
6239 % \begin{macrocode}
6240 \cs_new:Nn \flowfram_continue_on_static_frame_idn:Nn
6241 {
6242 \ffdefaultstaticcontinuetext { #1 } { #2 }
6243 }
6244 % \end{macrocode}
6245 %
6246 %The first argument is the IDN of the current frame and the second
6247 %is the label of the next frame.
6248 % \begin{macrocode}
6249 \cs_new:Nn \flowfram_continue_on_static_frame_idl:Nn
6250 {
6251 \__flowfram_get_static_id:n { #2 }
6252 \flowfram_continue_on_static_frame_idn:Nn #1 { \l__flowfram_id_int }
6253 }
6254 % \end{macrocode}
6255 %
6256 %\begin{macro}{\ffdefaultstaticcontinuetext}
6257 %\changes{2.0}{2025-11-24}{new}
6258 % \begin{macrocode}
6259 \newcommand \ffdefaultstaticcontinuetext [ 2 ] { \ffdefaultcontinuetext }
6260 % \end{macrocode}
6261 %\end{macro}
6262 %
6263 %\begin{macro}{\ffdefaultdynamiccontinuetext}
6264 %\changes{2.0}{2025-11-24}{new}
6265 % \begin{macrocode}
6266 \newcommand \ffdefaultdynamiccontinuetext [ 2 ] { \ffdefaultcontinuetext }
6267 % \end{macrocode}
6268 %\end{macro}
6269 %
6270 %\begin{macro}{\ffdefaultcontinuetext}
6271 %\changes{2.0}{2025-11-24}{new}
6272 % \begin{macrocode}
6273 \newcommand \ffdefaultcontinuetext { }
6274 % \end{macrocode}
6275 %\end{macro}
6276 %
6277 %\begin{macro}{\ffstaticpostcontinued}
6278 %\changes{2.0}{2025-11-24}{new}
6279 % \begin{macrocode}
6280 \newcommand \ffstaticpostcontinued [ 2 ]
6281 {
6282 \ffdefaultpostcontinued
6283 }
6284 % \end{macrocode}
6285 %\end{macro}
6286 %
6287 %\begin{macro}{\ffdynamicpostcontinued}
6288 %\changes{2.0}{2025-11-24}{new}
6289 % \begin{macrocode}
6290 \newcommand \ffdynamicpostcontinued [ 2 ]
6291 {
6292 \ffdefaultpostcontinued
6293 }
6294 % \end{macrocode}
6295 %\end{macro}
6296 %
6297 %\begin{macro}{\ffdefaultpostcontinued}
6298 %\changes{2.0}{2025-11-24}{new}
6299 %\begin{definition}
6300 %\cs{ffdefaultpostcontinued}
6301 %\end{definition}
6302 %Hook for start of next frame:
6303 % \begin{macrocode}
6304 \newcommand{\ffdefaultpostcontinued}{%
6305 \par
6306 \noindent
6307 \ignorespaces
6308 }
6309 % \end{macrocode}
6310 %\end{macro}
6311 %\begin{macro}{\ffcontinuedtextlayout}
6312 %Displays the continued text used by \cs{continueonframe}.
6313 % \begin{macrocode}
6314 \newcommand{\ffcontinuedtextlayout}[1]{%
6315 \group_begin:
6316 \dim_zero:N \parfillskip
6317 \par
6318 \hfill
6319 \ffcontinuedtextfont { #1 }
6320 \par
6321 \group_end:
6322 }
6323 % \end{macrocode}
6324 %\end{macro}
6325 %\begin{macro}{\ffcontinuedtextfont}
6326 %Sets the font to display the continuation text used by
6327 %\cs{continueonframe}
6328 % \begin{macrocode}
6329 \newcommand*{\ffcontinuedtextfont}[1]{\emph{\small #1}}
6330 % \end{macrocode}
6331 %\end{macro}
6332 %
6333 % \subsection{Dynamic Frames}
6334 % Now deal with the \glspl{dynamic}. These are very similar
6335 % to the \glspl{static}, but instead of having a savebox,
6336 % the contents of the \gls{dynamic} are stored in a macro.
6337 %\begin{macro}{\newdynamicframe}
6338 % Syntax:\newline
6339 % \cs{newdynamicframe}\oarg{pages}\marg{width}\marg{height}\marg{x}\marg{y}\oarg{label}
6340 %\changes{2.0}{2025-11-24}{changed to document command}
6341 % \begin{macrocode}
6342 \NewDocumentCommand \newdynamicframe
6343 { s O{all} m m m m O { \int_use:N \c@maxdynamic } }
6344 {
6345 \__flowfram_new_dynamic:nnnnnn
6346 { #2 } { #3 } { #4 } { #5 } { #6 } { #7 }
6347 \IfBooleanT { #1 }
6348 {
6349 % \end{macrocode}
6350 %\changes{2.1}{2026-02-23}{corrected function name}
6351 % \begin{macrocode}
6352 \flowfram_frame_set_bool_true:nnn
6353 { dynamic } { hasframe } { \c@maxdynamic }
6354 }
6355 }
6356 % \end{macrocode}
6357 %\end{macro}
6358 %
6359 % \begin{macrocode}
6360 \cs_new:Nn \__flowfram_new_dynamic:nnnnn
6361 {
6362 \__flowfram_new_dynamic:nnnnnn
6363 { #1 } { #2 } { #3 } { #4 } { #5 } { \int_use:N \c@maxdynamic }
6364 }
6365 % \end{macrocode}
6366 %
6367 %\begin{macro}{\@n@wdynamicframe}
6368 %Version 2.0 removed \cs{@n@wdynamicframe}.
6369 %\changes{2.0}{2025-11-24}{removed}
6370 %\end{macro}
6371 %\begin{macro}{\@snewdynamicframe}
6372 %Version 2.0 removed \cs{@snewdynamicframe}.
6373 %\changes{2.0}{2025-11-24}{removed}
6374 %\end{macro}
6375 %\begin{macro}{\@newdynamicframe}
6376 %Version 2.0 removed \cs{@newdynamicframe}.
6377 %\changes{2.0}{2025-11-24}{removed}
6378 %\end{macro}
6379 %\begin{macro}{\@@newdynamicframe}
6380 % Create new \gls{dynamic}:
6381 %Version 2.0 renamed \cs{@@newdynamicframe}.
6382 %\changes{2.0}{2025-11-24}{renamed}
6383 % \begin{macrocode}
6384 \cs_new_nopar:Nn \__flowfram_new_dynamic:nnnnnn
6385 {
6386 \__flowfram_new_frame:nnnnnnn
6387 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { dynamic }
6388 % \end{macrocode}
6389 %Define content token list.
6390 % \begin{macrocode}
6391 \flowfram_frame_new_tl:nnn { dynamic } { content } { \c@maxdynamic }
6392 % \end{macrocode}
6393 %Define attributes specific to dynamic frames.
6394 % \begin{macrocode}
6395 \flowfram_frame_new_bool:nnnN
6396 { dynamic } { clear } { \c@maxdynamic } \c_false_bool
6397 \flowfram_frame_new_bool:nnnN
6398 { dynamic } { hide } { \c@maxdynamic } \c_false_bool
6399 \flowfram_frame_new_bool:nnnN
6400 { dynamic } { hidethis } { \c@maxdynamic } \c_false_bool
6401 % \end{macrocode}
6402 %Inner position argument for \cs{parbox}:
6403 % \begin{macrocode}
6404 \flowfram_frame_new_tl:nnnn
6405 { dynamic } { valign } { \c@maxdynamic } { t }
6406 % \end{macrocode}
6407 %Paragraph shaping declaration.
6408 % \begin{macrocode}
6409 \flowfram_frame_new_tl:nnnn
6410 { dynamic } { shape } { \c@maxdynamic } { \relax }
6411 % \end{macrocode}
6412 %Paragraph indentation defaults to \cs{sdfparindent}.
6413 %This is stored as a token list variable rather than a dimension to
6414 %allow it to pick up changes if \cs{sdfparindent} is changed.
6415 % \begin{macrocode}
6416 \flowfram_frame_new_tl:nnnn
6417 { dynamic } { parindent } { \c@maxdynamic } { \sdfparindent }
6418 % \end{macrocode}
6419 %Formatting style csname.
6420 % \begin{macrocode}
6421 \flowfram_frame_new_tl:nnnn
6422 { dynamic } { style } { \c@maxdynamic } { @firstofone }
6423 }
6424 % \end{macrocode}
6425 %\end{macro}
6426 %\begin{macro}{\@s@tdynamicframeid}
6427 %Version 2.0 removed \cs{@s@tdynamicframeid}.
6428 %\changes{2.0}{2025-11-24}{removed}
6429 %\end{macro}
6430 %\begin{macro}{\@df@checkuniqueidl}
6431 %\changes{2.0}{2025-11-24}{removed}
6432 %Version 2.0 removed \cs{@df@checkuniqueidl}.
6433 %\end{macro}
6434 %
6435 %\begin{macro}{\getdynamiclabel}
6436 %\changes{1.11}{2008/06/27}{new}
6437 %\cs{getdynamiclabel}\marg{idn}
6438 % Gets the \gls{idl} for the \gls{dynamic} identified by its
6439 % \gls{idn}.
6440 % \begin{macrocode}
6441 \newcommand*{\getdynamiclabel}[1]{%
6442 \flowfram_frame_use_tl:nnn { dynamic } { label } { #1 }
6443 }
6444 % \end{macrocode}
6445 %\end{macro}
6446 %
6447 %\begin{macro}{\getdynamicid}
6448 %\changes{1.11}{2008/06/27}{new}
6449 %\changes{2.0}{2025-11-24}{changed to document command}
6450 %\cs{getdynamicid}\marg{cmd}\marg{idl}
6451 % Gets the \gls{idn} for the \gls{dynamic} identified by its
6452 % \gls{idl} and stores in \meta{cmd} which must be a control
6453 % sequence.
6454 % \begin{macrocode}
6455 \NewDocumentCommand \getdynamicid { m m }
6456 {
6457 \__flowfram_get_dynamic_id:e { #2 }
6458 \tl_set:Ne #1 { \int_use:N \l__flowfram_id_int }
6459 }
6460 % \end{macrocode}
6461 %\end{macro}
6462 %
6463 %\begin{macro}{\@dynamicframeid}
6464 % Determine the \gls{idn} of the \gls{dynamic} from its label.
6465 % The \gls{idn} is stored in "\l__flowfram_id_int".
6466 %Version 2.0 renamed \cs{@dynamicframeid}.
6467 % \begin{macrocode}
6468 \cs_new:Nn \__flowfram_get_dynamic_id:n
6469 {
6470 \__flowfram_if_dynamic_label_exists:nF { #1 }
6471 {
6472 \__flowfram_error:eee { label-undefined } { #1 } { dynamic }
6473 }
6474 }
6475 \cs_generate_variant:Nn \__flowfram_get_dynamic_id:n { e, V }
6476 % \end{macrocode}
6477 %\end{macro}
6478 %
6479 % \begin{macrocode}
6480 \prg_new_conditional:Nnn \__flowfram_if_dynamic_label_exists:n
6481 { TF , T , F }
6482 {
6483 \__flowfram_if_frame_label_exists:nnNTF
6484 { dynamic } { #1 } \l__flowfram_id_int
6485 { \prg_return_true: }
6486 { \prg_return_false: }
6487 }
6488 % \end{macrocode}
6489 %
6490 % Make it easier to get the x and y values for dynamic
6491 % frames. (Width and height stored differently.)
6492 %\begin{macro}{\dynamicframex}
6493 % \begin{macrocode}
6494 \newcommand*{\dynamicframex}[1]{%
6495 \flowfram_frame_use_dim:nnn { dynamic } { posx } { #1 }
6496 }
6497 % \end{macrocode}
6498 %\end{macro}
6499 %\begin{macro}{\dynamicframey}
6500 % \begin{macrocode}
6501 \newcommand*{\dynamicframey}[1]{%
6502 \flowfram_frame_use_dim:nnn { dynamic } { posy } { #1 }
6503 }
6504 % \end{macrocode}
6505 %\end{macro}
6506 %\begin{macro}{\dynamicframeevenx}
6507 % \begin{macrocode}
6508 \newcommand*{\dynamicframeevenx}[1]{%
6509 \flowfram_frame_use_dim:nnn { dynamic } { evenx } { #1 }
6510 }
6511 % \end{macrocode}
6512 %\end{macro}
6513 %\begin{macro}{\dynamicframeeveny}
6514 % \begin{macrocode}
6515 \newcommand*{\dynamicframeeveny}[1]{%
6516 \flowfram_frame_use_dim:nnn { dynamic } { eveny } { #1 }
6517 }
6518 % \end{macrocode}
6519 %\end{macro}
6520 %
6521 %\begin{macro}{\dynamicframewidth}
6522 %\changes{2.0}{2025-11-24}{new}
6523 % \begin{macrocode}
6524 \newcommand*{\dynamicframewidth}[1]{%
6525 \flowfram_frame_use_dim:nnn { dynamic } { width } { #1 }
6526 }
6527 % \end{macrocode}
6528 %\end{macro}
6529 %
6530 %\begin{macro}{\dynamicframeheight}
6531 %\changes{2.0}{2025-11-24}{new}
6532 % \begin{macrocode}
6533 \newcommand*{\dynamicframeheight}[1]{%
6534 \flowfram_frame_use_dim:nnn { dynamic } { height } { #1 }
6535 }
6536 % \end{macrocode}
6537 %
6538 %\end{macro}
6539 %\begin{macro}{\setalldynamicframes}
6540 % Change the settings for all the \glspl{dynamic}:
6541 %\changes{2.0}{2025-11-24}{changed to document command}
6542 % \begin{macrocode}
6543 \NewDocumentCommand \setalldynamicframes { m }
6544 {
6545 \int_step_inline:nn { \c@maxdynamic }
6546 {
6547 \__flowfram_set_dynamic_by_idn:nn { ##1 } { #1 }
6548 }
6549 }
6550 % \end{macrocode}
6551 %\end{macro}
6552 %\begin{macro}{\setdynamicframe}
6553 % Change the settings for specified \glspl{dynamic}:
6554 % The starred version iterates through comma-separated list
6555 % of labels.
6556 %\changes{2.0}{2025-11-24}{changed to document command}
6557 % \begin{macrocode}
6558 \NewDocumentCommand \setdynamicframe { s m m }
6559 {
6560 \IfBooleanTF { #1 }
6561 {
6562 \exp_args:Ne \clist_map_inline:nn { #2 }
6563 {
6564 \__flowfram_if_dynamic_label_exists:nTF { ##1 }
6565 {
6566 \__flowfram_set_dynamic_by_idn:nn { \l__flowfram_id_int } { #3 }
6567 }
6568 {
6569 \__flowfram_error:eee { label-undefined } { ##1 } { dynamic }
6570 }
6571 }
6572 }
6573 {
6574 \__flowfram_map_idns:enn { #2 } { dynamic }
6575 {
6576 \__flowfram_set_dynamic_by_idn:nn { \l__flowfram_id_int } { #3 }
6577 }
6578 }
6579 }
6580 % \end{macrocode}
6581 %\end{macro}
6582 %\begin{macro}{\@ssetdynamicframe}
6583 %Version 2.0 removed \cs{@ssetdynamicframe}.
6584 %\changes{2.0}{2025-11-24}{removed}
6585 %\end{macro}
6586 %\begin{macro}{\@setdynamicframe}
6587 %\changes{2.0}{2025-11-24}{removed}
6588 %Version 2.0 removed \cs{@setdynamicframe}.
6589 %\end{macro}
6590 %
6591 %\begin{macro}{\@@setdynamicframe}
6592 % Change the setting for the \gls{dynamic} given by its \gls{idn}.
6593 % Version 2.0 renamed \cs{@@setdynamicframe}.
6594 %\changes{1.11}{2008/06/27}{removed unwanted space}
6595 %\changes{1.11}{2008/06/27}{fixed bug in clear key}
6596 %\changes{2.0}{2025-11-24}{renamed}
6597 % \begin{macrocode}
6598 \cs_new:Nn \__flowfram_set_dynamic_by_idn:nn
6599 {
6600 \__flowfram_set_keys_for_type:nnn { #2 } { dynamic } { #1 }
6601 % \end{macrocode}
6602 %Option specific to dynamic frames:
6603 % \begin{macrocode}
6604 \tl_if_empty:NF \l__flowfram_style_tl
6605 {
6606 \flowfram_frame_set_tl:nnnV
6607 { dynamic } { style } { #1 } \l__flowfram_style_tl
6608 }
6609 \tl_if_empty:NF \l__flowfram_clearflag_tl
6610 {
6611 \flowfram_frame_set_bool_from_option:nnnV
6612 { dynamic } { clear } { #1 }
6613 \l__flowfram_clearflag_tl
6614 }
6615 \tl_if_empty:NF \l__flowfram_hideflag_tl
6616 {
6617 \flowfram_frame_set_bool_from_option:nnnV
6618 { dynamic } { hide } { #1 }
6619 \l__flowfram_hideflag_tl
6620 }
6621 \tl_if_empty:NF \l__flowfram_hidethisflag_tl
6622 {
6623 \flowfram_frame_set_bool_from_option:nnnV
6624 { dynamic } { hidethis } { #1 }
6625 \l__flowfram_hidethisflag_tl
6626 }
6627 \exp_args:NV \tl_if_novalue:nF \l__flowfram_shape_tl
6628 {
6629 \flowfram_frame_set_tl:nnnV
6630 { dynamic } { shape } { #1 } \l__flowfram_shape_tl
6631 }
6632 \exp_args:NV \tl_if_novalue:nF \l__flowfram_parindent_tl
6633 {
6634 \flowfram_frame_set_tl:nnnV
6635 { dynamic } { parindent } { #1 } \l__flowfram_parindent_tl
6636 }
6637 \tl_if_empty:NF \l__flowfram_valign_tl
6638 {
6639 \flowfram_frame_set_tl:nnnV
6640 { dynamic } { valign } { #1 }
6641 \l__flowfram_valign_tl
6642 }
6643 }
6644 % \end{macrocode}
6645 %\end{macro}
6646 %
6647 %\begin{macro}{\dynamicsetpagelist}
6648 % Sets the page list for the \gls{dynamic} given by "#1" (the
6649 % \gls{idn}).
6650 %\changes{1.14}{2012-11-10}{new}
6651 %\changes{2.0}{2025-11-24}{changed to document command}
6652 % \begin{macrocode}
6653 \NewDocumentCommand \dynamicsetpagelist { m m }
6654 {
6655 \flowfram_set_frame_pagelist:nne { dynamic } { #1 } { #2 }
6656 }
6657 % \end{macrocode}
6658 %\end{macro}
6659 %\begin{macro}{\dynamicsetexclusion}
6660 % Sets the exclusion list for the \gls{dynamic} given by "#1" (the
6661 % \gls{idn}).
6662 %\changes{1.14}{2012-11-10}{new}
6663 %\changes{2.0}{2025-11-24}{changed to document command}
6664 % \begin{macrocode}
6665 \NewDocumentCommand \dynamicsetexclusion { m m }
6666 {
6667 \flowfram_set_frame_excludelist:nne { dynamic } { #1 } { #2 }
6668 }
6669 % \end{macrocode}
6670 %\end{macro}
6671 %\begin{macro}{\dynamicaddexclusion}
6672 % Adds to the exclusion list for the \gls{dynamic} given by "#1" (the
6673 % \gls{idn}).
6674 %\changes{1.14}{2012-11-10}{new}
6675 %\changes{2.0}{2025-11-24}{changed to document command}
6676 % \begin{macrocode}
6677 \NewDocumentCommand \dynamicaddexclusion { m m }
6678 {
6679 \flowfram_concat_frame_excludelist:nne
6680 { dynamic } { #1 } { #2 }
6681 }
6682 % \end{macrocode}
6683 %\end{macro}
6684 %
6685 %\begin{macro}{\@@dynamicframeswapcoords}
6686 % Swap odd and even offsets for a given \gls{dynamic}. Do the main stuff for
6687 % a given \gls{dynamic} \gls{idn}.
6688 %Version 2.0 removed \cs{@@dynamicframeswapcoords}.
6689 %\changes{2.0}{2025-11-24}{removed}
6690 %\end{macro}
6691 %\begin{macro}{\dfswapoddeven}
6692 % Allow user to specify \gls{flow} either by \gls{idn} or \gls{idl}:
6693 %\changes{2.0}{2025-11-24}{changed to document command}
6694 % \begin{macrocode}
6695 \NewDocumentCommand \dfswapoddeven { s m }
6696 {
6697 \IfValueTF { #1 }
6698 {
6699 \exp_args:Ne \clist_map_inline:nn { #2 }
6700 {
6701 \__flowfram_get_dynamic_id:n { ##1 }
6702 \__flowfram_dynamic_swap_coords:n { \l__flowfram_id_int }
6703 }
6704 }
6705 {
6706 \__flowfram_map_idns:enn { #2 } { dynamic }
6707 {
6708 \__flowfram_dynamic_swap_coords:n { \l__flowfram_id_int }
6709 }
6710 }
6711 }
6712 % \end{macrocode}
6713 %\end{macro}
6714 %\begin{macro}{\@sdynamicframeswapcoords}
6715 %\changes{2.0}{2025-11-24}{removed}
6716 %Version 2.0 removed \cs{@sdynamicframeswapcoords}.
6717 %\end{macro}
6718 %\begin{macro}{\@dynamicframeswapcoords}
6719 % Version 2.0 renamed \cs{@dynamicframeswapcoords}.
6720 %\changes{2.0}{2025-11-24}{renamed}
6721 % \begin{macrocode}
6722 \cs_new:Nn \__flowfram_dynamic_swap_coords:n
6723 {
6724 \flowfram_frame_swap_dim:nnnn
6725 { dynamic } { posx } { evenx } { #1 }
6726 \flowfram_frame_swap_dim:nnnn
6727 { dynamic } { posy } { eveny } { #1 }
6728 }
6729 % \end{macrocode}
6730 %\end{macro}
6731 % Set the contents of a \gls{dynamic}.
6732 %
6733 %\begin{environment}{dynamiccontents}
6734 % Syntax: "\begin{dynamiccontents}"\marg{idn}
6735 % Set the contents of a dynamic frame with an environment that
6736 % captures its body.
6737 %\changes{2.0}{2025-11-24}{changed to document environment}
6738 % \begin{macrocode}
6739 \NewDocumentEnvironment { dynamiccontents } { o m +b }
6740 {
6741 \IfValueT { #1 }
6742 {
6743 \__flowfram_set_dynamic_by_idn:nn { #2 } { #1 }
6744 }
6745 \setdynamiccontents { #2 } { #3 }
6746 }
6747 { }
6748 % \end{macrocode}
6749 %\end{environment}
6750 %
6751 %\begin{environment}{dynamiccontents*}
6752 % Starred version references the frame by its label.
6753 %\changes{2.0}{2025-11-24}{changed to document environment}
6754 % \begin{macrocode}
6755 \NewDocumentEnvironment { dynamiccontents* } { o m +b }
6756 {
6757 \__flowfram_get_dynamic_id:n { #2 }
6758 \IfValueT { #1 }
6759 {
6760 \__flowfram_set_dynamic_by_idn:nn
6761 { \l__flowfram_id_int } { #1 }
6762 }
6763 \setdynamiccontents
6764 { \l__flowfram_id_int } { #3 }
6765 }
6766 { }
6767 % \end{macrocode}
6768 %\end{environment}
6769 %
6770 %\begin{macro}{\@dynamictok}
6771 %\changes{2.0}{2025-11-24}{removed}
6772 %Version 2.0 removed \cs{@dynamictok}.
6773 %\end{macro}
6774 %\begin{macro}{\xdynamiccontents}
6775 %Version 2.0 removed \cs{xdynamiccontents}.
6776 %\end{macro}
6777 %
6778 %\begin{macro}{\@flf@get@body}
6779 %\changes{2.0}{2025-11-24}{removed}
6780 %Version 2.0 removed \cs{@flf@get@body}.
6781 %\end{macro}
6782 %\begin{macro}{\ifdfcontinued}
6783 %Version 2.0 removed \cs{ifdfcontinued}.
6784 %\changes{2.0}{2025-11-24}{removed}
6785 %\end{macro}
6786 %
6787 %\begin{macro}{\@flf@checkcontinued}
6788 %Version 2.0 removed \cs{@flf@checkcontinued}.
6789 %\changes{2.0}{2025-11-24}{removed}
6790 %\end{macro}
6791 %\begin{macro}{\@lempty}
6792 %Version 2.0 removed \cs{@lempty}.
6793 %\changes{2.0}{2025-11-24}{removed}
6794 %\end{macro}
6795 %
6796 %\begin{macro}{\flf@getcontargs}
6797 %Version 2.0 removed \cs{flf@getcontargs}.
6798 %\changes{2.0}{2025-11-24}{removed}
6799 %\end{macro}
6800 %
6801 %\begin{macro}{\@flf@getcontargs}
6802 %Version 2.0 removed \cs{@flf@getcontargs}.
6803 %\changes{2.0}{2025-11-24}{removed}
6804 %\end{macro}
6805 %\begin{macro}{\@flf@find@end}
6806 %\changes{2.0}{2025-11-24}{removed}
6807 %Version 2.0 removed \cs{@flf@find@end}.
6808 %\end{macro}
6809 %
6810 %\begin{macro}{\endxdynamiccontents}
6811 %Version 2.0 removed \cs{endxdynamiccontents}.
6812 %\changes{2.0}{2025-11-24}{removed}
6813 %\end{macro}
6814 %
6815 %\begin{macro}{\@flf@endxdynamiccontents}
6816 %Version 2.0 removed \cs{@flf@endxdynamiccontents}.
6817 %\changes{2.0}{2025-11-24}{removed}
6818 %\end{macro}
6819 %
6820 %\begin{macro}{\setdynamiccontents}
6821 % \begin{macrocode}
6822 \NewDocumentCommand \setdynamiccontents { s o m +m }
6823 {
6824 \group_begin:
6825 \IfBooleanTF { #1 }
6826 {
6827 \__flowfram_get_dynamic_id:n { #3 }
6828 \IfValueT { #2 }
6829 {
6830 \__flowfram_set_dynamic_by_idn:nn
6831 { \l__flowfram_id_int } { #2 }
6832 }
6833 \RenewDocumentCommand \continueonframe { o m }
6834 {
6835 \__flowfram_dynamic_continue_idl:nn { ##1 } { ##2 }
6836 }
6837 \__flowfram_set_dynamic_contents_from_body:nn
6838 { \l__flowfram_id_int } { #4 }
6839 }
6840 {
6841 \IfValueT { #2 }
6842 {
6843 \__flowfram_set_dynamic_by_idn:nn { #3 } { #2 }
6844 }
6845 \RenewDocumentCommand \continueonframe { O{} m }
6846 {
6847 \__flowfram_dynamic_continue_idn:nn { ##1 } { ##2 }
6848 }
6849 \__flowfram_set_dynamic_contents_from_body:nn
6850 { #3 } { #4 }
6851 }
6852 \group_end:
6853 }
6854 % \end{macrocode}
6855 %\end{macro}
6856 %
6857 % \begin{macrocode}
6858 \cs_new:Nn \__flowfram_dynamic_continue_idn:nn
6859 {
6860 \IfValueTF { #1 }
6861 {
6862 \__flowfram_append_dynamic_contents_idn:nn
6863 { \l__flowfram_current_dynamic_int }
6864 { \ffcontinuedtextlayout { #1 } }
6865 }
6866 {
6867 % \end{macrocode}
6868 %Expansion required variables may have different values when the
6869 %frame contents are displayed.
6870 % \begin{macrocode}
6871 \exp_args:Nne
6872 \__flowfram_append_dynamic_contents_idn:nn
6873 { \l__flowfram_current_dynamic_int }
6874 {
6875 \exp_not:N \ffcontinuedtextlayout
6876 {
6877 \exp_not:N \flowfram_continue_on_dynamic_frame_idn:nn
6878 { \int_use:N \l__flowfram_current_dynamic_int }
6879 { \int_eval:n { #2 } }
6880 }
6881 }
6882 }
6883 \exp_args:NV
6884 \__flowfram_set_post_continued:nnn
6885 \l__flowfram_current_dynamic_int
6886 { \l__flowfram_current_dynamic_int }
6887 { \c_flowfram_frame_type_dynamic_int }
6888 \int_set:Nn \l__flowfram_current_dynamic_int { #2 }
6889 \exp_after:wN
6890 \__flowfram_set_dynamic_contents_from_body:w
6891 \l__flowfram_postcontinued_tl
6892 }
6893 % \end{macrocode}
6894 %
6895 % \begin{macrocode}
6896 \cs_new:Nn \__flowfram_dynamic_continue_idl:nn
6897 {
6898 \IfValueTF { #1 }
6899 {
6900 \__flowfram_append_dynamic_contents_idn:nn
6901 { \l__flowfram_current_dynamic_int }
6902 { \ffcontinuedtextlayout { #1 } }
6903 }
6904 {
6905 % \end{macrocode}
6906 %Expansion required variables may have different values when the
6907 %frame contents are displayed.
6908 % \begin{macrocode}
6909 \exp_args:Nne
6910 \__flowfram_append_dynamic_contents_idn:nn
6911 { \l__flowfram_current_dynamic_int }
6912 {
6913 \exp_not:N \ffcontinuedtextlayout
6914 {
6915 \exp_not:N \flowfram_continue_on_dynamic_frame_idl:nn
6916 { \int_use:N \l__flowfram_current_dynamic_int }
6917 { #2 }
6918 }
6919 }
6920 }
6921 \exp_args:NV
6922 \__flowfram_set_post_continued:nnn
6923 \l__flowfram_current_dynamic_int
6924 { \l__flowfram_current_dynamic_int }
6925 { \c_flowfram_frame_type_dynamic_int }
6926 \__flowfram_get_dynamic_id:n { #2 }
6927 \int_set_eq:Nn
6928 \l__flowfram_current_dynamic_int
6929 \l__flowfram_id_int
6930 \exp_after:wN
6931 \__flowfram_set_dynamic_contents_from_body:w
6932 \l__flowfram_postcontinued_tl
6933 }
6934 % \end{macrocode}
6935 %
6936 % \begin{macrocode}
6937 \cs_new:Nn \flowfram_continue_on_dynamic_frame_idn:nn
6938 {
6939 \ffdefaultdynamiccontinuetext { #1 } { #2 }
6940 }
6941 % \end{macrocode}
6942 %
6943 % \begin{macrocode}
6944 \cs_new:Nn \flowfram_continue_on_dynamic_frame_idl:nn
6945 {
6946 \__flowfram_get_dynamic_id:n { #2 }
6947 \ffdefaultdynamiccontinuetext { #1 } { \l__flowfram_id_int }
6948 }
6949 % \end{macrocode}
6950 %
6951 % \begin{macrocode}
6952 \cs_new:Nn \__flowfram_set_dynamic_contents_from_body:nn
6953 {
6954 \int_set:Nn \l__flowfram_current_dynamic_int { #1 }
6955 \__flowfram_set_dynamic_contents_from_body:w
6956 #2 \continueonframe \q_nil \q_stop
6957 }
6958 % \end{macrocode}
6959 %
6960 % \begin{macrocode}
6961 \cs_new:Npn \__flowfram_set_dynamic_contents_from_body:w
6962 #1 \continueonframe #2 \q_stop
6963 {
6964 \__flowfram_set_dynamic_contents:nn
6965 { \l__flowfram_current_dynamic_int }
6966 { #1 }
6967 \tl_if_head_eq_meaning:nNTF { #2 } [
6968 {
6969 \__flowfram_dynamic_continued_opt_conts:wn #2 \q_stop
6970 }
6971 {
6972 \quark_if_nil:nF { #2 }
6973 {
6974 \__flowfram_dynamic_continued_conts:wn
6975 #2
6976 \q_stop
6977 }
6978 }
6979 }
6980 % \end{macrocode}
6981 %
6982 % \begin{macrocode}
6983 \cs_new:Npn \__flowfram_dynamic_continued_opt_conts:wn
6984 [ #1 ] #2 #3 \q_stop
6985 {
6986 \continueonframe [ #1 ] { #2 }
6987 #3 \q_stop
6988 }
6989 \cs_new:Npn \__flowfram_dynamic_continued_conts:wn
6990 #1 #2 \q_stop
6991 {
6992 \continueonframe { #1 }
6993 #2 \q_stop
6994 }
6995 % \end{macrocode}
6996 %
6997 %\begin{macro}{\@ssetdynamiccontents}
6998 % Starred version: identify \gls{dynamic} by its \gls{idl}:
6999 %\changes{2.0}{2025-11-24}{removed}
7000 %Version 2.0 removed \cs{@ssetdynamiccontents}.
7001 %\end{macro}
7002 %
7003 %\begin{macro}{\@setdynamiccontents}
7004 % Set the contents of a dynamic frame identified by its \gls{idn}:
7005 %\changes{2.0}{2025-11-24}{renamed}
7006 %Version 2.0 renamed \cs{@setdynamiccontents}.
7007 % \begin{macrocode}
7008 \cs_new:Nn \__flowfram_set_dynamic_contents:nn
7009 {
7010 \flowfram_frame_set_tl:nnnn
7011 { dynamic } { content } { #1 } { #2 }
7012 }
7013 % \end{macrocode}
7014 %\end{macro}
7015 %\begin{macro}{\appenddynamiccontents}
7016 % Append information to \gls{dynamic}. First check to
7017 % see if starred or unstarred version is being used.
7018 %\changes{2.0}{2025-11-24}{changed to document command}
7019 %\changes{2.0}{2025-11-24}{added optional argument}
7020 % \begin{macrocode}
7021 \NewDocumentCommand \appenddynamiccontents { s o m +m }
7022 {
7023 \IfBooleanTF { #1 }
7024 {
7025 \__flowfram_get_dynamic_id:n { #3 }
7026 \IfValueT { #2 }
7027 {
7028 \__flowfram_set_dynamic_by_idn:nn
7029 { \l__flowfram_id_int } { #2 }
7030 }
7031 \__flowfram_append_dynamic_contents_idn:nn { \l__flowfram_id_int } { #4 }
7032 }
7033 {
7034 \IfValueT { #2 }
7035 {
7036 \__flowfram_set_dynamic_by_idn:nn { #3 } { #2 }
7037 }
7038 \__flowfram_append_dynamic_contents_idn:nn { #3 } { #4 }
7039 }
7040 }
7041 % \end{macrocode}
7042 %\end{macro}
7043 %\begin{macro}{\@sappenddynamic}
7044 % Append to dynamic frame identified by its \gls{idl}.
7045 %Version 2.0 renamed \cs{@sappenddynamic}.
7046 %\changes{2.0}{2025-11-24}{renamed}
7047 % \begin{macrocode}
7048 \cs_new:Nn \__flowfram_append_dynamic_contents_idl:nn
7049 {
7050 \__flowfram_get_dynamic_id:n { #1 }
7051 \__flowfram_append_dynamic_contents_idn:nn
7052 { \l__flowfram_id_int } { #2 }
7053 }
7054 % \end{macrocode}
7055 %\end{macro}
7056 %\begin{macro}{\@appenddynamic}
7057 % Append to dynamic frame identified by its \gls{idn}.
7058 %Version 2.0 renamed \cs{@appenddynamic}.
7059 %\changes{2.0}{2025-11-24}{renamed}
7060 % \begin{macrocode}
7061 \cs_new:Nn \__flowfram_append_dynamic_contents_idn:nn
7062 {
7063 \flowfram_frame_put_right_tl:nnnn
7064 { dynamic } { content } { #1 } { #2 }
7065 }
7066 % \end{macrocode}
7067 %\end{macro}
7068 %
7069 %\begin{macro}{\flf@ta}
7070 % Version 2.0 removed \cs{flf@ta}.
7071 %\changes{2.0}{2025-11-24}{removed}
7072 %\end{macro}
7073 %
7074 %\begin{macro}{\flf@tb}
7075 % Version 2.0 removed \cs{flf@tb}.
7076 %\changes{2.0}{2025-11-24}{removed}
7077 %\end{macro}
7078 %
7079 %\begin{macro}{\@ff@addtolist}
7080 %\changes{2.0}{2025-11-24}{removed}
7081 % Version 2.0 removed \cs{@ff@addtolist}.
7082 %\end{macro}
7083 %
7084 %\subsection{Determining Dimensions and Locations}
7085 %\begin{macro}{\computeleftedgeodd}
7086 % Compute the position of the leftmost edge of the page,
7087 % relative to the left side of the \gls{typeblock}. Since odd and
7088 % even pages may have a different offset if "\oddsidemargin"
7089 % and "\evensidemargin" have different values, it is necessary
7090 % to have two separate commands for odd and even pages.
7091 % First the odd pages.
7092 %\changes{2.0}{2025-11-24}{changed to document command}
7093 % \begin{macrocode}
7094 \NewDocumentCommand \computeleftedgeodd { m }
7095 {
7096 \dim_set:Nn #1 { -1in - \hoffset - \oddsidemargin }
7097 }
7098 % \end{macrocode}
7099 %\end{macro}
7100 %\begin{macro}{\computeleftedgeeven}
7101 %\changes{2.0}{2025-11-24}{changed to document command}
7102 % Now for the even pages
7103 % \begin{macrocode}
7104 \NewDocumentCommand \computeleftedgeeven { m }
7105 {
7106 \dim_set:Nn #1 { -1in - \hoffset - \evensidemargin }
7107 }
7108 % \end{macrocode}
7109 %\end{macro}
7110 %\begin{macro}{\computetopedge}
7111 %\changes{2.0}{2025-11-24}{changed to document command}
7112 % Compute the top edge of the page, relative to the bottom of
7113 % the \gls{typeblock}.
7114 % \begin{macrocode}
7115 \NewDocumentCommand \computetopedge { m }
7116 {
7117 \dim_set:Nn #1
7118 {
7119 \typeblockheight
7120 + \typeblockoffsety
7121 + 1in
7122 }
7123 }
7124 % \end{macrocode}
7125 %\end{macro}
7126 %\begin{macro}{\computebottomedge}
7127 %\changes{2.0}{2025-11-24}{changed to document command}
7128 % Compute the bottom edge of the page, relative to the bottom
7129 % of the \gls{typeblock}.
7130 % \begin{macrocode}
7131 \NewDocumentCommand \computebottomedge { m }
7132 {
7133 \computetopedge { #1 }
7134 \addtolength { #1 } { - \paperheight }
7135 }
7136 % \end{macrocode}
7137 %\end{macro}
7138 %\begin{macro}{\computerightedgeodd}
7139 %\changes{2.0}{2025-11-24}{changed to document command}
7140 % Compute the right edge of the page, relative to the left edge
7141 % of the \gls{typeblock}. Again, two commands are needed for odd
7142 % and even pages. First the odd pages.
7143 % \begin{macrocode}
7144 \NewDocumentCommand \computerightedgeodd { m }
7145 {
7146 \computeleftedgeodd { #1 }
7147 \addtolength { #1 } { \paperwidth }
7148 }
7149 % \end{macrocode}
7150 %\end{macro}
7151 %\begin{macro}{\computerightedgeeven}
7152 %\changes{2.0}{2025-11-24}{changed to document command}
7153 % Now for the even pages.
7154 % \begin{macrocode}
7155 \NewDocumentCommand \computerightedgeeven { m }
7156 {
7157 \computeleftedgeeven { #1 }
7158 \addtolength { #1 } { \paperwidth }
7159 }
7160 % \end{macrocode}
7161 %\end{macro}
7162 % Compute the minimum area surrounding the listed \glspl{flow}.
7163 % Values stored in "\ffareawidth", "\ffareaheight", "\ffareax"
7164 % and "\ffareay"
7165 % \begin{macrocode}
7166 \newlength\ffareawidth
7167 \newlength\ffareaheight
7168 \newlength\ffareax
7169 \newlength\ffareay
7170 \newlength\ffareaevenx
7171 \newlength\ffareaeveny
7172 % \end{macrocode}
7173 %\begin{macro}{\computeflowframearea}
7174 %\changes{2.0}{2025-11-24}{changed to document command}
7175 % Starred version identifies frame by \gls{idl}, unstarred
7176 % version identifies frame by \gls{idn}.
7177 % \begin{macrocode}
7178 \NewDocumentCommand \computeflowframearea { s m }
7179 {
7180 \setlength \ffareax { \paperwidth }
7181 \setlength \ffareay { \paperheight }
7182 \dim_zero:N \l__flowfram_x_dim
7183 \dim_zero:N \l__flowfram_y_dim
7184 \IfBooleanTF { #1 }
7185 {
7186 \exp_args:Ne \clist_map_inline:nn { #1 }
7187 {
7188 \__flowfram_if_flow_label_exists:nTF { ##1 }
7189 {
7190 \__flowfram_compute_flow_area_by_idn:n { \l__flowfram_id_int }
7191 }
7192 {
7193 \__flowfram_error:eee { label-undefined } { ##1 } { flow }
7194 }
7195 }
7196 }
7197 {
7198 \__flowfram_map_idns:enn { #2 } { flow }
7199 {
7200 \__flowfram_compute_flow_area_by_idn:n { \l__flowfram_id_int }
7201 }
7202 }
7203 \dim_set:Nn \ffareawidth
7204 {
7205 \l__flowfram_x_dim -\ffareax
7206 }
7207 \dim_set:Nn \ffareaheight
7208 {
7209 \l__flowfram_y_dim - \ffareay
7210 }
7211 }
7212 % \end{macrocode}
7213 %\end{macro}
7214 %
7215 % \begin{macrocode}
7216 \cs_new:Nn \__flowfram_compute_flow_area_by_idn:n
7217 {
7218 \dim_compare:nNnT
7219 { \ffareax } > { \flowframex { #1 } }
7220 {
7221 \dim_set:Nn \ffareax { \flowframex { #1 } }
7222 }
7223 \dim_compare:nNnT
7224 { \ffareay } > { \flowframey { #1 } }
7225 {
7226 \dim_set:Nn \ffareay { \flowframey { #1 } }
7227 }
7228 \dim_set:Nn \l__flowfram_offset_dim
7229 {
7230 \flowframex { #1 }
7231 + \flowframewidth { #1 }
7232 }
7233 \dim_compare:nNnT
7234 { \l__flowfram_x_dim } < { \l__flowfram_offset_dim }
7235 {
7236 \dim_set_eq:NN \l__flowfram_x_dim \l__flowfram_offset_dim
7237 }
7238 \dim_set:Nn \l__flowfram_offset_dim
7239 {
7240 \flowframey { #1 }
7241 + \flowframeheight { #1 }
7242 }
7243 \dim_compare:nNnT
7244 { \l__flowfram_y_dim } < { \l__flowfram_offset_dim }
7245 {
7246 \dim_set_eq:NN \l__flowfram_y_dim \l__flowfram_offset_dim
7247 }
7248 }
7249 % \end{macrocode}
7250 %
7251 %\begin{macro}{\@scomputeffarea}
7252 % Version 2.0 removed \cs{@scomputeffarea}.
7253 %\changes{2.0}{2025-11-24}{removed}
7254 %\end{macro}
7255 %\begin{macro}{\@computeffarea}
7256 % Version 2.0 removed \cs{@computeffarea}.
7257 %\changes{2.0}{2025-11-24}{removed}
7258 %\end{macro}
7259 %
7260 %\begin{macro}{\@ff@swaplen}
7261 % Swap the values of two dimensions.
7262 % Version 2.0 renamed \cs{@ff@swaplen}.
7263 %\changes{2.0}{2025-11-24}{renamed}
7264 % \begin{macrocode}
7265 \cs_new:Nn \__flowfram_swap_dim:NN
7266 {
7267 \dim_set_eq:NN \l__flowfram_tmpa_dim #1
7268 \dim_set_eq:NN #1 #2
7269 \dim_set_eq:NN #2 \l__flowfram_tmpa_dim
7270 }
7271 % \end{macrocode}
7272 %\end{macro}
7273 %
7274 %\begin{macro}{\@ff@getdim}
7275 % Get the dimensions for the given type of frame.
7276 % The first parameter should be a number indictating
7277 % type of frame : 1 (flow), 2 (static), 3 (dynamic).
7278 % The second number is its \gls{idn}. Values are stored in
7279 % "\ffareax", "\ffareay", "\ffareawidth" and "\ffareaheight".
7280 % Version 2.0 renamed \cs{@ff@getdim}.
7281 %\changes{2.0}{2025-11-24}{renamed}
7282 % \begin{macrocode}
7283 \cs_new:Nn \__flowfram_get_frame_bounds_by_typeid:nn
7284 {
7285 \int_case:nnF { #1 }
7286 {
7287 { \c_flowfram_frame_type_flow_int }
7288 {
7289 \__flowfram_get_flow_bounds:n { #2 }
7290 }
7291 { \c_flowfram_frame_type_static_int }
7292 {
7293 \__flowfram_get_static_bounds:n { #2 }
7294 }
7295 { \c_flowfram_frame_type_dynamic_int }
7296 {
7297 \__flowfram_get_dynamic_bounds:n { #2 }
7298 }
7299 }
7300 {
7301 \msg_error:nne { flowfram } { invalid-frame-typeid }
7302 { \int_eval:n { #1 } }
7303 }
7304 }
7305 % \end{macrocode}
7306 %\end{macro}
7307 %Identify by type label.
7308 % \begin{macrocode}
7309 \cs_new:Nn \__flowfram_get_frame_bounds_by_type:nn
7310 {
7311 \flowfram_set_dim_to_frame_dim:Nnnn
7312 \ffareax { #1 } { posx } { #2 }
7313 \flowfram_set_dim_to_frame_dim:Nnnn
7314 \ffareay { #1 } { posy } { #2 }
7315 \flowfram_set_dim_to_frame_dim:Nnnn
7316 \ffareaevenx { #1 } { evenx } { #2 }
7317 \flowfram_set_dim_to_frame_dim:Nnnn
7318 \ffareaeveny { #1 } { eveny } { #2 }
7319 \flowfram_set_dim_to_frame_dim:Nnnn
7320 \ffareawidth { #1 } { width } { #2 }
7321 \flowfram_set_dim_to_frame_dim:Nnnn
7322 \ffareaheight { #1 } { height } { #2 }
7323 }
7324 % \end{macrocode}
7325 %
7326 %\begin{macro}{\@ff@getevendim}
7327 %\changes{1.11}{2008/06/27}{new}
7328 % Get the dimensions for the given type of frame on even pages.
7329 % The first parameter should be a number indictating
7330 % type of frame : 1 (flow), 2 (static), 3 (dynamic).
7331 % The second number is its \gls{idn}. Values are stored in
7332 % "\ffareax", "\ffareay", "\ffareawidth" and "\ffareaheight".
7333 % \begin{macrocode}
7334 \cs_new:Nn \__flowfram_get_frame_even_bounds_by_typeid:nn
7335 {
7336 \int_case:nnF { #1 }
7337 {
7338 { \c_flowfram_frame_type_flow_int }
7339 {
7340 \__flowfram_get_flow_even_bounds:n { #2 }
7341 }
7342 { \c_flowfram_frame_type_static_int }
7343 {
7344 \__flowfram_get_static_even_bounds:n { #2 }
7345 }
7346 { \c_flowfram_frame_type_dynamic_int }
7347 {
7348 \__flowfram_get_dynamic_even_bounds:n { #2 }
7349 }
7350 }
7351 {
7352 \msg_error:nne { flowfram } { invalid-frame-typeid }
7353 { \int_eval:n { #1 } }
7354 }
7355 }
7356 % \end{macrocode}
7357 %\end{macro}
7358 %
7359 % \begin{macrocode}
7360 \cs_new:Nn \__flowfram_get_frame_even_bounds_by_type:nn
7361 {
7362 \flowfram_set_dim_to_frame_dim:Nnnn
7363 \ffareax { #1 } { evenx } { #2 }
7364 \flowfram_set_dim_to_frame_dim:Nnnn
7365 \ffareay { #1 } { eveny } { #2 }
7366 \flowfram_set_dim_to_frame_dim:Nnnn
7367 \ffareawidth { #1 } { width } { #2 }
7368 \flowfram_set_dim_to_frame_dim:Nnnn
7369 \ffareaheight { #1 } { height } { #2 }
7370 }
7371 % \end{macrocode}
7372 %
7373 %\begin{macro}{\getstaticbounds}
7374 % Convenience method for calling the above. Firstly for static
7375 % frames:
7376 %\changes{2.0}{2025-11-24}{changed to document command}
7377 % \begin{macrocode}
7378 \NewDocumentCommand \getstaticbounds { s m }
7379 {
7380 \IfBooleanTF { #1 }
7381 {
7382 \__flowfram_get_static_id:n { #2 }
7383 \__flowfram_get_static_bounds:n { \l__flowfram_id_int }
7384 }
7385 {
7386 \__flowfram_get_static_bounds:n { #2 }
7387 }
7388 }
7389 % \end{macrocode}
7390 %\end{macro}
7391 %\begin{macro}{\@sgetstaticbounds}
7392 % Version 2.0 removed \cs{@sgetstaticbounds}.
7393 %\changes{2.0}{2025-11-24}{removed}
7394 %\end{macro}
7395 %\begin{macro}{\@getstaticbounds}
7396 % Unstarred version (specify by \gls{idn}):
7397 %\changes{1.11}{2008/06/27}{fixed bug: changed frame id from
7398 % 1 to 2 (thanks to Lutz Goldmann for pointing it out)}
7399 %Version 2.0 renamed \cs{@getstaticbounds}.
7400 %\changes{2.0}{2025-11-24}{renamed}
7401 % \begin{macrocode}
7402 \cs_new:Nn \__flowfram_get_static_bounds:n
7403 {
7404 \__flowfram_get_frame_bounds_by_type:nn { static } { #1 }
7405 }
7406 % \end{macrocode}
7407 %\end{macro}
7408 %
7409 %\begin{macro}{\getstaticevenbounds}
7410 %\changes{1.11}{2008/06/27}{new}
7411 % Even pages.
7412 %\changes{2.0}{2025-11-24}{changed to document command}
7413 % \begin{macrocode}
7414 \NewDocumentCommand \getstaticevenbounds { s m }
7415 {
7416 \IfBooleanTF { #1 }
7417 {
7418 \__flowfram_get_static_id:n { #2 }
7419 \__flowfram_get_static_even_bounds:n { \l__flowfram_id_int }
7420 }
7421 {
7422 \__flowfram_get_static_even_bounds:n { #2 }
7423 }
7424 }
7425 % \end{macrocode}
7426 %\end{macro}
7427 %\begin{macro}{\@sgetstaticevenbounds}
7428 % Version 2.0 removed \cs{@sgetstaticevenbounds}.
7429 %\changes{2.0}{2025-11-24}{removed}
7430 %\end{macro}
7431 %\begin{macro}{\@getstaticevenbounds}
7432 %\changes{1.11}{2008/06/27}{new}
7433 % Get static bounds by \gls{idn}.
7434 % Version 2.0 renamed \cs{@getstaticevenbounds}.
7435 %\changes{2.0}{2025-11-24}{renamed}
7436 % \begin{macrocode}
7437 \cs_new:Nn \__flowfram_get_static_even_bounds:n
7438 {
7439 \__flowfram_get_frame_even_bounds_by_type:nn { static } { #1 }
7440 }
7441 % \end{macrocode}
7442 %\end{macro}
7443 %
7444 %\begin{macro}{\getflowbounds}
7445 % Next flow frames:
7446 %\changes{2.0}{2025-11-24}{changed to document command}
7447 % \begin{macrocode}
7448 \NewDocumentCommand \getflowbounds { s m }
7449 {
7450 \IfBooleanTF { #1 }
7451 {
7452 \__flowfram_get_flow_id:e { #2 }
7453 \__flowfram_get_flow_bounds:n { \l__flowfram_id_int }
7454 }
7455 {
7456 \__flowfram_get_flow_bounds:n { #2 }
7457 }
7458 }
7459 % \end{macrocode}
7460 %\end{macro}
7461 %\begin{macro}{\@sgetflowbounds}
7462 %Version 2.0 removed \cs{@sgetflowbounds}.
7463 %\changes{2.0}{2025-11-24}{removed}
7464 %\end{macro}
7465 %\begin{macro}{\@getflowbounds}
7466 % Get flow bounds by \gls{idn}).
7467 % Version 2.0 renamed \cs{@getflowbounds}.
7468 %\changes{1.11}{2008/06/27}{fixed bug: changed frame id from
7469 % 2 to 1 (thanks to Lutz Goldmann for pointing it out)}
7470 %\changes{2.0}{2025-11-24}{renamed}
7471 % \begin{macrocode}
7472 \cs_new:Nn \__flowfram_get_flow_bounds:n
7473 {
7474 \__flowfram_get_frame_bounds_by_type:nn { flow } { #1 }
7475 }
7476 % \end{macrocode}
7477 %\end{macro}
7478 %\begin{macro}{\getflowevenbounds}
7479 %\changes{1.11}{2008/06/27}{new}
7480 %\changes{2.0}{2025-11-24}{changed to document command}
7481 % Even pages:
7482 % \begin{macrocode}
7483 \NewDocumentCommand \getflowevenbounds { s m }
7484 {
7485 \IfBooleanTF { #1 }
7486 {
7487 \__flowfram_get_flow_id:e { #1 }
7488 \__flowfram_get_flow_even_bounds:n { \l__flowfram_id_int }
7489 }
7490 {
7491 \__flowfram_get_flow_even_bounds:n { #2 }
7492 }
7493 }
7494 % \end{macrocode}
7495 %\end{macro}
7496 %\begin{macro}{\@sgetflowevenbounds}
7497 %\changes{1.11}{2008/06/27}{new}
7498 %\changes{2.0}{2025-11-24}{removed}
7499 %Version 2.0 removed \cs{@sgetflowevenbounds}.
7500 %\end{macro}
7501 %\begin{macro}{\@getflowevenbounds}
7502 %\changes{1.11}{2008/06/27}{new}
7503 % Get bounds by \gls{idn}.
7504 %Version 2.0 renamed \cs{@getflowevenbounds}.
7505 %\changes{2.0}{2025-11-24}{renamed}
7506 % \begin{macrocode}
7507 \cs_new:Nn \__flowfram_get_flow_even_bounds:n
7508 {
7509 \__flowfram_get_frame_even_bounds_by_type:nn { flow } { #1 }
7510 }
7511 % \end{macrocode}
7512 %\end{macro}
7513 %
7514 %\begin{macro}{\getdynamicbounds}
7515 %\changes{2.0}{2025-11-24}{changed to document command}
7516 % Next dynamic frames:
7517 % \begin{macrocode}
7518 \NewDocumentCommand \getdynamicbounds { s m }
7519 {
7520 \IfBooleanTF { #1 }
7521 {
7522 \__flowfram_get_dynamic_id:n { #1 }
7523 \__flowfram_get_dynamic_bounds:n { \l__flowfram_id_int }
7524 }
7525 {
7526 \__flowfram_get_dynamic_bounds:n { #2 }
7527 }
7528 }
7529 % \end{macrocode}
7530 %\end{macro}
7531 %\begin{macro}{\@sgetdynamicbounds}
7532 %Version 2.0 removed \cs{@sgetdynamicbounds}.
7533 %\changes{2.0}{2025-11-24}{removed}
7534 %\end{macro}
7535 %\begin{macro}{\@getdynamicbounds}
7536 % Get bounds by \gls{idn}):
7537 %Version 2.0 renamed \cs{@getdynamicbounds}.
7538 %\changes{2.0}{2025-11-24}{renamed}
7539 % \begin{macrocode}
7540 \cs_new:Nn \__flowfram_get_dynamic_bounds:n
7541 {
7542 \__flowfram_get_frame_bounds_by_type:nn { dynamic } { #1 }
7543 }
7544 % \end{macrocode}
7545 %\end{macro}
7546 %
7547 %\begin{macro}{\getdynamicevenbounds}
7548 %\changes{1.11}{2008/06/27}{new}
7549 %\changes{2.0}{2025-11-24}{changed to document command}
7550 % Even pages:
7551 % \begin{macrocode}
7552 \NewDocumentCommand \getdynamicevenbounds { s m }
7553 {
7554 \IfBooleanTF { #1 }
7555 {
7556 \__flowfram_get_dynamic_id:n { #1 }
7557 \__flowfram_get_dynamic_even_bounds:n { \l__flowfram_id_int }
7558 }
7559 {
7560 \__flowfram_get_dynamic_even_bounds:n { #2 }
7561 }
7562 }
7563 % \end{macrocode}
7564 %\end{macro}
7565 %\begin{macro}{\@sgetdynamicevenbounds}
7566 %Version 2.0 removed \cs{@sgetdynamicevenbounds}.
7567 %\changes{2.0}{2025-11-24}{removed}
7568 %\end{macro}
7569 %\begin{macro}{\@getdynamicevenbounds}
7570 % Get bounds by \gls{idn}).
7571 % Version 2.0 renamed \cs{@getdynamicevenbounds}.
7572 %\changes{2.0}{2025-11-24}{renamed}
7573 % \begin{macrocode}
7574 \cs_new:Nn \__flowfram_get_dynamic_even_bounds:n
7575 {
7576 \__flowfram_get_frame_even_bounds_by_type:nn { dynamic } { #1 }
7577 }
7578 % \end{macrocode}
7579 %\end{macro}
7580 %
7581 % \subsection{Determining the relative location of one frame from
7582 % another}
7583 %\changes{1.11}{2008/06/27}{added relative location commands}
7584 % The commands in this section set the following boolean variables:
7585 % \begin{macrocode}
7586 \newif\ifFLFabove
7587 \newif\ifFLFbelow
7588 \newif\ifFLFleft
7589 \newif\ifFLFright
7590 % \end{macrocode}
7591 % These can then be used after one of the \cs{checkifframe}\meta{loc}
7592 % commands defined below.
7593 %
7594 %\begin{macro}{\checkifframeabove}
7595 %\changes{1.11}{2008/06/27}{new}
7596 %\changes{2.0}{2025-11-24}{changed to document command}
7597 %\cs{checkifframeabove}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
7598 %
7599 % Checks if the first frame is above the second frame where the
7600 % first frame is of type \meta{type1} with \gls{idn} given by
7601 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
7602 % given by \meta{id2}. The starred version uses the \gls{idl} instead
7603 % of the \gls{idn}. The first frame is not considered to be above the
7604 % second frame if they overlap. This code checks the page number to
7605 % determine whether to use \cs{oddcheckifframeabove} or
7606 % \cs{evencheckifframeabove} so it should not be used in the
7607 % first paragraph of the first \gls{flow} on the page if the paragraph
7608 % spans the page break.
7609 % \begin{macrocode}
7610 \NewDocumentCommand \checkifframeabove { s m m m m }
7611 {
7612 \IfBooleanTF { #1 }
7613 {
7614 \__flowframe_check_if_frame_above_by_idl:nnnn
7615 { #2 } { #3 } { #4 } { #5 }
7616 }
7617 {
7618 \__flowframe_check_if_frame_above_by_idn:nnnn
7619 { #2 } { #3 } { #4 } { #5 }
7620 }
7621 }
7622 % \end{macrocode}
7623 %\end{macro}
7624 %\begin{macro}{\@scheckifframeabove}
7625 %\changes{2.0}{2025-11-24}{renamed}
7626 % Check by \gls{idl}.
7627 % Version 2.0 renamed \cs{@scheckifframeabove}.
7628 % \begin{macrocode}
7629 \cs_new:Nn \__flowframe_check_if_frame_above_by_idl:nnnn
7630 {
7631 \int_if_odd:nTF { \c@page }
7632 {
7633 \__flowframe_check_odd_if_frame_above_by_idl:nnnn
7634 { #1 } { #2 } { #3 } { #4 }
7635 }
7636 {
7637 \__flowframe_check_even_if_frame_above_by_idl:nnnn
7638 { #1 } { #2 } { #3 } { #4 }
7639 }
7640 }
7641 % \end{macrocode}
7642 %\end{macro}
7643 %
7644 %\begin{macro}{\@checkifframeabove}
7645 %\changes{2.0}{2025-11-24}{renamed}
7646 % Check by \gls{idl}.
7647 % Version 2.0 renamed \cs{@checkifframeabove}.
7648 % \begin{macrocode}
7649 \cs_new:Nn \__flowframe_check_if_frame_above_by_idn:nnnn
7650 {
7651 \__flowframe_check_if_frame_above_by_idn:nnnnn
7652 { \c@page } { #1 } { #2 } { #3 } { #4 }
7653 }
7654 % \end{macrocode}
7655 %\end{macro}
7656 %Supply page number in first argument:
7657 % \begin{macrocode}
7658 \cs_new:Nn \__flowframe_check_if_frame_above_by_idn:nnnnn
7659 {
7660 \int_if_odd:nTF { #1 }
7661 {
7662 \__flowframe_check_odd_if_frame_above_by_idn:nnnn
7663 { #2 } { #3 } { #4 } { #5 }
7664 }
7665 {
7666 \__flowframe_check_even_if_frame_above_by_idn:nnnn
7667 { #2 } { #3 } { #4 } { #5 }
7668 }
7669 }
7670 % \end{macrocode}
7671 %
7672 %\begin{macro}{\oddcheckifframeabove}
7673 %\changes{1.11}{2008/06/27}{new}
7674 %\changes{2.0}{2025-11-24}{changed to document command}
7675 %\cs{oddcheckifframeabove}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
7676 % Checks if the first frame is above the second frame where the
7677 % first frame is of type \meta{type1} with \gls{idn} given by
7678 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
7679 % given by \meta{id2} for odd pages. The starred version uses the \gls{idl} instead
7680 % of the \gls{idn}. The first frame is not considered to be above the
7681 % second frame if they overlap.
7682 % \begin{macrocode}
7683 \NewDocumentCommand \oddcheckifframeabove { s m m m m }
7684 {
7685 \IfBooleanTF { #1 }
7686 {
7687 \__flowframe_check_odd_if_frame_above_by_idl:nnnn
7688 { #2 } { #3 } { #4 } { #5 }
7689 }
7690 {
7691 \__flowframe_check_odd_if_frame_above_by_idn:nnnn
7692 { #2 } { #3 } { #4 } { #5 }
7693 }
7694 }
7695 % \end{macrocode}
7696 %\end{macro}
7697 %\begin{macro}{\@soddcheckifframeabove}
7698 % Check by \gls{idl}.
7699 % Version 2.0 renamed \cs{@soddcheckifframeabove}.
7700 %\changes{2.0}{2025-11-24}{renamed}
7701 % \begin{macrocode}
7702 \cs_new:Nn \__flowframe_check_odd_if_frame_above_by_idl:nnnn
7703 {
7704 \__flowfram_get_frame_id:nn { #1 } { #2 }
7705 \__flowfram_get_frame_bounds_by_type:nn { #1 } { \l__flowfram_id_int }
7706 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareay
7707 \__flowfram_get_frame_id:nn { #3 } { #4 }
7708 \__flowfram_get_frame_bounds_by_type:nn { #3 } { \l__flowfram_id_int }
7709 \dim_add:Nn \ffareay { \ffareaheight }
7710 \dim_compare:nNnTF { \l__flowfram_tmpa_dim } > { \ffareay }
7711 {
7712 \FLFabovetrue
7713 }
7714 {
7715 \FLFabovefalse
7716 }
7717 }
7718 % \end{macrocode}
7719 %\end{macro}
7720 %\begin{macro}{\@oddcheckifframeabove}
7721 % Check by \gls{idn}.
7722 % Version 2.0 renamed \cs{@oddcheckifframeabove}.
7723 %\changes{2.0}{2025-11-24}{renamed}
7724 % \begin{macrocode}
7725 \cs_new:Nn \__flowframe_check_odd_if_frame_above_by_idn:nnnn
7726 {
7727 \__flowfram_get_frame_bounds_by_type:nn { #1 } { #2 }
7728 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareay
7729 \__flowfram_get_frame_bounds_by_type:nn { #3 } { #4 }
7730 \dim_add:Nn \ffareay { \ffareaheight }
7731 \dim_compare:nNnTF { \l__flowfram_tmpa_dim } > { \ffareay }
7732 {
7733 \FLFabovetrue
7734 }
7735 {
7736 \FLFabovefalse
7737 }
7738 }
7739 % \end{macrocode}
7740 %\end{macro}
7741 %
7742 %\begin{macro}{\checkifframebelow}
7743 %\changes{1.11}{2008/06/27}{new}
7744 %\changes{2.0}{2025-11-24}{changed to document command}
7745 %\cs{checkifframebelow}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
7746 % Checks if the first frame is below the second frame where the
7747 % first frame is of type \meta{type1} with \gls{idn} given by
7748 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
7749 % given by \meta{id2}. The starred version uses the \gls{idl} instead
7750 % of the \gls{idn}. The first frame is not considered to be below the
7751 % second frame if they overlap. This code checks the page number to
7752 % determine whether to use \cs{oddcheckifframebelow} or
7753 % \cs{evencheckifframebelow} so it should not be used in the
7754 % first paragraph of the first \gls{flow} on the page if the paragraph
7755 % spans the page break.
7756 % \begin{macrocode}
7757 \NewDocumentCommand \checkifframebelow { s m m m m }
7758 {
7759 \IfBooleanTF { #1 }
7760 {
7761 \__flowframe_check_if_frame_below_by_idl:nnnn
7762 { #2 } { #3 } { #4 } { #5 }
7763 }
7764 {
7765 \__flowframe_check_if_frame_below_by_idn:nnnn
7766 { #2 } { #3 } { #4 } { #5 }
7767 }
7768 }
7769 % \end{macrocode}
7770 %\end{macro}
7771 %\begin{macro}{\@scheckifframebelow}
7772 %\changes{2.0}{2025-11-24}{renamed}
7773 % Check by \gls{idl}.
7774 % Version 2.0 renamed \cs{@scheckifframebelow}.
7775 % \begin{macrocode}
7776 \cs_new:Nn \__flowframe_check_if_frame_below_by_idl:nnnn
7777 {
7778 \int_if_odd { \c@page }
7779 {
7780 \__flowframe_check_odd_if_frame_below_by_idl:nnnn
7781 { #1 } { #2 } { #3 } { #4 }
7782 }
7783 {
7784 \__flowframe_check_even_if_frame_below_by_idl:nnnn
7785 { #1 } { #2 } { #3 } { #4 }
7786 }
7787 }
7788 % \end{macrocode}
7789 %\end{macro}
7790 %\begin{macro}{\@checkifframebelow}
7791 %\changes{2.0}{2025-11-24}{renamed}
7792 % Check by \gls{idl}.
7793 % Version 2.0 renamed \cs{@checkifframebelow}.
7794 % \begin{macrocode}
7795 \cs_new:Nn \__flowframe_check_if_frame_below_by_idn:nnnn
7796 {
7797 \__flowframe_check_if_frame_below_by_idn:nnnnn
7798 { \c@page } { #1 } { #2 } { #3 } { #4 }
7799 }
7800 \cs_new:Nn \__flowframe_check_if_frame_below_by_idn:nnnnn
7801 {
7802 \int_if_odd:nTF { #1 }
7803 {
7804 \__flowframe_check_odd_if_frame_below_by_idn:nnnn
7805 { #2 } { #3 } { #4 } { #5 }
7806 }
7807 {
7808 \__flowframe_check_even_if_frame_below_by_idn:nnnn
7809 { #2 } { #3 } { #4 } { #5 }
7810 }
7811 }
7812 % \end{macrocode}
7813 %\end{macro}
7814 %
7815 %\begin{macro}{\oddcheckifframebelow}
7816 %\changes{1.11}{2008/06/27}{new}
7817 %\changes{2.0}{2025-11-24}{changed to document command}
7818 %\cs{oddcheckifframebelow}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
7819 %
7820 % Checks if the first frame is below the second frame where the
7821 % first frame is of type \meta{type1} with \gls{idn} given by
7822 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
7823 % given by \meta{id2} on odd pages. The starred version uses the \gls{idl} instead
7824 % of the \gls{idn}. The first frame is not considered to be below the
7825 % second frame if they overlap.
7826 % \begin{macrocode}
7827 \NewDocumentCommand \oddcheckifframebelow { s m m m m }
7828 {
7829 \IfBooleanTF { #1 }
7830 {
7831 \__flowframe_check_odd_if_frame_below_by_idl:nnnn
7832 { #2 } { #3 } { #4 } { #5 }
7833 }
7834 {
7835 \__flowframe_check_odd_if_frame_below_by_idn:nnnn
7836 { #2 } { #3 } { #4 } { #5 }
7837 }
7838 }
7839 % \end{macrocode}
7840 %\end{macro}
7841 %\begin{macro}{\@soddcheckifframebelow}
7842 % Check by \gls{idl}.
7843 % Version 2.0 renamed \cs{@soddcheckifframebelow}.
7844 %\changes{2.0}{2025-11-24}{renamed}
7845 % \begin{macrocode}
7846 \cs_new:Nn \__flowframe_check_odd_if_frame_below_by_idl:nnnn
7847 {
7848 \__flowfram_get_frame_id:nn { #1 } { #2 }
7849 \__flowfram_get_frame_bounds_by_type:nn { #1 } { \l__flowfram_id_int }
7850 \dim_add:Nn \ffareay { \ffareaheight }
7851 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareay
7852 \__flowfram_get_frame_id:nn { #3 } { #4 }
7853 \__flowfram_get_frame_bounds_by_type:nn { #3 } { \l__flowfram_id_int }
7854 \dim_compare:nNnTF { \l__flowfram_tmpa_dim} < { \ffareay }
7855 {
7856 \FLFbelowtrue
7857 }
7858 {
7859 \FLFbelowfalse
7860 }
7861 }
7862 % \end{macrocode}
7863 %\end{macro}
7864 %\begin{macro}{\@oddcheckifframebelow}
7865 % Check by \gls{idn}.
7866 % Version 2.0 renamed \cs{@oddcheckifframebelow}.
7867 %\changes{2.0}{2025-11-24}{renamed}
7868 % \begin{macrocode}
7869 \cs_new:Nn \__flowframe_check_odd_if_frame_below_by_idn:nnnn
7870 {
7871 \__flowfram_get_frame_bounds_by_type:nn { #1 } { #2 }
7872 \dim_add:Nn \ffareay { \ffareaheight }
7873 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareay
7874 \__flowfram_get_frame_bounds_by_type:nn { #3 } { #4 }
7875 \dim_compare:nNnTF { \l__flowfram_tmpa_dim } < { \ffareay }
7876 {
7877 \FLFbelowtrue
7878 }
7879 {
7880 \FLFbelowfalse
7881 }
7882 }
7883 % \end{macrocode}
7884 %\end{macro}
7885 %
7886 %\begin{macro}{\checkifframeleft}
7887 %\changes{1.11}{2008/06/27}{new}
7888 %\changes{2.0}{2025-11-24}{changed to document command}
7889 %\cs{checkifframeleft}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
7890 % Checks if the first frame is to the left of the second frame where the
7891 % first frame is of type \meta{type1} with \gls{idn} given by
7892 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
7893 % given by \meta{id2}. The starred version uses the \gls{idl} instead
7894 % of the \gls{idn}. The first frame is not considered to be to the
7895 % left of the second frame if they overlap. This code checks the page number to
7896 % determine whether to use \cs{oddcheckifframeleft} or
7897 % \cs{evencheckifframeleft} so it should not be used in the
7898 % first paragraph of the first \gls{flow} on the page if the paragraph
7899 % spans the page break.
7900 % \begin{macrocode}
7901 \NewDocumentCommand \checkifframeleft { s m m m m m }
7902 {
7903 \IfBooleanTF { #1 }
7904 {
7905 \__flowframe_check_if_frame_left_by_idl:nnnn
7906 { #2 } { #3 } { #4 } { #5 }
7907 }
7908 {
7909 \__flowframe_check_if_frame_left_by_idn:nnnn
7910 { #2 } { #3 } { #4 } { #5 }
7911 }
7912 }
7913 % \end{macrocode}
7914 %\end{macro}
7915 %\begin{macro}{\@scheckifframeleft}
7916 %\changes{2.0}{2025-11-24}{renamed}
7917 % Check by \gls{idl}.
7918 % Version 2.0 renamed \cs{@scheckifframeleft}.
7919 % \begin{macrocode}
7920 \cs_new:Nn \__flowframe_check_if_frame_left_by_idl:nnnn
7921 {
7922 \int_if_odd:nTF { \c@page }
7923 {
7924 \__flowframe_check_odd_if_frame_left_by_idl:nnnn
7925 { #1 } { #2 } { #3 } { #4 }
7926 }
7927 {
7928 \__flowframe_check_even_if_frame_left_by_idl:nnnn
7929 { #1 } { #2 } { #3 } { #4 }
7930 }
7931 }
7932 % \end{macrocode}
7933 %\end{macro}
7934 %\begin{macro}{\@checkifframeleft}
7935 %\changes{2.0}{2025-11-24}{renamed}
7936 % Check by \gls{idn}.
7937 %Version 2.0 renamed \cs{@checkifframeleft}.
7938 % \begin{macrocode}
7939 \cs_new:Nn \__flowframe_check_if_frame_left_by_idn:nnnn
7940 {
7941 \__flowframe_check_if_frame_left_by_idn:nnnnn
7942 { \c@page } { #1 } { #2 } { #3 } { #4 }
7943 }
7944 \cs_new:Nn \__flowframe_check_if_frame_left_by_idn:nnnnn
7945 {
7946 \int_if_odd:nTF { #1 }
7947 {
7948 \__flowframe_check_odd_if_frame_left_by_idn:nnnn
7949 { #2 } { #3 } { #4 } { #5 }
7950 }
7951 {
7952 \__flowframe_check_even_if_frame_left_by_idn:nnnn
7953 { #2 } { #3 } { #4 } { #5 }
7954 }
7955 }
7956 % \end{macrocode}
7957 %\end{macro}
7958 %
7959 %\begin{macro}{\oddcheckifframeleft}
7960 %\changes{1.11}{2008/06/27}{new}
7961 %\cs{oddcheckifframeleft}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
7962 %
7963 % Checks if the first frame is to the left of the second frame where the
7964 % first frame is of type \meta{type1} with \gls{idn} given by
7965 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
7966 % given by \meta{id2} on odd pages. The starred version uses the \gls{idl} instead
7967 % of the \gls{idn}. The first frame is not considered to be to the
7968 % left of the second frame if they overlap.
7969 %\changes{2.0}{2025-11-24}{changed to document command}
7970 % \begin{macrocode}
7971 \NewDocumentCommand \oddcheckifframeleft { s m m m m }
7972 {
7973 \IfBooleanTF { #1 }
7974 {
7975 \__flowframe_check_odd_if_frame_left_by_idl:nnnn
7976 { #2 } { #3 } { #4 } { #5 }
7977 }
7978 {
7979 \__flowframe_check_odd_if_frame_left_by_idn:nnnn
7980 { #2 } { #3 } { #4 } { #5 }
7981 }
7982 }
7983 % \end{macrocode}
7984 %\end{macro}
7985 %\begin{macro}{\@soddcheckifframeleft}
7986 % Check by \gls{idl}.
7987 % Version 2.0 renamed \cs{@soddcheckifframeleft}.
7988 %\changes{2.0}{2025-11-24}{renamed}
7989 % \begin{macrocode}
7990 \cs_new:Nn \__flowframe_check_odd_if_frame_left_by_idl:nnnn
7991 {
7992 \__flowfram_get_frame_id:nn { #1 } { #2 }
7993 \__flowfram_get_frame_bounds_by_type:nn { #1 } { \l__flowfram_id_int }
7994 \dim_add:Nn \ffareax { \ffareawidth }
7995 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareax
7996 \__flowfram_get_frame_id:nn { #3 } { #4 }
7997 \__flowfram_get_frame_bounds_by_type:nn { #3 } { \l__flowfram_id_int }
7998 \dim_compare:nNnTF { \l__flowfram_tmpa_dim } < { \ffareax }
7999 {
8000 \FLFlefttrue
8001 }
8002 {
8003 \FLFleftfalse
8004 }
8005 }
8006 % \end{macrocode}
8007 %\end{macro}
8008 %\begin{macro}{\@oddcheckifframeleft}
8009 % Check by \gls{idn}.
8010 % Version 2.0 renamed \cs{@oddcheckifframeleft}.
8011 %\changes{2.0}{2025-11-24}{renamed}
8012 % \begin{macrocode}
8013 \cs_new:Nn \__flowframe_check_odd_if_frame_left_by_idn:nnnn
8014 {
8015 \__flowfram_get_frame_bounds_by_type:nn { #1 } { #2 }
8016 \dim_add:Nn \ffareax { \ffareawidth }
8017 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareax
8018 \__flowfram_get_frame_bounds_by_type:nn { #3 } { #4 }
8019 \dim_compare:nNnTF { \l__flowfram_tmpa_dim } < { \ffareax }
8020 {
8021 \FLFlefttrue
8022 }
8023 {
8024 \FLFleftfalse
8025 }
8026 }
8027 % \end{macrocode}
8028 %\end{macro}
8029 %
8030 %\begin{macro}{\checkifframeright}
8031 %\changes{1.11}{2008/06/27}{new}
8032 %\changes{2.0}{2025-11-24}{changed to document command}
8033 %\cs{checkifframeright}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
8034 % Checks if the first frame is to the right of the second frame where the
8035 % first frame is of type \meta{type1} with \gls{idn} given by
8036 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
8037 % given by \meta{id2}. The starred version uses the \gls{idl} instead
8038 % of the \gls{idn}. The first frame is not considered to be to the
8039 % right of the second frame if they overlap. This code checks the page number to
8040 % determine whether to use \cs{oddcheckifframeright} or
8041 % \cs{evencheckifframeright} so it should not be used in the
8042 % first paragraph of the first \gls{flow} on the page if the paragraph
8043 % spans the page break.
8044 % \begin{macrocode}
8045 \NewDocumentCommand \checkifframeright { s m m m m }
8046 {
8047 \IfBooleanTF { #1 }
8048 {
8049 \__flowframe_check_if_frame_right_by_idl:nnnn
8050 { #2 } { #3 } { #4 } { #5 }
8051 }
8052 {
8053 \__flowframe_check_if_frame_right_by_idn:nnnn
8054 { #2 } { #3 } { #4 } { #5 }
8055 }
8056 }
8057 % \end{macrocode}
8058 %\end{macro}
8059 %\begin{macro}{\@scheckifframeright}
8060 %\changes{2.0}{2025-11-24}{renamed}
8061 % Check by \gls{idl}.
8062 %Version 2.0 renamed \cs{@scheckifframeright}.
8063 % \begin{macrocode}
8064 \cs_new:Nn \__flowframe_check_if_frame_right_by_idl:nnnn
8065 {
8066 \int_if_odd:nTF { \c@page }
8067 {
8068 \__flowframe_check_odd_if_frame_right_by_idl:nnnn
8069 { #1 } { #2 } { #3 } { #4 }
8070 }
8071 {
8072 \__flowframe_check_even_if_frame_right_by_idl:nnnn
8073 { #1 } { #2 } { #3 } { #4 }
8074 }
8075 }
8076 % \end{macrocode}
8077 %\end{macro}
8078 %\begin{macro}{\@checkifframeright}
8079 %\changes{2.0}{2025-11-24}{renamed}
8080 % Check by \gls{idn}.
8081 %Version 2.0 renamed \cs{@checkifframeright}.
8082 % \begin{macrocode}
8083 \cs_new:Nn \__flowframe_check_if_frame_right_by_idn:nnnn
8084 {
8085 \__flowframe_check_if_frame_right_by_idn:nnnnn
8086 { \c@page } { #1 } { #2 } { #3 } { #4 }
8087 }
8088 \cs_new:Nn \__flowframe_check_if_frame_right_by_idn:nnnnn
8089 {
8090 \int_if_odd:nTF { #1 }
8091 {
8092 \__flowframe_check_odd_if_frame_right_by_idn:nnnn
8093 { #2 } { #3 } { #4 } { #5 }
8094 }
8095 {
8096 \__flowframe_check_even_if_frame_right_by_idn:nnnn
8097 { #2 } { #3 } { #4 } { #5 }
8098 }
8099 }
8100 % \end{macrocode}
8101 %\end{macro}
8102 %
8103 %\begin{macro}{\oddcheckifframeright}
8104 %\changes{1.11}{2008/06/27}{new}
8105 %\changes{2.0}{2025-11-24}{changed to document command}
8106 %\cs{oddcheckifframeright}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
8107 %
8108 % Checks if the first frame is to the right of the second frame where the
8109 % first frame is of type \meta{type1} with \gls{idn} given by
8110 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
8111 % given by \meta{id2} on odd pages. The starred version uses the \gls{idl} instead
8112 % of the \gls{idn}. The first frame is not considered to be to the
8113 % right of the second frame if they overlap.
8114 % \begin{macrocode}
8115 \NewDocumentCommand \oddcheckifframeright { s m m m m }
8116 {
8117 \IfBooleanTF { #1 }
8118 {
8119 \__flowframe_check_odd_if_frame_right_by_idl:nnnn
8120 { #2 } { #3 } { #4 } { #5 }
8121 }
8122 {
8123 \__flowframe_check_odd_if_frame_right_by_idn:nnnn
8124 { #2 } { #3 } { #4 } { #5 }
8125 }
8126 }
8127 % \end{macrocode}
8128 %\end{macro}
8129 %\begin{macro}{\@soddcheckifframeright}
8130 % Check by \gls{idl}.
8131 % Version 2.0 renamed \cs{}@soddcheckifframeright.
8132 %\changes{2.0}{2025-11-24}{renamed}
8133 % \begin{macrocode}
8134 \cs_new:Nn \__flowframe_check_odd_if_frame_right_by_idl:nnnn
8135 {
8136 \__flowfram_get_frame_id:nn { #1 } { #2 }
8137 \__flowfram_get_frame_bounds_by_type:nn { #1 } { \l__flowfram_id_int }
8138 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareax
8139 \__flowfram_get_frame_id:nn { #3 } { #4 }
8140 \__flowfram_get_frame_bounds_by_type:nn { #3 } { \l__flowfram_id_int }
8141 \dim_add:Nn \ffareax { \ffareawidth }
8142 \dim_compare:nNnTF { \l__flowfram_tmpa_dim } > { \ffareax }
8143 {
8144 \FLFrighttrue
8145 }
8146 {
8147 \FLFrightfalse
8148 }
8149 }
8150 % \end{macrocode}
8151 %\end{macro}
8152 %\begin{macro}{\@oddcheckifframeright}
8153 % Check by \gls{idn}.
8154 % Version 2.0 renamed \cs{@oddcheckifframeright}.
8155 %\changes{2.0}{2025-11-24}{renamed}
8156 % \begin{macrocode}
8157 \cs_new:Nn \__flowframe_check_odd_if_frame_right_by_idn:nnnn
8158 {
8159 \__flowfram_get_frame_bounds_by_type:nn { #1 } { #2 }
8160 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareax
8161 \__flowfram_get_frame_bounds_by_type:nn { #3 } { #4 }
8162 \dim_add:Nn \ffareax { \ffareawidth }
8163 \dim_compare:nNnTF { \l__flowfram_tmpa_dim } > { \ffareax }
8164 {
8165 \FLFrighttrue
8166 }
8167 {
8168 \FLFrightfalse
8169 }
8170 }
8171 % \end{macrocode}
8172 %\end{macro}
8173 %
8174 %\begin{macro}{\evencheckifframeabove}
8175 %\changes{1.11}{2008/06/27}{new}
8176 %\changes{2.0}{2025-11-24}{changed to document command}
8177 %\cs{evencheckifframeabove}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
8178 % Checks if the first frame is above the second frame where the
8179 % first frame is of type \meta{type1} with \gls{idn} given by
8180 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
8181 % given by \meta{id2} for even pages.
8182 % The starred version uses the \gls{idl} instead
8183 % of the \gls{idn}. The first frame is not considered to be above the
8184 % second frame if they overlap.
8185 % \begin{macrocode}
8186 \NewDocumentCommand \evencheckifframeabove { s m m m m }
8187 {
8188 \IfBooleanTF { #1 }
8189 {
8190 \__flowframe_check_even_if_frame_above_by_idl:nnnn
8191 { #2 } { #3 } { #4 } { #5 }
8192 }
8193 {
8194 \__flowframe_check_even_if_frame_above_by_idn:nnnn
8195 { #2 } { #3 } { #4 } { #5 }
8196 }
8197 }
8198 % \end{macrocode}
8199 %\end{macro}
8200 %\begin{macro}{\@sevencheckifframeabove}
8201 %\changes{2.0}{2025-11-24}{renamed}
8202 % Check by \gls{idl}.
8203 %Version 2.0 renamed \cs{@sevencheckifframeabove}.
8204 % \begin{macrocode}
8205 \cs_new:Nn \__flowframe_check_even_if_frame_above_by_idl:nnnn
8206 {
8207 \__flowfram_get_frame_id:nn { #1 } { #2 }
8208 \__flowfram_get_frame_even_bounds_by_type:nn { #1 } { \l__flowfram_id_int }
8209 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareay
8210 \__flowfram_get_frame_id:nn { #3 } { #4 }
8211 \__flowfram_get_frame_even_bounds_by_type:nn { #3 } { \l__flowfram_id_int }
8212 \dim_add:Nn \ffareay { \ffareaheight }
8213 \dim_compare:nNnTF { \l__flowfram_tmpa_dim } > { \ffareay }
8214 {
8215 \FLFabovetrue
8216 }
8217 {
8218 \FLFabovefalse
8219 }
8220 }
8221 % \end{macrocode}
8222 %\end{macro}
8223 %\begin{macro}{\@evencheckifframeabove}
8224 % Check by \gls{idn}.
8225 % Version 2.0 renamed \cs{@evencheckifframeabove}.
8226 %\changes{2.0}{2025-11-24}{renamed}
8227 % \begin{macrocode}
8228 \cs_new:Nn \__flowframe_check_even_if_frame_above_by_idn:nnnn
8229 {
8230 \__flowfram_get_frame_even_bounds_by_type:nn { #1 } { #2 }
8231 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareay
8232 \__flowfram_get_frame_even_bounds_by_type:nn { #3 } { #4 }
8233 \dim_add:Nn \ffareay { \ffareaheight }
8234 \dim_compare:nNnTF { \l__flowfram_tmpa_dim } > { \ffareay }
8235 {
8236 \FLFabovetrue
8237 }
8238 {
8239 \FLFabovefalse
8240 }
8241 }
8242 % \end{macrocode}
8243 %\end{macro}
8244 %
8245 %\begin{macro}{\evencheckifframebelow}
8246 %\changes{1.11}{2008/06/27}{new}
8247 %\changes{2.0}{2025-11-24}{changed to document command}
8248 %\cs{checkifframebelow}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
8249 % Checks if the first frame is below the second frame where the
8250 % first frame is of type \meta{type1} with \gls{idn} given by
8251 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
8252 % given by \meta{id2}. The starred version uses the \gls{idl} instead
8253 % of the \gls{idn}. The first frame is not considered to be below the
8254 % second frame if they overlap.
8255 % \begin{macrocode}
8256 \NewDocumentCommand \evencheckifframebelow { s m m m m }
8257 {
8258 \IfBooleanTF { #1 }
8259 {
8260 \__flowframe_check_even_if_frame_below_by_idl:nnnn
8261 { #2 } { #3 } { #4 } { #5 }
8262 }
8263 {
8264 \__flowframe_check_even_if_frame_below_by_idn:nnnn
8265 { #2 } { #3 } { #4 } { #5 }
8266 }
8267 }
8268 % \end{macrocode}
8269 %\end{macro}
8270 %\begin{macro}{\@sevencheckifframebelow}
8271 %\changes{2.0}{2025-11-24}{renamed}
8272 % Check by \gls{idl}.
8273 %Version 2.0 renamed \cs{@sevencheckifframebelow}.
8274 % \begin{macrocode}
8275 \cs_new:Nn \__flowframe_check_even_if_frame_below_by_idl:nnnn
8276 {
8277 \__flowfram_get_frame_id:nn { #1 } { #2 }
8278 \__flowfram_get_frame_even_bounds_by_type:nn { #1 } { \l__flowfram_id_int }
8279 \dim_add:Nn \ffareay { \ffareaheight }
8280 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareay
8281 \__flowfram_get_frame_id:nn { #3 } { #4 }
8282 \__flowfram_get_frame_even_bounds_by_type:nn { #3 } { \l__flowfram_id_int }
8283 \dim_compare:nNnTF { \l__flowfram_tmpa_dim } < { \ffareay }
8284 {
8285 \FLFbelowtrue
8286 }
8287 {
8288 \FLFbelowfalse
8289 }
8290 }
8291 % \end{macrocode}
8292 %\end{macro}
8293 %\begin{macro}{\@evencheckifframebelow}
8294 % Check by \gls{idn}.
8295 % Version 2.0 renamed \cs{@evencheckifframebelow}.
8296 %\changes{2.0}{2025-11-24}{renamed}
8297 % \begin{macrocode}
8298 \cs_new:Nn \__flowframe_check_even_if_frame_below_by_idn:nnnn
8299 {
8300 \__flowfram_get_frame_even_bounds_by_type:nn { #1 } { #2 }
8301 \dim_add:Nn \ffareay { \ffareaheight }
8302 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareay
8303 \__flowfram_get_frame_even_bounds_by_type:nn { #3 } { #4 }
8304 \dim_compare:nNnTF { \l__flowfram_tmpa_dim } < { \ffareay }
8305 {
8306 \FLFbelowtrue
8307 }
8308 {
8309 \FLFbelowfalse
8310 }
8311 }
8312 % \end{macrocode}
8313 %\end{macro}
8314 %
8315 %\begin{macro}{\evencheckifframeleft}
8316 %\changes{1.11}{2008/06/27}{new}
8317 %\changes{2.0}{2025-11-24}{changed to document command}
8318 %\cs{evencheckifframeleft}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
8319 % Checks if the first frame is to the left of the second frame where the
8320 % first frame is of type \meta{type1} with \gls{idn} given by
8321 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
8322 % given by \meta{id2}. The starred version uses the \gls{idl} instead
8323 % of the \gls{idn}. The first frame is not considered to be to the
8324 % left of the second frame if they overlap.
8325 % \begin{macrocode}
8326 \NewDocumentCommand \evencheckifframeleft { s m m m m }
8327 {
8328 \IfBooleanTF { #1 }
8329 {
8330 \__flowframe_check_even_if_frame_left_by_idl:nnnn
8331 { #2 } { #3 } { #4 } { #5 }
8332 }
8333 {
8334 \__flowframe_check_even_if_frame_left_by_idn:nnnn
8335 { #2 } { #3 } { #4 } { #5 }
8336 }
8337 }
8338 % \end{macrocode}
8339 %\end{macro}
8340 %\begin{macro}{\@sevencheckifframeleft}
8341 %\changes{2.0}{2025-11-24}{renamed}
8342 % Check by \gls{idl}.
8343 %Version 2.0 renamed \cs{@sevencheckifframeleft}.
8344 % \begin{macrocode}
8345 \cs_new:Nn \__flowframe_check_even_if_frame_left_by_idl:nnnn
8346 {
8347 \__flowfram_get_frame_id:nn { #1 } { #2 }
8348 \__flowfram_get_frame_even_bounds_by_type:nn { #1 } { \l__flowfram_id_int }
8349 \dim_add:Nn \ffareax { \ffareawidth }
8350 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareax
8351 \__flowfram_get_frame_id:nn { #3 } { #4 }
8352 \__flowfram_get_frame_even_bounds_by_type:nn { #3 } { \l__flowfram_id_int }
8353 \dim_compare:nNnTF { \l__flowfram_tmpa_dim } < { \ffareax }
8354 {
8355 \FLFlefttrue
8356 }
8357 {
8358 \FLFleftfalse
8359 }
8360 }
8361 % \end{macrocode}
8362 %\end{macro}
8363 %\begin{macro}{\@evencheckifframeleft}
8364 % Check by \gls{idn}.
8365 % Version 2.0 renamed \cs{@evencheckifframeleft}.
8366 %\changes{2.0}{2025-11-24}{renamed}
8367 % \begin{macrocode}
8368 \cs_new:Nn \__flowframe_check_even_if_frame_left_by_idn:nnnn
8369 {
8370 \__flowfram_get_frame_even_bounds_by_type:nn { #1 } { #2 }
8371 \dim_add:Nn \ffareax { \ffareawidth }
8372 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareax
8373 \__flowfram_get_frame_even_bounds_by_type:nn { #3 } { #4 }
8374 \dim_compare:nNnTF { \l__flowfram_tmpa_dim } < { \ffareax }
8375 {
8376 \FLFlefttrue
8377 }
8378 {
8379 \FLFleftfalse
8380 }
8381 }
8382 % \end{macrocode}
8383 %\end{macro}
8384 %
8385 %\begin{macro}{\evencheckifframeright}
8386 %\changes{1.11}{2008/06/27}{new}
8387 %\changes{2.0}{2025-11-24}{changed to document command}
8388 %\cs{evencheckifframeright}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
8389 % Checks if the first frame is to the right of the second frame where the
8390 % first frame is of type \meta{type1} with \gls{idn} given by
8391 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
8392 % given by \meta{id2}. The starred version uses the \gls{idl} instead
8393 % of the \gls{idn}. The first frame is not considered to be to the
8394 % right of the second frame if they overlap.
8395 % \begin{macrocode}
8396 \NewDocumentCommand \evencheckifframeright { s m m m m }
8397 {
8398 \IfBooleanTF { #1 }
8399 {
8400 \__flowframe_check_even_if_frame_right_by_idl:nnnn
8401 { #2 } { #3 } { #4 } { #5 }
8402 }
8403 {
8404 \__flowframe_check_even_if_frame_right_by_idn:nnnn
8405 { #2 } { #3 } { #4 } { #5 }
8406 }
8407 }
8408 % \end{macrocode}
8409 %\end{macro}
8410 %\begin{macro}{\@sevencheckifframeright}
8411 %\changes{2.0}{2025-11-24}{renamed}
8412 % Check by \gls{idl}.
8413 %Version 2.0 renamed \cs{@sevencheckifframeright}.
8414 % \begin{macrocode}
8415 \cs_new:Nn \__flowframe_check_even_if_frame_right_by_idl:nnnn
8416 {
8417 \__flowfram_get_frame_id:nn { #1 } { #2 }
8418 \__flowfram_get_frame_even_bounds_by_type:nn { #1 } { \l__flowfram_id_int }
8419 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareax
8420 \__flowfram_get_frame_id:nn { #3 } { #4 }
8421 \__flowfram_get_frame_even_bounds_by_type:nn { #3 } { \l__flowfram_id_int }
8422 \dim_add:Nn \ffareax { \ffareawidth }
8423 \dim_compare:nNnTF {\l__flowfram_tmpa_dim } > { \ffareax }
8424 {
8425 \FLFrighttrue
8426 }
8427 {
8428 \FLFrightfalse
8429 }
8430 }
8431 % \end{macrocode}
8432 %\end{macro}
8433 %\begin{macro}{\@evencheckifframeright}
8434 % Check by \gls{idn}.
8435 % Version 2.0 renamed \cs{@evencheckifframeright}.
8436 %\changes{2.0}{2025-11-24}{renamed}
8437 % \begin{macrocode}
8438 \cs_new:Nn \__flowframe_check_even_if_frame_right_by_idn:nnnn
8439 {
8440 \__flowfram_get_frame_even_bounds_by_type:nn { #1 } { #2 }
8441 \dim_set_eq:NN \l__flowfram_tmpa_dim \ffareax
8442 \__flowfram_get_frame_even_bounds_by_type:nn { #3 } { #4 }
8443 \dim_add:Nn \ffareax { \ffareawidth }
8444 \dim_compare:nNnTF {\l__flowfram_tmpa_dim } > { \ffareax }
8445 {
8446 \FLFrighttrue
8447 }
8448 {
8449 \FLFrightfalse
8450 }
8451 }
8452 % \end{macrocode}
8453 %\end{macro}
8454 %
8455 % Textual labels used to indicate relative location of one frame
8456 % to another.
8457 %\begin{macro}{\FFaboveleft}
8458 %\changes{1.11}{2008/06/27}{new}
8459 % \begin{macrocode}
8460 \newcommand*{\FFaboveleft}{above ~ left}
8461 % \end{macrocode}
8462 %\end{macro}
8463 %\begin{macro}{\FFaboveright}
8464 %\changes{1.11}{2008/06/27}{new}
8465 % \begin{macrocode}
8466 \newcommand*{\FFaboveright}{above ~ right}
8467 % \end{macrocode}
8468 %\end{macro}
8469 %\begin{macro}{\FFbelowleft}
8470 %\changes{1.11}{2008/06/27}{new}
8471 % \begin{macrocode}
8472 \newcommand*{\FFbelowleft}{below ~ left}
8473 % \end{macrocode}
8474 %\end{macro}
8475 %\begin{macro}{\FFbelowright}
8476 %\changes{1.11}{2008/06/27}{new}
8477 % \begin{macrocode}
8478 \newcommand*{\FFbelowright}{below ~ right}
8479 % \end{macrocode}
8480 %\end{macro}
8481 %\begin{macro}{\FFleft}
8482 %\changes{1.11}{2008/06/27}{new}
8483 % \begin{macrocode}
8484 \newcommand*{\FFleft}{on ~ the ~ left}
8485 % \end{macrocode}
8486 %\end{macro}
8487 %\begin{macro}{\FFbelowright}
8488 %\changes{1.11}{2008/06/27}{new}
8489 % \begin{macrocode}
8490 \newcommand*{\FFright}{on ~ the ~ right}
8491 % \end{macrocode}
8492 %\end{macro}
8493 %\begin{macro}{\FFabove}
8494 %\changes{1.11}{2008/06/27}{new}
8495 % \begin{macrocode}
8496 \newcommand*{\FFabove}{above}
8497 % \end{macrocode}
8498 %\end{macro}
8499 %\begin{macro}{\FFbelow}
8500 %\changes{1.11}{2008/06/27}{new}
8501 % \begin{macrocode}
8502 \newcommand*{\FFbelow}{below}
8503 % \end{macrocode}
8504 %\end{macro}
8505 %\begin{macro}{\FFoverlap}
8506 %\changes{1.11}{2008/06/27}{new}
8507 % \begin{macrocode}
8508 \newcommand*{\FFoverlap}{overlap}
8509 % \end{macrocode}
8510 %\end{macro}
8511 %
8512 %\begin{macro}{\relativeframelocation}
8513 %\changes{1.11}{2008/06/27}{new}
8514 %\changes{2.0}{2025-11-24}{changed to document command}
8515 %\begin{definition}
8516 %\cs{relativeframelocation}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
8517 %\end{definition}
8518 % Displays one of the above commands depending on the relative
8519 % locations of the first frame to the second frame. The arguments
8520 % \meta{id1} and \meta{id2} refer to the \gls{idn} for the unstarred
8521 % version and to the \gls{idl} for the starred version.
8522 % \begin{macrocode}
8523 \NewDocumentCommand \relativeframelocation { s m m m m }
8524 {
8525 \IfBooleanTF { #1 }
8526 {
8527 \__flowfram_relative_frame_location_by_idl:nnnn
8528 { #2 } { #3 } { #4 } { #5 }
8529 }
8530 {
8531 \__flowfram_relative_frame_location_by_idn:nnnn
8532 { #2 } { #3 } { #4 } { #5 }
8533 }
8534 }
8535 % \end{macrocode}
8536 %\end{macro}
8537 %\begin{macro}{\@srelativeframelocation}
8538 %\changes{2.0}{2025-11-24}{renamed}
8539 %Check by \gls{idl}.
8540 %Version 2.0 renamed \cs{@srelativeframelocation}.
8541 % \begin{macrocode}
8542 \cs_new:Nn \__flowfram_relative_frame_location_by_idl:nnnn
8543 {
8544 \__flowfram_get_frame_id:nn { #1 } { #2 }
8545 \int_set_eq:NN \l__flowfram_tmpa_int \l__flowfram_id_int
8546 \__flowfram_get_frame_id:nn { #3 } { #4 }
8547 \int_set_eq:NN \l__flowfram_tmpb_int \l__flowfram_id_int
8548 \__flowfram_relative_frame_location_by_idn:nVnV
8549 { #1 } \l__flowfram_tmpa_int
8550 { #3 } \l__flowfram_tmpb_int
8551 }
8552 % \end{macrocode}
8553 %\end{macro}
8554 %\begin{macro}{\@relativeframelocation}
8555 %\changes{2.0}{2025-11-24}{renamed}
8556 %Check by \gls{idn}.
8557 %Version 2.0 renamed \cs{@relativeframelocation}.
8558 % \begin{macrocode}
8559 \cs_new:Nn \__flowfram_relative_frame_location_by_idn:nnnn
8560 {
8561 \__flowfram_relative_frame_location_by_idn:nnnnn
8562 { \c@page } { #1 } { #2 } { #3 } { #4 }
8563 }
8564 \cs_generate_variant:Nn \__flowfram_relative_frame_location_by_idn:nnnn
8565 { nVnV }
8566 % \end{macrocode}
8567 %\end{macro}
8568 %For a specific page:
8569 % \begin{macrocode}
8570 \cs_new:Nn \__flowfram_relative_frame_location_by_idn:nnnnn
8571 {
8572 \__flowframe_check_if_frame_above_by_idn:nnnnn
8573 { #1 } { #2 } { #3 } { #4 } { #5 }
8574 \__flowframe_check_if_frame_below_by_idn:nnnnn
8575 { #1 } { #2 } { #3 } { #4 } { #5 }
8576 \__flowframe_check_if_frame_left_by_idn:nnnnn
8577 { #1 } { #2 } { #3 } { #4 } { #5 }
8578 \__flowframe_check_if_frame_right_by_idn:nnnnn
8579 { #1 } { #2 } { #3 } { #4 } { #5 }
8580 \ifFLFabove
8581 \ifFLFleft
8582 \FFaboveleft
8583 \else
8584 \ifFLFright
8585 \FFaboveright
8586 \else
8587 \FFabove
8588 \fi
8589 \fi
8590 \else
8591 \ifFLFbelow
8592 \ifFLFleft
8593 \FFbelowleft
8594 \else
8595 \ifFLFright
8596 \FFbelowright
8597 \else
8598 \FFbelow
8599 \fi
8600 \fi
8601 \else
8602 \ifFLFleft
8603 \FFleft
8604 \else
8605 \ifFLFright
8606 \FFright
8607 \else
8608 \FFoverlap
8609 \fi
8610 \fi
8611 \fi
8612 \fi
8613 }
8614 % \end{macrocode}
8615 %
8616 %\begin{macro}{\SaveRelativeFrameLocation}
8617 %\begin{definition}
8618 %\cs{SaveRelativeFrameLocation}\marg{label}\marg{type1}\marg{ID1}\marg{type2}\marg{ID2}
8619 %\end{definition}
8620 %\changes{2.0}{2025-11-24}{new}
8621 %Save in aux file for next run.
8622 % \begin{macrocode}
8623 \NewDocumentCommand \SaveRelativeFrameLocation { s m m m m m }
8624 {
8625 \IfBooleanTF { #1 }
8626 {
8627 \__flowfram_get_frame_id:nn { #3 } { #4 }
8628 \int_set_eq:NN \l__flowfram_tmpa_int \l__flowfram_id_int
8629 \__flowfram_get_frame_id:nn { #5 } { #6 }
8630 \int_set_eq:NN \l__flowfram_tmpb_int \l__flowfram_id_int
8631 }
8632 {
8633 \int_set:Nn \l__flowfram_tmpa_int { #4 }
8634 \int_set:Nn \l__flowfram_tmpb_int { #6 }
8635 }
8636 % \end{macrocode}
8637 %Obtain the dimensions of the first frame:
8638 % \begin{macrocode}
8639 \flowfram_set_dim_to_frame_dim:Nnnn
8640 \l__flowfram_x_dim
8641 { #3 } { posx } { \l__flowfram_tmpa_int }
8642 \flowfram_set_dim_to_frame_dim:Nnnn
8643 \l__flowfram_evenx_dim
8644 { #3 } { evenx } { \l__flowfram_tmpa_int }
8645 \flowfram_set_dim_to_frame_dim:Nnnn
8646 \l__flowfram_y_dim
8647 { #3 } { posy } { \l__flowfram_tmpa_int }
8648 \flowfram_set_dim_to_frame_dim:Nnnn
8649 \l__flowfram_eveny_dim
8650 { #3 } { eveny } { \l__flowfram_tmpa_int }
8651 \flowfram_set_dim_to_frame_dim:Nnnn
8652 \l__flowfram_width_dim
8653 { #3 } { width } { \l__flowfram_tmpa_int }
8654 \flowfram_set_dim_to_frame_dim:Nnnn
8655 \l__flowfram_height_dim
8656 { #3 } { height } { \l__flowfram_tmpa_int }
8657 % \end{macrocode}
8658 %Store the first frame values:
8659 % \begin{macrocode}
8660 \tl_set:Ne \l__flowfram_x_tl
8661 { \dim_use:N \l__flowfram_x_dim }
8662 \tl_set:Ne \l__flowfram_y_tl
8663 { \dim_use:N \l__flowfram_y_dim }
8664 \tl_set:Ne \l__flowfram_evenx_tl
8665 { \dim_use:N \l__flowfram_evenx_dim }
8666 \tl_set:Ne \l__flowfram_eveny_tl
8667 { \dim_use:N \l__flowfram_eveny_dim }
8668 \tl_set:Ne \l__flowfram_width_tl
8669 { \dim_use:N \l__flowfram_width_dim }
8670 \tl_set:Ne \l__flowfram_height_tl
8671 { \dim_use:N \l__flowfram_height_dim }
8672 % \end{macrocode}
8673 %Obtain the dimensions of the first frame:
8674 % \begin{macrocode}
8675 \flowfram_set_dim_to_frame_dim:Nnnn
8676 \l__flowfram_x_dim
8677 { #5 } { posx } { \l__flowfram_tmpb_int }
8678 \flowfram_set_dim_to_frame_dim:Nnnn
8679 \l__flowfram_evenx_dim
8680 { #5 } { evenx } { \l__flowfram_tmpb_int }
8681 \flowfram_set_dim_to_frame_dim:Nnnn
8682 \l__flowfram_y_dim
8683 { #5 } { posy } { \l__flowfram_tmpb_int }
8684 \flowfram_set_dim_to_frame_dim:Nnnn
8685 \l__flowfram_eveny_dim
8686 { #5 } { eveny } { \l__flowfram_tmpb_int }
8687 \flowfram_set_dim_to_frame_dim:Nnnn
8688 \l__flowfram_width_dim
8689 { #5 } { width } { \l__flowfram_tmpb_int }
8690 \flowfram_set_dim_to_frame_dim:Nnnn
8691 \l__flowfram_height_dim
8692 { #5 } { height } { \l__flowfram_tmpb_int }
8693 % \end{macrocode}
8694 %Write the information to the aux file (the actual page value is
8695 %required not \cs{thepage}):
8696 % \begin{macrocode}
8697 \protected@write \@auxout
8698 { \let \flowfram@thepagenumber \relax }
8699 {
8700 \string \@flowfram@saverelativeloc
8701 { #2 }
8702 { \flowfram@thepagenumber }
8703 {
8704 { \l__flowfram_x_tl }
8705 { \l__flowfram_y_tl }
8706 { \l__flowfram_evenx_tl }
8707 { \l__flowfram_eveny_tl }
8708 { \l__flowfram_width_tl }
8709 { \l__flowfram_height_tl }
8710 }
8711 {
8712 { \dim_use:N \l__flowfram_x_dim }
8713 { \dim_use:N \l__flowfram_y_dim }
8714 { \dim_use:N \l__flowfram_evenx_dim }
8715 { \dim_use:N \l__flowfram_eveny_dim }
8716 { \dim_use:N \l__flowfram_width_dim }
8717 { \dim_use:N \l__flowfram_height_dim }
8718 }
8719 }
8720 \tl_if_exist:cF { g__flowfram_saved_rel_loc_ #2 _tl }
8721 {
8722 \@flowframe@warn@rerun
8723 }
8724 }
8725 % \end{macrocode}
8726 %\end{macro}
8727 %Extract the dimension arguments:
8728 % \begin{macrocode}
8729 \cs_new:Nn \__flowfram_fetch_odd_dimensions:nnnnnn
8730 {
8731 \dim_set:Nn \l__flowfram_x_dim { #1 }
8732 \dim_set:Nn \l__flowfram_y_dim { #2 }
8733 \dim_set:Nn \l__flowfram_width_dim { #5 }
8734 \dim_set:Nn \l__flowfram_height_dim { #6 }
8735 }
8736 \cs_new:Nn \__flowfram_fetch_even_dimensions:nnnnnn
8737 {
8738 \dim_set:Nn \l__flowfram_x_dim { #3 }
8739 \dim_set:Nn \l__flowfram_y_dim { #4 }
8740 \dim_set:Nn \l__flowfram_width_dim { #5 }
8741 \dim_set:Nn \l__flowfram_height_dim { #6 }
8742 }
8743 % \end{macrocode}
8744 %\begin{macro}{\@flowfram@saverelativeloc}
8745 %\changes{2.0}{2025-11-24}{new}
8746 %\begin{definition}
8747 %\cs{@flowfram@saverelativeloc}\marg{label}\marg{page}\marg{frame 1
8748 %dimensions}\marg{frame 2 dimensions}
8749 %\end{definition}
8750 % \begin{macrocode}
8751 \newcommand\@flowfram@saverelativeloc [ 4 ]
8752 {
8753 \tl_if_exist:cTF { g__flowfram_saved_rel_loc_ #1 _tl }
8754 {
8755 \msg_warning:nnn { flowfram } { relloc-label-already-defined }
8756 { #1 }
8757 }
8758 {
8759 \tl_const:cn { c__flowfram_saved_data_rel_loc_ #1 _tl }
8760 { { #2 } { #3 } { #4 } }
8761 \tl_new:c { g__flowfram_saved_rel_loc_ #1 _tl }
8762 \int_if_odd:nTF { #2 }
8763 {
8764 \__flowfram_fetch_odd_dimensions:nnnnnn #3
8765 }
8766 {
8767 \__flowfram_fetch_even_dimensions:nnnnnn #3
8768 }
8769 \dim_set_eq:NN \ffareax \l__flowfram_x_dim
8770 \dim_set_eq:NN \ffareay \l__flowfram_y_dim
8771 \dim_set_eq:NN \ffareawidth \l__flowfram_width_dim
8772 \dim_set_eq:NN \ffareaheight \l__flowfram_height_dim
8773 \int_if_odd:nTF { #2 }
8774 {
8775 \__flowfram_fetch_odd_dimensions:nnnnnn #4
8776 }
8777 {
8778 \__flowfram_fetch_even_dimensions:nnnnnn #4
8779 }
8780 \FLFabovefalse
8781 \FLFbelowfalse
8782 \FLFleftfalse
8783 \FLFrightfalse
8784 \dim_compare:nNnTF
8785 { \ffareax } > { \l__flowfram_x_dim + \l__flowfram_width_dim }
8786 {
8787 \FLFrighttrue
8788 }
8789 {
8790 \dim_compare:nNnT
8791 { \ffareax + \ffareawidth } < { \l__flowfram_x_dim }
8792 {
8793 \FLFlefttrue
8794 }
8795 }
8796 \dim_compare:nNnTF
8797 { \ffareay } > { \l__flowfram_y_dim + \l__flowfram_height_dim }
8798 {
8799 \FLFabovetrue
8800 }
8801 {
8802 \dim_compare:nNnT
8803 { \ffareay + \ffareaheight } < { \l__flowfram_y_dim }
8804 {
8805 \FLFbelowtrue
8806 }
8807 }
8808 \ifFLFabove
8809 \ifFLFleft
8810 \tl_gset:cn { g__flowfram_saved_rel_loc_ #1 _tl }
8811 { \FFaboveleft }
8812 \else
8813 \ifFLFright
8814 \tl_gset:cn { g__flowfram_saved_rel_loc_ #1 _tl }
8815 { \FFaboveright }
8816 \else
8817 \tl_gset:cn { g__flowfram_saved_rel_loc_ #1 _tl }
8818 { \FFabove }
8819 \fi
8820 \fi
8821 \else
8822 \ifFLFbelow
8823 \ifFLFleft
8824 \tl_gset:cn { g__flowfram_saved_rel_loc_ #1 _tl }
8825 { \FFbelowleft }
8826 \else
8827 \ifFLFright
8828 \tl_gset:cn { g__flowfram_saved_rel_loc_ #1 _tl }
8829 { \FFbelowright }
8830 \else
8831 \tl_gset:cn { g__flowfram_saved_rel_loc_ #1 _tl }
8832 { \FFbelow }
8833 \fi
8834 \fi
8835 \else
8836 \ifFLFleft
8837 \tl_gset:cn { g__flowfram_saved_rel_loc_ #1 _tl }
8838 { \FFleft }
8839 \else
8840 \ifFLFright
8841 \tl_gset:cn { g__flowfram_saved_rel_loc_ #1 _tl }
8842 { \FFright }
8843 \else
8844 \tl_gset:cn { g__flowfram_saved_rel_loc_ #1 _tl }
8845 { \FFoverlap }
8846 \fi
8847 \fi
8848 \fi
8849 \fi
8850 \bool_new:c { g__flowfram_saved_rel_loc_ #1 _above_bool }
8851 \bool_new:c { g__flowfram_saved_rel_loc_ #1 _below_bool }
8852 \bool_new:c { g__flowfram_saved_rel_loc_ #1 _left_bool }
8853 \bool_new:c { g__flowfram_saved_rel_loc_ #1 _right_bool }
8854 \ifFLFabove
8855 \bool_gset_true:c { g__flowfram_saved_rel_loc_ #1 _above_bool }
8856 \fi
8857 \ifFLFbelow
8858 \bool_gset_true:c { g__flowfram_saved_rel_loc_ #1 _below_bool }
8859 \fi
8860 \ifFLFleft
8861 \bool_gset_true:c { g__flowfram_saved_rel_loc_ #1 _left_bool }
8862 \fi
8863 \ifFLFright
8864 \bool_gset_true:c { g__flowfram_saved_rel_loc_ #1 _right_bool }
8865 \fi
8866 }
8867 }
8868 \AddToHook { begindocument / end }
8869 {
8870 \cs_gset_eq:NN \@flowfram@saverelativeloc \@flowfram@checkrelativeloc
8871 }
8872 % \end{macrocode}
8873 %\end{macro}
8874 %
8875 %\begin{macro}{\@flowfram@checkrelativeloc}
8876 %\changes{2.0}{2025-11-24}{new}
8877 % \begin{macrocode}
8878 \newcommand\@flowfram@checkrelativeloc [ 4 ]
8879 {
8880 \tl_if_exist:cT { c__flowfram_saved_data_rel_loc_ #1 _tl }
8881 {
8882 \tl_if_eq:cnF { c__flowfram_saved_data_rel_loc_ #1 _tl }
8883 { { #2 } { #3 } { #4 } }
8884 {
8885 \@flowframe@warn@rerun
8886 }
8887 }
8888 }
8889 % \end{macrocode}
8890 %\end{macro}
8891 %
8892 %\begin{macro}{\@flowframe@warn@rerun}
8893 %\changes{2.0}{2025-11-24}{new}
8894 % \begin{macrocode}
8895 \newcommand \@flowframe@warn@rerun
8896 {
8897 \AtEndDocument
8898 {
8899 \msg_warning:nn { flowfram} { data-changed-rerun }
8900 }
8901 \global \let \@flowframe@warn@rerun \relax
8902 }
8903 % \end{macrocode}
8904 %\end{macro}
8905 %
8906 %\begin{macro}{\RefSavedRelativeLocation}
8907 %\changes{2.0}{2025-11-24}{new}
8908 % \begin{macrocode}
8909 \NewDocumentCommand \RefSavedRelativeLocation { m }
8910 {
8911 \tl_if_exist:cTF { g__flowfram_saved_rel_loc_ #1 _tl }
8912 {
8913 \tl_use:c { g__flowfram_saved_rel_loc_ #1 _tl }
8914 }
8915 {
8916 ??
8917 \msg_warning:nnn { flowfram } { relloc-label-not-defined }
8918 { #1 }
8919 }
8920 }
8921 % \end{macrocode}
8922 %\end{macro}
8923 %
8924 %\begin{macro}{\IfSavedRelativeLocationEq}
8925 %\changes{2.0}{2025-11-24}{new}
8926 %\begin{definition}
8927 %\cs{IfSavedRelativeLocationEq}\marg{label}\marg{value}\marg{true}\marg{false}
8928 %\end{definition}
8929 % \begin{macrocode}
8930 \NewDocumentCommand \IfSavedRelativeLocationEq { m m m m }
8931 {
8932 \tl_if_exist:cTF { g__flowfram_saved_rel_loc_ #1 _tl }
8933 {
8934 \tl_if_eq:cnTF { g__flowfram_saved_rel_loc_ #1 _tl } { #2 }
8935 { #3 } { #4 }
8936 }
8937 { #4 }
8938 }
8939 % \end{macrocode}
8940 %\end{macro}
8941 %
8942 %\begin{macro}{\IfSavedRelativeLocationAbove}
8943 %\changes{2.0}{2025-11-24}{new}
8944 %\begin{definition}
8945 %\cs{IfSavedRelativeLocationAbove}\marg{label}\marg{true}\marg{false}
8946 %\end{definition}
8947 % \begin{macrocode}
8948 \newcommand \IfSavedRelativeLocationAbove [ 3 ]
8949 {
8950 \bool_if_exist:cTF { g__flowfram_saved_rel_loc_ #1 _above_bool }
8951 {
8952 \bool_if:cTF { g__flowfram_saved_rel_loc_ #1 _above_bool }
8953 { #2 } { #3 }
8954 }
8955 { #3 }
8956 }
8957 % \end{macrocode}
8958 %\end{macro}
8959 %
8960 %\begin{macro}{\IfSavedRelativeLocationBelow}
8961 %\changes{2.0}{2025-11-24}{new}
8962 %\begin{definition}
8963 %\cs{IfSavedRelativeLocationBelow}\marg{label}\marg{true}\marg{false}
8964 %\end{definition}
8965 % \begin{macrocode}
8966 \newcommand \IfSavedRelativeLocationBelow [ 3 ]
8967 {
8968 \bool_if_exist:cTF { g__flowfram_saved_rel_loc_ #1 _below_bool }
8969 {
8970 \bool_if:cTF { g__flowfram_saved_rel_loc_ #1 _below_bool }
8971 { #2 } { #3 }
8972 }
8973 { #3 }
8974 }
8975 % \end{macrocode}
8976 %\end{macro}
8977 %
8978 %\begin{macro}{\IfSavedRelativeLocationLeft}
8979 %\changes{2.0}{2025-11-24}{new}
8980 %\begin{definition}
8981 %\cs{IfSavedRelativeLocationLeft}\marg{label}\marg{true}\marg{false}
8982 %\end{definition}
8983 % \begin{macrocode}
8984 \newcommand \IfSavedRelativeLocationLeft [ 3 ]
8985 {
8986 \bool_if_exist:cTF { g__flowfram_saved_rel_loc_ #1 _left_bool }
8987 {
8988 \bool_if:cTF { g__flowfram_saved_rel_loc_ #1 _left_bool }
8989 { #2 } { #3 }
8990 }
8991 { #3 }
8992 }
8993 % \end{macrocode}
8994 %\end{macro}
8995 %
8996 %\begin{macro}{\IfSavedRelativeLocationRight}
8997 %\changes{2.0}{2025-11-24}{new}
8998 %\begin{definition}
8999 %\cs{IfSavedRelativeLocationRight}\marg{label}\marg{true}\marg{false}
9000 %\end{definition}
9001 % \begin{macrocode}
9002 \newcommand \IfSavedRelativeLocationRight [ 3 ]
9003 {
9004 \bool_if_exist:cTF { g__flowfram_saved_rel_loc_ #1 _right_bool }
9005 {
9006 \bool_if:cTF { g__flowfram_saved_rel_loc_ #1 _right_bool }
9007 { #2 } { #3 }
9008 }
9009 { #3 }
9010 }
9011 % \end{macrocode}
9012 %\end{macro}
9013 %
9014 % Short cut commands for \glspl{frame} of the same type.
9015 %\begin{macro}{\reldynamicloc}
9016 %\changes{1.11}{2008/06/27}{new}
9017 %\changes{1.14}{2012-11-10}{removed unwanted spaces}
9018 %\changes{2.0}{2025-11-24}{changed to document command}
9019 %\cs{reldynamicloc}\marg{id1}\marg{id2}
9020 % \begin{macrocode}
9021 \NewDocumentCommand \reldynamicloc { s m m }
9022 {
9023 \IfBooleanTF { #1 }
9024 {
9025 \__flowfram_relative_frame_location_by_idl:nnnn
9026 { dynamic } { #2 } { dynamic } { #3 }
9027 }
9028 {
9029 \__flowfram_relative_frame_location_by_idn:nnnn
9030 { dynamic } { #2 } { dynamic } { #3 }
9031 }
9032 }
9033 % \end{macrocode}
9034 %\end{macro}
9035 %\begin{macro}{\@sreldynamicloc}
9036 %Version 2.0 removed \cs{@sreldynamicloc}.
9037 %\changes{2.0}{2025-11-24}{removed}
9038 %\end{macro}
9039 %\begin{macro}{\@reldynamicloc}
9040 %Version 2.0 removed \cs{@reldynamicloc}.
9041 %\changes{2.0}{2025-11-24}{removed}
9042 %\end{macro}
9043 %
9044 %\begin{macro}{\relstaticloc}
9045 %\changes{1.11}{2008/06/27}{new}
9046 %\changes{1.14}{2012-11-10}{removed unwanted spaces}
9047 %\changes{2.0}{2025-11-24}{changed to document command}
9048 %\cs{relstaticloc}\marg{id1}\marg{id2}
9049 % \begin{macrocode}
9050 \NewDocumentCommand \relstaticloc { s m m }
9051 {
9052 \IfBooleanTF { #1 }
9053 {
9054 \__flowfram_relative_frame_location_by_idl:nnnn
9055 { static } { #2 } { static } { #3 }
9056 }
9057 {
9058 \__flowfram_relative_frame_location_by_idn:nnnn
9059 { static } { #2 } { static } { #3 }
9060 }
9061 }
9062 % \end{macrocode}
9063 %\end{macro}
9064 %\begin{macro}{\@srelstaticloc}
9065 %Version 2.0 removed \cs{@srelstaticloc}.
9066 %\changes{2.0}{2025-11-24}{removed}
9067 %\end{macro}
9068 %\begin{macro}{\@relstaticloc}
9069 %Version 2.0 removed \cs{@relstaticloc}.
9070 %\changes{2.0}{2025-11-24}{removed}
9071 %\end{macro}
9072 %
9073 %\begin{macro}{\relflowloc}
9074 %\changes{1.11}{2008/06/27}{new}
9075 %\changes{1.14}{2012-11-10}{removed unwanted spaces}
9076 %\changes{2.0}{2025-11-24}{changed to document command}
9077 %\cs{relflowloc}\marg{id1}\marg{id2}
9078 % \begin{macrocode}
9079 \NewDocumentCommand \relflowloc { s m m }
9080 {
9081 \IfBooleanTF { #1 }
9082 {
9083 \__flowfram_relative_frame_location_by_idl:nnnn
9084 { flow } { #2 } { flow } { #3 }
9085 }
9086 {
9087 \__flowfram_relative_frame_location_by_idn:nnnn
9088 { flow } { #2 } { flow } { #3 }
9089 }
9090 }
9091 % \end{macrocode}
9092 %\end{macro}
9093 %\begin{macro}{\@srelflowloc}
9094 %Version 2.0 removed \cs{@srelflowloc}.
9095 %\changes{2.0}{2025-11-24}{removed}
9096 %\end{macro}
9097 %\begin{macro}{\@relflowloc}
9098 %Version 2.0 removed \cs{@relflowloc}.
9099 %\changes{2.0}{2025-11-24}{removed}
9100 %\end{macro}
9101 %
9102 %\subsection{Initialise Flow Frames}
9103 %\begin{macro}{\setinitialframe}
9104 % Specify initial frame. This should be the first flow
9105 % frame that is defined on the first page of the document.
9106 % Having another \gls{flow} as the initial frame is not
9107 % a good idea, and may have unexpected results.
9108 %\changes{2.0}{2025-11-24}{changed to document command}
9109 % \begin{macrocode}
9110 \NewDocumentCommand \setinitialframe { m }
9111 {
9112 \int_gset:Nn \c@thisframe { #1 }
9113 \global \usedframebreaktrue
9114 \__flowfram_set_column:n { #1 }
9115 }
9116 % \end{macrocode}
9117 %\end{macro}
9118 %\begin{macro}{\if@setfr@mes}
9119 %Scratch conditional.
9120 % TODO remove ??
9121 % \begin{macrocode}
9122 \newif\if@setfr@mes
9123 \@setfr@mesfalse
9124 % \end{macrocode}
9125 %\end{macro}
9126 %
9127 %\begin{macro}{\setframes}
9128 %\changes{2.0}{2025-11-24}{changed to document command}
9129 % Set the initial frame.
9130 % \begin{macrocode}
9131 \NewDocumentCommand \setframes { }
9132 {
9133 \int_if_zero:nT { \c@thisframe }
9134 {
9135 \msg_info:nn { flowfram } { no-page1-col }
9136 \int_gset_eq:NN \g__flowfram_next_frame_int \c_one_int
9137 \int_gset_eq:NN \g__flowfram_current_page_int \c_one_int
9138 \__flowfram_get_next_column:N \g__flowfram_next_frame_int
9139 % \end{macrocode}
9140 % Shipout pages without flow frames.
9141 % \begin{macrocode}
9142 \int_gdecr:N \g__flowfram_current_page_int
9143 \bool_while_do:nn
9144 { \int_compare_p:nNn { \g__flowfram_current_page_int } > { \c_zero_int } }
9145 {
9146 \int_gdecr:N \g__flowfram_current_page_int
9147 \setbox \@outputbox
9148 \vbox_to_ht:nn { \typeblockheight }
9149 {
9150 \__flowfram_do_all_frames:
9151 }
9152 \@outputpage
9153 }
9154 \int_gset_eq:NN \c@thisframe \g__flowfram_next_frame_int
9155 }
9156 \__flowfram_set_column:n { \c@thisframe }
9157 \@flowfram@update@col@count { \c@thisframe }
9158 \@setfr@mestrue
9159 \flowfram_set_tl_to_frame_tl:Nnnn
9160 \l__flowfram_textcolor_tl
9161 { flow } { textcolor } { \c@thisframe }
9162 \__flowfram_set_text_color:
9163 }
9164 % \end{macrocode}
9165 %\end{macro}
9166 %\begin{macro}{\emulatetwocolumn}
9167 %\changes{2.0}{2025-11-24}{changed to document command}
9168 % Emulate original "\twocolumn" declaration.
9169 % This is provided for backward compatibility, and
9170 % may be removed in later versions.
9171 % \begin{macrocode}
9172 \NewDocumentCommand \emulatetwocolumn { O{} }
9173 {
9174 \finishthispage
9175 \setallflowframes { pages = none }
9176 \settoheight \l__flowfram_sfdf_height_dim { #1 }
9177 \settodepth \l__flowfram_tmpa_dim { #1 }
9178 \addtolength \l__flowfram_sfdf_height_dim
9179 { \l__flowfram_tmpa_dim }
9180 \dim_compare:nNnTF
9181 { \l__flowfram_sfdf_height_dim } > { \c_zero_dim }
9182 {
9183 \__flowfram_two_column_with_top_in_area:nnnnnnn
9184 { \int_eval:n { \g__flowfram_pagecounter_tl } }
9185 { static }
9186 { \dim_use:N \l__flowfram_sfdf_height_dim }
9187 { \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
9188 \int_gset:Nn \c@thisframe { \c@maxflow - \c_one_int }
9189 \exp_args:Ne \__flowfram_two_columns:n
9190 { > \int_eval:n { \g__flowfram_pagecounter_tl } }
9191 \setstaticcontents { \c@maxstatic } { #1 }
9192 }
9193 {
9194 \__flowfram_two_columns:n { all }
9195 \int_gset:Nn \c@thisframe { \c@maxflow - \c_one_int }
9196 }
9197 \__flowfram_set_column:n { \c@thisframe }
9198 \relax
9199 }
9200 % \end{macrocode}
9201 %\end{macro}
9202 %\begin{macro}{\emulateonecolumn}
9203 %\changes{2.0}{2025-11-24}{changed to document command}
9204 % Emulate original "\onecolumn" declaration.
9205 % This is provided for backward compatibility, and
9206 % may be removed in later versions.
9207 % \begin{macrocode}
9208 \NewDocumentCommand \emulateonecolumn { O{} }
9209 {
9210 \finishthispage
9211 \setallflowframes { pages = none }
9212 \settoheight \l__flowfram_sfdf_height_dim { #1 }
9213 \settodepth \l__flowfram_tmpa_dim { #1 }
9214 \addtolength \l__flowfram_sfdf_height_dim { \l__flowfram_tmpa_dim }
9215 \dim_compare:nNnTF
9216 { \l__flowfram_sfdf_height_dim } > { \c_zero_dim }
9217 {
9218 \__flowfram_one_column_with_top_in_area:nnnnnnn
9219 { \int_eval:n { \g__flowfram_pagecounter_tl } }
9220 { static }
9221 { \dim_use:N \l__flowfram_sfdf_height_dim }
9222 { \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
9223 \int_gset:Nn \c@thisframe { \c@maxflow - \c_one_int }
9224 \__flowfram_new_flow:nnnnn
9225 { > \int_eval:n { \g__flowfram_pagecounter_tl } }
9226 { \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
9227 \setstaticcontents { \c@maxstatic } { #1 }
9228 }
9229 {
9230 \__flowfram_one_column:n { all }
9231 \int_gset:Nn \c@thisframe { \c@maxflow - \c_one_int }
9232 }
9233 \__flowfram_set_column:n { \c@thisframe }
9234 \relax
9235 }
9236 % \end{macrocode}
9237 %\end{macro}
9238 %
9239 % If no flow frames have been defined, create a single flow frame
9240 % the size of the \gls{typeblock}, and initialise the frames.
9241 % \begin{macrocode}
9242 \AtBeginDocument
9243 {
9244 \__flowfram_doc_init:
9245 }
9246 % \end{macrocode}
9247 %
9248 % \begin{macrocode}
9249 \cs_new:Nn \__flowfram_doc_init:
9250 {
9251 % \end{macrocode}
9252 %Save original definition of \cs{@starttoc} in case it's changed by
9253 %another package loaded after \sty{flowfram}:
9254 % \begin{macrocode}
9255 \cs_set_eq:NN \__flowfram_org_starttoc: \@starttoc
9256 % \end{macrocode}
9257 %Initialise absolutepage.
9258 % \begin{macrocode}
9259 \int_gset_eq:NN \c@absolutepage \c_one_int
9260 \int_if_zero:nT { \c@maxflow }
9261 {
9262 \if@twocolumn
9263 \msg_warning:nnn { flowfram } { no-cols } { 2 }
9264 \__flowfram_two_columns:n { all }
9265 \else
9266 \msg_warning:nnn { flowfram } { no-cols } { 1 }
9267 \__flowfram_one_column:n { all }
9268 \fi
9269 }
9270 \setframes
9271 \cs_set_eq:NN \__flowfram_only_document_env:Nn \use_ii:nn
9272 \cs_set_eq:NN
9273 \__flowfram_only_preamble:Nn
9274 \__flowfram_forbidden:Nn
9275 \cs_set_eq:NN \onecolumn \__flowfram_doc_onecolumn:
9276 \RenewDocumentCommand \twocolumn { o }
9277 {
9278 \__flowfram_doc_twocolumn:n { ##1 }
9279 }
9280 \cs_set_eq:NN
9281 \__flowfram_write_html_opts:nnn
9282 \__flowfram_doc_write_html_opts:nnn
9283 }
9284 % \end{macrocode}
9285 %
9286 %The behaviour of \cs{onecolumn} in the document environment:
9287 % \begin{macrocode}
9288 \cs_new:Nn \__flowfram_doc_onecolumn:
9289 {
9290 \bool_if:NTF \g__flowfram_ignore_column_changes_bool
9291 {
9292 \bool_if:NT \g__flowfram_clearpage_column_changes_bool
9293 {
9294 \clearpage
9295 }
9296 }
9297 {
9298 \flowfram_set_one_col:
9299 }
9300 }
9301 % \end{macrocode}
9302 %The behaviour of \cs{twocolumn} in the document environment:
9303 % \begin{macrocode}
9304 \cs_new:Nn \__flowfram_doc_twocolumn:n
9305 {
9306 \IfValueTF { #1 }
9307 {
9308 \bool_if:NTF \g__flowfram_ignore_column_changes_bool
9309 {
9310 \bool_if:NT \g__flowfram_clearpage_column_changes_bool
9311 {
9312 \clearpage
9313 }
9314 #1
9315 }
9316 {
9317 \flowfram_set_two_col_header:n { #1 }
9318 }
9319 }
9320 {
9321 \bool_if:NTF \g__flowfram_ignore_column_changes_bool
9322 {
9323 \bool_if:NT \g__flowfram_clearpage_column_changes_bool
9324 {
9325 \clearpage
9326 }
9327 }
9328 {
9329 \flowfram_set_two_col:
9330 }
9331 }
9332 }
9333
9334 % \end{macrocode}
9335 %If a class or package is being used that automatically inserts
9336 %\cs{onecolumn} or \cs{twocolumn}, identify which frames should be
9337 %switched on or off.
9338 % \begin{macrocode}
9339 \tl_new:N \g__flowfram_one_col_id_tl
9340 \tl_new:N \g__flowfram_two_col_i_id_tl
9341 \tl_new:N \g__flowfram_two_col_ii_id_tl
9342 \tl_new:N \g__flowfram_two_col_header_id_tl
9343 \tl_new:N \g__flowfram_two_col_header_type_tl
9344 \tl_new:N \g__flowfram_headed_two_col_i_id_tl
9345 \tl_new:N \g__flowfram_headed_two_col_ii_id_tl
9346 % \end{macrocode}
9347 %\begin{macro}{\SetOneColumnFrame}
9348 %Identify which column should be used if \cs{onecolumn} is
9349 %encountered:
9350 % \begin{macrocode}
9351 \NewDocumentCommand \SetOneColumnFrame { s m }
9352 {
9353 \tl_if_empty:nTF { #2 }
9354 {
9355 \tl_gclear:N \g__flowfram_one_col_id_tl
9356 }
9357 {
9358 \IfBooleanTF { #1 }
9359 {
9360 \__flowfram_get_flow_id:n { #2 }
9361 \tl_gset:Ne \g__flowfram_one_col_id_tl
9362 { \int_use:N \l__flowfram_id_int }
9363 }
9364 {
9365 \bool_lazy_or:nnTF
9366 {
9367 \int_compare_p:nNn { #2 } < { \c_one_int }
9368 }
9369 {
9370 \int_compare_p:nNn { #2 } > { \c@maxflow }
9371 }
9372 {
9373 \msg_error:nnnn { flowfram } { idn-undefined }
9374 { flow } { #2 }
9375 }
9376 {
9377 \tl_gset:Ne \g__flowfram_one_col_id_tl
9378 { \int_eval:n { #2 } }
9379 }
9380 }
9381 }
9382 }
9383 % \end{macrocode}
9384 %\end{macro}
9385 %
9386 %\begin{macro}{\SetTwoColumnFrames}
9387 %Identify which column should be used if \cs{twocolumn} is
9388 %encountered.
9389 %Syntax:
9390 %\oarg{header-type}\oarg{header-id}\marg{col-1}\oarg{header-col1}
9391 %\marg{col-2}\oarg{header-col-2}
9392 % \begin{macrocode}
9393 \NewDocumentCommand \SetTwoColumnFrames { s o o m o m o }
9394 {
9395 \IfValueTF { #2 }
9396 {
9397 % \end{macrocode}
9398 % Header frame of given type.
9399 % \begin{macrocode}
9400 \cs_if_exist:cTF { __flowfram_get_ #2 _id:n }
9401 {
9402 \tl_gset:Ne \g__flowfram_two_col_header_type_tl { #2 }
9403 \IfValueT { #3 }
9404 {
9405 \tl_if_empty:nTF { #3 }
9406 {
9407 \tl_gclear:N \g__flowfram_two_col_header_id_tl
9408 }
9409 {
9410 \IfBooleanTF { #1 }
9411 {
9412 \use:c { __flowfram_get_ #2 _id:n } { #3 }
9413 \tl_gset:Ne \g__flowfram_two_col_header_id_tl
9414 { \int_use:N \l__flowfram_id_int }
9415 }
9416 {
9417 \bool_lazy_or:nnTF
9418 {
9419 \int_compare_p:nNn { #3 } < { \c_one_int }
9420 }
9421 {
9422 \int_compare_p:nNn { #3 } > { \int_use:c { c@max #2 } }
9423 }
9424 {
9425 \msg_error:nnnn { flowfram } { idn-undefined }
9426 { #2 } { #3 }
9427 }
9428 {
9429 \tl_gset:Ne \g__flowfram_two_col_header_id_tl
9430 { \int_eval:n { #3 } }
9431 }
9432 }
9433 }
9434 }
9435 }
9436 {
9437 \msg_error:nnn { flowfram } { invalid-frame-type } { #2 }
9438 }
9439 }
9440 % \end{macrocode}
9441 % First flow frame.
9442 % \begin{macrocode}
9443 \tl_if_empty:nTF { #4 }
9444 {
9445 \tl_gclear:N \g__flowfram_two_col_i_id_tl
9446 }
9447 {
9448 \IfBooleanTF { #1 }
9449 {
9450 \__flowfram_get_flow_id:n { #4 }
9451 \tl_gset:Ne \g__flowfram_two_col_i_id_tl
9452 { \int_use:N \l__flowfram_id_int }
9453 }
9454 {
9455 \bool_lazy_or:nnTF
9456 {
9457 \int_compare_p:nNn { #4 } < { \c_one_int }
9458 }
9459 {
9460 \int_compare_p:nNn { #4 } > { \c@maxflow }
9461 }
9462 {
9463 \msg_error:nnnn { flowfram } { idn-undefined }
9464 { flow } { #4 }
9465 }
9466 {
9467 \tl_gset:Ne \g__flowfram_two_col_i_id_tl
9468 { \int_eval:n { #4 } }
9469 }
9470 }
9471 }
9472 % \end{macrocode}
9473 % First flow frame on headed page.
9474 % \begin{macrocode}
9475 \IfValueT { #5 }
9476 {
9477 \tl_if_empty:nTF { #5 }
9478 {
9479 \tl_gclear:N \g__flowfram_headed_two_col_i_id_tl
9480 }
9481 {
9482 \IfBooleanTF { #1 }
9483 {
9484 \__flowfram_get_flow_id:n { #5 }
9485 \tl_gset:Ne \g__flowfram_headed_two_col_i_id_tl
9486 { \int_use:N \l__flowfram_id_int }
9487 }
9488 {
9489 \bool_lazy_or:nnTF
9490 {
9491 \int_compare_p:nNn { #5 } < { \c_one_int }
9492 }
9493 {
9494 \int_compare_p:nNn { #5 } > { \c@maxflow }
9495 }
9496 {
9497 \msg_error:nnnn { flowfram } { idn-undefined }
9498 { flow } { #5 }
9499 }
9500 {
9501 \tl_gset:Ne \g__flowfram_headed_two_col_i_id_tl
9502 { \int_eval:n { #5 } }
9503 }
9504 }
9505 }
9506 }
9507 % \end{macrocode}
9508 % Second flow frame.
9509 % \begin{macrocode}
9510 \tl_if_empty:nTF { #6 }
9511 {
9512 \tl_gclear:N \g__flowfram_two_col_ii_id_tl
9513 }
9514 {
9515 \IfBooleanTF { #1 }
9516 {
9517 \__flowfram_get_flow_id:n { #6 }
9518 \tl_gset:Ne \g__flowfram_two_col_ii_id_tl
9519 { \int_use:N \l__flowfram_id_int }
9520 }
9521 {
9522 \bool_lazy_or:nnTF
9523 {
9524 \int_compare_p:nNn { #6 } < { \c_one_int }
9525 }
9526 {
9527 \int_compare_p:nNn { #6 } > { \c@maxflow }
9528 }
9529 {
9530 \msg_error:nnnn { flowfram } { idn-undefined }
9531 { flow } { #6 }
9532 }
9533 {
9534 \tl_gset:Ne \g__flowfram_two_col_ii_id_tl
9535 { \int_eval:n { #6 } }
9536 }
9537 }
9538 }
9539 % \end{macrocode}
9540 % Second flow frame on headed page.
9541 % \begin{macrocode}
9542 \IfValueT { #7 }
9543 {
9544 \tl_if_empty:nTF { #7 }
9545 {
9546 \tl_gclear:N \g__flowfram_headed_two_col_ii_id_tl
9547 }
9548 {
9549 \IfBooleanTF { #1 }
9550 {
9551 \__flowfram_get_flow_id:n { #7 }
9552 \tl_gset:Ne \g__flowfram_headed_two_col_ii_id_tl
9553 { \int_use:N \l__flowfram_id_int }
9554 }
9555 {
9556 \bool_lazy_or:nnTF
9557 {
9558 \int_compare_p:nNn { #7 } < { \c_one_int }
9559 }
9560 {
9561 \int_compare_p:nNn { #7 } > { \c@maxflow }
9562 }
9563 {
9564 \msg_error:nnnn { flowfram } { idn-undefined }
9565 { flow } { #7 }
9566 }
9567 {
9568 \tl_gset:Ne \g__flowfram_headed_two_col_ii_id_tl
9569 { \int_eval:n { #7 } }
9570 }
9571 }
9572 }
9573 }
9574 }
9575 % \end{macrocode}
9576 %\end{macro}
9577 %Switch to the column associated with \cs{onecolumn}:
9578 % \begin{macrocode}
9579 \cs_new:Nn \flowfram_set_one_col:
9580 {
9581 \tl_if_empty:NTF \g__flowfram_one_col_id_tl
9582 {
9583 \msg_warning:nnn { flowfram } { misplaced-col-cmd } { \onecolumn }
9584 }
9585 {
9586 \int_step_inline:nn { \c@maxflow }
9587 {
9588 % \end{macrocode}
9589 % Is this frame currently on or off on this page?
9590 % \begin{macrocode}
9591 \__flowfram_check_if_this_page:nn
9592 { \g__flowfram_pagecounter_tl } { ##1 }
9593 \int_compare:nNnTF
9594 { ##1 } = { \g__flowfram_one_col_id_tl }
9595 {
9596 \bool_if:NT \g__flowfram_not_this_frame_bool
9597 {
9598 \tl_gput_right:Nn \g__flowfram_output_adjust_frames_tl
9599 {
9600 \flowsetpagelist { ##1 }
9601 {
9602 pages =
9603 { > \int_eval:n { \g__flowfram_pagecounter_tl } }
9604 }
9605 }
9606 }
9607 }
9608 {
9609 \bool_if:NF \g__flowfram_not_this_frame_bool
9610 {
9611 \tl_gput_right:Nn \g__flowfram_output_adjust_frames_tl
9612 {
9613 \flowsetpagelist { ##1 } { pages = none }
9614 }
9615 }
9616 }
9617 }
9618 }
9619 \clearpage
9620 }
9621 % \end{macrocode}
9622 %Two columns with no header.
9623 % \begin{macrocode}
9624 \cs_new:Nn \flowfram_set_two_col:
9625 {
9626 \bool_lazy_or:nnTF
9627 {
9628 \tl_if_empty_p:N \g__flowfram_two_col_i_id_tl
9629 }
9630 {
9631 \tl_if_empty_p:N \g__flowfram_two_col_ii_id_tl
9632 }
9633 {
9634 \msg_warning:nnn { flowfram } { misplaced-col-cmd } { \twocolumn }
9635 }
9636 {
9637 \int_step_inline:nn { \c@maxflow }
9638 {
9639 % \end{macrocode}
9640 % Is this frame currently on or off on this page?
9641 % \begin{macrocode}
9642 \__flowfram_check_if_this_page:nn
9643 { \g__flowfram_pagecounter_tl } { ##1 }
9644 \bool_lazy_or:nnTF
9645 {
9646 \int_compare_p:nNn
9647 { ##1 } = { \g__flowfram_two_col_i_id_tl }
9648 }
9649 {
9650 \int_compare_p:nNn
9651 { ##1 } = { \g__flowfram_two_col_ii_id_tl }
9652 }
9653 {
9654 \bool_if:NT \g__flowfram_not_this_frame_bool
9655 {
9656 \tl_gput_right:Nn \g__flowfram_output_adjust_frames_tl
9657 {
9658 \flowsetpagelist { ##1 }
9659 {
9660 pages =
9661 { > \int_eval:n { \g__flowfram_pagecounter_tl } }
9662 }
9663 }
9664 }
9665 }
9666 {
9667 \bool_if:NF \g__flowfram_not_this_frame_bool
9668 {
9669 \tl_gput_right:Nn \g__flowfram_output_adjust_frames_tl
9670 {
9671 \flowsetpagelist { ##1 } { pages = none }
9672 }
9673 }
9674 }
9675 }
9676 }
9677 \clearpage
9678 }
9679 % \end{macrocode}
9680 %Two columns with header.
9681 % \begin{macrocode}
9682 \cs_new:Nn \flowfram_set_two_col_header:n
9683 {
9684 \tl_if_empty:NTF \g__flowfram_two_col_header_id_tl
9685 {
9686 \flowfram_set_two_col:
9687 #1
9688 }
9689 {
9690 \bool_lazy_and:nnTF
9691 {
9692 \tl_if_empty_p:N \g__flowfram_headed_two_col_i_id_tl
9693 }
9694 {
9695 \tl_if_empty_p:N \g__flowfram_headed_two_col_ii_id_tl
9696 }
9697 {
9698 \flowfram_set_two_col:
9699 }
9700 {
9701 \int_step_inline:nn { \c@maxflow }
9702 {
9703 % \end{macrocode}
9704 % Is this frame currently on or off on this page?
9705 % \begin{macrocode}
9706 \__flowfram_check_if_this_page:nn
9707 { \g__flowfram_pagecounter_tl } { ##1 }
9708 \bool_lazy_or:nnTF
9709 {
9710 \int_compare_p:nNn
9711 { ##1 } = { \g__flowfram_two_col_i_id_tl }
9712 }
9713 {
9714 \int_compare_p:nNn
9715 { ##1 } = { \g__flowfram_two_col_ii_id_tl }
9716 }
9717 {
9718 \bool_if:NT \g__flowfram_not_this_frame_bool
9719 {
9720 \tl_gput_right:Nn \g__flowfram_output_adjust_frames_tl
9721 {
9722 \flowsetpagelist { ##1 }
9723 {
9724 pages =
9725 {
9726 >
9727 \int_eval:n
9728 {
9729 \g__flowfram_pagecounter_tl
9730 + \c_one_int
9731 }
9732 }
9733 }
9734 }
9735 }
9736 }
9737 {
9738 \bool_lazy_or:nnTF
9739 {
9740 \int_compare_p:nNn
9741 { ##1 } = { \g__flowfram_headed_two_col_i_id_tl }
9742 }
9743 {
9744 \int_compare_p:nNn
9745 { ##1 } = { \g__flowfram_headed_two_col_ii_id_tl }
9746 }
9747 {
9748 \bool_if:NT \g__flowfram_not_this_frame_bool
9749 {
9750 \tl_gput_right:Nn \g__flowfram_output_adjust_frames_tl
9751 {
9752 \flowsetpagelist { ##1 }
9753 {
9754 pages =
9755 { \int_eval:n { \g__flowfram_pagecounter_tl } }
9756 }
9757 }
9758 }
9759 }
9760 {
9761 \bool_if:NF \g__flowfram_not_this_frame_bool
9762 {
9763 \tl_gput_right:Nn \g__flowfram_output_adjust_frames_tl
9764 {
9765 \flowsetpagelist { ##1 } { pages = none }
9766 }
9767 }
9768 }
9769 }
9770 }
9771 \clearpage
9772 }
9773 \cs_if_exist:cTF
9774 { set \g__flowfram_two_col_header_type_tl contents }
9775 {
9776 \use:c
9777 { set \g__flowfram_two_col_header_type_tl contents }
9778 { \g__flowfram_two_col_header_id_tl }
9779 { #1 }
9780 }
9781 {
9782 #1
9783 }
9784 }
9785 }
9786 % \end{macrocode}
9787 %
9788 %\subsection{Output Routine}
9789 %
9790 %\begin{macro}{\fftolerance}
9791 % The \sty{flowfram} package does a check to see if text has
9792 % flowed between frames of different widths, which will cause a
9793 % discrepancy in the line widths of the paragraph spanning the break.
9794 % Before version~1.14, the output routine just checked if the widths
9795 % were different, but this means that warning messages will be
9796 % generated even if there's only a tiny difference that can be
9797 % caused by rounding errors (for example, if the frames were created
9798 % using jpgfdraw). So add a tolerance and only complain if the
9799 % difference exceeds this value.
9800 %\changes{1.14}{2012-11-10}{new}
9801 % \begin{macrocode}
9802 \newlength\fftolerance
9803 \setlength\fftolerance{2pt}
9804 % \end{macrocode}
9805 %\end{macro}
9806 %
9807 %\begin{macro}{\columnheight}
9808 %Version 2.0 removed \cs{columnheight}
9809 %\changes{2.0}{2025-11-24}{removed}
9810 %\end{macro}
9811 %
9812 %\begin{macro}{\@setcol}
9813 % Set up the output box so it has the correct dimensions for
9814 % specified \gls{flow}. This is used by the output routine.
9815 %\changes{1.11}{2008/06/27}{added displayedframe increment}
9816 %\changes{1.14}{2012-11-10}{changed check to use tolerance rather
9817 %than testing if hsize and columnwidth are equal}
9818 %Version 2.0 renamed \cs{@setcol}.
9819 %\changes{2.0}{2025-11-24}{renamed}
9820 % \begin{macrocode}
9821 \cs_new:Nn \__flowfram_set_column:n
9822 {
9823 \bool_lazy_or:nnTF
9824 {
9825 \int_compare_p:nNn { \c@maxflow } < { #1 }
9826 }
9827 {
9828 \int_compare_p:nNn { #1 } < { \c_one_int }
9829 }
9830 {
9831 \msg_error:nne { flowfram } { cant-set-column }
9832 { \int_eval:n { #1 } }
9833 }
9834 {
9835 \exp_args:Nnee
9836 \__flowfram_message:nnn
9837 { info-switching-col }
9838 { \int_eval:n { #1 } }
9839 { \int_eval:n { \g__flowfram_pagecounter_tl } }
9840 \dim_gset:Nn
9841 \columnwidth
9842 { \flowfram_frame_use_dim:nnn { flow } { width } { #1 } }
9843 \legacy_if:nF { usedframebreak }
9844 {
9845 \dim_set_eq:NN \l__flowfram_tmpb_dim \columnwidth
9846 \dim_sub:Nn \l__flowfram_tmpb_dim { \hsize }
9847 \dim_compare:nNnT { \l__flowfram_tmpb_dim } < { \c_zero_dim }
9848 {
9849 \dim_set:Nn \l__flowfram_tmpb_dim { - \l__flowfram_tmpb_dim }
9850 }
9851 \dim_compare:nNnT { \l__flowfram_tmpb_dim } > { \fftolerance }
9852 {
9853 \msg_warning:nnee { flowfram } { unequal-cols }
9854 { \dim_use:N \l__flowfram_tmpb_dim }
9855 { \the \fftolerance }
9856 }
9857 }
9858 \global \usedframebreakfalse
9859 \global \hsize \columnwidth
9860 \flowfram_gset_dim_to_frame_dim:Nnnn
9861 \textheight { flow } { height } { #1 }
9862 \global \vsize \textheight
9863 \global \@colht \textheight
9864 \global \@colroom \@colht
9865 % \end{macrocode}
9866 % We may be inside an environment that has modified the line
9867 % width, such as one of the list environments so we can't just set
9868 % \cs{linewidth} to \cs{columnwidth}. Test if we're in a list
9869 % environment by checking if \cs{@listdepth} is greater than 0. If
9870 % true, only modify \cs{linewidth} if
9871 % it's larger than the new column width.
9872 %\changes{1.15}{2014-05-15}{set \cs{linewidth} as well as \cs{textwidth}}
9873 %\changes{1.17}{2014-09-30}{added check for list}
9874 % \begin{macrocode}
9875 \int_compare:nNnTF { \@listdepth } > { \c_zero_int }
9876 {
9877 \dim_compare:nNnT { \linewidth } > { \columnwidth }
9878 {
9879 \dim_gset_eq:NN \linewidth \columnwidth
9880 }
9881 }
9882 {
9883 \dim_gset_eq:NN \linewidth \columnwidth
9884 }
9885 % \end{macrocode}
9886 %\changes{1.16}{2014-06-04}{Removed assignment of \cs{textwidth}}
9887 % \begin{macrocode}
9888 \setmargin
9889 }
9890 \stepcounter { displayedframe }
9891 }
9892 % \end{macrocode}
9893 %\end{macro}
9894 %Version 2.0 no longer overriding \cs{output}.
9895 %\begin{macro}{\@doclearpage}
9896 %Version 2.0 no longer redefining \cs{@doclearpage}.
9897 %\changes{2.0}{2025-11-24}{no longer redefining}
9898 %\end{macro}
9899 %
9900 %\begin{macro}{\flowfram@header}
9901 %\changes{2.0}{2025-11-24}{new}
9902 % \begin{macrocode}
9903 \newcommand \flowfram@header [2]
9904 {
9905 \__flowfram_header:n
9906 {
9907 \color@hbox
9908 \g__flowfram_headercolor_tl
9909 \hbox_to_wd:nn { #1 } { #2 }
9910 \color@endbox
9911 }
9912 }
9913 % \end{macrocode}
9914 %\end{macro}
9915 %Boxes may interfere with the dynamic frame settings, so provide an
9916 %alternative. This may be redefined to \cs{flowfram@header} if
9917 %preferred:
9918 %\begin{macro}{\flowfram@dynamicheader}
9919 %\changes{2.0}{2025-11-24}{new}
9920 % \begin{macrocode}
9921 \newcommand \flowfram@dynamicheader [2]
9922 {
9923 \g__flowfram_headercolor_tl
9924 \__flowfram_header:n { #2 }
9925 }
9926 % \end{macrocode}
9927 %\end{macro}
9928 % \begin{macrocode}
9929 \tl_new:N \g__flowfram_headercolor_tl
9930 \tl_gset:Nn \g__flowfram_headercolor_tl { \normalcolor }
9931 \cs_new:Nn \__flowfram_header:n
9932 {
9933 \pdfannot@link@off@@
9934 \UseTaggingSocket
9935 {build/page/header}
9936 { }
9937 { #1 }
9938 \pdfannot@link@on@@
9939 }
9940 % \end{macrocode}
9941 %\begin{macro}{\flowfram@footer}
9942 %\changes{2.0}{2025-11-24}{new}
9943 % \begin{macrocode}
9944 \newcommand \flowfram@footer [2]
9945 {
9946 \__flowfram_footer:n
9947 {
9948 \color@hbox
9949 \g__flowfram_footercolor_tl
9950 \hbox_to_wd:nn { #1 } { #2 }
9951 \color@endbox
9952 }
9953 }
9954 % \end{macrocode}
9955 %\end{macro}
9956 %Boxes may interfere with the dynamic frame settings, so provide an
9957 %alternative. This may be redefined to \cs{flowfram@footer} if
9958 %preferred:
9959 %\begin{macro}{\flowfram@dynamicfooter}
9960 %\changes{2.0}{2025-11-24}{new}
9961 % \begin{macrocode}
9962 \newcommand \flowfram@dynamicfooter [2]
9963 {
9964 \g__flowfram_footercolor_tl
9965 \__flowfram_footer:n { #2 }
9966 }
9967 % \end{macrocode}
9968 %\end{macro}
9969 % \begin{macrocode}
9970 \tl_new:N \g__flowfram_footercolor_tl
9971 \tl_gset:Nn \g__flowfram_footercolor_tl { \normalcolor }
9972 % \end{macrocode}
9973 % \begin{macrocode}
9974 \cs_new:Nn \__flowfram_footer:n
9975 {
9976 \pdfannot@link@off@@
9977 \UseTaggingSocket {build/page/footer}
9978 { }
9979 { #1 }
9980 \pdfannot@link@on@@
9981 }
9982 % \end{macrocode}
9983 %
9984 %\begin{macro}{\@dothehead}
9985 % First define macro to do the header. This will be
9986 % modified if it is turned into a \gls{dynamic}.
9987 %Version 2.0 added tagging socket.
9988 %\changes{2.0}{2025-11-24}{added tagging socket}
9989 % \begin{macrocode}
9990 \newcommand{\@dothehead}{
9991 \vbox_to_ht:nn { \headheight }
9992 {
9993 \vfil
9994 \flowfram@header { \typeblockwidth }
9995 {
9996 \@thehead
9997 }
9998 }
9999 }
10000 % \end{macrocode}
10001 %\end{macro}
10002 %\begin{macro}{\@dothefoot}
10003 % Same again for the footer.
10004 % \begin{macrocode}
10005 \newcommand{\@dothefoot}{
10006 \vbox:n
10007 {
10008 \flowfram@footer { \typeblockwidth }
10009 {
10010 \@thefoot
10011 }
10012 }
10013 }
10014 \newcommand{\@dodynamicthehead}{}
10015 \newcommand{\@dodynamicthefoot}{}
10016 % \end{macrocode}
10017 %\end{macro}
10018 %
10019 %Column spanning floats conflict with \sty{flowfram}'s output
10020 %routine so make starred floats behave like unstarred floats.
10021 % \begin{macrocode}
10022 \cs_set_eq:NN \__flowfram_org_dblfloat: \@dblfloat
10023 \cs_set_eq:NN \@dblfloat \@float
10024 \cs_set_eq:NN \__flowfram_org_enddblfloat: \end@dblfloat
10025 \cs_set_eq:NN \end@dblfloat \end@float
10026 % \end{macrocode}
10027 %
10028 %\begin{macro}{\FlowFramRestoreOR}
10029 %Version 2.0: provide a way of restoring the output routine.
10030 %\changes{2.0}{2025-11-24}{new}
10031 % \begin{macrocode}
10032 \cs_set_eq:NN \__flowfram_org_opcol: \@opcol
10033 \cs_set_eq:NN \__flowfram_org_outputdblcol: \@outputdblcol
10034 \int_new:N \g__flowfram_saved_thisframe_int
10035 \NewDocumentCommand \FlowFramRestoreOR { }
10036 {
10037 \__flowfram_only_document_env:Nn \FlowFramRestoreOR
10038 {
10039 \finishthispage
10040 \int_gset_eq:NN \g__flowfram_saved_thisframe_int \c@thisframe
10041 \cs_set_eq:NN \@dblfloat \__flowfram_org_dblfloat:
10042 \cs_set_eq:NN \end@dblfloat \__flowfram_org_enddblfloat:
10043 \cs_set_eq:NN \@opcol \__flowfram_org_opcol:
10044 \cs_set_eq:NN \@outputdblcol \__flowfram_org_outputdblcol:
10045 \let\@outputpage\@@flowfram@org@output@page
10046 \renewcommand \@flowfram@build@page@after
10047 {
10048 \stepcounter{absolutepage}%
10049 }
10050 \cs_set_eq:NN \onecolumn \__flowfram_org_onecolumn:
10051 \cs_set_eq:NN \twocolumn \__flowfram_org_twocolumn:
10052 \int_gset_eq:NN \col@number \c_one_int
10053 \global \@twocolumnfalse
10054 \global \textwidth \typeblockwidth
10055 \global \textheight \typeblockheight
10056 \global \columnwidth \textwidth
10057 \global \hsize \textwidth
10058 \global \vsize \textheight
10059 \global \@colht \vsize
10060 \global \@colroom \@colht
10061 }
10062 }
10063 % \end{macrocode}
10064 %\end{macro}
10065 %
10066 %\begin{macro}{\FlowFramUnrestoreOR}
10067 %And switch back again.
10068 %\changes{2.0}{2025-11-24}{new}
10069 % \begin{macrocode}
10070 \NewDocumentCommand \FlowFramUnrestoreOR { }
10071 {
10072 \__flowfram_only_document_env:Nn \FlowFramUnrestoreOR
10073 {
10074 \clearpage
10075 \cs_set_eq:NN \@opcol \__flowfram_op_col:
10076 \cs_set_eq:NN \@outputdblcol \__flowfram_output_dbl_col:
10077 \let\@outputpage\@@flowfram@output@page
10078 \cs_set_eq:NN \@dblfloat \@float
10079 \cs_set_eq:NN \end@dblfloat \end@float
10080 \renewcommand \@flowfram@build@page@before { }
10081 \renewcommand \@flowfram@build@page@after { }
10082 \cs_set_eq:NN \onecolumn \__flowfram_doc_onecolumn:
10083 \RenewDocumentCommand \twocolumn { o }
10084 {
10085 \__flowfram_doc_twocolumn:n { ##1 }
10086 }
10087 \int_gzero:N \c@displayedframe
10088 \int_gset_eq:NN \c@thisframe \g__flowfram_saved_thisframe_int
10089 \int_gset_eq:NN \g__flowfram_next_frame_int \g__flowfram_saved_thisframe_int
10090 \__flowfram_set_column:n { \c@thisframe }
10091 \@flowfram@update@col@count{\c@thisframe}%
10092 }
10093 }
10094 % \end{macrocode}
10095 %\end{macro}
10096 %
10097 %\begin{macro}{\@opcol}
10098 %Version 2.0 ensure marks stuff is included but always use
10099 %\cs{@outputdblcol}.
10100 %\changes{2.0}{2025-11-24}{include mark structures}
10101 % \begin{macrocode}
10102 \renewcommand * \@opcol { \__flowfram_op_col: }
10103 % \end{macrocode}
10104 %\end{macro}
10105 % \begin{macrocode}
10106 \cs_new:Nn \__flowfram_op_col:
10107 {
10108 \if@twocolumn
10109 \@expl@@@mark@update@dblcol@structures@@
10110 \else
10111 \@expl@@@mark@update@singlecol@structures@@
10112 \fi
10113 \@outputdblcol
10114 \global \@mparbottom \z@
10115 \global \@textfloatsheight \z@
10116 \@flowfram@adjust@fdepth
10117 \@floatplacement
10118 }
10119 % \end{macrocode}
10120 %
10121 %\begin{macro}{\@flowfram@adjust@fdepth}
10122 %\changes{2.1}{2026-02-23}{new}
10123 %TODO investigate why this doesn't work as expected
10124 % \begin{macrocode}
10125 \newcommand\@flowfram@adjust@fdepth{%
10126 %\def\f@depth{1sp}%
10127 }
10128 % \end{macrocode}
10129 %\end{macro}
10130 %
10131 %\begin{macro}{\@outputpage}
10132 %The header and footer code need to be removed as they may be placed
10133 %in a dynamic frame instead and repositioned.
10134 %Version 2.0 updated.
10135 % \begin{macrocode}
10136 \ExplSyntaxOff
10137 % \end{macrocode}
10138 %Save original so that it can be restored.
10139 % \begin{macrocode}
10140 \let\@@flowfram@org@output@page\@outputpage
10141 \def\@outputpage{\@@flowfram@output@page}
10142 % \end{macrocode}
10143 %Define \sty{flowfram}'s version of \cs{@outputpage}:
10144 % \begin{macrocode}
10145 \newcommand \@@flowfram@output@page{%
10146 \UseHook {build/page/before}%
10147 \begingroup
10148 \let \protect \noexpand
10149 \language\document@default@language
10150 \@resetactivechars
10151 \nfss@catcodes
10152 \catcode`\$\thr@@
10153 \catcode`\_8\relax
10154 \catcode`\ 10\relax
10155 \catcode`\^^I10\relax
10156 \catcode`\~13\relax
10157 \catcode`\^^M5\relax
10158 \global\let\@@if@newlist\if@newlist
10159 \global\@newlistfalse
10160 \UseHook {build/page/reset}%
10161 \shipout \vbox{%
10162 \set@typeset@protect
10163 \aftergroup \endgroup
10164 \aftergroup \set@typeset@protect
10165 \if@specialpage
10166 \global \@specialpagefalse
10167 \ifcsdef {ps@special\@specialstyle}%
10168 {\@nameuse {ps@special\@specialstyle}}%
10169 {\@nameuse {ps@\@specialstyle}}%
10170 \fi
10171 \if@twoside
10172 \ifodd\count\z@
10173 \let \@thehead \@oddhead
10174 \let \@thefoot \@oddfoot
10175 \let \@themargin \oddsidemargin
10176 \else
10177 \let \@thehead \@evenhead
10178 \let \@thefoot \@evenfoot
10179 \let \@themargin \evensidemargin
10180 \fi
10181 \else
10182 \let \@thehead \@oddhead
10183 \let \@thefoot \@oddfoot
10184 \let \@themargin \oddsidemargin
10185 \fi
10186 % \end{macrocode}
10187 %Omit block relating to header, footer and margin.
10188 % \begin{macrocode}
10189 \reset@font
10190 \normalsize
10191 \normalsfcodes
10192 \let \label \@gobble@with@sphack@om
10193 \let \index \@gobble@with@sphack@som
10194 \let \glossary \@gobble@with@sphack@om
10195 \let \@@flowfram@current@pre@section@title \empty
10196 \baselineskip \z@skip
10197 \lineskip \z@skip
10198 \lineskiplimit \z@
10199 \@begindvi
10200 \vskip \typeblockoffsety
10201 \moveright\@themargin \vbox {%
10202 % \end{macrocode}
10203 %Omit header.
10204 % \begin{macrocode}
10205 \box \@outputbox
10206 % \end{macrocode}
10207 %Omit footer.
10208 % \begin{macrocode}
10209 }%
10210 }%
10211 \global \let \if@newlist \@@if@newlist
10212 \@flowfram@set@next@vsize
10213 \global \textwidth \hsize
10214 \global \textheight \vsize
10215 \global \@colht \vsize
10216 \global \@colroom \@colht
10217 \stepcounter{page}%
10218 \stepcounter{absolutepage}%
10219 \setcounter{displayedframe}{0}%
10220 \@flowfram@update@col@count{\c@thisframe}%
10221 \UseHook {build/page/after}%
10222 }
10223 \ExplSyntaxOn
10224 % \end{macrocode}
10225 %If OR is restored, provide a means to still display the dynamic
10226 %frames and update absolutepage.
10227 % \begin{macrocode}
10228 \AddToHook {build/page/before}
10229 {
10230 \@flowfram@build@page@before
10231 }
10232 \AddToHook {build/page/after}
10233 {
10234 \@flowfram@build@page@after
10235 }
10236 % \end{macrocode}
10237 %No extra action unless OR is restored.
10238 % \begin{macrocode}
10239 \newcommand\@flowfram@build@page@before{}
10240 \newcommand\@flowfram@build@page@after{}
10241 % \end{macrocode}
10242 %Set \cs{vsize} for next frame.
10243 % \begin{macrocode}
10244 \newcommand\@flowfram@set@next@vsize
10245 {
10246 \flowfram_gset_dim_to_frame_dim:Nnnn \vsize
10247 { flow } { height } { \g__flowfram_next_frame_int }
10248 }
10249 % \end{macrocode}
10250 %\end{macro}
10251 %
10252 %\begin{macro}{\makedfheaderfooter}
10253 % Make the headers and footers be in \glspl{dynamic}. There
10254 % will initially be no difference in appearance until
10255 % the settings are changed using "\setdynamicframe".
10256 % The header frame is given the \gls{idl} "header", and the
10257 % footer is given the \gls{idl} "footer".
10258 %\changes{2.0}{2025-11-24}{changed to document command}
10259 %
10260 %Keep track of which frames have the header and footer. These will
10261 %be zero if feature not implemented. NB the even IDs are only set by
10262 %\sty{flowframtkutils}.
10263 % \begin{macrocode}
10264 \int_new:N \g__flowfram_dynamic_header_int
10265 \int_new:N \g__flowfram_dynamic_even_header_int
10266 \int_new:N \g__flowfram_dynamic_footer_int
10267 \int_new:N \g__flowfram_dynamic_even_footer_int
10268 % \end{macrocode}
10269 % Create dynamic frames for the header and footer.
10270 % \begin{macrocode}
10271 \NewDocumentCommand \makedfheaderfooter { }
10272 {
10273 % \end{macrocode}
10274 % Create dynamic frames at the standard location:
10275 % \begin{macrocode}
10276 \__flowfram_new_dynamic:nnnnnn
10277 { all } { \typeblockwidth } { \headheight }
10278 { 0pt } { \typeblockheight + \headsep } { header }
10279 \int_set_eq:NN \g__flowfram_dynamic_header_int
10280 \c@maxdynamic
10281 \__flowfram_set_dynamic_by_idn:nn { \c@maxdynamic } { valign=c }
10282 \__flowfram_new_dynamic:nnnnnn
10283 { all } { \typeblockwidth } { \headheight }
10284 { 0pt } { -\footskip } { footer }
10285 \int_set_eq:NN \g__flowfram_dynamic_footer_int
10286 \c@maxdynamic
10287 \__flowfram_set_dynamic_by_idn:nn { \c@maxdynamic } { valign=c }
10288 \gdef \@dothehead { }
10289 \gdef \@dothefoot { }
10290 \gdef \@dodynamicthehead
10291 {
10292 \__flowfram_set_dynamic_contents:nn
10293 { \g__flowfram_dynamic_header_int }
10294 {
10295 \flowfram_dynamic_header:n
10296 { \g__flowfram_dynamic_header_int }
10297 }
10298 }
10299 \gdef \@dodynamicthefoot
10300 {
10301 \__flowfram_set_dynamic_contents:nn
10302 { \g__flowfram_dynamic_footer_int }
10303 {
10304 \flowfram_dynamic_footer:n
10305 { \g__flowfram_dynamic_footer_int }
10306 }
10307 }
10308 \tl_clear:N \g__flowfram_headercolor_tl
10309 \tl_clear:N \g__flowfram_footercolor_tl
10310 \__flowfram_adjust_page_styles:n
10311 {
10312 \let \ps@myheadings \ps@ffmyheadings
10313 \let \ps@headings \ps@ffheadings
10314 \let \ps@plain \ps@ffplain
10315 \let \ps@empty \ps@ffempty
10316 }
10317 \pagestyle { ffheadings }
10318 \cs_set:Nn \__flowfram_only_pre_makedfheaderfooter:nn
10319 {
10320 \msg_error:nnn { flowfram } { option-too-late } { ##1 } { \makedfheaderfooter }
10321 }
10322 }
10323 % \end{macrocode}
10324 %
10325 % This should only be done in the preamble.
10326 % \begin{macrocode}
10327 \@onlypreamble{\makedfheaderfooter}
10328 % \end{macrocode}
10329 %\end{macro}
10330 %
10331 %\begin{macro}{\FlowFramSetDynamicHeadFootAttributes}
10332 %\changes{2.0}{2025-11-24}{new}
10333 %Set dynamic header and footer frame attributes if they have been defined.
10334 %Does nothing otherwise.
10335 % \begin{macrocode}
10336 \NewDocumentCommand \FlowFramSetDynamicHeadFootAttributes { m }
10337 {
10338 \int_compare:nNnT
10339 { \g__flowfram_dynamic_header_int } > { \c_zero_int }
10340 {
10341 \__flowfram_set_dynamic_by_idn:nn
10342 { \g__flowfram_dynamic_header_int } { #1 }
10343 }
10344 \int_compare:nNnT
10345 { \g__flowfram_dynamic_even_header_int } > { \c_zero_int }
10346 {
10347 \__flowfram_set_dynamic_by_idn:nn
10348 { \g__flowfram_dynamic_even_header_int } { #1 }
10349 }
10350 \int_compare:nNnT
10351 { \g__flowfram_dynamic_footer_int } > { \c_zero_int }
10352 {
10353 \__flowfram_set_dynamic_by_idn:nn
10354 { \g__flowfram_dynamic_footer_int } { #1 }
10355 }
10356 \int_compare:nNnT
10357 { \g__flowfram_dynamic_even_footer_int } > { \c_zero_int }
10358 {
10359 \__flowfram_set_dynamic_by_idn:nn
10360 { \g__flowfram_dynamic_even_footer_int } { #1 }
10361 }
10362 }
10363 % \end{macrocode}
10364 %\end{macro}
10365 %
10366 %The argument is the dynamic frame's IDN.
10367 %The box is added because in some cases without it an infinite
10368 %shrinkage error occurs.
10369 % \begin{macrocode}
10370 \cs_new:Nn \flowfram_dynamic_header:n
10371 {
10372 \flowfram_set_dim_to_frame_dim:Nnnn
10373 \l__flowfram_sfdf_width_dim
10374 { dynamic } { width } { #1 }
10375 \if@twoside
10376 \ifodd\c@page
10377 \flowfram@dynamicheader
10378 { \l__flowfram_sfdf_width_dim }
10379 { \@oddhead }
10380 \else
10381 \flowfram@dynamicheader
10382 { \l__flowfram_sfdf_width_dim }
10383 { \@evenhead }
10384 \fi
10385 \else
10386 \flowfram@dynamicheader
10387 { \l__flowfram_sfdf_width_dim }
10388 { \@thehead }
10389 \fi
10390 }
10391 % \end{macrocode}
10392 %For the benefit of \sty{flowframtkutils}, where there may be
10393 %separate odd and even header dynamic frames:
10394 % \begin{macrocode}
10395 \cs_new:Nn \flowfram_dynamic_odd_header:n
10396 {
10397 \flowfram_set_dim_to_frame_dim:Nnnn
10398 \l__flowfram_sfdf_width_dim
10399 { dynamic } { width } { #1 }
10400 \if@twoside
10401 \ifodd\c@page
10402 \flowfram@dynamicheader
10403 { \l__flowfram_sfdf_width_dim }
10404 { \@oddhead }
10405 \else
10406 \flowfram@dynamicheader
10407 { \l__flowfram_sfdf_width_dim }
10408 { }
10409 \fi
10410 \else
10411 \flowfram@dynamicheader
10412 { \l__flowfram_sfdf_width_dim }
10413 { \@thehead }
10414 \fi
10415 }
10416 % \end{macrocode}
10417 %
10418 % \begin{macrocode}
10419 \cs_new:Nn \flowfram_dynamic_even_header:n
10420 {
10421 \flowfram_set_dim_to_frame_dim:Nnnn
10422 \l__flowfram_sfdf_width_dim
10423 { dynamic } { width } { #1 }
10424 \if@twoside
10425 \ifodd\c@page
10426 \flowfram@dynamicheader
10427 { \l__flowfram_sfdf_width_dim }
10428 { }
10429 \else
10430 \flowfram@dynamicheader
10431 { \l__flowfram_sfdf_width_dim }
10432 { \@evenhead }
10433 \fi
10434 \else
10435 \flowfram@dynamicheader
10436 { \l__flowfram_sfdf_width_dim }
10437 { }
10438 \fi
10439 }
10440 % \end{macrocode}
10441 %
10442 % \begin{macrocode}
10443 \cs_new:Nn \flowfram_dynamic_footer:n
10444 {
10445 \flowfram_set_dim_to_frame_dim:Nnnn
10446 \l__flowfram_sfdf_width_dim
10447 { dynamic } { width } { #1 }
10448 \if@twoside
10449 \ifodd\c@page
10450 \flowfram@dynamicfooter
10451 { \l__flowfram_sfdf_width_dim } { \@oddfoot }
10452 \else
10453 \flowfram@dynamicfooter
10454 { \l__flowfram_sfdf_width_dim } { \@evenfoot }
10455 \fi
10456 \else
10457 \flowfram@dynamicfooter
10458 { \l__flowfram_sfdf_width_dim } { \@thefoot }
10459 \fi
10460 }
10461 % \end{macrocode}
10462 %
10463 % \begin{macrocode}
10464 \cs_new:Nn \flowfram_dynamic_odd_footer:n
10465 {
10466 \flowfram_set_dim_to_frame_dim:Nnnn
10467 \l__flowfram_sfdf_width_dim
10468 { dynamic } { width } { #1 }
10469 \if@twoside
10470 \ifodd\c@page
10471 \flowfram@dynamicfooter
10472 { \l__flowfram_sfdf_width_dim } { \@oddfoot }
10473 \else
10474 \flowfram@dynamicfooter
10475 { \l__flowfram_sfdf_width_dim } { }
10476 \fi
10477 \else
10478 \flowfram@dynamicfooter
10479 { \l__flowfram_sfdf_width_dim } { \@thefoot }
10480 \fi
10481 }
10482 % \end{macrocode}
10483 %
10484 % \begin{macrocode}
10485 \cs_new:Nn \flowfram_dynamic_even_footer:n
10486 {
10487 \flowfram_set_dim_to_frame_dim:Nnnn
10488 \l__flowfram_sfdf_width_dim
10489 { dynamic } { width } { #1 }
10490 \if@twoside
10491 \ifodd\c@page
10492 \flowfram@dynamicfooter
10493 { \l__flowfram_sfdf_width_dim } { }
10494 \else
10495 \flowfram@dynamicfooter
10496 { \l__flowfram_sfdf_width_dim } { \@evenfoot }
10497 \fi
10498 \else
10499 \flowfram@dynamicfooter
10500 { \l__flowfram_sfdf_width_dim } { }
10501 \fi
10502 }
10503 % \end{macrocode}
10504 %
10505 %
10506 %\begin{macro}{\dfOddHeaderStyle}
10507 %\changes{2.0}{2025-11-24}{new}
10508 % \begin{macrocode}
10509 \newcommand \dfOddHeaderStyle [ 1 ] { \hfill #1 }
10510 % \end{macrocode}
10511 %\end{macro}
10512 %\begin{macro}{\dfEvenHeaderStyle}
10513 %\changes{2.0}{2025-11-24}{new}
10514 % \begin{macrocode}
10515 \newcommand \dfEvenHeaderStyle [ 1 ] { #1 \hfill }
10516 % \end{macrocode}
10517 %\end{macro}
10518 %\begin{macro}{\dfOddFooterStyle}
10519 %\changes{2.0}{2025-11-24}{new}
10520 % \begin{macrocode}
10521 \newcommand \dfOddFooterStyle [ 1 ] { \hfill #1 \hfill }
10522 % \end{macrocode}
10523 %\end{macro}
10524 %\begin{macro}{\dfEvenFooterStyle}
10525 %\changes{2.0}{2025-11-24}{new}
10526 % \begin{macrocode}
10527 \newcommand \dfEvenFooterStyle [ 1 ] { \hfill #1 \hfill }
10528 % \end{macrocode}
10529 %\end{macro}
10530 %Some classes have page styles that cause a problem with the dynamic
10531 %header and footer so provide a simple page style. The dynamic
10532 %frame's attributes can be adjusted to changing the formatting.
10533 % \begin{macrocode}
10534 \cs_if_exist:NTF \chapter
10535 {
10536 \cs_new:Nn \__flowfram_ps_myheadings:
10537 {
10538 \def \@oddfoot { \dfOddFooterStyle { \thepage } }
10539 \def \@evenfoot { \dfEvenFooterStyle { \thepage } }
10540 \def \@oddhead { \dfOddHeaderStyle { \rightmark } }
10541 \def \@evenhead { \dfEvenHeaderStyle { \leftmark } }
10542 \let \@mkboth \@gobbletwo
10543 \let \chaptermark \@gobble
10544 \let \sectionmark \@gobble
10545 }
10546 \cs_new:Nn \__flowfram_ps_headings:
10547 {
10548 \def \@oddfoot { \dfOddFooterStyle { \thepage } }
10549 \def \@evenfoot { \dfEvenFooterStyle { \thepage } }
10550 \def \@oddhead { \dfOddHeaderStyle { \rightmark } }
10551 \def \@evenhead { \dfEvenHeaderStyle { \leftmark } }
10552 \let \@mkboth \markboth
10553 \def \chaptermark ##1
10554 {
10555 \markboth
10556 {
10557 \flowframchapterheader { ##1 }
10558 }
10559 {
10560 \flowfram_initial_right_mark:n
10561 {
10562 \flowframchapterheader { ##1 }
10563 }
10564 }
10565 }
10566 \def \sectionmark ##1
10567 {
10568 \markright
10569 {
10570 \flowframsectionheader { ##1 }
10571 }
10572 }
10573 }
10574 \newcommand \flowframchapterheader [ 1 ]
10575 {
10576 \flowfram_header_font:n
10577 {
10578 \flowfram_header_case:n
10579 {
10580 \ifnum \c@secnumdepth >\m@ne
10581 \if@mainmatter
10582 \flowframheaderchapprefix
10583 \thechapter
10584 \flowframheadersep
10585 \fi
10586 \fi
10587 #1
10588 }
10589 }
10590 }
10591 \newcommand \flowframsectionheader [ 1 ]
10592 {
10593 \flowfram_subheader_font:n
10594 {
10595 \flowfram_subheader_case:n
10596 {
10597 \ifnum \c@secnumdepth >\z@
10598 \thesection
10599 \flowframheadersep
10600 \fi
10601 #1
10602 }
10603 }
10604 }
10605 }
10606 {
10607 \cs_new:Nn \__flowfram_ps_myheadings:
10608 {
10609 \def \@oddfoot { \dfOddFooterStyle { \thepage } }
10610 \def \@evenfoot { \dfEvenFooterStyle { \thepage } }
10611 \def \@oddhead { \dfOddHeaderStyle { \rightmark } }
10612 \def \@evenhead { \dfEvenHeaderStyle { \leftmark } }
10613 \let \@mkboth \@gobbletwo
10614 \let \sectionmark \@gobble
10615 \let \subsectionmark \@gobble
10616 }
10617 \cs_new:Nn \__flowfram_ps_headings:
10618 {
10619 \def \@oddfoot { \dfOddFooterStyle { \thepage } }
10620 \def \@evenfoot { \dfEvenFooterStyle { \thepage } }
10621 \def \@oddhead { \dfOddHeaderStyle { \rightmark } }
10622 \def \@evenhead { \dfEvenHeaderStyle { \leftmark } }
10623 \let \@mkboth \markboth
10624 \def \sectionmark ##1
10625 {
10626 \markboth
10627 {
10628 \flowframsectionheader { ##1 }
10629 }
10630 {
10631 \flowfram_initial_right_mark:n
10632 {
10633 \flowframsectionheader { ##1 }
10634 }
10635 }
10636 }
10637 \def \subsectionmark ##1
10638 {
10639 \markright
10640 {
10641 \flowframsubsectionheader { ##1 }
10642 }
10643 }
10644 }
10645 \newcommand \flowframsectionheader [ 1 ]
10646 {
10647 \flowfram_header_font:n
10648 {
10649 \flowfram_header_case:n
10650 {
10651 \ifnum \c@secnumdepth >\m@ne
10652 \thesection
10653 \flowframheadersep
10654 \fi
10655 #1
10656 }
10657 }
10658 }
10659 \newcommand \flowframsubsectionheader [ 1 ]
10660 {
10661 \flowfram_subheader_font:n
10662 {
10663 \flowfram_subheader_case:n
10664 {
10665 \int_compare:nNnT { \c@secnumdepth } > { 2 }
10666 {
10667 \thesubsection
10668 \flowframheadersep
10669 }
10670 #1
10671 }
10672 }
10673 }
10674 }
10675 % \end{macrocode}
10676 %At the start of a chapter/section the following governs whether or
10677 %not to initialise the right mark to the same as the left mark.
10678 % \begin{macrocode}
10679 \cs_new:Nn \flowfram_initial_right_mark:n { #1 }
10680 % \end{macrocode}
10681 %\begin{macro}{\ps@ffmyheadings}
10682 % \begin{macrocode}
10683 \newcommand \ps@ffmyheadings
10684 {
10685 \__flowfram_ps_myheadings:
10686 \bool_if:NT \l__flowfram_ps_ffempty_hides_bool
10687 {
10688 \FlowFramSetDynamicHeadFootAttributes
10689 { hide = false , hidethis = false }
10690 }
10691 }
10692 % \end{macrocode}
10693 %\end{macro}
10694 %\begin{macro}{\ps@ffheadings}
10695 % \begin{macrocode}
10696 \newcommand \ps@ffheadings
10697 {
10698 \__flowfram_ps_headings:
10699 \bool_if:NT \l__flowfram_ps_ffempty_hides_bool
10700 {
10701 \FlowFramSetDynamicHeadFootAttributes
10702 { hide = false , hidethis = false }
10703 }
10704 }
10705 % \end{macrocode}
10706 %\end{macro}
10707 %\begin{macro}{\ps@ffplain}
10708 %\changes{2.0}{2025-11-24}{new}
10709 % \begin{macrocode}
10710 \newcommand \ps@ffplain
10711 {
10712 \__flowfram_ps_plain:
10713 \bool_if:NT \l__flowfram_ps_ffempty_hides_bool
10714 {
10715 \FlowFramSetDynamicHeadFootAttributes
10716 { hide = false , hidethis = false }
10717 }
10718 }
10719 % \end{macrocode}
10720 %\end{macro}
10721 %
10722 % \begin{macrocode}
10723 \cs_new:Nn \__flowfram_ps_plain:
10724 {
10725 \def \@oddfoot { \dfOddFooterStyle { \thepage } }
10726 \def \@evenfoot { \dfEvenFooterStyle { \thepage } }
10727 \def \@oddhead { }
10728 \def \@evenhead { }
10729 \let \@mkboth \@gobbletwo
10730 \let \sectionmark \@gobble
10731 \let \subsectionmark \@gobble
10732 }
10733 % \end{macrocode}
10734 %
10735 %\begin{macro}{\ps@ffempty}
10736 %\changes{2.0}{2025-11-24}{new}
10737 % \begin{macrocode}
10738 \newcommand \ps@ffempty
10739 {
10740 \l__flowfram_ffempty_style_tl
10741 \bool_if:NT \l__flowfram_ps_ffempty_hides_bool
10742 {
10743 \FlowFramSetDynamicHeadFootAttributes { hide }
10744 }
10745 }
10746 % \end{macrocode}
10747 %\end{macro}
10748 %
10749 % \begin{macrocode}
10750 \cs_new:Nn \__flowfram_ps_empty:
10751 {
10752 \def \@oddfoot { }
10753 \def \@evenfoot { }
10754 \def \@oddhead { }
10755 \def \@evenhead { }
10756 \let \@mkboth \@gobbletwo
10757 \let \sectionmark \@gobble
10758 \let \subsectionmark \@gobble
10759 }
10760 % \end{macrocode}
10761 %
10762 %\begin{macro}{\ps@specialffempty}
10763 %Used with \cs{thispagestyle}:
10764 %\changes{2.0}{2025-11-24}{new}
10765 % \begin{macrocode}
10766 \newcommand \ps@specialffempty
10767 {
10768 \l__flowfram_ffempty_style_tl
10769 \bool_if:NT \l__flowfram_ps_ffempty_hides_bool
10770 {
10771 \FlowFramSetDynamicHeadFootAttributes { hidethis }
10772 }
10773 }
10774 % \end{macrocode}
10775 %\end{macro}
10776 %
10777 %\begin{macro}{\ps@specialempty}
10778 %Used with \cs{thispagestyle}:
10779 % \begin{macrocode}
10780 \newcommand \ps@specialempty { \ps@empty }
10781 % \end{macrocode}
10782 %\end{macro}
10783 %
10784 %\begin{macro}{\footnotecolor}
10785 %\changes{2.0}{2025-11-24}{deprecated}
10786 %Does nothing now. Marked for removal.
10787 % \begin{macrocode}
10788 \newcommand \footnotecolor { }
10789 % \end{macrocode}
10790 %\end{macro}
10791 %\begin{macro}{\@makecol}
10792 %Version 2.0 removed redefinition of \cs{@makecol}.
10793 %\changes{2.0}{2025-11-24}{removed redefinition}
10794 %This means that footnotes will now be the default colour rather
10795 %than the text colour associated with the current flow frame.
10796 %Use \cs{color} in the preamble to set the default colour.
10797 %\end{macro}
10798 %
10799 %\begin{macro}{\if@ff@moreframes}
10800 %Version 2.0 replaced legacy conditional \cs{if@ff@moreframes} with
10801 %l3bool.
10802 % \begin{macrocode}
10803 \bool_new:N \g__flowfram_more_frames_bool
10804 % \end{macrocode}
10805 %\end{macro}
10806 %\begin{macro}{\@ff@checkifmoreframes}
10807 % Check to see if there are more \glspl{flow} defined, and
10808 % set "\g__flowfram_more_frames_bool" as appropriate. This involves
10809 % iterating through all \glspl{flow}, and through each
10810 % frame's \gls{pglist}.
10811 % Version 2.0 renamed \cs{@ff@checkifmoreframes}.
10812 %\changes{2.0}{2025-11-24}{renamed}
10813 % \begin{macrocode}
10814 \cs_new:Nn \__flowfram_check_if_more_frames:n
10815 {
10816 \bool_gset_false:N \g__flowfram_more_frames_bool
10817 \int_set:Nn \l__flowfram_col_int { #1 }
10818 \bool_while_do:nn
10819 {
10820 \bool_lazy_and_p:nn
10821 {
10822 \int_compare_p:nNn { \l__flowfram_col_int } < { \c@maxflow }
10823 }
10824 {
10825 \bool_not_p:n
10826 {
10827 \bool_if_p:N \g__flowfram_more_frames_bool
10828 }
10829 }
10830 }
10831 {
10832 \int_incr:N \l__flowfram_col_int
10833 % \end{macrocode}
10834 % Skip if this page is in this frame's exclusion list.
10835 %\changes{1.14}{2012-11-10}{added check for exclusion list}
10836 % \begin{macrocode}
10837 \exp_args:Ne
10838 \flowfram_if_in_frame_clist:nnnnF
10839 { \int_eval:n { \g__flowfram_pagecounter_tl } }
10840 { flow } { excludelist } { \l__flowfram_col_int }
10841 {
10842 % \end{macrocode}
10843 % This page is in this not in frame's exclusion list so now check if
10844 % in frame's page list.
10845 % \begin{macrocode}
10846 \exp_args:Ne
10847 \flowfram_if_frame_has_morepages:nnnT
10848 { \int_eval:n { \g__flowfram_pagecounter_tl } }
10849 { flow } { \l__flowfram_col_int }
10850 {
10851 \bool_gset_true:N \g__flowfram_more_frames_bool
10852 }
10853 % \end{macrocode}
10854 % If found a frame, break out of loop.
10855 % \begin{macrocode}
10856 }
10857 }
10858 \bool_if:NF \g__flowfram_more_frames_bool
10859 {
10860 % \end{macrocode}
10861 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
10862 %\cs{@ff@pages@countreg}}
10863 % \begin{macrocode}
10864 \int_set:Nn \l__flowfram_tmpa_int
10865 { \g__flowfram_pagecounter_tl }
10866 % \end{macrocode}
10867 % Look ahead up to a maximum of 4 pages.
10868 % \begin{macrocode}
10869 \int_zero:N \l__flowfram_tmpb_int
10870 \bool_do_while:nn
10871 {
10872 \int_compare_p:nNn { \l__flowfram_tmpb_int } < { 4 }
10873 }
10874 {
10875 \int_incr:N \l__flowfram_tmpa_int
10876 \int_zero:N \l__flowfram_col_int
10877 \bool_while_do:nn
10878 {
10879 \int_compare_p:nNn { \l__flowfram_col_int } < { \c@maxflow }
10880 }
10881 {
10882 \int_incr:N \l__flowfram_col_int
10883 % \end{macrocode}
10884 % Skip if page is in this frame's exclusion list.
10885 % \begin{macrocode}
10886 \exp_args:NV \flowfram_if_frame_excludedpage:nnnF
10887 \l__flowfram_tmpa_int
10888 { flow } { \l__flowfram_col_int }
10889 {
10890 % \end{macrocode}
10891 % This page is not in this frame's exclusion list.
10892 % \begin{macrocode}
10893 \exp_args:NV
10894 \flowfram_if_frame_has_morepages:nnnT
10895 \l__flowfram_tmpa_int
10896 { flow } { \l__flowfram_col_int }
10897 {
10898 \bool_gset_true:N \g__flowfram_more_frames_bool
10899 }
10900 % \end{macrocode}
10901 % If found a frame, break out of loop.
10902 % \begin{macrocode}
10903 \bool_if:NT \g__flowfram_more_frames_bool
10904 {
10905 \int_set_eq:NN \l__flowfram_col_int \c@maxflow
10906 }
10907 }
10908 }
10909 \bool_if:NTF \g__flowfram_more_frames_bool
10910 {
10911 \int_set:Nn \l__flowfram_tmpb_int { 4 }
10912 }
10913 {
10914 \int_incr:N \l__flowfram_tmpb_int
10915 }
10916 }
10917 }
10918 }
10919 % \end{macrocode}
10920 %\end{macro}
10921 %\begin{macro}{\@ff@checkpages}
10922 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
10923 %\cs{@ff@pages@countreg}}
10924 %\changes{2.0}{2025-11-24}{removed}
10925 %Version 2.0 removed \cs{@ff@checkpages}
10926 %
10927 % Check to see if the current page lies in the \gls{pgrange}
10928 % given by "#1". If the \gls{pgrange} is specified by
10929 % "all", "odd" or "even" then there are definitely more
10930 % frames available, otherwise check to see if the current page
10931 % lies within the number range. If the \gls{pgrange} is "none",
10932 % ignore it.
10933 %\end{macro}
10934 %
10935 %\begin{macro}{\@ff@checkthispage}
10936 %\changes{2.0}{2025-11-24}{removed}
10937 %Version 2.0 removed \cs{@ff@checkthispage}
10938 %\end{macro}
10939 %\begin{macro}{\@ff@checknumrange}
10940 %\changes{2.0}{2025-11-24}{removed}
10941 %Version 2.0 removed \cs{@ff@checknumrange}.
10942 %\end{macro}
10943 %
10944 %\begin{macro}{\c@ffrangenum}
10945 %\changes{2.0}{2025-11-24}{removed}
10946 %Version 2.0 removed \cs{ffrangenum}.
10947 %\end{macro}
10948 %\begin{macro}{\@ff@getrangeless}
10949 %\changes{2.0}{2025-11-24}{removed}
10950 %Version 2.0 removed \cs{@ff@getrangeless}.
10951 %\end{macro}
10952 %\begin{macro}{\@ff@getrangegreater}
10953 %\changes{2.0}{2025-11-24}{removed}
10954 %Version 2.0 removed \cs{@ff@getrangegreater}.
10955 %\end{macro}
10956 %\begin{macro}{\@@ff@getrange}
10957 %\changes{2.0}{2025-11-24}{removed}
10958 %Version 2.0 removed \cs{@ff@getrange}.
10959 %\end{macro}
10960 %\begin{macro}{\@@@ff@getrange}
10961 %\changes{2.0}{2025-11-24}{removed}
10962 %Version 2.0 removed \cs{@ff@getrange}.
10963 %\end{macro}
10964 %
10965 %\begin{macro}{\@ff@output@adjustframes}
10966 %\changes{1.14}{2012-11-10}{new}
10967 % Provide a hook to adjust frame settings in the output routine.
10968 % Version 2.0 renamed \cs{@ff@output@adjustframes}
10969 %\changes{2.0}{2025-11-24}{renamed}
10970 % \begin{macrocode}
10971 \tl_new:N \g__flowfram_output_adjust_frames_tl
10972 % \end{macrocode}
10973 %\end{macro}
10974 %
10975 %\begin{macro}{\ffaddtoadjustframeshook}
10976 %\changes{1.14}{2012-11-10}{new}
10977 %\changes{2.0}{2025-11-24}{changed to document command}
10978 % Add stuff to the output hook.
10979 % \begin{macrocode}
10980 \NewDocumentCommand \ffaddtoadjustframeshook { m }
10981 {
10982 \tl_gput_right:Nn \g__flowfram_output_adjust_frames_tl { #1 }
10983 }
10984 % \end{macrocode}
10985 %\end{macro}
10986 %
10987 %\begin{macro}{\if@ff@nwpg}
10988 %Conditional to keep track of whether or not a new page is required.
10989 %\changes{2.0}{2025-11-24}{replace}
10990 %Version 2.0 replaced legacy conditional with l3bool.
10991 % \begin{macrocode}
10992 %\newif\if@ff@nwpg
10993 \bool_new:N \g__flowfram_new_page_bool
10994 % \end{macrocode}
10995 %\end{macro}
10996 %
10997 %\begin{macro}{\if@notthiscol}
10998 %Version 2.0 replaced legacy conditional \cs{if@notthiscol} with
10999 %l3bool.
11000 %\changes{2.0}{2025-11-24}{replaced}
11001 % \begin{macrocode}
11002 \bool_new:N \g__flowfram_not_this_frame_bool
11003 % \end{macrocode}
11004 %\end{macro}
11005 %\begin{macro}{\c@curpg}
11006 %Keep track of current page.
11007 %Version 2.0 renamed \cs{c@curpg}.
11008 %\changes{2.0}{2025-11-24}{renamed}
11009 % \begin{macrocode}
11010 \int_new:N \g__flowfram_current_page_int
11011 % \end{macrocode}
11012 %\end{macro}
11013 %
11014 %\begin{macro}{\@g@tnextcol}
11015 % Find the next \gls{flow}. If there are no more flow
11016 % frames, define a new one the size of the \gls{typeblock}.
11017 % (Otherwise the remaining document text will be lost.)
11018 %\changes{2.0}{2025-11-24}{renamed}
11019 %Version 2.0 renamed \cs{@g@tnextcol}.
11020 %Get the next available column, which may be on this page or the
11021 %next. The integer variable is the current frame index which will be
11022 %updated. Also, "\g__flowfram_current_page_int" will be updated
11023 %if there are no further frames available on the current page.
11024 % \begin{macrocode}
11025 \cs_new:Nn \__flowfram_get_next_column:N
11026 {
11027 % \end{macrocode}
11028 % Do any frame adjustments:
11029 % \begin{macrocode}
11030 \g__flowfram_output_adjust_frames_tl
11031 % \end{macrocode}
11032 % Now clear the hook:
11033 % \begin{macrocode}
11034 \tl_gclear:N \g__flowfram_output_adjust_frames_tl
11035 % \end{macrocode}
11036 % Now check for any more frames.
11037 % \begin{macrocode}
11038 \__flowfram_check_if_more_frames:n { \c@thisframe }
11039 \bool_if:NF \g__flowfram_more_frames_bool
11040 {
11041 % \end{macrocode}
11042 % No more frames, add new frame
11043 % \begin{macrocode}
11044 \msg_warning:nne { flowfram } { no-more-cols-on-page }
11045 { \int_eval:n { \g__flowfram_pagecounter_tl } }
11046 \flf@doifverbose
11047 {
11048 \tl_clear:N \l__flowfram_tmpa_tl
11049 \seq_map_indexed_inline:nn \g__flowfram_flowlabels_seq
11050 {
11051 \tl_put_right:Ne \l__flowfram_tmpa_tl
11052 {
11053 \exp_not:N \MessageBreak
11054 ##1 ( ##2 )
11055 Pages: ~
11056 \flowfram_frame_use_clist:nnn
11057 { flow } { pagelist } { ##1 }
11058 Exclusions: ~
11059 \flowfram_frame_use_clist:nnn
11060 { flow } { excludelist } { ##1 }
11061 }
11062 }
11063 \msg_info:nnV { flowfram } { info-col-list }
11064 \l__flowfram_tmpa_tl
11065 }
11066 % \end{macrocode}
11067 %No flow frames available. Create a single flow frame.
11068 % \begin{macrocode}
11069 \__flowfram_one_column:n { all }
11070 \int_gset_eq:NN #1 \c@maxflow
11071 }
11072 \bool_gset_true:N \g__flowfram_not_this_frame_bool
11073 \bool_gset_false:N \g__flowfram_new_page_bool
11074 \int_set_eq:NN \l__flowfram_col_int #1
11075 % \end{macrocode}
11076 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
11077 %\cs{@ff@pages@countreg}}
11078 % \begin{macrocode}
11079 \int_gset:Nn \g__flowfram_current_page_int
11080 { \g__flowfram_pagecounter_tl }
11081 \bool_while_do:Nn \g__flowfram_not_this_frame_bool
11082 {
11083 \int_compare:nNnTF
11084 { \l__flowfram_col_int } = { \c@maxflow }
11085 {
11086 % \end{macrocode}
11087 % Reached the end of the page. Try the next one.
11088 % \begin{macrocode}
11089 \int_set_eq:NN \l__flowfram_col_int \c_one_int
11090 \bool_gset_true:N \g__flowfram_new_page_bool
11091 \int_gincr:N \g__flowfram_current_page_int
11092 }
11093 {
11094 % \end{macrocode}
11095 % Move on to the next flow frame on this page.
11096 % \begin{macrocode}
11097 \int_incr:N \l__flowfram_col_int
11098 }
11099 \__flowfram_check_if_this_page:nn
11100 { \g__flowfram_current_page_int } { \l__flowfram_col_int }
11101 }
11102 \int_gset_eq:NN #1 \l__flowfram_col_int
11103 }
11104 % \end{macrocode}
11105 %\end{macro}
11106 %\begin{macro}{\@ff@chckifthispg}
11107 % This is used to determine the next \gls{flow}, since not
11108 % all \glspl{flow} may be defined on every page. Checks to
11109 % see if \gls{flow} "#2" is defined on page "#1".
11110 %Version 2.0 renamed \cs{@ff@chckifthispg}.
11111 %\changes{2.0}{2025-11-24}{renamed}
11112 % \begin{macrocode}
11113 \cs_new:Nn \__flowfram_check_if_this_page:nn
11114 {
11115 % \end{macrocode}
11116 % First set up some variables.
11117 % \begin{macrocode}
11118 \bool_gset_false:N \g__flowfram_not_this_frame_bool
11119 \flowfram_set_clist_to_frame_clist:Nnnn
11120 \l__flowfram_exclude_pages_clist
11121 { flow } { excludelist } { #2 }
11122 % \end{macrocode}
11123 % Iterate over exclusion list.
11124 % \begin{macrocode}
11125 \clist_map_inline:Nn
11126 \l__flowfram_exclude_pages_clist
11127 {
11128 \int_compare:nNnT { ##1 } = { #1 }
11129 {
11130 \bool_gset_true:N \g__flowfram_not_this_frame_bool
11131 \clist_map_break:
11132 }
11133 }
11134 \bool_if:NF \g__flowfram_not_this_frame_bool
11135 {
11136 % \end{macrocode}
11137 % Not in the excluded list. Now check if in the page list range.
11138 % \begin{macrocode}
11139 \bool_gset_true:N \g__flowfram_not_this_frame_bool
11140 \flowfram_set_clist_to_frame_clist:Nnnn
11141 \l__flowfram_pages_clist
11142 { flow } { pagelist } { #2 }
11143 \__flowfram_check_if_this_page:n { #1 }
11144 }
11145 }
11146 % \end{macrocode}
11147 %\end{macro}
11148 %\begin{macro}{\@@ff@chckifthispg}
11149 % Now go ahead and check.
11150 % Version 2.0 renamed \cs{@@ff@chckifthispg}.
11151 %\changes{2.0}{2025-11-24}{renamed}
11152 % \begin{macrocode}
11153 \cs_new:Nn \__flowfram_check_if_this_page:n
11154 {
11155 \tl_if_eq:NNF \l__flowfram_pages_clist \c_flowfram_none_tl
11156 {
11157 \tl_if_eq:NNTF \l__flowfram_pages_clist \c_flowfram_all_tl
11158 {
11159 \bool_gset_false:N \g__flowfram_not_this_frame_bool
11160 }
11161 {
11162 \tl_if_eq:NNTF \l__flowfram_pages_clist \c_flowfram_odd_tl
11163 {
11164 \int_if_odd:nT { #1 }
11165 {
11166 \bool_gset_false:N \g__flowfram_not_this_frame_bool
11167 }
11168 }
11169 {
11170 \tl_if_eq:NNTF \l__flowfram_pages_clist \c_flowfram_even_tl
11171 {
11172 \int_if_even:nT { #1 }
11173 {
11174 \bool_gset_false:N \g__flowfram_not_this_frame_bool
11175 }
11176 }
11177 {
11178 % \end{macrocode}
11179 % check through list of page numbers
11180 % \begin{macrocode}
11181 \clist_map_inline:Nn \l__flowfram_pages_clist
11182 {
11183 \flowfram_if_in_pagerange:nnT { #1 } { ##1 }
11184 {
11185 \bool_gset_false:N \g__flowfram_not_this_frame_bool
11186 \clist_map_break:
11187 }
11188 }
11189 }
11190 }
11191 }
11192 }
11193 }
11194 % \end{macrocode}
11195 %\end{macro}
11196 %\begin{macro}{\@sf@chckifthispg}
11197 % Checks to see if \gls{static} "#1" is defined on the
11198 % current page (or the page given by the optional argument).
11199 %\changes{1.14}{2012-11-10}{added optional argument}
11200 %Version 2.0 replaced \cs{@sf@chckifthispg}.
11201 %\changes{2.0}{2025-11-24}{replaced}
11202 % \begin{macrocode}
11203 \cs_new:Nn \__flowfram_static_check_if_this_page:n
11204 {
11205 \__flowfram_static_check_if_this_page:nn
11206 { \g__flowfram_pagecounter_tl } { #1 }
11207 }
11208 \cs_new:Nn \__flowfram_static_check_if_this_page:nn
11209 {
11210 \bool_gset_true:N \g__flowfram_not_this_frame_bool
11211 \flowfram_set_clist_to_frame_clist:Nnnn
11212 \l__flowfram_pages_clist
11213 { static } { pagelist } { #2 }
11214 % \end{macrocode}
11215 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
11216 %\cs{@ff@pages@countreg}}
11217 % \begin{macrocode}
11218 \__flowfram_check_if_this_page:n { #1 }
11219 }
11220 % \end{macrocode}
11221 %\end{macro}
11222 %\begin{macro}{\@df@chckifthispg}
11223 % Checks to see if \gls{dynamic} "#1" is defined on the
11224 % current page (or the page given by the optional argument).
11225 %\changes{1.14}{2012-11-10}{added optional argument}
11226 %Version 2.0 replaced \cs{@df@chckifthispg}.
11227 %\changes{2.0}{2025-11-24}{replaced}
11228 % \begin{macrocode}
11229 \cs_new:Nn \__flowfram_dynamic_check_if_this_page:n
11230 {
11231 \__flowfram_dynamic_check_if_this_page:nn
11232 { \g__flowfram_pagecounter_tl } { #1 }
11233 }
11234 \cs_new:Nn \__flowfram_dynamic_check_if_this_page:nn
11235 {
11236 \bool_gset_true:N \g__flowfram_not_this_frame_bool
11237 \flowfram_set_clist_to_frame_clist:Nnnn
11238 \l__flowfram_pages_clist
11239 { dynamic } { pagelist } { #2 }
11240 % \end{macrocode}
11241 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
11242 %\cs{@ff@pages@countreg}}
11243 % \begin{macrocode}
11244 \__flowfram_check_if_this_page:n { #1 }
11245 }
11246 % \end{macrocode}
11247 %\end{macro}
11248 %\begin{macro}{\@setcolbox}
11249 % Sets the \TeX\ box defining the \gls{flow} to the output
11250 % box. This saves the output until the page is shipped out after
11251 % all the \glspl{flow} have been filled for that page.
11252 %\changes{2.0}{2025-11-24}{renamed}
11253 %Version 2.0 renamed \cs{@setcolbox}.
11254 % \begin{macrocode}
11255 \cs_new:Nn \__flowfram_set_column_box:n
11256 {
11257 \exp_args:Nne \__flowfram_message:nn
11258 { info-setting-col } { \int_eval:n { #1 } }
11259 \flowfram_frame_set_box_eq:nnnN
11260 { flow } { column } { #1 } \@outputbox
11261 }
11262 % \end{macrocode}
11263 %\end{macro}
11264 %\begin{macro}{\rotateframe}
11265 %\changes{2.0}{2025-11-24}{changed to document command}
11266 % \begin{macrocode}
11267 \NewDocumentCommand \rotateframe { m m }
11268 {
11269 \int_if_zero:nTF { #1 }
11270 { #2 }
11271 {
11272 \rotatebox { #1 } { #2 }
11273 }
11274 }
11275 % \end{macrocode}
11276 %\end{macro}
11277 %
11278 %\begin{macro}{\@docolbox}
11279 % Put \gls{flow} on the page with the correct border, if it
11280 % has one.
11281 %Version 2.0 renamed \cs{@docolbox}.
11282 %\changes{2.0}{2025-11-24}{renamed}
11283 % \begin{macrocode}
11284 \cs_new:Nn \__flowfram_do_flow_box:n
11285 {
11286 \exp_args:Nnee
11287 \__flowfram_message:nnn
11288 { info-doing-col}
11289 { \int_eval:n { #1 } }
11290 { \int_eval:n { \g__flowfram_pagecounter_tl} }
11291 \flowfram_set_tl_to_frame_tl:Nnnn
11292 \l__flowfram_frametype_tl
11293 { flow } { frametype } { #1 }
11294 % \end{macrocode}
11295 % Frame colour
11296 % \begin{macrocode}
11297 \flowfram_set_tl_to_frame_tl:Nnnn
11298 \l__flowfram_bordercolor_tl
11299 { flow } { bordercolor } { #1 }
11300 % \end{macrocode}
11301 % Text colour
11302 % \begin{macrocode}
11303 \flowfram_set_tl_to_frame_tl:Nnnn
11304 \l__flowfram_textcolor_tl
11305 { flow } { textcolor } { #1 }
11306 % \end{macrocode}
11307 % Background colour
11308 % \begin{macrocode}
11309 \flowfram_set_tl_to_frame_tl:Nnnn
11310 \l__flowfram_backcolor_tl
11311 { flow } { backcolor } { #1 }
11312 % \end{macrocode}
11313 % Compute offset for this frame
11314 % \begin{macrocode}
11315 \__flowfram_flow_calc_offset:n {#1}%
11316 % \end{macrocode}
11317 % Rotate frame if required
11318 % \begin{macrocode}
11319 \exp_args:Ne \rotateframe
11320 {
11321 \flowfram_frame_use_tl:nnn { flow } { angle } { #1 }
11322 }
11323 {
11324 % \end{macrocode}
11325 % Check if frame has a border
11326 % \begin{macrocode}
11327 \flowfram_if_frame_bool:nnnTF
11328 { flow } { hasframe } { #1 }
11329 {
11330 % \end{macrocode}
11331 % Put the required border around the frame
11332 % \begin{macrocode}
11333 \__flowfram_bordered_box:nnnn
11334 {
11335 \flowfram_frame_use_dim:nnn { flow } { width } { #1 }
11336 }
11337 {
11338 \flowfram_frame_use_dim:nnn { flow } { height } { #1 }
11339 }
11340 {
11341 \flowfram_frame_use_drop_box:nnn
11342 { flow } { column } { #1 }
11343 }
11344 {
11345 \use:c { \l__flowfram_frametype_tl }
11346 }
11347 }
11348 {
11349 % \end{macrocode}
11350 % Do the frame without a border
11351 % \begin{macrocode}
11352 \__flowfram_noborder_box:nnn
11353 {
11354 \flowfram_frame_use_dim:nnn { flow } { width } { #1 }
11355 }
11356 {
11357 \flowfram_frame_use_dim:nnn { flow } { height } { #1 }
11358 }
11359 {
11360 \flowfram_frame_use_drop_box:nnn { flow } { column } { #1 }
11361 }
11362 }
11363 }
11364 }
11365 % \end{macrocode}
11366 %\end{macro}
11367 %\begin{macro}{\@docolbbox}
11368 % Do the \gls{bbox} for given \gls{flow}.
11369 %Version 2.0 renamed \cs{@docolbbox}.
11370 %\changes{2.0}{2025-11-24}{renamed}
11371 % \begin{macrocode}
11372 \cs_new:Nn \__flowfram_do_flow_bounding_box:n
11373 {
11374 \__flowfram_flow_calc_offset:n { #1 }
11375 \tl_clear:N \l__flowfram_bordercolor_tl
11376 \tl_clear:N \l__flowfram_textcolor_tl
11377 \__flowfram_do_if_draft:nn
11378 {
11379 \__flowfram_noborder_box:nnn
11380 {
11381 \flowfram_frame_use_dim:nnn { flow } { width } { #1 }
11382 }
11383 {
11384 \flowfram_frame_use_dim:nnn { flow } { height } { #1 }
11385 }
11386 {
11387 \flowfram_frame_use_drop_box:nnn { flow } { column } { #1 }
11388 }
11389 }
11390 {
11391 \flowfram_draft_annote:nnn
11392 { F } { \int_eval:n { #1 } } { \getflowlabel { #1 } }
11393 }
11394 }
11395 % \end{macrocode}
11396 %\end{macro}
11397 %\begin{macro}{\@ff@fbox}
11398 % Put the \TeX\ box "#3" of width "#1" and
11399 % height "#2", and frame making command
11400 % specified by "#4".
11401 %Version 2.0 renamed \cs{@ff@fbox}.
11402 %\changes{2.0}{2025-11-24}{renamed}
11403 % \begin{macrocode}
11404 \cs_new:Nn \__flowfram_bordered_box:nnnn
11405 {
11406 \group_begin:
11407 \dim_set_eq:NN \fboxsep \flowframesep
11408 \dim_set_eq:NN \fboxrule \flowframerule
11409 \__flowfram_set_border_color:
11410 \kern \l__flowfram_offset_dim
11411 #4 { \__flowfram_noborder_box:nnn { #1 } { #2 } { #3 } }
11412 \group_end:
11413 }
11414 % \end{macrocode}
11415 %\end{macro}
11416 %\begin{macro}{\@ff@box}
11417 % Put the \TeX\ box "#3" of width "#1" and height "#2" on
11418 % the page.
11419 %Version 2.0 renamed \cs{@ff@box}.
11420 %\changes{2.0}{2025-11-24}{renamed}
11421 % \begin{macrocode}
11422 \cs_new:Nn \__flowfram_noborder_box:nnn
11423 {
11424 \group_begin:
11425 \__flowfram_background_box:n
11426 {
11427 \vbox_to_ht:nn { #2 }
11428 {
11429 \hbox_to_wd:nn { #1 }
11430 { \hss { \__flowfram_set_text_color: #3 } \hss }
11431 \vss
11432 \kern\z@
11433 }
11434 }
11435 \group_end:
11436 }
11437 % \end{macrocode}
11438 %\end{macro}
11439 %\begin{macro}{\@putcolbox}
11440 % Display the \gls{flow} on the page, at its given position.
11441 % If the document is two-sided, need to check whether
11442 % the current page is odd or even to determine the correct
11443 % location.
11444 % Version 2.0 renamed \cs{@putcolbox}.
11445 %\changes{2.0}{2025-11-24}{renamed}
11446 % \begin{macrocode}
11447 \cs_new:Nn \__flowfram_put_flow_box:n
11448 {
11449 % \end{macrocode}
11450 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
11451 %\cs{@ff@pages@countreg}}
11452 % \begin{macrocode}
11453 \__flowfram_check_if_this_page:nn
11454 { \g__flowfram_pagecounter_tl } { #1 }
11455 % \end{macrocode}
11456 %\changes{1.14}{2012-11-10}{added check for non-void box}
11457 % \begin{macrocode}
11458 \bool_if:NT \g__flowfram_not_this_frame_bool
11459 {
11460 \flowfram_frame_if_box_empty:nnnF
11461 { flow } { column } { #1 }
11462 {
11463 \msg_warning:nneeee
11464 { flowfram } { non-void-box }
11465 { \int_eval:n { #1 } }
11466 { \int_use:N \g__flowfram_pagecounter_tl }
11467 { \flowfram_frame_use_clist:nnn { flow } { pagelist } { #1 } }
11468 { \flowfram_frame_use_clist:nnn { flow } { excludelist } { #1 } }
11469 \bool_gset_false:N \g__flowfram_not_this_frame_bool
11470 }
11471 }
11472 \bool_if:NTF \g__flowfram_not_this_frame_bool
11473 {
11474 \exp_args:Nnee
11475 \__flowfram_message:nnn
11476 { info-col-not-required }
11477 { \int_eval:n { #1 } }
11478 { \int_eval:n { \g__flowfram_pagecounter_tl } }
11479 }
11480 {
11481 \@killglue
11482 \legacy_if:nTF { @twoside }
11483 {
11484 \int_if_odd:nTF { \c@page }
11485 {
11486 \box_move_up:nn
11487 {
11488 \flowfram_frame_use_dim:nnn { flow } { posy } { #1 }
11489 }
11490 {
11491 \hbox_to_zero:n
11492 {
11493 \kern
11494 \flowfram_frame_use_dim:nnn { flow } { posx } { #1 }
11495 \__flowfram_do_flow_box:n { #1 }
11496 \hss
11497 }
11498 }
11499 }
11500 {
11501 \box_move_up:nn
11502 {
11503 \flowfram_frame_use_dim:nnn { flow } { eveny } { #1 }
11504 }
11505 {
11506 \hbox_to_zero:n
11507 {
11508 \kern
11509 \flowfram_frame_use_dim:nnn { flow } { evenx } { #1 }
11510 \__flowfram_do_flow_box:n { #1 }
11511 \hss
11512 }
11513 }
11514 }
11515 }
11516 {
11517 \box_move_up:nn
11518 {
11519 \flowfram_frame_use_dim:nnn { flow } { posy } { #1 }
11520 }
11521 {
11522 \hbox_to_zero:n
11523 {
11524 \kern
11525 \flowfram_frame_use_dim:nnn { flow } { posx } { #1 }
11526 \__flowfram_do_flow_box:n { #1 }
11527 \hss
11528 }
11529 }
11530 }
11531 }
11532 }
11533 % \end{macrocode}
11534 %\end{macro}
11535 %\begin{macro}{\@putcolbbox}
11536 % Same for \gls{flow} \gls{bbox}:
11537 %Version 2.0 renamed \cs{@putcolbbox}.
11538 %\changes{2.0}{2025-11-24}{renamed}
11539 % \begin{macrocode}
11540 \cs_new:Nn \__flowfram_put_flow_bounding_box:n
11541 {
11542 % \end{macrocode}
11543 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with \cs{@ff@pages@countreg}}
11544 % \begin{macrocode}
11545 \__flowfram_check_if_this_page:nn
11546 { \g__flowfram_pagecounter_tl } { #1 }
11547 \bool_if:NF \g__flowfram_not_this_frame_bool
11548 {
11549 \@killglue
11550 \legacy_if:nTF { @twoside }
11551 {
11552 \int_if_odd:nTF { \c@page }
11553 {
11554 \box_move_up:nn
11555 {
11556 \flowfram_frame_use_dim:nnn { flow } { posy } { #1 }
11557 }
11558 {
11559 \hbox_to_zero:n
11560 {
11561 \kern
11562 \flowfram_frame_use_dim:nnn { flow } { posx } { #1 }
11563 \__flowfram_do_flow_bounding_box:n { #1 }
11564 \hss
11565 }
11566 }
11567 }
11568 {
11569 \box_move_up:nn
11570 {
11571 \flowfram_frame_use_dim:nnn { flow } { eveny } { #1 }
11572 }
11573 {
11574 \hbox_to_zero:n
11575 {
11576 \kern
11577 \flowfram_frame_use_dim:nnn { flow } { evenx } { #1 }
11578 \__flowfram_do_flow_bounding_box:n {#1}
11579 \hss
11580 }
11581 }
11582 }
11583 }
11584 {
11585 \box_move_up:nn
11586 {
11587 \flowfram_frame_use_dim:nnn { flow } { posy } { #1 }
11588 }
11589 {
11590 \hbox_to_zero:n
11591 {
11592 \kern
11593 \flowfram_frame_use_dim:nnn { flow } { posx } { #1 }
11594 \__flowfram_do_flow_bounding_box:n {#1}
11595 \hss
11596 }
11597 }
11598 }
11599 }
11600 }
11601 % \end{macrocode}
11602 %\end{macro}
11603 % If an offset hasn't been specified, compute it. If the
11604 % frame making command is known (e.g. doublebox), compute
11605 % the offset according to known specifications, otherwise
11606 % set the negative offset to "\flowframesep" plus
11607 % "\flowframerule", which may or may not be correct.
11608 %
11609 %\begin{macro}{\ff@s@t@doubleboxoffset}
11610 % Compute offset for "\doublebox".
11611 %Version 2.0 renamed \cs{ff@s@t@doubleboxoffset}
11612 %\changes{2.0}{2025-11-24}{renamed}
11613 % \begin{macrocode}
11614 \cs_new:Nn \__flowfram_set_doublebox_offset:
11615 {
11616 \dim_set:Nn \l__flowfram_offset_dim
11617 {
11618 - \flowframesep
11619 -3.75 \flowframerule
11620 - 0.5pt
11621 }
11622 }
11623 % \end{macrocode}
11624 %\end{macro}
11625 %\begin{macro}{\@ff@s@t@ovalboxoffset}
11626 % Compute offset for "\ovalbox".
11627 %Version 2.0 renamed \cs{ff@s@t@ovalboxoffset}
11628 %\changes{2.0}{2025-11-24}{renamed}
11629 % \begin{macrocode}
11630 \cs_new:Nn \__flowfram_set_ovalbox_offset:
11631 {
11632 \dim_set:Nn \l__flowfram_offset_dim
11633 {
11634 - \flowframesep
11635 - \fontdimen 8 \tenln
11636 }
11637 }
11638 % \end{macrocode}
11639 %\end{macro}
11640 %\begin{macro}{\@ff@s@t@Ovalboxoffset}
11641 % Compute offset for "\Ovalbox":
11642 %\changes{2.0}{2025-11-24}{renamed}
11643 %Version 2.0 renamed \cs{ff@s@t@Ovalboxoffset}
11644 % \begin{macrocode}
11645 \cs_new:Nn \__flowfram_set_Ovalbox_offset:
11646 {
11647 \dim_set:Nn \l__flowfram_offset_dim
11648 {
11649 - \flowframesep
11650 - \fontdimen 8 \tenlnw
11651 }
11652 }
11653 % \end{macrocode}
11654 %\end{macro}
11655 %\begin{macro}{\@ff@s@t@defaultoffset}
11656 % Compute default offset:
11657 %\changes{2.0}{2025-11-24}{renamed}
11658 %Version 2.0 renamed \cs{ff@s@t@defaultoffset}
11659 % \begin{macrocode}
11660 \cs_new:Nn \__flowfram_set_default_offset:
11661 {
11662 \dim_set:Nn \l__flowfram_offset_dim
11663 {
11664 - \flowframesep
11665 - \flowframerule
11666 }
11667 }
11668 % \end{macrocode}
11669 %\end{macro}
11670 %\begin{macro}{\@ff@setoffset}
11671 % Compute offset for \gls{flow} "#1". Stores offset value
11672 % in "\l__flowfram_offset_tl".
11673 % Version 2.0 renamed \cs{@ff@setoffset}.
11674 %\changes{2.0}{2025-11-24}{renamed}
11675 % \begin{macrocode}
11676 \cs_new:Nn \__flowfram_flow_calc_offset:n
11677 {
11678 \flowfram_if_tl_eq_frame_tl:NnnnTF
11679 \c_flowfram_compute_tl
11680 { flow } { offset } { #1 }
11681 {
11682 \flowfram_if_frame_bool:nnnTF { flow } { hasframe } { #1 }
11683 {
11684 \flowfram_set_tl_to_frame_tl:Nnnn
11685 \l__flowfram_frametype_tl
11686 { flow } { frametype } { #1 }
11687 \cs_if_exist_use:cF
11688 { __flowfram_set_ \l__flowfram_frametype_tl _offset: }
11689 {
11690 \__flowfram_set_default_offset:
11691 }
11692 }
11693 {
11694 \dim_zero:N \l__flowfram_offset_dim
11695 }
11696 }
11697 {
11698 \flowfram_set_dim_to_frame_tl:Nnnn
11699 \l__flowfram_offset_dim
11700 { flow } { offset } { #1 }
11701 }
11702 }
11703 % \end{macrocode}
11704 %\end{macro}
11705 %\begin{macro}{\@sf@setoffset}
11706 % Compute offset for \gls{static} "#1". Stores offset value
11707 % in "\l__flowfram_offset_tl".
11708 % Version 2.0 renamed \cs{@sf@setoffset}.
11709 %\changes{2.0}{2025-11-24}{renamed}
11710 % \begin{macrocode}
11711 \cs_new:Nn \__flowfram_static_calc_offset:n
11712 {
11713 \flowfram_if_tl_eq_frame_tl:NnnnTF
11714 \c_flowfram_compute_tl
11715 { static } { offset } { #1 }
11716 {
11717 \flowfram_if_frame_bool:nnnTF { static } { hasframe } { #1 }
11718 {
11719 \flowfram_set_tl_to_frame_tl:Nnnn
11720 \l__flowfram_frametype_tl
11721 { static } { frametype } { #1 }
11722 \cs_if_exist_use:cF
11723 { __flowfram_set_ \l__flowfram_frametype_tl _offset: }
11724 {
11725 \__flowfram_set_default_offset:
11726 }
11727 }
11728 {
11729 \dim_zero:N \l__flowfram_offset_dim
11730 }
11731 }
11732 {
11733 \flowfram_set_dim_to_frame_tl:Nnnn
11734 \l__flowfram_offset_dim
11735 { static } { offset } { #1 }
11736 }
11737 }
11738 % \end{macrocode}
11739 %\end{macro}
11740 %\begin{macro}{\@df@setoffset}
11741 % Compute offset for \gls{dynamic} "#1". Stores offset value
11742 % in "\l__flowfram_offset_tl".
11743 % Version 2.0 renamed \cs{@sf@setoffset}.
11744 %\changes{2.0}{2025-11-24}{renamed}
11745 % \begin{macrocode}
11746 \cs_new:Nn \__flowfram_dynamic_calc_offset:n
11747 {
11748 \flowfram_if_tl_eq_frame_tl:NnnnTF
11749 \c_flowfram_compute_tl
11750 { dynamic } { offset } { #1 }
11751 {
11752 \flowfram_if_frame_bool:nnnTF { dynamic } { hasframe } { #1 }
11753 {
11754 \flowfram_set_tl_to_frame_tl:Nnnn
11755 \l__flowfram_frametype_tl
11756 { dynamic } { frametype } { #1 }
11757 \cs_if_exist_use:cF
11758 { __flowfram_set_ \l__flowfram_frametype_tl _offset: }
11759 {
11760 \__flowfram_set_default_offset:
11761 }
11762 }
11763 {
11764 \dim_zero:N \l__flowfram_offset_dim
11765 }
11766 }
11767 {
11768 \flowfram_set_dim_to_frame_tl:Nnnn
11769 \l__flowfram_offset_dim
11770 { dynamic } { offset } { #1 }
11771 }
11772 }
11773 % \end{macrocode}
11774 %\end{macro}
11775 %\begin{macro}{\@putmarginbox}
11776 % Draw box representing the margin for \gls{flow} "#1".
11777 %Version 2.0 renamed \cs{@putmarginbox}.
11778 %\changes{2.0}{2025-11-24}{renamed}
11779 % \begin{macrocode}
11780 \cs_new:Nn \__flowframe_put_margin_box:n
11781 {
11782 % \end{macrocode}
11783 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
11784 %\cs{@ff@pages@countreg}}
11785 % \begin{macrocode}
11786 \__flowfram_check_if_this_page:nn
11787 { \g__flowfram_pagecounter_tl } { #1 }
11788 \bool_if:NF \g__flowfram_not_this_frame_bool
11789 {
11790 \@killglue
11791 \legacy_if:nTF { @twoside }
11792 {
11793 \int_if_odd:nTF { \c@page }
11794 {
11795 \flowfram_set_dim_to_frame_dim:Nnnn
11796 \l__flowfram_x_dim
11797 { flow } { posx } { #1 }
11798 \flowfram_set_dim_to_frame_dim:Nnnn
11799 \l__flowfram_y_dim
11800 { flow } { posy } { #1 }
11801 }
11802 {
11803 \flowfram_set_dim_to_frame_dim:Nnnn
11804 \l__flowfram_x_dim
11805 { flow } { evenx } { #1 }
11806 \flowfram_set_dim_to_frame_dim:Nnnn
11807 \l__flowfram_y_dim
11808 { flow } { eveny } { #1 }
11809 }
11810 }
11811 {
11812 \flowfram_set_dim_to_frame_dim:Nnnn
11813 \l__flowfram_x_dim
11814 { flow } { posx } { #1 }
11815 \flowfram_set_dim_to_frame_dim:Nnnn
11816 \l__flowfram_y_dim
11817 { flow } { posy } { #1 }
11818 }
11819 \__flowfram_get_margin_pos:e
11820 {
11821 \flowfram_frame_use_tl:nnn { flow } { margin } { #1 }
11822 }
11823 \tl_if_eq:NNTF \l__flowfram_margin_tl \c_flowfram_left_tl
11824 {
11825 \dim_add:Nn \l__flowfram_x_dim
11826 {
11827 - \marginparwidth
11828 - \marginparsep
11829 }
11830 }
11831 {
11832 \dim_add:Nn \l__flowfram_x_dim
11833 {
11834 \flowfram_frame_use_dim:nnn { flow } { width } { #1 }
11835 + \marginparsep
11836 }
11837 }
11838 \box_move_up:nn { \l__flowfram_y_dim }
11839 {
11840 \hbox_to_zero:n
11841 {
11842 \kern \l__flowfram_x_dim
11843 \__flowfram_do_if_draft:nn
11844 {
11845 \__flowfram_noborder_box:nnn { \marginparwidth }
11846 {
11847 \flowfram_frame_use_dim:nnn { flow } { height } { #1 }
11848 }
11849 { }
11850 }
11851 {
11852 \flowfram_draft_annote:nn { M } { \int_eval:n { #1 } }
11853 }
11854 \hss
11855 }
11856 }
11857 }
11858 \ignorespaces
11859 }
11860 % \end{macrocode}
11861 %\end{macro}
11862 %\begin{macro}{\@ff@drawmargins}
11863 % Draw all the margins associated with the \glspl{flow} defined
11864 % on the current page.
11865 %Version 2.0 renamed \cs{@ff@drawmargins}.
11866 %\changes{2.0}{2025-11-24}{renamed}
11867 % \begin{macrocode}
11868 \cs_new:Nn \__flowfram_draw_margins:
11869 {
11870 \int_step_inline:nn { \c@maxflow }
11871 {
11872 \makebox [ \c_zero_dim ] [ l ]
11873 {
11874 \__flowframe_put_margin_box:n { ##1 }
11875 }
11876 }
11877 }
11878 % \end{macrocode}
11879 %\end{macro}
11880 %\begin{macro}{\@ff@getstaticpos}
11881 %Version 2.0 removed \cs{@ff@getstaticpos}.
11882 %\changes{2.0}{2025-11-24}{removed}
11883 %\end{macro}
11884 %\begin{macro}{\@dostaticbox}
11885 % Display the savebox associated with \gls{static} "#1"
11886 % \begin{macrocode}
11887 \cs_new:Nn \__flowfram_do_static_box:n
11888 {
11889 \int_set:Nn \l__flowfram_current_static_int { #1 }
11890 % \end{macrocode}
11891 %Get the frame border type.
11892 % \begin{macrocode}
11893 \flowfram_set_tl_to_frame_tl:Nnnn
11894 \l__flowfram_frametype_tl
11895 { static } { frametype } { #1 }
11896 % \end{macrocode}
11897 %Get the frame border colour.
11898 % \begin{macrocode}
11899 \flowfram_set_tl_to_frame_tl:Nnnn
11900 \l__flowfram_bordercolor_tl
11901 { static } { bordercolor } { #1 }
11902 % \end{macrocode}
11903 %Note that it's too late to apply the text colour as that's set when
11904 %the contents are set.
11905 %Get the background colour.
11906 % \begin{macrocode}
11907 \flowfram_set_tl_to_frame_tl:Nnnn
11908 \l__flowfram_backcolor_tl
11909 { static } { backcolor } { #1 }
11910 % \end{macrocode}
11911 %Calculate the offset to take into account the border.
11912 % \begin{macrocode}
11913 \__flowfram_static_calc_offset:n {#1}%
11914 % \end{macrocode}
11915 %Rotate the frame by the designated angle.
11916 % \begin{macrocode}
11917 \exp_args:Ne \rotateframe
11918 {
11919 \flowfram_frame_use_tl:nnn { static } { angle } { #1 }
11920 }
11921 {
11922 \flowfram_if_frame_bool:nnnTF
11923 { static } { hasframe } { #1 }
11924 {
11925 \__flowfram_bordered_box:nnnn
11926 {
11927 \flowfram_frame_use_dim:nnn { static } { width } { #1 }
11928 }
11929 {
11930 \flowfram_frame_use_dim:nnn { static } { height } { #1 }
11931 }
11932 {
11933 \flowfram_frame_use_box:nnn
11934 { static } { content } { #1 }
11935 }
11936 {
11937 \use:c { \l__flowfram_frametype_tl }
11938 }
11939 }
11940 {
11941 \__flowfram_noborder_box:nnn
11942 {
11943 \flowfram_frame_use_dim:nnn { static } { width } { #1 }
11944 }
11945 {
11946 \flowfram_frame_use_dim:nnn { static } { height } { #1 }
11947 }
11948 {
11949 \flowfram_frame_use_box:nnn
11950 { static } { content } { #1 }
11951 }
11952 }
11953 }
11954 }
11955 % \end{macrocode}
11956 %\end{macro}
11957 %\begin{macro}{\@dostaticbbox}
11958 % Now for the \gls{bbox}:
11959 % Version 2.0 renamed \cs{@dostaticbbox}
11960 %\changes{2.0}{2025-11-24}{renamed}
11961 % \begin{macrocode}
11962 \cs_new:Nn \__flowfram_do_static_bounding_box:n
11963 {
11964 \tl_clear:N \l__flowfram_bordercolor_tl
11965 \__flowfram_static_calc_offset:n { #1 }
11966 \__flowfram_do_if_draft:nn
11967 {
11968 \__flowfram_noborder_box:nnn
11969 {
11970 \flowfram_frame_use_dim:nnn { static } { width } { #1 }
11971 }
11972 {
11973 \flowfram_frame_use_dim:nnn { static } { height } { #1 }
11974 }
11975 {
11976 \flowfram_frame_use_box:nnn
11977 { static } { content } { #1 }
11978 }
11979 }
11980 {
11981 \flowfram_draft_annote:nnn
11982 { S } { \int_eval:n { #1 } }
11983 {
11984 \flowfram_frame_use_tl:nnn { static } { label } { #1 }
11985 }
11986 }
11987 }
11988 % \end{macrocode}
11989 %\end{macro}
11990 %\begin{macro}{\@putstaticbox}
11991 % Put the static box "#1" at its given position, with its
11992 % associated border.
11993 % Version 2.0 renamed \cs{@putstaticbox}
11994 %\changes{2.0}{2025-11-24}{renamed}
11995 % \begin{macrocode}
11996 \cs_new:Nn \__flowfram_put_static_box:n
11997 {
11998 % \end{macrocode}
11999 %\changes{2014-06-04}{1.16}{added check for `hide' and `hidethis'
12000 %attributes}
12001 % Check the `hide' and `hidethis' attributes
12002 % \begin{macrocode}
12003 \flowfram_if_frame_bool:nnnTF
12004 { static } { hidethis } { #1 }
12005 {
12006 \__flowfram_message:nen
12007 { info-static-frame-hidden } { \int_eval:n { #1 } } { hidethis }
12008 \bool_gset_true:N \g__flowfram_not_this_frame_bool
12009 \flowfram_frame_set_bool_false:nnn
12010 { static } { hidethis } { #1 }
12011 }
12012 {
12013 \flowfram_if_frame_bool:nnnTF
12014 { static } { hide } { #1 }
12015 {
12016 \__flowfram_message:nen
12017 { info-static-frame-hidden } { \int_eval:n { #1 } } { hide }
12018 \bool_gset_true:N \g__flowfram_not_this_frame_bool
12019 }
12020 {
12021 % \end{macrocode}
12022 % Neither `hide' nor `hidethis' have been set so check the page
12023 % list.
12024 % \begin{macrocode}
12025 \__flowfram_static_check_if_this_page:n { #1 }
12026 }
12027 }
12028 \bool_if:NF \g__flowfram_not_this_frame_bool
12029 {
12030 \@killglue
12031 \legacy_if:nTF { @twoside }
12032 {
12033 \int_if_odd:nTF { \c@page }
12034 {
12035 \box_move_up:nn
12036 {
12037 \flowfram_frame_use_dim:nnn { static } { posy } { #1 }
12038 }
12039 {
12040 \hbox_to_zero:n
12041 {
12042 \kern
12043 \flowfram_frame_use_dim:nnn { static } { posx } { #1 }
12044 \__flowfram_do_static_box:n { #1 }
12045 \hss
12046 }
12047 }
12048 }
12049 {
12050 \box_move_up:nn
12051 {
12052 \flowfram_frame_use_dim:nnn { static } { eveny } { #1 }
12053 }
12054 {
12055 \hbox_to_zero:n
12056 {
12057 \kern
12058 \flowfram_frame_use_dim:nnn { static } { evenx } { #1 }
12059 \__flowfram_do_static_box:n { #1 }
12060 \hss
12061 }
12062 }
12063 }
12064 }
12065 {
12066 \box_move_up:nn
12067 {
12068 \flowfram_frame_use_dim:nnn { static } { posy } { #1 }
12069 }
12070 {
12071 \hbox_to_zero:n
12072 {
12073 \kern
12074 \flowfram_frame_use_dim:nnn { static } { posx } { #1 }
12075 \__flowfram_do_static_box:n { #1 }
12076 \hss
12077 }
12078 }
12079 }
12080 }
12081 }
12082 % \end{macrocode}
12083 %\end{macro}
12084 %\begin{macro}{\@putstaticbbox}
12085 % Now for the \gls{bbox}:
12086 % Version 2.0 renamed \cs{@putstaticbbox}
12087 %\changes{2.0}{2025-11-24}{removed}
12088 % \begin{macrocode}
12089 \cs_new:Nn \__flowfram_put_static_bounding_box:n
12090 {
12091 \flowfram_if_frame_bool:nnnTF
12092 { static } { hidethis } { #1 }
12093 {
12094 \bool_gset_true:N \g__flowfram_not_this_frame_bool
12095 \flowfram_frame_set_bool_false:nnn
12096 { static } { hidethis } { #1 }
12097 }
12098 {
12099 \flowfram_if_frame_bool:nnnTF
12100 { static } { hide } { #1 }
12101 {
12102 \bool_gset_true:N \g__flowfram_not_this_frame_bool
12103 }
12104 {
12105 % \end{macrocode}
12106 % Neither `hide' nor `hidethis' have been set so check the page
12107 % list.
12108 % \begin{macrocode}
12109 \__flowfram_static_check_if_this_page:n { #1 }
12110 }
12111 }
12112 \bool_if:NF \g__flowfram_not_this_frame_bool
12113 {
12114 \@killglue
12115 \legacy_if:nTF { @twoside }
12116 {
12117 \int_if_odd:nTF { \c@page }
12118 {
12119 \box_move_up:nn
12120 {
12121 \flowfram_frame_use_dim:nnn { static } { posy } { #1 }
12122 }
12123 {
12124 \hbox_to_zero:n
12125 {
12126 \kern
12127 \flowfram_frame_use_dim:nnn { static } { posx } { #1 }
12128 \__flowfram_do_static_bounding_box:n { #1 }
12129 \hss
12130 }
12131 }
12132 }
12133 {
12134 \box_move_up:nn
12135 {
12136 \flowfram_frame_use_dim:nnn { static } { eveny } { #1 }
12137 }
12138 {
12139 \hbox_to_zero:n
12140 {
12141 \kern
12142 \flowfram_frame_use_dim:nnn { static } { evenx } { #1 }
12143 \__flowfram_do_static_bounding_box:n { #1 }
12144 \hss
12145 }
12146 }
12147 }
12148 }
12149 {
12150 \box_move_up:nn
12151 {
12152 \flowfram_frame_use_dim:nnn { static } { posy } { #1 }
12153 }
12154 {
12155 \hbox_to_zero:n
12156 {
12157 \kern
12158 \flowfram_frame_use_dim:nnn { static } { posx } { #1 }
12159 \__flowfram_do_static_bounding_box:n { #1 }
12160 \hss
12161 }
12162 }
12163 }
12164 \ignorespaces
12165 }
12166 }
12167 % \end{macrocode}
12168 %\end{macro}
12169 %\begin{macro}{\@resetst@tics}
12170 % Clear the contents of all the \glspl{static} that have
12171 % the "clear" option set.
12172 % Version 2.0 renamed \cs{@resetst@tics}
12173 %\changes{2.0}{2025-11-24}{renamed}
12174 % \begin{macrocode}
12175 \cs_new:Nn \__flowfram_reset_statics:
12176 {
12177 \int_step_inline:nn { \c@maxstatic }
12178 {
12179 % \end{macrocode}
12180 % Has the clear flag been set?
12181 % \begin{macrocode}
12182 \flowfram_if_frame_bool:nnnT
12183 { static } { clear } { ##1 }
12184 {
12185 % \end{macrocode}
12186 % Set the contents of the box to empty
12187 % \begin{macrocode}
12188 \flowfram_frame_clear_box:nnn
12189 { static } { content } { ##1 }
12190 }
12191 }
12192 }
12193 % \end{macrocode}
12194 %\end{macro}
12195 %\begin{macro}{\@resetdyn@mics}
12196 % Clear the contents of the \glspl{dynamic} that have the "clear" option
12197 % set.
12198 % Version 2.0 renamed \cs{@resetdyn@mics}
12199 %\changes{2.0}{2025-11-24}{renamed}
12200 % \begin{macrocode}
12201 \cs_new:Nn \__flowfram_reset_dynamics:
12202 {
12203 \int_step_inline:nn { \c@maxdynamic }
12204 {
12205 % \end{macrocode}
12206 % Has the clear flag been set?
12207 % \begin{macrocode}
12208 \flowfram_if_frame_bool:nnnT
12209 { dynamic } { clear } { ##1 }
12210 {
12211 % \end{macrocode}
12212 % Clear the contents.
12213 % \begin{macrocode}
12214 \flowfram_frame_clear_tl:nnn
12215 { dynamic } { content } { ##1 }
12216 }
12217 }
12218 }
12219 % \end{macrocode}
12220 %\end{macro}
12221 %Dynamic frame content is now put inside a \env{minipage} instead of
12222 %a \cs{parbox} (\cs{shapepar} has problems in a \cs{parbox}).
12223 % \begin{macrocode}
12224 \cs_new:Nn \__flowfram_parbox:nnnn
12225 {
12226 \begin { minipage } [ c ] [ #1 ] [ #2 ] { #3 }
12227 #4
12228 \end { minipage }
12229 }
12230 \cs_generate_variant:Nn \__flowfram_parbox:nnnn { eeen }
12231 % \end{macrocode}
12232 %\begin{macro}{\@dodfparbox}
12233 % Display contents of dynamic box (contents stored in
12234 % "\l__flowfram_contents_tl ", style given by "\l__flowfram_style_tl"):
12235 % Version 2.0 renamed \cs{@dodfparbox}.
12236 %\changes{2.0}{2025-11-24}{renamed}
12237 % \begin{macrocode}
12238 \cs_new:Nn \__flowfram_do_dynamic_content:n
12239 {
12240 \flowfram_set_tl_to_frame_tl:Nnnn
12241 \l__flowfram_parindent_tl
12242 { dynamic } { parindent } { #1 }
12243 \flowfram_set_tl_to_frame_tl:Nnnn
12244 \l__flowfram_parshape_tl
12245 { dynamic } { shape } { #1 }
12246 \__flowfram_get_shape:V \l__flowfram_parshape_tl
12247 \int_case:nnF { \l__flowfram_shape_int }
12248 {
12249 { \c_flowfram_shape_type_parshape_int }
12250 {
12251 % \end{macrocode}
12252 % \cs{parshape}
12253 % \begin{macrocode}
12254 \__flowfram_parbox:eeen
12255 {
12256 \dynamicframeheight { #1 }
12257 }
12258 {
12259 \flowfram_frame_use_tl:nnn
12260 { dynamic } { valign } { #1 }
12261 }
12262 {
12263 \dynamicframewidth { #1 }
12264 }
12265 {
12266 \dim_set:Nn \parindent { \l__flowfram_parindent_tl }
12267 \use:c { \l__flowfram_style_tl }
12268 {
12269 \__flowfram_set_shaped_section_headings:
12270 \let \par \FLFsimpar
12271 \l__flowfram_parshape_tl
12272 \l__flowfram_contents_tl
12273 \endgraf
12274 }
12275 }
12276 }
12277 { \c_flowfram_shape_type_shapepar_int }
12278 {
12279 % \end{macrocode}
12280 % \cs{shapepar} or \cs{Shapepar}
12281 % \begin{macrocode}
12282 \__flowfram_parbox:eeen
12283 {
12284 \dynamicframeheight { #1 }
12285 }
12286 {
12287 \flowfram_frame_use_tl:nnn
12288 { dynamic } { valign } { #1 }
12289 }
12290 {
12291 \dynamicframewidth { #1 }
12292 }
12293 {
12294 \dim_set:Nn \parindent { \l__flowfram_parindent_tl }
12295 \use:c { \l__flowfram_style_tl }
12296 {
12297 \@ff@disablesec
12298 \let \par \FLFsimpar
12299 \l__flowfram_parshape_tl
12300 \l__flowfram_contents_tl
12301 \endgraf
12302 }
12303 }
12304 }
12305 }
12306 {
12307 % \end{macrocode}
12308 % no shape
12309 % \begin{macrocode}
12310 \__flowfram_parbox:eeen
12311 {
12312 \dynamicframeheight { #1 }
12313 }
12314 {
12315 \flowfram_frame_use_tl:nnn
12316 { dynamic } { valign } { #1 }
12317 }
12318 {
12319 \dynamicframewidth { #1 }
12320 }
12321 {
12322 \dim_set:Nn \parindent { \l__flowfram_parindent_tl }
12323 \use:c { \l__flowfram_style_tl }
12324 % \end{macrocode}
12325 %This will be picked up as an argument if the style is a text-block
12326 %command but won't add extra grouping otherwise:
12327 % \begin{macrocode}
12328 \l__flowfram_contents_tl
12329 }
12330 }
12331 }
12332 % \end{macrocode}
12333 %\end{macro}
12334 %\begin{macro}{\@dodynamicbox}
12335 % Typeset the dynamic box with its associated border.
12336 % Version 2.0 renamed \cs{@dodynamicbox}
12337 %\changes{2.0}{2025-11-24}{renamed}
12338 % \begin{macrocode}
12339 \cs_new:Nn \__flowfram_do_dynamic_box:n
12340 {
12341 \int_set:Nn \l__flowfram_current_dynamic_int { #1 }
12342 % \end{macrocode}
12343 %Get the frame border type.
12344 % \begin{macrocode}
12345 \flowfram_set_tl_to_frame_tl:Nnnn
12346 \l__flowfram_frametype_tl
12347 { dynamic } { frametype } { #1 }
12348 % \end{macrocode}
12349 %Get the frame border colour.
12350 % \begin{macrocode}
12351 \flowfram_set_tl_to_frame_tl:Nnnn
12352 \l__flowfram_bordercolor_tl
12353 { dynamic } { bordercolor } { #1 }
12354 % \end{macrocode}
12355 %Get the text colour.
12356 % \begin{macrocode}
12357 \flowfram_set_tl_to_frame_tl:Nnnn
12358 \l__flowfram_textcolor_tl
12359 { dynamic } { textcolor } { #1 }
12360 % \end{macrocode}
12361 %Get the background colour.
12362 % \begin{macrocode}
12363 \flowfram_set_tl_to_frame_tl:Nnnn
12364 \l__flowfram_backcolor_tl
12365 { dynamic } { backcolor } { #1 }
12366 % \end{macrocode}
12367 %Get the style (csname to apply to the content).
12368 % \begin{macrocode}
12369 \flowfram_set_tl_to_frame_tl:Nnnn
12370 \l__flowfram_style_tl
12371 { dynamic } { style } { #1 }
12372 % \end{macrocode}
12373 %Get the content.
12374 % \begin{macrocode}
12375 \flowfram_set_tl_to_frame_tl:Nnnn
12376 \l__flowfram_contents_tl
12377 { dynamic } { content } { #1 }
12378 % \end{macrocode}
12379 %Calculate the offset to take into account the border.
12380 % \begin{macrocode}
12381 \__flowfram_dynamic_calc_offset:n {#1}%
12382 \exp_args:Ne \rotateframe
12383 {
12384 \flowfram_frame_use_tl:nnn { dynamic } { angle } { #1 }
12385 }
12386 {
12387 \flowfram_if_frame_bool:nnnTF
12388 { dynamic } { hasframe } { #1 }
12389 {
12390 \__flowfram_bordered_box:nnnn
12391 {
12392 \flowfram_frame_use_dim:nnn { dynamic } { width } { #1 }
12393 }
12394 {
12395 \flowfram_frame_use_dim:nnn { dynamic } { height } { #1 }
12396 }
12397 {
12398 \__flowfram_do_dynamic_content:n { #1 }
12399 }
12400 {
12401 \use:c { \l__flowfram_frametype_tl }
12402 }
12403 }
12404 {
12405 \__flowfram_noborder_box:nnn
12406 {
12407 \flowfram_frame_use_dim:nnn { dynamic } { width } { #1 }
12408 }
12409 {
12410 \flowfram_frame_use_dim:nnn { dynamic } { height } { #1 }
12411 }
12412 {
12413 \__flowfram_do_dynamic_content:n { #1 }
12414 }
12415 }
12416 }
12417 }
12418 % \end{macrocode}
12419 %\end{macro}
12420 %\begin{macro}{\@dodynamicbbox}
12421 % Now for the \gls{bbox}.
12422 % Version 2.0 renamed \cs{@dodynamicbbox}
12423 %\changes{2.0}{2025-11-24}{renamed}
12424 % \begin{macrocode}
12425 \cs_new:Nn \__flowfram_do_dynamic_bounding_box:n
12426 {
12427 \tl_clear:N \l__flowfram_bordercolor_tl
12428 % \end{macrocode}
12429 %Calculate the offset to take into account the border.
12430 % \begin{macrocode}
12431 \__flowfram_dynamic_calc_offset:n { #1 }
12432 \__flowfram_do_if_draft:nn
12433 {
12434 \__flowfram_noborder_box:nnn
12435 {
12436 \flowfram_frame_use_dim:nnn { dynamic } { width } { #1 }
12437 }
12438 {
12439 \flowfram_frame_use_dim:nnn { dynamic } { height } { #1 }
12440 }
12441 {
12442 \__flowfram_parbox:eeen
12443 {
12444 \dynamicframeheight { #1 }
12445 }
12446 {
12447 \flowfram_frame_use_tl:nnn
12448 { dynamic } { valign } { #1 }
12449 }
12450 {
12451 \dynamicframewidth { #1 }
12452 }
12453 { }
12454 }
12455 }
12456 {
12457 \flowfram_draft_annote:nnn
12458 { D } { \int_eval:n { #1 } }
12459 {
12460 \flowfram_frame_use_tl:nnn { dynamic } { label } { #1 }
12461 }
12462 }
12463 }
12464 % \end{macrocode}
12465 %\end{macro}
12466 %
12467 %\begin{macro}{\@putdynamicbox}
12468 % Put the \gls{dynamic} "#1" at its given position.
12469 % Version 2.0 renamed \cs{@putdynamicbox}
12470 %\changes{2.0}{2025-11-24}{renamed}
12471 % \begin{macrocode}
12472 \cs_new:Nn \__flowfram_put_dynamic_box:n
12473 {
12474 % \end{macrocode}
12475 %\changes{2014-06-04}{1.16}{added check for `hide' and `hidethis'
12476 %attributes}
12477 % Check the `hide' and `hidethis' attributes
12478 % \begin{macrocode}
12479 \flowfram_if_frame_bool:nnnTF
12480 { dynamic } { hidethis } { #1 }
12481 {
12482 \__flowfram_message:nen
12483 { info-dynamic-frame-hidden } { \int_eval:n { #1 } } { hidethis }
12484 \bool_gset_true:N \g__flowfram_not_this_frame_bool
12485 \flowfram_frame_set_bool_false:nnn
12486 { dynamic } { hidethis } { #1 }
12487 }
12488 {
12489 \flowfram_if_frame_bool:nnnTF
12490 { dynamic } { hide } { #1 }
12491 {
12492 \__flowfram_message:nen
12493 { info-dynamic-frame-hidden } { \int_eval:n { #1 } } { hide }
12494 \bool_gset_true:N \g__flowfram_not_this_frame_bool
12495 }
12496 {
12497 % \end{macrocode}
12498 % Neither `hide' nor `hidethis' have been set so check the page
12499 % list.
12500 % \begin{macrocode}
12501 \__flowfram_dynamic_check_if_this_page:n { #1 }
12502 }
12503 }
12504 \bool_if:NF \g__flowfram_not_this_frame_bool
12505 {
12506 \@killglue
12507 \legacy_if:nTF { @twoside }
12508 {
12509 \int_if_odd:nTF { \c@page }
12510 {
12511 \box_move_up:nn
12512 {
12513 \flowfram_frame_use_dim:nnn { dynamic } { posy } { #1 }
12514 }
12515 {
12516 \hbox_to_zero:n
12517 {
12518 \kern
12519 \flowfram_frame_use_dim:nnn { dynamic } { posx } { #1 }
12520 \__flowfram_do_dynamic_box:n { #1 }
12521 \hss
12522 }
12523 }
12524 }
12525 {
12526 \box_move_up:nn
12527 {
12528 \flowfram_frame_use_dim:nnn { dynamic } { eveny } { #1 }
12529 }
12530 {
12531 \hbox_to_zero:n
12532 {
12533 \kern
12534 \flowfram_frame_use_dim:nnn { dynamic } { evenx } { #1 }
12535 \__flowfram_do_dynamic_box:n { #1 }
12536 \hss
12537 }
12538 }
12539 }
12540 }
12541 {
12542 \box_move_up:nn
12543 {
12544 \flowfram_frame_use_dim:nnn { dynamic } { posy } { #1 }
12545 }
12546 {
12547 \hbox_to_zero:n
12548 {
12549 \kern
12550 \flowfram_frame_use_dim:nnn { dynamic } { posx } { #1 }
12551 \__flowfram_do_dynamic_box:n { #1 }
12552 \hss
12553 }
12554 }
12555 }
12556 \ignorespaces
12557 }
12558 }
12559 % \end{macrocode}
12560 %\end{macro}
12561 %\begin{macro}{\@putdynamicbbox}
12562 % Bounding box.
12563 % Version 2.0 renamed \cs{@putdynamicbbox}
12564 %\changes{2.0}{2025-11-24}{renamed}
12565 % \begin{macrocode}
12566 \cs_new:Nn \__flowfram_put_dynamic_bounding_box:n
12567 {
12568 \flowfram_if_frame_bool:nnnTF
12569 { dynamic } { hidethis } { #1 }
12570 {
12571 \bool_gset_true:N \g__flowfram_not_this_frame_bool
12572 \flowfram_frame_set_bool_false:nnn
12573 { dynamic } { hidethis } { #1 }
12574 }
12575 {
12576 \flowfram_if_frame_bool:nnnTF
12577 { dynamic } { hide } { #1 }
12578 {
12579 \bool_gset_true:N \g__flowfram_not_this_frame_bool
12580 }
12581 {
12582 % \end{macrocode}
12583 % Neither `hide' nor `hidethis' have been set so check the page
12584 % list.
12585 % \begin{macrocode}
12586 \__flowfram_dynamic_check_if_this_page:n { #1 }
12587 }
12588 }
12589 \bool_if:NF \g__flowfram_not_this_frame_bool
12590 {
12591 \@killglue
12592 \legacy_if:nTF { @twoside }
12593 {
12594 \int_if_odd:nTF { \c@page }
12595 {
12596 \box_move_up:nn
12597 {
12598 \flowfram_frame_use_dim:nnn { dynamic } { posy } { #1 }
12599 }
12600 {
12601 \hbox_to_zero:n
12602 {
12603 \kern
12604 \flowfram_frame_use_dim:nnn { dynamic } { posx } { #1 }
12605 \__flowfram_do_dynamic_bounding_box:n { #1 }
12606 \hss
12607 }
12608 }
12609 }
12610 {
12611 \box_move_up:nn
12612 {
12613 \flowfram_frame_use_dim:nnn { dynamic } { eveny } { #1 }
12614 }
12615 {
12616 \hbox_to_zero:n
12617 {
12618 \kern
12619 \flowfram_frame_use_dim:nnn { dynamic } { evenx } { #1 }
12620 \__flowfram_do_dynamic_bounding_box:n { #1 }
12621 \hss
12622 }
12623 }
12624 }
12625 }
12626 {
12627 \box_move_up:nn
12628 {
12629 \flowfram_frame_use_dim:nnn { dynamic } { posy } { #1 }
12630 }
12631 {
12632 \hbox_to_zero:n
12633 {
12634 \kern
12635 \flowfram_frame_use_dim:nnn { dynamic } { posx } { #1 }
12636 \__flowfram_do_dynamic_bounding_box:n { #1 }
12637 \hss
12638 }
12639 }
12640 }
12641 \ignorespaces
12642 }
12643 }
12644 % \end{macrocode}
12645 %\end{macro}
12646 %\begin{macro}{\@@doheader}
12647 % Do standard header in the standard place.
12648 % Version 2.0 renamed \cs{@@doheader}
12649 %\changes{2.0}{2025-11-24}{renamed}
12650 % \begin{macrocode}
12651 \cs_new:Nn \__flowfram_do_standard_header:
12652 {
12653 \box_move_up:nn
12654 {
12655 \typeblockheight + \headsep
12656 }
12657 {
12658 \vbox_to_ht:nn { \headheight }
12659 {
12660 \hbox_to_zero:n
12661 {
12662 \@dothehead \hss
12663 }
12664 \vss
12665 }
12666 }
12667 }
12668 % \end{macrocode}
12669 %\end{macro}
12670 %\begin{macro}{\@@dofooter}
12671 % Do standard footer in the standard place.
12672 % Version 2.0 renamed \cs{@@dofooter}
12673 %\changes{2.0}{2025-11-24}{renamed}
12674 % \begin{macrocode}
12675 \cs_new:Nn \__flowfram_do_standard_footer:
12676 {
12677 \box_move_down:nn
12678 { \footskip }
12679 {
12680 \hbox_to_zero:n
12681 {
12682 \@dothefoot \hss
12683 }
12684 }
12685 }
12686 % \end{macrocode}
12687 %\end{macro}
12688 %\begin{macro}{\@s@tfr@mes}
12689 % Version 2.0 renamed \cs{@s@tfr@mes}
12690 %\changes{2.0}{2025-11-24}{renamed}
12691 % \begin{macrocode}
12692 \box_new:N \l__all_content_box
12693 \dim_new:N \l__all_content_height_dim
12694 \cs_new:Nn \__flowfram_set_frames:n
12695 {
12696 \group_begin:
12697 \dim_set_eq:NN \l__all_content_height_dim \typeblockheight
12698 \setbox
12699 \l__all_content_box
12700 \hbox_to_wd:nn
12701 { \typeblockwidth }
12702 {
12703 \hbox:n { #1 }
12704 \hss
12705 }
12706 \ht \l__all_content_box
12707 \l__all_content_height_dim
12708 \dp \l__all_content_box \c_zero_dim
12709 \mbox
12710 {
12711 \box_use_drop:N \l__all_content_box
12712 }
12713 \group_end:
12714 }
12715 % \end{macrocode}
12716 %\end{macro}
12717 %\begin{macro}{\@ff@doallflowframes}
12718 % Puts all the \glspl{flow} defined on the current page.
12719 % Version 2.0 renamed \cs{@ff@doallflowframes}
12720 %\changes{2.0}{2025-11-24}{renamed}
12721 % \begin{macrocode}
12722 \cs_new:Nn \__flowfram_do_all_flow_frames:
12723 {
12724 \int_step_function:nN { \c@maxflow }
12725 \__flowfram_put_flow_box:n
12726 }
12727 % \end{macrocode}
12728 %\end{macro}
12729 %
12730 %\begin{macro}{\@ff@doallflowframesbbox}
12731 % Flow frame \glspl{bbox}.
12732 % Version 2.0 renamed \cs{@ff@doallflowframesbbox}
12733 %\changes{2.0}{2025-11-24}{renamed}
12734 % \begin{macrocode}
12735 \cs_new:Nn \__flowfram_do_all_flow_bounding_boxes:
12736 {
12737 \int_step_function:nN { \c@maxflow }
12738 \__flowfram_put_flow_bounding_box:n
12739 }
12740 % \end{macrocode}
12741 %\end{macro}
12742 %\begin{macro}{\@ff@doallstatics}
12743 % Puts all \glspl{static} defined on the current page.
12744 % Version 2.0 renamed \cs{@ff@doallstatics}
12745 %\changes{2.0}{2025-11-24}{renamed}
12746 % \begin{macrocode}
12747 \cs_new:Nn \__flowfram_do_all_static_frames:
12748 {
12749 \int_step_function:nN { \c@maxstatic }
12750 \__flowfram_put_static_box:n
12751 \int_zero:N \l__flowfram_current_static_int
12752 }
12753 % \end{macrocode}
12754 %\end{macro}
12755 %
12756 %\begin{macro}{\@ff@doallstaticsbbox}
12757 % Static frame \glspl{bbox}.
12758 % Version 2.0 renamed \cs{@ff@doallstaticsbbox}
12759 %\changes{2.0}{2025-11-24}{renamed}
12760 % \begin{macrocode}
12761 \cs_new:Nn \__flowfram_do_all_static_bounding_boxes:
12762 {
12763 \int_step_function:nN { \c@maxstatic }
12764 \__flowfram_put_static_bounding_box:n
12765 }
12766 % \end{macrocode}
12767 %\end{macro}
12768 %\begin{macro}{\@ff@doalldynamics}
12769 % Puts all the \glspl{dynamic} defined on the current page.
12770 % Version 2.0 renamed \cs{@ff@doalldynamics}
12771 %\changes{2.0}{2025-11-24}{renamed}
12772 % \begin{macrocode}
12773 \cs_new:Nn \__flowfram_do_all_dynamic_frames:
12774 {
12775 \int_step_function:nN { \c@maxdynamic }
12776 \__flowfram_put_dynamic_box:n
12777 \int_zero:N \l__flowfram_current_dynamic_int
12778 }
12779 % \end{macrocode}
12780 %\end{macro}
12781 %\begin{macro}{\@ff@doalldynamicsbbox}
12782 % Dynamic frame \glspl{bbox}.
12783 % Version 2.0 renamed \cs{@ff@doalldynamicsbbox}.
12784 %\changes{2.0}{2025-11-24}{renamed}
12785 % \begin{macrocode}
12786 \cs_new:Nn \__flowfram_do_all_dynamic_bounding_boxes:
12787 {
12788 \int_step_function:nN { \c@maxdynamic }
12789 \__flowfram_put_dynamic_bounding_box:n
12790 }
12791 % \end{macrocode}
12792 %\end{macro}
12793 %\begin{macro}{\@ff@dotypeblock}
12794 % Draw \gls{typeblock} frame if draft.
12795 % Version 2.0 renamed \cs{@ff@dotypeblock}.
12796 %\changes{2.0}{2025-11-24}{renamed}
12797 % \begin{macrocode}
12798 \cs_new:Nn \__flowfram_do_typeblock:
12799 {
12800 \makebox [ \c_zero_dim ] [ l ]
12801 {
12802 \__flowfram_do_if_draft:nnn
12803 { \setffdrafttypeblockcolor }
12804 {
12805 \vbox_to_ht:nn { \typeblockheight }
12806 {
12807 \hbox_to_wd:nn \typeblockwidth { }
12808 }
12809 }
12810 { }
12811 }
12812 }
12813 % \end{macrocode}
12814 %\end{macro}
12815 %\begin{macro}{\ffevenoffset}
12816 % Version 2.0 removed \cs{ffevenoffset}.
12817 %\changes{2.0}{2025-11-24}{removed}
12818 %\end{macro}
12819 %\begin{macro}{\@ff@do@allframes}
12820 % Put all frames defined on the current page.
12821 % Version 2.0 renamed \cs{@ff@do@allframes}.
12822 %\changes{2.0}{2025-11-24}{renamed}
12823 % \begin{macrocode}
12824 \cs_new:Nn \__flowfram_do_all_frames:
12825 {
12826 \hbox_to_wd:nn { \typeblockwidth }
12827 {
12828 \__flowfram_set_frames:n
12829 {
12830 \__flowfram_do_all_static_frames:
12831 \__flowfram_do_standard_header:
12832 \__flowfram_do_standard_footer:
12833 \__flowfram_do_all_flow_frames:
12834 \__flowfram_do_all_dynamic_frames:
12835 \ifshowtypeblock
12836 \__flowfram_do_typeblock:
12837 \fi
12838 \ifshowframebbox
12839 \__flowfram_do_all_static_bounding_boxes:
12840 \__flowfram_do_all_flow_bounding_boxes:
12841 \__flowfram_do_all_dynamic_bounding_boxes:
12842 \fi
12843 \ifshowmargins
12844 \__flowfram_draw_margins:
12845 \fi
12846 }
12847 \hss
12848 }
12849 }
12850 % \end{macrocode}
12851 %\end{macro}
12852 %\begin{macro}{\@outputdblcol}
12853 % This was modified from the output routine for standard
12854 % two column format. After "\__flowfram_get_next_column:N" has
12855 % finished, the register "\g__flowfram_current_page_int"
12856 % contains the page that the next \gls{flow}
12857 % is on. If "\g__flowfram_current_page_int" minus "\c@page" is greater
12858 % than 1, then there is at least one page without a \gls{flow}.
12859 % These pages will have to be shipped before \TeX\ can
12860 % continue with the rest of the document.
12861 % \begin{macrocode}
12862 \int_new:N \g__flowfram_next_frame_int
12863 \renewcommand*\@outputdblcol
12864 {
12865 \__flowfram_output_dbl_col:
12866 }
12867 % \end{macrocode}
12868 %\end{macro}
12869 %
12870 % \begin{macrocode}
12871 \cs_new:Nn \__flowfram_output_dbl_col:
12872 {
12873 \int_gset_eq:NN \g__flowfram_next_frame_int \c@thisframe
12874 % \end{macrocode}
12875 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
12876 %\cs{@ff@pages@countreg}}
12877 % \begin{macrocode}
12878 \int_gset:Nn \g__flowfram_current_page_int
12879 { \g__flowfram_pagecounter_tl }
12880 \__flowfram_get_next_column:N \g__flowfram_next_frame_int
12881 \bool_if:NTF \g__flowfram_new_page_bool
12882 {
12883 % \end{macrocode}
12884 % Next flow frame starts on new page.
12885 % \begin{macrocode}
12886 \global \@firstcolumntrue
12887 \__flowfram_set_column_box:n { \c@thisframe }
12888 \legacy_if:nT { @specialpage }
12889 {
12890 \global \@specialpagefalse
12891 \@nameuse { ps@ \@specialstyle }
12892 \relax
12893 }
12894 \@dodynamicthehead
12895 \@dodynamicthefoot
12896 \vbadness=\@M
12897 \setbox \@outputbox
12898 \vbox_to_ht:nn { \typeblockheight }
12899 {
12900 \__flowfram_do_all_frames:
12901 }
12902 \@combinedblfloats
12903 \@outputpage
12904 % \end{macrocode}
12905 % Shipout pages without flow frames. Any static or dynamic frames on
12906 % those pages should be included.
12907 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
12908 %\cs{@ff@pages@countreg}}
12909 % \begin{macrocode}
12910 \int_gadd:Nn \g__flowfram_current_page_int
12911 { - \g__flowfram_pagecounter_tl }
12912 \bool_while_do:nn
12913 {
12914 \int_compare_p:nNn
12915 { \g__flowfram_current_page_int } > { \c_zero_int }
12916 }
12917 {
12918 \int_gdecr:N \g__flowfram_current_page_int
12919 \setbox \@outputbox
12920 \vbox_to_ht:nn { \typeblockheight }
12921 {
12922 \__flowfram_do_all_frames:
12923 }
12924 \@outputpage
12925 }
12926 \begingroup
12927 \@dblfloatplacement
12928 \@startdblcolumn
12929 \@whilesw \if@fcolmade \fi
12930 {\@outputpage \@startdblcolumn }%
12931 \endgroup
12932 \__flowfram_reset_statics:
12933 \__flowfram_reset_dynamics:
12934 }
12935 {
12936 % \end{macrocode}
12937 % Still on same page, save contents of box255
12938 % \begin{macrocode}
12939 \global \@firstcolumnfalse
12940 % \end{macrocode}
12941 %Set this frame's column box to the output box.
12942 % \begin{macrocode}
12943 \__flowfram_set_column_box:n { \c@thisframe }
12944 }
12945 \int_gset_eq:NN \c@thisframe \g__flowfram_next_frame_int
12946 \__flowfram_set_column:n { \c@thisframe }
12947 }
12948 % \end{macrocode}
12949 %
12950 % \begin{macrocode}
12951 \newcommand \@flowfram@update@col@count [ 1 ]
12952 {
12953 \int_gset_eq:NN \col@number \c_one_int
12954 \int_step_inline:nnn
12955 { #1 + \c_one_int } { \c@maxflow }
12956 {
12957 \exp_args:Ne
12958 \flowfram_if_in_frame_clist:nnnnF
12959 { \int_eval:n { \g__flowfram_pagecounter_tl } }
12960 { flow } { excludelist } { ##1 }
12961 {
12962 % \end{macrocode}
12963 % This page is in this not in frame's exclusion list so now check if
12964 % in frame's page list.
12965 % \begin{macrocode}
12966 \exp_args:Ne
12967 \flowfram_if_frame_has_morepages:nnnT
12968 { \int_eval:n { \g__flowfram_pagecounter_tl } }
12969 { flow } { ##1 }
12970 {
12971 \int_gincr:N \col@number
12972 }
12973 }
12974 }
12975 \int_compare:nNnT
12976 { \col@number } > { \c_one_int }
12977 {
12978 \global\@twocolumntrue
12979 }
12980 }
12981 % \end{macrocode}
12982 %\begin{macro}{\@dblfloatplacement}
12983 % Version 2.0 no longer redefining \cs{@dblfloatplacement}
12984 %(no support for column spanning floats).
12985 %\changes{2.0}{2025-11-24}{removed redefinition}
12986 %\end{macro}
12987 %
12988 %\subsection{Switching Frames On and Off For Subsequent Pages}
12989 %
12990 %\begin{macro}{\flowswitchonnext}
12991 %\changes{1.14}{2012-11-10}{new}
12992 %\changes{2.0}{2025-11-24}{changed to document command}
12993 % Switch on the listed flow frames from the next page onwards
12994 % \begin{macrocode}
12995 \NewDocumentCommand \flowswitchonnext { s m }
12996 {
12997 \IfBooleanTF { #1 }
12998 {
12999 \clist_map_inline:nn { #2 }
13000 {
13001 \__flowfram_get_flow_id:n { ##1 }
13002 \__flowfram_flow_switch_on_next:n { \l__flowfram_id_int }
13003 }
13004 }
13005 {
13006 \clist_map_inline:nn { #2 }
13007 {
13008 \__flowfram_flow_switch_on_next:n { ##1 }
13009 }
13010 }
13011 }
13012 % \end{macrocode}
13013 %\end{macro}
13014 %
13015 %\begin{macro}{\@sflowswitchonnext}
13016 % Version 2.0 removed \cs{@sflowswitchonnext}
13017 %\changes{2.0}{2025-11-24}{removed}
13018 %\end{macro}
13019 %
13020 %\begin{macro}{\@flowswitchonnext}
13021 % The unstarred version uses \glspl{idn}.
13022 % Version 2.0 removed \cs{@flowswitchonnext}
13023 %\changes{2.0}{2025-11-24}{removed}
13024 %\end{macro}
13025 %Switch on a given frame by its \gls{idn}.
13026 % \begin{macrocode}
13027 \cs_new:Nn \__flowfram_flow_switch_on_next:n
13028 {
13029 % \end{macrocode}
13030 % Is this frame already on?
13031 % \begin{macrocode}
13032 \__flowfram_check_if_this_page:nn
13033 { \g__flowfram_pagecounter_tl } { #1 }
13034 \bool_if:NTF \g__flowfram_not_this_frame_bool
13035 {
13036 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
13037 {
13038 \exp_not:N \flowsetpagelist
13039 { \int_eval:n { #1 } }
13040 { > \int_eval:n { \g__flowfram_pagecounter_tl } }
13041 }
13042 }
13043 {
13044 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
13045 {
13046 \exp_not:N \flowsetpagelist
13047 { \int_eval:n { #1 } }
13048 { \int_eval:n { \g__flowfram_pagecounter_tl } ,
13049 > \int_eval:n { \g__flowfram_pagecounter_tl }
13050 }
13051 }
13052 }
13053 }
13054 % \end{macrocode}
13055 %
13056 %\begin{macro}{\flowswitchonnextodd}
13057 %\changes{1.14}{2012-11-10}{new}
13058 % Switch on the listed flow frames from the next odd page onwards
13059 %\changes{2.0}{2025-11-24}{changed to document command}
13060 % \begin{macrocode}
13061 \NewDocumentCommand \flowswitchonnextodd { s m }
13062 {
13063 \int_set:Nn \l__flowfram_tmpb_int
13064 { \g__flowfram_pagecounter_tl }
13065 \int_if_odd:nT { \l__flowfram_tmpb_int }
13066 {
13067 \int_incr:N \l__flowfram_tmpb_int
13068 }
13069 \IfBooleanTF { #1 }
13070 {
13071 \clist_map_inline:nn { #2 }
13072 {
13073 \__flowfram_get_flow_id:n { ##1 }
13074 \__flowfram_flow_switch_on_next_odd:n { \l__flowfram_id_int }
13075 }
13076 }
13077 {
13078 \clist_map_inline:nn { #2 }
13079 {
13080 \__flowfram_flow_switch_on_next_odd:n { ##1 }
13081 }
13082 }
13083 }
13084 % \end{macrocode}
13085 %\end{macro}
13086 %
13087 % \begin{macrocode}
13088 \cs_new:Nn \__flowfram_flow_switch_on_next_odd:n
13089 {
13090 % \end{macrocode}
13091 % Is this frame already on?
13092 % \begin{macrocode}
13093 \__flowfram_check_if_this_page:nn
13094 { \g__flowfram_pagecounter_tl } { #1 }
13095 \clist_clear:N \l__flowfram_pages_clist
13096 \bool_if:NF \g__flowfram_not_this_frame_bool
13097 {
13098 \clist_put_right:Ne \l__flowfram_pages_clist
13099 { \int_eval:n { \g__flowfram_pagecounter_tl } }
13100 }
13101 % \end{macrocode}
13102 % Is this frame already switched on for the next page?
13103 % \begin{macrocode}
13104 \__flowfram_check_if_this_page:nn { \l__flowfram_tmpb_int } { #1 }
13105 \int_compare:nNnF
13106 { \l__flowfram_tmpb_int } { \g__flowfram_pagecounter_tl }
13107 {
13108 \bool_if:NF \g__flowfram_not_this_frame_bool
13109 {
13110 \clist_put_right:Ne \l__flowfram_pages_clist
13111 { \int_eval:n { \l__flowfram_tmpb_int } }
13112 }
13113 }
13114 \clist_put_right:Ne \l__flowfram_pages_clist
13115 { > \int_eval:n { \l__flowfram_tmpb_int } }
13116 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
13117 {
13118 \exp_not:N \flowsetpagelist
13119 { \int_eval:n { #1 } }
13120 { \clist_use:Nn \l__flowfram_pages_clist { , } }
13121 }
13122 }
13123 % \end{macrocode}
13124 %
13125 %\begin{macro}{\@sflowswitchonnextodd}
13126 %Version 2.0 removed \cs{@sflowswitchonnextodd}.
13127 %\changes{2.0}{2025-11-24}{removed}
13128 %\end{macro}
13129 %
13130 %\begin{macro}{\@flowswitchonnextodd}
13131 %Version 2.0 removed \cs{@flowswitchonnextodd}.
13132 %\changes{2.0}{2025-11-24}{removed}
13133 %\end{macro}
13134 %
13135 %\begin{macro}{\flowswitchoffnext}
13136 %\changes{1.14}{2012-11-10}{new}
13137 %\changes{2.0}{2025-11-24}{changed to document command}
13138 % Switch off the listed flow frames from the next page onwards
13139 % \begin{macrocode}
13140 \NewDocumentCommand \flowswitchoffnext { s m }
13141 {
13142 \IfBooleanTF { #1 }
13143 {
13144 \clist_map_inline:nn { #2 }
13145 {
13146 \__flowfram_get_flow_id:n { ##1 }
13147 \__flowfram_flow_switch_off_next:n { \l__flowfram_id_int }
13148 }
13149 }
13150 {
13151 \clist_map_inline:nn { #2 }
13152 {
13153 \__flowfram_flow_switch_off_next:n { ##1 }
13154 }
13155 }
13156 }
13157 % \end{macrocode}
13158 %\end{macro}
13159 %
13160 % \begin{macrocode}
13161 \cs_new:Nn \__flowfram_flow_switch_off_next:n
13162 {
13163 % \end{macrocode}
13164 % Is this frame already off on this page?
13165 % \begin{macrocode}
13166 \__flowfram_check_if_this_page:nn
13167 { \g__flowfram_pagecounter_tl } { #1 }
13168 \bool_if:NTF \g__flowfram_not_this_frame_bool
13169 {
13170 \clist_set:Nn \l__flowfram_pages_clist { none }
13171 }
13172 {
13173 \tl_set:Ne \l__flowfram_pages_clist
13174 {
13175 \int_eval:n { \g__flowfram_pagecounter_tl }
13176 }
13177 }
13178 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
13179 {
13180 \exp_not:N \flowsetpagelist
13181 { \int_eval:n { #1 } }
13182 { \l__flowfram_pages_clist }
13183 }
13184 }
13185 % \end{macrocode}
13186 %
13187 %\begin{macro}{\@sflowswitchoffnext}
13188 %Version 2.0 removed \cs{@sflowswitchoffnext}.
13189 %\changes{2.0}{2025-11-24}{removed}
13190 %\end{macro}
13191 %
13192 %\begin{macro}{\@flowswitchoffnext}
13193 %Version 2.0 removed \cs{@flowswitchoffnext}.
13194 %\changes{2.0}{2025-11-24}{removed}
13195 %\end{macro}
13196 %
13197 %\begin{macro}{\flowswitchoffnextodd}
13198 %\changes{1.14}{2012-11-10}{new}
13199 %\changes{2.0}{2025-11-24}{changed to document command}
13200 % Switch off the listed flow frames from the next odd page onwards
13201 % \begin{macrocode}
13202 \NewDocumentCommand \flowswitchoffnextodd { s m }
13203 {
13204 \int_set:Nn \l__flowfram_tmpb_int
13205 { \g__flowfram_pagecounter_tl }
13206 \int_if_odd:nT { \g__flowfram_pagecounter_tl }
13207 {
13208 \int_incr:N \l__flowfram_tmpb_int
13209 }
13210 \IfBooleanTF { #1 }
13211 {
13212 \clist_map_inline:nn { #2 }
13213 {
13214 \__flowfram_get_flow_id:n { ##1 }
13215 \__flowfram_flow_switch_off_next_odd:n { \l__flowfram_id_int }
13216 }
13217 }
13218 {
13219 \clist_map_inline:nn { #2 }
13220 {
13221 \__flowfram_flow_switch_off_next_odd:n { ##1 }
13222 }
13223 }
13224 }
13225 % \end{macrocode}
13226 %\end{macro}
13227 %
13228 % \begin{macrocode}
13229 \cs_new:Nn \__flowfram_flow_switch_off_next_odd:n
13230 {
13231 % \end{macrocode}
13232 % Is this frame already off on this page?
13233 % \begin{macrocode}
13234 \__flowfram_check_if_this_page:nn
13235 { \g__flowfram_pagecounter_tl } { #1 }
13236 \bool_if:NTF \g__flowfram_not_this_frame_bool
13237 {
13238 % \end{macrocode}
13239 % It's off on this page. Is it on or off on the next page, if this
13240 % page is odd? First, is this page odd?
13241 % \begin{macrocode}
13242 \int_compare:nNnTF
13243 { \g__flowfram_pagecounter_tl } = { \l__flowfram_tmpb_int }
13244 {
13245 % \end{macrocode}
13246 % This page is even and the frame is off on this page, so set to
13247 % none.
13248 % \begin{macrocode}
13249 \tl_set:Nn \l__flowfram_next_pages_tl { none }
13250 }
13251 {
13252 % \end{macrocode}
13253 % This page is odd. Is the frame on or off on the next page?
13254 % \begin{macrocode}
13255 \__flowfram_check_if_this_page:nn
13256 { \l__flowfram_tmpb_int } { #1 }
13257 \bool_if:NTF \g__flowfram_not_this_frame_bool
13258 {
13259 % \end{macrocode}
13260 % Off on the next page as well, so set to none.
13261 % \begin{macrocode}
13262 \tl_set:Nn \l__flowfram_next_pages_tl { none }
13263 }
13264 {
13265 % \end{macrocode}
13266 % Not off on the next page, so set to next page only.
13267 % \begin{macrocode}
13268 \tl_set:Ne \l__flowfram_next_pages_tl
13269 { \int_use:N \l__flowfram_tmpb_int }
13270 }
13271 }
13272 }
13273 {
13274 % \end{macrocode}
13275 % It's not off on this page. Is it on or off on the next page, if this
13276 % page is odd? First, is this page odd?
13277 % \begin{macrocode}
13278 \int_compare:nNnTF
13279 { \g__flowfram_pagecounter_tl } = { \l__flowfram_tmpb_int }
13280 {
13281 % \end{macrocode}
13282 % This page is even and the frame is not off on this page, so set to
13283 % this page.
13284 % \begin{macrocode}
13285 \tl_set:Ne \l__flowfram_next_pages_tl
13286 { \int_eval:n { \g__flowfram_pagecounter_tl } }
13287 }
13288 {
13289 % \end{macrocode}
13290 % This page is odd. Is the frame on or off on the next page?
13291 % \begin{macrocode}
13292 \__flowfram_check_if_this_page:nn
13293 { \l__flowfram_tmpb_int } { #1 }
13294 \bool_if:NTF \g__flowfram_not_this_frame_bool
13295 {
13296 % \end{macrocode}
13297 % Off on the next page but not off on this page. So set to just this
13298 % page.
13299 % \begin{macrocode}
13300 \tl_set:Ne \l__flowfram_next_pages_tl
13301 { \int_eval:n { \g__flowfram_pagecounter_tl } }
13302 }
13303 {
13304 % \end{macrocode}
13305 % Not off on the next page as well, so set to this page and next page.
13306 % \begin{macrocode}
13307 \tl_set:Ne \l__flowfram_next_pages_tl
13308 {
13309 \int_eval:n { \g__flowfram_pagecounter_tl } ,
13310 \int_use:N \l__flowfram_tmpb_int
13311 }
13312 }
13313 }
13314 }
13315 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
13316 {
13317 \exp_not:N \flowsetpagelist
13318 { \int_eval:n { #1 } }
13319 { \l__flowfram_next_pages_tl }
13320 }
13321 }
13322 % \end{macrocode}
13323 %
13324 %\begin{macro}{\@sflowswitchoffnextodd}
13325 % Version 2.0 removed \cs{@sflowswitchoffnextodd}.
13326 %\changes{2.0}{2025-11-24}{removed}
13327 %\end{macro}
13328 %
13329 %\begin{macro}{\@flowswitchoffnextodd}
13330 % Version 2.0 removed \cs{sflowswitchoffnextodd}.
13331 %\changes{2.0}{2025-11-24}{removed}
13332 %\end{macro}
13333 %
13334 %\begin{macro}{\flowswitchonnextonly}
13335 %\changes{1.14}{2012-11-10}{new}
13336 %\changes{2.0}{2025-11-24}{changed to document command}
13337 % Switch on the listed flow frames for just the next page
13338 % \begin{macrocode}
13339 \NewDocumentCommand \flowswitchonnextonly { s m }
13340 {
13341 \int_set:Nn \l__flowfram_tmpb_int
13342 { \g__flowfram_pagecounter_tl + \c_one_int }
13343 \IfBooleanTF { #1 }
13344 {
13345 \clist_map_inline:nn { #2 }
13346 {
13347 \__flowfram_get_flow_id:n { ##1 }
13348 \__flowfram_flow_switch_on_next_only:n { \l__flowfram_id_int }
13349 }
13350 }
13351 {
13352 \clist_map_inline:nn { #2 }
13353 {
13354 \__flowfram_flow_switch_on_next_only:n { ##1 }
13355 }
13356 }
13357 }
13358 % \end{macrocode}
13359 %\end{macro}
13360 %
13361 % \begin{macrocode}
13362 \cs_new:Nn \__flowfram_flow_switch_on_next_only:n
13363 {
13364 % \end{macrocode}
13365 % Is this frame already on?
13366 % \begin{macrocode}
13367 \__flowfram_check_if_this_page:nn
13368 { \g__flowfram_pagecounter_tl } { #1 }
13369 \bool_if:NTF \g__flowfram_not_this_frame_bool
13370 {
13371 % \end{macrocode}
13372 % Not, it isn't, so just set to the next page:
13373 % \begin{macrocode}
13374 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
13375 {
13376 \exp_not:N \flowsetpagelist
13377 { \int_eval:n { #1 } }
13378 { \int_use:N \l__flowfram_tmpb_int }
13379 }
13380 }
13381 {
13382 % \end{macrocode}
13383 % Yes, it is, so set to this page and the next page:
13384 % \begin{macrocode}
13385 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
13386 {
13387 \exp_not:N \flowsetpagelist
13388 { \int_eval:n { #1 } }
13389 {
13390 \int_eval:n { \g__flowfram_pagecounter_tl } ,
13391 \int_use:N \l__flowfram_tmpb_int
13392 }
13393 }
13394 }
13395 }
13396 % \end{macrocode}
13397 %
13398 %\begin{macro}{\@sflowswitchonnextonly}
13399 %Version 2.0 removed \cs{@sflowswitchonnextonly}.
13400 %\changes{2.0}{2025-11-24}{removed}
13401 %\end{macro}
13402 %
13403 %\begin{macro}{\@flowswitchonnextonly}
13404 %Version 2.0 removed \cs{@flowswitchonnextonly}.
13405 %\changes{2.0}{2025-11-24}{removed}
13406 % The unstarred version uses \glspl{idn}.
13407 %\end{macro}
13408 %
13409 %\begin{macro}{\flowswitchonnextoddonly}
13410 %\changes{1.14}{2012-11-10}{new}
13411 %\changes{2.0}{2025-11-24}{changed to document command}
13412 % Switch on the listed flow frames for just the next odd page
13413 % \begin{macrocode}
13414 \NewDocumentCommand \flowswitchonnextoddonly { s m }
13415 {
13416 \IfBooleanTF { #1 }
13417 {
13418 \clist_map_inline:nn { #2 }
13419 {
13420 \__flowfram_get_flow_id:n { ##1 }
13421 \__flowfram_flow_switch_on_next_odd_only:n { \l__flowfram_id_int }
13422 }
13423 }
13424 {
13425 \clist_map_inline:nn { #2 }
13426 {
13427 \__flowfram_flow_switch_on_next_odd_only:n { ##1 }
13428 }
13429 }
13430 }
13431 % \end{macrocode}
13432 %\end{macro}
13433 %
13434 % \begin{macrocode}
13435 \cs_new:Nn \__flowfram_flow_switch_on_next_odd_only:n
13436 {
13437 % \end{macrocode}
13438 % Is this frame already on?
13439 % \begin{macrocode}
13440 \__flowfram_check_if_this_page:nn
13441 { \g__flowfram_pagecounter_tl } { #1 }
13442 \bool_if:NTF \g__flowfram_not_this_frame_bool
13443 {
13444 % \end{macrocode}
13445 % No, it isn't. If this is an odd page, is it on or off on the next
13446 % page? First, is this an odd page?
13447 % \begin{macrocode}
13448 \int_if_odd:nTF { \g__flowfram_pagecounter_tl }
13449 {
13450 % \end{macrocode}
13451 % Yes, it's odd. So this frame isn't on this page, but is it on or
13452 % off on the next page?
13453 % \begin{macrocode}
13454 \int_set:Nn \l__flowfram_tmpb_int
13455 { \g__flowfram_pagecounter_tl + \c_one_int }
13456 \__flowfram_check_if_this_page:nn
13457 { \l__flowfram_tmpb_int } { #1 }
13458 \bool_if:NTF \g__flowfram_not_this_frame_bool
13459 {
13460 % \end{macrocode}
13461 % It's not switched on either on this (odd) page or the next (even) page. So
13462 % the page list should be just the next odd page after this one.
13463 % \begin{macrocode}
13464 \int_incr:N \l__flowfram_tmpb_int
13465 \clist_set:Ne \l__flowfram_pages_clist
13466 { \int_use:N \l__flowfram_tmpb_int }
13467 }
13468 {
13469 % \end{macrocode}
13470 % It's not switched on for this (odd) page but it is for the next (even) page. So
13471 % the page list should be the next even and odd pages after this
13472 % page.
13473 % \begin{macrocode}
13474 \clist_set:Ne \l__flowfram_pages_clist
13475 { \int_use:N \l__flowfram_tmpb_int }
13476 \int_incr:N \l__flowfram_tmpb_int
13477 \clist_put_right:Ne \l__flowfram_pages_clist
13478 { \int_use:N \l__flowfram_tmpb_int }
13479 }
13480 }
13481 {
13482 % \end{macrocode}
13483 % No, it's even. So it's not on this (even) page, but needs to be on
13484 % for the following (odd) page.
13485 % \begin{macrocode}
13486 \int_set:Nn \l__flowfram_tmpb_int
13487 { \g__flowfram_pagecounter_tl }
13488 \int_incr:N \l__flowfram_tmpb_int
13489 \clist_set:Ne \l__flowfram_pages_clist
13490 { \int_use:N \l__flowfram_tmpb_int }
13491 }
13492 }
13493 {
13494 % \end{macrocode}
13495 % Frame is on this page. If this is an odd page, is it on or off on
13496 % the next page? First, is this an odd page?
13497 % \begin{macrocode}
13498 \int_if_odd:nTF { \g__flowfram_pagecounter_tl }
13499 {
13500 % \end{macrocode}
13501 % Yes, it's odd. Is the frame on or off for the next (even) page?
13502 % \begin{macrocode}
13503 \int_set:Nn \l__flowfram_tmpb_int
13504 {
13505 \g__flowfram_pagecounter_tl + \c_one_int
13506 }
13507 \__flowfram_check_if_this_page:nn
13508 { \l__flowfram_tmpb_int } { #1 }
13509 \bool_if:NTF \g__flowfram_not_this_frame_bool
13510 {
13511 % \end{macrocode}
13512 % Frame is off. So the frame is switched on for this (odd) page but
13513 % is off for the next (even) page. So the page list needs to be this
13514 % (odd) page and the following odd page, skipping the even page in
13515 % between.
13516 % \begin{macrocode}
13517 \int_incr:N \l__flowfram_tmpb_int
13518 \clist_set:Ne \l__flowfram_pages_clist
13519 {
13520 \int_eval:n { \g__flowfram_pagecounter_tl } ,
13521 \int_use:N \l__flowfram_tmpb_int
13522 }
13523 }
13524 {
13525 % \end{macrocode}
13526 % Frame is on. So the frame is switched on for this (odd) page and
13527 % the next (even) page. So the page list needs to be this
13528 % (odd) page, the next even page and the following odd page.
13529 % \begin{macrocode}
13530 \int_incr:N \l__flowfram_tmpb_int
13531 \clist_set:Ne \l__flowfram_pages_clist
13532 {
13533 \int_eval:n { \g__flowfram_pagecounter_tl } -
13534 \int_use:N \l__flowfram_tmpb_int
13535 }
13536 }
13537 }
13538 {
13539 % \end{macrocode}
13540 % Frame is switched on for this page and this page is even. So the
13541 % page list needs to be this (even) page and the next (odd) page.
13542 % \begin{macrocode}
13543 \int_set:Nn \l__flowfram_tmpb_int
13544 {
13545 \g__flowfram_pagecounter_tl + \c_one_int
13546 }
13547 \clist_set:Ne \l__flowfram_pages_clist
13548 {
13549 \int_eval:n { \g__flowfram_pagecounter_tl } ,
13550 \int_use:N \l__flowfram_tmpb_int
13551 }
13552 }
13553 % \end{macrocode}
13554 % \begin{macrocode}
13555 }
13556 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
13557 {
13558 \exp_not:N \flowsetpagelist
13559 { \int_eval:n { #1 } }
13560 { \l__flowfram_pages_clist }
13561 }
13562 }
13563 % \end{macrocode}
13564 %
13565 %\begin{macro}{\@sflowswitchonnextoddonly}
13566 % Version 2.0 removed \cs{@sflowswitchonnextoddonly}.
13567 %\changes{2.0}{2025-11-24}{removed}
13568 %\end{macro}
13569 %
13570 %\begin{macro}{\@flowswitchonnextoddonly}
13571 % Version 2.0 removed \cs{@flowswitchonnextoddonly}.
13572 %\changes{2.0}{2025-11-24}{removed}
13573 %\end{macro}
13574 %
13575 %
13576 %\begin{macro}{\flowswitchoffnextonly}
13577 %\changes{1.14}{2012-11-10}{new}
13578 %\changes{2.0}{2025-11-24}{changed to document command}
13579 % Switch off the listed flow frames for just the next page
13580 % \begin{macrocode}
13581 \NewDocumentCommand \flowswitchoffnextonly { s m }
13582 {
13583 \int_set:Nn \l__flowfram_tmpb_int
13584 {
13585 \g__flowfram_pagecounter_tl + \c_one_int
13586 }
13587 \IfBooleanTF { #1 }
13588 {
13589 \clist_map_inline:nn { #2 }
13590 {
13591 \__flowfram_get_flow_id:n { ##1 }
13592 \__flowfram_flow_switch_off_next_only:n { \l__flowfram_id_int }
13593 }
13594 }
13595 {
13596 \clist_map_inline:nn { #2 }
13597 {
13598 \__flowfram_flow_switch_off_next_only:n { ##1 }
13599 }
13600 }
13601 }
13602 % \end{macrocode}
13603 %\end{macro}
13604 %
13605 % \begin{macrocode}
13606 \cs_new:Nn \__flowfram_flow_switch_off_next_only:n
13607 {
13608 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
13609 {
13610 \exp_not:N \flowaddexclusion
13611 { \int_eval:n { #1 } }
13612 { \int_use:N \l__flowfram_tmpb_int }
13613 }
13614 }
13615 % \end{macrocode}
13616 %
13617 %\begin{macro}{\@sflowswitchoffnextonly}
13618 %Version 2.0 removed \cs{@sflowswitchoffnextonly}.
13619 %\changes{2.0}{2025-11-24}{removed}
13620 %\end{macro}
13621 %
13622 %\begin{macro}{\@flowswitchoffnextonly}
13623 %Version 2.0 removed \cs{@flowswitchoffnextonly}.
13624 %\changes{2.0}{2025-11-24}{removed}
13625 %\end{macro}
13626 %
13627 %\begin{macro}{\flowswitchoffnextoddonly}
13628 %\changes{1.14}{2012-11-10}{new}
13629 %\changes{2.0}{2025-11-24}{changed to document command}
13630 % Switch off the listed flow frames for just the next odd page
13631 % \begin{macrocode}
13632 \NewDocumentCommand \flowswitchoffnextoddonly { s m }
13633 {
13634 \int_set:Nn \l__flowfram_tmpb_int
13635 {
13636 \g__flowfram_pagecounter_tl + \c_one_int
13637 }
13638 \int_if_odd:nF { \l__flowfram_tmpb_int }
13639 {
13640 \int_incr:N \l__flowfram_tmpb_int
13641 }
13642 \IfBooleanTF { #1 }
13643 {
13644 \clist_map_inline:nn { #2 }
13645 {
13646 \__flowfram_get_flow_id:n { ##1 }
13647 \__flowfram_flow_switch_off_next_odd_only:n { \l__flowfram_id_int }
13648 }
13649 }
13650 {
13651 \clist_map_inline:nn { #2 }
13652 {
13653 \__flowfram_flow_switch_off_next_odd_only:n { ##1 }
13654 }
13655 }
13656 }
13657 % \end{macrocode}
13658 %\end{macro}
13659 %
13660 % \begin{macrocode}
13661 \cs_new:Nn \__flowfram_flow_switch_off_next_odd_only:n
13662 {
13663 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
13664 {
13665 \exp_not:N \flowaddexclusion
13666 { \int_eval:n { #1 } }
13667 { \int_use:N \l__flowfram_tmpb_int }
13668 }
13669 }
13670 % \end{macrocode}
13671 %
13672 %\begin{macro}{\@sflowswitchoffnextoddonly}
13673 %Version 2.0 removed \cs{@sflowswitchoffnextoddonly}.
13674 %\changes{2.0}{2025-11-24}{removed}
13675 %\end{macro}
13676 %
13677 %\begin{macro}{\@flowswitchoffnextoddonly}
13678 %Version 2.0 removed \cs{@flowswitchoffnextoddonly}.
13679 %\changes{2.0}{2025-11-24}{removed}
13680 %\end{macro}
13681 %
13682 %\begin{macro}{\dynamicswitchonnext}
13683 %\changes{1.14}{2012-11-10}{new}
13684 %\changes{2.0}{2025-11-24}{changed to document command}
13685 % Switch on the listed dynamic frames from the next page onwards
13686 % \begin{macrocode}
13687 \NewDocumentCommand \dynamicswitchonnext { s m }
13688 {
13689 \IfBooleanTF { #1 }
13690 {
13691 \clist_map_inline:nn { #2 }
13692 {
13693 \__flowfram_get_dynamic_id:n { ##1 }
13694 \__flowfram_dynamic_switch_on_next:n { \l__flowfram_id_int }
13695 }
13696 }
13697 {
13698 \clist_map_inline:nn { #2 }
13699 {
13700 \__flowfram_dynamic_switch_on_next:n { ##1 }
13701 }
13702 }
13703 }
13704 % \end{macrocode}
13705 %\end{macro}
13706 %
13707 % \begin{macrocode}
13708 \cs_new:Nn \__flowfram_dynamic_switch_on_next:n
13709 {
13710 % \end{macrocode}
13711 % Is this frame already on?
13712 % \begin{macrocode}
13713 \__flowfram_dynamic_check_if_this_page:nn
13714 { \g__flowfram_pagecounter_tl } { #1 }
13715 \bool_if:NTF \g__flowfram_not_this_frame_bool
13716 {
13717 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
13718 {
13719 \exp_not:N \dynamicsetpagelist
13720 { \int_eval:n { #1 } }
13721 { > \int_eval:n { \g__flowfram_pagecounter_tl } }
13722 }
13723 }
13724 {
13725 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
13726 {
13727 \exp_not:N \dynamicsetpagelist
13728 { \int_eval:n { #1 } }
13729 {
13730 \int_eval:n { \g__flowfram_pagecounter_tl } ,
13731 > \int_eval:n { \g__flowfram_pagecounter_tl }
13732 }
13733 }
13734 }
13735 }
13736 % \end{macrocode}
13737 %
13738 %\begin{macro}{\@sdynamicswitchonnext}
13739 % Version 2.0 removed \cs{@sdynamicswitchonnext}.
13740 %\changes{2.0}{2025-11-24}{removed}
13741 %\end{macro}
13742 %
13743 %\begin{macro}{\@dynamicswitchonnext}
13744 % Version 2.0 removed \cs{@dynamicswitchonnext}.
13745 %\changes{2.0}{2025-11-24}{removed}
13746 %\end{macro}
13747 %
13748 %\begin{macro}{\dynamicswitchonnextodd}
13749 %\changes{1.14}{2012-11-10}{new}
13750 %\changes{2.0}{2025-11-24}{changed to document command}
13751 % Switch on the listed dynamic frames from the next odd page onwards
13752 % \begin{macrocode}
13753 \NewDocumentCommand \dynamicswitchonnextodd { s m }
13754 {
13755 \int_set:Nn \l__flowfram_tmpb_int
13756 { \g__flowfram_pagecounter_tl }
13757 \int_if_odd:nT { \l__flowfram_tmpb_int }
13758 {
13759 \int_incr:N \l__flowfram_tmpb_int
13760 }
13761 \IfBooleanTF { #1 }
13762 {
13763 \clist_map_inline:nn { #2 }
13764 {
13765 \__flowfram_get_dynamic_id:n { ##1 }
13766 \__flowfram_dynamic_switch_on_next_odd:n { \l__flowfram_id_int }
13767 }
13768 }
13769 {
13770 \clist_map_inline:nn { #2 }
13771 {
13772 \__flowfram_dynamic_switch_on_next_odd:n { ##1 }
13773 }
13774 }
13775 }
13776 % \end{macrocode}
13777 %\end{macro}
13778 %
13779 % \begin{macrocode}
13780 \cs_new:Nn \__flowfram_dynamic_switch_on_next_odd:n
13781 {
13782 % \end{macrocode}
13783 % Is this frame already on?
13784 % \begin{macrocode}
13785 \__flowfram_dynamic_check_if_this_page:nn
13786 { \g__flowfram_pagecounter_tl } { #1 }
13787 \clist_clear:N \l__flowfram_pages_clist
13788 \bool_if:NF \g__flowfram_not_this_frame_bool
13789 {
13790 \clist_set:Ne \l__flowfram_pages_clist
13791 { \int_use:n { \g__flowfram_pagecounter_tl } }
13792 }
13793 % \end{macrocode}
13794 % Is this frame already switched on for the next page?
13795 % \begin{macrocode}
13796 \__flowfram_dynamic_check_if_this_page:nn
13797 { \l__flowfram_tmpb_int } { #1 }
13798 \int_compare:nNnF
13799 { \l__flowfram_tmpb_int } = { \g__flowfram_pagecounter_tl }
13800 {
13801 \bool_if:NF \g__flowfram_not_this_frame_bool
13802 {
13803 \clist_put_right:Ne \l__flowfram_pages_clist
13804 { \int_eval:n { \l__flowfram_tmpb_int } }
13805 }
13806 }
13807 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
13808 {
13809 \exp_not:N \dynamicsetpagelist
13810 { \int_eval:n { #1 }}
13811 {
13812 \l__flowfram_pages_clist
13813 > \int_use:N \l__flowfram_tmpb_int
13814 }
13815 }
13816 }
13817 % \end{macrocode}
13818 %
13819 %\begin{macro}{\@sdynamicswitchonnextodd}
13820 % Version 2.0 removed \cs{@sdynamicswitchonnextodd}.
13821 %\changes{2.0}{2025-11-24}{removed}
13822 %\end{macro}
13823 %
13824 %\begin{macro}{\@dynamicswitchonnextodd}
13825 % Version 2.0 removed \cs{@dynamicswitchonnextodd}.
13826 %\changes{2.0}{2025-11-24}{removed}
13827 %\end{macro}
13828 %
13829 %\begin{macro}{\dynamicswitchoffnext}
13830 %\changes{1.14}{2012-11-10}{new}
13831 % Switch off the listed dynamic frames from the next page onwards
13832 % \begin{macrocode}
13833 \NewDocumentCommand \dynamicswitchoffnext { s m }
13834 {
13835 \IfBooleanTF { #1 }
13836 {
13837 \clist_map_inline:nn { #2 }
13838 {
13839 \__flowfram_get_dynamic_id:n { ##1 }
13840 \__flowfram_dynamic_switch_off_next:n { \l__flowfram_id_int }
13841 }
13842 }
13843 {
13844 \clist_map_inline:nn { #2 }
13845 {
13846 \__flowfram_dynamic_switch_off_next:n { ##1 }
13847 }
13848 }
13849 }
13850 % \end{macrocode}
13851 %\end{macro}
13852 %
13853 % \begin{macrocode}
13854 \cs_new:Nn \__flowfram_dynamic_switch_off_next:n
13855 {
13856 % \end{macrocode}
13857 % Is this frame already off on this page?
13858 % \begin{macrocode}
13859 \__flowfram_dynamic_check_if_this_page:nn
13860 { \g__flowfram_pagecounter_tl } { #1 }
13861 \bool_if:NTF \g__flowfram_not_this_frame_bool
13862 {
13863 \clist_set:Nn \l__flowfram_pages_clist { none }
13864 }
13865 {
13866 \clist_set:Ne \l__flowfram_pages_clist
13867 { \int_eval:n { \g__flowfram_pagecounter_tl } }
13868 }
13869 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
13870 {
13871 \exp_not:N \dynamicsetpagelist
13872 { \int_eval:n { #1 } }
13873 { \l__flowfram_pages_clist }
13874 }
13875 }
13876 % \end{macrocode}
13877 %
13878 %\begin{macro}{\@sdynamicswitchoffnext}
13879 % Version 2.0 removed \cs{@sdynamicswitchoffnext}.
13880 %\changes{2.0}{2025-11-24}{removed}
13881 %\end{macro}
13882 %
13883 %\begin{macro}{\@dynamicswitchoffnext}
13884 % Version 2.0 removed \cs{@dynamicswitchoffnext}.
13885 %\changes{2.0}{2025-11-24}{removed}
13886 %\end{macro}
13887 %
13888 %\begin{macro}{\dynamicswitchoffnextodd}
13889 %\changes{1.14}{2012-11-10}{new}
13890 %\changes{2.0}{2025-11-24}{changed to document command}
13891 % Switch off the listed dynamic frames from the next odd page onwards
13892 % \begin{macrocode}
13893 \NewDocumentCommand \dynamicswitchoffnextodd { s m }
13894 {
13895 \int_set:Nn \l__flowfram_tmpb_int
13896 { \g__flowfram_pagecounter_tl }
13897 \int_if_odd:nT { \g__flowfram_pagecounter_tl }
13898 {
13899 \int_incr:N \l__flowfram_tmpb_int
13900 }
13901 \IfBooleanTF { #1 }
13902 {
13903 \clist_map_inline:nn { #2 }
13904 {
13905 \__flowfram_get_dynamic_id:n { ##1 }
13906 \__flowfram_dynamic_switch_off_next_odd:n { \l__flowfram_id_int }
13907 }
13908 }
13909 {
13910 \clist_map_inline:nn { #2 }
13911 {
13912 \__flowfram_dynamic_switch_off_next_odd:n { ##1 }
13913 }
13914 }
13915 }
13916 % \end{macrocode}
13917 %\end{macro}
13918 % \begin{macrocode}
13919 \cs_new:Nn \__flowfram_dynamic_switch_off_next_odd:n
13920 {
13921 % \end{macrocode}
13922 % Is this frame already off on this page?
13923 % \begin{macrocode}
13924 \__flowfram_dynamic_check_if_this_page:nn
13925 { \g__flowfram_pagecounter_tl } { #1 }
13926 \bool_if:NTF \g__flowfram_not_this_frame_bool
13927 {
13928 % \end{macrocode}
13929 % It's off on this page. Is it on or off on the next page, if this
13930 % page is odd? First, is this page odd?
13931 % \begin{macrocode}
13932 \int_compare:nNnTF
13933 { \g__flowfram_pagecounter_tl } = { \l__flowfram_tmpb_int }
13934 {
13935 % \end{macrocode}
13936 % This page is even and the frame is off on this page, so set to
13937 % none.
13938 % \begin{macrocode}
13939 \tl_set:Nn \l__flowfram_next_pages_tl { none }
13940 }
13941 {
13942 % \end{macrocode}
13943 % This page is odd. Is the frame on or off on the next page?
13944 % \begin{macrocode}
13945 \__flowfram_dynamic_check_if_this_page:nn
13946 { \l__flowfram_tmpb_int } { #1 }
13947 \bool_if:NTF \g__flowfram_not_this_frame_bool
13948 {
13949 % \end{macrocode}
13950 % Off on the next page as well, so set to none.
13951 % \begin{macrocode}
13952 \tl_set:Nn \l__flowfram_next_pages_tl { none }
13953 }
13954 {
13955 % \end{macrocode}
13956 % Not off on the next page, so set to next page only.
13957 % \begin{macrocode}
13958 \tl_set:Ne \l__flowfram_next_pages_tl
13959 { \int_use:N \l__flowfram_tmpb_int }
13960 }
13961 }
13962 }
13963 {
13964 % \end{macrocode}
13965 % It's not off on this page. Is it on or off on the next page, if this
13966 % page is odd? First, is this page odd?
13967 % \begin{macrocode}
13968 \int_compare:nNnTF
13969 { \g__flowfram_pagecounter_tl } = { \l__flowfram_tmpb_int }
13970 {
13971 % \end{macrocode}
13972 % This page is even and the frame is not off on this page, so set to
13973 % this page.
13974 % \begin{macrocode}
13975 \tl_set:Ne \l__flowfram_next_pages_tl
13976 { \int_use:n { \g__flowfram_pagecounter_tl } }
13977 }
13978 {
13979 % \end{macrocode}
13980 % This page is odd. Is the frame on or off on the next page?
13981 % \begin{macrocode}
13982 \__flowfram_dynamic_check_if_this_page:nn
13983 { \l__flowfram_tmpb_int } { #1 }
13984 \bool_if:NTF \g__flowfram_not_this_frame_bool
13985 {
13986 % \end{macrocode}
13987 % Off on the next page but not off on this page. So set to just this
13988 % page.
13989 % \begin{macrocode}
13990 \tl_set:Ne \l__flowfram_next_pages_tl
13991 { \int_eval:n { \g__flowfram_pagecounter_tl } }
13992 }
13993 {
13994 % \end{macrocode}
13995 % Not off on the next page as well, so set to this page and next page.
13996 % \begin{macrocode}
13997 \tl_set:Ne \l__flowfram_next_pages_tl
13998 {
13999 \int_eval:n { \g__flowfram_pagecounter_tl } ,
14000 \int_use:N \l__flowfram_tmpb_int
14001 }
14002 }
14003 }
14004 % \end{macrocode}
14005 % \begin{macrocode}
14006 }
14007 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14008 {
14009 \exp_not:N \dynamicsetpagelist
14010 { \int_eval:n { #1 } }
14011 { \l__flowfram_next_pages_tl }
14012 }
14013 }
14014 %
14015 % \end{macrocode}
14016 %\begin{macro}{\@sdynamicswitchoffnextodd}
14017 %Version 2.0 removed \cs{@sdynamicswitchoffnextodd}.
14018 %\changes{2.0}{2025-11-24}{removed}
14019 %\end{macro}
14020 %
14021 %\begin{macro}{\@dynamicswitchoffnextodd}
14022 %Version 2.0 removed \cs{@dynamicswitchoffnextodd}.
14023 %\changes{2.0}{2025-11-24}{removed}
14024 %\end{macro}
14025 %
14026 %\begin{macro}{\dynamicswitchonnextonly}
14027 %\changes{1.14}{2012-11-10}{new}
14028 %\changes{2.0}{2025-11-24}{changed to document command}
14029 % Switch on the listed dynamic frames for just the next page
14030 % \begin{macrocode}
14031 \NewDocumentCommand \dynamicswitchonnextonly { s m }
14032 {
14033 \int_set:Nn \l__flowfram_tmpb_int
14034 { \g__flowfram_pagecounter_tl + \c_one_int }
14035 \IfBooleanTF { #1 }
14036 {
14037 \clist_map_inline:nn { #2 }
14038 {
14039 \__flowfram_get_dynamic_id:n { ##1 }
14040 \__flowfram_dynamic_switch_on_next_only:n { \l__flowfram_id_int }
14041 }
14042 }
14043 {
14044 \clist_map_inline:nn { #2 }
14045 {
14046 \__flowfram_dynamic_switch_on_next_only:n { ##1 }
14047 }
14048 }
14049 }
14050 % \end{macrocode}
14051 %\end{macro}
14052 %
14053 % \begin{macrocode}
14054 \cs_new:Nn \__flowfram_dynamic_switch_on_next_only:n
14055 {
14056 % \end{macrocode}
14057 % Is this frame already on?
14058 % \begin{macrocode}
14059 \__flowfram_dynamic_check_if_this_page:nn
14060 { \g__flowfram_pagecounter_tl } { #1 }
14061 \bool_if:NTF \g__flowfram_not_this_frame_bool
14062 {
14063 % \end{macrocode}
14064 % Not, it isn't, so just set to the next page:
14065 % \begin{macrocode}
14066 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14067 {
14068 \exp_not:N \dynamicsetpagelist
14069 { \int_eval:n { #1 } }
14070 { \int_use:N \l__flowfram_tmpb_int }
14071 }
14072 }
14073 {
14074 % \end{macrocode}
14075 % Yes, it is, so set to this page and the next page:
14076 % \begin{macrocode}
14077 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14078 {
14079 \exp_not:N \dynamicsetpagelist
14080 { \int_eval:n { #1 } }
14081 {
14082 \int_eval:n { \g__flowfram_pagecounter_tl } ,
14083 \int_use:N \l__flowfram_tmpb_int
14084 }
14085 }
14086 }
14087 }
14088 % \end{macrocode}
14089 %
14090 %\begin{macro}{\@sdynamicswitchonnextonly}
14091 % Version 2.0 removed \cs{@sdynamicswitchonnextonly}
14092 %\changes{2.0}{2025-11-24}{removed}
14093 %\end{macro}
14094 %
14095 %\begin{macro}{\@dynamicswitchonnextonly}
14096 % Version 2.0 removed \cs{@dynamicswitchonnextonly}
14097 %\changes{2.0}{2025-11-24}{removed}
14098 %\end{macro}
14099 %
14100 %\begin{macro}{\dynamicswitchonnextoddonly}
14101 %\changes{1.14}{2012-11-10}{new}
14102 %\changes{2.0}{2025-11-24}{changed to document command}
14103 % Switch on the listed dynamic frames for just the next odd page
14104 % \begin{macrocode}
14105 \NewDocumentCommand \dynamicswitchonnextoddonly { s m }
14106 {
14107 \IfBooleanTF { #1 }
14108 {
14109 \clist_map_inline:nn { #2 }
14110 {
14111 \__flowfram_get_dynamic_id:n { ##1 }
14112 \__flowfram_dynamic_switch_on_next_odd_only:n { \l__flowfram_id_int }
14113 }
14114 }
14115 {
14116 \clist_map_inline:nn { #2 }
14117 {
14118 \__flowfram_dynamic_switch_on_next_odd_only:n { ##1 }
14119 }
14120 }
14121 }
14122 % \end{macrocode}
14123 %\end{macro}
14124 %
14125 % \begin{macrocode}
14126 \cs_new:Nn \__flowfram_dynamic_switch_on_next_odd_only:n
14127 {
14128 % \end{macrocode}
14129 % Is this frame already on?
14130 % \begin{macrocode}
14131 \__flowfram_dynamic_check_if_this_page:nn
14132 { \g__flowfram_pagecounter_tl } { #1 }
14133 \bool_if:NTF \g__flowfram_not_this_frame_bool
14134 {
14135 % \end{macrocode}
14136 % No, it isn't. If this is an odd page, is it on or off on the next
14137 % page? First, is this an odd page?
14138 % \begin{macrocode}
14139 \int_if_odd:nTF { \g__flowfram_pagecounter_tl }
14140 {
14141 % \end{macrocode}
14142 % Yes, it's odd. So this frame isn't on this page, but is it on or
14143 % off on the next page?
14144 % \begin{macrocode}
14145 \int_set:Nn \l__flowfram_tmpb_int
14146 { \g__flowfram_pagecounter_tl + \c_one_int }
14147 \__flowfram_dynamic_check_if_this_page:nn
14148 { \l__flowfram_tmpb_int } { #1 }
14149 \bool_if:NTF \g__flowfram_not_this_frame_bool
14150 {
14151 % \end{macrocode}
14152 % It's not switched on either on this (odd) page or the next (even) page. So
14153 % the page list should be just the next odd page after this one.
14154 % \begin{macrocode}
14155 \int_incr:N \l__flowfram_tmpb_int
14156 \clist_set:Ne \l__flowfram_pages_clist
14157 { \int_use:N \l__flowfram_tmpb_int }
14158 }
14159 {
14160 % \end{macrocode}
14161 % It's not switched on for this (odd) page but it is for the next (even) page. So
14162 % the page list should be the next even and odd pages after this
14163 % page.
14164 % \begin{macrocode}
14165 \clist_set:Ne \l__flowfram_pages_clist
14166 { \int_use:N \l__flowfram_tmpb_int }
14167 \int_inc:N \l__flowfram_tmpb_int
14168 \clist_put_right:Ne \l__flowfram_pages_clist
14169 { \int_use:N \l__flowfram_tmpb_int }
14170 }
14171 }
14172 {
14173 % \end{macrocode}
14174 % No, it's even. So it's not on this (even) page, but needs to be on
14175 % for the following (odd) page.
14176 % \begin{macrocode}
14177 \int_set:Nn \l__flowfram_tmpb_int
14178 { \g__flowfram_pagecounter_tl + \c_one_int }
14179 \clist_set:Ne \l__flowfram_pages_clist
14180 { \int_use:N \l__flowfram_tmpb_int }
14181 }
14182 }
14183 {
14184 % \end{macrocode}
14185 % Frame is on this page. If this is an odd page, is it on or off on
14186 % the next page? First, is this an odd page?
14187 % \begin{macrocode}
14188 \int_if_odd:nTF { \g__flowfram_pagecounter_tl }
14189 {
14190 % \end{macrocode}
14191 % Yes, it's odd. Is the frame on or off for the next (even) page?
14192 % \begin{macrocode}
14193 \int_set:Nn \l__flowfram_tmpb_int
14194 { \g__flowfram_pagecounter_tl + \c_one_int }
14195 \__flowfram_dynamic_check_if_this_page:nn
14196 { \l__flowfram_tmpb_int } { #1 }
14197 \bool_if:NTF \g__flowfram_not_this_frame_bool
14198 {
14199 % \end{macrocode}
14200 % Frame is off. So the frame is switched on for this (odd) page but
14201 % is off for the next (even) page. So the page list needs to be this
14202 % (odd) page and the following odd page, skipping the even page in
14203 % between.
14204 % \begin{macrocode}
14205 \int_incr:N \l__flowfram_tmpb_int
14206 \clist_set:Ne \l__flowfram_pages_clist
14207 {
14208 \int_eval:n { \g__flowfram_pagecounter_tl } ,
14209 \int_use:N \l__flowfram_tmpb_int
14210 }
14211 }
14212 {
14213 % \end{macrocode}
14214 % Frame is on. So the frame is switched on for this (odd) page and
14215 % the next (even) page. So the page list needs to be this
14216 % (odd) page, the next even page and the following odd page.
14217 % \begin{macrocode}
14218 \int_incr:N \l__flowfram_tmpb_int
14219 \clist_set:Ne \l__flowfram_pages_clist
14220 {
14221 \int_eval:n { \g__flowfram_pagecounter_tl } -
14222 \int_use:N \l__flowfram_tmpb_int
14223 }
14224 }
14225 }
14226 {
14227 % \end{macrocode}
14228 % Frame is switched on for this page and this page is even. So the
14229 % page list needs to be this (even) page and the next (odd) page.
14230 % \begin{macrocode}
14231 \int_set:Nn \l__flowfram_tmpb_int
14232 { \g__flowfram_pagecounter_tl + \c_one_int }
14233 \clist_set:Ne \l__flowfram_pages_clist
14234 {
14235 \int_eval:n { \g__flowfram_pagecounter_tl } ,
14236 \int_use:N \l__flowfram_tmpb_int
14237 }
14238 }
14239 }
14240 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14241 {
14242 \exp_not:N \dynamicsetpagelist
14243 { \int_eval:n { #1 } }
14244 { \l__flowfram_pages_clist }
14245 }
14246 }
14247 % \end{macrocode}
14248 %
14249 %\begin{macro}{\@sdynamicswitchonnextoddonly}
14250 % Version 2.0 removed \cs{@sdynamicswitchonnextoddonly}
14251 %\changes{2.0}{2025-11-24}{removed}
14252 %\end{macro}
14253 %
14254 %\begin{macro}{\@dynamicswitchonnextoddonly}
14255 % Version 2.0 removed \cs{@dynamicswitchonnextoddonly}.
14256 %\changes{2.0}{2025-11-24}{removed}
14257 %\end{macro}
14258 %
14259 %
14260 %\begin{macro}{\dynamicswitchoffnextonly}
14261 %\changes{1.14}{2012-11-10}{new}
14262 %\changes{2.0}{2025-11-24}{changed to document command}
14263 % Switch off the listed dynamic frames for just the next page
14264 % \begin{macrocode}
14265 \NewDocumentCommand \dynamicswitchoffnextonly { s m }
14266 {
14267 \int_set:Nn \l__flowfram_tmpb_int
14268 { \g__flowfram_pagecounter_tl + \c_one_int }
14269 \IfBooleanTF { #1 }
14270 {
14271 \clist_map_inline:nn { #2 }
14272 {
14273 \__flowfram_get_dynamic_id:n { ##1 }
14274 \__flowfram_dynamic_switch_off_next_only:n { \l__flowfram_id_int }
14275 }
14276 }
14277 {
14278 \clist_map_inline:nn { #2 }
14279 {
14280 \__flowfram_dynamic_switch_off_next_only:n { ##1 }
14281 }
14282 }
14283 }
14284 % \end{macrocode}
14285 %\end{macro}
14286 %
14287 % \begin{macrocode}
14288 \cs_new:Nn \__flowfram_dynamic_switch_off_next_only:n
14289 {
14290 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14291 {
14292 \exp_not:N \dynamicaddexclusion
14293 { \int_eval:n { #1 } }
14294 { \int_use:N \l__flowfram_tmpb_int }
14295 }
14296 }
14297 % \end{macrocode}
14298 %\begin{macro}{\@sdynamicswitchoffnextonly}
14299 % Version 2.0 removed \cs{@sdynamicswitchoffnextonly}.
14300 %\changes{2.0}{2025-11-24}{removed}
14301 %\end{macro}
14302 %
14303 %\begin{macro}{\@dynamicswitchoffnextonly}
14304 % Version 2.0 removed \cs{@dynamicswitchoffnextonly}
14305 %\changes{2.0}{2025-11-24}{removed}
14306 %\end{macro}
14307 %
14308 %\begin{macro}{\dynamicswitchoffnextoddonly}
14309 %\changes{1.14}{2012-11-10}{new}
14310 %\changes{2.0}{2025-11-24}{changed to document command}
14311 % Switch off the listed dynamic frames for just the next odd page
14312 % \begin{macrocode}
14313 \NewDocumentCommand \dynamicswitchoffnextoddonly { s m }
14314 {
14315 \int_set:Nn \l__flowfram_tmpb_int
14316 { \g__flowfram_pagecounter_tl + \c_one_int }
14317 \int_if_odd:nF { \l__flowfram_tmpb_int }
14318 {
14319 \int_incr:N \l__flowfram_tmpb_int
14320 }
14321 \IfBooleanTF { #1 }
14322 {
14323 \clist_map_inline:nn { #2 }
14324 {
14325 \__flowfram_get_dynamic_id:n { ##1 }
14326 \__flowfram_dynamic_switch_off_next_odd_only:n { \l__flowfram_id_int }
14327 }
14328 }
14329 {
14330 \clist_map_inline:nn { #2 }
14331 {
14332 \__flowfram_dynamic_switch_off_next_odd_only:n { ##1 }
14333 }
14334 }
14335 }
14336 % \end{macrocode}
14337 %\end{macro}
14338 %
14339 % \begin{macrocode}
14340 \cs_new:Nn \__flowfram_dynamic_switch_off_next_odd_only:n
14341 {
14342 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14343 {
14344 \exp_not:N \dynamicaddexclusion
14345 { \int_eval:n { #1 } }
14346 { \int_use:N \l__flowfram_tmpb_int }
14347 }
14348 }
14349 % \end{macrocode}
14350 %
14351 %\begin{macro}{\@sdynamicswitchoffnextoddonly}
14352 % Version 2.0 removed \cs{@sdynamicswitchoffnextoddonly}.
14353 %\changes{2.0}{2025-11-24}{removed}
14354 %\end{macro}
14355 %
14356 %\begin{macro}{\@dynamicswitchoffnextoddonly}
14357 % Version 2.0 removed \cs{@dynamicswitchoffnextoddonly}.
14358 %\changes{2.0}{2025-11-24}{removed}
14359 %\end{macro}
14360 %
14361 %\begin{macro}{\staticswitchonnext}
14362 %\changes{1.14}{2012-11-10}{new}
14363 %\changes{2.0}{2025-11-24}{changed to document command}
14364 % Switch on the listed static frames from the next page onwards
14365 % \begin{macrocode}
14366 \NewDocumentCommand \staticswitchonnext { s m }
14367 {
14368 \IfBooleanTF { #1 }
14369 {
14370 \clist_map_inline:nn { #2 }
14371 {
14372 \__flowfram_get_static_id:n { ##1 }
14373 \__flowfram_static_switch_on_next:n { \l__flowfram_id_int }
14374 }
14375 }
14376 {
14377 \clist_map_inline:nn { #2 }
14378 {
14379 \__flowfram_static_switch_on_next:n { ##1 }
14380 }
14381 }
14382 }
14383 % \end{macrocode}
14384 %\end{macro}
14385 %
14386 % \begin{macrocode}
14387 \cs_new:Nn \__flowfram_static_switch_on_next:n
14388 {
14389 % \end{macrocode}
14390 % Is this frame already on?
14391 % \begin{macrocode}
14392 \__flowfram_static_check_if_this_page:nn
14393 { \g__flowfram_pagecounter_tl } { #1 }
14394 \bool_if:NTF \g__flowfram_not_this_frame_bool
14395 {
14396 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14397 {
14398 \exp_not:N \staticsetpagelist
14399 { \int_eval:n { #1 } }
14400 { > \int_eval:n { \g__flowfram_pagecounter_tl } }
14401 }
14402 }
14403 {
14404 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14405 {
14406 \exp_not:N \staticsetpagelist
14407 { \int_eval:n { #1 } }
14408 {
14409 \int_eval:n { \g__flowfram_pagecounter_tl } ,
14410 > \int_eval:n { \g__flowfram_pagecounter_tl }
14411 }
14412 }
14413 }
14414 }
14415 % \end{macrocode}
14416 %
14417 %\begin{macro}{\@sstaticswitchonnext}
14418 % Version 2.0 removed \cs{@sstaticswitchonnext}.
14419 %\changes{2.0}{2025-11-24}{removed}
14420 %\end{macro}
14421 %
14422 %\begin{macro}{\@staticswitchonnext}
14423 % Version 2.0 removed \cs{@staticswitchonnext}.
14424 %\changes{2.0}{2025-11-24}{removed}
14425 %\end{macro}
14426 %
14427 %\begin{macro}{\staticswitchonnextodd}
14428 %\changes{1.14}{2012-11-10}{new}
14429 %\changes{2.0}{2025-11-24}{changed to document command}
14430 % Switch on the listed static frames from the next odd page onwards
14431 % \begin{macrocode}
14432 \NewDocumentCommand \staticswitchonnextodd { s m }
14433 {
14434 \int_set:Nn \l__flowfram_tmpb_int
14435 { \g__flowfram_pagecounter_tl }
14436 \int_if_odd:nT { \l__flowfram_tmpb_int }
14437 {
14438 \int_incr:N \l__flowfram_tmpb_int
14439 }
14440 \IfBooleanTF { #1 }
14441 {
14442 \clist_map_inline:nn { #2 }
14443 {
14444 \__flowfram_get_static_id:n { ##1 }
14445 \__flowfram_static_switch_on_next_odd:n { \l__flowfram_id_int }
14446 }
14447 }
14448 {
14449 \clist_map_inline:nn { #2 }
14450 {
14451 \__flowfram_static_switch_on_next_odd:n { ##1 }
14452 }
14453 }
14454 }
14455 % \end{macrocode}
14456 %\end{macro}
14457 %
14458 % \begin{macrocode}
14459 \cs_new:Nn \__flowfram_static_switch_on_next_odd:n
14460 {
14461 % \end{macrocode}
14462 % Is this frame already on?
14463 % \begin{macrocode}
14464 \__flowfram_static_check_if_this_page:nn
14465 { \g__flowfram_pagecounter_tl } { #1 }
14466 \clist_clear:N \l__flowfram_pages_clist
14467 \bool_if:NF \g__flowfram_not_this_frame_bool
14468 {
14469 \clist_put_right:Ne \l__flowfram_pages_clist
14470 { \int_eval:n { \g__flowfram_pagecounter_tl } }
14471 }
14472 % \end{macrocode}
14473 % Is this frame already switched on for the next page?
14474 % \begin{macrocode}
14475 \__flowfram_static_check_if_this_page:nn
14476 { \l__flowfram_tmpb_int } { #1 }
14477 \int_compare:nNnF
14478 { \l__flowfram_tmpb_int } = { \g__flowfram_pagecounter_tl }
14479 {
14480 \bool_if:NF \g__flowfram_not_this_frame_bool
14481 {
14482 \clist_put_right:Ne \l__flowfram_pages_clist
14483 { \int_use:N \l__flowfram_tmpb_int }
14484 }
14485 }
14486 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14487 {
14488 \exp_not:N \staticsetpagelist
14489 { \int_eval:n { #1 } }
14490 {
14491 \l__flowfram_pages_clist ,
14492 > \int_use:N \l__flowfram_tmpb_int
14493 }
14494 }
14495 }
14496 % \end{macrocode}
14497 %
14498 %\begin{macro}{\@sstaticswitchonnextodd}
14499 % Version 2.0 removed \cs{@sstaticswitchonnextodd}.
14500 %\changes{2.0}{2025-11-24}{removed}
14501 %\end{macro}
14502 %
14503 %\begin{macro}{\@staticswitchonnextodd}
14504 % Version 2.0 removed \cs{@staticswitchonnextodd}.
14505 %\changes{2.0}{2025-11-24}{removed}
14506 %\end{macro}
14507 %
14508 %\begin{macro}{\staticswitchoffnext}
14509 %\changes{1.14}{2012-11-10}{new}
14510 %\changes{2.0}{2025-11-24}{changed to document command}
14511 % Switch off the listed static frames from the next page onwards
14512 % \begin{macrocode}
14513 \NewDocumentCommand \staticswitchoffnext { s m }
14514 {
14515 \IfBooleanTF { #1 }
14516 {
14517 \clist_map_inline:nn { #2 }
14518 {
14519 \__flowfram_get_static_id:n { ##1 }
14520 \__flowfram_static_switch_off_next:n { \l__flowfram_id_int }
14521 }
14522 }
14523 {
14524 \clist_map_inline:nn { #2 }
14525 {
14526 \__flowfram_static_switch_off_next:n { ##1 }
14527 }
14528 }
14529 }
14530 % \end{macrocode}
14531 %\end{macro}
14532 %
14533 % \begin{macrocode}
14534 \cs_new:Nn \__flowfram_static_switch_off_next:n
14535 {
14536 % \end{macrocode}
14537 % Is this frame already off on this page?
14538 % \begin{macrocode}
14539 \__flowfram_static_check_if_this_page:nn
14540 { \g__flowfram_pagecounter_tl } { #1 }
14541 \bool_if:NTF \g__flowfram_not_this_frame_bool
14542 {
14543 \clist_set:Nn \l__flowfram_pages_clist { none }
14544 }
14545 {
14546 \clist_set:Ne \l__flowfram_pages_clist
14547 { \int_eval:n { \g__flowfram_pagecounter_tl } }
14548 }
14549 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14550 {
14551 \exp_not:N \staticsetpagelist
14552 { \int_eval:n { #1 } }
14553 { \l__flowfram_pages_clist }
14554 }
14555 }
14556 % \end{macrocode}
14557 %
14558 %\begin{macro}{\@sstaticswitchoffnext}
14559 % Version 2.0 removed \cs{@sstaticswitchoffnext}.
14560 %\changes{2.0}{2025-11-24}{removed}
14561 %\end{macro}
14562 %
14563 %\begin{macro}{\@staticswitchoffnext}
14564 % Version 2.0 removed \cs{@staticswitchoffnext}.
14565 %\changes{2.0}{2025-11-24}{removed}
14566 %\end{macro}
14567 %
14568 %\begin{macro}{\staticswitchoffnextodd}
14569 %\changes{1.14}{2012-11-10}{new}
14570 %\changes{2.0}{2025-11-24}{changed to document command}
14571 % Switch off the listed static frames from the next odd page onwards
14572 % \begin{macrocode}
14573 \NewDocumentCommand \staticswitchoffnextodd { s m }
14574 {
14575 \int_set:Nn \l__flowfram_tmpb_int
14576 { \g__flowfram_pagecounter_tl }
14577 \int_if_odd:nT { \g__flowfram_pagecounter_tl }
14578 {
14579 \int_incr:N \l__flowfram_tmpb_int
14580 }
14581 \IfBooleanTF { #1 }
14582 {
14583 \clist_map_inline:nn { #2 }
14584 {
14585 \__flowfram_get_static_id:n { ##1 }
14586 \__flowfram_static_switch_off_next_odd:n { \l__flowfram_id_int }
14587 }
14588 }
14589 {
14590 \clist_map_inline:nn { #2 }
14591 {
14592 \__flowfram_static_switch_off_next_odd:n { ##1 }
14593 }
14594 }
14595 }
14596 % \end{macrocode}
14597 %\end{macro}
14598 %
14599 % \begin{macrocode}
14600 \cs_new:Nn \__flowfram_static_switch_off_next_odd:n
14601 {
14602 % \end{macrocode}
14603 % Is this frame already off on this page?
14604 % \begin{macrocode}
14605 \__flowfram_static_check_if_this_page:nn
14606 { \g__flowfram_pagecounter_tl } { #1 }
14607 \bool_if:NTF \g__flowfram_not_this_frame_bool
14608 {
14609 % \end{macrocode}
14610 % It's off on this page. Is it on or off on the next page, if this
14611 % page is odd? First, is this page odd?
14612 % \begin{macrocode}
14613 \int_compare:nNnTF
14614 { \g__flowfram_pagecounter_tl } = { \l__flowfram_tmpb_int }
14615 {
14616 % \end{macrocode}
14617 % This page is even and the frame is off on this page, so set to
14618 % none.
14619 % \begin{macrocode}
14620 \tl_set:Nn \l__flowfram_next_pages_tl { none }
14621 }
14622 {
14623 % \end{macrocode}
14624 % This page is odd. Is the frame on or off on the next page?
14625 % \begin{macrocode}
14626 \__flowfram_static_check_if_this_page:nn
14627 { \l__flowfram_tmpb_int } { #1 }
14628 \bool_if:NTF \g__flowfram_not_this_frame_bool
14629 {
14630 % \end{macrocode}
14631 % Off on the next page as well, so set to none.
14632 % \begin{macrocode}
14633 \tl_set:Nn \l__flowfram_next_pages_tl { none }
14634 }
14635 {
14636 % \end{macrocode}
14637 % Not off on the next page, so set to next page only.
14638 % \begin{macrocode}
14639 \tl_set:Ne \l__flowfram_next_pages_tl
14640 { \int_use:N \l__flowfram_tmpb_int }
14641 }
14642 }
14643 }
14644 {
14645 % \end{macrocode}
14646 % It's not off on this page. Is it on or off on the next page, if this
14647 % page is odd? First, is this page odd?
14648 % \begin{macrocode}
14649 \int_compare:nNnTF
14650 { \g__flowfram_pagecounter_tl } = { \l__flowfram_tmpb_int }
14651 {
14652 % \end{macrocode}
14653 % This page is even and the frame is not off on this page, so set to
14654 % this page.
14655 % \begin{macrocode}
14656 \tl_set:Ne \l__flowfram_next_pages_tl
14657 { \int_eval:n { \g__flowfram_pagecounter_tl } }
14658 }
14659 {
14660 % \end{macrocode}
14661 % This page is odd. Is the frame on or off on the next page?
14662 % \begin{macrocode}
14663 \__flowfram_static_check_if_this_page:nn
14664 { \l__flowfram_tmpb_int } { #1 }
14665 \bool_if:NTF \g__flowfram_not_this_frame_bool
14666 {
14667 % \end{macrocode}
14668 % Off on the next page but not off on this page. So set to just this
14669 % page.
14670 % \begin{macrocode}
14671 \tl_set:Ne \l__flowfram_next_pages_tl
14672 { \int_eval:n { \g__flowfram_pagecounter_tl } }
14673 }
14674 {
14675 % \end{macrocode}
14676 % Not off on the next page as well, so set to this page and next page.
14677 % \begin{macrocode}
14678 \tl_set:Ne \l__flowfram_next_pages_tl
14679 {
14680 \int_eval:n { \g__flowfram_pagecounter_tl } ,
14681 \int_use:N \l__flowfram_tmpb_int
14682 }
14683 }
14684 }
14685 }
14686 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14687 {
14688 \exp_not:N \staticsetpagelist
14689 { \int_eval:n { #1 } }
14690 { \l__flowfram_next_pages_tl }
14691 }
14692 }
14693 % \end{macrocode}
14694 %
14695 %\begin{macro}{\@sstaticswitchoffnextodd}
14696 % Version 2.0 removed \cs{@sstaticswitchoffnextodd}.
14697 %\changes{2.0}{2025-11-24}{removed}
14698 %\end{macro}
14699 %
14700 %\begin{macro}{\@staticswitchoffnextodd}
14701 % Version 2.0 removed \cs{\@staticswitchoffnextodd}.
14702 %\changes{2.0}{2025-11-24}{removed}
14703 %\end{macro}
14704 %
14705 %\begin{macro}{\staticswitchonnextonly}
14706 %\changes{1.14}{2012-11-10}{new}
14707 %\changes{2.0}{2025-11-24}{changed to document command}
14708 % Switch on the listed static frames for just the next page
14709 % \begin{macrocode}
14710 \NewDocumentCommand \staticswitchonnextonly { s m }
14711 {
14712 \int_set:Nn \l__flowfram_tmpb_int
14713 { \g__flowfram_pagecounter_tl + \c_one_int }
14714 \IfBooleanTF { #1 }
14715 {
14716 \clist_map_inline:nn { #2 }
14717 {
14718 \__flowfram_get_static_id:n { ##1 }
14719 \__flowfram_static_switch_on_next_only:n { \l__flowfram_id_int }
14720 }
14721 }
14722 {
14723 \clist_map_inline:nn { #2 }
14724 {
14725 \__flowfram_static_switch_on_next_only:n { ##1 }
14726 }
14727 }
14728 }
14729 % \end{macrocode}
14730 %\end{macro}
14731 %
14732 % \begin{macrocode}
14733 \cs_new:Nn \__flowfram_static_switch_on_next_only:n
14734 {
14735 % \end{macrocode}
14736 % Is this frame already on?
14737 % \begin{macrocode}
14738 \__flowfram_static_check_if_this_page:nn
14739 { \g__flowfram_pagecounter_tl } { #1 }
14740 \bool_if:NTF \g__flowfram_not_this_frame_bool
14741 {
14742 % \end{macrocode}
14743 % Not, it isn't, so just set to the next page:
14744 % \begin{macrocode}
14745 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14746 {
14747 \exp_not:N \staticsetpagelist
14748 { \int_eval:n { #1 } }
14749 { \int_use:N \l__flowfram_tmpb_int }
14750 }
14751 }
14752 {
14753 % \end{macrocode}
14754 % Yes, it is, so set to this page and the next page:
14755 % \begin{macrocode}
14756 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14757 {
14758 \exp_not:N \staticsetpagelist
14759 { \int_eval:n { #1 } }
14760 {
14761 \int_eval:n { \g__flowfram_pagecounter_tl } ,
14762 \int_use:N \l__flowfram_tmpb_int
14763 }
14764 }
14765 }
14766 }
14767 % \end{macrocode}
14768 %
14769 %\begin{macro}{\@sstaticswitchonnextonly}
14770 % Version 2.0 removed \cs{@sstaticswitchonnextonly}.
14771 %\changes{2.0}{2025-11-24}{removed}
14772 %\end{macro}
14773 %
14774 %\begin{macro}{\@staticswitchonnextonly}
14775 % Version 2.0 removed \cs{@staticswitchonnextonly}.
14776 %\changes{2.0}{2025-11-24}{removed}
14777 %\end{macro}
14778 %
14779 %\begin{macro}{\staticswitchonnextoddonly}
14780 %\changes{1.14}{2012-11-10}{new}
14781 %\changes{2.0}{2025-11-24}{changed to document command}
14782 % Switch on the listed static frames for just the next odd page
14783 % \begin{macrocode}
14784 \NewDocumentCommand \staticswitchonnextoddonly { s m }
14785 {
14786 \IfBooleanTF { #1 }
14787 {
14788 \clist_map_inline:nn { #2 }
14789 {
14790 \__flowfram_get_static_id:n { ##1 }
14791 \__flowfram_static_switch_on_next_odd_only:n { \l__flowfram_id_int }
14792 }
14793 }
14794 {
14795 \clist_map_inline:nn { #2 }
14796 {
14797 \__flowfram_static_switch_on_next_odd_only:n { ##1 }
14798 }
14799 }
14800 }
14801 % \end{macrocode}
14802 %\end{macro}
14803 %
14804 % \begin{macrocode}
14805 \cs_new:Nn \__flowfram_static_switch_on_next_odd_only:n
14806 {
14807 % \end{macrocode}
14808 % Is this frame already on?
14809 % \begin{macrocode}
14810 \__flowfram_static_check_if_this_page:nn
14811 { \g__flowfram_pagecounter_tl } { #1 }
14812 \bool_if:NTF \g__flowfram_not_this_frame_bool
14813 {
14814 % \end{macrocode}
14815 % No, it isn't. If this is an odd page, is it on or off on the next
14816 % page? First, is this an odd page?
14817 % \begin{macrocode}
14818 \int_if_odd:nTF { \g__flowfram_pagecounter_tl }
14819 {
14820 % \end{macrocode}
14821 % Yes, it's odd. So this frame isn't on this page, but is it on or
14822 % off on the next page?
14823 % \begin{macrocode}
14824 \int_set:Nn \l__flowfram_tmpb_int
14825 { \g__flowfram_pagecounter_tl + \c_one_int }
14826 \__flowfram_static_check_if_this_page:nn
14827 { \l__flowfram_tmpb_int } { #1 }
14828 \bool_if:NTF \g__flowfram_not_this_frame_bool
14829 {
14830 % \end{macrocode}
14831 % It's not switched on either on this (odd) page or the next (even) page. So
14832 % the page list should be just the next odd page after this one.
14833 % \begin{macrocode}
14834 \int_incr:N \l__flowfram_tmpb_int
14835 \clist_set:Ne \l__flowfram_pages_clist
14836 { \int_use:N \l__flowfram_tmpb_int }
14837 }
14838 {
14839 % \end{macrocode}
14840 % It's not switched on for this (odd) page but it is for the next (even) page. So
14841 % the page list should be the next even and odd pages after this
14842 % page.
14843 % \begin{macrocode}
14844 \clist_set:Ne \l__flowfram_pages_clist
14845 { \int_use:N \l__flowfram_tmpb_int }
14846 \int_incr:N \l__flowfram_tmpb_int
14847 \clist_put_right:Ne \l__flowfram_pages_clist
14848 {
14849 \int_use:N \l__flowfram_tmpb_int
14850 }
14851 }
14852 }
14853 {
14854 % \end{macrocode}
14855 % No, it's even. So it's not on this (even) page, but needs to be on
14856 % for the following (odd) page.
14857 % \begin{macrocode}
14858 \int_set:Nn \l__flowfram_tmpb_int
14859 { \g__flowfram_pagecounter_tl + \c_one_int }
14860 \clist_set:Ne \l__flowfram_pages_clist
14861 { \int_use:N \l__flowfram_tmpb_int }
14862 }
14863 }
14864 {
14865 % \end{macrocode}
14866 % Frame is on this page. If this is an odd page, is it on or off on
14867 % the next page? First, is this an odd page?
14868 % \begin{macrocode}
14869 \int_if_odd:nTF { \g__flowfram_pagecounter_tl }
14870 {
14871 % \end{macrocode}
14872 % Yes, it's odd. Is the frame on or off for the next (even) page?
14873 % \begin{macrocode}
14874 \int_set:Nn \l__flowfram_tmpb_int
14875 { \g__flowfram_pagecounter_tl + \c_one_int }
14876 \__flowfram_static_check_if_this_page:nn
14877 { \l__flowfram_tmpb_int } { #1 }
14878 \bool_if:NTF \g__flowfram_not_this_frame_bool
14879 {
14880 % \end{macrocode}
14881 % Frame is off. So the frame is switched on for this (odd) page but
14882 % is off for the next (even) page. So the page list needs to be this
14883 % (odd) page and the following odd page, skipping the even page in
14884 % between.
14885 % \begin{macrocode}
14886 \int_incr:N \l__flowfram_tmpb_int
14887 \clist_set:Ne \l__flowfram_pages_clist
14888 {
14889 \int_eval:n { \g__flowfram_pagecounter_tl } ,
14890 \int_use:N \l__flowfram_tmpb_int
14891 }
14892 }
14893 {
14894 % \end{macrocode}
14895 % Frame is on. So the frame is switched on for this (odd) page and
14896 % the next (even) page. So the page list needs to be this
14897 % (odd) page, the next even page and the following odd page.
14898 % \begin{macrocode}
14899 \int_incr:N \l__flowfram_tmpb_int
14900 \clist_set:Ne \l__flowfram_pages_clist
14901 {
14902 \int_eval:n { \g__flowfram_pagecounter_tl } -
14903 \int_use:N \l__flowfram_tmpb_int
14904 }
14905 }
14906 }
14907 {
14908 % \end{macrocode}
14909 % Frame is switched on for this page and this page is even. So the
14910 % page list needs to be this (even) page and the next (odd) page.
14911 % \begin{macrocode}
14912 \int_set:Nn \l__flowfram_tmpb_int
14913 { \g__flowfram_pagecounter_tl + \c_one_int }
14914 \clist_set:Ne \l__flowfram_pages_clist
14915 {
14916 \int_eval:n { \g__flowfram_pagecounter_tl } ,
14917 \int_use:N \l__flowfram_tmpb_int
14918 }
14919 }
14920 }
14921 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14922 {
14923 \exp_not:N \staticsetpagelist
14924 { \int_eval:n { #1 } }
14925 { \l__flowfram_pages_clist }
14926 }
14927 }
14928 % \end{macrocode}
14929 %
14930 %\begin{macro}{\@sstaticswitchonnextoddonly}
14931 % Version 2.0 removed \cs{@sstaticswitchonnextoddonly}.
14932 %\changes{2.0}{2025-11-24}{removed}
14933 %\end{macro}
14934 %
14935 %\begin{macro}{\@staticswitchonnextoddonly}
14936 % Version 2.0 removed \cs{@staticswitchonnextoddonly}.
14937 %\changes{2.0}{2025-11-24}{removed}
14938 %\end{macro}
14939 %
14940 %
14941 %\begin{macro}{\staticswitchoffnextonly}
14942 %\changes{1.14}{2012-11-10}{new}
14943 %\changes{2.0}{2025-11-24}{changed to document command}
14944 % Switch off the listed static frames for just the next page
14945 % \begin{macrocode}
14946 \NewDocumentCommand \staticswitchoffnextonly { s m }
14947 {
14948 \int_set:Nn \l__flowfram_tmpb_int
14949 { \g__flowfram_pagecounter_tl + \c_one_int }
14950 \IfBooleanTF { #1 }
14951 {
14952 \clist_map_inline:nn { #2 }
14953 {
14954 \__flowfram_get_static_id:n { ##1 }
14955 \__flowfram_static_switch_off_next_only:n { \l__flowfram_id_int }
14956 }
14957 }
14958 {
14959 \clist_map_inline:nn { #2 }
14960 {
14961 \__flowfram_static_switch_off_next_only:n { ##1 }
14962 }
14963 }
14964 }
14965 % \end{macrocode}
14966 %\end{macro}
14967 %
14968 % \begin{macrocode}
14969 \cs_new:Nn \__flowfram_static_switch_off_next_only:n
14970 {
14971 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
14972 {
14973 \exp_not:N \staticaddexclusion
14974 { \int_eval:n { #1 } }
14975 { \int_use:N \l__flowfram_tmpb_int }
14976 }
14977 }
14978 % \end{macrocode}
14979 %
14980 %\begin{macro}{\@sstaticswitchoffnextonly}
14981 % Version 2.0 removed \cs{@sstaticswitchoffnextonly}.
14982 %\changes{2.0}{2025-11-24}{removed}
14983 %\end{macro}
14984 %
14985 %\begin{macro}{\@staticswitchoffnextonly}
14986 % Version 2.0 removed \cs{@staticswitchoffnextonly}.
14987 %\changes{2.0}{2025-11-24}{removed}
14988 %\end{macro}
14989 %
14990 %\begin{macro}{\staticswitchoffnextoddonly}
14991 %\changes{1.14}{2012-11-10}{new}
14992 %\changes{2.0}{2025-11-24}{changed to document command}
14993 % Switch off the listed static frames for just the next odd page
14994 % \begin{macrocode}
14995 \NewDocumentCommand \staticswitchoffnextoddonly { s m }
14996 {
14997 \int_set:Nn \l__flowfram_tmpb_int
14998 { \g__flowfram_pagecounter_tl + \c_one_int }
14999 \int_if_odd:nF { \l__flowfram_tmpb_int }
15000 {
15001 \int_incr:N \l__flowfram_tmpb_int
15002 }
15003 \IfBooleanTF { #1 }
15004 {
15005 \clist_map_inline:nn { #2 }
15006 {
15007 \__flowfram_get_static_id:n { ##1 }
15008 \__flowfram_static_switch_off_next_odd_only:n { \l__flowfram_id_int }
15009 }
15010 }
15011 {
15012 \clist_map_inline:nn { #2 }
15013 {
15014 \__flowfram_static_switch_off_next_odd_only:n { ##1 }
15015 }
15016 }
15017 }
15018 % \end{macrocode}
15019 %\end{macro}
15020 %
15021 % \begin{macrocode}
15022 \cs_new:Nn \__flowfram_static_switch_off_next_odd_only:n
15023 {
15024 \tl_gput_right:Ne \g__flowfram_output_adjust_frames_tl
15025 {
15026 \exp_not:N \staticaddexclusion
15027 { \int_eval:n { #1 } }
15028 { \int_use:N \l__flowfram_tmpb_int }
15029 }
15030 }
15031 % \end{macrocode}
15032 %
15033 %\begin{macro}{\@sstaticswitchoffnextoddonly}
15034 % Version 2.0 removed \cs{@sstaticswitchoffnextoddonly}.
15035 %\changes{2.0}{2025-11-24}{removed}
15036 %\end{macro}
15037 %
15038 %\begin{macro}{\@staticswitchoffnextoddonly}
15039 % Version 2.0 removed \cs{@staticswitchoffnextoddonly}.
15040 %\changes{2.0}{2025-11-24}{removed}
15041 %\end{macro}
15042 %
15043 %\subsection{Static versions of floats}
15044 % Floats can not go in saved boxes or minipages, so define
15045 % static versions to go in static and \glspl{dynamic}.
15046 % These just set "\@captype" so that the "\caption"
15047 % command may be used.
15048 %Version 2.0 added paragraph breaks and ignore spaces.
15049 %\begin{environment}{statictable}
15050 % \begin{macrocode}
15051 \newenvironment{statictable}
15052 {\par\def\@captype{table}\ignorespaces}
15053 {\par\ignorespacesafterend}
15054 % \end{macrocode}
15055 %\end{environment}
15056 %\begin{environment}{staticfigure}
15057 % \begin{macrocode}
15058 \newenvironment{staticfigure}
15059 {\def\@captype{figure}\ignorespaces}
15060 {\par\ignorespacesafterend}
15061 % \end{macrocode}
15062 %\end{environment}
15063 %
15064 %\subsection{Standard Layouts}
15065 %\subsubsection{Column Styles}
15066 % Redefine "\twocolumn" and "\onecolumn" to set up \glspl{flow} from
15067 % the dimensions of the \gls{typeblock}. Ignore the optional argument.
15068 % The \gls{flow} height will be adjusted to make sure that it
15069 % is an integer multiple of "\baselineskip", unless
15070 % "\ffvajdustfalse" is used.
15071 % \begin{macrocode}
15072 \newif\ifffvadjust
15073 \ffvadjusttrue
15074 % \end{macrocode}
15075 %\begin{macro}{\onecolumn}
15076 % "\onecolumn" will make a single \gls{flow} that takes
15077 % up the entire area of the \gls{typeblock} (adjusted according
15078 % to "\ifffvadjust".) Frames should only be created in
15079 % the preamble, otherwise the next \gls{flow} may not
15080 % be detected by the output routine. The exception to this
15081 % is when the output routine can't find any more \glspl{flow}
15082 % to use, in which case it creates a single \gls{flow} using
15083 % "\__flowfram_one_column:n". Syntax: \cs{onecolumn}\oarg{pages},
15084 % where \meta{pages} is the \gls{pglist} for which the new
15085 % \gls{flow} is defined.
15086 %\changes{2.0}{2025-11-24}{changed to document command}
15087 % \begin{macrocode}
15088 \cs_set_eq:NN \__flowfram_org_onecolumn: \onecolumn
15089 \RenewDocumentCommand \onecolumn { O{all} o }
15090 {
15091 \__flowfram_only_preamble:Nn \onecolumn
15092 {
15093 \__flowfram_one_column:n { #1 }
15094 \IfValueT { #2 }
15095 {
15096 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #2 }
15097 }
15098 }
15099 }
15100 % \end{macrocode}
15101 %\end{macro}
15102 %\begin{macro}{\@onecolumn}
15103 % Version 2.0 replaced \cs{@onecolumn}
15104 %\changes{2.0}{2025-11-24}{replaced}
15105 % \begin{macrocode}
15106 \cs_new:Nn \__flowfram_one_column:n
15107 {
15108 \__flowfram_one_column_in_area:nnnnn
15109 { #1 } { \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
15110 }
15111 % \end{macrocode}
15112 %\end{macro}
15113 %\begin{macro}{\onecolumninarea}
15114 %\changes{2.0}{2025-11-24}{changed to document command}
15115 % "\onecolumn" is in fact a special case of "\onecolumninarea"
15116 % which sets up one \gls{flow} in the specified area, given
15117 % by bottom left corner (\meta{x}, \meta{y}),
15118 % relative to the \gls{typeblock}, with width \meta{w}
15119 % and height \meta{h}.
15120 % The only difference between "\onecolumninarea" and
15121 % explicitly creating the \gls{flow} using "\newflowframe"
15122 % is the "\onecolumninarea" will adjust the vertical height
15123 % the ensure it is a multiple of "\baselineskip". There
15124 % is also no starred version, so if you want a border, you
15125 % will need to set it explicitly using "\setflowframe".
15126 % Syntax:\newline
15127 % \cs{onecolumninarea}\oarg{pages}\marg{w}\marg{h}\marg{x}\marg{y}.
15128 % \begin{macrocode}
15129 \NewDocumentCommand \onecolumninarea { O { all } m m m m o }
15130 {
15131 \__flowfram_only_preamble:Nn \onecolumninarea
15132 {
15133 \__flowfram_one_column_in_area:nnnnn
15134 { #1 } { #2 } { #3 } { #4 } { #5 }
15135 \IfValueT { #6 }
15136 {
15137 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #6 }
15138 }
15139 }
15140 }
15141 % \end{macrocode}
15142 %\end{macro}
15143 %\begin{macro}{\@onecolumninarea}
15144 % Version 2.0 replaced \cs{@onecolumninarea}
15145 %\changes{2.0}{2025-11-24}{replaced}
15146 % \begin{macrocode}
15147 \cs_new:Nn \__flowfram_one_column_in_area:nnnnn
15148 {
15149 \dim_set:Nn \l__flowfram_height_dim { #3 }
15150 \ifffvadjust
15151 \adjustheight \l__flowfram_height_dim
15152 \fi
15153 \__flowfram_new_flow:nnnnn
15154 { #1 } { #2 } { \l__flowfram_height_dim } { #4 } { #5 }
15155 % \end{macrocode}
15156 %If \cs{onecolumn} is used in the document and the column associated
15157 %with that column hasn't yet been set, assume this is the one column to
15158 %use.
15159 % \begin{macrocode}
15160 \tl_if_empty:NT \g__flowfram_one_col_id_tl
15161 {
15162 \tl_gset:Ne \g__flowfram_one_col_id_tl { \int_use:N \c@maxflow }
15163 }
15164 }
15165 % \end{macrocode}
15166 %\end{macro}
15167 %\begin{macro}{\twocolumn}
15168 %\changes{2.0}{2025-11-24}{changed to document command}
15169 % Set up two \glspl{flow} parallel to each other
15170 % with a distance of "\columnsep" between them, to
15171 % fill the entire \gls{typeblock} (although the frames may
15172 % end up marginally shorter than "\typeblockheight" after
15173 % they have been adjusted.) Again, these commands may only
15174 % be used in the preamble. Note that unlike the standard
15175 % "\twocolumn" command, this one has an optional argument
15176 % that indicates which pages the two \glspl{flow} should
15177 % appear on. Syntax: \cs{twocolumn}\oarg{pages}.
15178 % \begin{macrocode}
15179 \cs_set_eq:NN \__flowfram_org_twocolumn: \twocolumn
15180 \RenewDocumentCommand \twocolumn { O { all } o }
15181 {
15182 \__flowfram_only_preamble:Nn \twocolumn
15183 {
15184 \__flowfram_two_columns:n { #1 }
15185 \IfValueT { #2 }
15186 {
15187 \clist_set:Ne \l__flowfram_tmp_clist { #2 }
15188 \int_compare:nNnTF
15189 { \clist_count:N \l__flowfram_tmp_clist } = { 2 }
15190 {
15191 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow }
15192 { \clist_item:Nn \l__flowfram_tmp_clist { 2 } }
15193 \__flowfram_set_frame_id:nnn { flow }
15194 { \int_eval:n { \c@maxflow - \c_one_int } }
15195 { \clist_item:Nn \l__flowfram_tmp_clist { 1 } }
15196 }
15197 {
15198 % \end{macrocode}
15199 %If only one label provided just set the last frame for backward
15200 %compatibility.
15201 % \begin{macrocode}
15202 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #2 }
15203 }
15204 }
15205 }
15206 }
15207 % \end{macrocode}
15208 %\end{macro}
15209 %\begin{macro}{\@twocolumn}
15210 % Version 2.0 removed \cs{@twocolumn}
15211 %\changes{2.0}{2025-11-24}{removed}
15212 % \begin{macrocode}
15213 \cs_new:Nn \__flowfram_two_columns:n
15214 {
15215 \__flowfram_two_columns_in_area:nnnnn
15216 { #1 } { \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
15217 }
15218 % \end{macrocode}
15219 %\end{macro}
15220 %\begin{macro}{\twocolumninarea}
15221 % Again, "\twocolumn" is actually a special case of
15222 % "\twocolumninarea". The final optional argument
15223 % is the label of the final frame. This is added for
15224 % backward-compatibility where a knock-on effect of the final
15225 % command being \cs{newflowframe} meant that a following "[" would
15226 % be interpreted as an optional argument specifying its label.
15227 % Syntax:\newline
15228 % \cs{twocolumninarea}\oarg{pages}\marg{w}\marg{h}\marg{x}\marg{y}.
15229 %\changes{2.0}{2025-11-24}{changed to document command}
15230 % \begin{macrocode}
15231 \NewDocumentCommand \twocolumninarea { O{all} m m m m o }
15232 {
15233 \__flowfram_only_preamble:Nn \twocolumninarea
15234 {
15235 \__flowfram_two_columns_in_area:nnnnn
15236 { #1 } { #2 } { #3 } { #4 } { #5 }
15237 \IfValueT { #6 }
15238 {
15239 \clist_set:Ne \l__flowfram_tmp_clist { #6 }
15240 \int_compare:nNnTF
15241 { \clist_count:N \l__flowfram_tmp_clist } = { 2 }
15242 {
15243 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow }
15244 { \clist_item:Nn \l__flowfram_tmp_clist { 2 } }
15245 \__flowfram_set_frame_id:nnn { flow }
15246 { \int_eval:n { \c@maxflow - \c_one_int } }
15247 { \clist_item:Nn \l__flowfram_tmp_clist { 1 } }
15248 }
15249 {
15250 % \end{macrocode}
15251 %If only one label provided just set the last frame for backward
15252 %compatibility.
15253 % \begin{macrocode}
15254 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #6 }
15255 }
15256 }
15257 }
15258 }
15259 % \end{macrocode}
15260 %\end{macro}
15261 %\begin{macro}{\@twocolumninarea}
15262 % Version 2.0 replaced \cs{@twocolumninarea}
15263 %\changes{2.0}{2025-11-24}{replaced}
15264 % \begin{macrocode}
15265 \cs_new:Nn \__flowfram_two_columns_in_area:nnnnn
15266 {
15267 \dim_set:Nn \l__flowfram_height_dim { #3 }
15268 \ifffvadjust
15269 \adjustheight \l__flowfram_height_dim
15270 \fi
15271 \dim_set:Nn \l__flowfram_width_dim { ( #2 - \columnsep ) / 2 }
15272 \dim_set:Nn \l__flowfram_x_dim
15273 {
15274 #4 + \l__flowfram_width_dim + \columnsep
15275 }
15276 \iflefttorightcolumns
15277 \__flowfram_new_flow:nnnnn
15278 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim } { #4 } { #5 }
15279 \setflowframe{\c@maxflow}{margin=left}%
15280 \else
15281 \__flowfram_new_flow:nnnnn
15282 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim }
15283 { \l__flowfram_x_dim } { #5 }
15284 \setflowframe{\c@maxflow}{margin=right}%
15285 \fi
15286 \iflefttorightcolumns
15287 \__flowfram_new_flow:nnnnn
15288 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim }
15289 { \l__flowfram_x_dim } { #5 }
15290 \setflowframe{\c@maxflow}{margin=right}%
15291 \else
15292 \__flowfram_new_flow:nnnnn
15293 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim }
15294 { #4 } { #5 }
15295 \setflowframe{\c@maxflow}{margin=left}%
15296 \fi
15297 % \end{macrocode}
15298 %If \cs{twocolumn} is used in the document and
15299 %\verb|\flowfram_set_two_col:|
15300 %still has its initial definition, assume this is the two column to
15301 %use. (Note there's no header frame in this case.)
15302 % \begin{macrocode}
15303 \cs_if_eq:NNT
15304 \flowfram_set_two_col:
15305 \__flowfram_set_two_col_warning:
15306 {
15307 \cs_set:Ne \flowfram_set_two_col:
15308 {
15309 \exp_not:N \setallflowframes{pages=none}
15310 \exp_not:N \__flowfram_set_flow_by_idn:nn
15311 { \int_eval:n { \c@maxflow - \c_one_int } } { pages=all }
15312 \exp_not:N \__flowfram_set_flow_by_idn:nn
15313 { \int_use:N \c@maxflow } { pages=all }
15314 }
15315 }
15316 % \end{macrocode}
15317 %If \cs{twocolumn} is used in the document and the associated
15318 %columns haven't yet been set, assume these are the columns to
15319 %use.
15320 % \begin{macrocode}
15321 \bool_lazy_and:nnT
15322 {
15323 \tl_if_empty_p:N \g__flowfram_two_col_i_id_tl
15324 }
15325 {
15326 \tl_if_empty_p:N \g__flowfram_two_col_ii_id_tl
15327 }
15328 {
15329 \tl_gset:Ne \g__flowfram_two_col_i_id_tl
15330 {
15331 \int_eval:n { \c@maxflow - \c_one_int }
15332 }
15333 \tl_gset:Ne \g__flowfram_two_col_ii_id_tl { \int_use:N \c@maxflow }
15334 }
15335 }
15336 % \end{macrocode}
15337 %\end{macro}
15338 %\begin{macro}{\Ncolumn}
15339 % Again for an arbitrary number of columns (\meta{n}). Syntax:
15340 % \cs{Ncolumn}\oarg{pages}\marg{n}.
15341 %\changes{2.0}{2025-11-24}{changed to document command}
15342 % \begin{macrocode}
15343 \NewDocumentCommand \Ncolumn { O{ all } m o }
15344 {
15345 \__flowfram_only_preamble:Nn \Ncolumn
15346 {
15347 \Ncolumninarea
15348 [ #1 ] { #2 } { \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
15349 \IfValueT { #3 }
15350 {
15351 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #3 }
15352 }
15353 }
15354 }
15355 % \end{macrocode}
15356 %\end{macro}
15357 %\begin{macro}{\Ncolumninarea}
15358 % Check the number of \glspl{flow} requested, and do one
15359 % of the special cases if available.
15360 % Syntax:\newline
15361 % \cs{Ncolumninarea}\oarg{pages}\marg{n}\marg{w}\marg{h}\marg{x}\marg{y}.
15362 %\changes{2.0}{2025-11-24}{changed to document command}
15363 % \begin{macrocode}
15364 \NewDocumentCommand \Ncolumninarea { O { all } m m m m m o }
15365 {
15366 \__flowfram_only_preamble:Nn \Ncolumninarea
15367 {
15368 \int_case:nnF { #2 }
15369 {
15370 { \c_one_int }
15371 {
15372 \__flowfram_one_column_in_area:nnnnn
15373 { #1 } { #3 } { #4 } { #5 } { #6 }
15374 }
15375 { 2 }
15376 {
15377 \__flowfram_two_columns_in_area:nnnnn
15378 { #1 } { #3 } { #4 } { #5 } { #6 }
15379 }
15380 }
15381 {
15382 \int_compare:nNnTF { #2 } < { \c_one_int }
15383 {
15384 \msg_error:nnne { flowfram } { invalid-num-frames }
15385 { flow } { \int_eval:n { #2 } }
15386 }
15387 {
15388 \__flowfram_n_columns_in_area:nnnnnn
15389 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 }
15390 }
15391 }
15392 \IfValueT { #7 }
15393 {
15394 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #7 }
15395 }
15396 }
15397 }
15398 % \end{macrocode}
15399 %\end{macro}
15400 %\begin{macro}{\@Ncolumninarea}
15401 % Set up \meta{n} columns in the area specified.
15402 % There is a horizontal distance of "\columnsep"
15403 % between them all.
15404 %Version 2.0 replaced \cs{@Ncolumninarea}.
15405 %\changes{2.0}{2025-11-24}{replaced}
15406 % \begin{macrocode}
15407 \cs_new:Nn \__flowfram_n_columns_in_area:nnnnnn
15408 {
15409 \int_set:Nn \l__flowfram_col_int { #2 - \c_one_int }
15410 \dim_set:Nn \l__flowfram_width_dim
15411 {
15412 ( #3 - \l__flowfram_col_int \columnsep ) / ( #2 )
15413 }
15414 \dim_set:Nn \l__flowfram_x_dim { #5 }
15415 \iflefttorightcolumns
15416 \else
15417 \dim_add:Nn \l__flowfram_x_dim { #3 - \l__flowfram_width_dim }
15418 \fi
15419 \dim_set:Nn \l__flowfram_height_dim { #4 }
15420 \ifffvadjust
15421 \adjustheight \l__flowfram_height_dim
15422 \fi
15423 \int_step_inline:nn { #2 }
15424 {
15425 \__flowfram_new_flow:nnnnn
15426 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim }
15427 { \l__flowfram_x_dim } { #6 }
15428 \iflefttorightcolumns
15429 \dim_add:Nn \l__flowfram_x_dim { \l__flowfram_width_dim + \columnsep }
15430 \else
15431 \dim_add:Nn \l__flowfram_x_dim { - \l__flowfram_width_dim - \columnsep }
15432 \fi
15433 }
15434 }
15435 % \end{macrocode}
15436 %\end{macro}
15437 %
15438 % Set up something similar but have another frame (of type
15439 % \meta{type}) at the top of the other frames.
15440 %\begin{macro}{\vcolumnsep}
15441 % The vertical distance between the top frames and column flow
15442 % frames when created using "\Ncolumntop" etc is given by:
15443 % \begin{macrocode}
15444 \newlength{\vcolumnsep}
15445 \setlength{\vcolumnsep}{\columnsep}
15446 % \end{macrocode}
15447 %\end{macro}
15448 %\begin{macro}{\onecolumntop}
15449 % "\onecolumntop" makes one \gls{flow}, and one \meta{type}
15450 % frame in the area specified, where the \meta{type} frame is
15451 % \meta{H} high.
15452 % The distance between the top frame and the column \gls{flow}
15453 % will be approximately "\vcolumnsep". (The height of \gls{flow}
15454 % may be adjusted to make it an integer multiple of
15455 % "\baselineskip".)
15456 %
15457 % First the special case where the area is the \gls{typeblock}.
15458 % Syntax:\newline
15459 % \cs{onecolumntop}\oarg{pages}\marg{type}\marg{H}
15460 %\changes{2.0}{2025-11-24}{changed to document command}
15461 % \begin{macrocode}
15462 \NewDocumentCommand \onecolumntop { O{all} m m o }
15463 {
15464 \__flowfram_only_preamble:Nn \onecolumntop
15465 {
15466 \__flowfram_one_column_with_top_in_area:nnnnnnn
15467 { #1 } { #2 } { #3 }{ \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
15468 \IfValueT { #4 }
15469 {
15470 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #4 }
15471 }
15472 }
15473 }
15474 % \end{macrocode}
15475 %\end{macro}
15476 %\begin{macro}{\onecolumnStop}
15477 % Special case for \gls{static}.
15478 % Syntax: \cs{onecolumnStop}\oarg{pages}\marg{H}
15479 %\changes{2.0}{2025-11-24}{changed to document command}
15480 % \begin{macrocode}
15481 \NewDocumentCommand \onecolumnStop { O {all } m o }
15482 {
15483 \__flowfram_only_preamble:Nn \onecolumnStop
15484 {
15485 \__flowfram_one_column_with_top_in_area:nnnnnnn
15486 { #1 } { static } { #2 } { \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
15487 \IfValueT { #3 }
15488 {
15489 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #3 }
15490 }
15491 }
15492 }
15493 % \end{macrocode}
15494 %\end{macro}
15495 %\begin{macro}{\onecolumnDtop}
15496 % Special case for \gls{dynamic}.
15497 % Syntax: \cs{onecolumnDtop}\oarg{pages}\marg{H}
15498 %\changes{2.0}{2025-11-24}{changed to document command}
15499 % \begin{macrocode}
15500 \NewDocumentCommand \onecolumnDtop { O { all } m o }
15501 {
15502 \__flowfram_only_preamble:Nn \onecolumnDtop
15503 {
15504 \__flowfram_one_column_with_top_in_area:nnnnnnn
15505 { #1 } { dynamic } { #2 } { \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
15506 \IfValueT { #3 }
15507 {
15508 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #3 }
15509 }
15510 }
15511 }
15512 % \end{macrocode}
15513 %\end{macro}
15514 %\begin{macro}{\newframe}
15515 % Create a frame of given type.
15516 % Syntax:\newline
15517 % \cs{newframe}\oarg{pages}\marg{type}\marg{w}\marg{h}\marg{x}\marg{y}\oarg{label}.
15518 %\changes{2.0}{2025-11-24}{changed to document command}
15519 % \begin{macrocode}
15520 \NewDocumentCommand \newframe { s O{all} m m m m m o }
15521 {
15522 \__flowfram_only_preamble:Nn \newframe
15523 {
15524 \cs_if_exist:cTF
15525 { __flowfram_new_ #3 :nnnnnn }
15526 {
15527 \IfValueTF { #8 }
15528 {
15529 \use:c { __flowfram_new_ #3 :nnnnnn }
15530 { #2 } { #4 } { #5 } { #6 } { #7 } { #8 }
15531 }
15532 {
15533 \use:c { __flowfram_new_ #3 :nnnnnn }
15534 { #2 } { #4 } { #5 } { #6 } { #7 } { \int_use:c { c@max #3 } }
15535 }
15536 \IfBooleanT { #1 }
15537 {
15538 % \end{macrocode}
15539 %\changes{2.1}{2026-02-23}{corrected function name}
15540 % \begin{macrocode}
15541 \flowfram_frame_set_bool_true:nnn
15542 { #3 } { hasframe } { \value { max #3 } }
15543 }
15544 }
15545 {
15546 \msg_error:nne { flowfram } { invalid-frame-type } { #3 }
15547 }
15548 }
15549 }
15550 % \end{macrocode}
15551 %\end{macro}
15552 %\begin{macro}{\onecolumntopinarea}
15553 % Now for a specified area.
15554 % Syntax:\newline
15555 % \cs{onecolumntopinarea}\oarg{pages}\marg{type}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}.
15556 %\changes{2.0}{2025-11-24}{changed to document command}
15557 % \begin{macrocode}
15558 \NewDocumentCommand \onecolumntopinarea { O{all} m m m m m m o }
15559 {
15560 \__flowfram_only_preamble:Nn \onecolumntopinarea
15561 {
15562 \__flowfram_one_column_with_top_in_area:nnnnnnn
15563 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 }
15564 \IfValueT { #8 }
15565 {
15566 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #8 }
15567 }
15568 }
15569 }
15570 % \end{macrocode}
15571 %\end{macro}
15572 %
15573 % \begin{macrocode}
15574 \cs_new:Nn \__flowfram_one_column_with_top_in_area:nnnnnnn
15575 {
15576 \dim_set:Nn \l__flowfram_sfdf_height_dim { #3 }
15577 \dim_set:Nn \l__flowfram_y_dim
15578 { #5 - \l__flowfram_sfdf_height_dim }
15579 \dim_set:Nn \l__flowfram_height_dim
15580 { \l__flowfram_y_dim - \vcolumnsep }
15581 \dim_add:Nn \l__flowfram_y_dim { #7 }
15582 \newframe
15583 [ #1 ] { #2 }
15584 { #4 } { \l__flowfram_sfdf_height_dim }
15585 { #6 } { \l__flowfram_y_dim }
15586 \ifffvadjust
15587 \adjustheight \l__flowfram_height_dim
15588 \fi
15589 \__flowfram_new_flow:nnnnn
15590 { #1 } { #4 } { \l__flowfram_height_dim } { #6 } { #7 }
15591 }
15592 % \end{macrocode}
15593 %\begin{macro}{\onecolumnStopinarea}
15594 % Special case for \gls{static}.
15595 % Syntax:\newline
15596 % \cs{onecolumnStopinarea}\oarg{pages}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}.
15597 %\changes{2.0}{2025-11-24}{changed to document command}
15598 % \begin{macrocode}
15599 \NewDocumentCommand \onecolumnStopinarea { O{all} m m m m m o }
15600 {
15601 \__flowfram_only_preamble:Nn \onecolumnStopinarea
15602 {
15603 \__flowfram_one_column_with_top_in_area:nnnnnnn
15604 { #1 } { static } { #2 } { #3 } { #4 } { #5 } { #6 }
15605 \IfValueT { #7 }
15606 {
15607 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #7 }
15608 }
15609 }
15610 }
15611 % \end{macrocode}
15612 %\end{macro}
15613 %\begin{macro}{\onecolumnDtopinarea}
15614 % Special case for \gls{dynamic}.
15615 % Syntax:\newline
15616 % \cs{onecolumnDtopinarea}\oarg{pages}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}.
15617 %\changes{2.0}{2025-11-24}{changed to document command}
15618 % \begin{macrocode}
15619 \NewDocumentCommand \onecolumnDtopinarea { O{all} m m m m m o }
15620 {
15621 \__flowfram_only_preamble:Nn \onecolumnStopinarea
15622 {
15623 \__flowfram_one_column_with_top_in_area:nnnnnnn
15624 { #1 } { dynamic } { #2 } { #3 } { #4 } { #5 } { #6 }
15625 \IfValueT { #7 }
15626 {
15627 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #7 }
15628 }
15629 }
15630 }
15631 % \end{macrocode}
15632 %\end{macro}
15633 %\begin{macro}{\twocolumntop}
15634 %\changes{2.0}{2025-11-24}{changed to document command}
15635 % Now for two \glspl{flow}, with a single \meta{type} frame
15636 % above both of them.
15637 % Syntax:\newline
15638 % \cs{twocolumntop}\oarg{pages}\marg{type}\marg{H}
15639 %
15640 % First the special case where the area is the entire
15641 % \gls{typeblock}:
15642 % \begin{macrocode}
15643 \NewDocumentCommand \twocolumntop { O{all} m m o }
15644 {
15645 \__flowfram_only_preamble:Nn \twocolumntop
15646 {
15647 \__flowfram_two_column_top_in_area:nnnnnnn
15648 { #1 } { #2 } { #3 } { \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
15649 \IfValueT { #4 }
15650 {
15651 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #4 }
15652 }
15653 }
15654 }
15655 % \end{macrocode}
15656 %\end{macro}
15657 %\begin{macro}{\twocolumnStop}
15658 % Special case for \gls{static}.
15659 %\changes{2.0}{2025-11-24}{changed to document command}
15660 % \begin{macrocode}
15661 \NewDocumentCommand \twocolumnStop { O{all} m o }
15662 {
15663 \__flowfram_only_preamble:Nn \twocolumnStop
15664 {
15665 \__flowfram_two_column_with_top_in_area:nnnnnnn
15666 { #1 } { static }{ #2 } { \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
15667 \IfValueT { #3 }
15668 {
15669 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #3 }
15670 }
15671 }
15672 }
15673 % \end{macrocode}
15674 %\end{macro}
15675 %\begin{macro}{\twocolumnDtop}
15676 %\changes{2.0}{2025-11-24}{changed to document command}
15677 % Special case for \gls{dynamic}.
15678 % \begin{macrocode}
15679 \NewDocumentCommand \twocolumnDtop { O{all} m o }
15680 {
15681 \__flowfram_only_preamble:Nn \twocolumnDtop
15682 {
15683 \__flowfram_two_column_with_top_in_area:nnnnnnn
15684 { #1 } { dynamic }{ #2 } { \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
15685 \IfValueT { #3 }
15686 {
15687 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #3 }
15688 }
15689 }
15690 }
15691 % \end{macrocode}
15692 %\end{macro}
15693 %
15694 % Now for a general area.
15695 %\begin{macro}{\twocolumntopinarea}
15696 % Syntax:\newline
15697 % \cs{twocolumntopinarea}\oarg{pages}\marg{type}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}.
15698 %\changes{2.0}{2025-11-24}{changed to document command}
15699 % \begin{macrocode}
15700 \NewDocumentCommand \twocolumntopinarea { O{all} m m m m m m o }
15701 {
15702 \__flowfram_only_preamble:Nn \twocolumntopinarea
15703 {
15704 \__flowfram_two_column_with_top_in_area:nnnnnnn
15705 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 }
15706 \IfValueT { #8 }
15707 {
15708 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #8 }
15709 }
15710 }
15711 }
15712 % \end{macrocode}
15713 %\end{macro}
15714 %\begin{macro}{\@twocolumntopinarea}
15715 % Version 2.0 replaced \cs{@twocolumntopinarea}
15716 %\changes{2.0}{2025-11-24}{replaced}
15717 %Syntax: \marg{pages}\marg{type}\marg{top
15718 %height}\marg{area-width}\marg{area-height}\marg{area-x}\marg{area-y}
15719 % \begin{macrocode}
15720 \cs_new:Nn \__flowfram_two_column_with_top_in_area:nnnnnnn
15721 {
15722 \dim_set:Nn \l__flowfram_sfdf_height_dim { #3 }
15723 % \end{macrocode}
15724 % Work out where to put the header frame.
15725 % \begin{macrocode}
15726 \dim_set:Nn \l__flowfram_y_dim
15727 { #5 - \l__flowfram_sfdf_height_dim }
15728 \dim_set:Nn \l__flowfram_height_dim
15729 { \l__flowfram_y_dim }
15730 \dim_add:Nn \l__flowfram_y_dim { #7 }
15731 \newframe
15732 [ #1 ] { #2 }
15733 { #4 } { \l__flowfram_sfdf_height_dim }
15734 { #6 } { \l__flowfram_y_dim }
15735 % \end{macrocode}
15736 %If \cs{twocolumn} is used in the document with its optional
15737 %argument and the associated frames haven't yet been set, assume
15738 %this is the header frame to use.
15739 % \begin{macrocode}
15740 \tl_if_empty:NT \g__flowfram_two_col_header_id_tl
15741 {
15742 \bool_lazy_and:nnT
15743 {
15744 \tl_if_empty_p:N \g__flowfram_headed_two_col_i_id_tl
15745 }
15746 {
15747 \tl_if_empty_p:N \g__flowfram_headed_two_col_ii_id_tl
15748 }
15749 {
15750 \tl_gset:Ne \g__flowfram_two_col_header_type_tl { #2 }
15751 \tl_gset:Ne \g__flowfram_two_col_header_id_tl
15752 {
15753 \int_use:c { c@max #2 }
15754 }
15755 }
15756 }
15757 % \end{macrocode}
15758 % work out height of the flow frames
15759 % \begin{macrocode}
15760 \dim_sub:Nn \l__flowfram_height_dim { \vcolumnsep }
15761 \ifffvadjust
15762 \adjustheight { \l__flowfram_height_dim }
15763 \fi
15764 % \end{macrocode}
15765 % work out the widths of the flow frames
15766 % \begin{macrocode}
15767 \dim_set:Nn \l__flowfram_width_dim
15768 { ( #4 - \columnsep ) / 2 }
15769 % \end{macrocode}
15770 % work out the offset of the right column
15771 % \begin{macrocode}
15772 \dim_set:Nn \l__flowfram_x_dim
15773 { \l__flowfram_width_dim + \columnsep + #6 }
15774 \iflefttorightcolumns
15775 \__flowfram_new_flow:nnnnn
15776 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim } { #6 } { #7 }
15777 \setflowframe { \c@maxflow } { margin = left }
15778 \__flowfram_new_flow:nnnnn
15779 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim } { \l__flowfram_x_dim } { #7 }
15780 \setflowframe { \c@maxflow } { margin = right }
15781 \else
15782 \__flowfram_new_flow:nnnnn
15783 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim } { \l__flowfram_x_dim } { #7 }
15784 \setflowframe { \c@maxflow } { margin = right }
15785 \__flowfram_new_flow:nnnnn
15786 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim } { #6 } { #7 }
15787 \setflowframe { \c@maxflow } { margin = left }
15788 \fi
15789 % \end{macrocode}
15790 %If \cs{twocolumn} is used in the document with its optional
15791 %argument and the associated frames haven't yet been set, assume these are the columns to
15792 %use.
15793 % \begin{macrocode}
15794 \bool_lazy_and:nnT
15795 {
15796 \tl_if_empty_p:N \g__flowfram_headed_two_col_i_id_tl
15797 }
15798 {
15799 \tl_if_empty_p:N \g__flowfram_headed_two_col_ii_id_tl
15800 }
15801 {
15802 \tl_gset:Ne \g__flowfram_headed_two_col_i_id_tl
15803 {
15804 \int_eval:n { \c@maxflow - \c_one_int }
15805 }
15806 \tl_gset:Ne \g__flowfram_headed_two_col_ii_id_tl { \int_use:N \c@maxflow }
15807 }
15808 }
15809 % \end{macrocode}
15810 %\end{macro}
15811 %\begin{macro}{\twocolumnStopinarea}
15812 % Special case for \gls{static}.
15813 %\changes{2.0}{2025-11-24}{changed to document command}
15814 % \begin{macrocode}
15815 \NewDocumentCommand \twocolumnStopinarea { O{all} m m m m m o }
15816 {
15817 \__flowfram_only_preamble:Nn \twocolumnStopinarea
15818 {
15819 \__flowfram_two_column_with_top_in_area:nnnnnnn
15820 { #1 } { static } { #2 } { #3 } { #4 } { #5 } { #6 }
15821 \IfValueT { #7 }
15822 {
15823 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #7 }
15824 }
15825 }
15826 }
15827 % \end{macrocode}
15828 %\end{macro}
15829 %\begin{macro}{\twocolumnDtopinarea}
15830 % Special case for \gls{dynamic}.
15831 %\changes{2.0}{2025-11-24}{changed to document command}
15832 % \begin{macrocode}
15833 \NewDocumentCommand \twocolumnDtopinarea { O{all} m m m m m o }
15834 {
15835 \__flowfram_only_preamble:Nn \twocolumnStopinarea
15836 {
15837 \__flowfram_two_column_with_top_in_area:nnnnnnn
15838 { #1 } { dynamic } { #2 } { #3 } { #4 } { #5 } { #6 }
15839 \IfValueT { #7 }
15840 {
15841 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #7 }
15842 }
15843 }
15844 }
15845 % \end{macrocode}
15846 %\end{macro}
15847 %\begin{macro}{\Ncolumntop}
15848 % Similarly for an arbitrary number of \glspl{flow}.
15849 % Special case where the area is the \gls{typeblock}.
15850 %
15851 % Syntax:\newline
15852 % \cs{Ncolumntop}\oarg{pages}\marg{type}\marg{n}\marg{H}
15853 %\changes{2.0}{2025-11-24}{changed to document command}
15854 % \begin{macrocode}
15855 \NewDocumentCommand \Ncolumntop { O{all} m m m o }
15856 {
15857 \__flowfram_only_preamble:Nn \Ncolumntop
15858 {
15859 \__flowfram_n_column_with_top_in_area:nnnnnnnn
15860 { #1 } { #2 } { #3 } { #4 }
15861 { \typeblockwidth } { \typeblockheight } { \c_zero_dim } { \c_zero_dim }
15862 \IfValueT { #5 }
15863 {
15864 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #5 }
15865 }
15866 }
15867 }
15868 % \end{macrocode}
15869 %\end{macro}
15870 %\begin{macro}{\NcolumnStop}
15871 % Special case for \gls{static}.
15872 %\changes{2.0}{2025-11-24}{changed to document command}
15873 % \begin{macrocode}
15874 \NewDocumentCommand \NcolumnStop { O{all} m m o }
15875 {
15876 \__flowfram_only_preamble:Nn \NcolumnStop
15877 {
15878 \__flowfram_n_column_with_top_in_area:nnnnnnnn
15879 { #1 } { static} { #2 } { #3 }
15880 { \typeblockwidth } { \typeblockheight } { \c_zero_dim } { \c_zero_dim }
15881 \IfValueT { #4 }
15882 {
15883 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #4 }
15884 }
15885 }
15886 }
15887 % \end{macrocode}
15888 %\end{macro}
15889 %\begin{macro}{\NcolumnDtop}
15890 % Special case for \gls{dynamic}.
15891 %\changes{2.0}{2025-11-24}{changed to document command}
15892 % \begin{macrocode}
15893 \NewDocumentCommand \NcolumnDtop { O{all} m m o }
15894 {
15895 \__flowfram_only_preamble:Nn \NcolumnDtop
15896 {
15897 \__flowfram_n_column_with_top_in_area:nnnnnnnn
15898 { #1 } { dynamic} { #2 } { #3 }
15899 { \typeblockwidth } { \typeblockheight } { \c_zero_dim } { \c_zero_dim }
15900 \IfValueT { #4 }
15901 {
15902 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #4 }
15903 }
15904 }
15905 }
15906 % \end{macrocode}
15907 %\end{macro}
15908 %\begin{macro}{\Ncolumntopinarea}
15909 % Again test to make sure the user requested a sensible
15910 % number.
15911 %\changes{2.0}{2025-11-24}{changed to document command}
15912 % \cs{Ncolumntopinarea}\oarg{pages}\marg{type}\marg{n}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}
15913 % \begin{macrocode}
15914 \NewDocumentCommand \Ncolumntopinarea { O{all} m m m m m m m o }
15915 {
15916 \__flowfram_only_preamble:Nn \Ncolumntopinarea
15917 {
15918 \__flowfram_n_column_with_top_in_area:nnnnnnnn
15919 { #1 } { #2 } { #4 } { #5 } { #6 } { #7 } { #8 }
15920 \IfValueT { #9 }
15921 {
15922 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #9 }
15923 }
15924 }
15925 }
15926 % \end{macrocode}
15927 %
15928 %\marg{pages}\marg{type}\marg{n}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}
15929 % \begin{macrocode}
15930 \cs_new:Nn \__flowfram_n_column_with_top_in_area:nnnnnnnn
15931 {
15932 \int_case:nnF { #3 }
15933 {
15934 { \c_one_int }
15935 {
15936 \__flowfram_one_column_with_top_in_area:nnnnnnn
15937 { #1 } { #2 } { #4 } { #5 } { #6 } { #7 } { #8 }
15938 }
15939 { 2 }
15940 {
15941 \__flowfram_two_column_with_top_in_area:nnnnnnn
15942 { #1 } { #2 } { #4 } { #5 } { #6 } { #7 } { #8 }
15943 }
15944 }
15945 {
15946 \int_compare:nNnTF { #3 } < { \c_one_int }
15947 {
15948 \msg_error:nnne { flowfram } { invalid-num-frames }
15949 { flow } { \int_eval:n { #3 } }
15950 }
15951 {
15952 \__flowfram_N_column_with_top_in_area:nnnnnnnn
15953 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 } { #8 }
15954 }
15955 }
15956 }
15957 % \end{macrocode}
15958 %\end{macro}
15959 %\begin{macro}{\@Ncolumntopinarea}
15960 % Fit the frames into specified area.
15961 % \marg{pages}\marg{type}\marg{n}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}.
15962 % Version 2.0 replaced \cs{@Ncolumntopinarea}.
15963 %\changes{2.0}{2025-11-24}{replaced}
15964 % \begin{macrocode}
15965 \cs_new:Nn \__flowfram_N_column_with_top_in_area:nnnnnnnn
15966 {
15967 \dim_set:Nn \l__flowfram_sfdf_height_dim { #4 }
15968 % \end{macrocode}
15969 % Work out where to put the static frame.
15970 % \begin{macrocode}
15971 \dim_set:Nn \l__flowfram_y_dim
15972 { #6 - \l__flowfram_sfdf_height_dim }
15973 \dim_set_eq:NN \l__flowfram_height_dim \l__flowfram_y_dim
15974 \dim_add:Nn \l__flowfram_y_dim { #8 }
15975 \newframe
15976 [ #1 ] { #2 }
15977 { #5 } { \l__flowfram_sfdf_height_dim }
15978 { #7 } { \l__flowfram_y_dim }
15979 % \end{macrocode}
15980 % work out height of the flow frames
15981 % \begin{macrocode}
15982 \dim_sub:Nn \l__flowfram_height_dim { \vcolumnsep }
15983 % \end{macrocode}
15984 % adjust the flow frame height so that it is a multiple of
15985 % \cs{baselineskip}
15986 % \begin{macrocode}
15987 \ifffvadjust
15988 \adjustheight{\l__flowfram_height_dim}%
15989 \fi
15990 % \end{macrocode}
15991 % work out the widths of the flow frames
15992 % \begin{macrocode}
15993 \int_set:Nn \l__flowfram_col_int { #3 - \c_one_int }
15994 \dim_set:Nn \l__flowfram_width_dim
15995 { ( #5 -\l__flowfram_col_int \columnsep ) / ( #3 ) }
15996 % \end{macrocode}
15997 % Set the $x$ position of the first frame
15998 % \begin{macrocode}
15999 \dim_set:Nn \l__flowfram_x_dim { #7 }
16000 \iflefttorightcolumns
16001 \else
16002 \dim_add:Nn \l__flowfram_x_dim { #5 - \l__flowfram_width_dim }
16003 \fi
16004 \int_step_inline:nn { #3 }
16005 {
16006 \__flowfram_new_flow:nnnnn
16007 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim }
16008 { \l__flowfram_x_dim } { #8 }
16009 % \end{macrocode}
16010 % work out the offset for the next column
16011 % \begin{macrocode}
16012 \iflefttorightcolumns
16013 \dim_add:Nn \l__flowfram_x_dim { \l__flowfram_width_dim + \columnsep }
16014 \else
16015 \dim_add:Nn \l__flowfram_x_dim { - \l__flowfram_width_dim - \columnsep }
16016 \fi
16017 }
16018 }
16019 % \end{macrocode}
16020 %\end{macro}
16021 %\begin{macro}{\NcolumnStopinarea}
16022 % Specific case for \gls{static}.
16023 %\changes{2.0}{2025-11-24}{changed to document command}
16024 % \marg{pages}\marg{n}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}.
16025 % \begin{macrocode}
16026 \NewDocumentCommand \NcolumnStopinarea { O{all} m m m m m m o }
16027 {
16028 \__flowfram_only_preamble:Nn \NcolumnStopinarea
16029 {
16030 \__flowfram_n_column_with_top_in_area:nnnnnnnn
16031 { #1 } { static } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 }
16032 \IfValueT { #8 }
16033 {
16034 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #8 }
16035 }
16036 }
16037 }
16038 % \end{macrocode}
16039 %\end{macro}
16040 %\begin{macro}{\NcolumnDtopinarea}
16041 % Specific case for \gls{dynamic}.
16042 %\changes{2.0}{2025-11-24}{changed to document command}
16043 % \begin{macrocode}
16044 \NewDocumentCommand \NcolumnDtopinarea { O{all} m m m m m m o }
16045 {
16046 \__flowfram_only_preamble:Nn \NcolumnDtopinarea
16047 {
16048 \__flowfram_n_column_with_top_in_area:nnnnnnnn
16049 { #1 } { dynamic } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 }
16050 \IfValueT { #8 }
16051 {
16052 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #8 }
16053 }
16054 }
16055 }
16056 % \end{macrocode}
16057 %\end{macro}
16058 % Now the same kind of thing but with the \meta{type} frame at the
16059 % bottom. Firstly, a single \gls{flow} with a \meta{type}
16060 % frame below it.
16061 %
16062 %\begin{macro}{\onecolumnbottom}
16063 % Syntax:\newline
16064 % \cs{onecolumnbottom}\oarg{pages}\marg{type}\marg{H}
16065 %\changes{2.0}{2025-11-24}{changed to document command}
16066 % \begin{macrocode}
16067 \NewDocumentCommand \onecolumnbottom { O{all} m m o }
16068 {
16069 \__flowfram_only_preamble:Nn \onecolumnbottom
16070 {
16071 \__flowfram_one_column_with_bottom_in_area:nnnnnnn
16072 { #1 } { #2 } { #3 }
16073 { \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
16074 \IfValueT { #4 }
16075 {
16076 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #4 }
16077 }
16078 }
16079 }
16080 % \end{macrocode}
16081 %\end{macro}
16082 %\begin{macro}{\onecolumnSbottom}
16083 % Special case for \gls{static}.
16084 %\changes{2.0}{2025-11-24}{changed to document command}
16085 % \begin{macrocode}
16086 \NewDocumentCommand \onecolumnSbottom { O{all} m o }
16087 {
16088 \__flowfram_only_preamble:Nn \onecolumnbottom
16089 {
16090 \__flowfram_one_column_with_bottom_in_area:nnnnnnn
16091 { #1 } { static } { #2 }
16092 { \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
16093 \IfValueT { #3 }
16094 {
16095 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #3 }
16096 }
16097 }
16098 }
16099 % \end{macrocode}
16100 %\end{macro}
16101 %\begin{macro}{\onecolumnDbottom}
16102 % Special case for \gls{dynamic}.
16103 %\changes{2.0}{2025-11-24}{changed to document command}
16104 % \begin{macrocode}
16105 \NewDocumentCommand \onecolumnDbottom { O{all} m o }
16106 {
16107 \__flowfram_only_preamble:Nn \onecolumnbottom
16108 {
16109 \__flowfram_one_column_with_bottom_in_area:nnnnnnn
16110 { #1 } { dynamic } { #2 }
16111 { \typeblockwidth } { \typeblockheight } { 0pt } { 0pt }
16112 \IfValueT { #3 }
16113 {
16114 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #3 }
16115 }
16116 }
16117 }
16118 % \end{macrocode}
16119 %\end{macro}
16120 %
16121 % General case of the above, but fit in specified area.
16122 %\begin{macro}{\onecolumnbottominarea}
16123 % Syntax:\newline
16124 % \cs{onecolumnbottominarea}\oarg{pages}\marg{type}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y},\newline
16125 % where \meta{H} is the \meta{type} frame's height.
16126 % The area is defined by bottom
16127 % left co-ordinates (\meta{x}, \meta{y}) width \meta{w}, and
16128 % height \meta{h}.
16129 %\changes{2.0}{2025-11-24}{changed to document command}
16130 % \begin{macrocode}
16131 \NewDocumentCommand \onecolumnbottominarea
16132 { O{all} m m m m m m o }
16133 {
16134 \__flowfram_only_preamble:Nn \onecolumnbottominarea
16135 {
16136 \__flowfram_one_column_with_bottom_in_area:nnnnnnn
16137 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 }
16138 \IfValueT { #8 }
16139 {
16140 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #8 }
16141 }
16142 }
16143 }
16144 % \end{macrocode}
16145 %
16146 % \begin{macrocode}
16147 \cs_new:Nn \__flowfram_one_column_with_bottom_in_area:nnnnnnn
16148 {
16149 \dim_set:Nn \l__flowfram_sfdf_height_dim { #3 }
16150 \dim_set:Nn \l__flowfram_height_dim
16151 {
16152 #5
16153 - \l__flowfram_sfdf_height_dim
16154 - \vcolumnsep
16155 }
16156 \ifffvadjust
16157 \adjustheight { \l__flowfram_height_dim }
16158 \fi
16159 \dim_set:Nn \l__flowfram_tmpa_dim
16160 {
16161 #5 - \l__flowfram_height_dim + #7
16162 }
16163 \newframe [ #1 ] { #2 }
16164 { #4 } { \l__flowfram_sfdf_height_dim }
16165 { #6 } { #7 }
16166 \__flowfram_new_flow:nnnnn
16167 { #1 } { #4 } { \l__flowfram_height_dim } { #6 } { \l__flowfram_tmpa_dim }
16168 }
16169 % \end{macrocode}
16170 %\end{macro}
16171 %\begin{macro}{\onecolumnSbottominarea}
16172 % Special case for \gls{static}.
16173 %\changes{2.0}{2025-11-24}{changed to document command}
16174 % \begin{macrocode}
16175 \NewDocumentCommand \onecolumnSbottominarea { O{all} m m m m m o }
16176 {
16177 \__flowfram_only_preamble:Nn \onecolumnSbottominarea
16178 {
16179 \__flowfram_one_column_with_bottom_in_area:nnnnnnn
16180 { #1 } { static } { #2 } { #3 } { #4 } { #5 } { #6 }
16181 \IfValueT { #7 }
16182 {
16183 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #7 }
16184 }
16185 }
16186 }
16187 % \end{macrocode}
16188 %\end{macro}
16189 %\begin{macro}{\onecolumnDbottominarea}
16190 % Special case for \gls{dynamic}.
16191 %\changes{2.0}{2025-11-24}{changed to document command}
16192 % \begin{macrocode}
16193 \NewDocumentCommand \onecolumnDbottominarea { O{all} m m m m m o }
16194 {
16195 \__flowfram_only_preamble:Nn \onecolumnDbottominarea
16196 {
16197 \__flowfram_one_column_with_bottom_in_area:nnnnnnn
16198 { #1 } { dynamic } { #2 } { #3 } { #4 } { #5 } { #6 }
16199 \IfValueT { #7 }
16200 {
16201 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #7 }
16202 }
16203 }
16204 }
16205 % \end{macrocode}
16206 %\end{macro}
16207 %\begin{macro}{\twocolumnbottom}
16208 % Now for two \glspl{flow} side by side with a static
16209 % frame underneath both of them. Firstly, the specific
16210 % case where the area is the entire \gls{typeblock}.
16211 % Syntax:\newline
16212 % \cs{twocolumnbottom}\oarg{pages}\marg{type}\marg{H}.
16213 %\changes{2.0}{2025-11-24}{changed to document command}
16214 % \begin{macrocode}
16215 \NewDocumentCommand \twocolumnbottom { O{all} m m o }
16216 {
16217 \__flowfram_only_preamble:Nn \twocolumnbottom
16218 {
16219 \__flowfram_two_column_with_bottom_in_area:nnnnnnn
16220 { #1 } { #2 } { #3 } { \typeblockwidth } { \typeblockheight }
16221 { \c_zero_dim } { \c_zero_dim }
16222 \IfValueT { #4 }
16223 {
16224 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #4 }
16225 }
16226 }
16227 }
16228 % \end{macrocode}
16229 %\end{macro}
16230 %\begin{macro}{\twocolumnSbottom}
16231 % Special case for \gls{static}.
16232 % \begin{macrocode}
16233 \NewDocumentCommand \twocolumnSbottom { O{all} m o }
16234 {
16235 \__flowfram_only_preamble:Nn \twocolumnDbottom
16236 {
16237 \__flowfram_two_column_with_bottom_in_area:nnnnnnn
16238 { #1 } { static } { #2 }
16239 { \typeblockwidth } { \typeblockheight } { \c_zero_dim } { \c_zero_dim }
16240 \IfValueT { #3 }
16241 {
16242 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #3 }
16243 }
16244 }
16245 }
16246 % \end{macrocode}
16247 %\end{macro}
16248 %\begin{macro}{\twocolumnDbottom}
16249 % Special case for \gls{dynamic}.
16250 %\changes{2.0}{2025-11-24}{changed to document command}
16251 % \begin{macrocode}
16252 \NewDocumentCommand \twocolumnDbottom { O{all} m o }
16253 {
16254 \__flowfram_only_preamble:Nn \twocolumnDbottom
16255 {
16256 \__flowfram_two_column_with_bottom_in_area:nnnnnnn
16257 { #1 } { dynamic } { #2 }
16258 { \typeblockwidth } { \typeblockheight } { \c_zero_dim } { \c_zero_dim }
16259 \IfValueT { #3 }
16260 {
16261 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #3 }
16262 }
16263 }
16264 }
16265 % \end{macrocode}
16266 %\end{macro}
16267 %\begin{macro}{\twocolumnbottominarea}
16268 % Now for a general area.
16269 % Syntax:\newline
16270 % \cs{twocolumnbottominarea}\oarg{pages}\marg{type}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}.
16271 %\changes{2.0}{2025-11-24}{changed to document command}
16272 % \begin{macrocode}
16273 \NewDocumentCommand \twocolumnbottominarea { O{all} m m m m m m o }
16274 {
16275 \__flowfram_only_preamble:Nn \twocolumnbottominarea
16276 {
16277 \__flowfram_two_column_with_bottom_in_area:nnnnnnn
16278 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 }
16279 \IfValueT { #8 }
16280 {
16281 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #8 }
16282 }
16283 }
16284 }
16285 % \end{macrocode}
16286 %
16287 % \begin{macrocode}
16288 \cs_new:Nn \__flowfram_two_column_with_bottom_in_area:nnnnnnn
16289 {
16290 \dim_set:Nn \l__flowfram_sfdf_width_dim { #4 }
16291 \dim_set:Nn \l__flowfram_sfdf_height_dim { #3 }
16292 % \end{macrocode}
16293 % Work out height of the flow frames.
16294 % \begin{macrocode}
16295 \dim_set:Nn \l__flowfram_height_dim
16296 { #5 - \l__flowfram_sfdf_height_dim - \vcolumnsep }
16297 \ifffvadjust
16298 \adjustheight { \l__flowfram_height_dim }
16299 \fi
16300 \newframe
16301 [ #1 ] { #2 }
16302 { \l__flowfram_sfdf_width_dim } { \l__flowfram_sfdf_height_dim }
16303 { #6 } { #7 }
16304 % \end{macrocode}
16305 % Work out the $y$ position of the flow frames.
16306 % \begin{macrocode}
16307 \dim_set:Nn \l__flowfram_y_dim { #5 - \l__flowfram_height_dim + #7 }
16308 % \end{macrocode}
16309 % work out the widths of the flow frames
16310 % \begin{macrocode}
16311 \dim_set:Nn \l__flowfram_width_dim
16312 {
16313 ( \l__flowfram_sfdf_width_dim - \columnsep ) /2
16314 }
16315 % \end{macrocode}
16316 % work out the $x$ offset of the right column
16317 % \begin{macrocode}
16318 \dim_set:Nn \l__flowfram_x_dim
16319 {
16320 \l__flowfram_width_dim + \columnsep + #6
16321 }
16322 % \end{macrocode}
16323 % Define the frames
16324 % \begin{macrocode}
16325 \iflefttorightcolumns
16326 \__flowfram_new_flow:nnnnn
16327 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim }
16328 { #6 } { \l__flowfram_y_dim }
16329 \setflowframe{\c@maxflow}{margin=left}%
16330 \__flowfram_new_flow:nnnnn
16331 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim }
16332 { \l__flowfram_x_dim } { \l__flowfram_y_dim }
16333 \setflowframe{\c@maxflow}{margin=right}%
16334 \else
16335 \__flowfram_new_flow:nnnnn
16336 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim }
16337 { \l__flowfram_x_dim } { \l__flowfram_y_dim }
16338 \setflowframe{\c@maxflow}{margin=right}%
16339 \__flowfram_new_flow:nnnnn
16340 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim }
16341 { #6 } { \l__flowfram_y_dim }
16342 \setflowframe{\c@maxflow}{margin=left}%
16343 \fi
16344 }
16345 % \end{macrocode}
16346 %\end{macro}
16347 %\begin{macro}{\twocolumnSbottominarea}
16348 % Special case for \gls{static}.
16349 %\changes{2.0}{2025-11-24}{changed to document command}
16350 % \begin{macrocode}
16351 \NewDocumentCommand \twocolumnSbottominarea { O{all} m m m m m o }
16352 {
16353 \__flowfram_only_preamble:Nn \twocolumnSbottominarea
16354 {
16355 \__flowfram_two_column_with_bottom_in_area:nnnnnnn
16356 { #1 } { static } { #2 } { #3 } { #4 } { #5 } { #6 }
16357 \IfValueT { #7 }
16358 {
16359 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #7 }
16360 }
16361 }
16362 }
16363 % \end{macrocode}
16364 %\end{macro}
16365 %\begin{macro}{\twocolumnDbottominarea}
16366 % Special case for \gls{dynamic}.
16367 %\changes{2.0}{2025-11-24}{changed to document command}
16368 % \begin{macrocode}
16369 \NewDocumentCommand \twocolumnDbottominarea { O{all} m m m m m o }
16370 {
16371 \__flowfram_only_preamble:Nn \twocolumnDbottominarea
16372 {
16373 \__flowfram_two_column_with_bottom_in_area:nnnnnnn
16374 { #1 } { dynamic } { #2 } { #3 } { #4 } { #5 } { #6 }
16375 \IfValueT { #7 }
16376 {
16377 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #7 }
16378 }
16379 }
16380 }
16381 % \end{macrocode}
16382 %\end{macro}
16383 % Now for an arbitrary number of parallel \glspl{flow}
16384 % with a \gls{static} beneath all of them.
16385 %
16386 %\begin{macro}{\Ncolumnbottom}
16387 % First make them fill the entire \gls{typeblock}.
16388 % Syntax:\newline
16389 % \cs{Ncolumnbottom}\oarg{pages}\marg{type}\marg{H}.
16390 %\changes{2.0}{2025-11-24}{changed to document command}
16391 % \begin{macrocode}
16392 \NewDocumentCommand \Ncolumnbottom { O{all} m m m o }
16393 {
16394 \__flowfram_only_preamble:Nn \Ncolumnbottominarea
16395 {
16396 \__flowfram_n_column_with_bottom_in_area:nnnnnnnn
16397 { #1 } { #2 } { #3 } { #4 }
16398 { \typeblockwidth } { \typeblockheight } { \c_zero_dim } { \c_zero_dim }
16399 \IfValueT { #5 }
16400 {
16401 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #5 }
16402 }
16403 }
16404 }
16405 % \end{macrocode}
16406 %\end{macro}
16407 %\begin{macro}{\NcolumnSbottom}
16408 % Special case for \gls{static}.
16409 %\changes{2.0}{2025-11-24}{changed to document command}
16410 % \begin{macrocode}
16411 \NewDocumentCommand \NcolumnSbottom { O{all} m m o }
16412 {
16413 \__flowfram_only_preamble:Nn \NcolumnSbottom
16414 {
16415 \__flowfram_n_column_with_bottom_in_area:nnnnnnnn
16416 { #1 } { static } { #2 } { #3 }
16417 { \typeblockwidth } { \typeblockheight } { \c_zero_dim } { \c_zero_dim }
16418 \IfValueT { #4 }
16419 {
16420 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #4 }
16421 }
16422 }
16423 }
16424 % \end{macrocode}
16425 %\end{macro}
16426 %\begin{macro}{\NcolumnDbottom}
16427 % Special case for \gls{dynamic}.
16428 %\changes{2.0}{2025-11-24}{changed to document command}
16429 % \begin{macrocode}
16430 \NewDocumentCommand \NcolumnDbottom { O{all} m m o }
16431 {
16432 \__flowfram_only_preamble:Nn \NcolumnDbottom
16433 {
16434 \__flowfram_n_column_with_bottom_in_area:nnnnnnnn
16435 { #1 } { dynamic } { #2 } { #3 }
16436 { \typeblockwidth } { \typeblockheight } { \c_zero_dim } { \c_zero_dim }
16437 \IfValueT { #4 }
16438 {
16439 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #4 }
16440 }
16441 }
16442 }
16443 % \end{macrocode}
16444 %\end{macro}
16445 %\begin{macro}{\Ncolumnbottominarea}
16446 % Again check the user has requested a sensible number.
16447 %\changes{2.0}{2025-11-24}{changed to document command}
16448 % \cs{Ncolumnbottominarea}\oarg{pages}\marg{type}\marg{n}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}
16449 % \begin{macrocode}
16450 \NewDocumentCommand \Ncolumnbottominarea { O{all} m m m m m m m o }
16451 {
16452 \__flowfram_only_preamble:Nn \Ncolumnbottominarea
16453 {
16454 \__flowfram_n_column_with_bottom_in_area:nnnnnnnn
16455 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 } { #8 }
16456 \IfValueT { #9 }
16457 {
16458 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #9 }
16459 }
16460 }
16461 }
16462 % \end{macrocode}
16463 %\end{macro}
16464 %\begin{macro}{\@Ncolumnbottominarea}
16465 % Version 2.0 replaced \cs{@Ncolumnbottominarea}
16466 %\changes{2.0}{2025-11-24}{replaced}
16467 % \begin{macrocode}
16468 \cs_new:Nn \__flowfram_n_column_with_bottom_in_area:nnnnnnnn
16469 {
16470 \int_case:nnF { #3 }
16471 {
16472 { \c_one_int }
16473 {
16474 \__flowfram_one_column_with_bottom_in_area:nnnnnnn
16475 { #1 } { #2 } { #4 } { #5 } { #6 } { #7 } { #8 }
16476 }
16477 { 2 }
16478 {
16479 \__flowfram_two_column_with_bottom_in_area:nnnnnnn
16480 { #1 } { #2 } { #4 } { #5 } { #6 } { #7 } { #8 }
16481 }
16482 }
16483 {
16484 \int_compare:nNnTF { #3 } > { 2 }
16485 {
16486 \__flowfram_N_column_with_bottom_in_area:nnnnnnnn
16487 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 } { #8 }
16488 }
16489 {
16490 \msg_error:nnne { flowfram } { invalid-num-frames }
16491 { flow } { \int_eval:n { #3 } }
16492 }
16493 }
16494 }
16495 % \end{macrocode}
16496 %\end{macro}
16497 % Syntax: \marg{pages}\marg{type}\marg{n}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}
16498 % \begin{macrocode}
16499 \cs_new:Nn \__flowfram_N_column_with_bottom_in_area:nnnnnnnn
16500 {
16501 \dim_set:Nn \l__flowfram_sfdf_height_dim { #4 }
16502 % \end{macrocode}
16503 % Work out height of the flow frames.
16504 % \begin{macrocode}
16505 \dim_set:Nn \l__flowfram_height_dim
16506 { #6 - \l__flowfram_sfdf_height_dim - \vcolumnsep }
16507 % \end{macrocode}
16508 % adjust the flow frame height so that it is a multiple of
16509 % \cs{baselineskip}
16510 % \begin{macrocode}
16511 \ifffvadjust
16512 \adjustheight { \l__flowfram_height_dim }
16513 \fi
16514 \newframe
16515 [ #1 ] { #2 }
16516 { #5 } { \l__flowfram_sfdf_height_dim } { #7 } { #8 }
16517 % \end{macrocode}
16518 % Work out the $y$ offset of the flow frames.
16519 % \begin{macrocode}
16520 \dim_set:Nn \l__flowfram_y_dim
16521 { #6 - \l__flowfram_height_dim + #8 }
16522 % \end{macrocode}
16523 % work out the widths of the flow frames
16524 % \begin{macrocode}
16525 \int_set:Nn \l__flowfram_col_int { #3 - \c_one_int }
16526 \dim_set:Nn \l__flowfram_width_dim
16527 { ( #5 -\l__flowfram_col_int \columnsep ) / ( #3 ) }
16528 % \end{macrocode}
16529 % Set the $x$ offset of the first frame.
16530 % \begin{macrocode}
16531 \dim_set:Nn \l__flowfram_x_dim { #7 }
16532 \iflefttorightcolumns
16533 \else
16534 \dim_add:Nn \l__flowfram_x_dim { #5 - \l__flowfram_width_dim }
16535 \fi
16536 \int_step_inline:nn { #3 }
16537 {
16538 \__flowfram_new_flow:nnnnn
16539 { #1 } { \l__flowfram_width_dim } { \l__flowfram_height_dim }
16540 { \l__flowfram_x_dim } { \l__flowfram_y_dim }
16541 % \end{macrocode}
16542 % Work out the offset for the next column.
16543 % \begin{macrocode}
16544 \iflefttorightcolumns
16545 \dim_add:Nn \l__flowfram_x_dim { \l__flowfram_width_dim + \columnsep }
16546 \else
16547 \dim_add:Nn \l__flowfram_x_dim { - \l__flowfram_width_dim -\columnsep }
16548 \fi
16549 }
16550 }
16551 % \end{macrocode}
16552 %
16553 %\begin{macro}{\NcolumnSbottominarea}
16554 % Specific case for \gls{static}.
16555 %\changes{2.0}{2025-11-24}{changed to document command}
16556 % \begin{macrocode}
16557 \NewDocumentCommand \NcolumnSbottominarea { O{all} m m m m m m o }
16558 {
16559 \__flowfram_only_preamble:Nn \NcolumnSbottominarea
16560 {
16561 \__flowfram_n_column_with_bottom_in_area:nnnnnnnn
16562 { #1 } { static } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 }
16563 \IfValueT { #8 }
16564 {
16565 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #8 }
16566 }
16567 }
16568 }
16569 % \end{macrocode}
16570 %\end{macro}
16571 %\begin{macro}{\NcolumnDbottominarea}
16572 % Specific case for \gls{dynamic}.
16573 %\changes{2.0}{2025-11-24}{changed to document command}
16574 % \begin{macrocode}
16575 \NewDocumentCommand \NcolumnDbottominarea { O{all} m m m m m m o }
16576 {
16577 \__flowfram_only_preamble:Nn \NcolumnDbottominarea
16578 {
16579 \__flowfram_n_column_with_bottom_in_area:nnnnnnnn
16580 { #1 } { dynamic } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 }
16581 \IfValueT { #8 }
16582 {
16583 \__flowfram_set_frame_id:nnn { flow } { \c@maxflow } { #8 }
16584 }
16585 }
16586 }
16587 % \end{macrocode}
16588 %\end{macro}
16589 %
16590 %\begin{macro}{\@ff@adjh}
16591 % Version 2.0 replaced \cs{@ff@adjh}
16592 %\changes{2.0}{2025-11-24}{replaced}
16593 % \begin{macrocode}
16594 \int_new:N \l__flowfram_adjust_height_int
16595 % \end{macrocode}
16596 %\end{macro}
16597 %\begin{macro}{\adjustheight}
16598 % Given a height "#1" (a length), adjust it so that it is a multiple of "\baselineskip".
16599 % \begin{macrocode}
16600 \newcommand*{\adjustheight}[1]{%
16601 % \end{macrocode}
16602 % Convert the dimension to an integer.
16603 % \begin{macrocode}
16604 \int_set:Nn \l__flowfram_adjust_height_int
16605 {
16606 \int_div_round:nn
16607 { \dim_to_decimal_in_sp:n { #1 } }
16608 { \dim_to_decimal_in_sp:n { \baselineskip } }
16609 }
16610 \dim_set:Nn #1 { \l__flowfram_adjust_height_int \baselineskip }
16611 }
16612 % \end{macrocode}
16613 %\end{macro}
16614 %\begin{macro}{\adjustcolsep}
16615 % Adjust the value of "\columnsep" so that the margins will fit between columns.
16616 % \begin{macrocode}
16617 \newcommand*{\adjustcolsep}{%
16618 \dim_set:Nn \columnsep { 2 \columnsep + \marginparwidth }
16619 }
16620 % \end{macrocode}
16621 %\end{macro}
16622 %
16623 %\subsubsection{Backdrop Effects}
16624 % Set up some commands to make \glspl{static} for different styles
16625 % of backdrop.
16626 %\begin{macro}{\vtwotone}
16627 % Syntax:\newline
16628 % \cs{vtwotone}\oarg{pages}\oarg{xoffset}\marg{W1}\marg{C1}\marg{L1}\marg{W2}\marg{C2}\marg{L2}
16629 %\newline where the first frame
16630 % has width \meta{W1} with background colour \meta{C1} and label \meta{L1}.
16631 % The second frame has width \meta{W2} with background colour \meta{C2}
16632 % and label \meta{L2}. Unlike earlier commands, the $x$-offset is
16633 % relative to the left page edge \emph{not} the \gls{typeblock}.
16634 % This is because they are designed for backdrops, which
16635 % tend to span the entire page.
16636 % Note that the colour specs must be
16637 % completely enclosed in braces. e.g.\ "{[gray]{0.5}}" \emph{not} "[gray]{0.5}".
16638 %
16639 % Vertical two tone effect where the height of the static
16640 % frames is equal to the paper height.
16641 %\changes{2.0}{2025-11-24}{changed to document command}
16642 % \begin{macrocode}
16643 \NewDocumentCommand \vtwotone
16644 { O{all} O {\c_zero_dim} m m m m m m }
16645 {
16646 \__flowfram_only_preamble:Nn \vtwotone
16647 {
16648 \__flowfram_v_two_tone_bottom:nnnnnnnnn
16649 { #1 } { #2 } { \paperheight } { #3 } { #4 } { #5 } { #6 } { #7 } { #8 }
16650 }
16651 }
16652 % \end{macrocode}
16653 %\end{macro}
16654 %\begin{macro}{\@vtwotone}
16655 % Version 2.0 removed \cs{@vtwotone}.
16656 %\changes{2.0}{2025-11-24}{removed}
16657 %\end{macro}
16658 % Vertical two tone effect along the bottom of the page, of
16659 % height \meta{H}.
16660 % Syntax:\newline
16661 % \oarg{pages}\oarg{xoffset}\marg{H}\marg{W1}\marg{C1}\marg{L1}\marg{W2}\marg{C2}\marg{L2}
16662 % where the first frame starts at \meta{xoffset}.
16663 % \begin{macrocode}
16664 \cs_new:Nn \__flowfram_v_two_tone_bottom:nnnnnnnnn
16665 {
16666 \computeleftedgeodd { \l__flowfram_x_dim }
16667 \if@twoside
16668 \computeleftedgeeven { \l__flowfram_evenx_dim }
16669 \else
16670 \dim_set_eq:NN \l__flowfram_evenx_dim \l__flowfram_x_dim
16671 \fi
16672 \computebottomedge { \l__flowfram_y_dim }
16673 \dim_add:Nn \l__flowfram_x_dim { #2 }
16674 \dim_add:Nn \l__flowfram_evenx_dim { #2 }
16675 \__flowfram_next_v_band:nnnnn { #1 } { #3 } { #4 } { #5 } { #6 }
16676 \__flowfram_next_v_band:nnnnn { #1 } { #3 } { #7 } { #8 } { #9 }
16677 }
16678 % \end{macrocode}
16679 %
16680 %\begin{macro}{\vtwotonebottom}
16681 % Border strip along the bottom of the page
16682 %\changes{2.0}{2025-11-24}{changed to document command}
16683 % \begin{macrocode}
16684 \NewDocumentCommand \vtwotonebottom
16685 { O{all} O {\c_zero_dim} m m m m m m m }
16686 {
16687 \__flowfram_only_preamble:Nn \vtwotonebottom
16688 {
16689 \__flowfram_v_two_tone_bottom:nnnnnnnnn
16690 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 } { #8 } { #9 }
16691 }
16692 }
16693 % \end{macrocode}
16694 %\end{macro}
16695 %\begin{macro}{\@vtwotonebottom}
16696 % Version 2.0 removed \cs{@vtwotonebottom}.
16697 %\changes{2.0}{2025-11-24}{removed}
16698 %\end{macro}
16699 %\begin{macro}{\vtwotonetop}
16700 % Border strip along the top of the page.
16701 %\changes{2.0}{2025-11-24}{changed to document command}
16702 % \begin{macrocode}
16703 \NewDocumentCommand \vtwotonetop
16704 { O{all} O {\c_zero_dim} m m m m m m m }
16705 {
16706 \__flowfram_only_preamble:Nn \vtwotonebottom
16707 {
16708 \__flowfram_v_two_tone_top:nnnnnnnnn
16709 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 } { #8 } { #9 }
16710 }
16711 }
16712 % \end{macrocode}
16713 %\end{macro}
16714 %\begin{macro}{\@vtwotonetop}
16715 % Version 2.0 removed \cs{@vtwotonetop}
16716 %\changes{2.0}{2025-11-24}{removed}
16717 % \begin{macrocode}
16718 % \end{macrocode}
16719 %\end{macro}
16720 %\begin{macro}{\@@vtwotonetop}
16721 % Version 2.0 replaced \cs{@@vtwotonetop}
16722 %\changes{2.0}{2025-11-24}{replaced}
16723 % \begin{macrocode}
16724 \cs_new:Nn \__flowfram_v_two_tone_top:nnnnnnnnn
16725 {
16726 \computeleftedgeodd { \l__flowfram_x_dim }
16727 \if@twoside
16728 \computeleftedgeeven { \l__flowfram_evenx_dim }
16729 \else
16730 \dim_set:Nn \l__flowfram_evenx_dim { \l__flowfram_x_dim }
16731 \fi
16732 \computetopedge { \l__flowfram_y_dim }
16733 \dim_sub:Nn \l__flowfram_y_dim { #3 }
16734 \dim_add:Nn \l__flowfram_x_dim { #2 }
16735 \dim_add:Nn \l__flowfram_evenx_dim { #2 }
16736 \__flowfram_next_v_band:nnnnn { #1 } { #3 } { #4 } { #5 } { #6 }
16737 \__flowfram_next_v_band:nnnnn { #1 } { #3 } { #7 } { #8 } { #9 }
16738 }
16739 % \end{macrocode}
16740 %\end{macro}
16741 %\begin{macro}{\@nextvband}
16742 % Make next \gls{static}. Syntax:\newline
16743 % \cs{@nextvband}\marg{pages}\marg{height}\marg{width}\marg{colour specs}\marg{label}\newline
16744 % $x$ and $y$ offsets are given by "\l__flowfram_x_dim " and "\l__flowfram_y_dim ".
16745 % On exit, "\l__flowfram_x_dim " is set to the right border.
16746 % Version 2.0 renamed \cs{@nextvband}.
16747 %\changes{2.0}{2025-11-24}{renamed}
16748 % \begin{macrocode}
16749 \cs_new:Nn \__flowfram_next_v_band:nnnnn
16750 {
16751 \dim_set:Nn \l__flowfram_sfdf_width_dim { #3 }
16752 \tl_if_empty:nTF { #5 }
16753 {
16754 \__flowfram_new_static:nnnnn
16755 { #1 } { \l__flowfram_sfdf_width_dim } { #2 }
16756 { \l__flowfram_x_dim } { \l__flowfram_y_dim }
16757 }
16758 {
16759 \__flowfram_new_static:nnnnnn
16760 { #1 } { \l__flowfram_sfdf_width_dim } { #2 }
16761 { \l__flowfram_x_dim } { \l__flowfram_y_dim } { #5 }
16762 }
16763 \flowfram_frame_set_dim:nnnn { static} { evenx } { \c@maxstatic }
16764 { \l__flowfram_evenx_dim }
16765 \__flowfram_set_frame_color:w
16766 #4 \q_stop { static } { backcolor } { \c@maxstatic }
16767 \dim_add:Nn \l__flowfram_x_dim { \l__flowfram_sfdf_width_dim }
16768 \dim_add:Nn \l__flowfram_evenx_dim { \l__flowfram_sfdf_width_dim }
16769 }
16770 % \end{macrocode}
16771 %\end{macro}
16772 %
16773 %\begin{macro}{\@thisstrip}
16774 % Keep track of which strip we are doing.
16775 % Version 2.0 renamed \cs{@thisstrip}.
16776 %\changes{2.0}{2025-11-24}{renamed}
16777 % \begin{macrocode}
16778 \int_new:N \l__flowfram_this_strip_int
16779 % \end{macrocode}
16780 %\end{macro}
16781 %
16782 %\begin{macro}{\vNtone}
16783 % Similarly for N colours. Syntax:\newline
16784 % \cs{vNtone}\oarg{pages}\oarg{xoffset}\marg{n}\marg{W1}\marg{C1}\marg{L1}\ldots\marg{Wn}\marg{Cn}\marg{Ln}\newline
16785 % where the first frame has width \meta{W1} with background
16786 % colour \meta{C1} and label \meta{L1} all the way up to
16787 % the \meta{n}th frame which has width \meta{Wn}, background
16788 % colour \meta{Cn} and \gls{idl} \meta{Ln}.
16789 %
16790 %\changes{2.0}{2025-11-24}{changed to document command}
16791 % \begin{macrocode}
16792 \NewDocumentCommand \vNtone { O{all} O {\c_zero_dim} m }
16793 {
16794 \clist_set:Nn \l__flowfram_pages_clist { #1 }
16795 \__flowfram_v_N_tone_bottom:nnn { #2 } { #3 } { \paperheight }
16796 }
16797 \@onlypreamble{\vNtone}
16798 % \end{macrocode}
16799 %\end{macro}
16800 %\begin{macro}{\@vNtone}
16801 % Got the first argument, now get the next.
16802 % Version 2.0 removed \cs{@vNtone}.
16803 %\changes{2.0}{2025-11-24}{removed}
16804 %\end{macro}
16805 %\begin{macro}{\@@vNtone}
16806 % Vertical \meta{n} tone aligned along the
16807 % bottom of the page with height "#3".
16808 % Version 2.0 renamed \cs{@@vNtone}.
16809 %\changes{2.0}{2025-11-24}{renamed}
16810 % \begin{macrocode}
16811 \cs_new:Nn \__flowfram_v_N_tone_bottom:nnn
16812 {
16813 \computeleftedgeodd { \l__flowfram_x_dim }
16814 \if@twoside
16815 \computeleftedgeeven { \l__flowfram_evenx_dim }
16816 \else
16817 \dim_set_eq:NN \l__flowfram_evenx_dim \l__flowfram_x_dim
16818 \fi
16819 \computebottomedge { \l__flowfram_y_dim }
16820 \dim_add:Nn \l__flowfram_x_dim { #1 }
16821 \dim_add:Nn \l__flowfram_evenx_dim { #1 }
16822 \int_set:Nn \l__flowfram_this_strip_int { #2 }
16823 \dim_set:Nn\l__flowfram_sfdf_height_dim { #3 }
16824 \__flowfram_next_v_N_band:
16825 }
16826 % \end{macrocode}
16827 %\end{macro}
16828 %\begin{macro}{\@nextvNband}
16829 % Recursively do the next strip.
16830 % Version 2.0 renamed \cs{@nextvNband}.
16831 %\changes{2.0}{2025-11-24}{renamed}
16832 % \begin{macrocode}
16833 \cs_new:Nn \__flowfram_next_v_N_band:
16834 {
16835 \int_compare:nNnTF { \l__flowfram_this_strip_int } > { \c_zero_int }
16836 {
16837 \let \flf@next \@@nextvNband
16838 }
16839 {
16840 \let \flf@next \relax
16841 }
16842 \int_decr:N \l__flowfram_this_strip_int
16843 \flf@next
16844 }
16845 % \end{macrocode}
16846 %\end{macro}
16847 %\begin{macro}{\@@nextvNband}
16848 % Do current strip, and go on to next one.
16849 % \begin{macrocode}
16850 \newcommand*{\@@nextvNband}[3]{%
16851 \__flowfram_next_v_band:nnnnn
16852 { \l__flowfram_pages_clist } { \l__flowfram_sfdf_height_dim }
16853 { #1 } { #2 } { #3 }
16854 \__flowfram_next_v_N_band:
16855 }
16856 % \end{macrocode}
16857 %\end{macro}
16858 %\begin{macro}{\vNtonebottom}
16859 % Border strip along the bottom of the page. Same as above
16860 % but user specifies the height.
16861 %\changes{2.0}{2025-11-24}{changed to document command}
16862 % \begin{macrocode}
16863 \NewDocumentCommand \vNtonebottom { O{all} O{\c_zero_dim} m m }
16864 {
16865 \clist_set:Nn \l__flowfram_pages_clist { #1 }
16866 \__flowfram_v_N_tone_bottom:nnn { #2 } { #3 } { #4 }
16867 }
16868 \@onlypreamble{\vNtonebottom}
16869 % \end{macrocode}
16870 %\end{macro}
16871 %\begin{macro}{\@vNtonebottom}
16872 % Version 2.0 removed \cs{@vNtonebottom}.
16873 %\changes{2.0}{2025-11-24}{removed}
16874 %\end{macro}
16875 %\begin{macro}{\vNtonetop}
16876 % Border strip along the top of the page. Again two
16877 % optional arguments are required. Get first optional
16878 % argument.
16879 % \begin{macrocode}
16880 \NewDocumentCommand \vNtonetop { O{all} O{\c_zero_dim} m m }
16881 {
16882 \clist_set:Nn \l__flowfram_pages_clist { #1 }
16883 \__flowfram_v_N_tone_top:nnn { #2 } { #3 } { #4 }
16884 }
16885 \@onlypreamble{\vNtonetop}
16886 % \end{macrocode}
16887 %\end{macro}
16888 %\begin{macro}{\@vNtonetop}
16889 % Get next optional argument.
16890 % Version 2.0 removed \cs{@vNtonetop}.
16891 %\changes{2.0}{2025-11-24}{removed}
16892 %\end{macro}
16893 %
16894 %\begin{macro}{\@@vNtonetop}
16895 % Now get on with it. Again, it has to be done
16896 % recursively.
16897 % Version 2.0 renamed \cs{@@vNtonetop}
16898 %\changes{2.0}{2025-11-24}{renamed}
16899 % \begin{macrocode}
16900 \cs_new:Nn \__flowfram_v_N_tone_top:nnn
16901 {
16902 \computeleftedgeodd { \l__flowfram_x_dim }
16903 \if@twoside
16904 \computeleftedgeeven { \l__flowfram_evenx_dim }
16905 \else
16906 \dim_set_eq:NN \l__flowfram_evenx_dim \l__flowfram_x_dim
16907 \fi
16908 \computetopedge { \l__flowfram_y_dim }
16909 \dim_sub:Nn \l__flowfram_y_dim { #3 }
16910 \dim_add:Nn \l__flowfram_x_dim { #1 }
16911 \dim_add:Nn \l__flowfram_evenx_dim { #1 }
16912 \int_set:Nn \l__flowfram_this_strip_int { #2 }
16913 \dim_set:Nn \l__flowfram_sfdf_height_dim { #3 }
16914 \__flowfram_next_v_N_band:
16915 }
16916 % \end{macrocode}
16917 %\end{macro}
16918 %\begin{macro}{\htwotone}
16919 % Now do horizontal strips. Syntax:\newline
16920 % \cs{htwotone}\oarg{pages}\oarg{y offset}\marg{H1}\marg{C1}\marg{L1}\marg{H2}\marg{C2}\marg{L2}
16921 %\changes{2.0}{2025-11-24}{changed to document command}
16922 % \begin{macrocode}
16923 \NewDocumentCommand \htwotone
16924 { O{all} O {\c_zero_dim} m m m m m m }
16925 {
16926 \__flowfram_only_preamble:Nn \htwotone
16927 {
16928 \__flowfram_h_two_tone_left:nnnnnnnnn
16929 { #1 } { #2 } { \paperwidth } { #3 } { #4 } { #5 } { #6 } { #7 } { #8 }
16930 }
16931 }
16932 \@onlypreamble{\htwotone}
16933 % \end{macrocode}
16934 %\end{macro}
16935 %\begin{macro}{\@htwotone}
16936 % Version 2.0 removed \cs{@htwotone}.
16937 %\changes{2.0}{2025-11-24}{removed}
16938 %\end{macro}
16939 %\begin{macro}{\@@htwotoneleft}
16940 % This is all done in much the same way as the vertical
16941 % strips.
16942 % Version 2.0 replaced \cs{@@htwotoneleft}.
16943 %\changes{2.0}{2025-11-24}{replaced}
16944 % \begin{macrocode}
16945 \cs_new:Nn \__flowfram_h_two_tone_left:nnnnnnnnn
16946 {
16947 \computeleftedgeodd { \l__flowfram_x_dim }
16948 \if@twoside
16949 \computeleftedgeeven { \l__flowfram_evenx_dim }
16950 \else
16951 \dim_set:Nn \l__flowfram_evenx_dim { \l__flowfram_x_dim }
16952 \fi
16953 \computebottomedge { \l__flowfram_y_dim }
16954 \dim_add:Nn \l__flowfram_y_dim { #2 }
16955 \__flowfram_h_two_tone_left:nnnnnnnnn { #1 } { #3 } { #4 } { #5 } { #6 }
16956 \__flowfram_h_two_tone_left:nnnnnnnnn { #1 } { #3 } { #7 } { #8 } { #9 }
16957 }
16958
16959 % \end{macrocode}
16960 %\end{macro}
16961 %\begin{macro}{\htwotoneleft}
16962 % Two tone horizontal strips along left border
16963 % Syntax: \cs{htwotoneleft}\oarg{pages}\oarg{y offset}\marg{width}\marg{H1}\marg{C1}\marg{L1}\marg{H2}\marg{C2}\marg{L2}
16964 %\changes{2.0}{2025-11-24}{changed to document command}
16965 % \begin{macrocode}
16966 \NewDocumentCommand \htwotoneleft
16967 { O{all} O {\c_zero_dim} m m m m m m m }
16968 {
16969 \__flowfram_only_preamble:Nn \htwotoneleft
16970 {
16971 \__flowfram_h_two_tone_left:nnnnnnnnn
16972 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 } { #8 } { #9 }
16973 }
16974 }
16975 \@onlypreamble{\htwotoneleft}
16976 % \end{macrocode}
16977 %\end{macro}
16978 %\begin{macro}{\@htwotoneleft}
16979 % Version 2.0 removed \cs{@htwotoneleft}
16980 %\changes{2.0}{2025-11-24}{removed}
16981 %\end{macro}
16982 %\begin{macro}{\htwotoneright}
16983 % Two tone horizontal strips along right border
16984 %\changes{2.0}{2025-11-24}{changed to document command}
16985 % \begin{macrocode}
16986 \NewDocumentCommand \htwotoneright
16987 { O{all} O {\c_zero_dim} m m m m m m m }
16988 {
16989 \__flowfram_only_preamble:Nn \htwotoneright
16990 {
16991 \__flowfram_h_two_tone_right:nnnnnnnnn
16992 { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } { #7 } { #8 } { #9 }
16993 }
16994 }
16995 \@onlypreamble{\htwotoneright}
16996 % \end{macrocode}
16997 %\end{macro}
16998 %\begin{macro}{\@htwotoneright}
16999 % Version 2.0 removed \cs{@htwotoneright}.
17000 %\changes{2.0}{2025-11-24}{removed}
17001 %\end{macro}
17002 %\begin{macro}{\@@htwotoneright}
17003 % Version 2.0 replaced \cs{@@htwotoneright}.
17004 %\changes{2.0}{2025-11-24}{replaced}
17005 % \begin{macrocode}
17006 \cs_new:Nn \__flowfram_h_two_tone_right:nnnnnnnnn
17007 {
17008 \computerightedgeodd { \l__flowfram_x_dim }
17009 \if@twoside
17010 \computerightedgeeven { \l__flowfram_evenx_dim }
17011 \else
17012 \dim_set:Nn \l__flowfram_evenx_dim { \l__flowfram_x_dim }
17013 \fi
17014 \computebottomedge { \l__flowfram_y_dim }
17015 \dim_add:Nn \l__flowfram_y_dim { #2 }
17016 \dim_sub:Nn \l__flowfram_x_dim { #3 }
17017 \dim_sub:Nn \l__flowfram_evenx_dim { #3 }
17018 \__flowfram_h_two_tone_left:nnnnnnnnn { #1 } { #3 } { #4 } { #5 } { #6 }
17019 \__flowfram_h_two_tone_left:nnnnnnnnn { #1 } { #3 } { #7 } { #8 } { #9 }
17020 }
17021 % \end{macrocode}
17022 %\end{macro}
17023 %\begin{macro}{\hNtone}
17024 % Now for \meta{N} coloured horizontal strips
17025 %\changes{2.0}{2025-11-24}{changed to document command}
17026 % \begin{macrocode}
17027 \NewDocumentCommand \hNtone { O{all} O {\c_zero_dim} m }
17028 {
17029 \clist_set:Nn \l__flowfram_pages_clist { #1 }
17030 \__flowfram_h_N_tone_left:nnn { #2 } { #3 } { \paperwidth }
17031 }
17032 \@onlypreamble{\hNtone}
17033 % \end{macrocode}
17034 %\end{macro}
17035 %\begin{macro}{\@hNtone}
17036 % Version 2.0 removed \cs{@hNtone}.
17037 %\changes{2.0}{2025-11-24}{removed}
17038 %\end{macro}
17039 %\begin{macro}{\@@hNtone}
17040 % Version 2.0 replaced \cs{@@hNtone}.
17041 %\changes{2.0}{2025-11-24}{replaced}
17042 % \begin{macrocode}
17043 \cs_new:Nn \__flowfram_h_N_tone_left:nnn
17044 {
17045 \computeleftedgeodd { \l__flowfram_x_dim }
17046 \if@twoside
17047 \computeleftedgeeven { \l__flowfram_evenx_dim }
17048 \else
17049 \dim_add:Nn \l__flowfram_evenx_dim { \l__flowfram_x_dim }
17050 \fi
17051 \computebottomedge { \l__flowfram_y_dim }
17052 \dim_add:Nn \l__flowfram_y_dim { #1 }
17053 \int_set:Nn \l__flowfram_this_strip_int { #2 }
17054 \dim_set:Nn l__flowfram_static_width_dim { #3 }
17055 \__flowfram_next_h_N_band:
17056 }
17057 % \end{macrocode}
17058 %\end{macro}
17059 %\begin{macro}{\hNtoneleft}
17060 % Now for the N tone strips along the left border
17061 %\changes{2.0}{2025-11-24}{changed to document command}
17062 % \begin{macrocode}
17063 \NewDocumentCommand \hNtoneleft { O{all} O {\c_zero_dim} m m }
17064 {
17065 \clist_set:Nn \l__flowfram_pages_clist { #1 }
17066 \__flowfram_h_N_tone_left:nnn { #2 } { #3 } { #4 }
17067 }
17068 \@onlypreamble{\hNtoneleft}
17069 % \end{macrocode}
17070 %\end{macro}
17071 %\begin{macro}{\@hNtoneleft}
17072 % Version 2.0 removed \cs{@hNtoneleft}.
17073 %\changes{2.0}{2025-11-24}{removed}
17074 %\end{macro}
17075 %\begin{macro}{\hNtoneright}
17076 % Border strip along the right border
17077 %\changes{2.0}{2025-11-24}{changed to document command}
17078 % \begin{macrocode}
17079 \NewDocumentCommand \hNtoneright { O{all} O {\c_zero_dim} m m }
17080 {
17081 \clist_set:Nn \l__flowfram_pages_clist { #1 }
17082 \__flowfram_h_N_tone_right:nnn { #2 } { #3 } { #4 }
17083 }
17084 \@onlypreamble{\hNtoneright}
17085 % \end{macrocode}
17086 %\end{macro}
17087 %\begin{macro}{\@hNtoneright}
17088 % Version 2.0 removed \cs{@hNtoneright}.
17089 %\changes{2.0}{2025-11-24}{removed}
17090 %\end{macro}
17091 %\begin{macro}{\@@hNtoneright}
17092 % Version 2.0 replaced \cs{@@hNtoneright}.
17093 %\changes{2.0}{2025-11-24}{replaced}
17094 % \begin{macrocode}
17095 \cs_new:Nn \__flowfram_h_N_tone_right:nnn
17096 {
17097 \computerightedgeodd { \l__flowfram_x_dim }
17098 \if@twoside
17099 \computerightedgeeven { \l__flowfram_evenx_dim }
17100 \else
17101 \dim_set:Nn \l__flowfram_evenx_dim { \l__flowfram_x_dim }
17102 \fi
17103 \computebottomedge { \l__flowfram_y_dim }
17104 \dim_add:Nn \l__flowfram_y_dim { #1 }
17105 \dim_sub:Nn \l__flowfram_x_dim { #3 }
17106 \dim_sub:Nn \l__flowfram_evenx_dim { #3 }
17107 \int_set:Nn \l__flowfram_this_strip_int { #2 }
17108 \dim_set:Nn \l__flowfram_sfdf_width_dim { #3 }
17109 \__flowfram_next_h_N_band:
17110 }
17111 % \end{macrocode}
17112 %\end{macro}
17113 %\begin{macro}{\@nexthband}
17114 % Make next \gls{static}. Syntax:\newline
17115 % \cs{@nexthband}\marg{pages}\marg{width}\marg{height}\marg{colour specs}\marg{label}\newline
17116 % $x$ and $y$ offsets are given by "\l__flowfram_x_dim " and "\l__flowfram_y_dim ".
17117 % On exit, "\l__flowfram_y_dim " is set to the top border.
17118 % Version 2.0 replaced \cs{@nexthband}.
17119 %\changes{2.0}{2025-11-24}{replaced}
17120 % \begin{macrocode}
17121 \cs_new:Nn \__flowfram_next_h_band:nnnnn
17122 {
17123 \dim_set:Nn \l__flowfram_sfdf_height_dim { #3 }
17124 \tl_if_empty:nTF { #5 }
17125 {
17126 \__flowfram_new_static:nnnnn
17127 { #1 } { #2 } { \l__flowfram_sfdf_height_dim }
17128 { \l__flowfram_x_dim } { \l__flowfram_y_dim }
17129 }
17130 {
17131 \__flowfram_new_static:nnnnnn
17132 { #1 } { #2 } { \l__flowfram_sfdf_height_dim }
17133 { \l__flowfram_x_dim } { \l__flowfram_y_dim }
17134 }
17135 \flowfram_frame_set_dim:nnnn { static} { evenx } { \c@maxstatic }
17136 { \l__flowfram_evenx_dim }
17137 \__flowfram_set_frame_color:w
17138 #4 \q_stop { static } { backcolor } { \c@maxstatic }
17139 \dim_add:Nn \l__flowfram_y_dim { \l__flowfram_sfdf_height_dim }
17140 }
17141 % \end{macrocode}
17142 %\end{macro}
17143 %\begin{macro}{\@nexthNband}
17144 % Get next horizontal strip recursively.
17145 % Version 2.0 renamed \cs{@nexthNband}.
17146 %\changes{2.0}{2025-11-24}{renamed}
17147 % \begin{macrocode}
17148 \cs_new:Nn \__flowfram_next_h_N_band:
17149 {
17150 \int_compare:nNnTF
17151 { \l__flowfram_this_strip_int } > { \c_zero_int }
17152 {
17153 \let \flf@next \@@nexthNband
17154 }
17155 {
17156 \let \flf@next \relax
17157 }
17158 \int_decr:N \l__flowfram_this_strip_int
17159 \flf@next
17160 }
17161 % \end{macrocode}
17162 %\end{macro}
17163 %\begin{macro}{\@@nexthNband}
17164 % \begin{macrocode}
17165 \newcommand*{\@@nexthNband}[3]{%
17166 \__flowfram_h_two_tone_left:nnnnnnnnn
17167 { \l__flowfram_pages_clist } { \l__flowfram_sfdf_width_dim }
17168 { #1 } { #2 } { #3 }
17169 \__flowfram_next_h_N_band:
17170 }
17171 % \end{macrocode}
17172 %\end{macro}
17173 %\begin{macro}{\makebackgroundframe}
17174 % Make one big \gls{static} that covers the entire page.
17175 % This command should come before all other commands that create
17176 % \glspl{static}, otherwise it will obscure all the ones defined
17177 % before it. Syntax:\newline
17178 % \cs{makebackgroundframe}\oarg{pages}\oarg{label}.
17179 %\changes{2.0}{2025-11-24}{changed to document command}
17180 % \begin{macrocode}
17181 \NewDocumentCommand \makebackgroundframe { O{all} o }
17182 {
17183 \__flowfram_only_preamble:Nn \NcolumnDbottominarea
17184 {
17185 \int_if_zero:nF { \c@maxstatic }
17186 {
17187 \msg_warning:nn { flowfram } { background-not-first }
17188 }
17189 \computeleftedgeodd { \l__flowfram_x_dim }
17190 \if@twoside
17191 \computeleftedgeeven { \l__flowfram_evenx_dim }
17192 \else
17193 \dim_set:Nn \l__flowfram_evenx_dim { \l__flowfram_x_dim }
17194 \fi
17195 \computebottomedge { \l__flowfram_y_dim }
17196 \IfValueTF { #2 }
17197 {
17198 \__flowfram_new_static:nnnnnn
17199 { #1 } { \paperwidth }{ \paperheight }
17200 { \l__flowfram_x_dim } { \l__flowfram_y_dim }
17201 { #2 }
17202 }
17203 {
17204 \__flowfram_new_static:nnnnn
17205 { #1 } { \paperwidth } { \paperheight }
17206 { \l__flowfram_x_dim } { \l__flowfram_y_dim }
17207 }
17208 \flowfram_frame_set_dim:nnnn { static} { evenx } { \c@maxstatic }
17209 { \l__flowfram_evenx_dim }
17210 }
17211 }
17212 % \end{macrocode}
17213 %\end{macro}
17214 %
17215 %\subsubsection{Lines Between Frames}
17216 %\DescribeMacro{\insertvrule}
17217 % Insert a \gls{static} between two frames with a vertical
17218 % rule that goes from the maximum height of the highest
17219 % to the minimum height of the lowest, equidistant from
17220 % both frames. Syntax:\newline
17221 % \cs{insertvrule}\oarg{y top}\oarg{y bottom}\marg{frame1 type}\marg{IDN1}\marg{frame2 type}\meta{IDN2}.
17222 % The starred version uses \glspl{idl} instead of \glspl{idn}.
17223 % The optional arguments indicate to continue above the highest
17224 % point by \meta{y top} or continue below the lowest point
17225 % by \meta{y bottom}.
17226 %
17227 %\begin{macro}{\ffcolumnseprule}
17228 % This has changed in v1.09. Define "\ffcolumnseprule" and use
17229 % instead of "\columnseprule"
17230 % \begin{macrocode}
17231 \newlength\ffcolumnseprule
17232 \setlength{\ffcolumnseprule}{2pt}
17233 % \end{macrocode}
17234 %\end{macro}
17235 %\begin{macro}{\ffruledeclarations}
17236 %\changes{1.11}{2008/06/27}{new}
17237 % This can be redefined to use declarations that affect how the
17238 % rule appears. For example, it can be used to set the colour of
17239 % the rule.
17240 % \begin{macrocode}
17241 \newcommand*{\ffruledeclarations}{}
17242 % \end{macrocode}
17243 %\end{macro}
17244 %
17245 %\begin{macro}{\insertvrule}
17246 % Determine whether or not the starred version is being
17247 % used. The starred version uses the label for the id.
17248 %The first optional argument \meta{y-top} extends the rule by that
17249 %much above the highest point. The second optional argument
17250 %\meta{y-bottom} extends the rule by that much below the lowest
17251 %point.
17252 %Syntax:
17253 %\cs{insertvrule}*\oarg{y-top}\oarg{y-bottom}\marg{type-1}\marg{id}\marg{type-2}\marg{id}
17254 %\changes{2.0}{2025-11-24}{changed to document command}
17255 % \begin{macrocode}
17256 \NewDocumentCommand \insertvrule
17257 { s O { \c_zero_dim } O { \c_zero_dim } m m m m }
17258 {
17259 \__flowfram_only_preamble:Nn \insertvrule
17260 {
17261 \__flowfram_get_frame_type:n { #4 }
17262 \__flowfram_get_frame_type:Nn
17263 \l__flowfram_type_ii_int
17264 { #6 }
17265 \bool_lazy_or:nnF
17266 {
17267 \int_compare_p:nNn
17268 { \l__flowfram_type_int } = { -\c_one_int }
17269 }
17270 {
17271 \int_compare_p:nNn
17272 { \l__flowfram_type_ii_int } = { -\c_one_int }
17273 }
17274 {
17275 \IfBooleanTF { #1 }
17276 {
17277 \use:c { __flowfram_get_ #6 _id:e } { #7 }
17278 \int_set_eq:NN \l__flowfram_id_ii_int \l__flowfram_id_int
17279 \use:c { __flowfram_get_ #4 _id:e } { #5 }
17280 \__flowfram_insert_v_rule:nnNnNn
17281 { #2 } { #3 }
17282 \l__flowfram_type_int { \l__flowfram_id_int }
17283 \l__flowfram_type_ii_int { \l__flowfram_id_ii_int }
17284 }
17285 {
17286 \__flowfram_insert_v_rule:nnNnNn
17287 { #2 } { #3 }
17288 \l__flowfram_type_int { #5 }
17289 \l__flowfram_type_ii_int { #7 }
17290 }
17291 }
17292 }
17293 }
17294 % \end{macrocode}
17295 %\end{macro}
17296 %\begin{macro}{\@insertvrule}
17297 % Version 2.0 removed \cs{@insertvrule},
17298 %\changes{2.0}{2025-11-24}{removed}
17299 %\end{macro}
17300 % Need some lengths:
17301 %\begin{macro}{\@ff@left@x}
17302 % Version 2.0 replaced \cs{@ff@left@x}.
17303 %\changes{2.0}{2025-11-24}{replaced}
17304 % \begin{macrocode}
17305 \dim_new:N \l__flowfram_left_x_dim
17306 % \end{macrocode}
17307 %\end{macro}
17308 %\begin{macro}{\@ff@left@y}
17309 % Version 2.0 replaced \cs{@ff@left@y}.
17310 %\changes{2.0}{2025-11-24}{replaced}
17311 % \begin{macrocode}
17312 \dim_new:N \l__flowfram_left_y_dim
17313 % \end{macrocode}
17314 %\end{macro}
17315 %\begin{macro}{\@ff@left@evenx}
17316 % Version 2.0 replaced \cs{@ff@left@evenx}.
17317 %\changes{2.0}{2025-11-24}{replaced}
17318 % \begin{macrocode}
17319 \dim_new:N \l__flowfram_left_evenx_dim
17320 % \end{macrocode}
17321 %\end{macro}
17322 %\begin{macro}{\@ff@left@eveny}
17323 % Version 2.0 replaced \cs{@ff@left@eveny}.
17324 %\changes{2.0}{2025-11-24}{replaced}
17325 % \begin{macrocode}
17326 \dim_new:N \l__flowfram_left_eveny_dim
17327 % \end{macrocode}
17328 %\end{macro}
17329 %\begin{macro}{\@ff@left@width}
17330 % Version 2.0 replaced \cs{@ff@left@width}.
17331 %\changes{2.0}{2025-11-24}{replaced}
17332 % \begin{macrocode}
17333 \dim_new:N \l__flowfram_left_width_dim
17334 % \end{macrocode}
17335 %\end{macro}
17336 %\begin{macro}{\@ff@left@height}
17337 % Version 2.0 replaced \cs{@ff@left@height}.
17338 %\changes{2.0}{2025-11-24}{replaced}
17339 % \begin{macrocode}
17340 \dim_new:N \l__flowfram_left_height_dim
17341 % \end{macrocode}
17342 %\end{macro}
17343 %
17344 %\begin{macro}{\@@insertvrule}
17345 % Version 2.0 removed \cs{@@insertvrule}.
17346 %\changes{2.0}{2025-11-24}{removed}
17347 %\end{macro}
17348 %\begin{macro}{\@@insert@vrule}
17349 % Insert a new \gls{static} between the two specified frames.
17350 % Check to make sure which one is on the left and which one
17351 % is on the right.
17352 % Syntax:\newline
17353 %\marg{y-top}\marg{y-bottom}\meta{type-1 int}\marg{idn}\meta{type-2 int}\marg{idn}
17354 % Version 2.0 replaced \cs{@@insert@vrule}
17355 %\changes{2.0}{2025-11-24}{replaced}
17356 % \begin{macrocode}
17357 \cs_new:Nn \__flowfram_insert_v_rule:nnNnNn
17358 {
17359 \__flowfram_get_frame_bounds_by_typeid:nn { #3 } { #4 }
17360 \dim_set_eq:NN \l__flowfram_left_x_dim \ffareax
17361 \dim_set_eq:NN \l__flowfram_left_y_dim \ffareay
17362 \dim_set_eq:NN \l__flowfram_left_width_dim \ffareawidth
17363 \dim_set_eq:NN \l__flowfram_left_height_dim \ffareaheight
17364 \__flowfram_get_frame_bounds_by_typeid:nn { #5 } { #6 }
17365 \dim_compare:nNnT
17366 { \l__flowfram_left_x_dim } > { \ffareax }
17367 {
17368 \__flowfram_swap_dim:NN \l__flowfram_left_x_dim \ffareax
17369 \__flowfram_swap_dim:NN \l__flowfram_left_y_dim \ffareax
17370 \__flowfram_swap_dim:NN \l__flowfram_left_evenx_dim \ffareaevenx
17371 \__flowfram_swap_dim:NN \l__flowfram_left_eveny_dim \ffareaevenx
17372 \__flowfram_swap_dim:NN \l__flowfram_left_width_dim \ffareawidth
17373 \__flowfram_swap_dim:NN \l__flowfram_left_height_dim \ffareaheight
17374 }
17375 \dim_set:Nn \l__flowfram_x_dim
17376 {
17377 \l__flowfram_left_x_dim
17378 + \l__flowfram_left_width_dim
17379 }
17380 \dim_set:Nn \l__flowfram_sfdf_width_dim
17381 {
17382 \ffareax - \l__flowfram_x_dim
17383 }
17384 \dim_set:Nn \l__flowfram_sfdf_height_dim
17385 {
17386 \l__flowfram_left_y_dim
17387 + \l__flowfram_left_height_dim
17388 }
17389 \dim_set:Nn \l__flowfram_y_dim
17390 {
17391 \ffareay + \ffareaheight
17392 }
17393 \dim_compare:nNnT
17394 { \l__flowfram_y_dim } > { \l__flowfram_sfdf_height_dim }
17395 {
17396 \dim_set_eq:NN \l__flowfram_sfdf_height_dim \l__flowfram_y_dim
17397 }
17398 \dim_compare:nNnTF
17399 { \l__flowfram_left_y_dim } < { \ffareay }
17400 {
17401 \dim_set_eq:NN \l__flowfram_y_dim \l__flowfram_left_y_dim
17402 }
17403 {
17404 \dim_set_eq:NN \l__flowfram_y_dim \ffareay
17405 }
17406 \dim_add:Nn \l__flowfram_sfdf_height_dim
17407 {
17408 - \l__flowfram_y_dim
17409 }
17410 \__flowfram_new_static:nnnnn
17411 { all }
17412 { \l__flowfram_sfdf_width_dim }
17413 { \l__flowfram_sfdf_height_dim }
17414 { \l__flowfram_x_dim }
17415 { \l__flowfram_y_dim }
17416 \dim_add:Nn \l__flowfram_sfdf_height_dim
17417 {
17418 #1 + #2
17419 }
17420 \setstaticcontents { \c@maxstatic }
17421 {
17422 \ffruledeclarations
17423 \ffvrule { #2 } { \ffcolumnseprule }
17424 { \l__flowfram_sfdf_height_dim }
17425 }
17426 \int_case:nn { #3 }
17427 {
17428 { \c_flowfram_frame_type_flow_int }
17429 {
17430 \flowfram_set_clist_to_frame_clist:Nnnn
17431 \l__flowfram_pages_clist
17432 { flow } { pagelist } { #4 }
17433 }
17434 { \c_flowfram_frame_type_static_int }
17435 {
17436 \flowfram_set_clist_to_frame_clist:Nnnn
17437 \l__flowfram_pages_clist
17438 { static } { pagelist } { #4 }
17439 }
17440 { \c_flowfram_frame_type_dynamic_int }
17441 {
17442 \flowfram_set_clist_to_frame_clist:Nnnn
17443 \l__flowfram_pages_clist
17444 { dynamic } { pagelist } { #4 }
17445 }
17446 }
17447 \setstaticframe { \c@maxstatic }
17448 { pages = \l__flowfram_pages_clist }
17449 % \end{macrocode}
17450 % Check the difference between odd and even page co-ordinates
17451 % and shift new frame in same direction. (Assumes the two
17452 % original frames stay in the same relative position.)
17453 % \begin{macrocode}
17454 \dim_add:Nn \l__flowfram_x_dim
17455 {
17456 \l__flowfram_left_evenx_dim
17457 - \l__flowfram_left_x_dim
17458 }
17459 \dim_add:Nn \l__flowfram_y_dim
17460 {
17461 \l__flowfram_left_eveny_dim
17462 - \l__flowfram_left_y_dim
17463 }
17464 \setstaticframe { \c@maxstatic }
17465 {
17466 evenx=\l__flowfram_x_dim ,
17467 eveny=\l__flowfram_y_dim
17468 }
17469 }
17470 % \end{macrocode}
17471 %\end{macro}
17472 %\begin{macro}{\ffvrule}
17473 %\changes{1.11}{2008/06/27}{new}
17474 %\cs{ffvrule}\marg{offset}\marg{width}\marg{height}\par
17475 % Draws the rule for \cs{insertvrule}
17476 % \begin{macrocode}
17477 \newcommand*{\ffvrule}[3]{%
17478 \hfill
17479 \rule [ - #1 ] { #2 } { #3 }
17480 \hfill
17481 \mbox { }
17482 }
17483 % \end{macrocode}
17484 %\end{macro}
17485 %\begin{macro}{\@sinsertvrule}
17486 % Version 2.0 removed \cs{@sinsertvrule}.
17487 %\changes{2.0}{2025-11-24}{removed}
17488 %\end{macro}
17489 %\begin{macro}{\@@sinsertvrule}
17490 % Version 2.0 removed \cs{@@sinsertvrule}.
17491 %\changes{2.0}{2025-11-24}{removed}
17492 %\end{macro}
17493 %\begin{macro}{\inserthrule}
17494 % Now for a horizontal rule. Syntax similar to "\insertvrule".
17495 %Syntax:
17496 %\cs{inserthrule}*\oarg{x-left}\oarg{x-right}\marg{type-1}\marg{id}\marg{type-2}\marg{id}
17497 % \begin{macrocode}
17498 \NewDocumentCommand \inserthrule
17499 { s O { \c_zero_dim } O { \c_zero_dim } m m m m }
17500 {
17501 \__flowfram_only_preamble:Nn \inserthrule
17502 {
17503 \__flowfram_get_frame_type:n { #4 }
17504 \__flowfram_get_frame_type:Nn
17505 \l__flowfram_type_ii_int
17506 { #6 }
17507 \bool_lazy_or:nnF
17508 {
17509 \int_compare_p:nNn
17510 { \l__flowfram_type_int } = { -\c_one_int }
17511 }
17512 {
17513 \int_compare_p:nNn
17514 { \l__flowfram_type_ii_int } = { -\c_one_int }
17515 }
17516 {
17517 \IfBooleanTF { #1 }
17518 {
17519 \use:c { __flowfram_get_ #6 _id:e } { #7 }
17520 \int_set_eq:NN \l__flowfram_id_ii_int \l__flowfram_id_int
17521 \use:c { __flowfram_get_ #4 _id:e } { #5 }
17522 \__flowfram_insert_h_rule:nnNnNn
17523 { #2 } { #3 }
17524 \l__flowfram_type_int { \l__flowfram_id_int }
17525 \l__flowfram_type_ii_int { \l__flowfram_id_ii_int }
17526 }
17527 {
17528 \__flowfram_insert_h_rule:nnNnNn
17529 { #2 } { #3 }
17530 \l__flowfram_type_int { #5 }
17531 \l__flowfram_type_ii_int { #7 }
17532 }
17533 }
17534 }
17535 }
17536 % \end{macrocode}
17537 %\end{macro}
17538 %\begin{macro}{\@inserthrule}
17539 % Version 2.0 removed \cs{@inserthrule}.
17540 %\changes{2.0}{2025-11-24}{removed}
17541 %\end{macro}
17542 %\begin{macro}{\@@inserthrule}
17543 % Version 2.0 removed \cs{@@inserthrule}.
17544 %\changes{2.0}{2025-11-24}{removed}
17545 %\end{macro}
17546 %\begin{macro}{\@@insert@hrule}
17547 % Insert a new \gls{static} between the two specified frames.
17548 % Check to make sure which one is on the top and which one
17549 % is on the bottom.
17550 % Syntax:\newline
17551 %\marg{x left}\marg{x right}\marg{type ID}\marg{IDN}\marg{type ID}\marg{IDN}.
17552 % \begin{macrocode}
17553 \cs_new:Nn \__flowfram_insert_h_rule:nnNnNn
17554 {
17555 \__flowfram_get_frame_bounds_by_typeid:nn { #3 } { #4 }
17556 \dim_set_eq:NN \l__flowfram_left_x_dim \ffareax
17557 \dim_set_eq:NN \l__flowfram_left_y_dim \ffareay
17558 \dim_set_eq:NN \l__flowfram_left_width_dim \ffareawidth
17559 \dim_set_eq:NN \l__flowfram_left_height_dim \ffareaheight
17560 \__flowfram_get_frame_bounds_by_typeid:nn { #5 } { #6 }
17561 \dim_compare:nNnT
17562 { \l__flowfram_left_y_dim } > { \ffareay }
17563 {
17564 \__flowfram_swap_dim:NN \l__flowfram_left_x_dim \ffareax
17565 \__flowfram_swap_dim:NN \l__flowfram_left_y_dim \ffareay
17566 \__flowfram_swap_dim:NN \l__flowfram_left_width_dim \ffareawidth
17567 \__flowfram_swap_dim:NN \l__flowfram_left_height_dim \ffareaheight
17568 }
17569 \dim_set:Nn \l__flowfram_y_dim
17570 {
17571 \l__flowfram_left_y_dim
17572 + \l__flowfram_left_height_dim
17573 }
17574 \dim_set:Nn \l__flowfram_sfdf_height_dim
17575 {
17576 \ffareay - \l__flowfram_y_dim
17577 }
17578 \dim_set:Nn \l__flowfram_sfdf_width_dim
17579 {
17580 \l__flowfram_left_x_dim
17581 + \l__flowfram_left_width_dim
17582 }
17583 \dim_set:Nn \l__flowfram_x_dim
17584 {
17585 \ffareax + \ffareawidth
17586 }
17587 \dim_compare:nNnT
17588 { \l__flowfram_x_dim } > { \l__flowfram_sfdf_width_dim }
17589 {
17590 \dim_set:Nn \l__flowfram_sfdf_width_dim { \l__flowfram_x_dim }
17591 }
17592 \dim_compare:nNnTF
17593 { \l__flowfram_left_x_dim } < { \ffareax }
17594 {
17595 \dim_set:Nn \l__flowfram_x_dim { \l__flowfram_left_x_dim }
17596 }
17597 {
17598 \dim_set:Nn \l__flowfram_x_dim { \ffareax }
17599 }
17600 \dim_add:Nn \l__flowfram_sfdf_width_dim
17601 {
17602 - \l__flowfram_x_dim
17603 }
17604 \__flowfram_new_static:nnnnn
17605 { all }
17606 { \l__flowfram_sfdf_width_dim }
17607 { \l__flowfram_sfdf_height_dim }
17608 { \l__flowfram_x_dim }
17609 { \l__flowfram_y_dim }
17610 \dim_add:Nn \l__flowfram_sfdf_width_dim
17611 { #1 + #2 }
17612 \setstaticcontents { \c@maxstatic }
17613 {
17614 \ffruledeclarations
17615 \ffhrule { #1 } { \l__flowfram_sfdf_width_dim } { \ffcolumnseprule }
17616 }
17617 \int_case:nn { #3 }
17618 {
17619 { \c_flowfram_frame_type_flow_int }
17620 {
17621 \flowfram_set_clist_to_frame_clist:Nnnn
17622 \l__flowfram_pages_clist
17623 { flow } { pagelist } { #4 }
17624 }
17625 { \c_flowfram_frame_type_static_int }
17626 {
17627 \flowfram_set_clist_to_frame_clist:Nnnn
17628 \l__flowfram_pages_clist
17629 { static } { pagelist } { #4 }
17630 }
17631 { \c_flowfram_frame_type_dynamic_int }
17632 {
17633 \flowfram_set_clist_to_frame_clist:Nnnn
17634 \l__flowfram_pages_clist
17635 { dynamic } { pagelist } { #4 }
17636 }
17637 }
17638 \setstaticframe { \c@maxstatic }
17639 { pages = \clist_use:N \l__flowfram_pages_clist }
17640 \dim_add:Nn \l__flowfram_x_dim
17641 {
17642 \l__flowfram_left_evenx_dim
17643 - \l__flowfram_left_x_dim
17644 }
17645 \dim_add:Nn \l__flowfram_y_dim
17646 {
17647 \l__flowfram_left_eveny_dim
17648 - \l__flowfram_left_y_dim
17649 }
17650 \setstaticframe {\c@maxstatic}
17651 {
17652 evenx = \l__flowfram_x_dim ,
17653 eveny = \l__flowfram_y_dim
17654 }
17655 }
17656 % \end{macrocode}
17657 %\end{macro}
17658 %\begin{macro}{\ffhrule}
17659 %\changes{1.11}{2008/06/27}{new}
17660 %\cs{ffhrule}\marg{offset}\marg{width}\marg{height}\par
17661 % Draws the rule for \cs{inserthrule}
17662 % \begin{macrocode}
17663 \newcommand*{\ffhrule}[3]{%
17664 \hspace* { -#1 } \rule { #2 } { #3 }
17665 }
17666 % \end{macrocode}
17667 %\end{macro}
17668 %\begin{macro}{\@sinserthrule}
17669 % Version 2.0 removed \cs{@sinserthrule}.
17670 %\changes{2.0}{2025-11-24}{removed}
17671 %\end{macro}
17672 %\begin{macro}{\@@sinserthrule}
17673 % Version 2.0 removed \cs{@@sinserthrule}.
17674 %\changes{2.0}{2025-11-24}{removed}
17675 %\end{macro}
17676 %
17677 % \subsection{Putting Chapter Headings in Dynamic Frames}
17678 %\begin{macro}{\dfchaphead}
17679 % Provide facility to make chapter headings appear
17680 % in specified \gls{dynamic}.
17681 % I originally called this macro "\putchapterheadingsindynamicframe"
17682 % which was descriptive, but overly long, so I changed it
17683 % to the rather more cryptic name "\dfchaphead".
17684 % If the starred form is used, the frame is identified by \gls{idl},
17685 % the unstarred form identifies the frame \gls{idn}.
17686 %\changes{2.0}{2025-11-24}{changed to document command}
17687 %
17688 %This is implemented by redefining \cs{@makechapterhead}
17689 %and \cs{@makeschapterhead} so that they place their argument in the
17690 %applicable dynamic frame. Unfortunately this causes a problem if a
17691 %class doesn't use these commands. As from v2.0, an alternative
17692 %approach is available but the original method is retained.
17693 % \begin{macrocode}
17694 \NewDocumentCommand \dfchaphead { s m }
17695 {
17696 \cs_if_exist:NTF \chapter
17697 {
17698 \IfBooleanTF { #1 }
17699 {
17700 \__flowfram_get_dynamic_id:n { #2 }
17701 }
17702 {
17703 \int_set:Nn \l__flowfram_id_int { #2 }
17704 }
17705 % \end{macrocode}
17706 % Store current chapter head definitions for starred and unstarred
17707 % versions
17708 % \begin{macrocode}
17709 \let\@ff@OLDmakechapterhead\@makechapterhead
17710 \let\@ff@OLDmakeschapterhead\@makeschapterhead
17711 % \end{macrocode}
17712 % Define user commands that can be redefined to modify the chapter
17713 % head style (in the event that the user is using a class that
17714 % doesn't provide an easy means to do this.)
17715 % \begin{macrocode}
17716 \renewcommand{\DFchapterstyle}[1]{\@ff@OLDmakechapterhead{##1}}%
17717 \renewcommand{\DFschapterstyle}[1]{\@ff@OLDmakeschapterhead{##1}}%
17718 % \end{macrocode}
17719 % Redefine chapter heads so that they put their contents in the
17720 % requested dynamic frame. First the unstarred version:
17721 % \begin{macrocode}
17722 \xdef\@makechapterhead##1{%
17723 \exp_not:N
17724 \__flowfram_set_dynamic_contents:nn
17725 { \int_use:N \l__flowfram_id_int }
17726 {
17727 \noexpand\DFchapterstyle { ##1 }
17728 }
17729 }
17730 % \end{macrocode}
17731 % Now the starred version:
17732 % \begin{macrocode}
17733 \xdef\@makeschapterhead##1{%
17734 \exp_not:N \__flowfram_set_dynamic_contents:nn
17735 { \int_use:N \l__flowfram_id_int }
17736 {
17737 \noexpand \DFschapterstyle { ##1 }
17738 }
17739 }
17740 }
17741 {
17742 \msg_error:nn { flowfram } { no-chapters }
17743 }
17744 }
17745 % \end{macrocode}
17746 %\end{macro}
17747 %
17748 % Define style for the chapter heading. These commands
17749 % are only used with \cs{dfchaphead}.
17750 %\begin{macro}{\DFchapterstyle}
17751 % \begin{macrocode}
17752 \newcommand{\DFchapterstyle}[1]{#1}
17753 % \end{macrocode}
17754 %\end{macro}
17755 %\begin{macro}{\DFschapterstyle}
17756 % \begin{macrocode}
17757 \newcommand{\DFschapterstyle}[1]{#1}
17758 % \end{macrocode}
17759 %\end{macro}
17760 %
17761 % \begin{macrocode}
17762 \int_new:N \g__flowfram_chaphead_frame_id
17763 % \end{macrocode}
17764 %
17765 %\begin{macro}{\ChapterInDynamic}
17766 %An alternative to \cs{dfchaphead} that doesn't alter \cs{@makechapterhead}
17767 %and \cs{@makeschapterhead}.
17768 %\changes{2.0}{2025-11-24}{new}
17769 % \begin{macrocode}
17770 \NewDocumentCommand \ChapterInDynamic { s m }
17771 {
17772 \cs_if_exist:NTF \chapter
17773 {
17774 \IfBooleanTF { #1 }
17775 {
17776 \__flowfram_get_dynamic_id:e { #2 }
17777 \int_gset_eq:NN
17778 \g__flowfram_chaphead_frame_id
17779 \l__flowfram_id_int
17780 }
17781 {
17782 \int_gset:Nn \g__flowfram_chaphead_frame_id { #2 }
17783 }
17784 \__flowfram_make_chapter_head:n { \g__flowfram_chaphead_frame_id }
17785 }
17786 {
17787 \msg_error:nn { flowfram } { no-chapters }
17788 }
17789 }
17790 % \end{macrocode}
17791 %\end{macro}
17792 %
17793 %With the alternative approach, \cs{chapter} command is placed in the dynamic
17794 %frame content instead of redefining the internal commands to put
17795 %their argument in the dynamic frame. There are a number of problems with this:
17796 %the initial clear page (or clear double page) can't go in the
17797 %\cs{parbox} used by the dynamic frame. If there are any sections that
17798 %follow the chapter heading on the same page their numbering will be
17799 %out of sync as the dynamic contents aren't typeset until the page
17800 %is output. So this approach first typesets the chapter heading in a
17801 %box (having locally disabled the problematic commands) and then
17802 %places the box in the dynamic contents. This rather goes against
17803 %the idea that dynamic frames don't typeset their content until the
17804 %page is output, but it's the simplest way around it that avoids
17805 %messing around with internals that may break certain classes.
17806 %Extra content can still be appended to the dynamic frame (which
17807 %can't be done in a static frame.
17808 %
17809 %Replicate report and book class \cs{@makechapterhead} and
17810 %\cs{@makeschapterhead} to test if those definitions currently
17811 %apply. This means they can be redefined to remove the hard-coded
17812 %top vertical space and allow more flexibility. Other classes, such
17813 %as memoir and the KOMA Script classes have their own hooks so don't
17814 %worry about them.
17815 % \begin{macrocode}
17816 \ExplSyntaxOff
17817 \newcommand*\@flowfram@standard@makechapterhead[1]{%
17818 \vspace *{50\p@ }%
17819 {\parindent \z@ \raggedright \normalfont
17820 \ifnum \c@secnumdepth >\m@ne
17821 \if@mainmatter \huge \bfseries \@chapapp \space \thechapter
17822 \par
17823 \nobreak \vskip 20\p@
17824 \fi
17825 \fi
17826 \interlinepenalty \@M
17827 \Huge \bfseries #1\par
17828 \nobreak
17829 \vskip 40\p@
17830 }}
17831 \ExplSyntaxOn
17832 % \end{macrocode}
17833 %
17834 % \begin{macrocode}
17835 \cs_if_exist:NTF \chapter
17836 {
17837 % \end{macrocode}
17838 %Redefine \cs{@makechapterhead} and \cs{@makeschapterhead} if they
17839 %have the book or report definition to allow for greater
17840 %flexibility. Only testing the definition of \cs{@makechapterhead}.
17841 %This assumes that if that definition matches the standard classes
17842 %then it's likely that \cs{@makeschapterhead} will also be the
17843 %standard definition.
17844 % \begin{macrocode}
17845 \cs_if_eq:NNT \@makechapterhead \@flowfram@standard@makechapterhead
17846 {
17847 % \end{macrocode}
17848 %\begin{macro}{\ffchapterpreheadskip}
17849 % \begin{macrocode}
17850 \newcommand \ffchapterpreheadskip
17851 {
17852 \vspace *{50\p@ }
17853 }
17854 % \end{macrocode}
17855 %\end{macro}
17856 %\begin{macro}{\ffchapterpostheadskip}
17857 % \begin{macrocode}
17858 \newcommand \ffchapterpostheadskip
17859 {
17860 \vspace *{40\p@ }
17861 }
17862 % \end{macrocode}
17863 %\end{macro}
17864 %\begin{macro}{\ffchapterheadstyle}
17865 % \begin{macrocode}
17866 \newcommand \ffchapterheadstyle
17867 {
17868 \parindent \z@ \raggedright
17869 }
17870 % \end{macrocode}
17871 %\end{macro}
17872 %\begin{macro}{\ffchapternamenumfont}
17873 % \begin{macrocode}
17874 \newcommand \ffchapternamenumfont [ 1 ] { { \huge #1 } }
17875 % \end{macrocode}
17876 %\end{macro}
17877 %\begin{macro}{\ffchapternamenum}
17878 % \begin{macrocode}
17879 \newcommand \ffchapternamenum [ 2 ]
17880 {
17881 #1 \space #2
17882 }
17883 % \end{macrocode}
17884 %\end{macro}
17885 %\begin{macro}{\ffchapterpostnamenum}
17886 % \begin{macrocode}
17887 \newcommand \ffchapterpostnamenum
17888 {
17889 \par
17890 \nobreak
17891 \vspace *{20\p@ }
17892 }
17893 % \end{macrocode}
17894 %\end{macro}
17895 %\begin{macro}{\ffchaptertitlefont}
17896 % \begin{macrocode}
17897 \newcommand \ffchaptertitlefont [ 1 ] { { \Huge #1 } }
17898 % \end{macrocode}
17899 %\end{macro}
17900 %
17901 %\begin{macro}{\ffchapterdefaultfont}
17902 % \begin{macrocode}
17903 \newcommand{\ffchapterdefaultfont}{\normalfont \bfseries}
17904 % \end{macrocode}
17905 %\end{macro}
17906 %
17907 %\begin{macro}{\@makechapterhead}
17908 % \begin{macrocode}
17909 \renewcommand*\@makechapterhead[1]
17910 {
17911 \ffchapterpreheadskip
17912 {
17913 \ffchapterheadstyle
17914 \ffchapterdefaultfont
17915 \ifnum \c@secnumdepth >\m@ne
17916 \if@mainmatter
17917 \ffchapternamenumfont
17918 {
17919 \ffchapternamenum { \@chapapp } { \thechapter }
17920 \ffchapterpostnamenum
17921 }
17922 \fi
17923 \fi
17924 \interlinepenalty \@M
17925 \ffchaptertitlefont { #1 \par }
17926 \nobreak
17927 \ffchapterpostheadskip
17928 }
17929 }
17930 % \end{macrocode}
17931 %\end{macro}
17932 %
17933 %\begin{macro}{\@makeschapterhead}
17934 % \begin{macrocode}
17935 \renewcommand*\@makeschapterhead[1]
17936 {
17937 \ffchapterpreheadskip
17938 {
17939 \ffchapterheadstyle
17940 \ffchapterdefaultfont
17941 \interlinepenalty \@M
17942 \ffchaptertitlefont { #1 \par }
17943 \nobreak
17944 \ffchapterpostheadskip
17945 }
17946 }
17947 % \end{macrocode}
17948 %\end{macro}
17949 %
17950 % \begin{macrocode}
17951 }
17952 % \end{macrocode}
17953 %\begin{macro}{\dfchapterclearpage}
17954 % \begin{macrocode}
17955 \cs_if_exist:NTF \if@openright
17956 {
17957 \newcommand \dfchapterclearpage
17958 {
17959 \legacy_if:nTF { @openright }
17960 {
17961 \cleardoublepage
17962 }
17963 {
17964 \clearpage
17965 }
17966 }
17967 }
17968 {
17969 \newcommand \dfchapterclearpage
17970 {
17971 \clearpage
17972 }
17973 }
17974 % \end{macrocode}
17975 %\end{macro}
17976 %Box used to store the chapter heading:
17977 % \begin{macrocode}
17978 \newsavebox \flowfram@dfchap@sbox
17979 % \end{macrocode}
17980 %Hooks for use within the box:
17981 % \begin{macrocode}
17982 \NewMirroredHookPair
17983 { flowfram / chaphead / before }
17984 { flowfram / chaphead / after }
17985 \NewMirroredHookPair
17986 { flowfram / chaphead / box / before }
17987 { flowfram / chaphead / box / after }
17988 % \end{macrocode}
17989 %If \cs{ffchapterpreheadskip} is defined, redefine to do nothing at
17990 %the start of the box:
17991 % \begin{macrocode}
17992 \cs_if_exist:NT \ffchapterpreheadskip
17993 {
17994 \AddToHook
17995 { flowfram / chaphead / box / before }
17996 {
17997 \let \ffchapterpreheadskip \relax
17998 }
17999 }
18000 % \end{macrocode}
18001 %Gather toc lines so they can be expanded straight away:
18002 % \begin{macrocode}
18003 \tl_new:N \g__flowfram_df_chapter_lines_tl
18004 \cs_new:Nn \__flowfram_df_addcontentsline:nnn
18005 {
18006 \tl_gput_right:Nn \g__flowfram_df_chapter_lines_tl
18007 {
18008 \addcontentsline { #1 } { #2 } { #3 }
18009 }
18010 }
18011 \cs_new:Nn \__flowfram_df_markright:n
18012 {
18013 \tl_gput_right:Nn \g__flowfram_df_chapter_lines_tl
18014 {
18015 \markright { #1 }
18016 }
18017 }
18018 \cs_new:Nn \__flowfram_df_markboth:nn
18019 {
18020 \tl_gput_right:Nn \g__flowfram_df_chapter_lines_tl
18021 {
18022 \markboth { #1 } { #2 }
18023 }
18024 }
18025 % \end{macrocode}
18026 %The box needs to have the same width as the dynamic frame.
18027 % \begin{macrocode}
18028 \dim_new:N \l__flowfram_df_chapbox_head_width_dim
18029 % \end{macrocode}
18030 %The argument is the actual chapter command (with its arguments):
18031 % \begin{macrocode}
18032 \cs_new:Nn \__flowfram_df_chapter:n
18033 {
18034 \dfchapterclearpage
18035 \tl_gclear:N \g__flowfram_df_chapter_lines_tl
18036 \flowfram_set_dim_to_frame_dim:Nnnn
18037 \l__flowfram_df_chapbox_head_width_dim
18038 { dynamic } { width } { \g__flowfram_chaphead_id_int }
18039 \UseHook { flowfram / chaphead / before }
18040 \sbox \flowfram@dfchap@sbox
18041 {
18042 % \end{macrocode}
18043 %Set the frame's text colour:
18044 % \begin{macrocode}
18045 \flowfram_set_tl_to_frame_tl:Nnnn
18046 \l__flowfram_textcolor_tl
18047 { dynamic } { textcolor } { \g__flowfram_chaphead_id_int }
18048 \__flowfram_set_text_color:
18049 % \end{macrocode}
18050 %Typeset the heading in a parbox:
18051 % \begin{macrocode}
18052 \parbox
18053 { \l__flowfram_df_chapbox_head_width_dim }
18054 {
18055 \let \clearpage \relax
18056 \let \cleardoublepage \relax
18057 \let \onecolumn \relax
18058 \@twocolumnfalse
18059 \let \addcontentsline \__flowfram_df_addcontentsline:nnn
18060 \let \markright \__flowfram_df_markright:n
18061 \let \markboth \__flowfram_df_markboth:nn
18062 \UseHook { flowfram / chaphead / box / before }
18063 #1
18064 % \end{macrocode}
18065 %The scoping introduced by the \cs{parbox} interferes with
18066 %KOMA's local redefinition of \cs{@currenttocentry}, so if this
18067 %command is defined, ensure that its definition is still available
18068 %outside this box.
18069 % \begin{macrocode}
18070 \tl_if_exist:NT \@currenttocentry
18071 {
18072 \tl_gset:Ne \@currenttocentry { \@currenttocentry }
18073 }
18074 \UseHook { flowfram / chaphead / box / after }
18075 }
18076 }
18077 \__flowfram_set_dynamic_contents:nn
18078 { \g__flowfram_chaphead_id_int }
18079 {
18080 \box_use_drop:N \flowfram@dfchap@sbox
18081 \@afterheading
18082 }
18083 \g__flowfram_df_chapter_lines_tl
18084 \tl_gclear:N \g__flowfram_df_chapter_lines_tl
18085 \UseHook { flowfram / chaphead / after }
18086 }
18087 % \end{macrocode}
18088 %Unstarred chapter with one optional argument.
18089 % \begin{macrocode}
18090 \cs_new:Nn \__flowfram_df_chapter:nn
18091 {
18092 \__flowfram_df_chapter:n
18093 {
18094 \__flowfram_org_chapter: [ #1 ] { #2 }
18095 }
18096 }
18097 % \end{macrocode}
18098 %Unstarred chapter with two optional arguments.
18099 % \begin{macrocode}
18100 \cs_new:Nn \__flowfram_df_chapter:nnn
18101 {
18102 \__flowfram_df_chapter:n
18103 {
18104 \__flowfram_org_chapter: [ #1 ] [ #2 ] { #3 }
18105 }
18106 }
18107 % \end{macrocode}
18108 %Starred chapter.
18109 % \begin{macrocode}
18110 \cs_new:Nn \__flowfram_df_chapter_star:nn
18111 {
18112 \__flowfram_df_chapter:n
18113 {
18114 \flowfram_nonum_section:Nnn
18115 \__flowfram_org_chapter: { #1 } { #2 }
18116 }
18117 }
18118 % \end{macrocode}
18119 %Return true if the argument is "chapter" and a dynamic frame has
18120 %been identified for chapter headings.
18121 % \begin{macrocode}
18122 \prg_new_conditional:Nnn \__flowfram_if_df_chapter:n
18123 { T, F, TF }
18124 {
18125 \int_if_zero:nTF { \g__flowfram_chaphead_id_int }
18126 { \prg_return_false: }
18127 {
18128 \tl_if_eq:nnTF { #1 } { chapter }
18129 { \prg_return_true: }
18130 { \prg_return_false: }
18131 }
18132 }
18133 }
18134 {
18135 % \end{macrocode}
18136 %Always returns false as there are no chapters.
18137 % \begin{macrocode}
18138 \prg_new_conditional:Nnn \__flowfram_if_df_chapter:n
18139 { T, F, TF }
18140 {
18141 \prg_return_false:
18142 }
18143 }
18144 % \end{macrocode}
18145 %\begin{macro}{\@dynamicchap}
18146 % Version 2.0 replaced \cs{@dynamicchap}.
18147 %\changes{2.0}{2025-11-24}{replaced}
18148 % \begin{macrocode}
18149 \cs_new:Nn \__flowfram_make_chapter_head:n
18150 {
18151 \int_set:Nn \g__flowfram_chaphead_id_int { #1 }
18152 }
18153 \int_new:N \g__flowfram_chaphead_id_int
18154 % \end{macrocode}
18155 %\end{macro}
18156 %\begin{macro}{\@sdynamicchap}
18157 % Version 2.0 removed \cs{@sdynamicchap}.
18158 %\changes{2.0}{2025-11-24}{removed}
18159 %\end{macro}
18160 %
18161 %\begin{macro}{\NoChapterInDynamic}
18162 %\changes{2.0}{2025-11-24}{new}
18163 %Revert back.
18164 % \begin{macrocode}
18165 \NewDocumentCommand \NoChapterInDynamic { }
18166 {
18167 \int_zero:N \g__flowfram_chaphead_id_int
18168 }
18169 % \end{macrocode}
18170 %\end{macro}
18171 %
18172 % There is no facility for placing other sectional types
18173 % in \glspl{dynamic}. This is because, either (1) the sectioning
18174 % command does not start a new page, in which case there
18175 % is no way of telling where exactly the new section will start,
18176 % and having a section title in some other location on the
18177 % page is ambiguous, and would really confuse the reader, or
18178 % (2) in the case of "\part" in report or book class files, the
18179 % title appears on a page of its own, so where is the point in
18180 % putting it in a \gls{dynamic}?
18181 %
18182 %\subsection{Thumbtabs}
18183 % Define counter to keep track of total number of
18184 % thumbtabs.
18185 % \begin{macrocode}
18186 \newcounter{maxthumbtabs}
18187 % \end{macrocode}
18188 %
18189 %\begin{macro}{\defaultthumbtabtype}
18190 % Check to see if chapters are defined, if they are make
18191 % thumbtabs correspond to chapters, otherwise make
18192 % thumbtabs correspond to sections.
18193 % \begin{macrocode}
18194 \cs_if_exist:NTF \chapter
18195 {
18196 \newcommand*{\defaultthumbtabtype}{chapter}
18197 }
18198 {
18199 \newcommand*{\defaultthumbtabtype}{section}
18200 }
18201 % \end{macrocode}
18202 %\end{macro}
18203 %\begin{macro}{\@ttb@type}
18204 % Section type to assign to thumbtabs.
18205 % Version 2.0 renamed \cs{@ttb@type}
18206 %\changes{2.0}{2025-11-24}{renamed}
18207 % \begin{macrocode}
18208 \tl_new:N \g__flowfram_thumbtab_type_tl
18209 \tl_gset:Nn \g__flowfram_thumbtab_type_tl
18210 { \defaultthumbtabtype }
18211 % \end{macrocode}
18212 %\end{macro}
18213 %
18214 %The table of contents isn't read until the start of the
18215 %document, but the thumbtabs are created in the preamble, so the toc
18216 %information can't be used as it will be too late by the time it's
18217 %read. This means a separate file is required.
18218 %
18219 % \begin{macrocode}
18220 \cs_new:Nn \__flowfram_ttb_num:n
18221 {
18222 \addtocontents {ttb}
18223 {
18224 \protect \thumbtab
18225 { \theFramePageCounter }
18226 { \arabic { \g__flowfram_thumbtab_type_tl } }
18227 { #1 }
18228 { \@currentHref }
18229 }
18230 }
18231 % \end{macrocode}
18232 %
18233 %Provide a counter for unnumbered tabs.
18234 % \begin{macrocode}
18235 \newcounter{thumbtabnonum}
18236 % \end{macrocode}
18237 %
18238 % \begin{macrocode}
18239 \cs_new:Nn \__flowfram_ttb_nonum:n
18240 {
18241 \bool_if:NT \g__flowfram_save_nonum_thumbtabs_bool
18242 {
18243 \refstepcounter { thumbtabnonum }
18244 \addtocontents { ttb }
18245 {
18246 \protect \thumbtab
18247 { \theFramePageCounter }
18248 { }
18249 { #1 }
18250 { thumbtabnonum . \thethumbtabnonum }
18251 }
18252 }
18253 }
18254 % \end{macrocode}
18255 %
18256 %\begin{macro}{\makethumbtabs}
18257 % Make the thumbtabs. Read in information from ".ttb"
18258 % file, and open it for output.
18259 % Syntax:\newline
18260 % \cs{makethumbtabs}\oarg{y offset}\marg{height}\oarg{sec type}.
18261 %
18262 %\changes{2.0}{2025-11-24}{changed to document command}
18263 % \begin{macrocode}
18264 \NewDocumentCommand \makethumbtabs
18265 { O { \c_zero_dim } m O { \defaultthumbtabtype } }
18266 {
18267 \exp_args:Nnne
18268 \__flowfram_make_thumbtabs:nnn { #1 } { #2 } { #3 }
18269 \cs_set:Nn \__flowfram_make_thumbtabs:nnn
18270 {
18271 \msg_note:nn { flowfram } { ignoring-multiple-makethumbtabs }
18272 }
18273 }
18274 % \end{macrocode}
18275 %\end{macro}
18276 %\begin{macro}{\@makethumbtabs}
18277 % Now all arguments are known, first redefine the
18278 % appropriate sectioning command, then input the ttb file,
18279 % and create the thumbtabs.
18280 % Version 2.0 replaced \cs{@makethumbtabs}.
18281 %\changes{2.0}{2025-11-24}{replaced}
18282 % \begin{macrocode}
18283 \cs_new:Nn \__flowfram_make_thumbtabs:nnn
18284 {
18285 \cs_if_exist:cTF { #3 }
18286 {
18287 \tl_gset:Ne \g__flowfram_thumbtab_type_tl { #3 }
18288 \@starttoc { ttb }
18289 \__flowfram_create_thumbtabs:nn { #1 } { #2 }
18290 \cs_set:Nn \__flowfram_write_backmatter_ttb:
18291 {
18292 \addtocontents {ttb}
18293 {
18294 \protect \thumbtab@backmatter
18295 { \theFramePageCounter }
18296 }
18297 }
18298 \cs_set:Nn \__flowfram_no_thumbtabs_warn:
18299 {
18300 \msg_warning:nn { flowfram } { no-thumbtabs-rerun }
18301 }
18302 }
18303 {
18304 \msg_error:nnn { flowfram } { section-unit-not-defined } { #3 }
18305 }
18306 }
18307 % \end{macrocode}
18308 %\end{macro}
18309 %Warning to produce if no thumbtabs:
18310 % \begin{macrocode}
18311 \cs_new:Nn \__flowfram_no_thumbtabs_warn:
18312 {
18313 \msg_warning:nn { flowfram } { no-thumbtabs-missing-makethumbtabs }
18314 }
18315 % \end{macrocode}
18316 %Write the page number to the ttb file when \cs{backmatter} is used
18317 %to get the end page range if not thumbtabs in backmatter.
18318 % \begin{macrocode}
18319 \cs_new:Nn \__flowfram_write_backmatter_ttb:
18320 {
18321 }
18322 % \end{macrocode}
18323 %
18324 %\begin{macro}{\@makethumbchapter}
18325 % Version 2.0 removed \cs{@makethumbchapter}.
18326 %\changes{2.0}{2025-11-24}{removed}
18327 %\end{macro}
18328 %
18329 %\begin{macro}{\@makethumbpart}
18330 % Version 2.0 removed \cs{@makethumbpart}.
18331 %\changes{2.0}{2025-11-24}{removed}
18332 %\end{macro}
18333 %\begin{macro}{\@makethumbsection}
18334 % Version 2.0 removed \cs{@makethumbsection}
18335 %\changes{2.0}{2025-11-24}{removed}
18336 %\end{macro}
18337 %\begin{macro}{\thumbtab}
18338 % The thumbtab file, ".ttb", will have a series of "\thumbtab"
18339 % commands, when this file is read in, just store the
18340 % information for now. The table of contents needs to be read first
18341 % to pick up any unnumbered sections that should be included.
18342 %Syntax: \marg{page}\marg{unit num}\marg{title}\marg{target}
18343 % \begin{macrocode}
18344 \newcommand{\thumbtab}[4]{%
18345 \stepcounter { maxthumbtabs }
18346 \__flowfram_message:nnnnn { info-found-thumbtab }
18347 { #1 } { #2 } { #3 } { #4 }
18348 \tl_new:c { g__thumbtab_ \romannumeral \c@maxthumbtabs _pages_tl }
18349 \int_new:c { g__thumbtab_ \romannumeral \c@maxthumbtabs _start_int }
18350 \int_gset:cn { g__thumbtab_ \romannumeral \c@maxthumbtabs _start_int }
18351 { #1 }
18352 \tl_new:c { g__thumbtab_ \romannumeral \c@maxthumbtabs _unitnum_tl }
18353 \tl_gset:cn
18354 { g__thumbtab_ \romannumeral \c@maxthumbtabs _unitnum_tl }
18355 { #2 }
18356 \tl_new:c { g__thumbtab_ \romannumeral \c@maxthumbtabs _title_tl }
18357 \tl_gset:cn { g__thumbtab_ \romannumeral \c@maxthumbtabs _title_tl }
18358 { #3 }
18359 \tl_new:c { g__thumbtab_ \romannumeral \c@maxthumbtabs _link_tl }
18360 \tl_gset:cn { g__thumbtab_ \romannumeral \c@maxthumbtabs _link_tl }
18361 { #4 }
18362 \tl_gclear:N \g__flowfram_ttb_endpage_tl
18363 }
18364 % \end{macrocode}
18365 %\end{macro}
18366 %
18367 %\begin{macro}{\thumbtab@backmatter}
18368 % \begin{macrocode}
18369 \tl_new:N \g__flowfram_ttb_endpage_tl
18370 \newcommand{\thumbtab@backmatter}[1]{%
18371 \tl_gset:Ne \g__flowfram_ttb_endpage_tl { \int_eval:n { #1 - \c_one_int } }
18372 }
18373 % \end{macrocode}
18374 %\end{macro}
18375 %
18376 %Use the thumbtab information.
18377 % \begin{macrocode}
18378 \cs_new:Nn \__flowfram_thumbtab_start:n
18379 {
18380 \int_use:c { g__thumbtab_ \romannumeral #1 _start_int }
18381 }
18382 \cs_new:Nn \__flowfram_thumbtab_unitnum:n
18383 {
18384 \tl_use:c { g__thumbtab_ \romannumeral #1 _unitnum_tl }
18385 }
18386 \cs_new:Nn \__flowfram_thumbtab_pages:n
18387 {
18388 \tl_use:c { g__thumbtab_ \romannumeral #1 _pages_tl }
18389 }
18390 \cs_new:Nn \__flowfram_thumbtab_set_pages:nn
18391 {
18392 \tl_gset:cn { g__thumbtab_ \romannumeral #1 _pages_tl }
18393 { #2 }
18394 }
18395 \cs_generate_variant:Nn \__flowfram_thumbtab_set_pages:nn { ne }
18396 \cs_new:Nn \__flowfram_thumbtab_title:n
18397 {
18398 \tl_use:c { g__thumbtab_ \romannumeral #1 _title_tl }
18399 }
18400 % \end{macrocode}
18401 %\begin{macro}{\SetThumbTabTitle}
18402 %The title for individual thumbtabs may be changed.
18403 %\changes{2.0}{2025-11-24}{new}
18404 % \begin{macrocode}
18405 \NewDocumentCommand \SetThumbTabTitle { m m }
18406 {
18407 \tl_if_exist:cTF { g__thumbtab_ \romannumeral #1 _title_tl }
18408 {
18409 \tl_gset:cn { g__thumbtab_ \romannumeral #1 _title_tl } { #2 }
18410 }
18411 {
18412 \msg_warning:nnn { flowfram } { cant-find-thumbtab } { #1 }
18413 }
18414 }
18415 % \end{macrocode}
18416 %\end{macro}
18417 % \begin{macrocode}
18418 \cs_new:Nn \__flowfram_thumbtab_link:n
18419 {
18420 \tl_use:c { g__thumbtab_ \romannumeral #1 _link_tl }
18421 }
18422 % \end{macrocode}
18423 %
18424 %\begin{macro}{\@dothumbtabs}
18425 % Once the thumbtab information has been read in and stored
18426 % in the thumbtab macros, create the thumbtabs using this
18427 % information. First need to work out the \glspl{pgrange} between
18428 % each thumbtab. If the following thumbtab starts on the
18429 % same page as the previous one, leave the page variable
18430 % as a single number (this may happen if the thumbtabs
18431 % correspond to sections rather than chapters). If the
18432 % following thumbtab starts on a different page to the
18433 % one before it, the preceding thumbtab page variable should
18434 % be a range from its own initial page up to the page before
18435 % the next thumbtab starts. The final thumbtab has an open
18436 % ended range. This final thumbtab will continue to be displayed
18437 % until cancelled by "\disablethumbtabs".
18438 %
18439 % Syntax: \marg{y offset}\marg{height}.
18440 % Version 2.0 replaced \cs{@dothumbtabs}.
18441 %\changes{2.0}{2025-11-24}{replaced}
18442 % \begin{macrocode}
18443 \cs_new:Nn \__flowfram_create_thumbtabs:nn
18444 {
18445 \dim_set:Nn \l__flowfram_y_dim
18446 {
18447 \typeblockheight - ( #2 ) - ( #1 )
18448 }
18449 \computerightedgeodd { \l__flowfram_x_dim }
18450 \dim_sub:Nn \l__flowfram_x_dim { \thumbtabwidth }
18451 \computeleftedgeeven { \l__flowfram_evenx_dim }
18452 \int_step_inline:nn { \c@maxthumbtabs }
18453 {
18454 % \end{macrocode}
18455 %First set the data obtained from the ttb file:
18456 % \begin{macrocode}
18457 \int_set:Nn \l__flowfram_range_start_int
18458 {
18459 \__flowfram_thumbtab_start:n { ##1 }
18460 }
18461 \int_compare:nNnTF { ##1 } = { \c@maxthumbtabs }
18462 {
18463 \tl_if_empty:NTF \g__flowfram_ttb_endpage_tl
18464 {
18465 \__flowfram_thumbtab_set_pages:ne { ##1 }
18466 {
18467 \int_use:N \l__flowfram_range_start_int ,
18468 > \int_use:N \l__flowfram_range_start_int
18469 }
18470 }
18471 {
18472 \__flowfram_thumbtab_set_pages:ne { ##1 }
18473 {
18474 \int_use:N \l__flowfram_range_start_int
18475 - \g__flowfram_ttb_endpage_tl
18476 }
18477 }
18478 }
18479 {
18480 % \end{macrocode}
18481 %Last page of this thumbtab is likely to be one less then the start of the next
18482 %thumbtab.
18483 % \begin{macrocode}
18484 \int_set:Nn \l__flowfram_range_end_int
18485 {
18486 \__flowfram_thumbtab_start:n
18487 { \int_eval:n { ##1 + \c_one_int } }
18488 }
18489 \int_decr:N \l__flowfram_range_end_int
18490 \int_compare:nNnTF
18491 { \l__flowfram_range_end_int }
18492 >
18493 { \l__flowfram_range_start_int }
18494 {
18495 \__flowfram_thumbtab_set_pages:ne { ##1 }
18496 {
18497 \int_use:N \l__flowfram_range_start_int
18498 - \int_use:N \l__flowfram_range_end_int
18499 }
18500 }
18501 {
18502 \__flowfram_thumbtab_set_pages:ne { ##1 }
18503 {
18504 \int_use:N \l__flowfram_range_start_int
18505 }
18506 }
18507 }
18508 % \end{macrocode}
18509 %Now create the dynamic frames associated with this thumbtab:
18510 % \begin{macrocode}
18511 \__flowfram_create_thumbtab:nn { ##1 } { #2 }
18512 }
18513 % \end{macrocode}
18514 % Now that all thumbtabs have been defined, set the page lists:
18515 % \begin{macrocode}
18516 \bool_if:NTF \g__flowfram_has_bespoke_thumbtabs_bool
18517 {
18518 \int_step_inline:nn { \c@maxthumbtabs }
18519 {
18520 \exp_args:Nnee
18521 \__flowfram_set_thumbtab_pagelist:nnn { ##1 }
18522 {
18523 \seq_item:Nn \g__flowfram_thumbtab_seq { ##1 }
18524 }
18525 {
18526 \seq_item:Nn \g__flowfram_even_thumbtab_seq { ##1 }
18527 }
18528 \flowfram_frame_set_bool_true:nnn
18529 { dynamic } { hide }
18530 {
18531 \seq_item:Nn \g__flowfram_thumbtab_seq { ##1 }
18532 }
18533 \flowfram_frame_set_bool_true:nnn
18534 { dynamic } { hide }
18535 {
18536 \seq_item:Nn \g__flowfram_even_thumbtab_seq { ##1 }
18537 }
18538 }
18539 }
18540 {
18541 \seq_map_indexed_inline:Nn \g__flowfram_thumbtab_seq
18542 {
18543 \clist_set:Ne \l__flowfram_pages_clist
18544 {
18545 \__flowfram_thumbtab_pages:n
18546 { ##1 }
18547 }
18548 \flowfram_frame_set_clist:nnnV
18549 { dynamic } { pagelist } { ##2 }
18550 \l__flowfram_pages_clist
18551 \flowfram_frame_set_bool_true:nnn
18552 { dynamic } { hide } { ##2 }
18553 }
18554 }
18555 }
18556 % \end{macrocode}
18557 %\end{macro}
18558 %
18559 % \begin{macrocode}
18560 \cs_new:Nn \__flowfram_set_thumbtab_pagelist:nnn
18561 {
18562 \clist_set:Ne \l__flowfram_pages_clist
18563 {
18564 \__flowfram_thumbtab_pages:n { #1 }
18565 }
18566 \__flowfram_separate_odd_even:
18567 \__flowfram_set_thumbtab_pages:nn { #2 } { #3 }
18568 }
18569 % \end{macrocode}
18570 %\begin{macro}{\thumbtabwidth}
18571 % Default thumbtab width.
18572 % \begin{macrocode}
18573 \newlength{\thumbtabwidth}
18574 \setlength{\thumbtabwidth}{1cm}
18575 % \end{macrocode}
18576 %\end{macro}
18577 %\begin{macro}{\thumbtabnumtitle}
18578 %\changes{2.0}{2025-11-24}{new}
18579 %Used to format number and title if both shown.
18580 % \begin{macrocode}
18581 \NewDocumentCommand \thumbtabnumtitle { m m }
18582 {
18583 #1 \c_space_tl #2
18584 }
18585 % \end{macrocode}
18586 %\end{macro}
18587 %\begin{macro}{\thumbtabformat}
18588 % Individual thumbtab format.
18589 % Syntax: \cs{thumbtabformat}\marg{text}\marg{height}
18590 % \begin{macrocode}
18591 \newcommand{\thumbtabformat}[2]{%
18592 \__flowfram_thumbtab_fmt:nn { #1 } { #2 }
18593 }
18594 % \end{macrocode}
18595 %\end{macro}
18596 %
18597 %\begin{macro}{\@flf@subsp}
18598 %\changes{1.10}{2007/08/21}{new}
18599 % Version 2.0 removed \cs{@flf@subsp}.
18600 %\changes{2.0}{2025-11-24}{removed}
18601 %\end{macro}
18602 %\begin{macro}{\@ttb@stack}
18603 % Stack letters vertically.
18604 %\changes{1.10}{2007/08/21}{spaces now replaced with \cs{space}}
18605 % Version 2.0 replaced \cs{@ttb@stack}.
18606 %\changes{2.0}{2025-11-24}{replaced}
18607 % \begin{macrocode}
18608 \cs_new:Nn \flowfram_thumbtab_stack:n
18609 {
18610 \tl_clear:N \l__flowfram_tmpa_tl
18611 \exp_args:Ne \text_map_inline:nn { \text_purify:n { #1 } }
18612 {
18613 \tl_if_empty:NF \l__flowfram_tmpa_tl
18614 {
18615 \tl_put_right:Nn \l__flowfram_tmpa_tl { \\ }
18616 }
18617 \tl_put_right:Nn \l__flowfram_tmpa_tl { ##1 }
18618 }
18619 \tl_put_left:Nn \l__flowfram_tmpa_tl { \begin { tabular } { l } }
18620 \tl_put_right:Nn \l__flowfram_tmpa_tl { \end { tabular } }
18621 \l__flowfram_tmpa_tl
18622 }
18623 % \end{macrocode}
18624 %\end{macro}
18625 %\begin{macro}{\@@ttb@stack}
18626 %\changes{1.10}{2007/08/21}{now uses \cs{mbox}}
18627 % Version 2.0 removed \cs{@@ttb@stack}.
18628 %\changes{2.0}{2025-11-24}{removed}
18629 %\end{macro}
18630 %
18631 %\begin{macro}{\@greyscale}
18632 % Count register to compute the grey scale.
18633 % Version 2.0 replaced \cs{@greyscale}
18634 %\changes{2.0}{2025-11-24}{replaced}
18635 % \begin{macrocode}
18636 \fp_new:N \l__flowfram_greyscale_fp
18637 % \end{macrocode}
18638 %\end{macro}
18639 %Keep track of IDNs of thumbtabs.
18640 % \begin{macrocode}
18641 \seq_new:N \g__flowfram_thumbtab_seq
18642 \seq_new:N \g__flowfram_thumbtab_index_seq
18643 % \end{macrocode}
18644 %
18645 %Version 2.0 allows bespoke thumbtabs. The dynamic frames should be
18646 %labelled "thumbtab1", "thumbtab2", etc. With corresponding dynamic
18647 %frames for the thumbtab index labelled "thumbtabindex1",
18648 %"thumbtabindex2", etc. The index thumbtabs should have the same
18649 %height as the thumbtabs. Allow for bespoke even thumbtabs, which
18650 %should be labelled "eventhumbtab1", "eventhumbtab2", etc, and
18651 %"eventhumbtabindex1", "eventhumbtabindex2", etc.
18652 % \begin{macrocode}
18653 \seq_new:N \g__flowfram_even_thumbtab_seq
18654 \seq_new:N \g__flowfram_even_thumbtab_index_seq
18655 \bool_new:N \g__flowfram_has_bespoke_thumbtabs_bool
18656 \bool_gset_false:N \g__flowfram_has_bespoke_thumbtabs_bool
18657 % \end{macrocode}
18658 %
18659 %\begin{macro}{\@@dothumbtabs}
18660 % Create the \glspl{dynamic} associated with each thumbtab.
18661 % Thumbtabs will initially have a grey background, but
18662 % this can be changed by the user. Each thumbtab is given
18663 % an \gls{idl} "thumbtab"\meta{n} where \meta{n} is the index of
18664 % the thumbtab (starting from 1 for the topmost thumbtab.)
18665 % Each frame in the thumbtab index is given an \gls{idl}
18666 % "thumbtabindex"\meta{n}, where \meta{n} is as before.
18667 %If the frame is already defined (for example via flowframtk)
18668 %then omit defining it but set the contents as appropriate.
18669 %Syntax: \marg{index}\marg{height}
18670 % \begin{macrocode}
18671 \cs_new:Nn \__flowfram_create_thumbtab:nn
18672 {
18673 \fp_set:Nn \l__flowfram_greyscale_fp
18674 {
18675 0.01 * ( ( 60 * ( #1 ) / \c@maxthumbtabs ) + 25 )
18676 }
18677 % \end{macrocode}
18678 % Create dynamic frame for thumbtab, unless it already exists.
18679 % \begin{macrocode}
18680 \__flowfram_if_frame_label_exists:nnNTF
18681 { dynamic }
18682 { thumbtab \int_eval:n { #1 } }
18683 \l__flowfram_id_int
18684 {
18685 % \end{macrocode}
18686 % Bespoke thumbtab. Change the offset in case we run out and need to
18687 % create extra.
18688 % \begin{macrocode}
18689 \bool_set_true:N \g__flowfram_has_bespoke_thumbtabs_bool
18690 \flowfram_set_dim_to_frame_dim:Nnnn
18691 \l__flowfram_y_dim
18692 { dynamic } { posy } { \l__flowfram_id_int }
18693 }
18694 {
18695 \__flowfram_new_dynamic:nnnnnn
18696 { none } { \thumbtabwidth } { #2 }
18697 { \l__flowfram_x_dim } { \l__flowfram_y_dim }
18698 { thumbtab \int_eval:n { #1 } }
18699 \int_set_eq:NN \l__flowfram_id_int \c@maxdynamic
18700 % \end{macrocode}
18701 % Set the position for even pages.
18702 % \begin{macrocode}
18703 \flowfram_frame_set_dim:nnnn { dynamic } { evenx }
18704 { \l__flowfram_id_int }
18705 { \l__flowfram_evenx_dim }
18706 % \end{macrocode}
18707 % Set the background colour.
18708 % \begin{macrocode}
18709 \flowfram_frame_set_tl:nnne
18710 { dynamic } { backcolor } { \l__flowfram_id_int }
18711 { [gray] { \fp_to_decimal:N \l__flowfram_greyscale_fp } }
18712 }
18713 \__flowfram_message:neee { info-thumbtab }
18714 { \int_eval:n { #1 } }
18715 { thumbtab \int_eval:n { #1 } }
18716 { \int_use:N \l__flowfram_id_int }
18717 \seq_put_right:NV \g__flowfram_thumbtab_seq
18718 \l__flowfram_id_int
18719 % \end{macrocode}
18720 % Set the contents of the thumbtab dynamic frame.
18721 %The title isn't expanded at this point to allow individual thumbtab
18722 %titles to be changed with \cs{SetThumbTabTitle}.
18723 % \begin{macrocode}
18724 \__flowfram_set_thumbtab_content:NVneen
18725 \thumbtabregularformat
18726 \l__flowfram_id_int
18727 { \__flowfram_thumbtab_link:n { #1 } }
18728 { \__flowfram_thumbtab_unitnum:n { #1 } }
18729 { \exp_not:N \__flowfram_thumbtab_title:n { #1 } }
18730 { #2 }
18731 % \end{macrocode}
18732 %Has an even frame been defined?
18733 % \begin{macrocode}
18734 \__flowfram_if_frame_label_exists:nnNTF
18735 { dynamic }
18736 { eventhumbtab \int_eval:n { #1 } }
18737 \l__flowfram_id_ii_int
18738 {
18739 \bool_set_true:N \g__flowfram_has_bespoke_thumbtabs_bool
18740 \seq_put_right:NV \g__flowfram_even_thumbtab_seq
18741 \l__flowfram_id_ii_int
18742 % \end{macrocode}
18743 %Set the frame content.
18744 % \begin{macrocode}
18745 \__flowfram_set_thumbtab_content:NVneen
18746 \thumbtabregularformat
18747 \l__flowfram_id_ii_int
18748 { \__flowfram_thumbtab_link:n { #1 } }
18749 { \__flowfram_thumbtab_unitnum:n { #1 } }
18750 { \exp_not:N \__flowfram_thumbtab_title:n { #1 } }
18751 { #2 }
18752 }
18753 {
18754 \seq_put_right:NV \g__flowfram_even_thumbtab_seq
18755 \l__flowfram_id_int
18756 }
18757 % \end{macrocode}
18758 % Create dynamic frame for thumbtab index, unless it already exists.
18759 % \begin{macrocode}
18760 \__flowfram_if_frame_label_exists:nnNTF
18761 { dynamic }
18762 { thumbtabindex \int_eval:n { #1 } }
18763 \l__flowfram_id_int
18764 {
18765 \bool_set_true:N \g__flowfram_has_bespoke_thumbtabs_bool
18766 }
18767 {
18768 \__flowfram_new_dynamic:nnnnnn
18769 { none } { \thumbtabwidth } { #2 }
18770 { \l__flowfram_x_dim } { \l__flowfram_y_dim }
18771 { thumbtabindex \int_eval:n { #1 } }
18772 \int_set_eq:NN \l__flowfram_id_int \c@maxdynamic
18773 % \end{macrocode}
18774 % Set the position for even pages.
18775 % \begin{macrocode}
18776 \flowfram_frame_set_dim:nnnn { dynamic } { evenx }
18777 { \l__flowfram_id_int }
18778 { \l__flowfram_evenx_dim }
18779 % \end{macrocode}
18780 % Set the background colour.
18781 % \begin{macrocode}
18782 \flowfram_frame_set_tl:nnne
18783 { dynamic } { backcolor } { \l__flowfram_id_int }
18784 { [gray] { \fp_to_decimal:N \l__flowfram_greyscale_fp } }
18785 }
18786 \__flowfram_message:neee {info-thumbtab-index}
18787 { \int_eval:n { #1 } }
18788 { thumbtabindex \int_eval:n { #1 } }
18789 { \int_use:N \l__flowfram_id_int }
18790 \seq_put_right:NV \g__flowfram_thumbtab_index_seq
18791 \l__flowfram_id_int
18792 % \end{macrocode}
18793 % Set the contents of the dynamic frame.
18794 % \begin{macrocode}
18795 \__flowfram_set_thumbtab_content:NVeeen
18796 \thumbtabindexformat
18797 \l__flowfram_id_int
18798 { \__flowfram_thumbtab_link:n { #1 } }
18799 { \__flowfram_thumbtab_unitnum:n { #1 } }
18800 { \exp_not:N \__flowfram_thumbtab_title:n { #1 } }
18801 { #2 }
18802 % \end{macrocode}
18803 %Has an even index frame been defined?
18804 % \begin{macrocode}
18805 \__flowfram_if_frame_label_exists:nnNTF
18806 { dynamic }
18807 { eventhumbtabindex \int_eval:n { #1 } }
18808 \l__flowfram_id_ii_int
18809 {
18810 \bool_set_true:N \g__flowfram_has_bespoke_thumbtabs_bool
18811 \seq_put_right:NV \g__flowfram_even_thumbtab_index_seq
18812 \l__flowfram_id_ii_int
18813 % \end{macrocode}
18814 %Set the frame content.
18815 % \begin{macrocode}
18816 \__flowfram_set_thumbtab_content:NVneen
18817 \thumbtabindexformat
18818 \l__flowfram_id_ii_int
18819 { \__flowfram_thumbtab_link:n { #1 } }
18820 { \__flowfram_thumbtab_unitnum:n { #1 } }
18821 { \exp_not:N \__flowfram_thumbtab_title:n { #1 } }
18822 { #2 }
18823 }
18824 {
18825 \seq_put_right:NV \g__flowfram_even_thumbtab_index_seq
18826 \l__flowfram_id_int
18827 }
18828 \dim_sub:Nn \l__flowfram_y_dim { #2 }
18829 }
18830 % \end{macrocode}
18831 %Set the frame content taking the package options into account.
18832 % \begin{macrocode}
18833 \cs_new:Nn \__flowfram_set_thumbtab_content:Nnnnnn
18834 {
18835 \tl_clear:N \l__flowfram_contents_tl
18836 \tl_if_empty:nTF { #4 }
18837 {
18838 % \end{macrocode}
18839 %No number (starred sectioning command) so just use title.
18840 % \begin{macrocode}
18841 \tl_set:Ne \l__flowfram_contents_tl
18842 {
18843 \exp_not:N #1
18844 { #3 }
18845 { \exp_not:n { #5 } }
18846 { \dim_eval:n { #6 } }
18847 }
18848 }
18849 {
18850 \bool_if:NTF \l__flowfram_ttb_show_number_bool
18851 {
18852 \bool_if:NTF \l__flowfram_ttb_show_title_bool
18853 {
18854 \tl_set:Ne \l__flowfram_contents_tl
18855 {
18856 \exp_not:N #1
18857 { #3 }
18858 {
18859 \exp_not:N \thumbtabnumtitle
18860 { #4 } { \exp_not:n { #5 } }
18861 }
18862 { \dim_eval:n { #6 } }
18863 }
18864 }
18865 {
18866 \tl_set:Ne \l__flowfram_contents_tl
18867 {
18868 \exp_not:N #1
18869 { #3 }
18870 { #4 } { \dim_eval:n { #6 } }
18871 }
18872 }
18873 }
18874 {
18875 \tl_set:Ne \l__flowfram_contents_tl
18876 {
18877 \exp_not:N #1
18878 { #3 }
18879 { \exp_not:n { #5 } }
18880 { \dim_eval:n { #6 } }
18881 }
18882 }
18883 }
18884 \exp_args:NnV \__flowfram_set_dynamic_contents:nn
18885 { #2 }
18886 \l__flowfram_contents_tl
18887 }
18888 \cs_generate_variant:Nn \__flowfram_set_thumbtab_content:Nnnnnn
18889 { NVneen , NVeeen }
18890 % \end{macrocode}
18891 %\end{macro}
18892 %\begin{macro}{\enablethumbtabs}
18893 % Enable thumbtabs. Once the \gls{idn} is obtained for the
18894 % first thumbtab, the rest can be found by incrementing the
18895 % number by 2 (the frames in between correspond to the
18896 % thumbtab index.)
18897 %\changes{2.0}{2025-11-24}{changed to document command}
18898 % \begin{macrocode}
18899 \NewDocumentCommand \enablethumbtabs { }
18900 {
18901 % \end{macrocode}
18902 %Ensure that \cs{FlowFramSectionUnit} writes to the ttb file:
18903 % \begin{macrocode}
18904 \cs_set_eq:NN
18905 \__flowfram_add_thumbtab:n
18906 \__flowfram_actual_add_thumbtab:n
18907 \int_if_zero:nTF
18908 { \seq_count:N \g__flowfram_thumbtab_seq }
18909 {
18910 \__flowfram_no_thumbtabs_warn:
18911 }
18912 {
18913 \seq_map_inline:Nn \g__flowfram_thumbtab_seq
18914 {
18915 \flowfram_frame_set_bool_false:nnn
18916 { dynamic } { hide } { ##1 }
18917 }
18918 \bool_if:NT \g__flowfram_has_bespoke_thumbtabs_bool
18919 {
18920 \seq_map_inline:Nn \g__flowfram_even_thumbtab_seq
18921 {
18922 \flowfram_frame_set_bool_false:nnn
18923 { dynamic } { hide } { ##1 }
18924 }
18925 }
18926 }
18927 }
18928 % \end{macrocode}
18929 %\end{macro}
18930 %\begin{macro}{\disablethumbtabs}
18931 % Disable all thumbtabs.
18932 %\changes{2.0}{2025-11-24}{changed to document command}
18933 % \begin{macrocode}
18934 \NewDocumentCommand \disablethumbtabs { }
18935 {
18936 % \end{macrocode}
18937 %Prevent \cs{FlowFramSectionUnit} from writing to the ttb file:
18938 % \begin{macrocode}
18939 \cs_set_eq:NN
18940 \__flowfram_add_thumbtab:n
18941 \use_none:n
18942 \seq_map_inline:Nn \g__flowfram_thumbtab_seq
18943 {
18944 \flowfram_frame_set_bool_true:nnn
18945 { dynamic } { hide } { ##1 }
18946 }
18947 \seq_map_inline:Nn \g__flowfram_thumbtab_index_seq
18948 {
18949 \flowfram_frame_set_clist:nnnn
18950 { dynamic } { pagelist } { ##1 } { none }
18951 }
18952 \bool_if:NT \g__flowfram_has_bespoke_thumbtabs_bool
18953 {
18954 \seq_map_inline:Nn \g__flowfram_even_thumbtab_seq
18955 {
18956 \flowfram_frame_set_clist:nnnn
18957 { dynamic } { hide } { ##1 } \c_true_bool
18958 }
18959 \seq_map_inline:Nn \g__flowfram_even_thumbtab_index_seq
18960 {
18961 \flowfram_frame_set_clist:nnnn
18962 { dynamic } { pagelist } { ##1 } { none }
18963 }
18964 }
18965 }
18966 % \end{macrocode}
18967 %\end{macro}
18968 %\begin{macro}{\thumbtabindex}
18969 % Show thumbtab indexes on current page (if no optional argument) or
18970 % for the given page list. Version 2.0 added optional argument.
18971 %\changes{2.0}{2025-11-24}{changed to document command and added
18972 %optional argument}
18973 % \begin{macrocode}
18974 \NewDocumentCommand \thumbtabindex { o }
18975 {
18976 \IfValueTF { #1 }
18977 {
18978 \clist_set:Ne \l__flowfram_pages_clist { #1 }
18979 % \end{macrocode}
18980 %If bespoke thumbtabs, need to separate the odd and even pages.
18981 % \begin{macrocode}
18982 \bool_if:NT \g__flowfram_has_bespoke_thumbtabs_bool
18983 {
18984 \__flowfram_separate_odd_even:
18985 }
18986 }
18987 {
18988 \clist_set:Ne \l__flowfram_pages_clist
18989 {
18990 \int_eval:n { \g__flowfram_pagecounter_tl }
18991 }
18992 \bool_if:NT \g__flowfram_has_bespoke_thumbtabs_bool
18993 {
18994 \int_if_odd:nTF { \g__flowfram_pagecounter_tl }
18995 {
18996 \clist_set_eq:NN \l__flowfram_odd_pages_clist
18997 \l__flowfram_pages_clist
18998 \clist_set:Nn \l__flowfram_even_pages_clist { none }
18999 }
19000 {
19001 \clist_set_eq:NN \l__flowfram_even_pages_clist
19002 \l__flowfram_pages_clist
19003 \clist_set:Nn \l__flowfram_odd_pages_clist { none }
19004 }
19005 }
19006 }
19007 \bool_if:NTF \g__flowfram_has_bespoke_thumbtabs_bool
19008 {
19009 \seq_map_pairwise_function:NNN
19010 \g__flowfram_thumbtab_index_seq
19011 \g__flowfram_even_thumbtab_index_seq
19012 \__flowfram_set_thumbtab_pages:nn
19013 }
19014 {
19015 \seq_map_inline:Nn \g__flowfram_thumbtab_index_seq
19016 {
19017 \flowfram_frame_set_clist:nnnV
19018 { dynamic } { pagelist } { ##1 }
19019 \l__flowfram_pages_clist
19020 }
19021 }
19022 }
19023 % \end{macrocode}
19024 %\end{macro}
19025 %
19026 % \begin{macrocode}
19027 \cs_new:Nn \__flowfram_separate_odd_even:
19028 {
19029 \clist_if_empty:NTF \l__flowfram_pages_clist
19030 {
19031 \clist_set:Nn \l__flowfram_pages_clist { none }
19032 \clist_set:Nn \l__flowfram_even_pages_clist { none }
19033 \clist_set:Nn \l__flowfram_odd_pages_clist { none}
19034 }
19035 {
19036 \exp_args:Ne \__flowfram_get_range:n
19037 { \clist_item:Nn \l__flowfram_pages_clist { \c_one_int } }
19038 \clist_clear:N \l__flowfram_even_pages_clist
19039 \clist_clear:N \l__flowfram_odd_pages_clist
19040 \int_compare:nNnTF
19041 { \l__flowfram_range_end_int} < { \c_flowfram_max_page_int }
19042 {
19043 \int_step_inline:nnn
19044 { \l__flowfram_range_start_int } { \l__flowfram_range_end_int }
19045 {
19046 \int_if_odd:nTF { ##1 }
19047 {
19048 \clist_put_right:Nn
19049 \l__flowfram_odd_pages_clist { ##1 }
19050 }
19051 {
19052 \clist_put_right:Nn
19053 \l__flowfram_even_pages_clist { ##1 }
19054 }
19055 }
19056 \clist_if_empty:NT \l__flowfram_odd_pages_clist
19057 {
19058 \clist_set:Nn \l__flowfram_odd_pages_clist { none }
19059 }
19060 \clist_if_empty:NT \l__flowfram_even_pages_clist
19061 {
19062 \clist_set:Nn \l__flowfram_even_pages_clist { none }
19063 }
19064 }
19065 {
19066 \clist_set:Nn \l__flowfram_even_pages_clist { even }
19067 \clist_set:Nn \l__flowfram_odd_pages_clist { odd }
19068 }
19069 }
19070 }
19071 % \end{macrocode}
19072 %
19073 % \begin{macrocode}
19074 \cs_new:Nn \__flowfram_set_thumbtab_pages:nn
19075 {
19076 \int_compare:nNnTF { #1 } = { #2 }
19077 {
19078 \flowfram_frame_set_clist:nnnV
19079 { dynamic } { pagelist } { #1 }
19080 \l__flowfram_pages_clist
19081 }
19082 {
19083 \flowfram_frame_set_clist:nnnV
19084 { dynamic } { pagelist } { #1 }
19085 \l__flowfram_odd_pages_clist
19086 \flowfram_frame_set_clist:nnnV
19087 { dynamic } { pagelist } { #2 }
19088 \l__flowfram_even_pages_clist
19089 }
19090 }
19091 % \end{macrocode}
19092 %\begin{macro}{\setthumbtab}
19093 % Modify the settings for all the thumbtabs (including thumbtab
19094 % index). Since the thumbtabs are \glspl{dynamic}
19095 % you could just use "\setdynamicframe", however, the thumbtabs
19096 % will not be generated on the first run, as there will be no
19097 % information in the ttb file, so "\setdynamicframe" would
19098 % generate an error. "\setthumbtab" will only give
19099 % a warning message if it can not find the thumbtab.
19100 % The argument "#1" is the index of the thumbtab (starting
19101 % from 1), the second argument "#2" is the
19102 % frame settings.
19103 %\changes{2.0}{2025-11-24}{changed to document command}
19104 % \begin{macrocode}
19105 \NewDocumentCommand \setthumbtab { m m }
19106 {
19107 \tl_if_eq:nnTF { #1 } { all }
19108 {
19109 \int_step_inline:nn { \c@maxthumbtabs }
19110 {
19111 \__flowfram_set_thumbtab:nn { ##1 } { #2 }
19112 }
19113 }
19114 {
19115 \clist_map_inline:nn { #1 }
19116 {
19117 \int_compare:nNnTF { ##1 } < { \c_one_int }
19118 {
19119 \msg_error:nnn { flowfram }
19120 { invalid-thumbtab-index }
19121 { ##1 }
19122 }
19123 {
19124 \int_compare:nNnTF
19125 { ##1 } >
19126 { \seq_count:N \g__flowfram_thumbtab_seq }
19127 {
19128 \msg_warning:nnn {flowfram} {cant-find-thumbtab} { ##1 }
19129 }
19130 {
19131 \__flowfram_set_thumbtab:nn { ##1 } { #2 }
19132 }
19133 }
19134 }
19135 }
19136 }
19137 % \end{macrocode}
19138 %\end{macro}
19139 %
19140 %\begin{macro}{\@setthumbtab}
19141 % Set individual thumbtab and its index tab.
19142 % Version 2.0 replaced \cs{@setthumbtab}.
19143 %\changes{2.0}{2025-11-24}{replaced}
19144 % \begin{macrocode}
19145 \cs_new:Nn \__flowfram_set_thumbtab:nn
19146 {
19147 % \end{macrocode}
19148 %Find the ID for the index thumbtab:
19149 % \begin{macrocode}
19150 \int_set:Nn \l__flowfram_id_int
19151 {
19152 \seq_item:Nn
19153 \g__flowfram_thumbtab_index_seq
19154 { #1 }
19155 }
19156 \__flowfram_set_dynamic_by_idn:nn
19157 {
19158 \l__flowfram_id_int
19159 }
19160 { #2 }
19161 \bool_if:NT \g__flowfram_has_bespoke_thumbtabs_bool
19162 {
19163 % \end{macrocode}
19164 %If bespoke thumbtabs, find the ID for the even index thumbtab:
19165 % \begin{macrocode}
19166 \int_set:Nn \l__flowfram_id_ii_int
19167 {
19168 \seq_item:Nn
19169 \g__flowfram_even_thumbtab_index_seq
19170 { #1 }
19171 }
19172 \int_compare:nNnF
19173 {
19174 \l__flowfram_id_int
19175 }
19176 =
19177 {
19178 \l__flowfram_id_ii_int
19179 }
19180 {
19181 \__flowfram_set_dynamic_by_idn:nn
19182 {
19183 \l__flowfram_id_ii_int
19184 }
19185 { #2 }
19186 }
19187 }
19188 % \end{macrocode}
19189 %Find the ID for the thumbtab:
19190 % \begin{macrocode}
19191 \int_set:Nn \l__flowfram_id_int
19192 {
19193 \seq_item:Nn
19194 \g__flowfram_thumbtab_seq
19195 { #1 }
19196 }
19197 \__flowfram_set_dynamic_by_idn:nn
19198 {
19199 \l__flowfram_id_int
19200 }
19201 { #2 }
19202 \bool_if:NT \g__flowfram_has_bespoke_thumbtabs_bool
19203 {
19204 % \end{macrocode}
19205 %If bespoke thumbtabs, find the ID for the even thumbtab:
19206 % \begin{macrocode}
19207 \int_set:Nn \l__flowfram_id_ii_int
19208 {
19209 \seq_item:Nn
19210 \g__flowfram_even_thumbtab_seq
19211 { #1 }
19212 }
19213 \int_compare:nNnF
19214 {
19215 \l__flowfram_id_int
19216 }
19217 =
19218 {
19219 \l__flowfram_id_ii_int
19220 }
19221 {
19222 \__flowfram_set_dynamic_by_idn:nn
19223 {
19224 \l__flowfram_id_ii_int
19225 }
19226 { #2 }
19227 }
19228 }
19229 }
19230 % \end{macrocode}
19231 %
19232 %\end{macro}
19233 %\begin{macro}{\setthumbtabindex}
19234 % Only change settings for the thumbtab index. This can
19235 % take a comma-separated number list.
19236 %\changes{2.0}{2025-11-24}{changed to document command}
19237 % \begin{macrocode}
19238 \NewDocumentCommand \setthumbtabindex { m m }
19239 {
19240 \tl_if_eq:nnTF { #1 } { all }
19241 {
19242 \int_step_inline:nn { \c@maxthumbtabs }
19243 {
19244 \__flowfram_set_thumbtab_index:nn { ##1 } { #2 }
19245 }
19246 }
19247 {
19248 \clist_map_inline:nn { #1 }
19249 {
19250 \int_compare:nNnTF { ##1 } < { \c_one_int }
19251 {
19252 \msg_error:nnn { flowfram }
19253 { invalid-thumbtab-index }
19254 { ##1 }
19255 }
19256 {
19257 \int_compare:nNnTF
19258 { ##1 } >
19259 { \seq_count:N \g__flowfram_thumbtab_seq }
19260 {
19261 \msg_warning:nnn {flowfram} {cant-find-thumbtab} { ##1 }
19262 }
19263 {
19264 \__flowfram_set_thumbtab_index:nn { ##1 } { #2 }
19265 }
19266 }
19267 }
19268 }
19269 }
19270 % \end{macrocode}
19271 %\end{macro}
19272 %\begin{macro}{\@setthumbtabindex}
19273 % Change setting for individual thumbtab index entry.
19274 % Version 2.0 replaced \cs{@setthumbtabindex}.
19275 %\changes{2.0}{2025-11-24}{replaced}
19276 % \begin{macrocode}
19277 \cs_new:Nn \__flowfram_set_thumbtab_index:nn
19278 {
19279 % \end{macrocode}
19280 %Find the ID for the index thumbtab:
19281 % \begin{macrocode}
19282 \int_set:Nn \l__flowfram_id_int
19283 {
19284 \seq_item:Nn
19285 \g__flowfram_thumbtab_index_seq
19286 { #1 }
19287 }
19288 \__flowfram_set_dynamic_by_idn:nn
19289 {
19290 \l__flowfram_id_int
19291 }
19292 { #2 }
19293 \bool_if:NT \g__flowfram_has_bespoke_thumbtabs_bool
19294 {
19295 % \end{macrocode}
19296 %If bespoke thumbtabs, find the ID for the even index thumbtab:
19297 % \begin{macrocode}
19298 \int_set:Nn \l__flowfram_id_ii_int
19299 {
19300 \seq_item:Nn
19301 \g__flowfram_even_thumbtab_index_seq
19302 { #1 }
19303 }
19304 \int_compare:nNnF
19305 {
19306 \l__flowfram_id_int
19307 }
19308 =
19309 {
19310 \l__flowfram_id_ii_int
19311 }
19312 {
19313 \__flowfram_set_dynamic_by_idn:nn
19314 {
19315 \l__flowfram_id_ii_int
19316 }
19317 { #2 }
19318 }
19319 }
19320 }
19321 % \end{macrocode}
19322 %\end{macro}
19323 %\begin{macro}{\tocandhumbtabindex}
19324 % Do both the table of contents and the thumbtab index.
19325 % This is intended for single paged table of contents.
19326 % \begin{macrocode}
19327 \NewDocumentCommand \tocandthumbtabindex { }
19328 {
19329 \aligntoctrue
19330 \bool_set_true:N \l__flowfram_thumbtabs_in_toc_bool
19331 \tableofcontents
19332 \aligntocfalse
19333 }
19334 % \end{macrocode}
19335 %\end{macro}
19336 %
19337 % \subsection{Minitocs}
19338 %\begin{macro}{\@ttb@minitoctype}
19339 % Sectioning type for the minitoc, by default it is the
19340 % same as the thumbtabs
19341 % Version 2.0 replaced \cs{@ttb@minitoctype}.
19342 %\changes{2.0}{2025-11-24}{replaced}
19343 % \begin{macrocode}
19344 \tl_new:N \g__flowfram_minitoc_type_tl
19345 % \end{macrocode}
19346 %\end{macro}
19347 %
19348 %\begin{macro}{\if@storetoc}
19349 % Version 2.0 removed \cs{if@storetoc}.
19350 %\changes{2.0}{2025-11-24}{removed}
19351 %\end{macro}
19352 %
19353 %\begin{macro}{\@starttoc}
19354 % In order to align the table of contents with the thumbtabs,
19355 % or to use minitocs, the toc information must be stored,
19356 % rather than simply input.
19357 % Therefore, modify "\@starttoc" so that it can store the contents
19358 % of the file. A boolean is used to determine whether
19359 % to store the contents, or act as normal.
19360 % \cs{@starttoc} will be set to the following:
19361 % \begin{macrocode}
19362 \cs_new:Nn \__flowfram_starttoc:n
19363 {
19364 \__flowfram_store_toc:n { #1 }
19365 }
19366 % \end{macrocode}
19367 %\end{macro}
19368 %
19369 %\begin{macro}{\@ttb@storetoc}
19370 % Store the contents of the file with the given extension.
19371 % Version 2.0 replaced \cs{@ttb@storetoc}.
19372 %\changes{2.0}{2025-11-24}{replaced}
19373 % \begin{macrocode}
19374 \cs_new:Nn \__flowfram_store_toc:n
19375 {
19376 \begingroup
19377 \makeatletter
19378 \__flowfram_parse_toc:n { \jobname . #1 }
19379 % \end{macrocode}
19380 %The rest is the same as for the kernel definition of \cs{@starttoc}
19381 %but includes the extra check used by \sty{rerunfilecheck}.
19382 % \begin{macrocode}
19383 \if@filesw
19384 \RerunFileCheck { \jobname . #1 }
19385 {
19386 \@ifundefined{tf@#1}{}
19387 {
19388 \immediate\closeout\csname tf@#1 \endcsname
19389 }
19390 }
19391 { }
19392 \@ifundefined{tf@#1}
19393 {
19394 \expandafter\newwrite\csname tf@#1\endcsname
19395 }
19396 { }
19397 \immediate\openout\csname tf@#1\endcsname\jobname.#1\relax
19398 \fi
19399 \@nobreakfalse
19400 \endgroup
19401 }
19402 % \end{macrocode}
19403 %\end{macro}
19404 %
19405 % \begin{macrocode}
19406 \ior_new:N \g__flowfram_toc_ior
19407 % \end{macrocode}
19408 %\begin{macro}{\@ttb@minitoclevel}
19409 % Version 2.0 replaced \cs{@ttb@minitoclevel}.
19410 %\changes{2.0}{2025-11-24}{replaced}
19411 % \begin{macrocode}
19412 \int_new:N \g__flowfram_minitoc_level_int
19413 % \end{macrocode}
19414 %\end{macro}
19415 %
19416 %\begin{macro}{\@storefileconts}
19417 % Store the contents of named file, if it exists.
19418 %\changes{1.10}{2007/08/21}{uses \cs{PackageInfo} instead of
19419 % \cs{typeout}}
19420 % Version 2.0 replaced \cs{@storefileconts}.
19421 %\changes{2.0}{2025-11-24}{replaced}
19422 % \begin{macrocode}
19423 \cs_new:Nn \__flowfram_parse_toc:n
19424 {
19425 \ior_open:NnTF \g__flowfram_toc_ior { #1 }
19426 {
19427 \int_if_exist:cTF
19428 {
19429 c_flowfram_level_
19430 \g__flowfram_minitoc_type_tl
19431 _int
19432 }
19433 {
19434 \int_gset_eq:Nc \g__flowfram_minitoc_level_int
19435 {
19436 c_flowfram_level_
19437 \g__flowfram_minitoc_type_tl
19438 _int
19439 }
19440 }
19441 {
19442 \int_gset:Nn \g__flowfram_minitoc_level_int { 6 }
19443 }
19444 \int_gzero:N \c@maxtocunits
19445 \int_gzero:N \c@maxminitoc
19446 \int_gzero:N \g__flowfram_toc_level_int
19447 \ior_map_inline:Nn \g__flowfram_toc_ior
19448 {
19449 \__flowfram_add_to_toc_list:Nn
19450 \c@maxtocunits { ##1 }
19451 }
19452 \ior_close:N \g__flowfram_toc_ior
19453 }
19454 {
19455 \msg_info:nnn { flowfram } { info-no-file } { #1 }
19456 }
19457 }
19458 % \end{macrocode}
19459 %\end{macro}
19460 % Store the number of units corresponding to the
19461 % thumbtab type, and minitoc units. These will usually
19462 % have the same value, but this is not always
19463 % guaranteed.
19464 %\begin{macro}{\c@maxtocunits}
19465 % Total number of toc units.
19466 % \begin{macrocode}
19467 \newcount\c@maxtocunits
19468 % \end{macrocode}
19469 %\end{macro}
19470 %\begin{macro}{\c@maxminitoc}
19471 % Total number of minitoc units.
19472 % \begin{macrocode}
19473 \newcount\c@maxminitoc
19474 % \end{macrocode}
19475 %\end{macro}
19476 %
19477 %\begin{macro}{\@@storefileconts}
19478 % Version 2.0 removed \cs{@@storefileconts}.
19479 %\changes{2.0}{2025-11-24}{removed}
19480 %\end{macro}
19481 %
19482 %\begin{macro}{\if@contsline}
19483 % Version 2.0 removed \cs{if@contsline}.
19484 %\changes{2.0}{2025-11-24}{removed}
19485 %\end{macro}
19486 %\begin{macro}{\@ttb@level}
19487 % Version 2.0 removed \cs{@ttb@level}.
19488 %\changes{2.0}{2025-11-24}{removed}
19489 %\end{macro}
19490 %\begin{macro}{\@addtotoclist}
19491 % Before each line is added to the contents list, it is
19492 % first checked to see whether the line starts with
19493 % "\contentsline". If it does, then check to see if the
19494 % sectioning type corresponds to the thumbtab level. If
19495 % it does, then start a new list. There will be "\c@maxtocunits"
19496 % lists, each one corresponding to each thumbtab group.
19497 % In addition, each contents line needs to be added to
19498 % the minitoclists, but only if the sectioning type level
19499 % is deeper than "\g__flowfram_minitoc_type_tl ". The number of minitoc
19500 % lists is given by "\c@maxminitoc".
19501 % Version 2.0 replaced \cs{@addtotoclist}
19502 %\changes{2.0}{2025-11-24}{replaced}
19503 %
19504 %Keep track of current level:
19505 % \begin{macrocode}
19506 \int_new:N \g__flowfram_toc_level_int
19507 % \end{macrocode}
19508 % Token list that will contain the whole toc:
19509 % \begin{macrocode}
19510 \tl_new:N \g__flowfram_table_of_contents_tl
19511 % \end{macrocode}
19512 % Add a line from the toc to the applicable list.
19513 %Syntax: \meta{int-var}\marg{toc line}
19514 %The variable keeps track of the number of toc sub lists.
19515 % \begin{macrocode}
19516 \cs_new:Nn \__flowfram_add_to_toc_list:Nn
19517 {
19518 % \end{macrocode}
19519 % First add to the whole list:
19520 % \begin{macrocode}
19521 \tl_gput_right:Nn \g__flowfram_table_of_contents_tl { #2 }
19522 % \end{macrocode}
19523 % Now check if the line starts with \cs{contentsline}.
19524 % \begin{macrocode}
19525 \tl_if_head_eq_meaning:nNT
19526 { #2 } \contentsline
19527 {
19528 % \end{macrocode}
19529 % Get the content of the first argument that follows \cs{contentsline}.
19530 %First discard \cs{contentsline}.
19531 % \begin{macrocode}
19532 \tl_set:Ne \l__flowfram_remainder_tl
19533 {
19534 \tl_tail:n { #2 }
19535 }
19536 % \end{macrocode}
19537 %Now get the first argument:
19538 % \begin{macrocode}
19539 \tl_set:Ne \l__flowfram_contents_tl
19540 {
19541 \tl_head:N \l__flowfram_remainder_tl
19542 }
19543 % \end{macrocode}
19544 %If this section type is recognised, get the numeric identifier:
19545 % \begin{macrocode}
19546 \int_if_exist:cTF
19547 {
19548 c_flowfram_level_
19549 \l__flowfram_contents_tl
19550 _int
19551 }
19552 {
19553 \int_gset_eq:Nc \g__flowfram_toc_level_int
19554 {
19555 c_flowfram_level_
19556 \l__flowfram_contents_tl
19557 _int
19558 }
19559 }
19560 {
19561 % \end{macrocode}
19562 %Not recognised, assume it comes after the known lowest level.
19563 % \begin{macrocode}
19564 \int_gset:Nn \g__flowfram_toc_level_int
19565 { \c_flowfram_level_subparagraph_int + \c_one_int }
19566 }
19567 % \end{macrocode}
19568 %If this level is the designated thumbtab level, increment the
19569 %counter that keeps track of the number of toc units.
19570 % \begin{macrocode}
19571 \tl_if_eq:eeT
19572 { \g__flowfram_thumbtab_type_tl }
19573 { \l__flowfram_contents_tl }
19574 {
19575 \int_gincr:N #1
19576 }
19577 % \end{macrocode}
19578 %If a token list is not yet available for this toc sub list, create it.
19579 % \begin{macrocode}
19580 \tl_if_exist:cF
19581 { g__flowfram_toc_level_ \romannumeral #1 _tl }
19582 {
19583 \tl_new:c
19584 { g__flowfram_toc_level_ \romannumeral #1 _tl }
19585 }
19586 % \end{macrocode}
19587 %Append the toc line to this toc sub list.
19588 % \begin{macrocode}
19589 \tl_gput_right:cn
19590 { g__flowfram_toc_level_ \romannumeral #1 _tl }
19591 { #2 }
19592 }
19593 % \end{macrocode}
19594 % Now do minitoc stuff if applicable.
19595 % \begin{macrocode}
19596 \bool_if:NT \g__flowfram_minitocs_enabled_bool
19597 {
19598 % \end{macrocode}
19599 % If the current toc level matches the designated minitoc level,
19600 % increment the counter that stores the maximum number of minitocs
19601 % and create the associated token list.
19602 % \begin{macrocode}
19603 \int_compare:nNnTF
19604 { \g__flowfram_toc_level_int }
19605 =
19606 { \g__flowfram_minitoc_level_int }
19607 {
19608 \int_gincr:N \c@maxminitoc
19609 % \end{macrocode}
19610 % Create the associated token list but don't add this toc line to
19611 % it.
19612 % \begin{macrocode}
19613 \tl_clear_new:c { g__flowfram_minitoc_ \romannumeral \c@maxminitoc _tl }
19614 }
19615 {
19616 \int_compare:nNnT
19617 { \g__flowfram_toc_level_int }
19618 >
19619 { \g__flowfram_minitoc_level_int }
19620 {
19621 % \end{macrocode}
19622 % If the current section level is deeper than the designated minitoc
19623 % level, add this toc line to the list.
19624 % \begin{macrocode}
19625 \tl_if_exist:cF { g__flowfram_minitoc_ \romannumeral \c@maxminitoc _tl }
19626 {
19627 \tl_new:c { g__flowfram_minitoc_ \romannumeral \c@maxminitoc _tl }
19628 }
19629 \tl_gput_right:cn
19630 { g__flowfram_minitoc_ \romannumeral \c@maxminitoc _tl }
19631 { #2 }
19632 }
19633 }
19634 }
19635 }
19636 % \end{macrocode}
19637 %\end{macro}
19638 % Is there already a way of determining the sectioning
19639 % level from its name?
19640 %\begin{macro}{\@ttb@part@level}
19641 % Version 2.0 replaced \cs{@ttb@part@level}
19642 %\changes{2.0}{2025-11-24}{replaced}
19643 % \begin{macrocode}
19644 \int_const:Nn \c_flowfram_level_part_int { -1 }
19645 % \end{macrocode}
19646 %\end{macro}
19647 %\begin{macro}{\@ttb@chapter@level}
19648 % Version 2.0 replaced \cs{@ttb@chapter@level}
19649 %\changes{2.0}{2025-11-24}{replaced}
19650 % \begin{macrocode}
19651 \int_const:Nn \c_flowfram_level_chapter_int { 0 }
19652 % \end{macrocode}
19653 %\end{macro}
19654 %\begin{macro}{\@ttb@section@level}
19655 % Version 2.0 replaced \cs{@ttb@section@level}
19656 %\changes{2.0}{2025-11-24}{replaced}
19657 % \begin{macrocode}
19658 \int_const:Nn \c_flowfram_level_section_int { 1 }
19659 % \end{macrocode}
19660 %\end{macro}
19661 %\begin{macro}{\@ttb@subsection@level}
19662 % Version 2.0 replaced \cs{@ttb@subsection@level}
19663 %\changes{2.0}{2025-11-24}{replaced}
19664 % \begin{macrocode}
19665 \int_const:Nn \c_flowfram_level_subsection_int { 2 }
19666 % \end{macrocode}
19667 %\end{macro}
19668 %\begin{macro}{\@ttb@subsubsection@level}
19669 % Version 2.0 replaced \cs{@ttb@subsubsection@level}
19670 %\changes{2.0}{2025-11-24}{replaced}
19671 % \begin{macrocode}
19672 \int_const:Nn \c_flowfram_level_subsubsection_int { 3 }
19673 % \end{macrocode}
19674 %\end{macro}
19675 %\begin{macro}{\@ttb@paragraph@level}
19676 % Version 2.0 replaced \cs{@ttb@paragraph@level}
19677 %\changes{2.0}{2025-11-24}{replaced}
19678 % \begin{macrocode}
19679 \int_const:Nn \c_flowfram_level_paragraph_int { 4 }
19680 % \end{macrocode}
19681 %\end{macro}
19682 %\begin{macro}{\@ttb@subparagraph@level}
19683 % Version 2.0 replaced \cs{@ttb@subparagraph@level}
19684 %\changes{2.0}{2025-11-24}{replaced}
19685 % \begin{macrocode}
19686 \int_const:Nn \c_flowfram_level_subparagraph_int { 5 }
19687 % \end{macrocode}
19688 %\end{macro}
19689 %\begin{macro}{\@checkcontentsline}
19690 % Version 2.0 removed \cs{@checkcontentsline}.
19691 %\changes{2.0}{2025-11-24}{removed}
19692 %\end{macro}
19693 %\begin{macro}{\@gettype}
19694 % Version 2.0 removed \cs{@gettype}
19695 %\changes{2.0}{2025-11-24}{removed}
19696 %\end{macro}
19697 %\begin{macro}{\tableofcontents}
19698 % Modify "\tableofcontents". It first stores the contents
19699 % of the toc file, and then, either simply prints it on the
19700 % page (so it appears no different to the standard
19701 % "\tableofcontents"), or it prints it out so that each
19702 % thumbtab unit has the same height as the thumbtabs.
19703 % Note: this assumes that the actual table of contents
19704 % starts at the same height as the thumbtabs. The thumbtab
19705 % vertical position may need to be adjusted to compensate
19706 % for space taken up by the contents title.
19707 % This is the default code used for "\tableofcontents":
19708 % \begin{macrocode}
19709 \cs_new:Nn \__flowfram_tableofcontents:
19710 {
19711 \cs_set_eq:NN \@starttoc \__flowfram_starttoc:n
19712 \flowfram_toc:
19713 \bool_lazy_and:nnTF
19714 {
19715 \bool_not_p:n
19716 {
19717 \tl_if_empty_p:N \g__flowfram_table_of_contents_tl
19718 }
19719 }
19720 {
19721 \bool_if_p:N \l__flowfram_thumbtabs_in_toc_bool
19722 }
19723 {
19724 \bool_if:NTF \l__flowfram_thumbtabs_span_toc_bool
19725 {
19726 \thumbtabindex[all]
19727 }
19728 {
19729 \thumbtabindex
19730 }
19731 \legacy_if:nTF { aligntoc }
19732 {
19733 \__flowfram_print_aligned_toc:
19734 }
19735 {
19736 \__flowfram_print_toc:
19737 }
19738 \bool_if:NT \l__flowfram_thumbtabs_span_toc_bool
19739 {
19740 \afterpage
19741 {
19742 \thumbtabindex[none]
19743 }
19744 }
19745 }
19746 {
19747 \__flowfram_print_toc:
19748 }
19749 \cs_set_eq:NN \@starttoc \__flowfram_org_starttoc:
19750 \int_gzero:N \c@minitoc
19751 }
19752 % \end{macrocode}
19753 %\end{macro}
19754 %\begin{macro}{\beforeminitocskip}
19755 % Vertical space to add before minitoc.
19756 % \begin{macrocode}
19757 \newlength\beforeminitocskip
19758 \setlength{\beforeminitocskip}{0pt}
19759 % \end{macrocode}
19760 %\end{macro}
19761 %\begin{macro}{\afterminitocskip}
19762 % Vertical space to add after minitoc.
19763 % \begin{macrocode}
19764 \newlength\afterminitocskip
19765 \setlength{\afterminitocskip}{\baselineskip}
19766 % \end{macrocode}
19767 %\end{macro}
19768 %\begin{macro}{\dominitoc}
19769 % Do the minitoc for unit "#1". (Version 2.0 removed check that
19770 % minitocs have been enabled since this command won't be used if
19771 % they haven't been enabled). The argument is the minitoc index.
19772 %\changes{2.0}{2025-11-24}{changed to document command}
19773 % \begin{macrocode}
19774 \NewDocumentCommand \dominitoc { m }
19775 {
19776 \flowfram_do_minitoc:n { #1 }
19777 }
19778 % \end{macrocode}
19779 %\end{macro}
19780 %\begin{macro}{\@dominitoc}
19781 %This command is redefined by \cs{appenddfminitoc}.
19782 % Version 2.0 renamed \cs{@dominitoc}.
19783 %\changes{2.0}{2025-11-24}{renamed}
19784 % \begin{macrocode}
19785 \cs_new:Nn \flowfram_do_minitoc:n
19786 {
19787 \flowfram_use_minitoc:n { #1 }
19788 }
19789 % \end{macrocode}
19790 %\end{macro}
19791 %\begin{macro}{\minitocstyle}
19792 % Style in which to display the minitoc.
19793 % \begin{macrocode}
19794 \newcommand{\minitocstyle}[1]{%
19795 \normalfont\normalsize\normalcolor
19796 #1%
19797 }
19798 % \end{macrocode}
19799 %\end{macro}
19800 %\begin{macro}{\@@dominitoc}
19801 % Now do the actual minitoc for unit "#1".
19802 % Version 2.0 renamed \cs{@@dominitoc}.
19803 %\changes{2.0}{2025-11-24}{renamed}
19804 % \begin{macrocode}
19805 \cs_new:Nn \flowfram_use_minitoc:n
19806 {
19807 \bool_lazy_and:nnT
19808 {
19809 \tl_if_exist_p:c { g__flowfram_minitoc_ \romannumeral #1 _tl }
19810 }
19811 {
19812 \bool_not_p:n
19813 { \tl_if_empty_p:c { g__flowfram_minitoc_ \romannumeral #1 _tl } }
19814 }
19815 {
19816 \vskip \beforeminitocskip
19817 \group_begin:
19818 \minitocstyle
19819 {
19820 \tl_use:c { g__flowfram_minitoc_ \romannumeral #1 _tl }
19821 }
19822 \group_end:
19823 \vskip \afterminitocskip
19824 }
19825 }
19826 % \end{macrocode}
19827 %\end{macro}
19828 %
19829 %We don't want to repeatedly add the minitoc to the dynamic frame
19830 %but \cs{ChapterInDynamic} automatically resets the contents which
19831 %means the minitoc will need to be appended at the start of each
19832 %chapter if they are both using the same frame. Also, if the clear
19833 %setting is on then the minitoc will need to be appended again when
19834 %needed.
19835 % \begin{macrocode}
19836 \cs_new:Nn \flowfram_clear_do_minitoc:
19837 {
19838 \int_compare:nNnF
19839 { \g__flowfram_minitoc_frame_id }
19840 =
19841 { \g__flowfram_chaphead_frame_id }
19842 {
19843 \flowfram_if_frame_bool:nnnF
19844 { dynamic } { clear } { \g__flowfram_minitoc_frame_id }
19845 {
19846 \cs_gset_eq:NN \flowfram_do_minitoc:n \use_none:n
19847 }
19848 }
19849 }
19850 % \end{macrocode}
19851 %
19852 % \begin{macrocode}
19853 \int_new:N \g__flowfram_minitoc_frame_id
19854 % \end{macrocode}
19855 %
19856 %\begin{macro}{\appenddfminitoc}
19857 % Modify "\dominitoc" so that the minitoc is appended
19858 % to specified \gls{dynamic}. Starred version uses
19859 % \gls{dynamic} \gls{idl}, unstarred version uses \gls{dynamic}
19860 % \gls{idn}. I originally called this macro "\appendminitoctodynamicframe"
19861 % but decided it was too long, for I've opted instead
19862 % for a slightly more cryptic name.
19863 % \begin{macrocode}
19864 \NewDocumentCommand \appenddfminitoc { s m }
19865 {
19866 \renewcommand{\beforeminitocskip}{\baselineskip}%
19867 \IfBooleanTF { #1 }
19868 {
19869 \__flowfram_get_dynamic_id:e { #2 }
19870 \int_gset_eq:NN
19871 \g__flowfram_minitoc_frame_id
19872 \l__flowfram_id_int
19873 }
19874 {
19875 \int_gset:Nn \g__flowfram_minitoc_frame_id { #2 }
19876 }
19877 \cs_set:Nn \flowfram_do_minitoc:n
19878 {
19879 \__flowfram_append_dynamic_contents_idn:nn
19880 { \g__flowfram_minitoc_frame_id }
19881 {
19882 \flowfram_use_minitoc:n { ##1 }
19883 }
19884 \flowfram_clear_do_minitoc:
19885 }
19886 }
19887 % \end{macrocode}
19888 %\end{macro}
19889 %\begin{macro}{\@sappendminitocdf}
19890 % Version 2.0 removed \cs{@sappendminitocdf}
19891 %\changes{2.0}{2025-11-24}{removed}
19892 %\end{macro}
19893 %\begin{macro}{\@appendminitocdf}
19894 % Version 2.0 removed \cs{@appendminitocdf}
19895 %\changes{2.0}{2025-11-24}{removed}
19896 %\end{macro}
19897 %
19898 %\begin{macro}{\@printtoc}
19899 % Do the table of contents, which has been gathered from the toc
19900 % file.
19901 % Version 2.0 replaced \cs{@printtoc}.
19902 %\changes{2.0}{2025-11-24}{replaced}
19903 % \begin{macrocode}
19904 \cs_new:Nn \__flowfram_print_toc_units:
19905 {
19906 \int_step_inline:nn { \c@maxtocunits }
19907 {
19908 \tl_use:c { g__flowfram_toc_level_ \romannumeral ##1 _tl }
19909 }
19910 }
19911 % \end{macrocode}
19912 %Print all the content found in the toc.
19913 % \begin{macrocode}
19914 \cs_new:Nn \__flowfram_print_toc:
19915 {
19916 \g__flowfram_table_of_contents_tl
19917 }
19918 % \end{macrocode}
19919 %\end{macro}
19920 %\begin{macro}{\@printalignedtoc}
19921 % Print the table of contents so that each unit is
19922 % has vertical height the same as the height of the
19923 % thumbtabs. Note that you may have to adjust the
19924 % vertical offset of the thumbtabs (in "\makethumbtabs")
19925 % in order to make them correctly aligned.
19926 % Version 2.0 replaced \cs{@printalignedtoc}
19927 %\changes{2.0}{2025-11-24}{replaced}
19928 % \begin{macrocode}
19929 \cs_new:Nn \__flowfram_print_aligned_toc:
19930 {
19931 \tl_if_exist:NT \g__flowfram_toc_level__tl
19932 {
19933 \g__flowfram_toc_level__tl
19934 \par
19935 \noindent
19936 \hrulefill
19937 }
19938 \int_step_inline:nn { \c@maxtocunits }
19939 {
19940 \int_compare:nNnTF { ##1 } > { \c@maxthumbtabs }
19941 {
19942 \tl_use:c { g__flowfram_toc_level_ \romannumeral ##1 _tl }
19943 }
19944 {
19945 \__flowfram_get_dynamic_id:n
19946 { thumbtabindex ##1 }
19947 \flowfram_set_dim_to_frame_dim:Nnnn
19948 \l__flowfram_x_dim
19949 { dynamic } { width } { \l__flowfram_id_int }
19950 \flowfram_set_dim_to_frame_dim:Nnnn
19951 \l__flowfram_y_dim
19952 { dynamic } { height } { \l__flowfram_id_int }
19953 \vbox_to_ht:nn { \l__flowfram_y_dim }
19954 {
19955 \noindent
19956 \parbox { \linewidth }
19957 {
19958 \tl_use:c { g__flowfram_toc_level_ \romannumeral ##1 _tl }
19959 }
19960 \vfill
19961 \par
19962 \noindent
19963 \hrulefill
19964 }
19965 }
19966 }
19967 }
19968 % \end{macrocode}
19969 %\end{macro}
19970 %\begin{macro}{\if@minitoc}
19971 % Version 2.0 replaced \cs{if@minitoc}.
19972 %\changes{2.0}{2025-11-24}{replaced}
19973 % \begin{macrocode}
19974 \bool_new:N \g__flowfram_minitocs_enabled_bool
19975 \bool_gset_false:N \g__flowfram_minitocs_enabled_bool
19976 % \end{macrocode}
19977 %\end{macro}
19978 %Counter to keep track of the current minitoc.
19979 % \begin{macrocode}
19980 \newcounter{minitoc}
19981 % \end{macrocode}
19982 %
19983 %\begin{macro}{\enableminitoc}
19984 % Make mini tocs appear at the start of given sectional unit.
19985 %\changes{2.0}{2025-11-24}{changed to document command}
19986 % \begin{macrocode}
19987 \NewDocumentCommand \enableminitoc
19988 { O { \g__flowfram_thumbtab_type_tl } }
19989 {
19990 \bool_gset_true:N \g__flowfram_minitocs_enabled_bool
19991 \int_gzero:N \c@minitoc
19992 \cs_if_exist:cTF { c_flowfram_level_ #1 _int }
19993 {
19994 \tl_gset:Ne \g__flowfram_minitoc_type_tl { #1 }
19995 \cs_set:Nn \__flowfram_minitoc_post_section_unit:n
19996 {
19997 \tl_if_eq:NnT \g__flowfram_minitoc_type_tl { ##1 }
19998 {
19999 \stepcounter { minitoc }
20000 \dominitoc { \c@minitoc }
20001 }
20002 }
20003 }
20004 {
20005 \msg_error:nne { flowfram } { section-unit-not-defined } { #1 }
20006 }
20007 }
20008 % \end{macrocode}
20009 %\end{macro}
20010 % This command should only appear in the preamble. (This
20011 % ensures that it is used before "\tableofcontents".
20012 % \begin{macrocode}
20013 \@onlypreamble{\enableminitoc}
20014 % \end{macrocode}
20015 %\begin{macro}{\@makeminitocchapter}
20016 % Version 2.0 removed \cs{@makeminitocchapter}.
20017 %\changes{2.0}{2025-11-24}{removed}
20018 %\end{macro}
20019 %\begin{macro}{\@makeminitocpart}
20020 % Version 2.0 removed \cs{@makeminitocpart}.
20021 %\changes{2.0}{2025-11-24}{removed}
20022 %\end{macro}
20023 %\begin{macro}{\@makeminitocsection}
20024 % Version 2.0 removed \cs{@makeminitocsection}.
20025 %\changes{2.0}{2025-11-24}{removed}
20026 %\end{macro}
20027 % \begin{macrocode}
20028 \ExplSyntaxOff
20029 % \end{macrocode}
20030 %\iffalse
20031 % \begin{macrocode}
20032 %</flowfram.sty>
20033 % \end{macrocode}
20034 %\fi
20035 %\iffalse
20036 % \begin{macrocode}
20037 %<*flowframtkutils.sty>
20038 % \end{macrocode}
20039 %\fi
20040 % \section{Support for FlowframTk}
20041 %This package (new in v2.0) is provided to support commands written by FlowframTk
20042 %when exporting to a LaTeX class, package, document file or
20043 %image file. This package doesn't automatically load \sty{flowfram}
20044 %as the exported file could simply just contain a \env{pgfpicture}
20045 %environment, in which case \sty{flowfram} isn't required.
20046 %
20047 %A FlowframTk image consists of the actual image itself, which is
20048 %defined by a set of objects, that may be paths, text (no line
20049 %breaks), bitmaps, composite shapes (defined by an underlying shape
20050 %with replicas or a reflection or text decoration), or groups (a
20051 %subset of objects). Each object may have \sty{flowfram} data
20052 %assigned to it. Additionally, the image may include early preamble
20053 %code, mid preamble code and late preamble code. These may be
20054 %inserted when exporting to a class, package or complete document.
20055 %
20056 %FlowframTk has two types of export: create an image using the
20057 %\env{pgfpicture} environment, provided by the \sty{pgf} package, or
20058 %export the \sty{flowfram} data assigned to objects, which will
20059 %write the applicable \cs{newflowframe}, \cs{newstaticframe} or
20060 %\cs{newdynamicframe}. Objects the don't have \sty{flowfram} data
20061 %assigned will be omitted from the export. The object's graphical
20062 %representation (shape, text, bitmap, etc) may be used as the border
20063 %for the frame, or may simply be used to identify the location and
20064 %dimension of the frame.
20065 % \begin{macrocode}
20066 \NeedsTeXFormat{LaTeX2e}
20067 % \end{macrocode}
20068 %Declare package:
20069 % \begin{macrocode}
20070 \ProvidesPackage{flowframtkutils}[2026/04/25 v2.2 (NLCT)]
20071 % \end{macrocode}
20072 %Switch on L3 syntax.
20073 % \begin{macrocode}
20074 \ExplSyntaxOn
20075 % \end{macrocode}
20076 % Provide outline support if true:
20077 % \begin{macrocode}
20078 \bool_new:N \l__flowframtk_outline_bool
20079 \bool_set_false:N \l__flowframtk_outline_bool
20080 % \end{macrocode}
20081 % Provide text-path support if true:
20082 % \begin{macrocode}
20083 \bool_new:N \l__flowframtk_textpath_bool
20084 \bool_set_false:N \l__flowframtk_textpath_bool
20085 % \end{macrocode}
20086 % Provide package options:
20087 % \begin{macrocode}
20088 \keys_define:nn { flowframtkutils }
20089 {
20090 outline .bool_set:N = \l__flowframtk_outline_bool ,
20091 outline .usage:n = { load },
20092 textpath .bool_set:N = \l__flowframtk_textpath_bool ,
20093 textpath .usage:n = { load },
20094 }
20095 % \end{macrocode}
20096 %
20097 % \begin{macrocode}
20098 \ExplSyntaxOff
20099 % \end{macrocode}
20100 %Process options:
20101 % \begin{macrocode}
20102 \ProcessKeyOptions[flowframtkutils]
20103 % \end{macrocode}
20104 %Load \sty{pgf} and \sty{graphicx}:
20105 % \begin{macrocode}
20106 \RequirePackage{pgf}
20107 \RequirePackage{graphicx}
20108 % \end{macrocode}
20109 %
20110 % \begin{macrocode}
20111 \ExplSyntaxOn
20112 % \end{macrocode}
20113 %
20114 %The following is for use when FlowframTk exports to cls or sty. This allows all
20115 %\sty{flowfram} options to be passed in the created class or package
20116 %option list. This means that FlowframTk doesn't have to keep
20117 %track of all \sty{flowfram}['s] options and, in the case of an
20118 %exported class file, the remaining options can be passed to the
20119 %underlying class. Some of these
20120 %options are not applicable with FlowframTk but they are provided
20121 %for completeness.
20122 % \begin{macrocode}
20123 \clist_new:N \g__flowframtk_options_clist
20124 % \end{macrocode}
20125 %\begin{macro}{\FlowFramTkSetKey}
20126 %Check if \sty{flowfram} has already been loaded. Bear in mind that
20127 %some options can only be specified when \sty{flowfram} is loading.
20128 %FlowframTk will write the require package line for \sty{flowfram}
20129 %after that for \sty{flowframtkutils}.
20130 % \begin{macrocode}
20131 \IfPackageLoadedTF { flowfram }
20132 {
20133 \newcommand \FlowFramTkSetKey [ 1 ]
20134 {
20135 \keys_set:nn { flowfram } { #1 }
20136 }
20137 }
20138 {
20139 \newcommand \FlowFramTkSetKey [ 1 ]
20140 {
20141 \clist_gput_right:Nn \g__flowframtk_options_clist { #1 }
20142 }
20143 }
20144 % \end{macrocode}
20145 %\end{macro}
20146 %
20147 %\begin{macro}{\FlowFramTkDeclareKeys}
20148 %Either set the option (if \sty{flowfram} has already been loaded)
20149 %or add to the list of options to pass to \sty{flowfram}.
20150 % \begin{macrocode}
20151 \newcommand \FlowFramTkDeclareKeys [ 1 ]
20152 {
20153 \keys_define:nn { #1 }
20154 {
20155 adjust-toc .code:n =
20156 {
20157 \FlowFramTkSetKey { adjust-toc = { ##1 } }
20158 } ,
20159 backmatter-sections .code:n =
20160 {
20161 \FlowFramTkSetKey { backmatter-sections = { ##1 } }
20162 } ,
20163 color .code:n =
20164 {
20165 \FlowFramTkSetKey { color = { ##1 } }
20166 } ,
20167 color .default:n = { true } ,
20168 column-changes .code:n =
20169 {
20170 \FlowFramTkSetKey { column-changes = { ##1 } }
20171 } ,
20172 draft .code:n =
20173 {
20174 \FlowFramTkSetKey { draft }
20175 } ,
20176 dynamic-empty-page-style .code:n =
20177 {
20178 \FlowFramTkSetKey { dynamic-empty-page-style = { ##1 } }
20179 } ,
20180 dynamic-header-case .code:n =
20181 {
20182 \FlowFramTkSetKey { dynamic-header-case = { ##1 } }
20183 } ,
20184 dynamic-page-style .code:n =
20185 {
20186 \FlowFramTkSetKey { dynamic-page-style = { ##1 } }
20187 } ,
20188 dynamic-page-style-header-font .code:n =
20189 {
20190 \FlowFramTkSetKey { dynamic-page-style-header-font = { ##1 } }
20191 } ,
20192 dynamic-page-style-subheader-font .code:n =
20193 {
20194 \FlowFramTkSetKey { dynamic-page-style-subheader-font = { ##1 } }
20195 } ,
20196 dynamic-subheader-case .code:n =
20197 {
20198 \FlowFramTkSetKey { dynamic-subheader-case = { ##1 } }
20199 } ,
20200 final .code:n =
20201 {
20202 \FlowFramTkSetKey { final }
20203 } ,
20204 LR .code:n =
20205 {
20206 \FlowFramTkSetKey { LR = ##1 }
20207 } ,
20208 LR .default:n = { true } ,
20209 matter-thumbtabs .code:n =
20210 {
20211 \FlowFramTkSetKey { matter-thumbtabs = { ##1 } }
20212 } ,
20213 nocolor .code:n =
20214 {
20215 \FlowFramTkSetKey { nocolor }
20216 } ,
20217 norotate .code:n =
20218 {
20219 \FlowFramTkSetKey { norotate }
20220 } ,
20221 pages .code:n =
20222 {
20223 \FlowFramTkSetKey { pages = ##1 }
20224 } ,
20225 prohibit-frame-rotation .code:n =
20226 {
20227 \FlowFramTkSetKey { prohibit-frame-rotation = { ##1 } }
20228 } ,
20229 prohibit-frame-rotation .default:n = { true } ,
20230 RL .code:n =
20231 {
20232 \FlowFramTkSetKey { RL = ##1 }
20233 } ,
20234 RL .default:n = { true } ,
20235 rotate .code:n =
20236 {
20237 \FlowFramTkSetKey { rotate = { ##1 } }
20238 } ,
20239 rotate .default:n = { true } ,
20240 thumbtabs .code:n =
20241 {
20242 \FlowFramTkSetKey { thumbtabs = ##1 }
20243 } ,
20244 thumbtabs .default:n = { title } ,
20245 thumbtab-links .code:n =
20246 {
20247 \FlowFramTkSetKey { thumbtab-links = { ##1 } }
20248 } ,
20249 thumbtab-text .code:n =
20250 {
20251 \FlowFramTkSetKey { thumbtab-text = { ##1 } }
20252 } ,
20253 toc-thumbtabs .code:n =
20254 {
20255 \FlowFramTkSetKey { toc-thumbtabs = { ##1 } }
20256 } ,
20257 toc-thumbtabs .default:n = { true } ,
20258 ttbnotitle .code:n =
20259 {
20260 \FlowFramTkSetKey { ttbnotitle }
20261 } ,
20262 ttbnonum .code:n =
20263 {
20264 \FlowFramTkSetKey { ttbnonum }
20265 } ,
20266 ttbnum .code:n =
20267 {
20268 \FlowFramTkSetKey { ttbnum }
20269 } ,
20270 ttbtitle .code:n =
20271 {
20272 \FlowFramTkSetKey { ttbtitle }
20273 } ,
20274 sections-extra-option .code:n =
20275 {
20276 \FlowFramTkSetKey { sections-extra-option = { ##1 } }
20277 } ,
20278 verbose .code:n =
20279 {
20280 \FlowFramTkSetKey { verbose = { ##1 } }
20281 } ,
20282 verbose .default:n = { true } ,
20283 unstarred-thumbtabs .code:n =
20284 {
20285 \FlowFramTkSetKey { unstarred-thumbtabs = { ##1 } }
20286 } ,
20287 unstarred-thumbtabs .default:n = { true } ,
20288 }
20289 }
20290 % \end{macrocode}
20291 %\end{macro}
20292 %
20293 %\begin{macro}{\jdrimagebox}
20294 % For encapsulated images when FlowframTk creates a \LaTeX\ document
20295 % file that simply contains the image in a \env{pgfpicture}
20296 % environment.
20297 % This command is just in case numerical rounding errors
20298 % cause the image to be marginally larger than the
20299 % typeblock, which can cause a spurious blank page.
20300 % \begin{macrocode}
20301 \NewDocumentCommand \jdrimagebox { m }
20302 {
20303 \noindent
20304 \vbox_to_ht:nn { \textheight } { \hbox_to_wd:nn { \textwidth } { #1 } }
20305 }
20306 % \end{macrocode}
20307 %\end{macro}
20308 %
20309 %Provide support for outline text, if applicable. This depends on the output format.
20310 %First the code if \LuaLaTeX:
20311 % \begin{macrocode}
20312 \newcommand \@flowframtk@def@outlinelua
20313 {
20314 % \end{macrocode}
20315 %The \file{pdf-trans} file uses \pdfLaTeX\ primitives so these need
20316 %to be defined and the simplest way to do that is to load
20317 %\sty{luatex85}.
20318 % \begin{macrocode}
20319 \RequirePackage{luatex85}
20320 % \end{macrocode}
20321 %The rest is the same as for \pdfLaTeX:
20322 % \begin{macrocode}
20323 \@flowframtk@def@outlinepdf
20324 }
20325 % \end{macrocode}
20326 %The code if \pdfLaTeX. This is much the same as the above, except
20327 %\sty{luatex85} isn't required.
20328 % \begin{macrocode}
20329 \newcommand \@flowframtk@def@outlinepdf
20330 {
20331 % \end{macrocode}
20332 % pdf-trans defines \cs{mod} which is likely to conflict with other
20333 % packages so save it so that it can be restored afterwards.
20334 % \begin{macrocode}
20335 \cs_set_eq:NN \__flowframtk_mod: \mod
20336 % \end{macrocode}
20337 %Now input pdf-trans:
20338 % \begin{macrocode}
20339 \input{pdf-trans}
20340 % \end{macrocode}
20341 %Make pdf-trans's \cs{mod} available under a different name if
20342 %required:
20343 % \begin{macrocode}
20344 \let \flowframtkpdftransmod \mod
20345 % \end{macrocode}
20346 %Restore the original \cs{mod}:
20347 % \begin{macrocode}
20348 \cs_set_eq:NN \mod \__flowframtk_mod:
20349 % \end{macrocode}
20350 %Now define \cs{jdroutline} so that it uses the \cs{boxgs} command
20351 %provided by pdf-trans:
20352 % \begin{macrocode}
20353 \NewDocumentCommand \jdroutline { m m m }
20354 {
20355 \setbox\@tempboxa\hbox{##3}
20356 \boxgs{##1}{}\copy\@tempboxa
20357 }
20358 }
20359 % \end{macrocode}
20360 %Otherwise fallback on using PSTricks:
20361 % \begin{macrocode}
20362 \newcommand \@flowframtk@def@outlinepst
20363 {
20364 \RequirePackage{pst-char}
20365 \NewDocumentCommand \jdroutline { m m m }
20366 {
20367 \begin{pspicture}(0,0)
20368 \pscharpath[##2]{##3}
20369 \end{pspicture}
20370 }
20371 }
20372 % \end{macrocode}
20373 %
20374 % \begin{macrocode}
20375 \msg_new:nnn { flowframtk }
20376 { no-outline }
20377 {
20378 outline ~ support ~ not ~ enabled
20379 }
20380 % \end{macrocode}
20381 %
20382 %\begin{macro}{\@flowframtk@outline}
20383 %This command will be set to the applicable above command according
20384 %to the engine, but only if outline support was requested with the
20385 %"outline" package option. This will be set later after exp3 syntax
20386 %has been switched off in case it interferes with the required file
20387 %or package.
20388 % \begin{macrocode}
20389 \newcommand \@flowframtk@outline
20390 {
20391 \NewDocumentCommand \jdroutline { m m m }
20392 {
20393 \msg_warning:nn { flowframtk } { no-outline }
20394 ##3
20395 }
20396 }
20397 % \end{macrocode}
20398 %\end{macro}
20399 %
20400 % Provide outline support if requested:
20401 % \begin{macrocode}
20402 \bool_if:NT \l__flowframtk_outline_bool
20403 {
20404 \sys_if_engine_luatex:TF
20405 {
20406 \let \@flowframtk@outline \@flowframtk@def@outlinelua
20407 }
20408 {
20409 \sys_if_engine_pdftex:TF
20410 {
20411 \let \@flowframtk@outline \@flowframtk@def@outlinepdf
20412 }
20413 {
20414 \let \@flowframtk@outline \@flowframtk@def@outlinepst
20415 }
20416 }
20417 }
20418 % \end{macrocode}
20419 %Provide text-path support if requested. This is simply a matter of
20420 %loading the \opt{decorations.text} \sty{pgf} library:
20421 % \begin{macrocode}
20422 \bool_if:NTF \l__flowframtk_textpath_bool
20423 {
20424 \newcommand \@flowframtk@provide@textpath
20425 {
20426 \usepgflibrary{decorations.text}
20427 }
20428 }
20429 {
20430 \newcommand \@flowframtk@provide@textpath { }
20431 }
20432 % \end{macrocode}
20433 %
20434 % \begin{macrocode}
20435 \ExplSyntaxOff
20436 % \end{macrocode}
20437 %
20438 % \begin{macrocode}
20439 \@flowframtk@outline
20440 \@flowframtk@provide@textpath
20441 % \end{macrocode}
20442 %
20443 % \begin{macrocode}
20444 \ExplSyntaxOn
20445 % \end{macrocode}
20446 %Scratch variable:
20447 % \begin{macrocode}
20448 \tl_new:N \l__flowframtk_tmp_tl
20449 % \end{macrocode}
20450 %
20451 %Provide command to restore full justification (may be used by
20452 %import function if justification switches in blocks of text).
20453 % \begin{macrocode}
20454 \let\@flowframtk@cr\\
20455 \skip_const:Nn \c__flowframtk_org_@right_skip { \@rightskip }
20456 \skip_const:Nn \c__flowframtk_org_right_skip { \rightskip }
20457 \skip_const:Nn \c__flowframtk_org_left_skip { \leftskip }
20458 \int_const:Nn \c__flowframtk_org_finalhyphendemerits { \finalhyphendemerits }
20459 \dim_const:Nn \c__flowframtk_org_parindent_dim { \parindent }
20460 \skip_const:Nn \c__flowframtk_org_parfill_skip { \parfillskip }
20461 % \end{macrocode}
20462 %\begin{macro}{\flowframtkNoRagged}
20463 %\changes{2.2}{2026-04-25}{new}
20464 % \begin{macrocode}
20465 \NewDocumentCommand\flowframtkNoRagged{}{%
20466 \let\\\@flowframtk@cr
20467 \@rightskip \c__flowframtk_org_@right_skip
20468 \rightskip \c__flowframtk_org_right_skip
20469 \leftskip \c__flowframtk_org_left_skip
20470 \finalhyphendemerits \c__flowframtk_org_finalhyphendemerits
20471 \parindent \c__flowframtk_org_parindent_dim
20472 \parfillskip \c__flowframtk_org_parfill_skip
20473 }
20474 % \end{macrocode}
20475 %\end{macro}
20476 %
20477 %Object markup is an optional setting in FlowframTk's export dialog
20478 %(v0.8.8+). Each object in the image can either be encapsulated or
20479 %bookended. Each object has a unique value
20480 %of \meta{n}, starting with 0 for the entire image (which is an
20481 %implicit group).
20482 %
20483 %\begin{macro}{\flowframtkencapobject}
20484 %\begin{definition}
20485 %\cs{flowframtkencapobject}\marg{n}\marg{class name}\marg{description}\marg{tag}\marg{pgf
20486 %point}\marg{width}\marg{height}\marg{object}
20487 %\end{definition}
20488 %Encapsulate the image object.
20489 % \begin{macrocode}
20490 \newcommand\flowframtkencapobject[8]{#8}
20491 % \end{macrocode}
20492 %\end{macro}
20493 %
20494 %Alternatively, bookend with start and matching end pairs. Each pair
20495 %must have the same \meta{n} that identifies the object they are
20496 %marking.
20497 %\begin{macro}{\flowframtkstartobject}
20498 %\begin{definition}
20499 %\cs{flowframtkstartobject}\marg{n}\marg{class name}\marg{description}\marg{tag}\marg{pgf point}\marg{width}\marg{height}
20500 %\end{definition}
20501 %Markup just before object \meta{n} starts.
20502 % \begin{macrocode}
20503 \newcommand\flowframtkstartobject[7]{}
20504 % \end{macrocode}
20505 %\end{macro}
20506 %
20507 %\begin{macro}{\flowframtkendobject}
20508 %Markup when object \meta{n} ends.
20509 %Syntax as for \cs{flowframtkstartobject}.
20510 % \begin{macrocode}
20511 \newcommand\flowframtkendobject[7]{}
20512 % \end{macrocode}
20513 %\end{macro}
20514 %
20515 %Provide some convenient commands for use in the above.
20516 %\begin{macro}{\FlowframTkScopeIfGroup}
20517 %\changes{2.2}{2026-04-25}{new}
20518 %\begin{definition}
20519 %\cs{FlowframTkScopeIfGroup}\marg{class name}\marg{object}
20520 %\end{definition}
20521 %This command is designed for \cs{flowframtkencapobject}. If the
20522 %\meta{class name} is "JDRGroup" it will add scoping around
20523 %\meta{object} otherwise it will just do \meta{object}.
20524 % \begin{macrocode}
20525 \newcommand\FlowframTkScopeIfGroup[2]{
20526 \tl_if_eq:nnTF { #1 } { JDRGroup }
20527 {
20528 \begin { pgfscope }
20529 #2
20530 \end { pgfscope }
20531 }
20532 { #2 }
20533 }
20534 % \end{macrocode}
20535 %\end{macro}
20536 %
20537 %\begin{macro}{\FlowframTkBeginScopeIfGroup}
20538 %\changes{2.2}{2026-04-25}{new}
20539 %\begin{definition}
20540 %\cs{FlowframTkBeginScopeIfGroup}\marg{class name}
20541 %\end{definition}
20542 %Similar to the above but designed for the paired markup commands.
20543 % \begin{macrocode}
20544 \newcommand\FlowframTkBeginScopeIfGroup[1]{
20545 \tl_if_eq:nnT { #1 } { JDRGroup }
20546 {
20547 \begin { pgfscope }
20548 }
20549 }
20550 % \end{macrocode}
20551 %\end{macro}
20552 %
20553 %\begin{macro}{\FlowframTkEndScopeIfGroup}
20554 %\changes{2.2}{2026-04-25}{new}
20555 %\begin{definition}
20556 %\cs{FlowframTkEndScopeIfGroup}\marg{class name}
20557 %\end{definition}
20558 % \begin{macrocode}
20559 \newcommand\FlowframTkEndScopeIfGroup[1]{
20560 \tl_if_eq:nnT { #1 } { JDRGroup }
20561 {
20562 \end { pgfscope }
20563 }
20564 }
20565 % \end{macrocode}
20566 %\end{macro}
20567 %
20568 %
20569 %Provide a definition of \cs{flowframtkencapobject} that can be used
20570 %to uncover parts of the image in \cls{beamer} or similar.
20571 %First the command that does the uncovering. This may be redefined
20572 %as applicable. Individual uncover:
20573 % \begin{macrocode}
20574 \cs_new:Nn \flowframtkutils_uncover:nn
20575 {
20576 \uncover < #1 > { #2 }
20577 }
20578 % \end{macrocode}
20579 %
20580 %Uncover from:
20581 % \begin{macrocode}
20582 \cs_new:Nn \flowframtkutils_uncover_from:nn
20583 {
20584 \uncover < #1 - > { #2 }
20585 }
20586 % \end{macrocode}
20587 %
20588 % \begin{macrocode}
20589 \cs_new:Nn \__flowframtkutils_uncover:nn
20590 {
20591 \flowframtkutils_uncover_from:nn { #1 } { #2 }
20592 }
20593 % \end{macrocode}
20594 %
20595 % \begin{macrocode}
20596 \cs_new:Nn \__flowframtkutils_current_encap:nn { #2 }
20597 % \end{macrocode}
20598 %
20599 % \begin{macrocode}
20600 \int_new:N \g_flowframtkutils_overlay_int
20601 \tl_new:N \l__flowframtkutils_overlay_tl
20602 % \end{macrocode}
20603 %
20604 % \begin{macrocode}
20605 \bool_new:N \l__flowframtkutils_auto_overlay_bool
20606 \bool_set_true:N \l__flowframtkutils_auto_overlay_bool
20607 % \end{macrocode}
20608 %
20609 % \begin{macrocode}
20610 \tl_new:N \l__flowframtkutils_propval_tl
20611 % \end{macrocode}
20612 %
20613 % Tag to text mapping (for annotations):
20614 % \begin{macrocode}
20615 \prop_new:N \l_flowframtkutils_tag_text_prop
20616 % \end{macrocode}
20617 %
20618 % Tag to overlay number:
20619 % \begin{macrocode}
20620 \prop_new:N \l_flowframtkutils_tag_overlay_prop
20621 % \end{macrocode}
20622 %
20623 % Object type to overlay number:
20624 % \begin{macrocode}
20625 \prop_new:N \l_flowframtkutils_object_type_overlay_prop
20626 % \end{macrocode}
20627 %Note that groups will have nested objects with a single
20628 %all-encompassing group. Unexpected results may occur if an overlay
20629 %is applied to a group.
20630 %
20631 %Annotations.
20632 % \begin{macrocode}
20633 \bool_new:N \l_flowframtkutils_annote_bool
20634 \bool_set_false:N \l_flowframtkutils_annote_bool
20635 % \end{macrocode}
20636 %Include arrows:
20637 % \begin{macrocode}
20638 \bool_new:N \l_flowframtkutils_annote_arrow_bool
20639 \bool_set_true:N \l_flowframtkutils_annote_arrow_bool
20640 % \end{macrocode}
20641 %
20642 % \begin{macrocode}
20643 \dim_new:N \l_flowframtkutils_annote_offsetx_dim
20644 \dim_set:Nn \l_flowframtkutils_annote_offsetx_dim { 1cm }
20645 \dim_new:N \l_flowframtkutils_annote_offsety_dim
20646 \dim_set:Nn \l_flowframtkutils_annote_offsety_dim { 1cm }
20647 % \end{macrocode}
20648 %
20649 % \begin{macrocode}
20650 \int_new:N \l_flowframtkutils_annote_location_int
20651 \int_new:N \l_flowframtkutils_current_annote_location_int
20652 \int_const:Nn \c_flowframtkutils_annote_location_auto_int { 0 }
20653 \int_const:Nn \c_flowframtkutils_annote_location_north_int { 1 }
20654 \int_const:Nn \c_flowframtkutils_annote_location_northeast_int { 2 }
20655 \int_const:Nn \c_flowframtkutils_annote_location_east_int { 3 }
20656 \int_const:Nn \c_flowframtkutils_annote_location_southeast_int { 4 }
20657 \int_const:Nn \c_flowframtkutils_annote_location_south_int { 5 }
20658 \int_const:Nn \c_flowframtkutils_annote_location_southwest_int { 6 }
20659 \int_const:Nn \c_flowframtkutils_annote_location_west_int { 7 }
20660 \int_const:Nn \c_flowframtkutils_annote_location_northwest_int { 8 }
20661 % \end{macrocode}
20662 %
20663 % \begin{macrocode}
20664 \cs_new:Nn \__flowframtkutils_annote_uncover:nn
20665 {
20666 \flowframtkutils_uncover:nn { #1 } { #2 }
20667 }
20668 % \end{macrocode}
20669 %
20670 %Syntax: \meta{tl var} \marg{description} \marg{tag}
20671 % \begin{macrocode}
20672 \cs_new:Nn \__flowframtkutils_get_annotation_text:Nnn
20673 {
20674 \tl_if_empty:nF { #2 }
20675 {
20676 \tl_set:Nn #1 { #2 }
20677 }
20678 }
20679 % \end{macrocode}
20680 %
20681 % \begin{macrocode}
20682 \bool_new:N \l_flowframtkutils_default_auto_bool
20683 \bool_set_false:N \l_flowframtkutils_default_auto_bool
20684 \tl_new:N \l_flowframtkutils_default_overlay_tl
20685 % \end{macrocode}
20686 %Get default overlay if auto overlay setting not on.
20687 %Syntax: \meta{tl var} \marg{object index} \marg{object}
20688 % \begin{macrocode}
20689 \cs_new:Nn \flowframtkutils_get_default_overlay:Nnn
20690 {
20691 \bool_if:NT \l_flowframtkutils_default_auto_bool
20692 {
20693 \tl_if_eq:nnF { #3 } { JDRGroup }
20694 {
20695 \tl_if_empty:NTF \l_flowframtkutils_default_overlay_tl
20696 {
20697 \int_gincr:N \g_flowframtkutils_overlay_int
20698 }
20699 {
20700 \int_gset:Nn \g_flowframtkutils_overlay_int
20701 { \l_flowframtkutils_default_overlay_tl }
20702 }
20703 \tl_set:NV
20704 #1
20705 \g_flowframtkutils_overlay_int
20706 }
20707 }
20708 }
20709 % \end{macrocode}
20710 %
20711 % \begin{macrocode}
20712 \cs_new:Nn \flowframtkutils_get_default_annotation_overlay:Nnn
20713 {
20714 \tl_set:Nn #1 { 1 }
20715 }
20716 % \end{macrocode}
20717 %
20718 % \begin{macrocode}
20719 \tl_new:N \l__flowframtkutils_annotation_tl
20720 % \end{macrocode}
20721 %
20722 % \begin{macrocode}
20723 \keys_define:nn { flowframtkutils / overlay }
20724 {
20725 uncover .choice: ,
20726 uncover / single .code:n =
20727 {
20728 \cs_set:Nn \__flowframtkutils_uncover:nn
20729 {
20730 \flowframtkutils_uncover:nn { ##1 } { ##2 }
20731 }
20732 } ,
20733 uncover / from .code:n =
20734 {
20735 \cs_set:Nn \__flowframtkutils_uncover:nn
20736 {
20737 \flowframtkutils_uncover_from:nn { ##1 } { ##2 }
20738 }
20739 } ,
20740 uncover / false .code:n =
20741 {
20742 \cs_set:Nn \__flowframtkutils_uncover:nn { ##2 }
20743 } ,
20744 annote .choice: ,
20745 annote / match .code:n =
20746 {
20747 \cs_new:Nn \__flowframtkutils_annote_uncover:nn
20748 {
20749 \__flowframtkutils_uncover:nn { ##1 } { ##2 }
20750 }
20751 \bool_set_true:N \l_flowframtkutils_annote_bool
20752 } ,
20753 annote / single .code:n =
20754 {
20755 \cs_new:Nn \__flowframtkutils_annote_uncover:nn
20756 {
20757 \flowframtkutils_uncover:nn { ##1 } { ##2 }
20758 }
20759 \bool_set_true:N \l_flowframtkutils_annote_bool
20760 } ,
20761 annote / from .code:n =
20762 {
20763 \cs_new:Nn \__flowframtkutils_annote_uncover:nn
20764 {
20765 \flowframtkutils_uncover_from:nn { ##1 } { ##2 }
20766 }
20767 \bool_set_true:N \l_flowframtkutils_annote_bool
20768 } ,
20769 annote / true .code:n =
20770 {
20771 \bool_set_true:N \l_flowframtkutils_annote_bool
20772 } ,
20773 annote / false .code:n =
20774 {
20775 \bool_set_false:N \l_flowframtkutils_annote_bool
20776 } ,
20777 annote .default:n = true ,
20778 annote-position .choices:nn =
20779 {
20780 auto , north, northeast , east, southeast , south ,
20781 southwest, west , northwest
20782 }
20783 {
20784 \int_set:Nn
20785 \l_flowframtkutils_annote_location_int
20786 { \l_keys_choice_int - \c_one_int }
20787 } ,
20788 annote-arrow .code:n =
20789 {
20790 \keys_set:nn { flowframtkutils / overlay / arrow } { #1 }
20791 } ,
20792 annote-arrow .default:n = show ,
20793 annote-text .choice: ,
20794 annote-text / hide .code:n =
20795 {
20796 \cs_set:Nn \__flowframtkutils_get_annotation_text:Nnn { }
20797 } ,
20798 annote-text / description .code:n =
20799 {
20800 \cs_set:Nn \__flowframtkutils_get_annotation_text:Nnn
20801 {
20802 \tl_if_empty:nF { ##2 }
20803 {
20804 \tl_set:Nn ##1 { ##2 }
20805 }
20806 }
20807 } ,
20808 annote-text / tag .code:n =
20809 {
20810 \cs_set:Nn \__flowframtkutils_get_annotation_text:Nnn
20811 {
20812 \tl_if_empty:nF { ##3 }
20813 {
20814 \tl_set:Nn ##1 { ##3 }
20815 }
20816 }
20817 } ,
20818 annote-text / description-or-tag .code:n =
20819 {
20820 \cs_set:Nn \__flowframtkutils_get_annotation_text:Nnn
20821 {
20822 \tl_if_empty:nTF { ##2 }
20823 {
20824 \tl_if_empty:nF { ##3 }
20825 {
20826 \tl_set:Nn ##1 { ##3 }
20827 }
20828 }
20829 {
20830 \tl_set:Nn ##1 { ##2 }
20831 }
20832 }
20833 } ,
20834 annote-text / tag-map .code:n =
20835 {
20836 \cs_set:Nn \__flowframtkutils_get_annotation_text:Nnn
20837 {
20838 \tl_if_empty:nF { ##3 }
20839 {
20840 \prop_get:NnN \l_flowframtkutils_tag_text_prop
20841 { ##3 } ##1
20842 }
20843 }
20844 } ,
20845 tag-text .code:n =
20846 {
20847 \prop_set_from_keyval:Nn \l_flowframtkutils_tag_text_prop { #1 }
20848 \prop_if_empty:NF \l_flowframtkutils_tag_text_prop
20849 {
20850 \cs_set:Nn \__flowframtkutils_get_annotation_text:Nnn
20851 {
20852 \tl_if_empty:nF { ##3 }
20853 {
20854 \prop_get:NnN \l_flowframtkutils_tag_text_prop
20855 { ##3 } ##1
20856 }
20857 }
20858 }
20859 } ,
20860 tag-overlay .code:n =
20861 {
20862 \prop_set_from_keyval:Nn \l_flowframtkutils_tag_overlay_prop { #1 }
20863 \prop_if_empty:NF \l_flowframtkutils_tag_overlay_prop
20864 {
20865 \bool_set_false:N \l__flowframtkutils_auto_overlay_bool
20866 }
20867 } ,
20868 object-overlay .code:n =
20869 {
20870 \prop_clear:N \l_flowframtkutils_object_type_overlay_prop
20871 \keys_set:nn { flowframtkutils / overlay / objects } { #1 }
20872 \prop_if_empty:NF \l_flowframtkutils_object_type_overlay_prop
20873 {
20874 \bool_set_false:N \l__flowframtkutils_auto_overlay_bool
20875 }
20876 } ,
20877 auto-overlay .bool_set:N = \l__flowframtkutils_auto_overlay_bool ,
20878 fallback-overlay .code:n =
20879 {
20880 \keys_set:nn { flowframtkutils / overlay / fallback } { #1 }
20881 } ,
20882 fallback-overlay .default:n = { enable } ,
20883 }
20884 % \end{macrocode}
20885 %
20886 % \begin{macrocode}
20887 \keys_define:nn { flowframtkutils / overlay / fallback }
20888 {
20889 enable .bool_set:N = \l_flowframtkutils_default_auto_bool ,
20890 fixed .tl_set:N = \l_flowframtkutils_default_overlay_tl ,
20891 increment .code:n =
20892 {
20893 \tl_clear:N \l_flowframtkutils_default_overlay_tl
20894 } ,
20895 increment .value_forbidden:n = true ,
20896 }
20897 % \end{macrocode}
20898 %
20899 % \begin{macrocode}
20900 \keys_define:nn { flowframtkutils / overlay / objects }
20901 {
20902 group .code:n =
20903 {
20904 \prop_put:Nne
20905 \l_flowframtkutils_object_type_overlay_prop
20906 { JDRGroup } { #1 }
20907 },
20908 path .code:n =
20909 {
20910 \prop_put:Nne
20911 \l_flowframtkutils_object_type_overlay_prop
20912 { JDRPath } { #1 }
20913 },
20914 text .code:n =
20915 {
20916 \prop_put:Nne
20917 \l_flowframtkutils_object_type_overlay_prop
20918 { JDRText } { #1 }
20919 },
20920 text-path .code:n =
20921 {
20922 \prop_put:Nne
20923 \l_flowframtkutils_object_type_overlay_prop
20924 { JDRTextPath } { #1 }
20925 },
20926 symmetric-path .code:n =
20927 {
20928 \prop_put:Nne
20929 \l_flowframtkutils_object_type_overlay_prop
20930 { JDRSymmetricPath } { #1 }
20931 },
20932 bitmap .code:n =
20933 {
20934 \prop_put:Nne
20935 \l_flowframtkutils_object_type_overlay_prop
20936 { JDRBitmap } { #1 }
20937 },
20938 scaled-pattern .code:n =
20939 {
20940 \prop_put:Nne
20941 \l_flowframtkutils_object_type_overlay_prop
20942 { JDRScaledPattern } { #1 }
20943 },
20944 spiral-pattern .code:n =
20945 {
20946 \prop_put:Nne
20947 \l_flowframtkutils_object_type_overlay_prop
20948 { JDRSpiralPattern } { #1 }
20949 },
20950 rotational-pattern .code:n =
20951 {
20952 \prop_put:Nne
20953 \l_flowframtkutils_object_type_overlay_prop
20954 { JDRRotationalPattern } { #1 }
20955 },
20956 }
20957 % \end{macrocode}
20958 %
20959 % \begin{macrocode}
20960 \keys_define:nn { flowframtkutils / overlay / arrow }
20961 {
20962 show .bool_set:N = \l_flowframtkutils_annote_arrow_bool ,
20963 hide .bool_set_inverse:N = \l_flowframtkutils_annote_arrow_bool ,
20964 dx .dim_set:N = \l_flowframtkutils_annote_offsetx_dim ,
20965 dy .dim_set:N = \l_flowframtkutils_annote_offsety_dim ,
20966 color .code:n =
20967 {
20968 \tl_if_empty:nTF { #1 }
20969 {
20970 \tl_clear:N \l_flowframtkutils_annotation_stroke_color_tl
20971 }
20972 {
20973 \tl_set:Nn \l_flowframtkutils_annotation_stroke_color_tl
20974 { \pgfsetstrokecolor { #1 } }
20975 }
20976 } ,
20977 start .code:n =
20978 {
20979 \tl_if_empty:nTF { #1 }
20980 {
20981 \tl_clear:N \l_flowframtkutils_annotation_start_arrow_tl
20982 }
20983 {
20984 \tl_set:Nn \l_flowframtkutils_annotation_start_arrow_tl
20985 {
20986 \pgfsetarrowsstart { #1 }
20987 }
20988 }
20989 } ,
20990 end .code:n =
20991 {
20992 \tl_if_empty:nTF { #1 }
20993 {
20994 \tl_clear:N \l_flowframtkutils_annotation_end_arrow_tl
20995 }
20996 {
20997 \tl_set:Nn \l_flowframtkutils_annotation_end_arrow_tl
20998 {
20999 \pgfsetarrowsend { #1 }
21000 }
21001 }
21002 } ,
21003 }
21004 % \end{macrocode}
21005 %
21006 % \begin{macrocode}
21007 \dim_new:N \l__flowframtkutils_image_minx_dim
21008 \dim_new:N \l__flowframtkutils_image_miny_dim
21009 \dim_new:N \l__flowframtkutils_image_maxx_dim
21010 \dim_new:N \l__flowframtkutils_image_maxy_dim
21011 \dim_new:N \l__flowframtkutils_image_cx_dim
21012 \dim_new:N \l__flowframtkutils_image_cy_dim
21013 \dim_new:N \l__flowframtkutils_image_width_dim
21014 \dim_new:N \l__flowframtkutils_image_height_dim
21015 % \end{macrocode}
21016 %Object boundary:
21017 % \begin{macrocode}
21018 \dim_new:N \l__flowframtkutils_object_minx_dim
21019 \dim_new:N \l__flowframtkutils_object_miny_dim
21020 \dim_new:N \l__flowframtkutils_object_maxx_dim
21021 \dim_new:N \l__flowframtkutils_object_maxy_dim
21022 \dim_new:N \l__flowframtkutils_object_cx_dim
21023 \dim_new:N \l__flowframtkutils_object_cy_dim
21024 \dim_new:N \l__flowframtkutils_object_width_dim
21025 \dim_new:N \l__flowframtkutils_object_height_dim
21026 % \end{macrocode}
21027 %
21028 % \begin{macrocode}
21029 \dim_new:N \l__flowframtkutils_x_dim
21030 \dim_new:N \l__flowframtkutils_y_dim
21031 % \end{macrocode}
21032 %Keep track of current group:
21033 % \begin{macrocode}
21034 \int_new:N \l_flowframtkutils_group_level_int
21035 % \end{macrocode}
21036 %
21037 % \begin{macrocode}
21038 \cs_new:Nn \flowframtkutils_uncover_encap:nnnnnnnn
21039 {
21040 % \end{macrocode}
21041 %Default to no overlay:
21042 % \begin{macrocode}
21043 \cs_set_eq:NN \__flowframtkutils_current_encap:nn \use_ii:nn
21044 \int_if_zero:nTF { #1 }
21045 {
21046 % \end{macrocode}
21047 % Start of the image (0, JDRGroup, no tag, image description).
21048 % \begin{macrocode}
21049 \int_gzero:N \g_flowframtkutils_overlay_int
21050 \tl_clear:N \l__flowframtkutils_overlay_tl
21051 % \end{macrocode}
21052 %This will be incremented later. So the group level for the entire
21053 %image will be 1. Actual top-level groups will be level 2,
21054 %sub-groups level 3, etc.
21055 % \begin{macrocode}
21056 \int_zero:N \l_flowframtkutils_group_level_int
21057 % \end{macrocode}
21058 % The bottom left position will be in the form
21059 % \cs{pgfpoint}\marg{x}\marg{y}.
21060 % \begin{macrocode}
21061 \pgfextractx \l__flowframtkutils_image_minx_dim { #5 }
21062 \pgfextracty \l__flowframtkutils_image_miny_dim { #5 }
21063 % \end{macrocode}
21064 %Width and height:
21065 % \begin{macrocode}
21066 \dim_set:Nn \l__flowframtkutils_image_width_dim { #6 }
21067 \dim_set:Nn \l__flowframtkutils_image_height_dim { #7 }
21068 % \end{macrocode}
21069 %Calculate maximum.
21070 % \begin{macrocode}
21071 \dim_set:Nn \l__flowframtkutils_image_maxx_dim
21072 {
21073 \l__flowframtkutils_image_minx_dim
21074 + \l__flowframtkutils_image_width_dim
21075 }
21076 \dim_set:Nn \l__flowframtkutils_image_maxy_dim
21077 {
21078 \l__flowframtkutils_image_miny_dim
21079 + \l__flowframtkutils_image_height_dim
21080 }
21081 % \end{macrocode}
21082 %Calculate centre point.
21083 % \begin{macrocode}
21084 \dim_set:Nn \l__flowframtkutils_image_cx_dim
21085 {
21086 \l__flowframtkutils_image_minx_dim
21087 + 0.5 \l__flowframtkutils_image_width_dim
21088 }
21089 \dim_set:Nn \l__flowframtkutils_image_cy_dim
21090 {
21091 \l__flowframtkutils_image_miny_dim
21092 + 0.5 \l__flowframtkutils_image_height_dim
21093 }
21094 % \end{macrocode}
21095 %If annote setting is on, set the current object bounds to the image
21096 %bounds.
21097 % \begin{macrocode}
21098 \bool_if:NT \l_flowframtkutils_annote_bool
21099 {
21100 \dim_set_eq:NN
21101 \l__flowframtkutils_object_minx_dim
21102 \l__flowframtkutils_image_minx_dim
21103 \dim_set_eq:NN
21104 \l__flowframtkutils_object_miny_dim
21105 \l__flowframtkutils_image_miny_dim
21106 \dim_set_eq:NN
21107 \l__flowframtkutils_object_maxx_dim
21108 \l__flowframtkutils_image_maxx_dim
21109 \dim_set_eq:NN
21110 \l__flowframtkutils_object_maxy_dim
21111 \l__flowframtkutils_image_maxy_dim
21112 \dim_set_eq:NN
21113 \l__flowframtkutils_object_cx_dim
21114 \l__flowframtkutils_image_cx_dim
21115 \dim_set_eq:NN
21116 \l__flowframtkutils_object_cy_dim
21117 \l__flowframtkutils_image_cy_dim
21118 \dim_set_eq:NN
21119 \l__flowframtkutils_object_width_dim
21120 \l__flowframtkutils_image_width_dim
21121 \dim_set_eq:NN
21122 \l__flowframtkutils_object_height_dim
21123 \l__flowframtkutils_image_height_dim
21124 }
21125 }
21126 {
21127 % \end{macrocode}
21128 %Obtain the overlay, if set.
21129 % \begin{macrocode}
21130 \tl_set:Nn \l__flowframtkutils_propval_tl { \q_no_value }
21131 \bool_if:NTF \l__flowframtkutils_auto_overlay_bool
21132 {
21133 % \end{macrocode}
21134 %Auto setting is on. Overlay is incremented but skip groups to
21135 %prevent nesting.
21136 % \begin{macrocode}
21137 \tl_if_eq:nnF { #2 } { JDRGroup }
21138 {
21139 \int_gincr:N \g_flowframtkutils_overlay_int
21140 \tl_set:NV
21141 \l__flowframtkutils_propval_tl
21142 \g_flowframtkutils_overlay_int
21143 }
21144 }
21145 {
21146 % \end{macrocode}
21147 %Tag setting takes precedence.
21148 % \begin{macrocode}
21149 \tl_if_empty:nF { #4 }
21150 {
21151 \prop_get:NnN \l_flowframtkutils_tag_overlay_prop { #4 }
21152 \l__flowframtkutils_propval_tl
21153 }
21154 \quark_if_no_value:NT
21155 \l__flowframtkutils_propval_tl
21156 {
21157 % \end{macrocode}
21158 %If no tag setting, use the object setting. The second argument is
21159 %the object type and will always be non-empty.
21160 % \begin{macrocode}
21161 \prop_get:NnN \l_flowframtkutils_object_type_overlay_prop { #2 }
21162 \l__flowframtkutils_propval_tl
21163 % \end{macrocode}
21164 %If no object setting either, get the default:
21165 % \begin{macrocode}
21166 \quark_if_no_value:NT
21167 \l__flowframtkutils_propval_tl
21168 {
21169 \flowframtkutils_get_default_overlay:Nnn
21170 \l__flowframtkutils_propval_tl
21171 { #1 } { #2 }
21172 }
21173 }
21174 }
21175 % \end{macrocode}
21176 %Set the overlay and uncover functions as appropriate.
21177 % \begin{macrocode}
21178 \quark_if_no_value:NTF
21179 \l__flowframtkutils_propval_tl
21180 {
21181 \tl_clear:N \l__flowframtkutils_overlay_tl
21182 }
21183 {
21184 \tl_if_empty:NF \l__flowframtkutils_propval_tl
21185 {
21186 \cs_set_eq:NN
21187 \__flowframtkutils_current_encap:nn
21188 \__flowframtkutils_uncover:nn
21189 }
21190 \tl_set_eq:NN
21191 \l__flowframtkutils_overlay_tl
21192 \l__flowframtkutils_propval_tl
21193 }
21194 \bool_if:NT \l_flowframtkutils_annote_bool
21195 {
21196 % \end{macrocode}
21197 %Annotation on. Store the current object's bounding box dimensions.
21198 % \begin{macrocode}
21199 \pgfextractx \l__flowframtkutils_object_minx_dim { #5 }
21200 \pgfextracty \l__flowframtkutils_object_miny_dim { #5 }
21201 \dim_set:Nn \l__flowframtkutils_object_width_dim { #6 }
21202 \dim_set:Nn \l__flowframtkutils_object_height_dim { #7 }
21203 % \end{macrocode}
21204 %Calculate maximum point.
21205 % \begin{macrocode}
21206 \dim_set:Nn \l__flowframtkutils_object_maxx_dim
21207 {
21208 \l__flowframtkutils_object_minx_dim
21209 + \l__flowframtkutils_object_width_dim
21210 }
21211 \dim_set:Nn \l__flowframtkutils_object_maxy_dim
21212 {
21213 \l__flowframtkutils_object_miny_dim
21214 + \l__flowframtkutils_object_height_dim
21215 }
21216 % \end{macrocode}
21217 %Calculate centre point.
21218 % \begin{macrocode}
21219 \dim_set:Nn \l__flowframtkutils_object_cx_dim
21220 {
21221 \l__flowframtkutils_object_minx_dim
21222 + 0.5 \l__flowframtkutils_object_width_dim
21223 }
21224 \dim_set:Nn \l__flowframtkutils_object_cy_dim
21225 {
21226 \l__flowframtkutils_object_miny_dim
21227 + 0.5 \l__flowframtkutils_object_height_dim
21228 }
21229 }
21230 }
21231 \tl_if_eq:nnT { #2 } { JDRGroup }
21232 {
21233 % \end{macrocode}
21234 %Increment group level. This isn't scoped so it will need
21235 %decrementing afterwards.
21236 % \begin{macrocode}
21237 \int_incr:N \l_flowframtkutils_group_level_int
21238 }
21239 % \end{macrocode}
21240 %Encapsulate object.
21241 % \begin{macrocode}
21242 \exp_args:NV
21243 \__flowframtkutils_current_encap:nn
21244 \l__flowframtkutils_overlay_tl { #8 }
21245 \bool_if:NT \l_flowframtkutils_annote_bool
21246 {
21247 % \end{macrocode}
21248 %Add annotation (arrow, if applicable, and text).
21249 % \begin{macrocode}
21250 \tl_clear:N \l__flowframtkutils_annotation_tl
21251 \tl_set:Nn \l__flowframtkutils_propval_tl { \q_no_value }
21252 \__flowframtkutils_get_annotation_text:Nnn
21253 \l__flowframtkutils_propval_tl
21254 { #3 } { #4 }
21255 % \end{macrocode}
21256 %If no text value, skip.
21257 % \begin{macrocode}
21258 \quark_if_no_value:NF
21259 \l__flowframtkutils_propval_tl
21260 {
21261 \int_if_zero:nTF
21262 { \l_flowframtkutils_annote_location_int }
21263 {
21264 % \end{macrocode}
21265 %Position set to auto so calculate suitable position id.
21266 % \begin{macrocode}
21267 \__flowframtkutils_auto_set_annote_location:
21268 }
21269 {
21270 % \end{macrocode}
21271 %Specific position, so just store position id.
21272 % \begin{macrocode}
21273 \int_set_eq:NN
21274 \l_flowframtkutils_current_annote_location_int
21275 \l_flowframtkutils_annote_location_int
21276 }
21277 % \end{macrocode}
21278 %Set the annotation content.
21279 % \begin{macrocode}
21280 \exp_args:NV
21281 \__flowframtkutils_set_annote_content:n
21282 \l__flowframtkutils_propval_tl
21283 }
21284 % \end{macrocode}
21285 %If an annotation has been set, draw it with the applicable overlay.
21286 % \begin{macrocode}
21287 \tl_if_empty:NF \l__flowframtkutils_annotation_tl
21288 {
21289 \tl_if_empty:NT \l__flowframtkutils_overlay_tl
21290 {
21291 % \end{macrocode}
21292 %No overlay for the current object so use the default annotation
21293 %overlay.
21294 % \begin{macrocode}
21295 \flowframtkutils_get_default_annotation_overlay:Nnn
21296 \l__flowframtkutils_overlay_tl { #1 } { #2 }
21297 }
21298 % \end{macrocode}
21299 %Draw the annotation:
21300 % \begin{macrocode}
21301 \exp_args:NVV
21302 \__flowframtkutils_annote_uncover:nn
21303 \l__flowframtkutils_overlay_tl
21304 \l__flowframtkutils_annotation_tl
21305 }
21306 }
21307 % \end{macrocode}
21308 %Decrement the group level counter.
21309 % \begin{macrocode}
21310 \tl_if_eq:nnT { #2 } { JDRGroup }
21311 {
21312 \int_decr:N \l_flowframtkutils_group_level_int
21313 }
21314 }
21315 % \end{macrocode}
21316 %
21317 %Used when the annotation location is set to auto:
21318 % \begin{macrocode}
21319 \cs_new:Nn \__flowframtkutils_auto_set_annote_location:
21320 {
21321 \dim_compare:nNnTF
21322 { \l__flowframtkutils_object_cx_dim }
21323 <
21324 { \l__flowframtkutils_image_cx_dim }
21325 {
21326 % \end{macrocode}
21327 %The centre of the object's bounding box is to the left of the
21328 %centre of the image's bounding box (West).
21329 % \begin{macrocode}
21330 \int_set_eq:NN
21331 \l_flowframtkutils_current_annote_location_int
21332 \c_flowframtkutils_annote_location_west_int
21333 \dim_compare:nNnTF
21334 { \l__flowframtkutils_object_miny_dim }
21335 >
21336 { \l__flowframtkutils_image_cy_dim }
21337 {
21338 % \end{macrocode}
21339 %The lowest point of the object's bounding box is higher than the
21340 %middle of the image's bounding box.
21341 % \begin{macrocode}
21342 \int_set_eq:NN
21343 \l_flowframtkutils_current_annote_location_int
21344 \c_flowframtkutils_annote_location_northwest_int
21345 }
21346 {
21347 \dim_compare:nNnT
21348 { \l__flowframtkutils_object_maxy_dim }
21349 <
21350 { \l__flowframtkutils_image_cy_dim }
21351 {
21352 % \end{macrocode}
21353 %The highest point of the object's bounding box is lower than the
21354 %middle of the image's bounding box.
21355 % \begin{macrocode}
21356 \int_set_eq:NN
21357 \l_flowframtkutils_current_annote_location_int
21358 \c_flowframtkutils_annote_location_southwest_int
21359 }
21360 }
21361 }
21362 {
21363 % \end{macrocode}
21364 %The centre of the object's bounding box is not to the left of the
21365 %centre of the image's bounding box (East).
21366 % \begin{macrocode}
21367 \int_set_eq:NN
21368 \l_flowframtkutils_current_annote_location_int
21369 \c_flowframtkutils_annote_location_east_int
21370 \dim_compare:nNnTF
21371 { \l__flowframtkutils_object_miny_dim }
21372 >
21373 { \l__flowframtkutils_image_cy_dim }
21374 {
21375 % \end{macrocode}
21376 %The lowest point of the object's bounding box is higher than the
21377 %middle of the image's bounding box.
21378 % \begin{macrocode}
21379 \int_set_eq:NN
21380 \l_flowframtkutils_current_annote_location_int
21381 \c_flowframtkutils_annote_location_northeast_int
21382 }
21383 {
21384 \dim_compare:nNnT
21385 { \l__flowframtkutils_object_maxy_dim }
21386 <
21387 { \l__flowframtkutils_image_cy_dim }
21388 {
21389 % \end{macrocode}
21390 %The highest point of the object's bounding box is lower than the
21391 %middle of the image's bounding box.
21392 % \begin{macrocode}
21393 \int_set_eq:NN
21394 \l_flowframtkutils_current_annote_location_int
21395 \c_flowframtkutils_annote_location_southeast_int
21396 }
21397 }
21398 }
21399 }
21400 % \end{macrocode}
21401 %Default arrow colour is black:
21402 % \begin{macrocode}
21403 \tl_new:N \l_flowframtkutils_annotation_stroke_color_tl
21404 \tl_set:Nn \l_flowframtkutils_annotation_stroke_color_tl
21405 {
21406 \pgfsetstrokecolor { black }
21407 }
21408 % \end{macrocode}
21409 %Default start arrow head (at the bounding box edge):
21410 % \begin{macrocode}
21411 \tl_new:N \l_flowframtkutils_annotation_start_arrow_tl
21412 \tl_set:Nn \l_flowframtkutils_annotation_start_arrow_tl
21413 {
21414 \pgfsetarrowsstart { < }
21415 }
21416 % \end{macrocode}
21417 %No end arrow head by default (the point where the text is placed).
21418 % \begin{macrocode}
21419 \tl_new:N \l_flowframtkutils_annotation_end_arrow_tl
21420 % \end{macrocode}
21421 %
21422 % \begin{macrocode}
21423 \cs_new:Nn \__flowframtkutils_set_annote_content:n
21424 {
21425 % \end{macrocode}
21426 %The code to draw the arrow and text is stored in a token list
21427 %variable.
21428 % \begin{macrocode}
21429 \tl_set:Nn \l__flowframtkutils_annotation_tl
21430 {
21431 \begin { pgfscope }
21432 \l_flowframtkutils_annotation_stroke_color_tl
21433 \l_flowframtkutils_annotation_start_arrow_tl
21434 \l_flowframtkutils_annotation_end_arrow_tl
21435 }
21436 % \end{macrocode}
21437 %The position of the text in relation to the object's bounding box
21438 %is indicated by a numeric id.
21439 % \begin{macrocode}
21440 \int_case:nn { \l_flowframtkutils_current_annote_location_int }
21441 {
21442 { \c_flowframtkutils_annote_location_north_int }
21443 {
21444 % \end{macrocode}
21445 %North (vertical arrow pointing downwards with text on top).
21446 %Calculate the co-ordinates of the text (the end of the arrow).
21447 % \begin{macrocode}
21448 \dim_set_eq:NN
21449 \l__flowframtkutils_x_dim
21450 \l__flowframtkutils_object_cx_dim
21451 \dim_set:Nn \l__flowframtkutils_y_dim
21452 {
21453 \l__flowframtkutils_object_maxy_dim
21454 + \l_flowframtkutils_annote_offsety_dim
21455 }
21456 % \end{macrocode}
21457 %Add the code to draw the arrow if applicable.
21458 % \begin{macrocode}
21459 \bool_if:NT \l_flowframtkutils_annote_arrow_bool
21460 {
21461 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21462 {
21463 \exp_not:N \pgfpathmoveto
21464 {
21465 \exp_not:N \pgfpoint
21466 { \dim_use:N \l__flowframtkutils_object_cx_dim }
21467 { \dim_use:N \l__flowframtkutils_object_maxy_dim }
21468 }
21469 \exp_not:N \pgfpathlineto
21470 {
21471 \exp_not:N \pgfpoint
21472 {
21473 \dim_use:N \l__flowframtkutils_x_dim
21474 }
21475 {
21476 \dim_use:N \l__flowframtkutils_y_dim
21477 }
21478 }
21479 \exp_not:N \pgfusepath { stroke }
21480 }
21481 }
21482 % \end{macrocode}
21483 %Add the code to position text.
21484 % \begin{macrocode}
21485 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21486 {
21487 \exp_not:N \pgftext
21488 [
21489 bottom ,
21490 at = {
21491 \exp_not:N \pgfpoint
21492 {
21493 \dim_use:N \l__flowframtkutils_x_dim
21494 }
21495 {
21496 \dim_use:N \l__flowframtkutils_y_dim
21497 }
21498 } ]
21499 { #1 }
21500 }
21501 }
21502 { \c_flowframtkutils_annote_location_northeast_int }
21503 {
21504 % \end{macrocode}
21505 %North-East (slanted arrow pointing down left with text to the upper right).
21506 %Calculate the co-ordinates of the text (the end of the arrow).
21507 % \begin{macrocode}
21508 \dim_set:Nn \l__flowframtkutils_x_dim
21509 {
21510 \l__flowframtkutils_object_maxx_dim
21511 + \l_flowframtkutils_annote_offsetx_dim
21512 }
21513 \dim_set:Nn \l__flowframtkutils_y_dim
21514 {
21515 \l__flowframtkutils_object_maxy_dim
21516 + \l_flowframtkutils_annote_offsety_dim
21517 }
21518 % \end{macrocode}
21519 %Add the code to draw the arrow if applicable.
21520 % \begin{macrocode}
21521 \bool_if:NT \l_flowframtkutils_annote_arrow_bool
21522 {
21523 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21524 {
21525 \exp_not:N \pgfpathmoveto
21526 {
21527 \exp_not:N \pgfpoint
21528 { \dim_use:N \l__flowframtkutils_object_maxx_dim }
21529 { \dim_use:N \l__flowframtkutils_object_maxy_dim }
21530 }
21531 \exp_not:N \pgfpathlineto
21532 {
21533 \exp_not:N \pgfpoint
21534 {
21535 \dim_use:N \l__flowframtkutils_x_dim
21536 }
21537 {
21538 \dim_use:N \l__flowframtkutils_y_dim
21539 }
21540 }
21541 \exp_not:N \pgfusepath { stroke }
21542 }
21543 }
21544 % \end{macrocode}
21545 %Add the code to position text.
21546 % \begin{macrocode}
21547 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21548 {
21549 \exp_not:N \pgftext
21550 [
21551 left , bottom ,
21552 at = {
21553 \exp_not:N \pgfpoint
21554 {
21555 \dim_use:N \l__flowframtkutils_x_dim
21556 }
21557 {
21558 \dim_use:N \l__flowframtkutils_y_dim
21559 }
21560 } ]
21561 { #1 }
21562 }
21563 }
21564 { \c_flowframtkutils_annote_location_east_int }
21565 {
21566 % \end{macrocode}
21567 %East (horizontal arrow pointing leftwards with text to the right).
21568 %Calculate the co-ordinates of the text (the end of the arrow).
21569 % \begin{macrocode}
21570 \dim_set:Nn \l__flowframtkutils_x_dim
21571 {
21572 \l__flowframtkutils_object_maxx_dim
21573 + \l_flowframtkutils_annote_offsetx_dim
21574 }
21575 \dim_set_eq:NN
21576 \l__flowframtkutils_y_dim
21577 \l__flowframtkutils_object_cy_dim
21578 % \end{macrocode}
21579 %Add the code to draw the arrow if applicable.
21580 % \begin{macrocode}
21581 \bool_if:NT \l_flowframtkutils_annote_arrow_bool
21582 {
21583 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21584 {
21585 \exp_not:N \pgfpathmoveto
21586 {
21587 \exp_not:N \pgfpoint
21588 { \dim_use:N \l__flowframtkutils_object_maxx_dim }
21589 { \dim_use:N \l__flowframtkutils_object_cy_dim }
21590 }
21591 \exp_not:N \pgfpathlineto
21592 {
21593 \exp_not:N \pgfpoint
21594 {
21595 \dim_use:N \l__flowframtkutils_x_dim
21596 }
21597 {
21598 \dim_use:N \l__flowframtkutils_y_dim
21599 }
21600 }
21601 \exp_not:N \pgfusepath { stroke }
21602 }
21603 }
21604 % \end{macrocode}
21605 %Add the code to position text.
21606 % \begin{macrocode}
21607 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21608 {
21609 \exp_not:N \pgftext
21610 [
21611 left ,
21612 at = {
21613 \exp_not:N \pgfpoint
21614 {
21615 \dim_use:N \l__flowframtkutils_x_dim
21616 }
21617 {
21618 \dim_use:N \l__flowframtkutils_y_dim
21619 }
21620 } ]
21621 { #1 }
21622 }
21623 }
21624 { \c_flowframtkutils_annote_location_southeast_int }
21625 {
21626 % \end{macrocode}
21627 %South-East (slanted arrow pointing up left with text to the lower right).
21628 %Calculate the co-ordinates of the text (the end of the arrow).
21629 % \begin{macrocode}
21630 \dim_set:Nn \l__flowframtkutils_x_dim
21631 {
21632 \l__flowframtkutils_object_maxx_dim
21633 + \l_flowframtkutils_annote_offsetx_dim
21634 }
21635 \dim_set:Nn \l__flowframtkutils_y_dim
21636 {
21637 \l__flowframtkutils_object_miny_dim
21638 - \l_flowframtkutils_annote_offsety_dim
21639 }
21640 % \end{macrocode}
21641 %Add the code to draw the arrow if applicable.
21642 % \begin{macrocode}
21643 \bool_if:NT \l_flowframtkutils_annote_arrow_bool
21644 {
21645 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21646 {
21647 \exp_not:N \pgfpathmoveto
21648 {
21649 \exp_not:N \pgfpoint
21650 { \dim_use:N \l__flowframtkutils_object_maxx_dim }
21651 { \dim_use:N \l__flowframtkutils_object_miny_dim }
21652 }
21653 \exp_not:N \pgfpathlineto
21654 {
21655 \exp_not:N \pgfpoint
21656 {
21657 \dim_use:N \l__flowframtkutils_x_dim
21658 }
21659 {
21660 \dim_use:N \l__flowframtkutils_y_dim
21661 }
21662 }
21663 \exp_not:N \pgfusepath { stroke }
21664 }
21665 }
21666 % \end{macrocode}
21667 %Add the code to position text.
21668 % \begin{macrocode}
21669 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21670 {
21671 \exp_not:N \pgftext
21672 [
21673 top, left ,
21674 at = {
21675 \exp_not:N \pgfpoint
21676 {
21677 \dim_use:N \l__flowframtkutils_x_dim
21678 }
21679 {
21680 \dim_use:N \l__flowframtkutils_y_dim
21681 }
21682 } ]
21683 { #1 }
21684 }
21685 }
21686 { \c_flowframtkutils_annote_location_south_int }
21687 {
21688 % \end{macrocode}
21689 %South (vertical arrow pointing upwards with text below).
21690 %Calculate the co-ordinates of the text (the end of the arrow).
21691 % \begin{macrocode}
21692 \dim_set_eq:NN
21693 \l__flowframtkutils_x_dim
21694 \l__flowframtkutils_object_cx_dim
21695 \dim_set:Nn \l__flowframtkutils_y_dim
21696 {
21697 \l__flowframtkutils_object_miny_dim
21698 - \l_flowframtkutils_annote_offsety_dim
21699 }
21700 % \end{macrocode}
21701 %Add the code to draw the arrow if applicable.
21702 % \begin{macrocode}
21703 \bool_if:NT \l_flowframtkutils_annote_arrow_bool
21704 {
21705 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21706 {
21707 \exp_not:N \pgfpathmoveto
21708 {
21709 \exp_not:N \pgfpoint
21710 { \dim_use:N \l__flowframtkutils_object_cx_dim }
21711 { \dim_use:N \l__flowframtkutils_object_miny_dim }
21712 }
21713 \exp_not:N \pgfpathlineto
21714 {
21715 \exp_not:N \pgfpoint
21716 {
21717 \dim_use:N \l__flowframtkutils_x_dim
21718 }
21719 {
21720 \dim_use:N \l__flowframtkutils_y_dim
21721 }
21722 }
21723 \exp_not:N \pgfusepath { stroke }
21724 }
21725 }
21726 % \end{macrocode}
21727 %Add the code to position text.
21728 % \begin{macrocode}
21729 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21730 {
21731 \exp_not:N \pgftext
21732 [
21733 top,
21734 at = {
21735 \exp_not:N \pgfpoint
21736 {
21737 \dim_use:N \l__flowframtkutils_x_dim
21738 }
21739 {
21740 \dim_use:N \l__flowframtkutils_y_dim
21741 }
21742 } ]
21743 { #1 }
21744 }
21745 }
21746 { \c_flowframtkutils_annote_location_southwest_int }
21747 {
21748 % \end{macrocode}
21749 %South-West (slanted arrow pointing up right with text to the lower left).
21750 %Calculate the co-ordinates of the text (the end of the arrow).
21751 % \begin{macrocode}
21752 \dim_set:Nn \l__flowframtkutils_x_dim
21753 {
21754 \l__flowframtkutils_object_minx_dim
21755 - \l_flowframtkutils_annote_offsetx_dim
21756 }
21757 \dim_set:Nn \l__flowframtkutils_y_dim
21758 {
21759 \l__flowframtkutils_object_miny_dim
21760 - \l_flowframtkutils_annote_offsety_dim
21761 }
21762 % \end{macrocode}
21763 %Add the code to draw the arrow if applicable.
21764 % \begin{macrocode}
21765 \bool_if:NT \l_flowframtkutils_annote_arrow_bool
21766 {
21767 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21768 {
21769 \exp_not:N \pgfpathmoveto
21770 {
21771 \exp_not:N \pgfpoint
21772 { \dim_use:N \l__flowframtkutils_object_minx_dim }
21773 { \dim_use:N \l__flowframtkutils_object_miny_dim }
21774 }
21775 \exp_not:N \pgfpathlineto
21776 {
21777 \exp_not:N \pgfpoint
21778 {
21779 \dim_use:N \l__flowframtkutils_x_dim
21780 }
21781 {
21782 \dim_use:N \l__flowframtkutils_y_dim
21783 }
21784 }
21785 \exp_not:N \pgfusepath { stroke }
21786 }
21787 }
21788 % \end{macrocode}
21789 %Add the code to position text.
21790 % \begin{macrocode}
21791 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21792 {
21793 \exp_not:N \pgftext
21794 [
21795 top , right,
21796 at = {
21797 \exp_not:N \pgfpoint
21798 {
21799 \dim_use:N \l__flowframtkutils_x_dim
21800 }
21801 {
21802 \dim_use:N \l__flowframtkutils_y_dim
21803 }
21804 } ]
21805 { #1 }
21806 }
21807 }
21808 { \c_flowframtkutils_annote_location_west_int }
21809 {
21810 % \end{macrocode}
21811 %West (horizontal arrow pointing rightwards with text to the left).
21812 %Calculate the co-ordinates of the text (the end of the arrow).
21813 % \begin{macrocode}
21814 \dim_set:Nn \l__flowframtkutils_x_dim
21815 {
21816 \l__flowframtkutils_object_minx_dim
21817 - \l_flowframtkutils_annote_offsetx_dim
21818 }
21819 \dim_set_eq:NN
21820 \l__flowframtkutils_y_dim
21821 \l__flowframtkutils_object_cy_dim
21822 % \end{macrocode}
21823 %Add the code to draw the arrow if applicable.
21824 % \begin{macrocode}
21825 \bool_if:NT \l_flowframtkutils_annote_arrow_bool
21826 {
21827 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21828 {
21829 \exp_not:N \pgfpathmoveto
21830 {
21831 \exp_not:N \pgfpoint
21832 { \dim_use:N \l__flowframtkutils_object_minx_dim }
21833 { \dim_use:N \l__flowframtkutils_object_cy_dim }
21834 }
21835 \exp_not:N \pgfpathlineto
21836 {
21837 \exp_not:N \pgfpoint
21838 {
21839 \dim_use:N \l__flowframtkutils_x_dim
21840 }
21841 {
21842 \dim_use:N \l__flowframtkutils_y_dim
21843 }
21844 }
21845 \exp_not:N \pgfusepath { stroke }
21846 }
21847 }
21848 % \end{macrocode}
21849 %Add the code to position text.
21850 % \begin{macrocode}
21851 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21852 {
21853 \exp_not:N \pgftext
21854 [
21855 right,
21856 at = {
21857 \exp_not:N \pgfpoint
21858 {
21859 \dim_use:N \l__flowframtkutils_x_dim
21860 }
21861 {
21862 \dim_use:N \l__flowframtkutils_y_dim
21863 }
21864 } ]
21865 { #1 }
21866 }
21867 }
21868 { \c_flowframtkutils_annote_location_northwest_int }
21869 {
21870 % \end{macrocode}
21871 %North-West (slanted arrow pointing down right with text to the upper left).
21872 %Calculate the co-ordinates of the text (the end of the arrow).
21873 % \begin{macrocode}
21874 \dim_set:Nn \l__flowframtkutils_x_dim
21875 {
21876 \l__flowframtkutils_object_minx_dim
21877 - \l_flowframtkutils_annote_offsetx_dim
21878 }
21879 \dim_set:Nn \l__flowframtkutils_y_dim
21880 {
21881 \l__flowframtkutils_object_maxy_dim
21882 + \l_flowframtkutils_annote_offsety_dim
21883 }
21884 % \end{macrocode}
21885 %Add the code to draw the arrow if applicable.
21886 % \begin{macrocode}
21887 \bool_if:NT \l_flowframtkutils_annote_arrow_bool
21888 {
21889 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21890 {
21891 \exp_not:N \pgfpathmoveto
21892 {
21893 \exp_not:N \pgfpoint
21894 { \dim_use:N \l__flowframtkutils_object_minx_dim }
21895 { \dim_use:N \l__flowframtkutils_object_maxy_dim }
21896 }
21897 \exp_not:N \pgfpathlineto
21898 {
21899 \exp_not:N \pgfpoint
21900 {
21901 \dim_use:N \l__flowframtkutils_x_dim
21902 }
21903 {
21904 \dim_use:N \l__flowframtkutils_y_dim
21905 }
21906 }
21907 \exp_not:N \pgfusepath { stroke }
21908 }
21909 }
21910 % \end{macrocode}
21911 %Add the code to position text.
21912 % \begin{macrocode}
21913 \tl_put_right:Ne \l__flowframtkutils_annotation_tl
21914 {
21915 \exp_not:N \pgftext
21916 [
21917 bottom, right,
21918 at = {
21919 \exp_not:N \pgfpoint
21920 {
21921 \dim_use:N \l__flowframtkutils_x_dim
21922 }
21923 {
21924 \dim_use:N \l__flowframtkutils_y_dim
21925 }
21926 } ]
21927 { #1 }
21928 }
21929 }
21930 }
21931 \tl_put_right:Nn \l__flowframtkutils_annotation_tl
21932 {
21933 \end { pgfscope }
21934 }
21935 }
21936 % \end{macrocode}
21937 %
21938 %\begin{macro}{\FlowFramTkUtilsSetOverlayEncap}
21939 % \begin{macrocode}
21940 \NewDocumentCommand \FlowFramTkUtilsSetOverlayEncap { o }
21941 {
21942 \IfValueT { #1 }
21943 {
21944 \keys_set:nn { flowframtkutils / overlay } { #1 }
21945 }
21946 \renewcommand \flowframtkencapobject
21947 {
21948 \flowframtkutils_uncover_encap:nnnnnnnn
21949 }
21950 }
21951 % \end{macrocode}
21952 %\end{macro}
21953 %
21954 %\begin{macro}{\FlowFramTkUtilsOverlayEncapSetup}
21955 % \begin{macrocode}
21956 \NewDocumentCommand \FlowFramTkUtilsOverlayEncapSetup { m }
21957 {
21958 \keys_set:nn { flowframtkutils / overlay } { #1 }
21959 }
21960 % \end{macrocode}
21961 %\end{macro}
21962 %
21963 %\begin{macro}{\includeteximage}
21964 %FlowframTk's export to \env{pgfpicture} option just creates a
21965 %".tex" file that contains the \env{pgfpicture} environment. This
21966 %file may simply be \cs{input} but provide a command similar to
21967 %\cs{includegraphics} that can be used with graphics options to
21968 %resize the image. This is just provided as there are other packages
21969 %(e.g.\ \sty{jmlrutils}) that define this command.
21970 %
21971 %NB although it's possible to change \sty{pgf} co-ordinate scaling,
21972 %the image may include text or bitmaps that may need to be scaled too.
21973 % \begin{macrocode}
21974 \ProvideDocumentCommand \includeteximage { o m }
21975 {
21976 \group_begin:
21977 \let\input@path\Ginput@path
21978 \IfValueTF { #1 }
21979 {
21980 \hbox_set:Nn \l__flowframtk_img_box
21981 { \file_input:n { #2 } }
21982 \keys_set:nn { flowframtk / img } { #1 }
21983 \__flowframtk_img_apply_resize:
21984 \mbox { \box_use:N \l__flowframtk_img_box }
21985 }
21986 {
21987 \file_input:n { #2 }
21988 }
21989 \group_end:
21990 }
21991 % \end{macrocode}
21992 %\end{macro}
21993 %
21994 %Variables for use in the above.
21995 % \begin{macrocode}
21996 \box_new:N \l__flowframtk_img_box
21997 \tl_new:N \l__flowframtk_img_width_tl
21998 \tl_new:N \l__flowframtk_img_height_tl
21999 % \end{macrocode}
22000 %
22001 %Apply resizing options:
22002 % \begin{macrocode}
22003 \cs_new:Nn \__flowframtk_img_apply_resize:
22004 {
22005 \tl_if_empty:NTF \l__flowframtk_img_width_tl
22006 {
22007 \tl_if_empty:NF \l__flowframtk_img_height_tl
22008 {
22009 \box_resize_to_ht:Nn
22010 \l__flowframtk_img_box { \l__flowframtk_img_height_tl }
22011 }
22012 \tl_clear:N \l__flowframtk_img_height_tl
22013 }
22014 {
22015 \tl_if_empty:NTF \l__flowframtk_img_height_tl
22016 {
22017 \box_resize_to_wd:Nn
22018 \l__flowframtk_img_box { \l__flowframtk_img_width_tl }
22019 }
22020 {
22021 \box_resize_to_wd_and_ht:Nnn
22022 \l__flowframtk_img_box
22023 { \l__flowframtk_img_width_tl }
22024 { \l__flowframtk_img_height_tl }
22025 \tl_clear:N \l__flowframtk_img_height_tl
22026 }
22027 \tl_clear:N \l__flowframtk_img_width_tl
22028 }
22029 }
22030 % \end{macrocode}
22031 %
22032 % \begin{macrocode}
22033 \keys_define:nn { flowframtk / img }
22034 {
22035 scale .code:n =
22036 {
22037 \__flowframtk_img_apply_resize:
22038 \box_scale:Nnn \l__flowframtk_img_box { #1 } { #1 }
22039 },
22040 angle .code:n =
22041 {
22042 \__flowframtk_img_apply_resize:
22043 \box_rotate:Nn \l__flowframtk_img_box { #1 }
22044 },
22045 width .tl_set:N = \l__flowframtk_img_width_tl ,
22046 height .tl_set:N = \l__flowframtk_img_height_tl ,
22047 alt .code:n = { }
22048 }
22049 % \end{macrocode}
22050 %
22051 %\begin{macro}{\flowframtkimgtitlechar}
22052 %\begin{definition}
22053 %\cs{flowframtkimgtitlechar}\marg{original-char}\marg{PDF-char}
22054 %\end{definition}
22055 %In case it's necessary to use \cs{pdfinfo}, FlowframTk will detect
22056 %and encapsulate problematic characters in the title with this
22057 %command. The first argument is the original character and the
22058 %second is the escaped character suitable for use in a PDF string.
22059 %For example, if the first argument is "(" or ")" then the second
22060 %will be \verb|\(| or \verb|\)|. NB this must be able to expand.
22061 % \begin{macrocode}
22062 \newcommand \flowframtkimgtitlechar [ 2 ] { #1 }
22063 % \end{macrocode}
22064 %\end{macro}
22065 %The above will be locally changed to the following when the title
22066 %needs to be written to the "/Title" PDF string.
22067 % \begin{macrocode}
22068 \cs_new:Nn \__flowframtk_imgtitlechar:nn
22069 {
22070 \tl_to_str:n { #2 }
22071 }
22072 % \end{macrocode}
22073 %Provide a command to use if \sty{hyperref} hasn't been loaded. This will
22074 %use \cs{pdfinfo} or \cs{pdfextension}, if available.
22075 % \begin{macrocode}
22076 \cs_if_exist:NTF \pdfinfo
22077 {
22078 \cs_new:Nn \__flowframtk_pdfinfo:n
22079 {
22080 \pdfinfo { #1 }
22081 }
22082 }
22083 {
22084 \cs_if_exist:NTF \pdfextension
22085 {
22086 \cs_new:Nn \__flowframtk_pdfinfo:n
22087 {
22088 \pdfextension info { #1 }
22089 }
22090 }
22091 {
22092 \cs_new:Nn \__flowframtk_pdfinfo:n { }
22093 }
22094 }
22095 % \end{macrocode}
22096 %Token list variable to hold the title:
22097 % \begin{macrocode}
22098 \tl_new:N \l_flowframtk_image_title_tl
22099 % \end{macrocode}
22100 %
22101 %\begin{macro}{\flowframtkSetTitle}
22102 %This command is provided to allow the image's early preamble to
22103 %provide an alternative definition.
22104 % \begin{macrocode}
22105 \ProvideDocumentCommand \flowframtkSetTitle { m }
22106 {
22107 \tl_set:Ne \l_flowframtk_image_title_tl { #1 }
22108 \cs_if_exist:NTF \hypersetup
22109 {
22110 \hypersetup { pdftitle = { \l_flowframtk_image_title_tl } }
22111 }
22112 {
22113 \cs_set_eq:NN \flowframtkimgtitlechar \__flowframtk_imgtitlechar:nn
22114 \__flowframtk_pdfinfo:n { /Title ( #1 ) }
22115 \cs_set_eq:NN \flowframtkimgtitlechar \use_i:nn
22116 }
22117 \cs_if_exist:NT \title
22118 {
22119 \exp_args:NV \title \l_flowframtk_image_title_tl
22120 }
22121 }
22122 % \end{macrocode}
22123 %\end{macro}
22124 %Token list variable to hold the creation date:
22125 % \begin{macrocode}
22126 \tl_new:N \l_flowframtk_image_creationdate_tl
22127 % \end{macrocode}
22128 %
22129 %\begin{macro}{\flowframtkSetCreationDate}
22130 %Again, this command is provided to allow the image's early preamble to
22131 %provide an alternative definition.
22132 % \begin{macrocode}
22133 \ProvideDocumentCommand \flowframtkSetCreationDate { m }
22134 {
22135 \tl_set:Ne \l_flowframtk_image_creationdate_tl
22136 {
22137 \tl_to_str:n { #1 }
22138 }
22139 \cs_if_exist:NTF \hypersetup
22140 {
22141 \exp_args:Ne
22142 \hypersetup
22143 { pdfcreationdate = { \l_flowframtk_image_creationdate_tl } }
22144 }
22145 {
22146 \exp_args:Ne
22147 \__flowframtk_pdfinfo:n
22148 { /CreationDate ( \l_flowframtk_image_creationdate_tl ) }
22149 }
22150 }
22151 % \end{macrocode}
22152 %\end{macro}
22153 %
22154 % \begin{macrocode}
22155 \keys_define:nn { flowframtk / imageinfo }
22156 {
22157 title .code:n = \flowframtkSetTitle { #1 } ,
22158 creationdate .code:n = \flowframtkSetCreationDate { #1 } ,
22159 }
22160 % \end{macrocode}
22161 %
22162 %\begin{macro}{\flowframtkimageinfo}
22163 %This is the command that FlowframTk will actually write to the
22164 %exported file, if the export settings request PDF data to be added:
22165 % \begin{macrocode}
22166 \NewDocumentCommand \flowframtkimageinfo { m }
22167 {
22168 \keys_set:nn { flowframtk / imageinfo } { #1 }
22169 }
22170 % \end{macrocode}
22171 %\end{macro}
22172 %
22173 %
22174 %The following commands are specifically for export options that
22175 %define flow, static and dynamic frames. The image objects that have
22176 %\sty{flowfram} data assigned to them may either use the associated
22177 %object as a border or simply use the object's bounding box to
22178 %determine the frame's location and size. Where the object should be
22179 %used as a border, a command needs to be defined that can be used as
22180 %the border frame command.
22181 %
22182 %\begin{macro}{\flowframtkNewFrameBorder}
22183 %\begin{definition}
22184 %\cs{flowframtkNewFrameBorder}\marg{label}\marg{pgfpicture-code}
22185 %\end{definition}
22186 %Defines an internal command that takes a single argument, which
22187 %will be the content of the applicable flow, static or dynamic
22188 %frame. This command will then be used as the frame's border
22189 %command (instead of \cs{fbox}). The second argument is the
22190 %\sty{pgf} code needed to replicate the object (path, bitmap etc)
22191 %from the image and position the frame content within the picture
22192 %according to the margins setup in FlowframTk.
22193 % \begin{macrocode}
22194 \NewDocumentCommand \flowframtkNewFrameBorder { m m }
22195 {
22196 \cs_set:cpn { @flf@border@ #1 } ##1 { #2 }
22197 }
22198 % \end{macrocode}
22199 %\end{macro}
22200 %
22201 %\begin{macro}{\flowframtkUseFrameBorderCsName}
22202 %Expands to the control sequence name of the custom border frame
22203 %command that was defined by \cs{flowframtkNewFrameBorder}.
22204 % \begin{macrocode}
22205 \newcommand \flowframtkUseFrameBorderCsName [ 1 ]
22206 {
22207 @flf@border@ #1
22208 }
22209 % \end{macrocode}
22210 %\end{macro}
22211 %
22212 %\begin{macro}{\flowframtkUseFrameBorderCsName}
22213 %Use the custom border frame
22214 %command that was defined by \cs{flowframtkNewFrameBorder}.
22215 % \begin{macrocode}
22216 \newcommand \flowframtkUseFrameBorderCs [ 1 ]
22217 {
22218 \use:n { @flf@border@ #1 }
22219 }
22220 % \end{macrocode}
22221 %\end{macro}
22222 %
22223 %\begin{macro}{\flowframtkNewDynamicStyle}
22224 %Create a style command for a dynamic frame
22225 % \begin{macrocode}
22226 \NewDocumentCommand \flowframtkNewDynamicStyle { m m }
22227 {
22228 \cs_set:cpn { @flf@dfstyle@ #1 } { #2 }
22229 }
22230 % \end{macrocode}
22231 %\end{macro}
22232 %
22233 %\begin{macro}{\flowframtkUseDynamicStyleCsName}
22234 %Expands to the control sequence name of a style command for a dynamic frame
22235 % \begin{macrocode}
22236 \NewDocumentCommand \flowframtkUseDynamicStyleCsName { m }
22237 {
22238 @flf@dfstyle@ #1
22239 }
22240 % \end{macrocode}
22241 %\end{macro}
22242 %
22243 %\begin{macro}{\flowframtkUseDynamicStyle}
22244 %Expands to the control sequence name of a style command for a dynamic frame
22245 % \begin{macrocode}
22246 \NewDocumentCommand \flowframtkUseDynamicStyle { m }
22247 {
22248 \use:n { @flf@dfstyle@ #1 }
22249 }
22250 % \end{macrocode}
22251 %\end{macro}
22252 %
22253 %These commands are used instead of \cs{makedfheaderfooter} for
22254 %a bespoke dynamic headers and footers.
22255 %
22256 %\begin{macro}{\flowframtkSetDynamicOddHead}
22257 %The same header frame is used for both odd and even pages or it's a
22258 %single-sided document.
22259 % \begin{macrocode}
22260 \NewDocumentCommand \flowframtkSetDynamicOddHead { m }
22261 {
22262 \__flowfram_get_dynamic_id:n { #1 }
22263 \int_set_eq:NN \g__flowfram_dynamic_header_int \l__flowfram_id_int
22264 \renewcommand \@dothehead { }
22265 \renewcommand \@dodynamicthehead
22266 {
22267 \__flowfram_set_dynamic_contents:nn
22268 { \g__flowfram_dynamic_header_int }
22269 {
22270 \flowfram_dynamic_header:n
22271 { \g__flowfram_dynamic_header_int }
22272 }
22273 }
22274 }
22275 % \end{macrocode}
22276 %\end{macro}
22277 %
22278 %\begin{macro}{\flowframtkSetDynamicOddEvenHead}
22279 %There are two dynamic header frames, one for
22280 %odd pages and one for even pages.
22281 % \begin{macrocode}
22282 \NewDocumentCommand \flowframtkSetDynamicOddEvenHead { m m }
22283 {
22284 \__flowfram_get_dynamic_id:n { #1 }
22285 \int_set_eq:NN \g__flowfram_dynamic_header_int \l__flowfram_id_int
22286 \__flowfram_get_dynamic_id:n { #2 }
22287 \int_set_eq:NN \g__flowfram_dynamic_even_header_int \l__flowfram_id_int
22288 \renewcommand \@dothehead { }
22289 \renewcommand \@dodynamicthehead
22290 {
22291 % \end{macrocode}
22292 %odd head
22293 % \begin{macrocode}
22294 \__flowfram_set_dynamic_contents:nn
22295 { \g__flowfram_dynamic_header_int }
22296 {
22297 \flowfram_dynamic_odd_header:n
22298 { \g__flowfram_dynamic_header_int }
22299 }
22300 % \end{macrocode}
22301 %even head
22302 % \begin{macrocode}
22303 \__flowfram_set_dynamic_contents:nn
22304 { \g__flowfram_dynamic_even_header_int }
22305 {
22306 \flowfram_dynamic_even_header:n
22307 { \g__flowfram_dynamic_even_header_int }
22308 }
22309 }
22310 % \end{macrocode}
22311 %Ensure twoside option is on:
22312 % \begin{macrocode}
22313 \@twosidetrue
22314 }
22315 % \end{macrocode}
22316 %\end{macro}
22317 %
22318 %\begin{macro}{\flowframtkSetDynamicEvenHead}
22319 %Only the header frame for even pages has been defined. NB the
22320 %document must have the twoside setting on.
22321 % \begin{macrocode}
22322 \NewDocumentCommand \flowframtkSetDynamicEvenHead { m }
22323 {
22324 \__flowfram_get_dynamic_id:n { #1 }
22325 \int_set_eq:NN \g__flowfram_dynamic_even_header_int \l__flowfram_id_int
22326 \renewcommand \@dothehead { }
22327 \cs_set:Ne \@dodynamicthehead
22328 {
22329 \__flowfram_set_dynamic_contents:nn
22330 { \g__flowfram_dynamic_even_header_int }
22331 {
22332 \flowfram_dynamic_even_header:n
22333 { \g__flowfram_dynamic_even_header_int }
22334 }
22335 }
22336 % \end{macrocode}
22337 %Ensure twoside option is on:
22338 % \begin{macrocode}
22339 \@twosidetrue
22340 }
22341 % \end{macrocode}
22342 %\end{macro}
22343 %
22344 %\begin{macro}{\flowframtkSetDynamicOddFoot}
22345 %The same footer frame is used for both odd and even pages or it's a
22346 %single-sided document.
22347 % \begin{macrocode}
22348 \NewDocumentCommand \flowframtkSetDynamicOddFoot { m }
22349 {
22350 \__flowfram_get_dynamic_id:n { #1 }
22351 \int_set_eq:NN \g__flowfram_dynamic_footer_int \l__flowfram_id_int
22352 \renewcommand \@dothefoot { }
22353 \renewcommand \@dodynamicthefoot
22354 {
22355 \__flowfram_set_dynamic_contents:nn
22356 { \g__flowfram_dynamic_footer_int }
22357 {
22358 \flowfram_dynamic_footer:n
22359 { \g__flowfram_dynamic_footer_int }
22360 }
22361 }
22362 }
22363 % \end{macrocode}
22364 %\end{macro}
22365 %
22366 %\begin{macro}{\flowframtkSetDynamicOddEvenFoot}
22367 %There are two dynamic footer frames, one for
22368 %odd pages and one for even pages.
22369 % \begin{macrocode}
22370 \NewDocumentCommand \flowframtkSetDynamicOddEvenFoot { m m }
22371 {
22372 \__flowfram_get_dynamic_id:n { #1 }
22373 \int_set_eq:NN \g__flowfram_dynamic_footer_int \l__flowfram_id_int
22374 \__flowfram_get_dynamic_id:n { #2 }
22375 \int_set_eq:NN \g__flowfram_dynamic_even_footer_int \l__flowfram_id_int
22376 \renewcommand \@dothefoot { }
22377 \renewcommand \@dodynamicthefoot
22378 {
22379 % \end{macrocode}
22380 %odd foot
22381 % \begin{macrocode}
22382 \__flowfram_set_dynamic_contents:nn
22383 { \g__flowfram_dynamic_footer_int }
22384 {
22385 \flowfram_dynamic_odd_footer:n
22386 { \g__flowfram_dynamic_footer_int }
22387 }
22388 % \end{macrocode}
22389 %even foot
22390 % \begin{macrocode}
22391 \__flowfram_set_dynamic_contents:nn
22392 { \g__flowfram_dynamic_even_footer_int }
22393 {
22394 \flowfram_dynamic_even_footer:n
22395 { \g__flowfram_dynamic_even_footer_int }
22396 }
22397 }
22398 % \end{macrocode}
22399 %Ensure twoside option is on:
22400 % \begin{macrocode}
22401 \@twosidetrue
22402 }
22403 % \end{macrocode}
22404 %\end{macro}
22405 %
22406 %\begin{macro}{\flowframtkSetDynamicEvenFoot}
22407 %Only the footer frame for even pages has been defined. NB the
22408 %document must have the twoside setting on.
22409 % \begin{macrocode}
22410 \NewDocumentCommand \flowframtkSetDynamicEvenFoot { m }
22411 {
22412 \__flowfram_get_dynamic_id:n { #1 }
22413 \int_set_eq:NN \g__flowfram_dynamic_even_footer_int \l__flowfram_id_int
22414 \renewcommand \@dothefoot { }
22415 \renewcommand \@dodynamicthefoot
22416 {
22417 \__flowfram_set_dynamic_contents:nn
22418 { \g__flowfram_dynamic_even_footer_int }
22419 {
22420 \flowfram_dynamic_even_footer:n
22421 { \g__flowfram_dynamic_even_footer_int }
22422 }
22423 }
22424 % \end{macrocode}
22425 %Ensure twoside option is on:
22426 % \begin{macrocode}
22427 \@twosidetrue
22428 }
22429 % \end{macrocode}
22430 %\end{macro}
22431 %
22432 %\begin{macro}{\flowframtkMakeDFHeaderFooter}
22433 %End part of \cs{makedfheaderfooter}:
22434 % \begin{macrocode}
22435 \NewDocumentCommand \flowframtkMakeDFHeaderFooter { }
22436 {
22437 \tl_clear:N \g__flowfram_headercolor_tl
22438 \tl_clear:N \g__flowfram_footercolor_tl
22439 \__flowfram_adjust_page_styles:n
22440 {
22441 \let \ps@myheadings \ps@ffmyheadings
22442 \let \ps@headings \ps@ffheadings
22443 \let \ps@plain \ps@ffplain
22444 \let \ps@empty \ps@ffempty
22445 }
22446 \pagestyle { ffheadings }
22447 \cs_set:Nn \__flowfram_only_pre_makedfheaderfooter:nn
22448 {
22449 \msg_error:nnn { flowfram } { option-too-late } { ##1 }
22450 { \flowframtkMakeDFHeaderFooter }
22451 }
22452 }
22453 % \end{macrocode}
22454 %\end{macro}
22455 %
22456 % \begin{macrocode}
22457 \ExplSyntaxOff
22458 % \end{macrocode}
22459 %\iffalse
22460 % \begin{macrocode}
22461 %</flowframtkutils.sty>
22462 % \end{macrocode}
22463 %\fi
22464 %\iffalse
22465 % \begin{macrocode}
22466 %<*flowfram-2014-09-30.sty>
22467 % \end{macrocode}
22468 %\fi
22469 % \section{Rollback v1.17 (flowfram-2014-09-30)}
22470 % \begin{macrocode}
22471 \NeedsTeXFormat{LaTeX2e}
22472 \ProvidesPackage{flowfram}[2014/09/30 v1.17 (NLCT)]
22473 \RequirePackage{ifthen}
22474 \RequirePackage{xkeyval}
22475 \RequirePackage{graphics}
22476 \RequirePackage{afterpage}
22477 \RequirePackage{xfor}
22478 \RequirePackage{etoolbox}
22479 \@ifundefined{@ldc@l@r}{\RequirePackage{color}}{}
22480 \newcommand{\setffdraftcolor}{\color[gray]{0.8}}
22481 \newcommand{\setffdrafttypeblockcolor}{\color[gray]{0.9}}
22482 \newlength\fflabelsep
22483 \fflabelsep=1pt
22484 \newcommand*{\fflabelfont}{\small\sffamily}
22485 \newif\ifshowtypeblock
22486 \newif\ifshowmargins
22487 \newif\ifshowframebbox
22488 \newcommand*{\@ffdraft}{%
22489 \showtypeblocktrue
22490 \showmarginstrue
22491 \showframebboxtrue
22492 }
22493 \newcommand*{\@ffnodraft}{%
22494 \showtypeblockfalse
22495 \showmarginsfalse
22496 \showframebboxfalse
22497 }
22498 \newcommand*{\@fr@meifdraft}[3][\setffdraftcolor]{%
22499 \def\ff@backcol{{none}}%
22500 \@ifundefined{color}{\frame{#2}}{#1\frame{#2}}%
22501 \ifthenelse{\equal{#3}{}}{}%
22502 {%
22503 \makebox[0pt][l]{\hskip\fflabelsep\fflabelfont{[#3]}}%
22504 }%
22505 }%
22506 \newcommand*{\@s@tffcol}{}
22507 \newcommand*{\@s@tfftextcol}{}
22508 \newcommand*{\@ffbackground}[1]{#1}
22509 \DeclareOptionX{draft}{\@ffdraft}
22510 \DeclareOptionX{final}{\@ffnodraft}
22511 \@ffnodraft
22512 \define@choicekey{flowfram.sty}%
22513 {verbose}[\val\nr]%
22514 {true,false}[true]%
22515 {%
22516 \ifcase\nr\relax
22517 \renewcommand*{\flf@doifverbose}[1]{##1}%
22518 \renewcommand*{\flf@message}[1]{\PackageInfo{flowfram}{##1}}%
22519 \or
22520 \renewcommand*{\flf@doifverbose}[1]{}%
22521 \renewcommand*{\flf@message}[1]{}%
22522 \fi
22523 }
22524 \newcommand*{\flf@message}[1]{%
22525 \flf@doifverbose
22526 {%
22527 \PackageInfo{flowfram}{##1}%
22528 }%
22529 }
22530 \newcommand*{\flf@doifverbose}[1]{}
22531 \define@boolkey{flowfram.sty}[@ttb@]{rotate}[true]{}
22532 \@ttb@rotatetrue
22533 \DeclareOptionX{norotate}{\@ttb@rotatefalse}
22534 \newcommand{\rotateframe}[2]{%
22535 \if@ttb@rotate
22536 \rotatebox{#1}{#2}%
22537 \else
22538 #2%
22539 \fi
22540 }
22541 \newif\if@ttb@num
22542 \@ttb@numfalse
22543 \newif\if@ttb@title
22544 \@ttb@titletrue
22545 \define@choicekey{flowfram.sty}%
22546 {thumbtabs}[\val\nr]%
22547 {title,number,both,none}[title]%
22548 {%
22549 \ifcase\nr\relax
22550 \@ttb@numfalse
22551 \@ttb@titletrue
22552 \or
22553 \@ttb@numtrue
22554 \@ttb@titlefalse
22555 \or
22556 \@ttb@numtrue
22557 \@ttb@titletrue
22558 \or
22559 \@ttb@numfalse
22560 \@ttb@titlefalse
22561 \fi
22562 }
22563 \DeclareOptionX{ttbtitle}{\@ttb@titletrue}
22564 \DeclareOptionX{ttbnotitle}{\@ttb@titlefalse}
22565 \DeclareOptionX{ttbnum}{\@ttb@numtrue}
22566 \DeclareOptionX{ttbnonum}{\@ttb@numfalse}
22567 \define@choicekey{flowfram.sty}{pages}[\val\nr]%
22568 {relative,absolute}%
22569 {%
22570 \ifcase\nr\relax
22571 \renewcommand*{\@ff@pages@countreg}{\c@page}%
22572 \or
22573 \renewcommand*{\@ff@pages@countreg}{\c@absolutepage}%
22574 \fi
22575 }
22576 \newcommand*{\@ff@pages@countreg}{\c@page}
22577 \newcounter{absolutepage}
22578 \define@choicekey{flowfram.sty}{color}[\val\nr]{true,false}[true]{%
22579 \ifcase\nr\relax
22580 \@ff@enablecolor
22581 \or
22582 \@ff@disablecolor
22583 \fi
22584 }
22585 \DeclareOptionX{nocolor}{%
22586 \@ff@disablecolor
22587 }
22588 \newcommand*{\@ff@enablecolor}{%
22589 \def\flowframecol{{black}}%
22590 \def\flowframetextcol{{black}}%
22591 \renewcommand*\@s@tffcol{%
22592 \ifthenelse{\equal{\ff@col}{}}%
22593 {}%
22594 {%
22595 \expandafter\color\ff@col}%
22596 }%
22597 \renewcommand*\@s@tfftextcol{%
22598 \ifthenelse{\equal{\ff@txtcol}{}}%
22599 {}%
22600 {%
22601 \expandafter\color\ff@txtcol
22602 }%
22603 }%
22604 \renewcommand*{\@ffbackground}[1]{%
22605 \ifthenelse{\equal{\ff@backcol}{{none}}}%
22606 {%
22607 ##1%
22608 }%
22609 {%
22610 {\fboxsep=0pt\expandafter\colorbox\ff@backcol{##1}}%
22611 }%
22612 }%
22613 }
22614 \newcommand*{\@ff@disablecolor}{%
22615 \def\flowframetextcol{}%
22616 \def\flowframecol{}%
22617 \renewcommand{\@s@tffcol}{}\renewcommand{\@s@tfftextcol}{}%
22618 \renewcommand{\@ffbackground}[1]{##1}%
22619 }
22620 \newif\iflefttorightcolumns
22621 \lefttorightcolumnstrue
22622 \DeclareOptionX{LR}{\lefttorightcolumnstrue}
22623 \DeclareOptionX{RL}{\lefttorightcolumnsfalse}
22624 \ifx\normalcolor\relax
22625 \@ff@disablecolor
22626 \else
22627 \@ff@enablecolor
22628 \fi
22629 \ProcessOptionsX
22630 \ifx\normalcolor\relax
22631 \ifthenelse{\equal{\flowframetextcol}{}}%
22632 {}%
22633 {%
22634 \RequirePackage{color}%
22635 }
22636 \fi
22637 \@ifundefined{chapter}{}%
22638 {%
22639 \newcommand*{\chapterfirstpagestyle}{plain}%
22640 \let\@ff@OLD@chapter\@chapter
22641 \let\@ff@OLD@schapter\@schapter
22642 \renewcommand{\@chapter}{%
22643 \thispagestyle{\chapterfirstpagestyle}%
22644 \@ff@OLD@chapter
22645 }%
22646 \renewcommand{\@schapter}{%
22647 \thispagestyle{\chapterfirstpagestyle}%
22648 \@ff@OLD@schapter
22649 }%
22650 \newcommand*{\ffprechapterhook}{}
22651 \let\@ff@OLD@ch@pter\chapter
22652 \renewcommand{\chapter}{%
22653 \ffprechapterhook
22654 \@ff@OLD@ch@pter
22655 }
22656 }
22657 \newcounter{maxflow}
22658 \c@maxflow=0\relax
22659 \newcounter{thisframe}
22660 \c@thisframe=0\relax
22661 \@ifpackageloaded{hyperref}
22662 {%
22663 \def\theHthisframe{\thepage.\arabic{thisframe}}%
22664 }%
22665 {}
22666 \newcommand*{\labelflowidn}[1]{%
22667 {%
22668 \def\@currentlabel{\thethisframe}%
22669 \label{#1}%
22670 }%
22671 }
22672 \newcounter{displayedframe}
22673 \c@displayedframe=0
22674 \@ifpackageloaded{hyperref}%
22675 {%
22676 \def\theHdisplayedframe{\thepage.\arabic{displayedframe}}%
22677 }%
22678 {}
22679 \newcommand*{\labelflow}[1]{%
22680 {%
22681 \def\@currentlabel{\thedisplayedframe}%
22682 \label{#1}%
22683 }%
22684 }
22685 \newcounter{maxstatic}
22686 \c@maxstatic=0\relax
22687 \newcounter{maxdynamic}
22688 \c@maxdynamic=0\relax
22689 \newcount\@colN
22690 \newcount\@ff@tmpN
22691 \newcount\ff@id
22692 \newlength\@ff@offset
22693 \newlength\@ff@tmp@x
22694 \newlength\@ff@tmp@x@even
22695 \newlength\@ff@tmp@y
22696 \newlength\sdfparindent
22697 \newlength\flowframesep
22698 \flowframesep=\fboxsep
22699 \newlength\flowframerule
22700 \flowframerule=\fboxrule
22701 \newcommand*{\flowframeshowlayout}{%
22702 \finishthispage
22703 {%
22704 \@ffdraft\mbox{}\finishthispage\clearpage
22705 }%
22706 }
22707 \newif\ifusedframebreak
22708 \newcommand{\framebreak}[1][4]{%
22709 \global\usedframebreaktrue
22710 {%
22711 \parfillskip=0pt\pagebreak[#1]\parskip=0pt\par\noindent
22712 }%
22713 }
22714 \newcommand{\finishthispage}{%
22715 \ifvmode
22716 \@colN=\c@thisframe\relax
22717 \count@=\c@absolutepage\relax
22718 \ifdim \pagetotal<\topskip
22719 \hbox{}%
22720 \fi
22721 \newpage \write \m@ne {}\vbox {}\penalty -\@Mi
22722 \ifnum\count@=\c@absolutepage\relax
22723 \whiledo{\@colN<\c@maxflow \OR \@colN=\c@maxflow}%
22724 {%
22725 \@ff@chckifthispg{\@ff@pages@countreg}{\@colN}%
22726 \if@notthiscol
22727 \else
22728 \c@thisframe=\@colN\relax
22729 \hbox{}\newpage
22730 \fi
22731 \advance\@colN by 1\relax
22732 }%
22733 \fi
22734 \fi
22735 }
22736 \def\cleardoublepage{%
22737 \clearpage
22738 \if@twoside
22739 \ifodd\c@page
22740 \else
22741 \hbox{}%
22742 \clearpage
22743 \fi
22744 \fi
22745 }
22746 \preto\newpage{\global\usedframebreaktrue}
22747 \@twocolumnfalse
22748 \@mparswitchfalse
22749 \newcommand{\globalreversemargin}{%
22750 \global\@mparbottom\z@
22751 \global\@reversemargintrue
22752 }
22753 \newcommand{\globalnormalmargin}{%
22754 \global\@mparbottom\z@\global
22755 \@reversemarginfalse
22756 }
22757 \newcommand{\@getmarginpos}[1]{%
22758 \ifthenelse{\equal{#1}{inner}}%
22759 {%
22760 \if@twoside
22761 \ifodd\c@page\def\ff@margin{left}\else\def\ff@margin{right}\fi
22762 \else
22763 \def\ff@margin{left}%
22764 \fi
22765 }%
22766 {%
22767 \ifthenelse{\equal{#1}{outer}}%
22768 {%
22769 \if@twoside
22770 \ifodd\c@page\def\ff@margin{right}\else\def\ff@margin{left}\fi
22771 \else
22772 \def\ff@margin{right}%
22773 \fi
22774 }%
22775 {%
22776 \def\ff@margin{#1}%
22777 }%
22778 }%
22779 }
22780 \newcommand{\setmargin}{%
22781 \@getmarginpos
22782 {%
22783 \csname @ff@margin@\romannumeral\c@thisframe\endcsname
22784 }%
22785 \ifthenelse{\equal{\ff@margin}{left}}%
22786 {\globalreversemargin}%
22787 {\globalnormalmargin}%
22788 }
22789 \newcommand{\newflowframe}{\@n@wflowframe}
22790 \@onlypreamble{\newflowframe}
22791 \newcommand{\@n@wflowframe}{%
22792 \global\advance\c@maxflow by 1\relax
22793 \expandafter\global\expandafter
22794 \newif\csname ifcolumnframe\romannumeral\c@maxflow\endcsname
22795 \@ifstar\@snewflowframe\@newflowframe
22796 }
22797 \newcommand{\@snewflowframe}{%
22798 \expandafter\global\expandafter
22799 \let\csname ifcolumnframe\romannumeral\c@maxflow\endcsname\iftrue
22800 \@@newflowframe
22801 }
22802 \newcommand{\@newflowframe}{%
22803 \expandafter\global\expandafter
22804 \let\csname ifcolumnframe\romannumeral\c@maxflow\endcsname\iffalse
22805 \@@newflowframe
22806 }
22807 \newcommand{\@@newflowframe}[5][all]{%
22808 \expandafter\global\expandafter
22809 \newbox\csname column\romannumeral\c@maxflow\endcsname
22810 \expandafter\global\expandafter
22811 \newlength\csname colwidth\romannumeral\c@maxflow\endcsname
22812 \expandafter\global\expandafter
22813 \newlength\csname colheight\romannumeral\c@maxflow\endcsname
22814 \expandafter\global\expandafter
22815 \newlength\csname col@\romannumeral\c@maxflow @posx\endcsname
22816 \expandafter\global\expandafter
22817 \newlength\csname col@\romannumeral\c@maxflow @posy\endcsname
22818 \expandafter\global\expandafter
22819 \setlength\csname colwidth\romannumeral\c@maxflow\endcsname{#2}
22820 \expandafter\global\expandafter
22821 \setlength\csname colheight\romannumeral\c@maxflow\endcsname{#3}
22822 \expandafter\global\expandafter
22823 \setlength\csname col@\romannumeral\c@maxflow @posx\endcsname{#4}
22824 \expandafter\global\expandafter
22825 \setlength\csname col@\romannumeral\c@maxflow @posy\endcsname{#5}
22826 \expandafter\global\expandafter
22827 \newlength\csname col@\romannumeral\c@maxflow @evenx\endcsname
22828 \expandafter\global\expandafter
22829 \newlength\csname col@\romannumeral\c@maxflow @eveny\endcsname
22830 \expandafter\global\expandafter
22831 \setlength\csname col@\romannumeral\c@maxflow @evenx\endcsname{#4}
22832 \expandafter\global\expandafter
22833 \setlength\csname col@\romannumeral\c@maxflow @eveny\endcsname{#5}
22834 \expandafter
22835 \gdef\csname @ff@frametype@\romannumeral\c@maxflow\endcsname{fbox}%
22836 \expandafter
22837 \gdef\csname @ff@col@\romannumeral\c@maxflow\endcsname{\flowframecol}
22838 \expandafter
22839 \gdef\csname @ff@txtcol@\romannumeral\c@maxflow\endcsname{%
22840 \flowframetextcol
22841 }
22842 \expandafter
22843 \gdef\csname @ff@backcol@\romannumeral\c@maxflow\endcsname{{none}}
22844 \expandafter
22845 \gdef\csname @ff@pages@\romannumeral\c@maxflow\endcsname{#1}%
22846 \expandafter
22847 \gdef\csname @ff@xpages@\romannumeral\c@maxflow\endcsname{}%
22848 \expandafter
22849 \gdef\csname @ff@offset@\romannumeral\c@maxflow\endcsname{compute}
22850 \expandafter
22851 \gdef\csname @ff@angle@\romannumeral\c@maxflow\endcsname{0}%
22852 \expandafter
22853 \gdef\csname @ff@margin@\romannumeral\c@maxflow\endcsname{right}
22854 \ifnum\c@thisframe=0\relax
22855 \ifthenelse{\equal{#1}{all}\TE@or\equal{#1}{odd}}%
22856 {%
22857 \c@thisframe=\c@maxflow
22858 \global\setlength{\hsize}{#2}%
22859 \global\usedframebreaktrue
22860 }%
22861 {%
22862 \ifthenelse{\equal{#1}{even}\TE@or\equal{#1}{none}}%
22863 {}%
22864 {%
22865 \def\ff@pages{#1}%
22866 \@for\@ff@pp:=\ff@pages\do
22867 {%
22868 \def\@ff@numstart{0}\def\@ff@numend{0}%
22869 \@ff@getrange{\@ff@pp}%
22870 \ifnum\@ff@numstart=0\relax
22871 \def\@ff@numstart{1}%
22872 \fi
22873 \ifnum\@ff@numstart=1\relax
22874 \c@thisframe=\c@maxflow
22875 \global\setlength{\hsize}{#2}%
22876 \global\usedframebreaktrue
22877 \fi
22878 }%
22879 }%
22880 }%
22881 \fi
22882 \@ifnextchar[%
22883 {\@s@tflowframeid{\c@maxflow}}%
22884 {%
22885 \@s@tflowframeid{\c@maxflow}[\number\c@maxflow]%
22886 }%
22887 }
22888 \def\@s@tflowframeid#1[#2]{%
22889 \edef\ff@label{#2}%
22890 \@ff@checkuniqueidl{#1}{\ff@label}%
22891 \expandafter
22892 \xdef\csname @col@id@\romannumeral#1\endcsname{\ff@label}%
22893 }
22894 \newcommand*{\@ff@checkuniqueidl}[2]{%
22895 {%
22896 \@colN=0\relax
22897 \whiledo{\@colN<\c@maxflow}%
22898 {%
22899 \advance\@colN by 1\relax
22900 \ifnum\@colN=#1\relax
22901 \else
22902 \ifthenelse
22903 {%
22904 \equal{#2}%
22905 {%
22906 \csname @col@id@\romannumeral\@colN\endcsname
22907 }%
22908 }%
22909 {%
22910 \PackageError{flowfram}%
22911 {Flow frame IDL '#2' already defined}%
22912 {%
22913 You can't assign this label, as it is already defined
22914 for flow frame \number\@colN
22915 }%
22916 }%
22917 {}%
22918 \fi
22919 }%
22920 }%
22921 }
22922 \newcommand*{\getflowlabel}[1]{%
22923 \csname @col@id@\romannumeral#1\endcsname
22924 }
22925 \newcommand*{\getflowid}[2]{%
22926 \@flowframeid{#2}%
22927 \edef#1{\number\ff@id}%
22928 }
22929 \newcommand*{\@flowframeid}[1]{%
22930 \@colN=0\relax
22931 \ff@id=0\relax
22932 \whiledo{\@colN<\c@maxflow}%
22933 {%
22934 \advance\@colN by 1\relax
22935 \ifthenelse
22936 {%
22937 \equal{#1}{\csname @col@id@\romannumeral\@colN\endcsname}%
22938 }%
22939 {%
22940 \ff@id=\@colN\relax
22941 \@colN=\c@maxflow
22942 }%
22943 {}%
22944 }%
22945 \ifnum\ff@id=0\relax
22946 \PackageError{flowfram}{Can't find flow frame id '#1'}{}%
22947 \fi
22948 }
22949 \define@key{flowframe}{width}%
22950 {%
22951 \ifthenelse{\equal{#1}{}}%
22952 {%
22953 \PackageError{flowfram}{Missing value for 'width' key}{}%
22954 }%
22955 {}%
22956 \def\ff@width{#1}%
22957 }
22958 \define@key{flowframe}{height}%
22959 {%
22960 \ifthenelse{\equal{#1}{}}%
22961 {%
22962 \PackageError{flowfram}{Missing value for 'height' key}{}%
22963 }%
22964 {}%
22965 \def\ff@height{#1}%
22966 }
22967 \define@key{flowframe}{x}%
22968 {%
22969 \ifthenelse{\equal{#1}{}}%
22970 {%
22971 \PackageError{flowfram}{Missing value for 'x' key}{}%
22972 }%
22973 {}%
22974 \def\ff@x{#1}%
22975 }
22976 \define@key{flowframe}{y}%
22977 {%
22978 \ifthenelse{\equal{#1}{}}%
22979 {%
22980 \PackageError{flowfram}{Missing value for 'y' key}{}%
22981 }%
22982 {}%
22983 \def\ff@y{#1}%
22984 }
22985 \define@key{flowframe}{evenx}%
22986 {%
22987 \ifthenelse{\equal{#1}{}}%
22988 {%
22989 \PackageError{flowfram}{Missing value for 'evenx' key}{}%
22990 }%
22991 {}%
22992 \def\ff@evenx{#1}%
22993 }
22994 \define@key{flowframe}{eveny}%
22995 {%
22996 \ifthenelse{\equal{#1}{}}%
22997 {%
22998 \PackageError{flowfram}{Missing value for 'eveny' key}{}%
22999 }%
23000 {}%
23001 \def\ff@eveny{#1}%
23002 }
23003 \define@key{flowframe}{oddx}%
23004 {%
23005 \ifthenelse{\equal{#1}{}}%
23006 {%
23007 \PackageError{flowfram}{Missing value for 'oddx' key}{}%
23008 }%
23009 {}%
23010 \def\ff@oddx{#1}%
23011 }
23012 \define@key{flowframe}{oddy}%
23013 {%
23014 \ifthenelse{\equal{#1}{}}%
23015 {%
23016 \PackageError{flowfram}{Missing value for 'oddy' key}{}%
23017 }%
23018 {}%
23019 \def\ff@oddy{#1}%
23020 }
23021 \define@key{flowframe}{label}%
23022 {%
23023 \ifthenelse{\equal{#1}{}}%
23024 {%
23025 \PackageError{flowfram}{Missing value for 'label' key}{}%
23026 }%
23027 {}%
23028 \def\ff@label{#1}%
23029 }
23030 \define@key{flowframe}{border}[plain]%
23031 {%
23032 \ifthenelse{\equal{#1}{}}%
23033 {%
23034 \PackageError{flowfram}%
23035 {%
23036 Missing value for 'border' key - use
23037 'none' for no border%
23038 }%
23039 {}%
23040 }%
23041 {}%
23042 \ifthenelse{\equal{#1}{none}}%
23043 {%
23044 \def\ff@frame{false}%
23045 }%
23046 {%
23047 \def\ff@frame{true}%
23048 \ifthenelse{\equal{#1}{plain}}%
23049 {%
23050 \def\ff@frametype{fbox}%
23051 }%
23052 {%
23053 \def\ff@frametype{#1}%
23054 }%
23055 }%
23056 }
23057 \define@key{flowframe}{bordercolor}%
23058 {%
23059 \ifthenelse{\equal{#1}{}}%
23060 {%
23061 \PackageError{flowfram}{Missing value for 'bordercolor' key}{}%
23062 }%
23063 {}%
23064 \def\ff@col{#1}%
23065 }
23066 \define@key{flowframe}{textcolor}%
23067 {%
23068 \ifthenelse{\equal{#1}{}}%
23069 {%
23070 \PackageError{flowfram}{Missing value for 'textcolor' key}{}%
23071 }%
23072 {}%
23073 \def\ff@txtcol{#1}%
23074 }
23075 \define@key{flowframe}{backcolor}%
23076 {%
23077 \ifthenelse{\equal{#1}{}}%
23078 {%
23079 \PackageError{flowfram}{Missing value for 'backcolor' key}{}%
23080 }%
23081 {}%
23082 \def\ff@backcol{#1}%
23083 }
23084 \define@key{flowframe}{pages}%
23085 {%
23086 \ifthenelse{\equal{#1}{}}%
23087 {%
23088 \PackageError{flowfram}{Missing value for 'pages' key}{}%
23089 }%
23090 {}%
23091 \def\ff@pages{#1}%
23092 }
23093 \define@key{flowframe}{excludepages}%
23094 {%
23095 \def\ff@xpages{#1}%
23096 }
23097 \define@key{flowframe}{offset}%
23098 {%
23099 \def\ff@offset{#1}%
23100 \ifthenelse{\equal{#1}{}}%
23101 {%
23102 \PackageError{flowframe}%
23103 {%
23104 Invalid value for key 'offset'%
23105 }%
23106 {%
23107 'offset' can either be 'compute' (to compute it according
23108 to certain pre-defined rules) or a length%
23109 }%
23110 }%
23111 {}%
23112 }
23113 \define@key{flowframe}{angle}{\def\ff@angle{#1}%
23114 }
23115 \define@choicekey{flowframe}{margin}{left,right,inner,outer}%
23116 {%
23117 \def\ff@margin{#1}%
23118 }
23119 \define@choicekey{flowframe}{clear}{true,false}[true]{%
23120 \def\ff@clear{#1}%
23121 }
23122 \define@key{flowframe}{style}%
23123 {%
23124 \ifthenelse{\equal{#1}{}}%
23125 {%
23126 \PackageError{flowfram}{Missing value for 'style' key}{}%
23127 }%
23128 {}%
23129 \ifthenelse{\equal{#1}{none}}%
23130 {%
23131 \def\ff@style{relax}%
23132 }%
23133 {%
23134 \def\ff@style{#1}%
23135 }%
23136 }
23137 \define@key{flowframe}{shape}%
23138 {%
23139 \def\ff@shape{#1}%
23140 }
23141 \define@choicekey{flowframe}{valign}{c,t,b}%
23142 {%
23143 \def\ff@valign{#1}%
23144 }
23145 \define@choicekey{flowframe}{hide}{true,false}[true]{%
23146 \def\ff@hide{#1}%
23147 }
23148 \define@choicekey{flowframe}{hidethis}{true,false}[true]{%
23149 \def\ff@hidethis{#1}%
23150 }
23151 \newcommand*{\setallflowframes}[1]{%
23152 \@colN=0\relax
23153 \whiledo{\@colN<\c@maxflow}%
23154 {%
23155 \advance\@colN by 1\relax
23156 \@@setflowframe{\@colN}{#1}%
23157 }%
23158 }
23159 \newcommand*{\setflowframe}{\@ifstar\@ssetflowframe\@setflowframe}
23160 \newcommand{\@ssetflowframe}[2]{%
23161 \@for\@ff@id:=#1\do{%
23162 \@flowframeid{\@ff@id}%
23163 \@@setflowframe{\ff@id}{#2}%
23164 }%
23165 }
23166 \newcommand*{\@setflowframe}[2]{%
23167 \ifthenelse{\equal{#1}{all}}%
23168 {%
23169 \setallflowframes{#2}%
23170 }%
23171 {%
23172 \ifthenelse{\equal{#1}{odd} \TE@or \equal{#1}{even}}%
23173 {%
23174 \ifthenelse{\equal{#1}{odd}}%
23175 {%
23176 \@colN=1\relax
23177 }%
23178 {%
23179 \@colN=2\relax
23180 }%
23181 \whiledo{\@colN<\c@maxflow\TE@or\@colN=\c@maxflow}%
23182 {%
23183 \@@setflowframe{\@colN}{#2}%
23184 \advance\@colN by 2\relax
23185 }%
23186 }%
23187 {%
23188 \@for\@ff@id:=#1\do
23189 {%
23190 \def\@ff@numstart{0}%
23191 \def\@ff@numend{10000}%
23192 \@ff@getrange{\@ff@id}%
23193 \ifnum\@ff@numstart=0\relax
23194 \def\@ff@numstart{1}%
23195 \fi
23196 \ifnum\@ff@numend>\c@maxflow\relax
23197 \def\@ff@numend{\c@maxflow}%
23198 \fi
23199 \@colN=\@ff@numstart\relax
23200 \whiledo{\@colN<\@ff@numend \TE@or \@colN=\@ff@numend}%
23201 {%
23202 \@@setflowframe{\@colN}{#2}%
23203 \advance\@colN by 1\relax
23204 }%
23205 }%
23206 }%
23207 }%
23208 }
23209 \newcommand*{\@@setflowframe}[2]{%
23210 \def\ff@frame{}\def\ff@width{}\def\ff@height{}\def\ff@margin{}%
23211 \def\ff@x{}\def\ff@y{}\def\ff@frametype{}\def\ff@col{}%
23212 \def\ff@valign{}\def\ff@style{}%
23213 \def\ff@hide{}\def\ff@hidethis{}%
23214 \def\ff@txtcol{}\def\ff@clear{}\def\ff@offset{}\def\ff@pages{}%
23215 \def\ff@label{}\def\ff@backcol{}\def\ff@evenx{}\def\ff@eveny{}%
23216 \def\ff@oddx{}\def\ff@oddy{}\def\ff@angle{}%
23217 \let\ff@xpages\undefined
23218 \let\ff@shape\undefined
23219 \setkeys{flowframe}{#2}%
23220 \ifdefempty{\ff@frame}{}%
23221 {%
23222 \setboolean{columnframe\romannumeral#1}{\ff@frame}%
23223 }%
23224 \ifdefempty{\ff@width}{}%
23225 {%
23226 \expandafter
23227 \setlength\csname colwidth\romannumeral#1\endcsname
23228 {\ff@width}%
23229 }%
23230 \ifdefempty{\ff@height}{}%
23231 {%
23232 \expandafter
23233 \setlength\csname colheight\romannumeral#1\endcsname
23234 {\ff@height}%
23235 }%
23236 \ifdefempty{\ff@x}{}%
23237 {%
23238 \expandafter
23239 \setlength\csname col@\romannumeral#1@posx\endcsname
23240 {\ff@x}%
23241 \expandafter
23242 \setlength\csname col@\romannumeral#1@evenx\endcsname
23243 {\ff@x}%
23244 }
23245 \ifdefempty{\ff@y}{}%
23246 {%
23247 \expandafter
23248 \setlength\csname col@\romannumeral#1@posy\endcsname
23249 {\ff@y}%
23250 \expandafter
23251 \setlength\csname col@\romannumeral#1@eveny\endcsname
23252 {\ff@y}%
23253 }%
23254 \ifdefempty{\ff@evenx}{}%
23255 {%
23256 \expandafter
23257 \setlength\csname col@\romannumeral#1@evenx\endcsname
23258 {\ff@evenx}%
23259 }%
23260 \ifdefempty{\ff@eveny}{}%
23261 {%
23262 \expandafter
23263 \setlength\csname col@\romannumeral#1@eveny\endcsname
23264 {\ff@eveny}%
23265 }%
23266 \ifdefempty{\ff@oddx}{}%
23267 {%
23268 \expandafter
23269 \setlength\csname col@\romannumeral#1@posx\endcsname
23270 {\ff@oddx}%
23271 }%
23272 \ifdefempty{\ff@oddy}{}%
23273 {%
23274 \expandafter
23275 \setlength\csname col@\romannumeral#1@posy\endcsname
23276 {\ff@oddy}%
23277 }%
23278 \ifdefempty{\ff@label}{}%
23279 {%
23280 \@s@tflowframeid{#1}[\ff@label]%
23281 }%
23282 \ifdefempty{\ff@frametype}{}%
23283 {%
23284 \expandafter
23285 \edef\csname @ff@frametype@\romannumeral#1\endcsname{%
23286 \ff@frametype}%
23287 }%
23288 \ifdefempty{\ff@col}{}%
23289 {%
23290 \expandafter\@setframecol\ff@col\end{#1}{col}{ff}%
23291 }%
23292 \ifdefempty{\ff@txtcol}{}%
23293 {%
23294 \expandafter\@setframecol\ff@txtcol\end{#1}{txtcol}{ff}%
23295 }%
23296 \ifdefempty{\ff@backcol}{}%
23297 {%
23298 \expandafter\@setframecol\ff@backcol\end{#1}{backcol}{ff}%
23299 }%
23300 \ifdefempty{\ff@margin}{}%
23301 {%
23302 \expandafter
23303 \xdef\csname @ff@margin@\romannumeral#1\endcsname{%
23304 \ff@margin}%
23305 }%
23306 \ifdefempty{\ff@pages}{}%
23307 {%
23308 \flowsetpagelist{#1}{\ff@pages}%
23309 }%
23310 \ifundef{\ff@xpages}{}%
23311 {%
23312 \flowsetexclusion{#1}{\ff@xpages}%
23313 }%
23314 \ifdefempty{\ff@offset}{}%
23315 {%
23316 \expandafter
23317 \xdef\csname @ff@offset@\romannumeral#1\endcsname{%
23318 \ff@offset}%
23319 }%
23320 \ifdefempty{\ff@angle}{}%
23321 {%
23322 \expandafter
23323 \xdef\csname @ff@angle@\romannumeral#1\endcsname{%
23324 \ff@angle}%
23325 }%
23326 \ifdefempty{\ff@clear}{}%
23327 {%
23328 \PackageError{flowfram}%
23329 {Key 'clear' not available for flow frames}{}%
23330 }%
23331 \ifdefempty{\ff@style}{}%
23332 {%
23333 \PackageError{flowfram}%
23334 {Key 'style' not available for flow frames}{}%
23335 }%
23336 \ifundef{\ff@shape}{}%
23337 {%
23338 \PackageError{flowfram}%
23339 {Key 'shape' not available for flow frames}{}%
23340 }%
23341 \ifdefempty{\ff@valign}{}%
23342 {%
23343 \PackageError{flowfram}%
23344 {Key 'valign' not available for flow frames}{}%
23345 }%
23346 \ifdefempty{\ff@hide}{}%
23347 {%
23348 \PackageError{flowfram}%
23349 {Key 'hide' not available for flow frames}{}%
23350 }%
23351 \ifdefempty{\ff@hidethis}{}%
23352 {%
23353 \PackageError{flowfram}%
23354 {Key 'hidethis' not available for flow frames}{}%
23355 }%
23356 }
23357 \newcommand*{\flowsetpagelist}[2]{%
23358 \expandafter
23359 \xdef\csname @ff@pages@\romannumeral#1\endcsname{#2}%
23360 \flf@message{Setting page range for flow frame
23361 \number#1\space\space to "#2"}%
23362 }
23363 \newcommand*{\flowsetexclusion}[2]{%
23364 \expandafter
23365 \xdef\csname @ff@xpages@\romannumeral#1\endcsname{#2}%
23366 \flf@message{Setting exclusion for flow frame
23367 \number#1\space\space to "#2"}%
23368 }
23369 \newcommand*{\flowaddexclusion}[2]{%
23370 \ifcsempty{@ff@xpages@\romannumeral#1}
23371 {%
23372 \expandafter
23373 \xdef\csname @ff@xpages@\romannumeral#1\endcsname{#2}%
23374 }%
23375 {%
23376 \expandafter
23377 \xdef\csname @ff@xpages@\romannumeral#1\endcsname{%
23378 \csname @ff@xpages@\romannumeral#1\endcsname,#2}%
23379 }%
23380 \flf@message{Setting exclusion for flow frame
23381 \number#1\space\space to
23382 "\csname @ff@xpages@\romannumeral#1\endcsname"}%
23383 }
23384 \newcommand*{\@@flowframeswapcoords}[1]{%
23385 \setlength{\@ff@tmp@x}%
23386 {\csname col@\romannumeral#1@evenx\endcsname}
23387 \expandafter\setlength\csname col@\romannumeral#1@evenx\endcsname
23388 {\csname col@\romannumeral#1@posx\endcsname}%
23389 \expandafter\setlength\csname col@\romannumeral#1@posx\endcsname
23390 {\@ff@tmp@x}%
23391 \setlength{\@ff@tmp@y}%
23392 {\csname col@\romannumeral#1@eveny\endcsname}
23393 \expandafter\setlength\csname col@\romannumeral#1@eveny\endcsname
23394 {\csname col@\romannumeral#1@posy\endcsname}%
23395 \expandafter\setlength\csname col@\romannumeral#1@posy\endcsname
23396 {\@ff@tmp@y}%
23397 }
23398 \newcommand*{\ffswapoddeven}{%
23399 \@ifstar\@sflowframeswapcoords\@flowframeswapcoords
23400 }
23401 \newcommand*{\@sflowframeswapcoords}[1]{%
23402 \@for\@ff@id:=#1\do
23403 {%
23404 \@flowframeid{\@ff@id}%
23405 \@@flowframeswapcoords{\ff@id}%
23406 }%
23407 }
23408 \newcommand*{\@flowframeswapcoords}[1]{%
23409 \ifthenelse{\equal{#1}{all}}%
23410 {%
23411 \ff@id=0\relax
23412 \whiledo{\ff@id<\c@maxflow}%
23413 {%
23414 \advance\ff@id by 1\relax
23415 \@@flowframeswapcoords{\ff@id}%
23416 }%
23417 }%
23418 {%
23419 \ifthenelse{\equal{#1}{odd} \TE@or \equal{#1}{even}}%
23420 {%
23421 \ifthenelse{\equal{#1}{odd}}{\@colN=1}{\@colN=2}%
23422 \whiledo{\@colN<\c@maxflow\TE@or\@colN=\c@maxflow}%
23423 {%
23424 \@@flowframeswapcoords{\@colN}%
23425 \advance\@colN by 2\relax
23426 }%
23427 }%
23428 {%
23429 \@for\@ff@id:=#1\do
23430 {%
23431 \def\@ff@numstart{0}%
23432 \def\@ff@numend{100000}%
23433 \@ff@getrange{\@ff@id}%
23434 \ifnum\@ff@numstart=0\relax
23435 \def\@ff@numstart{1}%
23436 \fi
23437 \ifnum\@ff@numend>\c@maxflow
23438 \def\@ff@numend{\c@maxflow}%
23439 \fi
23440 \@colN=\@ff@numstart
23441 \whiledo{\@colN<\@ff@numend \TE@or \@colN=\@ff@numend}%
23442 {%
23443 \@@flowframeswapcoords{\@colN}%
23444 \advance\@colN by 1\relax
23445 }%
23446 }%
23447 }%
23448 }%
23449 }
23450 \newcommand*{\flowframex}[1]{%
23451 \csname col@\romannumeral#1@posx\endcsname
23452 }
23453 \newcommand*{\flowframey}[1]{%
23454 \csname col@\romannumeral#1@posy\endcsname
23455 }
23456 \newcommand*{\flowframeevenx}[1]{%
23457 \csname col@\romannumeral#1@evenx\endcsname
23458 }
23459 \newcommand*{\flowframeeveny}[1]{%
23460 \csname col@\romannumeral#1@eveny\endcsname
23461 }
23462 \newcommand{\flowframewidth}[1]{%
23463 \csname colwidth\romannumeral#1\endcsname
23464 }
23465 \newcommand*{\flowframeheight}[1]{%
23466 \csname colheight\romannumeral#1\endcsname
23467 }
23468 \def\@setframecol{\@ifnextchar[\@@setframecol\@@setfr@mecol}
23469 \def\@@setframecol[#1]#2\end#3#4#5{%
23470 \expandafter\edef\csname @#5@#4@\romannumeral#3\endcsname{%
23471 [#1]{#2}}%
23472 }
23473 \def\@@setfr@mecol#1\end#2#3#4{%
23474 \expandafter\edef\csname @#4@#3@\romannumeral#2\endcsname{{#1}}%
23475 }
23476 \newcommand*{\newstaticframe}{\@n@wstaticframe}
23477 \newcommand*{\@n@wstaticframe}{%
23478 \global\advance\c@maxstatic by 1\relax
23479 \newboolean{staticframe\romannumeral\c@maxstatic}%
23480 \@ifstar\@snewstaticframe\@newstaticframe
23481 }
23482 \newcommand{\@snewstaticframe}{%
23483 \setboolean{staticframe\romannumeral\c@maxstatic}{true}%
23484 \@@newstaticframe
23485 }
23486 \newcommand{\@newstaticframe}{%
23487 \setboolean{staticframe\romannumeral\c@maxstatic}{false}%
23488 \@@newstaticframe
23489 }
23490 \newcommand*{\@@newstaticframe}[5][all]{%
23491 \expandafter
23492 \newbox\csname @staticframe@\romannumeral\c@maxstatic\endcsname
23493 \expandafter
23494 \newlength\csname @sf@\romannumeral\c@maxstatic @posx\endcsname
23495 \expandafter
23496 \newlength\csname @sf@\romannumeral\c@maxstatic @posy\endcsname
23497 \expandafter\setlength
23498 \csname @sf@\romannumeral\c@maxstatic @posx\endcsname{#4}%
23499 \expandafter\setlength
23500 \csname @sf@\romannumeral\c@maxstatic @posy\endcsname{#5}%
23501 \expandafter\newlength
23502 \csname @sf@\romannumeral\c@maxstatic @evenx\endcsname
23503 \expandafter\newlength
23504 \csname @sf@\romannumeral\c@maxstatic @eveny\endcsname
23505 \expandafter\setlength
23506 \csname @sf@\romannumeral\c@maxstatic @evenx\endcsname{#4}%
23507 \expandafter\setlength
23508 \csname @sf@\romannumeral\c@maxstatic @eveny\endcsname{#5}%
23509 {\@ff@tmp@x=#2\relax
23510 \@ff@tmp@y=#3\relax
23511 \expandafter
23512 \xdef\csname @sf@dim@\romannumeral\c@maxstatic\endcsname{%
23513 [c][\the\@ff@tmp@y][c]{\the\@ff@tmp@x}}}%
23514 \expandafter
23515 \def\csname @sf@col@\romannumeral\c@maxstatic\endcsname{%
23516 \flowframecol}%
23517 \expandafter
23518 \def\csname @sf@txtcol@\romannumeral\c@maxstatic\endcsname{%
23519 \flowframetextcol}%
23520 \expandafter
23521 \def\csname @sf@backcol@\romannumeral\c@maxstatic\endcsname{%
23522 {none}}%
23523 \expandafter
23524 \xdef\csname @sf@pages@\romannumeral\c@maxstatic\endcsname{#1}%
23525 \expandafter
23526 \gdef\csname @sf@xpages@\romannumeral\c@maxflow\endcsname{}%
23527 \expandafter
23528 \gdef\csname @sf@offset@\romannumeral\c@maxstatic\endcsname{%
23529 compute}%
23530 \expandafter
23531 \gdef\csname @sf@angle@\romannumeral\c@maxstatic\endcsname{0}%
23532 \expandafter
23533 \gdef\csname @sf@shape@\romannumeral\c@maxstatic\endcsname{\relax}%
23534 \expandafter
23535 \def\csname @sf@frametype@\romannumeral\c@maxstatic\endcsname{%
23536 fbox}%
23537 \newboolean{@sf@clear@\romannumeral\c@maxstatic}%
23538 \setboolean{@sf@clear@\romannumeral\c@maxstatic}{false}
23539 \newboolean{@sf@hide@\romannumeral\c@maxstatic}%
23540 \setboolean{@sf@hide@\romannumeral\c@maxstatic}{false}%
23541 \newboolean{@sf@hidethis@\romannumeral\c@maxstatic}%
23542 \setboolean{@sf@hidethis@\romannumeral\c@maxstatic}{false}%
23543 \@ifnextchar[{\@s@tstaticframeid{\c@maxstatic}}%
23544 {\@s@tstaticframeid{\c@maxstatic}[\number\c@maxstatic]}%
23545 }
23546 \def\@s@tstaticframeid#1[#2]{%
23547 \edef\ff@label{#2}%
23548 \@sf@checkuniqueidl{#1}{\ff@label}%
23549 \expandafter
23550 \xdef\csname @sf@id@\romannumeral#1\endcsname{\ff@label}%
23551 }
23552 \newcommand*{\@sf@checkuniqueidl}[2]{%
23553 \@colN=0\relax
23554 \whiledo{\@colN<\c@maxstatic}%
23555 {%
23556 \advance\@colN by 1\relax
23557 \ifnum\@colN=#1\relax
23558 \else
23559 \ifthenelse
23560 {%
23561 \equal{#2}{\csname @sf@id@\romannumeral\@colN\endcsname}%
23562 }%
23563 {%
23564 \PackageError{flowfram}%
23565 {Static frame IDL '#2' already defined}%
23566 {%
23567 You can't assign this label, as it is already defined
23568 for static frame \number\@colN
23569 }%
23570 }%
23571 {}%
23572 \fi
23573 }%
23574 }
23575 \newcommand*{\getstaticlabel}[1]{%
23576 \csname @sf@id@\romannumeral#1\endcsname
23577 }
23578 \newcommand*{\getstaticid}[2]{%
23579 \@staticframeid{#2}\edef#1{\number\ff@id}%
23580 }
23581 \newcommand*{\@staticframeid}[1]{%
23582 \@colN=0\relax
23583 \ff@id=0\relax
23584 \whiledo{\@colN<\c@maxstatic}%
23585 {%
23586 \advance\@colN by 1\relax
23587 \ifthenelse
23588 {%
23589 \equal{#1}{\csname @sf@id@\romannumeral\@colN\endcsname}%
23590 }%
23591 {%
23592 \ff@id=\@colN\relax
23593 \@colN=\c@maxstatic
23594 }%
23595 {}%
23596 }%
23597 \ifnum\ff@id=0\relax
23598 \PackageError{flowfram}%
23599 {Can't find static frame id '#1'}{}%
23600 \fi
23601 }
23602 \newcommand*{\staticframex}[1]{%
23603 \csname @sf@\romannumeral#1@posx\endcsname
23604 }
23605 \newcommand*{\staticframey}[1]{%
23606 \csname @sf@\romannumeral#1@posy\endcsname
23607 }
23608 \newcommand*{\staticframeevenx}[1]{%
23609 \csname @sf@\romannumeral#1@evenx\endcsname
23610 }
23611 \newcommand*{\staticframeeveny}[1]{%
23612 \csname @sf@\romannumeral#1@eveny\endcsname
23613 }
23614 \newcommand*{\setallstaticframes}[1]{%
23615 \@colN=0\relax
23616 \whiledo{\@colN<\c@maxstatic}%
23617 {%
23618 \advance\@colN by 1\relax
23619 \@@setstaticframe{\@colN}{#1}%
23620 }%
23621 }
23622 \newcommand*{\setstaticframe}{%
23623 \@ifstar\@ssetstaticframe\@setstaticframe
23624 }
23625 \newcommand*{\@ssetstaticframe}[2]{%
23626 \@for\@ff@id:=#1\do
23627 {%
23628 \@staticframeid{\@ff@id}%
23629 \@@setstaticframe{\ff@id}{#2}%
23630 }%
23631 }
23632 \newcommand*{\@setstaticframe}[2]{%
23633 \ifthenelse{\equal{#1}{all}}%
23634 {%
23635 \setallstaticframes{#2}%
23636 }%
23637 {%
23638 \ifthenelse{\equal{#1}{odd} \TE@or \equal{#1}{even}}%
23639 {%
23640 \ifthenelse{\equal{#1}{odd}}{\@colN=1}{\@colN=2}%
23641 \whiledo{\@colN<\c@maxstatic\TE@or\@colN=\c@maxstatic}%
23642 {%
23643 \@@setstaticframe{\@colN}{#2}%
23644 \advance\@colN by 2\relax
23645 }%
23646 }%
23647 {%
23648 \@for\@ff@id:=#1\do
23649 {%
23650 \def\@ff@numstart{0}%
23651 \def\@ff@numend{10000}%
23652 \@ff@getrange{\@ff@id}%
23653 \ifnum\@ff@numstart=0\relax
23654 \def\@ff@numstart{1}%
23655 \fi
23656 \ifnum\@ff@numend>\c@maxstatic\relax
23657 \def\@ff@numend{\c@maxstatic}%
23658 \fi
23659 \@colN=\@ff@numstart\relax
23660 \whiledo{\@colN<\@ff@numend \TE@or \@colN=\@ff@numend}%
23661 {%
23662 \@@setstaticframe{\@colN}{#2}%
23663 \advance\@colN by 1\relax
23664 }%
23665 }%
23666 }%
23667 }%
23668 }
23669 \newcommand*{\@@setstaticframe}[2]{%
23670 \expandafter\expandafter\expandafter
23671 \@ff@getstaticpos\csname @sf@dim@\romannumeral#1\endcsname
23672 \def\ff@frame{}\edef\ff@width{\the\@ff@tmp@x}\def\ff@angle{}%
23673 \edef\ff@height{\the\@ff@tmp@y}\def\ff@style{}\def\ff@frametype{}%
23674 \def\ff@x{}\def\ff@y{}\def\ff@col{}\def\ff@txtcol{}%
23675 \def\ff@backcol{}%
23676 \def\ff@clear{}\def\ff@margin{}\def\ff@offset{}\def\ff@pages{}%
23677 \def\ff@label{}\def\ff@evenx{}\def\ff@eveny{}%
23678 \def\ff@oddx{}\def\ff@oddy{}%
23679 \def\ff@hide{}\def\ff@hidethis{}%
23680 \let\ff@shape\undefined
23681 \let\ff@xpages\undefined
23682 \setkeys{flowframe}{#2}%
23683 \ifdefempty{\ff@frame}{}%
23684 {%
23685 \setboolean{staticframe\romannumeral#1}{\ff@frame}%
23686 }%
23687 \ifdefempty{\ff@x}{}%
23688 {%
23689 \expandafter\global\expandafter
23690 \setlength\csname @sf@\romannumeral#1@posx\endcsname
23691 {\ff@x}%
23692 \expandafter\global\expandafter
23693 \setlength\csname @sf@\romannumeral#1@evenx\endcsname
23694 {\ff@x}%
23695 }%
23696 \ifdefempty{\ff@y}{}%
23697 {%
23698 \expandafter\global\expandafter
23699 \setlength\csname @sf@\romannumeral#1@posy\endcsname
23700 {\ff@y}%
23701 \expandafter\global\expandafter
23702 \setlength\csname @sf@\romannumeral#1@eveny\endcsname
23703 {\ff@y}%
23704 }%
23705 \ifdefempty{\ff@evenx}{}%
23706 {%
23707 \expandafter\global\expandafter
23708 \setlength\csname @sf@\romannumeral#1@evenx\endcsname
23709 {\ff@evenx}%
23710 }%
23711 \ifdefempty{\ff@eveny}{}%
23712 {%
23713 \expandafter\global\expandafter
23714 \setlength\csname @sf@\romannumeral#1@eveny\endcsname
23715 {\ff@eveny}%
23716 }%
23717 \ifdefempty{\ff@oddx}{}%
23718 {%
23719 \expandafter\global\expandafter
23720 \setlength\csname @sf@\romannumeral#1@posx\endcsname
23721 {\ff@oddx}%
23722 }%
23723 \ifdefempty{\ff@oddy}{}%
23724 {%
23725 \expandafter\global\expandafter
23726 \setlength\csname @sf@\romannumeral#1@posy\endcsname
23727 {\ff@oddy}%
23728 }%
23729 \expandafter
23730 \xdef\csname @sf@dim@\romannumeral#1\endcsname{%
23731 [c][\ff@height][\ff@valign]{\ff@width}}%
23732 \ifdefempty{\ff@frametype}{}%
23733 {%
23734 \expandafter
23735 \xdef\csname @sf@frametype@\romannumeral#1\endcsname{%
23736 \ff@frametype}%
23737 }%
23738 \ifdefempty{\ff@label}{}%
23739 {%
23740 \@s@tstaticframeid{#1}[\ff@label]%
23741 }
23742 \ifdefempty{\ff@col}{}%
23743 {%
23744 \expandafter\@setframecol\ff@col\end{#1}{col}{sf}%
23745 }%
23746 \ifdefempty{\ff@txtcol}{}%
23747 {%
23748 \expandafter\@setframecol\ff@txtcol\end{#1}{txtcol}{sf}%
23749 }%
23750 \ifdefempty{\ff@backcol}{}%
23751 {%
23752 \expandafter\@setframecol\ff@backcol\end{#1}{backcol}{sf}%
23753 }%
23754 \ifdefempty{\ff@offset}{}%
23755 {%
23756 \expandafter
23757 \xdef\csname @sf@offset@\romannumeral#1\endcsname{\ff@offset}%
23758 }%
23759 \ifdefempty{\ff@angle}{}%
23760 {%
23761 \expandafter
23762 \xdef\csname @sf@angle@\romannumeral#1\endcsname{\ff@angle}%
23763 }%
23764 \ifundef{\ff@shape}{}%
23765 {%
23766 \expandafter\global\expandafter
23767 \let\csname @sf@shape@\romannumeral#1\endcsname\ff@shape
23768 }%
23769 \ifdefempty{\ff@pages}{}%
23770 {%
23771 \staticsetpagelist{#1}{\ff@pages}%
23772 }%
23773 \ifundef{\ff@xpages}{}%
23774 {%
23775 \staticsetexclusion{#1}{\ff@xpages}%
23776 }%
23777 \ifdefempty{\ff@hide}{}%
23778 {%
23779 \setboolean{@sf@hide@\romannumeral#1}{\ff@hide}%
23780 }%
23781 \ifdefempty{\ff@hidethis}{}%
23782 {%
23783 \global\csletcs{if@sf@hidethis@\romannumeral#1}{if\ff@hidethis}%
23784 }%
23785 \ifdefempty{\ff@clear}{}%
23786 {%
23787 \setboolean{@sf@clear@\romannumeral#1}{\ff@clear}%
23788 }%
23789 \ifdefempty{\ff@margin}{}%
23790 {%
23791 \PackageError{flowfram}%
23792 {Key 'margin' not available for static frames}%
23793 {Static frames don't have marginal notes}%
23794 }%
23795 \ifdefempty{\ff@style}{}%
23796 {%
23797 \PackageError{flowfram}%
23798 {Key 'style' not available for static frames}{}%
23799 }%
23800 }
23801 %\newcommand*{\simpar}{\hfil\vadjust{\vskip\parskip}\break\indent}
23802 \newcommand*{\simpar}{\hfill\\\indent\mbox{}}
23803 \let\FLForgpar\par
23804 \newcommand{\ffpshpar}{%
23805 \edef\flf@next{\hangafter=\the\hangafter
23806 \hangindent=\the\hangindent}%
23807 \FLForgpar\flf@next
23808 \edef\flf@next{\prevgraf=\the\prevgraf}%
23809 \@ff@parshape\indent\mbox{}\flf@next
23810 }
23811 \def\@ff@parshape{\parshape=0}
23812 \newcommand*{\@ff@sectionhead}[1]{%
23813 \def\ff@sechead{#1}%
23814 \ffpshpar
23815 \@ifstar{\@s@ff@heading}{\@dblarg\@ff@heading}%
23816 }
23817 \def\@s@ff@heading#1{%
23818 \@ifundefined{@ff@old\ff@sechead}%
23819 {%
23820 \PackageError{flowfram}%
23821 {Unknown heading command '\ff@sechead'}{}%
23822 }%
23823 {%
23824 \begingroup
23825 \edef\flf@next{\hangafter=\the\hangafter
23826 \hangindent=\the\hangindent}%
23827 \FLForgpar\flf@next
23828 \let\par=\FLForgpar
23829 \edef\flf@next{\prevgraf=\the\prevgraf}%
23830 \csname @ff@old\ff@sechead\endcsname*{%
23831 \@ff@parshape\flf@next #1}%
23832 \xdef\flf@next{%
23833 \@ff@parshape
23834 \prevgraf=\the\prevgraf}%
23835 \endgroup
23836 }%
23837 \mbox{}\flf@next
23838 \let\flf@next\undefined
23839 }
23840 \def\@ff@heading[#1]#2{%
23841 \@ifundefined{@ff@old\ff@sechead}%
23842 {%
23843 \PackageError{flowfram}%
23844 {Unknown heading command '\ff@sechead'}{}%
23845 }%
23846 {%
23847 \begingroup
23848 \edef\flf@next{%
23849 \hangafter=\the\hangafter
23850 \hangindent=\the\hangindent}%
23851 \FLForgpar\flf@next
23852 \let\par=\FLForgpar
23853 \edef\flf@next{\prevgraf=\the\prevgraf}%
23854 \csname @ff@old\ff@sechead\endcsname[#1]{%
23855 \@ff@parshape\flf@next #2}%
23856 \xdef\flf@next{\@ff@parshape
23857 \prevgraf=\the\prevgraf}%
23858 \endgroup
23859 }%
23860 \mbox{}\flf@next
23861 \let\flf@next\undefined
23862 }
23863 \newcommand*{\@ff@setsecthead}{%
23864 \let\@ff@oldsection=\section
23865 \let\@ff@oldsubsection=\subsection
23866 \let\@ff@oldsubsubsection=\subsubsection
23867 \let\@ff@oldparagraph=\paragraph
23868 \let\@ff@oldsubparagraph=\subparagraph
23869 \def\section{\@ff@sectionhead{section}}%
23870 \def\subsection{\@ff@sectionhead{subsection}}%
23871 \def\subsubsection{\@ff@sectionhead{subsubsection}}%
23872 \def\paragraph{\@ff@sectionhead{paragraph}}%
23873 \def\subparagraph{\@ff@sectionhead{subparagraph}}%
23874 }
23875 \def\@ff@getshape#1#2\relax{%
23876 \ifdefequal{#1}{\parshape}%
23877 {%
23878 \def\ff@shape{1}%
23879 }%
23880 {%
23881 \ifdefequal{#1}{\shapepar}%
23882 {%
23883 \def\ff@shape{2}%
23884 }%
23885 {%
23886 \ifdefequal{#1}{\Shapepar}%
23887 {%
23888 \def\ff@shape{2}%
23889 }%
23890 {%
23891 \ifx#1\relax
23892 \def\ff@shape{0}%
23893 \else
23894 \PackageError{flowfram}{Unknown shape \string#1}{}%
23895 \def\ff@shape{2}%
23896 \fi
23897 }%
23898 }%
23899 }%
23900 }
23901 \newcommand*{\@ff@disablesec}{%
23902 \def\section{%
23903 \PackageError{flowfram}%
23904 {You can't have sectioning commands within a \string\shapepar}{}%
23905 }%
23906 \def\subsection{%
23907 \PackageError{flowfram}%
23908 {You can't have sectioning commands within a \string\shapepar}{}%
23909 }%
23910 \def\subsubsection{%
23911 \PackageError{flowfram}%
23912 {You can't have sectioning commands within a \string\shapepar}{}%
23913 }%
23914 \def\paragraph{%
23915 \PackageError{flowfram}%
23916 {You can't have sectioning commands within a \string\shapepar}{}%
23917 }%
23918 \def\subparagraph{%
23919 \PackageError{flowfram}%
23920 {You can't have sectioning commands within a \string\shapepar}{}%
23921 }%
23922 }
23923 \newbox\staticframe
23924 \newenvironment{staticcontents}[1]{%
23925 \let\continueonframe=\@staticcontinueonframe
23926 \@beginstaticcontents{#1}%
23927 }%
23928 {%
23929 \@endstaticcontents
23930 \ignorespaces
23931 }
23932 \newenvironment{staticcontents*}[1]{%
23933 \@staticframeid{#1}%
23934 \let\continueonframe=\@staticscontinueonframe
23935 \@beginstaticcontents{\ff@id}%
23936 }%
23937 {%
23938 \@endstaticcontents
23939 \ignorespaces
23940 }
23941 \newcommand{\@beginstaticcontents}[1]{%
23942 \@ifundefined{@staticframe@\romannumeral#1}%
23943 {%
23944 \PackageError{flowfram}{Static frame '#1' not defined}{}%
23945 }%
23946 {}%
23947 \expandafter\let\expandafter\@ff@parshape\csname @sf@shape@\romannumeral#1\endcsname
23948 \expandafter\@ff@getshape\@ff@parshape\relax
23949 \ifcase\ff@shape
23950 \edef\@sf@mpg{%
23951 \noexpand
23952 \begin{minipage}\csname @sf@dim@\romannumeral#1\endcsname
23953 \noexpand\begingroup
23954 \noexpand\let\noexpand\FLForgpar=\noexpand\par
23955 }%
23956 \or
23957 \edef\@sf@mpg{%
23958 \noexpand
23959 \begin{minipage}\csname @sf@dim@\romannumeral#1\endcsname
23960 \@ff@parshape
23961 \noexpand\begingroup
23962 \noexpand\let\noexpand\FLForgpar=\noexpand\par
23963 \noexpand\let\noexpand\par=\noexpand\ffpshpar
23964 \noexpand\@ff@setsecthead
23965 }%
23966 \or
23967 \edef\@sf@mpg{%
23968 \noexpand
23969 \begin{minipage}\csname @sf@dim@\romannumeral#1\endcsname
23970 \noexpand\begingroup
23971 \noexpand\@ff@disablesec
23972 \noexpand\@ff@parshape
23973 }%
23974 \fi
23975 \edef\@sf@thisframe{\csname @staticframe@\romannumeral#1\endcsname}%
23976 \begin{lrbox}{\staticframe}%
23977 \edef\ff@txtcol{\csname @sf@txtcol@\romannumeral#1\endcsname}%
23978 \@s@tfftextcol\noindent
23979 \@sf@mpg
23980 \setlength\parindent\sdfparindent
23981 }
23982 \newcommand*{\@endstaticcontents}{%
23983 \ifnum\ff@shape=2\relax
23984 \par
23985 \else
23986 \FLForgpar
23987 \fi
23988 \endgroup
23989 \end{minipage}%
23990 \end{lrbox}%
23991 \expandafter\global\expandafter
23992 \sbox\@sf@thisframe{\usebox\staticframe}%
23993 }
23994 \newcommand{\setstaticcontents}{%
23995 \@ifstar\@sstaticconts\@staticconts
23996 }
23997 \newcommand{\@sstaticconts}[2]{%
23998 \begin{staticcontents*}{#1}%
23999 #2%
24000 \end{staticcontents*}%
24001 }
24002 \newcommand{\@staticconts}[2]{%
24003 \begin{staticcontents}{#1}%
24004 #2%
24005 \end{staticcontents}%
24006 }
24007 \newcommand*{\staticsetpagelist}[2]{%
24008 \expandafter
24009 \xdef\csname @sf@pages@\romannumeral#1\endcsname{#2}%
24010 \flf@message{Setting page range for static frame
24011 \number#1\space\space to "#2"}%
24012 }
24013 \newcommand*{\staticsetexclusion}[2]{%
24014 \expandafter
24015 \xdef\csname @sf@xpages@\romannumeral#1\endcsname{#2}%
24016 \flf@message{Setting exclusion for static frame
24017 \number#1\space\space to "#2"}%
24018 }
24019 \newcommand*{\staticaddexclusion}[2]{%
24020 \ifcsempty{@sf@xpages@\romannumeral#1}
24021 {%
24022 \expandafter
24023 \xdef\csname @sf@xpages@\romannumeral#1\endcsname{#2}%
24024 }%
24025 {%
24026 \expandafter
24027 \xdef\csname @sf@xpages@\romannumeral#1\endcsname{%
24028 \csname @sf@xpages@\romannumeral#1\endcsname,#2}%
24029 }%
24030 \flf@message{Setting exclusion for static frame
24031 \number#1\space\space to
24032 "\csname @sf@xpages@\romannumeral#1\endcsname"}%
24033 }
24034 \newcommand*{\@@staticframeswapcoords}[1]{%
24035 \setlength{\@ff@tmp@x}%
24036 {\csname @sf@\romannumeral#1@evenx\endcsname}
24037 \expandafter\setlength\csname @sf@\romannumeral#1@evenx\endcsname
24038 {\csname @sf@\romannumeral#1@posx\endcsname}%
24039 \expandafter\setlength\csname @sf@\romannumeral#1@posx\endcsname
24040 {\@ff@tmp@x}%
24041 \setlength{\@ff@tmp@y}%
24042 {\csname @sf@\romannumeral#1@eveny\endcsname}
24043 \expandafter\setlength\csname @sf@\romannumeral#1@eveny\endcsname
24044 {\csname @sf@\romannumeral#1@posy\endcsname}%
24045 \expandafter\setlength\csname @sf@\romannumeral#1@posy\endcsname
24046 {\@ff@tmp@y}%
24047 }
24048 \newcommand*{\sfswapoddeven}{%
24049 \@ifstar\@sstaticframeswapcoords\@staticframeswapcoords
24050 }
24051 \newcommand*{\@sstaticframeswapcoords}[1]{%
24052 \@for\@ff@id:=#1\do
24053 {%
24054 \@staticframeid{\@ff@id}%
24055 \@@staticframeswapcoords{\ff@id}%
24056 }%
24057 }
24058 \newcommand*{\@staticframeswapcoords}[1]{%
24059 \ifthenelse{\equal{#1}{all}}%
24060 {%
24061 \ff@id=0\relax
24062 \whiledo{\ff@id<\c@maxflow}%
24063 {%
24064 \advance\ff@id by 1\relax
24065 \@@staticframeswapcoords{\ff@id}%
24066 }%
24067 }%
24068 {%
24069 \ifthenelse{\equal{#1}{odd} \TE@or \equal{#1}{even}}%
24070 {%
24071 \ifthenelse{\equal{#1}{odd}}{\@colN=1}{\@colN=2}%
24072 \whiledo{\@colN<\c@maxflow\TE@or\@colN=\c@maxflow}%
24073 {%
24074 \@@staticframeswapcoords{\@colN}%
24075 \advance\@colN by 2\relax
24076 }%
24077 }%
24078 {%
24079 \@for\@ff@id:=#1\do
24080 {%
24081 \def\@ff@numstart{0}\def\@ff@numend{100000}%
24082 \@ff@getrange{\@ff@id}%
24083 \ifnum\@ff@numstart=0\relax
24084 \def\@ff@numstart{1}%
24085 \fi
24086 \ifnum\@ff@numend>\c@maxflow
24087 \def\@ff@numend{\c@maxflow}%
24088 \fi
24089 \@colN=\@ff@numstart
24090 \whiledo{\@colN<\@ff@numend \TE@or \@colN=\@ff@numend}%
24091 {%
24092 \@@staticframeswapcoords{\@colN}%
24093 \advance\@colN by 1\relax
24094 }%
24095 }%
24096 }%
24097 }%
24098 }
24099 \newcommand*{\newdynamicframe}{%
24100 \@n@wdynamicframe
24101 }
24102 \newcommand*{\@n@wdynamicframe}{%
24103 \global\advance\c@maxdynamic by 1\relax
24104 \newboolean{dynamicframe\romannumeral\c@maxdynamic}
24105 \@ifstar\@snewdynamicframe\@newdynamicframe
24106 }
24107 \newcommand*{\@snewdynamicframe}{%
24108 \setboolean{dynamicframe\romannumeral\c@maxdynamic}{true}%
24109 \@@newdynamicframe
24110 }
24111 \newcommand*{\@newdynamicframe}{%
24112 \setboolean{dynamicframe\romannumeral\c@maxdynamic}{false}%
24113 \@@newdynamicframe
24114 }
24115 \newcommand*{\@@newdynamicframe}[5][all]{%
24116 \expandafter
24117 \gdef\csname @dynamicframe@\romannumeral\c@maxdynamic\endcsname{}%
24118 \expandafter
24119 \newlength\csname @df@\romannumeral\c@maxdynamic @posx\endcsname
24120 \expandafter
24121 \newlength\csname @df@\romannumeral\c@maxdynamic @posy\endcsname
24122 \expandafter\setlength
24123 \csname @df@\romannumeral\c@maxdynamic @posx\endcsname{#4}%
24124 \expandafter\setlength
24125 \csname @df@\romannumeral\c@maxdynamic @posy\endcsname{#5}%
24126 \expandafter\newlength
24127 \csname @df@\romannumeral\c@maxdynamic @evenx\endcsname
24128 \expandafter\newlength
24129 \csname @df@\romannumeral\c@maxdynamic @eveny\endcsname
24130 \expandafter\setlength
24131 \csname @df@\romannumeral\c@maxdynamic @evenx\endcsname{#4}%
24132 \expandafter\setlength
24133 \csname @df@\romannumeral\c@maxdynamic @eveny\endcsname{#5}%
24134 {%
24135 \@ff@tmp@x=#2\relax
24136 \@ff@tmp@y=#3\relax
24137 \expandafter
24138 \xdef\csname @df@dim@\romannumeral\c@maxdynamic\endcsname{%
24139 [c][\the\@ff@tmp@y][t]{\the\@ff@tmp@x}%
24140 }%
24141 }%
24142 \expandafter
24143 \gdef\csname @df@col@\romannumeral\c@maxdynamic\endcsname{%
24144 \flowframecol
24145 }%
24146 \expandafter
24147 \gdef\csname @df@txtcol@\romannumeral\c@maxdynamic\endcsname{%
24148 \flowframetextcol
24149 }%
24150 \expandafter
24151 \gdef\csname @df@backcol@\romannumeral\c@maxdynamic\endcsname{%
24152 {none}}%
24153 \expandafter
24154 \gdef\csname @df@pages@\romannumeral\c@maxdynamic\endcsname{#1}%
24155 \expandafter
24156 \gdef\csname @df@xpages@\romannumeral\c@maxflow\endcsname{}%
24157 \expandafter
24158 \gdef\csname @df@frametype@\romannumeral\c@maxdynamic\endcsname{%
24159 fbox}%
24160 \expandafter
24161 \gdef\csname @df@style@\romannumeral\c@maxdynamic\endcsname{relax}%
24162 \expandafter
24163 \gdef\csname @df@offset@\romannumeral\c@maxdynamic\endcsname{compute}%
24164 \expandafter
24165 \gdef\csname @df@angle@\romannumeral\c@maxdynamic\endcsname{0}%
24166 \expandafter
24167 \gdef\csname @df@shape@\romannumeral\c@maxdynamic\endcsname{\relax}%
24168 \newboolean{@df@clear@\romannumeral\c@maxdynamic}%
24169 \setboolean{@df@clear@\romannumeral\c@maxdynamic}{false}%
24170 \newboolean{@df@hide@\romannumeral\c@maxdynamic}%
24171 \setboolean{@df@hide@\romannumeral\c@maxdynamic}{false}%
24172 \newboolean{@df@hidethis@\romannumeral\c@maxdynamic}%
24173 \setboolean{@df@hidethis@\romannumeral\c@maxdynamic}{false}%
24174 \@ifnextchar[{\@s@tdynamicframeid{\c@maxdynamic}}%
24175 {\@s@tdynamicframeid{\c@maxdynamic}[\number\c@maxdynamic]}%
24176 }
24177 \def\@s@tdynamicframeid#1[#2]{%
24178 \edef\ff@label{#2}%
24179 \@df@checkuniqueidl{#1}{\ff@label}%
24180 \expandafter
24181 \xdef\csname @df@id@\romannumeral#1\endcsname{\ff@label}%
24182 }
24183 \newcommand*{\@df@checkuniqueidl}[2]{%
24184 \@colN=0\relax
24185 \whiledo{\@colN<\c@maxdynamic}%
24186 {%
24187 \advance\@colN by 1\relax
24188 \ifnum\@colN=#1\relax
24189 \else
24190 \ifthenelse
24191 {%
24192 \equal{#2}%
24193 {\csname @df@id@\romannumeral\@colN\endcsname}%
24194 }%
24195 {%
24196 \PackageError{flowfram}%
24197 {Dynamic frame IDL '#2' already defined}%
24198 {%
24199 You can't assign this label, as it is already defined
24200 for dynamic frame \number\@colN
24201 }%
24202 }%
24203 {}%
24204 \fi
24205 }%
24206 }
24207 \newcommand*{\getdynamiclabel}[1]{%
24208 \csname @df@id@\romannumeral#1\endcsname
24209 }
24210 \newcommand*{\getdynamicid}[2]{%
24211 \@dynamicframeid{#2}\edef#1{\number\ff@id}%
24212 }
24213 \newcommand*{\@dynamicframeid}[1]{%
24214 \@colN=0\relax
24215 \ff@id=0\relax
24216 \whiledo{\@colN<\c@maxdynamic}%
24217 {%
24218 \advance\@colN by 1\relax
24219 \ifthenelse
24220 {%
24221 \equal{#1}{\csname @df@id@\romannumeral\@colN\endcsname}%
24222 }%
24223 {%
24224 \ff@id=\@colN\relax
24225 \@colN=\c@maxdynamic
24226 }%
24227 {}%
24228 }%
24229 \ifnum\ff@id=0\relax
24230 \PackageError{flowfram}%
24231 {Can't find dynamic frame id '#1'}{}%
24232 \fi
24233 }
24234 \newcommand*{\@getframeid}[2]{%
24235 \@ifdefined{@#1frameid}%
24236 {\csname @#1frameid\endcsname{#2}}%
24237 {%
24238 \PackageError{flowfram}%
24239 {Unknown frame type `#1'}%
24240 {Frame types can be one of: flow, static or dynamic}%
24241 }%
24242 }
24243 \newcommand*{\dynamicframex}[1]{%
24244 \csname @df@\romannumeral#1@posx\endcsname
24245 }
24246 \newcommand*{\dynamicframey}[1]{%
24247 \csname @df@\romannumeral#1@posy\endcsname
24248 }
24249 \newcommand*{\dynamicframeevenx}[1]{%
24250 \csname @df@\romannumeral#1@evenx\endcsname
24251 }
24252 \newcommand*{\dynamicframeeveny}[1]{%
24253 \csname @df@\romannumeral#1@eveny\endcsname
24254 }
24255 \newcommand*{\setalldynamicframes}[1]{%
24256 \@colN=0\relax
24257 \whiledo{\@colN<\c@maxdynamic}%
24258 {%
24259 \advance\@colN by 1\relax
24260 \@@setdynamicframe{\@colN}{#1}%
24261 }%
24262 }
24263 \newcommand*{\setdynamicframe}{%
24264 \@ifstar\@ssetdynamicframe\@setdynamicframe
24265 }
24266 \newcommand*{\@ssetdynamicframe}[2]{%
24267 \@for\@ff@id:=#1\do{%
24268 \@dynamicframeid{\@ff@id}%
24269 \@@setdynamicframe{\ff@id}{#2}%
24270 }%
24271 }
24272 \newcommand*{\@setdynamicframe}[2]{%
24273 \ifthenelse{\equal{#1}{all}}%
24274 {%
24275 \setalldynamicframes{#2}%
24276 }%
24277 {%
24278 \ifthenelse{\equal{#1}{odd} \TE@or \equal{#1}{even}}%
24279 {%
24280 \ifthenelse{\equal{#1}{odd}}%
24281 {\@colN=1}%
24282 {\@colN=2}%
24283 \whiledo{\@colN<\c@maxdynamic\TE@or\@colN=\c@maxdynamic}%
24284 {%
24285 \@@setdynamicframe{\@colN}{#2}%
24286 \advance\@colN by 2\relax
24287 }%
24288 }%
24289 {%
24290 \@for\@ff@id:=#1\do{%
24291 \def\@ff@numstart{0}%
24292 \def\@ff@numend{10000}%
24293 \@ff@getrange{\@ff@id}%
24294 \ifnum\@ff@numstart=0\relax
24295 \def\@ff@numstart{1}%
24296 \fi
24297 \ifnum\@ff@numend>\c@maxdynamic\relax
24298 \def\@ff@numend{\c@maxdynamic}%
24299 \fi
24300 \@colN=\@ff@numstart\relax
24301 \whiledo{\@colN<\@ff@numend \TE@or \@colN=\@ff@numend}%
24302 {%
24303 \@@setdynamicframe{\@colN}{#2}%
24304 \advance\@colN by 1\relax
24305 }%
24306 }%
24307 }%
24308 }%
24309 }
24310 \newcommand*{\@@setdynamicframe}[2]{%
24311 \expandafter\expandafter\expandafter
24312 \@ff@getstaticpos\csname @df@dim@\romannumeral#1\endcsname
24313 \def\ff@frame{}\edef\ff@width{\the\@ff@tmp@x}%
24314 \edef\ff@height{\the\@ff@tmp@y}\def\ff@style{}\def\ff@frametype{}%
24315 \def\ff@x{}\def\ff@y{}\def\ff@col{}\def\ff@txtcol{}\def\ff@backcol{}%
24316 \def\ff@clear{}\def\ff@margin{}\def\ff@offset{}\def\ff@pages{}%
24317 \def\ff@label{}\def\ff@evenx{}\def\ff@eveny{}%
24318 \def\ff@oddx{}\def\ff@oddy{}\def\ff@angle{}%
24319 \def\ff@hide{}\def\ff@hidethis{}%
24320 \let\ff@shape\undefined
24321 \let\ff@xpages\undefined
24322 \setkeys{flowframe}{#2}%
24323 \ifdefempty{\ff@frame}%
24324 {}%
24325 {%
24326 \setboolean{dynamicframe\romannumeral#1}{\ff@frame}%
24327 }%
24328 \ifdefempty{\ff@x}%
24329 {}%
24330 {%
24331 \expandafter\global\expandafter\setlength
24332 \csname @df@\romannumeral#1@posx\endcsname{\ff@x}%
24333 \expandafter\global\expandafter\setlength
24334 \csname @df@\romannumeral#1@evenx\endcsname{\ff@x}%
24335 }%
24336 \ifdefempty{\ff@y}%
24337 {}%
24338 {%
24339 \expandafter\global\expandafter\setlength
24340 \csname @df@\romannumeral#1@posy\endcsname{\ff@y}%
24341 \expandafter\global\expandafter\setlength
24342 \csname @df@\romannumeral#1@eveny\endcsname{\ff@y}%
24343 }%
24344 \ifdefempty{\ff@evenx}%
24345 {}%
24346 {%
24347 \expandafter\global\expandafter\setlength
24348 \csname @df@\romannumeral#1@evenx\endcsname{\ff@evenx}%
24349 }%
24350 \ifdefempty{\ff@eveny}%
24351 {}%
24352 {%
24353 \expandafter\global\expandafter\setlength
24354 \csname @df@\romannumeral#1@eveny\endcsname{\ff@eveny}%
24355 }%
24356 \ifdefempty{\ff@oddx}%
24357 {}%
24358 {%
24359 \expandafter\global\expandafter\setlength
24360 \csname @df@\romannumeral#1@posx\endcsname{\ff@oddx}%
24361 }%
24362 \ifdefempty{\ff@oddy}%
24363 {}%
24364 {%
24365 \expandafter\global\expandafter\setlength
24366 \csname @df@\romannumeral#1@posy\endcsname{\ff@oddy}%
24367 }%
24368 \expandafter\xdef\csname @df@dim@\romannumeral#1\endcsname{%
24369 [c][\ff@height][\ff@valign]{\ff@width}%
24370 }%
24371 \ifdefempty{\ff@label}%
24372 {}%
24373 {%
24374 \@s@tdynamicframeid{#1}[\ff@label]%
24375 }%
24376 \ifdefempty{\ff@frametype}%
24377 {}%
24378 {%
24379 \expandafter
24380 \xdef\csname @df@frametype@\romannumeral#1\endcsname{%
24381 \ff@frametype
24382 }%
24383 }%
24384 \ifdefempty{\ff@col}%
24385 {}%
24386 {%
24387 \expandafter\@setframecol\ff@col\end{#1}{col}{df}%
24388 }%
24389 \ifdefempty{\ff@txtcol}%
24390 {}%
24391 {%
24392 \expandafter\@setframecol\ff@txtcol\end{#1}{txtcol}{df}%
24393 }%
24394 \ifdefempty{\ff@backcol}%
24395 {}%
24396 {%
24397 \expandafter\@setframecol\ff@backcol\end{#1}{backcol}{df}%
24398 }%
24399 \ifdefempty{\ff@offset}%
24400 {}%
24401 {%
24402 \expandafter
24403 \xdef\csname @df@offset@\romannumeral#1\endcsname{\ff@offset}%
24404 }%
24405 \ifdefempty{\ff@angle}%
24406 {}%
24407 {%
24408 \expandafter
24409 \xdef\csname @df@angle@\romannumeral#1\endcsname{\ff@angle}%
24410 }%
24411 \ifundef{\ff@shape}{}%
24412 {%
24413 \expandafter\global\expandafter
24414 \let\csname @df@shape@\romannumeral#1\endcsname\ff@shape
24415 }%
24416 \ifdefempty{\ff@pages}%
24417 {}%
24418 {%
24419 \dynamicsetpagelist{#1}{\ff@pages}%
24420 }%
24421 \ifundef{\ff@xpages}{}%
24422 {%
24423 \dynamicsetexclusion{#1}{\ff@xpages}%
24424 }%
24425 \ifdefempty{\ff@style}%
24426 {}%
24427 {%
24428 \ifcsundef{\ff@style}%
24429 {%
24430 \PackageError{flowfram}%
24431 {Unknown style '\ff@style'}%
24432 {%
24433 The command \expandafter\@gobble\string\\\ff@style
24434 \space has not been defined%
24435 }%
24436 }%
24437 {%
24438 \expandafter
24439 \xdef\csname @df@style@\romannumeral#1\endcsname{\ff@style}%
24440 }%
24441 }%
24442 \ifdefempty{\ff@clear}%
24443 {}%
24444 {%
24445 \setboolean{@df@clear@\romannumeral#1}{\ff@clear}%
24446 }%
24447 \ifdefempty{\ff@margin}%
24448 {}%
24449 {%
24450 \PackageError{flowfram}%
24451 {%
24452 Key 'margin' not available for dynamic frames%
24453 }%
24454 {dynamic frames don't have marginal notes}%
24455 }%
24456 \ifdefempty{\ff@hide}{}%
24457 {%
24458 \setboolean{@df@hide@\romannumeral#1}{\ff@hide}%
24459 }%
24460 \ifdefempty{\ff@hidethis}{}%
24461 {%
24462 \global\csletcs{if@df@hidethis@\romannumeral#1}{if\ff@hidethis}%
24463 }%
24464 }
24465 \newcommand*{\dynamicsetpagelist}[2]{%
24466 \expandafter
24467 \xdef\csname @df@pages@\romannumeral#1\endcsname{#2}%
24468 \flf@message{Setting page range for dynamic frame
24469 \number#1\space\space to "#2"}%
24470 }
24471 \newcommand*{\dynamicsetexclusion}[2]{%
24472 \expandafter
24473 \xdef\csname @df@xpages@\romannumeral#1\endcsname{#2}%
24474 \flf@message{Setting exclusion for dynamic frame
24475 \number#1\space\space to "#2"}%
24476 }
24477 \newcommand*{\dynamicaddexclusion}[2]{%
24478 \ifcsempty{@df@xpages@\romannumeral#1}
24479 {%
24480 \expandafter
24481 \xdef\csname @df@xpages@\romannumeral#1\endcsname{#2}%
24482 }%
24483 {%
24484 \expandafter
24485 \xdef\csname @df@xpages@\romannumeral#1\endcsname{%
24486 \csname @df@xpages@\romannumeral#1\endcsname,#2}%
24487 }%
24488 \flf@message{Setting exclusion for dynamic frame
24489 \number#1\space\space to
24490 "\csname @df@xpages@\romannumeral#1\endcsname"}%
24491 }
24492 \newcommand*{\@@dynamicframeswapcoords}[1]{%
24493 \setlength{\@ff@tmp@x}%
24494 {\csname @df@\romannumeral#1@evenx\endcsname}%
24495 \expandafter\setlength
24496 \csname @df@\romannumeral#1@evenx\endcsname
24497 {\csname @df@\romannumeral#1@posx\endcsname}%
24498 \expandafter\setlength
24499 \csname @df@\romannumeral#1@posx\endcsname{\@ff@tmp@x}%
24500 \setlength{\@ff@tmp@y}%
24501 {\csname @df@\romannumeral#1@eveny\endcsname}%
24502 \expandafter\setlength
24503 \csname @df@\romannumeral#1@eveny\endcsname
24504 {\csname @df@\romannumeral#1@posy\endcsname}%
24505 \expandafter\setlength\csname @df@\romannumeral#1@posy\endcsname
24506 {\@ff@tmp@y}%
24507 }
24508 \newcommand*{\dfswapoddeven}{%
24509 \@ifstar\@sdynamicframeswapcoords\@dynamicframeswapcoords}
24510 \newcommand*{\@sdynamicframeswapcoords}[1]{%
24511 \@for\@ff@id:=#1\do{%
24512 \@dynamicframeid{\@ff@id}%
24513 \@@dynamicframeswapcoords{\ff@id}}%
24514 }
24515 \newcommand*{\@dynamicframeswapcoords}[1]{%
24516 \ifthenelse{\equal{#1}{all}}%
24517 {%
24518 \ff@id=0\relax
24519 \whiledo{\ff@id<\c@maxflow}%
24520 {%
24521 \advance\ff@id by 1\relax
24522 \@@dynamicframeswapcoords{\ff@id}%
24523 }%
24524 }%
24525 {%
24526 \ifthenelse{\equal{#1}{odd} \TE@or \equal{#1}{even}}%
24527 {%
24528 \ifthenelse{\equal{#1}{odd}}%
24529 {\@colN=1}%
24530 {\@colN=2}%
24531 \whiledo{\@colN<\c@maxflow\TE@or\@colN=\c@maxflow}%
24532 {%
24533 \@@dynamicframeswapcoords{\@colN}%
24534 \advance\@colN by 2\relax
24535 }%
24536 }%
24537 {%
24538 \@for\@ff@id:=#1\do{%
24539 \def\@ff@numstart{0}%
24540 \def\@ff@numend{10000}%
24541 \@ff@getrange{\@ff@id}%
24542 \ifnum\@ff@numstart=0\relax
24543 \def\@ff@numstart{1}%
24544 \fi
24545 \ifnum\@ff@numend>\c@maxflow
24546 \def\@ff@numend{\c@maxflow}%
24547 \fi
24548 \@colN=\@ff@numstart
24549 \whiledo{\@colN<\@ff@numend \TE@or \@colN=\@ff@numend}%
24550 {%
24551 \@@dynamicframeswapcoords{\@colN}%
24552 \advance\@colN by 1\relax
24553 }%
24554 }%
24555 }%
24556 }%
24557 }
24558 \newenvironment{dynamiccontents}[1]{%
24559 \def\@flf@{dynamiccontents}%
24560 \xdynamiccontents{#1}}{%
24561 \endxdynamiccontents
24562 }
24563 \newtoks\@dynamictok
24564 \def\xdynamiccontents#1{%
24565 \def\@flf@idn{#1}%
24566 \@dynamictok{}\@flf@get@body
24567 }
24568 \long\def\@flf@get@body#1\end{%
24569 \@flf@checkcontinued#1\continueonframe\@nil
24570 \ifdfcontinued
24571 \expandafter\flf@ta\expandafter{\@flf@tmpa}%
24572 \edef\@flf@tmp{\the\@dynamictok\the\flf@ta}%
24573 \@dynamictok\expandafter{\@flf@tmp}%
24574 \else
24575 \@dynamictok\expandafter{\the\@dynamictok#1}%
24576 \fi
24577 \@flf@find@end
24578 }
24579 \newif\ifdfcontinued
24580 \long\def\@flf@checkcontinued#1\continueonframe#2\@nil{%
24581 \long\def\@flf@tmpa{#1}\long\def\@flf@tmpb{#2}%
24582 \ifx\@flf@tmpb\@lempty
24583 \dfcontinuedfalse
24584 \else
24585 \dfcontinuedtrue
24586 \flf@getcontargs#2\@ff@text\@ff@nextid\@ff@rest
24587 \fi
24588 }
24589 \long\def\@lempty{}
24590 \def\flf@getcontargs{%
24591 \@ifnextchar[{\@flf@getcontargs}{\@flf@getcontargs[]}%
24592 }
24593 \long\def\@flf@getcontargs[#1]#2#3\continueonframe#4#5#6{%
24594 \def#4{#1}\def#5{#2}\def#6{#3}%
24595 }
24596 \def\@flf@find@end#1{%
24597 \def\@tempa{#1}%
24598 \global\let\flf@next=\relax
24599 \ifdfcontinued
24600 \@dynamictok\expandafter
24601 {\the\@dynamictok\ffcontinuedtextlayout}%
24602 \protected@edef\@tmpa{\the\@dynamictok{\@ff@text}}%
24603 \@dynamictok\expandafter{\@tmpa}%
24604 \toks@\expandafter{\@ff@rest}%
24605 \edef\flf@next{\noexpand\@flf@get@body\noexpand\end{#1}%
24606 \noexpand\begin{#1}{\@ff@nextid}\noexpand\par
24607 \noexpand\noindent\noexpand\ignorespaces
24608 \the\toks@\noexpand\end{#1}}%
24609 \else
24610 \ifx\@tempa\@flf@
24611 \let\flf@next=\@flf@endxdynamiccontents
24612 \else
24613 \@dynamictok\expandafter
24614 {\the\@dynamictok\end{#1}}%
24615 \let\flf@next=\@flf@get@body
24616 \fi
24617 \fi
24618 \flf@next
24619 }
24620 \let\endxdynamiccontents\relax
24621 \def\@flf@endxdynamiccontents{%
24622 \ifnum\@flf@idn>\c@maxdynamic
24623 \PackageError{flowfram}%
24624 {Dynamic frame \number\@flf@idn\ does not exist}%
24625 {%
24626 You have specified dynamic frame number \number\@flf@idn,
24627 but there are only \number\c@maxdynamic\space dynamic
24628 frames currently defined%
24629 }%
24630 \else
24631 \expandafter
24632 \xdef\csname @dynamicframe@\romannumeral\@flf@idn\endcsname{%
24633 \the\@dynamictok}%
24634 \expandafter
24635 \fi
24636 \expandafter\end\expandafter{\@flf@}%
24637 }
24638 \newenvironment{dynamiccontents*}[1]{%
24639 \def\@flf@{dynamiccontents*}%
24640 \@dynamicframeid{#1}%
24641 \xdynamiccontents{\ff@id}}{%
24642 \enddynamiccontents
24643 }
24644 \newcommand{\setdynamiccontents}{%
24645 \@ifstar\@ssetdynamiccontents\@setdynamiccontents
24646 }
24647 \newcommand{\@ssetdynamiccontents}[2]{%
24648 \@dynamicframeid{#1}\@setdynamiccontents{\ff@id}{#2}%
24649 }
24650 \newcommand{\@setdynamiccontents}[2]{%
24651 \ifnum#1>\c@maxdynamic
24652 \PackageError{flowfram}%
24653 {Dynamic frame \number#1\ does not exist}%
24654 {%
24655 You have specified dynamic frame number \number#1, but there are
24656 only \number\c@maxdynamic\space dynamic frames currently defined%
24657 }%
24658 \else
24659 \expandafter
24660 \gdef\csname @dynamicframe@\romannumeral#1\endcsname{#2}%
24661 \fi
24662 }
24663 \newcommand{\appenddynamiccontents}{%
24664 \@ifstar\@sappenddynamic\@appenddynamic
24665 }
24666 \newcommand{\@sappenddynamic}[2]{%
24667 \@dynamicframeid{#1}\@appenddynamic{\ff@id}{#2}%
24668 }
24669 \newcommand{\@appenddynamic}[2]{%
24670 \ifnum#1>\c@maxdynamic
24671 \PackageError{flowfram}%
24672 {Dynamic frame \number#1 does not exist}%
24673 {%
24674 You have specified dynamic frame number \number#1,
24675 but there are only
24676 \number\c@maxdynamic\space dynamic frames currently defined%
24677 }%
24678 \else
24679 \expandafter\@ff@addtolist
24680 \csname @dynamicframe@\romannumeral#1\endcsname\entry{#2}%
24681 \fi
24682 }
24683 \newtoks\flf@ta \newtoks\flf@tb
24684 \long\def\@ff@addtolist#1\entry#2{%
24685 \flf@ta={{#2}}%
24686 \flf@tb=\expandafter{#1}%
24687 \xdef#1{\the\flf@tb\the\flf@ta}%
24688 }
24689 \newcommand{\continueonframe}{%
24690 \PackageError{flowfram}%
24691 {%
24692 Can't continue to new frame: not in static or dynamic frame%
24693 }%
24694 {%
24695 \string\continueonframe\space may only
24696 be used inside `staticcontents' or `dynamiccontents'
24697 environments (or their starred versions)%
24698 }%
24699 }
24700 \newcommand*{\@staticscontinueonframe}[2][]{%
24701 \ffcontinuedtextlayout{#1}%
24702 \end{staticcontents*}%
24703 \begin{staticcontents*}{#2}\par\noindent\ignorespaces
24704 }
24705 \newcommand*{\@staticcontinueonframe}[2][]{%
24706 \ffcontinuedtextlayout{#1}%
24707 \end{staticcontents}%
24708 \begin{staticcontents}{#2}\par\noindent\ignorespaces
24709 }
24710 \newcommand{\ffcontinuedtextlayout}[1]{%
24711 \parfillskip=0pt\par\hfill
24712 \ffcontinuedtextfont{#1}%
24713 }
24714 \newcommand*{\ffcontinuedtextfont}[1]{\emph{\small #1}}
24715 \newcommand*{\computeleftedgeodd}[1]{%
24716 \setlength{#1}{-1in}%
24717 \addtolength{#1}{-\hoffset}%
24718 \addtolength{#1}{-\oddsidemargin}%
24719 }
24720 \newcommand*{\computeleftedgeeven}[1]{%
24721 \setlength{#1}{-1in}%
24722 \addtolength{#1}{-\hoffset}%
24723 \addtolength{#1}{-\evensidemargin}%
24724 }
24725 \newcommand*{\computetopedge}[1]{%
24726 \setlength{#1}{\textheight}%
24727 \addtolength{#1}{\headheight}%
24728 \addtolength{#1}{\headsep}%
24729 \addtolength{#1}{1in}%
24730 \addtolength{#1}{\voffset}%
24731 \addtolength{#1}{\topmargin}%
24732 }
24733 \newcommand*{\computebottomedge}[1]{%
24734 \computetopedge{#1}%
24735 \addtolength{#1}{-\paperheight}%
24736 }
24737 \newcommand*{\computerightedgeodd}[1]{%
24738 \computeleftedgeodd{#1}%
24739 \addtolength{#1}{\paperwidth}%
24740 }
24741 \newcommand*{\computerightedgeeven}[1]{%
24742 \computeleftedgeeven{#1}%
24743 \addtolength{#1}{\paperwidth}%
24744 }
24745 \newlength\ffareawidth
24746 \newlength\ffareaheight
24747 \newlength\ffareax
24748 \newlength\ffareay
24749 \newlength\ffareaevenx
24750 \newlength\ffareaeveny
24751 \newcommand*{\computeflowframearea}{%
24752 \@ifstar\@scomputeffarea\@computeffarea
24753 }
24754 \newcommand*{\@scomputeffarea}[1]{%
24755 \setlength{\ffareax}{\paperwidth}%
24756 \setlength{\ffareay}{\paperheight}%
24757 \setlength{\@ff@tmp@x}{0pt}%
24758 \setlength{\@ff@tmp@y}{0pt}%
24759 \@for\@ff@id:=#1\do{%
24760 \@flowframeid{\@ff@id}%
24761 \ifnum\ffareax>\flowframex{\ff@id}%
24762 \setlength{\ffareax}{\flowframex{\ff@id}}%
24763 \fi
24764 \ifnum\ffareay>\flowframey{\ff@id}%
24765 \setlength{\ffareay}{\flowframey{\ff@id}}%
24766 \fi
24767 \setlength{\@ff@offset}{\flowframex{\ff@id}}%
24768 \addtolength{@ff@offset}{\flowframewidth{\ff@id}}%
24769 \ifnum\@ff@tmp@x<\@ff@offset
24770 \setlength{\@ff@tmp@x}{\@ff@offset}%
24771 \fi
24772 \setlength{\@ff@offset}{\flowframey{\ff@id}}%
24773 \addtolength{@ff@offset}{\flowframeheight{\ff@id}}%
24774 \ifnum\@ff@tmp@y<\@ff@offset
24775 \setlength{\@ff@tmp@y}{\@ff@offset}%
24776 \fi
24777 }%
24778 \setlength{\ffareawidth}{\@ff@tmp@x}%
24779 \addtolength{\ffareawidth}{-\ffareax}%
24780 \setlength{\ffareaheight}{\@ff@tmp@y}%
24781 \addtolength{\ffareaheight}{-\ffareay}%
24782 }
24783 \newcommand*{\@computeffarea}[1]{%
24784 \setlength{\ffareax}{\paperwidth}%
24785 \setlength{\ffareay}{\paperheight}%
24786 \setlength{\@ff@tmp@x}{0pt}%
24787 \setlength{\@ff@tmp@y}{0pt}%
24788 \@for\@ff@id:=#1\do{%
24789 \ff@id=\@ff@id\relax
24790 \setlength{\@ff@offset}{\flowframex{\ff@id}}%
24791 \ifdim\ffareax>\@ff@offset
24792 \setlength{\ffareax}{\@ff@offset}%
24793 \fi
24794 \setlength{\@ff@offset}{\flowframey{\ff@id}}%
24795 \ifdim\ffareay>\@ff@offset
24796 \setlength{\ffareay}{\@ff@offset}%
24797 \fi
24798 \setlength{\@ff@offset}{\flowframex{\ff@id}}%
24799 \addtolength{\@ff@offset}{\flowframewidth{\ff@id}}%
24800 \ifdim\@ff@tmp@x<\@ff@offset
24801 \setlength{\@ff@tmp@x}{\@ff@offset}%
24802 \fi
24803 \setlength{\@ff@offset}{\flowframey{\ff@id}}%
24804 \addtolength{\@ff@offset}{\flowframeheight{\ff@id}}%
24805 \ifdim\@ff@tmp@y<\@ff@offset
24806 \setlength{\@ff@tmp@y}{\@ff@offset}%
24807 \fi
24808 }%
24809 \setlength{\ffareawidth}{\@ff@tmp@x}%
24810 \addtolength{\ffareawidth}{-\ffareax}%
24811 \setlength{\ffareaheight}{\@ff@tmp@y}%
24812 \addtolength{\ffareaheight}{-\ffareay}%
24813 }
24814 \newcommand*{\@ff@swaplen}[2]{%
24815 \setlength{\@ff@tmp@x}{#1}%
24816 \setlength{#1}{#2}%
24817 \setlength{#2}{\@ff@tmp@x}%
24818 }
24819 \newcommand*{\@ff@getdim}[2]{%
24820 \ifnum#2<1\relax
24821 \PackageError{flowfram}%
24822 {Frame IDNs start from 1}%
24823 {%
24824 You have specified a frame IDN of '\number#2'%
24825 }%
24826 \fi
24827 \ifcase#1\relax
24828 \PackageError{flowfram}%
24829 {Unknown frame ID type '#1'}%
24830 {%
24831 Frame ID types are: 1 (flow), 2 (static) and 3 (dynamic)%
24832 }%
24833 \or
24834 \ifnum#2>\c@maxflow\relax
24835 \PackageError{flowfram}{Invalid flow frame IDN '\number#2'}{%
24836 Flow frame IDNs go from 1 to \number\c@maxflow}%
24837 \else
24838 \setlength{\ffareax}{\flowframex{#2}}%
24839 \setlength{\ffareay}{\flowframey{#2}}%
24840 \setlength{\ffareaevenx}{\flowframeevenx{#2}}%
24841 \setlength{\ffareaeveny}{\flowframeeveny{#2}}%
24842 \setlength{\ffareawidth}{\flowframewidth{#2}}%
24843 \setlength{\ffareaheight}{\flowframeheight{#2}}%
24844 \fi
24845 \or
24846 \ifnum#2>\c@maxstatic\relax
24847 \PackageError{flowfram}%
24848 {Invalid static frame IDN '\number#2'}%
24849 {%
24850 Static frame IDNs go from 1 to \number\c@maxstatic
24851 }%
24852 \else
24853 \setlength{\ffareax}{\staticframex{#2}}%
24854 \setlength{\ffareay}{\staticframey{#2}}%
24855 \setlength{\ffareaevenx}{\staticframeevenx{#2}}%
24856 \setlength{\ffareaeveny}{\staticframeeveny{#2}}%
24857 \expandafter\expandafter\expandafter
24858 \@ff@getstaticpos
24859 \csname @sf@dim@\romannumeral#2\endcsname
24860 \setlength{\ffareawidth}{\@ff@tmp@x}%
24861 \setlength{\ffareaheight}{\@ff@tmp@y}%
24862 \fi
24863 \or
24864 \ifnum#2>\c@maxdynamic\relax
24865 \PackageError{flowfram}%
24866 {Invalid dynamic frame IDN '\number#2'}%
24867 {%
24868 Dynamic frame IDNs go from 1 to \number\c@maxdynamic
24869 }%
24870 \else
24871 \setlength{\ffareax}{\dynamicframex{#2}}%
24872 \setlength{\ffareay}{\dynamicframey{#2}}%
24873 \setlength{\ffareaevenx}{\dynamicframeevenx{#2}}%
24874 \setlength{\ffareaeveny}{\dynamicframeeveny{#2}}%
24875 \expandafter\expandafter\expandafter
24876 \@ff@getstaticpos
24877 \csname @df@dim@\romannumeral#2\endcsname
24878 \setlength{\ffareawidth}{\@ff@tmp@x}%
24879 \setlength{\ffareaheight}{\@ff@tmp@y}%
24880 \fi
24881 \else
24882 \PackageError{flowfram}%
24883 {Unknown frame ID type '#1'}%
24884 {%
24885 Frame ID types are: 1 (flow), 2 (static) and 3 (dynamic)%
24886 }%
24887 \fi
24888 }
24889 \newcommand*{\@ff@getevendim}[2]{%
24890 \ifnum#2<1\relax
24891 \PackageError{flowfram}%
24892 {Frame IDNs start from 1}%
24893 {%
24894 You have specified a frame IDN of '\number#2'%
24895 }%
24896 \fi
24897 \ifcase#1\relax
24898 \PackageError{flowfram}%
24899 {Unknown frame ID type '#1'}%
24900 {%
24901 Frame ID types are: 1 (flow), 2 (static) and 3 (dynamic)%
24902 }
24903 \or
24904 \ifnum#2>\c@maxflow
24905 \PackageError{flowfram}%
24906 {Invalid flow frame IDN '\number#2'}%
24907 {%
24908 Flow frame IDNs go from 1 to \number\c@maxflow
24909 }%
24910 \else
24911 \setlength{\ffareax}{\flowframeevenx{#2}}%
24912 \setlength{\ffareay}{\flowframeeveny{#2}}%
24913 \setlength{\ffareawidth}{\flowframewidth{#2}}%
24914 \setlength{\ffareaheight}{\flowframeheight{#2}}%
24915 \fi
24916 \or
24917 \ifnum#2>\c@maxstatic\relax
24918 \PackageError{flowfram}%
24919 {Invalid static frame IDN '\number#2'}%
24920 {%
24921 Static frame IDNs go from 1 to \number\c@maxstatic
24922 }%
24923 \else
24924 \setlength{\ffareax}{\staticframeevenx{#2}}%
24925 \setlength{\ffareay}{\staticframeeveny{#2}}%
24926 \expandafter\expandafter\expandafter
24927 \@ff@getstaticpos
24928 \csname @sf@dim@\romannumeral#2\endcsname
24929 \setlength{\ffareawidth}{\@ff@tmp@x}%
24930 \setlength{\ffareaheight}{\@ff@tmp@y}%
24931 \fi
24932 \or
24933 \ifnum#2>\c@maxdynamic\relax
24934 \PackageError{flowfram}%
24935 {Invalid dynamic frame IDN '\number#2'}%
24936 {%
24937 Dynamic frame IDNs go from 1 to \number\c@maxdynamic
24938 }%
24939 \else
24940 \setlength{\ffareax}{\dynamicframeevenx{#2}}%
24941 \setlength{\ffareay}{\dynamicframeeveny{#2}}%
24942 \expandafter\expandafter\expandafter
24943 \@ff@getstaticpos
24944 \csname @df@dim@\romannumeral#2\endcsname
24945 \setlength{\ffareawidth}{\@ff@tmp@x}%
24946 \setlength{\ffareaheight}{\@ff@tmp@y}%
24947 \fi
24948 \else
24949 \PackageError{flowfram}%
24950 {Unknown frame ID type '#1'}%
24951 {%
24952 Frame ID types are: 1 (flow), 2 (static) and 3 (dynamic)%
24953 }%
24954 \fi
24955 }
24956 \newcommand*{\getstaticbounds}{%
24957 \@ifstar\@sgetstaticbounds\@getstaticbounds
24958 }
24959 \newcommand*{\@sgetstaticbounds}[1]{%
24960 \@staticframeid{#1}\@getstaticbounds{\ff@id}%
24961 }
24962 \newcommand*{\@getstaticbounds}[1]{\@ff@getdim{2}{#1}}
24963 \newcommand*{\getstaticevenbounds}{%
24964 \@ifstar\@sgetstaticevenbounds\@getstaticevenbounds
24965 }
24966 \newcommand*{\@sgetstaticevenbounds}[1]{%
24967 \@staticframeid{#1}\@getstaticevenbounds{\ff@id}%
24968 }
24969 \newcommand*{\@getstaticevenbounds}[1]{\@ff@getevendim{2}{#1}}
24970 \newcommand*{\getflowbounds}{%
24971 \@ifstar\@sgetflowbounds\@getflowbounds
24972 }
24973 \newcommand*{\@sgetflowbounds}[1]{%
24974 \@flowframeid{#1}\@getflowbounds{\ff@id}%
24975 }
24976 \newcommand*{\@getflowbounds}[1]{\@ff@getdim{1}{#1}}
24977 \newcommand*{\getflowevenbounds}{%
24978 \@ifstar\@sgetflowevenbounds\@getflowevenbounds
24979 }
24980 \newcommand*{\@sgetflowevenbounds}[1]{%
24981 \@flowframeid{#1}\@getflowevenbounds{\ff@id}%
24982 }
24983 \newcommand*{\@getflowevenbounds}[1]{\@ff@getevendim{1}{#1}}
24984 \newcommand*{\getdynamicbounds}{%
24985 \@ifstar\@sgetdynamicbounds\@getdynamicbounds
24986 }
24987 \newcommand*{\@sgetdynamicbounds}[1]{%
24988 \@dynamicframeid{#1}\@getdynamicbounds{\ff@id}%
24989 }
24990 \newcommand*{\@getdynamicbounds}[1]{\@ff@getdim{3}{#1}}
24991 \newcommand*{\getdynamicevenbounds}{%
24992 \@ifstar\@sgetdynamicevenbounds\@getdynamicevenbounds
24993 }
24994 \newcommand*{\@sgetdynamicevenbounds}[1]{%
24995 \@dynamicframeid{#1}\@getdynamicevenbounds{\ff@id}%
24996 }
24997 \newcommand*{\@getdynamicevenbounds}[1]{\@ff@getevendim{3}{#1}}
24998 \newif\ifFLFabove
24999 \newif\ifFLFbelow
25000 \newif\ifFLFleft
25001 \newif\ifFLFright
25002 \newcommand*{\checkifframeabove}{%
25003 \@ifstar\@scheckifframeabove\@checkifframeabove
25004 }
25005 \newcommand*{\@scheckifframeabove}[4]{%
25006 \ifodd\c@page
25007 \@soddcheckifframeabove{#1}{#2}{#3}{#4}%
25008 \else
25009 \@sevencheckifframeabove{#1}{#2}{#3}{#4}%
25010 \fi
25011 }
25012 \newcommand*{\@checkifframeabove}[4]{%
25013 \ifodd\c@page
25014 \@oddcheckifframeabove{#1}{#2}{#3}{#4}%
25015 \else
25016 \@evencheckifframeabove{#1}{#2}{#3}{#4}%
25017 \fi
25018 }
25019 \newcommand*{\oddcheckifframeabove}{%
25020 \@ifstar\@soddcheckifframeabove\@oddcheckifframeabove
25021 }
25022 \newcommand*{\@soddcheckifframeabove}[4]{%
25023 \@ifundefined{@sget#1bounds}%
25024 {%
25025 \PackageError{flowfram}%
25026 {Unknown frame type `#1'}%
25027 {%
25028 Frame types may only be one of: static, dynamic or flow%
25029 }%
25030 }%
25031 {}%
25032 \csname @sget#1bounds\endcsname{#2}%
25033 \edef\@ff@check{\the\ffareay}%
25034 \@ifundefined{@sget#3bounds}%
25035 {%
25036 \PackageError{flowfram}%
25037 {Unknown frame type `#3'}%
25038 {%
25039 Frame types may only be one of: static, dynamic or flow%
25040 }%
25041 }%
25042 {}%
25043 \csname @sget#3bounds\endcsname{#4}%
25044 \advance\ffareay by \ffareaheight\relax
25045 \expandafter\ifdim\@ff@check>\ffareay
25046 \FLFabovetrue
25047 \else
25048 \FLFabovefalse
25049 \fi
25050 }
25051 \newcommand*{\@oddcheckifframeabove}[4]{%
25052 \@ifundefined{@get#1bounds}%
25053 {%
25054 \PackageError{flowfram}%
25055 {Unknown frame type `#1'}%
25056 {%
25057 Frame types may only be one of: static, dynamic or
25058 flow%
25059 }%
25060 }%
25061 {}%
25062 \csname @get#1bounds\endcsname{#2}%
25063 \edef\@ff@check{\the\ffareay}%
25064 \@ifundefined{@get#3bounds}%
25065 {%
25066 \PackageError{flowfram}%
25067 {Unknown frame type `#3'}%
25068 {%
25069 Frame types may only be one of: static, dynamic or
25070 flow%
25071 }%
25072 }%
25073 {}%
25074 \csname @get#3bounds\endcsname{#4}%
25075 \advance\ffareay by \ffareaheight\relax
25076 \expandafter\ifdim\@ff@check>\ffareay
25077 \FLFabovetrue
25078 \else
25079 \FLFabovefalse
25080 \fi
25081 }
25082 \newcommand*{\checkifframebelow}{%
25083 \@ifstar\@scheckifframebelow\@checkifframebelow
25084 }
25085 \newcommand*{\@scheckifframebelow}[4]{%
25086 \ifodd\c@page
25087 \@soddcheckifframebelow{#1}{#2}{#3}{#4}%
25088 \else
25089 \@sevencheckifframebelow{#1}{#2}{#3}{#4}%
25090 \fi
25091 }
25092 \newcommand*{\@checkifframebelow}[4]{%
25093 \ifodd\c@page
25094 \@oddcheckifframebelow{#1}{#2}{#3}{#4}%
25095 \else
25096 \@evencheckifframebelow{#1}{#2}{#3}{#4}%
25097 \fi
25098 }
25099 \newcommand*{\oddcheckifframebelow}{%
25100 \@ifstar\@soddcheckifframebelow\@oddcheckifframebelow
25101 }
25102 \newcommand*{\@soddcheckifframebelow}[4]{%
25103 \@ifundefined{@sget#1bounds}%
25104 {%
25105 \PackageError{flowfram}%
25106 {Unknown frame type `#1'}%
25107 {%
25108 Frame types may only be one of: static, dynamic or
25109 flow%
25110 }%
25111 }%
25112 {}%
25113 \csname @sget#1bounds\endcsname{#2}%
25114 \advance\ffareay by \ffareaheight\relax
25115 \edef\@ff@check{\the\ffareay}%
25116 \@ifundefined{@sget#3bounds}%
25117 {%
25118 \PackageError{flowfram}%
25119 {Unknown frame type `#3'}%
25120 {%
25121 Frame types may only be one of: static, dynamic or
25122 flow%
25123 }%
25124 }%
25125 {}%
25126 \csname @sget#3bounds\endcsname{#4}%
25127 \expandafter\ifdim\@ff@check<\ffareay
25128 \FLFbelowtrue
25129 \else
25130 \FLFbelowfalse
25131 \fi
25132 }
25133 \newcommand*{\@oddcheckifframebelow}[4]{%
25134 \@ifundefined{@get#1bounds}%
25135 {%
25136 \PackageError{flowfram}%
25137 {Unknown frame type `#1'}%
25138 {%
25139 Frame types may only be one of: static, dynamic or
25140 flow%
25141 }%
25142 }%
25143 {}%
25144 \csname @get#1bounds\endcsname{#2}%
25145 \advance\ffareay by \ffareaheight\relax
25146 \edef\@ff@check{\the\ffareay}%
25147 \@ifundefined{@get#3bounds}%
25148 {%
25149 \PackageError{flowfram}%
25150 {Unknown frame type `#3'}%
25151 {%
25152 Frame types may only be one of: static, dynamic or
25153 flow%
25154 }%
25155 }%
25156 {}%
25157 \csname @get#3bounds\endcsname{#4}%
25158 \expandafter\ifdim\@ff@check<\ffareay
25159 \FLFbelowtrue
25160 \else
25161 \FLFbelowfalse
25162 \fi
25163 }
25164 \newcommand*{\checkifframeleft}{%
25165 \@ifstar\@scheckifframeleft\@checkifframeleft
25166 }
25167 \newcommand*{\@scheckifframeleft}[4]{%
25168 \ifodd\c@page
25169 \@soddcheckifframeleft{#1}{#2}{#3}{#4}%
25170 \else
25171 \@sevencheckifframeleft{#1}{#2}{#3}{#4}%
25172 \fi
25173 }
25174 \newcommand*{\@checkifframeleft}[4]{%
25175 \ifodd\c@page
25176 \@oddcheckifframeleft{#1}{#2}{#3}{#4}%
25177 \else
25178 \@evencheckifframeleft{#1}{#2}{#3}{#4}%
25179 \fi
25180 }
25181 \newcommand*{\oddcheckifframeleft}{%
25182 \@ifstar\@soddcheckifframeleft\@oddcheckifframeleft
25183 }
25184 \newcommand*{\@soddcheckifframeleft}[4]{%
25185 \@ifundefined{@sget#1bounds}%
25186 {%
25187 \PackageError{flowfram}%
25188 {Unknown frame type `#1'}%
25189 {%
25190 Frame types may only be one of: static, dynamic or
25191 flow%
25192 }%
25193 }%
25194 {}%
25195 \csname @sget#1bounds\endcsname{#2}%
25196 \advance\ffareax by \ffareawidth\relax
25197 \edef\@ff@check{\the\ffareax}%
25198 \@ifundefined{@sget#3bounds}%
25199 {%
25200 \PackageError{flowfram}%
25201 {Unknown frame type `#3'}%
25202 {%
25203 Frame types may only be one of: static, dynamic or
25204 flow%
25205 }%
25206 }%
25207 {}%
25208 \csname @sget#3bounds\endcsname{#4}%
25209 \expandafter\ifdim\@ff@check<\ffareax
25210 \FLFlefttrue
25211 \else
25212 \FLFleftfalse
25213 \fi
25214 }
25215 \newcommand*{\@oddcheckifframeleft}[4]{%
25216 \@ifundefined{@get#1bounds}%
25217 {%
25218 \PackageError{flowfram}%
25219 {Unknown frame type `#1'}%
25220 {%
25221 Frame types may only be one of: static, dynamic or
25222 flow%
25223 }%
25224 }%
25225 {}%
25226 \csname @get#1bounds\endcsname{#2}%
25227 \advance\ffareax by \ffareawidth\relax
25228 \edef\@ff@check{\the\ffareax}%
25229 \@ifundefined{@get#3bounds}%
25230 {%
25231 \PackageError{flowfram}%
25232 {Unknown frame type `#3'}%
25233 {%
25234 Frame types may only be one of: static, dynamic or
25235 flow%
25236 }%
25237 }%
25238 {}%
25239 \csname @get#3bounds\endcsname{#4}%
25240 \expandafter\ifdim\@ff@check<\ffareax
25241 \FLFlefttrue
25242 \else
25243 \FLFleftfalse
25244 \fi
25245 }
25246 \newcommand*{\checkifframeright}{%
25247 \@ifstar\@scheckifframeright\@checkifframeright
25248 }
25249 \newcommand*{\@scheckifframeright}[4]{%
25250 \ifodd\c@page
25251 \@soddcheckifframeright{#1}{#2}{#3}{#4}%
25252 \else
25253 \@sevencheckifframeright{#1}{#2}{#3}{#4}%
25254 \fi
25255 }
25256 \newcommand*{\@checkifframeright}[4]{%
25257 \ifodd\c@page
25258 \@oddcheckifframeright{#1}{#2}{#3}{#4}%
25259 \else
25260 \@evencheckifframeright{#1}{#2}{#3}{#4}%
25261 \fi
25262 }
25263 \newcommand*{\oddcheckifframeright}{%
25264 \@ifstar\@soddcheckifframeright\@oddcheckifframeright
25265 }
25266 \newcommand*{\@soddcheckifframeright}[4]{%
25267 \@ifundefined{@sget#1bounds}%
25268 {%
25269 \PackageError{flowfram}%
25270 {Unknown frame type `#1'}%
25271 {%
25272 Frame types may only be one of: static, dynamic or
25273 flow%
25274 }%
25275 }%
25276 {}%
25277 \csname @sget#1bounds\endcsname{#2}%
25278 \edef\@ff@check{\the\ffareax}%
25279 \@ifundefined{@sget#3bounds}%
25280 {%
25281 \PackageError{flowfram}%
25282 {Unknown frame type `#3'}%
25283 {%
25284 Frame types may only be one of: static, dynamic or
25285 flow%
25286 }%
25287 }%
25288 {}%
25289 \csname @sget#3bounds\endcsname{#4}%
25290 \advance\ffareax by \ffareawidth\relax
25291 \expandafter\ifdim\@ff@check>\ffareax
25292 \FLFrighttrue
25293 \else
25294 \FLFrightfalse
25295 \fi
25296 }
25297 \newcommand*{\@oddcheckifframeright}[4]{%
25298 \@ifundefined{@get#1bounds}%
25299 {%
25300 \PackageError{flowfram}%
25301 {Unknown frame type `#1'}%
25302 {%
25303 Frame types may only be one of: static, dynamic or
25304 flow%
25305 }%
25306 }%
25307 {}%
25308 \csname @get#1bounds\endcsname{#2}%
25309 \edef\@ff@check{\the\ffareax}%
25310 \@ifundefined{@get#3bounds}%
25311 {%
25312 \PackageError{flowfram}%
25313 {Unknown frame type `#3'}%
25314 {%
25315 Frame types may only be one of: static, dynamic or
25316 flow%
25317 }%
25318 }%
25319 {}%
25320 \csname @get#3bounds\endcsname{#4}%
25321 \advance\ffareax by \ffareawidth\relax
25322 \expandafter\ifdim\@ff@check>\ffareax
25323 \FLFrighttrue
25324 \else
25325 \FLFrightfalse
25326 \fi
25327 }
25328 \newcommand*{\evencheckifframeabove}{%
25329 \@ifstar\@sevencheckifframeabove\@evencheckifframeabove
25330 }
25331 \newcommand*{\@sevencheckifframeabove}[4]{%
25332 \@ifundefined{@sget#1evenbounds}%
25333 {%
25334 \PackageError{flowfram}%
25335 {Unknown frame type `#1'}%
25336 {%
25337 Frame types may only be one of: static, dynamic or
25338 flow%
25339 }%
25340 }%
25341 {}%
25342 \csname @sget#1evenbounds\endcsname{#2}%
25343 \edef\@ff@check{\the\ffareay}%
25344 \@ifundefined{@sget#3evenbounds}%
25345 {%
25346 \PackageError{flowfram}%
25347 {Unknown frame type `#3'}%
25348 {%
25349 Frame types may only be one of: static, dynamic or
25350 flow%
25351 }%
25352 }%
25353 {}%
25354 \csname @sget#3evenbounds\endcsname{#4}%
25355 \advance\ffareay by \ffareaheight\relax
25356 \expandafter\ifdim\@ff@check>\ffareay
25357 \FLFabovetrue
25358 \else
25359 \FLFabovefalse
25360 \fi
25361 }
25362 \newcommand*{\@evencheckifframeabove}[4]{%
25363 \@ifundefined{@get#1evenbounds}%
25364 {%
25365 \PackageError{flowfram}%
25366 {Unknown frame type `#1'}%
25367 {%
25368 Frame types may only be one of: static, dynamic or
25369 flow%
25370 }%
25371 }%
25372 {}%
25373 \csname @get#1evenbounds\endcsname{#2}%
25374 \edef\@ff@check{\the\ffareay}%
25375 \@ifundefined{@get#3evenbounds}%
25376 {%
25377 \PackageError{flowfram}%
25378 {Unknown frame type `#3'}%
25379 {%
25380 Frame types may only be one of: static, dynamic or
25381 flow%
25382 }%
25383 }%
25384 {}%
25385 \csname @get#3evenbounds\endcsname{#4}%
25386 \advance\ffareay by \ffareaheight\relax
25387 \expandafter\ifdim\@ff@check>\ffareay
25388 \FLFabovetrue
25389 \else
25390 \FLFabovefalse
25391 \fi
25392 }
25393 \newcommand*{\evencheckifframebelow}{%
25394 \@ifstar\@sevencheckifframebelow\@evencheckifframebelow
25395 }
25396 \newcommand*{\@sevencheckifframebelow}[4]{%
25397 \@ifundefined{@sget#1evenbounds}%
25398 {%
25399 \PackageError{flowfram}%
25400 {Unknown frame type `#1'}%
25401 {%
25402 Frame types may only be one of: static, dynamic or
25403 flow%
25404 }%
25405 }%
25406 {}%
25407 \csname @sget#1evenbounds\endcsname{#2}%
25408 \advance\ffareay by \ffareaheight\relax
25409 \edef\@ff@check{\the\ffareay}%
25410 \@ifundefined{@sget#3evenbounds}%
25411 {%
25412 \PackageError{flowfram}%
25413 {Unknown frame type `#3'}%
25414 {%
25415 Frame types may only be one of: static, dynamic or
25416 flow%
25417 }%
25418 }%
25419 {}%
25420 \csname @sget#3evenbounds\endcsname{#4}%
25421 \expandafter\ifdim\@ff@check<\ffareay
25422 \FLFbelowtrue
25423 \else
25424 \FLFbelowfalse
25425 \fi
25426 }
25427 \newcommand*{\@evencheckifframebelow}[4]{%
25428 \@ifundefined{@get#1evenbounds}%
25429 {%
25430 \PackageError{flowfram}%
25431 {Unknown frame type `#1'}%
25432 {%
25433 Frame types may only be one of: static, dynamic or
25434 flow%
25435 }%
25436 }{}%
25437 \csname @get#1evenbounds\endcsname{#2}%
25438 \advance\ffareay by \ffareaheight\relax
25439 \edef\@ff@check{\the\ffareay}%
25440 \@ifundefined{@get#3evenbounds}%
25441 {%
25442 \PackageError{flowfram}%
25443 {Unknown frame type `#3'}%
25444 {%
25445 Frame types may only be one of: static, dynamic or
25446 flow%
25447 }%
25448 }%
25449 {}%
25450 \csname @get#3evenbounds\endcsname{#4}%
25451 \expandafter\ifdim\@ff@check<\ffareay
25452 \FLFbelowtrue
25453 \else
25454 \FLFbelowfalse
25455 \fi
25456 }
25457 \newcommand*{\evencheckifframeleft}{%
25458 \@ifstar\@sevencheckifframeleft\@evencheckifframeleft
25459 }
25460 \newcommand*{\@sevencheckifframeleft}[4]{%
25461 \@ifundefined{@sget#1evenbounds}%
25462 {%
25463 \PackageError{flowfram}%
25464 {Unknown frame type `#1'}%
25465 {%
25466 Frame types may only be one of: static, dynamic or
25467 flow%
25468 }%
25469 }%
25470 {}%
25471 \csname @sget#1evenbounds\endcsname{#2}%
25472 \advance\ffareax by \ffareawidth\relax
25473 \edef\@ff@check{\the\ffareax}%
25474 \@ifundefined{@sget#3evenbounds}%
25475 {%
25476 \PackageError{flowfram}%
25477 {Unknown frame type `#3'}%
25478 {%
25479 Frame types may only be one of: static, dynamic or
25480 flow%
25481 }%
25482 }%
25483 {}%
25484 \csname @sget#3evenbounds\endcsname{#4}%
25485 \expandafter\ifdim\@ff@check<\ffareax
25486 \FLFlefttrue
25487 \else
25488 \FLFleftfalse
25489 \fi
25490 }
25491 \newcommand*{\@evencheckifframeleft}[4]{%
25492 \@ifundefined{@get#1evenbounds}%
25493 {%
25494 \PackageError{flowfram}%
25495 {Unknown frame type `#1'}%
25496 {%
25497 Frame types may only be one of: static, dynamic or
25498 flow%
25499 }%
25500 }%
25501 {}%
25502 \csname @get#1evenbounds\endcsname{#2}%
25503 \advance\ffareax by \ffareawidth\relax
25504 \edef\@ff@check{\the\ffareax}%
25505 \@ifundefined{@get#3evenbounds}%
25506 {%
25507 \PackageError{flowfram}%
25508 {Unknown frame type `#3'}%
25509 {%
25510 Frame types may only be one of: static, dynamic or
25511 flow%
25512 }%
25513 }%
25514 {}%
25515 \csname @get#3evenbounds\endcsname{#4}%
25516 \expandafter\ifdim\@ff@check<\ffareax
25517 \FLFlefttrue
25518 \else
25519 \FLFleftfalse
25520 \fi
25521 }
25522 \newcommand*{\evencheckifframeright}{%
25523 \@ifstar\@sevencheckifframeright\@evencheckifframeright
25524 }
25525 \newcommand*{\@sevencheckifframeright}[4]{%
25526 \@ifundefined{@sget#1evenbounds}%
25527 {%
25528 \PackageError{flowfram}%
25529 {Unknown frame type `#1'}%
25530 {%
25531 Frame types may only be one of: static, dynamic or
25532 flow%
25533 }%
25534 }%
25535 {}%
25536 \csname @sget#1evenbounds\endcsname{#2}%
25537 \edef\@ff@check{\the\ffareax}%
25538 \@ifundefined{@sget#3evenbounds}%
25539 {%
25540 \PackageError{flowfram}%
25541 {Unknown frame type `#3'}%
25542 {%
25543 Frame types may only be one of: static, dynamic or
25544 flow%
25545 }%
25546 }%
25547 {}%
25548 \csname @sget#3evenbounds\endcsname{#4}%
25549 \advance\ffareax by \ffareawidth\relax
25550 \expandafter\ifdim\@ff@check>\ffareax
25551 \FLFrighttrue
25552 \else
25553 \FLFrightfalse
25554 \fi
25555 }
25556 \newcommand*{\@evencheckifframeright}[4]{%
25557 \@ifundefined{@get#1evenbounds}%
25558 {%
25559 \PackageError{flowfram}%
25560 {Unknown frame type `#1'}%
25561 {%
25562 Frame types may only be one of: static, dynamic or
25563 flow%
25564 }%
25565 }%
25566 {}%
25567 \csname @get#1evenbounds\endcsname{#2}%
25568 \edef\@ff@check{\the\ffareax}%
25569 \@ifundefined{@get#3evenbounds}%
25570 {%
25571 \PackageError{flowfram}%
25572 {Unknown frame type `#3'}%
25573 {%
25574 Frame types may only be one of: static, dynamic or
25575 flow%
25576 }%
25577 }%
25578 {}%
25579 \csname @get#3evenbounds\endcsname{#4}%
25580 \advance\ffareax by \ffareawidth\relax
25581 \expandafter\ifdim\@ff@check>\ffareax
25582 \FLFrighttrue
25583 \else
25584 \FLFrightfalse
25585 \fi
25586 }
25587 \newcommand*{\FFaboveleft}{above left}
25588 \newcommand*{\FFaboveright}{above right}
25589 \newcommand*{\FFbelowleft}{below left}
25590 \newcommand*{\FFbelowright}{below right}
25591 \newcommand*{\FFleft}{on the left}
25592 \newcommand*{\FFright}{on the right}
25593 \newcommand*{\FFabove}{above}
25594 \newcommand*{\FFbelow}{below}
25595 \newcommand*{\FFoverlap}{overlap}
25596 \DeclareRobustCommand*{\relativeframelocation}{%
25597 \@ifstar\@srelativeframelocation\@relativeframelocation
25598 }
25599 \newcommand*{\@srelativeframelocation}[4]{%
25600 \@scheckifframeabove{#1}{#2}{#3}{#4}%
25601 \@scheckifframebelow{#1}{#2}{#3}{#4}%
25602 \@scheckifframeleft{#1}{#2}{#3}{#4}%
25603 \@scheckifframeright{#1}{#2}{#3}{#4}%
25604 \ifFLFabove
25605 \ifFLFleft
25606 \FFaboveleft
25607 \else
25608 \ifFLFright
25609 \FFaboveright
25610 \else
25611 \FFabove
25612 \fi
25613 \fi
25614 \else
25615 \ifFLFbelow
25616 \ifFLFleft
25617 \FFbelowleft
25618 \else
25619 \ifFLFright
25620 \FFbelowright
25621 \else
25622 \FFbelow
25623 \fi
25624 \fi
25625 \else
25626 \ifFLFleft
25627 \FFleft
25628 \else
25629 \ifFLFright
25630 \FFright
25631 \else
25632 \FFoverlap
25633 \fi
25634 \fi
25635 \fi
25636 \fi
25637 }
25638 \newcommand*{\@relativeframelocation}[4]{%
25639 \@checkifframeabove{#1}{#2}{#3}{#4}%
25640 \@checkifframebelow{#1}{#2}{#3}{#4}%
25641 \@checkifframeleft{#1}{#2}{#3}{#4}%
25642 \@checkifframeright{#1}{#2}{#3}{#4}%
25643 \ifFLFabove
25644 \ifFLFleft
25645 \FFaboveleft
25646 \else
25647 \ifFLFright
25648 \FFaboveright
25649 \else
25650 \FFabove
25651 \fi
25652 \fi
25653 \else
25654 \ifFLFbelow
25655 \ifFLFleft
25656 \FFbelowleft
25657 \else
25658 \ifFLFright
25659 \FFbelowright
25660 \else
25661 \FFbelow
25662 \fi
25663 \fi
25664 \else
25665 \ifFLFleft
25666 \FFleft
25667 \else
25668 \ifFLFright
25669 \FFright
25670 \else
25671 \FFoverlap
25672 \fi
25673 \fi
25674 \fi
25675 \fi
25676 }
25677 \DeclareRobustCommand*{\reldynamicloc}{%
25678 \@ifstar\@sreldynamicloc\@reldynamicloc
25679 }
25680 \newcommand*{\@sreldynamicloc}[2]{%
25681 \@srelativeframelocation{dynamic}{#1}{dynamic}{#2}%
25682 }
25683 \newcommand*{\@reldynamicloc}[2]{%
25684 \@relativeframelocation{dynamic}{#1}{dynamic}{#2}%
25685 }
25686 \DeclareRobustCommand*{\relstaticloc}{%
25687 \@ifstar\@srelstaticloc\@relstaticloc
25688 }
25689 \newcommand*{\@srelstaticloc}[2]{%
25690 \@srelativeframelocation{static}{#1}{static}{#2}%
25691 }
25692 \newcommand*{\@relstaticloc}[2]{%
25693 \@relativeframelocation{static}{#1}{static}{#2}%
25694 }
25695 \DeclareRobustCommand*{\relflowloc}{%
25696 \@ifstar\@srelflowloc\@relflowloc
25697 }
25698 \newcommand*{\@srelflowloc}[2]{%
25699 \@srelativeframelocation{flow}{#1}{flow}{#2}%
25700 }
25701 \newcommand*{\@relflowloc}[2]{%
25702 \@relativeframelocation{flow}{#1}{flow}{#2}%
25703 }
25704 \newcommand*{\setinitialframe}[1]{%
25705 \c@thisframe=#1%
25706 \global\usedframebreaktrue
25707 \global\setlength{\hsize}
25708 {%
25709 \csname colwidth\romannumeral\c@thisframe\endcsname
25710 }%
25711 }
25712 \newif\if@setfr@mes
25713 \@setfr@mesfalse
25714 \newcommand*{\setframes}{%
25715 \ifnum\c@thisframe=0\relax
25716 \PackageWarning{flowfram}%
25717 {Can't find a flow frame on page 1.
25718 \MessageBreak
25719 Attempting to find the first page with a flow frame%
25720 }%
25721 \@nxtcol=1\relax
25722 \c@curpg=1\relax
25723 \@g@tnextcol{\@nxtcol}%
25724 \advance\c@curpg by -1\relax
25725 \whiledo{\c@curpg>0}%
25726 {%
25727 \advance\c@curpg by -1\relax
25728 \setbox\@outputbox\vbox{\hbox to \textwidth{\@ff@do@allframes}}%
25729 \@outputpage
25730 }%
25731 \c@thisframe=\@nxtcol
25732 \fi
25733 \@setcol{\c@thisframe}\relax
25734 \@setfr@mestrue
25735 \edef\ff@txtcol{%
25736 \csname @ff@txtcol@\romannumeral\c@thisframe\endcsname}%
25737 \@s@tfftextcol
25738 }
25739 \newcommand{\emulatetwocolumn}[1][]{%
25740 \finishthispage
25741 \setallflowframes{pages=none}%
25742 \settoheight{\@ff@staticH}{#1}%
25743 \settodepth{\@ff@tmp@y}{#1}%
25744 \addtolength{\@ff@staticH}{\@ff@tmp@y}%
25745 \ifdim\@ff@staticH>0pt\relax
25746 \twocolumnStop[\@ff@pages@countreg]{\@ff@staticH}%
25747 \c@thisframe=\c@maxflow
25748 \advance\c@thisframe by -1\relax
25749 \@twocolumn[>\@ff@pages@countreg]%
25750 \setstaticcontents{\c@maxstatic}{#1}%
25751 \else
25752 \@twocolumn
25753 \c@thisframe=\c@maxflow
25754 \advance\c@thisframe by -1\relax
25755 \fi
25756 \@setcol{\c@thisframe}%
25757 \relax
25758 }
25759 \newcommand{\emulateonecolumn}[1][]{%
25760 \finishthispage
25761 \setallflowframes{pages=none}%
25762 \settoheight{\@ff@staticH}{#1}%
25763 \settodepth{\@ff@tmp@y}{#1}%
25764 \addtolength{\@ff@staticH}{\@ff@tmp@y}%
25765 \ifdim\@ff@staticH>0pt\relax
25766 \onecolumnStop[\@ff@pages@countreg]{\@ff@staticH}%
25767 \c@thisframe=\c@maxflow
25768 \advance\c@thisframe by -1\relax
25769 \@onecolumn[>\@ff@pages@countreg]%
25770 \setstaticcontents{\c@maxstatic}{#1}%
25771 \else
25772 \@twocolumn
25773 \c@thisframe=\c@maxflow
25774 \advance\c@thisframe by -1\relax
25775 \fi
25776 \@setcol{\c@thisframe}%
25777 \relax
25778 }
25779 \AtBeginDocument{%
25780 \c@absolutepage=1\relax
25781 \ifnum\c@maxflow=0\relax
25782 \PackageWarning{flowfram}{No flow frames, adding one}%
25783 \@onecolumn
25784 \fi
25785 \setframes
25786 \renewcommand{\onecolumn}[1][]{%
25787 \PackageWarning{flowfram}%
25788 {%
25789 Ignoring \string\onecolumn\space found in document environment.
25790 Frames must be defined in the preamble%
25791 }%
25792 #1%
25793 }%
25794 \renewcommand{\twocolumn}[1][]{%
25795 \PackageWarning{flowfram}%
25796 {%
25797 Ignoring \string\twocolumn\space found in document environment.
25798 Frames must be defined in the preamble}%
25799 #1%
25800 }%
25801 }
25802 \newlength\fftolerance
25803 \setlength\fftolerance{2pt}
25804 \newcommand{\@setcol}[1]{%
25805 \ifnum\c@maxflow<#1\relax
25806 \PackageError{flowfram}%
25807 {Can't set frame '\number#1', doesn't exist}{}%
25808 \else
25809 \flf@message{Switching to flow frame \number#1\space on page
25810 \number\@ff@pages@countreg}%
25811 \expandafter\global\expandafter\columnwidth
25812 \csname colwidth\romannumeral#1\endcsname
25813 \dimen@\columnwidth
25814 \advance\dimen@ by -\hsize\relax
25815 \ifdim\dimen@<0pt\relax
25816 \dimen@=-\dimen@
25817 \fi
25818 \ifdim\dimen@>\fftolerance
25819 \ifusedframebreak
25820 \else
25821 \PackageWarning{flowfram}%
25822 {Moving to flow frame of unequal
25823 width,\MessageBreak use of \string\framebreak\space advised,
25824 or text might not appear correctly (difference =
25825 \the\dimen@, tolerance = \the\fftolerance)}%
25826 \fi
25827 \fi
25828 \global\usedframebreakfalse
25829 \global\hsize\columnwidth
25830 \expandafter\global
25831 \expandafter\vsize\csname colheight\romannumeral#1\endcsname
25832 \global\@colht\vsize
25833 \global\@colroom\@colht
25834 \ifnum\@listdepth>0\relax
25835 \ifnum\linewidth>\columnwidth
25836 \global\linewidth\columnwidth
25837 \fi
25838 \else
25839 \global\linewidth\columnwidth
25840 \fi
25841 %\global\textwidth\columnwidth
25842 \setmargin
25843 \fi
25844 \stepcounter{displayedframe}%
25845 }
25846 \output={%
25847 \let\par\@@par
25848 \ifnum\outputpenalty <-\@M
25849 \@specialoutput
25850 \else
25851 \@makecol
25852 \@opcol \@startcolumn
25853 \@whilesw \if@fcolmade \fi {\@opcol \@startcolumn }%
25854 \fi
25855 \ifnum\outputpenalty>-\@Miv
25856 \ifdim\@colroom<1.5\baselineskip
25857 \ifdim\@colroom<\vsize
25858 \@latex@warning@no@line{Text page \thepage \space
25859 contains only floats}%
25860 \@emptycol
25861 \else
25862 \global\vsize\@colroom
25863 \fi
25864 \else
25865 \global\vsize\@colroom
25866 \fi
25867 \else
25868 \global\vsize\maxdimen
25869 \fi
25870 }
25871 \def\@doclearpage{%
25872 \ifvoid\footins
25873 \setbox\@tempboxa\vsplit\@cclv to\z@
25874 \unvbox\@tempboxa
25875 \setbox\@tempboxa\box\@cclv
25876 \xdef\@deferlist{\@toplist\@botlist\@deferlist}%
25877 \global\let\@toplist\@empty
25878 \global\let\@botlist\@empty
25879 \global\@colroom\@colht
25880 \ifx\@currlist\@empty
25881 \else
25882 \@latexerr{Float(s) lost}\@ehb
25883 \global\let\@currlist\@empty
25884 \fi
25885 \@makefcolumn\@deferlist
25886 \@whilesw \if@fcolmade \fi
25887 {%
25888 \@opcol
25889 \@makefcolumn\@deferlist
25890 }%
25891 \if@firstcolumn
25892 \xdef\@dbldeferlist{\@dbltoplist\@dbldeferlist}%
25893 \global\let\@dbltoplist\@empty
25894 \global\@colht\vsize
25895 \begingroup
25896 \@dblfloatplacement
25897 \@makefcolumn\@dbldeferlist
25898 \@whilesw \if@fcolmade \fi
25899 {%
25900 \@outputpage
25901 \@makefcolumn\@dbldeferlist
25902 }%
25903 \endgroup
25904 \else
25905 \vbox{}%
25906 \clearpage
25907 \fi
25908 \else
25909 \setbox\@cclv\vbox{\box\@cclv\vfil}%
25910 \@makecol\@opcol
25911 \clearpage
25912 \fi
25913 }
25914 \newcommand{\@dothehead}{%
25915 \vbox to \headheight
25916 {%
25917 \color@hbox\normalcolor\hbox to \textwidth{\@thehead}%
25918 \color@endbox
25919 }%
25920 }
25921 \newcommand{\@dothefoot}{%
25922 \color@hbox\normalcolor\hbox to \textwidth{\@thefoot}%
25923 \color@endbox
25924 }
25925 \newcommand{\@dodynamicthehead}{}
25926 \newcommand{\@dodynamicthefoot}{}
25927 \def\@outputpage{%
25928 \begingroup
25929 \let\protect\noexpand
25930 \@resetactivechars
25931 \global\let\@@if@newlist\if@newlist
25932 \global\@newlistfalse\@parboxrestore
25933 \shipout\vbox
25934 {%
25935 \set@typeset@protect
25936 \aftergroup
25937 \endgroup
25938 \aftergroup
25939 \set@typeset@protect
25940 \reset@font\normalsize\normalsfcodes
25941 \let\label\@gobble
25942 \let\index\@gobble
25943 \let\glossary\@gobble
25944 \baselineskip\z@skip
25945 \lineskip\z@skip
25946 \lineskiplimit\z@
25947 \vskip\topmargin\moveright\@themargin
25948 \vbox
25949 {%
25950 \vskip\headheight
25951 \vskip\headsep
25952 \box\@outputbox
25953 }%
25954 }%
25955 \global\let\if@newlist\@@if@newlist
25956 \stepcounter{page}%
25957 \stepcounter{absolutepage}%
25958 \setcounter{displayedframe}{0}%
25959 \let\firstmark\botmark
25960 }
25961 \newcommand*{\makedfheaderfooter}{%
25962 \setlength{\@ff@tmp@y}{\textheight}%
25963 \addtolength{\@ff@tmp@y}{\headsep}%
25964 \newdynamicframe{\textwidth}{\headheight}{0pt}{\@ff@tmp@y}[header]%
25965 \newdynamicframe{\textwidth}{\headheight}{0pt}{-\footskip}[footer]%
25966 \renewcommand{\@dothehead}{}%
25967 \renewcommand{\@dothefoot}{}%
25968 \renewcommand{\@dodynamicthehead}{%
25969 \@dynamicframeid{header}%
25970 \expandafter
25971 \def\csname @dynamicframe@\romannumeral\ff@id\endcsname{%
25972 \vfill\@thehead\vfill
25973 }%
25974 }%
25975 \renewcommand{\@dodynamicthefoot}{%
25976 \@dynamicframeid{footer}%
25977 \expandafter
25978 \def\csname @dynamicframe@\romannumeral\ff@id\endcsname{%
25979 \vfill\@thefoot\vfill
25980 }%
25981 }%
25982 }
25983 \@onlypreamble{\makedfheaderfooter}
25984 \newcommand{\footnotecolor}{%
25985 \@ifundefined{@ff@txtcol@\romannumeral\c@thisframe}%
25986 {%
25987 \normalcolor
25988 }%
25989 {%
25990 \edef\ff@txtcol{%
25991 \csname @ff@txtcol@\romannumeral\c@thisframe\endcsname
25992 }%
25993 \@s@tfftextcol
25994 }%
25995 }
25996 \renewcommand{\@makecol}{%
25997 \ifvoid\footins
25998 \setbox\@outputbox\box\@cclv
25999 \else
26000 \setbox\@outputbox\vbox
26001 {%
26002 \boxmaxdepth\@maxdepth\@tempdima\dp\@cclv
26003 \unvbox\@cclv
26004 \vskip\skip\footins
26005 \color@begingroup
26006 \footnotecolor
26007 \footnoterule
26008 \unvbox\footins
26009 \color@endgroup
26010 }%
26011 \fi
26012 \xdef\@freelist{\@freelist\@midlist}%
26013 \global\let\@midlist\@empty
26014 \@combinefloats
26015 \ifvbox\@kludgeins
26016 \@makespecialcolbox
26017 \else
26018 \setbox\@outputbox\vbox to\@colht{%
26019 \@texttop\dimen@\dp\@outputbox
26020 \unvbox \@outputbox
26021 \vskip -\dimen@\@textbottom
26022 }%
26023 \fi
26024 \global\maxdepth\@maxdepth
26025 }
26026 \def\@opcol{%
26027 \@outputdblcol
26028 \global\@mparbottom\z@
26029 \global\@textfloatsheight\z@
26030 \@floatplacement
26031 }
26032 \newif\if@ff@moreframes
26033 \newcommand*{\@ff@checkifmoreframes}{%
26034 \@ff@moreframesfalse
26035 \@colN=\c@thisframe
26036 \whiledo{\@colN<\c@maxflow}%
26037 {%
26038 \advance\@colN by 1\relax
26039 \edef\ff@xpages{\csname @ff@xpages@\romannumeral\@colN\endcsname}%
26040 \@for\@ff@pp:=\ff@xpages\do
26041 {%
26042 \ifnum0\@ff@pp=\@ff@pages@countreg\relax
26043 \@endfortrue
26044 \fi
26045 }%
26046 \if@endfor
26047 \else
26048 \edef\ff@pages{\csname @ff@pages@\romannumeral\@colN\endcsname}%
26049 \@ff@checkpages{\ff@pages}%
26050 \if@ff@moreframes
26051 \@colN=\c@maxflow\relax
26052 \fi
26053 \fi
26054 }%
26055 \if@ff@moreframes
26056 \else
26057 \@ff@tmpN=\@ff@pages@countreg
26058 \count@=0\relax
26059 \loop
26060 \advance\@ff@tmpN by 1\relax
26061 \@colN=0\relax
26062 \whiledo{\@colN<\c@maxflow}%
26063 {%
26064 \advance\@colN by 1\relax
26065 \edef\ff@xpages{\csname @ff@xpages@\romannumeral\@colN\endcsname}%
26066 \@for\@ff@pp:=\ff@xpages\do
26067 {%
26068 \ifnum0\@ff@pp=\@ff@tmpN\relax
26069 \@endfortrue
26070 \fi
26071 }%
26072 \if@endfor
26073 \else
26074 \edef\ff@pages{\csname @ff@pages@\romannumeral\@colN\endcsname}%
26075 \@ff@checkpages[\@ff@tmpN]{\ff@pages}%
26076 \if@ff@moreframes
26077 \@colN=\c@maxflow\relax
26078 \fi
26079 \fi
26080 }%
26081 \if@ff@moreframes
26082 \count@=4\relax
26083 \else
26084 \advance\count@ by 1\relax
26085 \fi
26086 \ifnum\count@<4
26087 \repeat
26088 \fi
26089 }
26090 \newcommand*{\@ff@checkpages}[2][\@ff@pages@countreg]{%
26091 \@for\@ff@pp:=#2\do{%
26092 \@ff@checkthispage{#1}{\@ff@pp}%
26093 }%
26094 }
26095 \newcommand*{\@ff@checkthispage}[2]{%
26096 \ifthenelse{\equal{#2}{all}\or\equal{#2}{even}\or\equal{#2}{odd}}%
26097 {%
26098 \@ff@moreframestrue
26099 }%
26100 {%
26101 \ifthenelse{\equal{#2}{none}}%
26102 {}%
26103 {%
26104 \@ff@checknumrange{#1}{#2}%
26105 }%
26106 }%
26107 }
26108 \newcommand*{\@ff@checknumrange}[2]{%
26109 \def\@ff@numstart{0}%
26110 \def\@ff@numend{100000}%
26111 \@ff@getrange{#2}%
26112 \ifnum\@ff@numend>#1\relax
26113 \@ff@moreframestrue
26114 \else
26115 \ifnum\@ff@numend=#1\relax
26116 \@ff@moreframestrue
26117 \fi
26118 \fi
26119 }
26120 \newcount\c@ffrangenum
26121 \newcommand*{\@ff@getrange}[1]{%
26122 \expandafter\@ff@@getrange#1-\relax\end
26123 }
26124 \def\@ff@@getrange#1#2\end{%
26125 \ifx#1<\relax
26126 \@ff@getrangeless#1#2\end
26127 \else
26128 \ifx#1>\relax
26129 \@ff@getrangegreater#1#2\end
26130 \else
26131 \@@ff@getrange#1#2\end
26132 \fi
26133 \fi
26134 }
26135 \def\@ff@getrangeless<#1-\relax\end{%
26136 \c@ffrangenum=#1\relax
26137 \advance\c@ffrangenum by -1\relax
26138 \def\@ff@numstart{0}%
26139 \edef\@ff@numend{\number\c@ffrangenum}%
26140 }
26141 \def\@ff@getrangegreater>#1-\relax\end{%
26142 \c@ffrangenum=#1\relax
26143 \advance\c@ffrangenum by 1\relax
26144 \edef\@ff@numstart{\number\c@ffrangenum}%
26145 \def\@ff@numend{100000}%
26146 }
26147 \def\@@ff@getrange#1-#2\end{%
26148 \ifx\relax#2\relax
26149 \def\@ff@numstart{#1}%
26150 \def\@ff@numend{#1}%
26151 \else
26152 \def\@ff@numstart{#1}%
26153 \@@@ff@getrange#2\end
26154 \fi
26155 }
26156 \def\@@@ff@getrange#1-\relax\end{%
26157 \def\@ff@numend{#1}%
26158 }
26159 \newcommand*{\@ff@output@adjustframes}{}
26160 \newcommand*{\flowswitchonnext}{%
26161 \@ifstar\@sflowswitchonnext\@flowswitchonnext
26162 }
26163 \newcommand{\@sflowswitchonnext}[1]{%
26164 \@for\@ff@id:=#1\do{%
26165 \@flowframeid{\@ff@id}%
26166 \@ff@chckifthispg{\@ff@pages@countreg}{\ff@id}%
26167 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26168 \if@notthiscol
26169 \xdef\@ff@output@adjustframes{%
26170 \the\toks@
26171 \noexpand\flowsetpagelist{\number\ff@id}{>\number\@ff@pages@countreg}%
26172 }%
26173 \else
26174 \xdef\@ff@output@adjustframes{%
26175 \the\toks@
26176 \noexpand\flowsetpagelist{\number\ff@id}%
26177 {\number\@ff@pages@countreg,>\number\@ff@pages@countreg}%
26178 }%
26179 \fi
26180 }%
26181 }
26182 \newcommand{\@flowswitchonnext}[1]{%
26183 \@for\@ff@id:=#1\do{%
26184 \@ff@chckifthispg{\@ff@pages@countreg}{\@ff@id}%
26185 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26186 \if@notthiscol
26187 \xdef\@ff@output@adjustframes{%
26188 \the\toks@
26189 \noexpand\flowsetpagelist{\number\@ff@id}{>\number\@ff@pages@countreg}%
26190 }%
26191 \else
26192 \xdef\@ff@output@adjustframes{%
26193 \the\toks@
26194 \noexpand\flowsetpagelist{\number\@ff@id}%
26195 {\number\@ff@pages@countreg,>\number\@ff@pages@countreg}%
26196 }%
26197 \fi
26198 }%
26199 }
26200 \newcommand*{\flowswitchonnextodd}{%
26201 \@ifstar\@sflowswitchonnextodd\@flowswitchonnextodd
26202 }
26203 \newcommand{\@sflowswitchonnextodd}[1]{%
26204 \count@=\@ff@pages@countreg\relax
26205 \ifodd\count@\relax
26206 \advance\count@ by 1\relax
26207 \fi
26208 \@for\@ff@id:=#1\do{%
26209 \@flowframeid{\@ff@id}%
26210 \@ff@chckifthispg{\@ff@pages@countreg}{\ff@id}%
26211 \def\@ff@prepages{}%
26212 \if@notthiscol
26213 \else
26214 \def\@ff@prepages{\number\@ff@pages@countreg,}%
26215 \fi
26216 \@ff@chckifthispg{\count@}{\ff@id}%
26217 \ifnum\count@=\@ff@pages@countreg\relax
26218 \else
26219 \if@notthiscol
26220 \else
26221 \edef\@ff@prepages{\@ff@prepages\number\count@,}%
26222 \fi
26223 \fi
26224 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26225 \xdef\@ff@output@adjustframes{%
26226 \the\toks@
26227 \noexpand\flowsetpagelist{\number\ff@id}%
26228 {\@ff@prepages>\number\count@}%
26229 }%
26230 }%
26231 }
26232 \newcommand{\@flowswitchonnextodd}[1]{%
26233 \count@=\@ff@pages@countreg\relax
26234 \ifodd\count@\relax
26235 \advance\count@ by 1\relax
26236 \fi
26237 \@for\@ff@id:=#1\do{%
26238 \@ff@chckifthispg{\@ff@pages@countreg}{\@ff@id}%
26239 \def\@ff@prepages{}%
26240 \if@notthiscol
26241 \else
26242 \def\@ff@prepages{\number\@ff@pages@countreg,}%
26243 \fi
26244 \@ff@chckifthispg{\count@}{\@ff@id}%
26245 \ifnum\count@=\@ff@pages@countreg\relax
26246 \else
26247 \if@notthiscol
26248 \else
26249 \edef\@ff@prepages{\@ff@prepages\number\count@,}%
26250 \fi
26251 \fi
26252 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26253 \xdef\@ff@output@adjustframes{%
26254 \the\toks@
26255 \noexpand\flowsetpagelist{\number\@ff@id}%
26256 {\@ff@prepages>\number\count@}%
26257 }%
26258 }%
26259 }
26260 \newcommand*{\flowswitchoffnext}{%
26261 \@ifstar\@sflowswitchoffnext\@flowswitchoffnext
26262 }
26263 \newcommand{\@sflowswitchoffnext}[1]{%
26264 \@for\@ff@id:=#1\do{%
26265 \@flowframeid{\@ff@id}%
26266 \@ff@chckifthispg{\@ff@pages@countreg}{\ff@id}%
26267 \if@notthiscol
26268 \def\@ff@pages{none}%
26269 \else
26270 \def\@ff@pages{\number\@ff@pages@countreg}%
26271 \fi
26272 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26273 \xdef\@ff@output@adjustframes{%
26274 \the\toks@
26275 \noexpand\flowsetpagelist{\number\ff@id}{\@ff@pages}%
26276 }%
26277 }%
26278 }
26279 \newcommand{\@flowswitchoffnext}[1]{%
26280 \@for\@ff@id:=#1\do{%
26281 \@ff@chckifthispg{\@ff@pages@countreg}{\@ff@id}%
26282 \if@notthiscol
26283 \def\@ff@pages{none}%
26284 \else
26285 \def\@ff@pages{\number\@ff@pages@countreg}%
26286 \fi
26287 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26288 \xdef\@ff@output@adjustframes{%
26289 \the\toks@
26290 \noexpand\flowsetpagelist{\number\@ff@id}{\@ff@pages}%
26291 }%
26292 }%
26293 }
26294 \newcommand*{\flowswitchoffnextodd}{%
26295 \@ifstar\@sflowswitchoffnextodd\@flowswitchoffnextodd
26296 }
26297 \newcommand{\@sflowswitchoffnextodd}[1]{%
26298 \count@=\@ff@pages@countreg\relax
26299 \ifodd\@ff@pages@countreg\relax
26300 \advance\count@ by 1\relax
26301 \fi
26302 \@for\@ff@id:=#1\do{%
26303 \@flowframeid{\@ff@id}%
26304 \@ff@chckifthispg{\@ff@pages@countreg}{\ff@id}%
26305 \if@notthiscol
26306 \ifnum\@ff@pages@countreg=\count@\relax
26307 \def\@ff@nextpages{none}%
26308 \else
26309 \@ff@chckifthispg{\count@}{\ff@id}%
26310 \if@notthiscol
26311 \def\@ff@nextpages{none}%
26312 \else
26313 \def\@ff@nextpages{\number\count@}%
26314 \fi
26315 \fi
26316 \else
26317 \ifnum\@ff@pages@countreg=\count@\relax
26318 \def\@ff@nextpages{\number\@ff@pages@countreg}%
26319 \else
26320 \@ff@chckifthispg{\count@}{\ff@id}%
26321 \if@notthiscol
26322 \def\@ff@nextpages{\number\@ff@pages@countreg}%
26323 \else
26324 \def\@ff@nextpages{\number\@ff@pages@countreg,\number\count@}%
26325 \fi
26326 \fi
26327 \fi
26328 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26329 \xdef\@ff@output@adjustframes{%
26330 \the\toks@
26331 \noexpand\flowsetpagelist{\number\ff@id}{\@ff@nextpages}%
26332 }%
26333 }%
26334 }
26335 \newcommand{\@flowswitchoffnextodd}[1]{%
26336 \count@=\@ff@pages@countreg\relax
26337 \ifodd\@ff@pages@countreg\relax
26338 \advance\count@ by 1\relax
26339 \fi
26340 \@for\@ff@id:=#1\do{%
26341 \@ff@chckifthispg{\@ff@pages@countreg}{\@ff@id}%
26342 \if@notthiscol
26343 \ifnum\@ff@pages@countreg=\count@\relax
26344 \def\@ff@nextpages{none}%
26345 \else
26346 \@ff@chckifthispg{\count@}{\@ff@id}%
26347 \if@notthiscol
26348 \def\@ff@nextpages{none}%
26349 \else
26350 \def\@ff@nextpages{\number\count@}%
26351 \fi
26352 \fi
26353 \else
26354 \ifnum\@ff@pages@countreg=\count@\relax
26355 \def\@ff@nextpages{\number\@ff@pages@countreg}%
26356 \else
26357 \@ff@chckifthispg{\count@}{\@ff@id}%
26358 \if@notthiscol
26359 \def\@ff@nextpages{\number\@ff@pages@countreg}%
26360 \else
26361 \def\@ff@nextpages{\number\@ff@pages@countreg,\number\count@}%
26362 \fi
26363 \fi
26364 \fi
26365 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26366 \xdef\@ff@output@adjustframes{%
26367 \the\toks@
26368 \noexpand\flowsetpagelist{\number\@ff@id}{\@ff@nextpages}%
26369 }%
26370 }%
26371 }
26372 \newcommand*{\flowswitchonnextonly}{%
26373 \@ifstar\@sflowswitchonnextonly\@flowswitchonnextonly
26374 }
26375 \newcommand{\@sflowswitchonnextonly}[1]{%
26376 \count@=\@ff@pages@countreg\relax
26377 \advance\count@ by 1\relax
26378 \@for\@ff@id:=#1\do{%
26379 \@flowframeid{\@ff@id}%
26380 \@ff@chckifthispg{\@ff@pages@countreg}{\ff@id}%
26381 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26382 \if@notthiscol
26383 \xdef\@ff@output@adjustframes{%
26384 \the\toks@
26385 \noexpand\flowsetpagelist{\number\ff@id}{\number\count@}%
26386 }%
26387 \else
26388 \xdef\@ff@output@adjustframes{%
26389 \the\toks@
26390 \noexpand\flowsetpagelist{\number\ff@id}%
26391 {\number\@ff@pages@countreg,\number\count@}%
26392 }%
26393 \fi
26394 }%
26395 }
26396 \newcommand{\@flowswitchonnextonly}[1]{%
26397 \count@=\@ff@pages@countreg\relax
26398 \advance\count@ by 1\relax
26399 \@for\@ff@id:=#1\do{%
26400 \@ff@chckifthispg{\@ff@pages@countreg}{\@ff@id}%
26401 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26402 \if@notthiscol
26403 \xdef\@ff@output@adjustframes{%
26404 \the\toks@
26405 \noexpand\flowsetpagelist{\number\@ff@id}{\number\count@}%
26406 }%
26407 \else
26408 \xdef\@ff@output@adjustframes{%
26409 \the\toks@
26410 \noexpand\flowsetpagelist{\number\@ff@id}%
26411 {\number\@ff@pages@countreg,\number\count@}%
26412 }%
26413 \fi
26414 }%
26415 }
26416 \newcommand*{\flowswitchonnextoddonly}{%
26417 \@ifstar\@sflowswitchonnextoddonly\@flowswitchonnextoddonly
26418 }
26419 \newcommand{\@sflowswitchonnextoddonly}[1]{%
26420 \@for\@ff@id:=#1\do{%
26421 \@flowframeid{\@ff@id}%
26422 \@ff@chckifthispg{\@ff@pages@countreg}{\ff@id}%
26423 \if@notthiscol
26424 \ifodd\@ff@pages@countreg
26425 \count@=\@ff@pages@countreg\relax
26426 \advance\count@ by 1\relax
26427 \@ff@chckifthispg{\count@}{\ff@id}%
26428 \if@notthiscol
26429 \advance\count@ by 1\relax
26430 \edef\@ff@pages{\number\count@}%
26431 \else
26432 \edef\@ff@pages{\number\count@}%
26433 \advance\count@ by 1\relax
26434 \edef\@ff@pages{\@ff@pages,\number\count@}%
26435 \fi
26436 \else
26437 \count@=\@ff@pages@countreg\relax
26438 \advance\count@ by 1\relax
26439 \edef\@ff@pages{\number\count@}%
26440 \fi
26441 \else
26442 \ifodd\@ff@pages@countreg
26443 \count@=\@ff@pages@countreg\relax
26444 \advance\count@ by 1\relax
26445 \@ff@chckifthispg{\count@}{\ff@id}%
26446 \if@notthiscol
26447 \advance\count@ by 1\relax
26448 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
26449 \else
26450 \advance\count@ by 1\relax
26451 \edef\@ff@pages{\number\@ff@pages@countreg-\number\count@}%
26452 \fi
26453 \else
26454 \count@=\@ff@pages@countreg\relax
26455 \advance\count@ by 1\relax
26456 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
26457 \fi
26458 \fi
26459 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26460 \xdef\@ff@output@adjustframes{%
26461 \the\toks@
26462 \noexpand\flowsetpagelist{\number\ff@id}{\@ff@pages}%
26463 }%
26464 }%
26465 }
26466 \newcommand{\@flowswitchonnextoddonly}[1]{%
26467 \@for\@ff@id:=#1\do{%
26468 \@ff@chckifthispg{\@ff@pages@countreg}{\@ff@id}%
26469 \if@notthiscol
26470 \ifodd\@ff@pages@countreg
26471 \count@=\@ff@pages@countreg\relax
26472 \advance\count@ by 1\relax
26473 \@ff@chckifthispg{\count@}{\@ff@id}%
26474 \if@notthiscol
26475 \advance\count@ by 1\relax
26476 \edef\@ff@pages{\number\count@}%
26477 \else
26478 \edef\@ff@pages{\number\count@}%
26479 \advance\count@ by 1\relax
26480 \edef\@ff@pages{\@ff@pages,\number\count@}%
26481 \fi
26482 \else
26483 \count@=\@ff@pages@countreg\relax
26484 \advance\count@ by 1\relax
26485 \edef\@ff@pages{\number\count@}%
26486 \fi
26487 \else
26488 \ifodd\@ff@pages@countreg
26489 \count@=\@ff@pages@countreg\relax
26490 \advance\count@ by 1\relax
26491 \@ff@chckifthispg{\count@}{\@ff@id}%
26492 \if@notthiscol
26493 \advance\count@ by 1\relax
26494 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
26495 \else
26496 \advance\count@ by 1\relax
26497 \edef\@ff@pages{\number\@ff@pages@countreg-\number\count@}%
26498 \fi
26499 \else
26500 \count@=\@ff@pages@countreg\relax
26501 \advance\count@ by 1\relax
26502 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
26503 \fi
26504 \fi
26505 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26506 \xdef\@ff@output@adjustframes{%
26507 \the\toks@
26508 \noexpand\flowsetpagelist{\number\@ff@id}{\@ff@pages}%
26509 }%
26510 }%
26511 }
26512 \newcommand*{\flowswitchoffnextonly}{%
26513 \@ifstar\@sflowswitchoffnextonly\@flowswitchoffnextonly
26514 }
26515 \newcommand{\@sflowswitchoffnextonly}[1]{%
26516 \count@=\@ff@pages@countreg\relax
26517 \advance\count@ by 1\relax
26518 \@for\@ff@id:=#1\do{%
26519 \@flowframeid{\@ff@id}%
26520 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26521 \xdef\@ff@output@adjustframes{%
26522 \the\toks@
26523 \noexpand\flowaddexclusion{\number\ff@id}{\number\count@}%
26524 }%
26525 }%
26526 }
26527 \newcommand{\@flowswitchoffnextonly}[1]{%
26528 \count@=\@ff@pages@countreg\relax
26529 \advance\count@ by 1\relax
26530 \@for\@ff@id:=#1\do{%
26531 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26532 \xdef\@ff@output@adjustframes{%
26533 \the\toks@
26534 \noexpand\flowaddexclusion{\number\@ff@id}{\number\count@}%
26535 }%
26536 }%
26537 }
26538 \newcommand*{\flowswitchoffnextoddonly}{%
26539 \@ifstar\@sflowswitchoffnextoddonly\@flowswitchoffnextoddonly
26540 }
26541 \newcommand{\@sflowswitchoffnextoddonly}[1]{%
26542 \count@=\@ff@pages@countreg\relax
26543 \advance\count@ by 1\relax
26544 \ifodd\count@\relax
26545 \else
26546 \advance\count@ by 1\relax
26547 \fi
26548 \@for\@ff@id:=#1\do{%
26549 \@flowframeid{\@ff@id}%
26550 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26551 \xdef\@ff@output@adjustframes{%
26552 \the\toks@
26553 \noexpand\flowaddexclusion{\number\ff@id}{\number\count@}%
26554 }%
26555 }%
26556 }
26557 \newcommand{\@flowswitchoffnextoddonly}[1]{%
26558 \count@=\@ff@pages@countreg\relax
26559 \advance\count@ by 1\relax
26560 \ifodd\count@\relax
26561 \else
26562 \advance\count@ by 1\relax
26563 \fi
26564 \@for\@ff@id:=#1\do{%
26565 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26566 \xdef\@ff@output@adjustframes{%
26567 \the\toks@
26568 \noexpand\flowaddexclusion{\number\@ff@id}{\number\count@}%
26569 }%
26570 }%
26571 }
26572 \newcommand*{\dynamicswitchonnext}{%
26573 \@ifstar\@sdynamicswitchonnext\@dynamicswitchonnext
26574 }
26575 \newcommand{\@sdynamicswitchonnext}[1]{%
26576 \@for\@ff@id:=#1\do{%
26577 \@dynamicframeid{\@ff@id}%
26578 \@df@chckifthispg[\@ff@pages@countreg]{\ff@id}%
26579 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26580 \if@notthiscol
26581 \xdef\@ff@output@adjustframes{%
26582 \the\toks@
26583 \noexpand\dynamicsetpagelist{\number\ff@id}{>\number\@ff@pages@countreg}%
26584 }%
26585 \else
26586 \xdef\@ff@output@adjustframes{%
26587 \the\toks@
26588 \noexpand\dynamicsetpagelist{\number\ff@id}%
26589 {\number\@ff@pages@countreg,>\number\@ff@pages@countreg}%
26590 }%
26591 \fi
26592 }%
26593 }
26594 \newcommand{\@dynamicswitchonnext}[1]{%
26595 \@for\@ff@id:=#1\do{%
26596 \@df@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
26597 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26598 \if@notthiscol
26599 \xdef\@ff@output@adjustframes{%
26600 \the\toks@
26601 \noexpand\dynamicsetpagelist{\number\@ff@id}{>\number\@ff@pages@countreg}%
26602 }%
26603 \else
26604 \xdef\@ff@output@adjustframes{%
26605 \the\toks@
26606 \noexpand\dynamicsetpagelist{\number\@ff@id}%
26607 {\number\@ff@pages@countreg,>\number\@ff@pages@countreg}%
26608 }%
26609 \fi
26610 }%
26611 }
26612 \newcommand*{\dynamicswitchonnextodd}{%
26613 \@ifstar\@sdynamicswitchonnextodd\@dynamicswitchonnextodd
26614 }
26615 \newcommand{\@sdynamicswitchonnextodd}[1]{%
26616 \count@=\@ff@pages@countreg\relax
26617 \ifodd\count@\relax
26618 \advance\count@ by 1\relax
26619 \fi
26620 \@for\@ff@id:=#1\do{%
26621 \@dynamicframeid{\@ff@id}%
26622 \@df@chckifthispg[\@ff@pages@countreg]{\ff@id}%
26623 \def\@ff@prepages{}%
26624 \if@notthiscol
26625 \else
26626 \def\@ff@prepages{\number\@ff@pages@countreg,}%
26627 \fi
26628 \@df@chckifthispg[\count@]{\ff@id}%
26629 \ifnum\count@=\@ff@pages@countreg\relax
26630 \else
26631 \if@notthiscol
26632 \else
26633 \edef\@ff@prepages{\@ff@prepages\number\count@,}%
26634 \fi
26635 \fi
26636 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26637 \xdef\@ff@output@adjustframes{%
26638 \the\toks@
26639 \noexpand\dynamicsetpagelist{\number\ff@id}%
26640 {\@ff@prepages>\number\count@}%
26641 }%
26642 }%
26643 }
26644 \newcommand{\@dynamicswitchonnextodd}[1]{%
26645 \count@=\@ff@pages@countreg\relax
26646 \ifodd\count@\relax
26647 \advance\count@ by 1\relax
26648 \fi
26649 \@for\@ff@id:=#1\do{%
26650 \@df@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
26651 \def\@ff@prepages{}%
26652 \if@notthiscol
26653 \else
26654 \def\@ff@prepages{\number\@ff@pages@countreg,}%
26655 \fi
26656 \@df@chckifthispg[\count@]{\@ff@id}%
26657 \ifnum\count@=\@ff@pages@countreg\relax
26658 \else
26659 \if@notthiscol
26660 \else
26661 \edef\@ff@prepages{\@ff@prepages\number\count@,}%
26662 \fi
26663 \fi
26664 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26665 \xdef\@ff@output@adjustframes{%
26666 \the\toks@
26667 \noexpand\dynamicsetpagelist{\number\@ff@id}%
26668 {\@ff@prepages>\number\count@}%
26669 }%
26670 }%
26671 }
26672 \newcommand*{\dynamicswitchoffnext}{%
26673 \@ifstar\@sdynamicswitchoffnext\@dynamicswitchoffnext
26674 }
26675 \newcommand{\@sdynamicswitchoffnext}[1]{%
26676 \@for\@ff@id:=#1\do{%
26677 \@dynamicframeid{\@ff@id}%
26678 \@df@chckifthispg[\@ff@pages@countreg]{\ff@id}%
26679 \if@notthiscol
26680 \def\@ff@pages{none}%
26681 \else
26682 \def\@ff@pages{\number\@ff@pages@countreg}%
26683 \fi
26684 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26685 \xdef\@ff@output@adjustframes{%
26686 \the\toks@
26687 \noexpand\dynamicsetpagelist{\number\ff@id}{\@ff@pages}%
26688 }%
26689 }%
26690 }
26691 \newcommand{\@dynamicswitchoffnext}[1]{%
26692 \@for\@ff@id:=#1\do{%
26693 \@df@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
26694 \if@notthiscol
26695 \def\@ff@pages{none}%
26696 \else
26697 \def\@ff@pages{\number\@ff@pages@countreg}%
26698 \fi
26699 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26700 \xdef\@ff@output@adjustframes{%
26701 \the\toks@
26702 \noexpand\dynamicsetpagelist{\number\@ff@id}{\@ff@pages}%
26703 }%
26704 }%
26705 }
26706 \newcommand*{\dynamicswitchoffnextodd}{%
26707 \@ifstar\@sdynamicswitchoffnextodd\@dynamicswitchoffnextodd
26708 }
26709 \newcommand{\@sdynamicswitchoffnextodd}[1]{%
26710 \count@=\@ff@pages@countreg\relax
26711 \ifodd\@ff@pages@countreg\relax
26712 \advance\count@ by 1\relax
26713 \fi
26714 \@for\@ff@id:=#1\do{%
26715 \@dynamicframeid{\@ff@id}%
26716 \@df@chckifthispg[\@ff@pages@countreg]{\ff@id}%
26717 \if@notthiscol
26718 \ifnum\@ff@pages@countreg=\count@\relax
26719 \def\@ff@nextpages{none}%
26720 \else
26721 \@df@chckifthispg[\count@]{\ff@id}%
26722 \if@notthiscol
26723 \def\@ff@nextpages{none}%
26724 \else
26725 \def\@ff@nextpages{\number\count@}%
26726 \fi
26727 \fi
26728 \else
26729 \ifnum\@ff@pages@countreg=\count@\relax
26730 \def\@ff@nextpages{\number\@ff@pages@countreg}%
26731 \else
26732 \@df@chckifthispg[\count@]{\ff@id}%
26733 \if@notthiscol
26734 \def\@ff@nextpages{\number\@ff@pages@countreg}%
26735 \else
26736 \def\@ff@nextpages{\number\@ff@pages@countreg,\number\count@}%
26737 \fi
26738 \fi
26739 \fi
26740 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26741 \xdef\@ff@output@adjustframes{%
26742 \the\toks@
26743 \noexpand\dynamicsetpagelist{\number\ff@id}{\@ff@nextpages}%
26744 }%
26745 }%
26746 }
26747 \newcommand{\@dynamicswitchoffnextodd}[1]{%
26748 \count@=\@ff@pages@countreg\relax
26749 \ifodd\@ff@pages@countreg\relax
26750 \advance\count@ by 1\relax
26751 \fi
26752 \@for\@ff@id:=#1\do{%
26753 \@df@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
26754 \if@notthiscol
26755 \ifnum\@ff@pages@countreg=\count@\relax
26756 \def\@ff@nextpages{none}%
26757 \else
26758 \@df@chckifthispg[\count@]{\@ff@id}%
26759 \if@notthiscol
26760 \def\@ff@nextpages{none}%
26761 \else
26762 \def\@ff@nextpages{\number\count@}%
26763 \fi
26764 \fi
26765 \else
26766 \ifnum\@ff@pages@countreg=\count@\relax
26767 \def\@ff@nextpages{\number\@ff@pages@countreg}%
26768 \else
26769 \@df@chckifthispg[\count@]{\@ff@id}%
26770 \if@notthiscol
26771 \def\@ff@nextpages{\number\@ff@pages@countreg}%
26772 \else
26773 \def\@ff@nextpages{\number\@ff@pages@countreg,\number\count@}%
26774 \fi
26775 \fi
26776 \fi
26777 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26778 \xdef\@ff@output@adjustframes{%
26779 \the\toks@
26780 \noexpand\dynamicsetpagelist{\number\@ff@id}{\@ff@nextpages}%
26781 }%
26782 }%
26783 }
26784 \newcommand*{\dynamicswitchonnextonly}{%
26785 \@ifstar\@sdynamicswitchonnextonly\@dynamicswitchonnextonly
26786 }
26787 \newcommand{\@sdynamicswitchonnextonly}[1]{%
26788 \count@=\@ff@pages@countreg\relax
26789 \advance\count@ by 1\relax
26790 \@for\@ff@id:=#1\do{%
26791 \@dynamicframeid{\@ff@id}%
26792 \@df@chckifthispg[\@ff@pages@countreg]{\ff@id}%
26793 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26794 \if@notthiscol
26795 \xdef\@ff@output@adjustframes{%
26796 \the\toks@
26797 \noexpand\dynamicsetpagelist{\number\ff@id}{\number\count@}%
26798 }%
26799 \else
26800 \xdef\@ff@output@adjustframes{%
26801 \the\toks@
26802 \noexpand\dynamicsetpagelist{\number\ff@id}%
26803 {\number\@ff@pages@countreg,\number\count@}%
26804 }%
26805 \fi
26806 }%
26807 }
26808 \newcommand{\@dynamicswitchonnextonly}[1]{%
26809 \count@=\@ff@pages@countreg\relax
26810 \advance\count@ by 1\relax
26811 \@for\@ff@id:=#1\do{%
26812 \@df@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
26813 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26814 \if@notthiscol
26815 \xdef\@ff@output@adjustframes{%
26816 \the\toks@
26817 \noexpand\dynamicsetpagelist{\number\@ff@id}{\number\count@}%
26818 }%
26819 \else
26820 \xdef\@ff@output@adjustframes{%
26821 \the\toks@
26822 \noexpand\dynamicsetpagelist{\number\@ff@id}%
26823 {\number\@ff@pages@countreg,\number\count@}%
26824 }%
26825 \fi
26826 }%
26827 }
26828 \newcommand*{\dynamicswitchonnextoddonly}{%
26829 \@ifstar\@sdynamicswitchonnextoddonly\@dynamicswitchonnextoddonly
26830 }
26831 \newcommand{\@sdynamicswitchonnextoddonly}[1]{%
26832 \@for\@ff@id:=#1\do{%
26833 \@dynamicframeid{\@ff@id}%
26834 \@df@chckifthispg[\@ff@pages@countreg]{\ff@id}%
26835 \if@notthiscol
26836 \ifodd\@ff@pages@countreg
26837 \count@=\@ff@pages@countreg\relax
26838 \advance\count@ by 1\relax
26839 \@df@chckifthispg[\count@]{\ff@id}%
26840 \if@notthiscol
26841 \advance\count@ by 1\relax
26842 \edef\@ff@pages{\number\count@}%
26843 \else
26844 \edef\@ff@pages{\number\count@}%
26845 \advance\count@ by 1\relax
26846 \edef\@ff@pages{\@ff@pages,\number\count@}%
26847 \fi
26848 \else
26849 \count@=\@ff@pages@countreg\relax
26850 \advance\count@ by 1\relax
26851 \edef\@ff@pages{\number\count@}%
26852 \fi
26853 \else
26854 \ifodd\@ff@pages@countreg
26855 \count@=\@ff@pages@countreg\relax
26856 \advance\count@ by 1\relax
26857 \@df@chckifthispg[\count@]{\ff@id}%
26858 \if@notthiscol
26859 \advance\count@ by 1\relax
26860 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
26861 \else
26862 \advance\count@ by 1\relax
26863 \edef\@ff@pages{\number\@ff@pages@countreg-\number\count@}%
26864 \fi
26865 \else
26866 \count@=\@ff@pages@countreg\relax
26867 \advance\count@ by 1\relax
26868 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
26869 \fi
26870 \fi
26871 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26872 \xdef\@ff@output@adjustframes{%
26873 \the\toks@
26874 \noexpand\dynamicsetpagelist{\number\ff@id}{\@ff@pages}%
26875 }%
26876 }%
26877 }
26878 \newcommand{\@dynamicswitchonnextoddonly}[1]{%
26879 \@for\@ff@id:=#1\do{%
26880 \@df@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
26881 \if@notthiscol
26882 \ifodd\@ff@pages@countreg
26883 \count@=\@ff@pages@countreg\relax
26884 \advance\count@ by 1\relax
26885 \@df@chckifthispg[\count@]{\@ff@id}%
26886 \if@notthiscol
26887 \advance\count@ by 1\relax
26888 \edef\@ff@pages{\number\count@}%
26889 \else
26890 \edef\@ff@pages{\number\count@}%
26891 \advance\count@ by 1\relax
26892 \edef\@ff@pages{\@ff@pages,\number\count@}%
26893 \fi
26894 \else
26895 \count@=\@ff@pages@countreg\relax
26896 \advance\count@ by 1\relax
26897 \edef\@ff@pages{\number\count@}%
26898 \fi
26899 \else
26900 \ifodd\@ff@pages@countreg
26901 \count@=\@ff@pages@countreg\relax
26902 \advance\count@ by 1\relax
26903 \@df@chckifthispg[\count@]{\@ff@id}%
26904 \if@notthiscol
26905 \advance\count@ by 1\relax
26906 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
26907 \else
26908 \advance\count@ by 1\relax
26909 \edef\@ff@pages{\number\@ff@pages@countreg-\number\count@}%
26910 \fi
26911 \else
26912 \count@=\@ff@pages@countreg\relax
26913 \advance\count@ by 1\relax
26914 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
26915 \fi
26916 \fi
26917 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26918 \xdef\@ff@output@adjustframes{%
26919 \the\toks@
26920 \noexpand\dynamicsetpagelist{\number\@ff@id}{\@ff@pages}%
26921 }%
26922 }%
26923 }
26924 \newcommand*{\dynamicswitchoffnextonly}{%
26925 \@ifstar\@sdynamicswitchoffnextonly\@dynamicswitchoffnextonly
26926 }
26927 \newcommand{\@sdynamicswitchoffnextonly}[1]{%
26928 \count@=\@ff@pages@countreg\relax
26929 \advance\count@ by 1\relax
26930 \@for\@ff@id:=#1\do{%
26931 \@dynamicframeid{\@ff@id}%
26932 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26933 \xdef\@ff@output@adjustframes{%
26934 \the\toks@
26935 \noexpand\dynamicaddexclusion{\number\ff@id}{\number\count@}%
26936 }%
26937 }%
26938 }
26939 \newcommand{\@dynamicswitchoffnextonly}[1]{%
26940 \count@=\@ff@pages@countreg\relax
26941 \advance\count@ by 1\relax
26942 \@for\@ff@id:=#1\do{%
26943 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26944 \xdef\@ff@output@adjustframes{%
26945 \the\toks@
26946 \noexpand\dynamicaddexclusion{\number\@ff@id}{\number\count@}%
26947 }%
26948 }%
26949 }
26950 \newcommand*{\dynamicswitchoffnextoddonly}{%
26951 \@ifstar\@sdynamicswitchoffnextoddonly\@dynamicswitchoffnextoddonly
26952 }
26953 \newcommand{\@sdynamicswitchoffnextoddonly}[1]{%
26954 \count@=\@ff@pages@countreg\relax
26955 \advance\count@ by 1\relax
26956 \ifodd\count@\relax
26957 \else
26958 \advance\count@ by 1\relax
26959 \fi
26960 \@for\@ff@id:=#1\do{%
26961 \@dynamicframeid{\@ff@id}%
26962 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26963 \xdef\@ff@output@adjustframes{%
26964 \the\toks@
26965 \noexpand\dynamicaddexclusion{\number\ff@id}{\number\count@}%
26966 }%
26967 }%
26968 }
26969 \newcommand{\@dynamicswitchoffnextoddonly}[1]{%
26970 \count@=\@ff@pages@countreg\relax
26971 \advance\count@ by 1\relax
26972 \ifodd\count@\relax
26973 \else
26974 \advance\count@ by 1\relax
26975 \fi
26976 \@for\@ff@id:=#1\do{%
26977 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26978 \xdef\@ff@output@adjustframes{%
26979 \the\toks@
26980 \noexpand\dynamicaddexclusion{\number\@ff@id}{\number\count@}%
26981 }%
26982 }%
26983 }
26984 \newcommand*{\staticswitchonnext}{%
26985 \@ifstar\@sstaticswitchonnext\@staticswitchonnext
26986 }
26987 \newcommand{\@sstaticswitchonnext}[1]{%
26988 \@for\@ff@id:=#1\do{%
26989 \@staticframeid{\@ff@id}%
26990 \@sf@chckifthispg[\@ff@pages@countreg]{\ff@id}%
26991 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
26992 \if@notthiscol
26993 \xdef\@ff@output@adjustframes{%
26994 \the\toks@
26995 \noexpand\staticsetpagelist{\number\ff@id}{>\number\@ff@pages@countreg}%
26996 }%
26997 \else
26998 \xdef\@ff@output@adjustframes{%
26999 \the\toks@
27000 \noexpand\staticsetpagelist{\number\ff@id}%
27001 {\number\@ff@pages@countreg,>\number\@ff@pages@countreg}%
27002 }%
27003 \fi
27004 }%
27005 }
27006 \newcommand{\@staticswitchonnext}[1]{%
27007 \@for\@ff@id:=#1\do{%
27008 \@sf@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
27009 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27010 \if@notthiscol
27011 \xdef\@ff@output@adjustframes{%
27012 \the\toks@
27013 \noexpand\staticsetpagelist{\number\@ff@id}{>\number\@ff@pages@countreg}%
27014 }%
27015 \else
27016 \xdef\@ff@output@adjustframes{%
27017 \the\toks@
27018 \noexpand\staticsetpagelist{\number\@ff@id}%
27019 {\number\@ff@pages@countreg,>\number\@ff@pages@countreg}%
27020 }%
27021 \fi
27022 }%
27023 }
27024 \newcommand*{\staticswitchonnextodd}{%
27025 \@ifstar\@sstaticswitchonnextodd\@staticswitchonnextodd
27026 }
27027 \newcommand{\@sstaticswitchonnextodd}[1]{%
27028 \count@=\@ff@pages@countreg\relax
27029 \ifodd\count@\relax
27030 \advance\count@ by 1\relax
27031 \fi
27032 \@for\@ff@id:=#1\do{%
27033 \@staticframeid{\@ff@id}%
27034 \@sf@chckifthispg[\@ff@pages@countreg]{\ff@id}%
27035 \def\@ff@prepages{}%
27036 \if@notthiscol
27037 \else
27038 \def\@ff@prepages{\number\@ff@pages@countreg,}%
27039 \fi
27040 \@sf@chckifthispg[\count@]{\ff@id}%
27041 \ifnum\count@=\@ff@pages@countreg\relax
27042 \else
27043 \if@notthiscol
27044 \else
27045 \edef\@ff@prepages{\@ff@prepages\number\count@,}%
27046 \fi
27047 \fi
27048 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27049 \xdef\@ff@output@adjustframes{%
27050 \the\toks@
27051 \noexpand\staticsetpagelist{\number\ff@id}%
27052 {\@ff@prepages>\number\count@}%
27053 }%
27054 }%
27055 }
27056 \newcommand{\@staticswitchonnextodd}[1]{%
27057 \count@=\@ff@pages@countreg\relax
27058 \ifodd\count@\relax
27059 \advance\count@ by 1\relax
27060 \fi
27061 \@for\@ff@id:=#1\do{%
27062 \@sf@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
27063 \def\@ff@prepages{}%
27064 \if@notthiscol
27065 \else
27066 \def\@ff@prepages{\number\@ff@pages@countreg,}%
27067 \fi
27068 \@sf@chckifthispg[\count@]{\@ff@id}%
27069 \ifnum\count@=\@ff@pages@countreg\relax
27070 \else
27071 \if@notthiscol
27072 \else
27073 \edef\@ff@prepages{\@ff@prepages\number\count@,}%
27074 \fi
27075 \fi
27076 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27077 \xdef\@ff@output@adjustframes{%
27078 \the\toks@
27079 \noexpand\staticsetpagelist{\number\@ff@id}%
27080 {\@ff@prepages>\number\count@}%
27081 }%
27082 }%
27083 }
27084 \newcommand*{\staticswitchoffnext}{%
27085 \@ifstar\@sstaticswitchoffnext\@staticswitchoffnext
27086 }
27087 \newcommand{\@sstaticswitchoffnext}[1]{%
27088 \@for\@ff@id:=#1\do{%
27089 \@staticframeid{\@ff@id}%
27090 \@sf@chckifthispg[\@ff@pages@countreg]{\ff@id}%
27091 \if@notthiscol
27092 \def\@ff@pages{none}%
27093 \else
27094 \def\@ff@pages{\number\@ff@pages@countreg}%
27095 \fi
27096 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27097 \xdef\@ff@output@adjustframes{%
27098 \the\toks@
27099 \noexpand\staticsetpagelist{\number\ff@id}{\@ff@pages}%
27100 }%
27101 }%
27102 }
27103 \newcommand{\@staticswitchoffnext}[1]{%
27104 \@for\@ff@id:=#1\do{%
27105 \@sf@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
27106 \if@notthiscol
27107 \def\@ff@pages{none}%
27108 \else
27109 \def\@ff@pages{\number\@ff@pages@countreg}%
27110 \fi
27111 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27112 \xdef\@ff@output@adjustframes{%
27113 \the\toks@
27114 \noexpand\staticsetpagelist{\number\@ff@id}{\@ff@pages}%
27115 }%
27116 }%
27117 }
27118 \newcommand*{\staticswitchoffnextodd}{%
27119 \@ifstar\@sstaticswitchoffnextodd\@staticswitchoffnextodd
27120 }
27121 \newcommand{\@sstaticswitchoffnextodd}[1]{%
27122 \count@=\@ff@pages@countreg\relax
27123 \ifodd\@ff@pages@countreg\relax
27124 \advance\count@ by 1\relax
27125 \fi
27126 \@for\@ff@id:=#1\do{%
27127 \@staticframeid{\@ff@id}%
27128 \@sf@chckifthispg[\@ff@pages@countreg]{\ff@id}%
27129 \if@notthiscol
27130 \ifnum\@ff@pages@countreg=\count@\relax
27131 \def\@ff@nextpages{none}%
27132 \else
27133 \@sf@chckifthispg[\count@]{\ff@id}%
27134 \if@notthiscol
27135 \def\@ff@nextpages{none}%
27136 \else
27137 \def\@ff@nextpages{\number\count@}%
27138 \fi
27139 \fi
27140 \else
27141 \ifnum\@ff@pages@countreg=\count@\relax
27142 \def\@ff@nextpages{\number\@ff@pages@countreg}%
27143 \else
27144 \@sf@chckifthispg[\count@]{\ff@id}%
27145 \if@notthiscol
27146 \def\@ff@nextpages{\number\@ff@pages@countreg}%
27147 \else
27148 \def\@ff@nextpages{\number\@ff@pages@countreg,\number\count@}%
27149 \fi
27150 \fi
27151 \fi
27152 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27153 \xdef\@ff@output@adjustframes{%
27154 \the\toks@
27155 \noexpand\staticsetpagelist{\number\ff@id}{\@ff@nextpages}%
27156 }%
27157 }%
27158 }
27159 \newcommand{\@staticswitchoffnextodd}[1]{%
27160 \count@=\@ff@pages@countreg\relax
27161 \ifodd\@ff@pages@countreg\relax
27162 \advance\count@ by 1\relax
27163 \fi
27164 \@for\@ff@id:=#1\do{%
27165 \@sf@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
27166 \if@notthiscol
27167 \ifnum\@ff@pages@countreg=\count@\relax
27168 \def\@ff@nextpages{none}%
27169 \else
27170 \@sf@chckifthispg[\count@]{\@ff@id}%
27171 \if@notthiscol
27172 \def\@ff@nextpages{none}%
27173 \else
27174 \def\@ff@nextpages{\number\count@}%
27175 \fi
27176 \fi
27177 \else
27178 \ifnum\@ff@pages@countreg=\count@\relax
27179 \def\@ff@nextpages{\number\@ff@pages@countreg}%
27180 \else
27181 \@sf@chckifthispg[\count@]{\@ff@id}%
27182 \if@notthiscol
27183 \def\@ff@nextpages{\number\@ff@pages@countreg}%
27184 \else
27185 \def\@ff@nextpages{\number\@ff@pages@countreg,\number\count@}%
27186 \fi
27187 \fi
27188 \fi
27189 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27190 \xdef\@ff@output@adjustframes{%
27191 \the\toks@
27192 \noexpand\staticsetpagelist{\number\@ff@id}{\@ff@nextpages}%
27193 }%
27194 }%
27195 }
27196 \newcommand*{\staticswitchonnextonly}{%
27197 \@ifstar\@sstaticswitchonnextonly\@staticswitchonnextonly
27198 }
27199 \newcommand{\@sstaticswitchonnextonly}[1]{%
27200 \count@=\@ff@pages@countreg\relax
27201 \advance\count@ by 1\relax
27202 \@for\@ff@id:=#1\do{%
27203 \@staticframeid{\@ff@id}%
27204 \@sf@chckifthispg[\@ff@pages@countreg]{\ff@id}%
27205 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27206 \if@notthiscol
27207 \xdef\@ff@output@adjustframes{%
27208 \the\toks@
27209 \noexpand\staticsetpagelist{\number\ff@id}{\number\count@}%
27210 }%
27211 \else
27212 \xdef\@ff@output@adjustframes{%
27213 \the\toks@
27214 \noexpand\staticsetpagelist{\number\ff@id}%
27215 {\number\@ff@pages@countreg,\number\count@}%
27216 }%
27217 \fi
27218 }%
27219 }
27220 \newcommand{\@staticswitchonnextonly}[1]{%
27221 \count@=\@ff@pages@countreg\relax
27222 \advance\count@ by 1\relax
27223 \@for\@ff@id:=#1\do{%
27224 \@sf@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
27225 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27226 \if@notthiscol
27227 \xdef\@ff@output@adjustframes{%
27228 \the\toks@
27229 \noexpand\staticsetpagelist{\number\@ff@id}{\number\count@}%
27230 }%
27231 \else
27232 \xdef\@ff@output@adjustframes{%
27233 \the\toks@
27234 \noexpand\staticsetpagelist{\number\@ff@id}%
27235 {\number\@ff@pages@countreg,\number\count@}%
27236 }%
27237 \fi
27238 }%
27239 }
27240 \newcommand*{\staticswitchonnextoddonly}{%
27241 \@ifstar\@sstaticswitchonnextoddonly\@staticswitchonnextoddonly
27242 }
27243 \newcommand{\@sstaticswitchonnextoddonly}[1]{%
27244 \@for\@ff@id:=#1\do{%
27245 \@staticframeid{\@ff@id}%
27246 \@sf@chckifthispg[\@ff@pages@countreg]{\ff@id}%
27247 \if@notthiscol
27248 \ifodd\@ff@pages@countreg
27249 \count@=\@ff@pages@countreg\relax
27250 \advance\count@ by 1\relax
27251 \@sf@chckifthispg[\count@]{\ff@id}%
27252 \if@notthiscol
27253 \advance\count@ by 1\relax
27254 \edef\@ff@pages{\number\count@}%
27255 \else
27256 \edef\@ff@pages{\number\count@}%
27257 \advance\count@ by 1\relax
27258 \edef\@ff@pages{\@ff@pages,\number\count@}%
27259 \fi
27260 \else
27261 \count@=\@ff@pages@countreg\relax
27262 \advance\count@ by 1\relax
27263 \edef\@ff@pages{\number\count@}%
27264 \fi
27265 \else
27266 \ifodd\@ff@pages@countreg
27267 \count@=\@ff@pages@countreg\relax
27268 \advance\count@ by 1\relax
27269 \@sf@chckifthispg[\count@]{\ff@id}%
27270 \if@notthiscol
27271 \advance\count@ by 1\relax
27272 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
27273 \else
27274 \advance\count@ by 1\relax
27275 \edef\@ff@pages{\number\@ff@pages@countreg-\number\count@}%
27276 \fi
27277 \else
27278 \count@=\@ff@pages@countreg\relax
27279 \advance\count@ by 1\relax
27280 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
27281 \fi
27282 \fi
27283 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27284 \xdef\@ff@output@adjustframes{%
27285 \the\toks@
27286 \noexpand\staticsetpagelist{\number\ff@id}{\@ff@pages}%
27287 }%
27288 }%
27289 }
27290 \newcommand{\@staticswitchonnextoddonly}[1]{%
27291 \@for\@ff@id:=#1\do{%
27292 \@sf@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
27293 \if@notthiscol
27294 \ifodd\@ff@pages@countreg
27295 \count@=\@ff@pages@countreg\relax
27296 \advance\count@ by 1\relax
27297 \@sf@chckifthispg[\count@]{\@ff@id}%
27298 \if@notthiscol
27299 \advance\count@ by 1\relax
27300 \edef\@ff@pages{\number\count@}%
27301 \else
27302 \edef\@ff@pages{\number\count@}%
27303 \advance\count@ by 1\relax
27304 \edef\@ff@pages{\@ff@pages,\number\count@}%
27305 \fi
27306 \else
27307 \count@=\@ff@pages@countreg\relax
27308 \advance\count@ by 1\relax
27309 \edef\@ff@pages{\number\count@}%
27310 \fi
27311 \else
27312 \ifodd\@ff@pages@countreg
27313 \count@=\@ff@pages@countreg\relax
27314 \advance\count@ by 1\relax
27315 \@sf@chckifthispg[\count@]{\@ff@id}%
27316 \if@notthiscol
27317 \advance\count@ by 1\relax
27318 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
27319 \else
27320 \advance\count@ by 1\relax
27321 \edef\@ff@pages{\number\@ff@pages@countreg-\number\count@}%
27322 \fi
27323 \else
27324 \count@=\@ff@pages@countreg\relax
27325 \advance\count@ by 1\relax
27326 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
27327 \fi
27328 \fi
27329 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27330 \xdef\@ff@output@adjustframes{%
27331 \the\toks@
27332 \noexpand\staticsetpagelist{\number\@ff@id}{\@ff@pages}%
27333 }%
27334 }%
27335 }
27336 \newcommand*{\staticswitchoffnextonly}{%
27337 \@ifstar\@sstaticswitchoffnextonly\@staticswitchoffnextonly
27338 }
27339 \newcommand{\@sstaticswitchoffnextonly}[1]{%
27340 \count@=\@ff@pages@countreg\relax
27341 \advance\count@ by 1\relax
27342 \@for\@ff@id:=#1\do{%
27343 \@staticframeid{\@ff@id}%
27344 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27345 \xdef\@ff@output@adjustframes{%
27346 \the\toks@
27347 \noexpand\staticaddexclusion{\number\ff@id}{\number\count@}%
27348 }%
27349 }%
27350 }
27351 \newcommand{\@staticswitchoffnextonly}[1]{%
27352 \count@=\@ff@pages@countreg\relax
27353 \advance\count@ by 1\relax
27354 \@for\@ff@id:=#1\do{%
27355 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27356 \xdef\@ff@output@adjustframes{%
27357 \the\toks@
27358 \noexpand\staticaddexclusion{\number\@ff@id}{\number\count@}%
27359 }%
27360 }%
27361 }
27362 \newcommand*{\staticswitchoffnextoddonly}{%
27363 \@ifstar\@sstaticswitchoffnextoddonly\@staticswitchoffnextoddonly
27364 }
27365 \newcommand{\@sstaticswitchoffnextoddonly}[1]{%
27366 \count@=\@ff@pages@countreg\relax
27367 \advance\count@ by 1\relax
27368 \ifodd\count@\relax
27369 \else
27370 \advance\count@ by 1\relax
27371 \fi
27372 \@for\@ff@id:=#1\do{%
27373 \@staticframeid{\@ff@id}%
27374 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27375 \xdef\@ff@output@adjustframes{%
27376 \the\toks@
27377 \noexpand\staticaddexclusion{\number\ff@id}{\number\count@}%
27378 }%
27379 }%
27380 }
27381 \newcommand{\@staticswitchoffnextoddonly}[1]{%
27382 \count@=\@ff@pages@countreg\relax
27383 \advance\count@ by 1\relax
27384 \ifodd\count@\relax
27385 \else
27386 \advance\count@ by 1\relax
27387 \fi
27388 \@for\@ff@id:=#1\do{%
27389 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
27390 \xdef\@ff@output@adjustframes{%
27391 \the\toks@
27392 \noexpand\staticaddexclusion{\number\@ff@id}{\number\count@}%
27393 }%
27394 }%
27395 }
27396 \newcommand*{\ffaddtoadjustframeshook}[1]{%
27397 \@ff@addtolist\@ff@output@adjustframes\entry{#1}%
27398 }
27399 \newif\if@notthiscol
27400 \newif\if@ff@nwpg
27401 \newcount\c@curpg
27402 \newcommand*{\@g@tnextcol}[1]{%
27403 \@ff@output@adjustframes
27404 \global\let\@ff@output@adjustframes\@empty
27405 \@ff@checkifmoreframes
27406 \if@ff@moreframes
27407 \else
27408 \PackageWarning{flowfram}%
27409 {Run out of flows frames on page \number\@ff@pages@countreg, adding new one}%
27410 \flf@doifverbose
27411 {%
27412 \def\flf@messinfo{Here's the list of flow frames:}%
27413 \count@=0\relax
27414 \loop
27415 \advance\count@ by 1\relax
27416 \expandafter\toks@\expandafter{\flf@messinfo\MessageBreak}%
27417 \edef\flf@messinfo{\the\toks@
27418 \number\count@.
27419 Pages: \csname @ff@pages@\romannumeral\count@\endcsname.
27420 Exclusions: \csname @ff@xpages@\romannumeral\count@\endcsname.
27421 }%
27422 \ifnum\count@<\c@maxflow
27423 \repeat
27424 \PackageInfo{flowfram}{\flf@messinfo\@gobbletwo}%
27425 }%
27426 \@onecolumn
27427 #1=\c@maxflow
27428 \fi
27429 \@notthiscoltrue
27430 \@ff@nwpgfalse
27431 \@colN=#1\relax
27432 \c@curpg=\@ff@pages@countreg
27433 \loop
27434 \ifnum\@colN=\c@maxflow
27435 \@colN=1\relax
27436 \@ff@nwpgtrue
27437 \advance\c@curpg by 1\relax
27438 \else
27439 \advance\@colN by 1\relax
27440 \fi
27441 \@ff@chckifthispg{\c@curpg}{\@colN}%
27442 \if@notthiscol
27443 \repeat
27444 #1=\@colN\relax
27445 }
27446 \newcommand*{\@ff@chckifthispg}[2]{%
27447 \@notthiscolfalse
27448 \edef\ff@xpages{\csname @ff@xpages@\romannumeral#2\endcsname}%
27449 \@for\@ff@pp:=\ff@xpages\do
27450 {%
27451 \ifnum0\@ff@pp=#1\relax
27452 \@notthiscoltrue
27453 \@endfortrue
27454 \fi
27455 }%
27456 \if@notthiscol
27457 \else
27458 \@notthiscoltrue
27459 \edef\ff@pages{\csname @ff@pages@\romannumeral#2\endcsname}%
27460 \@@ff@chckifthispg{#1}%
27461 \fi
27462 }
27463 \newcommand*{\@@ff@chckifthispg}[1]{%
27464 \ifthenelse{\equal{\ff@pages}{none}}%
27465 {}%
27466 {%
27467 \ifthenelse{\equal{\ff@pages}{all}}%
27468 {%
27469 \@notthiscolfalse
27470 }%
27471 {%
27472 \ifthenelse{\equal{\ff@pages}{odd}}%
27473 {%
27474 \ifodd#1\@notthiscolfalse\fi
27475 }%
27476 {%
27477 \ifthenelse{\equal{\ff@pages}{even}}%
27478 {%
27479 \ifodd#1\else\@notthiscolfalse\fi
27480 }%
27481 {%
27482 \@for\@ff@pp:=\ff@pages\do{%
27483 \def\@ff@numstart{0}%
27484 \def\@ff@numend{0}%
27485 \@ff@getrange{\@ff@pp}%
27486 \ifthenelse{#1<\@ff@numstart \or #1>\@ff@numend}%
27487 {}%
27488 {%
27489 \@notthiscolfalse
27490 }%
27491 }%
27492 }%
27493 }%
27494 }%
27495 }%
27496 }
27497 \newcommand*{\@sf@chckifthispg}[2][\@ff@pages@countreg]{%
27498 \@notthiscoltrue
27499 \edef\ff@pages{\csname @sf@pages@\romannumeral#2\endcsname}%
27500 \@@ff@chckifthispg{#1}%
27501 }
27502 \newcommand*{\@df@chckifthispg}[2][\@ff@pages@countreg]{%
27503 \@notthiscoltrue
27504 \edef\ff@pages{\csname @df@pages@\romannumeral#2\endcsname}%
27505 \@@ff@chckifthispg{#1}%
27506 }
27507 \newcommand*{\@setcolbox}[1]{%
27508 \flf@message{Setting contents of box for flow frame \number#1}%
27509 \expandafter\global\expandafter\setbox
27510 \csname column\romannumeral#1\endcsname\box\@outputbox
27511 }
27512 \newcommand*{\@docolbox}[1]{%
27513 \flf@message{Doing flow frame \number#1\space
27514 (page \number\@ff@pages@countreg)}%
27515 \edef\ff@frametype{%
27516 \csname @ff@frametype@\romannumeral#1\endcsname}%
27517 \edef\ff@col{\csname @ff@col@\romannumeral#1\endcsname}%
27518 \edef\ff@txtcol{\csname @ff@txtcol@\romannumeral#1\endcsname}%
27519 \edef\ff@backcol{\csname @ff@backcol@\romannumeral#1\endcsname}%
27520 \@ff@setoffset{#1}%
27521 \rotateframe{\csname @ff@angle@\romannumeral#1\endcsname}%
27522 {%
27523 \ifthenelse{\boolean{columnframe\romannumeral#1}}%
27524 {%
27525 \@ff@fbox
27526 {\csname colwidth\romannumeral#1\endcsname}%
27527 {\csname colheight\romannumeral#1\endcsname}%
27528 {%
27529 \expandafter\box\csname column\romannumeral#1\endcsname
27530 }%
27531 {%
27532 \csname\ff@frametype\endcsname
27533 }%
27534 }%
27535 {%
27536 \@ff@box
27537 {\csname colwidth\romannumeral#1\endcsname}%
27538 {\csname colheight\romannumeral#1\endcsname}%
27539 {%
27540 \expandafter\box\csname column\romannumeral#1\endcsname
27541 }%
27542 }%
27543 }%
27544 }
27545 \newcommand*{\@docolbbox}[1]{%
27546 \@ff@setoffset{#1}%
27547 \def\ff@col{}\def\ff@txtcol{}%
27548 \@fr@meifdraft
27549 {%
27550 \@ff@box
27551 {\csname colwidth\romannumeral#1\endcsname}%
27552 {\csname colheight\romannumeral#1\endcsname}%
27553 {%
27554 \expandafter\box\csname column\romannumeral#1\endcsname
27555 }%
27556 }%
27557 {F:\number#1;\csname @col@id@\romannumeral#1\endcsname}%
27558 }
27559 \newcommand{\@ff@fbox}[4]{%
27560 {%
27561 \fboxsep=\flowframesep
27562 \fboxrule=\flowframerule
27563 \@s@tffcol
27564 \kern\@ff@offset
27565 #4{\@ff@box{#1}{#2}{#3}}%
27566 }%
27567 }
27568 \newcommand{\@ff@box}[3]{%
27569 {%
27570 \@ffbackground
27571 {%
27572 \vbox to#2 {\hb@xt@ #1{\hss{\@s@tfftextcol #3}\hss}\vss\kern\z@}%
27573 }%
27574 }%
27575 }
27576 \newcommand*{\@putcolbox}[1]{%
27577 \@ff@chckifthispg{\@ff@pages@countreg}{#1}%
27578 \if@notthiscol
27579 \expandafter\ifvoid\csname column\romannumeral#1\endcsname
27580 \else
27581 \PackageWarning{flowfram}{Box \number#1\space is not void.
27582 Dumping. This page: \number\@ff@pages@countreg.
27583 Page list: "\csname @ff@pages@\romannumeral#1\endcsname".
27584 Exclusion list: "\csname @ff@xpages@\romannumeral#1\endcsname".
27585 (Maybe the page list was changed after this frame was
27586 selected or maybe you should use package option pages=absolute)}%
27587 \@notthiscolfalse
27588 \fi
27589 \fi
27590 \if@notthiscol
27591 \flf@message{Flow frame \number#1\space is not required on page
27592 \number\@ff@pages@countreg}%
27593 \else
27594 \@killglue
27595 \if@twoside
27596 \ifodd\c@page
27597 \expandafter\raise\csname col@\romannumeral#1@posy\endcsname
27598 \hb@xt@\z@
27599 {%
27600 \expandafter\kern \csname col@\romannumeral#1@posx\endcsname
27601 \@docolbox{#1}\hss
27602 }%
27603 \else
27604 \expandafter\raise\csname col@\romannumeral#1@eveny\endcsname
27605 \hb@xt@\z@
27606 {%
27607 \expandafter\kern \csname col@\romannumeral#1@evenx\endcsname
27608 \@docolbox{#1}\hss
27609 }%
27610 \fi
27611 \else
27612 \expandafter\raise\csname col@\romannumeral#1@posy\endcsname
27613 \hb@xt@\z@
27614 {%
27615 \expandafter\kern \csname col@\romannumeral#1@posx\endcsname
27616 \@docolbox{#1}\hss
27617 }%
27618 \fi
27619 \fi
27620 }
27621 \newcommand*{\@putcolbbox}[1]{%
27622 \@ff@chckifthispg{\@ff@pages@countreg}{#1}%
27623 \if@notthiscol
27624 \else
27625 \@killglue
27626 \if@twoside
27627 \ifodd\c@page
27628 \expandafter\raise\csname col@\romannumeral#1@posy\endcsname
27629 \hb@xt@\z@
27630 {%
27631 \expandafter\kern \csname col@\romannumeral#1@posx\endcsname
27632 \@docolbbox{#1}\hss
27633 }%
27634 \else
27635 \expandafter\raise\csname col@\romannumeral#1@eveny\endcsname
27636 \hb@xt@\z@
27637 {%
27638 \expandafter\kern \csname col@\romannumeral#1@evenx\endcsname
27639 \@docolbbox{#1}\hss
27640 }%
27641 \fi
27642 \else
27643 \expandafter\raise\csname col@\romannumeral#1@posy\endcsname
27644 \hb@xt@\z@
27645 {%
27646 \expandafter\kern \csname col@\romannumeral#1@posx\endcsname
27647 \@docolbbox{#1}\hss
27648 }%
27649 \fi
27650 \fi
27651 }
27652 \newcommand*{\@ff@s@t@doubleboxoffset}{%
27653 \setlength{\@ff@offset}{-\flowframesep}%
27654 \addtolength{\@ff@offset}{-3.75\flowframerule}%
27655 \addtolength{\@ff@offset}{-.5pt}%
27656 }
27657 \newcommand*{\@ff@s@t@ovalboxoffset}{%
27658 \@ff@offset=-\fontdimen 8\tenln\relax
27659 \advance\@ff@offset by -\flowframesep\relax
27660 }
27661 \newcommand*{\@ff@s@t@Ovalboxoffset}{%
27662 \@ff@offset=-\fontdimen 8\tenlnw\relax
27663 \advance\@ff@offset by -\flowframesep\relax
27664 }
27665 \newcommand*{\@ff@s@t@defaultoffset}{%
27666 \@ff@offset=-\flowframesep\relax
27667 \addtolength{\@ff@offset}{-\flowframerule}%
27668 }
27669 \newcommand*{\@ff@setoffset}[1]{%
27670 \ifthenelse
27671 {\equal{\csname @ff@offset@\romannumeral#1\endcsname}{compute}}%
27672 {%
27673 \ifthenelse{\boolean{columnframe\romannumeral#1}}%
27674 {%
27675 \ifthenelse
27676 {%
27677 \equal{\csname @ff@frametype@\romannumeral#1\endcsname}%
27678 {doublebox}%
27679 }%
27680 {%
27681 \@ff@s@t@doubleboxoffset
27682 }%
27683 {%
27684 \ifthenelse
27685 {%
27686 \equal{\csname @ff@frametype@\romannumeral#1\endcsname}%
27687 {ovalbox}%
27688 }%
27689 {%
27690 \@ff@s@t@ovalboxoffset
27691 }%
27692 {%
27693 \ifthenelse
27694 {%
27695 \equal{\csname @ff@frametype@\romannumeral#1\endcsname}%
27696 {Ovalbox}%
27697 }%
27698 {%
27699 \@ff@s@t@Ovalboxoffset
27700 }%
27701 {%
27702 \@ff@s@t@defaultoffset
27703 }%
27704 }%
27705 }%
27706 }%
27707 {}%
27708 }%
27709 {%
27710 \setlength{\@ff@offset}%
27711 {\csname @ff@offset@\romannumeral#1\endcsname}%
27712 }%
27713 }
27714 \newcommand*{\@sf@setoffset}[1]{%
27715 \ifthenelse
27716 {%
27717 \equal{\csname @sf@offset@\romannumeral#1\endcsname}%
27718 {compute}%
27719 }%
27720 {%
27721 \ifthenelse{\boolean{staticframe\romannumeral#1}}%
27722 {%
27723 \ifthenelse
27724 {%
27725 \equal{\csname @sf@frametype@\romannumeral#1\endcsname}%
27726 {doublebox}%
27727 }%
27728 {%
27729 \@ff@s@t@doubleboxoffset
27730 }%
27731 {%
27732 \ifthenelse
27733 {%
27734 \equal{\csname @sf@frametype@\romannumeral#1\endcsname}%
27735 {ovalbox}%
27736 }%
27737 {%
27738 \@ff@s@t@ovalboxoffset
27739 }%
27740 {%
27741 \ifthenelse
27742 {%
27743 \equal{\csname @sf@frametype@\romannumeral#1\endcsname}%
27744 {Ovalbox}%
27745 }%
27746 {%
27747 \@ff@s@t@Ovalboxoffset
27748 }%
27749 {%
27750 \@ff@s@t@defaultoffset
27751 }%
27752 }%
27753 }%
27754 }%
27755 {}%
27756 }%
27757 {%
27758 \setlength{\@ff@offset}%
27759 {\csname @sf@offset@\romannumeral#1\endcsname}%
27760 }%
27761 }
27762 \newcommand*{\@df@setoffset}[1]{%
27763 \ifthenelse
27764 {%
27765 \equal{\csname @df@offset@\romannumeral#1\endcsname}%
27766 {compute}%
27767 }%
27768 {%
27769 \setlength{\@ff@offset}{0pt}%
27770 \ifthenelse{\boolean{dynamicframe\romannumeral#1}}%
27771 {%
27772 \ifthenelse
27773 {%
27774 \equal{\csname @df@frametype@\romannumeral#1\endcsname}%
27775 {doublebox}%
27776 }%
27777 {%
27778 \@ff@s@t@doubleboxoffset
27779 }%
27780 {%
27781 \ifthenelse
27782 {%
27783 \equal{\csname @df@frametype@\romannumeral#1\endcsname}%
27784 {ovalbox}%
27785 }%
27786 {%
27787 \@ff@s@t@ovalboxoffset
27788 }%
27789 {%
27790 \ifthenelse
27791 {%
27792 \equal{\csname @df@frametype@\romannumeral#1\endcsname}%
27793 {Ovalbox}%
27794 }%
27795 {%
27796 \@ff@s@t@Ovalboxoffset
27797 }%
27798 {%
27799 \@ff@s@t@defaultoffset
27800 }%
27801 }%
27802 }%
27803 }%
27804 {}%
27805 }%
27806 {%
27807 \setlength{\@ff@offset}%
27808 {\csname @df@offset@\romannumeral#1\endcsname}%
27809 }%
27810 }
27811 \newcommand*{\@putmarginbox}[1]{%
27812 \@ff@chckifthispg{\@ff@pages@countreg}{#1}%
27813 \if@notthiscol
27814 \else
27815 \@killglue
27816 \if@twoside
27817 \ifodd\c@page
27818 \edef\ff@x{\csname col@\romannumeral#1@posx\endcsname}%
27819 \edef\ff@y{\csname col@\romannumeral#1@posy\endcsname}%
27820 \else
27821 \edef\ff@x{\csname col@\romannumeral#1@evenx\endcsname}%
27822 \edef\ff@y{\csname col@\romannumeral#1@eveny\endcsname}%
27823 \fi
27824 \else
27825 \edef\ff@x{\csname col@\romannumeral#1@posx\endcsname}%
27826 \edef\ff@y{\csname col@\romannumeral#1@posy\endcsname}%
27827 \fi
27828 \setlength{\@ff@tmp@x}{\ff@x}%
27829 \setlength{\@ff@tmp@y}{\ff@y}%
27830 \@getmarginpos{\csname @ff@margin@\romannumeral#1\endcsname}%
27831 \ifthenelse{\equal{\ff@margin}{left}}%
27832 {%
27833 \addtolength{\@ff@tmp@x}{-\marginparwidth}%
27834 \addtolength{\@ff@tmp@x}{-\marginparsep}%
27835 \ifthenelse{\boolean{columnframe\romannumeral#1}}%
27836 {}%
27837 {}%
27838 }%
27839 {%
27840 \addtolength{\@ff@tmp@x}%
27841 {\csname colwidth\romannumeral#1\endcsname}%
27842 \addtolength{\@ff@tmp@x}{\marginparsep}%
27843 \ifthenelse{\boolean{columnframe\romannumeral#1}}%
27844 {}%
27845 {}%
27846 }%
27847 \raise\@ff@tmp@y
27848 \hb@xt@\z@
27849 {%
27850 \expandafter\kern\@ff@tmp@x
27851 \@fr@meifdraft{\@ff@box{\marginparwidth}%
27852 {\csname colheight\romannumeral#1\endcsname}{}}%
27853 {M:\number#1}\hss
27854 }%
27855 \fi
27856 \ignorespaces
27857 }
27858 \newcommand*{\@ff@drawmargins}{%
27859 \@colN=0\relax
27860 \whiledo{\@colN<\c@maxflow}%
27861 {%
27862 \advance\@colN by 1\relax
27863 \makebox[0pt][l]{\@putmarginbox{\@colN}}%
27864 }%
27865 }
27866 \def\@ff@getstaticpos[#1][#2][#3]#4{%
27867 \@ff@tmp@x=#4\relax
27868 \@ff@tmp@y=#2\relax
27869 \def\ff@valign{#3}%
27870 }
27871 \newcommand*{\@dostaticbox}[1]{%
27872 \edef\ff@frametype{%
27873 \csname @sf@frametype@\romannumeral#1\endcsname
27874 }%
27875 \edef\ff@col{\csname @sf@col@\romannumeral#1\endcsname}%
27876 \edef\ff@backcol{\csname @sf@backcol@\romannumeral#1\endcsname}%
27877 \@sf@setoffset{#1}%
27878 \expandafter\expandafter\expandafter
27879 \@ff@getstaticpos\csname @sf@dim@\romannumeral#1\endcsname
27880 \rotateframe
27881 {\csname @sf@angle@\romannumeral#1\endcsname}%
27882 {%
27883 \ifthenelse{\boolean{staticframe\romannumeral#1}}%
27884 {%
27885 \@ff@fbox{\@ff@tmp@x}{\@ff@tmp@y}%
27886 {%
27887 \expandafter\usebox\csname @staticframe@\romannumeral#1\endcsname
27888 }
27889 {\csname\ff@frametype\endcsname}%
27890 }%
27891 {%
27892 \@ff@box{\@ff@tmp@x}{\@ff@tmp@y}%
27893 {%
27894 \expandafter\usebox\csname @staticframe@\romannumeral#1\endcsname
27895 }%
27896 }%
27897 }%
27898 }
27899 \newcommand*{\@dostaticbbox}[1]{%
27900 \edef\ff@col{}%
27901 \@sf@setoffset{#1}%
27902 \expandafter\expandafter\expandafter
27903 \@ff@getstaticpos\csname @sf@dim@\romannumeral#1\endcsname
27904 \@fr@meifdraft
27905 {%
27906 \@ff@box{\@ff@tmp@x}{\@ff@tmp@y}%
27907 {%
27908 \expandafter\usebox\csname @staticframe@\romannumeral#1\endcsname
27909 }%
27910 }%
27911 {S:\number#1;\csname @sf@id@\romannumeral#1\endcsname}%
27912 }
27913 \newcommand*{\@putstaticbox}[1]{%
27914 \ifthenelse{\boolean{@sf@hidethis@\romannumeral#1}}%
27915 {%
27916 \@notthiscoltrue
27917 \global\csletcs{if@sf@hidethis@\romannumeral#1}{iffalse}%
27918 }%
27919 {%
27920 \ifthenelse{\boolean{@sf@hide@\romannumeral#1}}%
27921 {%
27922 \@notthiscoltrue
27923 }%
27924 {%
27925 \@sf@chckifthispg{#1}%
27926 }%
27927 }%
27928 \if@notthiscol
27929 \else
27930 \@killglue
27931 \if@twoside
27932 \ifodd\c@page
27933 \expandafter\raise\csname @sf@\romannumeral#1@posy\endcsname
27934 \hb@xt@\z@
27935 {%
27936 \expandafter\kern \csname @sf@\romannumeral#1@posx\endcsname
27937 \@dostaticbox{#1}\hss
27938 }%
27939 \else
27940 \expandafter\raise\csname @sf@\romannumeral#1@eveny\endcsname
27941 \hb@xt@\z@
27942 {%
27943 \expandafter\kern \csname @sf@\romannumeral#1@evenx\endcsname
27944 \@dostaticbox{#1}\hss
27945 }%
27946 \fi
27947 \else
27948 \expandafter\raise\csname @sf@\romannumeral#1@posy\endcsname
27949 \hb@xt@\z@
27950 {%
27951 \expandafter\kern \csname @sf@\romannumeral#1@posx\endcsname
27952 \@dostaticbox{#1}\hss
27953 }%
27954 \fi
27955 \fi
27956 }
27957 \newcommand*{\@putstaticbbox}[1]{%
27958 \@sf@chckifthispg{#1}%
27959 \if@notthiscol
27960 \else
27961 \@killglue
27962 \if@twoside
27963 \ifodd\c@page
27964 \expandafter\raise\csname @sf@\romannumeral#1@posy\endcsname
27965 \hb@xt@\z@
27966 {%
27967 \expandafter\kern \csname @sf@\romannumeral#1@posx\endcsname
27968 \@dostaticbbox{#1}\hss
27969 }%
27970 \ignorespaces
27971 \else
27972 \expandafter\raise\csname @sf@\romannumeral#1@eveny\endcsname
27973 \hb@xt@\z@
27974 {%
27975 \expandafter\kern \csname @sf@\romannumeral#1@evenx\endcsname
27976 \@dostaticbbox{#1}\hss
27977 }%
27978 \ignorespaces
27979 \fi
27980 \else
27981 \expandafter\raise\csname @sf@\romannumeral#1@posy\endcsname
27982 \hb@xt@\z@
27983 {%
27984 \expandafter\kern \csname @sf@\romannumeral#1@posx\endcsname
27985 \@dostaticbbox{#1}\hss
27986 }%
27987 \ignorespaces
27988 \fi
27989 \fi
27990 }
27991 \newcommand*{\@resetst@tics}{%
27992 \@colN=0\relax
27993 \whiledo{\@colN<\c@maxstatic}%
27994 {%
27995 \advance\@colN by 1\relax
27996 \ifthenelse{\boolean{@sf@clear@\romannumeral\@colN}}%
27997 {%
27998 \global\sbox
27999 {%
28000 \csname @staticframe@\romannumeral\@colN\endcsname
28001 }%
28002 {}%
28003 }%
28004 {}%
28005 }%
28006 }
28007 \newcommand*{\@resetdyn@mics}{%
28008 \@colN=0\relax
28009 \whiledo{\@colN<\c@maxdynamic}%
28010 {%
28011 \advance\@colN by 1\relax
28012 \ifthenelse{\boolean{@df@clear@\romannumeral\@colN}}%
28013 {%
28014 \expandafter\global\expandafter
28015 \gdef\csname @dynamicframe@\romannumeral\@colN\endcsname{}%
28016 }%
28017 {}%
28018 }%
28019 }
28020 \newcommand*{\@dodfparbox}[1]{%
28021 \expandafter\let\expandafter
28022 \@ff@parshape\csname @df@shape@\romannumeral#1\endcsname
28023 \expandafter\@ff@getshape\@ff@parshape\relax
28024 \ifcase\ff@shape
28025 \expandafter\expandafter\expandafter
28026 \parbox\csname @df@dim@\romannumeral#1\endcsname
28027 {%
28028 \setlength\parindent\sdfparindent
28029 \csname\ff@style\endcsname{\ff@contents}%
28030 }%
28031 \or
28032 \expandafter\expandafter\expandafter
28033 \parbox\csname @df@dim@\romannumeral#1\endcsname
28034 {%
28035 \setlength\parindent\sdfparindent
28036 \csname\ff@style\endcsname
28037 {{%
28038 \let\oldpar=\par
28039 \let\par=\ffpshpar
28040 \@ff@setsecthead
28041 \@ff@parshape
28042 \ff@contents\oldpar
28043 }}%
28044 }%
28045 \or
28046 \expandafter\expandafter\expandafter
28047 \parbox\csname @df@dim@\romannumeral#1\endcsname
28048 {%
28049 \setlength\parindent\sdfparindent
28050 \csname\ff@style\endcsname
28051 {{%
28052 \@ff@disablesec\@ff@parshape
28053 \ff@contents\par
28054 }}%
28055 }%
28056 \fi
28057 }
28058 \newcommand*{\@dodynamicbox}[1]{%
28059 \edef\ff@frametype{%
28060 \csname @df@frametype@\romannumeral#1\endcsname
28061 }%
28062 \edef\ff@col{\csname @df@col@\romannumeral#1\endcsname}%
28063 \edef\ff@txtcol{\csname @df@txtcol@\romannumeral#1\endcsname}%
28064 \edef\ff@backcol{\csname @df@backcol@\romannumeral#1\endcsname}%
28065 \edef\ff@style{\csname @df@style@\romannumeral#1\endcsname}%
28066 \def\ff@contents{\csname @dynamicframe@\romannumeral#1\endcsname}%
28067 \@df@setoffset{#1}%
28068 \expandafter\expandafter\expandafter
28069 \@ff@getstaticpos\csname @df@dim@\romannumeral#1\endcsname
28070 \rotateframe{\csname @df@angle@\romannumeral#1\endcsname}%
28071 {%
28072 \ifthenelse{\boolean{dynamicframe\romannumeral#1}}%
28073 {%
28074 \@ff@fbox{\@ff@tmp@x}{\@ff@tmp@y}%
28075 {\@dodfparbox{#1}}%
28076 {\csname\ff@frametype\endcsname}%
28077 }%
28078 {%
28079 \@ff@box{\@ff@tmp@x}{\@ff@tmp@y}%
28080 {%
28081 \@dodfparbox{#1}%
28082 }%
28083 }%
28084 }%
28085 }
28086 \newcommand*{\@dodynamicbbox}[1]{%
28087 \edef\ff@col{}%
28088 \@df@setoffset{#1}%
28089 \expandafter\expandafter\expandafter
28090 \@ff@getstaticpos\csname @df@dim@\romannumeral#1\endcsname
28091 \@fr@meifdraft
28092 {%
28093 \@ff@box{\@ff@tmp@x}{\@ff@tmp@y}%
28094 {%
28095 \expandafter\expandafter\expandafter
28096 \parbox\csname @df@dim@\romannumeral#1\endcsname
28097 {}%
28098 }%
28099 }%
28100 {D:\number#1;\csname @df@id@\romannumeral#1\endcsname}%
28101 }
28102 \newcommand*{\@putdynamicbox}[1]{%
28103 \ifthenelse{\boolean{@df@hidethis@\romannumeral#1}}%
28104 {%
28105 \@notthiscoltrue
28106 \global\csletcs{if@df@hidethis@\romannumeral#1}{iffalse}%
28107 }%
28108 {%
28109 \ifthenelse{\boolean{@df@hide@\romannumeral#1}}%
28110 {%
28111 \@notthiscoltrue
28112 }%
28113 {%
28114 \@df@chckifthispg{#1}%
28115 }%
28116 }%
28117 \if@notthiscol
28118 \else
28119 \@killglue
28120 \if@twoside
28121 \ifodd\c@page
28122 \expandafter\raise\csname @df@\romannumeral#1@posy\endcsname
28123 \hb@xt@\z@
28124 {%
28125 \expandafter\kern \csname @df@\romannumeral#1@posx\endcsname
28126 \@dodynamicbox{#1}\hss
28127 }%
28128 \ignorespaces
28129 \else
28130 \expandafter\raise\csname @df@\romannumeral#1@eveny\endcsname
28131 \hb@xt@\z@
28132 {%
28133 \expandafter\kern \csname @df@\romannumeral#1@evenx\endcsname
28134 \@dodynamicbox{#1}\hss
28135 }%
28136 \ignorespaces
28137 \fi
28138 \else
28139 \expandafter\raise\csname @df@\romannumeral#1@posy\endcsname
28140 \hb@xt@\z@
28141 {%
28142 \expandafter\kern \csname @df@\romannumeral#1@posx\endcsname
28143 \@dodynamicbox{#1}\hss
28144 }%
28145 \ignorespaces
28146 \fi
28147 \fi
28148 }
28149 \newcommand*{\@putdynamicbbox}[1]{%
28150 \@df@chckifthispg{#1}%
28151 \if@notthiscol
28152 \else
28153 \@killglue
28154 \if@twoside
28155 \ifodd\c@page
28156 \expandafter\raise\csname @df@\romannumeral#1@posy\endcsname
28157 \hb@xt@\z@
28158 {%
28159 \expandafter\kern \csname @df@\romannumeral#1@posx\endcsname
28160 \@dodynamicbbox{#1}\hss
28161 }%
28162 \ignorespaces
28163 \else
28164 \expandafter\raise\csname @df@\romannumeral#1@eveny\endcsname
28165 \hb@xt@\z@
28166 {%
28167 \expandafter\kern \csname @df@\romannumeral#1@evenx\endcsname
28168 \@dodynamicbbox{#1}\hss
28169 }%
28170 \ignorespaces
28171 \fi
28172 \else
28173 \expandafter\raise\csname @df@\romannumeral#1@posy\endcsname
28174 \hb@xt@\z@
28175 {%
28176 \expandafter\kern \csname @df@\romannumeral#1@posx\endcsname
28177 \@dodynamicbbox{#1}\hss
28178 }%
28179 \ignorespaces
28180 \fi
28181 \fi
28182 }
28183 \newcommand*{\@@doheader}{%
28184 \setlength\@ff@tmp@y{\textheight}%
28185 \addtolength{\@ff@tmp@y}{\headsep}%
28186 \def\ff@col{}%
28187 \def\ff@txtcol{}%
28188 \def\ff@backcol{{none}}%
28189 \@ff@box{0pt}{\@ff@tmp@y}{\makebox[0pt][l]{\@dothehead}}%
28190 }
28191 \newcommand*{\@@dofooter}{%
28192 \setlength\@ff@tmp@y{-\footskip}%
28193 \def\ff@col{}%
28194 \def\ff@txtcol{}%
28195 \def\ff@backcol{{none}}%
28196 \@ff@box{0pt}{\@ff@tmp@y}{\makebox[0pt][l]{\@dothefoot}}%
28197 }
28198 \newcommand{\@s@tfr@mes}[1]{%
28199 {%
28200 \@picht\textheight
28201 \setbox\@picbox\hb@xt@ \textwidth
28202 \bgroup
28203 \hbox
28204 \bgroup
28205 #1\relax
28206 \egroup
28207 \hss
28208 \egroup
28209 \ht\@picbox\@picht
28210 \dp\@picbox\z@
28211 \mbox{\box\@picbox}%
28212 }%
28213 }
28214 \newcommand*{\@ff@doallflowframes}{%
28215 \@colN=0\relax
28216 \whiledo{\@colN<\c@maxflow}%
28217 {%
28218 \advance\@colN by 1\relax
28219 \@putcolbox{\@colN}%
28220 }%
28221 }
28222 \newcommand*{\@ff@doallflowframesbbox}{%
28223 \@colN=0\relax
28224 \whiledo{\@colN<\c@maxflow}%
28225 {%
28226 \advance\@colN by 1\relax
28227 \@putcolbbox{\@colN}%
28228 }%
28229 }
28230 \newcommand*{\@ff@doallstatics}{%
28231 \@colN=0\relax
28232 \whiledo{\@colN<\c@maxstatic}%
28233 {%
28234 \advance\@colN by 1\relax
28235 \@putstaticbox{\@colN}%
28236 }%
28237 }
28238 \newcommand*{\@ff@doallstaticsbbox}{%
28239 \@colN=0\relax
28240 \whiledo{\@colN<\c@maxstatic}%
28241 {%
28242 \advance\@colN by 1\relax
28243 \@putstaticbbox{\@colN}%
28244 }%
28245 }
28246 \newcommand*{\@ff@doalldynamics}{%
28247 \@colN=0\relax
28248 \whiledo{\@colN<\c@maxdynamic}%
28249 {%
28250 \advance\@colN by 1\relax
28251 \@putdynamicbox{\@colN}%
28252 }%
28253 }
28254 \newcommand*{\@ff@doalldynamicsbbox}{%
28255 \@colN=0\relax
28256 \whiledo{\@colN<\c@maxdynamic}%
28257 {%
28258 \advance\@colN by 1\relax
28259 \@putdynamicbbox{\@colN}%
28260 }%
28261 }
28262 \newcommand*{\@ff@dotypeblock}{%
28263 \makebox[0pt][l]%
28264 {%
28265 \@fr@meifdraft[\setffdrafttypeblockcolor]%
28266 {%
28267 \vbox to \textheight{\hbox to \textwidth{}}%
28268 }%
28269 {}%
28270 }%
28271 }
28272 \newlength\ffevenoffset
28273 \newcommand*{\@ff@do@allframes}{%
28274 \ffevenoffset=0pt\relax
28275 \if@twoside
28276 \ifodd\c@page
28277 \else
28278 \ffevenoffset=-\oddsidemargin\relax
28279 \advance\ffevenoffset by \evensidemargin\relax
28280 \kern\ffevenoffset\relax
28281 \fi
28282 \fi
28283 \setlength{\@ff@tmp@x}{\textwidth}%
28284 \advance\@ff@tmp@x by -\ffevenoffset\relax
28285 \makebox[\@ff@tmp@x][l]%
28286 {%
28287 \@s@tfr@mes
28288 {%
28289 \@ff@doallstatics
28290 \@@doheader
28291 \@@dofooter
28292 \@ff@doallflowframes
28293 \@ff@doalldynamics
28294 \ifshowtypeblock
28295 \@ff@dotypeblock
28296 \fi
28297 \ifshowframebbox
28298 \@ff@doallstaticsbbox
28299 \@ff@doallflowframesbbox
28300 \@ff@doalldynamicsbbox
28301 \fi
28302 \ifshowmargins
28303 \@ff@drawmargins
28304 \fi
28305 }%
28306 }%
28307 }
28308 \newcount\@nxtcol
28309 \def\@outputdblcol{%
28310 \@nxtcol=\c@thisframe
28311 \c@curpg=\@ff@pages@countreg
28312 \@g@tnextcol{\@nxtcol}%
28313 \if@ff@nwpg
28314 \global\@firstcolumntrue
28315 \@setcolbox\c@thisframe
28316 \if@specialpage
28317 \global\@specialpagefalse
28318 \@nameuse{ps@\@specialstyle}\relax
28319 \fi
28320 \if@twoside
28321 \ifodd\count\z@
28322 \let\@thehead\@oddhead
28323 \let\@thefoot\@oddfoot
28324 \else
28325 \let\@thehead\@evenhead
28326 \let\@thefoot\@evenfoot
28327 \fi
28328 \else
28329 \let\@thehead\@oddhead
28330 \let\@thefoot\@oddfoot
28331 \fi
28332 \@begindvi
28333 \@dodynamicthehead\@dodynamicthefoot
28334 \vbadness=\@M
28335 \setbox\@outputbox\vbox{\hbox to \textwidth{\@ff@do@allframes}}%
28336 \@combinedblfloats
28337 \@outputpage
28338 \advance\c@curpg by -\@ff@pages@countreg\relax
28339 \whiledo{\c@curpg>0}%
28340 {%
28341 \advance\c@curpg by -1\relax
28342 \setbox\@outputbox\vbox{\hbox to \textwidth{\@ff@do@allframes}}%
28343 \@outputpage
28344 }
28345 \begingroup
28346 \@dblfloatplacement
28347 \@startdblcolumn
28348 \@whilesw \if@fcolmade \fi
28349 {\@outputpage \@startdblcolumn }%
28350 \endgroup
28351 \@resetst@tics
28352 \@resetdyn@mics
28353 \else
28354 \global\@firstcolumnfalse
28355 \@setcolbox\c@thisframe
28356 \fi
28357 \global\c@thisframe=\@nxtcol
28358 \@setcol{\c@thisframe}\relax
28359 \global\@colht\vsize
28360 }
28361 \def\@dblfloatplacement{%
28362 \global\@dbltopnum\c@dbltopnumber
28363 \global\@dbltoproom\dbltopfraction\@colht\@textmin
28364 \@colht\advance\@textmin -\@dbltoproom
28365 \@fpmin\dblfloatpagefraction\vsize
28366 \@fptop \@dblfptop \@fpsep \@dblfpsep \@fpbot \@dblfpbot
28367 }
28368 \newenvironment{statictable}{\def\@captype{table}}{}
28369 \newenvironment{staticfigure}{\def\@captype{figure}}{}
28370 \newif\ifffvadjust
28371 \ffvadjusttrue
28372 \renewcommand*{\onecolumn}{\@onecolumn}
28373 \newcommand*{\@onecolumn}[1][all]{%
28374 \@onecolumninarea[#1]{\textwidth}{\textheight}{0pt}{0pt}%
28375 }
28376 \newlength\columnheight
28377 \newcommand*{\onecolumninarea}{\@onecolumninarea}
28378 \@onlypreamble{\onecolumninarea}
28379 \newcommand*{\@onecolumninarea}[5][all]{%
28380 \setlength{\columnheight}{#3}%
28381 \ifffvadjust
28382 \adjustheight{\columnheight}%
28383 \fi
28384 \@n@wflowframe[#1]{#2}{\columnheight}{#4}{#5}%
28385 }
28386 \renewcommand*{\twocolumn}{\@twocolumn}
28387 \newcommand*{\@twocolumn}[1][all]{%
28388 \@twocolumninarea[#1]{\textwidth}{\textheight}{0pt}{0pt}%
28389 }
28390 \newcommand*{\twocolumninarea}{\@twocolumninarea}
28391 \@onlypreamble{\twocolumninarea}
28392 \newcommand*{\@twocolumninarea}[5][all]{%
28393 \setlength{\columnheight}{#3}%
28394 \ifffvadjust
28395 \adjustheight{\columnheight}%
28396 \fi
28397 \setlength{\columnwidth}{#2}%
28398 \addtolength{\columnwidth}{-\columnsep}%
28399 \divide\columnwidth by 2\relax
28400 \setlength{\@ff@tmp@x}{#4}%
28401 \addtolength{\@ff@tmp@x}{\columnwidth}%
28402 \addtolength{\@ff@tmp@x}{\columnsep}%
28403 \iflefttorightcolumns
28404 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{#4}{#5}%
28405 \setflowframe{\c@maxflow}{margin=left}%
28406 \else
28407 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{\@ff@tmp@x}{#5}%
28408 \setflowframe{\c@maxflow}{margin=right}%
28409 \fi
28410 \iflefttorightcolumns
28411 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{\@ff@tmp@x}{#5}%
28412 \setflowframe{\c@maxflow}{margin=right}%
28413 \else
28414 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{#4}{#5}%
28415 \setflowframe{\c@maxflow}{margin=left}%
28416 \fi
28417 }
28418 \newcommand*{\Ncolumn}[2][all]{%
28419 \Ncolumninarea[#1]{#2}{\textwidth}{\textheight}{0pt}{0pt}%
28420 }
28421 \@onlypreamble{\Ncolumn}
28422 \newcommand*{\Ncolumninarea}[6][all]{%
28423 \ifnum#2>2\relax
28424 \@Ncolumninarea[#1]{#2}{#3}{#4}{#5}{#6}%
28425 \else
28426 \ifcase#2\relax
28427 \PackageError{flowfram}%
28428 {%
28429 You have requested 0 flowframes!%
28430 }%
28431 {%
28432 It does not make much sense to ask to create 0 flow frames%
28433 }%
28434 \or
28435 \onecolumninarea[#1]{#3}{#4}{#5}{#6}%
28436 \or
28437 \twocolumninarea[#1]{#3}{#4}{#5}{#6}%
28438 \else
28439 \PackageError{flowfram}%
28440 {%
28441 Can't create a negative number of flow frames!%
28442 }%
28443 {%
28444 You have asked for \number#2 \space flow frames
28445 which really doesn't make sense%
28446 }%
28447 \fi
28448 \fi
28449 }
28450
28451 \@onlypreamble{\Ncolumninarea}
28452 \newcommand*{\@Ncolumninarea}[6][all]{%
28453 \@colN=#2\relax
28454 \advance\@colN by -1\relax
28455 \setlength{\columnwidth}{#3}%
28456 \addtolength{\columnwidth}{-\@colN\columnsep}%
28457 \divide\columnwidth by #2\relax
28458 \setlength{\@ff@tmp@x}{#5}%
28459 \iflefttorightcolumns
28460 \else
28461 \addtolength{\@ff@tmp@x}{#3}%
28462 \addtolength{\@ff@tmp@x}{-\columnwidth}%
28463 \fi
28464 \setlength{\columnheight}{#4}%
28465 \ifffvadjust\adjustheight{\columnheight}\fi%
28466 \@colN=0\relax
28467 \loop
28468 \advance\@colN by 1\relax
28469 \newflowframe[#1]{\columnwidth}{\columnheight}{\@ff@tmp@x}{#6}%
28470 \iflefttorightcolumns
28471 \addtolength{\@ff@tmp@x}{\columnwidth}%
28472 \addtolength{\@ff@tmp@x}{\columnsep}%
28473 \else
28474 \addtolength{\@ff@tmp@x}{-\columnwidth}%
28475 \addtolength{\@ff@tmp@x}{-\columnsep}%
28476 \fi
28477 \ifnum\@colN<#2
28478 \repeat
28479 }
28480 \newlength{\vcolumnsep}
28481 \setlength{\vcolumnsep}{\columnsep}
28482 \newcommand*{\onecolumntop}[3][all]{%
28483 \onecolumntopinarea[#1]{#2}{#3}{\textwidth}{\textheight}{0pt}{0pt}%
28484 }
28485 \@onlypreamble{\onecolumntop}
28486 \newcommand*{\onecolumnStop}[2][all]{%
28487 \onecolumntopinarea[#1]{static}{#2}{\textwidth}{\textheight}{0pt}{0pt}%
28488 }
28489 \newcommand*{\onecolumnDtop}[2][all]{%
28490 \onecolumntopinarea[#1]{dynamic}{#2}{\textwidth}{\textheight}{0pt}{0pt}%
28491 }
28492 \newcommand*{\newframe}[6][all]{%
28493 \ifthenelse{\equal{#2}{flow}}%
28494 {%
28495 \@n@wflowframe[#1]{#3}{#4}{#5}{#6}%
28496 }%
28497 {%
28498 \ifthenelse{\equal{#2}{dynamic}}%
28499 {%
28500 \@n@wdynamicframe[#1]{#3}{#4}{#5}{#6}%
28501 }%
28502 {%
28503 \ifthenelse{\equal{#2}{static}}%
28504 {%
28505 \@n@wstaticframe[#1]{#3}{#4}{#5}{#6}%
28506 }%
28507 {%
28508 \PackageError{flowfram}%
28509 {Unknown frame type '#2'}%
28510 {%
28511 Available frame types are: 'flow', 'static' and 'dynamic'%
28512 }%
28513 }%
28514 }%
28515 }%
28516 }
28517 \newlength\@ff@staticH
28518
28519 \newcommand*{\onecolumntopinarea}[7][all]{%
28520 \setlength{\@ff@staticH}{#3}%
28521 \setlength{\@ff@tmp@y}{#5}%
28522 \addtolength{\@ff@tmp@y}{-\@ff@staticH}%
28523 \setlength{\columnheight}{\@ff@tmp@y}%
28524 \addtolength{\columnheight}{-\vcolumnsep}%
28525 \ifffvadjust
28526 \adjustheight{\columnheight}%
28527 \fi
28528 \addtolength{\@ff@tmp@y}{#7}%
28529 \newframe[#1]{#2}{#4}{\@ff@staticH}{#6}{\@ff@tmp@y}%
28530 \@n@wflowframe[#1]{#4}{\columnheight}{#6}{#7}%
28531 }
28532
28533 \@onlypreamble{\onecolumntopinarea}
28534 \newcommand*{\onecolumnStopinarea}[6][all]{%
28535 \onecolumntopinarea[#1]{static}{#2}{#3}{#4}{#5}{#6}%
28536 }
28537 \newcommand*{\onecolumnDtopinarea}[6][all]{%
28538 \onecolumntopinarea[#1]{dynamic}{#2}{#3}{#4}{#5}{#6}%
28539 }
28540 \newcommand*{\twocolumntop}[3][all]{%
28541 \twocolumntopinarea[#1]{#2}{#3}{\textwidth}{\textheight}{0pt}{0pt}%
28542 }
28543 \@onlypreamble{\twocolumntop}
28544 \newcommand*{\twocolumnStop}[2][all]{%
28545 \@twocolumntopinarea[#1]{static}{#2}{\textwidth}{\textheight}{0pt}{0pt}%
28546 }
28547 \newcommand*{\twocolumnDtop}[2][all]{%
28548 \twocolumntop[#1]{dynamic}{#2}%
28549 }
28550 \newcommand*{\twocolumntopinarea}{\@twocolumntopinarea}
28551 \newcommand*{\@twocolumntopinarea}[7][all]{%
28552 \setlength{\@ff@staticH}{#3}%
28553 \setlength{\@ff@tmp@y}{#5}%
28554 \addtolength{\@ff@tmp@y}{-\@ff@staticH}%
28555 \setlength{\columnheight}{\@ff@tmp@y}%
28556 \addtolength{\@ff@tmp@y}{#7}%
28557 \newframe[#1]{#2}{#4}{\@ff@staticH}{#6}{\@ff@tmp@y}%
28558 \addtolength{\columnheight}{-\vcolumnsep}%
28559 \ifffvadjust\adjustheight{\columnheight}\fi
28560 \setlength{\columnwidth}{#4}%
28561 \addtolength{\columnwidth}{-\columnsep}%
28562 \divide\columnwidth by 2\relax
28563 \setlength{\@ff@tmp@x}{\columnwidth}%
28564 \addtolength{\@ff@tmp@x}{\columnsep}%
28565 \addtolength{\@ff@tmp@x}{#6}%
28566 \iflefttorightcolumns
28567 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{#6}{#7}%
28568 \setflowframe{\c@maxflow}{margin=left}%
28569 \else
28570 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{\@ff@tmp@x}{#7}%
28571 \setflowframe{\c@maxflow}{margin=right}%
28572 \fi
28573 \iflefttorightcolumns
28574 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{\@ff@tmp@x}{#7}%
28575 \setflowframe{\c@maxflow}{margin=right}%
28576 \else
28577 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{#6}{#7}%
28578 \setflowframe{\c@maxflow}{margin=left}%
28579 \fi
28580 }
28581 \@onlypreamble{\twocolumntopinarea}
28582 \newcommand*{\twocolumnStopinarea}[6][all]{%
28583 \twocolumntopinarea[#1]{static}{#2}{#3}{#4}{#5}{#6}%
28584 }
28585 \newcommand*{\twocolumnDtopinarea}[6][all]{%
28586 \twocolumntopinarea[#1]{dynamic}{#2}{#3}{#4}{#5}{#6}%
28587 }
28588 \newcommand*{\Ncolumntop}[4][all]{%
28589 \Ncolumntopinarea[#1]{#2}{#3}{#4}{\textwidth}{\textheight}{0pt}{0pt}%
28590 }
28591 \@onlypreamble{\Ncolumntop}
28592 \newcommand*{\NcolumnStop}[3][all]{%
28593 \Ncolumntop[#1]{static}{#2}{#3}%
28594 }
28595 \newcommand*{\NcolumnDtop}[3][all]{%
28596 \Ncolumntop[#1]{dynamic}{#2}{#3}%
28597 }
28598 \newcommand*{\Ncolumntopinarea}[8][all]{%
28599 \ifnum#3>2\relax
28600 \@Ncolumntopinarea[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
28601 \else
28602 \ifcase#3\relax
28603 \PackageError{flowfram}%
28604 {%
28605 You have requested 0 flowframes!%
28606 }%
28607 {%
28608 It does not make much sense to ask to create 0 flow frames%
28609 }%
28610 \or
28611 \onecolumntopinarea[#1]{#2}{#4}{#5}{#6}{#7}{#8}%
28612 \or
28613 \twocolumntopinarea[#1]{#2}{#4}{#5}{#6}{#7}{#8}%
28614 \else
28615 \PackageError{flowfram}%
28616 {%
28617 Can't create a negative number of flow frames!%
28618 }%
28619 {%
28620 You have asked for \number#3 \space flow frames
28621 which really doesn't make sense%
28622 }%
28623 \fi
28624 \fi
28625 }
28626 \@onlypreamble{\Ncolumntopinarea}
28627 \newcommand*{\@Ncolumntopinarea}[8][all]{%
28628 \setlength{\@ff@staticH}{#4}%
28629 \setlength{\@ff@tmp@y}{#6}%
28630 \addtolength{\@ff@tmp@y}{-\@ff@staticH}%
28631 \setlength{\columnheight}{\@ff@tmp@y}%
28632 \addtolength{\@ff@tmp@y}{#8}%
28633 \newframe[#1]{#2}{#5}{\@ff@staticH}{#7}{\@ff@tmp@y}%
28634 \addtolength{\columnheight}{-\vcolumnsep}%
28635 \ifffvadjust
28636 \adjustheight{\columnheight}%
28637 \fi
28638 \@colN=#3\relax
28639 \advance\@colN by -1\relax
28640 \setlength{\columnwidth}{#5}%
28641 \addtolength{\columnwidth}{-\@colN\columnsep}%
28642 \divide\columnwidth by #3\relax
28643 \setlength{\@ff@tmp@x}{#7}%
28644 \iflefttorightcolumns
28645 \else
28646 \addtolength{\@ff@tmp@x}{#5}%
28647 \addtolength{\@ff@tmp@x}{-\columnwidth}%
28648 \fi
28649 \@colN=0\relax
28650 \loop
28651 \advance\@colN by 1\relax
28652 \newflowframe[#1]{\columnwidth}{\columnheight}{\@ff@tmp@x}{#8}%
28653 \iflefttorightcolumns
28654 \addtolength{\@ff@tmp@x}{\columnwidth}%
28655 \addtolength{\@ff@tmp@x}{\columnsep}%
28656 \else
28657 \addtolength{\@ff@tmp@x}{-\columnwidth}%
28658 \addtolength{\@ff@tmp@x}{-\columnsep}%
28659 \fi
28660 \ifnum\@colN<#3
28661 \repeat
28662 }
28663 \newcommand*{\NcolumnStopinarea}[7][all]{%
28664 \Ncolumntopinarea[#1]{static}{#2}{#3}{#4}{#5}{#6}{#7}%
28665 }
28666 \newcommand*{\NcolumnDtopinarea}[7][all]{%
28667 \Ncolumntopinarea[#1]{dynamic}{#2}{#3}{#4}{#5}{#6}{#7}%
28668 }
28669 \newcommand*{\onecolumnbottom}[3][all]{%
28670 \onecolumnbottominarea[#1]{#2}{#3}{\textwidth}{\textheight}{0pt}{0pt}%
28671 }
28672 \@onlypreamble{\onecolumnbottom}
28673 \newcommand*{\onecolumnSbottom}[2][all]{%
28674 \onecolumnbottom[#1]{static}{#2}%
28675 }
28676 \newcommand*{\onecolumnDbottom}[2][all]{%
28677 \onecolumnbottom[#1]{dynamic}{#2}%
28678 }
28679 \newcommand*{\onecolumnbottominarea}[7][all]{%
28680 \setlength{\@ff@staticH}{#3}%
28681 \setlength{\columnheight}{#5}%
28682 \addtolength{\columnheight}{-\@ff@staticH}%
28683 \addtolength{\columnheight}{-\vcolumnsep}%
28684 \ifffvadjust
28685 \adjustheight{\columnheight}%
28686 \fi
28687 \setlength{\@ff@tmp@y}{#5}%
28688 \addtolength{\@ff@tmp@y}{-\columnheight}%
28689 \addtolength{\@ff@tmp@y}{#7}%
28690 \newframe[#1]{#2}{#4}{\@ff@staticH}{#6}{#7}%
28691 \newflowframe[#1]{#4}{\columnheight}{#6}{\@ff@tmp@y}%
28692 }
28693 \@onlypreamble{\onecolumnbottominarea}
28694 \newcommand*{\onecolumnSbottominarea}[6][all]{%
28695 \onecolumnbottominarea[#1]{static}{#2}{#3}{#4}{#5}{#6}%
28696 }
28697 \newcommand*{\onecolumnDbottominarea}[6][all]{%
28698 \onecolumnbottominarea[#1]{dynamic}{#2}{#3}{#4}{#5}{#6}%
28699 }
28700 \newcommand*{\twocolumnbottom}[3][all]{%
28701 \twocolumnSbottominarea[#1]{#2}{#3}{\textwidth}{\textheight}{0pt}{0pt}%
28702 }
28703 \@onlypreamble{\twocolumnbottom}
28704 \newcommand*{\twocolumnSbottom}[2][all]{%
28705 \twocolumnbottom[#1]{static}{#2}%
28706 }
28707 \newcommand*{\twocolumnDbottom}[2][all]{%
28708 \twocolumnbottom[#1]{dynamic}{#2}%
28709 }
28710 \newcommand*{\twocolumnbottominarea}[7][all]{%
28711 \setlength{\@ff@staticW}{#4}%
28712 \setlength{\@ff@staticH}{#3}%
28713 \setlength{\columnheight}{#5}%
28714 \addtolength{\columnheight}{-\@ff@staticH}%
28715 \addtolength{\columnheight}{-\vcolumnsep}%
28716 \ifffvadjust\adjustheight{\columnheight}\fi%
28717 \newframe[#1]{#2}{\@ff@staticW}{\@ff@staticH}{#6}{#7}%
28718 \setlength{\@ff@tmp@y}{#5}%
28719 \addtolength{\@ff@tmp@y}{-\columnheight}%
28720 \addtolength{\@ff@tmp@y}{#7}%
28721 \setlength{\columnwidth}{\@ff@staticW}%
28722 \addtolength{\columnwidth}{-\columnsep}%
28723 \divide\columnwidth by 2\relax
28724 \setlength{\@ff@tmp@x}{\columnwidth}%
28725 \addtolength{\@ff@tmp@x}{\columnsep}%
28726 \addtolength{\@ff@tmp@x}{#6}%
28727 \iflefttorightcolumns
28728 \newflowframe[#1]{\columnwidth}{\columnheight}{#6}{\@ff@tmp@y}%
28729 \setflowframe{\c@maxflow}{margin=left}%
28730 \else
28731 \newflowframe[#1]{\columnwidth}{\columnheight}%
28732 {\@ff@tmp@x}{\@ff@tmp@y}%
28733 \setflowframe{\c@maxflow}{margin=right}%
28734 \fi
28735 \iflefttorightcolumns
28736 \newflowframe[#1]{\columnwidth}{\columnheight}%
28737 {\@ff@tmp@x}{\@ff@tmp@y}%
28738 \setflowframe{\c@maxflow}{margin=right}%
28739 \else
28740 \newflowframe[#1]{\columnwidth}{\columnheight}{#6}{\@ff@tmp@y}%
28741 \setflowframe{\c@maxflow}{margin=left}%
28742 \fi
28743 }
28744 \@onlypreamble{\twocolumnbottominarea}
28745 \newcommand*{\twocolumnSbottominarea}[6][all]{%
28746 \twocolumnbottominarea[#1]{static}{#2}{#3}{#4}{#5}{#6}%
28747 }
28748 \newcommand*{\twocolumnDbottominarea}[6][all]{%
28749 \twocolumnbottominarea[#1]{dynamic}{#2}{#3}{#4}{#5}{#6}%
28750 }
28751 \newcommand*{\Ncolumnbottom}[4][all]{%
28752 \Ncolumnbottominarea[#1]{#2}{#3}{#4}{\textwidth}{\textheight}{0pt}{0pt}%
28753 }
28754 \@onlypreamble{\Ncolumnbottom}
28755 \newcommand*{\NcolumnSbottom}[3][all]{%
28756 \Ncolumnbottom[#1]{static}{#2}{#3}%
28757 }
28758 \newcommand*{\NcolumnDbottom}[3][all]{%
28759 \Ncolumnbottom[#1]{dynamic}{#2}{#3}%
28760 }
28761 \newcommand*{\Ncolumnbottominarea}[8][all]{%
28762 \ifnum#3>2\relax
28763 \@Ncolumnbottominarea[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
28764 \else
28765 \ifcase#3\relax
28766 \PackageError{flowfram}{%
28767 You have requested 0 flowframes!}{%
28768 It does not make much sense to ask to create 0 flow frames}
28769 \or
28770 \onecolumnbottominarea[#1]{#2}{#4}{#5}{#6}{#7}{#8}%
28771 \or
28772 \twocolumnbottominarea[#1]{#2}{#4}{#5}{#6}{#7}{#8}%
28773 \else
28774 \PackageError{flowfram}%
28775 {%
28776 Can't create a negative number of flow frames!%
28777 }%
28778 {%
28779 You have asked for \number#3 \space flow frames
28780 which really doesn't make sense%
28781 }%
28782 \fi
28783 \fi
28784 }
28785 \@onlypreamble{\Ncolumnbottominarea}
28786 \newcommand*{\@NcolumnSbottominarea}[8][all]{%
28787 \setlength{\@ff@staticH}{#4}%
28788 \setlength{\columnheight}{#6}%
28789 \addtolength{\columnheight}{-\@ff@staticH}%
28790 \addtolength{\columnheight}{-\vcolumnsep}%
28791 \ifffvadjust
28792 \adjustheight{\columnheight}%
28793 \fi
28794 \newframe[#1]{#2}{#5}{\@ff@staticH}{#7}{#8}%
28795 \setlength{\@ff@tmp@y}{#6}%
28796 \addtolength{\@ff@tmp@y}{-\columnheight}%
28797 \addtolength{\@ff@tmp@y}{#8}%
28798 \@colN=#3\relax
28799 \advance\@colN by -1\relax
28800 \setlength{\columnwidth}{#5}%
28801 \addtolength{\columnwidth}{-\@colN\columnsep}%
28802 \divide\columnwidth by #3\relax
28803 \setlength{\@ff@tmp@x}{#7}%
28804 \iflefttorightcolumns
28805 \else
28806 \addtolength{\@ff@tmp@x}{#5}%
28807 \addtolength{\@ff@tmp@x}{-\columnwidth}%
28808 \fi
28809 \@colN=0\relax
28810 \loop
28811 \advance\@colN by 1\relax
28812 \newflowframe[#1]{\columnwidth}{\columnheight}%
28813 {\@ff@tmp@x}{\@ff@tmp@y}%
28814 \iflefttorightcolumns
28815 \addtolength{\@ff@tmp@x}{\columnwidth}%
28816 \addtolength{\@ff@tmp@x}{\columnsep}%
28817 \else
28818 \addtolength{\@ff@tmp@x}{-\columnwidth}%
28819 \addtolength{\@ff@tmp@x}{-\columnsep}%
28820 \fi
28821 \ifnum\@colN<#3
28822 \repeat
28823 }
28824 \newcommand*{\NcolumnSbottominarea}[1][all]{%
28825 \Ncolumnbottominarea[#1]{static}%
28826 }
28827 \newcommand*{\NcolumnDbottominarea}[1][all]{%
28828 \Ncolumnbottominarea[#1]{dynamic}%
28829 }
28830 \newcount\@ff@adjh
28831 \newcommand*{\adjustheight}[1]{%
28832 \@ff@adjh=#1\relax
28833 \divide\@ff@adjh by \baselineskip\relax
28834 #1=\baselineskip\relax
28835 \multiply#1 by \@ff@adjh\relax
28836 }
28837 \newcommand*{\adjustcolsep}{%
28838 \multiply\columnsep by 2\relax
28839 \addtolength{\columnsep}{\marginparwidth}%
28840 }
28841 \newlength\@ff@staticW
28842 \newcommand*{\vtwotone}[1][all]{%
28843 \def\ff@pages{#1}%
28844 \@vtwotone
28845 }
28846
28847 \newcommand*{\@vtwotone}[1][0pt]{\@@vtwotonebottom{#1}{\paperheight}}
28848 \newcommand*{\@@vtwotonebottom}[8]{%
28849 \computeleftedgeodd{\@ff@tmp@x}%
28850 \if@twoside
28851 \computeleftedgeeven{\@ff@tmp@x@even}%
28852 \else
28853 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
28854 \fi
28855 \computebottomedge{\@ff@tmp@y}%
28856 \addtolength{\@ff@tmp@x}{#1}%
28857 \addtolength{\@ff@tmp@x@even}{#1}%
28858 \@nextvband{\ff@pages}{#2}{#3}{#4}{#5}%
28859 \@nextvband{\ff@pages}{#2}{#6}{#7}{#8}%
28860 }
28861
28862 \@onlypreamble{\vtwotone}
28863 \newcommand*{\vtwotonebottom}[1][all]{%
28864 \def\ff@pages{#1}%
28865 \@vtwotonebottom
28866 }
28867
28868 \@onlypreamble{\vtwotonebottom}
28869
28870 \newcommand*{\@vtwotonebottom}[2][0pt]{\@@vtwotonebottom{#1}{#2}}
28871 \newcommand*{\vtwotonetop}[1][all]{%
28872 \def\ff@pages{#1}%
28873 \@vtwotonetop
28874 }
28875
28876 \newcommand*{\@vtwotonetop}[2][0pt]{\@@vtwotonetop{#1}{#2}}
28877
28878 \newcommand*{\@@vtwotonetop}[8]{%
28879 \computeleftedgeodd{\@ff@tmp@x}%
28880 \if@twoside
28881 \computeleftedgeeven{\@ff@tmp@x@even}%
28882 \else
28883 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
28884 \fi
28885 \computetopedge{\@ff@tmp@y}%
28886 \addtolength{\@ff@tmp@y}{-#2}%
28887 \addtolength{\@ff@tmp@x}{#1}%
28888 \addtolength{\@ff@tmp@x@even}{#1}%
28889 \@nextvband{\ff@pages}{#2}{#3}{#4}{#5}%
28890 \@nextvband{\ff@pages}{#2}{#6}{#7}{#8}%
28891 }
28892 \newcommand*{\@nextvband}[5]{%
28893 \setlength{\@ff@staticW}{#3}%
28894 \ifthenelse{\equal{#5}{}}%
28895 {%
28896 \newstaticframe[#1]{\@ff@staticW}{#2}{\@ff@tmp@x}{\@ff@tmp@y}%
28897 }%
28898 {%
28899 \newstaticframe[#1]{\@ff@staticW}{#2}{\@ff@tmp@x}{\@ff@tmp@y}[#5]%
28900 }%
28901 \expandafter\global\expandafter\setlength
28902 \csname @sf@\romannumeral\c@maxstatic @evenx\endcsname{%
28903 \@ff@tmp@x@even}%
28904 \@setframecol#4\end{\c@maxstatic}{backcol}{sf}%
28905 \addtolength{\@ff@tmp@x}{\@ff@staticW}%
28906 \addtolength{\@ff@tmp@x@even}{\@ff@staticW}%
28907 }
28908 \newcount\@thisstrip
28909 \newcommand*{\vNtone}[1][all]{%
28910 \def\ff@pages{#1}%
28911 \@vNtone
28912 }
28913 \newcommand*{\@vNtone}[2][0pt]{%
28914 \@@vNtone{#1}{#2}{\paperheight}%
28915 }
28916 \newcommand*{\@@vNtone}[3]{%
28917 \computeleftedgeodd{\@ff@tmp@x}%
28918 \if@twoside
28919 \computeleftedgeeven{\@ff@tmp@x@even}%
28920 \else
28921 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
28922 \fi
28923 \computebottomedge{\@ff@tmp@y}%
28924 \addtolength{\@ff@tmp@x}{#1}%
28925 \addtolength{\@ff@tmp@x@even}{#1}%
28926 \@thisstrip=#2\relax
28927 \setlength{\@ff@staticH}{#3}%
28928 \@nextvNband
28929 }
28930 \newcommand*{\@nextvNband}{%
28931 \ifnum\@thisstrip>0\relax
28932 \let\flf@next\@@nextvNband
28933 \else
28934 \let\flf@next\relax
28935 \fi
28936 \advance\@thisstrip by -1\relax
28937 \flf@next
28938 }
28939 \newcommand*{\@@nextvNband}[3]{%
28940 \@nextvband{\ff@pages}{\@ff@staticH}{#1}{#2}{#3}%
28941 \@nextvNband
28942 }
28943
28944 \@onlypreamble{\vNtone}
28945 \newcommand*{\vNtonebottom}[1][all]{%
28946 \def\ff@pages{#1}%
28947 \@vNtonebottom
28948 }
28949 \@onlypreamble{\vNtonebottom}
28950 \newcommand*{\@vNtonebottom}[3][0pt]{%
28951 \@@vNtone{#1}{#2}{#3}%
28952 }
28953 \newcommand*{\vNtonetop}[1][all]{%
28954 \def\ff@pages{#1}%
28955 \@vNtonetop
28956 }
28957 \@onlypreamble{\vNtonetop}
28958 \newcommand*{\@vNtonetop}[3][0pt]{%
28959 \@@vNtonetop{#1}{#2}{#3}%
28960 }
28961 \newcommand*{\@@vNtonetop}[3]{%
28962 \computeleftedgeodd{\@ff@tmp@x}%
28963 \if@twoside
28964 \computeleftedgeeven{\@ff@tmp@x@even}%
28965 \else
28966 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
28967 \fi
28968 \computetopedge{\@ff@tmp@y}%
28969 \addtolength{\@ff@tmp@y}{-#3}%
28970 \addtolength{\@ff@tmp@x}{#1}%
28971 \addtolength{\@ff@tmp@x@even}{#1}%
28972 \@thisstrip=#2\relax
28973 \setlength{\@ff@staticH}{#3}%
28974 \@nextvNband%
28975 }
28976 \newcommand*{\htwotone}[1][all]{%
28977 \def\ff@pages{#1}%
28978 \@htwotone
28979 }
28980 \newcommand*{\@htwotone}[1][0pt]{\@@htwotoneleft{#1}{\paperwidth}}
28981 \newcommand*{\@@htwotoneleft}[8]{%
28982 \computeleftedgeodd{\@ff@tmp@x}%
28983 \if@twoside
28984 \computeleftedgeeven{\@ff@tmp@x@even}%
28985 \else
28986 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
28987 \fi
28988 \computebottomedge{\@ff@tmp@y}%
28989 \addtolength{\@ff@tmp@y}{#1}%
28990 \@nexthband{\ff@pages}{#2}{#3}{#4}{#5}%
28991 \@nexthband{\ff@pages}{#2}{#6}{#7}{#8}%
28992 }
28993
28994 \@onlypreamble{\htwotone}
28995 \newcommand*{\htwotoneleft}[1][all]{%
28996 \def\ff@pages{#1}%
28997 \@htwotoneleft
28998 }
28999 \@onlypreamble{\htwotoneleft}
29000 \newcommand*{\@htwotoneleft}[2][0pt]{\@@htwotoneleft{#1}{#2}}
29001 \newcommand*{\htwotoneright}[1][all]{%
29002 \def\ff@pages{#1}%
29003 \@htwotoneright
29004 }
29005 \@onlypreamble{\htwotoneright}
29006 \newcommand*{\@htwotoneright}[2][0pt]{\@@htwotoneright{#1}{#2}}
29007 \newcommand*{\@@htwotoneright}[8]{%
29008 \computerightedgeodd{\@ff@tmp@x}%
29009 \if@twoside
29010 \computerightedgeeven{\@ff@tmp@x@even}%
29011 \else
29012 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
29013 \fi
29014 \computebottomedge{\@ff@tmp@y}%
29015 \addtolength{\@ff@tmp@y}{#1}%
29016 \addtolength{\@ff@tmp@x}{-#2}%
29017 \addtolength{\@ff@tmp@x@even}{-#2}%
29018 \@nexthband{\ff@pages}{#2}{#3}{#4}{#5}%
29019 \@nexthband{\ff@pages}{#2}{#6}{#7}{#8}%
29020 }
29021 \newcommand*{\hNtone}[1][all]{%
29022 \def\ff@pages{#1}%
29023 \@hNtone
29024 }
29025 \@onlypreamble{\hNtone}
29026 \newcommand*{\@hNtone}[2][0pt]{%
29027 \@@hNtone{#1}{#2}{\paperwidth}%
29028 }
29029 \newcommand*{\@@hNtone}[3]{%
29030 \computeleftedgeodd{\@ff@tmp@x}%
29031 \if@twoside
29032 \computeleftedgeeven{\@ff@tmp@x@even}%
29033 \else
29034 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
29035 \fi
29036 \computebottomedge{\@ff@tmp@y}%
29037 \addtolength{\@ff@tmp@y}{#1}%
29038 \@thisstrip=#2\relax
29039 \setlength{\@ff@staticW}{#3}%
29040 \@nexthNband
29041 }
29042 \newcommand*{\hNtoneleft}[1][all]{%
29043 \def\ff@pages{#1}%
29044 \@hNtoneleft
29045 }
29046 \@onlypreamble{\hNtoneleft}
29047 \newcommand*{\@hNtoneleft}[3][0pt]{%
29048 \@@hNtone{#1}{#2}{#3}%
29049 }
29050 \newcommand*{\hNtoneright}[1][all]{%
29051 \def\ff@pages{#1}%
29052 \@hNtoneright
29053 }
29054 \@onlypreamble{\hNtoneright}
29055 \newcommand*{\@hNtoneright}[3][0pt]{%
29056 \@@hNtoneright{#1}{#2}{#3}%
29057 }
29058 \newcommand*{\@@hNtoneright}[3]{%
29059 \computerightedgeodd{\@ff@tmp@x}%
29060 \if@twoside
29061 \computerightedgeeven{\@ff@tmp@x@even}%
29062 \else
29063 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
29064 \fi
29065 \computebottomedge{\@ff@tmp@y}%
29066 \addtolength{\@ff@tmp@y}{#1}%
29067 \addtolength{\@ff@tmp@x}{-#3}%
29068 \addtolength{\@ff@tmp@x@even}{-#3}%
29069 \@thisstrip=#2\relax
29070 \setlength{\@ff@staticW}{#3}%
29071 \@nexthNband
29072 }
29073 \newcommand*{\@nexthband}[5]{%
29074 \setlength{\@ff@staticH}{#3}%
29075 \ifthenelse{\equal{#5}{}}%
29076 {%
29077 \newstaticframe[#1]{#2}{\@ff@staticH}{\@ff@tmp@x}{\@ff@tmp@y}%
29078 }%
29079 {%
29080 \newstaticframe[#1]{#2}{\@ff@staticH}{\@ff@tmp@x}{\@ff@tmp@y}[#5]%
29081 }%
29082 \expandafter\global\expandafter
29083 \setlength\csname @sf@\romannumeral\c@maxstatic @evenx\endcsname
29084 {\@ff@tmp@x@even}%
29085 \@setframecol#4\end{\c@maxstatic}{backcol}{sf}%
29086 \addtolength{\@ff@tmp@y}{\@ff@staticH}%
29087 }
29088 \newcommand*{\@nexthNband}{%
29089 \ifnum\@thisstrip>0\relax
29090 \let\flf@next\@@nexthNband
29091 \else
29092 \let\flf@next\relax
29093 \fi
29094 \advance\@thisstrip by -1\relax
29095 \flf@next
29096 }
29097 \newcommand*{\@@nexthNband}[3]{%
29098 \@nexthband{\ff@pages}{\@ff@staticW}{#1}{#2}{#3}%
29099 \@nexthNband
29100 }
29101 \newcommand*{\makebackgroundframe}[1][all]{%
29102 \ifnum\c@maxstatic>0\relax
29103 \PackageWarning{flowfram}%
29104 {%
29105 Background frame is not first static frame to be
29106 defined. All previously defined static frames may be
29107 obscured.%
29108 }%
29109 \fi
29110 \computeleftedgeodd{\@ff@tmp@x}%
29111 \if@twoside
29112 \computeleftedgeeven{\@ff@tmp@x@even}%
29113 \else
29114 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
29115 \fi
29116 \computebottomedge{\@ff@tmp@y}%
29117 \newstaticframe[#1]{\paperwidth}{\paperheight}{\@ff@tmp@x}%
29118 {\@ff@tmp@y}%
29119 \expandafter\global\expandafter
29120 \setlength\csname @sf@\romannumeral\c@maxstatic @evenx\endcsname
29121 {\@ff@tmp@x@even}%
29122 }
29123 \newlength\ffcolumnseprule
29124 \setlength{\ffcolumnseprule}{2pt}
29125 \newcommand*{\ffruledeclarations}{}
29126 \newcommand*{\insertvrule}{\@ifstar\@sinsertvrule\@insertvrule}
29127 \newcommand*{\@insertvrule}[1][0pt]{%
29128 \@ifnextchar[{\@@insertvrule[#1]}{\@@insertvrule[#1][0pt]}%
29129 }
29130 \newlength\@ff@left@x
29131 \newlength\@ff@left@y
29132 \newlength\@ff@left@evenx
29133 \newlength\@ff@left@eveny
29134 \newlength\@ff@left@width
29135 \newlength\@ff@left@height
29136 \def\@@insertvrule[#1][#2]#3#4#5#6{%
29137 \ifthenelse{\equal{#3}{flow}}%
29138 {%
29139 \def\@ff@type@i{1}%
29140 }%
29141 {%
29142 \ifthenelse{\equal{#3}{static}}%
29143 {%
29144 \def\@ff@type@i{2}%
29145 }%
29146 {%
29147 \ifthenelse{\equal{#3}{dynamic}}%
29148 {%
29149 \def\@ff@type@i{3}%
29150 }%
29151 {%
29152 \PackageError{flowfram}%
29153 {Unknown frame type '#3'}%
29154 {%
29155 Available frame types are: 'flow', 'static'
29156 or 'dynamic'%
29157 }%
29158 }%
29159 }%
29160 }%
29161 \ifthenelse{\equal{#5}{flow}}%
29162 {%
29163 \def\@ff@type@ii{1}%
29164 }%
29165 {%
29166 \ifthenelse{\equal{#5}{static}}%
29167 {%
29168 \def\@ff@type@ii{2}%
29169 }%
29170 {%
29171 \ifthenelse{\equal{#5}{dynamic}}%
29172 {%
29173 \def\@ff@type@ii{3}%
29174 }%
29175 {%
29176 \PackageError{flowfram}%
29177 {Unknown frame type '#5'}%
29178 {%
29179 Available frame types are: 'flow', 'static'
29180 or 'dynamic'%
29181 }%
29182 }%
29183 }%
29184 }%
29185 \@@insert@vrule{#1}{#2}{\@ff@type@i}{#4}{\@ff@type@ii}{#6}%
29186 }
29187 \newcommand*{\@@insert@vrule}[6]{%
29188 \@ff@getdim{#3}{#4}%
29189 \setlength{\@ff@left@x}{\ffareax}%
29190 \setlength{\@ff@left@y}{\ffareay}%
29191 \setlength{\@ff@left@width}{\ffareawidth}%
29192 \setlength{\@ff@left@height}{\ffareaheight}%
29193 \@ff@getdim{#5}{#6}%
29194 \ifnum\@ff@left@x>\ffareax\relax
29195 \@ff@swaplen{\@ff@left@x}{\ffareax}%
29196 \@ff@swaplen{\@ff@left@y}{\ffareax}%
29197 \@ff@swaplen{\@ff@left@evenx}{\ffareaevenx}%
29198 \@ff@swaplen{\@ff@left@eveny}{\ffareaevenx}%
29199 \@ff@swaplen{\@ff@left@width}{\ffareawidth}%
29200 \@ff@swaplen{\@ff@left@height}{\ffareaheight}%
29201 \fi
29202 \setlength{\@ff@tmp@x}{\@ff@left@x}
29203 \addtolength{\@ff@tmp@x}{\@ff@left@width}%
29204 \setlength{\@ff@staticW}{\ffareax}%
29205 \addtolength{\@ff@staticW}{-\@ff@tmp@x}%
29206 \setlength{\@ff@staticH}{\@ff@left@y}%
29207 \addtolength{\@ff@staticH}{\@ff@left@height}%
29208 \setlength{\@ff@tmp@y}{\ffareay}%
29209 \addtolength{\@ff@tmp@y}{\ffareaheight}%
29210 \ifnum\@ff@tmp@y>\@ff@staticH
29211 \setlength{\@ff@staticH}{\@ff@tmp@y}%
29212 \fi
29213 \ifnum\@ff@left@y<\ffareay\relax
29214 \setlength{\@ff@tmp@y}{\@ff@left@y}%
29215 \else
29216 \setlength{\@ff@tmp@y}{\ffareay}%
29217 \fi
29218 \addtolength{\@ff@staticH}{-\@ff@tmp@y}%
29219 \newstaticframe{\@ff@staticW}{\@ff@staticH}%
29220 {\@ff@tmp@x}{\@ff@tmp@y}%
29221 \addtolength{\@ff@staticH}{#1}%
29222 \addtolength{\@ff@staticH}{#2}%
29223 \setstaticcontents{\c@maxstatic}{%
29224 \ffruledeclarations
29225 \ffvrule{#2}{\ffcolumnseprule}{\@ff@staticH}}%
29226 \ifcase#3\relax
29227 \or \edef\@ff@pages{\csname @ff@pages@\romannumeral#4\endcsname}%
29228 \or \edef\@ff@pages{\csname @sf@pages@\romannumeral#4\endcsname}%
29229 \or \edef\@ff@pages{\csname @df@pages@\romannumeral#4\endcsname}%
29230 \fi
29231 \setstaticframe{\c@maxstatic}{pages=\@ff@pages}%
29232 \addtolength{\@ff@tmp@x}{\@ff@left@evenx}%
29233 \addtolength{\@ff@tmp@x}{-\@ff@left@x}%
29234 \addtolength{\@ff@tmp@y}{\@ff@left@eveny}%
29235 \addtolength{\@ff@tmp@y}{-\@ff@left@y}%
29236 \setstaticframe{\c@maxstatic}{evenx=\@ff@tmp@x,eveny=\@ff@tmp@y}%
29237 }
29238 \newcommand*{\ffvrule}[3]{%
29239 \hfill \rule[-#1]{#2}{#3}\hfill\mbox{}%
29240 }
29241 \newcommand*{\@sinsertvrule}[1][0pt]{%
29242 \@ifnextchar[{\@@sinsertvrule[#1]}{\@@sinsertvrule[#1][0pt]}%
29243 }
29244 \def\@@sinsertvrule[#1][#2]#3#4#5#6{%
29245 \ifthenelse{\equal{#3}{flow}}%
29246 {%
29247 \def\@ff@type@i{1}%
29248 \@flowframeid{#4}%
29249 \@ff@tmpN=\ff@id
29250 }%
29251 {%
29252 \ifthenelse{\equal{#3}{static}}%
29253 {%
29254 \def\@ff@type@i{2}\@staticframeid{#4}\@ff@tmpN=\ff@id
29255 }%
29256 {%
29257 \ifthenelse{\equal{#3}{dynamic}}%
29258 {%
29259 \def\@ff@type@i{3}%
29260 \@dynamicframeid{#4}%
29261 \@ff@tmpN=\ff@id
29262 }%
29263 {%
29264 \PackageError{flowfram}%
29265 {Unknown frame type '#3'}%
29266 {%
29267 Available frame types are: 'flow', 'static'
29268 or 'dynamic'%
29269 }%
29270 }%
29271 }%
29272 }%
29273 \ifthenelse{\equal{#5}{flow}}%
29274 {%
29275 \def\@ff@type@ii{1}\@flowframeid{#6}%
29276 }%
29277 {%
29278 \ifthenelse{\equal{#5}{static}}%
29279 {%
29280 \def\@ff@type@ii{2}%
29281 \@staticframeid{#6}%
29282 }%
29283 {%
29284 \ifthenelse{\equal{#5}{dynamic}}%
29285 {%
29286 \def\@ff@type@ii{3}%
29287 \@dynamicframeid{#6}%
29288 }%
29289 {%
29290 \PackageError{flowfram}%
29291 {Unknown frame type '#5'}%
29292 {%
29293 Available frame types are: 'flow', 'static'
29294 or 'dynamic'%
29295 }%
29296 }%
29297 }%
29298 }%
29299 \@@insert@vrule{#1}{#2}{\@ff@type@i}{\@ff@tmpN}%
29300 {\@ff@type@ii}{\ff@id}%
29301 }
29302 \newcommand*{\inserthrule}{\@ifstar\@sinserthrule\@inserthrule}
29303 \newcommand*{\@inserthrule}[1][0pt]{%
29304 \@ifnextchar[{\@@inserthrule[#1]}{\@@inserthrule[#1][0pt]}%
29305 }
29306 \def\@@inserthrule[#1][#2]#3#4#5#6{%
29307 \ifthenelse{\equal{#3}{flow}}%
29308 {%
29309 \def\@ff@type@i{1}%
29310 }%
29311 {%
29312 \ifthenelse{\equal{#3}{static}}%
29313 {%
29314 \def\@ff@type@i{2}%
29315 }%
29316 {%
29317 \ifthenelse{\equal{#3}{dynamic}}%
29318 {%
29319 \def\@ff@type@i{3}}%
29320 {%
29321 \PackageError{flowfram}%
29322 {Unknown frame type '#3'}%
29323 {%
29324 Available frame types are: 'flow', 'static'
29325 or 'dynamic'%
29326 }%
29327 }%
29328 }%
29329 }%
29330 \ifthenelse{\equal{#5}{flow}}%
29331 {%
29332 \def\@ff@type@ii{1}%
29333 }%
29334 {%
29335 \ifthenelse{\equal{#5}{static}}%
29336 {%
29337 \def\@ff@type@ii{2}%
29338 }%
29339 {%
29340 \ifthenelse{\equal{#5}{dynamic}}%
29341 {%
29342 \def\@ff@type@ii{3}%
29343 }%
29344 {%
29345 \PackageError{flowfram}%
29346 {Unknown frame type '#5'}%
29347 {%
29348 Available frame types are: 'flow', 'static'
29349 or 'dynamic'%
29350 }%
29351 }%
29352 }%
29353 }%
29354 \@@insert@hrule{#1}{#2}{\@ff@type@i}{#4}{\@ff@type@ii}{#6}%
29355 }
29356 \newcommand*{\@@insert@hrule}[6]{%
29357 \@ff@getdim{#3}{#4}%
29358 \setlength{\@ff@left@x}{\ffareax}%
29359 \setlength{\@ff@left@y}{\ffareay}%
29360 \setlength{\@ff@left@width}{\ffareawidth}%
29361 \setlength{\@ff@left@height}{\ffareaheight}%
29362 \@ff@getdim{#5}{#6}%
29363 \ifnum\@ff@left@y>\ffareay\relax
29364 \@ff@swaplen{\@ff@left@x}{\ffareax}%
29365 \@ff@swaplen{\@ff@left@y}{\ffareay}%
29366 \@ff@swaplen{\@ff@left@width}{\ffareawidth}%
29367 \@ff@swaplen{\@ff@left@height}{\ffareaheight}%
29368 \fi
29369 \setlength{\@ff@tmp@y}{\@ff@left@y}%
29370 \addtolength{\@ff@tmp@y}{\@ff@left@height}%
29371 \setlength{\@ff@staticH}{\ffareay}%
29372 \addtolength{\@ff@staticH}{-\@ff@tmp@y}%
29373 \setlength{\@ff@staticW}{\@ff@left@x}%
29374 \addtolength{\@ff@staticW}{\@ff@left@width}%
29375 \setlength{\@ff@tmp@x}{\ffareax}%
29376 \addtolength{\@ff@tmp@x}{\ffareawidth}%
29377 \ifnum\@ff@tmp@x>\@ff@staticW\relax
29378 \setlength{\@ff@staticW}{\@ff@tmp@x}%
29379 \fi
29380 \ifnum\@ff@left@x<\ffareax\relax
29381 \setlength{\@ff@tmp@x}{\@ff@left@x}%
29382 \else
29383 \setlength{\@ff@tmp@x}{\ffareax}%
29384 \fi
29385 \addtolength{\@ff@staticW}{-\@ff@tmp@x}%
29386 \newstaticframe{\@ff@staticW}{\@ff@staticH}%
29387 {\@ff@tmp@x}{\@ff@tmp@y}%
29388 \addtolength{\@ff@staticW}{#1}%
29389 \addtolength{\@ff@staticW}{#2}%
29390 \setstaticcontents{\c@maxstatic}%
29391 {%
29392 \ffruledeclarations
29393 \ffhrule{#1}{\@ff@staticW}{\ffcolumnseprule}%
29394 }%
29395 \ifcase#3\relax
29396 \or \edef\@ff@pages{\csname @ff@pages@\romannumeral#4\endcsname}%
29397 \or \edef\@ff@pages{\csname @sf@pages@\romannumeral#4\endcsname}%
29398 \or \edef\@ff@pages{\csname @df@pages@\romannumeral#4\endcsname}%
29399 \fi
29400 \setstaticframe{\c@maxstatic}{pages=\@ff@pages}%
29401 \addtolength{\@ff@tmp@x}{\@ff@left@evenx}%
29402 \addtolength{\@ff@tmp@x}{-\@ff@left@x}%
29403 \addtolength{\@ff@tmp@y}{\@ff@left@eveny}%
29404 \addtolength{\@ff@tmp@y}{-\@ff@left@y}%
29405 \setstaticframe{\c@maxstatic}{evenx=\@ff@tmp@x,eveny=\@ff@tmp@y}%
29406 }
29407 \newcommand*{\ffhrule}[3]{%
29408 \hspace*{-#1}\rule{#2}{#3}%
29409 }
29410 \newcommand*{\@sinserthrule}[1][0pt]{%
29411 \@ifnextchar[{\@@sinserthrule[#1]}{\@@sinserthrule[#1][0pt]}%
29412 }
29413 \def\@@sinserthrule[#1][#2]#3#4#5#6{%
29414 \ifthenelse{\equal{#3}{flow}}%
29415 {%
29416 \def\@ff@type@i{1}%
29417 \@flowframeid{#4}%
29418 \@ff@tmpN=\ff@id
29419 }%
29420 {%
29421 \ifthenelse{\equal{#3}{static}}%
29422 {%
29423 \def\@ff@type@i{2}%
29424 \@staticframeid{#4}%
29425 \@ff@tmpN=\ff@id
29426 }%
29427 {%
29428 \ifthenelse{\equal{#3}{dynamic}}%
29429 {%
29430 \def\@ff@type@i{3}%
29431 \@dynamicframeid{#4}%
29432 \@ff@tmpN=\ff@id
29433 }%
29434 {%
29435 \PackageError{flowfram}%
29436 {Unknown frame type '#3'}%
29437 {%
29438 Available frame types are: 'flow', 'static'
29439 or 'dynamic'%
29440 }%
29441 }%
29442 }%
29443 }%
29444 \ifthenelse{\equal{#5}{flow}}%
29445 {%
29446 \def\@ff@type@ii{1}%
29447 \@flowframeid{#6}%
29448 }%
29449 {%
29450 \ifthenelse{\equal{#5}{static}}%
29451 {%
29452 \def\@ff@type@ii{2}%
29453 \@staticframeid{#6}%
29454 }%
29455 {%
29456 \ifthenelse{\equal{#5}{dynamic}}%
29457 {%
29458 \def\@ff@type@ii{3}%
29459 \@dynamicframeid{#6}%
29460 }%
29461 {%
29462 \PackageError{flowfram}%
29463 {Unknown frame type '#5'}%
29464 {%
29465 Available frame types are: 'flow', 'static'
29466 or 'dynamic'%
29467 }%
29468 }%
29469 }%
29470 }%
29471 \@@insert@hrule{#1}{#2}{\@ff@type@i}{\@ff@tmpN}%
29472 {\@ff@type@ii}{\ff@id}%
29473 }
29474 \newcommand*{\dfchaphead}{%
29475 \@ifstar\@sdynamicchap\@dynamicchap
29476 }
29477 \newcommand{\DFchapterstyle}[1]{#1}
29478 \newcommand{\DFschapterstyle}[1]{#1}
29479 \newcommand{\@dynamicchap}[1]{%
29480 \@ifundefined{chapter}%
29481 {%
29482 \PackageError{flowfram}%
29483 {Chapters aren't defined}%
29484 {%
29485 The document class you are using does not
29486 define chapters%
29487 }%
29488 }%
29489 {%
29490 \let\@ff@OLDmakechapterhead\@makechapterhead
29491 \let\@ff@OLDmakeschapterhead\@makeschapterhead
29492 \renewcommand{\DFchapterstyle}[1]{\@ff@OLDmakechapterhead{##1}}%
29493 \renewcommand{\DFschapterstyle}[1]{\@ff@OLDmakeschapterhead{##1}}%
29494 \xdef\@makechapterhead##1{%
29495 \noexpand\@setdynamiccontents{\number#1}%
29496 {%
29497 \noexpand\DFchapterstyle{##1}%
29498 }%
29499 }%
29500 \xdef\@makeschapterhead##1{%
29501 \noexpand\@setdynamiccontents{\number#1}%
29502 {%
29503 \noexpand\DFschapterstyle{##1}%
29504 }%
29505 }%
29506 }%
29507 }
29508 \newcommand{\@sdynamicchap}[1]{%
29509 \@dynamicframeid{#1}%
29510 \@dynamicchap{\ff@id}%
29511 }
29512 \newcounter{maxthumbtabs}
29513 \@ifundefined{chapter}%
29514 {%
29515 \newcommand*{\defaultthumbtabtype}{section}%
29516 }%
29517 {%
29518 \newcommand*{\defaultthumbtabtype}{chapter}%
29519 }
29520 \newcommand*{\@ttb@type}{\defaultthumbtabtype}
29521 \newcommand*{\makethumbtabs}[2][0pt]{%
29522 \@ifnextchar[%
29523 {\@makethumbtabs[#1]{#2}}%
29524 {%
29525 \@makethumbtabs[#1]{#2}[\defaultthumbtabtype]%
29526 }%
29527 }
29528 \def\@makethumbtabs[#1]#2[#3]{%
29529 \@ifundefined{#3}%
29530 {%
29531 \PackageError{flowfram}%
29532 {%
29533 Unknown section type '#3'%
29534 }%
29535 {}%
29536 }%
29537 {%
29538 \renewcommand{\@ttb@type}{#3}%
29539 \ifthenelse{\equal{#3}{chapter}}%
29540 {%
29541 \@makethumbchapter
29542 }%
29543 {%
29544 \ifthenelse{\equal{#3}{part}}%
29545 {\@makethumbpart}%
29546 {%
29547 \@makethumbsection{#3}%
29548 }%
29549 }%
29550 }%
29551 \@starttoc{ttb}%
29552 \@dothumbtabs{#1}{#2}%
29553 }
29554 \newcommand{\@makethumbchapter}{%
29555 \let\@ttb@old@chapter\@chapter
29556 \def\@chapter[##1]##2{%
29557 \@ttb@old@chapter[##1]{##2}%
29558 \addtocontents{ttb}{\protect\thumbtab
29559 {\thepage}{\thechapter}{##1}{chapter.\thechapter}}%
29560 \@afterheading
29561 }%
29562 }
29563 \newcommand{\@makethumbpart}{%
29564 \let\@ttb@old@part\@part
29565 \@ifundefined{@endpart}%
29566 {%
29567 \def\@part[##1]##2{%
29568 \@ttb@old@part[##1]{##2}%
29569 \addtocontents{ttb}{\protect\thumbtab
29570 {\thepage}{\thepart}{##1}{part.\thepage}}%
29571 \@afterheading
29572 }%
29573 }%
29574 {%
29575 \let\@ttb@old@endpart\@endpart
29576 \def\@part[##1]##2{%
29577 \def\@parttitle{##1}%
29578 \@ttb@old@part[##1]{##2}%
29579 }%
29580 \def\@endpart{%
29581 \addtocontents{ttb}%
29582 {%
29583 \protect\thumbtab{\thepage}%
29584 {\thepart}{\@parttitle}{part.\thepage}%
29585 }%
29586 \@ttb@old@endpart
29587 }%
29588 }%
29589 }
29590 \newcommand*{\@makethumbsection}[1]{%
29591 \let\@ttb@old@sect=\@sect
29592 \def\@sect##1##2##3##4##5##6[##7]##8{%
29593 \@ttb@old@sect{##1}{##2}{##3}{##4}{##5}{##6}[##7]{##8}%
29594 \ifthenelse{\equal{##1}{#1}}%
29595 {%
29596 \addtocontents{ttb}%
29597 {%
29598 \protect\thumbtab{\thepage}{\csname the#1\endcsname}%
29599 {##7}{#1.\csname the#1\endcsname}%
29600 }%
29601 \@afterheading
29602 }%
29603 {}%
29604 }%
29605 }
29606 \newcommand{\thumbtab}[4]{%
29607 \stepcounter{maxthumbtabs}%
29608 \expandafter
29609 \gdef\csname thumbtab@pages@\romannumeral\c@maxthumbtabs\endcsname{#1}%
29610 \expandafter
29611 \gdef\csname thumbtab@num@\romannumeral\c@maxthumbtabs\endcsname{#2}%
29612 \expandafter
29613 \gdef\csname thumbtab@title@\romannumeral\c@maxthumbtabs\endcsname{#3}%
29614 \expandafter
29615 \gdef\csname thumbtab@link@\romannumeral\c@maxthumbtabs\endcsname{#4}%
29616 }
29617 \newcommand*{\@dothumbtabs}[2]{%
29618 \@colN=0\relax
29619 \whiledo{\@colN<\c@maxthumbtabs}%
29620 {%
29621 \advance\@colN by 1\relax
29622 \edef\ff@pages{%
29623 \csname thumbtab@pages@\romannumeral\@colN\endcsname}%
29624 \ifnum\@colN=\c@maxthumbtabs
29625 \expandafter
29626 \xdef\csname thumbtab@pages@\romannumeral\@colN\endcsname{%
29627 \ff@pages,>\ff@pages}%
29628 \else
29629 \advance\@colN by 1\relax
29630 \edef\ff@endpage{%
29631 \csname thumbtab@pages@\romannumeral\@colN\endcsname}%
29632 \advance\@colN by -1\relax
29633 \@ff@tmpN=\ff@endpage\relax
29634 \advance\@ff@tmpN by -1\relax
29635 \ifnum\@ff@tmpN>\ff@pages
29636 \expandafter
29637 \xdef\csname thumbtab@pages@\romannumeral\@colN\endcsname{%
29638 \ff@pages-\number\@ff@tmpN}%
29639 \fi
29640 \fi
29641 }%
29642 \@@dothumbtabs{#1}{#2}%
29643 }
29644 \newlength{\thumbtabwidth}
29645 \setlength{\thumbtabwidth}{1cm}
29646 \@ifundefined{hyperlink}%
29647 {%
29648 \newcommand{\thumbtabindexformat}[3]{%
29649 \thumbtabformat{#2}{#3}%
29650 }%
29651 }%
29652 {%
29653 \newcommand{\thumbtabindexformat}[3]{%
29654 \hyperlink{#1}{\thumbtabformat{#2}{#3}}%
29655 }%
29656 }
29657 \newcommand{\thumbtabformat}[2]{%
29658 \if@ttb@rotate
29659 \rotatebox{-90}%
29660 {%
29661 \parbox[c][\thumbtabwidth]{#2}{%
29662 \centering#1%
29663 }%
29664 }%
29665 \else
29666 \parbox[c][#2]{\thumbtabwidth}{%
29667 \centering\@ttb@stack{#1}%
29668 }%
29669 \fi
29670 }
29671 \def\@flf@subsp#1 #2{%
29672 \expandafter\flf@ta\expandafter{\@flf@subsptext}%
29673 \flf@tb{#1}%
29674 \edef\@flf@subsptext{\the\flf@ta\the\flf@tb}%
29675 \def\@flf@tmp{#2}%
29676 \ifx\@flf@tmp\@nnil
29677 \let\@flf@donextsubsp=\@gobble
29678 \else
29679 \expandafter\flf@ta\expandafter{\@flf@subsptext}%
29680 \edef\@flf@subsptext{\the\flf@ta\noexpand\space}%
29681 \let\@flf@donextsubsp=\@flf@subsp
29682 \fi
29683 \@flf@donextsubsp{#2}%
29684 }
29685 \newcommand{\@ttb@stack}[1]{%
29686 \def\@flf@subsptext{}%
29687 \expandafter\@flf@subsp#1 \@nil\relax
29688 \begin{tabular}{l}%
29689 \expandafter\@@ttb@stack\@flf@subsptext\@nil\relax
29690 \end{tabular}%
29691 }
29692 \def\@@ttb@stack#1#2{%
29693 \def\@flf@tmp{#1}%
29694 \ifx\@flf@tmp\@nnil
29695 \let\flf@next\relax
29696 \else
29697 #1\\%
29698 \def\@flf@tmp{#2}%
29699 \ifx\@nnil#2\relax
29700 \let\flf@next\@gobble
29701 \else
29702 \let\flf@next\@@ttb@stack
29703 \fi
29704 \fi
29705 \flf@next{#2}%
29706 }
29707 \newcount\@greyscale
29708 \newcommand{\@@dothumbtabs}[2]{%
29709 \setlength{\@ff@tmp@y}{\textheight}%
29710 \addtolength{\@ff@tmp@y}{-#2}%
29711 \addtolength{\@ff@tmp@y}{-#1}%
29712 \computerightedgeodd{\@ff@tmp@x}%
29713 \addtolength{\@ff@tmp@x}{-\thumbtabwidth}%
29714 \computeleftedgeeven{\@ff@tmp@x@even}%
29715 \@ff@tmpN=0\relax
29716 \whiledo{\@ff@tmpN<\c@maxthumbtabs}%
29717 {%
29718 \advance\@ff@tmpN by 1\relax
29719 \@greyscale=\@ff@tmpN\relax
29720 \multiply\@greyscale by 60\relax
29721 \divide\@greyscale by \c@maxthumbtabs
29722 \advance\@greyscale by 25\relax
29723 \edef\@ff@greyscale{0.\number\@greyscale}%
29724 \newdynamicframe[none]{\thumbtabwidth}{#2}%
29725 {\@ff@tmp@x}{\@ff@tmp@y}[thumbtab\number\@ff@tmpN]%
29726 \expandafter\global\expandafter
29727 \setlength\csname @df@\romannumeral\c@maxdynamic @evenx\endcsname
29728 {\@ff@tmp@x@even}%
29729 \ifthenelse{\boolean{@ttb@title}\and\boolean{@ttb@num}}%
29730 {%
29731 \expandafter
29732 \xdef\csname @dynamicframe@\romannumeral\c@maxdynamic\endcsname{%
29733 \noexpand\thumbtabformat
29734 {%
29735 \csname thumbtab@num@\romannumeral\@ff@tmpN\endcsname\
29736 \csname thumbtab@title@\romannumeral\@ff@tmpN\endcsname
29737 }%
29738 {#2}%
29739 }%
29740 }%
29741 {%
29742 \if@ttb@title
29743 \expandafter
29744 \xdef\csname @dynamicframe@\romannumeral\c@maxdynamic\endcsname{%
29745 \noexpand\thumbtabformat
29746 {%
29747 \csname thumbtab@title@\romannumeral\@ff@tmpN\endcsname
29748 }%
29749 {#2}%
29750 }%
29751 \fi
29752 \if@ttb@num
29753 \expandafter
29754 \xdef\csname @dynamicframe@\romannumeral\c@maxdynamic\endcsname{%
29755 \noexpand\thumbtabformat
29756 {%
29757 \csname thumbtab@num@\romannumeral\@ff@tmpN\endcsname
29758 }%
29759 {#2}%
29760 }%
29761 \fi
29762 }%
29763 \expandafter
29764 \xdef\csname @df@backcol@\romannumeral\c@maxdynamic\endcsname
29765 {[gray]{\@ff@greyscale}}
29766 \newdynamicframe[none]{\thumbtabwidth}{#2}%
29767 {\@ff@tmp@x}{\@ff@tmp@y}[thumbtabindex\number\@ff@tmpN]%
29768 \expandafter\global\expandafter
29769 \setlength\csname @df@\romannumeral\c@maxdynamic @evenx\endcsname
29770 {\@ff@tmp@x@even}%
29771 \expandafter
29772 \ifthenelse{\boolean{@ttb@title}\and\boolean{@ttb@num}}%
29773 {%
29774 \expandafter
29775 \xdef\csname @dynamicframe@\romannumeral\c@maxdynamic\endcsname{%
29776 \noexpand\thumbtabindexformat
29777 {%
29778 \csname thumbtab@link@\romannumeral\@ff@tmpN\endcsname
29779 }%
29780 {%
29781 \csname thumbtab@num@\romannumeral\@ff@tmpN\endcsname\
29782 \csname thumbtab@title@\romannumeral\@ff@tmpN\endcsname
29783 }%
29784 {#2}%
29785 }%
29786 }%
29787 {%
29788 \if@ttb@title
29789 \expandafter
29790 \xdef\csname @dynamicframe@\romannumeral\c@maxdynamic\endcsname{%
29791 \noexpand\thumbtabindexformat
29792 {%
29793 \csname thumbtab@link@\romannumeral\@ff@tmpN\endcsname
29794 }%
29795 {%
29796 \csname thumbtab@title@\romannumeral\@ff@tmpN\endcsname
29797 }%
29798 {#2}%
29799 }%
29800 \fi
29801 \if@ttb@num
29802 \expandafter
29803 \xdef\csname @dynamicframe@\romannumeral\c@maxdynamic\endcsname{%
29804 \noexpand\thumbtabindexformat
29805 {%
29806 \csname thumbtab@link@\romannumeral\@ff@tmpN\endcsname
29807 }%
29808 {%
29809 \csname thumbtab@num@\romannumeral\@ff@tmpN\endcsname
29810 }%
29811 {#2}%
29812 }%
29813 \fi
29814 }%
29815 \expandafter
29816 \xdef\csname @df@backcol@\romannumeral\c@maxdynamic\endcsname
29817 {[gray]{\@ff@greyscale}}
29818 \addtolength{\@ff@tmp@y}{-#2}%
29819 }%
29820 }%
29821 \newcommand*{\enablethumbtabs}{%
29822 \ifnum\c@maxthumbtabs>0\relax
29823 \@ff@tmpN=0\relax
29824 \@dynamicframeid{thumbtab1}%
29825 \whiledo{\@ff@tmpN<\c@maxthumbtabs}%
29826 {%
29827 \advance\@ff@tmpN by 1\relax
29828 \edef\@ff@pages{\csname thumbtab@pages@\romannumeral\@ff@tmpN\endcsname}%
29829 \@@setdynamicframe{\ff@id}{pages=\@ff@pages}%
29830 \advance\ff@id by 2\relax
29831 }%
29832 \else
29833 \PackageWarning{flowfram}{No thumb tabs defined}%
29834 \fi
29835 }
29836 \newcommand*{\disablethumbtabs}{%
29837 \ifnum\c@maxthumbtabs>0\relax
29838 \@ff@tmpN=0\relax
29839 \@dynamicframeid{thumbtab1}%
29840 \whiledo{\@ff@tmpN<\c@maxthumbtabs}%
29841 {%
29842 \advance\@ff@tmpN by 1\relax
29843 \expandafter\xdef\csname @df@pages@\romannumeral\ff@id\endcsname
29844 {none}%
29845 \advance\ff@id by 1\relax
29846 \expandafter\xdef\csname @df@pages@\romannumeral\ff@id\endcsname
29847 {none}%
29848 \advance\ff@id by 1\relax
29849 }%
29850 \fi
29851 }
29852 \newcommand*{\thumbtabindex}{%
29853 \ifnum\c@maxthumbtabs>0\relax
29854 \@ff@tmpN=0\relax
29855 \@dynamicframeid{thumbtabindex1}%
29856 \whiledo{\@ff@tmpN<\c@maxthumbtabs}%
29857 {%
29858 \advance\@ff@tmpN by 1\relax
29859 \expandafter
29860 \xdef\csname @df@pages@\romannumeral\ff@id\endcsname{\c@page}%
29861 \edef\@ff@doafter{%
29862 \noexpand\afterpage
29863 {%
29864 \noexpand\setdynamicframe{\number\ff@id}{pages=none}%
29865 }%
29866 }%
29867 \@ff@doafter
29868 \advance\ff@id by 2\relax
29869 }%
29870 \fi
29871 }
29872 \newcommand{\setthumbtab}[2]{%
29873 \ifthenelse{\equal{#1}{all}}%
29874 {%
29875 \@ff@tmpN=0\relax
29876 \whiledo{\@ff@tmpN<\c@maxthumbtabs}%
29877 {%
29878 \advance\@ff@tmpN by 1\relax
29879 \@setthumbtab{\@ff@tmpN}{#2}%
29880 }%
29881 }%
29882 {%
29883 \@for\@ttb@id:=#1\do{\@setthumbtab{\@ttb@id}{#2}}%
29884 }%
29885 }
29886 \newcommand{\@setthumbtab}[2]{%
29887 \ifthenelse{\(\c@maxthumbtabs<#1\) \or \(#1<1\)}%
29888 {%
29889 \PackageWarning{flowfram}%
29890 {%
29891 Can't find thumbtab number '#1', ttb file may not be
29892 up-to-date%
29893 }%
29894 }%
29895 {%
29896 \@dynamicframeid{thumbtab\number#1}%
29897 \@@setdynamicframe{\ff@id}{#2}%
29898 \@dynamicframeid{thumbtabindex\number#1}%
29899 \@@setdynamicframe{\ff@id}{#2}%
29900 }%
29901 }
29902 \newcommand{\setthumbtabindex}[2]{%
29903 \ifthenelse{\equal{#1}{all}}%
29904 {%
29905 \@ff@tmpN=0\relax
29906 \whiledo{\@ff@tmpN<\c@maxthumbtabs}%
29907 {%
29908 \advance\@ff@tmpN by 1\relax
29909 \@setthumbtabindex{\@ff@tmpN}{#2}%
29910 }%
29911 }%
29912 {%
29913 \@for\@ttb@id:=#1\do{\@setthumbtabindex{\@ttb@id}{#2}}%
29914 }%
29915 }
29916 \newcommand{\@setthumbtabindex}[2]{%
29917 \ifthenelse{\(\c@maxthumbtabs<#1\) \or \(#1<1\)}%
29918 {%
29919 \PackageWarning{flowfram}%
29920 {%
29921 Can't find thumbtab number `\number#1',
29922 ttb file may not be up-to-date%
29923 }%
29924 }%
29925 {%
29926 \@dynamicframeid{thumbtabindex\number#1}%
29927 \@@setdynamicframe{\ff@id}{#2}%
29928 }%
29929 }
29930 \newcommand*{\tocandthumbtabindex}{%
29931 \aligntoctrue
29932 \tableofcontents
29933 \thumbtabindex
29934 \aligntocfalse
29935 }
29936 \newcommand*{\@ttb@minitoctype}{\@ttb@type}
29937 \let\@ttb@old@starttoc\@starttoc
29938 \newif\if@storetoc
29939 \@storetocfalse
29940 \renewcommand*{\@starttoc}[1]{%
29941 \if@storetoc
29942 \@ttb@storetoc{#1}%
29943 \else
29944 \@ttb@old@starttoc{#1}%
29945 \fi
29946 }
29947 \newcommand*{\@ttb@storetoc}[1]{%
29948 \begingroup
29949 \makeatletter
29950 \@storefileconts{\jobname.#1}%
29951 \if@filesw
29952 \expandafter\newwrite\csname tf@#1\endcsname
29953 \immediate\openout\csname tf@#1\endcsname\jobname.#1\relax
29954 \fi
29955 \@nobreakfalse
29956 \endgroup
29957 }
29958 \newcommand*{\@storefileconts}[1]{%
29959 \IfFileExists{#1}%
29960 {%
29961 \@@storefileconts\@filef@und
29962 }%
29963 {%
29964 \PackageInfo{flowfram}{No file #1.}%
29965 }%
29966 }
29967 \newcount\c@maxtocunits
29968 \newcount\c@maxminitoc
29969 \newcommand{\@@storefileconts}[1]{%
29970 \@ifundefined{\@ttb@minitoctype}%
29971 {%
29972 \@ttb@minitoclevel=6\relax
29973 }%
29974 {%
29975 \expandafter\@ttb@minitoclevel\expandafter
29976 =\csname @ttb@\@ttb@minitoctype @level\endcsname
29977 }%
29978 \newread\@ttb@toc
29979 \openin\@ttb@toc=#1\relax
29980 \c@maxtocunits=0\relax
29981 \c@maxminitoc=0\relax
29982 \whiledo{\not\boolean{eof}\@ttb@toc}%
29983 {%
29984 \read\@ttb@toc to\tocline
29985 \@addtotoclist{\tocline}{\c@maxtocunits}%
29986 }%
29987 \closein\@ttb@toc
29988 }
29989 \newif\if@contsline
29990 \newcount\@ttb@level
29991 \newcount\@ttb@minitoclevel
29992
29993 \newcommand{\@addtotoclist}[2]{%
29994 \expandafter\@checkcontentsline#1\end
29995 \if@contsline
29996 \expandafter\@gettype#1\end
29997 \ifthenelse{\equal{\@ttb@contstype}{\@ttb@type}}%
29998 {%
29999 \global\advance#2 by 1\relax
30000 }%
30001 {}%
30002 \fi
30003 \@ifundefined{@toc@\romannumeral#2}%
30004 {%
30005 \flf@ta=\expandafter{#1}%
30006 \expandafter\xdef\csname @toc@\romannumeral#2\endcsname{\the\flf@ta}%
30007 }%
30008 {%
30009 \flf@ta=\expandafter{#1}%
30010 \flf@tb=\expandafter\expandafter\expandafter
30011 {\csname @toc@\romannumeral#2\endcsname}%
30012 \expandafter\xdef\csname @toc@\romannumeral#2\endcsname{%
30013 \the\flf@tb\the\flf@ta}%
30014 }%
30015 \if@minitoc
30016 \if@contsline
30017 \@ifundefined{\@ttb@contstype}%
30018 {\@ttb@level=6}%
30019 {%
30020 \@ttb@level=\csname @ttb@\@ttb@contstype @level\endcsname
30021 }%
30022 \relax
30023 \ifnum\@ttb@level=\@ttb@minitoclevel
30024 \global\advance\c@maxminitoc by 1\relax
30025 \expandafter
30026 \gdef\csname @minitoc@\romannumeral\c@maxminitoc\endcsname{}%
30027 \else
30028 \ifnum\@ttb@level>\@ttb@minitoclevel
30029 \flf@ta=\expandafter{#1}\relax
30030 \flf@tb=\expandafter\expandafter\expandafter
30031 {\csname @minitoc@\romannumeral\c@maxminitoc\endcsname}\relax
30032 \expandafter
30033 \xdef\csname @minitoc@\romannumeral\c@maxminitoc\endcsname{%
30034 \the\flf@tb\the\flf@ta}
30035 \fi
30036 \fi
30037 \fi
30038 \fi
30039 }
30040 \def\@ttb@part@level{-1}
30041 \def\@ttb@chapter@level{0}
30042 \def\@ttb@section@level{1}
30043 \def\@ttb@subsection@level{2}
30044 \def\@ttb@subsubsection@level{3}
30045 \def\@ttb@paragraph@level{4}
30046 \def\@ttb@subparagraph@level{5}
30047 \long\def\@checkcontentsline#1#2\end{%
30048 \ifx#1\contentsline
30049 \@contslinetrue
30050 \else
30051 \@contslinefalse
30052 \fi
30053 }
30054 \def\@gettype\contentsline#1#2\end{%
30055 \def\@ttb@contstype{#1}%
30056 }
30057 \newif\ifaligntoc
30058 \aligntocfalse
30059 \let\@ttb@old@tableofcontents\tableofcontents
30060 \renewcommand{\tableofcontents}{%
30061 \@storetoctrue
30062 \@ttb@old@tableofcontents
30063 \ifaligntoc
30064 \@printalignedtoc
30065 \else
30066 \@printtoc
30067 \fi
30068 \@storetocfalse
30069 \global\c@minitoc=0\relax
30070 }
30071 \newlength\beforeminitocskip
30072 \setlength{\beforeminitocskip}{0pt}
30073 \newlength\afterminitocskip
30074 \setlength{\afterminitocskip}{\baselineskip}
30075 \newcommand*{\dominitoc}[1]{%
30076 \if@minitoc
30077 \@dominitoc{#1}%
30078 \fi
30079 }
30080 \newcommand*{\@dominitoc}[1]{\@@dominitoc{#1}}
30081 \newcommand{\minitocstyle}[1]{%
30082 \normalfont\normalsize\normalcolor
30083 #1%
30084 }
30085 \newcommand*{\@@dominitoc}[1]{%
30086 {%
30087 \minitocstyle
30088 {%
30089 \vskip\beforeminitocskip
30090 \csname @minitoc@\romannumeral#1\endcsname
30091 }%
30092 }%
30093 \vskip\afterminitocskip
30094 }
30095 \newcommand*{\appenddfminitoc}{%
30096 \renewcommand{\beforeminitocskip}{\baselineskip}%
30097 \@ifstar\@sappendminitocdf\@appendminitocdf
30098 }
30099 \newcommand*{\@sappendminitocdf}[1]{%
30100 \renewcommand{\@dominitoc}[1]{%
30101 \@sappenddynamic{#1}{\@@dominitoc{##1}}%
30102 }%
30103 }
30104 \newcommand*{\@appendminitocdf}[1]{%
30105 \renewcommand{\@dominitoc}[1]{%
30106 \@appenddynamic{#1}{\@@dominitoc{##1}}%
30107 }%
30108 }
30109 \newcommand*{\@printtoc}{%
30110 \@colN=0\relax
30111 \csname @toc@\romannumeral\@colN\endcsname
30112 \whiledo{\@colN<\c@maxtocunits}%
30113 {%
30114 \advance\@colN by 1\relax
30115 \csname @toc@\romannumeral\@colN\endcsname
30116 }%
30117 }
30118 \newcommand{\@printalignedtoc}{%
30119 \@ff@tmpN=0\relax
30120 \@ifundefined{@toc@\romannumeral\@ff@tmpN}%
30121 {}%
30122 {%
30123 \csname @toc@\romannumeral\@ff@tmpN\endcsname
30124 \par\noindent\hrulefill
30125 }%
30126 \whiledo{\@ff@tmpN<\c@maxtocunits}%
30127 {%
30128 \advance\@ff@tmpN by 1\relax
30129 \ifnum\@ff@tmpN>\c@maxthumbtabs
30130 \csname @toc@\romannumeral\@ff@tmpN\endcsname
30131 \else
30132 \@dynamicframeid{thumbtabindex\number\@ff@tmpN}%
30133 \expandafter\expandafter\expandafter
30134 \@ff@getstaticpos\csname @df@dim@\romannumeral\ff@id\endcsname
30135 \vbox to \@ff@tmp@y
30136 {%
30137 \noindent\parbox{\linewidth}%
30138 {%
30139 \csname @toc@\romannumeral\@ff@tmpN\endcsname
30140 }%
30141 \vfill
30142 \par\noindent\hrulefill
30143 }%
30144 \fi
30145 }%
30146 }
30147 \newcounter{minitoc}
30148 \newif\if@minitoc
30149 \@minitocfalse
30150
30151 \newcommand*{\enableminitoc}[1][\@ttb@type]{%
30152 \@minitoctrue
30153 \setcounter{minitoc}{0}%
30154 \@ifundefined{#1}%
30155 {%
30156 \PackageError{flowfram}{Sectioning type `#1' not defined}{}%
30157 }%
30158 {%
30159 \renewcommand{\@ttb@minitoctype}{#1}%
30160 \ifthenelse{\equal{#1}{chapter}}%
30161 {%
30162 \@makeminitocchapter
30163 }%
30164 {%
30165 \ifthenelse{\equal{#1}{part}}%
30166 {\@makeminitocpart}%
30167 {%
30168 \@makeminitocsection{#1}%
30169 }%
30170 }%
30171 }%
30172 }
30173 \@onlypreamble{\enableminitoc}
30174 \newcommand{\@makeminitocchapter}{%
30175 \let\@mtoc@old@chapter\@chapter
30176 \def\@chapter[##1]##2{%
30177 \@mtoc@old@chapter[##1]{##2}%
30178 \stepcounter{minitoc}%
30179 \dominitoc{\c@minitoc}%
30180 \@afterheading
30181 }%
30182 }
30183 \newcommand{\@makeminitocpart}{%
30184 \@ifundefined{@endpart}%
30185 {%
30186 \let\@mtoc@old@part\@part
30187 \def\@part[##1]##2{%
30188 \@mtoc@old@part[##1]{##2}%
30189 \stepcounter{minitoc}%
30190 \dominitoc{\c@minitoc}%
30191 \@afterheading
30192 }%
30193 }%
30194 {%
30195 \let\@mtoc@old@endpart\@endpart
30196 \def\@endpart{%
30197 \stepcounter{minitoc}%
30198 \dominitoc{\c@minitoc}%
30199 \@mtoc@old@endpart
30200 }%
30201 }%
30202 }
30203 \newcommand{\@makeminitocsection}[1]{%
30204 \let\@mtoc@old@sect=\@sect
30205 \def\@sect##1##2##3##4##5##6[##7]##8{%
30206 \@mtoc@old@sect{##1}{##2}{##3}{##4}{##5}{##6}[##7]{##8}%
30207 \ifthenelse{\equal{##1}{#1}}%
30208 {%
30209 \stepcounter{minitoc}%
30210 \dominitoc{\c@minitoc}%
30211 \@afterheading
30212 }%
30213 {}%
30214 }%
30215 }
30216 % \end{macrocode}
30217 %\iffalse
30218 % \begin{macrocode}
30219 %</flowfram-2014-09-30.sty>
30220 % \end{macrocode}
30221 %\fi
30222 %\iffalse
30223 % \begin{macrocode}
30224 %<*flowfram-2025-08-23.sty>
30225 % \end{macrocode}
30226 %\fi
30227 % \section{Rollback v1.18 (flowfram-2025-08-23)}
30228 % Declare package, and identify it as a \LaTeXe\ package.
30229 % \begin{macrocode}
30230 \NeedsTeXFormat{LaTeX2e}
30231 % \end{macrocode}
30232 % Rollback release:
30233 % \begin{macrocode}
30234 \DeclareRelease{v1.17}{2014-09-30}{flowfram-2014-09-30.sty}
30235 \DeclareCurrentRelease{v1.18}{2025-08-23}
30236 % \end{macrocode}
30237 %Declare package:
30238 % \begin{macrocode}
30239 \ProvidesPackage{flowfram}[2025/08/23 v1.18 (NLCT)]
30240 % \end{macrocode}
30241 % Load packages needed by this package
30242 % \begin{macrocode}
30243 \RequirePackage{ifthen}
30244 % \end{macrocode}
30245 %\changes{1.14}{2012-11-10}{now loading xkeyval instead of keyval}
30246 % \begin{macrocode}
30247 \RequirePackage{xkeyval}
30248 \RequirePackage{graphics}
30249 \RequirePackage{afterpage}
30250 % \end{macrocode}
30251 %\changes{1.14}{2012-11-10}{now loading xfor and etoolbox}
30252 % \begin{macrocode}
30253 \RequirePackage{xfor}
30254 \RequirePackage{etoolbox}
30255 % \end{macrocode}
30256 % \begin{macrocode}
30257 \@ifundefined{@ldc@l@r}{\RequirePackage{color}}{}
30258 % \end{macrocode}
30259 % The colour of the \gls{bbox} borders when the draft
30260 % option is specified is given by the commands:
30261 % \begin{macrocode}
30262 \newcommand{\setffdraftcolor}{\color[gray]{0.8}}
30263 \newcommand{\setffdrafttypeblockcolor}{\color[gray]{0.9}}
30264 % \end{macrocode}
30265 %\begin{macro}{\fflabelsep}
30266 % In draft mode, each \gls{bbox} (apart from the one indicating
30267 % the \gls{typeblock}), has a label positioned to the right of the
30268 % box, at a distance of "\fflabelsep" from the right hand
30269 % border.\DescribeMacro{\fflabelsep}
30270 % \begin{macrocode}
30271 \newlength\fflabelsep
30272 \fflabelsep=1pt
30273 % \end{macrocode}
30274 %\end{macro}
30275 %\begin{macro}{\fflabelfont}
30276 % The appearance of the label is set by the declaration:
30277 % \begin{macrocode}
30278 \newcommand*{\fflabelfont}{\small\sffamily}
30279 % \end{macrocode}
30280 %\end{macro}
30281 % The command "\@ffdraft" is used to switch to draft mode.
30282 % Allow user the option to show particular types of bounding
30283 % boxes.
30284 % \begin{macrocode}
30285 \newif\ifshowtypeblock
30286 \newif\ifshowmargins
30287 \newif\ifshowframebbox
30288 % \end{macrocode}
30289 %\begin{macro}{\@ffdraft}
30290 % Set all draft settings.
30291 % \begin{macrocode}
30292 \newcommand*{\@ffdraft}{%
30293 \showtypeblocktrue
30294 \showmarginstrue
30295 \showframebboxtrue
30296 }
30297 % \end{macrocode}
30298 %\end{macro}
30299 %\begin{macro}{\@ffnodraft}
30300 % Unset all draft settings.
30301 % \begin{macrocode}
30302 \newcommand*{\@ffnodraft}{%
30303 \showtypeblockfalse
30304 \showmarginsfalse
30305 \showframebboxfalse
30306 }
30307 % \end{macrocode}
30308 %\end{macro}
30309 %\begin{macro}{\@fr@meifdraft}
30310 % Draw \gls{bbox}.
30311 % \begin{macrocode}
30312 \newcommand*{\@fr@meifdraft}[3][\setffdraftcolor]{%
30313 \def\ff@backcol{{none}}%
30314 \@ifundefined{color}{\frame{#2}}{#1\frame{#2}}%
30315 \ifthenelse{\equal{#3}{}}{}%
30316 {%
30317 \makebox[0pt][l]{\hskip\fflabelsep\fflabelfont{[#3]}}%
30318 }%
30319 }%
30320 % \end{macrocode}
30321 %\end{macro}
30322 % Colour setting commands, do nothing by default:
30323 % \begin{macrocode}
30324 \newcommand*{\@s@tffcol}{}
30325 \newcommand*{\@s@tfftextcol}{}
30326 % \end{macrocode}
30327 %\begin{macro}{\@ffbackground}
30328 % Deal with \gls{frame} background colour. Note that the background colour only
30329 % extends to the limit of the \gls{frame}['s] \gls{bbox}. If you want the background
30330 % colour to be flush with the \glspl{frame} border, you will have to create your own
30331 % customised border.
30332 % \begin{macrocode}
30333 \newcommand*{\@ffbackground}[1]{#1}
30334 % \end{macrocode}
30335 %\end{macro}
30336 % Now declare the options.
30337 %\begin{option}{draft}
30338 % If draft, switch to draft definitions.
30339 % \begin{macrocode}
30340 \DeclareOptionX{draft}{\@ffdraft}
30341 % \end{macrocode}
30342 %\end{option}
30343 %\begin{option}{final}
30344 % If not draft, reset commands so that no \glspl{bbox}
30345 % are drawn.
30346 % \begin{macrocode}
30347 \DeclareOptionX{final}{\@ffnodraft}
30348 % \end{macrocode}
30349 %\end{option}
30350 % Set the default to \opt{final}:
30351 % \begin{macrocode}
30352 \@ffnodraft
30353 % \end{macrocode}
30354 %
30355 %\begin{option}{verbose}
30356 %\changes{1.14}{2012-11-10}{new}
30357 % Verbose mode is primarily for debug messages.
30358 % \begin{macrocode}
30359 \define@choicekey{flowfram.sty}%
30360 {verbose}[\@flf@val\@flf@nr]%
30361 {true,false}[true]%
30362 {%
30363 \ifcase\@flf@nr\relax
30364 \renewcommand*{\flf@doifverbose}[1]{##1}%
30365 \renewcommand*{\flf@message}[1]{\PackageInfo{flowfram}{##1}}%
30366 \or
30367 \renewcommand*{\flf@doifverbose}[1]{}%
30368 \renewcommand*{\flf@message}[1]{}%
30369 \fi
30370 }
30371 % \end{macrocode}
30372 %\end{option}
30373 %\begin{macro}{\flf@message}
30374 % Messaging system (to help debugging):
30375 %\changes{1.14}{2012-11-10}{new}
30376 % \begin{macrocode}
30377 \newcommand*{\flf@message}[1]{%
30378 \flf@doifverbose
30379 {%
30380 \PackageInfo{flowfram}{##1}%
30381 }%
30382 }
30383 % \end{macrocode}
30384 %\end{macro}
30385 %
30386 %\begin{macro}{\flf@doifverbose}
30387 %\changes{1.14}{2012-11-10}{new}
30388 % Initialise:
30389 % \begin{macrocode}
30390 \newcommand*{\flf@doifverbose}[1]{}
30391 % \end{macrocode}
30392 %\end{macro}
30393 %
30394 %\begin{option}{rotate}
30395 % Allow provision to prevent rotation in the thumbtabs.
30396 % If no rotation, thumbtab text will be stacked vertically.
30397 % This will also affect whether or not to rotate \glspl{frame}.
30398 %\changes{1.14}{2012-11-10}{changed to boolean key}
30399 % \begin{macrocode}
30400 \define@boolkey{flowfram.sty}[@ttb@]{rotate}[true]{}
30401 \@ttb@rotatetrue
30402 % \end{macrocode}
30403 %\end{option}
30404 %\begin{option}{norotate}
30405 % Provide \opt{norotate} option for backward compatibility
30406 % \begin{macrocode}
30407 \DeclareOptionX{norotate}{\@ttb@rotatefalse}
30408 % \end{macrocode}
30409 %\end{option}
30410 %\begin{macro}{\rotateframe}
30411 % Define command that will only rotate box if rotate option
30412 % set.
30413 % \begin{macrocode}
30414 \newcommand{\rotateframe}[2]{%
30415 \if@ttb@rotate
30416 \rotatebox{#1}{#2}%
30417 \else
30418 #2%
30419 \fi
30420 }
30421 % \end{macrocode}
30422 %\end{macro}
30423 % Should the thumbtabs include number, title, both or
30424 % neither?
30425 %\begin{macro}{\if@ttb@num}
30426 % \begin{macrocode}
30427 \newif\if@ttb@num
30428 \@ttb@numfalse
30429 % \end{macrocode}
30430 %\end{macro}
30431 %\begin{macro}{\if@ttb@title}
30432 % \begin{macrocode}
30433 \newif\if@ttb@title
30434 \@ttb@titletrue
30435 % \end{macrocode}
30436 %\begin{option}{thumbtabs}
30437 %\changes{1.14}{2012-11-10}{new}
30438 % The \opt{thumbtabs} option replaces the \opt{ttbtitle},
30439 % \opt{ttbnotitle}, \opt{ttbnum} and \opt{ttbnonum}
30440 % options.
30441 % \begin{macrocode}
30442 \define@choicekey{flowfram.sty}%
30443 {thumbtabs}[\@flf@val\@flf@nr]%
30444 {title,number,both,none}[title]%
30445 {%
30446 \ifcase\@flf@nr\relax
30447 % \end{macrocode}
30448 % Thumbtabs to only include title
30449 % \begin{macrocode}
30450 \@ttb@numfalse
30451 \@ttb@titletrue
30452 \or
30453 % \end{macrocode}
30454 % Thumbtabs to only include number
30455 % \begin{macrocode}
30456 \@ttb@numtrue
30457 \@ttb@titlefalse
30458 \or
30459 % \end{macrocode}
30460 % Thumbtabs to include title and number
30461 % \begin{macrocode}
30462 \@ttb@numtrue
30463 \@ttb@titletrue
30464 \or
30465 % \end{macrocode}
30466 % Thumbtabs don't have title or number
30467 % \begin{macrocode}
30468 \@ttb@numfalse
30469 \@ttb@titlefalse
30470 \fi
30471 }
30472 % \end{macrocode}
30473 %\end{option}
30474 % Provide old options for backward compatibility:
30475 %\begin{option}{ttbtitle}
30476 % \begin{macrocode}
30477 \DeclareOptionX{ttbtitle}{\@ttb@titletrue}
30478 % \end{macrocode}
30479 %\end{option}
30480 %\begin{option}{ttbnotitle}
30481 % \begin{macrocode}
30482 \DeclareOptionX{ttbnotitle}{\@ttb@titlefalse}
30483 % \end{macrocode}
30484 %\end{option}
30485 %\begin{option}{ttbnum}
30486 % \begin{macrocode}
30487 \DeclareOptionX{ttbnum}{\@ttb@numtrue}
30488 % \end{macrocode}
30489 %\end{option}
30490 %\begin{option}{ttbnonum}
30491 % \begin{macrocode}
30492 \DeclareOptionX{ttbnonum}{\@ttb@numfalse}
30493 % \end{macrocode}
30494 %\end{option}
30495 %
30496 %\begin{option}{pages}
30497 %\changes{1.14}{2012-11-10}{new}
30498 % Determine whether the pages key when defining frames refers to the
30499 % page number as given by \cs{c@page} or the absolute
30500 % page number as given by \cs{c@absolutepage}.
30501 % \begin{macrocode}
30502 \define@choicekey{flowfram.sty}{pages}[\@flf@val\@flf@nr]%
30503 {relative,absolute}%
30504 {%
30505 \ifcase\@flf@nr\relax
30506 % \end{macrocode}
30507 % Relative (use \cs{c@page}):
30508 % \begin{macrocode}
30509 \renewcommand*{\@ff@pages@countreg}{\c@page}%
30510 \or
30511 % \end{macrocode}
30512 % Absolute (use \cs{c@absolutepage}):
30513 % \begin{macrocode}
30514 \renewcommand*{\@ff@pages@countreg}{\c@absolutepage}%
30515 \fi
30516 }
30517 % \end{macrocode}
30518 %\end{option}
30519 %\begin{macro}{\@ff@pages@countreg}
30520 %\changes{1.14}{2012-11-10}{new}
30521 % The default is relative (for backwards compatibility).
30522 % \begin{macrocode}
30523 \newcommand*{\@ff@pages@countreg}{\c@page}
30524 % \end{macrocode}
30525 %\end{macro}
30526 %\begin{counter}{absolutepage}
30527 %\changes{1.14}{2012-11-10}{new}
30528 % \begin{macrocode}
30529 \newcounter{absolutepage}
30530 % \end{macrocode}
30531 %\end{counter}
30532 %
30533 %\begin{option}{color}
30534 %\changes{1.14}{2012-11-10}{changed to boolean option}
30535 % If \opt[true]{color} option specified, set up the default colours
30536 % for the borders and text for all \gls{frame} types. Note that
30537 % the colour name has to be grouped within the definition
30538 % of \cs{flowframecol} and \cs{flowframetextcol}. This
30539 % was done so that you could do, for example,
30540 % "\renewcommand{\flowframecol}{[rgb]{1,1,0}}" so that
30541 % you can specify the colour model as well.
30542 % The commands \cs{@s@tffcol} and \cs{@s@tfftextcol}
30543 % switch to the border and text colour, respectively. They
30544 % both assume that \cs{ff@col} has been set to the
30545 % relevant colour before use.
30546 % \begin{macrocode}
30547 \define@choicekey{flowfram.sty}{color}[\@flf@val\@flf@nr]{true,false}[true]{%
30548 \ifcase\@flf@nr\relax
30549 % \end{macrocode}
30550 % Option set to true:
30551 % \begin{macrocode}
30552 \@ff@enablecolor
30553 \or
30554 % \end{macrocode}
30555 % Option set to false, ensure that the colour changing
30556 % commands do nothing:
30557 % \begin{macrocode}
30558 \@ff@disablecolor
30559 \fi
30560 }
30561 % \end{macrocode}
30562 %\end{option}
30563 % Provide \opt{nocolor} option for backward compatibility:
30564 % \begin{macrocode}
30565 \DeclareOptionX{nocolor}{%
30566 \@ff@disablecolor
30567 }
30568 % \end{macrocode}
30569 %\begin{macro}{\@ff@enablecolor}
30570 %\changes{1.14}{2012-11-10}{new}
30571 % Enable colour commands.
30572 % \begin{macrocode}
30573 \newcommand*{\@ff@enablecolor}{%
30574 \def\flowframecol{{black}}%
30575 \def\flowframetextcol{{black}}%
30576 \renewcommand*\@s@tffcol{%
30577 \ifthenelse{\equal{\ff@col}{}}%
30578 {}%
30579 {%
30580 \expandafter\color\ff@col}%
30581 }%
30582 \renewcommand*\@s@tfftextcol{%
30583 \ifthenelse{\equal{\ff@txtcol}{}}%
30584 {}%
30585 {%
30586 \expandafter\color\ff@txtcol
30587 }%
30588 }%
30589 \renewcommand*{\@ffbackground}[1]{%
30590 \ifthenelse{\equal{\ff@backcol}{{none}}}%
30591 {%
30592 ##1%
30593 }%
30594 {%
30595 {\fboxsep=0pt\expandafter\colorbox\ff@backcol{##1}}%
30596 }%
30597 }%
30598 }
30599 % \end{macrocode}
30600 %\end{macro}
30601 %\begin{macro}{\@ff@disablecolor}
30602 %\changes{1.14}{2012-11-10}{new}
30603 % Disable colour commands.
30604 % \begin{macrocode}
30605 \newcommand*{\@ff@disablecolor}{%
30606 \def\flowframetextcol{}%
30607 \def\flowframecol{}%
30608 \renewcommand{\@s@tffcol}{}\renewcommand{\@s@tfftextcol}{}%
30609 \renewcommand{\@ffbackground}[1]{##1}%
30610 }
30611 % \end{macrocode}
30612 %\end{macro}
30613 %
30614 %\begin{macro}{\iflefttorightcolumns}
30615 % Determine whether to define the Ncolumn style frames from left
30616 % to right or from right to left.
30617 %\changes{1.12}{2009/11/25}{new}
30618 % \begin{macrocode}
30619 \newif\iflefttorightcolumns
30620 \lefttorightcolumnstrue
30621 % \end{macrocode}
30622 %\end{macro}
30623 % Define options that set the direction:
30624 %\begin{option}{LR}
30625 % \begin{macrocode}
30626 \DeclareOptionX{LR}{\lefttorightcolumnstrue}
30627 % \end{macrocode}
30628 %\end{option}
30629 %\begin{option}{RL}
30630 % \begin{macrocode}
30631 \DeclareOptionX{RL}{\lefttorightcolumnsfalse}
30632 % \end{macrocode}
30633 %\end{option}
30634 % If the \cs{normalcolor} command is something other than
30635 % \cs{relax}, then implement
30636 % the \opt[true]{color} option as the default, otherwise implement the
30637 % \opt[false]{color} option as the default.
30638 % \begin{macrocode}
30639 \ifx\normalcolor\relax
30640 \@ff@disablecolor
30641 \else
30642 \@ff@enablecolor
30643 \fi
30644 % \end{macrocode}
30645 % Now the defaults have all been set, the package options
30646 % specified by the user can be processed:
30647 % \begin{macrocode}
30648 \ProcessOptionsX
30649 % \end{macrocode}
30650 % If \opt[true]{color} option has been specified, but no color
30651 % package has been loaded yet, load color.sty
30652 % \begin{macrocode}
30653 \ifx\normalcolor\relax
30654 \ifthenelse{\equal{\flowframetextcol}{}}%
30655 {}%
30656 {%
30657 \RequirePackage{color}%
30658 }
30659 \fi
30660 % \end{macrocode}
30661 %
30662 % \begin{macrocode}
30663 \@ifundefined{chapter}{}%
30664 {%
30665 % \end{macrocode}
30666 %\begin{macro}{\chapterfirstpagestyle}
30667 % User may want a non standard style for the first page of
30668 % each chapter, so modify chapter commands to take this into
30669 % account.
30670 % \begin{macrocode}
30671 \newcommand*{\chapterfirstpagestyle}{plain}%
30672 % \end{macrocode}
30673 %\end{macro}
30674 %
30675 % \begin{macrocode}
30676 \let\@ff@OLD@chapter\@chapter
30677 \let\@ff@OLD@schapter\@schapter
30678 \renewcommand{\@chapter}{%
30679 \thispagestyle{\chapterfirstpagestyle}%
30680 \@ff@OLD@chapter
30681 }%
30682 \renewcommand{\@schapter}{%
30683 \thispagestyle{\chapterfirstpagestyle}%
30684 \@ff@OLD@schapter
30685 }%
30686 % \end{macrocode}
30687 %\end{macro}
30688 %
30689 %\begin{macro}{\ffprechapterhook}
30690 %\changes{1.14}{2012-11-10}{new}
30691 % Hook at start of chapter (before page break issued)
30692 % \begin{macrocode}
30693 \newcommand*{\ffprechapterhook}{}
30694 % \end{macrocode}
30695 %\end{macro}
30696 %
30697 %\begin{macro}{\chapter}
30698 % Modify \cs{chapter} so the hook is called at the start:
30699 % \begin{macrocode}
30700 \let\@ff@OLD@ch@pter\chapter
30701 \renewcommand{\chapter}{%
30702 \ffprechapterhook
30703 \@ff@OLD@ch@pter
30704 }
30705 % \end{macrocode}
30706 %\end{macro}
30707 %
30708 % End of test if \cs{chapter} defined:
30709 % \begin{macrocode}
30710 }
30711 % \end{macrocode}
30712 %
30713 %\begin{counter}{maxflow}
30714 % Now get on with the package. First we need to set up
30715 % a register to store the number of \glspl{flow} that have been defined:
30716 % \begin{macrocode}
30717 \newcounter{maxflow}
30718 \c@maxflow=0\relax
30719 % \end{macrocode}
30720 %\end{counter}
30721 %
30722 %\begin{counter}{thisframe}
30723 % Next define a counter to keep track of the \gls{idn} of the current
30724 % \gls{flow}.
30725 % \begin{macrocode}
30726 \newcounter{thisframe}
30727 \c@thisframe=0\relax
30728 \@ifpackageloaded{hyperref}
30729 {%
30730 \def\theHthisframe{\thepage.\arabic{thisframe}}%
30731 }%
30732 {}
30733 % \end{macrocode}
30734 %\end{counter}
30735 %\begin{macro}{\labelflowidn}
30736 %\changes{1.11}{2008/06/27}{new}
30737 % Define a command to label the current \gls{flow} so that its
30738 % \gls{idn} can be referenced:
30739 % \begin{macrocode}
30740 \newcommand*{\labelflowidn}[1]{%
30741 {%
30742 \def\@currentlabel{\thethisframe}%
30743 \label{#1}%
30744 }%
30745 }
30746 % \end{macrocode}
30747 %\end{macro}
30748 %\begin{counter}{displayedframe}
30749 % Define a counter to store the current frame index for the current
30750 % page. This will be the same as the \gls{idn} if all \glspl{flow}
30751 % are displayed on the current page, but may be different to the
30752 % \gls{idn} if some \glspl{flow} are not displayed.
30753 %\changes{1.11}{2008/06/27}{displayedframe counter added}
30754 % \begin{macrocode}
30755 \newcounter{displayedframe}
30756 \c@displayedframe=0
30757 \@ifpackageloaded{hyperref}%
30758 {%
30759 \def\theHdisplayedframe{\thepage.\arabic{displayedframe}}%
30760 }%
30761 {}
30762 % \end{macrocode}
30763 %\end{counter}
30764 %
30765 %\begin{macro}{\labelflow}
30766 %\changes{1.11}{2008/06/27}{new}
30767 % Define a command to label the current \gls{flow} so that its
30768 % displayed index can be referenced:
30769 % \begin{macrocode}
30770 \newcommand*{\labelflow}[1]{%
30771 {%
30772 \def\@currentlabel{\thedisplayedframe}%
30773 \label{#1}%
30774 }%
30775 }
30776 % \end{macrocode}
30777 %\end{macro}
30778 %\begin{counter}{maxstatic}
30779 % Define a counter to store the total number of \glspl{static}:
30780 % \begin{macrocode}
30781 \newcounter{maxstatic}
30782 \c@maxstatic=0\relax
30783 % \end{macrocode}
30784 %\end{counter}
30785 %\begin{counter}{maxdynamic}
30786 % Define a counter to store the total number of \glspl{dynamic}:
30787 % \begin{macrocode}
30788 \newcounter{maxdynamic}
30789 \c@maxdynamic=0\relax
30790 % \end{macrocode}
30791 %\end{counter}
30792 % Define some temporary variables
30793 % \begin{macrocode}
30794 \newcount\@colN
30795 \newcount\@ff@tmpN
30796 \newcount\ff@id
30797 \newlength\@ff@offset
30798 \newlength\@ff@tmp@x
30799 \newlength\@ff@tmp@x@even
30800 \newlength\@ff@tmp@y
30801 % \end{macrocode}
30802 %\begin{macro}{\sdfparindent}
30803 % Define a length to govern paragraph indentation within
30804 % static and dynamic frames.
30805 % This is 0pt by default.
30806 % \begin{macrocode}
30807 \newlength\sdfparindent
30808 % \end{macrocode}
30809 %\end{macro}
30810 %
30811 % \subsection{Flow Frames}
30812 %\begin{macro}{\flowframesep}
30813 % Set up default lengths. The gap between the text and the
30814 % border is given by:
30815 % \begin{macrocode}
30816 \newlength\flowframesep
30817 \flowframesep=\fboxsep
30818 % \end{macrocode}
30819 %\end{macro}
30820 %\begin{macro}{\flowframerule}
30821 % The width of the frame is given by:
30822 % \begin{macrocode}
30823 \newlength\flowframerule
30824 \flowframerule=\fboxrule
30825 % \end{macrocode}
30826 %\end{macro}
30827 %\begin{macro}{\flowframeshowlayout}
30828 % Define command to show page layout. This finishes the current
30829 % page, temporarily sets draft mode, and prints an empty page.
30830 % Only the \glspl{frame} for that page will be shown.
30831 %\DescribeMacro{\flowframeshowlayout}
30832 % \begin{macrocode}
30833 \newcommand*{\flowframeshowlayout}{%
30834 \finishthispage
30835 {%
30836 \@ffdraft\mbox{}\finishthispage\clearpage
30837 }%
30838 }
30839 % \end{macrocode}
30840 %\end{macro}
30841 %\begin{macro}{\framebreak}
30842 % If the \glspl{flow} are not all of the same width, the change
30843 % in "\hsize" will not come into effect until the end
30844 % of the paragraph. Provide a command to simulate a paragraph
30845 % break, without making it look as though there is a paragraph.
30846 % Provides an optional argument that is passed to
30847 % "\pagebreak". Make sure it is grouped to localise
30848 % the change in "\parfillskip" and "\parskip".
30849 %\changes{1.14}{2012-11-10}{made change to switch global}
30850 % \begin{macrocode}
30851 \newif\ifusedframebreak
30852 \newcommand{\framebreak}[1][4]{%
30853 \global\usedframebreaktrue
30854 {%
30855 \parfillskip=0pt\pagebreak[#1]\parskip=0pt\par\noindent
30856 }%
30857 }
30858 % \end{macrocode}
30859 %\end{macro}
30860 %\begin{macro}{\finishthispage}
30861 % The commands \cs{newpage} and
30862 % \cs{pagebreak} can be used to move on to the next
30863 % \gls{flow}, but to finish the entire page, use
30864 % "\finishthispage". This is (loosely) based on the code for
30865 % \cs{clearpage}. (\cs{@dbltopnum} not required as we can't have
30866 % column-spanning floats.)
30867 %\changes{1.14}{2012-11-10}{change \cs{c@page} to
30868 %\cs{@ff@pages@countreg}}
30869 % \begin{macrocode}
30870 \newcommand{\finishthispage}{%
30871 \ifvmode
30872 \@colN=\c@thisframe\relax
30873 \count@=\c@absolutepage\relax
30874 \ifdim \pagetotal<\topskip
30875 \hbox{}%
30876 \fi
30877 \newpage \write \m@ne {}\vbox {}\penalty -\@Mi
30878 % \end{macrocode}
30879 % If that was the last \gls{flow} on the page, then we're done,
30880 % otherwise iterate through the remaining \glspl{flow}.
30881 % \begin{macrocode}
30882 \ifnum\count@=\c@absolutepage\relax
30883 \whiledo{\@colN<\c@maxflow \OR \@colN=\c@maxflow}%
30884 {%
30885 \@ff@chckifthispg{\@ff@pages@countreg}{\@colN}%
30886 \if@notthiscol
30887 \else
30888 \c@thisframe=\@colN\relax
30889 \hbox{}\newpage
30890 \fi
30891 \advance\@colN by 1\relax
30892 }%
30893 \fi
30894 \fi
30895 }
30896 % \end{macrocode}
30897 %\end{macro}
30898 %\begin{macro}{\cleardoublepage}
30899 % Modify the definition of "\cleardoublepage". This may
30900 % or may not be defined so use "\def".
30901 % \begin{macrocode}
30902 \def\cleardoublepage{%
30903 \clearpage
30904 \if@twoside
30905 \ifodd\c@page
30906 \else
30907 \hbox{}%
30908 \clearpage
30909 \fi
30910 \fi
30911 }
30912 % \end{macrocode}
30913 %\end{macro}
30914 %
30915 %\begin{macro}{\newpage}
30916 % Modify the definition of \cs{newpage} so that it sets the
30917 % "usedframebreak" flag.
30918 %\changes{1.14}{2012-11-10}{Modified definition of \cs{newpage}}
30919 % \begin{macrocode}
30920 \preto\newpage{\global\usedframebreaktrue}
30921 % \end{macrocode}
30922 %\end{macro}
30923 % Disable "@twocolumn" flag, as it makes no sense.
30924 % \begin{macrocode}
30925 \@twocolumnfalse
30926 % \end{macrocode}
30927 % Disable "@mparswitch" flag, as each \gls{flow} has
30928 % its own predefined margin setting.
30929 % \begin{macrocode}
30930 \@mparswitchfalse
30931 % \end{macrocode}
30932 %\begin{macro}{\globalreversemargin}
30933 % The margins get switched during the output routine, so
30934 % need the effect to be global.
30935 % \begin{macrocode}
30936 \newcommand{\globalreversemargin}{%
30937 \global\@mparbottom\z@
30938 \global\@reversemargintrue
30939 }
30940 % \end{macrocode}
30941 %\end{macro}
30942 %\begin{macro}{\globalnormalmargin}
30943 % \begin{macrocode}
30944 \newcommand{\globalnormalmargin}{%
30945 \global\@mparbottom\z@\global
30946 \@reversemarginfalse
30947 }
30948 % \end{macrocode}
30949 %\end{macro}
30950 %\begin{macro}{\@getmarginpos}
30951 % Determine whether the margin should be on the right
30952 % or left. This depends on the setting, which can either
30953 % be "right" or "left" (self explanatory) or "inner" (on the
30954 % spine side, so left for odd pages and right for even
30955 % pages) or "outer" (on the outside of the page, so right
30956 % for odd pages and left for even pages.) When "\@getmarginpos"
30957 % is finished, the setting is stored in "\ff@margin".
30958 % \begin{macrocode}
30959 \newcommand{\@getmarginpos}[1]{%
30960 \ifthenelse{\equal{#1}{inner}}%
30961 {%
30962 \if@twoside
30963 \ifodd\c@page\def\ff@margin{left}\else\def\ff@margin{right}\fi
30964 \else
30965 \def\ff@margin{left}%
30966 \fi
30967 }%
30968 {%
30969 \ifthenelse{\equal{#1}{outer}}%
30970 {%
30971 \if@twoside
30972 \ifodd\c@page\def\ff@margin{right}\else\def\ff@margin{left}\fi
30973 \else
30974 \def\ff@margin{right}%
30975 \fi
30976 }%
30977 {%
30978 \def\ff@margin{#1}%
30979 }%
30980 }%
30981 }
30982 % \end{macrocode}
30983 %\end{macro}
30984 %\begin{macro}{\setmargin}
30985 % Set the margin for current \gls{flow}.
30986 % \begin{macrocode}
30987 \newcommand{\setmargin}{%
30988 \@getmarginpos
30989 {%
30990 \csname @ff@margin@\romannumeral\c@thisframe\endcsname
30991 }%
30992 \ifthenelse{\equal{\ff@margin}{left}}%
30993 {\globalreversemargin}%
30994 {\globalnormalmargin}%
30995 }
30996 % \end{macrocode}
30997 %\end{macro}
30998 %\begin{macro}{\newflowframe}
30999 % Create a new \gls{flow}. Syntax:\newline
31000 % \cs{newflowframe}\oarg{pages}\marg{width}\marg{height}\marg{x}\marg{y}\oarg{label}
31001 %
31002 % First increment "\c@maxflow", and define boolean
31003 % to indicate whether or not the \gls{flow} has a border,
31004 % Then check to see whether or not the starred version is
31005 % begin used. All the settings must be global: the
31006 % output routine will create a new \gls{flow}, if there are no
31007 % more defined, and since changes made in the output routine
31008 % are localised, the new \gls{frame} will be lost unless it is
31009 % globally defined. Flow frames should only be set up in the
31010 % preamble, but if there are not enough \glspl{frame} to fit all
31011 % the document text, the output routine will create a new \gls{flow}.
31012 % So, define "\newflowframe" so that it calls
31013 % "\@n@wflowframe"
31014 % \begin{macrocode}
31015 \newcommand{\newflowframe}{\@n@wflowframe}
31016 % \end{macrocode}
31017 %\end{macro}
31018 % Set the external command for use only in the preamble, an
31019 % make the output routine use the internal command
31020 % \begin{macrocode}
31021 \@onlypreamble{\newflowframe}
31022 % \end{macrocode}
31023 %\begin{macro}{\@n@wflowframe}
31024 % \begin{macrocode}
31025 \newcommand{\@n@wflowframe}{%
31026 \global\advance\c@maxflow by 1\relax
31027 \expandafter\global\expandafter
31028 \newif\csname ifcolumnframe\romannumeral\c@maxflow\endcsname
31029 \@ifstar\@snewflowframe\@newflowframe
31030 }
31031 % \end{macrocode}
31032 %\end{macro}
31033 %\begin{macro}{\@snewflowframe}
31034 % Starred version sets boolean flag to indicate a border
31035 % \begin{macrocode}
31036 \newcommand{\@snewflowframe}{%
31037 \expandafter\global\expandafter
31038 \let\csname ifcolumnframe\romannumeral\c@maxflow\endcsname\iftrue
31039 \@@newflowframe
31040 }
31041 % \end{macrocode}
31042 %\end{macro}
31043 %\begin{macro}{\@newflowframe}
31044 % The unstarred version unsets boolean flag to indicate
31045 % no border.
31046 % \begin{macrocode}
31047 \newcommand{\@newflowframe}{%
31048 \expandafter\global\expandafter
31049 \let\csname ifcolumnframe\romannumeral\c@maxflow\endcsname\iffalse
31050 \@@newflowframe
31051 }
31052 % \end{macrocode}
31053 %\end{macro}
31054 %\begin{macro}{\@@newflowframe}
31055 % Now get on with initialising the \gls{flow}. By default, it
31056 % will apply the \gls{flow} to all pages, the optional argument
31057 % can override this.
31058 % \begin{macrocode}
31059 \newcommand{\@@newflowframe}[5][all]{%
31060 \expandafter\global\expandafter
31061 \newbox\csname column\romannumeral\c@maxflow\endcsname
31062 \expandafter\global\expandafter
31063 \newlength\csname colwidth\romannumeral\c@maxflow\endcsname
31064 \expandafter\global\expandafter
31065 \newlength\csname colheight\romannumeral\c@maxflow\endcsname
31066 \expandafter\global\expandafter
31067 \newlength\csname col@\romannumeral\c@maxflow @posx\endcsname
31068 \expandafter\global\expandafter
31069 \newlength\csname col@\romannumeral\c@maxflow @posy\endcsname
31070 \expandafter\global\expandafter
31071 \setlength\csname colwidth\romannumeral\c@maxflow\endcsname{#2}
31072 \expandafter\global\expandafter
31073 \setlength\csname colheight\romannumeral\c@maxflow\endcsname{#3}
31074 \expandafter\global\expandafter
31075 \setlength\csname col@\romannumeral\c@maxflow @posx\endcsname{#4}
31076 \expandafter\global\expandafter
31077 \setlength\csname col@\romannumeral\c@maxflow @posy\endcsname{#5}
31078 \expandafter\global\expandafter
31079 \newlength\csname col@\romannumeral\c@maxflow @evenx\endcsname
31080 \expandafter\global\expandafter
31081 \newlength\csname col@\romannumeral\c@maxflow @eveny\endcsname
31082 \expandafter\global\expandafter
31083 \setlength\csname col@\romannumeral\c@maxflow @evenx\endcsname{#4}
31084 \expandafter\global\expandafter
31085 \setlength\csname col@\romannumeral\c@maxflow @eveny\endcsname{#5}
31086 \expandafter
31087 \gdef\csname @ff@frametype@\romannumeral\c@maxflow\endcsname{fbox}%
31088 \expandafter
31089 \gdef\csname @ff@col@\romannumeral\c@maxflow\endcsname{\flowframecol}
31090 \expandafter
31091 \gdef\csname @ff@txtcol@\romannumeral\c@maxflow\endcsname{%
31092 \flowframetextcol
31093 }
31094 \expandafter
31095 \gdef\csname @ff@backcol@\romannumeral\c@maxflow\endcsname{{none}}
31096 \expandafter
31097 \gdef\csname @ff@pages@\romannumeral\c@maxflow\endcsname{#1}%
31098 % \end{macrocode}
31099 % Page exclusion list:
31100 %\changes{1.14}{2012-11-10}{added page exclusion list}
31101 % \begin{macrocode}
31102 \expandafter
31103 \gdef\csname @ff@xpages@\romannumeral\c@maxflow\endcsname{}%
31104 \expandafter
31105 \gdef\csname @ff@offset@\romannumeral\c@maxflow\endcsname{compute}
31106 \expandafter
31107 \gdef\csname @ff@angle@\romannumeral\c@maxflow\endcsname{0}%
31108 \expandafter
31109 \gdef\csname @ff@margin@\romannumeral\c@maxflow\endcsname{right}
31110 \ifnum\c@thisframe=0\relax
31111 \ifthenelse{\equal{#1}{all}\TE@or\equal{#1}{odd}}%
31112 {%
31113 \c@thisframe=\c@maxflow
31114 \global\setlength{\hsize}{#2}%
31115 \global\usedframebreaktrue
31116 }%
31117 {%
31118 \ifthenelse{\equal{#1}{even}\TE@or\equal{#1}{none}}%
31119 {}%
31120 {%
31121 \def\ff@pages{#1}%
31122 \@for\@ff@pp:=\ff@pages\do
31123 {%
31124 \def\@ff@numstart{0}\def\@ff@numend{0}%
31125 \@ff@getrange{\@ff@pp}%
31126 \ifnum\@ff@numstart=0\relax
31127 \def\@ff@numstart{1}%
31128 \fi
31129 \ifnum\@ff@numstart=1\relax
31130 \c@thisframe=\c@maxflow
31131 \global\setlength{\hsize}{#2}%
31132 \global\usedframebreaktrue
31133 \fi
31134 }%
31135 }%
31136 }%
31137 \fi
31138 \@ifnextchar[%
31139 {\@s@tflowframeid{\c@maxflow}}%
31140 {%
31141 \@s@tflowframeid{\c@maxflow}[\number\c@maxflow]%
31142 }%
31143 }
31144 % \end{macrocode}
31145 %\end{macro}
31146 %\begin{macro}{\@s@tflowframeid}
31147 % If square brackets occur after "\newflowframe", take
31148 % the contents to be the label, otherwise the label will be
31149 % the \gls{flow} number.
31150 % \begin{macrocode}
31151 \def\@s@tflowframeid#1[#2]{%
31152 \edef\ff@label{#2}%
31153 \@ff@checkuniqueidl{#1}{\ff@label}%
31154 \expandafter
31155 \xdef\csname @col@id@\romannumeral#1\endcsname{\ff@label}%
31156 }
31157 % \end{macrocode}
31158 %\end{macro}
31159 %\begin{macro}{\@ff@checkuniqueidl}
31160 % Check \gls{idl} "#2" for \gls{flow} "#1" is unique
31161 % \begin{macrocode}
31162 \newcommand*{\@ff@checkuniqueidl}[2]{%
31163 {%
31164 \@colN=0\relax
31165 \whiledo{\@colN<\c@maxflow}%
31166 {%
31167 \advance\@colN by 1\relax
31168 \ifnum\@colN=#1\relax
31169 \else
31170 \ifthenelse
31171 {%
31172 \equal{#2}%
31173 {%
31174 \csname @col@id@\romannumeral\@colN\endcsname
31175 }%
31176 }%
31177 {%
31178 \PackageError{flowfram}%
31179 {Flow frame IDL '#2' already defined}%
31180 {%
31181 You can't assign this label, as it is already defined
31182 for flow frame \number\@colN
31183 }%
31184 }%
31185 {}%
31186 \fi
31187 }%
31188 }%
31189 }
31190 % \end{macrocode}
31191 %\end{macro}
31192 %
31193 %\begin{macro}{\getflowlabel}
31194 %\changes{1.11}{2008/06/27}{new}
31195 %\cs{getflowlabel}\marg{idn}
31196 % Gets the \gls{idl} for the \gls{flow} identified by its
31197 % \gls{idn}.
31198 % \begin{macrocode}
31199 \newcommand*{\getflowlabel}[1]{%
31200 \csname @col@id@\romannumeral#1\endcsname
31201 }
31202 % \end{macrocode}
31203 %\end{macro}
31204 %
31205 %\begin{macro}{\getflowid}
31206 %\changes{1.11}{2008/06/27}{new}
31207 %\cs{getflowid}\marg{cmd}\marg{idl}
31208 % Gets the \gls{idn} for the \gls{flow} identified by its
31209 % \gls{idl} and stores in \meta{cmd} which must be a control
31210 % sequence.
31211 % \begin{macrocode}
31212 \newcommand*{\getflowid}[2]{%
31213 \@flowframeid{#2}%
31214 \edef#1{\number\ff@id}%
31215 }
31216 % \end{macrocode}
31217 %\end{macro}
31218 %
31219 %\begin{macro}{\@flowframeid}
31220 % Work out the \gls{flow} \gls{idn} from the label. This
31221 % iterates through the \glspl{flow}, so if you have a lot of
31222 % them it is quicker to identifiy them by their \gls{idn}
31223 % rather than their \gls{idl}.
31224 % The \gls{idn} stored in "\ff@id".
31225 % \begin{macrocode}
31226 \newcommand*{\@flowframeid}[1]{%
31227 \@colN=0\relax
31228 \ff@id=0\relax
31229 \whiledo{\@colN<\c@maxflow}%
31230 {%
31231 \advance\@colN by 1\relax
31232 \ifthenelse
31233 {%
31234 \equal{#1}{\csname @col@id@\romannumeral\@colN\endcsname}%
31235 }%
31236 {%
31237 \ff@id=\@colN\relax
31238 % \end{macrocode}
31239 % Break out of loop
31240 % \begin{macrocode}
31241 \@colN=\c@maxflow
31242 }%
31243 {}%
31244 }%
31245 \ifnum\ff@id=0\relax
31246 \PackageError{flowfram}{Can't find flow frame id '#1'}{}%
31247 \fi
31248 }
31249 % \end{macrocode}
31250 %\end{macro}
31251 % Set up the keys for use with "\setflowframe",
31252 % "\setstaticframe" and "\setdynamicframe".
31253 %
31254 % Frame width is stored in "\ff@width".
31255 % \begin{macrocode}
31256 \define@key{flowframe}{width}%
31257 {%
31258 \ifthenelse{\equal{#1}{}}%
31259 {%
31260 \PackageError{flowfram}{Missing value for 'width' key}{}%
31261 }%
31262 {}%
31263 \def\ff@width{#1}%
31264 }
31265 % \end{macrocode}
31266 % Frame height is stored in "\ff@height".
31267 % \begin{macrocode}
31268 \define@key{flowframe}{height}%
31269 {%
31270 \ifthenelse{\equal{#1}{}}%
31271 {%
31272 \PackageError{flowfram}{Missing value for 'height' key}{}%
31273 }%
31274 {}%
31275 \def\ff@height{#1}%
31276 }
31277 % \end{macrocode}
31278 % Frame $x$ co-ordinate (odd and even pages) is stored
31279 % in "\ff@x".
31280 % \begin{macrocode}
31281 \define@key{flowframe}{x}%
31282 {%
31283 \ifthenelse{\equal{#1}{}}%
31284 {%
31285 \PackageError{flowfram}{Missing value for 'x' key}{}%
31286 }%
31287 {}%
31288 \def\ff@x{#1}%
31289 }
31290 % \end{macrocode}
31291 % Frame $y$ co-ordinate (odd and even pages) is stored
31292 % in "\ff@y".
31293 % \begin{macrocode}
31294 \define@key{flowframe}{y}%
31295 {%
31296 \ifthenelse{\equal{#1}{}}%
31297 {%
31298 \PackageError{flowfram}{Missing value for 'y' key}{}%
31299 }%
31300 {}%
31301 \def\ff@y{#1}%
31302 }
31303 % \end{macrocode}
31304 % Frame $x$ co-ordinate (even pages only) is stored
31305 % in "\ff@evenx".
31306 % \begin{macrocode}
31307 \define@key{flowframe}{evenx}%
31308 {%
31309 \ifthenelse{\equal{#1}{}}%
31310 {%
31311 \PackageError{flowfram}{Missing value for 'evenx' key}{}%
31312 }%
31313 {}%
31314 \def\ff@evenx{#1}%
31315 }
31316 % \end{macrocode}
31317 % Frame $y$ co-ordinate (even pages only) is stored in
31318 % "\ff@eveny".
31319 % \begin{macrocode}
31320 \define@key{flowframe}{eveny}%
31321 {%
31322 \ifthenelse{\equal{#1}{}}%
31323 {%
31324 \PackageError{flowfram}{Missing value for 'eveny' key}{}%
31325 }%
31326 {}%
31327 \def\ff@eveny{#1}%
31328 }
31329 % \end{macrocode}
31330 % Frame $x$ co-ordinate (odd pages only if twoside implemented)
31331 % is stored in "\ff@oddx".
31332 % \begin{macrocode}
31333 \define@key{flowframe}{oddx}%
31334 {%
31335 \ifthenelse{\equal{#1}{}}%
31336 {%
31337 \PackageError{flowfram}{Missing value for 'oddx' key}{}%
31338 }%
31339 {}%
31340 \def\ff@oddx{#1}%
31341 }
31342 % \end{macrocode}
31343 % Frame $y$ co-ordinate (odd pages only if twoside implemented)
31344 % is stored in "\ff@oddy".
31345 % \begin{macrocode}
31346 \define@key{flowframe}{oddy}%
31347 {%
31348 \ifthenelse{\equal{#1}{}}%
31349 {%
31350 \PackageError{flowfram}{Missing value for 'oddy' key}{}%
31351 }%
31352 {}%
31353 \def\ff@oddy{#1}%
31354 }
31355 % \end{macrocode}
31356 % New \gls{idl} for \gls{frame} is stored in "\ff@label".
31357 % \begin{macrocode}
31358 \define@key{flowframe}{label}%
31359 {%
31360 \ifthenelse{\equal{#1}{}}%
31361 {%
31362 \PackageError{flowfram}{Missing value for 'label' key}{}%
31363 }%
31364 {}%
31365 \def\ff@label{#1}%
31366 }
31367 % \end{macrocode}
31368 % Frame border. If "none", define "\ff@frame" as "false",
31369 % otherwise define "\ff@frame" as "true". If "plain", define
31370 % "\ff@frametype" as "fbox", otherwise define it to be
31371 % the specified type, which should be the name of a
31372 % \gls{fcmd} without the preceding backslash.
31373 % \begin{macrocode}
31374 \define@key{flowframe}{border}[plain]%
31375 {%
31376 \ifthenelse{\equal{#1}{}}%
31377 {%
31378 \PackageError{flowfram}%
31379 {%
31380 Missing value for 'border' key - use
31381 'none' for no border%
31382 }%
31383 {}%
31384 }%
31385 {}%
31386 \ifthenelse{\equal{#1}{none}}%
31387 {%
31388 \def\ff@frame{false}%
31389 }%
31390 {%
31391 \def\ff@frame{true}%
31392 \ifthenelse{\equal{#1}{plain}}%
31393 {%
31394 \def\ff@frametype{fbox}%
31395 }%
31396 {%
31397 \def\ff@frametype{#1}%
31398 }%
31399 }%
31400 }
31401 % \end{macrocode}
31402 % Frame's border colour. (This may not work for non-standard
31403 % \glspl{fcmd}.)
31404 % \begin{macrocode}
31405 \define@key{flowframe}{bordercolor}%
31406 {%
31407 \ifthenelse{\equal{#1}{}}%
31408 {%
31409 \PackageError{flowfram}{Missing value for 'bordercolor' key}{}%
31410 }%
31411 {}%
31412 \def\ff@col{#1}%
31413 }
31414 % \end{macrocode}
31415 % Frame's text colour.
31416 % \begin{macrocode}
31417 \define@key{flowframe}{textcolor}%
31418 {%
31419 \ifthenelse{\equal{#1}{}}%
31420 {%
31421 \PackageError{flowfram}{Missing value for 'textcolor' key}{}%
31422 }%
31423 {}%
31424 \def\ff@txtcol{#1}%
31425 }
31426 % \end{macrocode}
31427 % The background colour of the \gls{frame}. Note this only covers
31428 % the region of the \gls{bbox}, not any extra space between
31429 % the \gls{bbox} and the border. If you want the background
31430 % colour to go right up to the border, you will need to
31431 % define your own customised border.
31432 % \begin{macrocode}
31433 \define@key{flowframe}{backcolor}%
31434 {%
31435 \ifthenelse{\equal{#1}{}}%
31436 {%
31437 \PackageError{flowfram}{Missing value for 'backcolor' key}{}%
31438 }%
31439 {}%
31440 \def\ff@backcol{#1}%
31441 }
31442 % \end{macrocode}
31443 % \Gls{pglist} for which the \gls{frame} should appear.
31444 % \begin{macrocode}
31445 \define@key{flowframe}{pages}%
31446 {%
31447 \ifthenelse{\equal{#1}{}}%
31448 {%
31449 \PackageError{flowfram}{Missing value for 'pages' key}{}%
31450 }%
31451 {}%
31452 \def\ff@pages{#1}%
31453 }
31454 % \end{macrocode}
31455 % Exclusion list:
31456 % \begin{macrocode}
31457 \define@key{flowframe}{excludepages}%
31458 {%
31459 \def\ff@xpages{#1}%
31460 }
31461 % \end{macrocode}
31462 % The border takes up extra space, which needs to be
31463 % adjusted. This can be done for standard border types,
31464 % but non-standard borders may require some help.
31465 % \begin{macrocode}
31466 \define@key{flowframe}{offset}%
31467 {%
31468 \def\ff@offset{#1}%
31469 \ifthenelse{\equal{#1}{}}%
31470 {%
31471 \PackageError{flowframe}%
31472 {%
31473 Invalid value for key 'offset'%
31474 }%
31475 {%
31476 'offset' can either be 'compute' (to compute it according
31477 to certain pre-defined rules) or a length%
31478 }%
31479 }%
31480 {}%
31481 }
31482 % \end{macrocode}
31483 % Angle to rotate \gls{flow}:
31484 % \begin{macrocode}
31485 \define@key{flowframe}{angle}{\def\ff@angle{#1}%
31486 }
31487 % \end{macrocode}
31488 % This key is only for \glspl{flow}:
31489 % \begin{macrocode}
31490 \define@choicekey{flowframe}{margin}{left,right,inner,outer}%
31491 {%
31492 \def\ff@margin{#1}%
31493 }
31494 % \end{macrocode}
31495 % This key is only for \glspl{static}:
31496 % \begin{macrocode}
31497 \define@choicekey{flowframe}{clear}{true,false}[true]{%
31498 \def\ff@clear{#1}%
31499 }
31500 % \end{macrocode}
31501 % This key is only for \glspl{dynamic}:
31502 % \begin{macrocode}
31503 \define@key{flowframe}{style}%
31504 {%
31505 \ifthenelse{\equal{#1}{}}%
31506 {%
31507 \PackageError{flowfram}{Missing value for 'style' key}{}%
31508 }%
31509 {}%
31510 \ifthenelse{\equal{#1}{none}}%
31511 {%
31512 \def\ff@style{relax}%
31513 }%
31514 {%
31515 \def\ff@style{#1}%
31516 }%
31517 }
31518 % \end{macrocode}
31519 % This key is only for \glspl{static} and \glspl{dynamic}.
31520 % \begin{macrocode}
31521 \define@key{flowframe}{shape}%
31522 {%
31523 \def\ff@shape{#1}%
31524 }
31525 % \end{macrocode}
31526 % This key is only for \glspl{static} and \glspl{dynamic}.
31527 % \begin{macrocode}
31528 \define@choicekey{flowframe}{valign}{c,t,b}%
31529 {%
31530 \def\ff@valign{#1}%
31531 }
31532 % \end{macrocode}
31533 % This key is only for \glspl{static} and \glspl{dynamic}:
31534 %\changes{2014-06-04}{1.16}{added `hide' and `hidethis' keys}
31535 % \begin{macrocode}
31536 \define@choicekey{flowframe}{hide}{true,false}[true]{%
31537 \def\ff@hide{#1}%
31538 }
31539 % \end{macrocode}
31540 % This key is only for \glspl{static} and \glspl{dynamic}:
31541 % \begin{macrocode}
31542 \define@choicekey{flowframe}{hidethis}{true,false}[true]{%
31543 \def\ff@hidethis{#1}%
31544 }
31545 % \end{macrocode}
31546 %
31547 %\begin{macro}{\setallflowframes}
31548 % Provide a command to change the settings for all flow
31549 % frames. This just iterates through all the \glspl{flow},
31550 % and sets each one in turn.
31551 % \begin{macrocode}
31552 \newcommand*{\setallflowframes}[1]{%
31553 \@colN=0\relax
31554 \whiledo{\@colN<\c@maxflow}%
31555 {%
31556 \advance\@colN by 1\relax
31557 \@@setflowframe{\@colN}{#1}%
31558 }%
31559 }
31560 % \end{macrocode}
31561 %\end{macro}
31562 %\begin{macro}{\setflowframe}
31563 % Define "\setflowframe" command. Check to see
31564 % whether or not the starred version is being used.
31565 % \begin{macrocode}
31566 \newcommand*{\setflowframe}{\@ifstar\@ssetflowframe\@setflowframe}
31567 % \end{macrocode}
31568 %\end{macro}
31569 %\begin{macro}{\@ssetflowframe}
31570 % This is the starred version. It finds the \gls{idn} for
31571 % each label in the comma-separated list (first argument),
31572 % and applies the setting for that numbered \gls{flow}.
31573 % \begin{macrocode}
31574 \newcommand{\@ssetflowframe}[2]{%
31575 \@for\@ff@id:=#1\do{%
31576 \@flowframeid{\@ff@id}%
31577 \@@setflowframe{\ff@id}{#2}%
31578 }%
31579 }
31580 % \end{macrocode}
31581 %\end{macro}
31582 %\begin{macro}{\@setflowframe}
31583 % This is the unstarred version. It iterates through
31584 % each \gls{idn} in the comma-separated list passed
31585 % as the first argument, but it also checks for number
31586 % ranges, and sets the values for that \gls{flow}. Ensures
31587 % that number ranges do not lie out of bounds.
31588 % \begin{macrocode}
31589 \newcommand*{\@setflowframe}[2]{%
31590 \ifthenelse{\equal{#1}{all}}%
31591 {%
31592 \setallflowframes{#2}%
31593 }%
31594 {%
31595 \ifthenelse{\equal{#1}{odd} \TE@or \equal{#1}{even}}%
31596 {%
31597 \ifthenelse{\equal{#1}{odd}}%
31598 {%
31599 \@colN=1\relax
31600 }%
31601 {%
31602 \@colN=2\relax
31603 }%
31604 \whiledo{\@colN<\c@maxflow\TE@or\@colN=\c@maxflow}%
31605 {%
31606 \@@setflowframe{\@colN}{#2}%
31607 \advance\@colN by 2\relax
31608 }%
31609 }%
31610 {%
31611 \@for\@ff@id:=#1\do
31612 {%
31613 \def\@ff@numstart{0}%
31614 \def\@ff@numend{10000}%
31615 \@ff@getrange{\@ff@id}%
31616 \ifnum\@ff@numstart=0\relax
31617 \def\@ff@numstart{1}%
31618 \fi
31619 \ifnum\@ff@numend>\c@maxflow\relax
31620 \def\@ff@numend{\c@maxflow}%
31621 \fi
31622 \@colN=\@ff@numstart\relax
31623 \whiledo{\@colN<\@ff@numend \TE@or \@colN=\@ff@numend}%
31624 {%
31625 \@@setflowframe{\@colN}{#2}%
31626 \advance\@colN by 1\relax
31627 }%
31628 }%
31629 }%
31630 }%
31631 }
31632 % \end{macrocode}
31633 %\end{macro}
31634 %\begin{macro}{\@@setflowframe}
31635 % This is the command that actually sets the values for
31636 % the \gls{flow} whose \gls{idn} is specified by the first
31637 % parameter.
31638 %\changes{1.11}{2008/06/27}{removed unwanted spaces}
31639 % \begin{macrocode}
31640 \newcommand*{\@@setflowframe}[2]{%
31641 \def\ff@frame{}\def\ff@width{}\def\ff@height{}\def\ff@margin{}%
31642 \def\ff@x{}\def\ff@y{}\def\ff@frametype{}\def\ff@col{}%
31643 \def\ff@valign{}\def\ff@style{}%
31644 \def\ff@hide{}\def\ff@hidethis{}%
31645 \def\ff@txtcol{}\def\ff@clear{}\def\ff@offset{}\def\ff@pages{}%
31646 \def\ff@label{}\def\ff@backcol{}\def\ff@evenx{}\def\ff@eveny{}%
31647 \def\ff@oddx{}\def\ff@oddy{}\def\ff@angle{}%
31648 \let\ff@xpages\undefined
31649 \let\ff@shape\undefined
31650 \setkeys{flowframe}{#2}%
31651 \ifdefempty{\ff@frame}{}%
31652 {%
31653 \setboolean{columnframe\romannumeral#1}{\ff@frame}%
31654 }%
31655 \ifdefempty{\ff@width}{}%
31656 {%
31657 \expandafter
31658 \setlength\csname colwidth\romannumeral#1\endcsname
31659 {\ff@width}%
31660 }%
31661 \ifdefempty{\ff@height}{}%
31662 {%
31663 \expandafter
31664 \setlength\csname colheight\romannumeral#1\endcsname
31665 {\ff@height}%
31666 }%
31667 \ifdefempty{\ff@x}{}%
31668 {%
31669 \expandafter
31670 \setlength\csname col@\romannumeral#1@posx\endcsname
31671 {\ff@x}%
31672 \expandafter
31673 \setlength\csname col@\romannumeral#1@evenx\endcsname
31674 {\ff@x}%
31675 }
31676 \ifdefempty{\ff@y}{}%
31677 {%
31678 \expandafter
31679 \setlength\csname col@\romannumeral#1@posy\endcsname
31680 {\ff@y}%
31681 \expandafter
31682 \setlength\csname col@\romannumeral#1@eveny\endcsname
31683 {\ff@y}%
31684 }%
31685 \ifdefempty{\ff@evenx}{}%
31686 {%
31687 \expandafter
31688 \setlength\csname col@\romannumeral#1@evenx\endcsname
31689 {\ff@evenx}%
31690 }%
31691 \ifdefempty{\ff@eveny}{}%
31692 {%
31693 \expandafter
31694 \setlength\csname col@\romannumeral#1@eveny\endcsname
31695 {\ff@eveny}%
31696 }%
31697 \ifdefempty{\ff@oddx}{}%
31698 {%
31699 \expandafter
31700 \setlength\csname col@\romannumeral#1@posx\endcsname
31701 {\ff@oddx}%
31702 }%
31703 \ifdefempty{\ff@oddy}{}%
31704 {%
31705 \expandafter
31706 \setlength\csname col@\romannumeral#1@posy\endcsname
31707 {\ff@oddy}%
31708 }%
31709 \ifdefempty{\ff@label}{}%
31710 {%
31711 \@s@tflowframeid{#1}[\ff@label]%
31712 }%
31713 \ifdefempty{\ff@frametype}{}%
31714 {%
31715 \expandafter
31716 \edef\csname @ff@frametype@\romannumeral#1\endcsname{%
31717 \ff@frametype}%
31718 }%
31719 \ifdefempty{\ff@col}{}%
31720 {%
31721 \expandafter\@setframecol\ff@col\end{#1}{col}{ff}%
31722 }%
31723 \ifdefempty{\ff@txtcol}{}%
31724 {%
31725 \expandafter\@setframecol\ff@txtcol\end{#1}{txtcol}{ff}%
31726 }%
31727 \ifdefempty{\ff@backcol}{}%
31728 {%
31729 \expandafter\@setframecol\ff@backcol\end{#1}{backcol}{ff}%
31730 }%
31731 \ifdefempty{\ff@margin}{}%
31732 {%
31733 \expandafter
31734 \xdef\csname @ff@margin@\romannumeral#1\endcsname{%
31735 \ff@margin}%
31736 }%
31737 \ifdefempty{\ff@pages}{}%
31738 {%
31739 \flowsetpagelist{#1}{\ff@pages}%
31740 }%
31741 \ifundef{\ff@xpages}{}%
31742 {%
31743 \flowsetexclusion{#1}{\ff@xpages}%
31744 }%
31745 \ifdefempty{\ff@offset}{}%
31746 {%
31747 \expandafter
31748 \xdef\csname @ff@offset@\romannumeral#1\endcsname{%
31749 \ff@offset}%
31750 }%
31751 \ifdefempty{\ff@angle}{}%
31752 {%
31753 \expandafter
31754 \xdef\csname @ff@angle@\romannumeral#1\endcsname{%
31755 \ff@angle}%
31756 }%
31757 \ifdefempty{\ff@clear}{}%
31758 {%
31759 \PackageError{flowfram}%
31760 {Key 'clear' not available for flow frames}{}%
31761 }%
31762 \ifdefempty{\ff@style}{}%
31763 {%
31764 \PackageError{flowfram}%
31765 {Key 'style' not available for flow frames}{}%
31766 }%
31767 \ifundef{\ff@shape}{}%
31768 {%
31769 \PackageError{flowfram}%
31770 {Key 'shape' not available for flow frames}{}%
31771 }%
31772 \ifdefempty{\ff@valign}{}%
31773 {%
31774 \PackageError{flowfram}%
31775 {Key 'valign' not available for flow frames}{}%
31776 }%
31777 \ifdefempty{\ff@hide}{}%
31778 {%
31779 \PackageError{flowfram}%
31780 {Key 'hide' not available for flow frames}{}%
31781 }%
31782 \ifdefempty{\ff@hidethis}{}%
31783 {%
31784 \PackageError{flowfram}%
31785 {Key 'hidethis' not available for flow frames}{}%
31786 }%
31787 }
31788 % \end{macrocode}
31789 %\end{macro}
31790 %
31791 %\begin{macro}{\flowsetpagelist}
31792 % Sets the page list for the \gls{flow} given by "#1" (the
31793 % \gls{idn}).
31794 %\changes{1.14}{2012-11-10}{new}
31795 % \begin{macrocode}
31796 \newcommand*{\flowsetpagelist}[2]{%
31797 \expandafter
31798 \xdef\csname @ff@pages@\romannumeral#1\endcsname{#2}%
31799 \flf@message{Setting page range for flow frame
31800 \number#1\space\space to "#2"}%
31801 }
31802 % \end{macrocode}
31803 %\end{macro}
31804 %\begin{macro}{\flowsetexclusion}
31805 % Sets the exclusion list for the \gls{flow} given by "#1" (the
31806 % \gls{idn}).
31807 %\changes{1.14}{2012-11-10}{new}
31808 % \begin{macrocode}
31809 \newcommand*{\flowsetexclusion}[2]{%
31810 \expandafter
31811 \xdef\csname @ff@xpages@\romannumeral#1\endcsname{#2}%
31812 \flf@message{Setting exclusion for flow frame
31813 \number#1\space\space to "#2"}%
31814 }
31815 % \end{macrocode}
31816 %\end{macro}
31817 %\begin{macro}{\flowaddexclusion}
31818 % Adds to the exclusion list for the \gls{flow} given by "#1" (the
31819 % \gls{idn}).
31820 %\changes{1.14}{2012-11-10}{new}
31821 % \begin{macrocode}
31822 \newcommand*{\flowaddexclusion}[2]{%
31823 \ifcsempty{@ff@xpages@\romannumeral#1}
31824 {%
31825 \expandafter
31826 \xdef\csname @ff@xpages@\romannumeral#1\endcsname{#2}%
31827 }%
31828 {%
31829 \expandafter
31830 \xdef\csname @ff@xpages@\romannumeral#1\endcsname{%
31831 \csname @ff@xpages@\romannumeral#1\endcsname,#2}%
31832 }%
31833 \flf@message{Setting exclusion for flow frame
31834 \number#1\space\space to
31835 "\csname @ff@xpages@\romannumeral#1\endcsname"}%
31836 }
31837 % \end{macrocode}
31838 %\end{macro}
31839 %
31840 %\begin{macro}{\ffswapoddeven}
31841 % Swap odd and even offsets for a given \gls{flow}. Do the main stuff for
31842 % a given \gls{flow} \gls{idn}.
31843 % \begin{macrocode}
31844 \newcommand*{\@@flowframeswapcoords}[1]{%
31845 \setlength{\@ff@tmp@x}%
31846 {\csname col@\romannumeral#1@evenx\endcsname}
31847 \expandafter\setlength\csname col@\romannumeral#1@evenx\endcsname
31848 {\csname col@\romannumeral#1@posx\endcsname}%
31849 \expandafter\setlength\csname col@\romannumeral#1@posx\endcsname
31850 {\@ff@tmp@x}%
31851 \setlength{\@ff@tmp@y}%
31852 {\csname col@\romannumeral#1@eveny\endcsname}
31853 \expandafter\setlength\csname col@\romannumeral#1@eveny\endcsname
31854 {\csname col@\romannumeral#1@posy\endcsname}%
31855 \expandafter\setlength\csname col@\romannumeral#1@posy\endcsname
31856 {\@ff@tmp@y}%
31857 }
31858 % \end{macrocode}
31859 %\end{macro}
31860 %\begin{macro}{\ffswapoddeven}
31861 % Allow user to specify \gls{flow} either by \gls{idn} or \gls{idl}:
31862 % \begin{macrocode}
31863 \newcommand*{\ffswapoddeven}{%
31864 \@ifstar\@sflowframeswapcoords\@flowframeswapcoords
31865 }
31866 % \end{macrocode}
31867 %\end{macro}
31868 %\begin{macro}{\@sflowframeswapcoords}
31869 % Starred form
31870 % \begin{macrocode}
31871 \newcommand*{\@sflowframeswapcoords}[1]{%
31872 \@for\@ff@id:=#1\do
31873 {%
31874 \@flowframeid{\@ff@id}%
31875 \@@flowframeswapcoords{\ff@id}%
31876 }%
31877 }
31878 % \end{macrocode}
31879 %\end{macro}
31880 %\begin{macro}{\@flowframeswapcoords}
31881 % Unstarred form:
31882 % \begin{macrocode}
31883 \newcommand*{\@flowframeswapcoords}[1]{%
31884 \ifthenelse{\equal{#1}{all}}%
31885 {%
31886 \ff@id=0\relax
31887 \whiledo{\ff@id<\c@maxflow}%
31888 {%
31889 \advance\ff@id by 1\relax
31890 \@@flowframeswapcoords{\ff@id}%
31891 }%
31892 }%
31893 {%
31894 \ifthenelse{\equal{#1}{odd} \TE@or \equal{#1}{even}}%
31895 {%
31896 \ifthenelse{\equal{#1}{odd}}{\@colN=1}{\@colN=2}%
31897 \whiledo{\@colN<\c@maxflow\TE@or\@colN=\c@maxflow}%
31898 {%
31899 \@@flowframeswapcoords{\@colN}%
31900 \advance\@colN by 2\relax
31901 }%
31902 }%
31903 {%
31904 \@for\@ff@id:=#1\do
31905 {%
31906 \def\@ff@numstart{0}%
31907 \def\@ff@numend{100000}%
31908 \@ff@getrange{\@ff@id}%
31909 \ifnum\@ff@numstart=0\relax
31910 \def\@ff@numstart{1}%
31911 \fi
31912 \ifnum\@ff@numend>\c@maxflow
31913 \def\@ff@numend{\c@maxflow}%
31914 \fi
31915 \@colN=\@ff@numstart
31916 \whiledo{\@colN<\@ff@numend \TE@or \@colN=\@ff@numend}%
31917 {%
31918 \@@flowframeswapcoords{\@colN}%
31919 \advance\@colN by 1\relax
31920 }%
31921 }%
31922 }%
31923 }%
31924 }
31925 % \end{macrocode}
31926 %\end{macro}
31927 %
31928 % Allow user to get the dimensions of \gls{flow} (useful for
31929 % \glspl{flow} created using "\Ncolumns" etc.) Only the \gls{idn} can
31930 % be used for these commands.
31931 %\begin{macro}{\flowframex}
31932 % \begin{macrocode}
31933 \newcommand*{\flowframex}[1]{%
31934 \csname col@\romannumeral#1@posx\endcsname
31935 }
31936 % \end{macrocode}
31937 %\end{macro}
31938 %\begin{macro}{\flowframey}
31939 % \begin{macrocode}
31940 \newcommand*{\flowframey}[1]{%
31941 \csname col@\romannumeral#1@posy\endcsname
31942 }
31943 % \end{macrocode}
31944 %\end{macro}
31945 %\begin{macro}{\flowframeevenx}
31946 % \begin{macrocode}
31947 \newcommand*{\flowframeevenx}[1]{%
31948 \csname col@\romannumeral#1@evenx\endcsname
31949 }
31950 % \end{macrocode}
31951 %\end{macro}
31952 %\begin{macro}{\flowframeeveny}
31953 % \begin{macrocode}
31954 \newcommand*{\flowframeeveny}[1]{%
31955 \csname col@\romannumeral#1@eveny\endcsname
31956 }
31957 % \end{macrocode}
31958 %\end{macro}
31959 %\begin{macro}{\flowframewidth}
31960 % \begin{macrocode}
31961 \newcommand{\flowframewidth}[1]{%
31962 \csname colwidth\romannumeral#1\endcsname
31963 }
31964 % \end{macrocode}
31965 %\end{macro}
31966 %\begin{macro}{\flowframeheight}
31967 % \begin{macrocode}
31968 \newcommand*{\flowframeheight}[1]{%
31969 \csname colheight\romannumeral#1\endcsname
31970 }
31971 % \end{macrocode}
31972 %\end{macro}
31973 %\begin{macro}{\@setframecol}
31974 % Set the colour of the frame, this is a little tricky
31975 % because the model may need to be specified in square
31976 % brackets. First check to see if a colour model has been
31977 % specified
31978 % \begin{macrocode}
31979 \def\@setframecol{\@ifnextchar[\@@setframecol\@@setfr@mecol}
31980 % \end{macrocode}
31981 %\end{macro}
31982 %\begin{macro}{\@@setframecol}
31983 % A colour model has been specified.
31984 % \begin{macrocode}
31985 \def\@@setframecol[#1]#2\end#3#4#5{%
31986 \expandafter\edef\csname @#5@#4@\romannumeral#3\endcsname{%
31987 [#1]{#2}}%
31988 }
31989 % \end{macrocode}
31990 %\end{macro}
31991 %\begin{macro}{\@@setfr@mecol}
31992 % A colour model has not been specified.
31993 % \begin{macrocode}
31994 \def\@@setfr@mecol#1\end#2#3#4{%
31995 \expandafter\edef\csname @#4@#3@\romannumeral#2\endcsname{{#1}}%
31996 }
31997 % \end{macrocode}
31998 %\end{macro}
31999 %
32000 % \subsection{Static Frames}
32001 %\begin{macro}{\newstaticframe}
32002 % Now deal with setting up the \glspl{static}. This is
32003 % similar to the \glspl{flow}, except it has an
32004 % associated \LaTeX\ savebox rather than a \TeX\ box.
32005 % Syntax:\newline
32006 % \cs{newstaticframe}\oarg{pages}\marg{width}\marg{height}\marg{x}\marg{y}\oarg{label}\par
32007 % As with "\newflowframe", the final optional argument is
32008 % dealt with at the end.
32009 % \begin{macrocode}
32010 \newcommand*{\newstaticframe}{\@n@wstaticframe}
32011 % \end{macrocode}
32012 %\end{macro}
32013 %\begin{macro}{\@n@wstaticframe}
32014 % \begin{macrocode}
32015 \newcommand*{\@n@wstaticframe}{%
32016 \global\advance\c@maxstatic by 1\relax
32017 \newboolean{staticframe\romannumeral\c@maxstatic}%
32018 \@ifstar\@snewstaticframe\@newstaticframe
32019 }
32020 % \end{macrocode}
32021 %\end{macro}
32022 %\begin{macro}{\@snewstaticframe}
32023 % Starred version (has a border):
32024 % \begin{macrocode}
32025 \newcommand{\@snewstaticframe}{%
32026 \setboolean{staticframe\romannumeral\c@maxstatic}{true}%
32027 \@@newstaticframe
32028 }
32029 % \end{macrocode}
32030 %\end{macro}
32031 %\begin{macro}{\@newstaticframe}
32032 % Unstarred version (no border):
32033 % \begin{macrocode}
32034 \newcommand{\@newstaticframe}{%
32035 \setboolean{staticframe\romannumeral\c@maxstatic}{false}%
32036 \@@newstaticframe
32037 }
32038 % \end{macrocode}
32039 %\end{macro}
32040 %\begin{macro}{\@@newstaticframe}
32041 % Now set up the \gls{static}:
32042 % \begin{macrocode}
32043 \newcommand*{\@@newstaticframe}[5][all]{%
32044 \expandafter
32045 \newbox\csname @staticframe@\romannumeral\c@maxstatic\endcsname
32046 \expandafter
32047 \newlength\csname @sf@\romannumeral\c@maxstatic @posx\endcsname
32048 \expandafter
32049 \newlength\csname @sf@\romannumeral\c@maxstatic @posy\endcsname
32050 \expandafter\setlength
32051 \csname @sf@\romannumeral\c@maxstatic @posx\endcsname{#4}%
32052 \expandafter\setlength
32053 \csname @sf@\romannumeral\c@maxstatic @posy\endcsname{#5}%
32054 \expandafter\newlength
32055 \csname @sf@\romannumeral\c@maxstatic @evenx\endcsname
32056 \expandafter\newlength
32057 \csname @sf@\romannumeral\c@maxstatic @eveny\endcsname
32058 \expandafter\setlength
32059 \csname @sf@\romannumeral\c@maxstatic @evenx\endcsname{#4}%
32060 \expandafter\setlength
32061 \csname @sf@\romannumeral\c@maxstatic @eveny\endcsname{#5}%
32062 {\@ff@tmp@x=#2\relax
32063 \@ff@tmp@y=#3\relax
32064 \expandafter
32065 \xdef\csname @sf@dim@\romannumeral\c@maxstatic\endcsname{%
32066 [c][\the\@ff@tmp@y][c]{\the\@ff@tmp@x}}}%
32067 \expandafter
32068 \def\csname @sf@col@\romannumeral\c@maxstatic\endcsname{%
32069 \flowframecol}%
32070 \expandafter
32071 \def\csname @sf@txtcol@\romannumeral\c@maxstatic\endcsname{%
32072 \flowframetextcol}%
32073 \expandafter
32074 \def\csname @sf@backcol@\romannumeral\c@maxstatic\endcsname{%
32075 {none}}%
32076 \expandafter
32077 \xdef\csname @sf@pages@\romannumeral\c@maxstatic\endcsname{#1}%
32078 % \end{macrocode}
32079 % Page exclusion list:
32080 %\changes{1.14}{2012-11-10}{added page exclusion list}
32081 % \begin{macrocode}
32082 \expandafter
32083 \gdef\csname @sf@xpages@\romannumeral\c@maxflow\endcsname{}%
32084 \expandafter
32085 \gdef\csname @sf@offset@\romannumeral\c@maxstatic\endcsname{%
32086 compute}%
32087 \expandafter
32088 \gdef\csname @sf@angle@\romannumeral\c@maxstatic\endcsname{0}%
32089 \expandafter
32090 \gdef\csname @sf@shape@\romannumeral\c@maxstatic\endcsname{\relax}%
32091 \expandafter
32092 \def\csname @sf@frametype@\romannumeral\c@maxstatic\endcsname{%
32093 fbox}%
32094 \newboolean{@sf@clear@\romannumeral\c@maxstatic}%
32095 \setboolean{@sf@clear@\romannumeral\c@maxstatic}{false}
32096 % \end{macrocode}
32097 %\changes{2014-06-04}{1.16}{added `hide' and `hidethis' attributes}
32098 % \begin{macrocode}
32099 \newboolean{@sf@hide@\romannumeral\c@maxstatic}%
32100 \setboolean{@sf@hide@\romannumeral\c@maxstatic}{false}%
32101 \newboolean{@sf@hidethis@\romannumeral\c@maxstatic}%
32102 \setboolean{@sf@hidethis@\romannumeral\c@maxstatic}{false}%
32103 \@ifnextchar[{\@s@tstaticframeid{\c@maxstatic}}%
32104 {\@s@tstaticframeid{\c@maxstatic}[\number\c@maxstatic]}%
32105 }
32106 % \end{macrocode}
32107 %\end{macro}
32108 %\begin{macro}{\@s@tstaticframeid}
32109 % Set the label for the \gls{static}:
32110 % \begin{macrocode}
32111 \def\@s@tstaticframeid#1[#2]{%
32112 \edef\ff@label{#2}%
32113 \@sf@checkuniqueidl{#1}{\ff@label}%
32114 \expandafter
32115 \xdef\csname @sf@id@\romannumeral#1\endcsname{\ff@label}%
32116 }
32117 % \end{macrocode}
32118 %\end{macro}
32119 %\begin{macro}{\@sf@checkuniqueidl}
32120 % Check \gls{idl} "#2" for \gls{static} "#1" is unique
32121 % \begin{macrocode}
32122 \newcommand*{\@sf@checkuniqueidl}[2]{%
32123 \@colN=0\relax
32124 \whiledo{\@colN<\c@maxstatic}%
32125 {%
32126 \advance\@colN by 1\relax
32127 \ifnum\@colN=#1\relax
32128 \else
32129 \ifthenelse
32130 {%
32131 \equal{#2}{\csname @sf@id@\romannumeral\@colN\endcsname}%
32132 }%
32133 {%
32134 \PackageError{flowfram}%
32135 {Static frame IDL '#2' already defined}%
32136 {%
32137 You can't assign this label, as it is already defined
32138 for static frame \number\@colN
32139 }%
32140 }%
32141 {}%
32142 \fi
32143 }%
32144 }
32145 % \end{macrocode}
32146 %\end{macro}
32147 %
32148 %\begin{macro}{\getstaticlabel}
32149 %\changes{1.11}{2008/06/27}{new}
32150 %\cs{getstaticlabel}\marg{idn}
32151 % Gets the \gls{idl} for the \gls{static} identified by its
32152 % \gls{idn}.
32153 % \begin{macrocode}
32154 \newcommand*{\getstaticlabel}[1]{%
32155 \csname @sf@id@\romannumeral#1\endcsname
32156 }
32157 % \end{macrocode}
32158 %\end{macro}
32159 %
32160 %\begin{macro}{\getstaticid}
32161 %\changes{1.11}{2008/06/27}{new}
32162 %\cs{getstaticid}\marg{cmd}\marg{idl}
32163 % Gets the \gls{idn} for the \gls{static} identified by its
32164 % \gls{idl} and stores in \meta{cmd} which must be a control
32165 % sequence.
32166 % \begin{macrocode}
32167 \newcommand*{\getstaticid}[2]{%
32168 \@staticframeid{#2}\edef#1{\number\ff@id}%
32169 }
32170 % \end{macrocode}
32171 %\end{macro}
32172 %
32173 %\begin{macro}{\@staticframeid}
32174 % Work out the \gls{idn} of the \gls{static} with the
32175 % given label. This iterates through each \gls{static},
32176 % so if there are a lot of \glspl{static}, it may take a while.
32177 % The \gls{idn} stored in "\ff@id".
32178 % \begin{macrocode}
32179 \newcommand*{\@staticframeid}[1]{%
32180 \@colN=0\relax
32181 \ff@id=0\relax
32182 \whiledo{\@colN<\c@maxstatic}%
32183 {%
32184 \advance\@colN by 1\relax
32185 \ifthenelse
32186 {%
32187 \equal{#1}{\csname @sf@id@\romannumeral\@colN\endcsname}%
32188 }%
32189 {%
32190 \ff@id=\@colN\relax
32191 % \end{macrocode}
32192 % Break out of loop
32193 % \begin{macrocode}
32194 \@colN=\c@maxstatic
32195 }%
32196 {}%
32197 }%
32198 \ifnum\ff@id=0\relax
32199 \PackageError{flowfram}%
32200 {Can't find static frame id '#1'}{}%
32201 \fi
32202 }
32203 % \end{macrocode}
32204 %\end{macro}
32205 %
32206 % Make it easier to get the x and y values for static
32207 % frames. (Width and height stored differently.)
32208 %\begin{macro}{\staticframex}
32209 % \begin{macrocode}
32210 \newcommand*{\staticframex}[1]{%
32211 \csname @sf@\romannumeral#1@posx\endcsname
32212 }
32213 % \end{macrocode}
32214 %\end{macro}
32215 %\begin{macro}{\staticframey}
32216 % \begin{macrocode}
32217 \newcommand*{\staticframey}[1]{%
32218 \csname @sf@\romannumeral#1@posy\endcsname
32219 }
32220 % \end{macrocode}
32221 %\end{macro}
32222 %\begin{macro}{\staticframeevenx}
32223 % \begin{macrocode}
32224 \newcommand*{\staticframeevenx}[1]{%
32225 \csname @sf@\romannumeral#1@evenx\endcsname
32226 }
32227 % \end{macrocode}
32228 %\end{macro}
32229 %\begin{macro}{\staticframeeveny}
32230 % \begin{macrocode}
32231 \newcommand*{\staticframeeveny}[1]{%
32232 \csname @sf@\romannumeral#1@eveny\endcsname
32233 }
32234 % \end{macrocode}
32235 %\end{macro}
32236 %\begin{macro}{\setallstaticframes}
32237 % Modify the settings for all the \glspl{static}:
32238 % \begin{macrocode}
32239 \newcommand*{\setallstaticframes}[1]{%
32240 \@colN=0\relax
32241 \whiledo{\@colN<\c@maxstatic}%
32242 {%
32243 \advance\@colN by 1\relax
32244 \@@setstaticframe{\@colN}{#1}%
32245 }%
32246 }
32247 % \end{macrocode}
32248 %\end{macro}
32249 %\begin{macro}{\setstaticframe}
32250 % Modify the settings for the specified \glspl{static}:
32251 % \begin{macrocode}
32252 \newcommand*{\setstaticframe}{%
32253 \@ifstar\@ssetstaticframe\@setstaticframe
32254 }
32255 % \end{macrocode}
32256 %\end{macro}
32257 %\begin{macro}{\@ssetstaticframe}
32258 % Starred version: Iterate through the comma-separated
32259 % list of labels.
32260 % \begin{macrocode}
32261 \newcommand*{\@ssetstaticframe}[2]{%
32262 \@for\@ff@id:=#1\do
32263 {%
32264 \@staticframeid{\@ff@id}%
32265 \@@setstaticframe{\ff@id}{#2}%
32266 }%
32267 }
32268 % \end{macrocode}
32269 %\end{macro}
32270 %\begin{macro}{\@setstaticframe}
32271 % Unstarred version. Iterate through the comma-separated
32272 % list of \glspl{idn}, and check for number ranges.
32273 % Ensures that number ranges do not lie out of bounds.
32274 % \begin{macrocode}
32275 \newcommand*{\@setstaticframe}[2]{%
32276 \ifthenelse{\equal{#1}{all}}%
32277 {%
32278 \setallstaticframes{#2}%
32279 }%
32280 {%
32281 \ifthenelse{\equal{#1}{odd} \TE@or \equal{#1}{even}}%
32282 {%
32283 \ifthenelse{\equal{#1}{odd}}{\@colN=1}{\@colN=2}%
32284 \whiledo{\@colN<\c@maxstatic\TE@or\@colN=\c@maxstatic}%
32285 {%
32286 \@@setstaticframe{\@colN}{#2}%
32287 \advance\@colN by 2\relax
32288 }%
32289 }%
32290 {%
32291 \@for\@ff@id:=#1\do
32292 {%
32293 \def\@ff@numstart{0}%
32294 \def\@ff@numend{10000}%
32295 \@ff@getrange{\@ff@id}%
32296 \ifnum\@ff@numstart=0\relax
32297 \def\@ff@numstart{1}%
32298 \fi
32299 \ifnum\@ff@numend>\c@maxstatic\relax
32300 \def\@ff@numend{\c@maxstatic}%
32301 \fi
32302 \@colN=\@ff@numstart\relax
32303 \whiledo{\@colN<\@ff@numend \TE@or \@colN=\@ff@numend}%
32304 {%
32305 \@@setstaticframe{\@colN}{#2}%
32306 \advance\@colN by 1\relax
32307 }%
32308 }%
32309 }%
32310 }%
32311 }
32312 % \end{macrocode}
32313 %\end{macro}
32314 %\begin{macro}{\@@setstaticframe}
32315 % Modify the settings for the \gls{static} whose \gls{idn}\
32316 % is given by the first argument.
32317 % \begin{macrocode}
32318 \newcommand*{\@@setstaticframe}[2]{%
32319 \expandafter\expandafter\expandafter
32320 \@ff@getstaticpos\csname @sf@dim@\romannumeral#1\endcsname
32321 \def\ff@frame{}\edef\ff@width{\the\@ff@tmp@x}\def\ff@angle{}%
32322 \edef\ff@height{\the\@ff@tmp@y}\def\ff@style{}\def\ff@frametype{}%
32323 \def\ff@x{}\def\ff@y{}\def\ff@col{}\def\ff@txtcol{}%
32324 \def\ff@backcol{}%
32325 \def\ff@clear{}\def\ff@margin{}\def\ff@offset{}\def\ff@pages{}%
32326 \def\ff@label{}\def\ff@evenx{}\def\ff@eveny{}%
32327 \def\ff@oddx{}\def\ff@oddy{}%
32328 \def\ff@hide{}\def\ff@hidethis{}%
32329 \let\ff@shape\undefined
32330 \let\ff@xpages\undefined
32331 \setkeys{flowframe}{#2}%
32332 \ifdefempty{\ff@frame}{}%
32333 {%
32334 \setboolean{staticframe\romannumeral#1}{\ff@frame}%
32335 }%
32336 \ifdefempty{\ff@x}{}%
32337 {%
32338 \expandafter\global\expandafter
32339 \setlength\csname @sf@\romannumeral#1@posx\endcsname
32340 {\ff@x}%
32341 \expandafter\global\expandafter
32342 \setlength\csname @sf@\romannumeral#1@evenx\endcsname
32343 {\ff@x}%
32344 }%
32345 \ifdefempty{\ff@y}{}%
32346 {%
32347 \expandafter\global\expandafter
32348 \setlength\csname @sf@\romannumeral#1@posy\endcsname
32349 {\ff@y}%
32350 \expandafter\global\expandafter
32351 \setlength\csname @sf@\romannumeral#1@eveny\endcsname
32352 {\ff@y}%
32353 }%
32354 \ifdefempty{\ff@evenx}{}%
32355 {%
32356 \expandafter\global\expandafter
32357 \setlength\csname @sf@\romannumeral#1@evenx\endcsname
32358 {\ff@evenx}%
32359 }%
32360 \ifdefempty{\ff@eveny}{}%
32361 {%
32362 \expandafter\global\expandafter
32363 \setlength\csname @sf@\romannumeral#1@eveny\endcsname
32364 {\ff@eveny}%
32365 }%
32366 \ifdefempty{\ff@oddx}{}%
32367 {%
32368 \expandafter\global\expandafter
32369 \setlength\csname @sf@\romannumeral#1@posx\endcsname
32370 {\ff@oddx}%
32371 }%
32372 \ifdefempty{\ff@oddy}{}%
32373 {%
32374 \expandafter\global\expandafter
32375 \setlength\csname @sf@\romannumeral#1@posy\endcsname
32376 {\ff@oddy}%
32377 }%
32378 \expandafter
32379 \xdef\csname @sf@dim@\romannumeral#1\endcsname{%
32380 [c][\ff@height][\ff@valign]{\ff@width}}%
32381 \ifdefempty{\ff@frametype}{}%
32382 {%
32383 \expandafter
32384 \xdef\csname @sf@frametype@\romannumeral#1\endcsname{%
32385 \ff@frametype}%
32386 }%
32387 \ifdefempty{\ff@label}{}%
32388 {%
32389 \@s@tstaticframeid{#1}[\ff@label]%
32390 }
32391 \ifdefempty{\ff@col}{}%
32392 {%
32393 \expandafter\@setframecol\ff@col\end{#1}{col}{sf}%
32394 }%
32395 \ifdefempty{\ff@txtcol}{}%
32396 {%
32397 \expandafter\@setframecol\ff@txtcol\end{#1}{txtcol}{sf}%
32398 }%
32399 \ifdefempty{\ff@backcol}{}%
32400 {%
32401 \expandafter\@setframecol\ff@backcol\end{#1}{backcol}{sf}%
32402 }%
32403 \ifdefempty{\ff@offset}{}%
32404 {%
32405 \expandafter
32406 \xdef\csname @sf@offset@\romannumeral#1\endcsname{\ff@offset}%
32407 }%
32408 \ifdefempty{\ff@angle}{}%
32409 {%
32410 \expandafter
32411 \xdef\csname @sf@angle@\romannumeral#1\endcsname{\ff@angle}%
32412 }%
32413 \ifundef{\ff@shape}{}%
32414 {%
32415 \expandafter\global\expandafter
32416 \let\csname @sf@shape@\romannumeral#1\endcsname\ff@shape
32417 }%
32418 \ifdefempty{\ff@pages}{}%
32419 {%
32420 \staticsetpagelist{#1}{\ff@pages}%
32421 }%
32422 \ifundef{\ff@xpages}{}%
32423 {%
32424 \staticsetexclusion{#1}{\ff@xpages}%
32425 }%
32426 \ifdefempty{\ff@hide}{}%
32427 {%
32428 \setboolean{@sf@hide@\romannumeral#1}{\ff@hide}%
32429 }%
32430 \ifdefempty{\ff@hidethis}{}%
32431 {%
32432 \global\csletcs{if@sf@hidethis@\romannumeral#1}{if\ff@hidethis}%
32433 }%
32434 \ifdefempty{\ff@clear}{}%
32435 {%
32436 \setboolean{@sf@clear@\romannumeral#1}{\ff@clear}%
32437 }%
32438 \ifdefempty{\ff@margin}{}%
32439 {%
32440 \PackageError{flowfram}%
32441 {Key 'margin' not available for static frames}%
32442 {Static frames don't have marginal notes}%
32443 }%
32444 \ifdefempty{\ff@style}{}%
32445 {%
32446 \PackageError{flowfram}%
32447 {Key 'style' not available for static frames}{}%
32448 }%
32449 }
32450 % \end{macrocode}
32451 %\end{macro}
32452 %
32453 %\begin{macro}{\simpar}
32454 % Simulate paragraph break inside "\shapepar"
32455 % \begin{macrocode}
32456 %\newcommand*{\simpar}{\hfil\vadjust{\vskip\parskip}\break\indent}
32457 \newcommand*{\simpar}{\hfill\\\indent\mbox{}}
32458 % \end{macrocode}
32459 %\end{macro}
32460 %\begin{macro}{\ffpshpar}
32461 % Provide means to allow parshape to be carried over a paragraph
32462 % break.
32463 % \begin{macrocode}
32464 \let\FLForgpar\par
32465 \newcommand{\ffpshpar}{%
32466 \edef\flf@next{\hangafter=\the\hangafter
32467 \hangindent=\the\hangindent}%
32468 \FLForgpar\flf@next
32469 \edef\flf@next{\prevgraf=\the\prevgraf}%
32470 \@ff@parshape\indent\mbox{}\flf@next
32471 }
32472 % \end{macrocode}
32473 %\end{macro}
32474 %
32475 % Provide a means to have section headings within "\parshape".
32476 %\begin{macro}{\@ff@parshape}
32477 % \begin{macrocode}
32478 \def\@ff@parshape{\parshape=0}
32479 % \end{macrocode}
32480 %\end{macro}
32481 %\begin{macro}{\@ff@sectionhead}
32482 % \begin{macrocode}
32483 \newcommand*{\@ff@sectionhead}[1]{%
32484 \def\ff@sechead{#1}%
32485 \ffpshpar
32486 \@ifstar{\@s@ff@heading}{\@dblarg\@ff@heading}%
32487 }
32488 % \end{macrocode}
32489 %\end{macro}
32490 %\begin{macro}{\@s@ff@heading}
32491 % \begin{macrocode}
32492 \def\@s@ff@heading#1{%
32493 \@ifundefined{@ff@old\ff@sechead}%
32494 {%
32495 \PackageError{flowfram}%
32496 {Unknown heading command '\ff@sechead'}{}%
32497 }%
32498 {%
32499 \begingroup
32500 \edef\flf@next{\hangafter=\the\hangafter
32501 \hangindent=\the\hangindent}%
32502 \FLForgpar\flf@next
32503 \let\par=\FLForgpar
32504 \edef\flf@next{\prevgraf=\the\prevgraf}%
32505 \csname @ff@old\ff@sechead\endcsname*{%
32506 \@ff@parshape\flf@next #1}%
32507 \xdef\flf@next{%
32508 \@ff@parshape
32509 \prevgraf=\the\prevgraf}%
32510 \endgroup
32511 }%
32512 \mbox{}\flf@next
32513 \let\flf@next\undefined
32514 }
32515 % \end{macrocode}
32516 %\end{macro}
32517 %\begin{macro}{\@ff@heading}
32518 % \begin{macrocode}
32519 \def\@ff@heading[#1]#2{%
32520 \@ifundefined{@ff@old\ff@sechead}%
32521 {%
32522 \PackageError{flowfram}%
32523 {Unknown heading command '\ff@sechead'}{}%
32524 }%
32525 {%
32526 \begingroup
32527 \edef\flf@next{%
32528 \hangafter=\the\hangafter
32529 \hangindent=\the\hangindent}%
32530 \FLForgpar\flf@next
32531 \let\par=\FLForgpar
32532 \edef\flf@next{\prevgraf=\the\prevgraf}%
32533 \csname @ff@old\ff@sechead\endcsname[#1]{%
32534 \@ff@parshape\flf@next #2}%
32535 \xdef\flf@next{\@ff@parshape
32536 \prevgraf=\the\prevgraf}%
32537 \endgroup
32538 }%
32539 \mbox{}\flf@next
32540 \let\flf@next\undefined
32541 }
32542 % \end{macrocode}
32543 %\end{macro}
32544 %\begin{macro}{\@ff@setsecthead}
32545 % Define command to switch to adjusted section headings:
32546 % \begin{macrocode}
32547 \newcommand*{\@ff@setsecthead}{%
32548 \let\@ff@oldsection=\section
32549 \let\@ff@oldsubsection=\subsection
32550 \let\@ff@oldsubsubsection=\subsubsection
32551 \let\@ff@oldparagraph=\paragraph
32552 \let\@ff@oldsubparagraph=\subparagraph
32553 \def\section{\@ff@sectionhead{section}}%
32554 \def\subsection{\@ff@sectionhead{subsection}}%
32555 \def\subsubsection{\@ff@sectionhead{subsubsection}}%
32556 \def\paragraph{\@ff@sectionhead{paragraph}}%
32557 \def\subparagraph{\@ff@sectionhead{subparagraph}}%
32558 }
32559 % \end{macrocode}
32560 %\end{macro}
32561 %\begin{macro}{\@ff@getshape}
32562 % Determine what shape command is being used:
32563 % \begin{macrocode}
32564 \def\@ff@getshape#1#2\relax{%
32565 \ifdefequal{#1}{\parshape}%
32566 {%
32567 \def\ff@shape{1}%
32568 }%
32569 {%
32570 \ifdefequal{#1}{\shapepar}%
32571 {%
32572 \def\ff@shape{2}%
32573 }%
32574 {%
32575 % \end{macrocode}
32576 %\changes{1.15}{2014-05-15}{added check for \cs{Shapepar}}
32577 % \begin{macrocode}
32578 \ifdefequal{#1}{\Shapepar}%
32579 {%
32580 \def\ff@shape{2}%
32581 }%
32582 {%
32583 \ifx#1\relax
32584 \def\ff@shape{0}%
32585 \else
32586 \PackageError{flowfram}{Unknown shape \string#1}{}%
32587 \def\ff@shape{2}%
32588 \fi
32589 }%
32590 }%
32591 }%
32592 }
32593 % \end{macrocode}
32594 %\end{macro}
32595 %\begin{macro}{\@ff@disablesec}
32596 % Disable sectioning commands
32597 % \begin{macrocode}
32598 \newcommand*{\@ff@disablesec}{%
32599 \def\section{%
32600 \PackageError{flowfram}%
32601 {You can't have sectioning commands within a \string\shapepar}{}%
32602 }%
32603 \def\subsection{%
32604 \PackageError{flowfram}%
32605 {You can't have sectioning commands within a \string\shapepar}{}%
32606 }%
32607 \def\subsubsection{%
32608 \PackageError{flowfram}%
32609 {You can't have sectioning commands within a \string\shapepar}{}%
32610 }%
32611 \def\paragraph{%
32612 \PackageError{flowfram}%
32613 {You can't have sectioning commands within a \string\shapepar}{}%
32614 }%
32615 \def\subparagraph{%
32616 \PackageError{flowfram}%
32617 {You can't have sectioning commands within a \string\shapepar}{}%
32618 }%
32619 }
32620 % \end{macrocode}
32621 %\end{macro}
32622 %
32623 %\begin{environment}{staticcontents}
32624 % Set the contents of the \gls{static} given by its \gls{idn}.
32625 % Syntax: "\begin{staticcontents}"\marg{idn}.
32626 % \begin{macrocode}
32627 \newbox\staticframe
32628 \newenvironment{staticcontents}[1]{%
32629 \let\continueonframe=\@staticcontinueonframe
32630 \@beginstaticcontents{#1}%
32631 }%
32632 {%
32633 \@endstaticcontents
32634 \ignorespaces
32635 }
32636 % \end{macrocode}
32637 %\end{environment}
32638 %\begin{environment}{staticcontents*}
32639 % Set the contents of the \gls{static} given by its \gls{idl}.
32640 % Syntax: "\begin{staticcontents*}"\marg{label}.
32641 % \begin{macrocode}
32642 \newenvironment{staticcontents*}[1]{%
32643 \@staticframeid{#1}%
32644 \let\continueonframe=\@staticscontinueonframe
32645 \@beginstaticcontents{\ff@id}%
32646 }%
32647 {%
32648 \@endstaticcontents
32649 \ignorespaces
32650 }
32651 % \end{macrocode}
32652 %\end{environment}
32653 %
32654 % Begin staticcontents stuff.
32655 % \begin{macrocode}
32656 \newcommand{\@beginstaticcontents}[1]{%
32657 \@ifundefined{@staticframe@\romannumeral#1}%
32658 {%
32659 \PackageError{flowfram}{Static frame '#1' not defined}{}%
32660 }%
32661 {}%
32662 \expandafter\let\expandafter\@ff@parshape\csname @sf@shape@\romannumeral#1\endcsname
32663 \expandafter\@ff@getshape\@ff@parshape\relax
32664 \ifcase\ff@shape
32665 % \end{macrocode}
32666 % no shape:
32667 % \begin{macrocode}
32668 \edef\@sf@mpg{%
32669 \noexpand
32670 \begin{minipage}\csname @sf@dim@\romannumeral#1\endcsname
32671 \noexpand\begingroup
32672 \noexpand\let\noexpand\FLForgpar=\noexpand\par
32673 }%
32674 \or
32675 % \end{macrocode}
32676 % \cs{parshape}:
32677 % \begin{macrocode}
32678 \edef\@sf@mpg{%
32679 \noexpand
32680 \begin{minipage}\csname @sf@dim@\romannumeral#1\endcsname
32681 \@ff@parshape
32682 \noexpand\begingroup
32683 \noexpand\let\noexpand\FLForgpar=\noexpand\par
32684 \noexpand\let\noexpand\par=\noexpand\ffpshpar
32685 \noexpand\@ff@setsecthead
32686 }%
32687 \or
32688 % \end{macrocode}
32689 % \cs{shapepar} or \cs{Shapepar}:
32690 % \begin{macrocode}
32691 \edef\@sf@mpg{%
32692 \noexpand
32693 \begin{minipage}\csname @sf@dim@\romannumeral#1\endcsname
32694 \noexpand\begingroup
32695 \noexpand\@ff@disablesec
32696 \noexpand\@ff@parshape
32697 }%
32698 \fi
32699 \edef\@sf@thisframe{\csname @staticframe@\romannumeral#1\endcsname}%
32700 \begin{lrbox}{\staticframe}%
32701 \edef\ff@txtcol{\csname @sf@txtcol@\romannumeral#1\endcsname}%
32702 \@s@tfftextcol\noindent
32703 \@sf@mpg
32704 \setlength\parindent\sdfparindent
32705 }
32706 % \end{macrocode}
32707 % End staticcontents stuff
32708 % \begin{macrocode}
32709 \newcommand*{\@endstaticcontents}{%
32710 \ifnum\ff@shape=2\relax
32711 \par
32712 \else
32713 \FLForgpar
32714 \fi
32715 \endgroup
32716 \end{minipage}%
32717 \end{lrbox}%
32718 \expandafter\global\expandafter
32719 \sbox\@sf@thisframe{\usebox\staticframe}%
32720 }
32721 % \end{macrocode}
32722 %
32723 %\begin{macro}{\setstaticcontents}
32724 % Provide a command version.
32725 % Syntax: \cs{setstaticcontents}\marg{idn}\marg{text}.
32726 % \begin{macrocode}
32727 \newcommand{\setstaticcontents}{%
32728 \@ifstar\@sstaticconts\@staticconts
32729 }
32730 % \end{macrocode}
32731 %\end{macro}
32732 %\begin{macro}{\@sstaticconts}
32733 % Starred version: \gls{static} identified by label.
32734 % \begin{macrocode}
32735 \newcommand{\@sstaticconts}[2]{%
32736 \begin{staticcontents*}{#1}%
32737 #2%
32738 \end{staticcontents*}%
32739 }
32740 % \end{macrocode}
32741 %\end{macro}
32742 %\begin{macro}{\@staticconts}
32743 % Unstarred version: \gls{static} identified by \gls{idn}.
32744 % \begin{macrocode}
32745 \newcommand{\@staticconts}[2]{%
32746 \begin{staticcontents}{#1}%
32747 #2%
32748 \end{staticcontents}%
32749 }
32750 % \end{macrocode}
32751 %\end{macro}
32752 %
32753 %\begin{macro}{\staticsetpagelist}
32754 % Sets the page list for the \gls{static} given by "#1" (the
32755 % \gls{idn}).
32756 %\changes{1.14}{2012-11-10}{new}
32757 % \begin{macrocode}
32758 \newcommand*{\staticsetpagelist}[2]{%
32759 \expandafter
32760 \xdef\csname @sf@pages@\romannumeral#1\endcsname{#2}%
32761 \flf@message{Setting page range for static frame
32762 \number#1\space\space to "#2"}%
32763 }
32764 % \end{macrocode}
32765 %\end{macro}
32766 %\begin{macro}{\staticsetexclusion}
32767 % Sets the exclusion list for the \gls{static} given by "#1" (the
32768 % \gls{idn}).
32769 %\changes{1.14}{2012-11-10}{new}
32770 % \begin{macrocode}
32771 \newcommand*{\staticsetexclusion}[2]{%
32772 \expandafter
32773 \xdef\csname @sf@xpages@\romannumeral#1\endcsname{#2}%
32774 \flf@message{Setting exclusion for static frame
32775 \number#1\space\space to "#2"}%
32776 }
32777 % \end{macrocode}
32778 %\end{macro}
32779 %\begin{macro}{\staticaddexclusion}
32780 % Adds to the exclusion list for the \gls{static} given by "#1" (the
32781 % \gls{idn}).
32782 %\changes{1.14}{2012-11-10}{new}
32783 % \begin{macrocode}
32784 \newcommand*{\staticaddexclusion}[2]{%
32785 \ifcsempty{@sf@xpages@\romannumeral#1}
32786 {%
32787 \expandafter
32788 \xdef\csname @sf@xpages@\romannumeral#1\endcsname{#2}%
32789 }%
32790 {%
32791 \expandafter
32792 \xdef\csname @sf@xpages@\romannumeral#1\endcsname{%
32793 \csname @sf@xpages@\romannumeral#1\endcsname,#2}%
32794 }%
32795 \flf@message{Setting exclusion for static frame
32796 \number#1\space\space to
32797 "\csname @sf@xpages@\romannumeral#1\endcsname"}%
32798 }
32799 % \end{macrocode}
32800 %\end{macro}
32801 %
32802 %\begin{macro}{\@@staticframeswapcoords}
32803 % Swap odd and even offsets for a given \gls{static}. Do the main stuff for
32804 % a given \gls{static} \gls{idn}.
32805 % \begin{macrocode}
32806 \newcommand*{\@@staticframeswapcoords}[1]{%
32807 \setlength{\@ff@tmp@x}%
32808 {\csname @sf@\romannumeral#1@evenx\endcsname}
32809 \expandafter\setlength\csname @sf@\romannumeral#1@evenx\endcsname
32810 {\csname @sf@\romannumeral#1@posx\endcsname}%
32811 \expandafter\setlength\csname @sf@\romannumeral#1@posx\endcsname
32812 {\@ff@tmp@x}%
32813 \setlength{\@ff@tmp@y}%
32814 {\csname @sf@\romannumeral#1@eveny\endcsname}
32815 \expandafter\setlength\csname @sf@\romannumeral#1@eveny\endcsname
32816 {\csname @sf@\romannumeral#1@posy\endcsname}%
32817 \expandafter\setlength\csname @sf@\romannumeral#1@posy\endcsname
32818 {\@ff@tmp@y}%
32819 }
32820 % \end{macrocode}
32821 %\end{macro}
32822 %\begin{macro}{\sfswapoddeven}
32823 % Allow user to specify \gls{flow} either by \gls{idn} or \gls{idl}:
32824 % \begin{macrocode}
32825 \newcommand*{\sfswapoddeven}{%
32826 \@ifstar\@sstaticframeswapcoords\@staticframeswapcoords
32827 }
32828 % \end{macrocode}
32829 %\end{macro}
32830 %\begin{macro}{\@sstaticframeswapcoords}
32831 % Starred form
32832 % \begin{macrocode}
32833 \newcommand*{\@sstaticframeswapcoords}[1]{%
32834 \@for\@ff@id:=#1\do
32835 {%
32836 \@staticframeid{\@ff@id}%
32837 \@@staticframeswapcoords{\ff@id}%
32838 }%
32839 }
32840 % \end{macrocode}
32841 %\end{macro}
32842 %\begin{macro}{\@staticframeswapcoords}
32843 % Unstarred form:
32844 % \begin{macrocode}
32845 \newcommand*{\@staticframeswapcoords}[1]{%
32846 \ifthenelse{\equal{#1}{all}}%
32847 {%
32848 \ff@id=0\relax
32849 \whiledo{\ff@id<\c@maxflow}%
32850 {%
32851 \advance\ff@id by 1\relax
32852 \@@staticframeswapcoords{\ff@id}%
32853 }%
32854 }%
32855 {%
32856 \ifthenelse{\equal{#1}{odd} \TE@or \equal{#1}{even}}%
32857 {%
32858 \ifthenelse{\equal{#1}{odd}}{\@colN=1}{\@colN=2}%
32859 \whiledo{\@colN<\c@maxflow\TE@or\@colN=\c@maxflow}%
32860 {%
32861 \@@staticframeswapcoords{\@colN}%
32862 \advance\@colN by 2\relax
32863 }%
32864 }%
32865 {%
32866 \@for\@ff@id:=#1\do
32867 {%
32868 \def\@ff@numstart{0}\def\@ff@numend{100000}%
32869 \@ff@getrange{\@ff@id}%
32870 \ifnum\@ff@numstart=0\relax
32871 \def\@ff@numstart{1}%
32872 \fi
32873 \ifnum\@ff@numend>\c@maxflow
32874 \def\@ff@numend{\c@maxflow}%
32875 \fi
32876 \@colN=\@ff@numstart
32877 \whiledo{\@colN<\@ff@numend \TE@or \@colN=\@ff@numend}%
32878 {%
32879 \@@staticframeswapcoords{\@colN}%
32880 \advance\@colN by 1\relax
32881 }%
32882 }%
32883 }%
32884 }%
32885 }
32886 % \end{macrocode}
32887 %\end{macro}
32888 %
32889 % \subsection{Dynamic Frames}
32890 % Now deal with the \glspl{dynamic}. These are very similar
32891 % to the \glspl{static}, but instead of having a savebox,
32892 % the contents of the \gls{dynamic} are stored in a macro.
32893 %\begin{macro}{\newdynamicframe}
32894 % Syntax:\newline
32895 % \cs{newdynamicframe}\oarg{pages}\marg{width}\marg{height}\marg{x}\marg{y}\oarg{label}
32896 % \begin{macrocode}
32897 \newcommand*{\newdynamicframe}{%
32898 \@n@wdynamicframe
32899 }
32900 \newcommand*{\@n@wdynamicframe}{%
32901 \global\advance\c@maxdynamic by 1\relax
32902 \newboolean{dynamicframe\romannumeral\c@maxdynamic}
32903 \@ifstar\@snewdynamicframe\@newdynamicframe
32904 }
32905 % \end{macrocode}
32906 %\end{macro}
32907 %\begin{macro}{\@snewdynamicframe}
32908 % Starred version: has a border.
32909 % \begin{macrocode}
32910 \newcommand*{\@snewdynamicframe}{%
32911 \setboolean{dynamicframe\romannumeral\c@maxdynamic}{true}%
32912 \@@newdynamicframe
32913 }
32914 % \end{macrocode}
32915 %\end{macro}
32916 %\begin{macro}{\@newdynamicframe}
32917 % Unstarred version: no border.
32918 % \begin{macrocode}
32919 \newcommand*{\@newdynamicframe}{%
32920 \setboolean{dynamicframe\romannumeral\c@maxdynamic}{false}%
32921 \@@newdynamicframe
32922 }
32923 % \end{macrocode}
32924 %\end{macro}
32925 %\begin{macro}{\@@newdynamicframe}
32926 % Create new \gls{dynamic}:
32927 % \begin{macrocode}
32928 \newcommand*{\@@newdynamicframe}[5][all]{%
32929 \expandafter
32930 \gdef\csname @dynamicframe@\romannumeral\c@maxdynamic\endcsname{}%
32931 \expandafter
32932 \newlength\csname @df@\romannumeral\c@maxdynamic @posx\endcsname
32933 \expandafter
32934 \newlength\csname @df@\romannumeral\c@maxdynamic @posy\endcsname
32935 \expandafter\setlength
32936 \csname @df@\romannumeral\c@maxdynamic @posx\endcsname{#4}%
32937 \expandafter\setlength
32938 \csname @df@\romannumeral\c@maxdynamic @posy\endcsname{#5}%
32939 \expandafter\newlength
32940 \csname @df@\romannumeral\c@maxdynamic @evenx\endcsname
32941 \expandafter\newlength
32942 \csname @df@\romannumeral\c@maxdynamic @eveny\endcsname
32943 \expandafter\setlength
32944 \csname @df@\romannumeral\c@maxdynamic @evenx\endcsname{#4}%
32945 \expandafter\setlength
32946 \csname @df@\romannumeral\c@maxdynamic @eveny\endcsname{#5}%
32947 {%
32948 \@ff@tmp@x=#2\relax
32949 \@ff@tmp@y=#3\relax
32950 \expandafter
32951 \xdef\csname @df@dim@\romannumeral\c@maxdynamic\endcsname{%
32952 [c][\the\@ff@tmp@y][t]{\the\@ff@tmp@x}%
32953 }%
32954 }%
32955 \expandafter
32956 \gdef\csname @df@col@\romannumeral\c@maxdynamic\endcsname{%
32957 \flowframecol
32958 }%
32959 \expandafter
32960 \gdef\csname @df@txtcol@\romannumeral\c@maxdynamic\endcsname{%
32961 \flowframetextcol
32962 }%
32963 \expandafter
32964 \gdef\csname @df@backcol@\romannumeral\c@maxdynamic\endcsname{%
32965 {none}}%
32966 \expandafter
32967 \gdef\csname @df@pages@\romannumeral\c@maxdynamic\endcsname{#1}%
32968 % \end{macrocode}
32969 % Page exclusion list:
32970 %\changes{1.14}{2012-11-10}{added page exclusion list}
32971 % \begin{macrocode}
32972 \expandafter
32973 \gdef\csname @df@xpages@\romannumeral\c@maxflow\endcsname{}%
32974 \expandafter
32975 \gdef\csname @df@frametype@\romannumeral\c@maxdynamic\endcsname{%
32976 fbox}%
32977 \expandafter
32978 \gdef\csname @df@style@\romannumeral\c@maxdynamic\endcsname{relax}%
32979 \expandafter
32980 \gdef\csname @df@offset@\romannumeral\c@maxdynamic\endcsname{compute}%
32981 \expandafter
32982 \gdef\csname @df@angle@\romannumeral\c@maxdynamic\endcsname{0}%
32983 \expandafter
32984 \gdef\csname @df@shape@\romannumeral\c@maxdynamic\endcsname{\relax}%
32985 \newboolean{@df@clear@\romannumeral\c@maxdynamic}%
32986 \setboolean{@df@clear@\romannumeral\c@maxdynamic}{false}%
32987 % \end{macrocode}
32988 %\changes{1.16}{2014-06-04}{added `hide' and `hidethis' attributes}
32989 % \begin{macrocode}
32990 \newboolean{@df@hide@\romannumeral\c@maxdynamic}%
32991 \setboolean{@df@hide@\romannumeral\c@maxdynamic}{false}%
32992 \newboolean{@df@hidethis@\romannumeral\c@maxdynamic}%
32993 \setboolean{@df@hidethis@\romannumeral\c@maxdynamic}{false}%
32994 \@ifnextchar[{\@s@tdynamicframeid{\c@maxdynamic}}%
32995 {\@s@tdynamicframeid{\c@maxdynamic}[\number\c@maxdynamic]}%
32996 }
32997 % \end{macrocode}
32998 %\end{macro}
32999 %\begin{macro}{\@s@tdynamicframeid}
33000 % Set the label for the given \gls{dynamic}:
33001 % \begin{macrocode}
33002 \def\@s@tdynamicframeid#1[#2]{%
33003 \edef\ff@label{#2}%
33004 \@df@checkuniqueidl{#1}{\ff@label}%
33005 \expandafter
33006 \xdef\csname @df@id@\romannumeral#1\endcsname{\ff@label}%
33007 }
33008 % \end{macrocode}
33009 %\end{macro}
33010 %\begin{macro}{\@df@checkuniqueidl}
33011 % Check \gls{idl} "#2" for \gls{static} "#1" is unique
33012 % \begin{macrocode}
33013 \newcommand*{\@df@checkuniqueidl}[2]{%
33014 \@colN=0\relax
33015 \whiledo{\@colN<\c@maxdynamic}%
33016 {%
33017 \advance\@colN by 1\relax
33018 \ifnum\@colN=#1\relax
33019 \else
33020 \ifthenelse
33021 {%
33022 \equal{#2}%
33023 {\csname @df@id@\romannumeral\@colN\endcsname}%
33024 }%
33025 {%
33026 \PackageError{flowfram}%
33027 {Dynamic frame IDL '#2' already defined}%
33028 {%
33029 You can't assign this label, as it is already defined
33030 for dynamic frame \number\@colN
33031 }%
33032 }%
33033 {}%
33034 \fi
33035 }%
33036 }
33037 % \end{macrocode}
33038 %\end{macro}
33039 %
33040 %\begin{macro}{\getdynamiclabel}
33041 %\changes{1.11}{2008/06/27}{new}
33042 %\cs{getdynamiclabel}\marg{idn}
33043 % Gets the \gls{idl} for the \gls{dynamic} identified by its
33044 % \gls{idn}.
33045 % \begin{macrocode}
33046 \newcommand*{\getdynamiclabel}[1]{%
33047 \csname @df@id@\romannumeral#1\endcsname
33048 }
33049 % \end{macrocode}
33050 %\end{macro}
33051 %
33052 %\begin{macro}{\getdynamicid}
33053 %\changes{1.11}{2008/06/27}{new}
33054 %\cs{getdynamicid}\marg{cmd}\marg{idl}
33055 % Gets the \gls{idn} for the \gls{dynamic} identified by its
33056 % \gls{idl} and stores in \meta{cmd} which must be a control
33057 % sequence.
33058 % \begin{macrocode}
33059 \newcommand*{\getdynamicid}[2]{%
33060 \@dynamicframeid{#2}\edef#1{\number\ff@id}%
33061 }
33062 % \end{macrocode}
33063 %\end{macro}
33064 %
33065 %\begin{macro}{\@dynamicframeid}
33066 % Determine the \gls{idn} of the \gls{dynamic} from its label.
33067 % The \gls{idn} is stored in "\ff@id".
33068 % \begin{macrocode}
33069 \newcommand*{\@dynamicframeid}[1]{%
33070 \@colN=0\relax
33071 \ff@id=0\relax
33072 \whiledo{\@colN<\c@maxdynamic}%
33073 {%
33074 \advance\@colN by 1\relax
33075 \ifthenelse
33076 {%
33077 \equal{#1}{\csname @df@id@\romannumeral\@colN\endcsname}%
33078 }%
33079 {%
33080 \ff@id=\@colN\relax
33081 % \end{macrocode}
33082 % Break out of loop
33083 % \begin{macrocode}
33084 \@colN=\c@maxdynamic
33085 }%
33086 {}%
33087 }%
33088 \ifnum\ff@id=0\relax
33089 \PackageError{flowfram}%
33090 {Can't find dynamic frame id '#1'}{}%
33091 \fi
33092 }
33093 % \end{macrocode}
33094 %\end{macro}
33095 %
33096 %\begin{macro}{\@getframeid}
33097 % \cs{@getframeid}\marg{type}\marg{idl}
33098 %
33099 % Gets the \gls{idl} for the frame of type \meta{type} whose \gls{idl}
33100 % is given by \meta{idl}. The \gls{idn} is stored in "\ff@id".
33101 % \begin{macrocode}
33102 \newcommand*{\@getframeid}[2]{%
33103 \@ifdefined{@#1frameid}%
33104 {\csname @#1frameid\endcsname{#2}}%
33105 {%
33106 \PackageError{flowfram}%
33107 {Unknown frame type `#1'}%
33108 {Frame types can be one of: flow, static or dynamic}%
33109 }%
33110 }
33111 % \end{macrocode}
33112 %\end{macro}
33113 %
33114 % Make it easier to get the x and y values for dynamic
33115 % frames. (Width and height stored differently.)
33116 %\begin{macro}{\dynamicframex}
33117 % \begin{macrocode}
33118 \newcommand*{\dynamicframex}[1]{%
33119 \csname @df@\romannumeral#1@posx\endcsname
33120 }
33121 % \end{macrocode}
33122 %\end{macro}
33123 %\begin{macro}{\dynamicframey}
33124 % \begin{macrocode}
33125 \newcommand*{\dynamicframey}[1]{%
33126 \csname @df@\romannumeral#1@posy\endcsname
33127 }
33128 % \end{macrocode}
33129 %\end{macro}
33130 %\begin{macro}{\dynamicframeevenx}
33131 % \begin{macrocode}
33132 \newcommand*{\dynamicframeevenx}[1]{%
33133 \csname @df@\romannumeral#1@evenx\endcsname
33134 }
33135 % \end{macrocode}
33136 %\end{macro}
33137 %\begin{macro}{\dynamicframeeveny}
33138 % \begin{macrocode}
33139 \newcommand*{\dynamicframeeveny}[1]{%
33140 \csname @df@\romannumeral#1@eveny\endcsname
33141 }
33142 % \end{macrocode}
33143 %\end{macro}
33144 %\begin{macro}{\setalldynamicframes}
33145 % Change the settings for all the \glspl{dynamic}:
33146 % \begin{macrocode}
33147 \newcommand*{\setalldynamicframes}[1]{%
33148 \@colN=0\relax
33149 \whiledo{\@colN<\c@maxdynamic}%
33150 {%
33151 \advance\@colN by 1\relax
33152 \@@setdynamicframe{\@colN}{#1}%
33153 }%
33154 }
33155 % \end{macrocode}
33156 %\end{macro}
33157 %\begin{macro}{\setdynamicframe}
33158 % Change the settings for specified \glspl{dynamic}:
33159 % \begin{macrocode}
33160 \newcommand*{\setdynamicframe}{%
33161 \@ifstar\@ssetdynamicframe\@setdynamicframe
33162 }
33163 % \end{macrocode}
33164 %\end{macro}
33165 %\begin{macro}{\@ssetdynamicframe}
33166 % Starred version: iterate through comma-separated list
33167 % of labels.
33168 % \begin{macrocode}
33169 \newcommand*{\@ssetdynamicframe}[2]{%
33170 \@for\@ff@id:=#1\do{%
33171 \@dynamicframeid{\@ff@id}%
33172 \@@setdynamicframe{\ff@id}{#2}%
33173 }%
33174 }
33175 % \end{macrocode}
33176 %\end{macro}
33177 %\begin{macro}{\@setdynamicframe}
33178 % Unstarred version: iterate through comma-separated list
33179 % of ID numbers. Include provision for number ranges.
33180 % If necessary, modify number ranges to ensure they are valid.
33181 % \begin{macrocode}
33182 \newcommand*{\@setdynamicframe}[2]{%
33183 \ifthenelse{\equal{#1}{all}}%
33184 {%
33185 \setalldynamicframes{#2}%
33186 }%
33187 {%
33188 \ifthenelse{\equal{#1}{odd} \TE@or \equal{#1}{even}}%
33189 {%
33190 \ifthenelse{\equal{#1}{odd}}%
33191 {\@colN=1}%
33192 {\@colN=2}%
33193 \whiledo{\@colN<\c@maxdynamic\TE@or\@colN=\c@maxdynamic}%
33194 {%
33195 \@@setdynamicframe{\@colN}{#2}%
33196 \advance\@colN by 2\relax
33197 }%
33198 }%
33199 {%
33200 \@for\@ff@id:=#1\do{%
33201 \def\@ff@numstart{0}%
33202 \def\@ff@numend{10000}%
33203 \@ff@getrange{\@ff@id}%
33204 \ifnum\@ff@numstart=0\relax
33205 \def\@ff@numstart{1}%
33206 \fi
33207 \ifnum\@ff@numend>\c@maxdynamic\relax
33208 \def\@ff@numend{\c@maxdynamic}%
33209 \fi
33210 \@colN=\@ff@numstart\relax
33211 \whiledo{\@colN<\@ff@numend \TE@or \@colN=\@ff@numend}%
33212 {%
33213 \@@setdynamicframe{\@colN}{#2}%
33214 \advance\@colN by 1\relax
33215 }%
33216 }%
33217 }%
33218 }%
33219 }
33220 % \end{macrocode}
33221 %\end{macro}
33222 %\begin{macro}{\@@setdynamicframe}
33223 % Change the setting for the \gls{dynamic} given by its \gls{idn}.
33224 %\changes{1.11}{2008/06/27}{removed unwanted space}
33225 %\changes{1.11}{2008/06/27}{fixed bug in clear key}
33226 % \begin{macrocode}
33227 \newcommand*{\@@setdynamicframe}[2]{%
33228 \expandafter\expandafter\expandafter
33229 \@ff@getstaticpos\csname @df@dim@\romannumeral#1\endcsname
33230 \def\ff@frame{}\edef\ff@width{\the\@ff@tmp@x}%
33231 \edef\ff@height{\the\@ff@tmp@y}\def\ff@style{}\def\ff@frametype{}%
33232 \def\ff@x{}\def\ff@y{}\def\ff@col{}\def\ff@txtcol{}\def\ff@backcol{}%
33233 \def\ff@clear{}\def\ff@margin{}\def\ff@offset{}\def\ff@pages{}%
33234 \def\ff@label{}\def\ff@evenx{}\def\ff@eveny{}%
33235 \def\ff@oddx{}\def\ff@oddy{}\def\ff@angle{}%
33236 \def\ff@hide{}\def\ff@hidethis{}%
33237 \let\ff@shape\undefined
33238 \let\ff@xpages\undefined
33239 \setkeys{flowframe}{#2}%
33240 \ifdefempty{\ff@frame}%
33241 {}%
33242 {%
33243 \setboolean{dynamicframe\romannumeral#1}{\ff@frame}%
33244 }%
33245 \ifdefempty{\ff@x}%
33246 {}%
33247 {%
33248 \expandafter\global\expandafter\setlength
33249 \csname @df@\romannumeral#1@posx\endcsname{\ff@x}%
33250 \expandafter\global\expandafter\setlength
33251 \csname @df@\romannumeral#1@evenx\endcsname{\ff@x}%
33252 }%
33253 \ifdefempty{\ff@y}%
33254 {}%
33255 {%
33256 \expandafter\global\expandafter\setlength
33257 \csname @df@\romannumeral#1@posy\endcsname{\ff@y}%
33258 \expandafter\global\expandafter\setlength
33259 \csname @df@\romannumeral#1@eveny\endcsname{\ff@y}%
33260 }%
33261 \ifdefempty{\ff@evenx}%
33262 {}%
33263 {%
33264 \expandafter\global\expandafter\setlength
33265 \csname @df@\romannumeral#1@evenx\endcsname{\ff@evenx}%
33266 }%
33267 \ifdefempty{\ff@eveny}%
33268 {}%
33269 {%
33270 \expandafter\global\expandafter\setlength
33271 \csname @df@\romannumeral#1@eveny\endcsname{\ff@eveny}%
33272 }%
33273 \ifdefempty{\ff@oddx}%
33274 {}%
33275 {%
33276 \expandafter\global\expandafter\setlength
33277 \csname @df@\romannumeral#1@posx\endcsname{\ff@oddx}%
33278 }%
33279 \ifdefempty{\ff@oddy}%
33280 {}%
33281 {%
33282 \expandafter\global\expandafter\setlength
33283 \csname @df@\romannumeral#1@posy\endcsname{\ff@oddy}%
33284 }%
33285 \expandafter\xdef\csname @df@dim@\romannumeral#1\endcsname{%
33286 [c][\ff@height][\ff@valign]{\ff@width}%
33287 }%
33288 \ifdefempty{\ff@label}%
33289 {}%
33290 {%
33291 \@s@tdynamicframeid{#1}[\ff@label]%
33292 }%
33293 \ifdefempty{\ff@frametype}%
33294 {}%
33295 {%
33296 \expandafter
33297 \xdef\csname @df@frametype@\romannumeral#1\endcsname{%
33298 \ff@frametype
33299 }%
33300 }%
33301 \ifdefempty{\ff@col}%
33302 {}%
33303 {%
33304 \expandafter\@setframecol\ff@col\end{#1}{col}{df}%
33305 }%
33306 \ifdefempty{\ff@txtcol}%
33307 {}%
33308 {%
33309 \expandafter\@setframecol\ff@txtcol\end{#1}{txtcol}{df}%
33310 }%
33311 \ifdefempty{\ff@backcol}%
33312 {}%
33313 {%
33314 \expandafter\@setframecol\ff@backcol\end{#1}{backcol}{df}%
33315 }%
33316 \ifdefempty{\ff@offset}%
33317 {}%
33318 {%
33319 \expandafter
33320 \xdef\csname @df@offset@\romannumeral#1\endcsname{\ff@offset}%
33321 }%
33322 \ifdefempty{\ff@angle}%
33323 {}%
33324 {%
33325 \expandafter
33326 \xdef\csname @df@angle@\romannumeral#1\endcsname{\ff@angle}%
33327 }%
33328 \ifundef{\ff@shape}{}%
33329 {%
33330 \expandafter\global\expandafter
33331 \let\csname @df@shape@\romannumeral#1\endcsname\ff@shape
33332 }%
33333 \ifdefempty{\ff@pages}%
33334 {}%
33335 {%
33336 \dynamicsetpagelist{#1}{\ff@pages}%
33337 }%
33338 \ifundef{\ff@xpages}{}%
33339 {%
33340 \dynamicsetexclusion{#1}{\ff@xpages}%
33341 }%
33342 \ifdefempty{\ff@style}%
33343 {}%
33344 {%
33345 \ifcsundef{\ff@style}%
33346 {%
33347 \PackageError{flowfram}%
33348 {Unknown style '\ff@style'}%
33349 {%
33350 The command \expandafter\@gobble\string\\\ff@style
33351 \space has not been defined%
33352 }%
33353 }%
33354 {%
33355 \expandafter
33356 \xdef\csname @df@style@\romannumeral#1\endcsname{\ff@style}%
33357 }%
33358 }%
33359 \ifdefempty{\ff@clear}%
33360 {}%
33361 {%
33362 \setboolean{@df@clear@\romannumeral#1}{\ff@clear}%
33363 }%
33364 \ifdefempty{\ff@margin}%
33365 {}%
33366 {%
33367 \PackageError{flowfram}%
33368 {%
33369 Key 'margin' not available for dynamic frames%
33370 }%
33371 {dynamic frames don't have marginal notes}%
33372 }%
33373 \ifdefempty{\ff@hide}{}%
33374 {%
33375 \setboolean{@df@hide@\romannumeral#1}{\ff@hide}%
33376 }%
33377 \ifdefempty{\ff@hidethis}{}%
33378 {%
33379 \global\csletcs{if@df@hidethis@\romannumeral#1}{if\ff@hidethis}%
33380 }%
33381 }
33382 % \end{macrocode}
33383 %\end{macro}
33384 %
33385 %\begin{macro}{\dynamicsetpagelist}
33386 % Sets the page list for the \gls{dynamic} given by "#1" (the
33387 % \gls{idn}).
33388 %\changes{1.14}{2012-11-10}{new}
33389 % \begin{macrocode}
33390 \newcommand*{\dynamicsetpagelist}[2]{%
33391 \expandafter
33392 \xdef\csname @df@pages@\romannumeral#1\endcsname{#2}%
33393 \flf@message{Setting page range for dynamic frame
33394 \number#1\space\space to "#2"}%
33395 }
33396 % \end{macrocode}
33397 %\end{macro}
33398 %\begin{macro}{\dynamicsetexclusion}
33399 % Sets the exclusion list for the \gls{dynamic} given by "#1" (the
33400 % \gls{idn}).
33401 %\changes{1.14}{2012-11-10}{new}
33402 % \begin{macrocode}
33403 \newcommand*{\dynamicsetexclusion}[2]{%
33404 \expandafter
33405 \xdef\csname @df@xpages@\romannumeral#1\endcsname{#2}%
33406 \flf@message{Setting exclusion for dynamic frame
33407 \number#1\space\space to "#2"}%
33408 }
33409 % \end{macrocode}
33410 %\end{macro}
33411 %\begin{macro}{\dynamicaddexclusion}
33412 % Adds to the exclusion list for the \gls{dynamic} given by "#1" (the
33413 % \gls{idn}).
33414 %\changes{1.14}{2012-11-10}{new}
33415 % \begin{macrocode}
33416 \newcommand*{\dynamicaddexclusion}[2]{%
33417 \ifcsempty{@df@xpages@\romannumeral#1}
33418 {%
33419 \expandafter
33420 \xdef\csname @df@xpages@\romannumeral#1\endcsname{#2}%
33421 }%
33422 {%
33423 \expandafter
33424 \xdef\csname @df@xpages@\romannumeral#1\endcsname{%
33425 \csname @df@xpages@\romannumeral#1\endcsname,#2}%
33426 }%
33427 \flf@message{Setting exclusion for dynamic frame
33428 \number#1\space\space to
33429 "\csname @df@xpages@\romannumeral#1\endcsname"}%
33430 }
33431 % \end{macrocode}
33432 %\end{macro}
33433 %
33434 %\begin{macro}{\@@dynamicframeswapcoords}
33435 % Swap odd and even offsets for a given \gls{dynamic}. Do the main stuff for
33436 % a given \gls{dynamic} \gls{idn}.
33437 % \begin{macrocode}
33438 \newcommand*{\@@dynamicframeswapcoords}[1]{%
33439 \setlength{\@ff@tmp@x}%
33440 {\csname @df@\romannumeral#1@evenx\endcsname}%
33441 \expandafter\setlength
33442 \csname @df@\romannumeral#1@evenx\endcsname
33443 {\csname @df@\romannumeral#1@posx\endcsname}%
33444 \expandafter\setlength
33445 \csname @df@\romannumeral#1@posx\endcsname{\@ff@tmp@x}%
33446 \setlength{\@ff@tmp@y}%
33447 {\csname @df@\romannumeral#1@eveny\endcsname}%
33448 \expandafter\setlength
33449 \csname @df@\romannumeral#1@eveny\endcsname
33450 {\csname @df@\romannumeral#1@posy\endcsname}%
33451 \expandafter\setlength\csname @df@\romannumeral#1@posy\endcsname
33452 {\@ff@tmp@y}%
33453 }
33454 % \end{macrocode}
33455 %\end{macro}
33456 %\begin{macro}{\dfswapoddeven}
33457 % Allow user to specify \gls{flow} either by \gls{idn} or \gls{idl}:
33458 % \begin{macrocode}
33459 \newcommand*{\dfswapoddeven}{%
33460 \@ifstar\@sdynamicframeswapcoords\@dynamicframeswapcoords}
33461 % \end{macrocode}
33462 %\end{macro}
33463 %\begin{macro}{\@sdynamicframeswapcoords}
33464 % Starred form
33465 % \begin{macrocode}
33466 \newcommand*{\@sdynamicframeswapcoords}[1]{%
33467 \@for\@ff@id:=#1\do{%
33468 \@dynamicframeid{\@ff@id}%
33469 \@@dynamicframeswapcoords{\ff@id}}%
33470 }
33471 % \end{macrocode}
33472 %\end{macro}
33473 %\begin{macro}{\@dynamicframeswapcoords}
33474 % Unstarred form:
33475 % \begin{macrocode}
33476 \newcommand*{\@dynamicframeswapcoords}[1]{%
33477 \ifthenelse{\equal{#1}{all}}%
33478 {%
33479 \ff@id=0\relax
33480 \whiledo{\ff@id<\c@maxflow}%
33481 {%
33482 \advance\ff@id by 1\relax
33483 \@@dynamicframeswapcoords{\ff@id}%
33484 }%
33485 }%
33486 {%
33487 \ifthenelse{\equal{#1}{odd} \TE@or \equal{#1}{even}}%
33488 {%
33489 \ifthenelse{\equal{#1}{odd}}%
33490 {\@colN=1}%
33491 {\@colN=2}%
33492 \whiledo{\@colN<\c@maxflow\TE@or\@colN=\c@maxflow}%
33493 {%
33494 \@@dynamicframeswapcoords{\@colN}%
33495 \advance\@colN by 2\relax
33496 }%
33497 }%
33498 {%
33499 \@for\@ff@id:=#1\do{%
33500 \def\@ff@numstart{0}%
33501 \def\@ff@numend{10000}%
33502 \@ff@getrange{\@ff@id}%
33503 \ifnum\@ff@numstart=0\relax
33504 \def\@ff@numstart{1}%
33505 \fi
33506 \ifnum\@ff@numend>\c@maxflow
33507 \def\@ff@numend{\c@maxflow}%
33508 \fi
33509 \@colN=\@ff@numstart
33510 \whiledo{\@colN<\@ff@numend \TE@or \@colN=\@ff@numend}%
33511 {%
33512 \@@dynamicframeswapcoords{\@colN}%
33513 \advance\@colN by 1\relax
33514 }%
33515 }%
33516 }%
33517 }%
33518 }
33519 % \end{macrocode}
33520 %\end{macro}
33521 % Set the contents of a \gls{dynamic}.
33522 %
33523 %\begin{environment}{dynamiccontents}
33524 % Syntax: "\begin{dynamiccontents}"\marg{idn}
33525 %
33526 % The contents of the \env{dynamiccontents} environment needs
33527 % to be stored in the control sequence "\@dynamicframe@"\meta{rn}
33528 % (where \meta{rn} is the \meta{idn} as a roman numeral.)
33529 % \begin{macrocode}
33530 \newenvironment{dynamiccontents}[1]{%
33531 \def\@flf@{dynamiccontents}%
33532 \xdynamiccontents{#1}}{%
33533 \endxdynamiccontents
33534 }
33535 % \end{macrocode}
33536 %\end{environment}
33537 % Token to store contents of environment:
33538 % \begin{macrocode}
33539 \newtoks\@dynamictok
33540 % \end{macrocode}
33541 % Start of the environment (unstarred):
33542 % \begin{macrocode}
33543 \def\xdynamiccontents#1{%
33544 \def\@flf@idn{#1}%
33545 \@dynamictok{}\@flf@get@body
33546 }
33547 % \end{macrocode}
33548 % Get the body of the environment:
33549 % \begin{macrocode}
33550 \long\def\@flf@get@body#1\end{%
33551 \@flf@checkcontinued#1\continueonframe\@nil
33552 \ifdfcontinued
33553 \expandafter\flf@ta\expandafter{\@flf@tmpa}%
33554 \edef\@flf@tmp{\the\@dynamictok\the\flf@ta}%
33555 \@dynamictok\expandafter{\@flf@tmp}%
33556 \else
33557 \@dynamictok\expandafter{\the\@dynamictok#1}%
33558 \fi
33559 \@flf@find@end
33560 }
33561 % \end{macrocode}
33562 % Check if \cs{continueonframe} has been used.
33563 % \begin{macrocode}
33564 \newif\ifdfcontinued
33565 \long\def\@flf@checkcontinued#1\continueonframe#2\@nil{%
33566 \long\def\@flf@tmpa{#1}\long\def\@flf@tmpb{#2}%
33567 \ifx\@flf@tmpb\@lempty
33568 \dfcontinuedfalse
33569 \else
33570 \dfcontinuedtrue
33571 \flf@getcontargs#2\@ff@text\@ff@nextid\@ff@rest
33572 \fi
33573 }
33574 % \end{macrocode}
33575 % Long equivalent of \cs{@empty}:
33576 % \begin{macrocode}
33577 \long\def\@lempty{}
33578 % \end{macrocode}
33579 % Get the first optional argument and store in the forth argument
33580 % (which should be a control sequence). Get the second argument and
33581 % store in the fifth argument (which should be a control sequence).
33582 % Get the third argument and
33583 % store in the sixth argument (which should be a control sequence).
33584 % \begin{macrocode}
33585 \def\flf@getcontargs{%
33586 \@ifnextchar[{\@flf@getcontargs}{\@flf@getcontargs[]}%
33587 }
33588 % \end{macrocode}
33589 % \begin{macrocode}
33590 \long\def\@flf@getcontargs[#1]#2#3\continueonframe#4#5#6{%
33591 \def#4{#1}\def#5{#2}\def#6{#3}%
33592 }
33593 % \end{macrocode}
33594 % Find the end of the environment:
33595 % \begin{macrocode}
33596 \def\@flf@find@end#1{%
33597 \def\@tempa{#1}%
33598 \global\let\flf@next=\relax
33599 \ifdfcontinued
33600 \@dynamictok\expandafter
33601 {\the\@dynamictok\ffcontinuedtextlayout}%
33602 \protected@edef\@tmpa{\the\@dynamictok{\@ff@text}}%
33603 \@dynamictok\expandafter{\@tmpa}%
33604 \toks@\expandafter{\@ff@rest}%
33605 \edef\flf@next{\noexpand\@flf@get@body\noexpand\end{#1}%
33606 \noexpand\begin{#1}{\@ff@nextid}\noexpand\par
33607 \noexpand\noindent\noexpand\ignorespaces
33608 \the\toks@\noexpand\end{#1}}%
33609 \else
33610 \ifx\@tempa\@flf@
33611 \let\flf@next=\@flf@endxdynamiccontents
33612 \else
33613 \@dynamictok\expandafter
33614 {\the\@dynamictok\end{#1}}%
33615 \let\flf@next=\@flf@get@body
33616 \fi
33617 \fi
33618 \flf@next
33619 }
33620 % \end{macrocode}
33621 % End of the environment:
33622 % \begin{macrocode}
33623 \let\endxdynamiccontents\relax
33624 \def\@flf@endxdynamiccontents{%
33625 \ifnum\@flf@idn>\c@maxdynamic
33626 \PackageError{flowfram}%
33627 {Dynamic frame \number\@flf@idn\ does not exist}%
33628 {%
33629 You have specified dynamic frame number \number\@flf@idn,
33630 but there are only \number\c@maxdynamic\space dynamic
33631 frames currently defined%
33632 }%
33633 \else
33634 \expandafter
33635 \xdef\csname @dynamicframe@\romannumeral\@flf@idn\endcsname{%
33636 \the\@dynamictok}%
33637 \expandafter
33638 \fi
33639 \expandafter\end\expandafter{\@flf@}%
33640 }
33641 % \end{macrocode}
33642 %\begin{environment}{dynamiccontents*}
33643 % Starred version
33644 % \begin{macrocode}
33645 \newenvironment{dynamiccontents*}[1]{%
33646 \def\@flf@{dynamiccontents*}%
33647 \@dynamicframeid{#1}%
33648 \xdynamiccontents{\ff@id}}{%
33649 \enddynamiccontents
33650 }
33651 % \end{macrocode}
33652 %\end{environment}
33653 %
33654 %\begin{macro}{\setdynamiccontents}
33655 % \begin{macrocode}
33656 \newcommand{\setdynamiccontents}{%
33657 \@ifstar\@ssetdynamiccontents\@setdynamiccontents
33658 }
33659 % \end{macrocode}
33660 %\end{macro}
33661 %\begin{macro}{\@ssetdynamiccontents}
33662 % Starred version: identify \gls{dynamic} by its \gls{idl}:
33663 % \begin{macrocode}
33664 \newcommand{\@ssetdynamiccontents}[2]{%
33665 \@dynamicframeid{#1}\@setdynamiccontents{\ff@id}{#2}%
33666 }
33667 % \end{macrocode}
33668 %\end{macro}
33669 %\begin{macro}{\@setdynamiccontents}
33670 % Unstarred version: identify \gls{dynamic} by its \gls{idn}:
33671 % \begin{macrocode}
33672 \newcommand{\@setdynamiccontents}[2]{%
33673 \ifnum#1>\c@maxdynamic
33674 \PackageError{flowfram}%
33675 {Dynamic frame \number#1\ does not exist}%
33676 {%
33677 You have specified dynamic frame number \number#1, but there are
33678 only \number\c@maxdynamic\space dynamic frames currently defined%
33679 }%
33680 \else
33681 \expandafter
33682 \gdef\csname @dynamicframe@\romannumeral#1\endcsname{#2}%
33683 \fi
33684 }
33685 % \end{macrocode}
33686 %\end{macro}
33687 %\begin{macro}{\appenddynamiccontents}
33688 % Append information to \gls{dynamic}. First check to
33689 % see if starred or unstarred version is being used.
33690 % \begin{macrocode}
33691 \newcommand{\appenddynamiccontents}{%
33692 \@ifstar\@sappenddynamic\@appenddynamic
33693 }
33694 % \end{macrocode}
33695 %\end{macro}
33696 %\begin{macro}{\@sappenddynamic}
33697 % Starred version: find the \gls{idn} and pass it to
33698 % the unstarred version.
33699 % \begin{macrocode}
33700 \newcommand{\@sappenddynamic}[2]{%
33701 \@dynamicframeid{#1}\@appenddynamic{\ff@id}{#2}%
33702 }
33703 % \end{macrocode}
33704 %\end{macro}
33705 %\begin{macro}{\@appenddynamic}
33706 % Unstarred version.
33707 % \begin{macrocode}
33708 \newcommand{\@appenddynamic}[2]{%
33709 \ifnum#1>\c@maxdynamic
33710 \PackageError{flowfram}%
33711 {Dynamic frame \number#1 does not exist}%
33712 {%
33713 You have specified dynamic frame number \number#1,
33714 but there are only
33715 \number\c@maxdynamic\space dynamic frames currently defined%
33716 }%
33717 \else
33718 \expandafter\@ff@addtolist
33719 \csname @dynamicframe@\romannumeral#1\endcsname\entry{#2}%
33720 \fi
33721 }
33722 % \end{macrocode}
33723 %\end{macro}
33724 %\begin{macro}{\@ff@addtolist}
33725 % Append "#2" onto the end of "#1".
33726 % \begin{macrocode}
33727 \newtoks\flf@ta \newtoks\flf@tb
33728 \long\def\@ff@addtolist#1\entry#2{%
33729 \flf@ta={{#2}}%
33730 \flf@tb=\expandafter{#1}%
33731 \xdef#1{\the\flf@tb\the\flf@ta}%
33732 }
33733 % \end{macrocode}
33734 %\end{macro}
33735 %
33736 %\begin{macro}{\continueonframe}
33737 % \cs{continueonframe}\oarg{text}\marg{id}
33738 % Ends current \env{staticcontents} or \env{dynamiccontents}
33739 % environment and starts environment of the same type for frame
33740 % given by \meta{id}. Can only be used inside \env{staticcontents}
33741 % or \env{dynamiccontents} environments. If the starred version of
33742 % the environment is used, \marg{id} refers to the \gls{idl}, otherwise
33743 % it refers to the \gls{idn} of the new frame.
33744 % \begin{macrocode}
33745 \newcommand{\continueonframe}{%
33746 \PackageError{flowfram}%
33747 {%
33748 Can't continue to new frame: not in static or dynamic frame%
33749 }%
33750 {%
33751 \string\continueonframe\space may only
33752 be used inside `staticcontents' or `dynamiccontents'
33753 environments (or their starred versions)%
33754 }%
33755 }
33756 % \end{macrocode}
33757 %\end{macro}
33758 % \cs{@scontinueonframe} and \cs{@continueonframe} are set
33759 % by \env{staticcontents} and \env{dynamiccontents} environments
33760 % (and their starred forms).
33761 %
33762 % Static starred version uses \gls{idl}
33763 % \begin{macrocode}
33764 \newcommand*{\@staticscontinueonframe}[2][]{%
33765 \ffcontinuedtextlayout{#1}%
33766 \end{staticcontents*}%
33767 \begin{staticcontents*}{#2}\par\noindent\ignorespaces
33768 }
33769 % \end{macrocode}
33770 % Static unstarred version uses \gls{idn}
33771 % \begin{macrocode}
33772 \newcommand*{\@staticcontinueonframe}[2][]{%
33773 \ffcontinuedtextlayout{#1}%
33774 \end{staticcontents}%
33775 \begin{staticcontents}{#2}\par\noindent\ignorespaces
33776 }
33777 % \end{macrocode}
33778 %
33779 %\begin{macro}{\ffcontinuedtextlayout}
33780 %Displays the continued text used by \cs{continueonframe}.
33781 % \begin{macrocode}
33782 \newcommand{\ffcontinuedtextlayout}[1]{%
33783 \parfillskip=0pt\par\hfill
33784 \ffcontinuedtextfont{#1}%
33785 }
33786 % \end{macrocode}
33787 %\end{macro}
33788 %\begin{macro}{\ffcontinuedtextfont}
33789 %Sets the font to display the continuation text used by
33790 %\cs{continueonframe}
33791 % \begin{macrocode}
33792 \newcommand*{\ffcontinuedtextfont}[1]{\emph{\small #1}}
33793 % \end{macrocode}
33794 %\end{macro}
33795 %
33796 %\subsection{Determining Dimensions and Locations}
33797 %\begin{macro}{\computeleftedgeodd}
33798 % Compute the position of the left most edge of the page,
33799 % relative to the left side of the \gls{typeblock}. Since odd and
33800 % even pages may have a different offset if "\oddsidemargin"
33801 % and "\evensidemargin" have different values, it is necessary
33802 % to have two separate commands for odd and even pages.
33803 % First the odd pages.
33804 % \begin{macrocode}
33805 \newcommand*{\computeleftedgeodd}[1]{%
33806 \setlength{#1}{-1in}%
33807 \addtolength{#1}{-\hoffset}%
33808 \addtolength{#1}{-\oddsidemargin}%
33809 }
33810 % \end{macrocode}
33811 %\end{macro}
33812 %\begin{macro}{\computeleftedgeeven}
33813 % Now for the even pages
33814 % \begin{macrocode}
33815 \newcommand*{\computeleftedgeeven}[1]{%
33816 \setlength{#1}{-1in}%
33817 \addtolength{#1}{-\hoffset}%
33818 \addtolength{#1}{-\evensidemargin}%
33819 }
33820 % \end{macrocode}
33821 %\end{macro}
33822 %\begin{macro}{\computetopedge}
33823 % Compute the top edge of the page, relative to the bottom of
33824 % the \gls{typeblock}.
33825 % \begin{macrocode}
33826 \newcommand*{\computetopedge}[1]{%
33827 \setlength{#1}{\textheight}%
33828 \addtolength{#1}{\headheight}%
33829 \addtolength{#1}{\headsep}%
33830 \addtolength{#1}{1in}%
33831 \addtolength{#1}{\voffset}%
33832 \addtolength{#1}{\topmargin}%
33833 }
33834 % \end{macrocode}
33835 %\end{macro}
33836 %\begin{macro}{\computebottomedge}
33837 % Compute the bottom edge of the page, relative to the bottom
33838 % of the \gls{typeblock}.
33839 % \begin{macrocode}
33840 \newcommand*{\computebottomedge}[1]{%
33841 \computetopedge{#1}%
33842 \addtolength{#1}{-\paperheight}%
33843 }
33844 % \end{macrocode}
33845 %\end{macro}
33846 %\begin{macro}{\computerightedgeodd}
33847 % Compute the right edge of the page, relative to the left edge
33848 % of the \gls{typeblock}. Again, two commands are needed for odd
33849 % and even pages. First the odd pages.
33850 % \begin{macrocode}
33851 \newcommand*{\computerightedgeodd}[1]{%
33852 \computeleftedgeodd{#1}%
33853 \addtolength{#1}{\paperwidth}%
33854 }
33855 % \end{macrocode}
33856 %\end{macro}
33857 %\begin{macro}{\computerightedgeeven}
33858 % Now for the even pages.
33859 % \begin{macrocode}
33860 \newcommand*{\computerightedgeeven}[1]{%
33861 \computeleftedgeeven{#1}%
33862 \addtolength{#1}{\paperwidth}%
33863 }
33864 % \end{macrocode}
33865 %\end{macro}
33866 % Compute the minimum area surrounding the listed \glspl{flow}.
33867 % Values stored in "\ffareawidth", "\ffareaheight", "\ffareax"
33868 % and "\ffareay"
33869 % \begin{macrocode}
33870 \newlength\ffareawidth
33871 \newlength\ffareaheight
33872 \newlength\ffareax
33873 \newlength\ffareay
33874 \newlength\ffareaevenx
33875 \newlength\ffareaeveny
33876 % \end{macrocode}
33877 %\begin{macro}{\computeflowframearea}
33878 % Starred version identifies frame by \gls{idl}, unstarred
33879 % version identifies frame by \gls{idn}.
33880 % \begin{macrocode}
33881 \newcommand*{\computeflowframearea}{%
33882 \@ifstar\@scomputeffarea\@computeffarea
33883 }
33884 % \end{macrocode}
33885 %\end{macro}
33886 %\begin{macro}{\@scomputeffarea}
33887 % Starred version.
33888 % \begin{macrocode}
33889 \newcommand*{\@scomputeffarea}[1]{%
33890 \setlength{\ffareax}{\paperwidth}%
33891 \setlength{\ffareay}{\paperheight}%
33892 \setlength{\@ff@tmp@x}{0pt}%
33893 \setlength{\@ff@tmp@y}{0pt}%
33894 \@for\@ff@id:=#1\do{%
33895 \@flowframeid{\@ff@id}%
33896 % \end{macrocode}
33897 %\cs{ff@id} is the IDN
33898 % \begin{macrocode}
33899 \ifnum\ffareax>\flowframex{\ff@id}%
33900 \setlength{\ffareax}{\flowframex{\ff@id}}%
33901 \fi
33902 \ifnum\ffareay>\flowframey{\ff@id}%
33903 \setlength{\ffareay}{\flowframey{\ff@id}}%
33904 \fi
33905 \setlength{\@ff@offset}{\flowframex{\ff@id}}%
33906 \addtolength{@ff@offset}{\flowframewidth{\ff@id}}%
33907 \ifnum\@ff@tmp@x<\@ff@offset
33908 \setlength{\@ff@tmp@x}{\@ff@offset}%
33909 \fi
33910 \setlength{\@ff@offset}{\flowframey{\ff@id}}%
33911 \addtolength{@ff@offset}{\flowframeheight{\ff@id}}%
33912 \ifnum\@ff@tmp@y<\@ff@offset
33913 \setlength{\@ff@tmp@y}{\@ff@offset}%
33914 \fi
33915 }%
33916 \setlength{\ffareawidth}{\@ff@tmp@x}%
33917 \addtolength{\ffareawidth}{-\ffareax}%
33918 \setlength{\ffareaheight}{\@ff@tmp@y}%
33919 \addtolength{\ffareaheight}{-\ffareay}%
33920 }
33921 % \end{macrocode}
33922 %\end{macro}
33923 %\begin{macro}{\@computeffarea}
33924 % Unstarred version.
33925 % \begin{macrocode}
33926 \newcommand*{\@computeffarea}[1]{%
33927 \setlength{\ffareax}{\paperwidth}%
33928 \setlength{\ffareay}{\paperheight}%
33929 \setlength{\@ff@tmp@x}{0pt}%
33930 \setlength{\@ff@tmp@y}{0pt}%
33931 \@for\@ff@id:=#1\do{%
33932 \ff@id=\@ff@id\relax
33933 \setlength{\@ff@offset}{\flowframex{\ff@id}}%
33934 \ifdim\ffareax>\@ff@offset
33935 \setlength{\ffareax}{\@ff@offset}%
33936 \fi
33937 \setlength{\@ff@offset}{\flowframey{\ff@id}}%
33938 \ifdim\ffareay>\@ff@offset
33939 \setlength{\ffareay}{\@ff@offset}%
33940 \fi
33941 \setlength{\@ff@offset}{\flowframex{\ff@id}}%
33942 \addtolength{\@ff@offset}{\flowframewidth{\ff@id}}%
33943 \ifdim\@ff@tmp@x<\@ff@offset
33944 \setlength{\@ff@tmp@x}{\@ff@offset}%
33945 \fi
33946 \setlength{\@ff@offset}{\flowframey{\ff@id}}%
33947 \addtolength{\@ff@offset}{\flowframeheight{\ff@id}}%
33948 \ifdim\@ff@tmp@y<\@ff@offset
33949 \setlength{\@ff@tmp@y}{\@ff@offset}%
33950 \fi
33951 }%
33952 \setlength{\ffareawidth}{\@ff@tmp@x}%
33953 \addtolength{\ffareawidth}{-\ffareax}%
33954 \setlength{\ffareaheight}{\@ff@tmp@y}%
33955 \addtolength{\ffareaheight}{-\ffareay}%
33956 }
33957 % \end{macrocode}
33958 %\end{macro}
33959 %\begin{macro}{\@ff@swaplen}
33960 % Swap the values of two lengths
33961 % \begin{macrocode}
33962 \newcommand*{\@ff@swaplen}[2]{%
33963 \setlength{\@ff@tmp@x}{#1}%
33964 \setlength{#1}{#2}%
33965 \setlength{#2}{\@ff@tmp@x}%
33966 }
33967 % \end{macrocode}
33968 %\end{macro}
33969 %
33970 %\begin{macro}{\@ff@getdim}
33971 % Get the dimensions for the given type of frame.
33972 % The first parameter should be a number indictating
33973 % type of frame : 1 (flow), 2 (static), 3 (dynamic).
33974 % The second number is its \gls{idn}. Values are stored in
33975 % "\ffareax", "\ffareay", "\ffareawidth" and "\ffareaheight".
33976 % \begin{macrocode}
33977 \newcommand*{\@ff@getdim}[2]{%
33978 \ifnum#2<1\relax
33979 \PackageError{flowfram}%
33980 {Frame IDNs start from 1}%
33981 {%
33982 You have specified a frame IDN of '\number#2'%
33983 }%
33984 \fi
33985 \ifcase#1\relax
33986 \PackageError{flowfram}%
33987 {Unknown frame ID type '#1'}%
33988 {%
33989 Frame ID types are: 1 (flow), 2 (static) and 3 (dynamic)%
33990 }%
33991 \or
33992 % \end{macrocode}
33993 % Flow frame
33994 % \begin{macrocode}
33995 \ifnum#2>\c@maxflow\relax
33996 \PackageError{flowfram}{Invalid flow frame IDN '\number#2'}{%
33997 Flow frame IDNs go from 1 to \number\c@maxflow}%
33998 \else
33999 \setlength{\ffareax}{\flowframex{#2}}%
34000 \setlength{\ffareay}{\flowframey{#2}}%
34001 \setlength{\ffareaevenx}{\flowframeevenx{#2}}%
34002 \setlength{\ffareaeveny}{\flowframeeveny{#2}}%
34003 \setlength{\ffareawidth}{\flowframewidth{#2}}%
34004 \setlength{\ffareaheight}{\flowframeheight{#2}}%
34005 \fi
34006 \or
34007 % \end{macrocode}
34008 % Static frame
34009 % \begin{macrocode}
34010 \ifnum#2>\c@maxstatic\relax
34011 \PackageError{flowfram}%
34012 {Invalid static frame IDN '\number#2'}%
34013 {%
34014 Static frame IDNs go from 1 to \number\c@maxstatic
34015 }%
34016 \else
34017 \setlength{\ffareax}{\staticframex{#2}}%
34018 \setlength{\ffareay}{\staticframey{#2}}%
34019 \setlength{\ffareaevenx}{\staticframeevenx{#2}}%
34020 \setlength{\ffareaeveny}{\staticframeeveny{#2}}%
34021 \expandafter\expandafter\expandafter
34022 \@ff@getstaticpos
34023 \csname @sf@dim@\romannumeral#2\endcsname
34024 \setlength{\ffareawidth}{\@ff@tmp@x}%
34025 \setlength{\ffareaheight}{\@ff@tmp@y}%
34026 \fi
34027 \or
34028 % \end{macrocode}
34029 % Dynamic frame
34030 % \begin{macrocode}
34031 \ifnum#2>\c@maxdynamic\relax
34032 \PackageError{flowfram}%
34033 {Invalid dynamic frame IDN '\number#2'}%
34034 {%
34035 Dynamic frame IDNs go from 1 to \number\c@maxdynamic
34036 }%
34037 \else
34038 \setlength{\ffareax}{\dynamicframex{#2}}%
34039 \setlength{\ffareay}{\dynamicframey{#2}}%
34040 \setlength{\ffareaevenx}{\dynamicframeevenx{#2}}%
34041 \setlength{\ffareaeveny}{\dynamicframeeveny{#2}}%
34042 \expandafter\expandafter\expandafter
34043 \@ff@getstaticpos
34044 \csname @df@dim@\romannumeral#2\endcsname
34045 \setlength{\ffareawidth}{\@ff@tmp@x}%
34046 \setlength{\ffareaheight}{\@ff@tmp@y}%
34047 \fi
34048 \else
34049 \PackageError{flowfram}%
34050 {Unknown frame ID type '#1'}%
34051 {%
34052 Frame ID types are: 1 (flow), 2 (static) and 3 (dynamic)%
34053 }%
34054 \fi
34055 }
34056 % \end{macrocode}
34057 %\end{macro}
34058 %
34059 %\begin{macro}{\@ff@getevendim}
34060 %\changes{1.11}{2008/06/27}{new}
34061 % Get the dimensions for the given type of frame on even pages.
34062 % The first parameter should be a number indictating
34063 % type of frame : 1 (flow), 2 (static), 3 (dynamic).
34064 % The second number is its \gls{idn}. Values are stored in
34065 % "\ffareax", "\ffareay", "\ffareawidth" and "\ffareaheight".
34066 % \begin{macrocode}
34067 \newcommand*{\@ff@getevendim}[2]{%
34068 \ifnum#2<1\relax
34069 \PackageError{flowfram}%
34070 {Frame IDNs start from 1}%
34071 {%
34072 You have specified a frame IDN of '\number#2'%
34073 }%
34074 \fi
34075 \ifcase#1\relax
34076 \PackageError{flowfram}%
34077 {Unknown frame ID type '#1'}%
34078 {%
34079 Frame ID types are: 1 (flow), 2 (static) and 3 (dynamic)%
34080 }
34081 \or
34082 % \end{macrocode}
34083 % Flow frame
34084 % \begin{macrocode}
34085 \ifnum#2>\c@maxflow
34086 \PackageError{flowfram}%
34087 {Invalid flow frame IDN '\number#2'}%
34088 {%
34089 Flow frame IDNs go from 1 to \number\c@maxflow
34090 }%
34091 \else
34092 \setlength{\ffareax}{\flowframeevenx{#2}}%
34093 \setlength{\ffareay}{\flowframeeveny{#2}}%
34094 \setlength{\ffareawidth}{\flowframewidth{#2}}%
34095 \setlength{\ffareaheight}{\flowframeheight{#2}}%
34096 \fi
34097 \or
34098 % \end{macrocode}
34099 % Static frame
34100 % \begin{macrocode}
34101 \ifnum#2>\c@maxstatic\relax
34102 \PackageError{flowfram}%
34103 {Invalid static frame IDN '\number#2'}%
34104 {%
34105 Static frame IDNs go from 1 to \number\c@maxstatic
34106 }%
34107 \else
34108 \setlength{\ffareax}{\staticframeevenx{#2}}%
34109 \setlength{\ffareay}{\staticframeeveny{#2}}%
34110 \expandafter\expandafter\expandafter
34111 \@ff@getstaticpos
34112 \csname @sf@dim@\romannumeral#2\endcsname
34113 \setlength{\ffareawidth}{\@ff@tmp@x}%
34114 \setlength{\ffareaheight}{\@ff@tmp@y}%
34115 \fi
34116 \or
34117 % \end{macrocode}
34118 % Dynamic frame
34119 % \begin{macrocode}
34120 \ifnum#2>\c@maxdynamic\relax
34121 \PackageError{flowfram}%
34122 {Invalid dynamic frame IDN '\number#2'}%
34123 {%
34124 Dynamic frame IDNs go from 1 to \number\c@maxdynamic
34125 }%
34126 \else
34127 \setlength{\ffareax}{\dynamicframeevenx{#2}}%
34128 \setlength{\ffareay}{\dynamicframeeveny{#2}}%
34129 \expandafter\expandafter\expandafter
34130 \@ff@getstaticpos
34131 \csname @df@dim@\romannumeral#2\endcsname
34132 \setlength{\ffareawidth}{\@ff@tmp@x}%
34133 \setlength{\ffareaheight}{\@ff@tmp@y}%
34134 \fi
34135 \else
34136 \PackageError{flowfram}%
34137 {Unknown frame ID type '#1'}%
34138 {%
34139 Frame ID types are: 1 (flow), 2 (static) and 3 (dynamic)%
34140 }%
34141 \fi
34142 }
34143 % \end{macrocode}
34144 %\end{macro}
34145 %
34146 %\begin{macro}{\getstaticbounds}
34147 % Convenience method for calling the above. Firstly for static
34148 % frames:
34149 % \begin{macrocode}
34150 \newcommand*{\getstaticbounds}{%
34151 \@ifstar\@sgetstaticbounds\@getstaticbounds
34152 }
34153 % \end{macrocode}
34154 %\end{macro}
34155 %\begin{macro}{\@sgetstaticbounds}
34156 % Starred version (specify by \gls{idl}):
34157 % \begin{macrocode}
34158 \newcommand*{\@sgetstaticbounds}[1]{%
34159 \@staticframeid{#1}\@getstaticbounds{\ff@id}%
34160 }
34161 % \end{macrocode}
34162 %\end{macro}
34163 %\begin{macro}{\@getstaticbounds}
34164 % Unstarred version (specify by \gls{idn}):
34165 %\changes{1.11}{2008/06/27}{fixed bug: changed frame id from
34166 % 1 to 2 (thanks to Lutz Goldmann for pointing it out)}
34167 % \begin{macrocode}
34168 \newcommand*{\@getstaticbounds}[1]{\@ff@getdim{2}{#1}}
34169 % \end{macrocode}
34170 %\end{macro}
34171 %
34172 %\begin{macro}{\getstaticevenbounds}
34173 %\changes{1.11}{2008/06/27}{new}
34174 % Even pages
34175 % \begin{macrocode}
34176 \newcommand*{\getstaticevenbounds}{%
34177 \@ifstar\@sgetstaticevenbounds\@getstaticevenbounds
34178 }
34179 % \end{macrocode}
34180 %\end{macro}
34181 %\begin{macro}{\@sgetstaticevenbounds}
34182 % Starred version (specify by \gls{idl}):
34183 % \begin{macrocode}
34184 \newcommand*{\@sgetstaticevenbounds}[1]{%
34185 \@staticframeid{#1}\@getstaticevenbounds{\ff@id}%
34186 }
34187 % \end{macrocode}
34188 %\end{macro}
34189 %\begin{macro}{\@getstaticevenbounds}
34190 %\changes{1.11}{2008/06/27}{new}
34191 % Unstarred version (specify by \gls{idn}):
34192 % \begin{macrocode}
34193 \newcommand*{\@getstaticevenbounds}[1]{\@ff@getevendim{2}{#1}}
34194 % \end{macrocode}
34195 %\end{macro}
34196 %
34197 %\begin{macro}{\getflowbounds}
34198 % Next flow frames:
34199 % \begin{macrocode}
34200 \newcommand*{\getflowbounds}{%
34201 \@ifstar\@sgetflowbounds\@getflowbounds
34202 }
34203 % \end{macrocode}
34204 %\end{macro}
34205 %\begin{macro}{\@sgetflowbounds}
34206 % Starred version (specify by \gls{idl}):
34207 % \begin{macrocode}
34208 \newcommand*{\@sgetflowbounds}[1]{%
34209 \@flowframeid{#1}\@getflowbounds{\ff@id}%
34210 }
34211 % \end{macrocode}
34212 %\end{macro}
34213 %\begin{macro}{\@getflowbounds}
34214 % Unstarred version (specify by \gls{idn}):
34215 %\changes{1.11}{2008/06/27}{fixed bug: changed frame id from
34216 % 2 to 1 (thanks to Lutz Goldmann for pointing it out)}
34217 % \begin{macrocode}
34218 \newcommand*{\@getflowbounds}[1]{\@ff@getdim{1}{#1}}
34219 % \end{macrocode}
34220 %\end{macro}
34221 %\begin{macro}{\getflowevenbounds}
34222 %\changes{1.11}{2008/06/27}{new}
34223 % Even pages:
34224 % \begin{macrocode}
34225 \newcommand*{\getflowevenbounds}{%
34226 \@ifstar\@sgetflowevenbounds\@getflowevenbounds
34227 }
34228 % \end{macrocode}
34229 %\end{macro}
34230 %\begin{macro}{\@sgetflowevenbounds}
34231 %\changes{1.11}{2008/06/27}{new}
34232 % Starred version (specify by \gls{idl}):
34233 % \begin{macrocode}
34234 \newcommand*{\@sgetflowevenbounds}[1]{%
34235 \@flowframeid{#1}\@getflowevenbounds{\ff@id}%
34236 }
34237 % \end{macrocode}
34238 %\end{macro}
34239 %\begin{macro}{\@getflowevenbounds}
34240 %\changes{1.11}{2008/06/27}{new}
34241 % Unstarred version (specify by \gls{idn}):
34242 % \begin{macrocode}
34243 \newcommand*{\@getflowevenbounds}[1]{\@ff@getevendim{1}{#1}}
34244 % \end{macrocode}
34245 %\end{macro}
34246 %
34247 %\begin{macro}{\getdynamicbounds}
34248 % Next dynamic frames:
34249 % \begin{macrocode}
34250 \newcommand*{\getdynamicbounds}{%
34251 \@ifstar\@sgetdynamicbounds\@getdynamicbounds
34252 }
34253 % \end{macrocode}
34254 %\end{macro}
34255 %\begin{macro}{\@sgetdynamicbounds}
34256 % Starred version (specify by \gls{idl}):
34257 % \begin{macrocode}
34258 \newcommand*{\@sgetdynamicbounds}[1]{%
34259 \@dynamicframeid{#1}\@getdynamicbounds{\ff@id}%
34260 }
34261 % \end{macrocode}
34262 %\end{macro}
34263 %\begin{macro}{\@getdynamicbounds}
34264 % Unstarred version (specify by \gls{idn}):
34265 % \begin{macrocode}
34266 \newcommand*{\@getdynamicbounds}[1]{\@ff@getdim{3}{#1}}
34267 % \end{macrocode}
34268 %\end{macro}
34269 %
34270 %\begin{macro}{\getdynamicevenbounds}
34271 % Even pages:
34272 % \begin{macrocode}
34273 \newcommand*{\getdynamicevenbounds}{%
34274 \@ifstar\@sgetdynamicevenbounds\@getdynamicevenbounds
34275 }
34276 % \end{macrocode}
34277 %\end{macro}
34278 %\begin{macro}{\@sgetdynamicevenbounds}
34279 % Starred version (specify by \gls{idl}):
34280 % \begin{macrocode}
34281 \newcommand*{\@sgetdynamicevenbounds}[1]{%
34282 \@dynamicframeid{#1}\@getdynamicevenbounds{\ff@id}%
34283 }
34284 % \end{macrocode}
34285 %\end{macro}
34286 %\begin{macro}{\@getdynamicevenbounds}
34287 % Unstarred version (specify by \gls{idn}):
34288 % \begin{macrocode}
34289 \newcommand*{\@getdynamicevenbounds}[1]{\@ff@getevendim{3}{#1}}
34290 % \end{macrocode}
34291 %\end{macro}
34292 %
34293 % \subsection{Determining the relative location of one frame from
34294 % another}
34295 %\changes{1.11}{2008/06/27}{added relative location commands}
34296 % The commands in this section set the following boolean variables:
34297 % \begin{macrocode}
34298 \newif\ifFLFabove
34299 \newif\ifFLFbelow
34300 \newif\ifFLFleft
34301 \newif\ifFLFright
34302 % \end{macrocode}
34303 % These can then be used after one of the \cs{checkifframe}\meta{loc}
34304 % commands defined below.
34305 %
34306 %\begin{macro}{\checkifframeabove}
34307 %\changes{1.11}{2008/06/27}{new}
34308 %\cs{checkifframeabove}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
34309 %
34310 % Checks if the first frame is above the second frame where the
34311 % first frame is of type \meta{type1} with \gls{idn} given by
34312 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
34313 % given by \meta{id2}. The starred version uses the \gls{idl} instead
34314 % of the \gls{idn}. The first frame is not considered to be above the
34315 % second frame if they overlap. This code checks the page number to
34316 % determine whether to use \cs{oddcheckifframeabove} or
34317 % \cs{evencheckifframeabove} so it should not be used in the
34318 % first paragraph of the first \gls{flow} on the page if the paragraph
34319 % spans the page break.
34320 % \begin{macrocode}
34321 \newcommand*{\checkifframeabove}{%
34322 \@ifstar\@scheckifframeabove\@checkifframeabove
34323 }
34324 % \end{macrocode}
34325 % Starred version:
34326 % \begin{macrocode}
34327 \newcommand*{\@scheckifframeabove}[4]{%
34328 \ifodd\c@page
34329 \@soddcheckifframeabove{#1}{#2}{#3}{#4}%
34330 \else
34331 \@sevencheckifframeabove{#1}{#2}{#3}{#4}%
34332 \fi
34333 }
34334 % \end{macrocode}
34335 % Unstarred version:
34336 % \begin{macrocode}
34337 \newcommand*{\@checkifframeabove}[4]{%
34338 \ifodd\c@page
34339 \@oddcheckifframeabove{#1}{#2}{#3}{#4}%
34340 \else
34341 \@evencheckifframeabove{#1}{#2}{#3}{#4}%
34342 \fi
34343 }
34344 % \end{macrocode}
34345 %\end{macro}
34346 %
34347 %\begin{macro}{\oddcheckifframeabove}
34348 %\changes{1.11}{2008/06/27}{new}
34349 %\cs{oddcheckifframeabove}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
34350 % Checks if the first frame is above the second frame where the
34351 % first frame is of type \meta{type1} with \gls{idn} given by
34352 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
34353 % given by \meta{id2} for odd pages. The starred version uses the \gls{idl} instead
34354 % of the \gls{idn}. The first frame is not considered to be above the
34355 % second frame if they overlap.
34356 % \begin{macrocode}
34357 \newcommand*{\oddcheckifframeabove}{%
34358 \@ifstar\@soddcheckifframeabove\@oddcheckifframeabove
34359 }
34360 % \end{macrocode}
34361 % The starred version
34362 % \begin{macrocode}
34363 \newcommand*{\@soddcheckifframeabove}[4]{%
34364 \@ifundefined{@sget#1bounds}%
34365 {%
34366 \PackageError{flowfram}%
34367 {Unknown frame type `#1'}%
34368 {%
34369 Frame types may only be one of: static, dynamic or flow%
34370 }%
34371 }%
34372 {}%
34373 \csname @sget#1bounds\endcsname{#2}%
34374 \edef\@ff@check{\the\ffareay}%
34375 \@ifundefined{@sget#3bounds}%
34376 {%
34377 \PackageError{flowfram}%
34378 {Unknown frame type `#3'}%
34379 {%
34380 Frame types may only be one of: static, dynamic or flow%
34381 }%
34382 }%
34383 {}%
34384 \csname @sget#3bounds\endcsname{#4}%
34385 \advance\ffareay by \ffareaheight\relax
34386 \expandafter\ifdim\@ff@check>\ffareay
34387 \FLFabovetrue
34388 \else
34389 \FLFabovefalse
34390 \fi
34391 }
34392 % \end{macrocode}
34393 % The unstarred version
34394 % \begin{macrocode}
34395 \newcommand*{\@oddcheckifframeabove}[4]{%
34396 \@ifundefined{@get#1bounds}%
34397 {%
34398 \PackageError{flowfram}%
34399 {Unknown frame type `#1'}%
34400 {%
34401 Frame types may only be one of: static, dynamic or
34402 flow%
34403 }%
34404 }%
34405 {}%
34406 \csname @get#1bounds\endcsname{#2}%
34407 \edef\@ff@check{\the\ffareay}%
34408 \@ifundefined{@get#3bounds}%
34409 {%
34410 \PackageError{flowfram}%
34411 {Unknown frame type `#3'}%
34412 {%
34413 Frame types may only be one of: static, dynamic or
34414 flow%
34415 }%
34416 }%
34417 {}%
34418 \csname @get#3bounds\endcsname{#4}%
34419 \advance\ffareay by \ffareaheight\relax
34420 \expandafter\ifdim\@ff@check>\ffareay
34421 \FLFabovetrue
34422 \else
34423 \FLFabovefalse
34424 \fi
34425 }
34426 % \end{macrocode}
34427 %\end{macro}
34428 %
34429 %\begin{macro}{\checkifframebelow}
34430 %\changes{1.11}{2008/06/27}{new}
34431 %\cs{checkifframebelow}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
34432 % Checks if the first frame is below the second frame where the
34433 % first frame is of type \meta{type1} with \gls{idn} given by
34434 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
34435 % given by \meta{id2}. The starred version uses the \gls{idl} instead
34436 % of the \gls{idn}. The first frame is not considered to be below the
34437 % second frame if they overlap. This code checks the page number to
34438 % determine whether to use \cs{oddcheckifframebelow} or
34439 % \cs{evencheckifframebelow} so it should not be used in the
34440 % first paragraph of the first \gls{flow} on the page if the paragraph
34441 % spans the page break.
34442 % \begin{macrocode}
34443 \newcommand*{\checkifframebelow}{%
34444 \@ifstar\@scheckifframebelow\@checkifframebelow
34445 }
34446 % \end{macrocode}
34447 % Starred version:
34448 % \begin{macrocode}
34449 \newcommand*{\@scheckifframebelow}[4]{%
34450 \ifodd\c@page
34451 \@soddcheckifframebelow{#1}{#2}{#3}{#4}%
34452 \else
34453 \@sevencheckifframebelow{#1}{#2}{#3}{#4}%
34454 \fi
34455 }
34456 % \end{macrocode}
34457 % Unstarred version:
34458 % \begin{macrocode}
34459 \newcommand*{\@checkifframebelow}[4]{%
34460 \ifodd\c@page
34461 \@oddcheckifframebelow{#1}{#2}{#3}{#4}%
34462 \else
34463 \@evencheckifframebelow{#1}{#2}{#3}{#4}%
34464 \fi
34465 }
34466 % \end{macrocode}
34467 %\end{macro}
34468 %
34469 %\begin{macro}{\oddcheckifframebelow}
34470 %\changes{1.11}{2008/06/27}{new}
34471 %\cs{oddcheckifframebelow}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
34472 %
34473 % Checks if the first frame is below the second frame where the
34474 % first frame is of type \meta{type1} with \gls{idn} given by
34475 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
34476 % given by \meta{id2} on odd pages. The starred version uses the \gls{idl} instead
34477 % of the \gls{idn}. The first frame is not considered to be below the
34478 % second frame if they overlap.
34479 % \begin{macrocode}
34480 \newcommand*{\oddcheckifframebelow}{%
34481 \@ifstar\@soddcheckifframebelow\@oddcheckifframebelow
34482 }
34483 % \end{macrocode}
34484 % The starred version
34485 % \begin{macrocode}
34486 \newcommand*{\@soddcheckifframebelow}[4]{%
34487 \@ifundefined{@sget#1bounds}%
34488 {%
34489 \PackageError{flowfram}%
34490 {Unknown frame type `#1'}%
34491 {%
34492 Frame types may only be one of: static, dynamic or
34493 flow%
34494 }%
34495 }%
34496 {}%
34497 \csname @sget#1bounds\endcsname{#2}%
34498 \advance\ffareay by \ffareaheight\relax
34499 \edef\@ff@check{\the\ffareay}%
34500 \@ifundefined{@sget#3bounds}%
34501 {%
34502 \PackageError{flowfram}%
34503 {Unknown frame type `#3'}%
34504 {%
34505 Frame types may only be one of: static, dynamic or
34506 flow%
34507 }%
34508 }%
34509 {}%
34510 \csname @sget#3bounds\endcsname{#4}%
34511 \expandafter\ifdim\@ff@check<\ffareay
34512 \FLFbelowtrue
34513 \else
34514 \FLFbelowfalse
34515 \fi
34516 }
34517 % \end{macrocode}
34518 % The unstarred version
34519 % \begin{macrocode}
34520 \newcommand*{\@oddcheckifframebelow}[4]{%
34521 \@ifundefined{@get#1bounds}%
34522 {%
34523 \PackageError{flowfram}%
34524 {Unknown frame type `#1'}%
34525 {%
34526 Frame types may only be one of: static, dynamic or
34527 flow%
34528 }%
34529 }%
34530 {}%
34531 \csname @get#1bounds\endcsname{#2}%
34532 \advance\ffareay by \ffareaheight\relax
34533 \edef\@ff@check{\the\ffareay}%
34534 \@ifundefined{@get#3bounds}%
34535 {%
34536 \PackageError{flowfram}%
34537 {Unknown frame type `#3'}%
34538 {%
34539 Frame types may only be one of: static, dynamic or
34540 flow%
34541 }%
34542 }%
34543 {}%
34544 \csname @get#3bounds\endcsname{#4}%
34545 \expandafter\ifdim\@ff@check<\ffareay
34546 \FLFbelowtrue
34547 \else
34548 \FLFbelowfalse
34549 \fi
34550 }
34551 % \end{macrocode}
34552 %\end{macro}
34553 %
34554 %\begin{macro}{\checkifframeleft}
34555 %\changes{1.11}{2008/06/27}{new}
34556 %\cs{checkifframeleft}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
34557 % Checks if the first frame is to the left of the second frame where the
34558 % first frame is of type \meta{type1} with \gls{idn} given by
34559 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
34560 % given by \meta{id2}. The starred version uses the \gls{idl} instead
34561 % of the \gls{idn}. The first frame is not considered to be to the
34562 % left of the second frame if they overlap. This code checks the page number to
34563 % determine whether to use \cs{oddcheckifframeleft} or
34564 % \cs{evencheckifframeleft} so it should not be used in the
34565 % first paragraph of the first \gls{flow} on the page if the paragraph
34566 % spans the page break.
34567 % \begin{macrocode}
34568 \newcommand*{\checkifframeleft}{%
34569 \@ifstar\@scheckifframeleft\@checkifframeleft
34570 }
34571 % \end{macrocode}
34572 % Starred version:
34573 % \begin{macrocode}
34574 \newcommand*{\@scheckifframeleft}[4]{%
34575 \ifodd\c@page
34576 \@soddcheckifframeleft{#1}{#2}{#3}{#4}%
34577 \else
34578 \@sevencheckifframeleft{#1}{#2}{#3}{#4}%
34579 \fi
34580 }
34581 % \end{macrocode}
34582 % Unstarred version:
34583 % \begin{macrocode}
34584 \newcommand*{\@checkifframeleft}[4]{%
34585 \ifodd\c@page
34586 \@oddcheckifframeleft{#1}{#2}{#3}{#4}%
34587 \else
34588 \@evencheckifframeleft{#1}{#2}{#3}{#4}%
34589 \fi
34590 }
34591 % \end{macrocode}
34592 %\end{macro}
34593 %
34594 %\begin{macro}{\oddcheckifframeleft}
34595 %\changes{1.11}{2008/06/27}{new}
34596 %\cs{oddcheckifframeleft}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
34597 %
34598 % Checks if the first frame is to the left of the second frame where the
34599 % first frame is of type \meta{type1} with \gls{idn} given by
34600 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
34601 % given by \meta{id2} on odd pages. The starred version uses the \gls{idl} instead
34602 % of the \gls{idn}. The first frame is not considered to be to the
34603 % left of the second frame if they overlap.
34604 % \begin{macrocode}
34605 \newcommand*{\oddcheckifframeleft}{%
34606 \@ifstar\@soddcheckifframeleft\@oddcheckifframeleft
34607 }
34608 % \end{macrocode}
34609 % The starred version
34610 % \begin{macrocode}
34611 \newcommand*{\@soddcheckifframeleft}[4]{%
34612 \@ifundefined{@sget#1bounds}%
34613 {%
34614 \PackageError{flowfram}%
34615 {Unknown frame type `#1'}%
34616 {%
34617 Frame types may only be one of: static, dynamic or
34618 flow%
34619 }%
34620 }%
34621 {}%
34622 \csname @sget#1bounds\endcsname{#2}%
34623 \advance\ffareax by \ffareawidth\relax
34624 \edef\@ff@check{\the\ffareax}%
34625 \@ifundefined{@sget#3bounds}%
34626 {%
34627 \PackageError{flowfram}%
34628 {Unknown frame type `#3'}%
34629 {%
34630 Frame types may only be one of: static, dynamic or
34631 flow%
34632 }%
34633 }%
34634 {}%
34635 \csname @sget#3bounds\endcsname{#4}%
34636 \expandafter\ifdim\@ff@check<\ffareax
34637 \FLFlefttrue
34638 \else
34639 \FLFleftfalse
34640 \fi
34641 }
34642 % \end{macrocode}
34643 % The unstarred version
34644 % \begin{macrocode}
34645 \newcommand*{\@oddcheckifframeleft}[4]{%
34646 \@ifundefined{@get#1bounds}%
34647 {%
34648 \PackageError{flowfram}%
34649 {Unknown frame type `#1'}%
34650 {%
34651 Frame types may only be one of: static, dynamic or
34652 flow%
34653 }%
34654 }%
34655 {}%
34656 \csname @get#1bounds\endcsname{#2}%
34657 \advance\ffareax by \ffareawidth\relax
34658 \edef\@ff@check{\the\ffareax}%
34659 \@ifundefined{@get#3bounds}%
34660 {%
34661 \PackageError{flowfram}%
34662 {Unknown frame type `#3'}%
34663 {%
34664 Frame types may only be one of: static, dynamic or
34665 flow%
34666 }%
34667 }%
34668 {}%
34669 \csname @get#3bounds\endcsname{#4}%
34670 \expandafter\ifdim\@ff@check<\ffareax
34671 \FLFlefttrue
34672 \else
34673 \FLFleftfalse
34674 \fi
34675 }
34676 % \end{macrocode}
34677 %\end{macro}
34678 %
34679 %\begin{macro}{\checkifframeright}
34680 %\changes{1.11}{2008/06/27}{new}
34681 %\cs{checkifframeright}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
34682 % Checks if the first frame is to the right of the second frame where the
34683 % first frame is of type \meta{type1} with \gls{idn} given by
34684 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
34685 % given by \meta{id2}. The starred version uses the \gls{idl} instead
34686 % of the \gls{idn}. The first frame is not considered to be to the
34687 % right of the second frame if they overlap. This code checks the page number to
34688 % determine whether to use \cs{oddcheckifframeright} or
34689 % \cs{evencheckifframeright} so it should not be used in the
34690 % first paragraph of the first \gls{flow} on the page if the paragraph
34691 % spans the page break.
34692 % \begin{macrocode}
34693 \newcommand*{\checkifframeright}{%
34694 \@ifstar\@scheckifframeright\@checkifframeright
34695 }
34696 % \end{macrocode}
34697 % Starred version:
34698 % \begin{macrocode}
34699 \newcommand*{\@scheckifframeright}[4]{%
34700 \ifodd\c@page
34701 \@soddcheckifframeright{#1}{#2}{#3}{#4}%
34702 \else
34703 \@sevencheckifframeright{#1}{#2}{#3}{#4}%
34704 \fi
34705 }
34706 % \end{macrocode}
34707 % Unstarred version:
34708 % \begin{macrocode}
34709 \newcommand*{\@checkifframeright}[4]{%
34710 \ifodd\c@page
34711 \@oddcheckifframeright{#1}{#2}{#3}{#4}%
34712 \else
34713 \@evencheckifframeright{#1}{#2}{#3}{#4}%
34714 \fi
34715 }
34716 % \end{macrocode}
34717 %\end{macro}
34718 %
34719 %\begin{macro}{\oddcheckifframeright}
34720 %\changes{1.11}{2008/06/27}{new}
34721 %\cs{oddcheckifframeright}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
34722 %
34723 % Checks if the first frame is to the right of the second frame where the
34724 % first frame is of type \meta{type1} with \gls{idn} given by
34725 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
34726 % given by \meta{id2} on odd pages. The starred version uses the \gls{idl} instead
34727 % of the \gls{idn}. The first frame is not considered to be to the
34728 % right of the second frame if they overlap.
34729 % \begin{macrocode}
34730 \newcommand*{\oddcheckifframeright}{%
34731 \@ifstar\@soddcheckifframeright\@oddcheckifframeright
34732 }
34733 % \end{macrocode}
34734 % The starred version
34735 % \begin{macrocode}
34736 \newcommand*{\@soddcheckifframeright}[4]{%
34737 \@ifundefined{@sget#1bounds}%
34738 {%
34739 \PackageError{flowfram}%
34740 {Unknown frame type `#1'}%
34741 {%
34742 Frame types may only be one of: static, dynamic or
34743 flow%
34744 }%
34745 }%
34746 {}%
34747 \csname @sget#1bounds\endcsname{#2}%
34748 \edef\@ff@check{\the\ffareax}%
34749 \@ifundefined{@sget#3bounds}%
34750 {%
34751 \PackageError{flowfram}%
34752 {Unknown frame type `#3'}%
34753 {%
34754 Frame types may only be one of: static, dynamic or
34755 flow%
34756 }%
34757 }%
34758 {}%
34759 \csname @sget#3bounds\endcsname{#4}%
34760 \advance\ffareax by \ffareawidth\relax
34761 \expandafter\ifdim\@ff@check>\ffareax
34762 \FLFrighttrue
34763 \else
34764 \FLFrightfalse
34765 \fi
34766 }
34767 % \end{macrocode}
34768 % The unstarred version
34769 % \begin{macrocode}
34770 \newcommand*{\@oddcheckifframeright}[4]{%
34771 \@ifundefined{@get#1bounds}%
34772 {%
34773 \PackageError{flowfram}%
34774 {Unknown frame type `#1'}%
34775 {%
34776 Frame types may only be one of: static, dynamic or
34777 flow%
34778 }%
34779 }%
34780 {}%
34781 \csname @get#1bounds\endcsname{#2}%
34782 \edef\@ff@check{\the\ffareax}%
34783 \@ifundefined{@get#3bounds}%
34784 {%
34785 \PackageError{flowfram}%
34786 {Unknown frame type `#3'}%
34787 {%
34788 Frame types may only be one of: static, dynamic or
34789 flow%
34790 }%
34791 }%
34792 {}%
34793 \csname @get#3bounds\endcsname{#4}%
34794 \advance\ffareax by \ffareawidth\relax
34795 \expandafter\ifdim\@ff@check>\ffareax
34796 \FLFrighttrue
34797 \else
34798 \FLFrightfalse
34799 \fi
34800 }
34801 % \end{macrocode}
34802 %\end{macro}
34803 %
34804 %\begin{macro}{\evencheckifframeabove}
34805 %\changes{1.11}{2008/06/27}{new}
34806 %\cs{evencheckifframeabove}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
34807 % Checks if the first frame is above the second frame where the
34808 % first frame is of type \meta{type1} with \gls{idn} given by
34809 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
34810 % given by \meta{id2} for even pages.
34811 % The starred version uses the \gls{idl} instead
34812 % of the \gls{idn}. The first frame is not considered to be above the
34813 % second frame if they overlap.
34814 % \begin{macrocode}
34815 \newcommand*{\evencheckifframeabove}{%
34816 \@ifstar\@sevencheckifframeabove\@evencheckifframeabove
34817 }
34818 % \end{macrocode}
34819 % The starred version
34820 % \begin{macrocode}
34821 \newcommand*{\@sevencheckifframeabove}[4]{%
34822 \@ifundefined{@sget#1evenbounds}%
34823 {%
34824 \PackageError{flowfram}%
34825 {Unknown frame type `#1'}%
34826 {%
34827 Frame types may only be one of: static, dynamic or
34828 flow%
34829 }%
34830 }%
34831 {}%
34832 \csname @sget#1evenbounds\endcsname{#2}%
34833 \edef\@ff@check{\the\ffareay}%
34834 \@ifundefined{@sget#3evenbounds}%
34835 {%
34836 \PackageError{flowfram}%
34837 {Unknown frame type `#3'}%
34838 {%
34839 Frame types may only be one of: static, dynamic or
34840 flow%
34841 }%
34842 }%
34843 {}%
34844 \csname @sget#3evenbounds\endcsname{#4}%
34845 \advance\ffareay by \ffareaheight\relax
34846 \expandafter\ifdim\@ff@check>\ffareay
34847 \FLFabovetrue
34848 \else
34849 \FLFabovefalse
34850 \fi
34851 }
34852 % \end{macrocode}
34853 % The unstarred version
34854 % \begin{macrocode}
34855 \newcommand*{\@evencheckifframeabove}[4]{%
34856 \@ifundefined{@get#1evenbounds}%
34857 {%
34858 \PackageError{flowfram}%
34859 {Unknown frame type `#1'}%
34860 {%
34861 Frame types may only be one of: static, dynamic or
34862 flow%
34863 }%
34864 }%
34865 {}%
34866 \csname @get#1evenbounds\endcsname{#2}%
34867 \edef\@ff@check{\the\ffareay}%
34868 \@ifundefined{@get#3evenbounds}%
34869 {%
34870 \PackageError{flowfram}%
34871 {Unknown frame type `#3'}%
34872 {%
34873 Frame types may only be one of: static, dynamic or
34874 flow%
34875 }%
34876 }%
34877 {}%
34878 \csname @get#3evenbounds\endcsname{#4}%
34879 \advance\ffareay by \ffareaheight\relax
34880 \expandafter\ifdim\@ff@check>\ffareay
34881 \FLFabovetrue
34882 \else
34883 \FLFabovefalse
34884 \fi
34885 }
34886 % \end{macrocode}
34887 %\end{macro}
34888 %
34889 %\begin{macro}{\evencheckifframebelow}
34890 %\changes{1.11}{2008/06/27}{new}
34891 %\cs{checkifframebelow}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
34892 % Checks if the first frame is below the second frame where the
34893 % first frame is of type \meta{type1} with \gls{idn} given by
34894 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
34895 % given by \meta{id2}. The starred version uses the \gls{idl} instead
34896 % of the \gls{idn}. The first frame is not considered to be below the
34897 % second frame if they overlap.
34898 % \begin{macrocode}
34899 \newcommand*{\evencheckifframebelow}{%
34900 \@ifstar\@sevencheckifframebelow\@evencheckifframebelow
34901 }
34902 % \end{macrocode}
34903 % The starred version
34904 % \begin{macrocode}
34905 \newcommand*{\@sevencheckifframebelow}[4]{%
34906 \@ifundefined{@sget#1evenbounds}%
34907 {%
34908 \PackageError{flowfram}%
34909 {Unknown frame type `#1'}%
34910 {%
34911 Frame types may only be one of: static, dynamic or
34912 flow%
34913 }%
34914 }%
34915 {}%
34916 \csname @sget#1evenbounds\endcsname{#2}%
34917 \advance\ffareay by \ffareaheight\relax
34918 \edef\@ff@check{\the\ffareay}%
34919 \@ifundefined{@sget#3evenbounds}%
34920 {%
34921 \PackageError{flowfram}%
34922 {Unknown frame type `#3'}%
34923 {%
34924 Frame types may only be one of: static, dynamic or
34925 flow%
34926 }%
34927 }%
34928 {}%
34929 \csname @sget#3evenbounds\endcsname{#4}%
34930 \expandafter\ifdim\@ff@check<\ffareay
34931 \FLFbelowtrue
34932 \else
34933 \FLFbelowfalse
34934 \fi
34935 }
34936 % \end{macrocode}
34937 % The unstarred version
34938 % \begin{macrocode}
34939 \newcommand*{\@evencheckifframebelow}[4]{%
34940 \@ifundefined{@get#1evenbounds}%
34941 {%
34942 \PackageError{flowfram}%
34943 {Unknown frame type `#1'}%
34944 {%
34945 Frame types may only be one of: static, dynamic or
34946 flow%
34947 }%
34948 }{}%
34949 \csname @get#1evenbounds\endcsname{#2}%
34950 \advance\ffareay by \ffareaheight\relax
34951 \edef\@ff@check{\the\ffareay}%
34952 \@ifundefined{@get#3evenbounds}%
34953 {%
34954 \PackageError{flowfram}%
34955 {Unknown frame type `#3'}%
34956 {%
34957 Frame types may only be one of: static, dynamic or
34958 flow%
34959 }%
34960 }%
34961 {}%
34962 \csname @get#3evenbounds\endcsname{#4}%
34963 \expandafter\ifdim\@ff@check<\ffareay
34964 \FLFbelowtrue
34965 \else
34966 \FLFbelowfalse
34967 \fi
34968 }
34969 % \end{macrocode}
34970 %\end{macro}
34971 %
34972 %\begin{macro}{\evencheckifframeleft}
34973 %\changes{1.11}{2008/06/27}{new}
34974 %\cs{evencheckifframeleft}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
34975 % Checks if the first frame is to the left of the second frame where the
34976 % first frame is of type \meta{type1} with \gls{idn} given by
34977 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
34978 % given by \meta{id2}. The starred version uses the \gls{idl} instead
34979 % of the \gls{idn}. The first frame is not considered to be to the
34980 % left of the second frame if they overlap.
34981 % \begin{macrocode}
34982 \newcommand*{\evencheckifframeleft}{%
34983 \@ifstar\@sevencheckifframeleft\@evencheckifframeleft
34984 }
34985 % \end{macrocode}
34986 % The starred version
34987 % \begin{macrocode}
34988 \newcommand*{\@sevencheckifframeleft}[4]{%
34989 \@ifundefined{@sget#1evenbounds}%
34990 {%
34991 \PackageError{flowfram}%
34992 {Unknown frame type `#1'}%
34993 {%
34994 Frame types may only be one of: static, dynamic or
34995 flow%
34996 }%
34997 }%
34998 {}%
34999 \csname @sget#1evenbounds\endcsname{#2}%
35000 \advance\ffareax by \ffareawidth\relax
35001 \edef\@ff@check{\the\ffareax}%
35002 \@ifundefined{@sget#3evenbounds}%
35003 {%
35004 \PackageError{flowfram}%
35005 {Unknown frame type `#3'}%
35006 {%
35007 Frame types may only be one of: static, dynamic or
35008 flow%
35009 }%
35010 }%
35011 {}%
35012 \csname @sget#3evenbounds\endcsname{#4}%
35013 \expandafter\ifdim\@ff@check<\ffareax
35014 \FLFlefttrue
35015 \else
35016 \FLFleftfalse
35017 \fi
35018 }
35019 % \end{macrocode}
35020 % The unstarred version
35021 % \begin{macrocode}
35022 \newcommand*{\@evencheckifframeleft}[4]{%
35023 \@ifundefined{@get#1evenbounds}%
35024 {%
35025 \PackageError{flowfram}%
35026 {Unknown frame type `#1'}%
35027 {%
35028 Frame types may only be one of: static, dynamic or
35029 flow%
35030 }%
35031 }%
35032 {}%
35033 \csname @get#1evenbounds\endcsname{#2}%
35034 \advance\ffareax by \ffareawidth\relax
35035 \edef\@ff@check{\the\ffareax}%
35036 \@ifundefined{@get#3evenbounds}%
35037 {%
35038 \PackageError{flowfram}%
35039 {Unknown frame type `#3'}%
35040 {%
35041 Frame types may only be one of: static, dynamic or
35042 flow%
35043 }%
35044 }%
35045 {}%
35046 \csname @get#3evenbounds\endcsname{#4}%
35047 \expandafter\ifdim\@ff@check<\ffareax
35048 \FLFlefttrue
35049 \else
35050 \FLFleftfalse
35051 \fi
35052 }
35053 % \end{macrocode}
35054 %\end{macro}
35055 %
35056 %\begin{macro}{\evencheckifframeright}
35057 %\changes{1.11}{2008/06/27}{new}
35058 %\cs{evencheckifframeright}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
35059 % Checks if the first frame is to the right of the second frame where the
35060 % first frame is of type \meta{type1} with \gls{idn} given by
35061 % \meta{id1} and the second frame is of type \meta{type2} with \gls{idn}
35062 % given by \meta{id2}. The starred version uses the \gls{idl} instead
35063 % of the \gls{idn}. The first frame is not considered to be to the
35064 % right of the second frame if they overlap.
35065 % \begin{macrocode}
35066 \newcommand*{\evencheckifframeright}{%
35067 \@ifstar\@sevencheckifframeright\@evencheckifframeright
35068 }
35069 % \end{macrocode}
35070 % The starred version
35071 % \begin{macrocode}
35072 \newcommand*{\@sevencheckifframeright}[4]{%
35073 \@ifundefined{@sget#1evenbounds}%
35074 {%
35075 \PackageError{flowfram}%
35076 {Unknown frame type `#1'}%
35077 {%
35078 Frame types may only be one of: static, dynamic or
35079 flow%
35080 }%
35081 }%
35082 {}%
35083 \csname @sget#1evenbounds\endcsname{#2}%
35084 \edef\@ff@check{\the\ffareax}%
35085 \@ifundefined{@sget#3evenbounds}%
35086 {%
35087 \PackageError{flowfram}%
35088 {Unknown frame type `#3'}%
35089 {%
35090 Frame types may only be one of: static, dynamic or
35091 flow%
35092 }%
35093 }%
35094 {}%
35095 \csname @sget#3evenbounds\endcsname{#4}%
35096 \advance\ffareax by \ffareawidth\relax
35097 \expandafter\ifdim\@ff@check>\ffareax
35098 \FLFrighttrue
35099 \else
35100 \FLFrightfalse
35101 \fi
35102 }
35103 % \end{macrocode}
35104 % The unstarred version
35105 % \begin{macrocode}
35106 \newcommand*{\@evencheckifframeright}[4]{%
35107 \@ifundefined{@get#1evenbounds}%
35108 {%
35109 \PackageError{flowfram}%
35110 {Unknown frame type `#1'}%
35111 {%
35112 Frame types may only be one of: static, dynamic or
35113 flow%
35114 }%
35115 }%
35116 {}%
35117 \csname @get#1evenbounds\endcsname{#2}%
35118 \edef\@ff@check{\the\ffareax}%
35119 \@ifundefined{@get#3evenbounds}%
35120 {%
35121 \PackageError{flowfram}%
35122 {Unknown frame type `#3'}%
35123 {%
35124 Frame types may only be one of: static, dynamic or
35125 flow%
35126 }%
35127 }%
35128 {}%
35129 \csname @get#3evenbounds\endcsname{#4}%
35130 \advance\ffareax by \ffareawidth\relax
35131 \expandafter\ifdim\@ff@check>\ffareax
35132 \FLFrighttrue
35133 \else
35134 \FLFrightfalse
35135 \fi
35136 }
35137 % \end{macrocode}
35138 %\end{macro}
35139 %
35140 % Textual labels used to indicate relative location of one frame
35141 % to another.
35142 %\begin{macro}{\FFaboveleft}
35143 %\changes{1.11}{2008/06/27}{new}
35144 % \begin{macrocode}
35145 \newcommand*{\FFaboveleft}{above left}
35146 % \end{macrocode}
35147 %\end{macro}
35148 %\begin{macro}{\FFaboveright}
35149 %\changes{1.11}{2008/06/27}{new}
35150 % \begin{macrocode}
35151 \newcommand*{\FFaboveright}{above right}
35152 % \end{macrocode}
35153 %\end{macro}
35154 %\begin{macro}{\FFbelowleft}
35155 %\changes{1.11}{2008/06/27}{new}
35156 % \begin{macrocode}
35157 \newcommand*{\FFbelowleft}{below left}
35158 % \end{macrocode}
35159 %\end{macro}
35160 %\begin{macro}{\FFbelowright}
35161 %\changes{1.11}{2008/06/27}{new}
35162 % \begin{macrocode}
35163 \newcommand*{\FFbelowright}{below right}
35164 % \end{macrocode}
35165 %\end{macro}
35166 %\begin{macro}{\FFleft}
35167 %\changes{1.11}{2008/06/27}{new}
35168 % \begin{macrocode}
35169 \newcommand*{\FFleft}{on the left}
35170 % \end{macrocode}
35171 %\end{macro}
35172 %\begin{macro}{\FFbelowright}
35173 %\changes{1.11}{2008/06/27}{new}
35174 % \begin{macrocode}
35175 \newcommand*{\FFright}{on the right}
35176 % \end{macrocode}
35177 %\end{macro}
35178 %\begin{macro}{\FFabove}
35179 %\changes{1.11}{2008/06/27}{new}
35180 % \begin{macrocode}
35181 \newcommand*{\FFabove}{above}
35182 % \end{macrocode}
35183 %\end{macro}
35184 %\begin{macro}{\FFbelow}
35185 %\changes{1.11}{2008/06/27}{new}
35186 % \begin{macrocode}
35187 \newcommand*{\FFbelow}{below}
35188 % \end{macrocode}
35189 %\end{macro}
35190 %\begin{macro}{\FFoverlap}
35191 %\changes{1.11}{2008/06/27}{new}
35192 % \begin{macrocode}
35193 \newcommand*{\FFoverlap}{overlap}
35194 % \end{macrocode}
35195 %\end{macro}
35196 %
35197 %\begin{macro}{\relativeframelocation}
35198 %\changes{1.11}{2008/06/27}{new}
35199 %\cs{relativeframelocation}\marg{type1}\marg{id1}\marg{type2}\marg{id2}
35200 % Displays one of the above commands depending on the relative
35201 % locations of the first frame to the second frame. The arguments
35202 % \meta{id1} and \meta{id2} refer to the \gls{idn} for the unstarred
35203 % version and to the \gls{idl} for the starred version.
35204 % \begin{macrocode}
35205 \DeclareRobustCommand*{\relativeframelocation}{%
35206 \@ifstar\@srelativeframelocation\@relativeframelocation
35207 }
35208 % \end{macrocode}
35209 % Starred version:
35210 % \begin{macrocode}
35211 \newcommand*{\@srelativeframelocation}[4]{%
35212 \@scheckifframeabove{#1}{#2}{#3}{#4}%
35213 \@scheckifframebelow{#1}{#2}{#3}{#4}%
35214 \@scheckifframeleft{#1}{#2}{#3}{#4}%
35215 \@scheckifframeright{#1}{#2}{#3}{#4}%
35216 \ifFLFabove
35217 \ifFLFleft
35218 \FFaboveleft
35219 \else
35220 \ifFLFright
35221 \FFaboveright
35222 \else
35223 \FFabove
35224 \fi
35225 \fi
35226 \else
35227 \ifFLFbelow
35228 \ifFLFleft
35229 \FFbelowleft
35230 \else
35231 \ifFLFright
35232 \FFbelowright
35233 \else
35234 \FFbelow
35235 \fi
35236 \fi
35237 \else
35238 \ifFLFleft
35239 \FFleft
35240 \else
35241 \ifFLFright
35242 \FFright
35243 \else
35244 \FFoverlap
35245 \fi
35246 \fi
35247 \fi
35248 \fi
35249 }
35250 % \end{macrocode}
35251 % Unstarred version:
35252 % \begin{macrocode}
35253 \newcommand*{\@relativeframelocation}[4]{%
35254 \@checkifframeabove{#1}{#2}{#3}{#4}%
35255 \@checkifframebelow{#1}{#2}{#3}{#4}%
35256 \@checkifframeleft{#1}{#2}{#3}{#4}%
35257 \@checkifframeright{#1}{#2}{#3}{#4}%
35258 \ifFLFabove
35259 \ifFLFleft
35260 \FFaboveleft
35261 \else
35262 \ifFLFright
35263 \FFaboveright
35264 \else
35265 \FFabove
35266 \fi
35267 \fi
35268 \else
35269 \ifFLFbelow
35270 \ifFLFleft
35271 \FFbelowleft
35272 \else
35273 \ifFLFright
35274 \FFbelowright
35275 \else
35276 \FFbelow
35277 \fi
35278 \fi
35279 \else
35280 \ifFLFleft
35281 \FFleft
35282 \else
35283 \ifFLFright
35284 \FFright
35285 \else
35286 \FFoverlap
35287 \fi
35288 \fi
35289 \fi
35290 \fi
35291 }
35292 % \end{macrocode}
35293 %\end{macro}
35294 %
35295 % Short cut commands for \glspl{frame} of the same type.
35296 %\begin{macro}{\reldynamicloc}
35297 %\changes{1.11}{2008/06/27}{new}
35298 %\changes{1.14}{2012-11-10}{removed unwanted spaces}
35299 %\cs{reldynamicloc}\marg{id1}\marg{id2}
35300 % \begin{macrocode}
35301 \DeclareRobustCommand*{\reldynamicloc}{%
35302 \@ifstar\@sreldynamicloc\@reldynamicloc
35303 }
35304 % \end{macrocode}
35305 % Starred version:
35306 % \begin{macrocode}
35307 \newcommand*{\@sreldynamicloc}[2]{%
35308 \@srelativeframelocation{dynamic}{#1}{dynamic}{#2}%
35309 }
35310 % \end{macrocode}
35311 % Unstarred version:
35312 % \begin{macrocode}
35313 \newcommand*{\@reldynamicloc}[2]{%
35314 \@relativeframelocation{dynamic}{#1}{dynamic}{#2}%
35315 }
35316 % \end{macrocode}
35317 %\end{macro}
35318 %
35319 %\begin{macro}{\relstaticloc}
35320 %\changes{1.11}{2008/06/27}{new}
35321 %\changes{1.14}{2012-11-10}{removed unwanted spaces}
35322 %\cs{relstaticloc}\marg{id1}\marg{id2}
35323 % \begin{macrocode}
35324 \DeclareRobustCommand*{\relstaticloc}{%
35325 \@ifstar\@srelstaticloc\@relstaticloc
35326 }
35327 % \end{macrocode}
35328 % Starred version:
35329 % \begin{macrocode}
35330 \newcommand*{\@srelstaticloc}[2]{%
35331 \@srelativeframelocation{static}{#1}{static}{#2}%
35332 }
35333 % \end{macrocode}
35334 % Unstarred version:
35335 % \begin{macrocode}
35336 \newcommand*{\@relstaticloc}[2]{%
35337 \@relativeframelocation{static}{#1}{static}{#2}%
35338 }
35339 % \end{macrocode}
35340 %\end{macro}
35341 %
35342 %\begin{macro}{\relflowloc}
35343 %\changes{1.11}{2008/06/27}{new}
35344 %\changes{1.14}{2012-11-10}{removed unwanted spaces}
35345 %\cs{relflowloc}\marg{id1}\marg{id2}
35346 % \begin{macrocode}
35347 \DeclareRobustCommand*{\relflowloc}{%
35348 \@ifstar\@srelflowloc\@relflowloc
35349 }
35350 % \end{macrocode}
35351 % Starred version:
35352 % \begin{macrocode}
35353 \newcommand*{\@srelflowloc}[2]{%
35354 \@srelativeframelocation{flow}{#1}{flow}{#2}%
35355 }
35356 % \end{macrocode}
35357 % Unstarred version:
35358 % \begin{macrocode}
35359 \newcommand*{\@relflowloc}[2]{%
35360 \@relativeframelocation{flow}{#1}{flow}{#2}%
35361 }
35362 % \end{macrocode}
35363 %\end{macro}
35364 %
35365 %\subsection{Initialise Flow Frames}
35366 %\begin{macro}{\setinitialframe}
35367 % Specify initial frame. This should be the first flow
35368 % frame that is defined on the first page of the document.
35369 % Having another \gls{flow} as the initial frame is not
35370 % a good idea, and may have unexpected results.
35371 % \begin{macrocode}
35372 \newcommand*{\setinitialframe}[1]{%
35373 \c@thisframe=#1%
35374 \global\usedframebreaktrue
35375 \global\setlength{\hsize}
35376 {%
35377 \csname colwidth\romannumeral\c@thisframe\endcsname
35378 }%
35379 }
35380 % \end{macrocode}
35381 %\end{macro}
35382 %\begin{macro}{\setframes}
35383 % Set the initial frame.
35384 % \begin{macrocode}
35385 \newif\if@setfr@mes
35386 \@setfr@mesfalse
35387 \newcommand*{\setframes}{%
35388 \ifnum\c@thisframe=0\relax
35389 \PackageWarning{flowfram}%
35390 {Can't find a flow frame on page 1.
35391 \MessageBreak
35392 Attempting to find the first page with a flow frame%
35393 }%
35394 \@nxtcol=1\relax
35395 \c@curpg=1\relax
35396 \@g@tnextcol{\@nxtcol}%
35397 % \end{macrocode}
35398 % Shipout pages without flow frames.
35399 % \begin{macrocode}
35400 \advance\c@curpg by -1\relax
35401 \whiledo{\c@curpg>0}%
35402 {%
35403 \advance\c@curpg by -1\relax
35404 \setbox\@outputbox\vbox{\hbox to \textwidth{\@ff@do@allframes}}%
35405 \@outputpage
35406 }%
35407 \c@thisframe=\@nxtcol
35408 \fi
35409 \@setcol{\c@thisframe}\relax
35410 \@setfr@mestrue
35411 \edef\ff@txtcol{%
35412 \csname @ff@txtcol@\romannumeral\c@thisframe\endcsname}%
35413 \@s@tfftextcol
35414 }
35415 % \end{macrocode}
35416 %\end{macro}
35417 %\begin{macro}{\emulatetwocolumn}
35418 % Emulate original "\twocolumn" declaration.
35419 % This is provided for backward compatibility, and
35420 % may be removed in later versions.
35421 % \begin{macrocode}
35422 \newcommand{\emulatetwocolumn}[1][]{%
35423 \finishthispage
35424 \setallflowframes{pages=none}%
35425 \settoheight{\@ff@staticH}{#1}%
35426 \settodepth{\@ff@tmp@y}{#1}%
35427 \addtolength{\@ff@staticH}{\@ff@tmp@y}%
35428 \ifdim\@ff@staticH>0pt\relax
35429 \twocolumnStop[\@ff@pages@countreg]{\@ff@staticH}%
35430 \c@thisframe=\c@maxflow
35431 \advance\c@thisframe by -1\relax
35432 \@twocolumn[>\@ff@pages@countreg]%
35433 \setstaticcontents{\c@maxstatic}{#1}%
35434 \else
35435 \@twocolumn
35436 \c@thisframe=\c@maxflow
35437 \advance\c@thisframe by -1\relax
35438 \fi
35439 \@setcol{\c@thisframe}%
35440 \relax
35441 }
35442 % \end{macrocode}
35443 %\end{macro}
35444 %\begin{macro}{\emulateonecolumn}
35445 % Emulate original "\onecolumn" declaration.
35446 % This is provided for backward compatibility, and
35447 % may be removed in later versions.
35448 % \begin{macrocode}
35449 \newcommand{\emulateonecolumn}[1][]{%
35450 \finishthispage
35451 \setallflowframes{pages=none}%
35452 \settoheight{\@ff@staticH}{#1}%
35453 \settodepth{\@ff@tmp@y}{#1}%
35454 \addtolength{\@ff@staticH}{\@ff@tmp@y}%
35455 \ifdim\@ff@staticH>0pt\relax
35456 \onecolumnStop[\@ff@pages@countreg]{\@ff@staticH}%
35457 \c@thisframe=\c@maxflow
35458 \advance\c@thisframe by -1\relax
35459 \@onecolumn[>\@ff@pages@countreg]%
35460 \setstaticcontents{\c@maxstatic}{#1}%
35461 \else
35462 \@twocolumn
35463 \c@thisframe=\c@maxflow
35464 \advance\c@thisframe by -1\relax
35465 \fi
35466 \@setcol{\c@thisframe}%
35467 \relax
35468 }
35469 % \end{macrocode}
35470 %\end{macro}
35471 % If no flow frames have been defined, create one big one
35472 % the size of the \gls{typeblock}, and initialise the frames.
35473 % \begin{macrocode}
35474 \AtBeginDocument{%
35475 \c@absolutepage=1\relax
35476 \ifnum\c@maxflow=0\relax
35477 \PackageWarning{flowfram}{No flow frames, adding one}%
35478 \@onecolumn
35479 \fi
35480 \setframes
35481 \renewcommand{\onecolumn}[1][]{%
35482 \PackageWarning{flowfram}%
35483 {%
35484 Ignoring \string\onecolumn\space found in document environment.
35485 Frames must be defined in the preamble%
35486 }%
35487 #1%
35488 }%
35489 \renewcommand{\twocolumn}[1][]{%
35490 \PackageWarning{flowfram}%
35491 {%
35492 Ignoring \string\twocolumn\space found in document environment.
35493 Frames must be defined in the preamble}%
35494 #1%
35495 }%
35496 }
35497 % \end{macrocode}
35498 %
35499 %\subsection{Output Routine}
35500 %
35501 %\begin{macro}{\fftolerance}
35502 % The \sty{flowfram} package does a check to see if text has
35503 % flowed between frames of different widths, which will cause a
35504 % discrepancy in the line widths of the paragraph spanning the break.
35505 % Before version~1.14, the output routine just checked if the widths
35506 % were different, but this means that warning messages will be
35507 % generated even if there's only a tiny difference that can be
35508 % caused by rounding errors (for example, if the frames were created
35509 % using jpgfdraw). So add a tolerance and only complain if the
35510 % difference exceeds this value.
35511 %\changes{1.14}{2012-11-10}{new}
35512 % \begin{macrocode}
35513 \newlength\fftolerance
35514 \setlength\fftolerance{2pt}
35515 % \end{macrocode}
35516 %\end{macro}
35517 %
35518 %\begin{macro}{\@setcol}
35519 % Set up the output box so it has the correct dimensions for
35520 % specified \gls{flow}. This is used by the output routine.
35521 %\changes{1.11}{2008/06/27}{added displayedframe increment}
35522 %\changes{1.14}{2012-11-10}{changed check to use tolerance rather
35523 %than testing if hsize and columnwidth are equal}
35524 % \begin{macrocode}
35525 \newcommand{\@setcol}[1]{%
35526 \ifnum\c@maxflow<#1\relax
35527 \PackageError{flowfram}%
35528 {Can't set frame '\number#1', doesn't exist}{}%
35529 \else
35530 \flf@message{Switching to flow frame \number#1\space on page
35531 \number\@ff@pages@countreg}%
35532 \expandafter\global\expandafter\columnwidth
35533 \csname colwidth\romannumeral#1\endcsname
35534 \dimen@\columnwidth
35535 \advance\dimen@ by -\hsize\relax
35536 \ifdim\dimen@<0pt\relax
35537 \dimen@=-\dimen@
35538 \fi
35539 \ifdim\dimen@>\fftolerance
35540 \ifusedframebreak
35541 \else
35542 \PackageWarning{flowfram}%
35543 {Moving to flow frame of unequal
35544 width,\MessageBreak use of \string\framebreak\space advised,
35545 or text might not appear correctly (difference =
35546 \the\dimen@, tolerance = \the\fftolerance)}%
35547 \fi
35548 \fi
35549 \global\usedframebreakfalse
35550 \global\hsize\columnwidth
35551 \expandafter\global
35552 \expandafter\vsize\csname colheight\romannumeral#1\endcsname
35553 \global\@colht\vsize
35554 \global\@colroom\@colht
35555 % \end{macrocode}
35556 % We may be inside an environment that has modified the line
35557 % width, such as one of the list environments so we can't just set
35558 % \cs{linewidth} to \cs{columnwidth}. Test if we're in a list
35559 % environment by checking if \cs{@listdepth} is greater than 0. If
35560 % true, only modify \cs{linewidth} if
35561 % it's larger than the new column width.
35562 %\changes{1.15}{2014-05-15}{set \cs{linewidth} as well as \cs{textwidth}}
35563 %\changes{1.17}{2014-09-30}{added check for list}
35564 % \begin{macrocode}
35565 \ifnum\@listdepth>0\relax
35566 \ifnum\linewidth>\columnwidth
35567 \global\linewidth\columnwidth
35568 \fi
35569 \else
35570 \global\linewidth\columnwidth
35571 \fi
35572 % \end{macrocode}
35573 %\changes{1.16}{2014-06-04}{Removed assignment of \cs{textwidth}}
35574 % \begin{macrocode}
35575 %\global\textwidth\columnwidth
35576 \setmargin
35577 \fi
35578 \stepcounter{displayedframe}%
35579 }
35580 % \end{macrocode}
35581 %\end{macro}
35582 % Modify the output routine so that it uses "\vsize"
35583 % instead of "\textheight".
35584 % \begin{macrocode}
35585 \output={%
35586 \let\par\@@par
35587 \ifnum\outputpenalty <-\@M
35588 \@specialoutput
35589 \else
35590 \@makecol
35591 \@opcol \@startcolumn
35592 \@whilesw \if@fcolmade \fi {\@opcol \@startcolumn }%
35593 \fi
35594 \ifnum\outputpenalty>-\@Miv
35595 \ifdim\@colroom<1.5\baselineskip
35596 \ifdim\@colroom<\vsize
35597 \@latex@warning@no@line{Text page \thepage \space
35598 contains only floats}%
35599 \@emptycol
35600 \else
35601 \global\vsize\@colroom
35602 \fi
35603 \else
35604 \global\vsize\@colroom
35605 \fi
35606 \else
35607 \global\vsize\maxdimen
35608 \fi
35609 }
35610 % \end{macrocode}
35611 %\begin{macro}{\@doclearpage}
35612 % Modify "\@doclearpage", again replace "\textheight"
35613 % with "\vsize", and only use the twocolumn stuff.
35614 % \begin{macrocode}
35615 \def\@doclearpage{%
35616 \ifvoid\footins
35617 \setbox\@tempboxa\vsplit\@cclv to\z@
35618 \unvbox\@tempboxa
35619 \setbox\@tempboxa\box\@cclv
35620 \xdef\@deferlist{\@toplist\@botlist\@deferlist}%
35621 \global\let\@toplist\@empty
35622 \global\let\@botlist\@empty
35623 \global\@colroom\@colht
35624 \ifx\@currlist\@empty
35625 \else
35626 \@latexerr{Float(s) lost}\@ehb
35627 \global\let\@currlist\@empty
35628 \fi
35629 \@makefcolumn\@deferlist
35630 \@whilesw \if@fcolmade \fi
35631 {%
35632 \@opcol
35633 \@makefcolumn\@deferlist
35634 }%
35635 \if@firstcolumn
35636 \xdef\@dbldeferlist{\@dbltoplist\@dbldeferlist}%
35637 \global\let\@dbltoplist\@empty
35638 \global\@colht\vsize
35639 \begingroup
35640 \@dblfloatplacement
35641 \@makefcolumn\@dbldeferlist
35642 \@whilesw \if@fcolmade \fi
35643 {%
35644 \@outputpage
35645 \@makefcolumn\@dbldeferlist
35646 }%
35647 \endgroup
35648 \else
35649 \vbox{}%
35650 \clearpage
35651 \fi
35652 \else
35653 \setbox\@cclv\vbox{\box\@cclv\vfil}%
35654 \@makecol\@opcol
35655 \clearpage
35656 \fi
35657 }
35658 % \end{macrocode}
35659 %\end{macro}
35660 % Modify "\@outputpage" slightly. Add provision for
35661 % turning headers and footers into \glspl{dynamic}.
35662 %
35663 %\begin{macro}{\@dothehead}
35664 % First define macro to do the header. This will be
35665 % modified if it is turned into a \gls{dynamic}.
35666 % \begin{macrocode}
35667 \newcommand{\@dothehead}{%
35668 \vbox to \headheight
35669 {%
35670 \color@hbox\normalcolor\hbox to \textwidth{\@thehead}%
35671 \color@endbox
35672 }%
35673 }
35674 % \end{macrocode}
35675 %\end{macro}
35676 %\begin{macro}{\@dothefoot}
35677 % Same again for the footer.
35678 % \begin{macrocode}
35679 \newcommand{\@dothefoot}{%
35680 \color@hbox\normalcolor\hbox to \textwidth{\@thefoot}%
35681 \color@endbox
35682 }
35683 \newcommand{\@dodynamicthehead}{}
35684 \newcommand{\@dodynamicthefoot}{}
35685 % \end{macrocode}
35686 %\end{macro}
35687 %
35688 %\begin{macro}{\@outputpage}
35689 % Now for the modified version of "\@outputpage". The
35690 % page style stuff has been moved to "\@outputdblcol"
35691 % so that the headers and footers can be set in \glspl{dynamic}
35692 % before the \glspl{dynamic} are put on the page.
35693 % \begin{macrocode}
35694 \def\@outputpage{%
35695 \begingroup
35696 \let\protect\noexpand
35697 \@resetactivechars
35698 \global\let\@@if@newlist\if@newlist
35699 \global\@newlistfalse\@parboxrestore
35700 \shipout\vbox
35701 {%
35702 \set@typeset@protect
35703 \aftergroup
35704 \endgroup
35705 \aftergroup
35706 \set@typeset@protect
35707 \reset@font\normalsize\normalsfcodes
35708 \let\label\@gobble
35709 \let\index\@gobble
35710 \let\glossary\@gobble
35711 \baselineskip\z@skip
35712 \lineskip\z@skip
35713 \lineskiplimit\z@
35714 \vskip\topmargin\moveright\@themargin
35715 \vbox
35716 {%
35717 \vskip\headheight
35718 \vskip\headsep
35719 \box\@outputbox
35720 }%
35721 }%
35722 \global\let\if@newlist\@@if@newlist
35723 \stepcounter{page}%
35724 % \end{macrocode}
35725 % Also increment absolutepage counter.
35726 %\changes{1.14}{2012-11-10}{added absolutepage increment}
35727 % \begin{macrocode}
35728 \stepcounter{absolutepage}%
35729 \setcounter{displayedframe}{0}%
35730 \let\firstmark\botmark
35731 }
35732 % \end{macrocode}
35733 %\end{macro}
35734 %\begin{macro}{\makedfheaderfooter}
35735 % Make the headers and footers be in \glspl{dynamic}. There
35736 % will initially be no difference in appearance until
35737 % the settings are changed using "\setdynamicframe".
35738 % The header frame is given the \gls{idl} "header", and the
35739 % footer is given the \gls{idl} "footer".
35740 % \begin{macrocode}
35741 \newcommand*{\makedfheaderfooter}{%
35742 % \end{macrocode}
35743 % create dynamic frames at the standard location
35744 % \begin{macrocode}
35745 \setlength{\@ff@tmp@y}{\textheight}%
35746 \addtolength{\@ff@tmp@y}{\headsep}%
35747 \newdynamicframe{\textwidth}{\headheight}{0pt}{\@ff@tmp@y}[header]%
35748 \newdynamicframe{\textwidth}{\headheight}{0pt}{-\footskip}[footer]%
35749 \renewcommand{\@dothehead}{}%
35750 \renewcommand{\@dothefoot}{}%
35751 \renewcommand{\@dodynamicthehead}{%
35752 \@dynamicframeid{header}%
35753 \expandafter
35754 \def\csname @dynamicframe@\romannumeral\ff@id\endcsname{%
35755 \vfill\@thehead\vfill
35756 }%
35757 }%
35758 \renewcommand{\@dodynamicthefoot}{%
35759 \@dynamicframeid{footer}%
35760 \expandafter
35761 \def\csname @dynamicframe@\romannumeral\ff@id\endcsname{%
35762 \vfill\@thefoot\vfill
35763 }%
35764 }%
35765 }
35766 % \end{macrocode}
35767 %\end{macro}
35768 % This should only be done in the preamble.
35769 % \begin{macrocode}
35770 \@onlypreamble{\makedfheaderfooter}
35771 % \end{macrocode}
35772 %\begin{macro}{\footnotecolor}
35773 % Set footnotes in "\footnotecolor" rather than "\normalcolor"
35774 % This ensures that the footnotes appear in the same colour
35775 % as the text colour for the \gls{flow} to which they belong.
35776 % \begin{macrocode}
35777 \newcommand{\footnotecolor}{%
35778 \@ifundefined{@ff@txtcol@\romannumeral\c@thisframe}%
35779 {%
35780 \normalcolor
35781 }%
35782 {%
35783 \edef\ff@txtcol{%
35784 \csname @ff@txtcol@\romannumeral\c@thisframe\endcsname
35785 }%
35786 \@s@tfftextcol
35787 }%
35788 }
35789 % \end{macrocode}
35790 %\end{macro}
35791 %\begin{macro}{\@makecol}
35792 % Modify "\@makecol" so that the footnotes, and the
35793 % footnote rule are in the colour for that frame.
35794 % \begin{macrocode}
35795 \renewcommand{\@makecol}{%
35796 \ifvoid\footins
35797 \setbox\@outputbox\box\@cclv
35798 \else
35799 \setbox\@outputbox\vbox
35800 {%
35801 \boxmaxdepth\@maxdepth\@tempdima\dp\@cclv
35802 \unvbox\@cclv
35803 \vskip\skip\footins
35804 \color@begingroup
35805 \footnotecolor
35806 \footnoterule
35807 \unvbox\footins
35808 \color@endgroup
35809 }%
35810 \fi
35811 \xdef\@freelist{\@freelist\@midlist}%
35812 \global\let\@midlist\@empty
35813 \@combinefloats
35814 \ifvbox\@kludgeins
35815 \@makespecialcolbox
35816 \else
35817 \setbox\@outputbox\vbox to\@colht{%
35818 \@texttop\dimen@\dp\@outputbox
35819 \unvbox \@outputbox
35820 \vskip -\dimen@\@textbottom
35821 }%
35822 \fi
35823 \global\maxdepth\@maxdepth
35824 }
35825 % \end{macrocode}
35826 %\end{macro}
35827 %\begin{macro}{\@opcol}
35828 % Modify "\@opcol", as "\if@twocolumn" is now
35829 % irrelevant.
35830 % \begin{macrocode}
35831 \def\@opcol{%
35832 \@outputdblcol
35833 \global\@mparbottom\z@
35834 \global\@textfloatsheight\z@
35835 \@floatplacement
35836 }
35837 % \end{macrocode}
35838 %\end{macro}
35839 %\begin{macro}{\@ff@checkifmoreframes}
35840 % Check to see if there are more \glspl{flow} defined, and
35841 % set "\if@ff@moreframes" as appropriate. This involves
35842 % iterating through all \glspl{flow}, and through each
35843 % frame's \gls{pglist}.
35844 % \begin{macrocode}
35845 \newif\if@ff@moreframes
35846 \newcommand*{\@ff@checkifmoreframes}{%
35847 \@ff@moreframesfalse
35848 \@colN=\c@thisframe
35849 \whiledo{\@colN<\c@maxflow}%
35850 {%
35851 \advance\@colN by 1\relax
35852 % \end{macrocode}
35853 % Skip if this page is in this frame's exclusion list.
35854 %\changes{1.14}{2012-11-10}{added check for exclusion list}
35855 % \begin{macrocode}
35856 \edef\ff@xpages{\csname @ff@xpages@\romannumeral\@colN\endcsname}%
35857 \@for\@ff@pp:=\ff@xpages\do
35858 {%
35859 \ifnum0\@ff@pp=\@ff@pages@countreg\relax
35860 \@endfortrue
35861 \fi
35862 }%
35863 \if@endfor
35864 % \end{macrocode}
35865 % If for loop was terminated prematurely, then this page is in this
35866 % frame's exclusion list.
35867 % \begin{macrocode}
35868 \else
35869 \edef\ff@pages{\csname @ff@pages@\romannumeral\@colN\endcsname}%
35870 \@ff@checkpages{\ff@pages}%
35871 % \end{macrocode}
35872 % If found a frame, break out of loop.
35873 % \begin{macrocode}
35874 \if@ff@moreframes
35875 \@colN=\c@maxflow\relax
35876 \fi
35877 \fi
35878 }%
35879 \if@ff@moreframes
35880 \else
35881 % \end{macrocode}
35882 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
35883 %\cs{@ff@pages@countreg}}
35884 % \begin{macrocode}
35885 \@ff@tmpN=\@ff@pages@countreg
35886 % \end{macrocode}
35887 % Look ahead up to a maximum of 4 pages.
35888 % \begin{macrocode}
35889 \count@=0\relax
35890 \loop
35891 \advance\@ff@tmpN by 1\relax
35892 \@colN=0\relax
35893 \whiledo{\@colN<\c@maxflow}%
35894 {%
35895 \advance\@colN by 1\relax
35896 % \end{macrocode}
35897 % Skip if page is in this frame's exclusion list.
35898 % \begin{macrocode}
35899 \edef\ff@xpages{\csname @ff@xpages@\romannumeral\@colN\endcsname}%
35900 \@for\@ff@pp:=\ff@xpages\do
35901 {%
35902 \ifnum0\@ff@pp=\@ff@tmpN\relax
35903 \@endfortrue
35904 \fi
35905 }%
35906 \if@endfor
35907 % \end{macrocode}
35908 % If for loop was terminated prematurely, then page is in this
35909 % frame's exclusion list.
35910 % \begin{macrocode}
35911 \else
35912 \edef\ff@pages{\csname @ff@pages@\romannumeral\@colN\endcsname}%
35913 \@ff@checkpages[\@ff@tmpN]{\ff@pages}%
35914 % \end{macrocode}
35915 % If found a frame, break out of loop.
35916 % \begin{macrocode}
35917 \if@ff@moreframes
35918 \@colN=\c@maxflow\relax
35919 \fi
35920 \fi
35921 }%
35922 \if@ff@moreframes
35923 \count@=4\relax
35924 \else
35925 \advance\count@ by 1\relax
35926 \fi
35927 \ifnum\count@<4
35928 \repeat
35929 \fi
35930 }
35931 % \end{macrocode}
35932 %\end{macro}
35933 %\begin{macro}{\@ff@checkpages}
35934 % Check to see if the current page lies in the \gls{pglist}
35935 % given by "#1".
35936 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
35937 %\cs{@ff@pages@countreg}}
35938 % \begin{macrocode}
35939 \newcommand*{\@ff@checkpages}[2][\@ff@pages@countreg]{%
35940 \@for\@ff@pp:=#2\do{%
35941 \@ff@checkthispage{#1}{\@ff@pp}%
35942 }%
35943 }
35944 % \end{macrocode}
35945 %\end{macro}
35946 %\begin{macro}{\@ff@checkthispage}
35947 % Check to see if the current page lies in the \gls{pgrange}
35948 % given by "#1". If the \gls{pgrange} is specified by
35949 % "all", "odd" or "even" then there are definitely more
35950 % frames available, otherwise check to see if the current page
35951 % lies within the number range. If the \gls{pgrange} is "none",
35952 % ignore it.
35953 % \begin{macrocode}
35954 \newcommand*{\@ff@checkthispage}[2]{%
35955 \ifthenelse{\equal{#2}{all}\or\equal{#2}{even}\or\equal{#2}{odd}}%
35956 {%
35957 \@ff@moreframestrue
35958 }%
35959 {%
35960 \ifthenelse{\equal{#2}{none}}%
35961 {}%
35962 {%
35963 \@ff@checknumrange{#1}{#2}%
35964 }%
35965 }%
35966 }
35967 % \end{macrocode}
35968 %\end{macro}
35969 %\begin{macro}{\@ff@checknumrange}
35970 % The number range could be a single number, a closed range
35971 % (e.g.\ "2-6") or an open range (e,g.\ "<4" or ">10").
35972 % Use "\@ff@getrange" to find the start and end ranges.
35973 % For open ended ranges assume a maximum value of 10000.
35974 % If the current page is less than or equal to the maximum,
35975 % there are still more \glspl{flow} available.
35976 % \begin{macrocode}
35977 \newcommand*{\@ff@checknumrange}[2]{%
35978 \def\@ff@numstart{0}%
35979 \def\@ff@numend{100000}%
35980 \@ff@getrange{#2}%
35981 \ifnum\@ff@numend>#1\relax
35982 \@ff@moreframestrue
35983 \else
35984 \ifnum\@ff@numend=#1\relax
35985 \@ff@moreframestrue
35986 \fi
35987 \fi
35988 }
35989 % \end{macrocode}
35990 %\end{macro}
35991 % Work out the minimum and maximum values of a number range
35992 % which could either be a single number, a closed number
35993 % range or an open number range. If the first character
35994 % is "<" or ">" then it is an open range, otherwise it is
35995 % a closed range or a single number. Define a counter
35996 % to use whilst determining the range.
35997 % \begin{macrocode}
35998 \newcount\c@ffrangenum
35999 % \end{macrocode}
36000 %\begin{macro}{\@ff@getrange}
36001 % Now to find out what kind of range it is. If it is a single
36002 % number, e.g.\ "24", then it will do, e.g.\
36003 % "\@ff@@getrange24-\relax".
36004 % If it is a closed range, e.g. "30-40", it will do , e.g.\
36005 % "\@ff@@getrange30-40-\relax". If it is an open range, e.g.\
36006 % ">25", it will do, e.g.\ "\@ff@@getrange>25-\relax".
36007 % \begin{macrocode}
36008 \newcommand*{\@ff@getrange}[1]{%
36009 \expandafter\@ff@@getrange#1-\relax\end
36010 }
36011 % \end{macrocode}
36012 %\end{macro}
36013 %\begin{macro}{\@ff@@getrange}
36014 % The ranges can now be picked out. If the first character
36015 % is a "<" or ">" it is an open ended range, otherwise it
36016 % is either a single value, or a close ended range.
36017 % \begin{macrocode}
36018 \def\@ff@@getrange#1#2\end{%
36019 \ifx#1<\relax
36020 \@ff@getrangeless#1#2\end
36021 \else
36022 \ifx#1>\relax
36023 \@ff@getrangegreater#1#2\end
36024 \else
36025 \@@ff@getrange#1#2\end
36026 \fi
36027 \fi
36028 }
36029 % \end{macrocode}
36030 %\end{macro}
36031 %\begin{macro}{\@ff@getrangeless}
36032 % Get the values for an open ended range with an
36033 % upper bound. A minimum value of "0" is assumed.
36034 % \begin{macrocode}
36035 \def\@ff@getrangeless<#1-\relax\end{%
36036 \c@ffrangenum=#1\relax
36037 \advance\c@ffrangenum by -1\relax
36038 \def\@ff@numstart{0}%
36039 \edef\@ff@numend{\number\c@ffrangenum}%
36040 }
36041 % \end{macrocode}
36042 %\end{macro}
36043 %\begin{macro}{\@ff@getrangegreater}
36044 % Get the values for an open ended range with a lower
36045 % bound. A maximum value of "100000" is assumed.
36046 % \begin{macrocode}
36047 \def\@ff@getrangegreater>#1-\relax\end{%
36048 \c@ffrangenum=#1\relax
36049 \advance\c@ffrangenum by 1\relax
36050 \edef\@ff@numstart{\number\c@ffrangenum}%
36051 \def\@ff@numend{100000}%
36052 }
36053 % \end{macrocode}
36054 %\end{macro}
36055 %\begin{macro}{\@@ff@getrange}
36056 % Determine whether we have a single number or
36057 % a closed range. If "#2" is "\relax", it is a single
36058 % value, otherwise it is a range.
36059 % \begin{macrocode}
36060 \def\@@ff@getrange#1-#2\end{%
36061 \ifx\relax#2\relax
36062 \def\@ff@numstart{#1}%
36063 \def\@ff@numend{#1}%
36064 \else
36065 \def\@ff@numstart{#1}%
36066 \@@@ff@getrange#2\end
36067 \fi
36068 }
36069 % \end{macrocode}
36070 %\end{macro}
36071 %\begin{macro}{\@@@ff@getrange}
36072 % Extract the end value from the closed range.
36073 % \begin{macrocode}
36074 \def\@@@ff@getrange#1-\relax\end{%
36075 \def\@ff@numend{#1}%
36076 }
36077 % \end{macrocode}
36078 %\end{macro}
36079 %
36080 %\begin{macro}{\@ff@output@adjustframes}
36081 %\changes{1.14}{2012-11-10}{new}
36082 % Provide a hook to adjust frame settings in the output routine.
36083 % \begin{macrocode}
36084 \newcommand*{\@ff@output@adjustframes}{}
36085 % \end{macrocode}
36086 %\end{macro}
36087 %
36088 %\begin{macro}{\flowswitchonnext}
36089 %\changes{1.14}{2012-11-10}{new}
36090 % Switch on the listed flow frames from the next page onwards
36091 % \begin{macrocode}
36092 \newcommand*{\flowswitchonnext}{%
36093 \@ifstar\@sflowswitchonnext\@flowswitchonnext
36094 }
36095 % \end{macrocode}
36096 %\end{macro}
36097 %
36098 %\begin{macro}{\@sflowswitchonnext}
36099 % The starred version uses \glspl{idl}.
36100 % \begin{macrocode}
36101 \newcommand{\@sflowswitchonnext}[1]{%
36102 \@for\@ff@id:=#1\do{%
36103 \@flowframeid{\@ff@id}%
36104 % \end{macrocode}
36105 % Is this frame already on?
36106 % \begin{macrocode}
36107 \@ff@chckifthispg{\@ff@pages@countreg}{\ff@id}%
36108 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36109 \if@notthiscol
36110 \xdef\@ff@output@adjustframes{%
36111 \the\toks@
36112 \noexpand\flowsetpagelist{\number\ff@id}{>\number\@ff@pages@countreg}%
36113 }%
36114 \else
36115 \xdef\@ff@output@adjustframes{%
36116 \the\toks@
36117 \noexpand\flowsetpagelist{\number\ff@id}%
36118 {\number\@ff@pages@countreg,>\number\@ff@pages@countreg}%
36119 }%
36120 \fi
36121 }%
36122 }
36123 % \end{macrocode}
36124 %\end{macro}
36125 %
36126 %\begin{macro}{\@flowswitchonnext}
36127 % The unstarred version uses \glspl{idn}.
36128 % \begin{macrocode}
36129 \newcommand{\@flowswitchonnext}[1]{%
36130 \@for\@ff@id:=#1\do{%
36131 % \end{macrocode}
36132 % Is this frame already on?
36133 % \begin{macrocode}
36134 \@ff@chckifthispg{\@ff@pages@countreg}{\@ff@id}%
36135 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36136 \if@notthiscol
36137 \xdef\@ff@output@adjustframes{%
36138 \the\toks@
36139 \noexpand\flowsetpagelist{\number\@ff@id}{>\number\@ff@pages@countreg}%
36140 }%
36141 \else
36142 \xdef\@ff@output@adjustframes{%
36143 \the\toks@
36144 \noexpand\flowsetpagelist{\number\@ff@id}%
36145 {\number\@ff@pages@countreg,>\number\@ff@pages@countreg}%
36146 }%
36147 \fi
36148 }%
36149 }
36150 % \end{macrocode}
36151 %\end{macro}
36152 %
36153 %\begin{macro}{\flowswitchonnextodd}
36154 %\changes{1.14}{2012-11-10}{new}
36155 % Switch on the listed flow frames from the next odd page onwards
36156 % \begin{macrocode}
36157 \newcommand*{\flowswitchonnextodd}{%
36158 \@ifstar\@sflowswitchonnextodd\@flowswitchonnextodd
36159 }
36160 % \end{macrocode}
36161 %\end{macro}
36162 %
36163 %\begin{macro}{\@sflowswitchonnextodd}
36164 % The starred version uses \glspl{idl}.
36165 % \begin{macrocode}
36166 \newcommand{\@sflowswitchonnextodd}[1]{%
36167 \count@=\@ff@pages@countreg\relax
36168 \ifodd\count@\relax
36169 \advance\count@ by 1\relax
36170 \fi
36171 \@for\@ff@id:=#1\do{%
36172 \@flowframeid{\@ff@id}%
36173 % \end{macrocode}
36174 % Is this frame already on?
36175 % \begin{macrocode}
36176 \@ff@chckifthispg{\@ff@pages@countreg}{\ff@id}%
36177 \def\@ff@prepages{}%
36178 \if@notthiscol
36179 \else
36180 \def\@ff@prepages{\number\@ff@pages@countreg,}%
36181 \fi
36182 % \end{macrocode}
36183 % Is this frame already switched on for the next page?
36184 % \begin{macrocode}
36185 \@ff@chckifthispg{\count@}{\ff@id}%
36186 \ifnum\count@=\@ff@pages@countreg\relax
36187 \else
36188 \if@notthiscol
36189 \else
36190 \edef\@ff@prepages{\@ff@prepages\number\count@,}%
36191 \fi
36192 \fi
36193 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36194 \xdef\@ff@output@adjustframes{%
36195 \the\toks@
36196 \noexpand\flowsetpagelist{\number\ff@id}%
36197 {\@ff@prepages>\number\count@}%
36198 }%
36199 }%
36200 }
36201 % \end{macrocode}
36202 %\end{macro}
36203 %
36204 %\begin{macro}{\@flowswitchonnextodd}
36205 % The unstarred version uses \glspl{idn}.
36206 % \begin{macrocode}
36207 \newcommand{\@flowswitchonnextodd}[1]{%
36208 \count@=\@ff@pages@countreg\relax
36209 \ifodd\count@\relax
36210 \advance\count@ by 1\relax
36211 \fi
36212 \@for\@ff@id:=#1\do{%
36213 % \end{macrocode}
36214 % Is this frame already on?
36215 % \begin{macrocode}
36216 \@ff@chckifthispg{\@ff@pages@countreg}{\@ff@id}%
36217 \def\@ff@prepages{}%
36218 \if@notthiscol
36219 \else
36220 \def\@ff@prepages{\number\@ff@pages@countreg,}%
36221 \fi
36222 % \end{macrocode}
36223 % Is this frame already switched on for the next page?
36224 % \begin{macrocode}
36225 \@ff@chckifthispg{\count@}{\@ff@id}%
36226 \ifnum\count@=\@ff@pages@countreg\relax
36227 \else
36228 \if@notthiscol
36229 \else
36230 \edef\@ff@prepages{\@ff@prepages\number\count@,}%
36231 \fi
36232 \fi
36233 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36234 \xdef\@ff@output@adjustframes{%
36235 \the\toks@
36236 \noexpand\flowsetpagelist{\number\@ff@id}%
36237 {\@ff@prepages>\number\count@}%
36238 }%
36239 }%
36240 }
36241 % \end{macrocode}
36242 %\end{macro}
36243 %
36244 %\begin{macro}{\flowswitchoffnext}
36245 %\changes{1.14}{2012-11-10}{new}
36246 % Switch off the listed flow frames from the next page onwards
36247 % \begin{macrocode}
36248 \newcommand*{\flowswitchoffnext}{%
36249 \@ifstar\@sflowswitchoffnext\@flowswitchoffnext
36250 }
36251 % \end{macrocode}
36252 %\end{macro}
36253 %
36254 %\begin{macro}{\@sflowswitchoffnext}
36255 % The starred version uses \glspl{idl}.
36256 % \begin{macrocode}
36257 \newcommand{\@sflowswitchoffnext}[1]{%
36258 \@for\@ff@id:=#1\do{%
36259 \@flowframeid{\@ff@id}%
36260 % \end{macrocode}
36261 % Is this frame already off on this page?
36262 % \begin{macrocode}
36263 \@ff@chckifthispg{\@ff@pages@countreg}{\ff@id}%
36264 \if@notthiscol
36265 \def\@ff@pages{none}%
36266 \else
36267 \def\@ff@pages{\number\@ff@pages@countreg}%
36268 \fi
36269 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36270 \xdef\@ff@output@adjustframes{%
36271 \the\toks@
36272 \noexpand\flowsetpagelist{\number\ff@id}{\@ff@pages}%
36273 }%
36274 }%
36275 }
36276 % \end{macrocode}
36277 %\end{macro}
36278 %
36279 %\begin{macro}{\@flowswitchoffnext}
36280 % The unstarred version uses \glspl{idn}.
36281 % \begin{macrocode}
36282 \newcommand{\@flowswitchoffnext}[1]{%
36283 \@for\@ff@id:=#1\do{%
36284 % \end{macrocode}
36285 % Is this frame already off on this page?
36286 % \begin{macrocode}
36287 \@ff@chckifthispg{\@ff@pages@countreg}{\@ff@id}%
36288 \if@notthiscol
36289 \def\@ff@pages{none}%
36290 \else
36291 \def\@ff@pages{\number\@ff@pages@countreg}%
36292 \fi
36293 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36294 \xdef\@ff@output@adjustframes{%
36295 \the\toks@
36296 \noexpand\flowsetpagelist{\number\@ff@id}{\@ff@pages}%
36297 }%
36298 }%
36299 }
36300 % \end{macrocode}
36301 %\end{macro}
36302 %
36303 %\begin{macro}{\flowswitchoffnextodd}
36304 %\changes{1.14}{2012-11-10}{new}
36305 % Switch off the listed flow frames from the next odd page onwards
36306 % \begin{macrocode}
36307 \newcommand*{\flowswitchoffnextodd}{%
36308 \@ifstar\@sflowswitchoffnextodd\@flowswitchoffnextodd
36309 }
36310 % \end{macrocode}
36311 %\end{macro}
36312 %
36313 %\begin{macro}{\@sflowswitchoffnextodd}
36314 % The starred version uses \glspl{idl}.
36315 % \begin{macrocode}
36316 \newcommand{\@sflowswitchoffnextodd}[1]{%
36317 \count@=\@ff@pages@countreg\relax
36318 \ifodd\@ff@pages@countreg\relax
36319 \advance\count@ by 1\relax
36320 \fi
36321 \@for\@ff@id:=#1\do{%
36322 \@flowframeid{\@ff@id}%
36323 % \end{macrocode}
36324 % Is this frame already off on this page?
36325 % \begin{macrocode}
36326 \@ff@chckifthispg{\@ff@pages@countreg}{\ff@id}%
36327 \if@notthiscol
36328 % \end{macrocode}
36329 % It's off on this page. Is it on or off on the next page, if this
36330 % page is odd? First, is this page odd?
36331 % \begin{macrocode}
36332 \ifnum\@ff@pages@countreg=\count@\relax
36333 % \end{macrocode}
36334 % This page is even and the frame is off on this page, so set to
36335 % none.
36336 % \begin{macrocode}
36337 \def\@ff@nextpages{none}%
36338 \else
36339 % \end{macrocode}
36340 % This page is odd. Is the frame on or off on the next page?
36341 % \begin{macrocode}
36342 \@ff@chckifthispg{\count@}{\ff@id}%
36343 \if@notthiscol
36344 % \end{macrocode}
36345 % Off on the next page as well, so set to none.
36346 % \begin{macrocode}
36347 \def\@ff@nextpages{none}%
36348 \else
36349 % \end{macrocode}
36350 % Not off on the next page, so set to next page only.
36351 % \begin{macrocode}
36352 \def\@ff@nextpages{\number\count@}%
36353 \fi
36354 \fi
36355 \else
36356 % \end{macrocode}
36357 % It's not off on this page. Is it on or off on the next page, if this
36358 % page is odd? First, is this page odd?
36359 % \begin{macrocode}
36360 \ifnum\@ff@pages@countreg=\count@\relax
36361 % \end{macrocode}
36362 % This page is even and the frame is not off on this page, so set to
36363 % this page.
36364 % \begin{macrocode}
36365 \def\@ff@nextpages{\number\@ff@pages@countreg}%
36366 \else
36367 % \end{macrocode}
36368 % This page is odd. Is the frame on or off on the next page?
36369 % \begin{macrocode}
36370 \@ff@chckifthispg{\count@}{\ff@id}%
36371 \if@notthiscol
36372 % \end{macrocode}
36373 % Off on the next page but not off on this page. So set to just this
36374 % page.
36375 % \begin{macrocode}
36376 \def\@ff@nextpages{\number\@ff@pages@countreg}%
36377 \else
36378 % \end{macrocode}
36379 % Not off on the next page as well, so set to this page and next page.
36380 % \begin{macrocode}
36381 \def\@ff@nextpages{\number\@ff@pages@countreg,\number\count@}%
36382 \fi
36383 \fi
36384 % \end{macrocode}
36385 % \begin{macrocode}
36386 \fi
36387 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36388 \xdef\@ff@output@adjustframes{%
36389 \the\toks@
36390 \noexpand\flowsetpagelist{\number\ff@id}{\@ff@nextpages}%
36391 }%
36392 }%
36393 }
36394 % \end{macrocode}
36395 %\end{macro}
36396 %
36397 %\begin{macro}{\@flowswitchoffnextodd}
36398 % The unstarred version uses \glspl{idn}.
36399 % \begin{macrocode}
36400 \newcommand{\@flowswitchoffnextodd}[1]{%
36401 \count@=\@ff@pages@countreg\relax
36402 \ifodd\@ff@pages@countreg\relax
36403 \advance\count@ by 1\relax
36404 \fi
36405 \@for\@ff@id:=#1\do{%
36406 % \end{macrocode}
36407 % Is this frame already off on this page?
36408 % \begin{macrocode}
36409 \@ff@chckifthispg{\@ff@pages@countreg}{\@ff@id}%
36410 \if@notthiscol
36411 % \end{macrocode}
36412 % It's off on this page. Is it on or off on the next page, if this
36413 % page is odd? First, is this page odd?
36414 % \begin{macrocode}
36415 \ifnum\@ff@pages@countreg=\count@\relax
36416 % \end{macrocode}
36417 % This page is even and the frame is off on this page, so set to
36418 % none.
36419 % \begin{macrocode}
36420 \def\@ff@nextpages{none}%
36421 \else
36422 % \end{macrocode}
36423 % This page is odd. Is the frame on or off on the next page?
36424 % \begin{macrocode}
36425 \@ff@chckifthispg{\count@}{\@ff@id}%
36426 \if@notthiscol
36427 % \end{macrocode}
36428 % Off on the next page as well, so set to none.
36429 % \begin{macrocode}
36430 \def\@ff@nextpages{none}%
36431 \else
36432 % \end{macrocode}
36433 % Not off on the next page, so set to next page only.
36434 % \begin{macrocode}
36435 \def\@ff@nextpages{\number\count@}%
36436 \fi
36437 \fi
36438 \else
36439 % \end{macrocode}
36440 % It's not off on this page. Is it on or off on the next page, if this
36441 % page is odd? First, is this page odd?
36442 % \begin{macrocode}
36443 \ifnum\@ff@pages@countreg=\count@\relax
36444 % \end{macrocode}
36445 % This page is even and the frame is not off on this page, so set to
36446 % this page.
36447 % \begin{macrocode}
36448 \def\@ff@nextpages{\number\@ff@pages@countreg}%
36449 \else
36450 % \end{macrocode}
36451 % This page is odd. Is the frame on or off on the next page?
36452 % \begin{macrocode}
36453 \@ff@chckifthispg{\count@}{\@ff@id}%
36454 \if@notthiscol
36455 % \end{macrocode}
36456 % Off on the next page but not off on this page. So set to just this
36457 % page.
36458 % \begin{macrocode}
36459 \def\@ff@nextpages{\number\@ff@pages@countreg}%
36460 \else
36461 % \end{macrocode}
36462 % Not off on the next page as well, so set to this page and next page.
36463 % \begin{macrocode}
36464 \def\@ff@nextpages{\number\@ff@pages@countreg,\number\count@}%
36465 \fi
36466 \fi
36467 % \end{macrocode}
36468 % \begin{macrocode}
36469 \fi
36470 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36471 \xdef\@ff@output@adjustframes{%
36472 \the\toks@
36473 \noexpand\flowsetpagelist{\number\@ff@id}{\@ff@nextpages}%
36474 }%
36475 }%
36476 }
36477 % \end{macrocode}
36478 %\end{macro}
36479 %
36480 %\begin{macro}{\flowswitchonnextonly}
36481 %\changes{1.14}{2012-11-10}{new}
36482 % Switch on the listed flow frames for just the next page
36483 % \begin{macrocode}
36484 \newcommand*{\flowswitchonnextonly}{%
36485 \@ifstar\@sflowswitchonnextonly\@flowswitchonnextonly
36486 }
36487 % \end{macrocode}
36488 %\end{macro}
36489 %
36490 %\begin{macro}{\@sflowswitchonnextonly}
36491 % The starred version uses \glspl{idl}.
36492 % \begin{macrocode}
36493 \newcommand{\@sflowswitchonnextonly}[1]{%
36494 \count@=\@ff@pages@countreg\relax
36495 \advance\count@ by 1\relax
36496 \@for\@ff@id:=#1\do{%
36497 \@flowframeid{\@ff@id}%
36498 % \end{macrocode}
36499 % Is this frame already on?
36500 % \begin{macrocode}
36501 \@ff@chckifthispg{\@ff@pages@countreg}{\ff@id}%
36502 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36503 \if@notthiscol
36504 % \end{macrocode}
36505 % Not, it isn't, so just set to the next page:
36506 % \begin{macrocode}
36507 \xdef\@ff@output@adjustframes{%
36508 \the\toks@
36509 \noexpand\flowsetpagelist{\number\ff@id}{\number\count@}%
36510 }%
36511 \else
36512 % \end{macrocode}
36513 % Yes, it is, so set to this page and the next page:
36514 % \begin{macrocode}
36515 \xdef\@ff@output@adjustframes{%
36516 \the\toks@
36517 \noexpand\flowsetpagelist{\number\ff@id}%
36518 {\number\@ff@pages@countreg,\number\count@}%
36519 }%
36520 \fi
36521 }%
36522 }
36523 % \end{macrocode}
36524 %\end{macro}
36525 %
36526 %\begin{macro}{\@flowswitchonnextonly}
36527 % The unstarred version uses \glspl{idn}.
36528 % \begin{macrocode}
36529 \newcommand{\@flowswitchonnextonly}[1]{%
36530 \count@=\@ff@pages@countreg\relax
36531 \advance\count@ by 1\relax
36532 \@for\@ff@id:=#1\do{%
36533 % \end{macrocode}
36534 % Is this frame already on?
36535 % \begin{macrocode}
36536 \@ff@chckifthispg{\@ff@pages@countreg}{\@ff@id}%
36537 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36538 \if@notthiscol
36539 % \end{macrocode}
36540 % Not, it isn't, so just set to the next page:
36541 % \begin{macrocode}
36542 \xdef\@ff@output@adjustframes{%
36543 \the\toks@
36544 \noexpand\flowsetpagelist{\number\@ff@id}{\number\count@}%
36545 }%
36546 \else
36547 % \end{macrocode}
36548 % Yes, it is, so set to this page and the next page:
36549 % \begin{macrocode}
36550 \xdef\@ff@output@adjustframes{%
36551 \the\toks@
36552 \noexpand\flowsetpagelist{\number\@ff@id}%
36553 {\number\@ff@pages@countreg,\number\count@}%
36554 }%
36555 \fi
36556 }%
36557 }
36558 % \end{macrocode}
36559 %\end{macro}
36560 %
36561 %\begin{macro}{\flowswitchonnextoddonly}
36562 %\changes{1.14}{2012-11-10}{new}
36563 % Switch on the listed flow frames for just the next odd page
36564 % \begin{macrocode}
36565 \newcommand*{\flowswitchonnextoddonly}{%
36566 \@ifstar\@sflowswitchonnextoddonly\@flowswitchonnextoddonly
36567 }
36568 % \end{macrocode}
36569 %\end{macro}
36570 %
36571 %\begin{macro}{\@sflowswitchonnextoddonly}
36572 % The starred version uses \glspl{idl}.
36573 % \begin{macrocode}
36574 \newcommand{\@sflowswitchonnextoddonly}[1]{%
36575 \@for\@ff@id:=#1\do{%
36576 \@flowframeid{\@ff@id}%
36577 % \end{macrocode}
36578 % Is this frame already on?
36579 % \begin{macrocode}
36580 \@ff@chckifthispg{\@ff@pages@countreg}{\ff@id}%
36581 \if@notthiscol
36582 % \end{macrocode}
36583 % No, it isn't. If this is an odd page, is it on or off on the next
36584 % page? First, is this an odd page?
36585 % \begin{macrocode}
36586 \ifodd\@ff@pages@countreg
36587 % \end{macrocode}
36588 % Yes, it's odd. So this frame isn't on this page, but is it on or
36589 % off on the next page?
36590 % \begin{macrocode}
36591 \count@=\@ff@pages@countreg\relax
36592 \advance\count@ by 1\relax
36593 \@ff@chckifthispg{\count@}{\ff@id}%
36594 \if@notthiscol
36595 % \end{macrocode}
36596 % It's not switched on either on this (odd) page or the next (even) page. So
36597 % the page list should be just the next odd page after this one.
36598 % \begin{macrocode}
36599 \advance\count@ by 1\relax
36600 \edef\@ff@pages{\number\count@}%
36601 \else
36602 % \end{macrocode}
36603 % It's not switched on for this (odd) page but it is for the next (even) page. So
36604 % the page list should be the next even and odd pages after this
36605 % page.
36606 % \begin{macrocode}
36607 \edef\@ff@pages{\number\count@}%
36608 \advance\count@ by 1\relax
36609 \edef\@ff@pages{\@ff@pages,\number\count@}%
36610 \fi
36611 \else
36612 % \end{macrocode}
36613 % No, it's even. So it's not on this (even) page, but needs to be on
36614 % for the following (odd) page.
36615 % \begin{macrocode}
36616 \count@=\@ff@pages@countreg\relax
36617 \advance\count@ by 1\relax
36618 \edef\@ff@pages{\number\count@}%
36619 \fi
36620 \else
36621 % \end{macrocode}
36622 % Frame is on this page. If this is an odd page, is it on or off on
36623 % the next page? First, is this an odd page?
36624 % \begin{macrocode}
36625 \ifodd\@ff@pages@countreg
36626 % \end{macrocode}
36627 % Yes, it's odd. Is the frame on or off for the next (even) page?
36628 % \begin{macrocode}
36629 \count@=\@ff@pages@countreg\relax
36630 \advance\count@ by 1\relax
36631 \@ff@chckifthispg{\count@}{\ff@id}%
36632 \if@notthiscol
36633 % \end{macrocode}
36634 % Frame is off. So the frame is switched on for this (odd) page but
36635 % is off for the next (even) page. So the page list needs to be this
36636 % (odd) page and the following odd page, skipping the even page in
36637 % between.
36638 % \begin{macrocode}
36639 \advance\count@ by 1\relax
36640 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
36641 \else
36642 % \end{macrocode}
36643 % Frame is on. So the frame is switched on for this (odd) page and
36644 % the next (even) page. So the page list needs to be this
36645 % (odd) page, the next even page and the following odd page.
36646 % \begin{macrocode}
36647 \advance\count@ by 1\relax
36648 \edef\@ff@pages{\number\@ff@pages@countreg-\number\count@}%
36649 \fi
36650 \else
36651 % \end{macrocode}
36652 % Frame is switched on for this page and this page is even. So the
36653 % page list needs to be this (even) page and the next (odd) page.
36654 % \begin{macrocode}
36655 \count@=\@ff@pages@countreg\relax
36656 \advance\count@ by 1\relax
36657 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
36658 \fi
36659 % \end{macrocode}
36660 % \begin{macrocode}
36661 \fi
36662 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36663 \xdef\@ff@output@adjustframes{%
36664 \the\toks@
36665 \noexpand\flowsetpagelist{\number\ff@id}{\@ff@pages}%
36666 }%
36667 }%
36668 }
36669 % \end{macrocode}
36670 %\end{macro}
36671 %
36672 %\begin{macro}{\@flowswitchonnextoddonly}
36673 % The unstarred version uses \glspl{idn}.
36674 % \begin{macrocode}
36675 \newcommand{\@flowswitchonnextoddonly}[1]{%
36676 \@for\@ff@id:=#1\do{%
36677 % \end{macrocode}
36678 % Is this frame already on?
36679 % \begin{macrocode}
36680 \@ff@chckifthispg{\@ff@pages@countreg}{\@ff@id}%
36681 \if@notthiscol
36682 % \end{macrocode}
36683 % No, it isn't. If this is an odd page, is it on or off on the next
36684 % page? First, is this an odd page?
36685 % \begin{macrocode}
36686 \ifodd\@ff@pages@countreg
36687 % \end{macrocode}
36688 % Yes, it's odd. So this frame isn't on this page, but is it on or
36689 % off on the next page?
36690 % \begin{macrocode}
36691 \count@=\@ff@pages@countreg\relax
36692 \advance\count@ by 1\relax
36693 \@ff@chckifthispg{\count@}{\@ff@id}%
36694 \if@notthiscol
36695 % \end{macrocode}
36696 % It's not switched on either on this (odd) page or the next (even) page. So
36697 % the page list should be just the next odd page after this one.
36698 % \begin{macrocode}
36699 \advance\count@ by 1\relax
36700 \edef\@ff@pages{\number\count@}%
36701 \else
36702 % \end{macrocode}
36703 % It's not switched on for this (odd) page but it is for the next (even) page. So
36704 % the page list should be the next even and odd pages after this
36705 % page.
36706 % \begin{macrocode}
36707 \edef\@ff@pages{\number\count@}%
36708 \advance\count@ by 1\relax
36709 \edef\@ff@pages{\@ff@pages,\number\count@}%
36710 \fi
36711 \else
36712 % \end{macrocode}
36713 % No, it's even. So it's not on this (even) page, but needs to be on
36714 % for the following (odd) page.
36715 % \begin{macrocode}
36716 \count@=\@ff@pages@countreg\relax
36717 \advance\count@ by 1\relax
36718 \edef\@ff@pages{\number\count@}%
36719 \fi
36720 \else
36721 % \end{macrocode}
36722 % Frame is on this page. If this is an odd page, is it on or off on
36723 % the next page? First, is this an odd page?
36724 % \begin{macrocode}
36725 \ifodd\@ff@pages@countreg
36726 % \end{macrocode}
36727 % Yes, it's odd. Is the frame on or off for the next (even) page?
36728 % \begin{macrocode}
36729 \count@=\@ff@pages@countreg\relax
36730 \advance\count@ by 1\relax
36731 \@ff@chckifthispg{\count@}{\@ff@id}%
36732 \if@notthiscol
36733 % \end{macrocode}
36734 % Frame is off. So the frame is switched on for this (odd) page but
36735 % is off for the next (even) page. So the page list needs to be this
36736 % (odd) page and the following odd page, skipping the even page in
36737 % between.
36738 % \begin{macrocode}
36739 \advance\count@ by 1\relax
36740 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
36741 \else
36742 % \end{macrocode}
36743 % Frame is on. So the frame is switched on for this (odd) page and
36744 % the next (even) page. So the page list needs to be this
36745 % (odd) page, the next even page and the following odd page.
36746 % \begin{macrocode}
36747 \advance\count@ by 1\relax
36748 \edef\@ff@pages{\number\@ff@pages@countreg-\number\count@}%
36749 \fi
36750 \else
36751 % \end{macrocode}
36752 % Frame is switched on for this page and this page is even. So the
36753 % page list needs to be this (even) page and the next (odd) page.
36754 % \begin{macrocode}
36755 \count@=\@ff@pages@countreg\relax
36756 \advance\count@ by 1\relax
36757 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
36758 \fi
36759 % \end{macrocode}
36760 % \begin{macrocode}
36761 \fi
36762 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36763 \xdef\@ff@output@adjustframes{%
36764 \the\toks@
36765 \noexpand\flowsetpagelist{\number\@ff@id}{\@ff@pages}%
36766 }%
36767 }%
36768 }
36769 % \end{macrocode}
36770 %\end{macro}
36771 %
36772 %
36773 %\begin{macro}{\flowswitchoffnextonly}
36774 %\changes{1.14}{2012-11-10}{new}
36775 % Switch off the listed flow frames for just the next page
36776 % \begin{macrocode}
36777 \newcommand*{\flowswitchoffnextonly}{%
36778 \@ifstar\@sflowswitchoffnextonly\@flowswitchoffnextonly
36779 }
36780 % \end{macrocode}
36781 %\end{macro}
36782 %
36783 %\begin{macro}{\@sflowswitchoffnextonly}
36784 % The starred version uses \glspl{idl}.
36785 % \begin{macrocode}
36786 \newcommand{\@sflowswitchoffnextonly}[1]{%
36787 \count@=\@ff@pages@countreg\relax
36788 \advance\count@ by 1\relax
36789 \@for\@ff@id:=#1\do{%
36790 \@flowframeid{\@ff@id}%
36791 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36792 \xdef\@ff@output@adjustframes{%
36793 \the\toks@
36794 \noexpand\flowaddexclusion{\number\ff@id}{\number\count@}%
36795 }%
36796 }%
36797 }
36798 % \end{macrocode}
36799 %\end{macro}
36800 %
36801 %\begin{macro}{\@flowswitchoffnextonly}
36802 % The unstarred version uses \glspl{idn}.
36803 % \begin{macrocode}
36804 \newcommand{\@flowswitchoffnextonly}[1]{%
36805 \count@=\@ff@pages@countreg\relax
36806 \advance\count@ by 1\relax
36807 \@for\@ff@id:=#1\do{%
36808 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36809 \xdef\@ff@output@adjustframes{%
36810 \the\toks@
36811 \noexpand\flowaddexclusion{\number\@ff@id}{\number\count@}%
36812 }%
36813 }%
36814 }
36815 % \end{macrocode}
36816 %\end{macro}
36817 %
36818 %\begin{macro}{\flowswitchoffnextoddonly}
36819 %\changes{1.14}{2012-11-10}{new}
36820 % Switch off the listed flow frames for just the next odd page
36821 % \begin{macrocode}
36822 \newcommand*{\flowswitchoffnextoddonly}{%
36823 \@ifstar\@sflowswitchoffnextoddonly\@flowswitchoffnextoddonly
36824 }
36825 % \end{macrocode}
36826 %\end{macro}
36827 %
36828 %\begin{macro}{\@sflowswitchoffnextoddonly}
36829 % The starred version uses \glspl{idl}.
36830 % \begin{macrocode}
36831 \newcommand{\@sflowswitchoffnextoddonly}[1]{%
36832 \count@=\@ff@pages@countreg\relax
36833 \advance\count@ by 1\relax
36834 \ifodd\count@\relax
36835 \else
36836 \advance\count@ by 1\relax
36837 \fi
36838 \@for\@ff@id:=#1\do{%
36839 \@flowframeid{\@ff@id}%
36840 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36841 \xdef\@ff@output@adjustframes{%
36842 \the\toks@
36843 \noexpand\flowaddexclusion{\number\ff@id}{\number\count@}%
36844 }%
36845 }%
36846 }
36847 % \end{macrocode}
36848 %\end{macro}
36849 %
36850 %\begin{macro}{\@flowswitchoffnextoddonly}
36851 % The unstarred version uses \glspl{idn}.
36852 % \begin{macrocode}
36853 \newcommand{\@flowswitchoffnextoddonly}[1]{%
36854 \count@=\@ff@pages@countreg\relax
36855 \advance\count@ by 1\relax
36856 \ifodd\count@\relax
36857 \else
36858 \advance\count@ by 1\relax
36859 \fi
36860 \@for\@ff@id:=#1\do{%
36861 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36862 \xdef\@ff@output@adjustframes{%
36863 \the\toks@
36864 \noexpand\flowaddexclusion{\number\@ff@id}{\number\count@}%
36865 }%
36866 }%
36867 }
36868 % \end{macrocode}
36869 %\end{macro}
36870 %
36871 %\begin{macro}{\dynamicswitchonnext}
36872 %\changes{1.14}{2012-11-10}{new}
36873 % Switch on the listed dynamic frames from the next page onwards
36874 % \begin{macrocode}
36875 \newcommand*{\dynamicswitchonnext}{%
36876 \@ifstar\@sdynamicswitchonnext\@dynamicswitchonnext
36877 }
36878 % \end{macrocode}
36879 %\end{macro}
36880 %
36881 %\begin{macro}{\@sdynamicswitchonnext}
36882 % The starred version uses \glspl{idl}.
36883 % \begin{macrocode}
36884 \newcommand{\@sdynamicswitchonnext}[1]{%
36885 \@for\@ff@id:=#1\do{%
36886 \@dynamicframeid{\@ff@id}%
36887 % \end{macrocode}
36888 % Is this frame already on?
36889 % \begin{macrocode}
36890 \@df@chckifthispg[\@ff@pages@countreg]{\ff@id}%
36891 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36892 \if@notthiscol
36893 \xdef\@ff@output@adjustframes{%
36894 \the\toks@
36895 \noexpand\dynamicsetpagelist{\number\ff@id}{>\number\@ff@pages@countreg}%
36896 }%
36897 \else
36898 \xdef\@ff@output@adjustframes{%
36899 \the\toks@
36900 \noexpand\dynamicsetpagelist{\number\ff@id}%
36901 {\number\@ff@pages@countreg,>\number\@ff@pages@countreg}%
36902 }%
36903 \fi
36904 }%
36905 }
36906 % \end{macrocode}
36907 %\end{macro}
36908 %
36909 %\begin{macro}{\@dynamicswitchonnext}
36910 % The unstarred version uses \glspl{idn}.
36911 % \begin{macrocode}
36912 \newcommand{\@dynamicswitchonnext}[1]{%
36913 \@for\@ff@id:=#1\do{%
36914 % \end{macrocode}
36915 % Is this frame already on?
36916 % \begin{macrocode}
36917 \@df@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
36918 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36919 \if@notthiscol
36920 \xdef\@ff@output@adjustframes{%
36921 \the\toks@
36922 \noexpand\dynamicsetpagelist{\number\@ff@id}{>\number\@ff@pages@countreg}%
36923 }%
36924 \else
36925 \xdef\@ff@output@adjustframes{%
36926 \the\toks@
36927 \noexpand\dynamicsetpagelist{\number\@ff@id}%
36928 {\number\@ff@pages@countreg,>\number\@ff@pages@countreg}%
36929 }%
36930 \fi
36931 }%
36932 }
36933 % \end{macrocode}
36934 %\end{macro}
36935 %
36936 %\begin{macro}{\dynamicswitchonnextodd}
36937 %\changes{1.14}{2012-11-10}{new}
36938 % Switch on the listed dynamic frames from the next odd page onwards
36939 % \begin{macrocode}
36940 \newcommand*{\dynamicswitchonnextodd}{%
36941 \@ifstar\@sdynamicswitchonnextodd\@dynamicswitchonnextodd
36942 }
36943 % \end{macrocode}
36944 %\end{macro}
36945 %
36946 %\begin{macro}{\@sdynamicswitchonnextodd}
36947 % The starred version uses \glspl{idl}.
36948 % \begin{macrocode}
36949 \newcommand{\@sdynamicswitchonnextodd}[1]{%
36950 \count@=\@ff@pages@countreg\relax
36951 \ifodd\count@\relax
36952 \advance\count@ by 1\relax
36953 \fi
36954 \@for\@ff@id:=#1\do{%
36955 \@dynamicframeid{\@ff@id}%
36956 % \end{macrocode}
36957 % Is this frame already on?
36958 % \begin{macrocode}
36959 \@df@chckifthispg[\@ff@pages@countreg]{\ff@id}%
36960 \def\@ff@prepages{}%
36961 \if@notthiscol
36962 \else
36963 \def\@ff@prepages{\number\@ff@pages@countreg,}%
36964 \fi
36965 % \end{macrocode}
36966 % Is this frame already switched on for the next page?
36967 % \begin{macrocode}
36968 \@df@chckifthispg[\count@]{\ff@id}%
36969 \ifnum\count@=\@ff@pages@countreg\relax
36970 \else
36971 \if@notthiscol
36972 \else
36973 \edef\@ff@prepages{\@ff@prepages\number\count@,}%
36974 \fi
36975 \fi
36976 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
36977 \xdef\@ff@output@adjustframes{%
36978 \the\toks@
36979 \noexpand\dynamicsetpagelist{\number\ff@id}%
36980 {\@ff@prepages>\number\count@}%
36981 }%
36982 }%
36983 }
36984 % \end{macrocode}
36985 %\end{macro}
36986 %
36987 %\begin{macro}{\@dynamicswitchonnextodd}
36988 % The unstarred version uses \glspl{idn}.
36989 % \begin{macrocode}
36990 \newcommand{\@dynamicswitchonnextodd}[1]{%
36991 \count@=\@ff@pages@countreg\relax
36992 \ifodd\count@\relax
36993 \advance\count@ by 1\relax
36994 \fi
36995 \@for\@ff@id:=#1\do{%
36996 % \end{macrocode}
36997 % Is this frame already on?
36998 % \begin{macrocode}
36999 \@df@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
37000 \def\@ff@prepages{}%
37001 \if@notthiscol
37002 \else
37003 \def\@ff@prepages{\number\@ff@pages@countreg,}%
37004 \fi
37005 % \end{macrocode}
37006 % Is this frame already switched on for the next page?
37007 % \begin{macrocode}
37008 \@df@chckifthispg[\count@]{\@ff@id}%
37009 \ifnum\count@=\@ff@pages@countreg\relax
37010 \else
37011 \if@notthiscol
37012 \else
37013 \edef\@ff@prepages{\@ff@prepages\number\count@,}%
37014 \fi
37015 \fi
37016 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37017 \xdef\@ff@output@adjustframes{%
37018 \the\toks@
37019 \noexpand\dynamicsetpagelist{\number\@ff@id}%
37020 {\@ff@prepages>\number\count@}%
37021 }%
37022 }%
37023 }
37024 % \end{macrocode}
37025 %\end{macro}
37026 %
37027 %\begin{macro}{\dynamicswitchoffnext}
37028 %\changes{1.14}{2012-11-10}{new}
37029 % Switch off the listed dynamic frames from the next page onwards
37030 % \begin{macrocode}
37031 \newcommand*{\dynamicswitchoffnext}{%
37032 \@ifstar\@sdynamicswitchoffnext\@dynamicswitchoffnext
37033 }
37034 % \end{macrocode}
37035 %\end{macro}
37036 %
37037 %\begin{macro}{\@sdynamicswitchoffnext}
37038 % The starred version uses \glspl{idl}.
37039 % \begin{macrocode}
37040 \newcommand{\@sdynamicswitchoffnext}[1]{%
37041 \@for\@ff@id:=#1\do{%
37042 \@dynamicframeid{\@ff@id}%
37043 % \end{macrocode}
37044 % Is this frame already off on this page?
37045 % \begin{macrocode}
37046 \@df@chckifthispg[\@ff@pages@countreg]{\ff@id}%
37047 \if@notthiscol
37048 \def\@ff@pages{none}%
37049 \else
37050 \def\@ff@pages{\number\@ff@pages@countreg}%
37051 \fi
37052 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37053 \xdef\@ff@output@adjustframes{%
37054 \the\toks@
37055 \noexpand\dynamicsetpagelist{\number\ff@id}{\@ff@pages}%
37056 }%
37057 }%
37058 }
37059 % \end{macrocode}
37060 %\end{macro}
37061 %
37062 %\begin{macro}{\@dynamicswitchoffnext}
37063 % The unstarred version uses \glspl{idn}.
37064 % \begin{macrocode}
37065 \newcommand{\@dynamicswitchoffnext}[1]{%
37066 \@for\@ff@id:=#1\do{%
37067 % \end{macrocode}
37068 % Is this frame already off on this page?
37069 % \begin{macrocode}
37070 \@df@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
37071 \if@notthiscol
37072 \def\@ff@pages{none}%
37073 \else
37074 \def\@ff@pages{\number\@ff@pages@countreg}%
37075 \fi
37076 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37077 \xdef\@ff@output@adjustframes{%
37078 \the\toks@
37079 \noexpand\dynamicsetpagelist{\number\@ff@id}{\@ff@pages}%
37080 }%
37081 }%
37082 }
37083 % \end{macrocode}
37084 %\end{macro}
37085 %
37086 %\begin{macro}{\dynamicswitchoffnextodd}
37087 %\changes{1.14}{2012-11-10}{new}
37088 % Switch off the listed dynamic frames from the next odd page onwards
37089 % \begin{macrocode}
37090 \newcommand*{\dynamicswitchoffnextodd}{%
37091 \@ifstar\@sdynamicswitchoffnextodd\@dynamicswitchoffnextodd
37092 }
37093 % \end{macrocode}
37094 %\end{macro}
37095 %
37096 %\begin{macro}{\@sdynamicswitchoffnextodd}
37097 % The starred version uses \glspl{idl}.
37098 % \begin{macrocode}
37099 \newcommand{\@sdynamicswitchoffnextodd}[1]{%
37100 \count@=\@ff@pages@countreg\relax
37101 \ifodd\@ff@pages@countreg\relax
37102 \advance\count@ by 1\relax
37103 \fi
37104 \@for\@ff@id:=#1\do{%
37105 \@dynamicframeid{\@ff@id}%
37106 % \end{macrocode}
37107 % Is this frame already off on this page?
37108 % \begin{macrocode}
37109 \@df@chckifthispg[\@ff@pages@countreg]{\ff@id}%
37110 \if@notthiscol
37111 % \end{macrocode}
37112 % It's off on this page. Is it on or off on the next page, if this
37113 % page is odd? First, is this page odd?
37114 % \begin{macrocode}
37115 \ifnum\@ff@pages@countreg=\count@\relax
37116 % \end{macrocode}
37117 % This page is even and the frame is off on this page, so set to
37118 % none.
37119 % \begin{macrocode}
37120 \def\@ff@nextpages{none}%
37121 \else
37122 % \end{macrocode}
37123 % This page is odd. Is the frame on or off on the next page?
37124 % \begin{macrocode}
37125 \@df@chckifthispg[\count@]{\ff@id}%
37126 \if@notthiscol
37127 % \end{macrocode}
37128 % Off on the next page as well, so set to none.
37129 % \begin{macrocode}
37130 \def\@ff@nextpages{none}%
37131 \else
37132 % \end{macrocode}
37133 % Not off on the next page, so set to next page only.
37134 % \begin{macrocode}
37135 \def\@ff@nextpages{\number\count@}%
37136 \fi
37137 \fi
37138 \else
37139 % \end{macrocode}
37140 % It's not off on this page. Is it on or off on the next page, if this
37141 % page is odd? First, is this page odd?
37142 % \begin{macrocode}
37143 \ifnum\@ff@pages@countreg=\count@\relax
37144 % \end{macrocode}
37145 % This page is even and the frame is not off on this page, so set to
37146 % this page.
37147 % \begin{macrocode}
37148 \def\@ff@nextpages{\number\@ff@pages@countreg}%
37149 \else
37150 % \end{macrocode}
37151 % This page is odd. Is the frame on or off on the next page?
37152 % \begin{macrocode}
37153 \@df@chckifthispg[\count@]{\ff@id}%
37154 \if@notthiscol
37155 % \end{macrocode}
37156 % Off on the next page but not off on this page. So set to just this
37157 % page.
37158 % \begin{macrocode}
37159 \def\@ff@nextpages{\number\@ff@pages@countreg}%
37160 \else
37161 % \end{macrocode}
37162 % Not off on the next page as well, so set to this page and next page.
37163 % \begin{macrocode}
37164 \def\@ff@nextpages{\number\@ff@pages@countreg,\number\count@}%
37165 \fi
37166 \fi
37167 % \end{macrocode}
37168 % \begin{macrocode}
37169 \fi
37170 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37171 \xdef\@ff@output@adjustframes{%
37172 \the\toks@
37173 \noexpand\dynamicsetpagelist{\number\ff@id}{\@ff@nextpages}%
37174 }%
37175 }%
37176 }
37177 % \end{macrocode}
37178 %\end{macro}
37179 %
37180 %\begin{macro}{\@dynamicswitchoffnextodd}
37181 % The unstarred version uses \glspl{idn}.
37182 % \begin{macrocode}
37183 \newcommand{\@dynamicswitchoffnextodd}[1]{%
37184 \count@=\@ff@pages@countreg\relax
37185 \ifodd\@ff@pages@countreg\relax
37186 \advance\count@ by 1\relax
37187 \fi
37188 \@for\@ff@id:=#1\do{%
37189 % \end{macrocode}
37190 % Is this frame already off on this page?
37191 % \begin{macrocode}
37192 \@df@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
37193 \if@notthiscol
37194 % \end{macrocode}
37195 % It's off on this page. Is it on or off on the next page, if this
37196 % page is odd? First, is this page odd?
37197 % \begin{macrocode}
37198 \ifnum\@ff@pages@countreg=\count@\relax
37199 % \end{macrocode}
37200 % This page is even and the frame is off on this page, so set to
37201 % none.
37202 % \begin{macrocode}
37203 \def\@ff@nextpages{none}%
37204 \else
37205 % \end{macrocode}
37206 % This page is odd. Is the frame on or off on the next page?
37207 % \begin{macrocode}
37208 \@df@chckifthispg[\count@]{\@ff@id}%
37209 \if@notthiscol
37210 % \end{macrocode}
37211 % Off on the next page as well, so set to none.
37212 % \begin{macrocode}
37213 \def\@ff@nextpages{none}%
37214 \else
37215 % \end{macrocode}
37216 % Not off on the next page, so set to next page only.
37217 % \begin{macrocode}
37218 \def\@ff@nextpages{\number\count@}%
37219 \fi
37220 \fi
37221 \else
37222 % \end{macrocode}
37223 % It's not off on this page. Is it on or off on the next page, if this
37224 % page is odd? First, is this page odd?
37225 % \begin{macrocode}
37226 \ifnum\@ff@pages@countreg=\count@\relax
37227 % \end{macrocode}
37228 % This page is even and the frame is not off on this page, so set to
37229 % this page.
37230 % \begin{macrocode}
37231 \def\@ff@nextpages{\number\@ff@pages@countreg}%
37232 \else
37233 % \end{macrocode}
37234 % This page is odd. Is the frame on or off on the next page?
37235 % \begin{macrocode}
37236 \@df@chckifthispg[\count@]{\@ff@id}%
37237 \if@notthiscol
37238 % \end{macrocode}
37239 % Off on the next page but not off on this page. So set to just this
37240 % page.
37241 % \begin{macrocode}
37242 \def\@ff@nextpages{\number\@ff@pages@countreg}%
37243 \else
37244 % \end{macrocode}
37245 % Not off on the next page as well, so set to this page and next page.
37246 % \begin{macrocode}
37247 \def\@ff@nextpages{\number\@ff@pages@countreg,\number\count@}%
37248 \fi
37249 \fi
37250 % \end{macrocode}
37251 % \begin{macrocode}
37252 \fi
37253 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37254 \xdef\@ff@output@adjustframes{%
37255 \the\toks@
37256 \noexpand\dynamicsetpagelist{\number\@ff@id}{\@ff@nextpages}%
37257 }%
37258 }%
37259 }
37260 % \end{macrocode}
37261 %\end{macro}
37262 %
37263 %\begin{macro}{\dynamicswitchonnextonly}
37264 %\changes{1.14}{2012-11-10}{new}
37265 % Switch on the listed dynamic frames for just the next page
37266 % \begin{macrocode}
37267 \newcommand*{\dynamicswitchonnextonly}{%
37268 \@ifstar\@sdynamicswitchonnextonly\@dynamicswitchonnextonly
37269 }
37270 % \end{macrocode}
37271 %\end{macro}
37272 %
37273 %\begin{macro}{\@sdynamicswitchonnextonly}
37274 % The starred version uses \glspl{idl}.
37275 % \begin{macrocode}
37276 \newcommand{\@sdynamicswitchonnextonly}[1]{%
37277 \count@=\@ff@pages@countreg\relax
37278 \advance\count@ by 1\relax
37279 \@for\@ff@id:=#1\do{%
37280 \@dynamicframeid{\@ff@id}%
37281 % \end{macrocode}
37282 % Is this frame already on?
37283 % \begin{macrocode}
37284 \@df@chckifthispg[\@ff@pages@countreg]{\ff@id}%
37285 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37286 \if@notthiscol
37287 % \end{macrocode}
37288 % Not, it isn't, so just set to the next page:
37289 % \begin{macrocode}
37290 \xdef\@ff@output@adjustframes{%
37291 \the\toks@
37292 \noexpand\dynamicsetpagelist{\number\ff@id}{\number\count@}%
37293 }%
37294 \else
37295 % \end{macrocode}
37296 % Yes, it is, so set to this page and the next page:
37297 % \begin{macrocode}
37298 \xdef\@ff@output@adjustframes{%
37299 \the\toks@
37300 \noexpand\dynamicsetpagelist{\number\ff@id}%
37301 {\number\@ff@pages@countreg,\number\count@}%
37302 }%
37303 \fi
37304 }%
37305 }
37306 % \end{macrocode}
37307 %\end{macro}
37308 %
37309 %\begin{macro}{\@dynamicswitchonnextonly}
37310 % The unstarred version uses \glspl{idn}.
37311 % \begin{macrocode}
37312 \newcommand{\@dynamicswitchonnextonly}[1]{%
37313 \count@=\@ff@pages@countreg\relax
37314 \advance\count@ by 1\relax
37315 \@for\@ff@id:=#1\do{%
37316 % \end{macrocode}
37317 % Is this frame already on?
37318 % \begin{macrocode}
37319 \@df@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
37320 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37321 \if@notthiscol
37322 % \end{macrocode}
37323 % Not, it isn't, so just set to the next page:
37324 % \begin{macrocode}
37325 \xdef\@ff@output@adjustframes{%
37326 \the\toks@
37327 \noexpand\dynamicsetpagelist{\number\@ff@id}{\number\count@}%
37328 }%
37329 \else
37330 % \end{macrocode}
37331 % Yes, it is, so set to this page and the next page:
37332 % \begin{macrocode}
37333 \xdef\@ff@output@adjustframes{%
37334 \the\toks@
37335 \noexpand\dynamicsetpagelist{\number\@ff@id}%
37336 {\number\@ff@pages@countreg,\number\count@}%
37337 }%
37338 \fi
37339 }%
37340 }
37341 % \end{macrocode}
37342 %\end{macro}
37343 %
37344 %\begin{macro}{\dynamicswitchonnextoddonly}
37345 %\changes{1.14}{2012-11-10}{new}
37346 % Switch on the listed dynamic frames for just the next odd page
37347 % \begin{macrocode}
37348 \newcommand*{\dynamicswitchonnextoddonly}{%
37349 \@ifstar\@sdynamicswitchonnextoddonly\@dynamicswitchonnextoddonly
37350 }
37351 % \end{macrocode}
37352 %\end{macro}
37353 %
37354 %\begin{macro}{\@sdynamicswitchonnextoddonly}
37355 % The starred version uses \glspl{idl}.
37356 % \begin{macrocode}
37357 \newcommand{\@sdynamicswitchonnextoddonly}[1]{%
37358 \@for\@ff@id:=#1\do{%
37359 \@dynamicframeid{\@ff@id}%
37360 % \end{macrocode}
37361 % Is this frame already on?
37362 % \begin{macrocode}
37363 \@df@chckifthispg[\@ff@pages@countreg]{\ff@id}%
37364 \if@notthiscol
37365 % \end{macrocode}
37366 % No, it isn't. If this is an odd page, is it on or off on the next
37367 % page? First, is this an odd page?
37368 % \begin{macrocode}
37369 \ifodd\@ff@pages@countreg
37370 % \end{macrocode}
37371 % Yes, it's odd. So this frame isn't on this page, but is it on or
37372 % off on the next page?
37373 % \begin{macrocode}
37374 \count@=\@ff@pages@countreg\relax
37375 \advance\count@ by 1\relax
37376 \@df@chckifthispg[\count@]{\ff@id}%
37377 \if@notthiscol
37378 % \end{macrocode}
37379 % It's not switched on either on this (odd) page or the next (even) page. So
37380 % the page list should be just the next odd page after this one.
37381 % \begin{macrocode}
37382 \advance\count@ by 1\relax
37383 \edef\@ff@pages{\number\count@}%
37384 \else
37385 % \end{macrocode}
37386 % It's not switched on for this (odd) page but it is for the next (even) page. So
37387 % the page list should be the next even and odd pages after this
37388 % page.
37389 % \begin{macrocode}
37390 \edef\@ff@pages{\number\count@}%
37391 \advance\count@ by 1\relax
37392 \edef\@ff@pages{\@ff@pages,\number\count@}%
37393 \fi
37394 \else
37395 % \end{macrocode}
37396 % No, it's even. So it's not on this (even) page, but needs to be on
37397 % for the following (odd) page.
37398 % \begin{macrocode}
37399 \count@=\@ff@pages@countreg\relax
37400 \advance\count@ by 1\relax
37401 \edef\@ff@pages{\number\count@}%
37402 \fi
37403 \else
37404 % \end{macrocode}
37405 % Frame is on this page. If this is an odd page, is it on or off on
37406 % the next page? First, is this an odd page?
37407 % \begin{macrocode}
37408 \ifodd\@ff@pages@countreg
37409 % \end{macrocode}
37410 % Yes, it's odd. Is the frame on or off for the next (even) page?
37411 % \begin{macrocode}
37412 \count@=\@ff@pages@countreg\relax
37413 \advance\count@ by 1\relax
37414 \@df@chckifthispg[\count@]{\ff@id}%
37415 \if@notthiscol
37416 % \end{macrocode}
37417 % Frame is off. So the frame is switched on for this (odd) page but
37418 % is off for the next (even) page. So the page list needs to be this
37419 % (odd) page and the following odd page, skipping the even page in
37420 % between.
37421 % \begin{macrocode}
37422 \advance\count@ by 1\relax
37423 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
37424 \else
37425 % \end{macrocode}
37426 % Frame is on. So the frame is switched on for this (odd) page and
37427 % the next (even) page. So the page list needs to be this
37428 % (odd) page, the next even page and the following odd page.
37429 % \begin{macrocode}
37430 \advance\count@ by 1\relax
37431 \edef\@ff@pages{\number\@ff@pages@countreg-\number\count@}%
37432 \fi
37433 \else
37434 % \end{macrocode}
37435 % Frame is switched on for this page and this page is even. So the
37436 % page list needs to be this (even) page and the next (odd) page.
37437 % \begin{macrocode}
37438 \count@=\@ff@pages@countreg\relax
37439 \advance\count@ by 1\relax
37440 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
37441 \fi
37442 \fi
37443 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37444 \xdef\@ff@output@adjustframes{%
37445 \the\toks@
37446 \noexpand\dynamicsetpagelist{\number\ff@id}{\@ff@pages}%
37447 }%
37448 }%
37449 }
37450 % \end{macrocode}
37451 %\end{macro}
37452 %
37453 %\begin{macro}{\@dynamicswitchonnextoddonly}
37454 % The unstarred version uses \glspl{idn}.
37455 % \begin{macrocode}
37456 \newcommand{\@dynamicswitchonnextoddonly}[1]{%
37457 \@for\@ff@id:=#1\do{%
37458 % \end{macrocode}
37459 % Is this frame already on?
37460 % \begin{macrocode}
37461 \@df@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
37462 \if@notthiscol
37463 % \end{macrocode}
37464 % No, it isn't. If this is an odd page, is it on or off on the next
37465 % page? First, is this an odd page?
37466 % \begin{macrocode}
37467 \ifodd\@ff@pages@countreg
37468 % \end{macrocode}
37469 % Yes, it's odd. So this frame isn't on this page, but is it on or
37470 % off on the next page?
37471 % \begin{macrocode}
37472 \count@=\@ff@pages@countreg\relax
37473 \advance\count@ by 1\relax
37474 \@df@chckifthispg[\count@]{\@ff@id}%
37475 \if@notthiscol
37476 % \end{macrocode}
37477 % It's not switched on either on this (odd) page or the next (even) page. So
37478 % the page list should be just the next odd page after this one.
37479 % \begin{macrocode}
37480 \advance\count@ by 1\relax
37481 \edef\@ff@pages{\number\count@}%
37482 \else
37483 % \end{macrocode}
37484 % It's not switched on for this (odd) page but it is for the next (even) page. So
37485 % the page list should be the next even and odd pages after this
37486 % page.
37487 % \begin{macrocode}
37488 \edef\@ff@pages{\number\count@}%
37489 \advance\count@ by 1\relax
37490 \edef\@ff@pages{\@ff@pages,\number\count@}%
37491 \fi
37492 \else
37493 % \end{macrocode}
37494 % No, it's even. So it's not on this (even) page, but needs to be on
37495 % for the following (odd) page.
37496 % \begin{macrocode}
37497 \count@=\@ff@pages@countreg\relax
37498 \advance\count@ by 1\relax
37499 \edef\@ff@pages{\number\count@}%
37500 \fi
37501 \else
37502 % \end{macrocode}
37503 % Frame is on this page. If this is an odd page, is it on or off on
37504 % the next page? First, is this an odd page?
37505 % \begin{macrocode}
37506 \ifodd\@ff@pages@countreg
37507 % \end{macrocode}
37508 % Yes, it's odd. Is the frame on or off for the next (even) page?
37509 % \begin{macrocode}
37510 \count@=\@ff@pages@countreg\relax
37511 \advance\count@ by 1\relax
37512 \@df@chckifthispg[\count@]{\@ff@id}%
37513 \if@notthiscol
37514 % \end{macrocode}
37515 % Frame is off. So the frame is switched on for this (odd) page but
37516 % is off for the next (even) page. So the page list needs to be this
37517 % (odd) page and the following odd page, skipping the even page in
37518 % between.
37519 % \begin{macrocode}
37520 \advance\count@ by 1\relax
37521 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
37522 \else
37523 % \end{macrocode}
37524 % Frame is on. So the frame is switched on for this (odd) page and
37525 % the next (even) page. So the page list needs to be this
37526 % (odd) page, the next even page and the following odd page.
37527 % \begin{macrocode}
37528 \advance\count@ by 1\relax
37529 \edef\@ff@pages{\number\@ff@pages@countreg-\number\count@}%
37530 \fi
37531 \else
37532 % \end{macrocode}
37533 % Frame is switched on for this page and this page is even. So the
37534 % page list needs to be this (even) page and the next (odd) page.
37535 % \begin{macrocode}
37536 \count@=\@ff@pages@countreg\relax
37537 \advance\count@ by 1\relax
37538 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
37539 \fi
37540 % \end{macrocode}
37541 % \begin{macrocode}
37542 \fi
37543 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37544 \xdef\@ff@output@adjustframes{%
37545 \the\toks@
37546 \noexpand\dynamicsetpagelist{\number\@ff@id}{\@ff@pages}%
37547 }%
37548 }%
37549 }
37550 % \end{macrocode}
37551 %\end{macro}
37552 %
37553 %
37554 %\begin{macro}{\dynamicswitchoffnextonly}
37555 %\changes{1.14}{2012-11-10}{new}
37556 % Switch off the listed dynamic frames for just the next page
37557 % \begin{macrocode}
37558 \newcommand*{\dynamicswitchoffnextonly}{%
37559 \@ifstar\@sdynamicswitchoffnextonly\@dynamicswitchoffnextonly
37560 }
37561 % \end{macrocode}
37562 %\end{macro}
37563 %
37564 %\begin{macro}{\@sdynamicswitchoffnextonly}
37565 % The starred version uses \glspl{idl}.
37566 % \begin{macrocode}
37567 \newcommand{\@sdynamicswitchoffnextonly}[1]{%
37568 \count@=\@ff@pages@countreg\relax
37569 \advance\count@ by 1\relax
37570 \@for\@ff@id:=#1\do{%
37571 \@dynamicframeid{\@ff@id}%
37572 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37573 \xdef\@ff@output@adjustframes{%
37574 \the\toks@
37575 \noexpand\dynamicaddexclusion{\number\ff@id}{\number\count@}%
37576 }%
37577 }%
37578 }
37579 % \end{macrocode}
37580 %\end{macro}
37581 %
37582 %\begin{macro}{\@dynamicswitchoffnextonly}
37583 % The unstarred version uses \glspl{idn}.
37584 % \begin{macrocode}
37585 \newcommand{\@dynamicswitchoffnextonly}[1]{%
37586 \count@=\@ff@pages@countreg\relax
37587 \advance\count@ by 1\relax
37588 \@for\@ff@id:=#1\do{%
37589 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37590 \xdef\@ff@output@adjustframes{%
37591 \the\toks@
37592 \noexpand\dynamicaddexclusion{\number\@ff@id}{\number\count@}%
37593 }%
37594 }%
37595 }
37596 % \end{macrocode}
37597 %\end{macro}
37598 %
37599 %\begin{macro}{\dynamicswitchoffnextoddonly}
37600 %\changes{1.14}{2012-11-10}{new}
37601 % Switch off the listed dynamic frames for just the next odd page
37602 % \begin{macrocode}
37603 \newcommand*{\dynamicswitchoffnextoddonly}{%
37604 \@ifstar\@sdynamicswitchoffnextoddonly\@dynamicswitchoffnextoddonly
37605 }
37606 % \end{macrocode}
37607 %\end{macro}
37608 %
37609 %\begin{macro}{\@sdynamicswitchoffnextoddonly}
37610 % The starred version uses \glspl{idl}.
37611 % \begin{macrocode}
37612 \newcommand{\@sdynamicswitchoffnextoddonly}[1]{%
37613 \count@=\@ff@pages@countreg\relax
37614 \advance\count@ by 1\relax
37615 \ifodd\count@\relax
37616 \else
37617 \advance\count@ by 1\relax
37618 \fi
37619 \@for\@ff@id:=#1\do{%
37620 \@dynamicframeid{\@ff@id}%
37621 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37622 \xdef\@ff@output@adjustframes{%
37623 \the\toks@
37624 \noexpand\dynamicaddexclusion{\number\ff@id}{\number\count@}%
37625 }%
37626 }%
37627 }
37628 % \end{macrocode}
37629 %\end{macro}
37630 %
37631 %\begin{macro}{\@dynamicswitchoffnextoddonly}
37632 % The unstarred version uses \glspl{idn}.
37633 % \begin{macrocode}
37634 \newcommand{\@dynamicswitchoffnextoddonly}[1]{%
37635 \count@=\@ff@pages@countreg\relax
37636 \advance\count@ by 1\relax
37637 \ifodd\count@\relax
37638 \else
37639 \advance\count@ by 1\relax
37640 \fi
37641 \@for\@ff@id:=#1\do{%
37642 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37643 \xdef\@ff@output@adjustframes{%
37644 \the\toks@
37645 \noexpand\dynamicaddexclusion{\number\@ff@id}{\number\count@}%
37646 }%
37647 }%
37648 }
37649 % \end{macrocode}
37650 %\end{macro}
37651 %
37652 %\begin{macro}{\staticswitchonnext}
37653 %\changes{1.14}{2012-11-10}{new}
37654 % Switch on the listed static frames from the next page onwards
37655 % \begin{macrocode}
37656 \newcommand*{\staticswitchonnext}{%
37657 \@ifstar\@sstaticswitchonnext\@staticswitchonnext
37658 }
37659 % \end{macrocode}
37660 %\end{macro}
37661 %
37662 %\begin{macro}{\@sstaticswitchonnext}
37663 % The starred version uses \glspl{idl}.
37664 % \begin{macrocode}
37665 \newcommand{\@sstaticswitchonnext}[1]{%
37666 \@for\@ff@id:=#1\do{%
37667 \@staticframeid{\@ff@id}%
37668 % \end{macrocode}
37669 % Is this frame already on?
37670 % \begin{macrocode}
37671 \@sf@chckifthispg[\@ff@pages@countreg]{\ff@id}%
37672 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37673 \if@notthiscol
37674 \xdef\@ff@output@adjustframes{%
37675 \the\toks@
37676 \noexpand\staticsetpagelist{\number\ff@id}{>\number\@ff@pages@countreg}%
37677 }%
37678 \else
37679 \xdef\@ff@output@adjustframes{%
37680 \the\toks@
37681 \noexpand\staticsetpagelist{\number\ff@id}%
37682 {\number\@ff@pages@countreg,>\number\@ff@pages@countreg}%
37683 }%
37684 \fi
37685 }%
37686 }
37687 % \end{macrocode}
37688 %\end{macro}
37689 %
37690 %\begin{macro}{\@staticswitchonnext}
37691 % The unstarred version uses \glspl{idn}.
37692 % \begin{macrocode}
37693 \newcommand{\@staticswitchonnext}[1]{%
37694 \@for\@ff@id:=#1\do{%
37695 % \end{macrocode}
37696 % Is this frame already on?
37697 % \begin{macrocode}
37698 \@sf@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
37699 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37700 \if@notthiscol
37701 \xdef\@ff@output@adjustframes{%
37702 \the\toks@
37703 \noexpand\staticsetpagelist{\number\@ff@id}{>\number\@ff@pages@countreg}%
37704 }%
37705 \else
37706 \xdef\@ff@output@adjustframes{%
37707 \the\toks@
37708 \noexpand\staticsetpagelist{\number\@ff@id}%
37709 {\number\@ff@pages@countreg,>\number\@ff@pages@countreg}%
37710 }%
37711 \fi
37712 }%
37713 }
37714 % \end{macrocode}
37715 %\end{macro}
37716 %
37717 %\begin{macro}{\staticswitchonnextodd}
37718 %\changes{1.14}{2012-11-10}{new}
37719 % Switch on the listed static frames from the next odd page onwards
37720 % \begin{macrocode}
37721 \newcommand*{\staticswitchonnextodd}{%
37722 \@ifstar\@sstaticswitchonnextodd\@staticswitchonnextodd
37723 }
37724 % \end{macrocode}
37725 %\end{macro}
37726 %
37727 %\begin{macro}{\@sstaticswitchonnextodd}
37728 % The starred version uses \glspl{idl}.
37729 % \begin{macrocode}
37730 \newcommand{\@sstaticswitchonnextodd}[1]{%
37731 \count@=\@ff@pages@countreg\relax
37732 \ifodd\count@\relax
37733 \advance\count@ by 1\relax
37734 \fi
37735 \@for\@ff@id:=#1\do{%
37736 \@staticframeid{\@ff@id}%
37737 % \end{macrocode}
37738 % Is this frame already on?
37739 % \begin{macrocode}
37740 \@sf@chckifthispg[\@ff@pages@countreg]{\ff@id}%
37741 \def\@ff@prepages{}%
37742 \if@notthiscol
37743 \else
37744 \def\@ff@prepages{\number\@ff@pages@countreg,}%
37745 \fi
37746 % \end{macrocode}
37747 % Is this frame already switched on for the next page?
37748 % \begin{macrocode}
37749 \@sf@chckifthispg[\count@]{\ff@id}%
37750 \ifnum\count@=\@ff@pages@countreg\relax
37751 \else
37752 \if@notthiscol
37753 \else
37754 \edef\@ff@prepages{\@ff@prepages\number\count@,}%
37755 \fi
37756 \fi
37757 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37758 \xdef\@ff@output@adjustframes{%
37759 \the\toks@
37760 \noexpand\staticsetpagelist{\number\ff@id}%
37761 {\@ff@prepages>\number\count@}%
37762 }%
37763 }%
37764 }
37765 % \end{macrocode}
37766 %\end{macro}
37767 %
37768 %\begin{macro}{\@staticswitchonnextodd}
37769 % The unstarred version uses \glspl{idn}.
37770 % \begin{macrocode}
37771 \newcommand{\@staticswitchonnextodd}[1]{%
37772 \count@=\@ff@pages@countreg\relax
37773 \ifodd\count@\relax
37774 \advance\count@ by 1\relax
37775 \fi
37776 \@for\@ff@id:=#1\do{%
37777 % \end{macrocode}
37778 % Is this frame already on?
37779 % \begin{macrocode}
37780 \@sf@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
37781 \def\@ff@prepages{}%
37782 \if@notthiscol
37783 \else
37784 \def\@ff@prepages{\number\@ff@pages@countreg,}%
37785 \fi
37786 % \end{macrocode}
37787 % Is this frame already switched on for the next page?
37788 % \begin{macrocode}
37789 \@sf@chckifthispg[\count@]{\@ff@id}%
37790 \ifnum\count@=\@ff@pages@countreg\relax
37791 \else
37792 \if@notthiscol
37793 \else
37794 \edef\@ff@prepages{\@ff@prepages\number\count@,}%
37795 \fi
37796 \fi
37797 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37798 \xdef\@ff@output@adjustframes{%
37799 \the\toks@
37800 \noexpand\staticsetpagelist{\number\@ff@id}%
37801 {\@ff@prepages>\number\count@}%
37802 }%
37803 }%
37804 }
37805 % \end{macrocode}
37806 %\end{macro}
37807 %
37808 %\begin{macro}{\staticswitchoffnext}
37809 %\changes{1.14}{2012-11-10}{new}
37810 % Switch off the listed static frames from the next page onwards
37811 % \begin{macrocode}
37812 \newcommand*{\staticswitchoffnext}{%
37813 \@ifstar\@sstaticswitchoffnext\@staticswitchoffnext
37814 }
37815 % \end{macrocode}
37816 %\end{macro}
37817 %
37818 %\begin{macro}{\@sstaticswitchoffnext}
37819 % The starred version uses \glspl{idl}.
37820 % \begin{macrocode}
37821 \newcommand{\@sstaticswitchoffnext}[1]{%
37822 \@for\@ff@id:=#1\do{%
37823 \@staticframeid{\@ff@id}%
37824 % \end{macrocode}
37825 % Is this frame already off on this page?
37826 % \begin{macrocode}
37827 \@sf@chckifthispg[\@ff@pages@countreg]{\ff@id}%
37828 \if@notthiscol
37829 \def\@ff@pages{none}%
37830 \else
37831 \def\@ff@pages{\number\@ff@pages@countreg}%
37832 \fi
37833 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37834 \xdef\@ff@output@adjustframes{%
37835 \the\toks@
37836 \noexpand\staticsetpagelist{\number\ff@id}{\@ff@pages}%
37837 }%
37838 }%
37839 }
37840 % \end{macrocode}
37841 %\end{macro}
37842 %
37843 %\begin{macro}{\@staticswitchoffnext}
37844 % The unstarred version uses \glspl{idn}.
37845 % \begin{macrocode}
37846 \newcommand{\@staticswitchoffnext}[1]{%
37847 \@for\@ff@id:=#1\do{%
37848 % \end{macrocode}
37849 % Is this frame already off on this page?
37850 % \begin{macrocode}
37851 \@sf@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
37852 \if@notthiscol
37853 \def\@ff@pages{none}%
37854 \else
37855 \def\@ff@pages{\number\@ff@pages@countreg}%
37856 \fi
37857 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37858 \xdef\@ff@output@adjustframes{%
37859 \the\toks@
37860 \noexpand\staticsetpagelist{\number\@ff@id}{\@ff@pages}%
37861 }%
37862 }%
37863 }
37864 % \end{macrocode}
37865 %\end{macro}
37866 %
37867 %\begin{macro}{\staticswitchoffnextodd}
37868 %\changes{1.14}{2012-11-10}{new}
37869 % Switch off the listed static frames from the next odd page onwards
37870 % \begin{macrocode}
37871 \newcommand*{\staticswitchoffnextodd}{%
37872 \@ifstar\@sstaticswitchoffnextodd\@staticswitchoffnextodd
37873 }
37874 % \end{macrocode}
37875 %\end{macro}
37876 %
37877 %\begin{macro}{\@sstaticswitchoffnextodd}
37878 % The starred version uses \glspl{idl}.
37879 % \begin{macrocode}
37880 \newcommand{\@sstaticswitchoffnextodd}[1]{%
37881 \count@=\@ff@pages@countreg\relax
37882 \ifodd\@ff@pages@countreg\relax
37883 \advance\count@ by 1\relax
37884 \fi
37885 \@for\@ff@id:=#1\do{%
37886 \@staticframeid{\@ff@id}%
37887 % \end{macrocode}
37888 % Is this frame already off on this page?
37889 % \begin{macrocode}
37890 \@sf@chckifthispg[\@ff@pages@countreg]{\ff@id}%
37891 \if@notthiscol
37892 % \end{macrocode}
37893 % It's off on this page. Is it on or off on the next page, if this
37894 % page is odd? First, is this page odd?
37895 % \begin{macrocode}
37896 \ifnum\@ff@pages@countreg=\count@\relax
37897 % \end{macrocode}
37898 % This page is even and the frame is off on this page, so set to
37899 % none.
37900 % \begin{macrocode}
37901 \def\@ff@nextpages{none}%
37902 \else
37903 % \end{macrocode}
37904 % This page is odd. Is the frame on or off on the next page?
37905 % \begin{macrocode}
37906 \@sf@chckifthispg[\count@]{\ff@id}%
37907 \if@notthiscol
37908 % \end{macrocode}
37909 % Off on the next page as well, so set to none.
37910 % \begin{macrocode}
37911 \def\@ff@nextpages{none}%
37912 \else
37913 % \end{macrocode}
37914 % Not off on the next page, so set to next page only.
37915 % \begin{macrocode}
37916 \def\@ff@nextpages{\number\count@}%
37917 \fi
37918 \fi
37919 \else
37920 % \end{macrocode}
37921 % It's not off on this page. Is it on or off on the next page, if this
37922 % page is odd? First, is this page odd?
37923 % \begin{macrocode}
37924 \ifnum\@ff@pages@countreg=\count@\relax
37925 % \end{macrocode}
37926 % This page is even and the frame is not off on this page, so set to
37927 % this page.
37928 % \begin{macrocode}
37929 \def\@ff@nextpages{\number\@ff@pages@countreg}%
37930 \else
37931 % \end{macrocode}
37932 % This page is odd. Is the frame on or off on the next page?
37933 % \begin{macrocode}
37934 \@sf@chckifthispg[\count@]{\ff@id}%
37935 \if@notthiscol
37936 % \end{macrocode}
37937 % Off on the next page but not off on this page. So set to just this
37938 % page.
37939 % \begin{macrocode}
37940 \def\@ff@nextpages{\number\@ff@pages@countreg}%
37941 \else
37942 % \end{macrocode}
37943 % Not off on the next page as well, so set to this page and next page.
37944 % \begin{macrocode}
37945 \def\@ff@nextpages{\number\@ff@pages@countreg,\number\count@}%
37946 \fi
37947 \fi
37948 % \end{macrocode}
37949 % \begin{macrocode}
37950 \fi
37951 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
37952 \xdef\@ff@output@adjustframes{%
37953 \the\toks@
37954 \noexpand\staticsetpagelist{\number\ff@id}{\@ff@nextpages}%
37955 }%
37956 }%
37957 }
37958 % \end{macrocode}
37959 %\end{macro}
37960 %
37961 %\begin{macro}{\@staticswitchoffnextodd}
37962 % The unstarred version uses \glspl{idn}.
37963 % \begin{macrocode}
37964 \newcommand{\@staticswitchoffnextodd}[1]{%
37965 \count@=\@ff@pages@countreg\relax
37966 \ifodd\@ff@pages@countreg\relax
37967 \advance\count@ by 1\relax
37968 \fi
37969 \@for\@ff@id:=#1\do{%
37970 % \end{macrocode}
37971 % Is this frame already off on this page?
37972 % \begin{macrocode}
37973 \@sf@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
37974 \if@notthiscol
37975 % \end{macrocode}
37976 % It's off on this page. Is it on or off on the next page, if this
37977 % page is odd? First, is this page odd?
37978 % \begin{macrocode}
37979 \ifnum\@ff@pages@countreg=\count@\relax
37980 % \end{macrocode}
37981 % This page is even and the frame is off on this page, so set to
37982 % none.
37983 % \begin{macrocode}
37984 \def\@ff@nextpages{none}%
37985 \else
37986 % \end{macrocode}
37987 % This page is odd. Is the frame on or off on the next page?
37988 % \begin{macrocode}
37989 \@sf@chckifthispg[\count@]{\@ff@id}%
37990 \if@notthiscol
37991 % \end{macrocode}
37992 % Off on the next page as well, so set to none.
37993 % \begin{macrocode}
37994 \def\@ff@nextpages{none}%
37995 \else
37996 % \end{macrocode}
37997 % Not off on the next page, so set to next page only.
37998 % \begin{macrocode}
37999 \def\@ff@nextpages{\number\count@}%
38000 \fi
38001 \fi
38002 \else
38003 % \end{macrocode}
38004 % It's not off on this page. Is it on or off on the next page, if this
38005 % page is odd? First, is this page odd?
38006 % \begin{macrocode}
38007 \ifnum\@ff@pages@countreg=\count@\relax
38008 % \end{macrocode}
38009 % This page is even and the frame is not off on this page, so set to
38010 % this page.
38011 % \begin{macrocode}
38012 \def\@ff@nextpages{\number\@ff@pages@countreg}%
38013 \else
38014 % \end{macrocode}
38015 % This page is odd. Is the frame on or off on the next page?
38016 % \begin{macrocode}
38017 \@sf@chckifthispg[\count@]{\@ff@id}%
38018 \if@notthiscol
38019 % \end{macrocode}
38020 % Off on the next page but not off on this page. So set to just this
38021 % page.
38022 % \begin{macrocode}
38023 \def\@ff@nextpages{\number\@ff@pages@countreg}%
38024 \else
38025 % \end{macrocode}
38026 % Not off on the next page as well, so set to this page and next page.
38027 % \begin{macrocode}
38028 \def\@ff@nextpages{\number\@ff@pages@countreg,\number\count@}%
38029 \fi
38030 \fi
38031 % \end{macrocode}
38032 % \begin{macrocode}
38033 \fi
38034 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
38035 \xdef\@ff@output@adjustframes{%
38036 \the\toks@
38037 \noexpand\staticsetpagelist{\number\@ff@id}{\@ff@nextpages}%
38038 }%
38039 }%
38040 }
38041 % \end{macrocode}
38042 %\end{macro}
38043 %
38044 %\begin{macro}{\staticswitchonnextonly}
38045 %\changes{1.14}{2012-11-10}{new}
38046 % Switch on the listed static frames for just the next page
38047 % \begin{macrocode}
38048 \newcommand*{\staticswitchonnextonly}{%
38049 \@ifstar\@sstaticswitchonnextonly\@staticswitchonnextonly
38050 }
38051 % \end{macrocode}
38052 %\end{macro}
38053 %
38054 %\begin{macro}{\@sstaticswitchonnextonly}
38055 % The starred version uses \glspl{idl}.
38056 % \begin{macrocode}
38057 \newcommand{\@sstaticswitchonnextonly}[1]{%
38058 \count@=\@ff@pages@countreg\relax
38059 \advance\count@ by 1\relax
38060 \@for\@ff@id:=#1\do{%
38061 \@staticframeid{\@ff@id}%
38062 % \end{macrocode}
38063 % Is this frame already on?
38064 % \begin{macrocode}
38065 \@sf@chckifthispg[\@ff@pages@countreg]{\ff@id}%
38066 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
38067 \if@notthiscol
38068 % \end{macrocode}
38069 % Not, it isn't, so just set to the next page:
38070 % \begin{macrocode}
38071 \xdef\@ff@output@adjustframes{%
38072 \the\toks@
38073 \noexpand\staticsetpagelist{\number\ff@id}{\number\count@}%
38074 }%
38075 \else
38076 % \end{macrocode}
38077 % Yes, it is, so set to this page and the next page:
38078 % \begin{macrocode}
38079 \xdef\@ff@output@adjustframes{%
38080 \the\toks@
38081 \noexpand\staticsetpagelist{\number\ff@id}%
38082 {\number\@ff@pages@countreg,\number\count@}%
38083 }%
38084 \fi
38085 }%
38086 }
38087 % \end{macrocode}
38088 %\end{macro}
38089 %
38090 %\begin{macro}{\@staticswitchonnextonly}
38091 % The unstarred version uses \glspl{idn}.
38092 % \begin{macrocode}
38093 \newcommand{\@staticswitchonnextonly}[1]{%
38094 \count@=\@ff@pages@countreg\relax
38095 \advance\count@ by 1\relax
38096 \@for\@ff@id:=#1\do{%
38097 % \end{macrocode}
38098 % Is this frame already on?
38099 % \begin{macrocode}
38100 \@sf@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
38101 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
38102 \if@notthiscol
38103 % \end{macrocode}
38104 % Not, it isn't, so just set to the next page:
38105 % \begin{macrocode}
38106 \xdef\@ff@output@adjustframes{%
38107 \the\toks@
38108 \noexpand\staticsetpagelist{\number\@ff@id}{\number\count@}%
38109 }%
38110 \else
38111 % \end{macrocode}
38112 % Yes, it is, so set to this page and the next page:
38113 % \begin{macrocode}
38114 \xdef\@ff@output@adjustframes{%
38115 \the\toks@
38116 \noexpand\staticsetpagelist{\number\@ff@id}%
38117 {\number\@ff@pages@countreg,\number\count@}%
38118 }%
38119 \fi
38120 }%
38121 }
38122 % \end{macrocode}
38123 %\end{macro}
38124 %
38125 %\begin{macro}{\staticswitchonnextoddonly}
38126 %\changes{1.14}{2012-11-10}{new}
38127 % Switch on the listed static frames for just the next odd page
38128 % \begin{macrocode}
38129 \newcommand*{\staticswitchonnextoddonly}{%
38130 \@ifstar\@sstaticswitchonnextoddonly\@staticswitchonnextoddonly
38131 }
38132 % \end{macrocode}
38133 %\end{macro}
38134 %
38135 %\begin{macro}{\@sstaticswitchonnextoddonly}
38136 % The starred version uses \glspl{idl}.
38137 % \begin{macrocode}
38138 \newcommand{\@sstaticswitchonnextoddonly}[1]{%
38139 \@for\@ff@id:=#1\do{%
38140 \@staticframeid{\@ff@id}%
38141 % \end{macrocode}
38142 % Is this frame already on?
38143 % \begin{macrocode}
38144 \@sf@chckifthispg[\@ff@pages@countreg]{\ff@id}%
38145 \if@notthiscol
38146 % \end{macrocode}
38147 % No, it isn't. If this is an odd page, is it on or off on the next
38148 % page? First, is this an odd page?
38149 % \begin{macrocode}
38150 \ifodd\@ff@pages@countreg
38151 % \end{macrocode}
38152 % Yes, it's odd. So this frame isn't on this page, but is it on or
38153 % off on the next page?
38154 % \begin{macrocode}
38155 \count@=\@ff@pages@countreg\relax
38156 \advance\count@ by 1\relax
38157 \@sf@chckifthispg[\count@]{\ff@id}%
38158 \if@notthiscol
38159 % \end{macrocode}
38160 % It's not switched on either on this (odd) page or the next (even) page. So
38161 % the page list should be just the next odd page after this one.
38162 % \begin{macrocode}
38163 \advance\count@ by 1\relax
38164 \edef\@ff@pages{\number\count@}%
38165 \else
38166 % \end{macrocode}
38167 % It's not switched on for this (odd) page but it is for the next (even) page. So
38168 % the page list should be the next even and odd pages after this
38169 % page.
38170 % \begin{macrocode}
38171 \edef\@ff@pages{\number\count@}%
38172 \advance\count@ by 1\relax
38173 \edef\@ff@pages{\@ff@pages,\number\count@}%
38174 \fi
38175 \else
38176 % \end{macrocode}
38177 % No, it's even. So it's not on this (even) page, but needs to be on
38178 % for the following (odd) page.
38179 % \begin{macrocode}
38180 \count@=\@ff@pages@countreg\relax
38181 \advance\count@ by 1\relax
38182 \edef\@ff@pages{\number\count@}%
38183 \fi
38184 \else
38185 % \end{macrocode}
38186 % Frame is on this page. If this is an odd page, is it on or off on
38187 % the next page? First, is this an odd page?
38188 % \begin{macrocode}
38189 \ifodd\@ff@pages@countreg
38190 % \end{macrocode}
38191 % Yes, it's odd. Is the frame on or off for the next (even) page?
38192 % \begin{macrocode}
38193 \count@=\@ff@pages@countreg\relax
38194 \advance\count@ by 1\relax
38195 \@sf@chckifthispg[\count@]{\ff@id}%
38196 \if@notthiscol
38197 % \end{macrocode}
38198 % Frame is off. So the frame is switched on for this (odd) page but
38199 % is off for the next (even) page. So the page list needs to be this
38200 % (odd) page and the following odd page, skipping the even page in
38201 % between.
38202 % \begin{macrocode}
38203 \advance\count@ by 1\relax
38204 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
38205 \else
38206 % \end{macrocode}
38207 % Frame is on. So the frame is switched on for this (odd) page and
38208 % the next (even) page. So the page list needs to be this
38209 % (odd) page, the next even page and the following odd page.
38210 % \begin{macrocode}
38211 \advance\count@ by 1\relax
38212 \edef\@ff@pages{\number\@ff@pages@countreg-\number\count@}%
38213 \fi
38214 \else
38215 % \end{macrocode}
38216 % Frame is switched on for this page and this page is even. So the
38217 % page list needs to be this (even) page and the next (odd) page.
38218 % \begin{macrocode}
38219 \count@=\@ff@pages@countreg\relax
38220 \advance\count@ by 1\relax
38221 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
38222 \fi
38223 % \end{macrocode}
38224 % \begin{macrocode}
38225 \fi
38226 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
38227 \xdef\@ff@output@adjustframes{%
38228 \the\toks@
38229 \noexpand\staticsetpagelist{\number\ff@id}{\@ff@pages}%
38230 }%
38231 }%
38232 }
38233 % \end{macrocode}
38234 %\end{macro}
38235 %
38236 %\begin{macro}{\@staticswitchonnextoddonly}
38237 % The unstarred version uses \glspl{idn}.
38238 % \begin{macrocode}
38239 \newcommand{\@staticswitchonnextoddonly}[1]{%
38240 \@for\@ff@id:=#1\do{%
38241 % \end{macrocode}
38242 % Is this frame already on?
38243 % \begin{macrocode}
38244 \@sf@chckifthispg[\@ff@pages@countreg]{\@ff@id}%
38245 \if@notthiscol
38246 % \end{macrocode}
38247 % No, it isn't. If this is an odd page, is it on or off on the next
38248 % page? First, is this an odd page?
38249 % \begin{macrocode}
38250 \ifodd\@ff@pages@countreg
38251 % \end{macrocode}
38252 % Yes, it's odd. So this frame isn't on this page, but is it on or
38253 % off on the next page?
38254 % \begin{macrocode}
38255 \count@=\@ff@pages@countreg\relax
38256 \advance\count@ by 1\relax
38257 \@sf@chckifthispg[\count@]{\@ff@id}%
38258 \if@notthiscol
38259 % \end{macrocode}
38260 % It's not switched on either on this (odd) page or the next (even) page. So
38261 % the page list should be just the next odd page after this one.
38262 % \begin{macrocode}
38263 \advance\count@ by 1\relax
38264 \edef\@ff@pages{\number\count@}%
38265 \else
38266 % \end{macrocode}
38267 % It's not switched on for this (odd) page but it is for the next (even) page. So
38268 % the page list should be the next even and odd pages after this
38269 % page.
38270 % \begin{macrocode}
38271 \edef\@ff@pages{\number\count@}%
38272 \advance\count@ by 1\relax
38273 \edef\@ff@pages{\@ff@pages,\number\count@}%
38274 \fi
38275 \else
38276 % \end{macrocode}
38277 % No, it's even. So it's not on this (even) page, but needs to be on
38278 % for the following (odd) page.
38279 % \begin{macrocode}
38280 \count@=\@ff@pages@countreg\relax
38281 \advance\count@ by 1\relax
38282 \edef\@ff@pages{\number\count@}%
38283 \fi
38284 \else
38285 % \end{macrocode}
38286 % Frame is on this page. If this is an odd page, is it on or off on
38287 % the next page? First, is this an odd page?
38288 % \begin{macrocode}
38289 \ifodd\@ff@pages@countreg
38290 % \end{macrocode}
38291 % Yes, it's odd. Is the frame on or off for the next (even) page?
38292 % \begin{macrocode}
38293 \count@=\@ff@pages@countreg\relax
38294 \advance\count@ by 1\relax
38295 \@sf@chckifthispg[\count@]{\@ff@id}%
38296 \if@notthiscol
38297 % \end{macrocode}
38298 % Frame is off. So the frame is switched on for this (odd) page but
38299 % is off for the next (even) page. So the page list needs to be this
38300 % (odd) page and the following odd page, skipping the even page in
38301 % between.
38302 % \begin{macrocode}
38303 \advance\count@ by 1\relax
38304 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
38305 \else
38306 % \end{macrocode}
38307 % Frame is on. So the frame is switched on for this (odd) page and
38308 % the next (even) page. So the page list needs to be this
38309 % (odd) page, the next even page and the following odd page.
38310 % \begin{macrocode}
38311 \advance\count@ by 1\relax
38312 \edef\@ff@pages{\number\@ff@pages@countreg-\number\count@}%
38313 \fi
38314 \else
38315 % \end{macrocode}
38316 % Frame is switched on for this page and this page is even. So the
38317 % page list needs to be this (even) page and the next (odd) page.
38318 % \begin{macrocode}
38319 \count@=\@ff@pages@countreg\relax
38320 \advance\count@ by 1\relax
38321 \edef\@ff@pages{\number\@ff@pages@countreg,\number\count@}%
38322 \fi
38323 % \end{macrocode}
38324 % \begin{macrocode}
38325 \fi
38326 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
38327 \xdef\@ff@output@adjustframes{%
38328 \the\toks@
38329 \noexpand\staticsetpagelist{\number\@ff@id}{\@ff@pages}%
38330 }%
38331 }%
38332 }
38333 % \end{macrocode}
38334 %\end{macro}
38335 %
38336 %
38337 %\begin{macro}{\staticswitchoffnextonly}
38338 %\changes{1.14}{2012-11-10}{new}
38339 % Switch off the listed static frames for just the next page
38340 % \begin{macrocode}
38341 \newcommand*{\staticswitchoffnextonly}{%
38342 \@ifstar\@sstaticswitchoffnextonly\@staticswitchoffnextonly
38343 }
38344 % \end{macrocode}
38345 %\end{macro}
38346 %
38347 %\begin{macro}{\@sstaticswitchoffnextonly}
38348 % The starred version uses \glspl{idl}.
38349 % \begin{macrocode}
38350 \newcommand{\@sstaticswitchoffnextonly}[1]{%
38351 \count@=\@ff@pages@countreg\relax
38352 \advance\count@ by 1\relax
38353 \@for\@ff@id:=#1\do{%
38354 \@staticframeid{\@ff@id}%
38355 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
38356 \xdef\@ff@output@adjustframes{%
38357 \the\toks@
38358 \noexpand\staticaddexclusion{\number\ff@id}{\number\count@}%
38359 }%
38360 }%
38361 }
38362 % \end{macrocode}
38363 %\end{macro}
38364 %
38365 %\begin{macro}{\@staticswitchoffnextonly}
38366 % The unstarred version uses \glspl{idn}.
38367 % \begin{macrocode}
38368 \newcommand{\@staticswitchoffnextonly}[1]{%
38369 \count@=\@ff@pages@countreg\relax
38370 \advance\count@ by 1\relax
38371 \@for\@ff@id:=#1\do{%
38372 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
38373 \xdef\@ff@output@adjustframes{%
38374 \the\toks@
38375 \noexpand\staticaddexclusion{\number\@ff@id}{\number\count@}%
38376 }%
38377 }%
38378 }
38379 % \end{macrocode}
38380 %\end{macro}
38381 %
38382 %\begin{macro}{\staticswitchoffnextoddonly}
38383 %\changes{1.14}{2012-11-10}{new}
38384 % Switch off the listed static frames for just the next odd page
38385 % \begin{macrocode}
38386 \newcommand*{\staticswitchoffnextoddonly}{%
38387 \@ifstar\@sstaticswitchoffnextoddonly\@staticswitchoffnextoddonly
38388 }
38389 % \end{macrocode}
38390 %\end{macro}
38391 %
38392 %\begin{macro}{\@sstaticswitchoffnextoddonly}
38393 % The starred version uses \glspl{idl}.
38394 % \begin{macrocode}
38395 \newcommand{\@sstaticswitchoffnextoddonly}[1]{%
38396 \count@=\@ff@pages@countreg\relax
38397 \advance\count@ by 1\relax
38398 \ifodd\count@\relax
38399 \else
38400 \advance\count@ by 1\relax
38401 \fi
38402 \@for\@ff@id:=#1\do{%
38403 \@staticframeid{\@ff@id}%
38404 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
38405 \xdef\@ff@output@adjustframes{%
38406 \the\toks@
38407 \noexpand\staticaddexclusion{\number\ff@id}{\number\count@}%
38408 }%
38409 }%
38410 }
38411 % \end{macrocode}
38412 %\end{macro}
38413 %
38414 %\begin{macro}{\@staticswitchoffnextoddonly}
38415 % The unstarred version uses \glspl{idn}.
38416 % \begin{macrocode}
38417 \newcommand{\@staticswitchoffnextoddonly}[1]{%
38418 \count@=\@ff@pages@countreg\relax
38419 \advance\count@ by 1\relax
38420 \ifodd\count@\relax
38421 \else
38422 \advance\count@ by 1\relax
38423 \fi
38424 \@for\@ff@id:=#1\do{%
38425 \expandafter\toks@\expandafter{\@ff@output@adjustframes}%
38426 \xdef\@ff@output@adjustframes{%
38427 \the\toks@
38428 \noexpand\staticaddexclusion{\number\@ff@id}{\number\count@}%
38429 }%
38430 }%
38431 }
38432 % \end{macrocode}
38433 %\end{macro}
38434 %
38435 %\begin{macro}{\ffaddtoadjustframeshook}
38436 %\changes{1.14}{2012-11-10}{new}
38437 % Add stuff to the output hook.
38438 % \begin{macrocode}
38439 \newcommand*{\ffaddtoadjustframeshook}[1]{%
38440 \@ff@addtolist\@ff@output@adjustframes\entry{#1}%
38441 }
38442 % \end{macrocode}
38443 %\end{macro}
38444 %
38445 %\begin{macro}{\@g@tnextcol}
38446 % Find the next \gls{flow}. If there are no more flow
38447 % frames, define a new one the size of the \gls{typeblock}.
38448 % (Otherwise the remaining document text will be lost.)
38449 % \begin{macrocode}
38450 \newif\if@notthiscol
38451 \newif\if@ff@nwpg
38452 \newcount\c@curpg
38453 \newcommand*{\@g@tnextcol}[1]{%
38454 % \end{macrocode}
38455 % Do any frame adjustments
38456 % \begin{macrocode}
38457 \@ff@output@adjustframes
38458 % \end{macrocode}
38459 % Now clear the hook
38460 % \begin{macrocode}
38461 \global\let\@ff@output@adjustframes\@empty
38462 % \end{macrocode}
38463 % Now check for any more frames.
38464 % \begin{macrocode}
38465 \@ff@checkifmoreframes
38466 \if@ff@moreframes
38467 \else
38468 % \end{macrocode}
38469 % No more frames, add new frame
38470 % \begin{macrocode}
38471 \PackageWarning{flowfram}%
38472 {Run out of flows frames on page \number\@ff@pages@countreg, adding new one}%
38473 \flf@doifverbose
38474 {%
38475 \def\flf@messinfo{Here's the list of flow frames:}%
38476 \count@=0\relax
38477 \loop
38478 \advance\count@ by 1\relax
38479 \expandafter\toks@\expandafter{\flf@messinfo\MessageBreak}%
38480 \edef\flf@messinfo{\the\toks@
38481 \number\count@.
38482 Pages: \csname @ff@pages@\romannumeral\count@\endcsname.
38483 Exclusions: \csname @ff@xpages@\romannumeral\count@\endcsname.
38484 }%
38485 \ifnum\count@<\c@maxflow
38486 \repeat
38487 \PackageInfo{flowfram}{\flf@messinfo\@gobbletwo}%
38488 }%
38489 \@onecolumn
38490 #1=\c@maxflow
38491 \fi
38492 \@notthiscoltrue
38493 \@ff@nwpgfalse
38494 \@colN=#1\relax
38495 % \end{macrocode}
38496 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
38497 %\cs{@ff@pages@countreg}}
38498 % \begin{macrocode}
38499 \c@curpg=\@ff@pages@countreg
38500 \loop
38501 \ifnum\@colN=\c@maxflow
38502 % \end{macrocode}
38503 % Reached the end of the page. Try the next one.
38504 % \begin{macrocode}
38505 \@colN=1\relax
38506 \@ff@nwpgtrue
38507 \advance\c@curpg by 1\relax
38508 \else
38509 % \end{macrocode}
38510 % Move on to the next flow frame on this page.
38511 % \begin{macrocode}
38512 \advance\@colN by 1\relax
38513 \fi
38514 \@ff@chckifthispg{\c@curpg}{\@colN}%
38515 \if@notthiscol
38516 \repeat
38517 #1=\@colN\relax
38518 }
38519 % \end{macrocode}
38520 %\end{macro}
38521 %\begin{macro}{\@ff@chckifthispg}
38522 % This is used to determine the next \gls{flow}, since not
38523 % all \glspl{flow} may be defined on every page. Checks to
38524 % see if \gls{flow} "#2" is defined on page "#1".
38525 % First set up some variables.
38526 % \begin{macrocode}
38527 \newcommand*{\@ff@chckifthispg}[2]{%
38528 \@notthiscolfalse
38529 \edef\ff@xpages{\csname @ff@xpages@\romannumeral#2\endcsname}%
38530 \@for\@ff@pp:=\ff@xpages\do
38531 {%
38532 \ifnum0\@ff@pp=#1\relax
38533 \@notthiscoltrue
38534 \@endfortrue
38535 \fi
38536 }%
38537 \if@notthiscol
38538 \else
38539 \@notthiscoltrue
38540 \edef\ff@pages{\csname @ff@pages@\romannumeral#2\endcsname}%
38541 \@@ff@chckifthispg{#1}%
38542 \fi
38543 }
38544 % \end{macrocode}
38545 %\end{macro}
38546 %\begin{macro}{\@@ff@chckifthispg}
38547 % Now go ahead and check.
38548 % \begin{macrocode}
38549 \newcommand*{\@@ff@chckifthispg}[1]{%
38550 \ifthenelse{\equal{\ff@pages}{none}}%
38551 {}%
38552 {%
38553 \ifthenelse{\equal{\ff@pages}{all}}%
38554 {%
38555 \@notthiscolfalse
38556 }%
38557 {%
38558 \ifthenelse{\equal{\ff@pages}{odd}}%
38559 {%
38560 \ifodd#1\@notthiscolfalse\fi
38561 }%
38562 {%
38563 \ifthenelse{\equal{\ff@pages}{even}}%
38564 {%
38565 \ifodd#1\else\@notthiscolfalse\fi
38566 }%
38567 {%
38568 % \end{macrocode}
38569 % check through list of page numbers
38570 % \begin{macrocode}
38571 \@for\@ff@pp:=\ff@pages\do{%
38572 \def\@ff@numstart{0}%
38573 \def\@ff@numend{0}%
38574 \@ff@getrange{\@ff@pp}%
38575 \ifthenelse{#1<\@ff@numstart \or #1>\@ff@numend}%
38576 {}%
38577 {%
38578 \@notthiscolfalse
38579 }%
38580 }%
38581 }%
38582 }%
38583 }%
38584 }%
38585 }
38586 % \end{macrocode}
38587 %\end{macro}
38588 %\begin{macro}{\@sf@chckifthispg}
38589 % Checks to see if \gls{static} "#1" is defined on the
38590 % current page (or the page given by the optional argument).
38591 %\changes{1.14}{2012-11-10}{added optional argument}
38592 % \begin{macrocode}
38593 \newcommand*{\@sf@chckifthispg}[2][\@ff@pages@countreg]{%
38594 \@notthiscoltrue
38595 \edef\ff@pages{\csname @sf@pages@\romannumeral#2\endcsname}%
38596 % \end{macrocode}
38597 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
38598 %\cs{@ff@pages@countreg}}
38599 % \begin{macrocode}
38600 \@@ff@chckifthispg{#1}%
38601 }
38602 % \end{macrocode}
38603 %\end{macro}
38604 %\begin{macro}{\@df@chckifthispg}
38605 % Checks to see if \gls{dynamic} "#1" is defined on the
38606 % current page (or the page given by the optional argument).
38607 %\changes{1.14}{2012-11-10}{added optional argument}
38608 % \begin{macrocode}
38609 \newcommand*{\@df@chckifthispg}[2][\@ff@pages@countreg]{%
38610 \@notthiscoltrue
38611 \edef\ff@pages{\csname @df@pages@\romannumeral#2\endcsname}%
38612 % \end{macrocode}
38613 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
38614 %\cs{@ff@pages@countreg}}
38615 % \begin{macrocode}
38616 \@@ff@chckifthispg{#1}%
38617 }
38618 % \end{macrocode}
38619 %\end{macro}
38620 %\begin{macro}{\@setcolbox}
38621 % Sets the \TeX\ box defining the \gls{flow} to the output
38622 % box. This saves the output until the page is shipped out after
38623 % all the \glspl{flow} have been filled for that page.
38624 % \begin{macrocode}
38625 \newcommand*{\@setcolbox}[1]{%
38626 \flf@message{Setting contents of box for flow frame \number#1}%
38627 \expandafter\global\expandafter\setbox
38628 \csname column\romannumeral#1\endcsname\box\@outputbox
38629 }
38630 % \end{macrocode}
38631 %\end{macro}
38632 %\begin{macro}{\@docolbox}
38633 % Put \gls{flow} on the page with the correct border, if it
38634 % has one.
38635 % \begin{macrocode}
38636 \newcommand*{\@docolbox}[1]{%
38637 \flf@message{Doing flow frame \number#1\space
38638 (page \number\@ff@pages@countreg)}%
38639 \edef\ff@frametype{%
38640 \csname @ff@frametype@\romannumeral#1\endcsname}%
38641 % \end{macrocode}
38642 % Frame colour
38643 % \begin{macrocode}
38644 \edef\ff@col{\csname @ff@col@\romannumeral#1\endcsname}%
38645 % \end{macrocode}
38646 % Text colour
38647 % \begin{macrocode}
38648 \edef\ff@txtcol{\csname @ff@txtcol@\romannumeral#1\endcsname}%
38649 % \end{macrocode}
38650 % Background colour
38651 % \begin{macrocode}
38652 \edef\ff@backcol{\csname @ff@backcol@\romannumeral#1\endcsname}%
38653 % \end{macrocode}
38654 % Compute offset for this frame
38655 % \begin{macrocode}
38656 \@ff@setoffset{#1}%
38657 % \end{macrocode}
38658 % Rotate frame if required
38659 % \begin{macrocode}
38660 \rotateframe{\csname @ff@angle@\romannumeral#1\endcsname}%
38661 {%
38662 % \end{macrocode}
38663 % Check if frame has a border
38664 % \begin{macrocode}
38665 \ifthenelse{\boolean{columnframe\romannumeral#1}}%
38666 {%
38667 % \end{macrocode}
38668 % Put the required border around the frame
38669 % \begin{macrocode}
38670 \@ff@fbox
38671 {\csname colwidth\romannumeral#1\endcsname}%
38672 {\csname colheight\romannumeral#1\endcsname}%
38673 {%
38674 \expandafter\box\csname column\romannumeral#1\endcsname
38675 }%
38676 {%
38677 \csname\ff@frametype\endcsname
38678 }%
38679 }%
38680 {%
38681 % \end{macrocode}
38682 % Do the frame without a border
38683 % \begin{macrocode}
38684 \@ff@box
38685 {\csname colwidth\romannumeral#1\endcsname}%
38686 {\csname colheight\romannumeral#1\endcsname}%
38687 {%
38688 \expandafter\box\csname column\romannumeral#1\endcsname
38689 }%
38690 }%
38691 }%
38692 }
38693 % \end{macrocode}
38694 %\end{macro}
38695 %\begin{macro}{\@docolbbox}
38696 % Do the \gls{bbox} for given \gls{flow}.
38697 % \begin{macrocode}
38698 \newcommand*{\@docolbbox}[1]{%
38699 \@ff@setoffset{#1}%
38700 \def\ff@col{}\def\ff@txtcol{}%
38701 \@fr@meifdraft
38702 {%
38703 \@ff@box
38704 {\csname colwidth\romannumeral#1\endcsname}%
38705 {\csname colheight\romannumeral#1\endcsname}%
38706 {%
38707 \expandafter\box\csname column\romannumeral#1\endcsname
38708 }%
38709 }%
38710 {F:\number#1;\csname @col@id@\romannumeral#1\endcsname}%
38711 }
38712 % \end{macrocode}
38713 %\end{macro}
38714 %\begin{macro}{\@ff@fbox}
38715 % Put the \TeX\ box "#3" of width "#1" and
38716 % height "#2", and frame making command
38717 % specified by "#4".
38718 % \begin{macrocode}
38719 \newcommand{\@ff@fbox}[4]{%
38720 {%
38721 \fboxsep=\flowframesep
38722 \fboxrule=\flowframerule
38723 \@s@tffcol
38724 \kern\@ff@offset
38725 #4{\@ff@box{#1}{#2}{#3}}%
38726 }%
38727 }
38728 % \end{macrocode}
38729 %\end{macro}
38730 %\begin{macro}{\@ff@box}
38731 % Put the \TeX\ box "#3" of width "#1" and height "#2" on
38732 % the page.
38733 % \begin{macrocode}
38734 \newcommand{\@ff@box}[3]{%
38735 {%
38736 \@ffbackground
38737 {%
38738 \vbox to#2 {\hb@xt@ #1{\hss{\@s@tfftextcol #3}\hss}\vss\kern\z@}%
38739 }%
38740 }%
38741 }
38742 % \end{macrocode}
38743 %\end{macro}
38744 %\begin{macro}{\@putcolbox}
38745 % Display the \gls{flow} on the page, at its given position.
38746 % If the document is two-sided, need to check whether
38747 % the current page is odd or even to determine the correct
38748 % location.
38749 % \begin{macrocode}
38750 \newcommand*{\@putcolbox}[1]{%
38751 % \end{macrocode}
38752 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
38753 %\cs{@ff@pages@countreg}}
38754 % \begin{macrocode}
38755 \@ff@chckifthispg{\@ff@pages@countreg}{#1}%
38756 % \end{macrocode}
38757 %\changes{1.14}{2012-11-10}{added check for non-void box}
38758 % \begin{macrocode}
38759 \if@notthiscol
38760 \expandafter\ifvoid\csname column\romannumeral#1\endcsname
38761 \else
38762 \PackageWarning{flowfram}{Box \number#1\space is not void.
38763 Dumping. This page: \number\@ff@pages@countreg.
38764 Page list: "\csname @ff@pages@\romannumeral#1\endcsname".
38765 Exclusion list: "\csname @ff@xpages@\romannumeral#1\endcsname".
38766 (Maybe the page list was changed after this frame was
38767 selected or maybe you should use package option pages=absolute)}%
38768 \@notthiscolfalse
38769 \fi
38770 \fi
38771 \if@notthiscol
38772 \flf@message{Flow frame \number#1\space is not required on page
38773 \number\@ff@pages@countreg}%
38774 \else
38775 \@killglue
38776 \if@twoside
38777 \ifodd\c@page
38778 \expandafter\raise\csname col@\romannumeral#1@posy\endcsname
38779 \hb@xt@\z@
38780 {%
38781 \expandafter\kern \csname col@\romannumeral#1@posx\endcsname
38782 \@docolbox{#1}\hss
38783 }%
38784 \else
38785 \expandafter\raise\csname col@\romannumeral#1@eveny\endcsname
38786 \hb@xt@\z@
38787 {%
38788 \expandafter\kern \csname col@\romannumeral#1@evenx\endcsname
38789 \@docolbox{#1}\hss
38790 }%
38791 \fi
38792 \else
38793 \expandafter\raise\csname col@\romannumeral#1@posy\endcsname
38794 \hb@xt@\z@
38795 {%
38796 \expandafter\kern \csname col@\romannumeral#1@posx\endcsname
38797 \@docolbox{#1}\hss
38798 }%
38799 \fi
38800 \fi
38801 }
38802 % \end{macrocode}
38803 %\end{macro}
38804 %\begin{macro}{\@putcolbbox}
38805 % Same for \gls{flow} \gls{bbox}:
38806 % \begin{macrocode}
38807 \newcommand*{\@putcolbbox}[1]{%
38808 % \end{macrocode}
38809 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with \cs{@ff@pages@countreg}}
38810 % \begin{macrocode}
38811 \@ff@chckifthispg{\@ff@pages@countreg}{#1}%
38812 \if@notthiscol
38813 \else
38814 \@killglue
38815 \if@twoside
38816 \ifodd\c@page
38817 \expandafter\raise\csname col@\romannumeral#1@posy\endcsname
38818 \hb@xt@\z@
38819 {%
38820 \expandafter\kern \csname col@\romannumeral#1@posx\endcsname
38821 \@docolbbox{#1}\hss
38822 }%
38823 \else
38824 \expandafter\raise\csname col@\romannumeral#1@eveny\endcsname
38825 \hb@xt@\z@
38826 {%
38827 \expandafter\kern \csname col@\romannumeral#1@evenx\endcsname
38828 \@docolbbox{#1}\hss
38829 }%
38830 \fi
38831 \else
38832 \expandafter\raise\csname col@\romannumeral#1@posy\endcsname
38833 \hb@xt@\z@
38834 {%
38835 \expandafter\kern \csname col@\romannumeral#1@posx\endcsname
38836 \@docolbbox{#1}\hss
38837 }%
38838 \fi
38839 \fi
38840 }
38841 % \end{macrocode}
38842 %\end{macro}
38843 % If an offset hasn't been specified, compute it. If the
38844 % frame making command is known (e.g. doublebox), compute
38845 % the offset according to known specifications, otherwise
38846 % set the negative offset to "\flowframesep" plus
38847 % "\flowframerule", which may or may not be correct.
38848 %
38849 %\begin{macro}{\@ff@s@t@doubleboxoffset}
38850 % Compute offset for "\doublebox":
38851 % \begin{macrocode}
38852 \newcommand*{\@ff@s@t@doubleboxoffset}{%
38853 \setlength{\@ff@offset}{-\flowframesep}%
38854 \addtolength{\@ff@offset}{-3.75\flowframerule}%
38855 \addtolength{\@ff@offset}{-.5pt}%
38856 }
38857 % \end{macrocode}
38858 %\end{macro}
38859 %\begin{macro}{\@ff@s@t@ovalboxoffset}
38860 % Compute offset for "\ovalbox":
38861 % \begin{macrocode}
38862 \newcommand*{\@ff@s@t@ovalboxoffset}{%
38863 \@ff@offset=-\fontdimen 8\tenln\relax
38864 \advance\@ff@offset by -\flowframesep\relax
38865 }
38866 % \end{macrocode}
38867 %\end{macro}
38868 %\begin{macro}{\@ff@s@t@Ovalboxoffset}
38869 % Compute offset for "\ovalbox":
38870 % \begin{macrocode}
38871 \newcommand*{\@ff@s@t@Ovalboxoffset}{%
38872 \@ff@offset=-\fontdimen 8\tenlnw\relax
38873 \advance\@ff@offset by -\flowframesep\relax
38874 }
38875 % \end{macrocode}
38876 %\end{macro}
38877 %\begin{macro}{\@ff@s@t@defaultoffset}
38878 % Compute default offset:
38879 % \begin{macrocode}
38880 \newcommand*{\@ff@s@t@defaultoffset}{%
38881 \@ff@offset=-\flowframesep\relax
38882 \addtolength{\@ff@offset}{-\flowframerule}%
38883 }
38884 % \end{macrocode}
38885 %\end{macro}
38886 %\begin{macro}{\@ff@setoffset}
38887 % Compute offset for \gls{flow} "#1". Stores offset value
38888 % in "\ff@offset".
38889 % \begin{macrocode}
38890 \newcommand*{\@ff@setoffset}[1]{%
38891 \ifthenelse
38892 {\equal{\csname @ff@offset@\romannumeral#1\endcsname}{compute}}%
38893 {%
38894 \ifthenelse{\boolean{columnframe\romannumeral#1}}%
38895 {%
38896 \ifthenelse
38897 {%
38898 \equal{\csname @ff@frametype@\romannumeral#1\endcsname}%
38899 {doublebox}%
38900 }%
38901 {%
38902 \@ff@s@t@doubleboxoffset
38903 }%
38904 {%
38905 \ifthenelse
38906 {%
38907 \equal{\csname @ff@frametype@\romannumeral#1\endcsname}%
38908 {ovalbox}%
38909 }%
38910 {%
38911 \@ff@s@t@ovalboxoffset
38912 }%
38913 {%
38914 \ifthenelse
38915 {%
38916 \equal{\csname @ff@frametype@\romannumeral#1\endcsname}%
38917 {Ovalbox}%
38918 }%
38919 {%
38920 \@ff@s@t@Ovalboxoffset
38921 }%
38922 {%
38923 \@ff@s@t@defaultoffset
38924 }%
38925 }%
38926 }%
38927 }%
38928 {}%
38929 }%
38930 {%
38931 \setlength{\@ff@offset}%
38932 {\csname @ff@offset@\romannumeral#1\endcsname}%
38933 }%
38934 }
38935 % \end{macrocode}
38936 %\end{macro}
38937 %\begin{macro}{\@sf@setoffset}
38938 % Compute offset for \gls{static} "#1". Stores offset value
38939 % in "\ff@offset".
38940 % \begin{macrocode}
38941 \newcommand*{\@sf@setoffset}[1]{%
38942 \ifthenelse
38943 {%
38944 \equal{\csname @sf@offset@\romannumeral#1\endcsname}%
38945 {compute}%
38946 }%
38947 {%
38948 \ifthenelse{\boolean{staticframe\romannumeral#1}}%
38949 {%
38950 \ifthenelse
38951 {%
38952 \equal{\csname @sf@frametype@\romannumeral#1\endcsname}%
38953 {doublebox}%
38954 }%
38955 {%
38956 \@ff@s@t@doubleboxoffset
38957 }%
38958 {%
38959 \ifthenelse
38960 {%
38961 \equal{\csname @sf@frametype@\romannumeral#1\endcsname}%
38962 {ovalbox}%
38963 }%
38964 {%
38965 \@ff@s@t@ovalboxoffset
38966 }%
38967 {%
38968 \ifthenelse
38969 {%
38970 \equal{\csname @sf@frametype@\romannumeral#1\endcsname}%
38971 {Ovalbox}%
38972 }%
38973 {%
38974 \@ff@s@t@Ovalboxoffset
38975 }%
38976 {%
38977 \@ff@s@t@defaultoffset
38978 }%
38979 }%
38980 }%
38981 }%
38982 {}%
38983 }%
38984 {%
38985 \setlength{\@ff@offset}%
38986 {\csname @sf@offset@\romannumeral#1\endcsname}%
38987 }%
38988 }
38989 % \end{macrocode}
38990 %\end{macro}
38991 %\begin{macro}{\@df@setoffset}
38992 % Compute offset for \gls{dynamic} "#1". Stores offset value
38993 % in "\ff@offset".
38994 % \begin{macrocode}
38995 \newcommand*{\@df@setoffset}[1]{%
38996 \ifthenelse
38997 {%
38998 \equal{\csname @df@offset@\romannumeral#1\endcsname}%
38999 {compute}%
39000 }%
39001 {%
39002 \setlength{\@ff@offset}{0pt}%
39003 \ifthenelse{\boolean{dynamicframe\romannumeral#1}}%
39004 {%
39005 \ifthenelse
39006 {%
39007 \equal{\csname @df@frametype@\romannumeral#1\endcsname}%
39008 {doublebox}%
39009 }%
39010 {%
39011 \@ff@s@t@doubleboxoffset
39012 }%
39013 {%
39014 \ifthenelse
39015 {%
39016 \equal{\csname @df@frametype@\romannumeral#1\endcsname}%
39017 {ovalbox}%
39018 }%
39019 {%
39020 \@ff@s@t@ovalboxoffset
39021 }%
39022 {%
39023 \ifthenelse
39024 {%
39025 \equal{\csname @df@frametype@\romannumeral#1\endcsname}%
39026 {Ovalbox}%
39027 }%
39028 {%
39029 \@ff@s@t@Ovalboxoffset
39030 }%
39031 {%
39032 \@ff@s@t@defaultoffset
39033 }%
39034 }%
39035 }%
39036 }%
39037 {}%
39038 }%
39039 {%
39040 \setlength{\@ff@offset}%
39041 {\csname @df@offset@\romannumeral#1\endcsname}%
39042 }%
39043 }
39044 % \end{macrocode}
39045 %\end{macro}
39046 %\begin{macro}{\@putmarginbox}
39047 % Draw box representing the margin for \gls{flow} "#1".
39048 % \begin{macrocode}
39049 \newcommand*{\@putmarginbox}[1]{%
39050 % \end{macrocode}
39051 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
39052 %\cs{@ff@pages@countreg}}
39053 % \begin{macrocode}
39054 \@ff@chckifthispg{\@ff@pages@countreg}{#1}%
39055 \if@notthiscol
39056 \else
39057 \@killglue
39058 \if@twoside
39059 \ifodd\c@page
39060 \edef\ff@x{\csname col@\romannumeral#1@posx\endcsname}%
39061 \edef\ff@y{\csname col@\romannumeral#1@posy\endcsname}%
39062 \else
39063 \edef\ff@x{\csname col@\romannumeral#1@evenx\endcsname}%
39064 \edef\ff@y{\csname col@\romannumeral#1@eveny\endcsname}%
39065 \fi
39066 \else
39067 \edef\ff@x{\csname col@\romannumeral#1@posx\endcsname}%
39068 \edef\ff@y{\csname col@\romannumeral#1@posy\endcsname}%
39069 \fi
39070 \setlength{\@ff@tmp@x}{\ff@x}%
39071 \setlength{\@ff@tmp@y}{\ff@y}%
39072 \@getmarginpos{\csname @ff@margin@\romannumeral#1\endcsname}%
39073 \ifthenelse{\equal{\ff@margin}{left}}%
39074 {%
39075 \addtolength{\@ff@tmp@x}{-\marginparwidth}%
39076 \addtolength{\@ff@tmp@x}{-\marginparsep}%
39077 \ifthenelse{\boolean{columnframe\romannumeral#1}}%
39078 {}%
39079 {}%
39080 }%
39081 {%
39082 \addtolength{\@ff@tmp@x}%
39083 {\csname colwidth\romannumeral#1\endcsname}%
39084 \addtolength{\@ff@tmp@x}{\marginparsep}%
39085 \ifthenelse{\boolean{columnframe\romannumeral#1}}%
39086 {}%
39087 {}%
39088 }%
39089 \raise\@ff@tmp@y
39090 \hb@xt@\z@
39091 {%
39092 \expandafter\kern\@ff@tmp@x
39093 \@fr@meifdraft{\@ff@box{\marginparwidth}%
39094 {\csname colheight\romannumeral#1\endcsname}{}}%
39095 {M:\number#1}\hss
39096 }%
39097 \fi
39098 \ignorespaces
39099 }
39100 % \end{macrocode}
39101 %\end{macro}
39102 %\begin{macro}{\@ff@drawmargins}
39103 % Draw all the margins associated with the \glspl{flow} defined
39104 % on the current page.
39105 % \begin{macrocode}
39106 \newcommand*{\@ff@drawmargins}{%
39107 \@colN=0\relax
39108 \whiledo{\@colN<\c@maxflow}%
39109 {%
39110 \advance\@colN by 1\relax
39111 \makebox[0pt][l]{\@putmarginbox{\@colN}}%
39112 }%
39113 }
39114 % \end{macrocode}
39115 %\end{macro}
39116 %\begin{macro}{\@ff@getstaticpos}
39117 % Extract the width and height for static or \gls{dynamic}
39118 % specified in the form \oarg{c}\oarg{height}\oarg{valign}\marg{width}
39119 % \begin{macrocode}
39120 \def\@ff@getstaticpos[#1][#2][#3]#4{%
39121 \@ff@tmp@x=#4\relax
39122 \@ff@tmp@y=#2\relax
39123 \def\ff@valign{#3}%
39124 }
39125 % \end{macrocode}
39126 %\end{macro}
39127 %\begin{macro}{\@dostaticbox}
39128 % Display the savebox associated with \gls{static} "#1"
39129 % \begin{macrocode}
39130 \newcommand*{\@dostaticbox}[1]{%
39131 \edef\ff@frametype{%
39132 \csname @sf@frametype@\romannumeral#1\endcsname
39133 }%
39134 \edef\ff@col{\csname @sf@col@\romannumeral#1\endcsname}%
39135 \edef\ff@backcol{\csname @sf@backcol@\romannumeral#1\endcsname}%
39136 \@sf@setoffset{#1}%
39137 \expandafter\expandafter\expandafter
39138 \@ff@getstaticpos\csname @sf@dim@\romannumeral#1\endcsname
39139 \rotateframe
39140 {\csname @sf@angle@\romannumeral#1\endcsname}%
39141 {%
39142 \ifthenelse{\boolean{staticframe\romannumeral#1}}%
39143 {%
39144 \@ff@fbox{\@ff@tmp@x}{\@ff@tmp@y}%
39145 {%
39146 \expandafter\usebox\csname @staticframe@\romannumeral#1\endcsname
39147 }
39148 {\csname\ff@frametype\endcsname}%
39149 }%
39150 {%
39151 \@ff@box{\@ff@tmp@x}{\@ff@tmp@y}%
39152 {%
39153 \expandafter\usebox\csname @staticframe@\romannumeral#1\endcsname
39154 }%
39155 }%
39156 }%
39157 }
39158 % \end{macrocode}
39159 %\end{macro}
39160 %\begin{macro}{\@dostaticbbox}
39161 % Now for the \gls{bbox}:
39162 % \begin{macrocode}
39163 \newcommand*{\@dostaticbbox}[1]{%
39164 \edef\ff@col{}%
39165 \@sf@setoffset{#1}%
39166 \expandafter\expandafter\expandafter
39167 \@ff@getstaticpos\csname @sf@dim@\romannumeral#1\endcsname
39168 \@fr@meifdraft
39169 {%
39170 \@ff@box{\@ff@tmp@x}{\@ff@tmp@y}%
39171 {%
39172 \expandafter\usebox\csname @staticframe@\romannumeral#1\endcsname
39173 }%
39174 }%
39175 {S:\number#1;\csname @sf@id@\romannumeral#1\endcsname}%
39176 }
39177 % \end{macrocode}
39178 %\end{macro}
39179 %\begin{macro}{\@putstaticbox}
39180 % Put the static box "#1" at its given position, with its
39181 % associated border.
39182 % \begin{macrocode}
39183 \newcommand*{\@putstaticbox}[1]{%
39184 % \end{macrocode}
39185 %\changes{2014-06-04}{1.16}{added check for `hide' and `hidethis'
39186 %attributes}
39187 % Check the `hide' and `hidethis' attributes
39188 % \begin{macrocode}
39189 \ifthenelse{\boolean{@sf@hidethis@\romannumeral#1}}%
39190 {%
39191 \@notthiscoltrue
39192 \global\csletcs{if@sf@hidethis@\romannumeral#1}{iffalse}%
39193 }%
39194 {%
39195 \ifthenelse{\boolean{@sf@hide@\romannumeral#1}}%
39196 {%
39197 \@notthiscoltrue
39198 }%
39199 {%
39200 % \end{macrocode}
39201 % Neither `hide' nor `hidethis' have been set so check the page
39202 % list.
39203 % \begin{macrocode}
39204 \@sf@chckifthispg{#1}%
39205 }%
39206 }%
39207 \if@notthiscol
39208 \else
39209 \@killglue
39210 \if@twoside
39211 \ifodd\c@page
39212 \expandafter\raise\csname @sf@\romannumeral#1@posy\endcsname
39213 \hb@xt@\z@
39214 {%
39215 \expandafter\kern \csname @sf@\romannumeral#1@posx\endcsname
39216 \@dostaticbox{#1}\hss
39217 }%
39218 \else
39219 \expandafter\raise\csname @sf@\romannumeral#1@eveny\endcsname
39220 \hb@xt@\z@
39221 {%
39222 \expandafter\kern \csname @sf@\romannumeral#1@evenx\endcsname
39223 \@dostaticbox{#1}\hss
39224 }%
39225 \fi
39226 \else
39227 \expandafter\raise\csname @sf@\romannumeral#1@posy\endcsname
39228 \hb@xt@\z@
39229 {%
39230 \expandafter\kern \csname @sf@\romannumeral#1@posx\endcsname
39231 \@dostaticbox{#1}\hss
39232 }%
39233 \fi
39234 \fi
39235 }
39236 % \end{macrocode}
39237 %\end{macro}
39238 %\begin{macro}{\@putstaticbbox}
39239 % Now for the \gls{bbox}:
39240 % \begin{macrocode}
39241 \newcommand*{\@putstaticbbox}[1]{%
39242 \@sf@chckifthispg{#1}%
39243 \if@notthiscol
39244 \else
39245 \@killglue
39246 \if@twoside
39247 \ifodd\c@page
39248 \expandafter\raise\csname @sf@\romannumeral#1@posy\endcsname
39249 \hb@xt@\z@
39250 {%
39251 \expandafter\kern \csname @sf@\romannumeral#1@posx\endcsname
39252 \@dostaticbbox{#1}\hss
39253 }%
39254 \ignorespaces
39255 \else
39256 \expandafter\raise\csname @sf@\romannumeral#1@eveny\endcsname
39257 \hb@xt@\z@
39258 {%
39259 \expandafter\kern \csname @sf@\romannumeral#1@evenx\endcsname
39260 \@dostaticbbox{#1}\hss
39261 }%
39262 \ignorespaces
39263 \fi
39264 \else
39265 \expandafter\raise\csname @sf@\romannumeral#1@posy\endcsname
39266 \hb@xt@\z@
39267 {%
39268 \expandafter\kern \csname @sf@\romannumeral#1@posx\endcsname
39269 \@dostaticbbox{#1}\hss
39270 }%
39271 \ignorespaces
39272 \fi
39273 \fi
39274 }
39275 % \end{macrocode}
39276 %\end{macro}
39277 %\begin{macro}{\@resetst@tics}
39278 % Clear the contents of all the \glspl{static} that have
39279 % the "clear" option set.
39280 % \begin{macrocode}
39281 \newcommand*{\@resetst@tics}{%
39282 \@colN=0\relax
39283 \whiledo{\@colN<\c@maxstatic}%
39284 {%
39285 \advance\@colN by 1\relax
39286 % \end{macrocode}
39287 % Has the clear flag been set?
39288 % \begin{macrocode}
39289 \ifthenelse{\boolean{@sf@clear@\romannumeral\@colN}}%
39290 {%
39291 % \end{macrocode}
39292 % Set the contents of the box to empty
39293 % \begin{macrocode}
39294 \global\sbox
39295 {%
39296 \csname @staticframe@\romannumeral\@colN\endcsname
39297 }%
39298 {}%
39299 }%
39300 {}%
39301 }%
39302 }
39303 % \end{macrocode}
39304 %\end{macro}
39305 %\begin{macro}{\@resetdyn@mics}
39306 % Clear the contents of the \glspl{dynamic} that have the "clear" option
39307 % set.
39308 % \begin{macrocode}
39309 \newcommand*{\@resetdyn@mics}{%
39310 \@colN=0\relax
39311 \whiledo{\@colN<\c@maxdynamic}%
39312 {%
39313 \advance\@colN by 1\relax
39314 \ifthenelse{\boolean{@df@clear@\romannumeral\@colN}}%
39315 {%
39316 \expandafter\global\expandafter
39317 \gdef\csname @dynamicframe@\romannumeral\@colN\endcsname{}%
39318 }%
39319 {}%
39320 }%
39321 }
39322 % \end{macrocode}
39323 %\end{macro}
39324 %\begin{macro}{\@dodfparbox}
39325 % Display contents of dynamic box (contents stored in
39326 % "\ff@contents", style given by "\ff@style"):
39327 % \begin{macrocode}
39328 \newcommand*{\@dodfparbox}[1]{%
39329 \expandafter\let\expandafter
39330 \@ff@parshape\csname @df@shape@\romannumeral#1\endcsname
39331 \expandafter\@ff@getshape\@ff@parshape\relax
39332 \ifcase\ff@shape
39333 % \end{macrocode}
39334 % no shape
39335 % \begin{macrocode}
39336 \expandafter\expandafter\expandafter
39337 \parbox\csname @df@dim@\romannumeral#1\endcsname
39338 {%
39339 \setlength\parindent\sdfparindent
39340 \csname\ff@style\endcsname{\ff@contents}%
39341 }%
39342 \or
39343 % \end{macrocode}
39344 % \cs{parshape}
39345 % \begin{macrocode}
39346 \expandafter\expandafter\expandafter
39347 \parbox\csname @df@dim@\romannumeral#1\endcsname
39348 {%
39349 \setlength\parindent\sdfparindent
39350 \csname\ff@style\endcsname
39351 {{%
39352 \let\oldpar=\par
39353 \let\par=\ffpshpar
39354 \@ff@setsecthead
39355 \@ff@parshape
39356 \ff@contents\oldpar
39357 }}%
39358 }%
39359 \or
39360 % \end{macrocode}
39361 % \cs{shapepar}
39362 % \begin{macrocode}
39363 \expandafter\expandafter\expandafter
39364 \parbox\csname @df@dim@\romannumeral#1\endcsname
39365 {%
39366 \setlength\parindent\sdfparindent
39367 \csname\ff@style\endcsname
39368 {{%
39369 \@ff@disablesec\@ff@parshape
39370 \ff@contents\par
39371 }}%
39372 }%
39373 \fi
39374 }
39375 % \end{macrocode}
39376 %\end{macro}
39377 %\begin{macro}{\@dodynamicbox}
39378 % Typeset the dynamic box with its associated border.
39379 % \begin{macrocode}
39380 \newcommand*{\@dodynamicbox}[1]{%
39381 \edef\ff@frametype{%
39382 \csname @df@frametype@\romannumeral#1\endcsname
39383 }%
39384 \edef\ff@col{\csname @df@col@\romannumeral#1\endcsname}%
39385 \edef\ff@txtcol{\csname @df@txtcol@\romannumeral#1\endcsname}%
39386 \edef\ff@backcol{\csname @df@backcol@\romannumeral#1\endcsname}%
39387 \edef\ff@style{\csname @df@style@\romannumeral#1\endcsname}%
39388 \def\ff@contents{\csname @dynamicframe@\romannumeral#1\endcsname}%
39389 \@df@setoffset{#1}%
39390 \expandafter\expandafter\expandafter
39391 \@ff@getstaticpos\csname @df@dim@\romannumeral#1\endcsname
39392 \rotateframe{\csname @df@angle@\romannumeral#1\endcsname}%
39393 {%
39394 \ifthenelse{\boolean{dynamicframe\romannumeral#1}}%
39395 {%
39396 \@ff@fbox{\@ff@tmp@x}{\@ff@tmp@y}%
39397 {\@dodfparbox{#1}}%
39398 {\csname\ff@frametype\endcsname}%
39399 }%
39400 {%
39401 \@ff@box{\@ff@tmp@x}{\@ff@tmp@y}%
39402 {%
39403 \@dodfparbox{#1}%
39404 }%
39405 }%
39406 }%
39407 }
39408 % \end{macrocode}
39409 %\end{macro}
39410 %\begin{macro}{\@dodynamicbbox}
39411 % Now for the \gls{bbox}:
39412 % \begin{macrocode}
39413 \newcommand*{\@dodynamicbbox}[1]{%
39414 \edef\ff@col{}%
39415 \@df@setoffset{#1}%
39416 \expandafter\expandafter\expandafter
39417 \@ff@getstaticpos\csname @df@dim@\romannumeral#1\endcsname
39418 \@fr@meifdraft
39419 {%
39420 \@ff@box{\@ff@tmp@x}{\@ff@tmp@y}%
39421 {%
39422 \expandafter\expandafter\expandafter
39423 \parbox\csname @df@dim@\romannumeral#1\endcsname
39424 {}%
39425 }%
39426 }%
39427 {D:\number#1;\csname @df@id@\romannumeral#1\endcsname}%
39428 }
39429 % \end{macrocode}
39430 %\end{macro}
39431 %\begin{macro}{\@putdynamicbox}
39432 % Put the \gls{dynamic} "#1" at its given position
39433 % \begin{macrocode}
39434 \newcommand*{\@putdynamicbox}[1]{%
39435 % \end{macrocode}
39436 %\changes{2014-06-04}{1.16}{added check for `hide' and `hidethis'
39437 %attributes}
39438 % Check the `hide' and `hidethis' attributes
39439 % \begin{macrocode}
39440 \ifthenelse{\boolean{@df@hidethis@\romannumeral#1}}%
39441 {%
39442 \@notthiscoltrue
39443 \global\csletcs{if@df@hidethis@\romannumeral#1}{iffalse}%
39444 }%
39445 {%
39446 \ifthenelse{\boolean{@df@hide@\romannumeral#1}}%
39447 {%
39448 \@notthiscoltrue
39449 }%
39450 {%
39451 % \end{macrocode}
39452 % Neither `hide' nor `hidethis' have been set so check the page
39453 % list.
39454 % \begin{macrocode}
39455 \@df@chckifthispg{#1}%
39456 }%
39457 }%
39458 \if@notthiscol
39459 \else
39460 \@killglue
39461 \if@twoside
39462 \ifodd\c@page
39463 \expandafter\raise\csname @df@\romannumeral#1@posy\endcsname
39464 \hb@xt@\z@
39465 {%
39466 \expandafter\kern \csname @df@\romannumeral#1@posx\endcsname
39467 \@dodynamicbox{#1}\hss
39468 }%
39469 \ignorespaces
39470 \else
39471 \expandafter\raise\csname @df@\romannumeral#1@eveny\endcsname
39472 \hb@xt@\z@
39473 {%
39474 \expandafter\kern \csname @df@\romannumeral#1@evenx\endcsname
39475 \@dodynamicbox{#1}\hss
39476 }%
39477 \ignorespaces
39478 \fi
39479 \else
39480 \expandafter\raise\csname @df@\romannumeral#1@posy\endcsname
39481 \hb@xt@\z@
39482 {%
39483 \expandafter\kern \csname @df@\romannumeral#1@posx\endcsname
39484 \@dodynamicbox{#1}\hss
39485 }%
39486 \ignorespaces
39487 \fi
39488 \fi
39489 }
39490 % \end{macrocode}
39491 %\end{macro}
39492 %\begin{macro}{\@putdynamicbbox}
39493 % Bounding box:
39494 % \begin{macrocode}
39495 \newcommand*{\@putdynamicbbox}[1]{%
39496 \@df@chckifthispg{#1}%
39497 \if@notthiscol
39498 \else
39499 \@killglue
39500 \if@twoside
39501 \ifodd\c@page
39502 \expandafter\raise\csname @df@\romannumeral#1@posy\endcsname
39503 \hb@xt@\z@
39504 {%
39505 \expandafter\kern \csname @df@\romannumeral#1@posx\endcsname
39506 \@dodynamicbbox{#1}\hss
39507 }%
39508 \ignorespaces
39509 \else
39510 \expandafter\raise\csname @df@\romannumeral#1@eveny\endcsname
39511 \hb@xt@\z@
39512 {%
39513 \expandafter\kern \csname @df@\romannumeral#1@evenx\endcsname
39514 \@dodynamicbbox{#1}\hss
39515 }%
39516 \ignorespaces
39517 \fi
39518 \else
39519 \expandafter\raise\csname @df@\romannumeral#1@posy\endcsname
39520 \hb@xt@\z@
39521 {%
39522 \expandafter\kern \csname @df@\romannumeral#1@posx\endcsname
39523 \@dodynamicbbox{#1}\hss
39524 }%
39525 \ignorespaces
39526 \fi
39527 \fi
39528 }
39529 % \end{macrocode}
39530 %\end{macro}
39531 %\begin{macro}{\@@doheader}
39532 % Do standard header in the standard place.
39533 % \begin{macrocode}
39534 \newcommand*{\@@doheader}{%
39535 \setlength\@ff@tmp@y{\textheight}%
39536 \addtolength{\@ff@tmp@y}{\headsep}%
39537 \def\ff@col{}%
39538 \def\ff@txtcol{}%
39539 \def\ff@backcol{{none}}%
39540 \@ff@box{0pt}{\@ff@tmp@y}{\makebox[0pt][l]{\@dothehead}}%
39541 }
39542 % \end{macrocode}
39543 %\end{macro}
39544 %\begin{macro}{\@@dofooter}
39545 % Do standard footer in the standard place.
39546 % \begin{macrocode}
39547 \newcommand*{\@@dofooter}{%
39548 \setlength\@ff@tmp@y{-\footskip}%
39549 \def\ff@col{}%
39550 \def\ff@txtcol{}%
39551 \def\ff@backcol{{none}}%
39552 \@ff@box{0pt}{\@ff@tmp@y}{\makebox[0pt][l]{\@dothefoot}}%
39553 }
39554 % \end{macrocode}
39555 %\end{macro}
39556 %\begin{macro}{\@s@tfr@mes}
39557 % This is a modified version of the way the picture environment
39558 % works:
39559 % \begin{macrocode}
39560 \newcommand{\@s@tfr@mes}[1]{%
39561 {%
39562 \@picht\textheight
39563 \setbox\@picbox\hb@xt@ \textwidth
39564 \bgroup
39565 \hbox
39566 \bgroup
39567 #1\relax
39568 \egroup
39569 \hss
39570 \egroup
39571 \ht\@picbox\@picht
39572 \dp\@picbox\z@
39573 \mbox{\box\@picbox}%
39574 }%
39575 }
39576 % \end{macrocode}
39577 %\end{macro}
39578 %\begin{macro}{\@ff@doallflowframes}
39579 % Puts all the \glspl{flow} defined on the current page
39580 % \begin{macrocode}
39581 \newcommand*{\@ff@doallflowframes}{%
39582 \@colN=0\relax
39583 \whiledo{\@colN<\c@maxflow}%
39584 {%
39585 \advance\@colN by 1\relax
39586 \@putcolbox{\@colN}%
39587 }%
39588 }
39589 % \end{macrocode}
39590 %\end{macro}
39591 %\begin{macro}{\@ff@doallflowframesbbox}
39592 % Flow frame \glspl{bbox}:
39593 % \begin{macrocode}
39594 \newcommand*{\@ff@doallflowframesbbox}{%
39595 \@colN=0\relax
39596 \whiledo{\@colN<\c@maxflow}%
39597 {%
39598 \advance\@colN by 1\relax
39599 \@putcolbbox{\@colN}%
39600 }%
39601 }
39602 % \end{macrocode}
39603 %\end{macro}
39604 %\begin{macro}{\@ff@doallstatics}
39605 % Puts all \glspl{static} defined on the current page
39606 % \begin{macrocode}
39607 \newcommand*{\@ff@doallstatics}{%
39608 \@colN=0\relax
39609 \whiledo{\@colN<\c@maxstatic}%
39610 {%
39611 \advance\@colN by 1\relax
39612 \@putstaticbox{\@colN}%
39613 }%
39614 }
39615 % \end{macrocode}
39616 %\end{macro}
39617 %\begin{macro}{\@ff@doallstaticsbbox}
39618 % Static frame \glspl{bbox}:
39619 % \begin{macrocode}
39620 \newcommand*{\@ff@doallstaticsbbox}{%
39621 \@colN=0\relax
39622 \whiledo{\@colN<\c@maxstatic}%
39623 {%
39624 \advance\@colN by 1\relax
39625 \@putstaticbbox{\@colN}%
39626 }%
39627 }
39628 % \end{macrocode}
39629 %\end{macro}
39630 %\begin{macro}{\@ff@doalldynamics}
39631 % Puts all the \glspl{dynamic} defined on the current page
39632 % \begin{macrocode}
39633 \newcommand*{\@ff@doalldynamics}{%
39634 \@colN=0\relax
39635 \whiledo{\@colN<\c@maxdynamic}%
39636 {%
39637 \advance\@colN by 1\relax
39638 \@putdynamicbox{\@colN}%
39639 }%
39640 }
39641 % \end{macrocode}
39642 %\end{macro}
39643 %\begin{macro}{\@ff@doalldynamicsbbox}
39644 % Dynamic frame \glspl{bbox}:
39645 % \begin{macrocode}
39646 \newcommand*{\@ff@doalldynamicsbbox}{%
39647 \@colN=0\relax
39648 \whiledo{\@colN<\c@maxdynamic}%
39649 {%
39650 \advance\@colN by 1\relax
39651 \@putdynamicbbox{\@colN}%
39652 }%
39653 }
39654 % \end{macrocode}
39655 %\end{macro}
39656 %\begin{macro}{\@ff@dotypeblock}
39657 % Draw \gls{typeblock} frame if draft.
39658 % \begin{macrocode}
39659 \newcommand*{\@ff@dotypeblock}{%
39660 \makebox[0pt][l]%
39661 {%
39662 \@fr@meifdraft[\setffdrafttypeblockcolor]%
39663 {%
39664 \vbox to \textheight{\hbox to \textwidth{}}%
39665 }%
39666 {}%
39667 }%
39668 }
39669 % \end{macrocode}
39670 %\end{macro}
39671 %\begin{macro}{\@ff@do@allframes}
39672 % Put all frames defined on the current page.
39673 % \begin{macrocode}
39674 \newlength\ffevenoffset
39675 \newcommand*{\@ff@do@allframes}{%
39676 \ffevenoffset=0pt\relax
39677 \if@twoside
39678 \ifodd\c@page
39679 \else
39680 \ffevenoffset=-\oddsidemargin\relax
39681 \advance\ffevenoffset by \evensidemargin\relax
39682 \kern\ffevenoffset\relax
39683 \fi
39684 \fi
39685 \setlength{\@ff@tmp@x}{\textwidth}%
39686 \advance\@ff@tmp@x by -\ffevenoffset\relax
39687 \makebox[\@ff@tmp@x][l]%
39688 {%
39689 \@s@tfr@mes
39690 {%
39691 \@ff@doallstatics
39692 \@@doheader
39693 \@@dofooter
39694 \@ff@doallflowframes
39695 \@ff@doalldynamics
39696 \ifshowtypeblock
39697 \@ff@dotypeblock
39698 \fi
39699 \ifshowframebbox
39700 \@ff@doallstaticsbbox
39701 \@ff@doallflowframesbbox
39702 \@ff@doalldynamicsbbox
39703 \fi
39704 \ifshowmargins
39705 \@ff@drawmargins
39706 \fi
39707 }%
39708 }%
39709 }
39710 % \end{macrocode}
39711 %\end{macro}
39712 %\begin{macro}{\@outputdblcol}
39713 % This was modified from the output routine for standard
39714 % two column format. After "\@g@tnextcol", the register
39715 % "\c@curpg" contains the page that the next \gls{flow}
39716 % is on. If "\c@curpg" minus "\c@page" is greater
39717 % than 1, then there is at least one page without a \gls{flow}.
39718 % These pages will have to be shipped before \TeX\ can
39719 % continue with the rest of the document.
39720 % \begin{macrocode}
39721 \newcount\@nxtcol
39722 \def\@outputdblcol{%
39723 \@nxtcol=\c@thisframe
39724 % \end{macrocode}
39725 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
39726 %\cs{@ff@pages@countreg}}
39727 % \begin{macrocode}
39728 \c@curpg=\@ff@pages@countreg
39729 \@g@tnextcol{\@nxtcol}%
39730 \if@ff@nwpg
39731 % \end{macrocode}
39732 % Next flow frame starts on new page.
39733 % \begin{macrocode}
39734 \global\@firstcolumntrue
39735 \@setcolbox\c@thisframe
39736 \if@specialpage
39737 \global\@specialpagefalse
39738 \@nameuse{ps@\@specialstyle}\relax
39739 \fi
39740 \if@twoside
39741 \ifodd\count\z@
39742 \let\@thehead\@oddhead
39743 \let\@thefoot\@oddfoot
39744 \else
39745 \let\@thehead\@evenhead
39746 \let\@thefoot\@evenfoot
39747 \fi
39748 \else
39749 \let\@thehead\@oddhead
39750 \let\@thefoot\@oddfoot
39751 \fi
39752 \@begindvi
39753 \@dodynamicthehead\@dodynamicthefoot
39754 \vbadness=\@M
39755 \setbox\@outputbox\vbox{\hbox to \textwidth{\@ff@do@allframes}}%
39756 \@combinedblfloats
39757 \@outputpage
39758 % \end{macrocode}
39759 % Shipout pages without flow frames.
39760 %\changes{1.14}{2012-11-10}{replaced \cs{c@page} with
39761 %\cs{@ff@pages@countreg}}
39762 % \begin{macrocode}
39763 \advance\c@curpg by -\@ff@pages@countreg\relax
39764 \whiledo{\c@curpg>0}%
39765 {%
39766 \advance\c@curpg by -1\relax
39767 \setbox\@outputbox\vbox{\hbox to \textwidth{\@ff@do@allframes}}%
39768 \@outputpage
39769 }
39770 \begingroup
39771 \@dblfloatplacement
39772 \@startdblcolumn
39773 \@whilesw \if@fcolmade \fi
39774 {\@outputpage \@startdblcolumn }%
39775 \endgroup
39776 \@resetst@tics
39777 \@resetdyn@mics
39778 \else
39779 % \end{macrocode}
39780 % Still on same page, save contents of box255
39781 % \begin{macrocode}
39782 \global\@firstcolumnfalse
39783 \@setcolbox\c@thisframe
39784 \fi
39785 \global\c@thisframe=\@nxtcol
39786 \@setcol{\c@thisframe}\relax
39787 \global\@colht\vsize
39788 }
39789 % \end{macrocode}
39790 %\end{macro}
39791 %\begin{macro}{\@dblfloatplacement}
39792 % Modify "\@dblfloatplacement" replacing "\textheight"
39793 % with "\vsize".
39794 % \begin{macrocode}
39795 \def\@dblfloatplacement{%
39796 \global\@dbltopnum\c@dbltopnumber
39797 \global\@dbltoproom\dbltopfraction\@colht\@textmin
39798 \@colht\advance\@textmin -\@dbltoproom
39799 \@fpmin\dblfloatpagefraction\vsize
39800 \@fptop \@dblfptop \@fpsep \@dblfpsep \@fpbot \@dblfpbot
39801 }
39802 % \end{macrocode}
39803 %\end{macro}
39804 %
39805 %\subsection{Static versions of floats}
39806 % Floats can not go in saveboxes or minipages, so define
39807 % static versions to go in static and \glspl{dynamic}.
39808 % These just set "\@captype" so that the "\caption"
39809 % command may be used.
39810 %\begin{environment}{statictable}
39811 % \begin{macrocode}
39812 \newenvironment{statictable}{\def\@captype{table}}{}
39813 % \end{macrocode}
39814 %\end{environment}
39815 %\begin{environment}{staticfigure}
39816 % \begin{macrocode}
39817 \newenvironment{staticfigure}{\def\@captype{figure}}{}
39818 % \end{macrocode}
39819 %\end{environment}
39820 %
39821 %\subsection{Standard Layouts}
39822 %\subsubsection{Column Styles}
39823 % Redefine "\twocolumn" and "\onecolumn" to set up \glspl{flow} from
39824 % the dimensions of the \gls{typeblock}. Ignore the optional argument.
39825 % The \gls{flow} height will be adjusted to make sure that it
39826 % is an integer multiple of "\baselineskip", unless
39827 % "\ffvajdustfalse" is used.
39828 % \begin{macrocode}
39829 \newif\ifffvadjust
39830 \ffvadjusttrue
39831 % \end{macrocode}
39832 %\begin{macro}{\onecolumn}
39833 % "\onecolumn" will make a single \gls{flow} that takes
39834 % up the entire area of the \gls{typeblock} (adjusted according
39835 % to "\ifffvadjust".) Frames should only be created in
39836 % the preamble, otherwise the next \gls{flow} may not
39837 % be detected by the output routine. The exception to this
39838 % is when the output routine can't find any more \glspl{flow}
39839 % to use, in which case it creates a single \gls{flow} using
39840 % "\@onecolumn". Therefore, make "\onecolumn" use "\@onecolumn",
39841 % and then set "\onecolumn" as a preamble command, so it
39842 % can't be used in the document, but the output routine can
39843 % use "\@onecolumn". Syntax: \cs{onecolumn}\oarg{pages},
39844 % where \meta{pages} is the \gls{pglist} for which the new
39845 % \gls{flow} is defined.
39846 % \begin{macrocode}
39847 \renewcommand*{\onecolumn}{\@onecolumn}
39848 % \end{macrocode}
39849 %\end{macro}
39850 %\begin{macro}{\@onecolumn}
39851 % \begin{macrocode}
39852 \newcommand*{\@onecolumn}[1][all]{%
39853 \@onecolumninarea[#1]{\textwidth}{\textheight}{0pt}{0pt}%
39854 }
39855 % \end{macrocode}
39856 %\end{macro}
39857 % Need a length to store the height of
39858 % the \gls{flow} so that it can be adjusted.
39859 % \begin{macrocode}
39860 \newlength\columnheight
39861 % \end{macrocode}
39862 %\begin{macro}{\onecolumninarea}
39863 % "\onecolumn" is in fact a special case of "\onecolumninarea"
39864 % which sets up one \gls{flow} in the specified area, given
39865 % by bottom left corner (\meta{x}, \meta{y}),
39866 % relative to the \gls{typeblock}, with width \meta{w}
39867 % and height \meta{h}.
39868 % The only difference between "\onecolumninarea" and
39869 % explicitly creating the \gls{flow} using "\newflowframe"
39870 % is the "\onecolumninarea" will adjust the vertical height
39871 % the ensure it is a multiple of "\baselineskip". There
39872 % is also no starred version, so if you want a border, you
39873 % will need to set it explicitly using "\setflowframe".
39874 % Syntax:\newline
39875 % \cs{onecolumninarea}\oarg{pages}\marg{w}\marg{h}\marg{x}\marg{y}.
39876 % \begin{macrocode}
39877 \newcommand*{\onecolumninarea}{\@onecolumninarea}
39878 \@onlypreamble{\onecolumninarea}
39879 % \end{macrocode}
39880 %\end{macro}
39881 %\begin{macro}{\@onecolumninarea}
39882 % \begin{macrocode}
39883 \newcommand*{\@onecolumninarea}[5][all]{%
39884 \setlength{\columnheight}{#3}%
39885 \ifffvadjust
39886 \adjustheight{\columnheight}%
39887 \fi
39888 \@n@wflowframe[#1]{#2}{\columnheight}{#4}{#5}%
39889 }
39890 % \end{macrocode}
39891 %\end{macro}
39892 %\begin{macro}{\twocolumn}
39893 % Set up two \glspl{flow} parallel to each other
39894 % with a distance of "\columnsep" between them, to
39895 % fill the entire \gls{typeblock} (although the frames may
39896 % end up marginally shorter than "\textheight" after
39897 % they have been adjusted.) Again, these commands may only
39898 % be used in the preamble. Note that unlike the standard
39899 % "\twocolumn" command, this one has an optional argument
39900 % that indicates which pages the two \glspl{flow} should
39901 % appear on. Syntax: \cs{twocolumn}\oarg{pages}.
39902 % \begin{macrocode}
39903 \renewcommand*{\twocolumn}{\@twocolumn}
39904 % \end{macrocode}
39905 %\end{macro}
39906 %\begin{macro}{\@twocolumn}
39907 % \begin{macrocode}
39908 \newcommand*{\@twocolumn}[1][all]{%
39909 \@twocolumninarea[#1]{\textwidth}{\textheight}{0pt}{0pt}%
39910 }
39911 % \end{macrocode}
39912 %\end{macro}
39913 %\begin{macro}{\twocolumninarea}
39914 % Again, "\twocolumn" is actually a special case of
39915 % "\twocolumninarea".
39916 % Syntax:\newline
39917 % \cs{twocolumninarea}\oarg{pages}\marg{w}\marg{h}\marg{x}\marg{y}.
39918 % \begin{macrocode}
39919 \newcommand*{\twocolumninarea}{\@twocolumninarea}
39920 \@onlypreamble{\twocolumninarea}
39921 % \end{macrocode}
39922 %\end{macro}
39923 %\begin{macro}{\@twocolumninarea}
39924 % \begin{macrocode}
39925 \newcommand*{\@twocolumninarea}[5][all]{%
39926 \setlength{\columnheight}{#3}%
39927 \ifffvadjust
39928 \adjustheight{\columnheight}%
39929 \fi
39930 \setlength{\columnwidth}{#2}%
39931 \addtolength{\columnwidth}{-\columnsep}%
39932 \divide\columnwidth by 2\relax
39933 \setlength{\@ff@tmp@x}{#4}%
39934 \addtolength{\@ff@tmp@x}{\columnwidth}%
39935 \addtolength{\@ff@tmp@x}{\columnsep}%
39936 \iflefttorightcolumns
39937 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{#4}{#5}%
39938 \setflowframe{\c@maxflow}{margin=left}%
39939 \else
39940 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{\@ff@tmp@x}{#5}%
39941 \setflowframe{\c@maxflow}{margin=right}%
39942 \fi
39943 \iflefttorightcolumns
39944 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{\@ff@tmp@x}{#5}%
39945 \setflowframe{\c@maxflow}{margin=right}%
39946 \else
39947 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{#4}{#5}%
39948 \setflowframe{\c@maxflow}{margin=left}%
39949 \fi
39950 }
39951 % \end{macrocode}
39952 %\end{macro}
39953 %\begin{macro}{\Ncolumn}
39954 % Again for an aribtrary number of columns (\meta{n}). Syntax:
39955 % \cs{Ncolumn}\oarg{pages}\marg{n}.
39956 % \begin{macrocode}
39957 \newcommand*{\Ncolumn}[2][all]{%
39958 \Ncolumninarea[#1]{#2}{\textwidth}{\textheight}{0pt}{0pt}%
39959 }
39960 \@onlypreamble{\Ncolumn}
39961 % \end{macrocode}
39962 %\end{macro}
39963 %\begin{macro}{\Ncolumninarea}
39964 % Check the number of \glspl{flow} requested, and do one
39965 % of the special cases if available.
39966 % Syntax:\newline
39967 % \cs{Ncolumninarea}\oarg{pages}\marg{n}\marg{w}\marg{h}\marg{x}\marg{y}.
39968 % \begin{macrocode}
39969 \newcommand*{\Ncolumninarea}[6][all]{%
39970 \ifnum#2>2\relax
39971 \@Ncolumninarea[#1]{#2}{#3}{#4}{#5}{#6}%
39972 \else
39973 \ifcase#2\relax
39974 \PackageError{flowfram}%
39975 {%
39976 You have requested 0 flowframes!%
39977 }%
39978 {%
39979 It does not make much sense to ask to create 0 flow frames%
39980 }%
39981 \or
39982 \onecolumninarea[#1]{#3}{#4}{#5}{#6}%
39983 \or
39984 \twocolumninarea[#1]{#3}{#4}{#5}{#6}%
39985 \else
39986 \PackageError{flowfram}%
39987 {%
39988 Can't create a negative number of flow frames!%
39989 }%
39990 {%
39991 You have asked for \number#2 \space flow frames
39992 which really doesn't make sense%
39993 }%
39994 \fi
39995 \fi
39996 }
39997
39998 \@onlypreamble{\Ncolumninarea}
39999 % \end{macrocode}
40000 %\end{macro}
40001 %\begin{macro}{\@Ncolumninarea}
40002 % Set up \meta{n} columns in the area specified.
40003 % There is a horizontal distance of "\columnsep"
40004 % between them all.
40005 % \begin{macrocode}
40006 \newcommand*{\@Ncolumninarea}[6][all]{%
40007 \@colN=#2\relax
40008 \advance\@colN by -1\relax
40009 \setlength{\columnwidth}{#3}%
40010 \addtolength{\columnwidth}{-\@colN\columnsep}%
40011 \divide\columnwidth by #2\relax
40012 \setlength{\@ff@tmp@x}{#5}%
40013 \iflefttorightcolumns
40014 \else
40015 \addtolength{\@ff@tmp@x}{#3}%
40016 \addtolength{\@ff@tmp@x}{-\columnwidth}%
40017 \fi
40018 \setlength{\columnheight}{#4}%
40019 \ifffvadjust\adjustheight{\columnheight}\fi%
40020 \@colN=0\relax
40021 \loop
40022 \advance\@colN by 1\relax
40023 \newflowframe[#1]{\columnwidth}{\columnheight}{\@ff@tmp@x}{#6}%
40024 \iflefttorightcolumns
40025 \addtolength{\@ff@tmp@x}{\columnwidth}%
40026 \addtolength{\@ff@tmp@x}{\columnsep}%
40027 \else
40028 \addtolength{\@ff@tmp@x}{-\columnwidth}%
40029 \addtolength{\@ff@tmp@x}{-\columnsep}%
40030 \fi
40031 \ifnum\@colN<#2
40032 \repeat
40033 }
40034 % \end{macrocode}
40035 %\end{macro}
40036 %
40037 % Set up something similar but have another frame (of type
40038 % \meta{type}) at the top of the other frames.
40039 %\begin{macro}{\vcolumnsep}
40040 % The vertical distance between the top frames and column flow
40041 % frames when created using "\Ncolumntop" etc is given by:
40042 % \begin{macrocode}
40043 \newlength{\vcolumnsep}
40044 \setlength{\vcolumnsep}{\columnsep}
40045 % \end{macrocode}
40046 %\end{macro}
40047 %\begin{macro}{\onecolumntop}
40048 % "\onecolumntop" makes one \gls{flow}, and one \meta{type}
40049 % frame in the area specified, where the \meta{type} frame is
40050 % \meta{H} high.
40051 % The distance between the top frame and the column \gls{flow}
40052 % will be approximately "\vcolumnsep". (The height of \gls{flow}
40053 % may be adjusted to make it an integer multiple of
40054 % "\baselineskip".)
40055 %
40056 % First the special case where the area is the \gls{typeblock}.
40057 % Syntax:\newline
40058 % \cs{onecolumntop}\oarg{pages}\marg{type}\marg{H}
40059 % \begin{macrocode}
40060 \newcommand*{\onecolumntop}[3][all]{%
40061 \onecolumntopinarea[#1]{#2}{#3}{\textwidth}{\textheight}{0pt}{0pt}%
40062 }
40063 \@onlypreamble{\onecolumntop}
40064 % \end{macrocode}
40065 %\end{macro}
40066 %\begin{macro}{\onecolumnStop}
40067 % Special case for \gls{static}.
40068 % Syntax: \cs{onecolumnStop}\oarg{pages}\marg{H}
40069 % \begin{macrocode}
40070 \newcommand*{\onecolumnStop}[2][all]{%
40071 \onecolumntopinarea[#1]{static}{#2}{\textwidth}{\textheight}{0pt}{0pt}%
40072 }
40073 % \end{macrocode}
40074 %\end{macro}
40075 %\begin{macro}{\onecolumnDtop}
40076 % Special case for \gls{dynamic}.
40077 % Syntax: \cs{onecolumnDtop}\oarg{pages}\marg{H}
40078 % \begin{macrocode}
40079 \newcommand*{\onecolumnDtop}[2][all]{%
40080 \onecolumntopinarea[#1]{dynamic}{#2}{\textwidth}{\textheight}{0pt}{0pt}%
40081 }
40082 % \end{macrocode}
40083 %\end{macro}
40084 %\begin{macro}{\newframe}
40085 % Create a frame of given type.
40086 % Syntax:\newline
40087 % \cs{newframe}\oarg{pages}\marg{type}\marg{w}\marg{h}\marg{x}\marg{y}.
40088 % \begin{macrocode}
40089 \newcommand*{\newframe}[6][all]{%
40090 \ifthenelse{\equal{#2}{flow}}%
40091 {%
40092 \@n@wflowframe[#1]{#3}{#4}{#5}{#6}%
40093 }%
40094 {%
40095 \ifthenelse{\equal{#2}{dynamic}}%
40096 {%
40097 \@n@wdynamicframe[#1]{#3}{#4}{#5}{#6}%
40098 }%
40099 {%
40100 \ifthenelse{\equal{#2}{static}}%
40101 {%
40102 \@n@wstaticframe[#1]{#3}{#4}{#5}{#6}%
40103 }%
40104 {%
40105 \PackageError{flowfram}%
40106 {Unknown frame type '#2'}%
40107 {%
40108 Available frame types are: 'flow', 'static' and 'dynamic'%
40109 }%
40110 }%
40111 }%
40112 }%
40113 }
40114 % \end{macrocode}
40115 %\end{macro}
40116 %\begin{macro}{\onecolumntopinarea}
40117 % Now for a specified area.
40118 % Syntax:\newline
40119 % \cs{onecolumntopinarea}\oarg{pages}\marg{type}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}.
40120 % \begin{macrocode}
40121 \newlength\@ff@staticH
40122
40123 \newcommand*{\onecolumntopinarea}[7][all]{%
40124 \setlength{\@ff@staticH}{#3}%
40125 \setlength{\@ff@tmp@y}{#5}%
40126 \addtolength{\@ff@tmp@y}{-\@ff@staticH}%
40127 \setlength{\columnheight}{\@ff@tmp@y}%
40128 \addtolength{\columnheight}{-\vcolumnsep}%
40129 \ifffvadjust
40130 \adjustheight{\columnheight}%
40131 \fi
40132 \addtolength{\@ff@tmp@y}{#7}%
40133 \newframe[#1]{#2}{#4}{\@ff@staticH}{#6}{\@ff@tmp@y}%
40134 \@n@wflowframe[#1]{#4}{\columnheight}{#6}{#7}%
40135 }
40136
40137 \@onlypreamble{\onecolumntopinarea}
40138 % \end{macrocode}
40139 %\end{macro}
40140 %\begin{macro}{\onecolumnStopinarea}
40141 % Special case for \gls{static}.
40142 % Syntax:\newline
40143 % \cs{onecolumnStopinarea}\oarg{pages}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}.
40144 % \begin{macrocode}
40145 \newcommand*{\onecolumnStopinarea}[6][all]{%
40146 \onecolumntopinarea[#1]{static}{#2}{#3}{#4}{#5}{#6}%
40147 }
40148 % \end{macrocode}
40149 %\end{macro}
40150 %\begin{macro}{\onecolumnDtopinarea}
40151 % Special case for \gls{dynamic}.
40152 % Syntax:\newline
40153 % \cs{onecolumnDtopinarea}\oarg{pages}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}.
40154 % \begin{macrocode}
40155 \newcommand*{\onecolumnDtopinarea}[6][all]{%
40156 \onecolumntopinarea[#1]{dynamic}{#2}{#3}{#4}{#5}{#6}%
40157 }
40158 % \end{macrocode}
40159 %\end{macro}
40160 %\begin{macro}{\twocolumntop}
40161 % Now for two \glspl{flow}, with a single \meta{type} frame
40162 % above both of them.
40163 % Syntax:\newline
40164 % \cs{twocolumntop}\oarg{pages}\marg{type}\marg{H}
40165 %
40166 % First the special case where the area is the entire
40167 % \gls{typeblock}:
40168 % \begin{macrocode}
40169 \newcommand*{\twocolumntop}[3][all]{%
40170 \twocolumntopinarea[#1]{#2}{#3}{\textwidth}{\textheight}{0pt}{0pt}%
40171 }
40172 \@onlypreamble{\twocolumntop}
40173 % \end{macrocode}
40174 %\end{macro}
40175 %\begin{macro}{\twocolumnStop}
40176 % Special case for \gls{static}.
40177 % \begin{macrocode}
40178 \newcommand*{\twocolumnStop}[2][all]{%
40179 \@twocolumntopinarea[#1]{static}{#2}{\textwidth}{\textheight}{0pt}{0pt}%
40180 }
40181 % \end{macrocode}
40182 %\end{macro}
40183 %\begin{macro}{\twocolumnDtop}
40184 % Special case for \gls{dynamic}.
40185 % \begin{macrocode}
40186 \newcommand*{\twocolumnDtop}[2][all]{%
40187 \twocolumntop[#1]{dynamic}{#2}%
40188 }
40189 % \end{macrocode}
40190 %\end{macro}
40191 %
40192 % Now for a general area.
40193 %\begin{macro}{\twocolumntopinarea}
40194 % Syntax:\newline
40195 % \cs{twocolumntopinarea}\oarg{pages}\marg{type}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}.
40196 % \begin{macrocode}
40197 \newcommand*{\twocolumntopinarea}{\@twocolumntopinarea}
40198 \newcommand*{\@twocolumntopinarea}[7][all]{%
40199 \setlength{\@ff@staticH}{#3}%
40200 % \end{macrocode}
40201 % work out where to put the static frame
40202 % \begin{macrocode}
40203 \setlength{\@ff@tmp@y}{#5}%
40204 \addtolength{\@ff@tmp@y}{-\@ff@staticH}%
40205 \setlength{\columnheight}{\@ff@tmp@y}%
40206 \addtolength{\@ff@tmp@y}{#7}%
40207 \newframe[#1]{#2}{#4}{\@ff@staticH}{#6}{\@ff@tmp@y}%
40208 % \end{macrocode}
40209 % work out height of the flow frames
40210 % \begin{macrocode}
40211 \addtolength{\columnheight}{-\vcolumnsep}%
40212 \ifffvadjust\adjustheight{\columnheight}\fi
40213 % \end{macrocode}
40214 % work out the widths of the flow frames
40215 % \begin{macrocode}
40216 \setlength{\columnwidth}{#4}%
40217 \addtolength{\columnwidth}{-\columnsep}%
40218 \divide\columnwidth by 2\relax
40219 % \end{macrocode}
40220 % work out the offset of the right column
40221 % \begin{macrocode}
40222 \setlength{\@ff@tmp@x}{\columnwidth}%
40223 \addtolength{\@ff@tmp@x}{\columnsep}%
40224 \addtolength{\@ff@tmp@x}{#6}%
40225 \iflefttorightcolumns
40226 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{#6}{#7}%
40227 \setflowframe{\c@maxflow}{margin=left}%
40228 \else
40229 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{\@ff@tmp@x}{#7}%
40230 \setflowframe{\c@maxflow}{margin=right}%
40231 \fi
40232 \iflefttorightcolumns
40233 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{\@ff@tmp@x}{#7}%
40234 \setflowframe{\c@maxflow}{margin=right}%
40235 \else
40236 \@n@wflowframe[#1]{\columnwidth}{\columnheight}{#6}{#7}%
40237 \setflowframe{\c@maxflow}{margin=left}%
40238 \fi
40239 }
40240 \@onlypreamble{\twocolumntopinarea}
40241 % \end{macrocode}
40242 %\end{macro}
40243 %\begin{macro}{\twocolumnStopinarea}
40244 % Special case for \gls{static}.
40245 % \begin{macrocode}
40246 \newcommand*{\twocolumnStopinarea}[6][all]{%
40247 \twocolumntopinarea[#1]{static}{#2}{#3}{#4}{#5}{#6}%
40248 }
40249 % \end{macrocode}
40250 %\end{macro}
40251 %\begin{macro}{\twocolumnDtopinarea}
40252 % Special case for \gls{dynamic}.
40253 % \begin{macrocode}
40254 \newcommand*{\twocolumnDtopinarea}[6][all]{%
40255 \twocolumntopinarea[#1]{dynamic}{#2}{#3}{#4}{#5}{#6}%
40256 }
40257 % \end{macrocode}
40258 %\end{macro}
40259 %\begin{macro}{\Ncolumntop}
40260 % Similarly for an arbitrary number of \glspl{flow}.
40261 % Special case where the area is the \gls{typeblock}.
40262 %
40263 % Syntax:\newline
40264 % \cs{Ncolumntop}\oarg{pages}\marg{type}\marg{n}\marg{H}
40265 % \begin{macrocode}
40266 \newcommand*{\Ncolumntop}[4][all]{%
40267 \Ncolumntopinarea[#1]{#2}{#3}{#4}{\textwidth}{\textheight}{0pt}{0pt}%
40268 }
40269 \@onlypreamble{\Ncolumntop}
40270 % \end{macrocode}
40271 %\end{macro}
40272 %\begin{macro}{\NcolumnStop}
40273 % Special case for \gls{static}.
40274 % \begin{macrocode}
40275 \newcommand*{\NcolumnStop}[3][all]{%
40276 \Ncolumntop[#1]{static}{#2}{#3}%
40277 }
40278 % \end{macrocode}
40279 %\end{macro}
40280 %\begin{macro}{\NcolumnDtop}
40281 % Special case for \gls{dynamic}.
40282 % \begin{macrocode}
40283 \newcommand*{\NcolumnDtop}[3][all]{%
40284 \Ncolumntop[#1]{dynamic}{#2}{#3}%
40285 }
40286 % \end{macrocode}
40287 %\end{macro}
40288 %\begin{macro}{\Ncolumntopinarea}
40289 % Again test to make sure the user requested a sensible
40290 % number.
40291 % \begin{macrocode}
40292 \newcommand*{\Ncolumntopinarea}[8][all]{%
40293 \ifnum#3>2\relax
40294 \@Ncolumntopinarea[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
40295 \else
40296 \ifcase#3\relax
40297 \PackageError{flowfram}%
40298 {%
40299 You have requested 0 flowframes!%
40300 }%
40301 {%
40302 It does not make much sense to ask to create 0 flow frames%
40303 }%
40304 \or
40305 \onecolumntopinarea[#1]{#2}{#4}{#5}{#6}{#7}{#8}%
40306 \or
40307 \twocolumntopinarea[#1]{#2}{#4}{#5}{#6}{#7}{#8}%
40308 \else
40309 \PackageError{flowfram}%
40310 {%
40311 Can't create a negative number of flow frames!%
40312 }%
40313 {%
40314 You have asked for \number#3 \space flow frames
40315 which really doesn't make sense%
40316 }%
40317 \fi
40318 \fi
40319 }
40320 \@onlypreamble{\Ncolumntopinarea}
40321 % \end{macrocode}
40322 %\end{macro}
40323 %\begin{macro}{\@Ncolumntopinarea}
40324 % Fit the frames into specified area.
40325 % Syntax:\newline
40326 % \cs{Ncolumntopinarea}\oarg{pages}\marg{type}\marg{n}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}.
40327 % \begin{macrocode}
40328 \newcommand*{\@Ncolumntopinarea}[8][all]{%
40329 \setlength{\@ff@staticH}{#4}%
40330 % \end{macrocode}
40331 % work out where to put the static frame
40332 % \begin{macrocode}
40333 \setlength{\@ff@tmp@y}{#6}%
40334 \addtolength{\@ff@tmp@y}{-\@ff@staticH}%
40335 \setlength{\columnheight}{\@ff@tmp@y}%
40336 \addtolength{\@ff@tmp@y}{#8}%
40337 \newframe[#1]{#2}{#5}{\@ff@staticH}{#7}{\@ff@tmp@y}%
40338 % \end{macrocode}
40339 % work out height of the flow frames
40340 % \begin{macrocode}
40341 \addtolength{\columnheight}{-\vcolumnsep}%
40342 % \end{macrocode}
40343 % adjust the flow frame height so that it is a multiple of
40344 % \cs{baselineskip}
40345 % \begin{macrocode}
40346 \ifffvadjust
40347 \adjustheight{\columnheight}%
40348 \fi
40349 % \end{macrocode}
40350 % work out the widths of the flow frames
40351 % \begin{macrocode}
40352 \@colN=#3\relax
40353 \advance\@colN by -1\relax
40354 \setlength{\columnwidth}{#5}%
40355 \addtolength{\columnwidth}{-\@colN\columnsep}%
40356 \divide\columnwidth by #3\relax
40357 % \end{macrocode}
40358 % Set the $x$ position of the first frame
40359 % \begin{macrocode}
40360 \setlength{\@ff@tmp@x}{#7}%
40361 \iflefttorightcolumns
40362 \else
40363 \addtolength{\@ff@tmp@x}{#5}%
40364 \addtolength{\@ff@tmp@x}{-\columnwidth}%
40365 \fi
40366 \@colN=0\relax
40367 \loop
40368 \advance\@colN by 1\relax
40369 \newflowframe[#1]{\columnwidth}{\columnheight}{\@ff@tmp@x}{#8}%
40370 % \end{macrocode}
40371 % work out the offset for the next column
40372 % \begin{macrocode}
40373 \iflefttorightcolumns
40374 \addtolength{\@ff@tmp@x}{\columnwidth}%
40375 \addtolength{\@ff@tmp@x}{\columnsep}%
40376 \else
40377 \addtolength{\@ff@tmp@x}{-\columnwidth}%
40378 \addtolength{\@ff@tmp@x}{-\columnsep}%
40379 \fi
40380 \ifnum\@colN<#3
40381 \repeat
40382 }
40383 % \end{macrocode}
40384 %\end{macro}
40385 %\begin{macro}{\NcolumnStopinarea}
40386 % Specific case for \gls{static}.
40387 % \begin{macrocode}
40388 \newcommand*{\NcolumnStopinarea}[7][all]{%
40389 \Ncolumntopinarea[#1]{static}{#2}{#3}{#4}{#5}{#6}{#7}%
40390 }
40391 % \end{macrocode}
40392 %\end{macro}
40393 %\begin{macro}{\NcolumnDtopinarea}
40394 % Specific case for \gls{dynamic}.
40395 % \begin{macrocode}
40396 \newcommand*{\NcolumnDtopinarea}[7][all]{%
40397 \Ncolumntopinarea[#1]{dynamic}{#2}{#3}{#4}{#5}{#6}{#7}%
40398 }
40399 % \end{macrocode}
40400 %\end{macro}
40401 % Now the same kind of thing but with the \meta{type} frame at the
40402 % bottom. Firstly, a single \gls{flow} with a \meta{type}
40403 % frame below it.
40404 %
40405 %\begin{macro}{\onecolumnbottom}
40406 % Syntax:\newline
40407 % \cs{onecolumnbottom}\oarg{pages}\marg{type}\marg{H}
40408 % \begin{macrocode}
40409 \newcommand*{\onecolumnbottom}[3][all]{%
40410 \onecolumnbottominarea[#1]{#2}{#3}{\textwidth}{\textheight}{0pt}{0pt}%
40411 }
40412 % \end{macrocode}
40413 %\end{macro}
40414 % This command may only be used in the preamble.
40415 % \begin{macrocode}
40416 \@onlypreamble{\onecolumnbottom}
40417 % \end{macrocode}
40418 %\begin{macro}{\onecolumnSbottom}
40419 % Special case for \gls{static}.
40420 % \begin{macrocode}
40421 \newcommand*{\onecolumnSbottom}[2][all]{%
40422 \onecolumnbottom[#1]{static}{#2}%
40423 }
40424 % \end{macrocode}
40425 %\end{macro}
40426 %\begin{macro}{\onecolumnDbottom}
40427 % Special case for \gls{dynamic}.
40428 % \begin{macrocode}
40429 \newcommand*{\onecolumnDbottom}[2][all]{%
40430 \onecolumnbottom[#1]{dynamic}{#2}%
40431 }
40432 % \end{macrocode}
40433 %\end{macro}
40434 %
40435 % General case of the above, but fit in specified area.
40436 %\begin{macro}{\onecolumnbottominarea}
40437 % Syntax:\newline
40438 % \cs{onecolumnbottominarea}\oarg{pages}\marg{type}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y},\newline
40439 % where \meta{H} is the \meta{type} frame's height.
40440 % The area is defined by bottom
40441 % left co-ordinates (\meta{x}, \meta{y}) width \meta{w}, and
40442 % height \meta{h}.
40443 % \begin{macrocode}
40444 \newcommand*{\onecolumnbottominarea}[7][all]{%
40445 \setlength{\@ff@staticH}{#3}%
40446 \setlength{\columnheight}{#5}%
40447 \addtolength{\columnheight}{-\@ff@staticH}%
40448 \addtolength{\columnheight}{-\vcolumnsep}%
40449 \ifffvadjust
40450 \adjustheight{\columnheight}%
40451 \fi
40452 \setlength{\@ff@tmp@y}{#5}%
40453 \addtolength{\@ff@tmp@y}{-\columnheight}%
40454 \addtolength{\@ff@tmp@y}{#7}%
40455 \newframe[#1]{#2}{#4}{\@ff@staticH}{#6}{#7}%
40456 \newflowframe[#1]{#4}{\columnheight}{#6}{\@ff@tmp@y}%
40457 }
40458 % \end{macrocode}
40459 %\end{macro}
40460 % Again, this command may only be used in the preamble.
40461 % \begin{macrocode}
40462 \@onlypreamble{\onecolumnbottominarea}
40463 % \end{macrocode}
40464 %\begin{macro}{\onecolumnSbottominarea}
40465 % Special case for \gls{static}.
40466 % \begin{macrocode}
40467 \newcommand*{\onecolumnSbottominarea}[6][all]{%
40468 \onecolumnbottominarea[#1]{static}{#2}{#3}{#4}{#5}{#6}%
40469 }
40470 % \end{macrocode}
40471 %\end{macro}
40472 %\begin{macro}{\onecolumnDbottominarea}
40473 % Special case for \gls{dynamic}.
40474 % \begin{macrocode}
40475 \newcommand*{\onecolumnDbottominarea}[6][all]{%
40476 \onecolumnbottominarea[#1]{dynamic}{#2}{#3}{#4}{#5}{#6}%
40477 }
40478 % \end{macrocode}
40479 %\end{macro}
40480 %\begin{macro}{\twocolumnbottom}
40481 % Now for two \glspl{flow} side by side with a static
40482 % frame underneath both of them. Firstly, the specific
40483 % case where the area is the entire \gls{typeblock}.
40484 % Syntax:\newline
40485 % \cs{twocolumnbottom}\oarg{pages}\marg{type}\marg{H}.
40486 % \begin{macrocode}
40487 \newcommand*{\twocolumnbottom}[3][all]{%
40488 \twocolumnSbottominarea[#1]{#2}{#3}{\textwidth}{\textheight}{0pt}{0pt}%
40489 }
40490 \@onlypreamble{\twocolumnbottom}
40491 % \end{macrocode}
40492 %\end{macro}
40493 %\begin{macro}{\twocolumnSbottom}
40494 % Special case for \gls{static}.
40495 % \begin{macrocode}
40496 \newcommand*{\twocolumnSbottom}[2][all]{%
40497 \twocolumnbottom[#1]{static}{#2}%
40498 }
40499 % \end{macrocode}
40500 %\end{macro}
40501 %\begin{macro}{\twocolumnDbottom}
40502 % Special case for \gls{dynamic}.
40503 % \begin{macrocode}
40504 \newcommand*{\twocolumnDbottom}[2][all]{%
40505 \twocolumnbottom[#1]{dynamic}{#2}%
40506 }
40507 % \end{macrocode}
40508 %\end{macro}
40509 %\begin{macro}{\twocolumnbottominarea}
40510 % Now for a general area.
40511 % Syntax:\newline
40512 % \cs{twocolumnbottominarea}\oarg{pages}\marg{type}\marg{H}\marg{w}\marg{h}\marg{x}\marg{y}.
40513 % \begin{macrocode}
40514 \newcommand*{\twocolumnbottominarea}[7][all]{%
40515 \setlength{\@ff@staticW}{#4}%
40516 \setlength{\@ff@staticH}{#3}%
40517 % \end{macrocode}
40518 % work out height of the flow frames
40519 % \begin{macrocode}
40520 \setlength{\columnheight}{#5}%
40521 \addtolength{\columnheight}{-\@ff@staticH}%
40522 \addtolength{\columnheight}{-\vcolumnsep}%
40523 \ifffvadjust\adjustheight{\columnheight}\fi%
40524 \newframe[#1]{#2}{\@ff@staticW}{\@ff@staticH}{#6}{#7}%
40525 % \end{macrocode}
40526 % work out the $y$ position of the flow frames
40527 % \begin{macrocode}
40528 \setlength{\@ff@tmp@y}{#5}%
40529 \addtolength{\@ff@tmp@y}{-\columnheight}%
40530 \addtolength{\@ff@tmp@y}{#7}%
40531 % \end{macrocode}
40532 % work out the widths of the flow frames
40533 % \begin{macrocode}
40534 \setlength{\columnwidth}{\@ff@staticW}%
40535 \addtolength{\columnwidth}{-\columnsep}%
40536 \divide\columnwidth by 2\relax
40537 % \end{macrocode}
40538 % work out the $x$ offset of the right column
40539 % \begin{macrocode}
40540 \setlength{\@ff@tmp@x}{\columnwidth}%
40541 \addtolength{\@ff@tmp@x}{\columnsep}%
40542 \addtolength{\@ff@tmp@x}{#6}%
40543 % \end{macrocode}
40544 % Define the frames
40545 % \begin{macrocode}
40546 \iflefttorightcolumns
40547 \newflowframe[#1]{\columnwidth}{\columnheight}{#6}{\@ff@tmp@y}%
40548 \setflowframe{\c@maxflow}{margin=left}%
40549 \else
40550 \newflowframe[#1]{\columnwidth}{\columnheight}%
40551 {\@ff@tmp@x}{\@ff@tmp@y}%
40552 \setflowframe{\c@maxflow}{margin=right}%
40553 \fi
40554 \iflefttorightcolumns
40555 \newflowframe[#1]{\columnwidth}{\columnheight}%
40556 {\@ff@tmp@x}{\@ff@tmp@y}%
40557 \setflowframe{\c@maxflow}{margin=right}%
40558 \else
40559 \newflowframe[#1]{\columnwidth}{\columnheight}{#6}{\@ff@tmp@y}%
40560 \setflowframe{\c@maxflow}{margin=left}%
40561 \fi
40562 }
40563 \@onlypreamble{\twocolumnbottominarea}
40564 % \end{macrocode}
40565 %\end{macro}
40566 %\begin{macro}{\twocolumnSbottominarea}
40567 % Special case for \gls{static}.
40568 % \begin{macrocode}
40569 \newcommand*{\twocolumnSbottominarea}[6][all]{%
40570 \twocolumnbottominarea[#1]{static}{#2}{#3}{#4}{#5}{#6}%
40571 }
40572 % \end{macrocode}
40573 %\end{macro}
40574 %\begin{macro}{\twocolumnDbottominarea}
40575 % Special case for \gls{dynamic}.
40576 % \begin{macrocode}
40577 \newcommand*{\twocolumnDbottominarea}[6][all]{%
40578 \twocolumnbottominarea[#1]{dynamic}{#2}{#3}{#4}{#5}{#6}%
40579 }
40580 % \end{macrocode}
40581 %\end{macro}
40582 % Now for an arbitrary number of parallel \glspl{flow}
40583 % with a \gls{static} beneath all of them.
40584 %
40585 %\begin{macro}{\Ncolumnbottom}
40586 % First make them fill the entire \gls{typeblock}.
40587 % Syntax:\newline
40588 % \cs{Ncolumnbottom}\oarg{pages}\marg{type}\marg{H}.
40589 % \begin{macrocode}
40590 \newcommand*{\Ncolumnbottom}[4][all]{%
40591 \Ncolumnbottominarea[#1]{#2}{#3}{#4}{\textwidth}{\textheight}{0pt}{0pt}%
40592 }
40593 \@onlypreamble{\Ncolumnbottom}
40594 % \end{macrocode}
40595 %\end{macro}
40596 %\begin{macro}{\NcolumnSbottom}
40597 % Special case for \gls{static}.
40598 % \begin{macrocode}
40599 \newcommand*{\NcolumnSbottom}[3][all]{%
40600 \Ncolumnbottom[#1]{static}{#2}{#3}%
40601 }
40602 % \end{macrocode}
40603 %\end{macro}
40604 %\begin{macro}{\NcolumnDbottom}
40605 % Special case for \gls{dynamic}.
40606 % \begin{macrocode}
40607 \newcommand*{\NcolumnDbottom}[3][all]{%
40608 \Ncolumnbottom[#1]{dynamic}{#2}{#3}%
40609 }
40610 % \end{macrocode}
40611 %\end{macro}
40612 %\begin{macro}{\Ncolumnbottominarea}
40613 % Again check the user has requested a sensible number.
40614 % \begin{macrocode}
40615 \newcommand*{\Ncolumnbottominarea}[8][all]{%
40616 \ifnum#3>2\relax
40617 \@Ncolumnbottominarea[#1]{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
40618 \else
40619 \ifcase#3\relax
40620 \PackageError{flowfram}{%
40621 You have requested 0 flowframes!}{%
40622 It does not make much sense to ask to create 0 flow frames}
40623 \or
40624 \onecolumnbottominarea[#1]{#2}{#4}{#5}{#6}{#7}{#8}%
40625 \or
40626 \twocolumnbottominarea[#1]{#2}{#4}{#5}{#6}{#7}{#8}%
40627 \else
40628 \PackageError{flowfram}%
40629 {%
40630 Can't create a negative number of flow frames!%
40631 }%
40632 {%
40633 You have asked for \number#3 \space flow frames
40634 which really doesn't make sense%
40635 }%
40636 \fi
40637 \fi
40638 }
40639 \@onlypreamble{\Ncolumnbottominarea}
40640 % \end{macrocode}
40641 %\end{macro}
40642 %\begin{macro}{\@NcolumnSbottominarea}
40643 % An arbitrary number of columns with a \gls{static}
40644 % underneath them all, filling the specified area.
40645 % \begin{macrocode}
40646 \newcommand*{\@NcolumnSbottominarea}[8][all]{%
40647 \setlength{\@ff@staticH}{#4}%
40648 % \end{macrocode}
40649 % work out height of the flow frames
40650 % \begin{macrocode}
40651 \setlength{\columnheight}{#6}%
40652 \addtolength{\columnheight}{-\@ff@staticH}%
40653 \addtolength{\columnheight}{-\vcolumnsep}%
40654 % \end{macrocode}
40655 % adjust the flow frame height so that it is a multiple of
40656 % \cs{baselineskip}
40657 % \begin{macrocode}
40658 \ifffvadjust
40659 \adjustheight{\columnheight}%
40660 \fi
40661 \newframe[#1]{#2}{#5}{\@ff@staticH}{#7}{#8}%
40662 % \end{macrocode}
40663 % work out the $y$ offset of the flow frames
40664 % \begin{macrocode}
40665 \setlength{\@ff@tmp@y}{#6}%
40666 \addtolength{\@ff@tmp@y}{-\columnheight}%
40667 \addtolength{\@ff@tmp@y}{#8}%
40668 % \end{macrocode}
40669 % work out the widths of the flow frames
40670 % \begin{macrocode}
40671 \@colN=#3\relax
40672 \advance\@colN by -1\relax
40673 \setlength{\columnwidth}{#5}%
40674 \addtolength{\columnwidth}{-\@colN\columnsep}%
40675 \divide\columnwidth by #3\relax
40676 % \end{macrocode}
40677 % Set the $x$ offset of the first frame.
40678 % \begin{macrocode}
40679 \setlength{\@ff@tmp@x}{#7}%
40680 \iflefttorightcolumns
40681 \else
40682 \addtolength{\@ff@tmp@x}{#5}%
40683 \addtolength{\@ff@tmp@x}{-\columnwidth}%
40684 \fi
40685 \@colN=0\relax
40686 \loop
40687 \advance\@colN by 1\relax
40688 \newflowframe[#1]{\columnwidth}{\columnheight}%
40689 {\@ff@tmp@x}{\@ff@tmp@y}%
40690 % \end{macrocode}
40691 % work out the offset for the next column
40692 % \begin{macrocode}
40693 \iflefttorightcolumns
40694 \addtolength{\@ff@tmp@x}{\columnwidth}%
40695 \addtolength{\@ff@tmp@x}{\columnsep}%
40696 \else
40697 \addtolength{\@ff@tmp@x}{-\columnwidth}%
40698 \addtolength{\@ff@tmp@x}{-\columnsep}%
40699 \fi
40700 \ifnum\@colN<#3
40701 \repeat
40702 }
40703 % \end{macrocode}
40704 %\end{macro}
40705 %\begin{macro}{\NcolumnSbottominarea}
40706 % Specific case for \gls{static}.
40707 % \begin{macrocode}
40708 \newcommand*{\NcolumnSbottominarea}[1][all]{%
40709 \Ncolumnbottominarea[#1]{static}%
40710 }
40711 % \end{macrocode}
40712 %\end{macro}
40713 %\begin{macro}{\NcolumnDbottominarea}
40714 % Specific case for \gls{dynamic}.
40715 % \begin{macrocode}
40716 \newcommand*{\NcolumnDbottominarea}[1][all]{%
40717 \Ncolumnbottominarea[#1]{dynamic}%
40718 }
40719 % \end{macrocode}
40720 %\end{macro}
40721 %\begin{macro}{\adjustheight}
40722 % Given a height "#1" (a length), adjust it so that it is a multiple of "\baselineskip".
40723 % \begin{macrocode}
40724 \newcount\@ff@adjh
40725 \newcommand*{\adjustheight}[1]{%
40726 % \end{macrocode}
40727 % convert to an integer
40728 % \begin{macrocode}
40729 \@ff@adjh=#1\relax
40730 \divide\@ff@adjh by \baselineskip\relax
40731 #1=\baselineskip\relax
40732 \multiply#1 by \@ff@adjh\relax
40733 }
40734 % \end{macrocode}
40735 %\end{macro}
40736 %\begin{macro}{\adjustcolsep}
40737 % Adjust the value of "\columnsep" so that the margins will fit between columns.
40738 % \begin{macrocode}
40739 \newcommand*{\adjustcolsep}{%
40740 \multiply\columnsep by 2\relax
40741 \addtolength{\columnsep}{\marginparwidth}%
40742 }
40743 % \end{macrocode}
40744 %\end{macro}
40745 %
40746 %\subsubsection{Backdrop Effects}
40747 % Set up some commands to make \glspl{static} for different styles
40748 % of backdrop.
40749 %\begin{macro}{\vtwotone}
40750 % Syntax:\newline
40751 % \cs{vtwotone}\oarg{pages}\oarg{xoffset}\marg{W1}\marg{C1}\marg{L1}\marg{W2}\marg{C2}\marg{L2}
40752 %\newline where the first frame
40753 % has width \meta{W1} with background colour \meta{C1} and label \meta{L1}.
40754 % The second frame has width \meta{W2} with background colour \meta{C2}
40755 % and label \meta{L2}. Unlike earlier commands, the $x$-offset is
40756 % relative to the left page edge \emph{not} the \gls{typeblock}.
40757 % This is because they are designed for backdrops, which
40758 % tend to span the entire page.
40759 % Note that the colour specs must be
40760 % completely enclosed in braces. e.g.\ "{[gray]{0.5}}" \emph{not} "[gray]{0.5}".
40761 %
40762 % Need a length to store the width of the \gls{static}.
40763 % \begin{macrocode}
40764 \newlength\@ff@staticW
40765 % \end{macrocode}
40766 % Vertical two tone effect where the height of the static
40767 % frames is equal to the paper height.
40768 % \begin{macrocode}
40769 \newcommand*{\vtwotone}[1][all]{%
40770 \def\ff@pages{#1}%
40771 \@vtwotone
40772 }
40773
40774 \newcommand*{\@vtwotone}[1][0pt]{\@@vtwotonebottom{#1}{\paperheight}}
40775 % \end{macrocode}
40776 %\end{macro}
40777 %\begin{macro}{\vtwotonebottom}
40778 % Vertical two tone effect along the bottom of the page, of
40779 % height \meta{H}.
40780 % Syntax:\newline
40781 % \cs{vtwotonebottom}\oarg{pages}\oarg{xoffset}\marg{H}\marg{W1}\marg{C1}\marg{L1}\marg{W2}\marg{C2}\marg{L2}
40782 % where the first frame starts at \meta{xoffset}.
40783 % \begin{macrocode}
40784 \newcommand*{\@@vtwotonebottom}[8]{%
40785 \computeleftedgeodd{\@ff@tmp@x}%
40786 \if@twoside
40787 \computeleftedgeeven{\@ff@tmp@x@even}%
40788 \else
40789 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
40790 \fi
40791 \computebottomedge{\@ff@tmp@y}%
40792 \addtolength{\@ff@tmp@x}{#1}%
40793 \addtolength{\@ff@tmp@x@even}{#1}%
40794 \@nextvband{\ff@pages}{#2}{#3}{#4}{#5}%
40795 \@nextvband{\ff@pages}{#2}{#6}{#7}{#8}%
40796 }
40797
40798 \@onlypreamble{\vtwotone}
40799 % \end{macrocode}
40800 %\end{macro}
40801 %\begin{macro}{\vtwotonebottom}
40802 % Border strip along the bottom of the page
40803 % \begin{macrocode}
40804 \newcommand*{\vtwotonebottom}[1][all]{%
40805 \def\ff@pages{#1}%
40806 \@vtwotonebottom
40807 }
40808
40809 \@onlypreamble{\vtwotonebottom}
40810
40811 \newcommand*{\@vtwotonebottom}[2][0pt]{\@@vtwotonebottom{#1}{#2}}
40812 % \end{macrocode}
40813 %\end{macro}
40814 %\begin{macro}{\vtwotonetop}
40815 % Border strip along the top of the page
40816 % \begin{macrocode}
40817 \newcommand*{\vtwotonetop}[1][all]{%
40818 \def\ff@pages{#1}%
40819 \@vtwotonetop
40820 }
40821
40822 \newcommand*{\@vtwotonetop}[2][0pt]{\@@vtwotonetop{#1}{#2}}
40823
40824 \newcommand*{\@@vtwotonetop}[8]{%
40825 \computeleftedgeodd{\@ff@tmp@x}%
40826 \if@twoside
40827 \computeleftedgeeven{\@ff@tmp@x@even}%
40828 \else
40829 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
40830 \fi
40831 \computetopedge{\@ff@tmp@y}%
40832 \addtolength{\@ff@tmp@y}{-#2}%
40833 \addtolength{\@ff@tmp@x}{#1}%
40834 \addtolength{\@ff@tmp@x@even}{#1}%
40835 \@nextvband{\ff@pages}{#2}{#3}{#4}{#5}%
40836 \@nextvband{\ff@pages}{#2}{#6}{#7}{#8}%
40837 }
40838 % \end{macrocode}
40839 %\end{macro}
40840 %\begin{macro}{\@nextvband}
40841 % Make next \gls{static}. Syntax:\newline
40842 % \cs{@nextvband}\marg{pages}\marg{height}\marg{width}\marg{colour specs}\marg{label}\newline
40843 % $x$ and $y$ offsets are given by "\@ff@tmp@x" and "\@ff@tmp@y".
40844 % On exit, "\@ff@tmp@x" is set to the right border.
40845 % \begin{macrocode}
40846 \newcommand*{\@nextvband}[5]{%
40847 \setlength{\@ff@staticW}{#3}%
40848 \ifthenelse{\equal{#5}{}}%
40849 {%
40850 \newstaticframe[#1]{\@ff@staticW}{#2}{\@ff@tmp@x}{\@ff@tmp@y}%
40851 }%
40852 {%
40853 \newstaticframe[#1]{\@ff@staticW}{#2}{\@ff@tmp@x}{\@ff@tmp@y}[#5]%
40854 }%
40855 \expandafter\global\expandafter\setlength
40856 \csname @sf@\romannumeral\c@maxstatic @evenx\endcsname{%
40857 \@ff@tmp@x@even}%
40858 \@setframecol#4\end{\c@maxstatic}{backcol}{sf}%
40859 \addtolength{\@ff@tmp@x}{\@ff@staticW}%
40860 \addtolength{\@ff@tmp@x@even}{\@ff@staticW}%
40861 }
40862 % \end{macrocode}
40863 %\end{macro}
40864 %\begin{macro}{\vNtone}
40865 % Similarly for N colours. Syntax:\newline
40866 % \cs{vNtone}\oarg{pages}\oarg{xoffset}\marg{n}\marg{W1}\marg{C1}\marg{L1}\ldots\marg{Wn}\marg{Cn}\marg{Ln}\newline
40867 % where the first frame has width \meta{W1} with background
40868 % colour \meta{C1} and label \meta{L1} all the way up to
40869 % the \meta{n}th frame which has width \meta{Wn}, background
40870 % colour \meta{Cn} and \gls{idl} \meta{Ln}.
40871 %
40872 % Keep track of which strip we are doing.
40873 % \begin{macrocode}
40874 \newcount\@thisstrip
40875 % \end{macrocode}
40876 % This command needs two optional arguments, so store
40877 % first optional argument, and look for the next.
40878 % \begin{macrocode}
40879 \newcommand*{\vNtone}[1][all]{%
40880 \def\ff@pages{#1}%
40881 \@vNtone
40882 }
40883 % \end{macrocode}
40884 %\end{macro}
40885 %\begin{macro}{\@vNtone}
40886 % Got the first argument, now get the next.
40887 % \begin{macrocode}
40888 \newcommand*{\@vNtone}[2][0pt]{%
40889 \@@vNtone{#1}{#2}{\paperheight}%
40890 }
40891 % \end{macrocode}
40892 %\end{macro}
40893 %\begin{macro}{\@@vNtone}
40894 % Vertical \meta{n} tone aligned along the
40895 % bottom of the page with height "#3".
40896 % \begin{macrocode}
40897 \newcommand*{\@@vNtone}[3]{%
40898 \computeleftedgeodd{\@ff@tmp@x}%
40899 \if@twoside
40900 \computeleftedgeeven{\@ff@tmp@x@even}%
40901 \else
40902 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
40903 \fi
40904 \computebottomedge{\@ff@tmp@y}%
40905 \addtolength{\@ff@tmp@x}{#1}%
40906 \addtolength{\@ff@tmp@x@even}{#1}%
40907 \@thisstrip=#2\relax
40908 \setlength{\@ff@staticH}{#3}%
40909 \@nextvNband
40910 }
40911 % \end{macrocode}
40912 %\end{macro}
40913 %\begin{macro}{\@nextvNband}
40914 % Recursively do the next strip.
40915 % \begin{macrocode}
40916 \newcommand*{\@nextvNband}{%
40917 \ifnum\@thisstrip>0\relax
40918 \let\flf@next\@@nextvNband
40919 \else
40920 \let\flf@next\relax
40921 \fi
40922 \advance\@thisstrip by -1\relax
40923 \flf@next
40924 }
40925 % \end{macrocode}
40926 %\end{macro}
40927 %\begin{macro}{\@@nextvNband}
40928 % Do current strip, and go on to next one.
40929 % \begin{macrocode}
40930 \newcommand*{\@@nextvNband}[3]{%
40931 \@nextvband{\ff@pages}{\@ff@staticH}{#1}{#2}{#3}%
40932 \@nextvNband
40933 }
40934
40935 \@onlypreamble{\vNtone}
40936 % \end{macrocode}
40937 %\end{macro}
40938 %\begin{macro}{\vNtonebottom}
40939 % Border strip along the bottom of the page. Same as above
40940 % but user specifies the height.
40941 % \begin{macrocode}
40942 \newcommand*{\vNtonebottom}[1][all]{%
40943 \def\ff@pages{#1}%
40944 \@vNtonebottom
40945 }
40946 \@onlypreamble{\vNtonebottom}
40947 % \end{macrocode}
40948 %\end{macro}
40949 %\begin{macro}{\@vNtonebottom}
40950 % \begin{macrocode}
40951 \newcommand*{\@vNtonebottom}[3][0pt]{%
40952 \@@vNtone{#1}{#2}{#3}%
40953 }
40954 % \end{macrocode}
40955 %\end{macro}
40956 %\begin{macro}{\vNtonetop}
40957 % Border strip along the top of the page. Again two
40958 % optional arguments are required. Get first optional
40959 % argument.
40960 % \begin{macrocode}
40961 \newcommand*{\vNtonetop}[1][all]{%
40962 \def\ff@pages{#1}%
40963 \@vNtonetop
40964 }
40965 \@onlypreamble{\vNtonetop}
40966 % \end{macrocode}
40967 %\end{macro}
40968 %\begin{macro}{\@vNtonetop}
40969 % Get next optional argument.
40970 % \begin{macrocode}
40971 \newcommand*{\@vNtonetop}[3][0pt]{%
40972 \@@vNtonetop{#1}{#2}{#3}%
40973 }
40974 % \end{macrocode}
40975 %\end{macro}
40976 %\begin{macro}{\@@vNtonetop}
40977 % Now get on with it. Again, it has to be done
40978 % recursively.
40979 % \begin{macrocode}
40980 \newcommand*{\@@vNtonetop}[3]{%
40981 \computeleftedgeodd{\@ff@tmp@x}%
40982 \if@twoside
40983 \computeleftedgeeven{\@ff@tmp@x@even}%
40984 \else
40985 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
40986 \fi
40987 \computetopedge{\@ff@tmp@y}%
40988 \addtolength{\@ff@tmp@y}{-#3}%
40989 \addtolength{\@ff@tmp@x}{#1}%
40990 \addtolength{\@ff@tmp@x@even}{#1}%
40991 \@thisstrip=#2\relax
40992 \setlength{\@ff@staticH}{#3}%
40993 \@nextvNband%
40994 }
40995 % \end{macrocode}
40996 %\end{macro}
40997 %\begin{macro}{\htwotone}
40998 % Now do horizontal strips. Syntax:\newline
40999 % \cs{htwotone}\oarg{pages}\oarg{y offset}\marg{H1}\marg{C1}\marg{L1}\marg{H2}\marg{C2}\marg{L2}
41000 % \begin{macrocode}
41001 \newcommand*{\htwotone}[1][all]{%
41002 \def\ff@pages{#1}%
41003 \@htwotone
41004 }
41005 % \end{macrocode}
41006 %\end{macro}
41007 %\begin{macro}{\@htwotone}
41008 % \begin{macrocode}
41009 \newcommand*{\@htwotone}[1][0pt]{\@@htwotoneleft{#1}{\paperwidth}}
41010 % \end{macrocode}
41011 %\end{macro}
41012 %\begin{macro}{\@@htwotoneleft}
41013 % This is all done in much the same way as the vertical
41014 % strips.
41015 % \begin{macrocode}
41016 \newcommand*{\@@htwotoneleft}[8]{%
41017 \computeleftedgeodd{\@ff@tmp@x}%
41018 \if@twoside
41019 \computeleftedgeeven{\@ff@tmp@x@even}%
41020 \else
41021 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
41022 \fi
41023 \computebottomedge{\@ff@tmp@y}%
41024 \addtolength{\@ff@tmp@y}{#1}%
41025 \@nexthband{\ff@pages}{#2}{#3}{#4}{#5}%
41026 \@nexthband{\ff@pages}{#2}{#6}{#7}{#8}%
41027 }
41028
41029 \@onlypreamble{\htwotone}
41030 % \end{macrocode}
41031 %\end{macro}
41032 %\begin{macro}{\htwotoneleft}
41033 % Two tone horizontal strips along left border
41034 % Syntax: \cs{htwotoneleft}\oarg{pages}\oarg{y offset}\marg{width}\marg{H1}\marg{C1}\marg{L1}\marg{H2}\marg{C2}\marg{L2}
41035 % \begin{macrocode}
41036 \newcommand*{\htwotoneleft}[1][all]{%
41037 \def\ff@pages{#1}%
41038 \@htwotoneleft
41039 }
41040 \@onlypreamble{\htwotoneleft}
41041 % \end{macrocode}
41042 %\end{macro}
41043 %\begin{macro}{\@htwotoneleft}
41044 % \begin{macrocode}
41045 \newcommand*{\@htwotoneleft}[2][0pt]{\@@htwotoneleft{#1}{#2}}
41046 % \end{macrocode}
41047 %\end{macro}
41048 %\begin{macro}{\htwotoneright}
41049 % Two tone horizontal strips along right border
41050 % \begin{macrocode}
41051 \newcommand*{\htwotoneright}[1][all]{%
41052 \def\ff@pages{#1}%
41053 \@htwotoneright
41054 }
41055 \@onlypreamble{\htwotoneright}
41056 % \end{macrocode}
41057 %\end{macro}
41058 %\begin{macro}{\@htwotoneright}
41059 % \begin{macrocode}
41060 \newcommand*{\@htwotoneright}[2][0pt]{\@@htwotoneright{#1}{#2}}
41061 % \end{macrocode}
41062 %\end{macro}
41063 %\begin{macro}{\@@htwotoneright}
41064 % \begin{macrocode}
41065 \newcommand*{\@@htwotoneright}[8]{%
41066 \computerightedgeodd{\@ff@tmp@x}%
41067 \if@twoside
41068 \computerightedgeeven{\@ff@tmp@x@even}%
41069 \else
41070 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
41071 \fi
41072 \computebottomedge{\@ff@tmp@y}%
41073 \addtolength{\@ff@tmp@y}{#1}%
41074 \addtolength{\@ff@tmp@x}{-#2}%
41075 \addtolength{\@ff@tmp@x@even}{-#2}%
41076 \@nexthband{\ff@pages}{#2}{#3}{#4}{#5}%
41077 \@nexthband{\ff@pages}{#2}{#6}{#7}{#8}%
41078 }
41079 % \end{macrocode}
41080 %\end{macro}
41081 %\begin{macro}{\hNtone}
41082 % Now for \meta{N} coloured horizontal strips
41083 % \begin{macrocode}
41084 \newcommand*{\hNtone}[1][all]{%
41085 \def\ff@pages{#1}%
41086 \@hNtone
41087 }
41088 \@onlypreamble{\hNtone}
41089 % \end{macrocode}
41090 %\end{macro}
41091 %\begin{macro}{\@hNtone}
41092 % \begin{macrocode}
41093 \newcommand*{\@hNtone}[2][0pt]{%
41094 \@@hNtone{#1}{#2}{\paperwidth}%
41095 }
41096 % \end{macrocode}
41097 %\end{macro}
41098 %\begin{macro}{\@@hNtone}
41099 % \begin{macrocode}
41100 \newcommand*{\@@hNtone}[3]{%
41101 \computeleftedgeodd{\@ff@tmp@x}%
41102 \if@twoside
41103 \computeleftedgeeven{\@ff@tmp@x@even}%
41104 \else
41105 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
41106 \fi
41107 \computebottomedge{\@ff@tmp@y}%
41108 \addtolength{\@ff@tmp@y}{#1}%
41109 \@thisstrip=#2\relax
41110 \setlength{\@ff@staticW}{#3}%
41111 \@nexthNband
41112 }
41113 % \end{macrocode}
41114 %\end{macro}
41115 %\begin{macro}{\hNtoneleft}
41116 % Now for the N tone strips along the left border
41117 % \begin{macrocode}
41118 \newcommand*{\hNtoneleft}[1][all]{%
41119 \def\ff@pages{#1}%
41120 \@hNtoneleft
41121 }
41122 \@onlypreamble{\hNtoneleft}
41123 % \end{macrocode}
41124 %\end{macro}
41125 %\begin{macro}{\@hNtoneleft}
41126 % \begin{macrocode}
41127 \newcommand*{\@hNtoneleft}[3][0pt]{%
41128 \@@hNtone{#1}{#2}{#3}%
41129 }
41130 % \end{macrocode}
41131 %\end{macro}
41132 %\begin{macro}{\hNtoneright}
41133 % Border strip along the right border
41134 % \begin{macrocode}
41135 \newcommand*{\hNtoneright}[1][all]{%
41136 \def\ff@pages{#1}%
41137 \@hNtoneright
41138 }
41139 \@onlypreamble{\hNtoneright}
41140 % \end{macrocode}
41141 %\end{macro}
41142 %\begin{macro}{\@hNtoneright}
41143 % \begin{macrocode}
41144 \newcommand*{\@hNtoneright}[3][0pt]{%
41145 \@@hNtoneright{#1}{#2}{#3}%
41146 }
41147 % \end{macrocode}
41148 %\end{macro}
41149 %\begin{macro}{\@@hNtoneright}
41150 % \begin{macrocode}
41151 \newcommand*{\@@hNtoneright}[3]{%
41152 \computerightedgeodd{\@ff@tmp@x}%
41153 \if@twoside
41154 \computerightedgeeven{\@ff@tmp@x@even}%
41155 \else
41156 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
41157 \fi
41158 \computebottomedge{\@ff@tmp@y}%
41159 \addtolength{\@ff@tmp@y}{#1}%
41160 \addtolength{\@ff@tmp@x}{-#3}%
41161 \addtolength{\@ff@tmp@x@even}{-#3}%
41162 \@thisstrip=#2\relax
41163 \setlength{\@ff@staticW}{#3}%
41164 \@nexthNband
41165 }
41166 % \end{macrocode}
41167 %\end{macro}
41168 %\begin{macro}{\@nexthband}
41169 % Make next \gls{static}. Syntax:\newline
41170 % \cs{@nexthband}\marg{pages}\marg{width}\marg{height}\marg{colour specs}\marg{label}\newline
41171 % $x$ and $y$ offsets are given by "\@ff@tmp@x" and "\@ff@tmp@y".
41172 % On exit, "\@ff@tmp@y" is set to the top border.
41173 % \begin{macrocode}
41174 \newcommand*{\@nexthband}[5]{%
41175 \setlength{\@ff@staticH}{#3}%
41176 \ifthenelse{\equal{#5}{}}%
41177 {%
41178 \newstaticframe[#1]{#2}{\@ff@staticH}{\@ff@tmp@x}{\@ff@tmp@y}%
41179 }%
41180 {%
41181 \newstaticframe[#1]{#2}{\@ff@staticH}{\@ff@tmp@x}{\@ff@tmp@y}[#5]%
41182 }%
41183 \expandafter\global\expandafter
41184 \setlength\csname @sf@\romannumeral\c@maxstatic @evenx\endcsname
41185 {\@ff@tmp@x@even}%
41186 \@setframecol#4\end{\c@maxstatic}{backcol}{sf}%
41187 \addtolength{\@ff@tmp@y}{\@ff@staticH}%
41188 }
41189 % \end{macrocode}
41190 %\end{macro}
41191 %\begin{macro}{\@nexthNband}
41192 % Get next horizontal strip recursively.
41193 % \begin{macrocode}
41194 \newcommand*{\@nexthNband}{%
41195 \ifnum\@thisstrip>0\relax
41196 \let\flf@next\@@nexthNband
41197 \else
41198 \let\flf@next\relax
41199 \fi
41200 \advance\@thisstrip by -1\relax
41201 \flf@next
41202 }
41203 % \end{macrocode}
41204 %\end{macro}
41205 %\begin{macro}{\@@nexthNband}
41206 % \begin{macrocode}
41207 \newcommand*{\@@nexthNband}[3]{%
41208 \@nexthband{\ff@pages}{\@ff@staticW}{#1}{#2}{#3}%
41209 \@nexthNband
41210 }
41211 % \end{macrocode}
41212 %\end{macro}
41213 %\begin{macro}{\makebackgroundframe}
41214 % Make one big \gls{static} that covers the entire page.
41215 % This command should come before all other commands that create
41216 % \glspl{static}, otherwise it will obscure all the ones defined
41217 % before it. Syntax:\newline
41218 % \cs{makebackgroundframe}\oarg{pages}\oarg{label}.
41219 % \begin{macrocode}
41220 \newcommand*{\makebackgroundframe}[1][all]{%
41221 \ifnum\c@maxstatic>0\relax
41222 \PackageWarning{flowfram}%
41223 {%
41224 Background frame is not first static frame to be
41225 defined. All previously defined static frames may be
41226 obscured.%
41227 }%
41228 \fi
41229 \computeleftedgeodd{\@ff@tmp@x}%
41230 \if@twoside
41231 \computeleftedgeeven{\@ff@tmp@x@even}%
41232 \else
41233 \setlength{\@ff@tmp@x@even}{\@ff@tmp@x}%
41234 \fi
41235 \computebottomedge{\@ff@tmp@y}%
41236 \newstaticframe[#1]{\paperwidth}{\paperheight}{\@ff@tmp@x}%
41237 {\@ff@tmp@y}%
41238 \expandafter\global\expandafter
41239 \setlength\csname @sf@\romannumeral\c@maxstatic @evenx\endcsname
41240 {\@ff@tmp@x@even}%
41241 }
41242 % \end{macrocode}
41243 %\end{macro}
41244 %
41245 %\subsubsection{Lines Between Frames}
41246 %\DescribeMacro{\insertvrule}
41247 % Insert a \gls{static} between two frames with a vertical
41248 % rule that goes from the maximum height of the highest
41249 % to the minimum height of the lowest, equidistant from
41250 % both frames. Syntax:\newline
41251 % \cs{insertvrule}\oarg{y top}\oarg{y bottom}\marg{frame1 type}\marg{IDN1}\marg{frame2 type}\meta{IDN2}.
41252 % The starred version uses \glspl{idl} instead of \glspl{idn}.
41253 % The optional arguments indicate to continue above the highest
41254 % point by \meta{y top} or continue below the lowest point
41255 % by \meta{y bottom}.
41256 %
41257 %\begin{macro}{\ffcolumnseprule}
41258 % This has changed in v1.09. Define "\ffcolumnseprule" and use
41259 % instead of "\columnseprule"
41260 % \begin{macrocode}
41261 \newlength\ffcolumnseprule
41262 \setlength{\ffcolumnseprule}{2pt}
41263 % \end{macrocode}
41264 %\end{macro}
41265 %\begin{macro}{\ffruledeclarations}
41266 %\changes{1.11}{2008/06/27}{new}
41267 % This can be redefined to use declarations that affect how the
41268 % rule appears. For example, it can be used to set the colour of
41269 % the rule.
41270 % \begin{macrocode}
41271 \newcommand*{\ffruledeclarations}{}
41272 % \end{macrocode}
41273 %\end{macro}
41274 %\begin{macro}{\insertvrule}
41275 % Determine whether or not the starred version is being
41276 % used.
41277 % \begin{macrocode}
41278 \newcommand*{\insertvrule}{\@ifstar\@sinsertvrule\@insertvrule}
41279 % \end{macrocode}
41280 %\end{macro}
41281 %\begin{macro}{\@insertvrule}
41282 % Two optional arguments required.
41283 % \begin{macrocode}
41284 \newcommand*{\@insertvrule}[1][0pt]{%
41285 \@ifnextchar[{\@@insertvrule[#1]}{\@@insertvrule[#1][0pt]}%
41286 }
41287 % \end{macrocode}
41288 %\end{macro}
41289 % Need some lengths:
41290 % \begin{macrocode}
41291 \newlength\@ff@left@x
41292 \newlength\@ff@left@y
41293 \newlength\@ff@left@evenx
41294 \newlength\@ff@left@eveny
41295 \newlength\@ff@left@width
41296 \newlength\@ff@left@height
41297 % \end{macrocode}
41298 %\begin{macro}{\@@insertvrule}
41299 % Arguments all accounted for. Convert the frame type
41300 % into a number to make life easier
41301 % \begin{macrocode}
41302 \def\@@insertvrule[#1][#2]#3#4#5#6{%
41303 \ifthenelse{\equal{#3}{flow}}%
41304 {%
41305 \def\@ff@type@i{1}%
41306 }%
41307 {%
41308 \ifthenelse{\equal{#3}{static}}%
41309 {%
41310 \def\@ff@type@i{2}%
41311 }%
41312 {%
41313 \ifthenelse{\equal{#3}{dynamic}}%
41314 {%
41315 \def\@ff@type@i{3}%
41316 }%
41317 {%
41318 \PackageError{flowfram}%
41319 {Unknown frame type '#3'}%
41320 {%
41321 Available frame types are: 'flow', 'static'
41322 or 'dynamic'%
41323 }%
41324 }%
41325 }%
41326 }%
41327 \ifthenelse{\equal{#5}{flow}}%
41328 {%
41329 \def\@ff@type@ii{1}%
41330 }%
41331 {%
41332 \ifthenelse{\equal{#5}{static}}%
41333 {%
41334 \def\@ff@type@ii{2}%
41335 }%
41336 {%
41337 \ifthenelse{\equal{#5}{dynamic}}%
41338 {%
41339 \def\@ff@type@ii{3}%
41340 }%
41341 {%
41342 \PackageError{flowfram}%
41343 {Unknown frame type '#5'}%
41344 {%
41345 Available frame types are: 'flow', 'static'
41346 or 'dynamic'%
41347 }%
41348 }%
41349 }%
41350 }%
41351 \@@insert@vrule{#1}{#2}{\@ff@type@i}{#4}{\@ff@type@ii}{#6}%
41352 }
41353 % \end{macrocode}
41354 %\end{macro}
41355 %\begin{macro}{\@@insert@vrule}
41356 % Insert a new \gls{static} between the two specified frames.
41357 % Check to make sure which one is on the left and which one
41358 % is on the right.
41359 % Syntax:\newline
41360 %\cs{@@insert@vrule}\marg{y top}\marg{y bottom}\marg{type ID}\marg{IDN}\marg{type ID}\marg{IDN}.
41361 % \begin{macrocode}
41362 \newcommand*{\@@insert@vrule}[6]{%
41363 \@ff@getdim{#3}{#4}%
41364 \setlength{\@ff@left@x}{\ffareax}%
41365 \setlength{\@ff@left@y}{\ffareay}%
41366 \setlength{\@ff@left@width}{\ffareawidth}%
41367 \setlength{\@ff@left@height}{\ffareaheight}%
41368 \@ff@getdim{#5}{#6}%
41369 \ifnum\@ff@left@x>\ffareax\relax
41370 \@ff@swaplen{\@ff@left@x}{\ffareax}%
41371 \@ff@swaplen{\@ff@left@y}{\ffareax}%
41372 \@ff@swaplen{\@ff@left@evenx}{\ffareaevenx}%
41373 \@ff@swaplen{\@ff@left@eveny}{\ffareaevenx}%
41374 \@ff@swaplen{\@ff@left@width}{\ffareawidth}%
41375 \@ff@swaplen{\@ff@left@height}{\ffareaheight}%
41376 \fi
41377 \setlength{\@ff@tmp@x}{\@ff@left@x}
41378 \addtolength{\@ff@tmp@x}{\@ff@left@width}%
41379 \setlength{\@ff@staticW}{\ffareax}%
41380 \addtolength{\@ff@staticW}{-\@ff@tmp@x}%
41381 \setlength{\@ff@staticH}{\@ff@left@y}%
41382 \addtolength{\@ff@staticH}{\@ff@left@height}%
41383 \setlength{\@ff@tmp@y}{\ffareay}%
41384 \addtolength{\@ff@tmp@y}{\ffareaheight}%
41385 \ifnum\@ff@tmp@y>\@ff@staticH
41386 \setlength{\@ff@staticH}{\@ff@tmp@y}%
41387 \fi
41388 \ifnum\@ff@left@y<\ffareay\relax
41389 \setlength{\@ff@tmp@y}{\@ff@left@y}%
41390 \else
41391 \setlength{\@ff@tmp@y}{\ffareay}%
41392 \fi
41393 \addtolength{\@ff@staticH}{-\@ff@tmp@y}%
41394 \newstaticframe{\@ff@staticW}{\@ff@staticH}%
41395 {\@ff@tmp@x}{\@ff@tmp@y}%
41396 \addtolength{\@ff@staticH}{#1}%
41397 \addtolength{\@ff@staticH}{#2}%
41398 \setstaticcontents{\c@maxstatic}{%
41399 \ffruledeclarations
41400 \ffvrule{#2}{\ffcolumnseprule}{\@ff@staticH}}%
41401 \ifcase#3\relax
41402 \or \edef\@ff@pages{\csname @ff@pages@\romannumeral#4\endcsname}%
41403 \or \edef\@ff@pages{\csname @sf@pages@\romannumeral#4\endcsname}%
41404 \or \edef\@ff@pages{\csname @df@pages@\romannumeral#4\endcsname}%
41405 \fi
41406 \setstaticframe{\c@maxstatic}{pages=\@ff@pages}%
41407 % \end{macrocode}
41408 % Check the difference between odd and even page co-ordinates
41409 % and shift new frame in same direction. (Assumes the two
41410 % original frames stay in the same relative position.)
41411 % \begin{macrocode}
41412 \addtolength{\@ff@tmp@x}{\@ff@left@evenx}%
41413 \addtolength{\@ff@tmp@x}{-\@ff@left@x}%
41414 \addtolength{\@ff@tmp@y}{\@ff@left@eveny}%
41415 \addtolength{\@ff@tmp@y}{-\@ff@left@y}%
41416 \setstaticframe{\c@maxstatic}{evenx=\@ff@tmp@x,eveny=\@ff@tmp@y}%
41417 }
41418 % \end{macrocode}
41419 %\end{macro}
41420 %\begin{macro}{\ffvrule}
41421 %\changes{1.11}{2008/06/27}{new}
41422 %\cs{ffvrule}\marg{offset}\marg{width}\marg{height}\par
41423 % Draws the rule for \cs{insertvrule}
41424 % \begin{macrocode}
41425 \newcommand*{\ffvrule}[3]{%
41426 \hfill \rule[-#1]{#2}{#3}\hfill\mbox{}%
41427 }
41428 % \end{macrocode}
41429 %\end{macro}
41430 %\begin{macro}{\@sinsertvrule}
41431 % Starred version. Two optional arguments required.
41432 % \begin{macrocode}
41433 \newcommand*{\@sinsertvrule}[1][0pt]{%
41434 \@ifnextchar[{\@@sinsertvrule[#1]}{\@@sinsertvrule[#1][0pt]}%
41435 }
41436 % \end{macrocode}
41437 %\end{macro}
41438 %\begin{macro}{\@@sinsertvrule}
41439 % Find out the frame types and their \gls{idn}.
41440 % \begin{macrocode}
41441 \def\@@sinsertvrule[#1][#2]#3#4#5#6{%
41442 \ifthenelse{\equal{#3}{flow}}%
41443 {%
41444 \def\@ff@type@i{1}%
41445 \@flowframeid{#4}%
41446 \@ff@tmpN=\ff@id
41447 }%
41448 {%
41449 \ifthenelse{\equal{#3}{static}}%
41450 {%
41451 \def\@ff@type@i{2}\@staticframeid{#4}\@ff@tmpN=\ff@id
41452 }%
41453 {%
41454 \ifthenelse{\equal{#3}{dynamic}}%
41455 {%
41456 \def\@ff@type@i{3}%
41457 \@dynamicframeid{#4}%
41458 \@ff@tmpN=\ff@id
41459 }%
41460 {%
41461 \PackageError{flowfram}%
41462 {Unknown frame type '#3'}%
41463 {%
41464 Available frame types are: 'flow', 'static'
41465 or 'dynamic'%
41466 }%
41467 }%
41468 }%
41469 }%
41470 \ifthenelse{\equal{#5}{flow}}%
41471 {%
41472 \def\@ff@type@ii{1}\@flowframeid{#6}%
41473 }%
41474 {%
41475 \ifthenelse{\equal{#5}{static}}%
41476 {%
41477 \def\@ff@type@ii{2}%
41478 \@staticframeid{#6}%
41479 }%
41480 {%
41481 \ifthenelse{\equal{#5}{dynamic}}%
41482 {%
41483 \def\@ff@type@ii{3}%
41484 \@dynamicframeid{#6}%
41485 }%
41486 {%
41487 \PackageError{flowfram}%
41488 {Unknown frame type '#5'}%
41489 {%
41490 Available frame types are: 'flow', 'static'
41491 or 'dynamic'%
41492 }%
41493 }%
41494 }%
41495 }%
41496 \@@insert@vrule{#1}{#2}{\@ff@type@i}{\@ff@tmpN}%
41497 {\@ff@type@ii}{\ff@id}%
41498 }
41499 % \end{macrocode}
41500 %\end{macro}
41501 %\begin{macro}{\inserthrule}
41502 % Now for a horizontal rule. Syntax similar to "\insertvrule".
41503 % Determine whether or not the starred version is being
41504 % used.
41505 % \begin{macrocode}
41506 \newcommand*{\inserthrule}{\@ifstar\@sinserthrule\@inserthrule}
41507 % \end{macrocode}
41508 %\end{macro}
41509 %\begin{macro}{\@inserthrule}
41510 % Two optional arguments required.
41511 % \begin{macrocode}
41512 \newcommand*{\@inserthrule}[1][0pt]{%
41513 \@ifnextchar[{\@@inserthrule[#1]}{\@@inserthrule[#1][0pt]}%
41514 }
41515 % \end{macrocode}
41516 %\end{macro}
41517 %\begin{macro}{\@@inserthrule}
41518 % Arguments all accounted for. Convert the frame type
41519 % into a number to make life easier
41520 % \begin{macrocode}
41521 \def\@@inserthrule[#1][#2]#3#4#5#6{%
41522 \ifthenelse{\equal{#3}{flow}}%
41523 {%
41524 \def\@ff@type@i{1}%
41525 }%
41526 {%
41527 \ifthenelse{\equal{#3}{static}}%
41528 {%
41529 \def\@ff@type@i{2}%
41530 }%
41531 {%
41532 \ifthenelse{\equal{#3}{dynamic}}%
41533 {%
41534 \def\@ff@type@i{3}}%
41535 {%
41536 \PackageError{flowfram}%
41537 {Unknown frame type '#3'}%
41538 {%
41539 Available frame types are: 'flow', 'static'
41540 or 'dynamic'%
41541 }%
41542 }%
41543 }%
41544 }%
41545 \ifthenelse{\equal{#5}{flow}}%
41546 {%
41547 \def\@ff@type@ii{1}%
41548 }%
41549 {%
41550 \ifthenelse{\equal{#5}{static}}%
41551 {%
41552 \def\@ff@type@ii{2}%
41553 }%
41554 {%
41555 \ifthenelse{\equal{#5}{dynamic}}%
41556 {%
41557 \def\@ff@type@ii{3}%
41558 }%
41559 {%
41560 \PackageError{flowfram}%
41561 {Unknown frame type '#5'}%
41562 {%
41563 Available frame types are: 'flow', 'static'
41564 or 'dynamic'%
41565 }%
41566 }%
41567 }%
41568 }%
41569 \@@insert@hrule{#1}{#2}{\@ff@type@i}{#4}{\@ff@type@ii}{#6}%
41570 }
41571 % \end{macrocode}
41572 %\end{macro}
41573 %\begin{macro}{\@@insert@hrule}
41574 % Insert a new \gls{static} between the two specified frames.
41575 % Check to make sure which one is on the top and which one
41576 % is on the bottom.
41577 % Syntax:\newline
41578 %\cs{@@insert@hrule}\marg{x left}\marg{x right}\marg{type ID}\marg{IDN}\marg{type ID}\marg{IDN}.
41579 % \begin{macrocode}
41580 \newcommand*{\@@insert@hrule}[6]{%
41581 \@ff@getdim{#3}{#4}%
41582 \setlength{\@ff@left@x}{\ffareax}%
41583 \setlength{\@ff@left@y}{\ffareay}%
41584 \setlength{\@ff@left@width}{\ffareawidth}%
41585 \setlength{\@ff@left@height}{\ffareaheight}%
41586 \@ff@getdim{#5}{#6}%
41587 \ifnum\@ff@left@y>\ffareay\relax
41588 \@ff@swaplen{\@ff@left@x}{\ffareax}%
41589 \@ff@swaplen{\@ff@left@y}{\ffareay}%
41590 \@ff@swaplen{\@ff@left@width}{\ffareawidth}%
41591 \@ff@swaplen{\@ff@left@height}{\ffareaheight}%
41592 \fi
41593 \setlength{\@ff@tmp@y}{\@ff@left@y}%
41594 \addtolength{\@ff@tmp@y}{\@ff@left@height}%
41595 \setlength{\@ff@staticH}{\ffareay}%
41596 \addtolength{\@ff@staticH}{-\@ff@tmp@y}%
41597 \setlength{\@ff@staticW}{\@ff@left@x}%
41598 \addtolength{\@ff@staticW}{\@ff@left@width}%
41599 \setlength{\@ff@tmp@x}{\ffareax}%
41600 \addtolength{\@ff@tmp@x}{\ffareawidth}%
41601 \ifnum\@ff@tmp@x>\@ff@staticW\relax
41602 \setlength{\@ff@staticW}{\@ff@tmp@x}%
41603 \fi
41604 \ifnum\@ff@left@x<\ffareax\relax
41605 \setlength{\@ff@tmp@x}{\@ff@left@x}%
41606 \else
41607 \setlength{\@ff@tmp@x}{\ffareax}%
41608 \fi
41609 \addtolength{\@ff@staticW}{-\@ff@tmp@x}%
41610 \newstaticframe{\@ff@staticW}{\@ff@staticH}%
41611 {\@ff@tmp@x}{\@ff@tmp@y}%
41612 \addtolength{\@ff@staticW}{#1}%
41613 \addtolength{\@ff@staticW}{#2}%
41614 \setstaticcontents{\c@maxstatic}%
41615 {%
41616 \ffruledeclarations
41617 \ffhrule{#1}{\@ff@staticW}{\ffcolumnseprule}%
41618 }%
41619 \ifcase#3\relax
41620 \or \edef\@ff@pages{\csname @ff@pages@\romannumeral#4\endcsname}%
41621 \or \edef\@ff@pages{\csname @sf@pages@\romannumeral#4\endcsname}%
41622 \or \edef\@ff@pages{\csname @df@pages@\romannumeral#4\endcsname}%
41623 \fi
41624 \setstaticframe{\c@maxstatic}{pages=\@ff@pages}%
41625 \addtolength{\@ff@tmp@x}{\@ff@left@evenx}%
41626 \addtolength{\@ff@tmp@x}{-\@ff@left@x}%
41627 \addtolength{\@ff@tmp@y}{\@ff@left@eveny}%
41628 \addtolength{\@ff@tmp@y}{-\@ff@left@y}%
41629 \setstaticframe{\c@maxstatic}{evenx=\@ff@tmp@x,eveny=\@ff@tmp@y}%
41630 }
41631 % \end{macrocode}
41632 %\end{macro}
41633 %\begin{macro}{\ffhrule}
41634 %\changes{1.11}{2008/06/27}{new}
41635 %\cs{ffhrule}\marg{offset}\marg{width}\marg{height}\par
41636 % Draws the rule for \cs{inserthrule}
41637 % \begin{macrocode}
41638 \newcommand*{\ffhrule}[3]{%
41639 \hspace*{-#1}\rule{#2}{#3}%
41640 }
41641 % \end{macrocode}
41642 %\end{macro}
41643 %\begin{macro}{\@sinserthrule}
41644 % Starred version. Two optional arguments required.
41645 % \begin{macrocode}
41646 \newcommand*{\@sinserthrule}[1][0pt]{%
41647 \@ifnextchar[{\@@sinserthrule[#1]}{\@@sinserthrule[#1][0pt]}%
41648 }
41649 % \end{macrocode}
41650 %\end{macro}
41651 %\begin{macro}{\@@sinserthrule}
41652 % Find out the frame types and their \gls{idn}.
41653 % \begin{macrocode}
41654 \def\@@sinserthrule[#1][#2]#3#4#5#6{%
41655 \ifthenelse{\equal{#3}{flow}}%
41656 {%
41657 \def\@ff@type@i{1}%
41658 \@flowframeid{#4}%
41659 \@ff@tmpN=\ff@id
41660 }%
41661 {%
41662 \ifthenelse{\equal{#3}{static}}%
41663 {%
41664 \def\@ff@type@i{2}%
41665 \@staticframeid{#4}%
41666 \@ff@tmpN=\ff@id
41667 }%
41668 {%
41669 \ifthenelse{\equal{#3}{dynamic}}%
41670 {%
41671 \def\@ff@type@i{3}%
41672 \@dynamicframeid{#4}%
41673 \@ff@tmpN=\ff@id
41674 }%
41675 {%
41676 \PackageError{flowfram}%
41677 {Unknown frame type '#3'}%
41678 {%
41679 Available frame types are: 'flow', 'static'
41680 or 'dynamic'%
41681 }%
41682 }%
41683 }%
41684 }%
41685 \ifthenelse{\equal{#5}{flow}}%
41686 {%
41687 \def\@ff@type@ii{1}%
41688 \@flowframeid{#6}%
41689 }%
41690 {%
41691 \ifthenelse{\equal{#5}{static}}%
41692 {%
41693 \def\@ff@type@ii{2}%
41694 \@staticframeid{#6}%
41695 }%
41696 {%
41697 \ifthenelse{\equal{#5}{dynamic}}%
41698 {%
41699 \def\@ff@type@ii{3}%
41700 \@dynamicframeid{#6}%
41701 }%
41702 {%
41703 \PackageError{flowfram}%
41704 {Unknown frame type '#5'}%
41705 {%
41706 Available frame types are: 'flow', 'static'
41707 or 'dynamic'%
41708 }%
41709 }%
41710 }%
41711 }%
41712 \@@insert@hrule{#1}{#2}{\@ff@type@i}{\@ff@tmpN}%
41713 {\@ff@type@ii}{\ff@id}%
41714 }
41715 % \end{macrocode}
41716 %\end{macro}
41717 %
41718 % \subsection{Putting Chapter Headings in Dynamic Frames}
41719 %\begin{macro}{\dfchaphead}
41720 % Provide facility to make chapter headings appear
41721 % in specified \gls{dynamic}.
41722 % I originally called this macro "\putchapterheadingsindynamicframe"
41723 % which was descriptive, but overly long, so I changed it
41724 % to the rather more cryptic name "\dfchaphead".
41725 % If the starred form is used, the frame is identified by \gls{idl},
41726 % the unstarred form identifies the frame \gls{idn}.
41727 % \begin{macrocode}
41728 \newcommand*{\dfchaphead}{%
41729 \@ifstar\@sdynamicchap\@dynamicchap
41730 }
41731 % \end{macrocode}
41732 %\end{macro}
41733 % Define style for the chapter heading. These commands
41734 % are should only be used when "\dfchaphead" has been used.
41735 %\begin{macro}{\DFchapterstyle}
41736 % \begin{macrocode}
41737 \newcommand{\DFchapterstyle}[1]{#1}
41738 % \end{macrocode}
41739 %\end{macro}
41740 %\begin{macro}{\DFschapterstyle}
41741 % \begin{macrocode}
41742 \newcommand{\DFschapterstyle}[1]{#1}
41743 % \end{macrocode}
41744 %\end{macro}
41745 %\begin{macro}{\@dynamicchap}
41746 % Unstarred version.
41747 % \begin{macrocode}
41748 \newcommand{\@dynamicchap}[1]{%
41749 \@ifundefined{chapter}%
41750 {%
41751 \PackageError{flowfram}%
41752 {Chapters aren't defined}%
41753 {%
41754 The document class you are using does not
41755 define chapters%
41756 }%
41757 }%
41758 {%
41759 % \end{macrocode}
41760 % Store current chapter head definitions for starred and unstarred
41761 % versions
41762 % \begin{macrocode}
41763 \let\@ff@OLDmakechapterhead\@makechapterhead
41764 \let\@ff@OLDmakeschapterhead\@makeschapterhead
41765 % \end{macrocode}
41766 % Define user commands that can be redefined to modify the chapter
41767 % head style (in the event that the user is using a class that
41768 % doesn't provide an easy means to do this.)
41769 % \begin{macrocode}
41770 \renewcommand{\DFchapterstyle}[1]{\@ff@OLDmakechapterhead{##1}}%
41771 \renewcommand{\DFschapterstyle}[1]{\@ff@OLDmakeschapterhead{##1}}%
41772 % \end{macrocode}
41773 % Redefine chapter heads so that they put their contents in the
41774 % requested dynamic frame. First the unstarred version:
41775 % \begin{macrocode}
41776 \xdef\@makechapterhead##1{%
41777 \noexpand\@setdynamiccontents{\number#1}%
41778 {%
41779 \noexpand\DFchapterstyle{##1}%
41780 }%
41781 }%
41782 % \end{macrocode}
41783 % Now the starred version:
41784 % \begin{macrocode}
41785 \xdef\@makeschapterhead##1{%
41786 \noexpand\@setdynamiccontents{\number#1}%
41787 {%
41788 \noexpand\DFschapterstyle{##1}%
41789 }%
41790 }%
41791 }%
41792 }
41793 % \end{macrocode}
41794 %\end{macro}
41795 %\begin{macro}{\@sdynamicchap}
41796 % Starred form.
41797 % \begin{macrocode}
41798 \newcommand{\@sdynamicchap}[1]{%
41799 \@dynamicframeid{#1}%
41800 \@dynamicchap{\ff@id}%
41801 }
41802 % \end{macrocode}
41803 %\end{macro}
41804 % There is no facility for placing other sectional types
41805 % in \glspl{dynamic}. This is because, either (1) the sectioning
41806 % command does not start a new page, in which case there
41807 % is no way of telling where exactly the new section will start,
41808 % and having a section title in some other location on the
41809 % page is ambiguous, and would really confuse the reader, or
41810 % (2) in the case of "\part" in report or book class files, the
41811 % title appears on a page of its own, so where is the point in
41812 % putting it in a \gls{dynamic}?
41813 %
41814 %\subsection{Thumbtabs}
41815 % Define counter to keep track of total number of
41816 % thumbtabs.
41817 % \begin{macrocode}
41818 \newcounter{maxthumbtabs}
41819 % \end{macrocode}
41820 %\begin{macro}{\defaultthumbtabtype}
41821 % Check to see if chapters are defined, if they are make
41822 % thumbtabs correspond to chapters, otherwise make
41823 % thumbtabs correspond to sections.
41824 % \begin{macrocode}
41825 \@ifundefined{chapter}%
41826 {%
41827 \newcommand*{\defaultthumbtabtype}{section}%
41828 }%
41829 {%
41830 \newcommand*{\defaultthumbtabtype}{chapter}%
41831 }
41832 % \end{macrocode}
41833 %\end{macro}
41834 %\begin{macro}{\@ttb@type}
41835 % Section type to assign to thumbtabs.
41836 % \begin{macrocode}
41837 \newcommand*{\@ttb@type}{\defaultthumbtabtype}
41838 % \end{macrocode}
41839 %\end{macro}
41840 %\begin{macro}{\makethumbtabs}
41841 % Make the thumbtabs. Read in information from ".ttb"
41842 % file, and open it for output.
41843 % Syntax:\newline
41844 % \cs{makethumbtabs}\oarg{y offset}\marg{height}\oarg{sec type}.
41845 %
41846 % First check to see if there is a second optional argument.
41847 % \begin{macrocode}
41848 \newcommand*{\makethumbtabs}[2][0pt]{%
41849 \@ifnextchar[%
41850 {\@makethumbtabs[#1]{#2}}%
41851 {%
41852 \@makethumbtabs[#1]{#2}[\defaultthumbtabtype]%
41853 }%
41854 }
41855 % \end{macrocode}
41856 %\end{macro}
41857 %\begin{macro}{\@makethumbtabs}
41858 % Now all arguments are known, first redefine the
41859 % appropriate sectioning command, then input the ttb file,
41860 % and create the thumbtabs.
41861 % \begin{macrocode}
41862 \def\@makethumbtabs[#1]#2[#3]{%
41863 \@ifundefined{#3}%
41864 {%
41865 \PackageError{flowfram}%
41866 {%
41867 Unknown section type '#3'%
41868 }%
41869 {}%
41870 }%
41871 {%
41872 \renewcommand{\@ttb@type}{#3}%
41873 \ifthenelse{\equal{#3}{chapter}}%
41874 {%
41875 \@makethumbchapter
41876 }%
41877 {%
41878 \ifthenelse{\equal{#3}{part}}%
41879 {\@makethumbpart}%
41880 {%
41881 \@makethumbsection{#3}%
41882 }%
41883 }%
41884 }%
41885 \@starttoc{ttb}%
41886 \@dothumbtabs{#1}{#2}%
41887 }
41888 % \end{macrocode}
41889 %\end{macro}
41890 %\begin{macro}{\@makethumbchapter}
41891 % If thumbtabs correspond to chapters, redefine "\@chapter"
41892 % so that each unstarred chapter writes an entry to the
41893 % ".ttb" file.
41894 % \begin{macrocode}
41895 \newcommand{\@makethumbchapter}{%
41896 \let\@ttb@old@chapter\@chapter
41897 \def\@chapter[##1]##2{%
41898 \@ttb@old@chapter[##1]{##2}%
41899 \addtocontents{ttb}{\protect\thumbtab
41900 {\thepage}{\thechapter}{##1}{chapter.\thechapter}}%
41901 \@afterheading
41902 }%
41903 }
41904 % \end{macrocode}
41905 %\end{macro}
41906 %\begin{macro}{\@makethumbpart}
41907 % For parts in books or reports, the thumbtab needs to be
41908 % saved after the part counter has been incremented, but
41909 % before the page break so that the page number and part
41910 % numbers are correct. If "\@endpart" is not defined, then
41911 % the document class probably does not start a new page after
41912 % "\part". (This can't be guaranteed for non standard class
41913 % files, but there's nothing that can be done about that.)
41914 % If this happens, just redefine "\@part", and hope for the
41915 % best.
41916 % \begin{macrocode}
41917 \newcommand{\@makethumbpart}{%
41918 \let\@ttb@old@part\@part
41919 \@ifundefined{@endpart}%
41920 {%
41921 \def\@part[##1]##2{%
41922 \@ttb@old@part[##1]{##2}%
41923 \addtocontents{ttb}{\protect\thumbtab
41924 {\thepage}{\thepart}{##1}{part.\thepage}}%
41925 \@afterheading
41926 }%
41927 }%
41928 {%
41929 \let\@ttb@old@endpart\@endpart
41930 \def\@part[##1]##2{%
41931 \def\@parttitle{##1}%
41932 \@ttb@old@part[##1]{##2}%
41933 }%
41934 \def\@endpart{%
41935 \addtocontents{ttb}%
41936 {%
41937 \protect\thumbtab{\thepage}%
41938 {\thepart}{\@parttitle}{part.\thepage}%
41939 }%
41940 \@ttb@old@endpart
41941 }%
41942 }%
41943 }
41944 % \end{macrocode}
41945 %\end{macro}
41946 %\begin{macro}{\@makethumbsection}
41947 % Thumbtabs defined for one of the remaining standard
41948 % sectioning commands. Since these commands use
41949 % "\@startsection", it is necessary to redefine
41950 % "\@sect" to add the thumbtab information to the .ttb file.
41951 % \begin{macrocode}
41952 \newcommand*{\@makethumbsection}[1]{%
41953 \let\@ttb@old@sect=\@sect
41954 \def\@sect##1##2##3##4##5##6[##7]##8{%
41955 \@ttb@old@sect{##1}{##2}{##3}{##4}{##5}{##6}[##7]{##8}%
41956 \ifthenelse{\equal{##1}{#1}}%
41957 {%
41958 \addtocontents{ttb}%
41959 {%
41960 \protect\thumbtab{\thepage}{\csname the#1\endcsname}%
41961 {##7}{#1.\csname the#1\endcsname}%
41962 }%
41963 \@afterheading
41964 }%
41965 {}%
41966 }%
41967 }
41968 % \end{macrocode}
41969 %\end{macro}
41970 %\begin{macro}{\thumbtab}
41971 % The thumbtab file, ".ttb", will have a series of "\thumbtab"
41972 % commands, when this file is read in, just store the
41973 % information for now.
41974 % \begin{macrocode}
41975 \newcommand{\thumbtab}[4]{%
41976 \stepcounter{maxthumbtabs}%
41977 \expandafter
41978 \gdef\csname thumbtab@pages@\romannumeral\c@maxthumbtabs\endcsname{#1}%
41979 \expandafter
41980 \gdef\csname thumbtab@num@\romannumeral\c@maxthumbtabs\endcsname{#2}%
41981 \expandafter
41982 \gdef\csname thumbtab@title@\romannumeral\c@maxthumbtabs\endcsname{#3}%
41983 \expandafter
41984 \gdef\csname thumbtab@link@\romannumeral\c@maxthumbtabs\endcsname{#4}%
41985 }
41986 % \end{macrocode}
41987 %\end{macro}
41988 %\begin{macro}{\@dothumbtabs}
41989 % Once the thumbtab information has been read in and stored
41990 % in the thumbtab macros, create the thumbtabs using this
41991 % information. First need to work out the \glspl{pgrange} between
41992 % each thumbtab. If the following thumbtab starts on the
41993 % same page as the previous one, leave the page varable
41994 % as a single number (this may happen if the thumbtabs
41995 % correspond to sections rather than chapters). If the
41996 % following thumbtab starts on a different page to the
41997 % one before it, the preceding thumbtab page variable so
41998 % be a range from its own initial page up to the page before
41999 % the next thumbtab starts. The final thumbtab has an open
42000 % ended range. This final thumbtab will continue to be displayed
42001 % until cancelled by "\disablethumbtabs".
42002 %
42003 % Syntax: \cs{@dothumbtabs}\marg{y offset}\marg{height}.
42004 % \begin{macrocode}
42005 \newcommand*{\@dothumbtabs}[2]{%
42006 \@colN=0\relax
42007 \whiledo{\@colN<\c@maxthumbtabs}%
42008 {%
42009 \advance\@colN by 1\relax
42010 \edef\ff@pages{%
42011 \csname thumbtab@pages@\romannumeral\@colN\endcsname}%
42012 \ifnum\@colN=\c@maxthumbtabs
42013 \expandafter
42014 \xdef\csname thumbtab@pages@\romannumeral\@colN\endcsname{%
42015 \ff@pages,>\ff@pages}%
42016 \else
42017 \advance\@colN by 1\relax
42018 \edef\ff@endpage{%
42019 \csname thumbtab@pages@\romannumeral\@colN\endcsname}%
42020 \advance\@colN by -1\relax
42021 \@ff@tmpN=\ff@endpage\relax
42022 \advance\@ff@tmpN by -1\relax
42023 \ifnum\@ff@tmpN>\ff@pages
42024 \expandafter
42025 \xdef\csname thumbtab@pages@\romannumeral\@colN\endcsname{%
42026 \ff@pages-\number\@ff@tmpN}%
42027 \fi
42028 \fi
42029 }%
42030 \@@dothumbtabs{#1}{#2}%
42031 }
42032 % \end{macrocode}
42033 %\end{macro}
42034 %\begin{macro}{\thumbtabwidth}
42035 % Default thumbtab width.
42036 % \begin{macrocode}
42037 \newlength{\thumbtabwidth}
42038 \setlength{\thumbtabwidth}{1cm}
42039 % \end{macrocode}
42040 %\end{macro}
42041 %\begin{macro}{\thumbtabindexformat}
42042 % Thumbtab format. If hyperlinks have been defined,
42043 % use a hyperlink in the thumbtab index.
42044 % Syntax: \cs{thumbtabindexformat}\marg{link}\marg{text}\marg{height}
42045 % \begin{macrocode}
42046 \@ifundefined{hyperlink}%
42047 {%
42048 \newcommand{\thumbtabindexformat}[3]{%
42049 \thumbtabformat{#2}{#3}%
42050 }%
42051 }%
42052 {%
42053 \newcommand{\thumbtabindexformat}[3]{%
42054 \hyperlink{#1}{\thumbtabformat{#2}{#3}}%
42055 }%
42056 }
42057 % \end{macrocode}
42058 %\end{macro}
42059 %\begin{macro}{\thumbtabformat}
42060 % Individual thumbtab format. If rotating has
42061 % been disabled, stack the letters vertically (this
42062 % doesn't look very good).
42063 % Syntax: \cs{thumbtabformat}\marg{text}\marg{height}
42064 % \begin{macrocode}
42065 \newcommand{\thumbtabformat}[2]{%
42066 \if@ttb@rotate
42067 \rotatebox{-90}%
42068 {%
42069 \parbox[c][\thumbtabwidth]{#2}{%
42070 \centering#1%
42071 }%
42072 }%
42073 \else
42074 \parbox[c][#2]{\thumbtabwidth}{%
42075 \centering\@ttb@stack{#1}%
42076 }%
42077 \fi
42078 }
42079 % \end{macrocode}
42080 %\end{macro}
42081 %\begin{macro}{\@flf@subsp}
42082 % Substitute spaces for \cs{space}. Stores resulting text in
42083 % \cs{@flf@subsptext} which should be set to empty before use.
42084 %\changes{1.10}{2007/08/21}{new}
42085 % \begin{macrocode}
42086 \def\@flf@subsp#1 #2{%
42087 \expandafter\flf@ta\expandafter{\@flf@subsptext}%
42088 \flf@tb{#1}%
42089 \edef\@flf@subsptext{\the\flf@ta\the\flf@tb}%
42090 \def\@flf@tmp{#2}%
42091 \ifx\@flf@tmp\@nnil
42092 \let\@flf@donextsubsp=\@gobble
42093 \else
42094 \expandafter\flf@ta\expandafter{\@flf@subsptext}%
42095 \edef\@flf@subsptext{\the\flf@ta\noexpand\space}%
42096 \let\@flf@donextsubsp=\@flf@subsp
42097 \fi
42098 \@flf@donextsubsp{#2}%
42099 }
42100 % \end{macrocode}
42101 %\end{macro}
42102 %\begin{macro}{\@ttb@stack}
42103 % Stack letters vertically.
42104 % Any spaces first need to be substituted
42105 % with \cs{space}, otherwise they will be ignored.
42106 %\changes{1.10}{2007/08/21}{spaces now replaced with \cs{space}}
42107 % \begin{macrocode}
42108 \newcommand{\@ttb@stack}[1]{%
42109 \def\@flf@subsptext{}%
42110 \expandafter\@flf@subsp#1 \@nil\relax
42111 \begin{tabular}{l}%
42112 \expandafter\@@ttb@stack\@flf@subsptext\@nil\relax
42113 \end{tabular}%
42114 }
42115 % \end{macrocode}
42116 %\end{macro}
42117 %\begin{macro}{\@@ttb@stack}
42118 %\changes{1.10}{2007/08/21}{now uses \cs{mbox}}
42119 % \begin{macrocode}
42120 \def\@@ttb@stack#1#2{%
42121 \def\@flf@tmp{#1}%
42122 \ifx\@flf@tmp\@nnil
42123 \let\flf@next\relax
42124 \else
42125 #1\\%
42126 \def\@flf@tmp{#2}%
42127 \ifx\@nnil#2\relax
42128 \let\flf@next\@gobble
42129 \else
42130 \let\flf@next\@@ttb@stack
42131 \fi
42132 \fi
42133 \flf@next{#2}%
42134 }
42135 % \end{macrocode}
42136 %\end{macro}
42137 %
42138 %\begin{macro}{\@greyscale}
42139 % Count register to compute the grey scale.
42140 % \begin{macrocode}
42141 \newcount\@greyscale
42142 % \end{macrocode}
42143 %\end{macro}
42144 %\begin{macro}{\@@dothumbtabs}
42145 % Once the \gls{pgrange} have been sorted, create the
42146 % \glspl{dynamic} associated with each thumbtab.
42147 % Thumbtabs will initially have a grey background, but
42148 % this can be changed by the user. Each thumbtab is given
42149 % an \gls{idl} "thumbtab"\meta{n} where \meta{n} is the index of
42150 % the thumbtab (starting from 1 for the topmost thumbtab.)
42151 % Each frame in the thumbtab index is given an \gls{idl}
42152 % "thumbtabindex"\meta{n}, where \meta{n} is as before.
42153 % \begin{macrocode}
42154 \newcommand{\@@dothumbtabs}[2]{%
42155 \setlength{\@ff@tmp@y}{\textheight}%
42156 \addtolength{\@ff@tmp@y}{-#2}%
42157 \addtolength{\@ff@tmp@y}{-#1}%
42158 \computerightedgeodd{\@ff@tmp@x}%
42159 \addtolength{\@ff@tmp@x}{-\thumbtabwidth}%
42160 \computeleftedgeeven{\@ff@tmp@x@even}%
42161 \@ff@tmpN=0\relax
42162 \whiledo{\@ff@tmpN<\c@maxthumbtabs}%
42163 {%
42164 \advance\@ff@tmpN by 1\relax
42165 \@greyscale=\@ff@tmpN\relax
42166 \multiply\@greyscale by 60\relax
42167 \divide\@greyscale by \c@maxthumbtabs
42168 \advance\@greyscale by 25\relax
42169 \edef\@ff@greyscale{0.\number\@greyscale}%
42170 % \end{macrocode}
42171 % Thumbtab
42172 % \begin{macrocode}
42173 \newdynamicframe[none]{\thumbtabwidth}{#2}%
42174 {\@ff@tmp@x}{\@ff@tmp@y}[thumbtab\number\@ff@tmpN]%
42175 \expandafter\global\expandafter
42176 \setlength\csname @df@\romannumeral\c@maxdynamic @evenx\endcsname
42177 {\@ff@tmp@x@even}%
42178 % \end{macrocode}
42179 % set the contents of the dynamic frame
42180 % \begin{macrocode}
42181 \ifthenelse{\boolean{@ttb@title}\and\boolean{@ttb@num}}%
42182 {%
42183 \expandafter
42184 \xdef\csname @dynamicframe@\romannumeral\c@maxdynamic\endcsname{%
42185 \noexpand\thumbtabformat
42186 {%
42187 \csname thumbtab@num@\romannumeral\@ff@tmpN\endcsname\
42188 \csname thumbtab@title@\romannumeral\@ff@tmpN\endcsname
42189 }%
42190 {#2}%
42191 }%
42192 }%
42193 {%
42194 \if@ttb@title
42195 \expandafter
42196 \xdef\csname @dynamicframe@\romannumeral\c@maxdynamic\endcsname{%
42197 \noexpand\thumbtabformat
42198 {%
42199 \csname thumbtab@title@\romannumeral\@ff@tmpN\endcsname
42200 }%
42201 {#2}%
42202 }%
42203 \fi
42204 \if@ttb@num
42205 \expandafter
42206 \xdef\csname @dynamicframe@\romannumeral\c@maxdynamic\endcsname{%
42207 \noexpand\thumbtabformat
42208 {%
42209 \csname thumbtab@num@\romannumeral\@ff@tmpN\endcsname
42210 }%
42211 {#2}%
42212 }%
42213 \fi
42214 }%
42215 \expandafter
42216 \xdef\csname @df@backcol@\romannumeral\c@maxdynamic\endcsname
42217 {[gray]{\@ff@greyscale}}
42218 % \end{macrocode}
42219 % Thumbtab index
42220 % \begin{macrocode}
42221 \newdynamicframe[none]{\thumbtabwidth}{#2}%
42222 {\@ff@tmp@x}{\@ff@tmp@y}[thumbtabindex\number\@ff@tmpN]%
42223 \expandafter\global\expandafter
42224 \setlength\csname @df@\romannumeral\c@maxdynamic @evenx\endcsname
42225 {\@ff@tmp@x@even}%
42226 \expandafter
42227 % \end{macrocode}
42228 % set the contents of the dynamic frame
42229 % \begin{macrocode}
42230 \ifthenelse{\boolean{@ttb@title}\and\boolean{@ttb@num}}%
42231 {%
42232 \expandafter
42233 \xdef\csname @dynamicframe@\romannumeral\c@maxdynamic\endcsname{%
42234 \noexpand\thumbtabindexformat
42235 {%
42236 \csname thumbtab@link@\romannumeral\@ff@tmpN\endcsname
42237 }%
42238 {%
42239 \csname thumbtab@num@\romannumeral\@ff@tmpN\endcsname\
42240 \csname thumbtab@title@\romannumeral\@ff@tmpN\endcsname
42241 }%
42242 {#2}%
42243 }%
42244 }%
42245 {%
42246 \if@ttb@title
42247 \expandafter
42248 \xdef\csname @dynamicframe@\romannumeral\c@maxdynamic\endcsname{%
42249 \noexpand\thumbtabindexformat
42250 {%
42251 \csname thumbtab@link@\romannumeral\@ff@tmpN\endcsname
42252 }%
42253 {%
42254 \csname thumbtab@title@\romannumeral\@ff@tmpN\endcsname
42255 }%
42256 {#2}%
42257 }%
42258 \fi
42259 \if@ttb@num
42260 \expandafter
42261 \xdef\csname @dynamicframe@\romannumeral\c@maxdynamic\endcsname{%
42262 \noexpand\thumbtabindexformat
42263 {%
42264 \csname thumbtab@link@\romannumeral\@ff@tmpN\endcsname
42265 }%
42266 {%
42267 \csname thumbtab@num@\romannumeral\@ff@tmpN\endcsname
42268 }%
42269 {#2}%
42270 }%
42271 \fi
42272 }%
42273 \expandafter
42274 \xdef\csname @df@backcol@\romannumeral\c@maxdynamic\endcsname
42275 {[gray]{\@ff@greyscale}}
42276 \addtolength{\@ff@tmp@y}{-#2}%
42277 }%
42278 }%
42279 % \end{macrocode}
42280 %\end{macro}
42281 %\begin{macro}{\enablethumbtabs}
42282 % Enable thumbtabs. Once the \gls{idn} is obtained for the
42283 % first thumbtab, the rest can be found by incrementing the
42284 % number by 2 (the frames in between correspond to the
42285 % thumbtab index.)
42286 % \begin{macrocode}
42287 \newcommand*{\enablethumbtabs}{%
42288 \ifnum\c@maxthumbtabs>0\relax
42289 \@ff@tmpN=0\relax
42290 \@dynamicframeid{thumbtab1}%
42291 \whiledo{\@ff@tmpN<\c@maxthumbtabs}%
42292 {%
42293 \advance\@ff@tmpN by 1\relax
42294 % \end{macrocode}
42295 % thumbtab
42296 % \begin{macrocode}
42297 \edef\@ff@pages{\csname thumbtab@pages@\romannumeral\@ff@tmpN\endcsname}%
42298 \@@setdynamicframe{\ff@id}{pages=\@ff@pages}%
42299 \advance\ff@id by 2\relax
42300 }%
42301 \else
42302 \PackageWarning{flowfram}{No thumb tabs defined}%
42303 \fi
42304 }
42305 % \end{macrocode}
42306 %\end{macro}
42307 %\begin{macro}{\disablethumbtabs}
42308 % Disable all thumbtabs.
42309 % \begin{macrocode}
42310 \newcommand*{\disablethumbtabs}{%
42311 \ifnum\c@maxthumbtabs>0\relax
42312 \@ff@tmpN=0\relax
42313 \@dynamicframeid{thumbtab1}%
42314 \whiledo{\@ff@tmpN<\c@maxthumbtabs}%
42315 {%
42316 \advance\@ff@tmpN by 1\relax
42317 % \end{macrocode}
42318 % Thumbtab:
42319 % \begin{macrocode}
42320 \expandafter\xdef\csname @df@pages@\romannumeral\ff@id\endcsname
42321 {none}%
42322 \advance\ff@id by 1\relax
42323 % \end{macrocode}
42324 % Thumbtab index:
42325 % \begin{macrocode}
42326 \expandafter\xdef\csname @df@pages@\romannumeral\ff@id\endcsname
42327 {none}%
42328 \advance\ff@id by 1\relax
42329 }%
42330 \fi
42331 }
42332 % \end{macrocode}
42333 %\end{macro}
42334 %\begin{macro}{\thumbtabindex}
42335 % Show thumbtab index on current page.
42336 % The "\@ff@doafter" bit circumvents the problem of duplicate page
42337 % numbers, as the table of contents
42338 % is quite frequently on page~i while the first chapter starts on page~1.
42339 % \begin{macrocode}
42340 \newcommand*{\thumbtabindex}{%
42341 \ifnum\c@maxthumbtabs>0\relax
42342 \@ff@tmpN=0\relax
42343 \@dynamicframeid{thumbtabindex1}%
42344 \whiledo{\@ff@tmpN<\c@maxthumbtabs}%
42345 {%
42346 \advance\@ff@tmpN by 1\relax
42347 \expandafter
42348 \xdef\csname @df@pages@\romannumeral\ff@id\endcsname{\c@page}%
42349 \edef\@ff@doafter{%
42350 \noexpand\afterpage
42351 {%
42352 \noexpand\setdynamicframe{\number\ff@id}{pages=none}%
42353 }%
42354 }%
42355 \@ff@doafter
42356 \advance\ff@id by 2\relax
42357 }%
42358 \fi
42359 }
42360 % \end{macrocode}
42361 %\end{macro}
42362 %\begin{macro}{\setthumbtab}
42363 % Modify the settings for all the thumbtabs (including thumbtab
42364 % index). Since the thumbtabs are \glspl{dynamic}
42365 % you could just use "\setdynamicframe", however, the thumbtabs
42366 % will not be generated on the first run, as there will be no
42367 % information in the ttb file, so "\setdynamicframe" would
42368 % generate an error. "\setthumbtab" will only give
42369 % a warning message if it can not find the thumbtab.
42370 % The argument "#1" is the index of the thumbtab (starting
42371 % from 1), the second argument "#2" is the
42372 % frame settings.
42373 % \begin{macrocode}
42374 \newcommand{\setthumbtab}[2]{%
42375 \ifthenelse{\equal{#1}{all}}%
42376 {%
42377 \@ff@tmpN=0\relax
42378 \whiledo{\@ff@tmpN<\c@maxthumbtabs}%
42379 {%
42380 \advance\@ff@tmpN by 1\relax
42381 \@setthumbtab{\@ff@tmpN}{#2}%
42382 }%
42383 }%
42384 {%
42385 \@for\@ttb@id:=#1\do{\@setthumbtab{\@ttb@id}{#2}}%
42386 }%
42387 }
42388 % \end{macrocode}
42389 %\end{macro}
42390 %\begin{macro}{\@setthumbtab}
42391 % Set individual thumbtab and its index tab.
42392 % \begin{macrocode}
42393 \newcommand{\@setthumbtab}[2]{%
42394 % \end{macrocode}
42395 % Check if this thumbtab exists
42396 % \begin{macrocode}
42397 \ifthenelse{\(\c@maxthumbtabs<#1\) \or \(#1<1\)}%
42398 {%
42399 \PackageWarning{flowfram}%
42400 {%
42401 Can't find thumbtab number '#1', ttb file may not be
42402 up-to-date%
42403 }%
42404 }%
42405 {%
42406 \@dynamicframeid{thumbtab\number#1}%
42407 \@@setdynamicframe{\ff@id}{#2}%
42408 \@dynamicframeid{thumbtabindex\number#1}%
42409 \@@setdynamicframe{\ff@id}{#2}%
42410 }%
42411 }
42412 % \end{macrocode}
42413 %\end{macro}
42414 %\begin{macro}{\setthumbtabindex}
42415 % Only change settings for the thumbtab index. This can
42416 % take a comma-separated number list.
42417 % \begin{macrocode}
42418 \newcommand{\setthumbtabindex}[2]{%
42419 \ifthenelse{\equal{#1}{all}}%
42420 {%
42421 \@ff@tmpN=0\relax
42422 \whiledo{\@ff@tmpN<\c@maxthumbtabs}%
42423 {%
42424 \advance\@ff@tmpN by 1\relax
42425 \@setthumbtabindex{\@ff@tmpN}{#2}%
42426 }%
42427 }%
42428 {%
42429 \@for\@ttb@id:=#1\do{\@setthumbtabindex{\@ttb@id}{#2}}%
42430 }%
42431 }
42432 % \end{macrocode}
42433 %\end{macro}
42434 %\begin{macro}{\@setthumbtabindex}
42435 % Change setting for individual thumbtab index entry.
42436 % \begin{macrocode}
42437 \newcommand{\@setthumbtabindex}[2]{%
42438 % \end{macrocode}
42439 % Check if this thumbtab exists
42440 % \begin{macrocode}
42441 \ifthenelse{\(\c@maxthumbtabs<#1\) \or \(#1<1\)}%
42442 {%
42443 \PackageWarning{flowfram}%
42444 {%
42445 Can't find thumbtab number `\number#1',
42446 ttb file may not be up-to-date%
42447 }%
42448 }%
42449 {%
42450 \@dynamicframeid{thumbtabindex\number#1}%
42451 \@@setdynamicframe{\ff@id}{#2}%
42452 }%
42453 }
42454 % \end{macrocode}
42455 %\end{macro}
42456 %\begin{macro}{\tocandhumbtabindex}
42457 % Do both the table of contents and the thumbtab index
42458 % \begin{macrocode}
42459 \newcommand*{\tocandthumbtabindex}{%
42460 \aligntoctrue
42461 \tableofcontents
42462 \thumbtabindex
42463 \aligntocfalse
42464 }
42465 % \end{macrocode}
42466 %\end{macro}
42467 %
42468 % \subsection{Minitocs}
42469 %\begin{macro}{\@ttb@minitoctype}
42470 % Sectioning type for the minitoc, by default it is the
42471 % same as the thumbtabs
42472 % \begin{macrocode}
42473 \newcommand*{\@ttb@minitoctype}{\@ttb@type}
42474 % \end{macrocode}
42475 %\end{macro}
42476 %\begin{macro}{\@starttoc}
42477 % In order to align the table of contents with the thumbtabs,
42478 % or to use minitocs, the toc information must be stored,
42479 % rather than simply input.
42480 % Therefore, modify "\@starttoc" so that it can store the contents
42481 % of the file. "\if@storetoc" is used to determine whether
42482 % to store the contents, or act as normal.
42483 % \begin{macrocode}
42484 \let\@ttb@old@starttoc\@starttoc
42485 \newif\if@storetoc
42486 \@storetocfalse
42487 \renewcommand*{\@starttoc}[1]{%
42488 \if@storetoc
42489 \@ttb@storetoc{#1}%
42490 \else
42491 \@ttb@old@starttoc{#1}%
42492 \fi
42493 }
42494 % \end{macrocode}
42495 %\end{macro}
42496 %\begin{macro}{\@ttb@storetoc}
42497 % store the contents of the file with the given extension
42498 % \begin{macrocode}
42499 \newcommand*{\@ttb@storetoc}[1]{%
42500 \begingroup
42501 \makeatletter
42502 \@storefileconts{\jobname.#1}%
42503 \if@filesw
42504 \expandafter\newwrite\csname tf@#1\endcsname
42505 \immediate\openout\csname tf@#1\endcsname\jobname.#1\relax
42506 \fi
42507 \@nobreakfalse
42508 \endgroup
42509 }
42510 % \end{macrocode}
42511 %\end{macro}
42512 %\begin{macro}{\@storefileconts}
42513 % Store the contents of named file, if it exists.
42514 %\changes{1.10}{2007/08/21}{uses \cs{PackageInfo} instead of
42515 % \cs{typeout}}
42516 % \begin{macrocode}
42517 \newcommand*{\@storefileconts}[1]{%
42518 \IfFileExists{#1}%
42519 {%
42520 \@@storefileconts\@filef@und
42521 }%
42522 {%
42523 \PackageInfo{flowfram}{No file #1.}%
42524 }%
42525 }
42526 % \end{macrocode}
42527 %\end{macro}
42528 % store the number of units corresponding to the
42529 % thumbtab type, and minitoc units. These will usually
42530 % have the same value, but this is not always
42531 % guaranteed.
42532 %\begin{macro}{\c@maxtocunits}
42533 % Total number of toc units
42534 % \begin{macrocode}
42535 \newcount\c@maxtocunits
42536 % \end{macrocode}
42537 %\end{macro}
42538 %\begin{macro}{\c@maxminitoc}
42539 % Total number of minitoc units
42540 % \begin{macrocode}
42541 \newcount\c@maxminitoc
42542 % \end{macrocode}
42543 %\end{macro}
42544 %\begin{macro}{\@@storefileconts}
42545 % Read each line in from the file, and add to the contents
42546 % list.
42547 % \begin{macrocode}
42548 \newcommand{\@@storefileconts}[1]{%
42549 \@ifundefined{\@ttb@minitoctype}%
42550 {%
42551 \@ttb@minitoclevel=6\relax
42552 }%
42553 {%
42554 \expandafter\@ttb@minitoclevel\expandafter
42555 =\csname @ttb@\@ttb@minitoctype @level\endcsname
42556 }%
42557 \newread\@ttb@toc
42558 \openin\@ttb@toc=#1\relax
42559 \c@maxtocunits=0\relax
42560 \c@maxminitoc=0\relax
42561 \whiledo{\not\boolean{eof}\@ttb@toc}%
42562 {%
42563 \read\@ttb@toc to\tocline
42564 \@addtotoclist{\tocline}{\c@maxtocunits}%
42565 }%
42566 \closein\@ttb@toc
42567 }
42568 % \end{macrocode}
42569 %\end{macro}
42570 %\begin{macro}{\@addtotoclist}
42571 % Before each line is added to the contents list, it is
42572 % first checked to see whether the line starts with
42573 % "\contentsline". If it does, then check to see if the
42574 % sectioning type corresponds to the thumbtab level. If
42575 % it does, then start a new list. There will be "\c@maxtocunits"
42576 % lists, each one corresponding to each thumbtab group.
42577 % In addition, each contents line needs to be added to
42578 % the minitoclists, but only if the sectioning type level
42579 % is greater than "\@ttb@minitoctype". The number of minitoc
42580 % lists is given by "\c@maxminitoc".
42581 % \begin{macrocode}
42582 \newif\if@contsline
42583 \newcount\@ttb@level
42584 \newcount\@ttb@minitoclevel
42585
42586 \newcommand{\@addtotoclist}[2]{%
42587 \expandafter\@checkcontentsline#1\end
42588 \if@contsline
42589 \expandafter\@gettype#1\end
42590 \ifthenelse{\equal{\@ttb@contstype}{\@ttb@type}}%
42591 {%
42592 \global\advance#2 by 1\relax
42593 }%
42594 {}%
42595 \fi
42596 \@ifundefined{@toc@\romannumeral#2}%
42597 {%
42598 \flf@ta=\expandafter{#1}%
42599 \expandafter\xdef\csname @toc@\romannumeral#2\endcsname{\the\flf@ta}%
42600 }%
42601 {%
42602 \flf@ta=\expandafter{#1}%
42603 \flf@tb=\expandafter\expandafter\expandafter
42604 {\csname @toc@\romannumeral#2\endcsname}%
42605 \expandafter\xdef\csname @toc@\romannumeral#2\endcsname{%
42606 \the\flf@tb\the\flf@ta}%
42607 }%
42608 % \end{macrocode}
42609 % now do minitoc stuff. If the sectioning type is unknown,
42610 % assume it comes last
42611 % \begin{macrocode}
42612 \if@minitoc
42613 \if@contsline
42614 \@ifundefined{\@ttb@contstype}%
42615 {\@ttb@level=6}%
42616 {%
42617 \@ttb@level=\csname @ttb@\@ttb@contstype @level\endcsname
42618 }%
42619 \relax
42620 \ifnum\@ttb@level=\@ttb@minitoclevel
42621 \global\advance\c@maxminitoc by 1\relax
42622 \expandafter
42623 \gdef\csname @minitoc@\romannumeral\c@maxminitoc\endcsname{}%
42624 \else
42625 \ifnum\@ttb@level>\@ttb@minitoclevel
42626 \flf@ta=\expandafter{#1}\relax
42627 \flf@tb=\expandafter\expandafter\expandafter
42628 {\csname @minitoc@\romannumeral\c@maxminitoc\endcsname}\relax
42629 \expandafter
42630 \xdef\csname @minitoc@\romannumeral\c@maxminitoc\endcsname{%
42631 \the\flf@tb\the\flf@ta}
42632 \fi
42633 \fi
42634 \fi
42635 \fi
42636 }
42637 % \end{macrocode}
42638 %\end{macro}
42639 % Is there already a way of determining the sectioning
42640 % level from its name?
42641 % \begin{macrocode}
42642 \def\@ttb@part@level{-1}
42643 \def\@ttb@chapter@level{0}
42644 \def\@ttb@section@level{1}
42645 \def\@ttb@subsection@level{2}
42646 \def\@ttb@subsubsection@level{3}
42647 \def\@ttb@paragraph@level{4}
42648 \def\@ttb@subparagraph@level{5}
42649 % \end{macrocode}
42650 %\begin{macro}{\@checkcontentsline}
42651 % Check to see if line starts with "\contentsline"
42652 % \begin{macrocode}
42653 \long\def\@checkcontentsline#1#2\end{%
42654 \ifx#1\contentsline
42655 \@contslinetrue
42656 \else
42657 \@contslinefalse
42658 \fi
42659 }
42660 % \end{macrocode}
42661 %\end{macro}
42662 %\begin{macro}{\@gettype}
42663 % Given that the line starts with "\contentsline", extract
42664 % the first argument of "\contentsline" to get the sectioning
42665 % type.
42666 % \begin{macrocode}
42667 \def\@gettype\contentsline#1#2\end{%
42668 \def\@ttb@contstype{#1}%
42669 }
42670 % \end{macrocode}
42671 %\end{macro}
42672 %\begin{macro}{\tableofcontents}
42673 % Modify "\tableofcontents". It first stores the contents
42674 % of the toc file, and then, either simply prints it on the
42675 % page (so it appears no different to the standard
42676 % "\tableofcontents"), or it prints it out so that each
42677 % thumbtab unit has the same height as the thumbtabs.
42678 % Note: this assumes that the actual table of contents
42679 % starts at the same height as the thumbtabs. The thumbtab
42680 % vertical position may need to be adjusted to compensate
42681 % for space taken up by the contents title.
42682 % \begin{macrocode}
42683 \newif\ifaligntoc
42684 \aligntocfalse
42685 % \end{macrocode}
42686 % Save original definition of "\tableofcontents"
42687 % \begin{macrocode}
42688 \let\@ttb@old@tableofcontents\tableofcontents
42689 % \end{macrocode}
42690 % Redefine "\tableofcontents"
42691 % \begin{macrocode}
42692 \renewcommand{\tableofcontents}{%
42693 \@storetoctrue
42694 \@ttb@old@tableofcontents
42695 \ifaligntoc
42696 \@printalignedtoc
42697 \else
42698 \@printtoc
42699 \fi
42700 \@storetocfalse
42701 \global\c@minitoc=0\relax
42702 }
42703 % \end{macrocode}
42704 %\end{macro}
42705 %\begin{macro}{\beforeminitocskip}
42706 % Vertical space to add before minitoc.
42707 % \begin{macrocode}
42708 \newlength\beforeminitocskip
42709 \setlength{\beforeminitocskip}{0pt}
42710 % \end{macrocode}
42711 %\end{macro}
42712 %\begin{macro}{\afterminitocskip}
42713 % Vertical space to add after minitoc.
42714 % \begin{macrocode}
42715 \newlength\afterminitocskip
42716 \setlength{\afterminitocskip}{\baselineskip}
42717 % \end{macrocode}
42718 %\end{macro}
42719 %\begin{macro}{\dominitoc}
42720 % Do the minitoc for unit "#1". Check first that
42721 % minitocs have been enabled.
42722 % \begin{macrocode}
42723 \newcommand*{\dominitoc}[1]{%
42724 \if@minitoc
42725 \@dominitoc{#1}%
42726 \fi
42727 }
42728 \newcommand*{\@dominitoc}[1]{\@@dominitoc{#1}}
42729 % \end{macrocode}
42730 %\end{macro}
42731 %\begin{macro}{\minitocstyle}
42732 % Style in which to display the minitoc.
42733 % \begin{macrocode}
42734 \newcommand{\minitocstyle}[1]{%
42735 \normalfont\normalsize\normalcolor
42736 #1%
42737 }
42738 % \end{macrocode}
42739 %\end{macro}
42740 %\begin{macro}{\@@dominitoc}
42741 % Now do the actual minitoc for unit "#1".
42742 % \begin{macrocode}
42743 \newcommand*{\@@dominitoc}[1]{%
42744 {%
42745 \minitocstyle
42746 {%
42747 \vskip\beforeminitocskip
42748 \csname @minitoc@\romannumeral#1\endcsname
42749 }%
42750 }%
42751 \vskip\afterminitocskip
42752 }
42753 % \end{macrocode}
42754 %\end{macro}
42755 %
42756 %\begin{macro}{\appenddfminitoc}
42757 % Modify "\dominitoc" so that the minitoc is appended
42758 % to specified \gls{dynamic}. Starred version uses
42759 % \gls{dynamic} \gls{idl}, unstarred version uses \gls{dynamic}
42760 % \gls{idn}. I originally called this macro "\appendminitoctodynamicframe"
42761 % but decided it was too long, for I've opted instead
42762 % for a slightly more cryptic name.
42763 % \begin{macrocode}
42764 \newcommand*{\appenddfminitoc}{%
42765 \renewcommand{\beforeminitocskip}{\baselineskip}%
42766 \@ifstar\@sappendminitocdf\@appendminitocdf
42767 }
42768 % \end{macrocode}
42769 %\end{macro}
42770 %\begin{macro}{\@sappendminitocdf}
42771 % Starred version
42772 % \begin{macrocode}
42773 \newcommand*{\@sappendminitocdf}[1]{%
42774 \renewcommand{\@dominitoc}[1]{%
42775 \@sappenddynamic{#1}{\@@dominitoc{##1}}%
42776 }%
42777 }
42778 % \end{macrocode}
42779 %\end{macro}
42780 %\begin{macro}{\@appendminitocdf}
42781 % Unstarred version
42782 % \begin{macrocode}
42783 \newcommand*{\@appendminitocdf}[1]{%
42784 \renewcommand{\@dominitoc}[1]{%
42785 \@appenddynamic{#1}{\@@dominitoc{##1}}%
42786 }%
42787 }
42788 % \end{macrocode}
42789 %\end{macro}
42790 %\begin{macro}{\@printtoc}
42791 % Do the table of contents, which has been stored
42792 % in "\c@maxtocunits" macros. (or possibly
42793 % "\c@maxtocunits + 1", if information was added
42794 % before the first group---which corresponds to
42795 % "\@colN=0".)
42796 % \begin{macrocode}
42797 \newcommand*{\@printtoc}{%
42798 \@colN=0\relax
42799 \csname @toc@\romannumeral\@colN\endcsname
42800 \whiledo{\@colN<\c@maxtocunits}%
42801 {%
42802 \advance\@colN by 1\relax
42803 \csname @toc@\romannumeral\@colN\endcsname
42804 }%
42805 }
42806 % \end{macrocode}
42807 %\end{macro}
42808 %\begin{macro}{\@printalignedtoc}
42809 % Print the table of contents so that each unit is
42810 % has vertical height the same as the height of the
42811 % thumbtabs. Note that you may have to adjust the
42812 % vertical offset of the thumbtabs (in "\makethumbtabs")
42813 % in order to make them correctly aligned.
42814 % \begin{macrocode}
42815 \newcommand{\@printalignedtoc}{%
42816 \@ff@tmpN=0\relax
42817 \@ifundefined{@toc@\romannumeral\@ff@tmpN}%
42818 {}%
42819 {%
42820 \csname @toc@\romannumeral\@ff@tmpN\endcsname
42821 \par\noindent\hrulefill
42822 }%
42823 \whiledo{\@ff@tmpN<\c@maxtocunits}%
42824 {%
42825 \advance\@ff@tmpN by 1\relax
42826 \ifnum\@ff@tmpN>\c@maxthumbtabs
42827 \csname @toc@\romannumeral\@ff@tmpN\endcsname
42828 \else
42829 \@dynamicframeid{thumbtabindex\number\@ff@tmpN}%
42830 \expandafter\expandafter\expandafter
42831 \@ff@getstaticpos\csname @df@dim@\romannumeral\ff@id\endcsname
42832 \vbox to \@ff@tmp@y
42833 {%
42834 \noindent\parbox{\linewidth}%
42835 {%
42836 \csname @toc@\romannumeral\@ff@tmpN\endcsname
42837 }%
42838 \vfill
42839 \par\noindent\hrulefill
42840 }%
42841 \fi
42842 }%
42843 }
42844 % \end{macrocode}
42845 %\end{macro}
42846 %\begin{macro}{\enableminitoc}
42847 % Make mini tocs appear at the start of given sectional unit.
42848 % \begin{macrocode}
42849 \newcounter{minitoc}
42850 \newif\if@minitoc
42851 \@minitocfalse
42852
42853 \newcommand*{\enableminitoc}[1][\@ttb@type]{%
42854 \@minitoctrue
42855 \setcounter{minitoc}{0}%
42856 \@ifundefined{#1}%
42857 {%
42858 \PackageError{flowfram}{Sectioning type `#1' not defined}{}%
42859 }%
42860 {%
42861 \renewcommand{\@ttb@minitoctype}{#1}%
42862 \ifthenelse{\equal{#1}{chapter}}%
42863 {%
42864 \@makeminitocchapter
42865 }%
42866 {%
42867 \ifthenelse{\equal{#1}{part}}%
42868 {\@makeminitocpart}%
42869 {%
42870 \@makeminitocsection{#1}%
42871 }%
42872 }%
42873 }%
42874 }
42875 % \end{macrocode}
42876 %\end{macro}
42877 % This command should only appear in the preamble. (This
42878 % ensures that it is used before "\tableofcontents".
42879 % \begin{macrocode}
42880 \@onlypreamble{\enableminitoc}
42881 % \end{macrocode}
42882 %\begin{macro}{\@makeminitocchapter}
42883 % If minitocs are associated with chapters, redefine
42884 % "\@chapter" so that the minitoc appears after the
42885 % chapter heading.
42886 % \begin{macrocode}
42887 \newcommand{\@makeminitocchapter}{%
42888 \let\@mtoc@old@chapter\@chapter
42889 \def\@chapter[##1]##2{%
42890 \@mtoc@old@chapter[##1]{##2}%
42891 \stepcounter{minitoc}%
42892 \dominitoc{\c@minitoc}%
42893 \@afterheading
42894 }%
42895 }
42896 % \end{macrocode}
42897 %\end{macro}
42898 %\begin{macro}{\@makeminitocpart}
42899 % Again, for parts. As before, need to redefine
42900 % "\@endpart" if it exists, otherwise redefine
42901 % "\@part".
42902 % \begin{macrocode}
42903 \newcommand{\@makeminitocpart}{%
42904 \@ifundefined{@endpart}%
42905 {%
42906 \let\@mtoc@old@part\@part
42907 \def\@part[##1]##2{%
42908 \@mtoc@old@part[##1]{##2}%
42909 \stepcounter{minitoc}%
42910 \dominitoc{\c@minitoc}%
42911 \@afterheading
42912 }%
42913 }%
42914 {%
42915 \let\@mtoc@old@endpart\@endpart
42916 \def\@endpart{%
42917 \stepcounter{minitoc}%
42918 \dominitoc{\c@minitoc}%
42919 \@mtoc@old@endpart
42920 }%
42921 }%
42922 }
42923 % \end{macrocode}
42924 %\end{macro}
42925 %\begin{macro}{\@makeminitocsection}
42926 % Now for the remaining sectional units.
42927 % \begin{macrocode}
42928 \newcommand{\@makeminitocsection}[1]{%
42929 \let\@mtoc@old@sect=\@sect
42930 \def\@sect##1##2##3##4##5##6[##7]##8{%
42931 \@mtoc@old@sect{##1}{##2}{##3}{##4}{##5}{##6}[##7]{##8}%
42932 \ifthenelse{\equal{##1}{#1}}%
42933 {%
42934 \stepcounter{minitoc}%
42935 \dominitoc{\c@minitoc}%
42936 \@afterheading
42937 }%
42938 {}%
42939 }%
42940 }
42941 % \end{macrocode}
42942 %\end{macro}
42943 %\iffalse
42944 % \begin{macrocode}
42945 %</flowfram-2025-08-23.sty>
42946 % \end{macrocode}
42947 %\fi
42948 %\Finale
42949 \endinput