Debian Codegraph @

texmf-dist/doc/plain/zztex/zzdetails.dat

raw
1 //---------------------------------------------------------------------------
2 //
3 // Copyright (c) 2012--2018 by Paul C. Anagnostopoulos
4 //
5 // This software may be used on your own computer systems and may
6 // be distributed freely to other people. It may not be sold or
7 // incorporated into any commercial products.
8 //
9 // Paul C. Anagnostopoulos
10 // Windfall Software
11 // 978 371-2316
12 // [email protected]
13 //
14 //---------------------------------------------------------------------------
15 //
16 // ZzExplore: Describe built-in TeX, Plain TeX, ZzTeX, and design
17 // file entities for compositors.
18 //
19 // This is the details phrase file.
20 //
21 // Created: 7 May 2016
22
23 // \art Block
24 // ---- -----
25
26 .details art_details \art
27 .template art_details
28 == The |\art| Block
29
30 This tutorial describes the ZzTeX |\art| block, which is used to place
31 Encapsulated PostScript (EPS) files on the page. EPS files can be created
32 with many different applications, the most common being Adobe Illustrator
33 and PhotoShop.
34
35 === The |\art| Command
36
37 The format of the |\art| command is:
38
39 | \art{*type*}{*file*,*width*,*height*,*scale*[,*gutter*,*file*,*width*,*height*,*scale*,...]}
40
41 The *type* argument specifies the type of the code block and thus its
42 design. Common examples are |figure| for art in floating figures and
43 |text| for art in text.
44
45 A single piece of art is described by four values in the second argument:
46
47 & *file*& The name of the EPS file. See below.
48 & *width*& The width of the art, usually specified in picas.
49 & *height*& The height of the art.
50 & *scale*& The scale factor for the art. See below.
51 &.
52
53 You can place multiple pieces of art, or panels, side-by-side by including
54 additional values in the second argument. The *gutter* specifies the
55 horizontal distance between the adjacent panels. The next four arguments specify
56 the second art file, in the same manner as the first. This sequence can be
57 continued to place three or four panels side-by-side.
58
59 === File Name
60
61 The file name specified in the |\art| command is the name of an EPS file to be
62 placed on the page. There is no need to specify the extension |.eps|. The
63 file is assumed to reside in the directory specifed by the |\setartroot|
64 command in the book's root file. If the name is preceded by an exclamation
65 point (|!|), then the file is located in the main project directory (this
66 feature is used for design art).
67
68 Occasionally, a piece of art will include spurious whitespace on the edges
69 of the art, but within its bounding box. This whitespace is called *slop*,
70 and will result in the art appearing out of position. ZzTeX can compensate
71 for the slops if you specify them with the file name, as follows:
72
73 \art{figure}{{smi01f01,0pt,5pt,0pt,3pt},...}
74
75 Note the extra set of braces around the file name and slops. All four slops
76 must be specified, in this order: left side, right side, top, bottom. If all
77 the slops are less than 1.5 points or so, there is no need to include them.
78 We haven't used slops much in the past decade or so; we simply ask the
79 illustrator to eliminate the whitespace.
80
81 === Width and Height
82
83 If both the width and height are specified as zero (i.e., |0pc,0pc|), then the
84 art will be dynamically sized when the file is processed. ZzTeX inspects the
85 EPS file to determine the art size. If it cannot find the |%%BoundingBox|
86 comment that specifies the size, an error results. We use this feature
87 only for design art.
88
89 The ZzSizeArt utility can automatically size the art in a chapter file.
90 Try |~.facility; sizing art| for more details.
91
92 === Scale Factor
93
94 The scale factor specifies the scale at which the piece of art should be
95 placed, relative to its natural size. The scale factor must always be
96 specified, even if it is 100. There are three ways to specify it:
97
98 * *percentage*&_A number that specifes the percentage of scaling.
99 The number may include decimal places.
100
101 * |=|&_An equal sign specifies that the art should be scaled
102 to fit in the prevailing width. The width is usually the
103 text measure or the type area width.
104
105 * |=*width*|&_An equal sign and a width specifies that the art should
106 be scaled to the specified width.
107 *.
108
109 === Aligning Side-by-Side Panels
110
111 The |\art| command aligns side-by-side panels along their top edges. Sometimes
112 you want them aligned differently. To shift a panel vertically, specify a
113 top slop that is positive to shift the panel up or negative to shift the panel
114 down.
115
116 Note that the slops are scaled by the scale factor, so the exact slop
117 required to shift the panel correctly may not be obvious.
118
119 // Art Sizing
120 // --- ------
121
122
123 .phrase art_sizing art sizing : text
124 .synonym sizing art
125 .synonym zzsizeart
126 .template
127 = ZzSizeArt Art Sizing Utility
128
129 The ZzSizeArt utility allows you to manipulate the art sizes specified in
130 |\art| commands in ZzTeX source files. Its two primary capabilities are to set
131 the sizes of art files by inspecting the Encapsulated PostScript (EPS) files
132 and to replace existing EPS files with new versions.
133
134 The ZzSizeArt facility relies on the following conventions for art files:
135
136 * The bulk of the art files for a book are stored in the art/
137 subdirectory under the primary project directory.
138
139 * Replacement art files are loaded into the new/ subdirectory under
140 the art/ directory before eventually being hoisted into the
141 art/ directory.
142
143 * Before an art file in an |\art| command is sized, its width and height are
144 coded as |20pc,10pc|. This special combination signals that the art has not
145 been sized.
146
147 * ZzTeX supports dynamic sizing by setting the |\art| size
148 to |0pc,0pc|. In this case, the size is determined by inspecting the
149 EPS file every time the chapter is processed, rather than being set
150 statically. Most ZzSizeArt commands ignore dynamically sized files.
151 *.
152
153 == zzsizeart Command
154
155 The zzsizeart command has the following syntax:
156
157 | zzsizeart *root* *command* *additional-items*
158
159 The *root* parameter specifies the root name of the book. It is usually
160 specified as a period (|.|), which causes ZzSizeArt to figure out the root
161 name. The command parameter is a keyword that determines which function
162 ZzSizeArt performs. Its functions are described in alphabetical order
163 in the following paragraphs.
164
165 * |zzsizeart *root* reset *source-file*|
166
167 This command resets all the art sizes in the specified ZzTeX source file to
168 |20pc,10pc|. Dynamically sized art files are ignored unless the |-all| option is
169 included, in which case they are reset also.
170
171 If the |-scale| option is specified, then ZzSizeArt also resets the scale of
172 the art files to 100.
173
174 * |zzsizeart *root* replace *optional-file-spec*|
175
176 This command analyzes the replacement art files in the art/new/ subdirectory
177 to determine whether they are the same size as the existing art files and
178 can safely replace them. If a *file-spec* parameter is provided, only the
179 replacement files that match the file spec are analyzed. The command
180 generates a report about the replacement art files and displays it on the
181 screen. This reports tells you whether the replacement art files are the
182 same size or a different size.
183
184 If the |-hoist| option is included, then any replacement art files that are the
185 same size as the existing files are hoisted from the new/ subdirectory up to
186 the art/ directory, replacing the old art files of the same names. The rest of
187 the replacement art files are left in the new/ subdirectory. You can use the
188 PrintEPS utility to generate a proof of the remaining art files, from which
189 you can read the sizes of those files. Also see the |tell| command below.
190
191 If the |-all| option is also specified, then all replacement art files are
192 hoisted, including those that are a different size from the existing art
193 files.
194
195 The |-epsilon=*w*,*h*| option specifies the epsilon values for the width (*w*) and
196 height (*h*). If the difference in size is within these epsilons, the
197 replacement file is considered the same size as the existing file. The
198 default width and heigh epsilons are both 1.5 points.
199
200 * |zzsizeart *root* size *source-file*|
201
202 This command sizes the |\art| commands in the specified ZzTeX source file by
203 analyzing the EPS files named in those |\art| commands. Every art file must have
204 the size |20pc,10pc|, except for dynamically-sized art files, which are
205 ignored. Every named art file must exist in the art/ subdirectory. The
206 source file is modified so that the art files have their actual sizes.
207
208 If the |-ifexists| option is specified, then ZzSizeArt will size those art
209 files that exist in the art/ subdirectory and ignore any other files named
210 in |\art| commands. *All* art files must still have the size |20pc,10pc|, but any
211 files that do not exist will not be set to their actual sizes.
212
213 If the |-partial| option is specified, then ZzSizeArt will size those art
214 files whose sizes are |20pc,10pc| and ignore any other art files named in |\art|
215 commands. This allows you to size art files that were not sized previously
216 for whatever reason, possibly due to a prior use of the |-ifexists| option.
217
218 If both |-ifexists| and |-partial| are specified, then ZzTeX will size any
219 art file who size is |20pc,10pc| and that exists in the art/ subdirectory.
220
221 * |zzsizeart *root* tell *eps-file* ...|
222
223 This command analyzes the specified EPS files and displays a report giving
224 their sizes. This is useful when you need to know the sizes of a few EPS
225 files in order to update their |\art| commands by hand.
226 *.
227 ----
228 For more details on the |\art| command, try |~.facility; \art|.
229
230 // Cleanup Report
231 // ------- ------
232
233
234 .phrase cleanup_report cleanup report
235 .synonym clean-up report
236 .synonym clean up report
237 .template
238 = Cleanup Report for ~.project;
239
240 This report describes the chapter cleanup activities for books
241 in general and ~.project; in particular.
242
243 Before reading this report, it's a good idea to read the design
244 report for ~.project;. Try |~.facility; design report|.
245
246 == General Cleanup
247
248 === Clean Up Headings
249
250 The heads in sectioning commands (e.g., |\chapter|, |\section|) and
251 tables, along with the titles in captions, must be formatted according
252 to the design. This involves
253
254 * Captitalizing them correctly
255
256 * Adding or removing trailing punctuation
257
258 * Ensuring that run-in heads have no blank lines after them
259
260 * Adding |\noindent| commands where they might be missing
261
262 * Once the chapter is processed, turning multi-line heads with
263 |\titlenl;| or |\titletl;|
264 *.
265
266 Here are the styles of the various heads and titles.
267
268 &= Command& Style
269 ----
270 ~foreach cmd, style_table;
271 & ~.cmd;& ~.style_table[cmd];
272 ~end;
273 &.
274
275 === Clean Up Floats
276
277 The cleanup for floats involves
278
279 * Making sure there is a blank line on either side
280
281 * Determining whether the author embedded floats in the middle of
282 paragraphs and merging the broken paragraph segments
283
284 * Moving floats after the first paragraph of reference (this may be
285 easier during page make-up)
286
287 * Placing the correct file names in |\art| commands.
288
289 * Checking captions to see if they need a |\legend| marker.
290 *.
291
292 // \code Block
293 // ----- -----
294
295 .details code_details \code
296 .template code_details subclass_set command code
297 == Code Facilities
298
299 This tutorial describes the ZzTeX code facilities. These facilities are
300 used to produce computer program code examples.
301
302 === The |\code| Block
303
304 The |\code| command has the following syntax:
305
306 | \code{*type*}
307 | *line of code*
308 | ...
309 | *line of code*
310 | \endcode
311
312 The *type* argument specifies the type of the code block and thus its
313 design. Each line of code is set more or less verbatim and line breaks
314 are preserved as they are. Code blocks are almost always set in a monospaced
315 font so that indentation can be accomplished with spaces at the beginnings
316 of lines.
317
318 === Verbatim Lines
319
320 The degree to which the code lines are taken verbatim is determined
321 by certain block design parameters. To investigate the design
322 parameters for a code block, try |~.facility; \code*type* details|.
323
324 * |\allowTeXcommands|&_If this flag is on, ZzTeX commands can be
325 included in the code, as long as they use only backslash and
326 braces (|\|, |{|, |}|). This flag is on in most code blocks.
327 To include those characters in the code itself, you must use:
328 |\\|, |\{|, |\}|.
329
330 * |\allowTeXmath|&_If this flag is on, math expressions can be
331 included in the code, using dollar sign, underscore, and hat (|$|,
332 |_|, |^|). This flag is off in most code blocks. To include those
333 character in the code itself, you must use: |\$|, |\_|, |\hat|.
334 (See |\codemath| for another way to include math in code.)
335
336 * |\allowatsigncommands|&_If this flag is on, at-sign commands
337 can be included in the code and would probably be provided by
338 the code design. This flag is off in most code blocks. To include an
339 at-sign in the code itself, you must use: |\@|.
340
341 === |\code| Tools
342
343 The following list includes all the tools that can be used within a |\code|
344 block. You can explore these various commands to learn what they do.
345
346 ~foreach name, name_set;
347 * |~.name;|
348 ~end;
349 *.
350
351 // \enunciation Block
352 // ------------ -----
353
354 .details enunciation_details \enunciation
355 .template enunciation_details
356 == The |\enunciation| Block
357
358 This tutorial describes the ZzTeX |\enunciation| block, which produces
359 mathematical "enunciations" such as theorems, corollaries, and proofs.
360 Using the |\enunciation| command is reasonably straightforward,
361 but defining the various types of enunciations is a bit trickier.
362
363 The format is the |\enunciation| command is:
364
365 | \enunciation{*type*}{*optional-attribution*}
366
367 The *type* argument specifies the type of the code block and thus its
368 design. The *optional-attribution* argument can have one of three
369 formats. Note that the second set of braces is required in *all* cases.
370
371 # |{}|&_If empty, there is no attribution for the enunciation.
372 & Theorem 1.1.&_There exist irrational numbers ...
373 &.
374
375 # |{Smith's Conjecture}|&_The specified text is the attribution for the
376 enunciation.
377 & Conjecture 1.2 (Smith's Conjecture).&_Let *K* be the *n*th cyclotomic field ...
378 &.
379
380 # |{\title Kleene's Theorem}|&_The text specified after the |\title| marker
381 is the complete title for the enunciation.
382 & Kleene's Theorem.&_Every language definable with a regular expression ...
383 &.
384 #.
385
386 === Defining an Enunciation Type
387
388 Prior to ZzTeX v5.8, each enunciation type had to be defined by
389 writing a complete design macro, as with other block types. There
390 are some subtle issues that make this difficult. In v5.8, the
391 |\definenunciation| command was added.
392
393 | \defineenunciation{*type*}{*association*}{*design*}
394
395 The first argument is the enunciation's type. The second argument
396 can be empty or specify the type of another enunciation whose
397 number counter is to be shared. Both types of enunciation will be
398 numbered sequentially with the same counter.
399
400 The third argument specifies a design macro for the base design
401 that is to be used for this new enunciation type. Multiple enunciations
402 can share the same base design. For example,
403
404 \defineenunciation{conjecture}{}{\enunciationtheoremlikedesign{Conjecture}}
405 \defineenunciation{corollary}{}{\enunciationtheoremlikedesign{Corollary}}
406 \defineenunciation{definition}{}{\enunciationtheoremlikedesign{Definition}}
407 \defineenunciation{lemma}{}{\enunciationtheoremlikedesign{Lemma}}
408 \defineenunciation{proof}{}{\enunciationprooflikedesign{Proof}}
409 \defineenunciation{proposition}{}{\enunciationtheoremlikedesign{Proposition}}
410
411 There are two base designs for these enunciations: |\enunciationtheoremlikedesign|
412 for enunciations formatted like theorems, and |\enunciationprooflikedesign|
413 for enunciations formatted like proofs. Note that the two design macros expect
414 an argument that is the word to appear in the title of the enunciation (e.g.,
415 "Conjecture", "Proof").
416
417 So defining a set of related enunciations boils down to writing one
418 base design macro.
419
420 === Base Enunciation Design
421
422 Most of the details about enunciation design macros are the same
423 as other design macros. There are two interesting additions.
424
425 \def \enunciationtheoremlikedesign #1{%
426 \aboveskip = \standardskip
427 ...
428 \def \labelformat ##1{%
429 \noindent
430 \attributiontypecase
431 {\llap{\colortext{darkblue}{\enunnumbersize\dbf #1 \the\enunciationcomptext}%
432 \hspace{10pt}}}% no attribution
433 {\llap{\colortext{darkblue}{\enunnumbersize\dbf #1 \the\enunciationcomptext}%
434 \hspace{10pt}}##1.\quad}% normal attribution
435 {\llap{\colortext{darkblue}{\enunnumbersize\dbf ##1}%
436 \hspace{10pt}}}% title override
437 \ignorespaces}%
438
439 The first addition is that the design macro accepts an argument that is
440 the word to be set in the title. The |#1| in the first line represents
441 that argument.
442
443 The second addition is the |\attributiontypecase| command in the
444 label formatter. It takes three arguments, each of which formats the
445 title (label) of the enunciation. The three arguments correspond to the
446 three title argument formats described above.
447
448 # The attribution argument is empty.
449 # The attribution argument specifies an attribution.
450 # The attribution argument includes the |\title| marker.
451 #.
452
453 === The |\defineeoedingbat| Command
454
455 The |\enunciation| block includes a design parameter named |\autoqed|.
456 This parameter can specify the name of an "end-of-enunciation dingbat"
457 that should appear at the end of the enunciation.
458
459 \def \enunciationprooflikedesign #1{%
460 ...
461 \autoqed = {\qed}%
462
463 The |\qed| command, which typesets a dingbat, is automatically performed
464 at the end of enunciations based on the |\enunciationprooflikedesign|
465 design. To override the position of the resulting dingbat, you can
466 specify the |\qed| command explicitly in the text of the enunciation.
467
468 An end-of-enunciation dingbat is defined with
469
470 | \defineeoedingbat{*name*}{*text*}{*space*}
471
472 The first argument is the name of the dingbat command. The second argument
473 is the text of the dingbat. The third argument specifies how to
474 separate the dingbat from the final word of the enunciation.
475
476 * |{10pt}|&_The dingbat is set 10 points from the final word.
477
478 * |{\flushright 8pt}|&_The dingbat is set flush right, but a minimum
479 of 8 points must separate it from the final word.
480 *.
481
482 So the |\qed| dingbat used above could be defined with
483
484 \defineeoedingbat{\qed}{\colortext{darkblue}{\slug{5pt}{5pt}}}{\flushright 8pt}
485
486 // Environments
487 // ------------
488
489
490 .phrase environments environments : text
491 .synonym LaTeX environments
492 .template
493 = LaTeX Environments
494
495 A LaTeX *environment* is the equivalent of a ZzTeX *block*.
496 The term environment is not used in ZzTeX.
497
498 // \eqno Marker
499 // ----- ------
500
501 .details eqno_details \eqno
502 .template eqno_details
503 == Equation Numbers
504
505 This tutorial describes the ZzTeX facilities for setting equation numbers on
506 math displays. An equation number is set with the |\eqno| marker, which can
507 appear in three places:
508
509 # At the end of a single-line math display, before the closing |$$|.
510
511 # At the end of an aligned math display, *after* the close brace of the
512 |\eqaligned| and before the closing |$$|. In this case, the number pertains
513 to the entire display.
514
515 # At the end of a row of an aligned display, just *before* the |\cr| or
516 close brace of the |\eqaligned|. In this case, the number pertains to
517 the row in which it appears.
518 #.
519
520 Almost all book designs call for one of two formats of equation number. In
521 most cases, the number consists of the chapter composite text and a sequence
522 number within the chapter, as in "3.17". In a few cases, only a sequence
523 number is used, as in "17". In the descriptions below, *chap* stands for the
524 chapter composite text, while *num* stands for the equation sequence number. The
525 sequence number is derived from the math display counter, in the same manner
526 as section numbers are derived from the section counter.
527
528 You can code an equation number in one of four ways:
529
530 | \eqno
531 | \eqno \tag{*xyz*}
532 | \eqno *override*
533 | \eqno *override* \tag{*xyz*}
534
535 The optional *override* text is used to override the normal numbering sequence.
536 A space or line break can be placed before and/or after the |\tag| command to
537 aid readability. The |\tag| command must appear immediately following its
538 paired |\eqno| in order to associate the tag with the correct equation
539 number.
540
541 The following paragraphs present the various forms of the *override* text for
542 overriding the numbering sequence. Each case includes two examples, the
543 first where the equations are numbered in the common (*chap*.*num*) format, and
544 the second where the equations are numbered with only a sequence number, as
545 in (*num*). The examples assume that the chapter number is 2 and the
546 math display counter is at 4 prior to the display
547 and also show the counter *after* the equation number is typeset.
548
549 * |\eqno|&_&_&_Next sequence number
550
551 The math display counter is incremented and its arabic form is used as
552 the *num* text. This is the common case.
553
554 &= Result when& Result when
555 &= (*chap*.*num*) style& (*num*) style& Counter After
556 ----
557 & (2.5)& (5)& 5
558 &.
559
560 * |\eqno +a|&_&_&_Next sequence number; use with suffix
561
562 The math display counter is incremented and its arabic form is joined
563 with the suffix following the plus sign to make up the *num* text.
564
565 &= Result when& Result when
566 &= (*chap*.*num*) style& (*num*) style& Counter After
567 ----
568 & (2.6a)& (6a)& 5
569 &.
570
571 * |\eqno ,b|&_&_&_Same sequence number with suffix
572
573 The math display counter is *not* incremented. Its arabic form is joined
574 with the suffix following the comma to make up the *num* text.
575
576 &= Result when& Result when
577 &= (*chap*.*num*) style& (*num*) style& Counter After
578 ----
579 & (2.4b)& (4b)& 4
580 &.
581
582 * |\eqno ,$'$|&_&_&_Same sequence number with suffix
583
584 This is another example of the preceding case, showing the common use
585 of a prime after the *num* text.
586
587 &= Result when& Result when
588 &= (*chap*.*num*) style& (*num*) style& Counter After
589 ----
590 & (2.4′)& (4′)& 4
591 &.
592
593 * |\eqno A1|&_&_&_Ignore sequence number; use specified *num*
594
595 The math display counter is ignored. The specified text is used as the
596 complete *num* text.
597
598 &= Result when& Result when
599 &= (*chap*.*num*) style& (*num*) style& Counter After
600 ----
601 & (2.A1)& (A1)& 4
602 &.
603
604 * |\eqno :A1|&_&_&_Next sequence number; use specified *num*
605
606 The math display counter is incremented *but then ignored*. The specified
607 text is used as the complete *num* text.
608
609 &= Result when& Result when
610 &= (*chap*.*num*) style& (*num*) style& Counter After
611 ----
612 & (2.A1)& (A1)& 5
613 &.
614
615 * |\eqno =12;a|&_&_&_Set sequence number; use with suffix
616
617 The math display counter is set to 12 and its arabic form is joined
618 with the suffix following the semicolon to make up the *num* text. Note that
619 the suffix (|a| here) is optional but the semicolon is required.
620
621 &= Result when& Result when
622 &= (*chap*.*num*) style& (*num*) style& Counter After
623 ----
624 & (2.12a)& (12a)& 12
625 &.
626
627 * |\eqno !2B.1|&_&_&_Use specified text for number
628
629 The chapter composite text and math display counter are ignored. The text
630 following the exclamation point is the complete equation number. This
631 feature is useful when you need to set an out-of-sequence equation number
632 in something like a sidebar or a chapter appendix.
633
634 &= Result when& Result when
635 &= (*chap*.*num*) style& (*num*) style& Counter After
636 ----
637 & (2B.1)& (2B.1)& 4
638 &.
639
640 * |\eqno >{*tag*}|&_&_&_Use equation number associated with tag
641
642 The chapter composite text and math display counter are ignored. The equation
643 number associated with the tag is duplicated for the equation number
644 of this display.
645 *.
646
647 If you ever need to reset the math display counter, the following command
648 will do it:
649
650 | \setmathdisplaynumber{*num*}
651
652 // Indexing
653 // --------
654
655 .phrase indexing indexing : text
656 .template
657 = Indexing Facilities, version 2
658
659 This tutorial describes the second generation ZzTeX indexing facilities.
660 These facilities are used to index a document with embedded indexing commands and
661 then generate one or more indexes for typesetting.
662
663 First, some definitions.
664
665 * Locator.&_An item followng a heading that refers the reader to related
666 information in the book. This is usually a page number or range,
667 but sometimes a "See" or "See also." The term *locator* is also used
668 for the commands that are inserted in the text to create index entries.
669
670 * Main heading.&_The heading of a top-level entry in an index.
671
672 * Raw index entry.&_A locator command such as |\xpage| generates
673 a raw index entry in the raw index entry files. The entry contains
674 unformatted information about the locator.
675
676 * Sort override.&_An alternate heading used in place of a regular heading
677 to specify how it should be sorted, For example, the heading "3-D"
678 might have a sort heading of "three D".
679
680 * Subheading.&_The heading of a second- or third-level entry in an index,
681 subordinate to a main heading.
682 *.
683
684 == Indexing Locators
685
686 Indexing locators are commands that are inserted in the text to produce raw index
687 entries that ultimately make up the index. This section describes typical
688 indexing locators. For another overview of locators, try |~.facility;
689 locators|.
690
691 Most locator commands produce a raw index entry that identifies a page or range of
692 pages relevant to the headings.
693
694 \xpage{Automobiles}
695 \xpage{Automobiles|muscle cars}
696
697 Locator commands begin with an |x| and include a type word that identifies
698 the type of locator produced. The argument specifies one to three
699 headings, separated by vertical bars (|&||). The first heading is the main heading
700 and any remaining headings are subheadings.
701
702 If the locator allows a page range, then the commands |\x*type*begin| and
703 |\x*type*end| identify the beginning and ending positions of the range.
704
705 \xpagebegin{Automobiles}
706 ...
707 \xpageend{Automobiles}
708
709 Some locators require an additional argument called the "text." This provides
710 more information about the locator.
711
712 \xsee{Cars}{Automobiles}
713 \xseealso{Automobiles|muscle cars}{Automobiles|pony cars}
714
715 Such locator commands produce locators that do not include a page number
716 but rather text that refers the reader to other entries. The additional
717 text argument is always the first argument of the locator command.
718
719 === Sort Overrides
720
721 (To be supplied.)
722
723 == Design File
724
725 This section describes the commands that appear in the design file to define
726 locators and their formatting and specify the design of the indexes in the
727 book. The commands are described in the order in which they must appear in
728 the design file.
729
730 \indexversion{2}
731
732 This command must appear at the beginning of the Index section of the design
733 file. It specifies that version 2 of the indexing facility is being used.
734
735 === Generating Indexes
736
737 Multiple indexes can be generated from the raw index entries of a book. Each
738 index is assigned a name and declared using the following command.
739
740 | \generateindex{*name*}
741
742 Typical names are |subject|, |author|, and |symbol|. For each generated
743 index, ZzTeX produces an "index parameter file" with the same name as the
744 index and the extension |zzp|. A parameter file contains information about
745 the defined locators and information taken from the design definition for
746 the named index. This information is used by the index generator to build
747 the final index file. (See below for a description of index parameter files.)
748
749 === Defining Locators
750
751 | \definelocator{*type*}{*attributes*}{*optional-format*}
752
753 This command defines an index locator and establishes the indexing commands
754 used to include the locator in the index. The first argument is the type word that
755 identifies the type of locator. Typical examples are |page|, |figure|, and
756 |see|.
757
758 The second argument gives the attributes of the locator. It is a series
759 of keywords:
760
761 * |\page|, |\nopage|&_Indicates whether the locator includes a page number.
762
763 * |\range|, |\norange|&_Indicates whether the locator may be used to specify
764 a range of pages in addition to a single page.
765
766 * |\text|, |\notext|&_Indicates whether the locator includes additional text.
767 *.
768
769 Assume that the type is |thing|. In all cases, the following locator command
770 is defined:
771
772 | \xthing{*headings*}
773
774 If a range is allowed, then two additional commands are defined:
775
776 | \xthingbegin{*headings*}
777 | \xthingend{*headings*}
778
779 If the locator includes additional text, then all commands take a first
780 argument specifying the text:
781
782 | \xthing{*text*}{*headings*}
783 | \xthingbegin{*text*}{*headings*}
784 | \xthingend{*text*}{*headings*}
785
786 The third argument to |\definelocator| is optional and specifies the format
787 of the locator in the final index. If the braces are empty, then the
788 separetely defined format with the same name as the locator is used. To
789 provide the format, use three sets of braces to specify the second, third,
790 and fourth arguments for the |\definelocatorformat| command (below). The new
791 format will be given the same name as the locator.
792
793 === Defining Formats
794
795 | \definelocatorformat{*name*}{*rank*.*order*}{*level-1-items*}{*level-2-items*}
796
797 This command defines a locator format with the given name for the final index.
798 The third and fourth arguments specify items that are needed to format
799 the locator. The level-1-items are used for locators associated with main
800 headings, while the level-2-items include overrides that pertain to
801 subheadings (both second- and third-level).
802
803 The second argument specifies the rank and order of this locator. The *rank*
804 determines this locator's position in the overall sequence of locators for a
805 heading. Typically, the page locators appear first, then the "see" locator,
806 then any "see also" locators.
807
808 The *order* determines the order of the locator within a series of locators
809 all with the same page number. Typically, plain page numbers appear first,
810 then pages with suffix 'f' for figure, then pages with suffix 't' for table,
811 etc.
812
813 & Mustang, 13, 44--49, 45*f*, 45*t*
814 &.
815
816 Each item list argument is in the following format:
817
818 | {*item*:*text*&|*item*:*text*&|...}
819
820 There is a sequence of items separated by bars (|&||). Each item consists of
821 an item tag, a colon (|:|), and some text. The following item tags are
822 available.
823
824 * |prefix1|&_Text to precede all locators of this rank, when this is
825 the first locator after the heading. Defaults to empty.
826
827 * |prefix2|&_Text to precede all locators of this rank, when this is
828 not the first locator after the heading. Defaults to |prefix1|.
829
830 * |tmplt|&_Template for this locator when there is a single page
831 or no page (only text). No default.
832
833 * |rtmplt|&_Template for this locator when there is a range of pages.
834 No default.
835
836 * |sep|&_Separator between locators of this rank. Defaults to empty.
837
838 * |suffix|&_Text to follow all locators of this rank. Defaults to empty.
839
840 * |term|&_Text to terminate the entire sequence of locators. Defaults to empty.
841 *.
842
843 The templates |tmplt| and |rtmplt| may include the following substitutors.
844
845 &= Substitutor& What is substituted
846 ----
847 & |?P|& Single page or first page of range.
848 & |?Q|& Second page of range.
849 & |?T|& Text (e.g., for |see| or |seealso| locators).
850 & |??|& Single question mark (|?|).
851 &.
852
853 The builtin locators can be found in the ZzTeX file zzindexv2.tex. They
854 are good examples of how locator formats are defined.
855
856 == Index Design
857
858 Each index of a book is typeset inside an index block whose design is
859 specified, as usual, with a design macro. The parameters of the design macro
860 include many common ones, but also a few that are special for index designs.
861 The following paragraphs describe the special parameters.
862
863 * |\def \alphaformat ##1{*text*}|
864
865 This parameter specifies how to format the break between letters produced by
866 the |\alphbreak{...}| command. The macro is passed the argument text from the
867 |\alphabreak|.
868
869 * |\divisions = {*div1*,*div2*,...}|
870
871 This parameter specifies the book divisions to be included in the index.
872 The value can be |\all|; a list of division names; or |\allbut| followed by a
873 list of division names.
874
875 * |\locators = {*loc1*,*loc2*,...}|
876
877 This parameter specifies the locators to be included in the index. The value
878 can be |\all|; a list of locators; or |\allbut| followed by a list of locators.
879 Each locator consists of the locator type followed by an optional colon and
880 format name. If a format name is not included, then the locator is formatted
881 according to the format with the same name as the locator.
882
883 * |\indexparams = {...}|
884
885 This parameter specifies index parameter statements to be included in the
886 index parameter file. See below for a description of the parameter
887 statements.
888
889 * |\position = {*options*}|
890
891 This parameter specifies the overall format of the index. It consists of a
892 sequence of the following options:
893
894 &= Option& Meaning
895 ----
896 & |\oneup|& Run index in one column.
897 & |\outline|& Format entries in outline style.
898 & |\runin|& Format entries in run-in (paragraph) style.
899 & |\threeup|& Run index in three columns.
900 & |\twoup|& Run index in two columns.
901 & |\usetextmeasure|& Use the text measure for the columns.
902 & |\usetextwidth|& Synonym for |\usetextmeasure|.
903 & |\usetypewidth|& Use the type area width for the columns.
904 &.
905 *.
906
907 === Entry Formatters
908
909 (To be supplied.)
910
911 == Raw Index Entry Files
912
913 ZzTeX populates raw index entry files as it encounters indexing locator
914 commands in the book files. Each indexing locator generates one raw entry
915 record in the file whose name is the same as the division with an extension
916 of |.zzi|. A raw entry record has the following format. The semicolon (|;|)
917 represents the field separator character hex B8, chosen because it cannot
918 appear in an index heading.
919
920 | *type*;*code*;*folio*;*main-head*;*subhead*;*sub-subhead*;*text*
921
922 The *code* is |S| for a single page entry, |B| for a begin page range entry,
923 or |E| for an end range entry.
924
925 == Index Parameter Files
926
927 (This material is highly technical and incomplete.)
928
929 An index parameter file contains a series of statements that specify
930 parameters for the index generator (zzindex2.exe). Each time an index is
931 generated, at least two parameter files are read:
932
933 * *index-name*.zzp&_The parameter file generated by the |\generateindex|
934 command for the specific index being generated.
935
936 * zzindex2.zzp&_A generic parameter file included with ZzTeX.
937 *.
938
939 Each statement in a parameter file has the following format:
940
941 | [*mode*] *keyword* *item* ... ;
942
943 The optional mode is enclosed in brackets and specifies the mode to which
944 the statement pertains. If the mode is not specified, the statement is used
945 in all modes. The items are separated by spaces. The statement ends with a
946 semicolon.
947
948 A parameter file may also contain blank lines and comment lines beginning
949 with |//|. Comment lines are ignored.
950
951 Statements that specify actions for tokens in headings include the token for
952 which the action is to be performed. A token can be one of the following:
953
954 &= Token& Meaning
955 ----
956 & |SP|& space
957 & |\SP|& TeX \<space> command
958 & |\*name*|& TeX |\*name*| command
959 & |\*c*|& TeX |\*c*| character command
960 & *x*& any other character
961 &.
962
963 The following statements can appear in an index parameter file.
964
965 * |begin-group *token* ;|
966
967 The token begins a group and is discarded. The mode stack is pushed with the
968 current mode.
969
970 * |define-format *format-text* ;|
971
972 (To be supplied.)
973
974 * |define-locator *definition-text* ;|
975
976 (To be supplied.)
977
978 * |[mode] discard *token* ;|
979
980 The token is discarded and does not appear in the canonicalized heading.
981
982 * |[mode] discard/u *token* ;|
983
984 The token is removed from the heading but suffixed to the canonicalized
985 heading.
986
987 * |divisions *divisions-text* ;|
988
989 This statement specifies the required divisions from the |\divisions| parameter
990 of the index design.
991
992 * |end-group *token* ;|
993
994 The token ends a group and is discarded. The mode stack is popped.
995
996 * |include-param *file* ;|
997
998 This statement requests that the named index parameter file be loaded.
999
1000 * |include-raw *file* ;|
1001
1002 This statement requests that the named raw index entry file be included in
1003 the set of raw index entry files.
1004
1005 * |index "*name*" ;|
1006
1007 This statement specifies the name of the index to be generated.
1008
1009 * |[mode] invalid *token* ;|
1010
1011 The token is invalid and an error message is produced.
1012
1013 * |[mode] keep *token* ;|
1014
1015 The token is preserved as is on the canonicalized heading.
1016
1017 * |locators *locators-text* ;|
1018
1019 This statement specifies the required locators from the |\locators| parameter
1020 of the index design.
1021
1022 * |math/u *token* ;|
1023
1024 The token begins or ends math mode. The mode stack is pushed or popped as
1025 appropriate. The token is suffixed to the canonicalized heading.
1026
1027 * |noise/u "*word*" ;|
1028
1029 If the word appears at the beginning of a subheading or sub-subheading, it
1030 is removed but suffixed to the canonicalized heading.
1031
1032 * |[mode] replace *token* "*text*" ;|
1033
1034 The token is discarded and replaced with the specified text, which is not
1035 rescanned.
1036
1037 * |[mode] replace/u *token* "*text*" ;|
1038
1039 The token is discarded and replaced with the specified text, which is not
1040 rescanned. The token is, however, suffixed to the canonicalized heading.
1041
1042 * |root "*name*" ;|
1043
1044 This statement specifies the name of the book's root file.
1045
1046 * |sort *mode* ;|
1047
1048 (To be supplied.)
1049
1050 * |[mode] synonym *token* "*text*" ;|
1051
1052 The token is discarded and replaced with the specified text, which is then
1053 rescanned.
1054 *.
1055
1056 // Letterspacing
1057 // -------------
1058
1059 .details letterspace_details \letterspace
1060 .template letterspace_details
1061 == Letterspacing
1062
1063 This tutorial describes the letterspacing facility in ZzTeX. All letterspacing
1064 is accomplished with the \letterspace command, which comes in two flavors:
1065
1066 | \letterspace{*amount*}{*text*}
1067
1068 This command letterspaces the specified text. The amount of letterspace is
1069 specified by the first argument, usually in ems.
1070
1071 | \letterspace{*amount*,*space*}{*text*}
1072
1073 This command operates like the first variant, except that the width of a
1074 space is specified explicitly after the letterspace amount.
1075
1076 Note that |\letterspace| commands are usually embedded in design macros in
1077 the design file. Rarely does one appear directly in book files. However, to
1078 code titles that will be letterspaced, the compositor needs to understand
1079 the behavior of the |\letterspace| command.
1080
1081 === What Happens Automatically
1082
1083 What a title or other text is letterspaced, the |\letterspace| command does
1084 the following things automatically:
1085
1086 * Inserts the letterspace amount between adjacent pairs of keyboarded
1087 characters (e.g, |AB|, |01|, |l.|). A "keyboarded character" is one that
1088 is typed on the keyboard, not coded like |\copyright| or |\alpha|.
1089
1090 * Replaces explicit spaces and tie characters (|~~|) with the space width
1091 derived from the first argument to the |\letterspace| command.
1092
1093 * Recognizes en dashes (|--|), em dashes (|---|), and double quotes (|``...''|)
1094 and does not break them apart with letterspace.
1095
1096 * Does *not* letterspace before or after ZzTeX commands, open braces (|{|), or
1097 close braces (|}|). This means that there will be no letterspacing around
1098 |\copyright|, |\ellipsis|, |\alpha|, |\times|, etc.
1099 *.
1100
1101 === Explicit Control of Letterspacing
1102
1103 The automatic rules take care of many letterspacing problems. However,
1104 sometimes you need explicit control over letterspacing, so the following
1105 commands can be used within a title that is letterspaced. If the same
1106 title is carried elsewhere (such as into a running head)
1107 but is not letterspaced there, these commands have no effect.
1108
1109 & |\lsp|& Insert a letterspace amount here.
1110 & |\lspspace|& Insert a letterspaced space here.
1111 & |\lspoff|& Turn off letterspacing completely.
1112 & |\lspon|& Restore letterspacing.
1113 &.
1114
1115 === An Example
1116
1117 The following diabolical example shows the power of the letterspacing
1118 facility. Here is a chapter title that is letterspaced:
1119
1120 \chapter{Text Access\titlenl; ``Methods''\titlenl;
1121 \lspoff$a-b'\times c$\lspon\lsp---Why~~Isn't It?}
1122
1123 This produces the following title, where the vertical bar represents a
1124 letterspace and the underscore represents a space:
1125
1126 & T&|e&|x&|t_A&|c&|c&|e&|s&|s
1127 & "&|M&|e&|t&|h&|o&|d&|s&|"
1128 & *a*&thinsp;-&thinsp;*b*&prime;&thinsp;&times;&thinsp;*c*&|---&|W&|h&|y_I&|s&|n&|'&|t_I&|t&|?
1129 &.
1130
1131 If this title is used in a running head or table of contents, the control
1132 commands |\lspoff|, |\lspon|, and |\lsp| are ignored (as well as |\titlenl|,
1133 of course). Note that the |\lsp| command is necessary to produce a
1134 letterspace before the em-dash, since letterspacing is automatically
1135 supressed after the |\lspon| command.
1136
1137 // Runners
1138 // -------
1139
1140 .phrase runners runners
1141 .synonym running heads
1142 .synonym running feet
1143 .template
1144 = Running Heads and Feet
1145
1146 Running heads and feet are collectively called *runners*. A design file can
1147 make use of multiple styles of runners. One is built into ZzTeX:
1148
1149 * |blind|&_A style with empty running heads and feet.
1150 *.
1151
1152 ZzTeX assumes the existence of two styles that must be defined in the
1153 design file:
1154
1155 * |normal|&_The style for normal body pages.
1156 * |chapter|&_the style for chapter opener pages.
1157 *.
1158
1159 Specific designs may use additional styles defined in the design file,
1160 for example:
1161
1162 * |part|&_The style for part opener pages.
1163 *.
1164
1165 For each style (except |blind|), the design file contains two definitions,
1166 one for the running head and one for the foot. These macros are responsible
1167 for formatting the header and footer, often using mark information to
1168 obtain chapter numbers, section titles, etc., and using |\folio| to obtain
1169 the page number:
1170
1171 \def \headernormalformat {...}
1172
1173 \def \footernormalformat {...}
1174
1175 \def \headerchapterformat {...}
1176
1177 \def \footerchapterformat {...}
1178
1179 == Runner Commands
1180
1181 The following commands are used to establish the runner styles
1182 for subsequent pages in the book.
1183
1184 ~foreach cmd, command_set;
1185 * |~.cmd;|
1186 ~end;
1187 *.
1188
1189 Those commands are lovely but rarely used explicitly, except in
1190 the front matter. Instead, runners are established using the |\runners|
1191 parameter of certain blocks.
1192
1193 == |\runners| Parameter
1194
1195 The |\runners| parameter is a design parameter for certain blocks in ZzTeX.
1196 It is usually specified in the design macros for those blocks in the design
1197 file, but you can override the normal styles by using the |\with| modifier on
1198 such blocks.
1199
1200 The following list specifies the blocks that use the |\runner| parameter to
1201 perform an implicit |\setrunners| command. Each entry shows the standard
1202 value of the parameter:
1203
1204 & |\part|& | \runners={blind,normal}|
1205 & |\quasipart|& |\runners={blind,normal}|
1206 & |\chapter|& |\runners={chapter,normal}|
1207 & |\quasichapter|& |\runners={chapter,normal}|
1208 & |\appendix|& |\runners={chapter,normal}|
1209 & |\float|& |\runners={normal}|
1210 &.
1211
1212 Imagine you had a quasichapter and you wanted to suppress the drop folio
1213 normally set by the chapter runners. You simply do the following:
1214
1215 \with{\runners={blind,normal}}
1216 \quasichapter{Weird Back Matter}
1217
1218 You must remember to specify a second style of |normal| for the remaining
1219 pages of the quasichapter or they will all have blind runners.
1220
1221 You can accomplish the same goal as follows:
1222
1223 \quasichapter{Weird Back Matter}
1224 \overriderunners{blind}
1225
1226 The |\float| block uses the |\runner| parameter to perform an implicit
1227 |\overriderunners| command.
1228 The float mechanism arranges to perform an |\overriderunners| with the
1229 style specified by the |\runner| parameter when it is about set a page
1230 containing *only floats*. If you want to suppress the running head on such a
1231 page:
1232
1233 \with{\runners={blind}}
1234 \float{figure}
1235
1236 However, see the |\userharea| block modifier for the best way to
1237 accomplish this.
1238
1239 == Some Examples
1240
1241 A book with a two-page-spread chapter opener could use the |\runners|
1242 parameter in the chapter design to set the correct runners for both
1243 opener pages:
1244
1245 \def \chapterdesign {%
1246 ...
1247 \def \paging {\freshpage{\short\floats\even}}%
1248 ...
1249 \runners = {blind,chapter,normal}%
1250 ...}
1251
1252 Some books have part pages but Chapter 1 occurs before Part I. If the
1253 running heads include the part number and title, that will probably fail in
1254 Chapter 1 because no part has been established. If the design file provides
1255 a special runners style |normalnopart| for such "part-less" chapters, you
1256 can use it quite easily:
1257
1258 \with{\runners={chapter,normalnopart}}
1259 \chapter{The First Chapter}
1260
1261 // \tabbing Block
1262 // -------- -----
1263
1264 .details tabbing_details \tabbing
1265 .template tabbing_details
1266 == Tabbing Facilities
1267
1268 This tutorial describes the ZzTeX tabbing facilities. The primary
1269 tabbing feature is the |\tabbing| block, which replaced the tabbing
1270 capability of the |\text| block in ZzTeX v17.2.
1271
1272 === The |\tabbing| Block
1273
1274 The |\tabbing| command has the following syntax:
1275
1276 | \tabbing{*type*}
1277 | *line of text*\nl
1278 | *another line*
1279 | &_*of text*\nl
1280 | ...
1281 | *last line of text*\nl
1282 | \endtabbing
1283
1284 The *type* argument specifies the type of the tabbing block and thus its
1285 design. A line in the typeset block can occupy multiple lines in the
1286 TeX file but must end with an |\nl| command. Line breaks in the file are
1287 not taken verbatim. The |\nl| after the final line is optional.
1288
1289 === Setting Tab Stops
1290
1291 There are two ways to set tab stops for the lines in a tabbing block.
1292 The first is to set uniform tab stops across the line. The distance
1293 between tab stops is specified by the |\defaulttabwidth| design
1294 parameter. If this parameter is a positive dimension, say, |14pt|,
1295 then tab stops are set every 14 points across the line.
1296
1297 The second method of setting tab stops is to include a *template line*
1298 at the beginning of the tabbing block. For example,
1299
1300 \tabbing{algorithm}
1301 @[email protected]@[email protected]@.@D
1302
1303 The |@C| command clears any existing tab stops. Each |@.| command
1304 sets a tab stop at the current width of the line. In this example,
1305 there will be a tab stop at the width of 5 |x| letters, 10 letters,
1306 15 letters, and 30 letters. The |@D| command discards the line
1307 so it doesn't show up on the page. The line exists only for the
1308 purpose of setting the stops.
1309
1310 === Tabbing
1311
1312 The |@>| command is used to tab from one tab stop to the next. In this
1313 example, assume that tab stops are set every 14 points.
1314
1315 \tabbing{algorithm}
1316 $\mvar{scores} = \{\}$\qquad // score accumulator maps doc IDs to scores\nl
1317 \For $w\in q$ \Do\nl
1318 @>\For $d, \mvar{count}\in \mvar{Idx}.\mvar{fetch}\_\mvar{docs}(w)$ \Do\nl
1319 @>@>$\mvar{scores}[d] = \mvar{scores}[d] + \mvar{score}\_\mvar{term}(\mvar{count})$
1320 @>\EndFor\nl
1321 \EndFor\nl
1322 \Return top $k$ documents from $\mvar{scores}$\nl
1323 \endtabbing
1324
1325 The third line is indented 14 points, the fourth line is indented 28 points, etc.
1326
1327 Note that each |@>| command tabs to the next tab stop in the sequence of stops,
1328 regardless of whether the width of the text is beyond that stop. If the width
1329 of the text is beyond the next stop, the text following that stop will overprint
1330 the preceding text.
1331
1332 === Vertical Adjustments
1333
1334 The are two ways to make vertical adjustments between lines of text.
1335 The first is to code a blank line:
1336
1337 \tabbing{algorithm}
1338 $\mvar{scores} = \{\}$\qquad // score accumulator maps doc IDs to scores\nl
1339 \nl
1340 \For $w\in q$ \Do\nl
1341
1342 A blank line produces the amount of vertical space specified by the
1343 |\tabbinggapskip| design parameter. This vertical space is usually
1344 less than a full line.
1345
1346 The second method of performaing a vertical adjustment is to use the
1347 |\adjusttabbing| command in between two lines. Try |~.facility; \adjusttabbing|
1348 for more information.
1349
1350 === Line Numbers
1351
1352 [To be supplied.]
1353
1354 // \tabular Block
1355 // -------- -----
1356
1357 .details tabular_details \tabular
1358 .template tabular_details subclass_set command tabular
1359 == Tabular Facilities, version 3
1360
1361 This tutorial describes the third generation of the ZzTeX tabular
1362 facilities. These facilities are used to produce tabular material in
1363 text or in a floating table.
1364
1365 First, some definitions:
1366
1367 * Cell.&_The intersection of each row and column is called a cell.
1368 The cell contains the text at that row/column intersection.
1369
1370 * Column.&_Tabular material is organized into vertical columns.
1371 Each column has a particular format, specified in the template.
1372
1373 * Gutter.&_The gutter is the horizontal space between columns. It is
1374 typically 1 pica and can stretch or shrink if tables are
1375 to be forced to a particular width. The gutter between two
1376 columns can be changed on a case-by-case basis.
1377
1378 * Interrow space.&_An extra amount of vertical space that is placed between
1379 rows of tabular material.
1380
1381 * Picture.&_A sequence of characters used to determine the alignment
1382 of decimal-aligned numeric columns.
1383
1384 * Row.&_Tabular material is organized into horizontal rows, with
1385
1386 * Ruled table.&_Tabular material that includes vertical rules.
1387
1388 * Template.&_An argument to the \tabular command that specifies the
1389 number of columns and the format for each column.
1390 *.
1391
1392 === The |\tabular| Command
1393
1394 The |\tabular| command has the following syntax:
1395
1396 | \tabular{*type*}{*template*}
1397 | *row* ... \cr
1398 | *row* ... \cr
1399 | ...
1400 | *row* ... \cr
1401 | \endtabular
1402
1403 The *type* argument specifies the type of the tabular block and thus its
1404 design. The *template* argument specifies the number of columns and their
1405 associated formats (see below).
1406
1407 Each row consists of a series of cells and is terminated by the |\cr| command
1408 ("carriage return" or "complete row"). The cells are specified as follows:
1409
1410 | *cell-1*&& *cell-2*&&&& *cell-4*&& ...&& *cell-n*\cr
1411
1412 There is one cell for each column and they are separated by ampersands
1413 (|&&|). It is important to eliminate any spaces *preceding* the ampersands,
1414 although spaces following them are fine. An empty cell is allowed, as with
1415 the third cell above.
1416
1417 In a ruled table, every cell in a row must be specified, although some may
1418 be empty (the cells corresponding to rule columns usually are). In a table
1419 that is not ruled, rightmost cells that are empty need not be specified.
1420
1421 === How ZzTeX Formats Tabular Material
1422
1423 ZzTeX goes through the following steps to format tabular material.
1424
1425 # The template is analyzed to check it, count the columns, and prepare the
1426 individual column formats.
1427
1428 # All rows are read and each cell is formatted in its own box.
1429
1430 # The maximum width of the cells in each column is determined, and all the
1431 cell boxes in that column are set to the maximum width. (See |\hidewidth| for
1432 an exception.)
1433
1434 # All the boxes in each row are set side by side, with the column gutter
1435 between them. The widths of the rows are forced to the specified overall
1436 table width, if required by the design. The extra space is placed in the
1437 gutters.
1438
1439 # The rows are butted together vertically, with no extra space between
1440 them.
1441 #.
1442
1443 There are some interesting implications of this scheme:
1444
1445 * Because every cell box in a column, except the widest, will not be filled
1446 with text, the template for each column must include at least one |\hfil|
1447 command to take up the slack. These |\hfil| commands are included in the
1448 builtin templates described below.
1449
1450 * Because there is no extra space between the rows, each row must occupy the
1451 full height and depth of the tabular body font, plus any interrow space.
1452 Otherwise the rows will not be spaced uniformly. It is this requirement that
1453 makes ruled tables tricky.
1454 *.
1455
1456 === The Template
1457
1458 The template argument to the |\tabular| command is coded as a sequence of
1459 format specifications, one for each column, in the desired order.
1460
1461 | \tabular{*type*}{@*x* @*y* ... @*z*}
1462
1463 The available column formats are specified as follows. Spaces and line
1464 breaks may appear in the template for readability.
1465
1466 * |@l|&_Single line; text flush left.
1467
1468 * |@c|&_Single line; text centered.
1469
1470 * |@r|&_Single line; text flush right.
1471
1472 * |@L{*picture*}|&_Decimal-aligned number; text flush left. See below.
1473
1474 * |@C{*picture*}|&_Decimal-aligned number; text centered.
1475
1476 * |@R{*picture*}|&_Decimal-aligned number; text flush right.
1477
1478 * |@p{*width*}|&_Text set in multiple lines as one or more
1479 paragraphs. The width of the line is specified.
1480 The raggedness, hang, and paragraph skip is
1481 determined by the design.
1482
1483 * |@e{*width*}|&_Empty column of the specified width.
1484
1485 * |@s{*sequence*}|&_Special custom column. See below.
1486
1487 * |@&||&_Column contains a vertical rule whose color and
1488 width are determined by the design. This is a real
1489 column that must be included in each row, but is
1490 normally empty.
1491
1492 * |@!{*color*}{*width*}|&_Column contains a vertical rule whose color and
1493 width are specified.
1494
1495 * |@>{*width*}|&_This template may appear following any of the
1496 above templates. It specifies the exact width of
1497 the gutter between the current column and the next,
1498 in place of the standard gutter determined by the
1499 design. Rule columns are surrounded by gutters half
1500 as wide as the standard, unless overridden with |@>|.
1501 If the width is follow by an asterisk (|&*|), then
1502 the gutter can vary in width according to the
1503 |\columngutter| parameter of the design.
1504 *.
1505
1506 === Decimal-Aligned Columns
1507
1508 Decimal-aligned column templates include a picture that determines how the
1509 cells are aligned. The picture is composed of the following characters:
1510
1511 & |0|& Represents a digit.
1512 & |.|& Specifies the position of the decimal point.
1513 & |,|& Indicates a comma in the number.
1514 & |$-$|& Indicates that the number may be preceded by a negative sign.
1515 & |(...)|& Indicates that the number may be surrounded by parentheses.
1516 &.
1517
1518 If there is no decimal point in the picture, the cells are aligned on the
1519 right. If there is a decimal point, they are aligned on the point. The
1520 difference between left-, center-, and right-aligned number columns is
1521 irrelevant unless a nonnumeric cell in the column is wider than the widest
1522 numeric cell. In this case the numeric cells are set flush left, center, or
1523 right on those wider cells. This happens when the column heads are wider
1524 than the numbers.
1525
1526 Because ZzTeX splits decimal-aligned numbers at their decimal points, it is
1527 necessary that both halves of the picture and of all the cell numbers
1528 be balanced with respect to braces and dollar signs.
1529
1530 === Special Custom Columns
1531
1532 A special custom column can be used to construct a complex column that
1533 contains boilerplate material. For example, imagine a left column in which
1534 all entries should be in italic and enclosed in parentheses. This column
1535 could be specified as follows:
1536
1537 | \tabular{table}{... @s{\emph{(#)}\hfil} ...}
1538 | ...& special& ...\cr
1539 | ...& critical& ...\cr
1540
1541 The two cells would appear in italic in this format:
1542
1543 | ... *(special)* ...
1544 | ... *(critical)* ...
1545
1546 Each cell is formatted by replacing the template sequence's sharp sign (|#|)
1547 with the text specified in the row cell, then using the resulting sequence as
1548 the final text of the cell. In the first row above, the final text would be
1549 |\emph{(special)}\hfil|. Note that the template includes an |\hfil| command to
1550 take up the slack and left-align the text. Don't forget the sharp sign and
1551 at least one |\hfil|.
1552
1553 === |\tabular| Tools
1554
1555 The following list includes all the tools that can be used with a |\tabular|
1556 block. You can explore these various commands to learn what they do.
1557
1558 ~foreach name, name_set;
1559 * |~.name;|
1560 ~end;
1561 *.
1562
1563 // \todo Block
1564 // ----- -----
1565
1566 .details todo_details \todo
1567 .template todo_details
1568 == To-Do Facility
1569
1570 The to-do facility allows you to place a
1571 reminder in a book file and optionally to typeset '???' to represent text
1572 that is still to come.
1573
1574 The \todo command has three forms. The first form is used most frequently.
1575
1576 | \todo{This math display needs to be cleaned up later.}
1577
1578 This command displays the message on your console and includes it in the log
1579 file. Processing continues without interruption. A summary of the number of
1580 to-do reminders is displayed at the end of the run.
1581
1582 | \todo{!Cannot continue until this table is formatted correctly.}
1583
1584 This variant includes the message in the log file, but then generates a
1585 warning message and halts execution. You can continue processing by
1586 pressing Enter. Use this variant to force a halt when the division is
1587 processed.
1588
1589 | \todo{?cover image credit}
1590
1591 This command is similar to the first variant, but also typesets a triple
1592 question mark (|???|) where the |\todo| appears. You can use this variant to set
1593 the standard triple question mark where text will be supplied later.
1594
1595 To obtain a list of all the outstanding to-dos, try |~.facility; to-dos|.
1596
1597 .end