Imported Upstream version 1.22.4
[platform/upstream/groff.git] / contrib / mom / momdoc / tables-of-contents.html
1 <?xml version="1.0" encoding="utf-8"?>
2 <!--
3 This file is part of groff, the GNU roff type-setting system.
4
5 Copyright (C) 2004-2018 Free Software Foundation, Inc.
6 Written by Peter Schaffter (peter@schaffter.ca).
7
8 Permission is granted to copy, distribute and/or modify this document
9 under the terms of the GNU Free Documentation License, Version 1.3 or
10 any later version published by the Free Software Foundation; with no
11 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
12 Texts.
13
14 A copy of the Free Documentation License is included as a file called
15 FDL in the main directory of the groff source package.
16 -->
17
18 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
19 <html xmlns="http://www.w3.org/1999/xhtml">
20
21 <head>
22   <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
23   <title>Mom -- Document processing, tables of contents</title>
24   <link rel="stylesheet" type="text/css" href="stylesheet.css" />
25 </head>
26
27 <body style="background-color: #f5faff;">
28
29 <!-- ==================================================================== -->
30
31 <div id="top" class="page">
32
33 <!-- Navigation links -->
34 <table style="width: 100%;">
35 <tr>
36   <td><a href="toc.html">Back to Table of Contents</a></td>
37   <td style="text-align: right;"><a href="refer.html#top">Next: Bibliographies and references</a></td>
38 </tr>
39 </table>
40
41 <h1 class="docs">Tables of contents</h1>
42
43 <div style="width: 68%; margin: auto;">
44 <ul class="no-enumerator">
45   <li><a href="#toc-intro">Introduction to tables of contents</a>
46   <li><a href="#toc-appearance">Tables of contents appearance and behaviour</a></li>
47   <li><a href="#pdf-output">PDF output</a>
48   <ul style="margin-left: -.5em; list-style-type: disc;">
49     <li><a href="#positioning">Positioning the table of contents</a>
50     <li><a href="#auto-relocate-toc">AUTO_RELOCATE_TOC</a></li>
51     <li><a href="#psselect"><kbd>psselect</kbd></a></li>
52   </ul></li>
53   <li><a href="#toc">The TOC macro</a></li>
54   <li><a href="#toc-control-top">Control macros for tables of contents</a>
55   <ul style="margin-left: -.5em; list-style-type: disc;">
56     <li><a href="#index-toc-control">Table of contents control macros</a></li>
57   </ul></li>
58 </ul>
59 </div>
60
61 <div class="rule-medium"><hr/></div>
62
63 <h2 id="toc-intro" class="docs">Introduction to tables of contents</h2>
64
65 <p>
66 Want a table of contents for your document?  Easy.  Just enter
67 <br/>
68 <span class="pre-in-pp">
69   .TOC
70 </span>
71 as the very last macro of your document file. Mom will have picked
72 up all document titles (in
73 <a href="rectoverso.html#collate">collated</a>
74 documents) and headings, as well as the endnotes section and
75 bibliography, if they exist, and assigned them the appropriate page
76 number.  Talk about a no-brainer!
77 </p>
78
79 <p>
80 That said, tables of contents have even more control macros than
81 endnotes.  As always, the reason for so many control macros is so
82 that if you want to change just about any aspect of the table of
83 contents&#8217; typographic appearance, you can.
84 </p>
85
86 <h2 id="toc-appearance" class="docs">Tables of contents appearance and behaviour</h2>
87
88 <p>
89 When you output a table of contents (with
90 <kbd><a href="#toc">.TOC</a></kbd>),
91 mom finishes processing the last page of your document, then breaks
92 to a new page for printing the table of contents.
93 </p>
94
95 <p>
96 Mom follows standard typesetting conventions for tables of contents.
97 To this end, if
98 <a href="headfootpage.html#headers">HEADERS</a>
99 are enabled for the document, the first page of the table of
100 contents has no page header, but does have a first page number
101 (roman numeral), always &#8220;i&#8221;, in the bottom margin.  If
102 <a href="headfootpage.html#footers">FOOTERS</a>
103 are enabled for the document, the first page has neither a footer,
104 nor a page number in the top margin.  (If you absolutely must have
105 a page footer on the first page of the table of contents, simply
106 invoke
107 <a href="headfootpage.html#footer-on-first-page"><kbd>.FOOTER_ON_FIRST_PAGE</kbd></a>
108 immediately before <kbd>.TOC</kbd>.)  Subsequent table of contents
109 pages have both page headers or footers and a page number.
110 </p>
111
112 <p>
113 Entries in a table of contents are hierarchically indented, as you
114 would expect, and if headings are numbered in the body of the document,
115 you can instruct mom to number them in the table of contents as
116 well (see
117 <a href="#toc-entry-numbers">TOC_ENTRY_NUMBERS</a>).
118 </p>
119
120 <p>
121 Tables of contents are never set in columns, regardless of whether
122 the rest of the document is.  Lastly, if
123 <a href="rectoverso.html#recto-verso">recto/verso</a>
124 printing is enabled, the table of contents respects it.  This
125 sometimes leads to tables of contents that begin with the wrong
126 margins, but the margins can be corrected either by outputting a
127 <a href="headfootpage.html#blank-pages">BLANKPAGE</a>
128 or by using the control macro
129 <a href="#toc-rv-switch">TOC_RV_SWITCH</a>.
130 </p>
131
132 <p>
133 The overall table of contents 
134 <a href="definitions.html#family">family</a>,
135 <a href="definitions.html#ps">point size</a>
136 and
137 <a href="definitions.html#leading">lead</a>
138 can be altered with
139 <a href="definitions.html#controlmacro">control macros</a>,
140 as can the family,
141 <a href="definitions.html#font">font</a>,
142 point size and indent of each level of entry.  Furthermore, the page
143 numbering style can be changed, as can the amount of visual space
144 reserved for entry page numbers.
145 </p>
146
147 <h2 id="pdf-output" class="docs">PDF output</h2>
148
149 <p>
150 When files containing a table of contents are processed with
151 <a href="using.html#pdfmom" style="font-weight: bold">pdfmom</a>,
152 entries in the table of contents are clickable links when the
153 document is viewed at the screen.  The colour of the links is the
154 last <kbd>.PDF_LINK_COLOR</kbd> in effect, so if you wish another
155 colour, it should be set just before issuing <kbd>.TOC</kbd>.
156 </p>
157
158 <p>
159 When preparing files for printing, coloured links in both the table
160 of contents and elsewhere in the document may not be desirable.
161 You can disable the colour by passing
162 <a href="using.html#pdfmom" style="font-weight: bold">pdfmom</a>
163 the <kbd>-c</kbd> option, like this: <br/>
164 <span class="pre-in-pp">
165    pdfmom -c doc.mom &gt; doc.pdf
166 </span>
167 </p>
168
169 <h3 id="positioning" class="docs">Positioning the Table of Contents</h3>
170
171 <p>
172 Because a table of contents can&#8217;t be generated until the
173 end of a document (hence the last macro in the file), it is also
174 the last page of the document.  While this is desirable for some
175 language conventions&mdash;French, for example&mdash;it is not
176 desirable for others.
177 </p>
178
179 <h4 id="auto-relocate-toc" class="docs">Automatic PDF relocation of the Table of Contents</h4>
180
181 <p>
182 When
183 <a href="using.html#pdfmom" style="font-weight: bold">pdfmom</a>
184 is used to process files with a table of contents, the macro
185 <kbd>.AUTO_RELOCATE_TOC</kbd> can be used to reposition the table
186 of contents to the top of the output document, with the presence
187 of a cover and/or title page sensibly taken into account.  Full
188 AUTO_RELOCATE_TOC usage is described in the manual,
189 <a href="http://www.schaffter.ca/mom/pdf/mom-pdf.pdf"><span class="book-title">Producing PDFs with groff and mom</span></a>.
190 </p>
191
192 <p>
193 In order to take advantage of automatic table of contents
194 repositioning, you must use
195 <a href="using.html#pdfmom" style="font-weight: bold">pdfmom</a>.
196 with groff&#8217;s native PDF driver (ie without the
197 <strong>-Tps</strong> flag).  Files that need to be processed with
198 the <strong>-Tps</strong> flag require you to reposition the table
199 of contents yourself with <strong>psselect</strong>, described
200 below.
201 </p>
202
203 <div class="box-tip">
204 <p class="tip">
205 <span class="note">Note:</span>
206 Note: <kbd>.AUTO_RELOCATE_TOC</kbd> must come before
207 <a href="docprocessing.html#start">START</a>.
208 </p>
209 </div>
210
211 <h4 id="psselect" class="docs"><span style="text-transform: none">Using psselect to relocate the Table of Contents in PostScript documents</span></h4>
212
213 <p>
214 To change the location of the table of contents in files
215 processed with <kbd>pdfmom -Tps</kbd>, you have two choices:
216 rearrange the pages by hand (okay for one or two hard copies),
217 or use the <strong>psselect</strong> programme provided by the
218 <strong>psutils</strong> suite of tools (which you may have to
219 install as a package from your distribution if it is not already on
220 your system).
221 </p>
222
223 <p>
224 The procedure for using <strong>psselect</strong> to put the
225 table of contents near the beginning of a document begins by
226 you determining how many pages it contains.  You can do this by
227 previewing the document with the document viewer of your choice
228 (gv, Okular, Evince, etc).
229 </p>
230
231 <p>
232 Once you know the number of pages in the table of contents, you use
233 <strong>psselect</strong> to place them where you want.
234 </p>
235
236 <p>
237 Say, for example, the table of contents runs to just one page.  The
238 command to place a one-page table of contents at the start of a
239 document is:
240 <br/>
241 <span class="pre-in-pp">
242    psselect -p _1,1-_2 
243 </span>
244 The <kbd>-p</kbd> option instructs <kbd>psselect</kbd> that what
245 follows is a comma-separated list of the order in which you want
246 pages of a document rearranged.  The underscore character means
247 "counting backwards from the end of the document".  Thus, the above
248 says: "Put the last page first (ie the table of contents), followed
249 by all pages from the original first page up to the second to last
250 (ie the last page before the table of contents)."
251 </p>
252
253 <p>
254 If your table of contents runs to two pages, the option to
255 <kbd>psselect</kbd> would look like this:
256 <br/>
257 <span class="pre-in-pp">
258    psselect -p _1-_2,1-_3
259 </span>
260 If your table of contents runs to two pages and you have a cover
261 page, the command would look like this:
262 <br/>
263 <span class="pre-in-pp">
264    psselect -p 1,_1-_2,2-_3
265 </span>
266 </p>
267
268 <div class="box-tip">
269 <p class="tip">
270 <span class="note">Note:</span>
271 <kbd>psselect</kbd> outputs to stdout, so you have to redirect the
272 output to a new file.
273 <br/>
274 <span class="pre-in-pp" style="margin-bottom: -1em">
275   psselect -p &lt;page list&gt; &lt;file&gt;.ps &gt; &lt;new-file&gt;.ps
276 </span>
277 </p>
278 </div>
279
280 <!-- -TOC- -->
281
282 <div class="macro-id-overline">
283 <h3 id="toc" class="macro-id">The TOC macro</h3>
284 </div>
285
286 <div class="box-macro-args">
287 Macro: <b>TOC</b> <kbd class="macro-args">[ INCLUDE_TITLE ]</kbd>
288 </div>
289
290 <p>
291 If you want a table of contents, just place <kbd>.TOC</kbd> at the
292 very end of your document.  Mom takes care of the rest.
293 </p>
294
295 <p>
296 The optional argument, <kbd>INCLUDE_TITLE</kbd>, is needed only
297 if your document is standalone, i.e. is not collated, for example
298 an essay.  By default, mom does not include the title (and page
299 number) of standalone documents in the Table of Contents since it
300 is largely redundant.  If you would like her to include the title,
301 invoke <kbd>.TOC</kbd> with <kbd>INCLUDE_TITLE</kbd>.
302 </p>
303
304 <div class="box-tip">
305 <p class="tip">
306 <span class="note">Note:</span>
307 If the last line of text in a document, before <kbd>.TOC</kbd>,
308 falls too close to the bottom margin, or if the line is followed
309 by a macro likely to cause a linebreak (e.g., <kbd>.LIST OFF</kbd> or
310 <kbd>.IQ</kbd>), mom may output a superfluous blank page before the
311 Table of Contents.
312 </p>
313
314 <p class="tip-bottom">
315 In order to avoid this, insert
316 <a href="typesetting.html#el"><kbd>.EL</kbd></a>
317 after the last line of text, before <kbd>.TOC</kbd> and/or any
318 concluding macros.  For example,
319 <br/>
320 <span class="pre-in-pp">
321   some concluding text.
322   .EL
323   .TOC
324 </span>
325 or
326 <br/>
327 <span class="pre-in-pp">
328   some concluding text.
329   .EL
330   .LIST OFF
331   .TOC
332 </span>
333 </p>
334 </div>
335
336 <div class="rule-short"><hr/></div>
337
338 <h2 id="toc-control-top" class="macro-group">Control macros for tables of contents</h2>
339
340 <p>
341 Aside from allowing you to set the style of table of contents
342 entries on a per-level basis, the control macros let you design
343 the table of contents as if they were a complete document unto
344 themselves (overall family, headers/footers, pagination, etc).
345 </p>
346
347 <div class="defaults-container" style="background-color: #ded4bd; border: none;">
348 <h3 id="index-toc-control" class="docs defaults">Table of contents control macros</h3>
349
350 <ol style="margin-top: .5em; padding-bottom: .5em;">
351   <li><a href="#toc-general">General table of contents style control</a>
352   <ul style="margin-left: -.5em;">
353     <li><a href="#toc-family">TOC_FAMILY</a> &ndash; base family for tables of contents</li>
354     <li><a href="#toc-pt-size">TOC_PT_SIZE</a> &ndash; base point size for tables of contents</li>
355     <li><a href="#toc-lead">TOC_LEAD</a> &ndash; leading of tables of contents</li>
356   </ul></li>
357   <li><a href="#toc-pagenumbering">Page numbering</a>
358   <ul style="margin-left: -.5em;">
359     <li><a href="#paginate-toc">PAGINATE_TOC</a> &ndash; turn table of contents pagination on or off</li>
360     <li><a href="#toc-pagenum-style">TOC_PAGENUM_STYLE</a> &ndash; table of contents page numbering style</li>
361   </ul></li>
362   <li><a href="#toc-header">Header string (e.g., &#8220;Contents&#8221;) and style</a>
363   <ul style="margin-left: -.5em;">
364     <li><a href="#toc-header-string">Changing the header string</a></li>
365     <li><a href="#toc-header-v-pos">Header string vertical placement</a></li>
366     <li><a href="#toc-header-style">Header string control macros and defaults</a></li>
367     </li>
368   </ul></li>
369   <li><a href="#toc-style">Entries and reference page number style</a>
370   <ul style="margin-left: -.5em;">
371     <li><a href="#toc-pn">Reference page numbers style control</a></li>
372     <li><a href="#toc-title-style">Title entry style control</a></li>
373     <li><a href="#toc-entry-style">Heading entry style control</a></li>
374     <li>Numbering table of contents items
375     <ul style="margin-left: -.75em; list-style: disc">
376       <li><a href="#toc-prefix-ch-number">Prefix chapter/section numbers</a>
377       <ul style="margin-left: -.75em;">
378         <li><a href="#toc-pad-ch-numbers">Pad chapter/section numbers</a></li>
379       </ul></li>
380       <li><a href="#toc-entry-numbers">Numbering heading entries</a></li>
381     </ul></li>
382   </ul></li>
383   <li><a href="#toc-additional">Additional table of contents control macros</a>
384   <ul style="margin-left: -.5em;">
385     <li><a href="#toc-appends-author">Append author(s) to table of contents title entries</a></li>
386     <li><a href="#toc-title-entry">Alter the wording of a table of contents title entry</a></li>
387     <li><a href="#space-toc-items">Space table of contents entries pleasingly</a></li>
388     <li><a href="#toc-padding">Establish the number of placeholders to leave for page reference numbers</a></li>
389     <li><a href="#toc-rv-switch">Switch tables of contents page margins</a></li>
390   </ul></li>
391   <li><a href="#toc-more">I still need more!</a></li>
392 </ol>
393 </div>
394
395 <h4 id="toc-general" class="docs" style="margin-top: -1.5em; margin-bottom: .5em;">1. General tables of contents style control</h4>
396
397 <!-- -TOC_FAMILY- -->
398
399 <div id="toc-family" class="box-macro-args">
400 Macro: <b>TOC_FAMILY</b> <kbd class="macro-args">&lt;family&gt;</kbd>
401 </div>
402
403 <p>
404 TOC_FAMILY establishes the default family for every page element in
405 a table of contents, including the table of contents&#8217; header
406 string (by default, &#8220;Contents&#8221;) and the page
407 number in the top or bottom margin.  The default is the prevailing
408 document family.
409 </p>
410
411 <p>
412 All page elements in the table of contents also have their own
413 _FAMILY control macros, which can be used on a case-by-case basis to
414 override the default family set with TOC_FAMILY.
415 </p>
416
417 <!-- -TOC_PT_SIZE- -->
418
419 <div id="toc-pt-size" class="box-macro-args">
420 Macro: <b>TOC_PT_SIZE</b> <kbd class="macro-args">&lt;base type size of the toc&gt;</kbd>
421 </div>
422
423 <p class="requires">
424 &bull;&nbsp;Does not require a <a href="definitions.html#unitofmeasure">unit of measure</a>; points is assumed
425 </p>
426
427 <p>
428 Unlike most other control macros that deal with size of document
429 elements, TOC_PT_SIZE takes as its argument an absolute value,
430 relative to nothing.  (Compare this with the
431 <a href="docelement.html#point-size">_SIZE</a>
432 control macros.)  The argument represents the base point size
433 of tables of contents from which the size of all other table of
434 contents elements are calculated.
435 </p>
436
437 <p>
438 The default for
439 <a href="docprocessing.html#printstyle">PRINTSTYLE <kbd>TYPESET</kbd></a>
440 is 12.5 points (the same default size used in the body of the
441 document).
442 </p>
443
444 <!-- -TOC_LEAD- -->
445
446 <div id="toc-lead" class="box-macro-args">
447 Macro: <b>TOC_LEAD</b> <kbd class="macro-args">&lt;leading of the toc&gt; [ ADJUST ]</kbd>
448 </div>
449
450 <p class="requires">
451 &bull;&nbsp;Does not require a <a href="definitions.html#unitofmeasure">unit of measure</a>; points is assumed
452 </p>
453
454 <p>
455 Unlike most other control macros that deal with leading of document
456 elements, TOC_LEAD takes as its argument an absolute value, relative
457 to nothing.  Therefore, the argument represents the
458 <a href="definitions.html#leading">leading</a>
459 of tables of contents in
460 <a href="definitions.html#picaspoints">points</a>
461 unless you append an alternative
462 <a href="definitions.html#unitofmeasure">unit of measure</a>.
463 For example,
464 <br/>
465 <span class="pre-in-pp">
466   .TOC_LEAD 14
467 </span>
468 sets the base leading of tables of contents to 14 points, whereas
469 <br/>
470 <span class="pre-in-pp">
471   .TOC_LEAD .5i
472 </span>
473 sets the base leading of tables of contents to 1/2 inch.
474 </p>
475
476 <p>
477 If you want the leading of tables of contents adjusted to fill the
478 page, pass TOC_LEAD the optional argument <kbd>ADJUST</kbd>.  (See
479 <a href="docprocessing.html#doc-lead-adjust">DOC_LEAD_ADJUST</a>
480 for an explanation of leading adjustment.)
481 </p>
482
483 <p>
484 The default for
485 <a href="docprocessing.html#printstyle">PRINTSTYLE TYPESET</a>
486 is the prevailing document lead (16 by default), adjusted.
487 </p>
488
489 <div class="box-tip">
490 <p class="tip">
491 <span class="note">Note:</span>
492 Even if you give mom a <kbd>.DOC_LEAD_ADJUST&nbsp;OFF</kbd> command,
493 she will still, by default, adjust the leading of the table of
494 contents.  You <i>must</i> enter
495 <kbd>TOC_LEAD&nbsp;&lt;lead&gt;</kbd> with no <kbd>ADJUST</kbd>
496 argument to disable this default behaviour.
497 </p>
498
499 <p class="tip-bottom">
500 <span class="additional-note">Additional note:</span>
501 Tables of contents are always double-spaced in
502 <a href="docprocessing.html#printstyle">PRINTSTYLE <kbd>TYPEWRITE</kbd></a>,
503 regardless of whether the body of the document is single-spaced.
504 </p>
505 </div>
506
507 <h4 id="toc-pagenumbering" class="docs">2. Page numbering</h4>
508
509 <p>
510 The pagination style of tables of contents is controlled by the same
511 macros that control
512 <a href="headfootpage.html#pagination-intro">document page numbering</a>,
513 except
514 <a href="headfootpage.html#pagenum">PAGENUM</a>
515 (tables of contents always start on page 1).  The defaults are the
516 same as for the rest of the document, with the exception that tables
517 of contents, by default, have roman numeral page numbers.
518 </p>
519
520 <p>
521 Therefore, if you wish to change some aspect of table of contents
522 pagination style, use the
523 <a href="headfootpage.html#index-pagination-control">document pagination control macros</a>
524 immediately prior to <kbd>.TOC</kbd>.
525 </p>
526
527 <p>
528 A special macro
529 <kbd><a href="#toc-pagenum-style">TOC_PAGENUM_STYLE</a></kbd>
530 controls the style of table of contents pagination (ie the actual
531 table of contents pages' numbers, not the page number references of
532 entries).
533 </p>
534
535 <!-- -PAGINATE_TOC- -->
536
537 <div id="paginate-toc" class="box-macro-args">
538 Macro: <b>PAGINATE_TOC</b> <kbd class="macro-args">&lt;toggle&gt;</kbd>
539 </div>
540
541 <p>
542 By default, mom paginates tables of contents.  If you&#8217;d like
543 her not to, do
544 <br/>
545 <span class="pre-in-pp">
546   .PAGINATE_TOC OFF
547 </span>
548 (or <kbd>NO, X,</kbd> etc).
549 </p>
550
551 <div class="box-tip">
552 <p class="tip">
553 <span class="note">Note:</span>
554 Simply invoking
555 <kbd>.PAGINATION&nbsp;OFF</kbd>
556 or
557 <kbd>.PAGINATE&nbsp;OFF</kbd>
558 disables table of contents pagination <i>for the first
559 page of the table of contents only.</i> You must use
560 <kbd>.PAGINATE_TOC&nbsp;OFF</kbd> to disable table of contents
561 pagination completely, even if pagination is turned off elsewhere in
562 your document.
563 </p>
564 </div>
565
566 <!-- -TOC_PAGENUM_STYLE- -->
567
568 <div id="toc-pagenum-style" class="box-macro-args">
569 Macro: <b>TOC_PAGENUM_STYLE</b> <kbd class="macro-args">&lt;DIGIT | ROMAN | roman | ALPHA | alpha&gt;</kbd>
570 </div>
571 <p class="requires">
572 See
573 <a href="headfootpage.html#pagenum-style"><span style="font-style: normal;">PAGENUM_STYLE</span></a>
574 for an explanation of the arguments.
575 </p>
576
577 <p>
578 By default, mom uses roman numerals to number table of contents
579 pages.  Use TOC_PAGENUM_STYLE if you&#8217;d prefer something else.
580 For example, to have standard digits instead of roman numerals, do
581 the following:
582 <br/>
583 <span class="pre-in-pp">
584   .TOC_PAGENUM_STYLE DIGIT
585 </span>
586 </p>
587
588 <h4 id="toc-header" class="docs" style="margin-top: -.5em;">3. Header string and style</h4>
589
590 <p>
591 The table of contents header string is the title that appears at to top of the
592 table of contents.  By default, it&#8217;s &#8220;Contents&#8221;.</p>
593
594 <div id="toc-header-string" class="box-macro-args">
595 Macro: <b>TOC_HEADER_STRING</b> <kbd class="macro-args">&lt;string&gt;</kbd>
596 </div>
597
598 <p>
599 If you&#8217;d like the title of the table of contents to read
600 something other than &#8220;Contents&#8221;, do, for
601 example
602 <br/>
603 <span class="pre-in-pp">
604   .TOC_HEADER_STRING "Table of Contents"
605 </span>
606 </p>
607
608 <h5 id="toc-header-v-pos" class="docs" style="margin-top: 1em; text-transform: none;">Header string vertical placement</h5>
609
610 <div id="toc-header-v-pos" class="box-macro-args" style="margin-top: 1em">
611 Macro: <b>TOC_HEADER_V_POS</b> <kbd class="macro-args">&lt;distance from top of page&gt;</kbd>
612 </div>
613 <p class="requires">
614 &bull;&nbsp;Requires a <a href="definitions.html#unitofmeasure">unit of measure</a>
615 </p>
616
617 <p>
618 Normally, the TOC header string falls at the same vertical position
619 as the
620 <a href="definitions.html#docheader">docheader</a>.
621 If you&#8217;d like it to fall at a different position, say 2 inches, use
622 <br/>
623 <span class="pre-in-pp">
624   .TOC_HEADER_V_POS 2i
625 </span>
626 </p>
627
628 <h5 id="toc-header-style" class="docs" style="margin-top: -.5em; text-transform: none;">Header string control macros and defaults</h5>
629
630 <div class="defaults-container" style="margin-top: 1em; padding-bottom: 8px;">
631 <p class="defaults" style="padding-top: 6px;">
632 See
633 <a href="docelement.html#control-macro-args">Arguments to the control macros</a>.
634 <br/>
635 The following TOC_HEADER control macros may also be
636 <a href="#grouping">grouped</a>
637 using TOC_HEADER_STYLE.
638 </p>
639 <span class="pre defaults">
640 .TOC_HEADER_FAMILY  default = prevailing doc family 
641 .TOC_HEADER_FONT    default = bold
642 .TOC_HEADER_SIZE    default = +4
643 .TOC_HEADER_QUAD    default = left
644 .TOC_HEADER_COLOR   default = black
645 .TOC_HEADER_CAPS       default = no
646 .TOC_HEADER_SMALLCAPS  default = no
647 .TOC_HEADER_UNDERSCORE default = none
648 </span>
649 </div>
650
651 <h4 id="toc-style" class="docs" style="margin-top: -.5em;">4. Entries and reference page numbers style</h4>
652
653 <p>
654 &#8220;Entries&#8221; refers to the hierarchical arrangement of
655 section titles (in
656 <a href="rectoverso.html#collate-intro">collated</a>
657 documents) and headings as they appear in the table of contents:
658 <span class="pre-in-pp">
659   Section title
660     Head level 1
661       Head level 2
662         Head level 3
663           ...
664 </span>
665 The style for title entries (e.g., chapter numbers or titles) and
666 heading levels is controlled by
667 <a href="#toc-title-style">TOC_TITLE_STYLE </a>
668 and
669 <a href="#toc-entry-style">TOC_ENTRY_STYLE</a>
670 respectively.
671 </p>
672
673 <p id="toc-pn">
674 &#8220;Reference page numbers&#8221; means the page numbers
675 associated with entries.  Macros to control their style take the
676 form <kbd>.TOC_PN_&lt;SPEC&gt;</kbd>, and the defaults are listed
677 here.
678 </p>
679
680 <div class="defaults-container" style="margin-top: 1em; padding-bottom: 8px;">
681 <p class="defaults" style="padding-top: 6px;">
682 See
683 <a href="docelement.html#control-macro-args">Arguments to the control macros</a>.
684 </p>
685
686 <span class="pre defaults">
687 .TOC_PN_FAMILY  default = prevailing doc family 
688 .TOC_PN_FONT    default = roman
689 .TOC_PN_SIZE    default = 0
690 </span>
691 </div>
692 </p>
693
694 <!-- -TOC_TITLE_STYLE- -->
695
696 <div id="toc-title-style" class="box-macro-args">
697 Macro: <b>TOC_TITLE_STYLE</b> <kbd class="macro-args">&lt;see below for args&gt;</kbd>
698 </div>
699
700 <p>
701 TOC_TITLE_STYLE allows you to set all the style parameters for
702 title entries in the tables of contents with one macro.  The
703 number of arguments can run long, so you may want to break them into
704 several lines with the backslash character (<kbd>\</kbd>).  The
705 arguments are:
706 <br/>
707 <span class="pre-in-pp">
708   FAMILY &lt;family&gt;
709   FONT &lt;font&gt;
710   SIZE +|-&lt;n&gt;
711   COLOR &lt;color&gt;
712   INDENT &lt;amount&gt;
713   CAPS | NO_CAPS
714 </span>
715 The arguments may be entered in any order.
716 </p>
717
718 <p>
719 The family, font, size, and color arguments behave identically
720 to the individual control macros that govern other tags, therefore see
721 <a href="docelement.html#control-macro-args">Arguments to the control macros</a>
722 for usage.  Their defaults are the same as for paragraphs in
723 <a href="definitions.html#running">running text</a>.
724 </p>
725
726 <p>
727 <kbd>INDENT</kbd> lets you indent title entries by the amount specified, and
728 requires a
729 <a href="definitions.html#unitofmeasure">unit of measure</a>.
730 The default is zero.
731 </p>
732
733 <p>
734 <kbd>CAPS</kbd> instructs mom to capitalize title entries.
735 Capitalization may be enabled or disabled on a per-entry-level
736 basis.
737 </p>
738
739 <p>
740 As an example, if you want title entries bold, slightly larger than other
741 entries and capitalized, you could do either
742 <br/>
743 <span class="pre-in-pp">
744   .TOC_TITLE_ENTRY FONT B SIZE +.5 CAPS
745 </span>
746 or
747 <br/>
748 <span class="pre-in-pp">
749   .TOC_TITLE_ENTRY \
750    FONT B \
751    SIZE +.5 \
752    CAPS
753 </span>
754 </p>
755
756 <!-- -TOC_ENTRY_STYLE- -->
757
758 <div id="toc-entry-style" class="box-macro-args">
759 Macro: <b>TOC_ENTRY_STYLE</b> <kbd class="macro-args">&lt;level&gt; &lt;see below for remaining args&gt;</kbd>
760 </div>
761
762 <p>
763 TOC_ENTRY_STYLE allows you to set individually all the style
764 parameters for any level of entry (beneath titles) in the tables
765 of contents.  The number of arguments can run long, so you may
766 want to break them into several lines with the backslash character
767 (<kbd>\</kbd>).
768 </p>
769
770 <p>
771 <kbd>&lt;level&gt;</kbd> corresponds to a
772 <a href="docelement.html#heading">HEADING</a>
773 level assigned in the body of the document.  The remaining arguments
774 are as follows.
775 <br/>
776 <span class="pre-in-pp">
777   FAMILY &lt;family&gt;
778   FONT &lt;font&gt;
779   SIZE +|-&lt;n&gt;
780   COLOR &lt;color&gt;
781   INDENT &lt;amount&gt;
782   CAPS | NO_CAPS
783 </span>
784 The arguments may be entered in any order.
785 </p>
786
787 <p>
788 The family, font, size, and color arguments behave identically
789 to the individual control macros that govern other tags, therefore see
790 <a href="docelement.html#control-macro-args">Arguments to the control macros</a>
791 for usage.  Their defaults are the same as for paragraphs in
792 <a href="definitions.html#running">running text</a>.
793 </p>
794
795 <p>
796 <kbd>INDENT</kbd> lets you indent entries by the amount specified, and
797 requires a
798 <a href="definitions.html#unitofmeasure">unit of measure</a>.
799 Mom sensibly indents and aligns all levels of entry.  If you change
800 the indent for any level, all levels beneath it are still indented
801 according to mom&#8217;s normal arrangement, but with the indent
802 assigned to <kbd>level</kbd> taken into account.  When you use
803 <kbd>INDENT</kbd>, the indent is measured from the left margin of
804 the entire text of the previous level, including numbering, if any.
805 </p>
806
807 <p>
808 <kbd>CAPS</kbd> instructs mom to capitalize title entries.
809 Capitalization may be enabled or disabled on a per-title basis.
810 </p>
811
812 <p>
813 As an example, if you want a particular entry level, say
814 &#8220;2&#8221;, to be in Helvetica, italics, and slightly larger
815 than other entries, you could do either
816 <br/>
817 <span class="pre-in-pp">
818   .TOC_ENTRY_STYLE 2 FAMILY H FONT I SIZE +.25
819 </span>
820 or
821 <br/>
822 <span class="pre-in-pp">
823   .TOC_ENTRY_STYLE 2 \
824    FAMILY H
825    FONT I \
826    SIZE +.25
827 </span>
828 </p>
829
830 <!-- -PREFIX_CHAPTER_NUMBERS- -->
831
832 <div id="toc-prefix-ch-number" class="box-macro-args">
833 Macro: <b>TOC_PREFIX_CHAPTER_NUMBER</b> <kbd class="macro-args">&lt;none&gt; &lt;anything&gt;</kbd>
834 </div>
835 <p class="alias" style="margin-bottom: 0;">
836 <i>Alias:</i> <b>TOC_PREFIX_SECTION_NUMBER</b>
837 </p>
838
839 <p>
840 By default, mom does not prefix a chapter number to chapters or
841 section titles in the table of contents.  If you would like her to
842 do so, invoke <kbd>TOC_PREFIX_CHAPTER_NUMBER</kbd> without an
843 argument before
844 <a href="docprocessing.html#start">START</a>.
845 </p>
846
847 <p>
848 You may subsequently disable the prefixing of chapter numbers by
849 supplying the macro with any argument (<b>OFF, QUIT, Q, X</b>...)
850 prior to the <kbd>START</kbd> that comes after
851 <a href="rectoverso.html#collate">COLLATE</a>.
852 </p>
853
854 <p>
855 This macro is useful you want chapters numbered in the table of
856 contents but the chapters themselves are identified by title only.
857 It can be used with both
858 <a href="docprocessing.html#doctype">DOCTYPE CHAPTER</a>
859 and
860 <a href="docprocessing.html#doctype">DOCTYPE DEFAULT</a>.
861 The alias <b>TOC_PREFIX_SECTION_NUMBER</b> may be preferable
862 in the latter case.
863 </p>
864
865 <!-- -PAD_TOC_CHAPTER_NUMBERS- -->
866
867 <div id="toc-pad-ch-numbers" class="box-macro-args">
868 Macro: <b>PAD_TOC_CHAPTER_NUMBERS</b> <kbd class="macro-args">&lt;number of chapters&gt;</kbd>
869 </div>
870 <p class="alias" style="margin-bottom: 0;">
871 <i>Alias:</i> <b>PAD_TOC_SECTION_NUMBERS</b>
872 </p>
873
874
875 <p>
876 If the number of chapters or major sections
877 (<a href="docprocessing.html#doctype">DOCTYPE DEFAULT</a>)
878 exceeds 9, you can have mom pad the numbers so the rightmost
879 numerals of the chapter numbers align.  Simply invoke
880 <kbd>PAD_TOC_CHAPTER_NUMBERS</kbd> with the number of chapters in
881 the document.
882 </p>
883
884 <p>
885 Without padding:
886 <br/>
887 <span class="pre-in-pp">
888   9. Chapter Title.....................100
889   10. Chapter Title....................123
890 </span>
891 With padding:
892 <br/>
893 <span class="pre-in-pp">
894    9. Chapter Title....................100
895   10. Chapter Title....................123
896 </span>
897 </p>
898
899 <!-- -TOC_ENTRY_NUMBERS- -->
900
901 <div id="toc-entry-numbers" class="box-macro-args">
902 Macro: <b>TOC_ENTRY_NUMBERS</b> <kbd class="macro-args">&lt;FULL&gt; &lt;TRUNCATE&gt; &lt;NONE&gt;</kbd>
903 </div>
904
905 <p>
906 If numbering is enabled for any level of
907 <a href="docelement.html#heading">HEADING</a>,
908 mom, by default, includes the numbering in that level&#8217;s
909 entries in table of contents.  If you would prefer that
910 numbering not be included in the table of contents,
911 issue <kbd>.TOC_ENTRY_NUMBERS&nbsp;NONE</kbd>.  If
912 you&#8217;d like to include numbering, but not the full,
913 concatenated numbering used in the body of the document, issue
914 <kbd>.TOC_ENTRY_NUMBERS&nbsp;TRUNCATE</kbd>.
915 </p>
916
917 <p>
918 Assuming numbering is enabled for HEADINGs 1, 2, and 3,
919 <kbd>.TOC_ENTRY_NUMBERS FULL</kbd> (mom&#8217;s default), would
920 result in
921 <br/>
922 <span class="pre-in-pp">
923   1. Level-1 entry
924      1.1. Level-2 entry
925        1.1.1. Level-3 entry
926   2. Level-1 entry
927      2.1. Level-2 entry
928        2.1.1. Level-3 entry
929 </span>
930 whereas <kbd>.TOC_ENTRY_NUMBERS TRUNCATE</kbd> would produce
931 <br/>
932 <span class="pre-in-pp">
933   1. Level-1 entry
934      1. Level-2 entry
935         1. Level-3 entry
936   2. Level-1 entry
937      1. Level-2 entry
938         1. Level-3 entry
939 </span>
940 and <kbd>.TOC_ENTRY_NUMBERS NONE</kbd> would remove numbering
941 completely.
942 <br/>
943 <span class="pre-in-pp">
944   Level-1 entry
945      Level-2 entry
946         Level-3 entry
947   Level-1 entry
948      Level-2 entry
949         Level-3 entry
950 </span>
951 </p>
952
953 <div class="box-tip">
954 <p class="tip">
955 <span class="note">Note:</span>
956 <kbd>.TOC_ENTRY_NUMBERS TRUNCATE</kbd> removes the numbering
957 associated with table of contents chapter or section titles
958 when
959 <a href="docelement.html#prefix-chapter-number">PREFIX_CHAPTER_NUMBER</a>
960 is enabled.  To enable the numbering of chapter or section titles
961 in this circumstance, use
962 <a href="#toc-prefix-ch-number"><kbd>TOC_PREFIX_CHAPTER_NUMBER</kbd></a>.
963 </p>
964 </div>
965
966 <h4 id="toc-additional" class="docs" style="margin-top: -1em;">5. Additional table of contents control macros</h4>
967
968 <p>
969 The following five macros allow you to
970 </p>
971 <ul style="margin-top: -.5em; margin-left: -.5em;">
972   <li>instruct mom to <a href="#toc-appends-author">append author(s) to</a> <a href="docprocessing.html#title">TITLE</a> <a href="toc-appends-author">entries</a></li>
973   <li><a href="#toc-title-entry">alter the wording of</a> <a href="docprocessing.html#title">TITLE</a> <a href="#toc-title-entry">entries</a></li>
974   <li>instruct mom to <a href="#space-toc-items">space table of contents entries</a> pleasingly</li>
975   <li>establish <a href="#toc-padding">how many placeholders to leave for page number references</a></li>
976   <li><a href="#toc-rv-switch">switch table of contents page margins</a> should they be incorrect for recto/verso printing</li>
977 </ul>
978
979 <!-- -TOC_APPENDS_AUTHOR- -->
980
981 <div id="toc-appends-author" class="box-macro-args">
982 Macro: <b>TOC_APPENDS_AUTHOR</b> <kbd class="macro-args">&lt;none&gt; | &quot;&lt;name(s) of authors&gt;&quot;</kbd>
983 </div>
984
985 <p>
986 In certain kinds of collated documents, different authors are
987 responsible for the articles or stories contained within them.  In
988 such documents, you may wish to have the author or authors appended
989 to the table of contents&#8217; title entry for each story or
990 article.
991 </p>
992
993 <p>
994 If you invoke <kbd>.TOC_APPENDS_AUTHOR</kbd> <i>without</i> an
995 argument, mom appends the first argument you passed to
996 <a href="docprocessing.html#author">AUTHOR</a>
997 to table of contents title entries, separated by a front-slash.
998 </p>
999
1000 <p>
1001 If you invoke <kbd>.TOC_APPENDS_AUTHOR</kbd> <i>with</i> an argument
1002 (surrounded by double-quotes), mom will append it to the table of
1003 contents title entries instead.  This is useful if you have multiple
1004 authors you wish to identify by last name only.  For example, if
1005 three authors&mdash;Joe Blough, Jane Doe, and John Deere&mdash;are
1006 responsible for a single article
1007 <br/>
1008 <span class="pre-in-pp">
1009   .TOC_APPENDS_AUTHOR "Blough et al."
1010 </span>
1011 would be a good way to identify them in the table of contents.
1012 </p>
1013
1014 <!-- -TOC_TITLE_ENTRY- -->
1015
1016 <div id="toc-title-entry" class="box-macro-args">
1017 Macro: <b>TOC_TITLE_ENTRY</b> <kbd class="macro-args">&quot;&lt;alternate wording for a title entry in the toc&gt;&quot;</kbd>
1018 </div>
1019
1020 <p>
1021 In 
1022 <a href="rectoverso.html#collate">collated</a>
1023 documents, the title of each chapter appears in the table of
1024 contents.  It may sometimes happen that you don&#8217;t want the
1025 title as it appears in the table of contents to be the same as what
1026 appears in the
1027 <a href="definitions.html#docheader">docheader</a>.
1028 You might, for example, want to shorten it.  Or, in the case of
1029 chapters where the docheader contains both a chapter number and a
1030 chapter title, like this
1031 <br/>
1032 <span class="pre-in-pp">
1033              Chapter 6
1034   Burning Bush &mdash; Maybe God Was Right
1035 </span>
1036 you might want only the chapter title, not the chapter number, to
1037 show up in the table of contents.  (By default, <kbd>.TOC</kbd>
1038 generates both.)
1039 </p>
1040
1041 <p>
1042 If you want to change the wording of a title entry in the table of
1043 contents, simply invoke
1044 <br/>
1045 <span class="pre-in-pp">
1046   .TOC_TITLE_ENTRY
1047 </span>
1048 with the desired wording, enclosed in double-quotes.  Using the
1049 example, above,
1050 <br/>
1051 <span class="pre-in-pp">
1052   .CHAPTER 6
1053   .CHAPTER_TITLE "Burning Bush &mdash; Maybe God Was Right"
1054   .TOC_TITLE_ENTRY "Burning Bush"
1055   .DOCTYPE CHAPTER
1056 </span>
1057
1058 would identify chapter 6 in the table of contents simply as
1059 &#8220;Burning Bush&#8221;.
1060 </p>
1061
1062 <!-- -SPACE_TOC_ITEMS- -->
1063
1064 <div id="space-toc-items" class="box-macro-args">
1065 Macro: <b>SPACE_TOC_ITEMS</b></kbd>
1066 </div>
1067
1068 <p>
1069 If you&#8217;d like mom to add a small amount of space between table
1070 of contents entry levels, use <kbd>.SPACE_TOC_ITEMS</kbd>.  Mom will
1071 visually group entry levels in a way that's pleasing to the eye.
1072 The only catch to this macro is that the bottom margins of table of
1073 contents pages may not align perfectly.
1074 </p>
1075
1076 <!-- -TOC_PADDING- -->
1077
1078 <div id="toc-padding" class="box-macro-args">
1079 Macro: <b>TOC_PADDING</b> <kbd class="macro-args">&lt;number of placeholders to allow for page number listings&gt;</kbd>
1080 </div>
1081
1082 <p>
1083 By default, mom allows room for 3 digits in the page number
1084 references of table of contents entries.  If you&#8217;d like some
1085 other number of placeholders, say 2 (if your document runs to less
1086 than 100 pages), do
1087 <br/>
1088 <span class="pre-in-pp">
1089   .TOC_PADDING 2
1090 </span>
1091 </p>
1092
1093 <!-- -TOC_RV_SWITCH- -->
1094
1095 <div id="toc-rv-switch" class="box-macro-args">
1096 Macro: <b>TOC_RV_SWITCH</b>
1097 </div>
1098
1099 <p>
1100 TOC_RV_SWITCH doesn&#8217;t take an argument.  It simply instructs
1101 mom to switch the left and right margins of the first table of
1102 contents page in
1103 <a href="rectoverso.html#recto-verso">recto/verso</a>
1104 documents should the table of contents happen to begin on an even
1105 page when you want an odd, or vice versa.
1106 </p>
1107
1108 <p>
1109 The same result can be accomplished by outputting a
1110 <a href="headfootpage.html#blank-pages">BLANKPAGE</a>.
1111 </p>
1112
1113 <h4 id="toc-more" class="docs" style="margin-top: -.5em;">6. I still need more!</h4>
1114
1115 <p>
1116 If there is some aspect of Table of Contents formatting for which
1117 no TOC control macros are provided, mom has a special
1118 <a href="definitions.html#toggle">toggle macro</a>
1119 to help out: TOC_PAGE_SETTINGS.
1120 </p>
1121
1122 <p>
1123 TOC_PAGE_SETTINGS allows you to enter extra formatting changes for
1124 the Table of Contents as if it were simply another collated section
1125 or chapter of a document.  Because it&#8217;s a toggle macro,
1126 invoking it by itself begins collecting your formatting directives,
1127 and invoking it with any argument (<b>OFF, QUIT, END</b>...) stops
1128 the collection.
1129 </p>
1130
1131 <p>
1132 TOC_PAGE_SETTINGS is special in that the formatting commands
1133 contained within it must be preceded by <kbd>\!</kbd> (that&#8217;s
1134 backslash-exclamation point).
1135 </p>
1136
1137 <p id="toc-page-settings-example">
1138 For example, say you want to redesign the default page headers for
1139 the Tables of Contents so that it only contains the document title
1140 on the left and &#8220;Contents&#8221; in italics on the right, and
1141 furthermore adjust the footer margin and footer gap, this is how
1142 you&#8217;d do it:
1143 <br/>
1144 <span class="pre-in-pp">
1145   .TOC_PAGE_SETTINGS
1146   \!.HEADER_RECTO L "^\E*[$TITLE]#\*[IT]Contents\*[PREV]^"
1147   \!.FOOTER_MARGIN 3P
1148   \!.B_MARGIN 6P+3p
1149   .TOC_PAGE_SETTINGS END
1150 </span>
1151 (For an explanation of why the example uses <kbd>.B_MARGIN</kbd> to
1152 set/change the footer gap, see
1153 <a href="headfootpage.html#gap-note">here</a>.)
1154 </p>
1155
1156 <p>
1157 TOC_PAGE_SETTINGS can be put in the stylesheet section of a document
1158 (ie after
1159 <a href="docprocessing.html#printstyle">PRINTSTYLE</a>
1160 and before
1161 <a href="docprocessing.html#start">START</a>)
1162 or invoked just before
1163 <a href="#toc">TOC</a>.
1164 </p>
1165
1166 <div class="rule-long"><hr/></div>
1167
1168 <!-- Navigation links -->
1169 <table style="width: 100%; margin-top: 12px;">
1170 <tr>
1171   <td style="width: 33%;"><a href="toc.html">Back to Table of Contents</a></td>
1172   <td style="width: 24%; text-align: center;"><a href="#top">Top</a></td>
1173   <td style="width: 42%; text-align: right;"><a href="refer.html">Next: Bibliographies and references</a></td>
1174 </tr>
1175 </table>
1176
1177 </div>
1178
1179 <div class="bottom-spacer"><br/></div>
1180
1181 </body>
1182 </html>