| 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
% |
| 3 |
% Module: ZzTeX New Running Head/Foot Scheme |
| 4 |
% |
| 5 |
% Synopsis: The new running head/foot scheme is an improvement over the |
| 6 |
% original scheme. |
| 7 |
% |
| 8 |
% Author: Paul C. Anagnostopoulos |
| 9 |
% Created: 26 November 1997 |
| 10 |
% |
| 11 |
% Copyright 1989--2020 by Paul C. Anagnostopoulos |
| 12 |
% under The MIT License (opensource.org/licenses/MIT) |
| 13 |
% |
| 14 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 15 |
|
| 16 |
% Data Structures |
| 17 |
% ---- ---------- |
| 18 |
|
| 19 |
|
| 20 |
\def \zdefrun {normal} |
| 21 |
|
| 22 |
\setlist \zrunlist = {} |
| 23 |
|
| 24 |
\setflag \zoverrun = \false |
| 25 |
|
| 26 |
\def \zcurback {% |
| 27 |
\if \definedp \backgroundnormalformat \backgroundnormalformat \fi} |
| 28 |
\def \zcurheader {\headernormalformat} |
| 29 |
\def \zcurfooter {\footernormalformat} |
| 30 |
|
| 31 |
% Specify Runners |
| 32 |
% ------- ------- |
| 33 |
|
| 34 |
|
| 35 |
%~ This command discards any current runner styles and sets up to use style |
| 36 |
%~ *style1* on the current page, *style2* on the next, *style3* on the one after |
| 37 |
%~ that, and so forth. The last style specified is used as the style for all |
| 38 |
%~ subsequent pages (it becomes the default style). No spaces are allowed in the |
| 39 |
%~ list. |
| 40 |
|
| 41 |
\def \setrunners #1{% {style1,style2,style3,...} %^runners |
| 42 |
{\if \zoverrun \pop{\zoverstyle}{\zrunlist}\fi |
| 43 |
\commalist{\zrunlist}{#1}% |
| 44 |
\maplist{\gdef \zdefrun {##1}}{\zrunlist}% |
| 45 |
\if \zoverrun \expandafter\overriderunners\expandafter{\zoverstyle}\fi |
| 46 |
\zsetcurrun}} |
| 47 |
|
| 48 |
%~ This command overrides the style for the current page, using style *style* |
| 49 |
%~ instead. After the current page, runner styles revert to those established |
| 50 |
%~ by the last |\setrunners| command. |
| 51 |
|
| 52 |
\def \overriderunners #1{% {style} %^runners |
| 53 |
\if \notp{\emptylistp{\zrunlist}}% |
| 54 |
\pop{\znext}{\zrunlist}% |
| 55 |
\fi |
| 56 |
\push{#1}{\zrunlist}% |
| 57 |
\global\setflag \zoverrun = \true |
| 58 |
\zsetcurrun} |
| 59 |
|
| 60 |
%~ This command is simply a shorthand for |\overriderunners{blind}|. |
| 61 |
|
| 62 |
\def \blindrunners {% %^runners |
| 63 |
\overriderunners{blind}} |
| 64 |
|
| 65 |
% Internal Common Macros |
| 66 |
% -------- ------ ------ |
| 67 |
|
| 68 |
|
| 69 |
\def \zsetrunnerstoks #1{% {\token-reg} |
| 70 |
\expandafter\setrunners\expandafter{\the#1}} |
| 71 |
|
| 72 |
\def \zoverriderunnerstoks #1{% {\token-reg} |
| 73 |
\expandafter\overriderunners\expandafter{\the#1}} |
| 74 |
|
| 75 |
\def \zoldrunners #1{} |
| 76 |
|
| 77 |
% Output Routine Interface |
| 78 |
% ------ ------- --------- |
| 79 |
|
| 80 |
|
| 81 |
\def \zsetcurrun {% |
| 82 |
\if \emptylistp{\zrunlist}% |
| 83 |
\edef \znext {\zdefrun}% |
| 84 |
\else |
| 85 |
\listtop{\znext}{\zrunlist}% |
| 86 |
\fi |
| 87 |
\ztoksa = \expandaftertwice{\name{\background\znext format}}% |
| 88 |
\xdef \zcurback {% |
| 89 |
\noexpand\if \noexpand\definedp\the\ztoksa \the\ztoksa \noexpand\fi}% |
| 90 |
\ztoksa = \expandaftertwice{\name{\header\znext format}}% |
| 91 |
\xdef \zcurheader {\the\ztoksa}% |
| 92 |
\ztoksa = \expandaftertwice{\name{\footer\znext format}}% |
| 93 |
\xdef \zcurfooter {\the\ztoksa}} |
| 94 |
|
| 95 |
\def \znextpagerunners {% |
| 96 |
\if \notp{\emptylistp{\zrunlist}}\pop{\znext}{\zrunlist}\fi |
| 97 |
\zsetcurrun |
| 98 |
\global\setflag \zoverrun = \false} |