Debian Codegraph @

texmf-dist/tex/plain/zztex/zzfront.tex

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %
3 % Module: ZzTeX Front Matter Facilities
4 %
5 % Synopsis: This file provides facilities for typesetting the front
6 % matter of a book.
7 %
8 % Author: Paul C. Anagnostopoulos
9 % Created: 24 September 1989
10 %
11 % Copyright 1989--2020 by Paul C. Anagnostopoulos
12 % under The MIT License (opensource.org/licenses/MIT)
13 %
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15
16 % Copyright Page
17 % --------- ----
18
19
20 \def \copyrightline #1#2{% {year}{publisher}
21 \noindent Copyright \copyright\ #1 by #2\par}
22
23 \def \concisecopyrightline #1#2{% {year}{publisher}
24 \noindent \copyright\ #1 by #2\par}
25
26 \def \superconcisecopyrightline #1#2{% {year}{publisher}
27 \noindent \copyright\ #1 #2\par}
28
29 \def \copyrightnotice {%
30 All rights reserved. No part of this publication may be reproduced,
31 stored in a retrieval system, or transmitted, in any form or by any
32 means, electronic, mechanical, photocopying, recording, or otherwise,
33 without the prior written permission of the publisher.}
34
35
36 % We provide a standard text design for the Library of Congress
37 % Cataloging-in-Publication data.
38
39 \def \textcipdataidesign {%
40 \aboveskip = \noskip
41 \belowskip = \noskip
42 \bodyfont = {}%
43 \setflag \enabletabbing = \false
44 \leftindent = 0pt
45 \parindent = \enclosingparindent
46 \parrag = \enclosingparrag
47 \parskip = 0pt
48 \rightindent = 0pt
49 \setflag \verbatimlines = \true
50 \width = \naturalwidth}
51
52 \def \textcipdataiidesign {%
53 \textcipdataidesign}
54
55 % Table of Contents Entries
56 % ----- -- -------- -------
57
58
59 % This macro is used to write a ToC entry in the cross-reference file.
60
61 \def \ztocentry #1#2#3#4{% {number}{title}{level}{allow?}
62 {\ztoksa = {#2}%
63 \tcounta = #3\relax
64 \edef \znext {\noexpand\xref{toc}{\noexpand\folio}{#1}{\the\ztoksa}
65 {\the\divisionname,\the\tcounta,%
66 \the\difficulty,\if #41\else 0\fi}}%
67 \znext}}
68
69 % This is the public command for writing ToC entries.
70
71 \def \tocentry #1#2#3{% {number}{title}{level}
72 \ztocentry{#1}{#2}{#3}{\true}}
73
74 % This macro allows the compositor to adjust pages in the ToC.
75
76 \setlist \ztocadjlist = {}
77
78 \long\def \tocadjustment #1#2#3{% {toc-type}{number}{commands}
79 \append{{#1}{#2}{#3}}{\ztocadjlist}}
80
81 % Table of Contents Block
82 % ----- -- -------- -----
83
84
85 \defineblock{\toc}{\endtoc}{\false}{}
86
87 %~block toc Type
88 % \abovepenalty = integer % Penalty above text.
89 % \aboveskip = glue % Space b/b above text.
90 % \belowpenalty = integer % Penalty below text.
91 % \belowskip = glue % Space b/b below text.
92 % \bodyfont = {\size\style} % Default font for body.
93 % \divisions = {...} % List of divisions to include.
94 % \foliofont = {\size\style} % Default font for folio.
95 % \leftindent = glue % Left indentation.
96 % \levels = {...} % List of levels to include.
97 % \setflag \minitoc = boolean % Is this a miniToC?
98 % \parindent = dimen % Paragraph indentation.
99 % \parrag = dimen % Paragraph raggedness.
100 % \parskip = glue % Paragraph skip.
101 % \rightindent = glue % Right indentation.
102 % \tocwidtha = dimen % General width a.
103 % \tocwidthb = dimen % General width b.
104 % \tocwidthc = dimen % General width c.
105 % \width = dimen % Line width
106 % \xreffile = {...} % Name of composite xref file to use.
107 %~end
108
109 \definetoks{\foliofont}
110 \definetoks{\levels}
111 \definedimen{\tocwidtha}{0pt}
112 \definedimen{\tocwidthb}{0pt}
113 \definedimen{\tocwidthc}{0pt}
114 \definetoks{\xreffile}
115
116 \definecount{\prevtocprimarylevel}{-1} % Previous level >= 70.
117
118
119 \def \toc #1{% {type}
120 \beginblockscope{toc}%
121 \def \ztoctype {#1}%
122 \global\increment \tocdepth
123 \abovepenalty = \breaknever %~default hard
124 \belowpenalty = \breakbest %~default hard
125 \bodyfont = {}% %~default soft
126 \divisions = {\all}% %~default soft
127 \setflag \minitoc = \false %~default soft
128 \tocwidtha = 0pt %~default soft
129 \tocwidthb = 0pt %~default soft
130 \tocwidthc = 0pt %~default soft
131 \xreffile = {}% %~default hard
132 \processdesign{\toc}{#1}%
133 \global\increment \tocnumber
134 \commalist{\zlevlist}{\the\levels}%
135 \the\bodyfont
136 \tocformat
137 \endtoc}
138
139 \def \endtoc {%
140 \endgraf
141 \endtocformat
142 \global\decrement \tocdepth
143 \endblockscope{toc}}
144
145 \def \tocformat {%
146 \endgraf
147 \bbskipabove{\abovepenalty}{\aboveskip}%
148 \alterindentation{\leftindent}{\rightindent}%
149 \settextwidth{\width}%
150 \setparrag{\parrag}%
151 \zadjtitle = \if \minitoc \zadjtitleminitoc \else \zadjtitletoc \fi
152 % \adjusttitle should adjust appropriate ToC.
153 \def \zadjloc {\toc}%
154 \if \emptytoksp{\xreffile}%
155 \zxloadcomp{\xrefloadtocmode}%
156 \else
157 \zxloadothercomp{\the\xreffile}{\xrefloadtocmode}%
158 \fi}
159
160 \def \endtocformat {%
161 \fakepar % In case the ToC is empty.
162 \setlist \ztocadjlist = {}%
163 \bbskipbelowblock{\belowpenalty}{\belowskip}}
164
165
166 % The following macro is called for each entry in the cross-reference file.
167 % Each entry must NOT be in a group.
168
169 \def \xreftoc #1#2#3#4{%
170 \ifnum \xrefmode=\xrefloadtocmode
171 \xreftocb{#1}{#2}{#3}{#4}%
172 \fi}
173
174 \definecount{\ztoclevel}{0}
175
176 \def \xreftocb #1#2#3#4{% {page}{number}{title}
177 % {division,level,difficulty,allow}
178 \def \znext ##1,##2,##3,##4,##5\zmark{%
179 \ztoksa={##1}\ztoclevel=##2\difficulty=##3\tcounta=##4\relax}%
180 \znext #4,1,\zmark%
181 \if \posp{\tcounta}%
182 \edef \znext {\noexpand\inclusionlist\noexpand\ztoctest
183 {\the\ztoksa}{\the\divisions}}%
184 \znext
185 \if \ztoctest
186 \ztesttoclev{\ztoclevel}%
187 \if \ztoctest
188 \zchktocadj{#2}{#3}%
189 \the\bodyfont
190 \name{\toc\ztoctype\romannumeral\ztoclevel format}{#1}{#2}{#3}%
191 \if \gtrp{\ztoclevel}{69}%
192 \prevtocprimarylevel = \ztoclevel % Save ToC level.
193 \global\authortext = {}% % Clear author text.
194 \fi
195 \fi
196 \fi
197 \fi}
198
199 \def \ztesttoclev #1{% {level}
200 \setflag \ztoctest = \false
201 \maplist{\ztesttoca{#1}##1-\zmark}{\zlevlist}}
202
203 \def \ztesttoca #1#2-#3\zmark{% {n}low-high\zmark
204 \if \emptyargp{#3}%
205 \setflag \ztoctest = {\eqlp{#1}{#2}}%
206 \else
207 \ztesttocb{#1}{#2}#3%
208 \fi
209 \if \ztoctest \exitmaplist \fi}
210
211 \def \ztesttocb #1#2#3-{% {n}{low}high-
212 \setflag \ztoctest = {\andp{\notp{\lssp{#1}{#2}}}
213 {\notp{\gtrp{#1}{#3}}}}}
214
215 \long\def \zchktocadj #1#2{% {number}{title}
216 \maplist{\zchktocadjb##1{#1}{#2}}{\ztocadjlist}}
217
218 \long\def \zchktocadjb #1#2#3#4#5{% {type}{number}{commands}{number}{title}
219 {\stringeql{\znext}{#1}{\ztoctype}%
220 \if \znext
221 \stringeql{\znext}{#2}{#4}%
222 \if \znext
223 #3\relax
224 \else
225 \def \tempa {#2}% % Don't expand titles.
226 \def \tempb {#5}%
227 \if \tokeqlp{\tempa}{\tempb}%
228 #3\relax
229 \fi
230 \fi
231 \fi}}
232
233 \def \bbskipabovetochead #1#2#3#4#5{% {level}{penalty}{skip}{penalty}{skip}
234 \if \eqlp{\prevtocprimarylevel}{#1}%
235 \bbskipabove{#2}{#3}%
236 \else
237 \bbskipabove{#4}{#5}%
238 \fi}
239
240 \definetoks{\zdelaytoc}
241
242 \def \delaytocformatter #1{%
243 \global\zdelaytoc = \expandafter{\the\zdelaytoc #1}}
244
245 \def \dodelayedtocformatter {%
246 \the\zdelaytoc
247 \global\zdelaytoc = {}}