summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/plain/zztex/zzfront.tex
blob: f0f281a9fc7bf8b1d7542a21b0d6230dfdd01b37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Module:    ZzTeX Front Matter Facilities
%
% Synopsis:  This file provides facilities for typesetting the front
%            matter of a book.
%
% Author:    Paul C. Anagnostopoulos
% Created:   24 September 1989
%
% Copyright 1989--2020 by Paul C. Anagnostopoulos
% under The MIT License (opensource.org/licenses/MIT)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%                       Copyright Page
%                       --------- ----


\def \copyrightline #1#2{%                              {year}{publisher}
  \noindent Copyright \copyright\ #1 by #2\par}

\def \concisecopyrightline #1#2{%                       {year}{publisher}
  \noindent \copyright\ #1 by #2\par}

\def \superconcisecopyrightline #1#2{%                  {year}{publisher}
  \noindent \copyright\ #1 #2\par}

\def \copyrightnotice {%
  All rights reserved.  No part of this publication may be reproduced,
  stored in a retrieval system, or transmitted, in any form or by any
  means, electronic, mechanical, photocopying, recording, or otherwise,
  without the prior written permission of the publisher.}


% We provide a standard text design for the Library of Congress
% Cataloging-in-Publication data.

\def \textcipdataidesign {%
  \aboveskip = \noskip
  \belowskip = \noskip
  \bodyfont = {}%
  \setflag \enabletabbing = \false
  \leftindent = 0pt
  \parindent = \enclosingparindent
  \parrag = \enclosingparrag
  \parskip = 0pt
  \rightindent = 0pt
  \setflag \verbatimlines = \true
  \width = \naturalwidth}

\def \textcipdataiidesign {%
  \textcipdataidesign}

%                       Table of Contents Entries
%                       ----- -- -------- -------


% This macro is used to write a ToC entry in the cross-reference file.

\def \ztocentry #1#2#3#4{%              {number}{title}{level}{allow?}
  {\ztoksa = {#2}%
   \tcounta = #3\relax
   \edef \znext {\noexpand\xref{toc}{\noexpand\folio}{#1}{\the\ztoksa}
                                    {\the\divisionname,\the\tcounta,%
                                     \the\difficulty,\if #41\else 0\fi}}% 
   \znext}}

% This is the public command for writing ToC entries.

\def \tocentry #1#2#3{%                         {number}{title}{level}
  \ztocentry{#1}{#2}{#3}{\true}}

% This macro allows the compositor to adjust pages in the ToC.

\setlist \ztocadjlist = {}

\long\def \tocadjustment #1#2#3{%               {toc-type}{number}{commands}
  \append{{#1}{#2}{#3}}{\ztocadjlist}}

%                       Table of Contents Block
%                       ----- -- -------- -----


\defineblock{\toc}{\endtoc}{\false}{}

%~block toc Type
% \abovepenalty = integer               % Penalty above text.
% \aboveskip = glue                     % Space b/b above text.
% \belowpenalty = integer               % Penalty below text.
% \belowskip = glue                     % Space b/b below text.
% \bodyfont = {\size\style}             % Default font for body.
% \divisions = {...}                    % List of divisions to include.
% \foliofont = {\size\style}            % Default font for folio.
% \leftindent = glue                    % Left indentation.
% \levels = {...}                       % List of levels to include.
% \setflag \minitoc = boolean           % Is this a miniToC?
% \parindent = dimen                    % Paragraph indentation.
% \parrag = dimen                       % Paragraph raggedness.
% \parskip = glue                       % Paragraph skip.
% \rightindent = glue                   % Right indentation.
% \tocwidtha = dimen                    % General width a.
% \tocwidthb = dimen                    % General width b.
% \tocwidthc = dimen                    % General width c.
% \width = dimen                        % Line width
% \xreffile = {...}                     % Name of composite xref file to use.
%~end

\definetoks{\foliofont}
\definetoks{\levels}
\definedimen{\tocwidtha}{0pt}
\definedimen{\tocwidthb}{0pt}
\definedimen{\tocwidthc}{0pt}
\definetoks{\xreffile}

\definecount{\prevtocprimarylevel}{-1}          % Previous level >= 70.


\def \toc #1{%                                          {type}
  \beginblockscope{toc}%
  \def \ztoctype {#1}%
  \global\increment \tocdepth
  \abovepenalty = \breaknever                   %~default hard
  \belowpenalty = \breakbest                    %~default hard
  \bodyfont = {}%                               %~default soft
  \divisions = {\all}%                          %~default soft
  \setflag \minitoc = \false                    %~default soft
  \tocwidtha = 0pt                              %~default soft
  \tocwidthb = 0pt                              %~default soft
  \tocwidthc = 0pt                              %~default soft
  \xreffile = {}%                               %~default hard
  \processdesign{\toc}{#1}%
  \global\increment \tocnumber
  \commalist{\zlevlist}{\the\levels}%
  \the\bodyfont
  \tocformat
  \endtoc}

\def \endtoc {%
  \endgraf
  \endtocformat
  \global\decrement \tocdepth
  \endblockscope{toc}}

\def \tocformat {%
  \endgraf
  \bbskipabove{\abovepenalty}{\aboveskip}%
  \alterindentation{\leftindent}{\rightindent}%
  \settextwidth{\width}%
  \setparrag{\parrag}%
  \zadjtitle = \if \minitoc \zadjtitleminitoc \else \zadjtitletoc \fi
                            % \adjusttitle should adjust appropriate ToC.
  \def \zadjloc {\toc}%
  \if \emptytoksp{\xreffile}%
    \zxloadcomp{\xrefloadtocmode}%
  \else
    \zxloadothercomp{\the\xreffile}{\xrefloadtocmode}%
  \fi}

\def \endtocformat {%
  \fakepar                                      % In case the ToC is empty.
  \setlist \ztocadjlist = {}%
  \bbskipbelowblock{\belowpenalty}{\belowskip}}


% The following macro is called for each entry in the cross-reference file.
% Each entry must NOT be in a group.

\def \xreftoc #1#2#3#4{%
  \ifnum \xrefmode=\xrefloadtocmode
    \xreftocb{#1}{#2}{#3}{#4}%
  \fi}

\definecount{\ztoclevel}{0}

\def \xreftocb #1#2#3#4{%               {page}{number}{title}
                        %               {division,level,difficulty,allow}
  \def \znext ##1,##2,##3,##4,##5\zmark{%
    \ztoksa={##1}\ztoclevel=##2\difficulty=##3\tcounta=##4\relax}%
  \znext #4,1,\zmark%
  \if \posp{\tcounta}%
    \edef \znext {\noexpand\inclusionlist\noexpand\ztoctest
                                         {\the\ztoksa}{\the\divisions}}%
    \znext
    \if \ztoctest
      \ztesttoclev{\ztoclevel}%
      \if \ztoctest
        \zchktocadj{#2}{#3}%
        \the\bodyfont
        \name{\toc\ztoctype\romannumeral\ztoclevel format}{#1}{#2}{#3}%
        \if \gtrp{\ztoclevel}{69}%
          \prevtocprimarylevel = \ztoclevel     % Save ToC level.
          \global\authortext = {}%              % Clear author text.
        \fi
      \fi
    \fi
  \fi}

\def \ztesttoclev #1{%                                  {level}
  \setflag \ztoctest = \false
  \maplist{\ztesttoca{#1}##1-\zmark}{\zlevlist}}

\def \ztesttoca #1#2-#3\zmark{%                         {n}low-high\zmark
  \if \emptyargp{#3}%
    \setflag \ztoctest = {\eqlp{#1}{#2}}%
  \else
    \ztesttocb{#1}{#2}#3%
  \fi
  \if \ztoctest \exitmaplist \fi}
  
\def \ztesttocb #1#2#3-{%                               {n}{low}high-
  \setflag \ztoctest = {\andp{\notp{\lssp{#1}{#2}}}
                             {\notp{\gtrp{#1}{#3}}}}}

\long\def \zchktocadj #1#2{%                            {number}{title}  
  \maplist{\zchktocadjb##1{#1}{#2}}{\ztocadjlist}}

\long\def \zchktocadjb #1#2#3#4#5{%     {type}{number}{commands}{number}{title}
  {\stringeql{\znext}{#1}{\ztoctype}%
   \if \znext
     \stringeql{\znext}{#2}{#4}%
     \if \znext
       #3\relax
     \else
       \def \tempa {#2}%                % Don't expand titles.
       \def \tempb {#5}%
       \if \tokeqlp{\tempa}{\tempb}%
         #3\relax
       \fi
     \fi
   \fi}}

\def \bbskipabovetochead #1#2#3#4#5{%   {level}{penalty}{skip}{penalty}{skip} 
  \if \eqlp{\prevtocprimarylevel}{#1}%
    \bbskipabove{#2}{#3}%
  \else
    \bbskipabove{#4}{#5}%
  \fi}

\definetoks{\zdelaytoc}

\def \delaytocformatter #1{%
  \global\zdelaytoc = \expandafter{\the\zdelaytoc #1}}

\def \dodelayedtocformatter {%
  \the\zdelaytoc
  \global\zdelaytoc = {}}