Imported Upstream version 1.22.4
[platform/upstream/groff.git] / contrib / mom / om.tmac
1 .ig
2 Mom -- a typesetting/document-processing macro set for groff.
3
4 Copyright (C) 2002-2018  Free Software Foundation, Inc.
5  Written by Peter Schaffter <peter@schaffter.ca>
6  PDF integration contributed by Deri James <deri.james@chuzzlewit.co.uk>
7
8 This file is part of groff.
9
10 groff is free software; you can redistribute it and/or modify it
11 under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 groff is distributed in the hope that it will be useful, but WITHOUT ANY
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
18 for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
22
23 Version 2.4
24 -----------
25 Antoine de St-ExupĂ©ry asserted that elegance in engineering is
26 achieved not when there is nothing left to add, but when there is
27 nothing left to take away.
28
29 By those standards, mom is a Rube Goldberg contraption.  She was
30 created over the years while groff, and my understanding of it,
31 changed and evolved.  However, I'm a firm believer in "if it ain't
32 broke, don't fix it."  Version 2.0 removed some of the redundancies
33 and cruft, but mom still needs some nip and tuck.
34
35 "<anything>" in the description of arguments that can be passed
36 to a macro means that any argument turns the feature off.
37
38 Thanks to everyone who has contributed suggestions and patches,
39 and to those whose GPL'd work has been plundered.  Special thanks
40 to Werner Lemberg (margin notes), Tadziu Hoffman (underlining),
41 Deri James (pdf integration), Robin Haberkorn (tbl integration, eqn
42 extensions, and float management).
43 ..
44 .\" %beginstrip%
45 \#
46 \# ====================================================================
47 \#
48 .if \n(.C \
49 .   ab [mom]: The groff mom macros do not work in compatibility mode.
50 \# Check that GNU troff is being run
51 .if !\n[.g]=1 \
52 .   ab [mom]: The mom macros require that you be running GNU troff.
53 \# Check which version of groff is being run
54 .if (\n[.x]\n[.y] < 118) \
55 .   ab [mom]: You need GNU troff version 1.18 or higher to run this version of mom.
56 \# Mom version
57 .ds version 2.4
58 .if dVERSION \{\
59 .   ab [mom]: Version \*[version]
60 .\}
61 \# Groff revision
62 .ds short_revision \n[.Y]
63 .substring short_revision 0 0
64 \#
65 \# Add supplementary styles
66 .sty \n[.fp] UL      \"  Ultra Light
67 .sty \n[.fp] ULI     \"  Ultra Light Italic
68 .sty \n[.fp] ULCD    \"  Ultra Light Condensed
69 .sty \n[.fp] ULCDI   \"  Ultra Light Condensed Italic
70 .sty \n[.fp] ULEX    \"  Ultra Light Extended
71 .sty \n[.fp] ULEXI   \"  Ultra Light Extended Italic
72 \#
73 .sty \n[.fp] XL      \"  Extra Light
74 .sty \n[.fp] XLI     \"  Extra Light Italic
75 .sty \n[.fp] XLCD    \"  Extra Light Condensed
76 .sty \n[.fp] XLCDI   \"  Extra Light Condensed Italic
77 .sty \n[.fp] XLEX    \"  Extra Light Extended
78 .sty \n[.fp] XLEXI   \"  Extra Light Extended Italic
79 \#
80 .sty \n[.fp] TH      \"  Thin
81 .sty \n[.fp] THI     \"  Thin Italic
82 .sty \n[.fp] THCD    \"  Thin Condensed
83 .sty \n[.fp] THCDI   \"  Thin Condensed Italic
84 .sty \n[.fp] THEX    \"  Thin Extended
85 .sty \n[.fp] THEXI   \"  Thin Extended Italic
86 \#
87 .sty \n[.fp] L       \"  Light Roman
88 .sty \n[.fp] LI      \"  Light Italic
89 .sty \n[.fp] LCD     \"  Light Condensed
90 .sty \n[.fp] LCDI    \"  Light Condensed Italic
91 .sty \n[.fp] LEX     \"  Light Extended
92 .sty \n[.fp] LEXI    \"  Light Extended Italic
93 \#
94 .sty \n[.fp] BK      \"  Book Roman
95 .sty \n[.fp] BKI     \"  Book Italic
96 .sty \n[.fp] BKCD    \"  Book Condensed
97 .sty \n[.fp] BKCDI   \"  Book Condensed Italic
98 .sty \n[.fp] BKEX    \"  Book Extended
99 .sty \n[.fp] BKEXI   \"  Book Extended Italic
100 \#
101 .sty \n[.fp] CD      \"  Medium Condensed
102 .sty \n[.fp] CDI     \"  Medium Condensed Italic
103 .sty \n[.fp] EX      \"  Medium Extended
104 .sty \n[.fp] EXI     \"  Medium Extended Italic
105 \#
106 .sty \n[.fp] DB      \"  DemiBold Roman
107 .sty \n[.fp] DBI     \"  DemiBold Italic
108 .sty \n[.fp] DBCD    \"  DemiBold Condensed
109 .sty \n[.fp] DBCDI   \"  DemiBold Condensed Italic
110 .sty \n[.fp] DBEX    \"  DemiBold Extended
111 .sty \n[.fp] DBEXI   \"  DemiBold Extended Italic
112 \#
113 .sty \n[.fp] SB      \"  SemiBold Roman
114 .sty \n[.fp] SBI     \"  SemiBold Italic
115 .sty \n[.fp] SBCD    \"  SemiBold Condensed
116 .sty \n[.fp] SBCDI   \"  SemiBold Condensed Italic
117 .sty \n[.fp] SBEX    \"  SemiBold Extended
118 .sty \n[.fp] SBEXI   \"  SemiBold Extended Italic
119 \#
120 .sty \n[.fp] BCD     \"  Bold Condensed
121 .sty \n[.fp] BCDI    \"  Bold Condensed Italic
122 .sty \n[.fp] BEX     \"  Bold Extended
123 .sty \n[.fp] BEXI    \"  Bold Extended Italic
124 .sty \n[.fp] BO      \"  Bold Outline
125 \#
126 .sty \n[.fp] XB      \"  Extra Bold
127 .sty \n[.fp] XBI     \"  Extra Bold Italic
128 .sty \n[.fp] XBCD    \"  Extra Bold Condensed
129 .sty \n[.fp] XBCDI   \"  Extra Bold Condensed Italic
130 .sty \n[.fp] XBEX    \"  Extra Bold Extended
131 .sty \n[.fp] XBEXI   \"  Extra Bold Extended Italic
132 \#
133 .sty \n[.fp] UB      \"  Ultra Bold
134 .sty \n[.fp] UBI     \"  Ultra Bold Italic
135 .sty \n[.fp] UBCD    \"  Ultra Bold Condensed
136 .sty \n[.fp] UBCDI   \"  Ultra Bold Condensed Italic
137 .sty \n[.fp] UBEX    \"  Ultra Bold Extended
138 .sty \n[.fp] UBEXI   \"  Ultra Bold Extended Italic
139 \#
140 .sty \n[.fp] HV      \"  Heavy
141 .sty \n[.fp] HVI     \"  Heavy Italic
142 .sty \n[.fp] HVCD    \"  Heavy Condensed
143 .sty \n[.fp] HVCDI   \"  Heavy Condensed Italic
144 .sty \n[.fp] HVEX    \"  Heavy Extended
145 .sty \n[.fp] HVEXI   \"  Heavy Extended Italic
146 \#
147 .sty \n[.fp] BL      \"  Black
148 .sty \n[.fp] BLI     \"  Black Italic
149 .sty \n[.fp] BLCD    \"  Black Condensed
150 .sty \n[.fp] BLCDI   \"  Black Condensed Italic
151 .sty \n[.fp] BLEX    \"  Black Extended
152 .sty \n[.fp] BLEXI   \"  Black Extended Italic
153 .sty \n[.fp] BLO     \"  Black Outline
154 \#
155 .sty \n[.fp] XBL     \"  Extra Black
156 .sty \n[.fp] XBLI    \"  Extra Black Italic
157 .sty \n[.fp] XBLCD   \"  Extra Black
158 .sty \n[.fp] XBLCDI  \"  Extra Black
159 .sty \n[.fp] XBLEX   \"  Extra Black Italic
160 .sty \n[.fp] XBLEXI  \"  Extra Black Italic
161 \#
162 .sty \n[.fp] UBL     \"  Ultra Black
163 .sty \n[.fp] UBLI    \"  Ultra Black Italic
164 .sty \n[.fp] UBLCD   \"  Ultra Black Condensed
165 .sty \n[.fp] UBLCDI  \"  Ultra Black Condensed Italic
166 .sty \n[.fp] UBLEX   \"  Ultra Black Extended
167 .sty \n[.fp] UBLEXI  \"  Ultra Black Extended Italic
168 \#
169 .sty \n[.fp] SC      \"  Small Caps Roman
170 .sty \n[.fp] SCI     \"  Small Caps Italic
171 .sty \n[.fp] SCDB    \"  Small Caps Demibold
172 .sty \n[.fp] SCDBI   \"  Small Caps Demibold Italic
173 .sty \n[.fp] SCSB    \"  Small Caps Semibold
174 .sty \n[.fp] SCSBI   \"  Small Caps Semibold Italic
175 \#
176 \# Instruct grops to use square linecaps and joins.
177 \# This instruction is also executed in DO_B_MARGIN, NEWPAGE, and HEADER
178 \#
179 .if !n \X'ps: exec 0 setlinejoin'\X'ps: exec 0 setlinecap'
180 \#
181 \# The following PostScript, provided by Tadziu Hoffmann, permits
182 \# no-fail underlining
183 \#
184 .de ul*ps
185 ps: def
186 grops begin
187 /decornone { grops begin /X { } def /Y { } def /y2 -1 def end } def
188 /decorline { grops begin u neg /uld exch def u /ulw exch def
189              /X { currentpoint /y0 exch def /x0 exch def } def
190              /Y { currentpoint /y1 exch def /x1 exch def
191                   drawline /x2 x1 def /y2 y1 def } def end } def
192 /drawline { gsave ulw setlinewidth 0 setlinecap x1 y1 uld sub moveto
193             y2 y0 eq { x2 y2 } { x0 y0 } ifelse uld sub lineto stroke
194             grestore } def
195 decornone
196 /uld 0 def
197 /ulw 0 def
198 /A { X show Y } def
199 /B { 0 SC 3 -1 roll X widthshow Y } def
200 /C { 0 exch X ashow Y } def
201 /D { 0 exch 0 SC 5 2 roll X awidthshow Y } def
202 /E { 0 rmoveto X show Y } def
203 /F { 0 rmoveto 0 SC 3 -1 roll X widthshow Y } def
204 /G { 0 rmoveto 0 exch X ashow Y } def
205 /H { 0 rmoveto 0 exch 0 SC 5 2 roll X awidthshow Y } def
206 /I { 0 exch rmoveto X show Y } def
207 /J { 0 exch rmoveto 0 SC 3 -1 roll X widthshow Y } def
208 /K { 0 exch rmoveto 0 exch X ashow Y } def
209 /L { 0 exch rmoveto 0 exch 0 SC 5 2 roll X awidthshow Y } def
210 /M { rmoveto X show Y } def
211 /N { rmoveto 0 SC 3 -1 roll X widthshow Y } def
212 /O { rmoveto 0 exch X ashow Y } def
213 /P { rmoveto 0 exch 0 SC 5 2 roll X awidthshow Y } def
214 /Q { moveto X show Y } def
215 /R { moveto 0 SC 3 -1 roll X widthshow Y } def
216 /S { moveto 0 exch X ashow Y } def
217 /T { moveto 0 exch 0 SC 5 2 roll X awidthshow Y } def
218 end
219 ..
220 \#
221 .if !n \Y[ul*ps]
222 .if n .color 0
223 .nr TOC.RELOCATE 0 \" TOC.RELOCATE is off by default
224 .ds PDFHREF.TEXTCOL.DEFAULT 0.0 0.3 0.9
225 .nr PDFHREF.VIEW.LEADING.C 3i
226 .nr PDFHREF.VIEW.LEADING.T 1i
227 .nr PDFHREF.VIEW.LEADING 0
228 .nr PDFHREF.VIEW.LEADING.H \n[PDFHREF.VIEW.LEADING]
229 \#
230 \# ====================================================================
231 \#
232 \# TYPESETTING MACROS, STRINGS, AND ALIASES
233 \# ========================================
234 \#
235 \# +++ALIASES+++
236 \#
237 \# Alias .als as ALIAS, and .aln (number registers) as ALIASN
238 \#
239 .als      ALIAS           als
240 .als      ALIASN          aln
241 \#
242 \# ALIASES FOR GROFF REQUESTS
243 \# --------------------------
244 \#
245 .ALIAS    MAC             de
246 .ALIAS    BR              br
247 .ALIAS    SPREAD          brp
248 .ALIAS    ESC_CHAR        ec
249 .ALIAS    STRING          ds
250 .ALIAS    INCLUDE         so
251 \#
252 \# ALIASES FOR NUMBER REGISTERS
253 \# ----------------------------
254 \#
255 .ALIASN  #PT_SIZE        .ps    \"fractional point size in units
256 .ALIASN  #DIVER_DEPTH     dn    \"diversion depth
257 .ALIASN  #DIVER_WIDTH     dl    \"diversion width
258 .ALIASN  #TRAP_DISTANCE  .t     \"distance to next trap
259 .ALIASN  #LEAD           .v     \"line space
260 .ALIASN  #PAGE_LENGTH    .p     \"page length
261 .ALIASN  #NUM_ARGS       .$     \"number of arguments passed to a macro
262 .ALIASN  #INDENT         .i     \"value of current indent
263 \#
264 \# ====================================================================
265 \#
266 \# MISCELLANEOUS
267 \# =============
268 .nr #L_MARGIN \n[.o]  \" Tabs, etc require #L_MARGIN
269 .cflags 4 /\[en]      \" So slash and en-dashes get broken
270 \#
271 \# 'END' is used throughout as the 2nd arg to 'MAC' (alias of .de)
272 \# Defining it as a macro here prevents groff from complaining
273 \# that 'END' isn't defined.
274 \#
275 .de END
276 ..
277 \#
278 \# ====================================================================
279 \#
280 \# +++PAGE LAYOUT+++
281 \#
282 \# Macros that control the physical layout of the page: paper size
283 \# and margins.
284 \#
285 \# PAGE WIDTH
286 \# ----------
287 \# *Argument:
288 \#   <width of printer sheet>
289 \# *Function:
290 \#   Stores user supplied page width in register #PAGE_WIDTH.
291 \# *Notes:
292 \#   #PAGE_WIDTH is used to establish the default LL (and right margin).
293 \#   Requires unit of measure.
294 \#
295 .MAC PAGEWIDTH END
296 .    br
297 .    nr #PAGE_WIDTH \\$1
298 .    if !r#L_MARGIN .L_MARGIN \\n[.o]
299 .    if !r#R_MARGIN .R_MARGIN 1i
300 .    if '\\*[.T]'pdf' \X'papersize=\\n[#PAGE_WIDTH]z,\\n[#PAGE_LENGTH]z'\c
301 .END
302 \#
303 \# L_MARGIN
304 \# --------
305 \# *Argument:
306 \#   <offset from page left>
307 \# *Function:
308 \#   Stores user supplied page offset in register #L_MARGIN.
309 \#   Sets .po to user supplied offset.
310 \# *Notes:
311 \#   Requires unit of measure.
312 \#
313 .MAC L_MARGIN END
314 .    br
315 .    nr #L_MARGIN (\\$1)
316 .    po \\n[#L_MARGIN]u
317 .END
318 \#
319 \# R_MARGIN
320 \# --------
321 \# *Argument:
322 \#   <width of right margin>
323 \# *Function:
324 \#   Stores user supplied right margin in register #R_MARGIN.
325 \# *Notes:
326 \#   This is a pseudo-margin.  Right margin is actually a function of
327 \#   line length.  The macro calculates line length from the page offset
328 \#   and the value plugged into #R_MARGIN.
329 \#
330 \#   N.B. -- PAGEWIDTH and L_MARGIN have to be defined before R_MARGIN.
331 \#
332 \#   Requires unit of measure.
333 \#
334 .MAC R_MARGIN END
335 .    br
336 .    nr #R_MARGIN (\\$1)
337 .    ll \\n[#PAGE_WIDTH]u-\\n[#L_MARGIN]u-\\n[#R_MARGIN]u
338 .    ta \\n[.l]u
339 .    nr #L_LENGTH \\n[.l]
340 .END
341 \#
342 \# T_MARGIN
343 \# --------
344 \# *Argument:
345 \#   <distance to advance from top of page>
346 \# *Function:
347 \#   Stores the user supplied top margin in register #T_MARGIN.
348 \#   Advances user supplied depth from the top of the page.
349 \# *Notes:
350 \#   Requires unit of measure.
351 \#
352 .MAC T_MARGIN END
353 .    nr #T_MARGIN (\\$1)
354 .    if !\\n[#DOCS] .sp |\\n[#T_MARGIN]u-1v
355 .    wh 0i DO_T_MARGIN
356 .END
357 \#
358 \# B_MARGIN
359 \# --------
360 \# *Argument:
361 \#   <space to leave at the bottom of the page>
362 \# *Function:
363 \#   Stores the user supplied bottom margin in register #B_MARGIN.
364 \# *Notes:
365 \#   Requires unit of measure.
366 \#
367 .MAC B_MARGIN END
368 .    br
369 .    nr #B_MARGIN (\\$1)
370 .    nr #ORIGINAL_B_MARGIN \\n[#B_MARGIN]
371 .    nr #B_MARGIN_SET 1
372 .    wh -\\n[#B_MARGIN]u DO_B_MARGIN
373 .END
374 \#
375 \# PAGE
376 \# ----
377 \# *Arguments:
378 \#   <pagewidth>  [pagelength [leftmargin [rightmargin [topmargin [bottommargin]]]]]
379 \# *Function:
380 \#   Page set-up.  Collects arguments and passes them to the appropriate
381 \#   macros.
382 \# *Notes:
383 \#   All arguments after pagewidth are optional, but must appear
384 \#   in the order given above.  (User can fill in as much or as
385 \#   little as desired.)
386 \#
387 \#   All arguments require a unit of measure.
388 \#
389 .MAC PAGE END
390 .    br
391 .    PAGEWIDTH   \\$1
392 .    PAGELENGTH  \\$2
393 .    ie '\\$3''  .L_MARGIN \\n[.o]
394 .    el          .L_MARGIN \\$3
395 .    ie '\\$4''  .R_MARGIN 1i
396 .    el          .R_MARGIN \\$4
397 .    if !'\\$5'' .T_MARGIN \\$5
398 .    if !'\\$6'' .B_MARGIN \\$6
399 .END
400 \#
401 \# gropdf: pass pagelength to postprocessor; no need for -P-p
402 \#
403 .MAC PAGELENGTH END
404 .    pl \\$*
405 .    if '\\*[.T]'pdf' \X'papersize=\\n[#PAGE_WIDTH]z,\\n[#PAGE_LENGTH]z'\c
406 .END
407 \#
408 \# =====================================================================
409 \#
410 \# +++PAGE CONTROL+++
411 \#
412 \# Generic macros for breaking pages.
413 \#
414 \# DO_T_MARGIN
415 \# -----------
416 \# *Argument:
417 \#   <none>
418 \# *Function:
419 \#   Plants the top margin at the top of each page.
420 \# *Notes:
421 \#   The trap is set in .T_MARGIN or .PAGE
422 \#
423 .MAC DO_T_MARGIN END
424 .    ev T_MARGIN
425 .    sp |\\n[#T_MARGIN]u-1v
426 .    ev
427 .END
428 \#
429 \# DO_B_MARGIN
430 \# -----------
431 \# *Argument:
432 \#   <none>
433 \# *Function:
434 \#   Plants the bottom margin at the bottom of each page.
435 \# *Notes:
436 \#   The trap is set in .B_MARGIN or .PAGE.
437 \#
438 .MAC DO_B_MARGIN END
439 .    nr #T_MARGIN_LEAD_ADJ \\n[#LEAD]-12000
440 .    ev B_MARGIN
441 .    if !n .nop \X'ps: exec 0 setlinejoin'\X'ps: exec 0 setlinecap'
442 .    ie \\n[#DOCS] \
443 .       if !\\n[#NEWPAGE] .bp
444 .    el .bp
445 .    ev
446 .END
447 \#
448 \# NEWPAGE
449 \# -------
450 \# *Argument:
451 \#   <none>
452 \# *Function:
453 \#   Breaks to a new page.
454 \# *Notes:
455 \#   If a B_MARGIN has been set, processes that, otherwise, just
456 \#   breaks to a new page.
457 \#
458 .MAC NEWPAGE END
459 .    br
460 .    if \\n[#DOC_TYPE]=5 \{\
461 .       if \\n[#NUM_ARGS]>0 \
462 .       pdftransition PAGE \\$1
463 .    \}
464 .    if !\\n[defer] \{\
465 .       nr #NEWPAGE 1
466 .       rr tbl*no-print-header
467 .    \}
468 .    ie !\\n[#DOCS]=1 \
469 .       if \\n[#B_MARGIN_SET]=1 .DO_B_MARGIN
470 .    el \{\
471 .       if \\n[#COLUMNS]=1 .nr #COL_NUM \\n[#NUM_COLS]
472 .       if !\\n[#FN_DEPTH] \{\
473 .          ch FN_OVERFLOW_TRAP
474 .          nr #RESET_FN_OVERFLOW_TRAP 1
475 .       \}
476 .    \}
477 .    if dPDF.EXPORT \
478 .       if \\n[#FLEX_ACTIVE] \
479 .          if !\\n[#NO_FLEX] \
480 .             tm .ds pre-newpage-\\n% \\n%@\\n[#COL_NUM]
481 .    if (\\n[@TOP]=0):(\\n[#END_COVER]=1) \
482 .       bp
483 .    rr #END_COVER
484 .    if \\n[#RESET_FN_OVERFLOW_TRAP] \{\
485 .       wh -\\n[#FN_OVERFLOW_TRAP_POS]u FN_OVERFLOW_TRAP
486 .       rr #RESET_FN_OVERFLOW_TRAP_POS
487 .   \}
488 .END
489 \#
490 .ALIAS NEWSLIDE NEWPAGE
491 \#
492 \# =====================================================================
493 \#
494 \# +++GENERAL STYLE MACROS+++
495 \#
496 \# LINE LENGTH
497 \# -----------
498 \# *Argument:
499 \#   <line length>
500 \# *Function:
501 \#   Stores user supplied line length in register #L_LENGTH.
502 \#   Sets .ll to #L_LENGTHu
503 \# *Notes:
504 \#   Requires unit of measure.
505 \#
506 .MAC LL END
507 .    nr #USER_SET_L_LENGTH 1
508 .    ll \\$1
509 .    nr #L_LENGTH \\n[.l]
510 .    ta \\n[.l]u
511 .END
512 \#
513 \# +++FAMILY AND FONT+++
514 \#
515 \# FALLBACK FONT
516 \# -------------
517 \# *Argument:
518 \#   <fallback font> [ ABORT | WARN ] | ABORT | WARN
519 \# *Function:
520 \#   Sets register #ABORT_FT_ERRORS to 1, or defines a fallback font
521 \#   called "dummy" at font position 0.
522 \# *Notes:
523 \#   Calls to non-existent families cause mom to continue processing
524 \#   files using the fallback font until a valid family is entered.
525 \#
526 \#   Calls to non-existent fonts generate warnings.  If ABORT is passed
527 \#   to FALLBACK_FONT, mom stops processing files after the warning.
528 \#   Otherwise, she continues to process files using the fallback font
529 \#   after the warning is issued.  The default fallback font is CR; the
530 \#   default for font warnings is to abort.
531 \#
532 .MAC FALLBACK_FONT END
533 .    if \\n[#NUM_ARGS]=1 \{\
534 .       if '\\$1'ABORT' .nr #ABORT_FT_ERRORS 1
535 .       if '\\$1'WARN' \
536 .          if r #ABORT_FT_ERRORS .nr #ABORT_FT_ERRORS 0
537 .       if !'\\$1'ABORT' \
538 .          if !'\\$1'WARN' .fp 0 dummy \\$1
539 .    \}
540 .    if \\n[#NUM_ARGS]=2 \{\
541 .       fp 0 dummy \\$1
542 .       if '\\$2'ABORT' .nr #ABORT_FT_ERRORS 1
543 .       if '\\$2'WARN'  .nr #ABORT_FT_ERRORS 0
544 .    \}
545 .END
546 \#
547 .FALLBACK_FONT CR ABORT
548 \#
549 \# FAMILY
550 \# ------
551 \# *Argument:
552 \#   <font family>
553 \# *Function:
554 \#   Stores user supplied font family in string $FAMILY.  Sets .fam
555 \#   to $FAMILY.
556 \#
557 .MAC FAMILY END
558 .    if '\\n[.ev]'COVER_TEXT' .ds $SAVED_DOC_FAM \\n[.fam]
559 .    if \\n[#COLLATE] .rm $SAVED_DOC_FAM
560 .    ds $FAMILY \\$1
561 .    if \\n[#PRINT_STYLE]=1 \{\
562 .       fam \\*[$TYPEWRITER_FAM]
563 .       return
564 .    \}
565 .    if \\n[#IGNORE] \{\
566 .       fam \\*[$TYPEWRITER_FAM]
567 .       return
568 .    \}
569 .    if (\\n[.x]\\n[.y]\\*[short_revision] >= 1192) .ds $SAVED_STYLE \\n[.sty]
570 .    ft 0
571 .    fam \\*[$FAMILY]
572 .    if (\\n[.x]\\n[.y]\\*[short_revision] >= 1192) \{\
573 .       ft \\*[$SAVED_STYLE]
574 .       if !F\\n[.fn] .ft 0
575 .    \}
576 .    ie \\n[#PRE_COLLATE]=1 .
577 .    el \{\
578 .       if \\n[#COLLATE]=1 \
579 .          if !r#START .ds $DOC_FAM \\*[$FAMILY]
580 .    \}
581 .END
582 \#
583 \# FONT
584 \# ----
585 \# *Argument:
586 \#   R | I | B | BI | <other style extension>
587 \# *Function:
588 \#  Stores user supplied font in $FONT and sets .ft to $FONT.
589 \#
590 .MAC FT END
591 .    ds $FONT \\$1
592 .    if \\n[#PRINT_STYLE]=1 \{\
593 .       ie '\\$1'I' \{\
594 .          if \\n[#UNDERLINE_ITALIC]=1 \{\
595 .             UNDERLINE
596 .             return
597 .          \}
598 .          if \\n[#ITALIC_MEANS_ITALIC]=1 \{\
599 .             ds $FONT \\$1
600 .             ft \\*[$FONT]
601 .             return
602 .          \}
603 .       \}
604 .       el .UNDERLINE OFF
605 .       return
606 .    \}
607 .    ft 0
608 .    ft \\*[$FONT]
609 .    if (\\n[.x]\\n[.y]\\*[short_revision] >= 1192) \{\
610 .       if '\\n[.sty]'' \{\
611 .          if !F\\n[.fn] \{\
612 .             if !S\\*[$FONT] \{\
613 .                tm1 "[mom]: Font style "\\*[$FONT]" at line \\n[.c] has not been registered.
614 .                ie \\n[#ABORT_FT_ERRORS]=0 \
615 .                   tm1 "       Continuing to process using fallback font.
616 .                el .ab [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
617 .             \}
618 .             if \\n[.f]=0 \{\
619 .                tm1 "[mom]: Either font style "\\*[$FONT]" at line \\n[.c] does not exist in family "\\n[.fam]",
620 .                tm1 "       or family "\\n[.fam]" has not been installed.
621 .                ie \\n[#ABORT_FT_ERRORS]=0 \
622 .                   tm1 "       Continuing to process using fallback font.
623 .                el .ab [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
624 .             \}
625 .          \}
626 .       \}
627 .    \}
628 .END
629 \#
630 \# POINT SIZE
631 \# ----------
632 \# *Arguments:
633 \#   <point size of type>
634 \# *Function:
635 \#   Sets point size to user supplied value in scaled points.
636 \#   If #AUTO_LEAD is on, resets lead accordingly.
637 \# *Notes:
638 \#   Must NOT use a unit of measure.
639 \#
640 .MAC PT_SIZE END
641 .    if \\n[#PRINT_STYLE]=1 .return
642 .    if \\n[#IGNORE] .return
643 .    ps \\$1
644 .    nr #PT_SIZE_IN_UNITS \\n[.ps]
645 .    ie '\\$0'DOC_PT_SIZE' \{\
646 .       if !\\n[#DOCS] .DOC_MACRO_ERROR \\$0
647 .       br
648 .       nr #NEW_DOC_PT_SIZE \\n[.ps]
649 .       if \\n[#DOC_AUTOLEAD] \{\
650 .          ie !\\n[#DOC_AUTOLEAD_FACTOR] .nr #AUTOLEADING \\n[#DOC_AUTOLEAD]
651 .          el .nr #AUTOLEADING \\n[.ps]*\\n[#DOC_AUTOLEAD]/1000-\\n[.ps]
652 .          nr #DOC_LEAD \\n[.ps]+\\n[#AUTOLEADING]
653 .          nr #RESET_TRAPS 1
654 .       \}
655 .    \}
656 .    el .if \\n[#AUTO_LEAD] .vs \\n[.ps]u+\\n[#AUTOLEADING]u
657 .END
658 \#
659 \# SIZE (inline)
660 \# -------------
661 \# *Arguments:
662 \#   <point size of type>
663 \# *Function:
664 \#   Sets point size to user supplied value in scaled points.
665 \#   Intended to be called inline with \*[SIZE <n><unit>]
666 \# *Notes:
667 \#   Can be used with a unit of measure or not.
668 \#
669 .MAC SIZE END
670 \c
671 .ps \\$1
672 .END
673 \#
674 \# LEADING
675 \# -------
676 \# *Argument:
677 \#   <leading between lines of text>
678 \# *Function:
679 \#   Turns off #AUTOLEAD if it's on.
680 \#   Sets .vs to user supplied value.
681 \# *Notes:
682 \#   Does not require unit of measure.  LS automatically turns off AUTOLEAD.
683 \#
684 .MAC LS END
685 .    br
686 .    if \\n[#PRINT_STYLE]=1 .return
687 .    if \\n[#IGNORE] .return
688 .    if \\n[#AUTO_LEAD] \{\
689 .       rr #AUTO_LEAD
690 .       rr #AUTOLEAD_VALUE
691 .       rr #AUTOLEADING
692 .    \}
693 .    vs \\$1
694 .    if !\\n[#START] \
695 .       if \\n[.t]<\\n[.v] 'bp
696 .END
697 \#
698 \# AUTOLEAD
699 \# --------
700 \# *Argument:
701 \#   <leading value to add to #PT_SIZE> [FACTOR]
702 \# *Function:
703 \#   Stores user supplied auto-lead value in register #AUTOLEAD_VALUE.
704 \#   Adds #AUT0LEAD_VALUE to #PT_SIZE when invoked to set leading.
705 \#   All subsequent PT_SIZE requests reset the leading in the same way until
706 \#   AUTOLEAD is turned off.
707 \# *Notes:
708 \#   With the optional FACTOR argument, the current point size is
709 \#   multiplied by #AUTOLEAD_VALUE/1000 instead of the two being added
710 \#   together.
711 \#
712 .MAC AUTOLEAD END
713 .    if \\n[#PRINT_STYLE]=1 .return
714 .    if \\n[#IGNORE] .return
715 .    nr #AUTO_LEAD 1 \" autolead on or off
716 .    nr #AUTOLEAD_VALUE (p;\\$1) \" arg x 1000
717 .    ie '\\$2'FACTOR' \{\
718 .       if !\\n[#DOCS] .nr #DOC_AUTOLEAD_FACTOR \\n[#AUTOLEAD_VALUE] \" save for DOC_PT_SIZE
719 .       nr #AUTOLEADING \\n[.ps]*\\n[#AUTOLEAD_VALUE]/1000-\\n[.ps]
720 .    \}
721 .    el .nr #AUTOLEADING \\n[#AUTOLEAD_VALUE]
722 .    vs \\n[.ps]u+\\n[#AUTOLEADING]u
723 .END
724 \#
725 \# STRINGS FOR INLINE CONTROL OF GENERAL TYPE STYLE
726 \# ------------------------------------------------
727 .ds ROM  \Ef[R]
728 .ds IT   \Ef[I]
729 .ds BD   \Ef[B]
730 .ds BDI  \Ef[BI]
731 .ds PREV \Ef[]
732 .ds S    \Es
733 \#
734 \# =====================================================================
735 \#
736 \# +++KERNING+++
737 \#
738 \# AUTOMATIC PAIRWISE KERNING
739 \# --------------------------
740 \# *Arguments:
741 \#   <none> | <anything>
742 \# *Function:
743 \#   Turns automatic pairwise kerning on or off.
744 \#
745 .MAC KERN END
746 .    ie '\\$1'' \{\
747 .       kern
748 .       nr #KERN 1
749 .    \}
750 .    el \{\
751 .       kern 0
752 .       nr #KERN 0
753 .    \}
754 .END
755 \#
756 \# INLINE KERNING AND HORIZONTAL MOVEMENT
757 \# --------------------------------------
758 \#
759 \# Inline kerning provides a simple way to adjust the amount of
760 \# space between any two letters.  It's predicated on a unit of
761 \# measure "U", which, by default, is 1/36 of the current point
762 \# size as returned by \n[.ps]; e.g., if the current point size is
763 \# 18, \n[.ps] returns 18000u, therefore U=500u.  Since U remains
764 \# proportional relative to the current point size, the amount of
765 \# kerning between two letters as expressed in Us remains visually
766 \# similar regardless of changes in point size.
767 \#
768 \# The default value for U may be changed or reset with the
769 \# KERN_UNIT macro.
770 \#
771 .MAC KERN_UNIT END
772 .    ie '\\$1'DEFAULT' .ds $KERN_UNIT 36
773 .    el .ds $KERN_UNIT \\$1
774 .END
775 \#
776 .ds $KERN_UNIT 36
777 .ds BU   \h'-(\En[.ps]u/\E*[$KERN_UNIT]u*\\$1u)'
778 .ds FU   \h'(\En[.ps]u/\E*[$KERN_UNIT]u*\\$1u)'
779 \#
780 \# Initialize strings for pre-1.1.3c-style BU and FU
781 \#
782 .nr #LOOP 0 1
783 .while \n+[#LOOP]<37 \{\
784 .   ds BU\n[#LOOP] \h'-(\En[.ps]u/\E*[$KERN_UNIT]u*\n[#LOOP]u)'
785 .   ds FU\n[#LOOP] \h'(\En[.ps]u/\E*[$KERN_UNIT]u*\n[#LOOP]u)'
786 .\}
787 \#
788 \# Horizontal movements
789 \# --------------------
790 \# BP1...12.75 and FP1...12.75 move backwards or forwards inline by the
791 \# specified number of points.
792 \#
793 .ds BCK  \h'-\\$1'
794 .ds FWD  \h'\\$1'
795 \#
796 .ds BP.25    \h'-.25'
797 .ds BP.5     \h'-.5'
798 .ds BP.75    \h'-.75'
799 .ds BP1      \h'-1p'
800 .ds BP1.25   \h'-1.25p'
801 .ds BP1.5    \h'-1.5p'
802 .ds BP1.75   \h'-1.75p'
803 .ds BP2      \h'-2p'
804 .ds BP2.25   \h'-2.25p'
805 .ds BP2.5    \h'-2.5p'
806 .ds BP2.75   \h'-2.75p'
807 .ds BP3      \h'-3p'
808 .ds BP3.25   \h'-3.25p'
809 .ds BP3.5    \h'-3.5p'
810 .ds BP3.75   \h'-3.75p'
811 .ds BP4      \h'-4p'
812 .ds BP4.25   \h'-4.25p'
813 .ds BP4.5    \h'-4.5p'
814 .ds BP4.75   \h'-4.75p'
815 .ds BP5      \h'-5p'
816 .ds BP5.25   \h'-5.25p'
817 .ds BP5.5    \h'-5.5p'
818 .ds BP5.75   \h'-5.75p'
819 .ds BP6      \h'-6p'
820 .ds BP6.25   \h'-6.25p'
821 .ds BP6.5    \h'-6.5p'
822 .ds BP6.75   \h'-6.75p'
823 .ds BP7      \h'-7p'
824 .ds BP7.25   \h'-7.25p'
825 .ds BP7.5    \h'-7.5p'
826 .ds BP7.75   \h'-7.75p'
827 .ds BP8      \h'-8p'
828 .ds BP8.25   \h'-8.25p'
829 .ds BP8.5    \h'-8.5p'
830 .ds BP8.75   \h'-8.75p'
831 .ds BP9      \h'-9p'
832 .ds BP9.25   \h'-9.25p'
833 .ds BP9.5    \h'-9.5p'
834 .ds BP9.75   \h'-9.75p'
835 .ds BP10     \h'-10p'
836 .ds BP10.25  \h'-10.25p'
837 .ds BP10.5   \h'-10.5p'
838 .ds BP10.75  \h'-10.75p'
839 .ds BP11     \h'-11p'
840 .ds BP11.25  \h'-11.25p'
841 .ds BP11.5   \h'-11.5p'
842 .ds BP11.75  \h'-11.75p'
843 .ds BP12     \h'-12p'
844 .ds BP12.25  \h'-12.25p'
845 .ds BP12.5   \h'-12.5p'
846 .ds BP12.75  \h'-12.75p'
847 \#
848 .ds FP.25    \h'.25'
849 .ds FP.5     \h'.5'
850 .ds FP.75    \h'.75'
851 .ds FP1      \h'1p'
852 .ds FP1.25   \h'1.25p'
853 .ds FP1.5    \h'1.5p'
854 .ds FP1.75   \h'1.75p'
855 .ds FP2      \h'2p'
856 .ds FP2.25   \h'2.25p'
857 .ds FP2.5    \h'2.5p'
858 .ds FP2.75   \h'2.75p'
859 .ds FP3      \h'3p'
860 .ds FP3.25   \h'3.25p'
861 .ds FP3.5    \h'3.5p'
862 .ds FP3.75   \h'3.75p'
863 .ds FP4      \h'4p'
864 .ds FP4.25   \h'4.25p'
865 .ds FP4.5    \h'4.5p'
866 .ds FP4.75   \h'4.75p'
867 .ds FP5      \h'5p'
868 .ds FP5.25   \h'5.25p'
869 .ds FP5.5    \h'5.5p'
870 .ds FP5.75   \h'5.75p'
871 .ds FP6      \h'6p'
872 .ds FP6.25   \h'6.25p'
873 .ds FP6.5    \h'6.5p'
874 .ds FP6.75   \h'6.75p'
875 .ds FP7      \h'7p'
876 .ds FP7.25   \h'7.25p'
877 .ds FP7.5    \h'7.5p'
878 .ds FP7.75   \h'7.75p'
879 .ds FP8      \h'8p'
880 .ds FP8.25   \h'8.25p'
881 .ds FP8.5    \h'8.5p'
882 .ds FP8.75   \h'8.75p'
883 .ds FP9      \h'9p'
884 .ds FP9.25   \h'9.25p'
885 .ds FP9.5    \h'9.5p'
886 .ds FP9.75   \h'9.75p'
887 .ds FP10     \h'10p'
888 .ds FP10.25  \h'10.25p'
889 .ds FP10.5   \h'10.5p'
890 .ds FP10.75  \h'10.75p'
891 .ds FP11     \h'11p'
892 .ds FP11.25  \h'11.25p'
893 .ds FP11.5   \h'11.5p'
894 .ds FP11.75  \h'11.75p'
895 .ds FP12     \h'12p'
896 .ds FP12.25  \h'12.25p'
897 .ds FP12.5   \h'12.5p'
898 .ds FP12.75  \h'12.75p'
899 \#
900 \# WHOLE LINE (TRACK) KERNING
901 \# --------------------------
902 \# *Argument:
903 \#   <amount of track kerning>
904 \# *Function:
905 \#   Invokes .tkf (track kerning) for the current font with
906 \#   1 as both the upper and lower point size limits, so that
907 \#   the value entered by the user applies regardless of point
908 \#   size.  RW ("Reduce Whitespace") reduces the amount of space
909 \#   between all characters by an equal amount.  EW ("Extra
910 \#   Whitespace") increases the amount of space.
911 \# *Notes:
912 \#   Decimal values are acceptable.
913 \#
914 \# A value of 1 will produce an unacceptably tight or loose line
915 \# at most text point sizes; therefore, effective use of RW and
916 \# EW is in the fractional range below 1.
917 \#
918 \# \n[.f] holds the current font number, which is acceptable to .tkf.
919 \#
920 \# RW and EW must be reset to 0 to cancel their effect on subsequent
921 \# output lines.
922 \#
923 .MAC RW END
924 .    if \\n[#BR_AT_LINE_KERN] \{\
925 .       ie \\n[#JUSTIFY]=1 .brp
926 .       el .br
927 .    \}
928 .    rr #EW
929 .    rm $EW
930 .    nr #RW 1
931 .    ds $RW \\$1
932 .    tkf \\n[.f] 1 -\\$1 1 -\\$1
933 .END
934 \#
935 .MAC EW END
936 .    if \\n[#BR_AT_LINE_KERN] \{\
937 .       ie \\n[#JUSTIFY]=1 .brp
938 .       el .br
939 .    \}
940 .    rr #RW
941 .    rm $RW
942 .    nr #EW 1
943 .    ds $EW \\$1
944 .    tkf \\n[.f] 1 \\$1 1 \\$1
945 .END
946 \#
947 \# BREAK AT LINE KERN
948 \# ------------------
949 \# *Arguments:
950 \#   toggle
951 \# *Function:
952 \#   Enables/disables .br's before .RW and .EW
953 \# *Notes:
954 \#   Mostly, users will want .br's before any kind of line kerning, but
955 \#   there may be cases where they don't.  BR_AT_LINE_KERN is off by
956 \#   default and must be invoked explicitly.
957 \#
958 .MAC BR_AT_LINE_KERN END
959 .    ie '\\$1'' .nr #BR_AT_LINE_KERN  1
960 .    el .rr #BR_AT_LINE_KERN
961 .END
962 \#
963 \# =====================================================================
964 \#
965 \# +++HYPHENATION+++
966 \#
967 \# AUTO HYPHENATION
968 \# ----------------
969 \# *Arguments:
970 \#   <none> | <anything> | DEFAULT
971 \#                 or
972 \#   LINES <n> | MARGIN <n> | SPACE <n>
973 \# *Function:
974 \#   Turns auto hyphenation on or off, resets the hyphenation style
975 \#   to default, or permits the setting of various hyphenation
976 \#   parameters.
977 \# *Notes:
978 \#   HY, by itself, defaults to .hy 14, i.e. no hyphens after the
979 \#   first two or before the last two characters of a word, and no
980 \#   hyphenation of the last line prior to a trap (e.g., at the
981 \#   bottom of a page).
982 \#
983 \#   HY DEFAULT resets the hyphenation style to .hy 14 (see
984 \#   above) if that behaviour is desired after changes have been
985 \#   made to LINES, MARGIN, or SPACE.
986 \#
987 \#   HY LINES <n> sets the number of allowable consecutive hyphenated lines.
988 \#
989 \#   HY MARGIN <n> sets the amount of space (ipPcm) allowed at the end
990 \#   of a line in QUAD mode before hyphenation is tripped (e.g. if there's
991 \#   only 6 points left, groff won't try to hyphenate the next word).
992 \#
993 \#   HY SPACE sets the amount of extra interword space (ipPcm) that can
994 \#   be added in JUSTIFY mode to prevent a line from being hyphenated.
995 \#
996 .MAC HY END
997 .    ie '\\$1'' \{\
998 .       hy 14
999 .       if \\n[#LINES]  .hlm \\n[#LINES]
1000 .       if \\n[#MARGIN] .hym \\n[#MARGIN]]
1001 .       if \\n[#SPACE]  .hys \\n[#SPACE]
1002 .       nr #HYPHENATE 1
1003 .    \}
1004 .    el \{\
1005 .       if !'\\$1'LINES' \{\
1006 .          nh
1007 .          nr #HYPHENATE 0
1008 .       \}
1009 .       if !'\\$1'MARGIN' \{\
1010 .          nh
1011 .          nr #HYPHENATE 0
1012 .       \}
1013 .       if !'\\$1'SPACE' \{\
1014 .          nh
1015 .          nr #HYPHENATE 0
1016 .       \}
1017 .       if !'\\$1'DEFAULT' \{\
1018 .          nh
1019 .          nr #HYPHENATE 0
1020 .       \}
1021 .       if '\\$1'LINES'  \{\
1022 .          hlm \\$2
1023 .          nr #HY_LINES \\$2
1024 .       \}
1025 .       if '\\$1'MARGIN' \{\
1026 .          hym \\$2
1027 .          nr #HY_MARGIN \\$2
1028 .       \}
1029 .       if '\\$1'SPACE'  \{\
1030 .          hys \\$2
1031 .          nr #HY_SPACE \\$2
1032 .       \}
1033 .       if '\\$1'DEFAULT' \{\
1034 .          hlm -1
1035 .          hym 0
1036 .          hys 0
1037 .          rr #HY_LINES
1038 .          rr #HY_SPACE
1039 .          rr #HY_MARGIN
1040 .       \}
1041 .    \}
1042 .END
1043 \#
1044 \# HYPHENATION PARAMETERS
1045 \# ----------------------
1046 \# *Arguments:
1047 \#   <# of lines> | <size of margin> | <amount of interword space>
1048 \# *Function:
1049 \#   Allows user to specify .HY LINES, MARGIN, and SPACE with a single command.
1050 \#
1051 .MAC HY_SET END
1052 .    nr #HY_SET 1
1053 .    hlm \\$1
1054 .    hym \\$2
1055 .    hys \\$3
1056 .END
1057 \#
1058 \# =====================================================================
1059 \#
1060 \# +++VERTICAL SPACING+++
1061 \#
1062 \# ADVANCE LEAD
1063 \# ------------
1064 \# *Argument:
1065 \#   <user supplied lead to advance below current baseline>
1066 \# *Function:
1067 \#   Creates or modifies register #ALD.  Adds user supplied lead
1068 \#   below current baseline.
1069 \# *Notes:
1070 \#   Requires a unit of measure.
1071 \#
1072 .MAC ALD END
1073 .    if '\\$0'ALD' \{\
1074 .       nr #ALD (u;\\$1)
1075 .       sp \\n[#ALD]u
1076 .    \}
1077 .    if '\\$0'ADD_SPACE' \{\
1078 .       vpt 0
1079 .       nr #ALD (u;\\$1)
1080 .       rs
1081 .       nop \&
1082 .       br
1083 .       sp |\\n[#T_MARGIN]u-1v+\\n[#ALD]u
1084 .       rr @TOP
1085 .       nr #SPACE_ADDED 1
1086 .       vpt
1087 .    \}
1088 .    if '\\$0'SPACE' .sp \\$1
1089 .    if '\\$0'SP'    .sp \\$1
1090 .END
1091 \#
1092 \# REVERSE LEAD
1093 \# ------------
1094 \# *Argument:
1095 \#   <user supplied lead to reverse above current baseline>
1096 \# *Function:
1097 \#   Creates or modifies register #RLD.  Reverses user supplied
1098 \#   lead above current baseline.
1099 \# *Notes:
1100 \#   Requires a unit of measure.
1101 \#
1102 .MAC RLD END
1103 .    br
1104 .    nr #RLD (u;\\$1)
1105 .    sp -\\n[#RLD]u
1106 .END
1107 \#
1108 \# ALD/RLD STRINGS
1109 \# ---------------
1110 \# The strings \*[ALD.25]...\*[ALD12.75] and their corresponding
1111 \# \*[RLD] forms have been left in for backward compatibility with
1112 \# documents created using mom-1.1.3c or earlier.  The preferred methods
1113 \# of advancing and reversing on the page inline are \*[UP <n><unit>]
1114 \# and \*[DOWN <n><unit>].
1115 \#
1116 .ds DOWN      \v'\\$1'
1117 .ds UP        \v'-\\$1'
1118 \#
1119 .ds ALD.25    \v'.25p'
1120 .ds ALD.5     \v'.5p'
1121 .ds ALD.75    \v'.75p'
1122 .ds ALD1      \v'1p'
1123 .ds ALD1.25   \v'1.25p'
1124 .ds ALD1.5    \v'1.5p'
1125 .ds ALD1.75   \v'1.75p'
1126 .ds ALD2      \v'2p'
1127 .ds ALD2.25   \v'2.25p'
1128 .ds ALD2.5    \v'2.5p'
1129 .ds ALD2.75   \v'2.75p'
1130 .ds ALD3      \v'3p'
1131 .ds ALD3.25   \v'3.25p'
1132 .ds ALD3.5    \v'3.5p'
1133 .ds ALD3.75   \v'3.75p'
1134 .ds ALD4      \v'4p'
1135 .ds ALD4.25   \v'4.25p'
1136 .ds ALD4.5    \v'4.5p'
1137 .ds ALD4.75   \v'4.75p'
1138 .ds ALD5      \v'5p'
1139 .ds ALD5.25   \v'5.25p'
1140 .ds ALD5.5    \v'5.5p'
1141 .ds ALD5.75   \v'5.75p'
1142 .ds ALD6      \v'6p'
1143 .ds ALD6.25   \v'6.25p'
1144 .ds ALD6.5    \v'6.5p'
1145 .ds ALD6.75   \v'6.75p'
1146 .ds ALD7      \v'7p'
1147 .ds ALD7.25   \v'7.25p'
1148 .ds ALD7.5    \v'7.5p'
1149 .ds ALD7.75   \v'7.75p'
1150 .ds ALD8      \v'8p'
1151 .ds ALD8.25   \v'8.25p'
1152 .ds ALD8.5    \v'8.5p'
1153 .ds ALD8.75   \v'8.75p'
1154 .ds ALD9      \v'9p'
1155 .ds ALD9.25   \v'9.25p'
1156 .ds ALD9.5    \v'9.5p'
1157 .ds ALD9.75   \v'9.75p'
1158 .ds ALD10     \v'10p'
1159 .ds ALD10.25  \v'10.25p'
1160 .ds ALD10.5   \v'10.5p'
1161 .ds ALD10.75  \v'10.75p'
1162 .ds ALD11     \v'11p'
1163 .ds ALD11.25  \v'11.25p'
1164 .ds ALD11.5   \v'11.5p'
1165 .ds ALD11.75  \v'11.75p'
1166 .ds ALD12     \v'12p'
1167 .ds ALD12.25  \v'12.5p'
1168 .ds ALD12.5   \v'12.5p'
1169 .ds ALD12.75  \v'12.75p'
1170 \#
1171 .ds RLD.25    \v'-.25p'
1172 .ds RLD.5     \v'-.5p'
1173 .ds RLD.75    \v'-.75p'
1174 .ds RLD1      \v'-1p'
1175 .ds RLD1.25   \v'-1.25p'
1176 .ds RLD1.5    \v'-1.5p'
1177 .ds RLD1.75   \v'-1.75p'
1178 .ds RLD2      \v'-2p'
1179 .ds RLD2.25   \v'-2.25p'
1180 .ds RLD2.5    \v'-2.5p'
1181 .ds RLD2.75   \v'-2.75p'
1182 .ds RLD3      \v'-3p'
1183 .ds RLD3.25   \v'-3.25p'
1184 .ds RLD3.5    \v'-3.5p'
1185 .ds RLD3.75   \v'-3.75p'
1186 .ds RLD4      \v'-4p'
1187 .ds RLD4.25   \v'-4.25p'
1188 .ds RLD4.5    \v'-4.5p'
1189 .ds RLD4.75   \v'-4.75p'
1190 .ds RLD5      \v'-5p'
1191 .ds RLD5.25   \v'-5.25p'
1192 .ds RLD5.5    \v'-5.5p'
1193 .ds RLD5.75   \v'-5.75p'
1194 .ds RLD6      \v'-6p'
1195 .ds RLD6.25   \v'-6.25p'
1196 .ds RLD6.5    \v'-6.5p'
1197 .ds RLD6.75   \v'-6.75p'
1198 .ds RLD7      \v'-7p'
1199 .ds RLD7.25   \v'-7.25p'
1200 .ds RLD7.5    \v'-7.5p'
1201 .ds RLD7.75   \v'-7.75p'
1202 .ds RLD8      \v'-8p'
1203 .ds RLD8.25   \v'-8.25p'
1204 .ds RLD8.5    \v'-8.5p'
1205 .ds RLD8.75   \v'-8.75p'
1206 .ds RLD9      \v'-9p'
1207 .ds RLD9.25   \v'-9.25p'
1208 .ds RLD9.5    \v'-9.5p'
1209 .ds RLD9.75   \v'-9.75p'
1210 .ds RLD10     \v'-10p'
1211 .ds RLD10.25  \v'-10.25p'
1212 .ds RLD10.5   \v'-10.5p'
1213 .ds RLD10.75  \v'-10.75p'
1214 .ds RLD11     \v'-11p'
1215 .ds RLD11.25  \v'-11.25p'
1216 .ds RLD11.5   \v'-11.5p'
1217 .ds RLD11.75  \v'-11.75p'
1218 .ds RLD12     \v'-12p'
1219 .ds RLD12.25  \v'-12.5p'
1220 .ds RLD12.5   \v'-12.5p'
1221 .ds RLD12.75  \v'-12.75p'
1222 \#
1223 \# =====================================================================
1224 \#
1225 \# +++REFINEMENTS+++
1226 \#
1227 \# AUTOMATIC LIGATURES
1228 \# -------------------
1229 \# *Arguments:
1230 \#   <none> | <anything>
1231 \# *Function:
1232 \#   Turns automatic ligature generation on or off.
1233 \# *Notes:
1234 \#   Ligatures may be supplied manually with \[fi], \[fl], etc.
1235 \#
1236 .MAC LIGATURES END
1237 .    ie '\\$1'' \{\
1238 .       lg
1239 .       nr #LIGATURES 1
1240 .    \}
1241 .    el \{\
1242 .       lg 0
1243 .       nr #LIGATURES 0
1244 .    \}
1245 .END
1246 \#
1247 \# SMARTQUOTES
1248 \# -----------
1249 \# *Arguments:
1250 \#   [ ,, ] | [ << ] | [ >> ] | <anything>
1251 \#   or
1252 \#   [ DA | DE | EN | ES | FR | IT | NL | NO | PT | SV ] | <anything>
1253 \# *Function:
1254 \#   Turns smartquotes on (optionally with a quoting style from the
1255 \#   argument list, or off).
1256 \#   If no quoting style is given, then EN (English) is used by default.
1257 \#   If no quoting style is given and smart quotes have been turned off
1258 \#   previously, the old quoting style will be restored.
1259 \# *Notes:
1260 \#   The " character is read outside the macro when mom is
1261 \#   processed.  The strings for open/close ($QUOTE<n>) are then
1262 \#   defined in the macro.
1263 \#
1264 .char " \\*[$QUOTE\\n[#OPEN_CLOSE]]\R'#OPEN_CLOSE (1-\\n[#OPEN_CLOSE])'
1265 .nr #SQ_ON 0
1266 \#
1267 .MAC SMARTQUOTES END
1268 .\" First " will be translated to $QUOTE0
1269 .    nr #OPEN_CLOSE 0
1270 .    if '\\$1'' \{\
1271 .       if !'\\*[$RESTORE_SQ]'' \{\
1272 .          SMARTQUOTES \\*[$RESTORE_SQ]
1273 .          return
1274 .       \}
1275 .\" Default smart quotes (English)
1276 .       ds $QUOTE0 \[lq]
1277 .       ds $QUOTE1 \[rq]
1278 .       ds $RESTORE_SQ EN
1279 .       nr #SQ_ON 1
1280 .       return
1281 .    \}
1282 .    if '\\$1',,' \{\
1283 .       ds $QUOTE0 \[Bq]
1284 .       ds $QUOTE1 \[lq]
1285 .       ds $RESTORE_SQ \\$1
1286 .       nr #SQ_ON 1
1287 .       return
1288 .    \}
1289 .    if '\\$1'<<' \{\
1290 .       ds $QUOTE0 \[Fo]
1291 .       ds $QUOTE1 \[Fc]
1292 .       ds $RESTORE_SQ \\$1
1293 .       nr #SQ_ON 1
1294 .       return
1295 .    \}
1296 .    if '\\$1'>>' \{\
1297 .       ds $QUOTE0 \[Fc]
1298 .       ds $QUOTE1 \[Fo]
1299 .       ds $RESTORE_SQ \\$1
1300 .       nr #SQ_ON 1
1301 .       return
1302 .    \}
1303 .    if '\\$1'DA' \{\
1304 .       ds $QUOTE0 \[Fc]
1305 .       ds $QUOTE1 \[Fo]
1306 .       ds $RESTORE_SQ \\$1
1307 .       nr #SQ_ON 1
1308 .       return
1309 .    \}
1310 .    if '\\$1'DE' \{\
1311 .       ds $QUOTE0 \[Bq]
1312 .       ds $QUOTE1 \[lq]
1313 .       ds $RESTORE_SQ \\$1
1314 .       nr #SQ_ON 1
1315 .       return
1316 .    \}
1317 .    if '\\$1'EN' \{\
1318 .       ds $QUOTE0 \[lq]
1319 .       ds $QUOTE1 \[rq]
1320 .       ds $RESTORE_SQ \\$1
1321 .       nr #SQ_ON 1
1322 .       return
1323 .    \}
1324 .    if '\\$1'ES' \{\
1325 .       ds $QUOTE0 \[lq]
1326 .       ds $QUOTE1 \[rq]
1327 .       ds $RESTORE_SQ \\$1
1328 .       nr #SQ_ON 1
1329 .       return
1330 .    \}
1331 .    if '\\$1'FR' \{\
1332 .       ds $QUOTE0 \[Fo]\|
1333 .       ds $QUOTE1 \|\[Fc]
1334 .       ds $RESTORE_SQ \\$1
1335 .       nr #SQ_ON 1
1336 .       return
1337 .    \}
1338 .    if '\\$1'IT' \{\
1339 .       ds $QUOTE0 \[Fo]\|
1340 .       ds $QUOTE1 \|\[Fc]
1341 .       ds $RESTORE_SQ \\$1
1342 .       nr #SQ_ON 1
1343 .       return
1344 .    \}
1345 .    if '\\$1'NL' \{\
1346 .       ds $QUOTE0 \[rq]
1347 .       ds $QUOTE1 \[rq]
1348 .       ds $RESTORE_SQ \\$1
1349 .       nr #SQ_ON 1
1350 .       return
1351 .    \}
1352 .    if '\\$1'NO' \{\
1353 .       ds $QUOTE0 \[Fo]
1354 .       ds $QUOTE1 \[Fc]
1355 .       ds $RESTORE_SQ \\$1
1356 .       nr #SQ_ON 1
1357 .       return
1358 .    \}
1359 .    if '\\$1'PT' \{\
1360 .       ds $QUOTE0 \[Fo]
1361 .       ds $QUOTE1 \[Fc]
1362 .       ds $RESTORE_SQ \\$1
1363 .       nr #SQ_ON 1
1364 .       return
1365 .    \}
1366 .    if '\\$1'SV' \{\
1367 .       ds $QUOTE0 \[Fc]
1368 .       ds $QUOTE1 \[Fc]
1369 .       ds $RESTORE_SQ \\$1
1370 .       nr #SQ_ON 1
1371 .       return
1372 .    \}
1373 .\" None of the above -> turn smartquotes off
1374 .    ds $QUOTE0 \[dq]
1375 .    ds $QUOTE1 \[dq]
1376 .    nr #SQ_ON 0
1377 .END
1378 \#
1379 .ds $QUOTE0 \[lq]
1380 .ds $QUOTE1 \[rq]
1381 \#
1382 \# Strings for foot and inch marks
1383 \#
1384 .ds FOOT \[fm]
1385 .ds INCH \[fm]\[fm]
1386 \#
1387 \# =====================================================================
1388 \#
1389 \# +++LINE BREAKS+++
1390 \#
1391 \# NO-SPACE BREAK
1392 \# --------------
1393 \# *Argument:
1394 \#   <none>
1395 \# *Function:
1396 \#   Breaks a line without advancing.
1397 \# *Notes:
1398 \#   EL is the mnemonic used on older, dedicated typesetting machines
1399 \#   to indicate "process the line, without advancing the galley
1400 \#   medium."  It stands for End Line.
1401 \#
1402 \#   The \c inline must be appended to the end of input lines when in
1403 \#   nofill mode; in fill modes, the \c inline must not be used.
1404 \#
1405 .MAC EL END
1406 .    TRAP OFF
1407 .    if \\n[#PSEUDO_FILL]=1 \&
1408 .    br
1409 .    sp -1v
1410 .    TRAP
1411 .END
1412 \#
1413 \# An inline escape to accomplish the same thing.
1414 \# Preferable, since it works with filled and non-filled copy and
1415 \# doesn't require the user to remember whether to use (or not use)
1416 \# \c.
1417 \#
1418 .ds B \h'|0'\R'#NO_ADVANCE 1'\c
1419 \#
1420 \# =====================================================================
1421 \#
1422 \# +++FILLING/QUADDING/JUSTIFYING+++
1423 \#
1424 \# JUSTIFY
1425 \# -------
1426 \# *Argument:
1427 \#   <none>
1428 \# *Function:
1429 \#   Turns fill on and sets .ad to b.
1430 \# *Notes:
1431 \#   Justifies text left and right.
1432 \#
1433 .MAC JUSTIFY END
1434 .    if \\n[#TAB_ACTIVE]=0 \{\
1435 .       nr #QUAD 1
1436 .       ds $RESTORE_QUAD_VALUE \\*[$QUAD_VALUE]
1437 .    \}
1438 '    ce 0
1439 .    QUAD J
1440 .    if \\n[#PRINT_STYLE]=1 .QUAD L
1441 .    nr #PSEUDO_FILL 0
1442 .END
1443 \#
1444 \# QUAD
1445 \# ----
1446 \# *Arguments:
1447 \#   L | LEFT | R | RIGHT | C | CENTER/CENTRE
1448 \# *Function:
1449 \#   Turns fill on and sets .ad to l, r, or c.
1450 \# *Notes:
1451 \#   Terminology is a problem here.  Some people call quad left
1452 \#   left justified, flush left, or flush left/rag right (and the
1453 \#   reverse for quad right).  Quad center is sometimes called rag
1454 \#   both.  For our purposes, all "quad" modes mean that groff fill
1455 \#   mode is enabled.
1456 \#
1457 .MAC QUAD END
1458 .    br
1459 .    if \\n[#COVERTEXT_PP] \
1460 .       ds $RESTORE_DOC_QUAD \\*[$QUAD_VALUE]
1461 .    ds $QUAD_VALUE \\$1
1462 .    substring $QUAD_VALUE 0 0
1463 .    if \\n[#TAB_ACTIVE]=0 \{\
1464 .       nr #QUAD 1
1465 .       ds $RESTORE_QUAD_VALUE \\*[$QUAD_VALUE]
1466 .    \}
1467 '    ce 0
1468 '    fi
1469 .    if '\\*[$QUAD_VALUE]'L' \{\
1470 .       nr #JUSTIFY 0
1471 .       ad l
1472 .    \}
1473 .    if '\\*[$QUAD_VALUE]'R' \{\
1474 .       nr #JUSTIFY 0
1475 .       ad r
1476 .    \}
1477 .    if '\\*[$QUAD_VALUE]'C' \{\
1478 .       nr #JUSTIFY 0
1479 .       ad c
1480 .    \}
1481 .    if '\\*[$QUAD_VALUE]'J' \{\
1482 .       nr #JUSTIFY 1
1483 .       ad b
1484 .    \}
1485 .    nr #PSEUDO_FILL 0
1486 .END
1487 \#
1488 \# LEFT, RIGHT, AND CENTER
1489 \# -----------------------
1490 \# The purpose of these macros is to allow the user to enter lines
1491 \# of text that will be quadded LRC without having to stick .BR
1492 \# or .br between lines.  For the sake of consistency, all three
1493 \# appear to behave similarly (from the point of view of the user),
1494 \# although the underlying primitives don't.  For this reason, LEFT,
1495 \# RIGHT, and CENTER must be followed by .QUAD [L R C J] or .JUSTIFY
1496 \# to restore text to fill mode.
1497 \#
1498 \# LEFT
1499 \# ----
1500 \# *Argument:
1501 \#   <none>
1502 \# *Function:
1503 \#   Turns fill mode off.  Allows user to quad lines left without
1504 \#   requiring the .BR or .br macro.
1505 \# *Notes:
1506 \#   LEFT simply turns fill off.  Lines that exceed the current LL
1507 \#   will not be broken.  Note that this behaviour differs from the
1508 \#   RIGHT and CENTER macros.
1509 \#
1510 .MAC LEFT END
1511 .    if \\n[#TAB_ACTIVE]=0 \{\
1512 .       rr #QUAD
1513 .       ds $RESTORE_QUAD_VALUE LEFT
1514 .    \}
1515 .    ce 0
1516 .    nf
1517 .    nr #PSEUDO_FILL 1
1518 .\" Fix for a little conflict with DOCTYPE LETTER
1519 .    if '\\n[.z]'LETTERHEAD1' .rr #DATE_FIRST
1520 .END
1521 \#
1522 \# RIGHT
1523 \# -----
1524 \# *Argument:
1525 \#   <none>
1526 \# *Function:
1527 \#   Turns fill on.  Allows user to quad lines right without
1528 \#   requiring the .BR or .br macro.
1529 \# *Notes:
1530 \#   Lines that exceed the current LL will be broken, with the excess
1531 \#   text quadded right.
1532 \#
1533 .MAC RIGHT END
1534 .    if \\n[#TAB_ACTIVE]=0 \{\
1535 .       rr #QUAD
1536 .       ds $RESTORE_QUAD_VALUE RIGHT
1537 .    \}
1538 .    nf
1539 .    rj 100000
1540 .    nr #PSEUDO_FILL 1
1541 .END
1542 \#
1543 \# CENTER
1544 \# ------
1545 \# *Argument:
1546 \#   <none>
1547 \# *Function:
1548 \#   Turns fill off.  Allows user to center lines without
1549 \#   requiring the .BR or .br macro.
1550 \# *Notes:
1551 \#   Lines that exceed the current LL will be broken, with the excess
1552 \#   text centered.
1553 \#
1554 .MAC CENTER END
1555 .    if \\n[#TAB_ACTIVE]=0 \{\
1556 .       rr #QUAD
1557 .       ds $RESTORE_QUAD_VALUE CENTER
1558 .    \}
1559 .    nf
1560 .    ce 100000
1561 .    nr #PSEUDO_FILL 1
1562 .END
1563 \#
1564 \# CENTER BLOCKS OF TYPE
1565 \# ---------------------
1566 \# *Arguments:
1567 \#   <none> | <anything>
1568 \# *Function:
1569 \#   Allows users to centre blocks of type on the page without
1570 \#   altering their quad.
1571 \#
1572 .MAC CENTER_BLOCK END
1573 .    br
1574 .    ie !\\n[.$] .di CENTER*BLOCK
1575 .    el \{\
1576 .       di
1577 .       in \\n[.l]u-\\n[dl]u/2u
1578 .       if \\n[.u] .nr #FILLED 1
1579 .       nf
1580 .       CENTER*BLOCK
1581 .       if \\n[#FILLED] .fi
1582 .       rr #FILLED
1583 .       in
1584 .    \}
1585 .END
1586 \#
1587 .ALIAS CENTRE_BLOCK CENTER_BLOCK
1588 \#
1589 \# =====================================================================
1590 \#
1591 \# +++TABS+++
1592 \#
1593 \# There are two different kinds of tabs: typesetting tabs and
1594 \# string tabs.
1595 \#
1596 \# Typesetting tabs are set with TAB_SET, which requires a tab number,
1597 \# an indent (offset) from the left margin and a length (optionally
1598 \# with a quad direction and an instruction to fill lines).  After tabs
1599 \# are set with TAB_SET, they are called with .TAB n, where "n"
1600 \# corresponds to the number passed to TAB_SET as a valid tab number.
1601 \#
1602 \# String tabs allow the user to mark off tab positions inline.  Tab
1603 \# indents and lengths are calculated from the beginning and end
1604 \# positions of the marks.  Up to 19 string tabs may be created,
1605 \# numbered 1-19.  Once created, they are called with .TAB n,
1606 \# just like typesetting tabs.
1607 \#
1608 \# Setting up string tabs is a two-step procedure.  First, the user
1609 \# enters an input line in which s/he wants to mark off string tabs.
1610 \# The beginning of a tab is marked with \*[STn], where "n" is
1611 \# the desired number of the tab.  The end of the tab is marked
1612 \# with \*[STnX].  All ST's must have a matching STX.  String tabs
1613 \# may be nested.
1614 \#
1615 \# Next, the user invokes .ST n for every string tab defined, and
1616 \# optionally passes quad information to it.  That done, string tabs
1617 \# can be called just like typesetting tabs.
1618 \#
1619 \# Strings for string tab inlines
1620 \# ------------------------------
1621 \# Initialize string tab markers numbered 1 to 19.
1622 \#
1623 .nr #LOOP 0 1
1624 .while \n+[#LOOP]<20 \{\
1625 .   ds ST\n[#LOOP] \Ek[#ST\n[#LOOP]_OFFSET]
1626 .\}
1627 \#
1628 .nr #LOOP 0 1
1629 .while \n+[#LOOP]<20 \{\
1630 .   ds ST\n[#LOOP]X \Ek[#ST\n[#LOOP]_MARK]
1631 .\}
1632 .rr #LOOP
1633 \#
1634 \# These are reserved ST numbers for internal use
1635 .ds ST100  \Ek[#ST100_OFFSET]
1636 .ds ST100X \Ek[#ST100_MARK]
1637 .ds ST101  \Ek[#ST101_OFFSET]
1638 .ds ST101X \Ek[#ST101_MARK]
1639 .ds ST102  \Ek[#ST102_OFFSET]
1640 .ds ST102X \Ek[#ST102_MARK]
1641 .ds ST103  \Ek[#ST103_OFFSET]
1642 .ds ST103X \Ek[#ST103_MARK]
1643 \#
1644 \# QUAD AND SET STRING TABS
1645 \# ------------------------
1646 \# *Arguments:
1647 \#   <stringtab number>  L | R | C | J  [QUAD]
1648 \# *Function:
1649 \#   Creates strings $ST<#>_QUAD_DIR and $ST<#>_FILL, then sets up a
1650 \#   tab based on the collected information.
1651 \# *Notes:
1652 \#   Like TAB_SET, ST invoked without a quad direction will default to LEFT.
1653 \#   If lines should be filled and quadded, use the optional argument QUAD.
1654 \#   N.B. -- indents *must* be turned off before setting string tabs
1655 \#   inside .PAD
1656 \#
1657 .MAC ST END
1658 .    ds $ST\\$1_QUAD_DIR \\$2
1659 .    if \\n[#NUM_ARGS]=3 .ds $ST\\$1_FILL QUAD
1660 .    nr #ST\\$1_LENGTH \\n[#ST\\$1_MARK]-\\n[#ST\\$1_OFFSET]
1661 .    ie \\n[#IN_TAB] \
1662 .       TAB_SET \\$1 \\n[#ST\\$1_OFFSET]u+\\n[#ST_OFFSET]u \
1663           \\n[#ST\\$1_LENGTH]u \\*[$ST\\$1_QUAD_DIR] \\*[$ST\\$1_FILL]
1664 .    el \
1665 .       TAB_SET \\$1 \\n[#ST\\$1_OFFSET]u \\n[#ST\\$1_LENGTH]u \
1666           \\*[$ST\\$1_QUAD_DIR] \\*[$ST\\$1_FILL]
1667 .END
1668 \#
1669 \# TAB SET
1670 \# -------
1671 \# *Arguments:
1672 \#   <n>  ident(ipPcm)  length(ipPcm)  [L | R | C | J [QUAD]]
1673 \# *Function:
1674 \#   Creates macros TABn and TAB n, where "n" is any arbitrary number.
1675 \#   TABn is a typesetting tab (i.e. a tab defined as an indent
1676 \#   from the page left offset plus a line length.)
1677 \# *Notes:
1678 \#   n      = arbitrary digit to identify the tab
1679 \#   indent = indent from left margin; unit of measure required
1680 \#   length = length of tab (unit of measure required; can be
1681 \#            \w'<string>'u--if more than one word in string, surround
1682 \#            with double quotes "\w'<three word string>'"
1683 \#   LRCJ   = quad for tab (left, right, center, justified)
1684 \#            If option QUAD afterwards is not given, quad is line for line
1685 \#            (no fill mode), meaning that there's no need for .BR or .br
1686 \#            between lines.
1687 \#   QUAD   = fill tab (so it behaves as if .QUAD LRC or .JUSTIFY
1688 \#            had been given).
1689 \#
1690 \#   N.B. -- indents *must* be turned off before setting tabs
1691 \#
1692 \# Tabs are not columnar in behaviour.  .TN and \*[TB+] permit
1693 \# bottom-line to bottom-line tab movement.
1694 \#
1695 \# When resetting tabs, .TQ must be invoked before .TAB_SET.
1696 \#
1697 \# Indents are turned off automatically whenever a new tab is called
1698 \# with TAB <n>.
1699 \#
1700 \# Generally, it's a good idea to make sure all indents are off
1701 \# before setting tabs.
1702 \#
1703 .MAC TAB_SET END
1704 .    br
1705 .    nr #TAB_NUMBER \\$1
1706 .    ds $CURRENT_TAB \\n[#TAB_NUMBER]
1707 .    nr #TAB_OFFSET (\\$2)
1708 .    nr #TAB_LENGTH (\\$3)
1709 .    MAC TAB\\n[#TAB_NUMBER]
1710 .        if !\\\\n[#TB+]=1 .br
1711 .        if \\\\n[#TB+]=1 \{\
1712 .           EL
1713 .           vpt 0
1714 .           rr #TB+
1715 .        \}
1716 .        in 0
1717 .        nr #TAB_ACTIVE 1
1718 .        nr #CURRENT_TAB \\n[#TAB_NUMBER]
1719 .        ds $CURRENT_TAB \\*[$CURRENT_TAB]
1720 .        nr #TAB_OFFSET\\*[$CURRENT_TAB] \\n[#TAB_OFFSET]
1721 .        nr #ST_OFFSET \\n[#TAB_OFFSET]
1722 .        ie !'\\\\n[.z]'' \
1723 \!.         po \\\\\\\\n[#L_MARGIN]u+\\\\n[#TAB_OFFSET\\\\*[$CURRENT_TAB]]u
1724 .        el \
1725 .           po \\\\n[#L_MARGIN]u+\\\\n[#TAB_OFFSET\\\\*[$CURRENT_TAB]]u
1726 .        ll \\n[#TAB_LENGTH]u
1727 .        ta \En[.l]u
1728 .        ie '\\$5'QUAD' \{\
1729 .           if '\\$4'L' .QUAD L
1730 .           if '\\$4'R' .QUAD R
1731 .           if '\\$4'C' .QUAD C
1732 .           if '\\$4'J' .JUSTIFY
1733 .        \}
1734 .        el \{\
1735 .           if '\\$4''  .LEFT
1736 .           if '\\$4'L' .LEFT
1737 .           if '\\$4'R' .RIGHT
1738 .           if '\\$4'C' .CENTER
1739 .           if '\\$4'J' .JUSTIFY
1740 .        \}
1741 .        if \\\\n[#TN]=1 \{\
1742 .           TRAP
1743 .           rr #TN
1744 .        \}
1745 ..
1746 .    rr #TAB_ACTIVE
1747 .END
1748 \#
1749 \# TAB
1750 \# ---
1751 \# *Arguments:
1752 \#   <tab number to tab into>
1753 \# *Function:
1754 \#   Moves to tab number passed as an argument.
1755 \#
1756 .MAC TAB END
1757 .    ds $TAB_NUMBER \\$1
1758 .    TAB\\*[$TAB_NUMBER]
1759 .    nr #IN_TAB 1
1760 .END
1761 \#
1762 \# TAB NEXT
1763 \# --------
1764 \# *Argument:
1765 \#   <none>
1766 \# *Function:
1767 \#   Automatically moves to TAB<n+1> on the same line as the last
1768 \#   line of the previous tab.
1769 \# *Notes:
1770 \#   The \c inline must be appended to the end of input lines when in
1771 \#   nofill mode; in fill modes, the \c inline must not be used.
1772 \#
1773 .MAC TN END
1774 .    nr #TN 1
1775 .    vpt 0
1776 .    sp -1v
1777 .    nr #NEXT_TAB \\n[#CURRENT_TAB]+1
1778 .    TAB\\n[#NEXT_TAB]
1779 .    vpt
1780 .END
1781 \#
1782 \# An inline escape to accomplish the same thing.  Preferable, since
1783 \# it works with filled and non-filled copy and doesn't require the
1784 \# user to remember to use (or not use) the \c.
1785 \#
1786 .ds TB+ \
1787 "\c\R'#TB+ 1'\R'#TN 1'\R'#NEXT_TAB \\n[#CURRENT_TAB]+1'\\*[TAB\\n[#NEXT_TAB]]\c
1788 \#
1789 \# TAB QUIT
1790 \# --------
1791 \# *Argument:
1792 \#   <none>
1793 \# *Function:
1794 \#   Sets #TAB_ACTIVE to "0" (off).
1795 \#   Resets left margin to value in effect prior to tabs.
1796 \#   Resets line length to value in effect prior to tabs.
1797 \#   Checks #QUAD to see if we were in flush or quad mode
1798 \#   prior to tabs (0=off, 1=on).
1799 \#   Resets QUAD [ L|R|C ], LEFT, RIGHT, CENTER, or JUSTIFY
1800 \#   in effect prior to tabs.
1801 \# *Notes:
1802 \#   TQ must precede setting new tabs to get the tabs' indents
1803 \#   measured from page left.  Otherwise, the tabs' indents are
1804 \#   measured from the left margin of the currently active tab.
1805 \#
1806 .MAC TQ END
1807 .    br
1808 .    rr #TAB_ACTIVE
1809 .    rr #IN_TAB
1810 .    nr #LOOP 0 1
1811 .    while \\n+[#LOOP]<20 \{\
1812 .       rm $ST\\n[#LOOP]_FILL
1813 .    \}
1814 .    rr #LOOP
1815 .    ie '\\n[.z]'FLOAT*DIV' \{\
1816 \!.     po \\n[#L_MARGIN]u
1817 \!.     ll \\n[#L_LENGTH]u
1818 .    \}
1819 .    el \{\
1820 .       po \\n[#L_MARGIN]u
1821 .       ll \\n[#L_LENGTH]u
1822 .    \}
1823 .    ll \\n[#L_LENGTH]u
1824 .    ta \\n[.l]u
1825 .    ie \\n[#QUAD] \{\
1826 .       ie '\\*[$RESTORE_QUAD_VALUE]'J' .JUSTIFY
1827 .       el .QUAD \\*[$RESTORE_QUAD_VALUE]
1828 .    \}
1829 .    el \{\
1830 .       if '\\*[$RESTORE_QUAD_VALUE]'LEFT' .LEFT
1831 .       if '\\*[$RESTORE_QUAD_VALUE]'RIGHT' .RIGHT
1832 .       if '\\*[$RESTORE_QUAD_VALUE]'CENTER' .CENTER
1833 .    \}
1834 .END
1835 \#
1836 \# ====================================================================
1837 \#
1838 \# COLOR HANDLING
1839 \# ==============
1840 \#
1841 \# COLOR
1842 \# -----
1843 \# *Arguments:
1844 \#   <pre-defined NEWCOLOR or XCOLOR>
1845 \# *Function:
1846 \#   Allows the inline escape for setting color to be called
1847 \#   as a macro.
1848 \#
1849 .MAC COLOR END
1850 .    ie \\n[.u]=1 \{\
1851 \c
1852 \\*[\\$1]\c
1853 .    \}
1854 .    el \\*[\\$1]
1855 .END
1856 \#
1857 \# NEWCOLOR
1858 \# --------
1859 \# *Arguments:
1860 \#   <color name> [<color scheme>] <color definition>
1861 \# *Function:
1862 \#   Based on .defcolor, allows users to name and define colors using
1863 \#   one of the four color schemes rgb, cmy, cmyk and grey.  The new
1864 \#   color is then defined as a string so that it can be called inline
1865 \#   with \*[COLORNAME] or with .COLOR.
1866 \# *Notes:
1867 \#   With only two args, the default color scheme is rgb.
1868 \#
1869 \#   It is highly recommended that users define new colors as
1870 \#   all-cap strings, to differentiate them from x colors, which must
1871 \#   be in lower case.
1872 \#
1873 .MAC NEWCOLOR END
1874 .    if \\n[#NUM_ARGS]=2 .defcolor \\$1 rgb \\$2
1875 .    if \\n[#NUM_ARGS]=3 \{\
1876 .       if '\\$2'RGB' .ds $COLOR_SCHEME rgb
1877 .       if '\\$2'CYM' .ds $COLOR_SCHEME cym
1878 .       if '\\$2'CMYK' .ds $COLOR_SCHEME cmyk
1879 .       if '\\$2'GRAY' .ds $COLOR_SCHEME gray
1880 .       if '\\$2'GREY' .ds $COLOR_SCHEME gray
1881 .       defcolor \\$1  \\*[$COLOR_SCHEME] \\$3
1882 .    \}
1883 .    ds \\$1 \\m[\\$1]
1884 .END
1885 \#
1886 \# XCOLOR
1887 \# ------
1888 \# *Arguments:
1889 \#   <x color name> [<alias>]
1890 \# *Function:
1891 \#   Defines a string of x color name (i.e. a predefined x
1892 \#   color).  If <alias> is given, creates a string of <alias name>
1893 \#   that references the x color name of the first argument.
1894 \# *Notes:
1895 \#   The color name must be a valid color name from rgb.txt, and
1896 \#   must be given entirely in lower case, all one word.
1897 \#
1898 .MAC XCOLOR END
1899 .    ds \\$1 \m[\\$1]
1900 .    if \\n[#NUM_ARGS]=2 \{\
1901 .       ds \\$2 \m[\\$1]
1902 .       ds $\\$2_FILL \\$1
1903 .       ds COLAL_\\$2 \\$1
1904 .    \}
1905 .END
1906 \#
1907 \# Pre-define xcolors black and white
1908 \#
1909 .ds black   \m[black]
1910 .ds BLACK   \m[black]
1911 .ds white   \m[white]
1912 .ds WHITE   \m[white]
1913 .ds default black
1914 \#
1915 \# =====================================================================
1916 \#
1917 \# +++MISCELLANEOUS USEFUL MACROS AND STRINGS+++
1918 \#
1919 .nr _w 500
1920 .nr _d 1250
1921 \#
1922 \# These string are used for creating aliases within loops that set
1923 \# style for doc-cover, cover, and docheader items.  They're defined
1924 \# here because underscoring needs them.
1925 \#
1926 .ds TITLE_TYPE_1  ATTRIBUTE
1927 .ds TITLE_TYPE_2  AUTHOR
1928 .ds TITLE_TYPE_3  CHAPTER
1929 .ds TITLE_TYPE_4  CHAPTER_TITLE
1930 .ds TITLE_TYPE_5  COVERTITLE
1931 .ds TITLE_TYPE_6  DOCTITLE
1932 .ds TITLE_TYPE_7  DOCTYPE
1933 .ds TITLE_TYPE_8  DOC_COVERTITLE
1934 .ds TITLE_TYPE_9  SUBTITLE
1935 .ds TITLE_TYPE_10 TITLE
1936 .ds TITLE_TYPE_11 MISC
1937 .ds TITLE_TYPE_12 COPYRIGHT
1938 .ds TITLE_TYPE_13 DOC_COVER_TITLE
1939 .ds TITLE_TYPE_14 COVER_TITLE
1940 \#
1941 \# UNDERLINE
1942 \# ---------
1943 \# *Arguments:
1944 \#   <none> | <anything>
1945 \# *Function:
1946 \#   Simulates typewriter-style underlining of italic passages.
1947 \# *Notes:
1948 \#   Defaults for rule weight and distance from baseline are below.
1949 \#   UNDERLINE_SPECS lets user change them
1950 \#
1951 .MAC UNDERLINE_SPECS END
1952 .    ie \B'\\$1' .nr _w (u;\\$1)
1953 .    el \{\
1954 .       ie '\\$1'DEFAULT' .nr _w 500
1955 .       el \{\
1956 .          nr _w 500
1957 .          tm1 "[mom]: The first argument to \\$0 must be a numeric
1958 .          tm1 "       argument with a unit of measure appended, or DEFAULT.
1959 .          tm1 "       Setting underline weight to DEFAULT.
1960 .       \}
1961 .    \}
1962 .    shift
1963 .    ie \B'\\$1' .nr _d (u;\\$1)
1964 .    el \{\
1965 .       ie '\\$1'DEFAULT' .nr _d 1250
1966 .       el \{\
1967 .          nr _d 1250
1968 .          tm1 "[mom]: The second argument to \\$0 must be a numeric
1969 .          tm1 "       argument with a unit of measure appended, or DEFAULT.
1970 .          tm1 "       Setting underline distance from baseline to DEFAULT.
1971 .       \}
1972 .    \}
1973 .END
1974 \#
1975 .MAC UNDERLINE END
1976 \c
1977 .    ds $SAVED_SS_VAR \\*[$SS_VAR]
1978 .    ie '\\$1'' \{\
1979 .       nr #UNDERLINE_ON 1
1980 .       ss \\n[.ss] (\\n[.ss]-\\n[.ss])
1981 .       ie !n .nop \X'ps: exec \\n[_w] \\n[_d] decorline'\c
1982 .       el .ul 1000
1983 .    \}
1984 .    el \{\
1985 .       nr #UNDERLINE_ON 0
1986 .       if !'\\*[$SAVED_SS_VAR]'' .SS \\*[$SAVED_SS_VAR]
1987 .       ie !n .nop \X'ps: exec decornone'\c
1988 .       el .ul 0
1989 .    \}
1990 .END
1991 \#
1992 \# UL/ULX
1993 \# ------
1994 \# *Arguments:
1995 \#   <none>
1996 \# *Function:
1997 \#   Simulates typewriter-style underlining of italic passages.
1998 \# *Notes:
1999 \#   Intended to be called with inline escapes \*[UL] (underline
2000 \#   on) and \*[ULX] (underline off).
2001 \#
2002 .MAC UL END
2003 \c
2004 .    ds $SAVED_SS_VAR \\*[$SS_VAR]
2005 .    ss \\n[.ss] (\\n[.ss]-\\n[.ss])
2006 .    ie !'\\n[.z]'' \{\
2007 \c
2008 .       ie !n \{\
2009 .          if !\\n[.k]=0 \?\h'-\w'\\n[.ss]'u'\?
2010 \?\R'#UNDERLINE_ON 1'\X'ps: exec \\n[_w] \\n[_d] decorline'\?\c
2011 .       \}
2012 .       el \{\
2013 \?\R'#UNDERLINE_ON 1'\?\c
2014 .          ul 1000
2015 .       \}
2016 .    \}
2017 .    el \{\
2018 .       ie !n \{\
2019 .          nr #UNDERLINE_ON 1
2020 .          nop \X'ps: exec \\n[_w] \\n[_d] decorline'\c
2021 .       \}
2022 .       el \{\
2023 \R'#UNDERLINE_ON 1'\c
2024 .          ul 1000
2025 .       \}
2026 .    \}
2027 .END
2028 \#
2029 .MAC ULX END
2030 \c
2031 .    SS \\*[$SAVED_SS_VAR]
2032 .    rm $SAVED_SS_VAR
2033 .    ie !'\\n[.z]'' \{\
2034 \c
2035 .       ie !n \{\
2036 \?\R'#UNDERLINE_ON 0'\X'ps: exec decornone'\?\c
2037 .       \}
2038 .       el \{\
2039 \?\R'#UNDERLINE_ON 0'\?\c
2040 .          ul 0
2041 .       \}
2042 .    \}
2043 .    el \{\
2044 .       ie !n \{\
2045 .          nr #UNDERLINE_ON 0
2046 .          nop \X'ps: exec decornone'\c
2047 .       \}
2048 .       el \{\
2049 .          nr #UNDERLINE_ON 0
2050 .          ul 0
2051 .       \}
2052 .    \}
2053 .END
2054 \#
2055 \# UNDERSCORE
2056 \# ----------
2057 \# *Arguments:
2058 \#   [<points below baseline>] "text"
2059 \# *Function:
2060 \#   Places an underscore 2 points under the string if no lead given,
2061 \#   otherwise places underscore under string by user specified amount.
2062 \# *Notes:
2063 \#   When using this macro, the string to be underscored must begin
2064 \#   with double-quotes ("), regardless of whether it's the sole
2065 \#   argument or the second.
2066 \#   E.g.:
2067 \#      .UNDERSCORE "Text to be underscored
2068 \#         or
2069 \#      .UNDERSCORE 2p "Text to be underscored
2070 \#
2071 \#   UNDERSCORE does not work across line breaks.  Each line of text
2072 \#   must be entered separately.  If the UNDERSCORE begins in the
2073 \#   middle of a line and crosses over a break, the portion before
2074 \#   the break and the portion afterwards must be entered
2075 \#   separately.
2076 \#
2077 .MAC UNDERSCORE END
2078 .    nr #SAVED_UNDERSCORE_WEIGHT     \\n[#UNDERSCORE_WEIGHT]
2079 .    nr #SAVED_UNDERSCORE_WEIGHT_ADJ \\n[#UNDERSCORE_WEIGHT_ADJ]
2080 .    ds $SAVED_UNDERSCORE_GAP        \\*[$UNDERSCORE_GAP]
2081 .    if \\n[#NUM_ARGS]=2 \{\
2082 .       ds $UNDERSCORE_GAP \\$1
2083 .       shift
2084 .    \}
2085 .    if !'\\*[$TITLE_TYPE]'' \{\
2086 .       nr #UNDERSCORE_WEIGHT     \\n[#\\*[$TITLE_TYPE]_UNDERLINE_WEIGHT]
2087 .       nr #UNDERSCORE_WEIGHT_ADJ \\n[#\\*[$TITLE_TYPE]_UNDERLINE_WEIGHT_ADJ]
2088 .       ds $UNDERSCORE_GAP        \\*[$\\*[$TITLE_TYPE]_UNDERLINE_GAP]
2089 .    \}
2090 .    nr #TEXT_WIDTH \w'\\$1'
2091 .    ie \\n[.u]=1 \{\
2092 \Z'\\$1'\
2093 \Z'\D't \\n[#UNDERSCORE_WEIGHT]''\
2094 \v'\\*[$UNDERSCORE_GAP]+\\n[#UNDERSCORE_WEIGHT_ADJ]u'\
2095 \D'l \\n[#TEXT_WIDTH]u 0'\
2096 \Z'\D't \\n[#RULE_WEIGHT]''\
2097 \v'-(\\*[$UNDERSCORE_GAP]+\\n[#UNDERSCORE_WEIGHT_ADJ]u)'\c
2098 .       nop
2099 .    \}
2100 .    el \{\
2101 \Z'\\$1'\
2102 \Z'\D't \\n[#UNDERSCORE_WEIGHT]''\
2103 \v'\\*[$UNDERSCORE_GAP]+\\n[#UNDERSCORE_WEIGHT_ADJ]u'\
2104 \D'l \\n[#TEXT_WIDTH]u 0'\
2105 \Z'\D't \\n[#RULE_WEIGHT]''\
2106 \v'-(\\*[$UNDERSCORE_GAP]+\\n[#UNDERSCORE_WEIGHT_ADJ]u)'
2107 .    \}
2108 .    nr #UNDERSCORE_WEIGHT     \\n[#SAVED_UNDERSCORE_WEIGHT]
2109 .    nr #UNDERSCORE_WEIGHT_ADJ \\n[#SAVED_UNDERSCORE_WEIGHT_ADJ]
2110 .    ds $UNDERSCORE_GAP        \\*[$SAVED_UNDERSCORE_GAP]
2111 .    rr #SAVED_UNDERSCORE_WEIGHT
2112 .    rr #SAVED_UNDERSCORE_WEIGHT_ADJ
2113 .    rm $SAVED_UNDERSCORE_GAP
2114 .    rm $TITLE_TYPE
2115 .END
2116 \#
2117 \# DOUBLE UNDERSCORE
2118 \# -----------------
2119 \# *Arguments:
2120 \#   [points below baseline] [points distance between rules] "text"
2121 \# *Function:
2122 \#   Same as UNDERSCORE, except it produces a double underscore.  The default
2123 \#   distance between the rules is 2 points.
2124 \# *Notes:
2125 \#   The same double-quote requirement as UNDERSCORE.
2126 \#
2127 .MAC UNDERSCORE2 END
2128 .    nr #SAVED_UNDERSCORE_WEIGHT     \\n[#UNDERSCORE_WEIGHT]
2129 .    nr #SAVED_UNDERSCORE_WEIGHT_ADJ \\n[#UNDERSCORE_WEIGHT_ADJ]
2130 .    ds $SAVED_UNDERSCORE_GAP        \\*[$UNDERSCORE_GAP]
2131 .    ds $SAVED_RULE_GAP              \\*[$RULE_GAP]
2132 .    if \\n[#NUM_ARGS]=2 \{\
2133 .       ds $UNDERSCORE_GAP \\$1
2134 .       shift
2135 .    \}
2136 .    if \\n[#NUM_ARGS]=3 \{\
2137 .       ds $UNDERSCORE_GAP \\$1
2138 .       ds $RULE_GAP \\$2
2139 .       shift 2
2140 .    \}
2141 .    if !'\\*[$TITLE_TYPE]'' \{\
2142 .       nr #UNDERSCORE_WEIGHT     \\n[#\\*[$TITLE_TYPE]_UNDERLINE_WEIGHT]
2143 .       nr #UNDERSCORE_WEIGHT_ADJ \\n[#\\*[$TITLE_TYPE]_UNDERLINE_WEIGHT_ADJ]
2144 .       ds $UNDERSCORE_GAP        \\*[$\\*[$TITLE_TYPE]_UNDERLINE_GAP]
2145 .       ds $RULE_GAP              \\*[$\\*[$TITLE_TYPE]_RULE_GAP]
2146 .    \}
2147 .    nr #TEXT_WIDTH \w'\\$1'
2148 .    ie \\n[.u]=1 \{\
2149 \Z'\\$1'\
2150 \Z'\D't \\n[#UNDERSCORE_WEIGHT]''\
2151 \v'\\*[$UNDERSCORE_GAP]+\\n[#UNDERSCORE_WEIGHT_ADJ]u'\
2152 \Z'\D'l \\n[#TEXT_WIDTH]u 0''\
2153 \v'\\*[$RULE_GAP]+\\n[#UNDERSCORE_WEIGHT]u'\
2154 \D'l \\n[#TEXT_WIDTH]u 0'\
2155 \Z'\D't \\n[#RULE_WEIGHT]''\
2156 \v'-(\\*[$UNDERSCORE_GAP]+\\*[$RULE_GAP])-(\\n[#UNDERSCORE_WEIGHT]u*2u)'\c
2157 .    \}
2158 .    el \{\
2159 \Z'\\$1'\
2160 \Z'\D't \\n[#UNDERSCORE_WEIGHT]''\
2161 \v'\\*[$UNDERSCORE_GAP]+\\n[#UNDERSCORE_WEIGHT_ADJ]u'\
2162 \Z'\D'l \\n[#TEXT_WIDTH]u 0''\
2163 \v'\\*[$RULE_GAP]+\\n[#UNDERSCORE_WEIGHT]u'\
2164 \D'l \\n[#TEXT_WIDTH]u 0'\
2165 \Z'\D't \\n[#RULE_WEIGHT]''\
2166 \v'-(\\*[$UNDERSCORE_GAP]+\\*[$RULE_GAP])-(\\n[#UNDERSCORE_WEIGHT]u*2u)'
2167 .    \}
2168 .    nr #UNDERSCORE_WEIGHT     \\n[#SAVED_UNDERSCORE_WEIGHT]
2169 .    nr #UNDERSCORE_WEIGHT_ADJ \\n[#SAVED_UNDERSCORE_WEIGHT_ADJ]
2170 .    ds $UNDERSCORE_GAP        \\*[$SAVED_UNDERSCORE_GAP]
2171 .    rr #SAVED_UNDERSCORE_WEIGHT
2172 .    rr #SAVED_UNDERSCORE_WEIGHT_ADJ
2173 .    rm $SAVED_UNDERSCORE_GAP
2174 .    rm $SAVED_RULE_GAP
2175 .    rm $TITLE_TYPE
2176 .END
2177 \#
2178 \# Default underscoring underline and rule gaps
2179 \#
2180 .ds $BIB_STRING_RULE_GAP      2p
2181 .ds $BIB_STRING_UNDERLINE_GAP 2p
2182 .ds $EN_STRING_RULE_GAP       2p
2183 .ds $EN_STRING_UNDERLINE_GAP  2p
2184 .ds $EN_TITLE_UNDERLINE_GAP   2p
2185 .ds $RULE_GAP                 2p
2186 .ds $TOC_HEADER_RULE_GAP      2p
2187 .ds $TOC_HEADER_UNDERLINE_GAP 2p
2188 .ds $UNDERSCORE_GAP           2p
2189 \#
2190 .nr #LOOP 0 1
2191 .while \n+[#LOOP]<=14 \{\
2192 . ds $\*[TITLE_TYPE_\n[#LOOP]]_RULE_GAP                2p
2193 . ds $COVER_\*[TITLE_TYPE_\n[#LOOP]]_RULE_GAP          2p
2194 . ds $DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_RULE_GAP      2p
2195 . ds $\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_GAP           2p
2196 . ds $COVER_\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_GAP     2p
2197 . ds $DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_GAP 2p
2198 .\}
2199 \#
2200 \# SUPERSCRIPT
2201 \# -----------
2202 \# *Function:
2203 \#   Prints everything after inline invocation as superscript.
2204 \# *Notes:
2205 \#   \*[SUP] and \*[SUPX] turn superscript on and off respectively.
2206 \#   If running type is pseudo-condensed/expanded, invoke the superscript
2207 \#   strings as \*[CONDSUP] or \*[EXTSUP] and turn off with \*[CONDSUPX]
2208 \#   and \*[EXTSUPX] respectively.
2209 \#
2210 \# Default raise/lower amount
2211 .ds $SUP_RAISE \v'-.3m'
2212 .ds $SUP_LOWER \v'.3m'
2213 \#
2214 \# SUPERSCRIPT RAISE
2215 \# -----------------
2216 \# *Argument:
2217 \#   <amount to raise superscript>
2218 \# *Function:
2219 \#   Defines strings $SUP_RAISE and $SUP_LOWER for use with \*[SUP],
2220 \#   \*[CONDSUP] and \*[EXTSUP].
2221 \#
2222 .MAC SUPERSCRIPT_RAISE_AMOUNT END
2223 .    ds $SUP_RAISE_AMOUNT \\$1
2224 .    ds $SUP_RAISE \v'-\\*[$SUP_RAISE_AMOUNT]'
2225 .    ds $SUP_LOWER \v'\\*[$SUP_RAISE_AMOUNT]'
2226 .END
2227 \#
2228 .ds SUP \
2229 \R'#PT_SIZE_IN_UNITS \En[.ps]'\
2230 \R'#SUP_PT_SIZE \En[#PT_SIZE_IN_UNITS]u*6u/10u'\
2231 \s[\En[#PT_SIZE_IN_UNITS]u]\E*[$SUP_RAISE]\s[\En[#SUP_PT_SIZE]u]
2232 \#
2233 .ds SUPX \s[\En[#PT_SIZE_IN_UNITS]u]\E*[$SUP_LOWER]
2234 \#
2235 .ds CONDSUP \
2236 \R'#PT_SIZE_IN_UNITS \En[.ps]'\
2237 \R'#SUP_PT_SIZE \En[#PT_SIZE_IN_UNITS]u*6u/10u'\
2238 \s[\En[#PT_SIZE_IN_UNITS]u]\E*[$SUP_RAISE]\s[\En[#SUP_PT_SIZE]u]\E*[COND_FOR_SUP]
2239 \#
2240 .ds CONDSUPX \s[\En[#PT_SIZE_IN_UNITS]u]\E*[$SUP_LOWER]\E*[COND]
2241 \#
2242 .ds EXTSUP \
2243 \R'#PT_SIZE_IN_UNITS \En[.ps]'\
2244 \R'#SUP_PT_SIZE \En[#PT_SIZE_IN_UNITS]u*6u/10u'\
2245 \s[\En[#PT_SIZE_IN_UNITS]u]\E*[$SUP_RAISE]\s[\En[#SUP_PT_SIZE]u]\E*[EXT_FOR_SUP]
2246 \#
2247 .ds EXTSUPX \s[\En[#PT_SIZE_IN_UNITS]u]\E*[$SUP_LOWER]\E*[EXT]
2248 \#
2249 \# SLANT
2250 \# -----
2251 \#
2252 \# SETSLANT
2253 \# --------
2254 \# *Arguments:
2255 \#   <number of degrees> | RESET
2256 \# *Function:
2257 \#   Modifies register #DEGREES for use with \*[SLANT], or resets
2258 \#   it to the default.  Defines string \*[SLANTX]
2259 \# *Notes:
2260 \#   \*[SLANT] permits pseudo-italicizing of a font in cases where
2261 \#   no italic font exists in a particular family.
2262 \#
2263 \#   Default # of degrees is 15.
2264 \#
2265 \#   Do not use unit of measure with arg to SETSLANT.
2266 \#
2267 \#   It may be necessary to adjust the spacing on either side of
2268 \#   [SLANT] and [SLANTX].
2269 \#
2270 \#   In docs, SLANT carries over from para to para.
2271 \#
2272 .nr #DEGREES 15
2273 .ds SLANT \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
2274 .ds SLANTX \ER'#SLANT_ON 0'\ES'0'
2275 \#
2276 .MAC SETSLANT END
2277 .    ie '\\$1'RESET' \{\
2278 .       nr #DEGREES 15
2279 .       if \\n[#PRINT_STYLE]=1 \
2280 .          if \\n[#UNDERLINE_SLANT] .return
2281 .       ds SLANT \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
2282 .    \}
2283 .    el \{\
2284 .       nr #DEGREES \\$1
2285 .       if \\n[#PRINT_STYLE]=1 \
2286 .          if \\n[#UNDERLINE_SLANT] .return
2287 .       ds SLANT \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
2288 .    \}
2289 .    ds SLANTX \ER'#SLANT_ON 0'\ES'0'
2290 .END
2291 \#
2292 \# BOLDER
2293 \# ------
2294 \#
2295 \# SETBOLDER
2296 \# ---------
2297 \# *Arguments:
2298 \#   <amount of emboldening> | RESET
2299 \# *Function:
2300 \#   Modifies register #BOLDER_UNITS for use with \*[BOLDER], or resets
2301 \#   it to the default 700 units.
2302 \# *Notes:
2303 \#   \*[BOLDER] allows pseudo-emboldening of a font where no bold
2304 \#   font exists in a particular family.
2305 \#
2306 \#   Default for SETBOLDER is 700 units.  Do not use unit of measure
2307 \#   with arg to SETBOLDER.
2308 \#
2309 .nr #BOLDER_UNITS 700
2310 \#
2311 .MAC SETBOLDER END
2312 .    if \\n[#IGNORE]=1 .return
2313 .    ie '\\$1'RESET' .nr #BOLDER_UNITS 700
2314 .    el              .nr #BOLDER_UNITS \\$1
2315 .END
2316 \#
2317 .MAC BOLDER END
2318 \c
2319 .bd \\n[.f] \\n[#BOLDER_UNITS]
2320 .END
2321 \#
2322 .MAC BOLDERX END
2323 \c
2324 .bd \\n[.f]
2325 .END
2326 \#
2327 \# +++CONDENSE/EXTEND+++
2328 \#
2329 \# CONDENSE/EXTEND
2330 \# ---------------
2331 \# *Arguments:
2332 \#   <percentage to condense/expand type size>
2333 \# *Function:
2334 \#   Stores current point size in z's in #PT_SIZE_IN_UNITS, figures out
2335 \#   new point size (for character width) from arg, and defines string
2336 \#   COND or EXT, which set the type size to the new character width,
2337 \#   and sets the height of type to the value stored in CURRENT_PT_SIZE
2338 \# *Notes:
2339 \#   CONDENSE_OR_EXTEND is invoked from the aliases
2340 \#   CONDENSE and EXTEND.  CONDENSE implies <100, EXTEND
2341 \#   implies >100.  Do not use a percent sign in the argument.
2342 \#
2343 \#   There is no default setting for CONDENSE or EXTEND.
2344 \#   80 is a good approximation of condensed type, 120 is okay
2345 \#   for extended.
2346 \#
2347 \#   The value set by CONDENSE or EXTEND applies to all
2348 \#   subsequent \*[COND] or \*[EXT] escapes until a new value is set.
2349 \#
2350 \#  \*[COND] or \*[EXT] must be turned off before all changes of point
2351 \#  size, and reinvoked afterwards (if so desired).  This refers to
2352 \#  changes of point size via control lines AND via inlines.
2353 \#
2354 .MAC CONDENSE_OR_EXTEND END
2355 .    if '\\$0'CONDENSE' \{\
2356 .       ds $COND_PERCENT \\$1
2357 .       if \\n[#PRINT_STYLE]=1 \{\
2358 .          rm $COND_PERCENT
2359 .          ds $COND_PERCENT 100
2360 .       \}
2361 .       ds COND \
2362 \R'#PT_SIZE_IN_UNITS \En[.ps]'\
2363 \R'#CONDENSE 1'\
2364 \R'#COND_WIDTH (\En[#PT_SIZE_IN_UNITS]u*\E*[$COND_PERCENT]u)/100'\
2365 \Es[\En[#COND_WIDTH]u]\EH'\En[#PT_SIZE_IN_UNITS]u'
2366 .       ds COND_FOR_SUP \
2367 \R'#COND_WIDTH (\En[#SUP_PT_SIZE]u*\E*[$COND_PERCENT]u)/100'\
2368 \Es[\En[#COND_WIDTH]u]\H'\En[#SUP_PT_SIZE]u'
2369 .    \}
2370 .    if '\\$0'EXTEND' \{\
2371 .       ds $EXT_PERCENT \\$1
2372 .       if \\n[#PRINT_STYLE]=1 \{\
2373 .          rm $EXT_PERCENT
2374 .          ds $EXT_PERCENT 100
2375 .       \}
2376 .       ds EXT \
2377 \R'#PT_SIZE_IN_UNITS \En[.ps]'\
2378 \R'#EXTEND 1'\
2379 \R'#EXT_WIDTH (\En[#PT_SIZE_IN_UNITS]u*\E*[$EXT_PERCENT]u)/100'\
2380 \Es[\En[#EXT_WIDTH]u]\EH'\En[#PT_SIZE_IN_UNITS]u'
2381 .       ds EXT_FOR_SUP \
2382 \R'#EXT_WIDTH (\En[#SUP_PT_SIZE]u*\E*[$EXT_PERCENT]u)/100'\
2383 \Es[\En[#EXT_WIDTH]u]\H'\En[#EXT_PT_SIZE]u'
2384 .    \}
2385 .END
2386 \#
2387 .ds CONDX \
2388 \ER'#CONDENSE 0'\Es[0]\R'#PT_SIZE_IN_UNITS \En[.ps]'\H'\En[#PT_SIZE_IN_UNITS]u'
2389 .ds EXTX  \
2390 \ER'#EXTEND   0'\Es[0]\R'#PT_SIZE_IN_UNITS \En[.ps]'\H'\En[#PT_SIZE_IN_UNITS]u'
2391 \#
2392 \# +++PAD LINES+++ (insert space)
2393 \#
2394 \# PAD MARKER
2395 \# ----------
2396 \# *Arguments:
2397 \#   <character to use for marking pad points>
2398 \# *Function:
2399 \#   Defines string $PAD_MARKER, used in PAD
2400 \# *Notes:
2401 \#   $PAD_MARKER is normally # (the pound sign).
2402 \#
2403 .MAC PAD_MARKER END
2404 .    ds $PAD_MARKER \\$1
2405 .END
2406 \#
2407 \# PAD
2408 \# ---
2409 \# *Arguments:
2410 \#   "<string of text with padding markers inserted>"
2411 \#   "<id of bookmark created by .PDF_BOOKMARK>"
2412 \# *Function:
2413 \#   Defines and redefines padding character (default=pound sign
2414 \#   unless padding character has been set with PAD_MARKER)
2415 \#   several times so that when the string is output at the end
2416 \#   of the macro, every # has been converted to an equal-sized
2417 \#   amount of padding (blank space) on a line.
2418 \# *Notes:
2419 \#   String tabs may be marked off during PAD.
2420 \#
2421 .MAC PAD END
2422 .    if \\n[.u]=1 .nr fill 1
2423 .    nf
2424 .    if !d$PAD_MARKER .ds $PAD_MARKER #
2425 .    char \\*[$PAD_MARKER] \R'#PAD_COUNT \En[#PAD_COUNT]+1'
2426 .    ds $FAMILY_FOR_PAD \\n[.fam]
2427 .\" .if !n .fp \\n[.fp] \\n[.sty]
2428 .    ds $FONT_FOR_PAD   \\n[.sty]
2429 .    nr #SIZE_FOR_PAD   \\n[.ps]
2430 .    ds $PAD_STRING \\$1
2431 .    as $PAD_STRING \Ekp
2432 .    di PAD_STRING
2433 .    fam \\*[$FAMILY_FOR_PAD]
2434 \f[\\*[$FONT_FOR_PAD]]\s[\\n[#SIZE_FOR_PAD]u]\\*[$PAD_STRING]
2435 .    br
2436 .    di
2437 .    if \\n[#INDENT_ACTIVE] \{\
2438 .       if \\n[#INDENT_LEFT_ACTIVE]  .ll -\\n[#L_INDENT]u
2439 .       if \\n[#INDENT_RIGHT_ACTIVE] .ll -\\n[#R_INDENT]u
2440 .       if \\n[#INDENT_BOTH_ACTIVE]  .ll -\\n[#BR_INDENT]u
2441 .    \}
2442 .    char \\*[$PAD_MARKER] \
2443 \R'#SPACE_TO_END \En[.l]-\En[p]'\R'#PAD_SPACE \En[#SPACE_TO_END]/\En[#PAD_COUNT]'
2444 .    di PAD_STRING
2445 .    fam \\*[$FAMILY_FOR_PAD]
2446 \f[\\*[$FONT_FOR_PAD]]\s[\\n[#SIZE_FOR_PAD]u]\\*[$PAD_STRING]
2447 .    br
2448 .    di
2449 .    if \\n[#INDENT_ACTIVE] \
2450 .       if (\\n[#INDENT_LEFT_ACTIVE]=1):(\\n[#INDENT_BOTH_ACTIVE]) .ll
2451 .    char \\*[$PAD_MARKER] \h'\En[#PAD_SPACE]u'
2452 .    if \\n[#SILENT] .SILENT
2453 .    fam \\*[$FAMILY_FOR_PAD]
2454 \f[\\*[$FONT_FOR_PAD]]\s[\\n[#SIZE_FOR_PAD]u]
2455 .    ie '\\$2'' .nop \\*[$PAD_STRING]
2456 .    el \{\
2457 .       ie !'\\$2'NOBREAK' .pdfhref L -D "\\$2" -E -- \&\\*[$PAD_STRING]
2458 .       el .nop \\*[$PAD_STRING]
2459 .    \}
2460 .    if \\n[#SILENT] .SILENT OFF
2461 .    br
2462 .    if \\n[fill] \{\
2463 .       fi
2464 .       rr fill
2465 .    \}
2466 .    rr #PAD_COUNT
2467 .    rr #SPACE_TO_END
2468 .    rr #PAD_SPACE
2469 .    rm $PAD_STRING
2470 .    rm PAD_STRING
2471 .    rchar \\*[$PAD_MARKER]
2472 .    if '\\$2'NOBREAK' \{\
2473 .       TRAP OFF
2474 .       EOL
2475 .       TRAP
2476 .    \}
2477 .END
2478 \#
2479 \# +++LEADERS+++
2480 \#
2481 \# The leader mechanism is primitive, but it works.  Basically, every
2482 \# macro in this set that includes a line length also sets a single
2483 \# groff tab stop at the right hand end of the line.  That way,
2484 \# whenever Ctrl-A is invoked (always at the end of an input line),
2485 \# leader of the correct length gets deposited.  Ctrl-A is accessed by
2486 \# the string LEADER (i.e. inline, as \*[LEADER]).  Leaders within tabs
2487 \# get their length from the tab line length.
2488 \#
2489 \# SET LEADER CHARACTER
2490 \# --------------------
2491 \# *Arguments:
2492 \#   <character to use whenever \*[LEADER] is invoked>
2493 \# *Function:
2494 \#   Set leader character.
2495 \#
2496 .MAC LEADER_CHARACTER END
2497 .    lc \\$1
2498 .END
2499 \#
2500 .ds LEADER \ 1
2501 \#
2502 \# +++DROP CAPS+++
2503 \#
2504 \# DROP CAP FAMILY
2505 \# ---------------
2506 \# *Argument:
2507 \#   <family of drop cap>
2508 \# *Function:
2509 \#   Creates or modifies string $DC_FAM.
2510 \#
2511 .MAC DROPCAP_FAMILY END
2512 .    ds $DC_FAM \\$1
2513 .END
2514 \#
2515 \# DROP CAP FONT
2516 \# -------------
2517 \# *Argument:
2518 \#   <font of drop cap>
2519 \# *Function:
2520 \#   Creates or modifies string $DC_FT.
2521 \#
2522 .MAC DROPCAP_FONT END
2523 .    ds $DC_FT \\$1
2524 .END
2525 \#
2526 \# DROPCAP COLOR
2527 \# -------------
2528 \# *Arguments:
2529 \#   <pre-defined XCOLOR or NEWCOLOR>
2530 \# *Function:
2531 \#   Defines string $DC_COLOR to argument.
2532 \# *Notes:
2533 \#   User must define an XCOLOR or NEWCOLOR before using
2534 \#   DC_COLOR.
2535 \#
2536 .MAC DROPCAP_COLOR END
2537 .    if \\n[#PRINT_STYLE]=1 .return
2538 .    nr #DC_COLOR 1
2539 .    ds $DC_COLOR \\$1
2540 .END
2541 \#
2542 \# DROP CAP GUTTER
2543 \# ---------------
2544 \# *Argument:
2545 \#   <width of gutter between drop cap and indented text>
2546 \# *Function:
2547 \#   Creates or modifies register #DC_GUT.
2548 \# *Notes:
2549 \#   Requires unit of measure.  Default is 3p.
2550 \#
2551 .MAC DROPCAP_GUTTER END
2552 .    nr #DC_GUT (\\$1)
2553 .END
2554 \#
2555 \# DROP CAP ADJUST
2556 \# ---------------
2557 \# *Argument:
2558 \#   <+|- # of points to in/decrease point size of drop cap letter>
2559 \# *Function:
2560 \#   Creates or modifies string $DC_ADJUST.
2561 \# *Notes:
2562 \#   Despite its best efforts, DROPCAP doesn't always get the point
2563 \#   size of the drop cap critically perfect.  DROPCAP_ADJUST lets
2564 \#   the user add or subtract points (or fractions of points) to
2565 \#   get the size right.
2566 \#
2567 \#   Requires the + or - sign.
2568 \#
2569 .MAC DROPCAP_ADJUST END
2570 .    ds $DC_ADJUST \\$1
2571 .END
2572 \#
2573 \# DROP CAP
2574 \# --------
2575 \# *Arguments:
2576 \#   <dropcap letter> <# of lines> [COND <% to condense> | EXT <% to extend>]
2577 \# *Function:
2578 \#   Calculates point size of dropcap based on # of lines passed as
2579 \#   arg 2.  Sets indent for text based on dropcap width+gutter.
2580 \#   Advances and prints dropcap; reverses and prints indented text
2581 \#   to bottom of dropcap, then resets indent to left margin (plus
2582 \#   any indent that was in effect prior to invoking DROPCAP).
2583 \# *Notes:
2584 \#   Drop caps when using the doc processing macro PP only work with
2585 \#   initial paragraphs (i.e. at doc start, or after heads), only when
2586 \#   DROPCAPS comes immediately after PP, and only when the PRINTSTYLE
2587 \#   is TYPESET.  If these conditions aren't met, DROPCAPS is silently
2588 \#   ignored.
2589 \#
2590 \#   The COND or EXT argument are processed separately from all
2591 \#   other COND or EXT inlines or macros, hence passing COND or
2592 \#   EXT has no effect on running type.
2593 \#
2594 .MAC DROPCAP END
2595 .    if \\n[#IGNORE]=1 \{\
2596 .       PRINT \\$1\c
2597 .       return
2598 .    \}
2599 .    br
2600 .    if n \{\
2601 .       PRINT \\$1\c
2602 .       return
2603 .    \}
2604 .    if \\n[#DOCS] \{\
2605 .       if \\n[#PRINT_STYLE]=1 \{\
2606 .          PRINT \\$1\c
2607 .          return
2608 .       \}
2609 .       if \\n[#PRINT_STYLE]=2 \{\
2610 .          sp -1
2611 .          if \\n[#PP_STYLE]=2 \{\
2612 .             PRINT \\$1\c
2613 .             return
2614 .          \}
2615 .          if \\n[#PP]>1 \{\
2616 .             if \\n[#PP_INDENT] .ti \\n[#PP_INDENT]u
2617 .             PRINT \\$1\c
2618 .             return
2619 .          \}
2620 .          ti 0
2621 .       \}
2622 .    \}
2623 .    ds $DROPCAP         \\$1
2624 .    nr #DC_LINES        \\$2-1
2625 .    if \\n[#CONDENSE]=1 \{\
2626 .       ds $RESTORE_COND \\*[$COND_PERCENT]
2627 \\*[CONDX]
2628 .       nr #CONDENSE_WAS_ON 1
2629 .    \}
2630 .    if \\n[#EXTEND]=1 \{\
2631 .       ds $RESTORE_EXT \\*[$EXT_PERCENT]
2632 \\*[EXTX]
2633 .       nr #EXTEND_WAS_ON 1
2634 .    \}
2635 .    if '\\$3'COND' .CONDENSE \\$4
2636 .    if '\\$3'EXT' .EXTEND \\$4
2637 .    if !r#DC_GUT .nr #DC_GUT 3p
2638 .    ie \\n[#DOCS] .ds $RESTORE_FAM \\*[$DOC_FAM]
2639 .    el .ds $RESTORE_FAM \\n[.fam]
2640 .    ie \\n[#DOCS] .ds $RESTORE_FT  \\*[$PP_FT]
2641 .    el .ds $RESTORE_FT  \\*[$FONT]
2642 .    nr #RESTORE_PT_SIZE \\n[#PT_SIZE]
2643 .    nr #RESTORE_INDENT  \\n[.i]
2644 .    SIZESPECS
2645 .    nr #DC_HEIGHT \\n[#DC_LINES]*\\n[#LEAD]+\\n[#CAP_HEIGHT]
2646 .    ie !d$DC_FAM .FAM \\n[.fam]
2647 .    el .FAM \\*[$DC_FAM]
2648 .    ie !d$DC_FT .FT \\*[$FONT]
2649 .    el .FT \\*[$DC_FT]
2650 .    while \\n[#GET_DC_HEIGHT]<\\n[#DC_HEIGHT] \{\
2651 .       ps \\n[#PT_SIZE]u+100u
2652 .       SIZESPECS
2653 .       nr #GET_DC_HEIGHT \\n[#CAP_HEIGHT]
2654 .    \}
2655 .    if d$DC_ADJUST .ps \\*[$DC_ADJUST]p
2656 .    nr #DC_LINES +1
2657 .    if \\n[#DC_LINES]v>\\n[.t] \{\
2658 .       nr pgnum \\n%+\\n[#PAGE_NUM_ADJ] 1
2659 .       if \\n[#COLUMNS]=1 .ds col-num ", column \\n[#COL_NUM]
2660 .       tm1 \
2661 "[mom]: Dropcap at line \\n[.c] does not fit on page \\n[pgnum]\\*[col-num].
2662 .       tm1 \
2663 "       Shifting paragraph to next page or column.
2664 .       ie \\n[#COLUMNS] .COL_NEXT
2665 .       el .NEWPAGE
2666 .    \}
2667 .    ie \\n[#DC_COLOR]=1 \{\
2668 .       ie !'\\$3'' \{\
2669 .          ie '\\$3'COND' \
2670 .             PRINT \
2671 \\*[DOWN \\n[#DC_LINES]v]\
2672 \m[\\*[$DC_COLOR]]\\*[COND]\\*[$DROPCAP]\\*[CONDX]\m[]\\*[UP \\n[#DC_LINES]v]
2673 .          el \
2674 .             PRINT \
2675 \\*[DOWN \\n[#DC_LINES]v]\
2676 \m[\\*[$DC_COLOR]]\\*[EXT]\\*[$DROPCAP]\\*[EXTX]\m[]\\*[UP \\n[#DC_LINES]v]
2677 .       \}
2678 .       el .PRINT \
2679 \\*[DOWN \\n[#DC_LINES]v]\
2680 \m[\\*[$DC_COLOR]]\\*[$DROPCAP]\m[]\\*[UP \\n[#DC_LINES]v]
2681 .    \}
2682 .    el \{\
2683 .       ie !'\\$3'' \{\
2684 .          ie '\\$3'COND' \
2685 .             PRINT \
2686 \\*[DOWN \\n[#DC_LINES]v]\
2687 \\*[COND]\\*[$DROPCAP]\\*[CONDX]\\*[UP \\n[#DC_LINES]v]
2688 .          el \
2689 .             PRINT \
2690 \\*[DOWN \\n[#DC_LINES]v]\
2691 \\*[EXT]\\*[$DROPCAP]\\*[EXTX]\\*[UP \\n[#DC_LINES]v]
2692 .       \}
2693 .       el .PRINT \
2694 \\*[DOWN \\n[#DC_LINES]v]\
2695 \\*[$DROPCAP]\\*[UP \\n[#DC_LINES]v]
2696 .    \}
2697 .    if '\\$3'COND' \E*[COND]
2698 .    if '\\$3'EXT' \E*[EXT]
2699 .    ie \\n[.i] \{\
2700 .       vs 0
2701 .       br
2702 .       in +\w'\\*[$DROPCAP]'u+\\n[#DC_GUT]u
2703 .       vs
2704 .    \}
2705 .    el \{\
2706 .       vs 0
2707 .       br
2708 .       in \w'\\*[$DROPCAP]'u+\\n[#DC_GUT]u
2709 .       vs
2710 .    \}
2711 .    if '\\$3'COND' \E*[CONDX]\c
2712 .    if '\\$3'EXT' \E*[EXTX]\c
2713 .    FAM \\*[$RESTORE_FAM]
2714 .    FT  \\*[$RESTORE_FT]
2715 .    ps \\n[#RESTORE_PT_SIZE]u
2716 .    if \\n[#CONDENSE_WAS_ON] \{\
2717 .       CONDENSE \\*[$RESTORE_COND]
2718 \\*[COND]\c
2719 .    \}
2720 .    if \\n[#EXTEND_WAS_ON] \{\
2721 .       EXTEND \\*[$RESTORE_EXT]
2722 \\*[EXT]\c
2723 .    \}
2724 .    ie \\n[.u] .wh \\n[.d]u+\\n[#DC_HEIGHT]u-1v DROPCAP_OFF
2725 .    el .wh \\n[.d]u+\\n[#DC_HEIGHT]u DROPCAP_OFF
2726 .    rr #CONDENSE_WAS_ON
2727 .    rr #EXTEND_WAS_ON
2728 .    rm $DROPCAP
2729 .    rr #DC_LINES
2730 .    rm $RESTORE_COND
2731 .    rm $RESTORE_EXT
2732 .    rm $RESTORE_FAM
2733 .    rm $RESTORE_FT
2734 .    rr #RESTORE_PT_SIZE
2735 .    rr #RESTORE_INDENT
2736 .    rr #DC_HEIGHT
2737 .    rr #GET_DC_HEIGHT
2738 .    rr x
2739 .END
2740 \#
2741 .MAC DROPCAP_OFF END
2742 '    in \\n[#RESTORE_INDENT]u
2743 .    ch DROPCAP_OFF
2744 .END
2745 \#
2746 \# =====================================================================
2747 \#
2748 \# +++GRAPHICAL OBJECTS+++
2749 \#
2750 \# Set params for graphical objects.
2751 \#
2752 .MAC GRAPHICAL_OBJ END
2753 .    rr #FILLED
2754 .    rr #FILL_MODE
2755 .    rr #NOFILL
2756 .    rr #NOFILL_MODE
2757 .    if \\n[.vpt]=1 \{\
2758 .       vpt 0
2759 .       nr #RESTORE_TRAP 1
2760 .    \}
2761 .    ie !\\n[#NO_ADVANCE]=1 .br
2762 .    el \{\
2763 .       sp -1v
2764 .       rr #NO_ADVANCE
2765 .    \}
2766 .    ie \\n[.u]=1 \{\
2767 .       nr #FILLED 1
2768 .       nr #FILL_MODE \\n[.j]
2769 .    \}
2770 .    el \{\
2771 .       nr #NOFILL 1
2772 .       if \\n[.ce]>0 .nr #NOFILL_MODE 3
2773 .       if \\n[.rj]>0 .nr #NOFILL_MODE 5
2774 .       ce 0
2775 .       rj 0
2776 .    \}
2777 .    nf
2778 .END
2779 \#
2780 \# HORIZONTAL RULE - DRH
2781 \# ---------------------
2782 \# *Arguments:
2783 \#   <none> | <rule weight> <indent> <length> [ <color> ]
2784 \# *Function:
2785 \#   With no arg, draws a full measure rule.  With args, draws
2786 \#   described horizontal rule.
2787 \# *Notes:
2788 \#   Rules are drawn left-to-right, from the baseline down, and
2789 \#   return to their point of origin.  Color must be set in the
2790 \#   macro; otherwise the color will be black, regardless of current
2791 \#   .gcolor.  If no arg given, the rule weight is the one set by
2792 \#   RULE_WEIGHT.
2793 \#
2794 .MAC DRH END
2795 .    GRAPHICAL_OBJ
2796 .    ds $RL_WEIGHT \\$1
2797 .    ds $RL_INDENT \\$2
2798 .    ds $RL_LENGTH \\$3
2799 .    ie !'\\$4'' .ds $RL_COLOR  \\$4
2800 .    el          .ds $RL_COLOR \\*[default]
2801 .    nr #SAVED_WEIGHT     \\n[#RULE_WEIGHT]
2802 .    nr #SAVED_WEIGHT_ADJ \\n[#RULE_WEIGHT_ADJ]
2803 .    di NULL
2804 .       if \\n[#NUM_ARGS]>=1 .RULE_WEIGHT \\*[$RL_WEIGHT]
2805 .    di
2806 .    COLOR \\*[$RL_COLOR]
2807 .    ie \\n[#NUM_ARGS]=0 \{\
2808 .       ie \\n[#INDENT_ACTIVE] \{\
2809 .          nr #RESTORE_L_LENGTH \\n[.l]
2810 .          if \\n[#INDENT_BOTH_ACTIVE] .ll \\n[.l]u-\\n[#BL_INDENT]u
2811 .          if \\n[#INDENT_LEFT_ACTIVE] .ll \\n[.l]u-\\n[#L_INDENT]u
2812 \D't \\n[#RULE_WEIGHT]'\
2813 \h'\\*[$RL_INDENT]-\\n[#RULE_WEIGHT]u'\
2814 \v'\\n[#RULE_WEIGHT_ADJ]u'\
2815 \D'l \En[.l]u 0'\v'-\\n[#RULE_WEIGHT_ADJ]u'\
2816 \v'-\\n[#RULE_WEIGHT_ADJ]u'\
2817 \D't \\n[#SAVED_RULE_WEIGHT]'
2818 .          ll \\n[#RESTORE_L_LENGTH]u
2819 .          rr #RESTORE_L_LENGTH
2820 .       \}
2821 .       el \{\
2822 \D't \\n[#RULE_WEIGHT]'\
2823 \h'\\*[$RL_INDENT]-\\n[#RULE_WEIGHT]u'\
2824 \v'\\n[#RULE_WEIGHT_ADJ]u'\
2825 \D'l \En[.l]u 0'\v'-\\n[#RULE_WEIGHT_ADJ]u'\
2826 \v'-\\n[#RULE_WEIGHT_ADJ]u'\
2827 \D't \\n[#SAVED_RULE_WEIGHT]'
2828 .       \}
2829 .    \}
2830 .    el \{\
2831 \D't \\n[#RULE_WEIGHT]'\
2832 \h'\\*[$RL_INDENT]-\\n[#RULE_WEIGHT]u'\
2833 \v'\\n[#RULE_WEIGHT_ADJ]u'\
2834 \D'l \\*[$RL_LENGTH] 0'\
2835 \v'-\\n[#RULE_WEIGHT_ADJ]u'\
2836 \D't \\n[#SAVED_RULE_WEIGHT]'
2837 .          rr #RESTORE_L_LENGTH
2838 .    \}
2839 .    if \\n[#FILLED]=1 \{\
2840 .       if \\n[#FILL_MODE]=0 .QUAD LEFT
2841 .       if \\n[#FILL_MODE]=1 .JUSTIFY
2842 .       if \\n[#FILL_MODE]=3 .QUAD CENTER
2843 .       if \\n[#FILL_MODE]=5 .QUAD RIGHT
2844 .       rr #FILLED
2845 .    \}
2846 .    sp -1v
2847 .    if \\n[#NOFILL]=1 \{\
2848 .       if \\n[#NOFILL_MODE]=3 .CENTER
2849 .       if \\n[#NOFILL_MODE]=5 .RIGHT
2850 .    \}
2851 .    gcolor
2852 .    nr #RULE_WEIGHT     \\n[#SAVED_WEIGHT]
2853 .    nr #RULE_WEIGHT_ADJ \\n[#SAVED_WEIGHT_ADJ]
2854 .    rr #SAVED_WEIGHT
2855 .    rr #SAVED_WEIGHT_ADJ
2856 .    if \\n[#RESTORE_TRAP]=1 \{\
2857 .       vpt
2858 .       rr #RESTORE_TRAP
2859 .    \}
2860 .    if '\\n[.z]'FLOAT*DIV' \
2861 .       if !(\\n[.d]+\\n[#WEIGHT])<\\n[D-float] .nr D-float \\n[.d]+\\n[#WEIGHT]
2862 .END
2863 \#
2864 \# RULE
2865 \# ----
2866 \# *Argument:
2867 \#   <none>
2868 \# *Function:
2869 \#   Draws a rule the length of the current measure.
2870 \# *Notes:
2871 \#   A convenience macro.  DRH with no argument does the same thing.
2872 \#   Kept in for backward compatibility.
2873 \#
2874 .MAC RULE END
2875 .    if \\n[.u]=1 \{\
2876 .       nr fill 1
2877 .       ds $CURRENT_QUAD \\*[$QUAD_VALUE]
2878 .       nf
2879 .    \}
2880 .    ie \\n[#INDENT_ACTIVE] \{\
2881 .       if \\n[#INDENT_BOTH_ACTIVE] .ll \\n[.l]u-\\n[#BL_INDENT]u
2882 .       if \\n[#INDENT_LEFT_ACTIVE] .ll \\n[.l]u-\\n[#L_INDENT]u
2883 .       PRINT \
2884 \D't \\n[#RULE_WEIGHT]'\v'\\n[#RULE_WEIGHT_ADJ]u'\
2885 \h'-\\n[#RULE_WEIGHT]u'\
2886 \D'l \En[.l]u 0'\v'-\\n[#RULE_WEIGHT_ADJ]u'\h'|0'\c
2887 .       ll
2888 .       rr #RESTORE_L_LENGTH
2889 .    \}
2890 .    el \{\
2891 .       PRINT \
2892 \D't \\n[#RULE_WEIGHT]'\v'\\n[#RULE_WEIGHT_ADJ]u'\
2893 \h'-\\n[#RULE_WEIGHT]u'\
2894 \D'l \En[.l]u 0'\v'-\\n[#RULE_WEIGHT_ADJ]u'\h'|0'\c
2895 .    \}
2896 .    if \\n[fill] \{\
2897 .       fi
2898 .       rr fill
2899 .       QUAD \\*[$CURRENT_QUAD]
2900 .       rm $CURRENT_QUAD
2901 .    \}
2902 .    EOL
2903 .END
2904 \#
2905 \# VERTICAL RULE - DRV
2906 \# -------------------
2907 \# *Arguments:
2908 \#   <rule weight> <indent> <depth> [ <color> ]
2909 \# *Function:
2910 \#   Draws described vertical rule.
2911 \# *Notes:
2912 \#   Rules are drawn left-to-right, from the baseline down, and
2913 \#   return to their point of origin.  Color must be set in the
2914 \#   macro; otherwise the color will be black, regardless of current
2915 \#   .gcolor.
2916 \#
2917 .MAC DRV END
2918 .    GRAPHICAL_OBJ
2919 .    ds $RL_WEIGHT \\$1
2920 .    ds $RL_INDENT \\$2
2921 .    ds $RL_DEPTH  \\$3
2922 .    ie !'\\$4'' \
2923 .       ds $RL_COLOR  \\$4
2924 .    el .ds $RL_COLOR \\*[default]
2925 .    nr #SAVED_WEIGHT     \\n[#RULE_WEIGHT]
2926 .    nr #SAVED_WEIGHT_ADJ \\n[#RULE_WEIGHT_ADJ]
2927 .    RULE_WEIGHT \\*[$RL_WEIGHT]
2928 .    COLOR \\*[$RL_COLOR]
2929 \D't \\n[#RULE_WEIGHT]'\
2930 \h'\\*[$RL_INDENT]-\\n[#RULE_WEIGHT_ADJ]u'\
2931 \D'l 0 \\*[$RL_DEPTH]'\
2932 \D't \\n[#SAVED_RULE_WEIGHT]'
2933 .    if \\n[#FILLED]=1 \{\
2934 .       if \\n[#FILL_MODE]=0 .QUAD LEFT
2935 .       if \\n[#FILL_MODE]=1 .JUSTIFY
2936 .       if \\n[#FILL_MODE]=3 .QUAD CENTER
2937 .       if \\n[#FILL_MODE]=5 .QUAD RIGHT
2938 .       rr #FILLED
2939 .    \}
2940 .    sp -1v
2941 .    if \\n[#NOFILL]=1 \{\
2942 .       if \\n[#NOFILL_MODE]=3 .CENTER
2943 .       if \\n[#NOFILL_MODE]=5 .RIGHT
2944 .    \}
2945 .    gcolor
2946 .    nr #RULE_WEIGHT     \\n[#SAVED_WEIGHT]
2947 .    nr #RULE_WEIGHT_ADJ \\n[#SAVED_WEIGHT_ADJ]
2948 .    if \\n[#RESTORE_TRAP]=1 \{\
2949 .       vpt
2950 .       rr #RESTORE_TRAP
2951 .    \}
2952 .    if '\\n[.z]'FLOAT*DIV' \
2953 .       if !(\\n[.d]+\\*[$RL_DEPTH])<\\n[D-float] .nr D-float \\n[.d]+\\*[$RL_DEPTH]
2954 .END
2955 \#
2956 \# BOXES - DBX
2957 \# -----------
2958 \# *Arguments:
2959 \#   <rule weight> | SOLID> <indent> <length> <depth> [ <color> ]
2960 \# *Function:
2961 \#   Draws described box.
2962 \# *Notes:
2963 \#   Boxes are drawn left-to-right, from the baseline down, and
2964 \#   return to their point of origin.  Box rules are drawn from the
2965 \#   perimeter inwards.  Color must be set in the macro; otherwise
2966 \#   the color will be black, regardless of current .gcolor.  If no
2967 \#   arg given, the rule weight is the one set by RULE_WEIGHT.
2968 \#
2969 .MAC DBX END
2970 .    GRAPHICAL_OBJ
2971 .    ie '\\$1'SOLID' .nr #BX_SOLID 1
2972 .    el              .ds $BX_WEIGHT \\$1
2973 .    ds $BX_INDENT \\$2
2974 .    ds $BX_WIDTH  \\$3
2975 .    ds $BX_DEPTH  \\$4
2976 .    ie !'\\$5'' \{\
2977 .       ie d$\\$5_FILL .ds $BX_COLOR \\*[$\\$5_FILL]
2978 .       el             .ds $BX_COLOR \\$5
2979 .    \}
2980 .    el .ds $BX_COLOR \\*[default]
2981 .    nr #SAVED_WEIGHT     \\n[#RULE_WEIGHT]
2982 .    nr #SAVED_WEIGHT_ADJ \\n[#WEIGHT_ADJ]
2983 .    if !'\\$1'SOLID' .RULE_WEIGHT \\*[$BX_WEIGHT]
2984 .    ds $BX_INDENT \\*[$BX_INDENT]-\\n[#WEIGHT_ADJ]u
2985 .    ie \\n[#BX_SOLID]=1 \{\
2986 .       fcolor \\*[$BX_COLOR]
2987 \h'\\*[$BX_INDENT]'\
2988 \D'P \\*[$BX_WIDTH] 0 0 \\*[$BX_DEPTH] -\\*[$BX_WIDTH] 0 0 -\\*[$BX_DEPTH]'
2989 .       fcolor
2990 .       rr #BX_SOLID
2991 .    \}
2992 .    el \{\
2993 .       COLOR \\*[$BX_COLOR]
2994 \D't \\n[#RULE_WEIGHT]'\
2995 \h'\\*[$BX_INDENT]'\
2996 \v'\\n[#WEIGHT_ADJ]u'\
2997 \D'p \\*[$BX_WIDTH]-\\n[#RULE_WEIGHT]u 0 0 \\*[$BX_DEPTH]-\\n[#RULE_WEIGHT]u -\\*[$BX_WIDTH]+\\n[#RULE_WEIGHT]u 0 0 -\\*[$BX_DEPTH]+\\n[#RULE_WEIGHT]u'\
2998 \v'-\\n[#WEIGHT_ADJ]u'\
2999 \D't \\n[#SAVED_RULE_WEIGHT]'
3000 .       gcolor
3001 .    \}
3002 .    sp -1v
3003 .    if \\n[#FILLED]=1 \{\
3004 .       if \\n[#FILL_MODE]=0 .QUAD LEFT
3005 .       if \\n[#FILL_MODE]=1 .JUSTIFY
3006 .       if \\n[#FILL_MODE]=3 .QUAD CENTER
3007 .       if \\n[#FILL_MODE]=5 .QUAD RIGHT
3008 .    \}
3009 .    if \\n[#NOFILL]=1 \{\
3010 .       if \\n[#NOFILL_MODE]=3 .CENTER
3011 .       if \\n[#NOFILL_MODE]=5 .RIGHT
3012 .    \}
3013 .    nr #RULE_WEIGHT \\n[#SAVED_WEIGHT]
3014 .    nr #WEIGHT_ADJ  \\n[#SAVED_WEIGHT_ADJ]
3015 .    rr #SAVED_WEIGHT
3016 .    rr #SAVED_WEIGHT_ADJ
3017 .    if \\n[#RESTORE_TRAP]=1 \{\
3018 .       vpt
3019 .       rr #RESTORE_TRAP
3020 .    \}
3021 .    if '\\n[.z]'FLOAT*DIV' \
3022 .       if !(\\n[.d]+\\*[$BX_DEPTH])<\\n[D-float] .nr D-float \\n[.d]+\\*[$BX_DEPTH]
3023 .END
3024 \#
3025 \# ELLIPSES - DCL
3026 \# --------------
3027 \# *Arguments:
3028 \#   <rule weight> | SOLID> <indent> <width> <depth> [ <color> ]
3029 \# *Function:
3030 \#   Draws described ellipses.
3031 \# *Notes:
3032 \#   Ellipses (circles) are drawn left-to-right, from the baseline
3033 \#   down, and return to their point of origin.  Ellipse rules are
3034 \#   drawn from the perimeter inwards.  Color must be set in the
3035 \#   macro; otherwise the color will be black, regardless of current
3036 \#   .gcolor.  If no arg given, the rule weight is the one set by
3037 \#   RULE_WEIGHT.
3038 \#
3039 .MAC DCL END
3040 .    GRAPHICAL_OBJ
3041 .    ie '\\$1'SOLID' .nr #CL_SOLID 1
3042 .    el              .ds $CL_WEIGHT \\$1
3043 .    ds $CL_INDENT \\$2
3044 .    ds $CL_WIDTH  \\$3
3045 .    ds $CL_DEPTH  \\$4
3046 .    ie !'\\$5'' \{\
3047 .       ie d$\\$5_FILL .ds $CL_COLOR \\*[$\\$5_FILL]
3048 .       el             .ds $CL_COLOR \\$5
3049 .    \}
3050 .    el .ds $CL_COLOR \\*[default]
3051 .    nr #SAVED_WEIGHT     \\n[#RULE_WEIGHT]
3052 .    nr #SAVED_WEIGHT_ADJ \\n[#WEIGHT_ADJ]
3053 .    if !'\\$1'SOLID' .RULE_WEIGHT \\*[$CL_WEIGHT]
3054 .    ds $CL_INDENT \\*[$CL_INDENT]-\\n[#WEIGHT_ADJ]u
3055 .    ie \\n[#CL_SOLID]=1 \{\
3056 .       fcolor \\*[$CL_COLOR]
3057 \h'\\*[$CL_INDENT]'\
3058 \v'\\*[$CL_DEPTH]/2u'\
3059 \D'E \\*[$CL_WIDTH]-\\n[#RULE_WEIGHT]u \\*[$CL_DEPTH]-\\n[#RULE_WEIGHT]u'\
3060 \v'-\\*[$CL_DEPTH]/2u'
3061 .       fcolor
3062 .       rr #CL_SOLID
3063 .    \}
3064 .    el \{\
3065 .       COLOR \\*[$CL_COLOR]
3066 \D't \\n[#RULE_WEIGHT]'\
3067 \h'\\*[$CL_INDENT]'\
3068 \v'\\*[$CL_DEPTH]/2u'\
3069 \D'e \\*[$CL_WIDTH]-\\n[#RULE_WEIGHT]u \\*[$CL_DEPTH]-\\n[#RULE_WEIGHT]u'\
3070 \v'-(\\*[$CL_DEPTH]/2u)'\
3071 \D't \\n[#SAVED_RULE_WEIGHT]'
3072 .       gcolor
3073 .    \}
3074 .    sp -1v
3075 .    if \\n[#FILLED]=1 \{\
3076 .       if \\n[#FILL_MODE]=0 .QUAD LEFT
3077 .       if \\n[#FILL_MODE]=1 .JUSTIFY
3078 .       if \\n[#FILL_MODE]=3 .QUAD CENTER
3079 .       if \\n[#FILL_MODE]=5 .QUAD RIGHT
3080 .       rr #FILLED
3081 .    \}
3082 .    if \\n[#NOFILL]=1 \{\
3083 .       if \\n[#NOFILL_MODE]=3 .CENTER
3084 .       if \\n[#NOFILL_MODE]=5 .RIGHT
3085 .    \}
3086 .    nr #RULE_WEIGHT \\n[#SAVED_WEIGHT]
3087 .    nr #WEIGHT_ADJ  \\n[#SAVED_WEIGHT_ADJ]
3088 .    rr #SAVED_WEIGHT
3089 .    rr #SAVED_WEIGHT_ADJ
3090 .    if \\n[#RESTORE_TRAP]=1 \{\
3091 .       vpt
3092 .       rr #RESTORE_TRAP
3093 .    \}
3094 .    if '\\n[.z]'FLOAT*DIV' \
3095 .       if !(\\n[.d]+\\*[$CL_DEPTH])<\\n[D-float] .nr D-float \\n[.d]+\\*[$CL_DEPTH]
3096 .END
3097 \#
3098 \# RULE WEIGHT
3099 \# -----------
3100 \# *Argument:
3101 \#   <weight of rules in points>
3102 \# *Function:
3103 \#   Sets \D't <n>' to the correct number of machine units for the
3104 \#   argument given in points.
3105 \# *Notes:
3106 \#   Decimal fractions are allowed.  Rule weight must be < 100.
3107 \#
3108 .MAC RULE_WEIGHT END
3109 .    di NULL \" Diverted so there's no problem with breaks, spacing, etc.
3110 .       ds $ARG \\$1
3111 .       substring $ARG -1
3112 .       if !\B'\\*[$ARG]' \{\
3113 .          tm1 "[mom]: The argument to \\$0 must not have a unit of measure appended.
3114 .          ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
3115 .       \}
3116 .       length #STR_LENGTH \\$1
3117 .       ds $ARG \\$1
3118 .       substring $ARG 0 0
3119 .       ie '\\*[$ARG]'.' \{\
3120 .          ds $ARG \\$1
3121 .          substring $ARG 1 \\n[#STR_LENGTH]-1
3122 .          nr #WEIGHT \\*[$ARG]*100
3123 .          if (\\n[#WEIGHT]>=1000) \{\
3124 .              while (\\n[#WEIGHT]>=1000) \{\
3125 .                 nr #WEIGHT \\n[#WEIGHT]/10
3126 .              \}
3127 .          \}
3128 .       \}
3129 .       el \{\
3130 .          ds $ARG \\$1
3131 .          length #ARG_LENGTH \\*[$ARG]
3132 .          if \\n[#ARG_LENGTH]>1 .substring $ARG 1 1
3133 .          ie '\\*[$ARG]'.' \{\
3134 .             ds $LHS \\$1
3135 .             substring $LHS 0 0
3136 .             ds $RHS \\$1
3137 .             substring $RHS 2
3138 .             nr #WEIGHT \\*[$LHS]\\*[$RHS]*100
3139 .             if (\\n[#WEIGHT]>=10000) \{\
3140 .                while (\\n[#WEIGHT]>=10000) \{\
3141 .                   nr #WEIGHT \\n[#WEIGHT]/10
3142 .                \}
3143 .             \}
3144 .          \}
3145 .          el \{\
3146 .             ie \\n[#STR_LENGTH]<=2 .nr #WEIGHT \\$1*1000
3147 .             el \{\
3148 .                ds $ARG \\$1
3149 .                substring $ARG 2 2
3150 .                ie !'\\*[$ARG]'.' \{\
3151 .                   tm1 "[mom]: Invalid argument given to macro \\$0 at line \\n[.c].
3152 .                   tm1 "       Rule weight must be < 100 points.
3153 .                   tm1 "       Falling back to default weight .5 points.
3154 .                   nr #WEIGHT 500
3155 .                \}
3156 .                el \{\
3157 .                   ds $LHS \\$1
3158 .                   substring $LHS 0 1
3159 .                   ds $RHS \\$1
3160 .                   substring $RHS 3
3161 .                   nr #WEIGHT \\*[$LHS]\\*[$RHS]*1000
3162 .                   if (\\n[#WEIGHT]>=100000) \{\
3163 .                      while (\\n[#WEIGHT]>=100000) \{\
3164 .                         nr #WEIGHT \\n[#WEIGHT]/10
3165 .                      \}
3166 .                   \}
3167 .                \}
3168 .             \}
3169 .          \}
3170 .       \}
3171 .       nr #WEIGHT_ADJ \\n[#WEIGHT]/2
3172 .       if '\\$0'BIBLIOGRAPHY_STRING_UNDERLINE_WEIGHT' \
3173 .          ds $TITLE_TYPE BIB_STRING_
3174 .       if '\\$0'ENDNOTE_TITLE_UNDERLINE_WEIGHT' \
3175 .          ds $TITLE_TYPE EN_TITLE_
3176 .       if '\\$0'EN_HEADER_UNDERLINE_WEIGHT' \
3177 .          ds $TITLE_TYPE EN_STRING_
3178 .       if !'\\*[$TITLE_TYPE]'BIB_STRING' \
3179 .          if !'\\*[$TITLE_TYPE]'EN_TITLE' \
3180 .             if !'\\*[$TITLE_TYPE]'EN_STRING' \
3181 .                ds _TYPE \\$0
3182 .       length type-len _TYPE
3183 .       if \\n[type-len]>17 \{\
3184 .          substring _TYPE 0 -17
3185 .          ds $TITLE_TYPE \\*[_TYPE]
3186 .       \}
3187 .       if !'\\*[$TITLE_TYPE]'' \{\
3188 .          nr #\\*[$TITLE_TYPE]UNDERLINE_WEIGHT \\n[#WEIGHT]
3189 .          nr #\\*[$TITLE_TYPE]UNDERLINE_WEIGHT_ADJ \\n[#WEIGHT_ADJ]
3190 .       \}
3191 .       if '\\$0'RULE_WEIGHT' \{\
3192 .          nr #RULE_WEIGHT     \\n[#WEIGHT]
3193 .          nr #RULE_WEIGHT_ADJ \\n[#WEIGHT_ADJ]
3194 .       \}
3195 .       if '\\$0'UNDERSCORE_WEIGHT' \{\
3196 .          nr #UNDERSCORE_WEIGHT     \\n[#WEIGHT]
3197 .          nr #UNDERSCORE_WEIGHT_ADJ \\n[#WEIGHT_ADJ]
3198 .       \}
3199 .       if '\\$0'FOOTER_RULE_WEIGHT' \{\
3200 .          nr #FOOTER_RULE_WEIGHT     \\n[#WEIGHT]
3201 .          nr #FOOTER_RULE_WEIGHT_ADJ \\n[#WEIGHT_ADJ]
3202 .       \}
3203 .       if '\\$0'FOOTNOTE_RULE_WEIGHT' \{\
3204 .          nr #FN_RULE_WEIGHT     \\n[#WEIGHT]
3205 .          nr #FN_RULE_WEIGHT_ADJ \\n[#WEIGHT_ADJ]
3206 .       \}
3207 .       if '\\$0'HEADER_RULE_WEIGHT' \{\
3208 .          nr #HEADER_RULE_WEIGHT     \\n[#WEIGHT]
3209 .          nr #HEADER_RULE_WEIGHT_ADJ \\n[#WEIGHT_ADJ]
3210 .       \}
3211 .    di
3212 .END
3213 \#
3214 \# Aliases for RULE_WEIGHT
3215 \# 
3216 .ALIAS BIB_STRING_UNDERLINE_WEIGHT RULE_WEIGHT
3217 .ALIAS DOCTYPE_UNDERLINE_WEIGHT    RULE_WEIGHT
3218 .ALIAS EN_STRING_UNDERLINE_WEIGHT  RULE_WEIGHT
3219 .ALIAS EN_TITLE_UNDERLINE_WEIGHT   RULE_WEIGHT
3220 .ALIAS FN_RULE_WEIGHT              RULE_WEIGHT
3221 .ALIAS FOOTER_RULE_WEIGHT          RULE_WEIGHT
3222 .ALIAS FOOTNOTE_RULE_WEIGHT        RULE_WEIGHT
3223 .ALIAS HEADER_RULE_WEIGHT          RULE_WEIGHT
3224 .ALIAS RULE_WEIGHT                 RULE_WEIGHT
3225 .ALIAS TOC_HEADER_UNDERLINE_WEIGHT RULE_WEIGHT
3226 .ALIAS UNDERSCORE_WEIGHT           RULE_WEIGHT
3227 \#
3228 \# Default rule weights
3229 \# 
3230 .nr #BIB_STRING_UNDERLINE_WEIGHT 500
3231 .nr #DOCTYPE_UNDERLINE_WEIGHT    500
3232 .nr #EN_STRING_UNDERLINE_WEIGHT  500
3233 .nr #EN_TITLE_UNDERLINE_WEIGHT   500
3234 .nr #FN_RULE_WEIGHT              500
3235 .nr #FOOTER_RULE_WEIGHT          500
3236 .nr #HEADER_RULE_WEIGHT          500
3237 .nr #RULE_WEIGHT                 500
3238 .nr #TOC_HEADER_UNDERLINE_WEIGHT 500
3239 .nr #UNDERSCORE_WEIGHT           500
3240 \#
3241 .nr #BIB_STRING_UNDERLINE_WEIGHT_ADJ \n[#BIB_STRING_UNDERLINE_WEIGHT]/2
3242 .nr #DOCTYPE_UNDERLINE_WEIGHT_ADJ    \n[#DOCTYPE_UNDERLINE_WEIGHT]/2
3243 .nr #EN_STRING_UNDERLINE_WEIGHT_ADJ  \n[#EN_STRING_UNDERLINE_WEIGHT]/2
3244 .nr #EN_TITLE_UNDERLINE_WEIGHT_ADJ   \n[#EN_TITLE_UNDERLINE_WEIGHT]/2
3245 .nr #FN_RULE_WEIGHT_ADJ              \n[#FN_RULE_WEIGHT]/2
3246 .nr #FOOTER_RULE_WEIGHT_ADJ          \n[#FOOTER_RULE_WEIGHT]/2
3247 .nr #HEADER_RULE_WEIGHT_ADJ          \n[#HEADER_RULE_WEIGHT]/2
3248 .nr #RULE_WEIGHT_ADJ                 \n[#RULE_WEIGHT]/2
3249 .nr #TOC_HEADER_UNDERLINE_WEIGHT_ADJ \n[#TOC_HEADER_UNDERLINE_WEIGHT]/2
3250 .nr #UNDERSCORE_WEIGHT_ADJ           \n[#UNDERSCORE_WEIGHT]/2
3251 \#
3252 \# Read in remaining aliases and default rule weights
3253 \#
3254 .nr #LOOP 0 1
3255 .while \n+[#LOOP]<=14 \{\
3256 . ALIAS \*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_WEIGHT           RULE_WEIGHT
3257 . ALIAS COVER_\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_WEIGHT     RULE_WEIGHT
3258 . ALIAS DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_WEIGHT RULE_WEIGHT
3259 . nr #\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_WEIGHT            500
3260 . nr #COVER_\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_WEIGHT      500
3261 . nr #DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_WEIGHT  500
3262 . nr #\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_WEIGHT_ADJ \
3263     \n[#\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_WEIGHT]/2
3264 . nr #COVER_\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_WEIGHT_ADJ \
3265     \n[#COVER_\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_WEIGHT]/2
3266 . nr #DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_WEIGHT_ADJ \
3267     \n[#DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE_WEIGHT]/2
3268 .\}
3269 \#
3270 \# Set default rule weight
3271 \#
3272 .di NULL
3273 \D't 500'
3274 .di
3275 \#
3276 \# =====================================================================
3277 \#
3278 \# +++WORD AND SENTENCE SPACING+++
3279 \#
3280 \# WORD SPACE CONTROL
3281 \# ------------------
3282 \# *Argument:
3283 \#   <+|->wordspace | DEFAULT
3284 \# *Function:
3285 \#   Increases or decreases interword space by user supplied amount.
3286 \#   If DEFAULT, value is set to 12 (groff default).
3287 \# *Notes:
3288 \#   $WS_CONSTANT is the groff default word space.
3289 \#   $WS_VAR is the user supplied amount by which to in/decrease word space.
3290 \#   $WS is a concatenation of WS_CONSTANT and WS_VAR.
3291 \#
3292 \#   \n[.sss] holds the current sentence space value.
3293 \#
3294 .MAC WS END
3295 .    ds $WS_CURR \\n[.ss]
3296 .    ds $WS_VAR  \\$1
3297 .    ie '\\$1'DEFAULT' .ss 12 \\n[.sss]
3298 .    el \{\
3299 .       ds $WS (\\*[$WS_CURR]+\\*[$WS_VAR])
3300 .       ie \\n[.sss]=12 .ss \\*[$WS] 12
3301 .       el \{\
3302 .          ss \\*[$WS] (\\*[$WS]+\\*[$SS_VAR])
3303 .          SS \\*[$SS_VAR]
3304 .      \}
3305 .    \}
3306 .END
3307 \#
3308 \# SENTENCE SPACE CONTROL
3309 \# ----------------------
3310 \# *Argument:
3311 \#   <+-sentencespace> | 0 | DEFAULT
3312 \# *Function:
3313 \#   Increases or decreases sentence space by user supplied amount.
3314 \#   If 0, sentence spaces are ignored.  If DEFAULT, value is
3315 \#   set to 12 (groff default).
3316 \# *Notes:
3317 \#   Because the user supplied value requires a literal + or - sign,
3318 \#   the macro argument is stored in a string.
3319 \#
3320 \#   Sentence space applies only to input where sentences are separated
3321 \#   by two spaces (and/or, in fill mode [FLUSH L|R|C or JUSTIFY], an EOL).
3322 \#   Changing .SS when sentences are separated by only one space has
3323 \#   no effect on the space between sentences.
3324 \#
3325 \#   \n[.ss] holds the current wordspace value.
3326 \#   \n[.sss] holds the current sentence space value.
3327 \#
3328 .MAC SS END
3329 .    ds $SS_VAR \\$1
3330 .    ie '\\$1'0' .ss \\n[.ss] (\\n[.ss]-\\n[.ss])
3331 .    el \{\
3332 .       ie '\\$1'DEFAULT' .ss \\n[.ss]
3333 .       el                .ss \\n[.ss] (0+\\*[$SS_VAR])
3334 .    \}
3335 .END
3336 \#
3337 \# =====================================================================
3338 \#
3339 \# INDENTS
3340 \# -------
3341 \#
3342 \# +++INDENT LEFT+++
3343 \#
3344 .MAC IL END
3345 .    if \\n[#INDENT_STYLE_BOTH] .IBX
3346 .    nr #INDENT_STYLE_LEFT  1
3347 .    nr #INDENT_ACTIVE      1
3348 .    nr #INDENT_LEFT_ACTIVE 1
3349 .    ie '\\$1'' \{\
3350 .       br
3351 .       in \\n[#L_INDENT]u
3352 .       ta \\n[.l]u-\\n[#L_INDENT]u
3353 .    \}
3354 .    el \{\
3355 .       br
3356 .       nr #L_INDENT +(\\$1)
3357 .       in \\n[#L_INDENT]u
3358 .       ta \\n[.l]u-\\n[#L_INDENT]u
3359 .    \}
3360 .    if \\n[#IN_ITEM] .nr #IN_ITEM_L_INDENT +(\\$1)
3361 .END
3362 \#
3363 \# +++INDENT RIGHT+++
3364 \#
3365 .MAC IR END
3366 .    if \\n[#INDENT_STYLE_BOTH] .IBX
3367 .    nr #INDENT_STYLE_RIGHT   1
3368 .    nr #INDENT_ACTIVE        1
3369 .    nr #INDENT_RIGHT_ACTIVE  1
3370 .    ie '\\$1'' \{\
3371 .       br
3372 .       ie \\n[#TAB_ACTIVE] \{\
3373 .          ll \\n[.l]u-\\n[#R_INDENT]u
3374 .          ta \\n[.l]u-\\n[#L_INDENT]u
3375 .       \}
3376 .       el \{\
3377 .          ll \\n[.l]u-\\n[#R_INDENT]u
3378 .          ta \\n[.l]u-\\n[#L_INDENT]u
3379 .       \}
3380 .    \}
3381 .    el \{\
3382 .       br
3383 .       nr #R_INDENT +(\\$1)
3384 .       ie \\n[#TAB_ACTIVE] \{\
3385 .          ll \\n[.l]u-\\n[#R_INDENT]u
3386 .          ta \\n[.l]u-\\n[#L_INDENT]u
3387 .       \}
3388 .       el \{\
3389 .          ll \\n[.l]u-\\n[#R_INDENT]u
3390 .          ta \\n[.l]u-\\n[#L_INDENT]u
3391 .       \}
3392 .    \}
3393 .END
3394 \#
3395 \# +++INDENT BOTH+++
3396 \#
3397 .MAC IB END
3398 .    br
3399 .    if \\n[#INDENT_STYLE_LEFT]  .ILX
3400 .    if \\n[#INDENT_STYLE_RIGHT] .IRX
3401 .    nr #INDENT_STYLE_BOTH  1
3402 .    nr #INDENT_ACTIVE      1
3403 .    nr #INDENT_BOTH_ACTIVE 1
3404 .    ie '\\$1'' \{\
3405 .       ie \\n[#DOCS] \
3406 .          ll \\n[#DOC_L_LENGTH]u-\\n[#BR_INDENT]u
3407 .       el .ll \\n[.l]u-\\n[#BR_INDENT]u
3408 .       in \\n[#BL_INDENT]u
3409 .       ta \\n[.l]u
3410 .    \}
3411 .    el \{\
3412 .       nr #BL_INDENT (\\n[#INDENT]+\\$1)
3413 .       ie \\n[#NUM_ARGS]=2 .nr #BR_INDENT +(\\$2)
3414 .       el .nr #BR_INDENT \\n[#BL_INDENT]
3415 .       if '\\n[.z]'' .ll
3416 .       ll \\n[.l]u-\\n[#BR_INDENT]u
3417 .       in \\n[#BL_INDENT]u
3418 .       ta \\n[.l]u-\\n[#BR_INDENT]u
3419 .    \}
3420 .END
3421 \#
3422 \# +++TEMPORARY INDENT+++
3423 \#
3424 .MAC TI END
3425 .    br
3426 .    ie '\\$1'' \{\
3427 .       ti \\n[#T_INDENT]u
3428 .       if \\n[#INDENT_LEFT_ACTIVE] .ti \\n[#T_INDENT]u+\\n[#L_INDENT]u
3429 .       if \\n[#INDENT_BOTH_ACTIVE] .ti \\n[#T_INDENT]u+\\n[#BL_INDENT]u
3430 .    \}
3431 .    el \{\
3432 .       nr #T_INDENT (\\$1)
3433 .       ti \\n[#T_INDENT]u
3434 .    \}
3435 .END
3436 \#
3437 \# +++HANGING INDENT+++
3438 \#
3439 .MAC HI END
3440 .    ie '\\$1'' .ti -\\n[#HL_INDENT]u
3441 .    el \{\
3442 .       nr #HL_INDENT (\\$1)
3443 .       ti -\\n[#HL_INDENT]u
3444 .    \}
3445 .END
3446 \#
3447 \# +++INDENTS OFF+++
3448 \#
3449 .MAC ILX END
3450 .    ie \\n[#IN_ITEM] .nr #L_INDENT -\\n[#IN_ITEM_L_INDENT]
3451 .    el \{\
3452 .       br
3453 .       in 0
3454 .       rr #INDENT_LEFT_ACTIVE
3455 .       nr #L_INDENT_ILX \\n[#L_INDENT]
3456 .    \}
3457 .    if '\\$1'CLEAR' \{\
3458 .       rr #L_INDENT
3459 .       rr #INDENT_STYLE_LEFT
3460 .       rr #L_INDENT_ILX
3461 .       rr #INDENT_ACTIVE
3462 .    \}
3463 .END
3464 \#
3465 .MAC IRX END
3466 .    br
3467 .    rr #INDENT_RIGHT_ACTIVE
3468 .    ie \\n[#TAB_ACTIVE] .TAB\\n[#CURRENT_TAB]
3469 .    el \{\
3470 .       ie \\n[#COLUMNS] \{\
3471 .          ll \\n[#COL_L_LENGTH]u
3472 .          ta \\n[.l]u
3473 .       \}
3474 .       el \{\
3475 .          ll \\n[#L_LENGTH]u
3476 .          ta \\n[.l]u
3477 .       \}
3478 .    \}
3479 .    if '\\$1'CLEAR' \{\
3480 .       rr #R_INDENT
3481 .       rr #INDENT_STYLE_RIGHT
3482 .    \}
3483 .END
3484 \#
3485 .MAC IBX END
3486 .    br
3487 .    in 0
3488 .    rr #INDENT_ACTIVE
3489 .    rr #INDENT_BOTH_ACTIVE
3490 .    ie \\n[#TAB_ACTIVE] .TAB\\n[#CURRENT_TAB]
3491 .    el \{\
3492 .       ie \\n[#COLUMNS] \{\
3493 .          ll \\n[#COL_L_LENGTH]u
3494 .          ta \\n[.l]u
3495 .       \}
3496 .       el \{\
3497 .          ll \\n[#L_LENGTH]u
3498 .          ta \\n[.l]u
3499 .       \}
3500 .    \}
3501 .    if '\\$1'CLEAR' \{\
3502 .       rr #BL_INDENT
3503 .       rr #BR_INDENT
3504 .       rr #INDENT_STYLE_BOTH
3505 .    \}
3506 .END
3507 \#
3508 .MAC IX END
3509 .    if '\\$0'IX' \{\
3510 .       if !\\n[#IX_WARN] \{\
3511 .          tm1 "[mom]: Use of .IX is deprecated.  Use .IQ instead.
3512 .          tm1 "      .IX will continue to behave as before, but to
3513 .          tm1 "       avoid this message, please update your document.
3514 .          nr #IX_WARN 1
3515 .       \}
3516 .    \}
3517 .    br
3518 .    in 0
3519 .    rr #INDENT_LEFT_ACTIVE
3520 .    rr #INDENT_RIGHT_ACTIVE
3521 .    rr #INDENT_BOTH_ACTIVE
3522 .    rr #INDENT_ACTIVE
3523 .    if \\n[#INDENT_STYLE_RIGHT] \{\
3524 .       ie \\n[#TAB_ACTIVE] .TAB\\n[#CURRENT_TAB]
3525 .       el \{\
3526 .          ie \\n[#COLUMNS] \{\
3527 .             ll \\n[#COL_L_LENGTH]u
3528 .             ta \\n[.l]u
3529 .          \}
3530 .          el \{\
3531 .             ll \\n[#L_LENGTH]u
3532 .             ta \\n[.l]u
3533 .          \}
3534 .       \}
3535 .    \}
3536 .    if \\n[#INDENT_STYLE_BOTH] \{\
3537 .       ie \\n[#TAB_ACTIVE] .TAB\\n[#CURRENT_TAB]
3538 .       el \{\
3539 .          ie \\n[#COLUMNS] \{\
3540 .             ll \\n[#COL_L_LENGTH]u
3541 .             ta \\n[.l]u
3542 .          \}
3543 .          el \{\
3544 .             ll \\n[#L_LENGTH]u
3545 .             ta \\n[.l]u
3546 .          \}
3547 .       \}
3548 .    \}
3549 .    if '\\$1'CLEAR' \{\
3550 .       if \\n[#INDENT_STYLE_RIGHT] \{\
3551 .          ie \\n[#TAB_ACTIVE] .TAB\\n[#CURRENT_TAB]
3552 .          el \{\
3553 .             ie \\n[#COLUMNS] \{\
3554 .                ll \\n[#COL_L_LENGTH]u
3555 .                ta \\n[.l]u
3556 .             \}
3557 .             el \{\
3558 .                ll \\n[#L_LENGTH]u
3559 .                ta \\n[.l]u
3560 .             \}
3561 .          \}
3562 .       \}
3563 .       if \\n[#INDENT_STYLE_BOTH] \{\
3564 .          ie \\n[#TAB_ACTIVE] .TAB\\n[#CURRENT_TAB]
3565 .          el \{\
3566 .             ie \\n[#COLUMNS] \{\
3567 .                ll \\n[#COL_L_LENGTH]u
3568 .                ta \\n[.l]u
3569 .             \}
3570 .             el \{\
3571 .                ll \\n[#L_LENGTH]u
3572 .                ta \\n[.l]u
3573 .             \}
3574 .          \}
3575 .       \}
3576 .       rr #L_INDENT
3577 .       rr #R_INDENT
3578 .       rr #BL_INDENT
3579 .       rr #BR_INDENT
3580 .       rr #T_INDENT
3581 .       rr #H_INDENT
3582 .       rr #INDENT_STYLE_LEFT
3583 .       rr #INDENT_STYLE_RIGHT
3584 .       rr #INDENT_STYLE_BOTH
3585 .    \}
3586 .END
3587 \#
3588 \# =====================================================================
3589 \#
3590 \# +++HANGING CHARACTERS+++
3591 \#
3592 \#   LEFT_HANG hangs its argument to the left of the left margin.
3593 \#   If enclosed in double-quotes, the argument may contain local
3594 \#   horizontal motions.  Input text after LEFT_HANG must begin
3595 \#   by repeating the text of the argument including horizontal
3596 \#   motions.  If the hung character is a left double-quote,
3597 \#   \[lq] must be used in the argument and the usual keyboard
3598 \#   double-quote (") used for the input text (so as not to confuse
3599 \#   SMARTQUOTES).
3600 \#
3601 \#   HANG is called inline with \*[HANG <character>].  Hangs its
3602 \#   single-character argument, typically a punctuation mark, to the
3603 \#   right of the right margin in justified copy.  Unlike LEFT_HANG,
3604 \#   does not require repeating the character as part of input text.
3605 \#
3606 \#   Except for hung hyphens, HANG may be used mid-line in input
3607 \#   text.  Hung hyphens must come at the end of input lines.  If
3608 \#   the hung character is a right double-quote, "\[rq]" must be
3609 \#   used as the argument (that is, the rq character surrounded by
3610 \#   double-quotes).  The double-quotes are required for all special
3611 \#   characters that have the form \[c].
3612 \#
3613 .MAC LEFT_HANG END
3614 .    ie '\\$0'LEFT_HANG' \{\
3615 .       vpt 0
3616 .       sp -1
3617 .       nr #HANG \w'\\$1'
3618 .       in +\\n[#HANG]u
3619 .       ll +\\n[#HANG]u
3620 .       ie !\\n[.z] .po -\\n[#HANG]u
3621 .       el \!.po -\\n[#HANG]u
3622 .       ti -\\n[#HANG]u
3623 .       vpt
3624 .    \}
3625 .    el \{\
3626 .       vpt 0
3627 .       in
3628 .       ll
3629 .       po
3630 .       vpt
3631 .    \}
3632 .END
3633 \#
3634 .ALIAS NO_HANG LEFT_HANG
3635 \#
3636 .MAC HANG END
3637 \c
3638 .if '\\$1'\[rq]' .nr #OPEN_CLOSE 0
3639 \c
3640 \&\\$1\c
3641 \h'-\w'\\$1'u'\c
3642 .END
3643 \#
3644 \# =====================================================================
3645 \#
3646 \# +++MULTIPLE COLUMNS+++
3647 \#
3648 \# MULTIPLE COLUMNS ON
3649 \# -------------------
3650 \# *Arguments:
3651 \#   <none>
3652 \# *Function:
3653 \#   Marks the top of a column set
3654 \#
3655 .MAC MCO END
3656 .    mk c
3657 .END
3658 \#
3659 \# MULTIPLE COLUMN RETURN
3660 \# ----------------------
3661 \# *Arguments:
3662 \#   <none>
3663 \# *Function:
3664 \#   Returns to the top of a column set
3665 \#
3666 .MAC MCR END
3667 .    vpt 0
3668 .    sp |\\n[c]u
3669 .    vpt
3670 .END
3671 \#
3672 \# MULTIPLE COLUMNS OFF
3673 \# --------------------
3674 \# *Arguments:
3675 \#   <none> | <lead to advance beneath bottom of deepest column>
3676 \# *Function:
3677 \#   Advances to the end of a column set
3678 \# *Notes:
3679 \#   With no argument, advances to the next baseline (at the current
3680 \#   leading value) beneath the longest column.  With an argument
3681 \#   (which requires a unit of measure), advances arg distance
3682 \#   beneath the baseline of the deepest column.  If the argument
3683 \#   is zero, advances to the baseline of the deepest column.
3684 \#
3685 .MAC MCX END
3686 .    vpt 0
3687 .    ie '\\$1'' \{\
3688 .       if '\\n[.z]'FLOAT*DIV' \!.TQ
3689 .       TQ
3690 .       sp |\\n[.h]u
3691 .    \}
3692 .    el \{\
3693 .       nr #MCX_ALD (\\$1)
3694 .       TQ
3695 .       ie \\n[#MCX_ALD]=0 .sp |\\n[.h]u-1v
3696 .       el .sp |\\n[.h]u+\\n[#MCX_ALD]u
3697 .       rr #MCX_ALD
3698 .    \}
3699 .    vpt
3700 .END
3701 \#
3702 \# =====================================================================
3703 \#
3704 \# +++TYPESETTING SUPPORT MACROS+++
3705 \#
3706 \# TRAP
3707 \# ----
3708 \# *Arguments:
3709 \#   toggle
3710 \# *Function:
3711 \#   Enables/disables traps.
3712 \# *Notes:
3713 \#   EL and TN don't function as advertised on the last line before
3714 \#   a trap (when they break the preceding line, they spring the
3715 \#   trap, and groff won't back up to the line preceding the trap).
3716 \#   TRAP is a kludge to get EL and TN work properly on last lines.
3717 \#   The user simply encloses the offending lines in TRAP OFF/TRAP.
3718 \#
3719 .MAC TRAP END
3720 .    ie '\\$1'' .vpt
3721 .    el         .vpt 0
3722 .END
3723 \#
3724 \# SILENT
3725 \# ------
3726 \# *Arguments:
3727 \#   <none> | <anything>
3728 \# *Function:
3729 \#   Diverts text so that it doesn't print, or turns the function off.
3730 \# *Notes:
3731 \#   Useful for setting up autotabs where you don't want the line with
3732 \#   the tab marks to print.
3733 \#
3734 \#   Also aliased as COMMENT, in case user wants to input a batch of
3735 \#   text that doesn't print.
3736 \#
3737 .MAC SILENT END
3738 .    nr #SILENT 1
3739 .    if \\n[#QUAD] .br
3740 .    ie '\\$1'' .di NO_FLASH
3741 .    el \{\
3742 .       br
3743 .       di
3744 .       rm NO_FLASH
3745 .       rr #SILENT
3746 .    \}
3747 .END
3748 \#
3749 \# PRINT
3750 \# -----
3751 \# *Function:
3752 \#   Prints anything.  A macro that helps keep my code nicely indented.
3753 \#
3754 .MAC PRINT END
3755 .    nop \\$*
3756 .END
3757 \#
3758 \# Numbered strings for while loop in SMALLCAPS.
3759 \#
3760 .ds $c1 a
3761 .ds $c2 b
3762 .ds $c3 c
3763 .ds $c4 d
3764 .ds $c5 e
3765 .ds $c6 f
3766 .ds $c7 g
3767 .ds $c8 h
3768 .ds $c9 i
3769 .ds $c10 j
3770 .ds $c11 k
3771 .ds $c12 l
3772 .ds $c13 m
3773 .ds $c14 n
3774 .ds $c15 o
3775 .ds $c16 p
3776 .ds $c17 q
3777 .ds $c18 r
3778 .ds $c19 s
3779 .ds $c20 t
3780 .ds $c21 u
3781 .ds $c22 v
3782 .ds $c23 w
3783 .ds $c24 x
3784 .ds $c25 y
3785 .ds $c26 z
3786 .ds $c27 \[`a]
3787 .ds $c28 \[^a]
3788 .ds $c29 \['a]
3789 .ds $c30 \[:a]
3790 .ds $c31 \[oa]
3791 .ds $c32 \[~a]
3792 .ds $c33 \[ae]
3793 .ds $c34 \[`e]
3794 .ds $c35 \[^e]
3795 .ds $c36 \['e]
3796 .ds $c37 \[:e]
3797 .ds $c38 \[`i]
3798 .ds $c39 \[^i]
3799 .ds $c40 \['i]
3800 .ds $c41 \[:i]
3801 .ds $c42 \[`o]
3802 .ds $c43 \[^o]
3803 .ds $c44 \['o]
3804 .ds $c45 \[:o]
3805 .ds $c46 \[~o]
3806 .ds $c47 \[/o]
3807 .ds $c48 \[`u]
3808 .ds $c49 \[^u]
3809 .ds $c50 \['u]
3810 .ds $c51 \[:u]
3811 .ds $c52 \[,c]
3812 .ds $c53 \[Sd]
3813 .ds $c54 \[~n]
3814 .ds $c55 \[Sd]
3815 .ds $c56 \[Tp]
3816 .ds $c57 \['y]
3817 .ds $c58 \[:y]
3818 \#
3819 .ds $C1 A
3820 .ds $C2 B
3821 .ds $C3 C
3822 .ds $C4 D
3823 .ds $C5 E
3824 .ds $C6 F
3825 .ds $C7 G
3826 .ds $C8 H
3827 .ds $C9 I
3828 .ds $C10 J
3829 .ds $C11 K
3830 .ds $C12 L
3831 .ds $C13 M
3832 .ds $C14 N
3833 .ds $C15 O
3834 .ds $C16 P
3835 .ds $C17 Q
3836 .ds $C18 R
3837 .ds $C19 S
3838 .ds $C20 T
3839 .ds $C21 U
3840 .ds $C22 V
3841 .ds $C23 W
3842 .ds $C24 X
3843 .ds $C25 Y
3844 .ds $C26 Z
3845 .ds $C27 \[`A]
3846 .ds $C28 \[^A]
3847 .ds $C29 \['A]
3848 .ds $C30 \[:A]
3849 .ds $C31 \[oA]
3850 .ds $C32 \[~A]
3851 .ds $C33 \[AE]
3852 .ds $C34 \[`E]
3853 .ds $C35 \[^E]
3854 .ds $C36 \['E]
3855 .ds $C37 \[:E]
3856 .ds $C38 \[`I]
3857 .ds $C39 \[^I]
3858 .ds $C40 \['I]
3859 .ds $C41 \[:I]
3860 .ds $C42 \[`O]
3861 .ds $C43 \[^O]
3862 .ds $C44 \['O]
3863 .ds $C45 \[:O]
3864 .ds $C46 \[~O]
3865 .ds $C47 \[/O]
3866 .ds $C48 \[`U]
3867 .ds $C49 \[^U]
3868 .ds $C50 \['U]
3869 .ds $C51 \[:U]
3870 .ds $C52 \[,C]
3871 .ds $C53 \[-D]
3872 .ds $C54 \[~N]
3873 .ds $C55 \[-D]
3874 .ds $C56 \[TP]
3875 .ds $C57 \['Y]
3876 .ds $C58 \[:Y]
3877 \#
3878 \# CAPS
3879 \# ----
3880 \# *Arguments:
3881 \#   <none> | <anything>
3882 \# *Function:
3883 \#   Converts text to caps, or, if OFF, reverts to normal caps/lc.
3884 \# *Notes:
3885 \#   For inline control of capitalization style, use \*[UC] and
3886 \#   \*[LC].
3887 \#
3888 .MAC CAPS END
3889 .    ie '\\$1'' \{\
3890 .       LC_TO_CAPS
3891 .       nr #CAPS_ON 1
3892 .    \}
3893 .    el \{\
3894 .       CAPS_TO_LC
3895 .       rr #CAPS_ON
3896 .    \}
3897 .END
3898 \#
3899 .MAC UC END
3900 \c
3901 .    LC_TO_CAPS
3902 .    nr #CAPS_ON 1
3903 .END
3904 \#
3905 .MAC LC END
3906 \c
3907 .    CAPS_TO_LC
3908 .    rr #CAPS_ON
3909 .END
3910 \#
3911 \# Perform lowercase conversion to caps or revert to lowercase
3912 \#
3913 .MAC CONVERT_CASE END
3914 .    if '\\$0'LC_TO_CAPS' \{\
3915 .       nr #LOOP 0 1
3916 .       while \\n+[#LOOP]<=58 \{\
3917 .          tr \\*[$c\\n[#LOOP]]\\*[$C\\n[#LOOP]]  
3918 .       \}
3919 .    \}
3920 .    if '\\$0'CAPS_TO_LC' \{\
3921 .       nr #LOOP 0 1
3922 .       while \\n+[#LOOP]<=58 \{\
3923 .          tr \\*[$c\\n[#LOOP]]\\*[$c\\n[#LOOP]]  
3924 .       \}
3925 .    \}
3926 .END
3927 .
3928 .ALIAS LC_TO_CAPS CONVERT_CASE
3929 .ALIAS CAPS_TO_LC CONVERT_CASE
3930 .
3931 \#
3932 \# SMALLCAPS
3933 \# ---------
3934 \# *Arguments:
3935 \#   <none> | <anything>
3936 \# *Function:
3937 \#   Converts text to smallcaps, or, if <anything>, reverts to normal
3938 \#   caps/lc.
3939 \# *Notes:
3940 \#   SMALLCAPS has no inline escape eqiv. to \*[UC].
3941 \#
3942 .MAC SMALLCAPS END
3943 .    if \\n[.int] .nop \& \c
3944 .    nr sc*size \\n[.ps]*\\n[sc*factor]/1000
3945 .    if \\n[sc*wt-adj] .nr sc*wt-adj-factor \\n[sc*size]*\\n[sc*wt-adj]/1000
3946 .    if \\n[sc*extend] .nr sc*extend-factor \\n[sc*size]*\\n[sc*extend]/1000
3947 .    ie '\\$1'' \{\
3948 .       nr #SMALLCAPS_ON 1
3949 .       nr #LOOP 0 1
3950 .       while \\n+[#LOOP]<=58 \{\
3951 .          char \\*[$c\\n[#LOOP]] \
3952 \Z'\s[\\n[sc*size]u+\\n[sc*extend-factor]u]\H'-\\n[sc*extend-factor]u'\
3953 \\*[$C\\n[#LOOP]]'\
3954 \h'\\n[sc*wt-adj-factor]u'\\*[$C\\n[#LOOP]]\s[0]
3955 .       \}
3956 .    \}
3957 .    el \{\
3958 .       nr #LOOP 0 1
3959 .       while \\n+[#LOOP]<=58 \{\
3960 .          rchar \\*[$c\\n[#LOOP]]
3961 .      \}
3962 .      rr sc*wt-adj-factor
3963 .      rr sc*extend-factor
3964 .      rr #SMALLCAPS_ON
3965 .    \}
3966 .END
3967 \#
3968 \# SMALLCAPS_SIZE
3969 \# --------------
3970 \# *Arguments:
3971 \#   <size> [ <weight adjustment>
3972 \# *Function:
3973 \#   Sets registers 'sc*factor', 'sc*wt-adj', and sc*extend.
3974 \# *Notes:
3975 \#   Weight adjustment pseudo-emboldens small caps to visually match the
3976 \#   weight of the larger real caps.
3977 \#
3978 \#   Both sc*factor (size) and sc*wt-adj (weight adjustment) args are
3979 \#   expressed as percentages of type size.
3980 \#
3981 .MAC SMALLCAPS_STYLE END
3982 .    nr #LOOP 0 1
3983 .    while \\n+[#LOOP]<=\\n[#NUM_ARGS] \{\
3984 .       if '\\$1'SIZE' \{\
3985 .          shift
3986 .          nr sc*factor (z;\\$1)/100
3987 .          shift
3988 .       \}
3989 .       if '\\$1'WEIGHT_ADJ' \{\
3990 .          shift
3991 .          nr sc*wt-adj (z;\\$1)/100
3992 .          shift
3993 .       \}
3994 .       if '\\$1'EXTEND' \{\
3995 .          shift
3996 .          nr sc*extend (z;\\$1)/100
3997 .          shift
3998 .       \}
3999 .    \}
4000 .    if \\n[sc*wt-adj]=0 .rr sc*wt-adj
4001 .    if \\n[sc*extend]=0 .rr sc*extend
4002 .END
4003 .
4004 .SMALLCAPS_STYLE \
4005 SIZE 74 \
4006 WEIGHT_ADJ .3 \
4007 EXTEND 5
4008 \#
4009 \# SIZESPECS
4010 \# ---------
4011 \# Argument:
4012 \#   <none>
4013 \# Function:
4014 \#   Gets cap-height, x-height, and descender depth of the
4015 \#   current font at the current point size.
4016 \# *Notes:
4017 \#   The routine is diverted so it remains invisible to output.
4018 \#
4019 .MAC SIZESPECS END
4020 .    if '\\n[.z]'FLOAT*DIV' \
4021 .       if \\n[dn] .nr saved-dn \\n[dn]
4022 .    di TYPESIZE
4023 E\R'#CAP_HEIGHT \\n[.cht]'
4024 e\R'#X_HEIGHT \\n[.cht]'
4025 y\R'#DESCENDER \\n[.cdp]'
4026 .    br
4027 .    ds $CAP_HEIGHT \\n[#CAP_HEIGHT]u
4028 .    ds $X_HEIGHT \\n[#X_HEIGHT]u
4029 .    ds $DESCENDER \\n[#DESCENDER]u
4030 .    di
4031 .    if '\\n[.z]'FLOAT*DIV' \
4032 .       nr dn \\n[saved-dn]
4033 .END
4034 \#
4035 \# =====================================================================
4036 \#
4037 \# +++TYPESETTING ALIASES+++
4038 \#
4039 .ALIAS ADD_SPACE         ALD
4040 .ALIAS CENTRE            CENTER
4041 .ALIAS COLOUR            COLOR
4042 .ALIAS COMMENT           SILENT
4043 .ALIAS CONDENSE          CONDENSE_OR_EXTEND
4044 .ALIAS EXTEND            CONDENSE_OR_EXTEND
4045 .ALIAS FAM               FAMILY
4046 .ALIAS FONT              FT
4047 .ALIAS HYPHENATE         HY
4048 .ALIAS HYPHENATION       HY
4049 .ALIAS HYSET             HY_SET
4050 .ALIAS IBQ               IBX
4051 .ALIAS ILQ               ILX
4052 .ALIAS IQ                IX
4053 .ALIAS IRQ               IRX
4054 .ALIAS LIG               LIGATURES
4055 .ALIAS NEWCOLOUR         NEWCOLOR
4056 .ALIAS PADMARKER         PAD_MARKER
4057 .ALIAS SP                ALD
4058 .ALIAS SPACE             ALD
4059 .ALIAS TABSET            TAB_SET
4060 .ALIAS TB                TAB
4061 .ALIAS UNDERSCORE_2      UNDERSCORE2
4062 .ALIAS XCOLOUR           XCOLOR
4063 \#
4064 \# ====================================================================
4065 \#
4066 \# DOCUMENT PROCESSING MACROS, STRINGS AND ALIASES
4067 \# ===============================================
4068 \#
4069 \# DOC_MACRO_ERROR
4070 \# ---------------
4071 \# *Arguments:
4072 \#   None.
4073 \# *Function:
4074 \#   Warning message if DOC_<PARAMETER> called before START.
4075 \#
4076 .MAC DOC_MACRO_ERROR END
4077 .    if '\\$1'DOC_L_MARGIN'    .ds $REPLACEMENT L_MARGIN
4078 .    if '\\$1'DOC_R_MARGIN'    .ds $REPLACEMENT R_MARGIN
4079 .    if '\\$1'DOC_LINE_LENGTH' .ds $REPLACEMENT LL
4080 .    if '\\$1'DOC_FAMILY'      .ds $REPLACEMENT "FAMILY or FAM
4081 .    if '\\$1'DOC_PT_SIZE'     .ds $REPLACEMENT PT_SIZE
4082 .    if '\\$1'DOC_LEAD'        .ds $REPLACEMENT LS
4083 .    if '\\$1'DOC_QUAD'        .ds $REPLACEMENT QUAD
4084 .    tm1 "[mom]: \\$1 at line \\n[.c] of '\\n[.F]' should not be used before START.
4085 .    tm1 "       Use \\*[$REPLACEMENT] instead.
4086 .    ab   [mom]: Aborting.
4087 .END
4088 \#
4089 \# +++PAGE DIMENSIONS+++
4090 \#
4091 \# PAPER SIZE
4092 \# ----------
4093 \# *Arguments:
4094 \#   LETTER | LEGAL | STATEMENT | TABLOID | LEDGER | FOLIO | QUARTO | 10x14 | EXECUTIVE | A3 | A4 | A5 | B4 | B5
4095 \# *Function:
4096 \#   Sets up dimensions for different paper sizes.
4097 \#
4098 .MAC PAPER END
4099 .    ds $PAPER \\$1
4100 .    if '\\*[$PAPER]'LETTER' \{\
4101 .       PAGEWIDTH  8.5i
4102 .       PAGELENGTH 11i
4103 .    \}
4104 .    if '\\*[$PAPER]'LEGAL' \{\
4105 .       PAGEWIDTH  8.5i
4106 .       PAGELENGTH 14i
4107 .    \}
4108 .    if '\\*[$PAPER]'STATEMENT' \{\
4109 .       PAGEWIDTH  5.5i
4110 .       PAGELENGTH 8.5i
4111 .    \}
4112 .    if '\\*[$PAPER]'TABLOID' \{\
4113 .       PAGEWIDTH  11i
4114 .       PAGELENGTH 17i
4115 .    \}
4116 .    if '\\*[$PAPER]'LEDGER' \{\
4117 .       PAGEWIDTH  17i
4118 .       PAGELENGTH 11i
4119 .    \}
4120 .    if '\\*[$PAPER]'FOLIO' \{\
4121 .       PAGEWIDTH  8.5i
4122 .       PAGELENGTH 13i
4123 .    \}
4124 .    if '\\*[$PAPER]'QUARTO' \{\
4125 .       PAGEWIDTH  610p
4126 .       PAGELENGTH 780p
4127 .    \}
4128 .    if '\\*[$PAPER]'10x14' \{\
4129 .       PAGEWIDTH  10i
4130 .       PAGELENGTH 14i
4131 .    \}
4132 .    if '\\*[$PAPER]'EXECUTIVE' \{\
4133 .       PAGEWIDTH  7.25i
4134 .       PAGELENGTH 10.5i
4135 .    \}
4136 .    if '\\*[$PAPER]'A3' \{\
4137 .       PAGEWIDTH  842p
4138 .       PAGELENGTH 1190p
4139 .    \}
4140 .    if '\\*[$PAPER]'A4' \{\
4141 .       PAGEWIDTH  595p
4142 .       PAGELENGTH 842p
4143 .    \}
4144 .    if '\\*[$PAPER]'A5' \{\
4145 .       PAGEWIDTH  421p
4146 .       PAGELENGTH 595p
4147 .    \}
4148 .    if '\\*[$PAPER]'B4' \{\
4149 .       PAGEWIDTH  709p
4150 .       PAGELENGTH 1002p
4151 .    \}
4152 .    if '\\*[$PAPER]'B5' \{\
4153 .       PAGEWIDTH  501p
4154 .       PAGELENGTH 709p
4155 .    \}
4156 .    if '\\$2'LANDSCAPE' \{\
4157 .       nr #PAGE_WIDTH_TMP \\n[#PAGE_WIDTH]
4158 .       PAGEWIDTH \\n[#PAGE_LENGTH]u
4159 .       PAGELENGTH \\n[#PAGE_WIDTH_TMP]u
4160 .    \}
4161 .    if !r#L_MARGIN .L_MARGIN \\n[.o]
4162 .    if !r#R_MARGIN .R_MARGIN 1i
4163 .END
4164 \#
4165 \# ====================================================================
4166 \#
4167 \# +++PRINTSTYLE -- TYPEWRITE OR TYPESET+++
4168 \#
4169 \# PRINTSTYLE
4170 \# ----------
4171 \# *Arguments:
4172 \#   TYPESET | TYPEWRITE [SINGLESPACE]
4173 \# *Function:
4174 \#   Sets type specs for typewriter-style or typeset output.
4175 \# *Notes:
4176 \#   Number registers: TYPEWRITE=1, TYPESET=2.
4177 \#
4178 .MAC PRINTSTYLE END
4179 .    if !\\n[#COLLATE]=1 \{\
4180 .       if !d$PAPER .PAPER LETTER
4181 .       if '\\$1'TYPEWRITE' \{\
4182 .          nr #PRINT_STYLE 1
4183 .          if !\\n[#DOC_TYPE]=4 \{\
4184 .             L_MARGIN 6P
4185 .             R_MARGIN 6P
4186 .          \}
4187 .          ds $TYPEWRITER_FAM C
4188 .          ds $TYPEWRITER_PS  12
4189 .          TYPEWRITER
4190 .          color 0
4191 .          ie '\\$2'SINGLESPACE' \{\
4192 .             nr #SINGLE_SPACE 1
4193 .             vs 12
4194 .             ie \\n[#DOC_TYPE]=4 .nr #FOOTER_ADJ \\n[.v]
4195 .             el .nr #FOOTER_ADJ \\n[.v]
4196 .             nr #ORIGINAL_DOC_LEAD \\n[.v]
4197 .          \}
4198 .          el \{\
4199 .             if !\\n[#DOC_TYPE]=4 \{\
4200 .                vs 24
4201 .                nr #FOOTER_ADJ \\n[.v]/2
4202 .                nr #ORIGINAL_DOC_LEAD \\n[.v]
4203 .             \}
4204 .          \}
4205 .          QUAD    L
4206 .          HY      OFF
4207 .          SMARTQUOTES OFF
4208 .          if !\\n[#PP_INDENT] .nr #PP_INDENT 3P
4209 .          HDRFTR_RIGHT_CAPS
4210 .          nr #BOLDER_UNITS 0
4211 .          nr #CONDENSE 0
4212 .          nr #EXTEND 0
4213 .          if !\\n[#ITALIC_MEANS_ITALIC] .rm IT
4214 .          rm BD
4215 .          rm BDI
4216 .          if !\\n[#ITALIC_MEANS_ITALIC] .rm PREV
4217 .          if !\\n[#SLANT_MEANS_SLANT]   .UNDERLINE_SLANT
4218 .          if !\\n[#ITALIC_MEANS_ITALIC] .UNDERLINE_ITALIC
4219 .          if !\\n[#UNDERLINE_QUOTES]    .UNDERLINE_QUOTES
4220 .          nr #IGNORE_COLUMNS 1
4221 .          nr #RULE_WEIGHT 500
4222 .          char \[em] --
4223 .          tr `'
4224 .          tr \[lq]"
4225 .          tr \[rq]"
4226 .       \}
4227 .       if '\\$1'TYPESET' \{\
4228 .          nr #PRINT_STYLE 2
4229 .          if !\\n[#DOC_TYPE]=5 \{\
4230 .             if !\\n[#DOC_TYPE]=4 \{\
4231 .                L_MARGIN 6P
4232 .                R_MARGIN 6P
4233 .             \}
4234 .          \}
4235 .          FAMILY  T
4236 .          FT      R
4237 .          if !\\n[#DOC_TYPE]=4 .ps 12.5
4238 .          if !\\n[#DOC_TYPE]=4 .vs 16
4239 .\" In DEFAULTS, TRAPS is run with this leading, so we need a register to
4240 .\" hold it for use with the .sp in FOOTER
4241 .          nr #FOOTER_ADJ 12000
4242 .          JUSTIFY
4243 .          HY
4244 .          HY_SET 2 36p 1p
4245 .          KERN
4246 .          LIG
4247 .          SS 0
4248 .          SMARTQUOTES
4249 .          if !\\n[#PP_INDENT] \{\
4250 .             in 2m                 \"Set indent
4251 .             nr #PP_INDENT \\n[.i] \"Read into #PP_INDENT
4252 .             in 0                  \"Remove indent
4253 .          \}
4254 .          HDRFTR_RIGHT_CAPS
4255 .          rr #IGNORE_COLUMNS
4256 .       \}
4257 .\" Set up default style for nine levels of headings
4258 .       nr #HD_LEVEL 0 1 \" loop step
4259 .       nr #LOOP 9       \" loop count
4260 .       while \\n+[#HD_LEVEL]<=\\n[#LOOP] \{\
4261 .           HEADING_STYLE \\n[#HD_LEVEL] \
4262             FONT  B  \
4263             SIZE  +0 \
4264             QUAD  L  \
4265             NEEDS 1 \
4266             COLOR black
4267 .\"  Set up default style for nine levels of TOC headings
4268 .           TOC_ENTRY_STYLE \\n[#HD_LEVEL] \
4269             FONT  R  \
4270             SIZE  +0 \
4271             COLOR black
4272 .       \}
4273 .\" Set up decreasing sizes for headings levels 1 - 3, starting at +3
4274 .       nr #HD_LEVEL 0 1 \" loop step
4275 .       nr #LOOP 3       \" loop count
4276 .       nr #HD_SIZE 4 1
4277 .       while \\n+[#HD_LEVEL]<=\\n[#LOOP] \{\
4278 .          nr #HD_SIZE_CHANGE \\n-[#HD_SIZE]
4279 .          ds $HEAD_\\n[#HD_LEVEL]_SIZE +\\n[#HD_SIZE_CHANGE]
4280 .       \}
4281 .\" Set up TOC title style
4282 .       TOC_TITLE_STYLE FONT R SIZE +0 INDENT 0
4283 .\" Set up captions, labels, sources
4284 .       LABELS ALL FONT B AUTOLEAD 2
4285 .       LABELS EQN FONT R QUAD RIGHT
4286 .       CAPTIONS ALL AUTOLEAD 2
4287 .       CAPTIONS EQN QUAD CENTER
4288 .       SOURCES TBL AUTOLEAD 2
4289 .    \}
4290 .END
4291 \#
4292 \# Set limited parameters to TYPEWRITE.
4293 \#
4294 .MAC TYPEWRITER_FAMILY END
4295 .    ds $TYPEWRITER_FAM \\$1
4296 .END
4297 \#
4298 .ALIAS TYPEWRITER_FAM TYPEWRITER_FAMILY
4299 \#
4300 .MAC TYPEWRITER_SIZE END
4301 .    ds $TYPEWRITER_PS \\$1
4302 .END
4303 \#
4304 .MAC TYPEWRITER END
4305 .    fam \\*[$TYPEWRITER_FAM]
4306 .    ft  R
4307 .    ps  \\*[$TYPEWRITER_PS]
4308 .END
4309 \#
4310 \# ITALIC MEANS ITALIC
4311 \# -------------------
4312 \# *Argument:
4313 \#   <none>
4314 \# *Function:
4315 \#   Instructs TYPEWRITE to treat italics as italics, whether
4316 \#   invoked via control lines or inline.
4317 \# *Notes:
4318 \#   ITALIC_MEANS_ITALIC and UNDERLINE_ITALIC are mutually exclusive,
4319 \#   hence invoking the one automatically turns off the other.
4320 \#
4321 .MAC ITALIC_MEANS_ITALIC END
4322 .    if \\n[#PRINT_STYLE]=1 \{\
4323 .       nr #ITALIC_MEANS_ITALIC 1
4324 .       rr #UNDERLINE_ITALIC
4325 .       rm ROM
4326 .       rm IT
4327 .       rm PREV
4328 .       ds ROM  \Ef[R]
4329 .       ds IT   \Ef[I]
4330 .       ds PREV \Ef[]
4331 .    \}
4332 .END
4333 \#
4334 \# UNDERLINE ITALIC
4335 \# ----------------
4336 \# *Argument:
4337 \#   <none>
4338 \# *Function:
4339 \#   Instructs TYPEWRITE to underline italics, whether invoked
4340 \#   via control lines or inline.
4341 \# *Notes:
4342 \#   UNDERLINE_ITALIC and ITALIC_MEANS_ITALIC are mutually exclusive,
4343 \#   hence invoking the one automatically turns off the other.
4344 \#
4345 \#   UNDERLINE_ITALIC is the default for TYPEWRITE.
4346 \#
4347 .MAC UNDERLINE_ITALIC END
4348 .    if \\n[#PRINT_STYLE]=1 \{\
4349 .       nr #UNDERLINE_ITALIC 1
4350 .       rr #ITALIC_MEANS_ITALIC
4351 .       rm ROM
4352 .       rm IT
4353 .       rm PREV
4354 .       ds ROM  \E*[ULX]
4355 .       ds IT   \E*[UL]
4356 .       ds PREV \E*[ULX]
4357 .    \}
4358 .END
4359 \#
4360 \# UNDERLINE SLANT
4361 \# ---------------
4362 \# *Arguments:
4363 \#   <none> | <anything>
4364 \# *Function:
4365 \#   Instructs TYPEWRITE to underline occurrences of \*[SLANT], or
4366 \#   turns feature off.
4367 \# *Notes:
4368 \#   Users may want \*[SLANT] to mean slant in TYPEWRITE, although
4369 \#   most of the time, \*[SLANT] most likely means the user wanted
4370 \#   italic but didn't have it, ergo the need to tell TYPEWRITE to
4371 \#   treat \*[SLANT] as italic (i.e. underlined).
4372 \#
4373 \#   UNDERLINE_SLANT and SLANT_MEANS_SLANT are mutually exclusive,
4374 \#   hence invoking the one automatically turns off the other.
4375 \#
4376 \#   UNDERLINE_SLANT is the default for TYPEWRITE.
4377 \#
4378 .MAC UNDERLINE_SLANT END
4379 .    if \\n[#PRINT_STYLE]=1 \{\
4380 .       rr #SLANT_MEANS_SLANT
4381 .       nr #UNDERLINE_SLANT 1
4382 .       rm SLANT
4383 .       rm SLANTX
4384 .       ds SLANT  \ER'#SLANT_ON 1'\E*[UL]
4385 .       ds SLANTX \ER'#SLANT_ON 0'\E*[ULX]
4386 .    \}
4387 .END
4388 \#
4389 .MAC SLANT_MEANS_SLANT END
4390 .    if \\n[#PRINT_STYLE]=1 \{\
4391 .       rr #UNDERLINE_SLANT
4392 .       nr #SLANT_MEANS_SLANT 1
4393 .       rm SLANT
4394 .       rm SLANTX
4395 .       ds SLANT  \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
4396 .       ds SLANTX \ER'#SLANT_ON 0'\ES'0'
4397 .    \}
4398 .END
4399 \#
4400 .MAC IGNORE_COLUMNS END
4401 .    if \\n[#PRINT_STYLE]=1 .nr #NO_COLUMNS 1
4402 .END
4403 \#
4404 \# ====================================================================
4405 \#
4406 \# +++COPY STYLE -- DRAFT OR FINAL+++
4407 \#
4408 \# COPY STYLE
4409 \# ----------
4410 \# *Arguments:
4411 \#   DRAFT | FINAL
4412 \# *Function:
4413 \#   Sets registers that are used to determine what to put
4414 \#   in the default header, and how to number pages.
4415 \# *Notes:
4416 \#   DOCTYPE must come before COPYSTYLE.
4417 \#
4418 .MAC COPYSTYLE END
4419 .    ds $COPY_STYLE \\$1
4420 .    if '\\*[$COPY_STYLE]'DRAFT' \{\
4421 .       nr #COPY_STYLE 1
4422 .       if !d$DRAFT .DRAFT 1
4423 .    \}
4424 .    if '\\*[$COPY_STYLE]'FINAL' .nr #COPY_STYLE 2
4425 .    if !d$CHAPTER_STRING  .CHAPTER_STRING "Chapter"
4426 .    if !d$DRAFT_STRING    .DRAFT_STRING "Draft"
4427 .    if !d$REVISION_STRING .REVISION_STRING "Rev."
4428 .\" Default
4429 .    if \\n[#DOC_TYPE]=1 \{\
4430 .       ie \\n[#COPY_STYLE]=1 \{\
4431 .          ie \\n[#PAGENUM_STYLE_SET] .PAGENUM_STYLE \\*[$PAGENUM_STYLE]
4432 .          el .PAGENUM_STYLE roman
4433 .          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
4434 .             ie \\n[#DRAFT_WITH_PAGENUM] .ds $HDRFTR_CENTER
4435 .             el \{\
4436 .                ie '\\*[$REVISION]'' \{\
4437 .                   ds $HDRFTR_CENTER \
4438                     \\*[$DRAFT_STRING]\\*[$DRAFT]
4439 .                \}
4440 .                el \{\
4441 .                   ds $HDRFTR_CENTER \
4442                     \\*[$DRAFT_STRING]\\*[$DRAFT], \
4443                     \\*[$REVISION_STRING] \\*[$REVISION]
4444 .                \}
4445 .             \}
4446 .          \}
4447 .       \}
4448 .       el \{\
4449 .          ie \\n[#PAGENUM_STYLE_SET] .PAGENUM_STYLE \\*[$PAGENUM_STYLE]
4450 .          el                         .PAGENUM_STYLE DIGIT
4451 .          if \\n[#DRAFT_WITH_PAGENUM] .rr #DRAFT_WITH_PAGENUM
4452 .          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
4453 .             ds $HDRFTR_CENTER
4454 .             rr #USER_DEF_HDRFTR_CENTER
4455 .          \}
4456 .       \}
4457 .    \}
4458 .\" Chapter
4459 .    if \\n[#DOC_TYPE]=2 \{\
4460 .\" Copystyle DRAFT
4461 .       ie \\n[#COPY_STYLE]=1 \{\
4462 .          ie \\n[#PAGENUM_STYLE_SET] \
4463 .             PAGENUM_STYLE \\*[$PAGENUM_STYLE]
4464 .          el \
4465 .             PAGENUM_STYLE roman
4466 .          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
4467 .             ie \\n[#DRAFT_WITH_PAGENUM] \{\
4468 .                ie '\\*[$CHAPTER]'' \{\
4469 .                   ie !'\\*[$CHAPTER_TITLE_1]'' \
4470 .                       ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
4471 .                   el .ds $HDRFTR_CENTER \\*[$CHAPTER_STRING]
4472 .                \}
4473 .                el \{\
4474 .                   ie !'\\*[$CHAPTER_TITLE_1]'' \
4475 .                       ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
4476 .                   el .ds $HDRFTR_CENTER \\*[$CHAPTER_STRING] \\*[$CHAPTER]
4477 .                \}
4478 .             \}
4479 .             el \{\
4480 .                ie '\\*[$REVISION]'' \{\
4481 .                   ie '\\*[$CHAPTER]'' \{\
4482 .                      ie !'\\*[$CHAPTER_TITLE_1]'' \{\
4483 .                         ie '\\*[$DRAFT]'' \
4484 .                            ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
4485 .                         el \{\
4486 .                            ds $HDRFTR_CENTER \
4487                              \\*[$CHAPTER_TITLE], \
4488                              \\*[$DRAFT_STRING]\\*[$DRAFT]
4489 .                         \}
4490 .                      \}
4491 .                      el \{\
4492 .                         ie '\\*[$DRAFT]'' \{\
4493 .                            ds $HDRFTR_CENTER \
4494                              \\*[$CHAPTER_STRING]
4495 .                         \}
4496 .                         el \{\
4497 .                            ds $HDRFTR_CENTER \
4498                              \\*[$CHAPTER_STRING], \
4499                              \\*[$DRAFT_STRING]\\*[$DRAFT]
4500 .                         \}
4501 .                      \}
4502 .                   \}
4503 .                   el \{\
4504 .                      ie !'\\*[$CHAPTER_TITLE_1]'' \{\
4505 .                         ie '\\*[$DRAFT]'' \
4506 .                            ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
4507 .                         el \{\
4508 .                            ds $HDRFTR_CENTER \
4509                              \\*[$CHAPTER_TITLE_1], \
4510                              \\*[$DRAFT_STRING]\\*[$DRAFT]
4511 .                         \}
4512 .                      \}
4513 .                      el \{\
4514 .                         ie '\\*[$DRAFT]'' \{\
4515 .                            ds $HDRFTR_CENTER \
4516                              \\*[$CHAPTER_STRING] \\*[$CHAPTER]
4517 .                         \}
4518 .                         el \{\
4519 .                            ds $HDRFTR_CENTER \
4520                              \\*[$CHAPTER_STRING] \\*[$CHAPTER], \
4521                              \\*[$DRAFT_STRING]\\*[$DRAFT]
4522 .                         \}
4523 .                      \}
4524 .                   \}
4525 .                \}
4526 .                el \{\
4527 .                   ie '\\*[$CHAPTER]'' \{\
4528 .                      ie !'\\*[$CHAPTER_TITLE_1]'' \{\
4529 .                         ie '\\*[$DRAFT]'' \{\
4530 .                            ds $HDRFTR_CENTER \
4531                              \\*[$CHAPTER_TITLE], \
4532                              \\*[$REVISION_STRING] \\*[$REVISION]
4533 .                         \}
4534 .                         el \{\
4535 .                            ds $HDRFTR_CENTER \
4536                              \\*[$CHAPTER_TITLE], \
4537                              \\*[$DRAFT_STRING]\\*[$DRAFT], \
4538                              \\*[$REVISION_STRING] \\*[$REVISION]
4539 .                         \}
4540 .                      \}
4541 .                      el \{\
4542 .                         ie '\\*[$DRAFT]'' \{\
4543 .                            ds $HDRFTR_CENTER \
4544                              \\*[$CHAPTER_STRING], \
4545                              \\*[$REVISION_STRING] \\*[$REVISION]
4546 .                         \}
4547 .                         el \{\
4548 .                            ds $HDRFTR_CENTER \
4549                              \\*[$CHAPTER_STRING], \
4550                              \\*[$DRAFT_STRING]\\*[$DRAFT], \
4551                              \\*[$REVISION_STRING] \\*[$REVISION]
4552 .                         \}
4553 .                      \}
4554 .                   \}
4555 .                   el \{\
4556 .                      ie !'\\*[$CHAPTER_TITLE_1]'' \{\
4557 .                         ie '\\*[$DRAFT]'' \{\
4558 .                            ds $HDRFTR_CENTER \
4559                              \\*[$CHAPTER_TITLE], \
4560                              \\*[$REVISION_STRING] \\*[$REVISION]
4561 .                         \}
4562 .                         el \{\
4563 .                            ds $HDRFTR_CENTER \
4564                              \\*[$CHAPTER_TITLE], \
4565                              \\*[$DRAFT_STRING]\\*[$DRAFT], \
4566                              \\*[$REVISION_STRING] \\*[$REVISION]
4567 .                         \}
4568 .                      \}
4569 .                      el \{\
4570 .                         ie '\\*[$DRAFT]'' \{\
4571 .                            ds $HDRFTR_CENTER \
4572                              \\*[$CHAPTER_STRING] \\*[$CHAPTER], \
4573                              \\*[$REVISION_STRING] \\*[$REVISION]
4574 .                         \}
4575 .                         el \{\
4576 .                            ds $HDRFTR_CENTER \
4577                              \\*[$CHAPTER_STRING] \\*[$CHAPTER], \
4578                              \\*[$DRAFT_STRING]\\*[$DRAFT], \
4579                              \\*[$REVISION_STRING] \\*[$REVISION]
4580 .                         \}
4581 .                      \}
4582 .                   \}
4583 .                \}
4584 .             \}
4585 .          \}
4586 .       \}
4587 .\" Copystyle FINAL
4588 .       el \{\
4589 .          if \\n[#DRAFT_WITH_PAGENUM] .rr #DRAFT_WITH_PAGENUM
4590 .          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
4591 .             ie \\n[#PAGENUM_STYLE_SET] \
4592 .                PAGENUM_STYLE \\*[$PAGENUM_STYLE]
4593 .             el .PAGENUM_STYLE DIGIT
4594 .             ie '\\*[$CHAPTER]'' \{\
4595 .                ie !'\\*[$CHAPTER_TITLE_1]'' \
4596 .                   ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
4597 .                el \
4598 .                   ds $HDRFTR_CENTER \\*[$CHAPTER_STRING]
4599 .             \}
4600 .             el \{\
4601 .                ie !'\\*[$CHAPTER_TITLE_1]'' \
4602 .                   ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
4603 .                el \
4604 .                   ds $HDRFTR_CENTER \\*[$CHAPTER_STRING] \\*[$CHAPTER]
4605 .             \}
4606 .          \}
4607 .       \}
4608 .    \}
4609 .\" Named
4610 .    if \\n[#DOC_TYPE]=3 \{\
4611 .       ie \\n[#COPY_STYLE]=1 \{\
4612 .          ie \\n[#PAGENUM_STYLE_SET] .PAGENUM_STYLE \\*[$PAGENUM_STYLE]
4613 .          el                         .PAGENUM_STYLE roman
4614 .          ie \\n[#DRAFT_WITH_PAGENUM] \
4615 .             ds $HDRFTR_CENTER \\*[$DOC_TYPE]
4616 .          el \{\
4617 .             if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
4618 .                ie '\\*[$REVISION]'' \{\
4619 .                   ie '\\*[$DRAFT]'' \
4620 .                      ds $HDRFTR_CENTER \\*[$DOC_TYPE]
4621 .                   el \{\
4622 .                      ds $HDRFTR_CENTER \
4623                        \\*[$DOC_TYPE], \
4624                        \\*[$DRAFT_STRING]\\*[$DRAFT]
4625 .                   \}
4626 .                \}
4627 .                el \{\
4628 .                   ie '\\*[$DRAFT]'' \{\
4629 .                      ds $HDRFTR_CENTER \
4630                        \\*[$DOC_TYPE], \
4631                        \\*[$REVISION_STRING] \\*[$REVISION]
4632 .                   \}
4633 .                   el \{\
4634 .                      ds $HDRFTR_CENTER \
4635                        \\*[$DOC_TYPE], \
4636                        \\*[$DRAFT_STRING]\\*[$DRAFT], \
4637                        \\*[$REVISION_STRING] \\*[$REVISION]
4638 .                   \}
4639 .                \}
4640 .             \}
4641 .          \}
4642 .       \}
4643 .       el \{\
4644 .          if \\n[#DRAFT_WITH_PAGENUM] .rr #DRAFT_WITH_PAGENUM
4645 .          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
4646 .             ie \\n[#PAGENUM_STYLE_SET] .PAGENUM_STYLE \\*[$PAGENUM_STYLE]
4647 .             el .PAGENUM_STYLE DIGIT
4648 .             ds $HDRFTR_CENTER \\*[$DOC_TYPE]
4649 .          \}
4650 .       \}
4651 .    \}
4652 .END
4653 \#
4654 \# ====================================================================
4655 \#
4656 \# +++COLLECT DOC INFO (reference macros, metadata)+++
4657 \#
4658 \# *Arguments:
4659 \#   various string/register arguments
4660 \# *Function:
4661 \#   Set strings and registers for covers, docheaders, page headers.
4662 \#
4663 .MAC DOCTITLE END
4664 .    rr #DOCTITLE_NUM
4665 .    nr #DOCTITLE_NUM 0 1
4666 .    while \\n[#NUM_ARGS]>\\n[#DOCTITLE_NUM] \{\
4667 .       ds $DOCTITLE_\\n+[#DOCTITLE_NUM] \\$\\n[#DOCTITLE_NUM]
4668 .    \}
4669 .    ds $DOCTITLE \\$*
4670 .    PDF_TITLE \\*[$DOCTITLE]
4671 .END
4672 \#
4673 .MAC TITLE END \"Document title
4674 .    if '\\$1'DOC_COVER' \{\
4675 .       shift
4676 .       DOC_COVERTITLE \\$@
4677 .       return
4678 .    \}
4679 .    if '\\$1'COVER' \{\
4680 .       shift
4681 .       COVERTITLE \\$@
4682 .       return
4683 .    \}
4684 .    ie \\n[#NUM_ARGS]=0 \{\
4685 .       if \\n[#TITLE_NUM] \{\
4686 .          nr #ITEM 0 1
4687 .          while \\n[#TITLE_NUM]>\\n[#ITEM] \{\
4688 .             rm $TITLE_\\n+[#ITEM]
4689 .          \}
4690 .          rr #TITLE_NUM
4691 .       \}
4692 .    \}
4693 .    el \{\
4694 .       nr #TITLE_NUM 0 1
4695 .       while \\n[#NUM_ARGS]>\\n[#TITLE_NUM] \{\
4696 .          ds $TITLE_\\n+[#TITLE_NUM] \\$\\n[#TITLE_NUM]
4697 .       \}
4698 .       ds $TITLE \\$*
4699 .    \}
4700 .END
4701 \#
4702 .MAC SUBTITLE END \"Document sub-title
4703 .    ie \\n[#NUM_ARGS]=0 \{\
4704 .       if \\n[#DOC_COVER_SUBTITLE_NUM] \
4705 .          ds COVER_ DOC_COVER_
4706 .       if \\n[#COVER_SUBTITLE_NUM] \
4707 .          ds COVER_ COVER_
4708 .       if \\n[#\\*[COVER_]SUBTITLE_NUM] \{\
4709 .          nr #ITEM 0 1
4710 .          while \\n[#\\*[COVER_]SUBTITLE_NUM]>\\n[#ITEM] \{\
4711 .             rm $\\*[COVER_]SUBTITLE_\\n+[#ITEM]
4712 .          \}
4713 .          rr #\\*[COVER_]SUBTITLE_NUM
4714 .          rm $SUBTITLE
4715 .       \}
4716 .    \}
4717 .    el \{\
4718 .       if '\\$1'DOC_COVER' \{\
4719 .          ds COVER_ DOC_COVER_
4720 .          shift
4721 .       \}
4722 .       if '\\$1'COVER' \{\
4723 .          ds COVER_ COVER_
4724 .          shift
4725 .       \}
4726 .       nr #\\*[COVER_]SUBTITLE_NUM 0 1
4727 .       while \\n[#NUM_ARGS]>\\n[#\\*[COVER_]SUBTITLE_NUM] \{\
4728 .          ds $\\*[COVER_]SUBTITLE_\\n+[#\\*[COVER_]SUBTITLE_NUM] \
4729 \\$\\n[#\\*[COVER_]SUBTITLE_NUM]
4730 .       \}
4731 .       rm COVER_
4732 .       ds $SUBTITLE \\$*
4733 .    \}
4734 .END
4735 \#
4736 .MAC CHAPTER END \"If document is a chapter, the chapter number
4737 .    nr #CHAPTER_CALLED 1
4738 .    ds $CHAPTER \\$1
4739 .    if \B'\\*[$CHAPTER]' .nr #CH_NUM \\*[$CHAPTER]
4740 .    if !r #CH_NUM .nr #CH_NUM 1
4741 .END
4742 .
4743 .MAC CHAPTER_NUMBER END
4744 .    nr #CH_NUM \\$1
4745 .END
4746 \#
4747 .MAC CHAPTER_TITLE END \" This defines what comes after Chapter #
4748 .    ie \\n[#NUM_ARGS]=0 \{\
4749 .       if \\n[#CHAPTER_TITLE_NUM] \{\
4750 .          nr #ITEM 0 1
4751 .          while \\n[#CHAPTER_TITLE_NUM]>\\n[#ITEM] \{\
4752 .             rm $CHAPTER_TITLE_\\n+[#ITEM]
4753 .          \}
4754 .          rr #CHAPTER_TITLE_NUM
4755 .          rm $CHAPTER_TITLE
4756 .       \}
4757 .    \}
4758 .    el \{\
4759 .       rr #CHAPTER_TITLE_NUM
4760 .       nr #CHAPTER_TITLE_NUM 0 1
4761 .       while \\n[#NUM_ARGS]>\\n[#CHAPTER_TITLE_NUM] \{\
4762 .          ds $CHAPTER_TITLE_\\n+[#CHAPTER_TITLE_NUM] \
4763 \\$\\n[#CHAPTER_TITLE_NUM]
4764 .       \}
4765 .       ds $CHAPTER_TITLE \\$*
4766 .    \}
4767 .END
4768 \#
4769 .MAC DRAFT END \"Draft number
4770 .    ie '\\$1'' .ds $DRAFT
4771 .    el .ds $DRAFT " \\$1
4772 .END
4773 \#
4774 .MAC REVISION END \"Revision number
4775 .    ds $REVISION \\$1
4776 .END
4777 \#
4778 .MAC DRAFT_WITH_PAGENUMBER END \"Attach draft/revision strings to page number
4779 .    nr #DRAFT_WITH_PAGENUM 1
4780 .END
4781 \#
4782 .MAC AUTHOR END \"Author.  Enclose all args fully in double quotes.
4783 .    rr #NO_PRINT_AUTHOR
4784 .    if '\\$1'DOC_COVER' \{\
4785 .       ds COVER_ DOC_COVER_
4786 .       shift
4787 .    \}
4788 .    if '\\$1'COVER' \{\
4789 .       ds COVER_ COVER_
4790 .       shift
4791 .    \}
4792 .    nr #\\*[COVER_]AUTHOR_NUM 0 1
4793 .    while \\n[#NUM_ARGS]>\\n[#\\*[COVER_]AUTHOR_NUM] \{\
4794 .       ds $\\*[COVER_]AUTHOR_\\n+[#\\*[COVER_]AUTHOR_NUM] \
4795 \\$\\n[#\\*[COVER_]AUTHOR_NUM]
4796 .       if !'\\*[$\\*[COVER_]AUTHOR_\\n[#\\*[COVER_]AUTHOR_NUM]]'' \
4797 .          as $AUTHORS \
4798 "\\*[$\\*[COVER_]AUTHOR_\\n[#\\*[COVER_]AUTHOR_NUM]], \"
4799 .    \}
4800 .    ds $AUTHOR \\*[$AUTHOR_1]
4801 .    substring $AUTHORS 0 -2
4802 .    ds PDF_AUTHORS \\*[$AUTHORS]
4803 .    pdfmomclean PDF_AUTHORS
4804 .    nop \!x X ps:exec [/Author (\\*[PDF_AUTHORS]) /DOCINFO pdfmark
4805 .END
4806 .
4807 .ALIAS EDITOR AUTHOR
4808 \#
4809 .MAC COPYRIGHT END          \"For use on cover pages only
4810 .   ie \\n[#NUM_ARGS]=1 \
4811 .       ds $COVER_COPYRIGHT \[co]\\$1
4812 .    el \
4813 .       if '\\$1'DOC_COVER' .ds $DOC_COVER_COPYRIGHT \[co]\\$2
4814 .END
4815 \#
4816 .MAC COPYRIGHT_V_ADJUST END
4817 .    ds $COPYRIGHT_V_ADJ \\$1
4818 .END
4819 \#
4820 .MAC MISC END \"Doc cover and cover pages only; enclose all args in double quotes
4821 .    rm COVER_
4822 .    ie \\n[#NUM_ARGS]=0 \{\
4823 .       if \\n[#DOC_COVER_MISC_LINES] \
4824 .          ds COVER_ DOC_COVER_
4825 .       if \\n[#COVER_MISC_LINES] \
4826 .          ds COVER_ COVER_
4827 .       if \\n[#\\*[COVER_]MISC_LINES] \{\
4828 .          nr #LINE 0 1
4829 .          while \\n[#\\*[COVER_]MISC_LINES]>\\n[#LINE] \{\
4830 .             rm $\\*[COVER_]MISC_\\n+[#LINE]
4831 .          \}
4832 .          rr #\\*[COVER_]MISC_LINES
4833 .       \}
4834 .    \}
4835 .    el \{\
4836 .       if '\\$1'DOC_COVER' \{\
4837 .          ds COVER_ DOC_COVER_
4838 .          shift
4839 .       \}
4840 .       if '\\$1'COVER' \{\
4841 .          ds COVER_ COVER_
4842 .          shift
4843 .       \}
4844 .       nr #\\*[COVER_]MISC_LINE 0 1
4845 .       while \\n[#NUM_ARGS]>\\n[#\\*[COVER_]MISC_LINE] \{\
4846 .          ds $\\*[COVER_]MISC_\\n+[#\\*[COVER_]MISC_LINE] \
4847 \\$[\\n[#\\*[COVER_]MISC_LINE]]
4848 .       \}
4849 .       nr #\\*[COVER_]MISC_LINES \\n[#NUM_ARGS]
4850 .       rm COVER_
4851 .    \}
4852 .END
4853 \#
4854 \# Page number that appears on page one.
4855 .MAC PAGENUMBER END
4856 .    nr #n%_AT_PAGENUM_SET \\n%
4857 .    nr #PAGE_NUM_ADJ \\$1-\\n[#n%_AT_PAGENUM_SET]
4858 .    rr #n%_AT_PAGENUM_SET
4859 .    nr #PAGE_NUM_SET 1
4860 .END
4861 \#
4862 \# Replacement string for pagenumber.
4863 .MAC PAGENUMBER_STRING END
4864 .    ds $PAGENUM_STRING \\$1
4865 .END
4866 \#
4867 \# ====================================================================
4868 \#
4869 \# +++TYPE OF DOCUMENT+++
4870 \#
4871 \# DOCUMENT TYPE
4872 \# -------------
4873 \# *Argument:
4874 \#   DEFAULT | CHAPTER | NAMED "<whatever> | LETTER
4875 \# *Function:
4876 \#   Creates strings and sets registers for document types.
4877 \# *Notes:
4878 \#   Number registers: DEFAULT=1, CHAPTER=2, NAMED=3, LETTER=4
4879 \#
4880 .MAC DOCTYPE END
4881 .    if '\\$1'DEFAULT' .nr #DOC_TYPE 1
4882 .    if '\\$1'CHAPTER' .nr #DOC_TYPE 2
4883 .    if '\\$1'NAMED' \{\
4884 .       rr #NO_PRINT_DOCTYPE
4885 .       ds $DOC_TYPE \\$2
4886 .       nr #DOC_TYPE 3
4887 .    \}
4888 .    if '\\$1'LETTER' \{\
4889 .       nr #DOC_TYPE 4
4890 .       L_MARGIN 1.125i
4891 .       R_MARGIN 1.125i
4892 .       ps 12
4893 .       vs 13.5
4894 .       nr #FOOTER_ADJ \\n[.v]
4895 .       DOCHEADER OFF
4896 .       PARA_INDENT 3m
4897 .       INDENT_FIRST_PARAS
4898 .       PARA_SPACE
4899 .       ds $SUITE \En[#SUITE]
4900 .       HEADER_MARGIN 3P+6p
4901 .       HEADER_GAP 3P
4902 .       FOOTERS
4903 .       FOOTER_RULE OFF
4904 .       FOOTER_LEFT ""
4905 .       FOOTER_CENTER ""
4906 .       FOOTER_RIGHT_SIZE +0
4907 .       FOOTER_RIGHT "\&.../\E*[$SUITE]
4908 .       FOOTER_ON_FIRST_PAGE
4909 .       em ALL_DONE
4910 .    \}
4911 .    if '\\$1'SLIDES' \{\
4912 .       shift
4913 .       nr #DOC_TYPE 5
4914 .       PRINTSTYLE TYPESET
4915 .       FAMILY H
4916 .       QUAD CENTER
4917 .       QUOTE_STYLE QUAD CENTER
4918 .       BLOCKQUOTE_STYLE \
4919           QUAD J \
4920           INDENT \\n[.l]u/5u
4921 .       PARA_INDENT 0
4922 .       NO_SHIM
4923 .       NO_FLEX
4924 .       HEADING_STYLE 1 \
4925           SIZE +8 \
4926           QUAD CENTER
4927 .       HEADING_STYLE 2 \
4928           SIZE +4 \
4929           QUAD CENTER
4930 .       HEADING_STYLE 3 \
4931           SIZE +2 \
4932           QUAD CENTER
4933 .       DOCHEADER off
4934 .       PAGINATION off
4935 .       PAGENUM_HYPHENS off
4936 .       HEADERS off
4937 .       FOOTERS off
4938 .       HEADERS_PLAIN
4939 .       FOOTERS_PLAIN
4940 .       nr loop-count 0 1
4941 .       nr loop-counter \\n[#NUM_ARGS]
4942 .\" Default 16:9 setup if no ASPECT
4943 .       PAGE 11i 6.1875i 36p 36p 80p 72p
4944 .       PT_SIZE 14
4945 .       AUTOLEAD 4
4946 .       HEADER_SIZE  -2
4947 .       while \\n+[loop-count]<=\\n[loop-counter] \{\
4948 .          if '\\$1'ASPECT' \{\
4949 .             if '\\$2'4:3' \{\
4950 .                PAGE 11i 8.25i 36p 36p 90p 84p
4951 .                PT_SIZE 16
4952 .                AUTOLEAD 6
4953 .                HEADER_SIZE  -3
4954 .             \}
4955 .             if '\\$2'16:9' \{\
4956 .                PAGE 11i 6.1875i 36p 36p 80p 72p
4957 .                PT_SIZE 14
4958 .                AUTOLEAD 4
4959 .                HEADER_SIZE  -2
4960 .             \}
4961 .             shift 2
4962 .          \}
4963 .          if '\\$1'HEADER' \{\
4964 .             shift 1
4965 .             nr #SLIDE_HEADERS 1
4966 .             ds $SLIDE_HDR_L \\$1
4967 .             ds $SLIDE_HDR_C \\$2
4968 .             ds $SLIDE_HDR_R \\$3
4969 .             HEADER_MARGIN 45p
4970 .             shift 3
4971 .          \}
4972 .          if '\\$1'FOOTER' \{\
4973 .             shift 1
4974 .             nr #SLIDE_FOOTERS 1
4975 .             ds $SLIDE_FTR_L \\$1
4976 .             ds $SLIDE_FTR_C \\$2
4977 .             ds $SLIDE_FTR_R \\$3
4978 .             shift 3
4979 .          \}
4980 .          if '\\$1'TRANSITION' \{\
4981 .             shift 1
4982 .             ds $TRANS_TYPE \\$1
4983 .             shift 1
4984 .          \}
4985 .          if '\\$1'PAUSE' \{\
4986 .             shift 1
4987 .             ds $PAUSE_TYPE \\$1
4988 .             shift 1
4989 .          \}
4990 .       \}
4991 .       if d $TRANS_TYPE \
4992 .          pdftransition PAGE \\*[$TRANS_TYPE]
4993 .       if d $PAUSE_TYPE \
4994 .          pdftransition BLOCK \\*[$PAUSE_TYPE]
4995 .    \}
4996 .    ie \\n[#SLIDE_HEADERS]+\\n[#SLIDE_FOOTERS]=2 \{\
4997 .       HEADERS_AND_FOOTERS L "^\\*[$SLIDE_HDR_L]#\\*[$SLIDE_HDR_C]#\\*[$SLIDE_HDR_R]^" \
4998                             L "^\\*[$SLIDE_FTR_L]#\\*[$SLIDE_FTR_C]#\\*[$SLIDE_FTR_R]^"
4999 .    \}
5000 .    el \{\
5001 .       if \\n[#SLIDE_HEADERS] \{\
5002 .          HEADERS
5003 .          HEADER_RECTO L "^\\*[$SLIDE_HDR_L]#\\*[$SLIDE_HDR_C]#\\*[$SLIDE_HDR_R]^" \
5004 .       \}
5005 .       if \\n[#SLIDE_FOOTERS] \{\
5006 .          FOOTERS
5007 .          FOOTER_RECTO L "^\\*[$SLIDE_FTR_L]#\\*[$SLIDE_FTR_C]#\\*[$SLIDE_FTR_R]^"
5008 .       \}
5009 .    \}
5010 .END
5011 \#
5012 \# +++LETTER MACROS+++
5013 \#
5014 \# First, create a register to hold incrementing numbers to be
5015 \# appended to LETTERHEAD.
5016 \#
5017 .nr #FIELD 0 1
5018 \#
5019 \# DATE
5020 \# ----
5021 \# *Arguments:
5022 \#   <none>
5023 \# *Function:
5024 \#   Stores date (entered on the line after .DATE) in diversion
5025 \#   LETTERHEAD<n>
5026 \#
5027 .MAC DATE END
5028 .    if !'\\n[.z]'' .di
5029 .    di LETTERHEAD\\n+[#FIELD]
5030 .    ie \\n[#FIELD]=1 \{\
5031 .       nr #DATE_FIRST 1
5032 .       RIGHT
5033 .    \}
5034 .    el .LEFT
5035 .END
5036 \#
5037 \# TO
5038 \# --
5039 \# *Arguments:
5040 \#   <none>
5041 \# *Function:
5042 \#   Stores addressee address (entered on the line after .TO) in
5043 \#   diversion LETTERHEAD<n>
5044 \#
5045 .MAC TO END
5046 .    if !'\\n[.z]'' .di
5047 .    di LETTERHEAD\\n+[#FIELD]
5048 .    LEFT
5049 .END
5050 \#
5051 \# FROM
5052 \# ----
5053 \# *Arguments:
5054 \#   <none>
5055 \# *Function:
5056 \#   Stores addresser address (entered on the line after .FROM) in
5057 \#   diversion LETTERHEAD<n>
5058 \#
5059 .MAC FROM END
5060 .    if !'\\n[.z]'' .di
5061 .    di LETTERHEAD\\n+[#FIELD]
5062 .    LEFT
5063 .END
5064 \#
5065 \# GREETING
5066 \# --------
5067 \# *Arguments:
5068 \#   <none>
5069 \# *Function:
5070 \#   Stores greeting (entered on the line after .GREETING) in
5071 \#   diversion LETTERHEAD<n>
5072 \#
5073 .MAC GREETING END
5074 .    if !'\\n[.z]'' .di
5075 .    di LETTERHEAD\\n+[#FIELD]
5076 .    LEFT
5077 .END
5078 \#
5079 \# CLOSING
5080 \# -------
5081 \# *Arguments:
5082 \#   <closing string>
5083 \# *Function:
5084 \#   Stores greeting in diversion CLOSING.
5085 \#
5086 .MAC CLOSING END
5087 .    if '\\*[$SIG_SPACE]'' .ds $SIG_SPACE 3v
5088 .    ie ( (2v+\\*[$SIG_SPACE]) > \\n[.t] ) \{\
5089 .       ie !\\n[@TOP] \{\
5090 .          ch HEADER
5091 .          ch FOOTER
5092 .          br
5093 .          tm1 "[mom]: Insufficient room for \\$0 and signature line.
5094 .          ab   [mom]: Terminating '\\n[.F]' before closing.
5095 .       \}
5096 .       el .sp
5097 .    \}
5098 .    el .br
5099 .    nr #CLOSING 1
5100 .    di CLOSING_TEXT
5101 .END
5102 \#
5103 \# CLOSING INDENT
5104 \# --------------
5105 \# *Argument:
5106 \#   <amount to indent closing from left margin>
5107 \# *Function:
5108 \#   Defines string $CLOSE_INDENT for use in macro, ALL_DONE.
5109 \#
5110 .MAC CLOSING_INDENT END
5111 .    ds $CLOSE_INDENT \\$1
5112 .END
5113 \#
5114 \# SIGNATURE_SPACE
5115 \# ---------------
5116 \# *Argument:
5117 \#   <amount of space to leave for signature>
5118 \# *Function:
5119 \#   Defines string $SIG_SPACE for use in macro, ALL_DONE.
5120 \#
5121 .MAC SIGNATURE_SPACE END
5122 .    ds $SIG_SPACE \\$1
5123 .END
5124 \#
5125 \# NO SUITE
5126 \# --------
5127 \# *Arguments:
5128 \#   <none>
5129 \# *Function:
5130 \#   Redefines $FOOTER_RIGHT to blank so that a suite number doesn't
5131 \#   appear at the bottom of letter pages.
5132 \#
5133 .MAC NO_SUITE END
5134 .    FOOTER_RIGHT ""
5135 .END
5136 \#
5137 \# ====================================================================
5138 \#
5139 \# +++DEFAULTS FOR DOCUMENT PROCESSING+++
5140 \#
5141 \# TYPE-STYLE CONTROL MACROS
5142 \# -------------------------
5143 \# The control macros for family, font, size, color and quad are
5144 \# here grouped together.  Each (e.g., _FAMILY) uses the calling alias
5145 \# to determine the document element to which the style parameter
5146 \# applies.  Defaults for all these guys are set in DEFAULTS, and
5147 \# listed in the "Control Macros" section of the documentation
5148 \# pertinent to the element whose style is to be changed.
5149 \#
5150 .MAC _FAMILY END
5151 .    ds PARAM      FAM
5152 .    ds ELEMENT    \\$0
5153 .    if '\\$0'COPYRIGHT_FAMILY' \
5154 .       ds ELEMENT COVER_COPYRIGHT_FAMILY
5155 .    ds FROM_ALIAS \\$0
5156 .    substring ELEMENT 0 -4    \" Strip 'ILY' from FAMILY
5157 .    ASSIGN_ELEMENT \\$1
5158 .END
5159 \#
5160 .MAC _FONT END
5161 .    ds PARAM      FT
5162 .    ds ELEMENT    \\$0
5163 .    ds FROM_ALIAS \\$0
5164 .    if '\\$0'COPYRIGHT_FONT' \
5165 .       ds ELEMENT COVER_COPYRIGHT_FONT
5166 .    substring ELEMENT 0 -5
5167 .    ds ELEMENT \\*[ELEMENT]FT \" ELEMENT is now \\$0_FT
5168 .    ASSIGN_ELEMENT \\$1
5169 .END
5170 \#
5171 .MAC _SIZE END
5172 .    ds PARAM       SIZE_CHANGE
5173 .    ds ELEMENT     \\$0_CHANGE
5174 .    if '\\$0'CODE_SIZE' \{\
5175 .       ds PARAM SIZE_ADJ
5176 .       ds ELEMENT \\$0_ADJ
5177 .    \}
5178 .    if '\\$0'COPYRIGHT_SIZE' \
5179 .       ds ELEMENT COVER_COPYRIGHT_SIZE_CHANGE
5180 .    ds FROM_ALIAS  \\$0
5181 .    ASSIGN_ELEMENT \\$1
5182 .END
5183 \#
5184 .MAC _COLOR END
5185 .    if \\n[#PRINT_STYLE]=1 .return
5186 .    ds PARAM       COLOR
5187 .    ds ELEMENT     \\$0
5188 .    if '\\$0'COPYRIGHT_COLOR' \
5189 .       ds ELEMENT COVER_COPYRIGHT_COLOR
5190 .    ds FROM_ALIAS  \\$0
5191 .    ASSIGN_ELEMENT \\$1
5192 .END
5193 \#
5194 .MAC _CAPS END
5195 .    ds CAPS_TYPE \\$0
5196 .    substring CAPS_TYPE 0 7
5197 .    ds CALLED_AS \\$0
5198 .    substring CALLED_AS -7
5199 .    ie '\\*[CALLED_AS]'NO_CAPS' \{\
5200 .       ie '\\*[CAPS_TYPE]'BIBLIOGR' \{\
5201 .          if '\\$0'BIBLIOGRAPHY_HEADER_NO_CAPS' .rr #BIB_STRING_CAPS
5202 .          if '\\$0'BIBLIOGRAPHY_STRING_NO_CAPS' .rr #BIB_STRING_CAPS
5203 .       \}
5204 .       el \{\
5205 .          ie '\\*[CAPS_TYPE]'ENDNOTES' \{\
5206 .             if '\\$0'ENDNOTES_HEADER_NO_CAPS' .rr #EN_STRING_CAPS
5207 .             if '\\$0'ENDNOTES_STRING_NO_CAPS' .rr #EN_STRING_CAPS
5208 .          \}
5209 .          el \{\
5210 .             ie '\\$0'TOC_HEADER_NO_CAPS' .rr #TOC_STRING_CAPS
5211 .             el \{\
5212 .                ds REGISTER_TYPE \\$0
5213 .                substring REGISTER_TYPE 0 -8
5214 .                as REGISTER_TYPE CAPS
5215 .                rr #\\*[REGISTER_TYPE]
5216 .             \}
5217 .          \}
5218 .       \}
5219 .    \}
5220 .    el \{\
5221 .       ie '\\*[CAPS_TYPE]'BIBLIOGR' \{\
5222 .          if '\\$0'BIBLIOGRAPHY_HEADER_CAPS' .nr #BIB_STRING_CAPS 1
5223 .          if '\\$0'BIBLIOGRAPHY_STRING_CAPS' .nr #BIB_STRING_CAPS 1
5224 .       \}
5225 .       el .nr #\\$0 1
5226 .    \}
5227 .END
5228 .
5229 .ALIAS _NO_CAPS _CAPS
5230 \#
5231 .MAC _SMALLCAPS END
5232 .    ds SMALLCAPS_TYPE \\$0
5233 .    substring SMALLCAPS_TYPE 0 7
5234 .    ds CALLED_AS \\$0
5235 .    substring CALLED_AS -12
5236 .    ie '\\*[CALLED_AS]'NO_SMALLCAPS' \{\
5237 .       ie '\\*[SMALLCAPS_TYPE]'BIBLIOGR' \{\
5238 .          if '\\$0'BIBLIOGRAPHY_HEADER_NO_SMALLCAPS' .rr #BIB_STRING_SMALLCAPS
5239 .          if '\\$0'BIBLIOGRAPHY_STRING_NO_SMALLCAPS' .rr #BIB_STRING_SMALLCAPS
5240 .       \}
5241 .       el \{\
5242 .          ie '\\*[SMALLCAPS_TYPE]'ENDNOTES' \{\
5243 .             if '\\$0'ENDNOTES_HEADER_NO_SMALLCAPS' .rr #EN_STRING_SMALLCAPS
5244 .             if '\\$0'ENDNOTES_STRING_NO_SMALLCAPS' .rr #EN_STRING_SMALLCAPS
5245 .          \}
5246 .          el \{\
5247 .             ie '\\$0'TOC_HEADER_NO_SMALLCAPS' .rr #TOC_STRING_SMALLCAPS
5248 .             el \{\
5249 .                ds REGISTER_TYPE \\$0
5250 .                substring REGISTER_TYPE 0 -13
5251 .                as REGISTER_TYPE SMALLCAPS
5252 .                rr #\\*[REGISTER_TYPE]
5253 .             \}
5254 .          \}
5255 .       \}
5256 .    \}
5257 .    el \{\
5258 .       ie '\\*[SMALLCAPS_TYPE]'BIBLIOGR' \{\
5259 .          if '\\$0'BIBLIOGRAPHY_HEADER_SMALLCAPS' .nr #BIB_STRING_SMALLCAPS 1
5260 .          if '\\$0'BIBLIOGRAPHY_STRING_SMALLCAPS' .nr #BIB_STRING_SMALLCAPS 1
5261 .       \}
5262 .       el .nr #\\$0 1
5263 .    \}
5264 .END
5265 .
5266 .ALIAS _NO_SMALLCAPS _SMALLCAPS
5267 \#
5268 .MAC _QUAD END
5269 .    if '\\$0'BIBLIOGRAPHY_QUAD' \{\
5270 .       if '\\$1'R' .QUAD-ERROR \\$0
5271 .       if '\\$1'C' .QUAD-ERROR \\$0
5272 .    \}
5273 .    if '\\$0'ENDNOTE_QUAD' \{\
5274 .       if '\\$1'R' .QUAD-ERROR \\$0
5275 .       if '\\$1'C' .QUAD-ERROR \\$0
5276 .    \}
5277 .    if '\\$0'DOC_QUAD' \
5278 .       if !\\n[#DOCS] .DOC_MACRO_ERROR \\$0
5279 .    ds PARAM       QUAD
5280 .    ds ELEMENT     \\$0
5281 .    if '\\$0'COPYRIGHT_QUAD' \
5282 .       ds ELEMENT COVER_COPYRIGHT_QUAD
5283 .    ds FROM_ALIAS  \\$0
5284 .    ASSIGN_ELEMENT \\$1
5285 .END
5286 \#
5287 \# Special handling for QUOTE quadding
5288 \#
5289 .MAC QUOTE_QUAD END
5290 .    ds $Q_QUAD \\$0
5291 .    substring $Q_QUAD 6
5292 .END
5293 .
5294 .ALIAS QUOTE_LEFT   QUOTE_QUAD
5295 .ALIAS QUOTE_CENTER QUOTE_QUAD
5296 .ALIAS QUOTE_RIGHT  QUOTE_QUAD
5297 \#
5298 .MAC QUAD-ERROR END
5299 .    tm1 "[mom]: \\$1 at line \\n[.c] of '\\n[.F]' must be set to either L or J.
5300 .    ab   [mom]: Aborting.
5301 .END
5302 \#
5303 .MAC ASSIGN_ELEMENT END
5304 .    rm $\\*[ELEMENT] \" Clear this first
5305 .\" HDRFTR_<POSITION>_<PARAMETER> need special handling.
5306 .    ds hdrftr \\*[FROM_ALIAS]
5307 .    substring hdrftr 0 5
5308 .    if '\\*[hdrftr]'HDRFTR' \{\
5309 .       ds hdrftr-pos-element \\*[ELEMENT]
5310 .\" See if ELEMENT is of the form HDRFTR_<pos>_<param>
5311 .       substring hdrftr-pos-element 0 7
5312 .       substring hdrftr-pos-element -1
5313 .       if !'\\*[ELEMENT]'HDRFTR_COLOR' \{\
5314 .          if '\\*[hdrftr-pos-element]'L' .nr hdrftr-pos-element 1
5315 .          if '\\*[hdrftr-pos-element]'C' .nr hdrftr-pos-element 1
5316 .          if '\\*[hdrftr-pos-element]'R' .nr hdrftr-pos-element 1
5317 .       \}
5318 .    \}
5319 .    if !\\n[hdrftr-pos-element] \{\
5320 .       ds c1-c5 \\*[ELEMENT]
5321 .       substring c1-c5 0 4  \" Grab first five letters of the alias
5322 .    \}
5323 .\"  If none of the following, convert the substring of the
5324 .\"  calling alias, ie \*[ELEMENT], into the parameter string, e.g.,
5325 .\"  $TITLE_FAM, assign arg, and set register.
5326 .    if !'\\*[c1-c5]'BIBLI' \
5327 .    if !'\\*[c1-c5]'BLOCK' \
5328 .    if !'\\*[c1-c5]'CITAT' \
5329 .    if !'\\*[c1-c5]'ENDNO' \
5330 .    if !'\\*[c1-c5]'EPIGR' \
5331 .    if !'\\*[c1-c5]'FOOTN' \
5332 .    if !'\\*[c1-c5]'HDRFT' \
5333 .    if !'\\*[c1-c5]'LINEN' \
5334 .    if !'\\*[c1-c5]'PAGEN' \{\
5335 .       ie '\\*[ELEMENT]'CODE_SIZE_ADJ' .nr #\\*[ELEMENT] \\$1
5336 .       el \{\
5337 .          ds $\\*[ELEMENT] \\$1
5338 .          nr #\\*[ELEMENT] 1
5339 .       \}
5340 .    \}
5341 .    if '\\*[$\\*[ELEMENT]]'' \{\
5342 .       if '\\*[c1-c5]'BIBLI' .ASSIGN_PARAM BIB       \\$1
5343 .       if '\\*[c1-c5]'BLOCK' .ASSIGN_PARAM BQUOTE_   \\$1
5344 .       if '\\*[c1-c5]'CITAT' .ASSIGN_PARAM BQUOTE_   \\$1
5345 .       if '\\*[c1-c5]'ENDNO' .ASSIGN_PARAM EN        \\$1
5346 .       if '\\*[c1-c5]'EPIGR' .ASSIGN_PARAM EPI_      \\$1
5347 .       if '\\*[c1-c5]'FOOTN' .ASSIGN_PARAM FN_       \\$1
5348 .       if '\\*[c1-c5]'HDRFT' .ASSIGN_PARAM HDRFTR_   \\$1
5349 .       if '\\*[c1-c5]'LINEN' .ASSIGN_PARAM LN_       \\$1
5350 .       if '\\*[c1-c5]'PAGEN' .ASSIGN_PARAM PAGE_NUM_ \\$1
5351 .    \}
5352 .    if \\n[hdrftr-pos-element] \{\
5353 .       if '\\*[hdrftr-pos-element]'L' .ds hdrftr-pos-element LEFT
5354 .       if '\\*[hdrftr-pos-element]'C' .ds hdrftr-pos-element CENTER
5355 .       if '\\*[hdrftr-pos-element]'R' .ds hdrftr-pos-element RIGHT
5356 .       if '\\*[ELEMENT]'HDRFTR_\\*[hdrftr-pos-element]_FAM' \
5357 .          ds $HDRFTR_\\*[hdrftr-pos-element]_FAM \\$1
5358 .    \}
5359 .    rr hdrftr-pos-element
5360 .    rm hdrftr-pos-element
5361 .END
5362 \#
5363 .MAC ASSIGN_PARAM END
5364 .    if '\\*[PARAM]'FAM'         .nr substr-index -7
5365 .    if '\\*[PARAM]'FT'          .nr substr-index -5
5366 .    if '\\*[PARAM]'SIZE_CHANGE' .nr substr-index -5
5367 .    if '\\*[PARAM]'COLOR'       .nr substr-index -6
5368 .    if '\\*[PARAM]'QUAD'        .nr substr-index -5
5369 .    if '\\$1'BIB' \{\
5370 .       ds ELEMENT \\*[FROM_ALIAS]
5371 .       substring ELEMENT 12 \\n[substr-index]
5372 .       if '\\*[ELEMENT]'_HEADER_' \
5373 .          ds ELEMENT _STRING_
5374 .    \}
5375 .    if '\\$1'BQUOTE_' .rm ELEMENT
5376 .    if '\\$1'EN' \{\
5377 .       ds ELEMENT \\*[FROM_ALIAS]
5378 .       substring ELEMENT 7 \\n[substr-index]
5379 .       if '\\*[ELEMENT]'S_HEADER_' \
5380 .          ds ELEMENT _STRING_
5381 .       if '\\*[ELEMENT]'_LINENUMBER_' \
5382 .          ds ELEMENT _LN_
5383 .    \}
5384 .    if '\\$1'EPI_' .rm ELEMENT
5385 .    if '\\$1'FN_'  .rm ELEMENT
5386 .    if '\\$1'HDRFTR_' \{\
5387 .       if '\\*[ELEMENT]'HDRFTR_FAM' \{\
5388 .          nr #HDRFTR 1
5389 .          ds $HDRFTR_FAM        \\$2
5390 .          ds $HDRFTR_LEFT_FAM   \\$2
5391 .          ds $HDRFTR_CENTER_FAM \\$2
5392 .          ds $HDRFTR_RIGHT_FAM  \\$2
5393 .       \}
5394 .       if '\\*[ELEMENT]'HDRFTR_COLOR' \{\
5395 .          nr #HDRFTR 1
5396 .          nr #HDRFTR_COLOR 1
5397 .          ds $HDRFTR_COLOR \\$2
5398 .       \}
5399 .       if '\\*[ELEMENT]'HDRFTR_SIZE_CHANGE' \{\
5400 .          nr #HDRFTR 1
5401 .          ds $HDRFTR_SIZE_CHANGE \\$2
5402 .       \}
5403 .       if '\\*[PARAM]'SIZE_CHANGE' \{\
5404 .          nr #HDRFTR 1
5405 .          if '\\*[hdrftr-pos-element]'L' \
5406 .             ds $HDRFTR_LEFT_SIZE_CHANGE \\$2
5407 .          if '\\*[hdrftr-pos-element]'C' \
5408 .             ds $HDRFTR_CENTER_SIZE_CHANGE \\$2
5409 .          if '\\*[hdrftr-pos-element]'R' \
5410 .             ds $HDRFTR_RIGHT_SIZE_CHANGE \\$2
5411 .       \}
5412 .       if !r #HDRFTR \{\
5413 .          substring ELEMENT 7 \\n[substr-index]
5414 .          if '\\*[ELEMENT]'_LEFT' .ds ELEMENT _STRING_
5415 .       \}
5416 .    \}
5417 .    if '\\$1'LN_'       .rm ELEMENT
5418 .    if '\\$1'PAGE_NUM_' .rm ELEMENT
5419 .    if !r #HDRFTR \{\
5420 .       ds $\\$1\\*[ELEMENT]\\*[PARAM] \\$2
5421 .       nr #\\$1\\*[ELEMENT]\\*[PARAM] 1
5422 .    \}
5423 .    rr #HDRFTR
5424 .    rm hdrftr-pos-element
5425 .    rr substr-index
5426 .    rm FROM_ALIAS
5427 .    rm ELEMENT
5428 .END
5429 \#
5430 .MAC TITLE_LEAD END
5431 .    ds $TYPE \\$0
5432 .    substring $TYPE 0 2
5433 .    if '\\*[$TYPE]'DOC' .nr DOC_ 1
5434 .    ds $TYPE \\$0
5435 .    ie '\\*[$TYPE]'MISC_LEAD' .ds $TYPE COVER_MISC
5436 .    el .substring $TYPE -6 0
5437 .    ds $\\*[$TYPE]_LEAD \\$1
5438 .    nr #\\*[$TYPE]_LEAD 1
5439 .    rm $TYPE
5440 .END
5441 \#
5442 \# The _STYLE macro, called by various aliases, allows grouping
5443 \# style parameters for most document elements in a single macro
5444 \# using 'KEYWORD value' pairs.
5445 \#
5446 .MAC _STYLE END
5447 .    SILENT \" Some of the invoked macros cause unwanted breaks
5448 .    ds $STYLE_TYPE \\$0
5449 .    substring $STYLE_TYPE 0 -7
5450 .    ds $HDR_FTR \\*[$STYLE_TYPE]
5451 .    length #HDR_FTR_STRING $HDR_FTR
5452 .    if \\n[#HDR_FTR_STRING]<=5 .substring $HDR_FTR 0 5 \" HEADER or FOOTER
5453 .    if '\\*[$HDR_FTR]'HEADER' .ds $HDR_FTR HEADER
5454 .    if '\\*[$HDR_FTR]'FOOTER' .ds $HDR_FTR FOOTER
5455 .    ds $POS \\$0
5456 .    substring $POS 7 7
5457 .    if '\\*[$POS]'L' .ds $POS LEFT
5458 .    if '\\*[$POS]'C' .ds $POS CENTER
5459 .    if '\\*[$POS]'R' .ds $POS RIGHT
5460 .    if '\\*[$STYLE_TYPE]'\\*[$HDR_FTR]_\\*[$POS]' \{\
5461 .       ds $\\*[$HDR_FTR]_\\*[$POS] \\*[$HDR_FTR]_\\*[$POS]
5462 .       ds $STYLE_TYPE HDRFTR_\\*[$POS]
5463 .    \}
5464 .    if '\\*[$STYLE_TYPE]'ENDNOTES_HEADER' \
5465 .       ds $BIB-EN-TOC EN_STRING
5466 .    if '\\*[$STYLE_TYPE]'ENDNOTE_STRING' \
5467 .       ds $BIB-EN-TOC EN_STRING
5468 .    if '\\*[$STYLE_TYPE]'BIBLIOGRAPHY_HEADER' \
5469 .       ds $BIB-EN-TOC BIB_STRING
5470 .    if '\\*[$STYLE_TYPE]'BIBLIOGRAPHY_STRING' \
5471 .       ds $BIB-EN-TOC BIB_STRING
5472 .    if '\\*[$STYLE_TYPE]'TOC_HEADER' \
5473 .       ds $BIB-EN-TOC TOC_STRING
5474 .    if '\\*[$STYLE_TYPE]'PAGENUMBER' \
5475 .       ds $STYLE_TYPE PAGENUM
5476 .    nr #LOOP 0 1
5477 .    nr #STYLE_PARAMS \\n[#NUM_ARGS]
5478 .    while \\n+[#LOOP]<=\\n[#STYLE_PARAMS] \{\ 
5479 .       if '\\$1'FAMILY' \{\
5480 .          shift
5481 .          \\*[$STYLE_TYPE]_FAMILY \\$1
5482 .          shift
5483 .       \}
5484 .       if '\\$1'FONT' \{\
5485 .          shift
5486 .          \\*[$STYLE_TYPE]_FONT \\$1
5487 .          shift
5488 .       \}
5489 .       if '\\$1'SIZE' \{\
5490 .          shift
5491 .          \\*[$STYLE_TYPE]_SIZE \\$1
5492 .          shift
5493 .       \}
5494 .       if '\\$1'COLOR' \{\
5495 .          shift
5496 .          \\*[$STYLE_TYPE]_COLOR \\$1
5497 .          shift
5498 .       \}
5499 .       if '\\$1'CAPS' \{\
5500 .          if \\n[#\\*[$STYLE_TYPE]_SMALLCAPS] \{\
5501 .             tm1 \
5502 "[mom]: '\\*[$STYLE_TYPE]_STYLE' contains CAPS and SMALLCAPS. \
5503 CAPS takes precedence.
5504 .             rr #\\*[$STYLE_TYPE]_SMALLCAPS
5505 .          \}
5506 .          \\*[$STYLE_TYPE]_CAPS
5507 .          if d $\\*[$HDR_FTR]_LEFT   .HEADER_LEFT_CAPS
5508 .          if d $\\*[$HDR_FTR]_CENTER .HEADER_CENTER_CAPS
5509 .          if d $\\*[$HDR_FTR]_CENTRE .HEADER_CENTER_CAPS
5510 .          if d $\\*[$HDR_FTR]_RIGHT  .HEADER_RIGHT_CAPS
5511 .          shift
5512 .       \}
5513 .       if '\\$1'NO_CAPS' \{\
5514 .          nr #\\*[$STYLE_TYPE]_CAPS 0
5515 .          if !'\\*[$BIB-EN-TOC]'' \
5516 .             rr #\\*[$BIB-EN-TOC]_CAPS
5517 .          shift
5518 .       \}
5519 .       if '\\$1'SMALLCAPS' \{\
5520 .          if \\n[#\\*[$STYLE_TYPE]_CAPS] \{\
5521 .             tm1 \
5522 "[mom]: '\\*[$STYLE_TYPE]_STYLE' contains CAPS and SMALLCAPS. \
5523 SMALLCAPS takes precedence.
5524 .             rr #\\*[$STYLE_TYPE]_CAPS
5525 .          \}
5526 .          \\*[$STYLE_TYPE]_SMALLCAPS
5527 .          shift
5528 .       \}
5529 .       if '\\$1'NO_SMALLCAPS' \{\
5530 .          rr #\\*[$STYLE_TYPE]_SMALLCAPS
5531 .          if !'\\*[$BIB-EN-TOC]'' \
5532 .             rr #\\*[$BIB-EN-TOC]_SMALLCAPS
5533 .          shift
5534 .       \}
5535 .       if '\\$1'LEAD' \{\
5536 .          shift
5537 .          \\*[$STYLE_TYPE]_LEAD \\$1
5538 .          shift
5539 .       \}
5540 .       if '\\$1'AUTOLEAD' \{\
5541 .          shift
5542 .          \\*[$STYLE_TYPE]_AUTOLEAD \\$1
5543 .          shift
5544 .       \}
5545 .       if '\\$1'SPACE' \{\
5546 .          shift
5547 .          \\*[$STYLE_TYPE]_SPACE \\$1
5548 .          shift
5549 .       \}
5550 .       if '\\$1'QUAD' \{\
5551 .          shift
5552 .          ie '\\*[$STYLE_TYPE]'QUOTE' \{\
5553 .              ds $QUAD_TYPE \\$1
5554 .              substring $QUAD_TYPE 0 0
5555 .              if '\\*[$QUAD_TYPE]'L' .QUOTE_LEFT
5556 .              if '\\*[$QUAD_TYPE]'C' .QUOTE_CENTER
5557 .              if '\\*[$QUAD_TYPE]'R' .QUOTE_RIGHT
5558 .          \}
5559 .          el .\\*[$STYLE_TYPE]_QUAD \\$1
5560 .          shift
5561 .       \}
5562 .       if '\\$1'INDENT' \{\
5563 .          shift
5564 .          \\*[$STYLE_TYPE]_INDENT \\$1
5565 .          shift
5566 .       \}
5567 .\" UNDERLINE and UNDERSCORE are identical but we can't use : or &
5568 .\" in string comparisons.
5569 .       if '\\$1'UNDERLINE' \{\
5570 .          shift
5571 .          if '\\$1'DOUBLE' \{\
5572 .             as ul-args \\$1 \"
5573 .             shift
5574 .          \}
5575 .          nr #COUNT 0 1
5576 .          while \\n+[#COUNT]<=3 \{\
5577 .             if \B'\\$1' \{\
5578 .                as ul-args \\$1 \"
5579 .                shift
5580 .             \}
5581 .          \}
5582 .          \\*[$STYLE_TYPE]_UNDERSCORE \\*[ul-args]
5583 .       \}
5584 .       if '\\$1'UNDERSCORE' \{\
5585 .          shift
5586 .          if '\\$1'DOUBLE' \{\
5587 .             as ul-args \\$1 \"
5588 .             shift
5589 .          \}
5590 .          nr #COUNT 0 1
5591 .          while \\n+[#COUNT]<=3 \{\
5592 .             if \B'\\$1' \{\
5593 .                as ul-args \\$1 \"
5594 .                shift
5595 .             \}
5596 .          \}
5597 .          \\*[$STYLE_TYPE]_UNDERSCORE \\*[ul-args]
5598 .       \}
5599 .       if '\\$1'NO_UNDERSCORE' \{\
5600 .          rr #\\*[$STYLE_TYPE]_UNDERLINE
5601 .          if !'\\*[$BIB-EN-TOC]'' \
5602 .             rr #\\*[$BIB-EN-TOC]_UNDERLINE
5603 .          shift
5604 .       \}
5605 .       if '\\$1'NO_UNDERLINE' \{\
5606 .          rr #\\*[$STYLE_TYPE]_UNDERLINE
5607 .          if !'\\*[$BIB-EN-TOC]'' \
5608 .             rr #\\*[$BIB-EN-TOC]_UNDERLINE
5609 .          shift
5610 .       \}
5611 .       if '\\$1'V_ADJUST' \{\
5612 .          shift
5613 .          COPYRIGHT_V_ADJUST \\$1
5614 .          shift
5615 .       \}
5616 .    \}
5617 .    rm $STYLE_TYPE
5618 .    rm $HDR_FTR
5619 .    rm $POS
5620 .    rm $HEADER_LEFT
5621 .    rm $HEADER_CENTER
5622 .    rm $HEADER_RIGHT
5623 .    rm $BIB-EN-TOC
5624 .    rm ul-args
5625 .    SILENT off
5626 .END
5627 .
5628 .ds STYLE_TYPE_1  ATTRIBUTE
5629 .ds STYLE_TYPE_2  AUTHOR
5630 .ds STYLE_TYPE_3  BIBLIOGRAPHY_HEADER
5631 .ds STYLE_TYPE_4  BIBLIOGRAPHY_STRING
5632 .ds STYLE_TYPE_5  BLOCKQUOTE
5633 .ds STYLE_TYPE_6  CHAPTER
5634 .ds STYLE_TYPE_7  CHAPTER_TITLE
5635 .ds STYLE_TYPE_8  CODE
5636 .ds STYLE_TYPE_9  COPYRIGHT
5637 .ds STYLE_TYPE_10 COVER
5638 .ds STYLE_TYPE_11 COVERTITLE
5639 .ds STYLE_TYPE_12 DOC_COVERTITLE
5640 .ds STYLE_TYPE_13 DOCHEADER
5641 .ds STYLE_TYPE_14 DOCTITLE
5642 .ds STYLE_TYPE_15 DOCTYPE
5643 .ds STYLE_TYPE_16 ENDNOTE_TITLE
5644 .ds STYLE_TYPE_17 ENDNOTES_HEADER
5645 .ds STYLE_TYPE_18 ENDNOTE_STRING
5646 .ds STYLE_TYPE_19 EPIGRAPH
5647 .ds STYLE_TYPE_20 FINIS
5648 .ds STYLE_TYPE_21 FOOTER_LEFT
5649 .ds STYLE_TYPE_22 FOOTER_CENTER
5650 .ds STYLE_TYPE_23 FOOTER_CENTRE
5651 .ds STYLE_TYPE_24 FOOTER_RIGHT
5652 .ds STYLE_TYPE_25 FOOTNOTE
5653 .ds STYLE_TYPE_26 HEADER_LEFT
5654 .ds STYLE_TYPE_27 HEADER_CENTER
5655 .ds STYLE_TYPE_28 HEADER_CENTRE
5656 .ds STYLE_TYPE_29 HEADER_RIGHT
5657 .ds STYLE_TYPE_30 LEAD
5658 .ds STYLE_TYPE_31 LINENUMBER
5659 .ds STYLE_TYPE_32 MISC
5660 .ds STYLE_TYPE_33 QUOTE
5661 .ds STYLE_TYPE_34 PAGENUMBER
5662 .ds STYLE_TYPE_35 SUBTITLE
5663 .ds STYLE_TYPE_36 TITLE
5664 .ds STYLE_TYPE_37 TOC_HEADER
5665 .
5666 .
5667 .nr #LOOP 0 1
5668 .while \n+[#LOOP]<=37 \{\
5669 . ALIAS \*[STYLE_TYPE_\n[#LOOP]]_STYLE           _STYLE
5670 . ALIAS COVER_\*[STYLE_TYPE_\n[#LOOP]]_STYLE     _STYLE
5671 . ALIAS DOC_COVER_\*[STYLE_TYPE_\n[#LOOP]]_STYLE _STYLE
5672 .\}
5673 \#
5674 \# UNDERLINE CONTROL
5675 \# -----------------
5676 \# *Arguments:
5677 \#   [ DOUBLE ] [ <underline weight> [<underline gap>] ] | <none> | <anything>
5678 \# *Function:
5679 \#   Toggles underlining of the element indicated by the calling alias
5680 \#   on or off.  Uses #<element>_UNDERLINE_WEIGHT to set the weight,
5681 \#   and defines string $<element>_UNDERLINE_GAP.
5682 \#
5683 .MAC _UNDERLINE END
5684 .    ds $GET_TITLE_TYPE \\$0
5685 .    substring $GET_TITLE_TYPE -2
5686 .    ie '\\*[$GET_TITLE_TYPE]'NE' \{\
5687 .\" Called as _UNDERLINE
5688 .        ds $GET_TITLE_TYPE \\$0
5689 .        substring $GET_TITLE_TYPE 0 -10
5690 .        ds $TITLE_TYPE \\*[$GET_TITLE_TYPE]
5691 .    \}
5692 .    el \{\
5693 .\" Called as _UNDERSCORE
5694 .        ds $GET_TITLE_TYPE \\$0
5695 .        substring $GET_TITLE_TYPE 0 -11
5696 .        ds $TITLE_TYPE \\*[$GET_TITLE_TYPE]
5697 .    \}
5698 .    ds $GET_TITLE_TYPE \\$0
5699 .    substring $GET_TITLE_TYPE 0 2
5700 .    if '\\*[$GET_TITLE_TYPE]'BIB' .ds $TITLE_TYPE BIB_STRING_
5701 .    if '\\*[$GET_TITLE_TYPE]'SUB' .ds $TITLE_TYPE SUBTITLE_
5702 .    ds $GET_TITLE_TYPE \\$0
5703 .    substring $GET_TITLE_TYPE 0 7
5704 .    if '\\*[$GET_TITLE_TYPE]'ENDNOTES' .ds $TITLE_TYPE EN_STRING_
5705 .    ds $GET_TITLE_TYPE \\$0
5706 .    substring $GET_TITLE_TYPE 0 10
5707 .    if '\\*[$GET_TITLE_TYPE]'ENDNOTE_STR' .ds $TITLE_TYPE EN_STRING_
5708 .    if '\\*[$GET_TITLE_TYPE]'ENDNOTE_TIT' .ds $TITLE_TYPE EN_TITLE_
5709 .    ie '\\$1'' .nr #\\*[$TITLE_TYPE]UNDERLINE 1
5710 .    el \{\
5711 .       ie \\n[#NUM_ARGS]=1 \{\
5712 .          ie \B'\\$1' \{\
5713 .             if !\\n[#PRINT_STYLE]=1 \{\
5714 .                \\*[$TITLE_TYPE]UNDERLINE_WEIGHT \\$1
5715 .                nr #\\*[$TITLE_TYPE]UNDERLINE 1
5716 .             \}
5717 .          \}
5718 .          el \{\
5719 .             ie '\\$1'DOUBLE' .nr #\\*[$TITLE_TYPE]UNDERLINE 2
5720 .             el .nr #\\*[$TITLE_TYPE]UNDERLINE 0
5721 .          \}
5722 .       \}
5723 .       el \{\
5724 .          if !\\n[#PRINT_STYLE]=1 \{\
5725 .               nr #\\*[$TITLE_TYPE]UNDERLINE 1
5726 .               if '\\$1'DOUBLE' \{\
5727 .                  nr #\\*[$TITLE_TYPE]UNDERLINE 2
5728 .                  shift
5729 .               \}
5730 .               \\*[$TITLE_TYPE]UNDERLINE_WEIGHT \\$1
5731 .               if !'\\$2'' \
5732 .                  ds $\\*[$TITLE_TYPE]UNDERLINE_GAP \\$2
5733 .               if !'\\$3'' \
5734 .                  ds $\\*[$TITLE_TYPE]RULE_GAP \\$3
5735 .          \}
5736 .       \}
5737 .    \}
5738 .    rm $TITLE_TYPE
5739 .END
5740 .
5741 .ALIAS ENDNOTE_STRING_UNDERLINE _UNDERLINE
5742 .ALIAS ENDNOTE_STRING_UNDERSCORE _UNDERLINE
5743 \#
5744 \# DEFAULTS
5745 \# --------
5746 \# *Arguments:
5747 \#   <none>
5748 \# *Function:
5749 \#   Sets up defaults if no values are entered prior to START.
5750 \# *Notes:
5751 \#   The defaults for $CHAPTER_STRING, $DRAFT_STRING, and
5752 \#   $REVISION_STRING are in the COPYSTYLE macro.
5753 \#
5754 .MAC DEFAULTS END
5755 .    if !\\n[#DOC_TYPE]=5 \{\
5756 .       ie !d $PAPER .PAPER LETTER
5757 .       el .PAPER \\*[$PAPER]
5758 .    \}
5759 .    if !\\n[#DOC_TYPE] .DOCTYPE DEFAULT
5760 .    if !r #CH_NUM .nr #CH_NUM 1 
5761 .    ie \\n[#PAGENUM_STYLE_SET] .PAGENUM_STYLE \\*[$PAGENUM_STYLE]
5762 .    el \
5763 .       if !\\n[#COPY_STYLE]=1 .PAGENUM_STYLE DIGIT
5764 .    if !\\n[#COPY_STYLE] .COPYSTYLE FINAL
5765 .    if \\n[#DRAFT_WITH_PAGENUM] .COPYSTYLE \\*[$COPY_STYLE]
5766 .    if \\n[#DOC_TYPE]=4 \{\
5767 .       if !\\n[#USER_SET_L_LENGTH] \{\
5768 .          R_MARGIN \\n[#R_MARGIN]u
5769 .          rr #USER_SET_L_LENGTH
5770 .       \}
5771 .       if \\n[#PRINT_STYLE]=1 .PRINTSTYLE TYPEWRITE SINGLESPACE
5772 .    \}
5773 .    if \\n[#COPY_STYLE]=1 \{\
5774 .       COPYSTYLE DRAFT
5775 .       PAGENUMBER 1
5776 .    \}
5777 .    if !r #DOC_HEADER .DOCHEADER
5778 .    if !r #HEADERS_ON .HEADERS
5779 .    if !r #PAGINATE   .PAGINATE
5780 .\"
5781 .    if !r #HEADER_MARGIN .HEADER_MARGIN 4P+6p
5782 .    if !r #HEADER_GAP    .HEADER_GAP 3P
5783 .\"
5784 .    if \\n[#FOOTERS_ON] \{\
5785 .       HEADERS OFF
5786 .       ie \\n[#PAGINATE] \
5787 .          if \\n[#PAGE_NUM_POS_SET]=0 .PAGENUM_POS TOP CENTER
5788 .       el \
5789 .          if !\\n[#T_MARGIN] .T_MARGIN 6P
5790 .    \}
5791 .    if !\\n[#HEADERS_ON] \{\
5792 .       if !\\n[#FOOTERS_ON] \{\
5793 .          ie \\n[#PAGE_NUM_V_POS]=1 \{\
5794 .             HEADER_MARGIN \\n[#HEADER_MARGIN]
5795 .             HEADER_GAP \\n[#HEADER_GAP]
5796 .          \}
5797 .          el .if !r #T_MARGIN .T_MARGIN 6P
5798 .       \}
5799 .    \}
5800 .    if !r #T_MARGIN \
5801 .       T_MARGIN \\n[#HEADER_MARGIN]+\\n[#HEADER_GAP]
5802 .    if !r #DOCHEADER_ADVANCE \
5803 .       nr #DOCHEADER_ADVANCE \\n[#T_MARGIN]
5804 .    if !r #FOOTER_MARGIN .FOOTER_MARGIN 3P
5805 .    if !r #FOOTER_GAP    .FOOTER_GAP 3P
5806 .    if !r #B_MARGIN \
5807 .       B_MARGIN \\n[#FOOTER_MARGIN]u+\\n[#FOOTER_GAP]u
5808 .    if !\\n[#HEADER_RULE_GAP] .HEADER_RULE_GAP 4p
5809 .    if !\\n[#FOOTER_RULE_GAP] .FOOTER_RULE_GAP 4p
5810 .    if !r #HDRFTR_RULE     .HDRFTR_RULE
5811 .    if !r #PAGE_NUM_SET    .PAGENUMBER 1
5812 .\" Read in number registers and strings for type parameters
5813 .    nr #DOC_L_MARGIN \\n[#L_MARGIN]
5814 .    nr #DOC_L_LENGTH \\n[#L_LENGTH]
5815 .    nr #DOC_R_MARGIN \\n[#PAGE_WIDTH]-(\\n[#DOC_L_MARGIN]+\\n[#L_LENGTH])
5816 .    ie !'\\*[$SAVED_DOC_FAM]'' \{\
5817 .       ds $DOC_FAM \\*[$SAVED_DOC_FAM]
5818 .       rm $SAVED_DOC_FAM
5819 .    \}
5820 .    el .ds $DOC_FAM \\*[$FAMILY]
5821 .    nr #DOC_PT_SIZE  \\n[#PT_SIZE]
5822 .    if \\n[#TOC]          .nr #DOC_PT_SIZE \\n[#TOC_PS]
5823 .    if \\n[#ENDNOTES]     .nr #DOC_PT_SIZE \\n[#EN_PS]
5824 .    if \\n[#BIBLIOGRAPHY] .nr #DOC_PT_SIZE \\n[#BIB_PS]
5825 .    if \
5826 (\\n[#TOC]=0)&\
5827 (\\n[#LIST_OF_FIGURES]=0)&\
5828 (\\n[#LIST_OF_TABLES]=0)&\
5829 (\\n[#LIST_OF_EQUATIONS]=0) \
5830 .    nr #DOC_LEAD \\n[.v]
5831 .    nr #DOC@LEAD \\n[#DOC_LEAD]
5832 .    if \\n[#AUTO_LEAD] .nr #DOC_AUTOLEAD \\n[#AUTOLEAD_VALUE]
5833 .\" #SAVED_DOC_LEAD is set in COLLATE
5834 .    if \\n[#SAVED_DOC_LEAD] \{\
5835 .       if \
5836 (\\n[#TOC]=0)&\
5837 (\\n[#LIST_OF_FIGURES]=0)&\
5838 (\\n[#LIST_OF_TABLES]=0)&\
5839 (\\n[#LIST_OF_EQUATIONS]=0) \{\
5840 .          ie !\\n[#DOC_LEAD]=\\n[#SAVED_DOC_LEAD] .nr #RERUN_TRAPS 1
5841 .          el .nr #SKIP_TRAPS 1
5842 .       \}
5843 .    \}
5844 .    ie \\n[#ADJ_DOC_LEAD]=1 .
5845 .    el \
5846 .       if !\\n[#DOC_LEAD_ADJUST_OFF] .DOC_LEAD_ADJUST
5847 .    ie d$RESTORE_DOC_QUAD \{\
5848 .       ds $DOC_QUAD \\*[$RESTORE_DOC_QUAD]
5849 .       rm $RESTORE_DOC_QUAD
5850 .    \}
5851 .    el .ds $DOC_QUAD \\*[$QUAD_VALUE]
5852 .    if '\\*[$FONT]''   .FT R
5853 .    if '\\*[$PP_FT]''  .ds $PP_FT \\*[$FONT]
5854 .    FT \\*[$PP_FT]
5855 .\" Counters
5856 .    nr #PP                0
5857 .    nr #FN_NUMBER         0 1
5858 .    nr #EN_NUMBER         0 1
5859 .    nr #FN_COUNT_FOR_COLS 0 1
5860 .    nr #DONE_ONCE         0 1
5861 .\" Enable shimming if user hasn't turned it off
5862 .   if \\n[#NO_SHIM]=2 \{\
5863 .      rr #NO_SHIM
5864 .      nr #NO_FLEX 1
5865 .   \}
5866 .\" General style defaults for both PRINTSTYLEs
5867 .    nr #PP_STYLE 1
5868 .    PARA_INDENT \\n[#PP_INDENT]u
5869 .    if !d $HDRFTR_FAM           .ds $HDRFTR_FAM \\*[$DOC_FAM]
5870 .    if !d $HDRFTR_SIZE_CHANGE   .HDRFTR_SIZE +0
5871 .    if !d $PAGE_NUM_FAM         .PAGENUM_FAMILY \\*[$DOC_FAM]
5872 .    if !d $PAGE_NUM_FT          .PAGENUM_FONT R
5873 .    if !d $PAGE_NUM_SIZE_CHANGE .PAGENUM_SIZE +0
5874 .    if !r #PAGE_NUM_POS_SET     .PAGENUM_POS BOTTOM CENTER
5875 .    ie \\n[#PAGE_NUM_HYPHENS_SET] \{\
5876 .       if \\n[#PAGE_NUM_HYPHENS]=0 .PAGENUM_HYPHENS OFF
5877 .       if \\n[#PAGE_NUM_HYPHENS]=1 .PAGENUM_HYPHENS
5878 .    \}
5879 .    el \
5880 .       if !d$PAGENUM_STRING .PAGENUM_HYPHENS
5881 .    if !d $FN_FAM     .FOOTNOTE_FAMILY \\*[$DOC_FAM]
5882 .    if !d $FN_FT      .FOOTNOTE_FONT R
5883 .    if !d $FN_QUAD    .FOOTNOTE_QUAD \\*[$DOC_QUAD]
5884 .    if !r #FN_RULE    .FOOTNOTE_RULE
5885 .    if !r #FN_MARKERS .FOOTNOTE_MARKERS
5886 .    if \\n[#FN_MARKERS]=1 \{\
5887 .       if \\n[#FN_REF]=1 \
5888 .          if !\\n[#FN_MARKER_STYLE] .FOOTNOTE_MARKER_STYLE NUMBER
5889 .       if !\\n[#FN_MARKER_STYLE] .FOOTNOTE_MARKER_STYLE STAR
5890 .    \}
5891 .    if !r #EN_MARKER_STYLE .ENDNOTE_MARKER_STYLE SUPERSCRIPT
5892 .    if !d $EN_PN_STYLE     .ENDNOTES_PAGENUM_STYLE digit
5893 .    if !d $EN_FAM          .ENDNOTE_FAMILY \\*[$DOC_FAM]
5894 .    if !d $EN_FT           .ENDNOTE_FONT R
5895 .    if !d $EN_QUAD \{\
5896 .       ds quad-check \\*[$DOC_QUAD]
5897 .       substring quad-check 0 0
5898 .       if '\\*[$DOC_QUAD]'C' .nr quad-check 1
5899 .       if '\\*[$DOC_QUAD]'R' .nr quad-check 1
5900 .       ie \\n[quad-check] .ENDNOTE_QUAD J
5901 .       el .ENDNOTE_QUAD \\*[$DOC_QUAD]
5902 .       rr quad-check
5903 .    \}
5904 .    if !d $EN_STRING       .ENDNOTES_HEADER_STRING "Endnotes"
5905 .    if !d $EN_STRING_FAM   .ENDNOTES_HEADER_FAMILY \\*[$EN_FAM]
5906 .    if !d $EN_STRING_QUAD  .ENDNOTES_HEADER_QUAD CENTER
5907 .    if !d $EN_TITLE \{\
5908 .       ie \\n[#DOC_TYPE]=2 \{\
5909 .          ie !'\\*[$CHAPTER_TITLE_1]'' \{\
5910 .             ie '\\*[$CHAPTER]'' .ENDNOTE_TITLE "\\*[$CHAPTER_TITLE]"
5911 .             el .ENDNOTE_TITLE \
5912 "\\*[$CHAPTER_STRING] \\*[$CHAPTER]: \\*[$CHAPTER_TITLE]"
5913 .          \}
5914 .             el \{\
5915 .                ie '\\*[$CHAPTER]'' .ENDNOTE_TITLE "\\*[$CHAPTER_STRING]"
5916 .                el .ENDNOTE_TITLE "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"
5917 .             \}
5918 .          \}
5919 .       el .ENDNOTE_TITLE "\\*[$TITLE]"
5920 .    \}
5921 .    if !d $EN_TITLE_FAM  .ENDNOTE_TITLE_FAMILY \\*[$EN_FAM]
5922 .    if !d $EN_TITLE_QUAD .ENDNOTE_TITLE_QUAD LEFT
5923 .    if !d $EN_NUMBER_FAM .ENDNOTE_NUMBER_FAMILY \\*[$EN_FAM]
5924 .    if !d $EN_LN_FAM     .ENDNOTE_LINENUMBER_FAMILY \\*[$EN_FAM]
5925 .    if !r #EN_NUMBERS_ALIGN_LEFT \{\
5926 .       if !r #EN_NUMBERS_ALIGN_RIGHT \{\
5927 .          ie !\\n[#EN_MARKER_STYLE]=2 .ENDNOTE_NUMBERS_ALIGN RIGHT 2
5928 .          el .ENDNOTE_NUMBERS_ALIGN RIGHT 4
5929 .       \}
5930 .    \}
5931 .    if !r #EN_LN_GAP            .ENDNOTE_LINENUMBER_GAP 1m
5932 .    if !r #EN_ALLOWS_HEADERS    .ENDNOTES_ALLOWS_HEADERS
5933 .    if !d $BIB_PN_STYLE         .BIBLIOGRAPHY_PAGENUM_STYLE digit
5934 .    if !d $BIB_FAM              .BIBLIOGRAPHY_FAMILY \\*[$DOC_FAM]
5935 .    if !d $BIB_FT               .BIBLIOGRAPHY_FONT R
5936 .    if !d $BIB_QUAD \{\
5937 .       ds quad-check \\*[$DOC_QUAD]
5938 .       substring quad-check 0 0
5939 .       if '\\*[$DOC_QUAD]'C' .nr quad-check 1
5940 .       if '\\*[$DOC_QUAD]'R' .nr quad-check 1
5941 .       ie \\n[quad-check] .BIBLIOGRAPHY_QUAD J
5942 .       el .BIBLIOGRAPHY_QUAD \\*[$DOC_QUAD]
5943 .       rr quad-check
5944 .    \}
5945 .    if !d $BIB_STRING           .BIBLIOGRAPHY_STRING "Bibliography"
5946 .    if !d $BIB_STRING_FAM       .BIBLIOGRAPHY_STRING_FAMILY \\*[$BIB_FAM]
5947 .    if !d $BIB_STRING_QUAD      .BIBLIOGRAPHY_STRING_QUAD CENTER
5948 .    if !d $TOC_HEADER_STRING    .TOC_HEADER_STRING "Contents"
5949 .    if !d $TOC_HEADER_QUAD      .TOC_HEADER_QUAD LEFT
5950 .    if !d $TOC_PN_STYLE         .TOC_PAGENUM_STYLE roman
5951 .    if !r #TOC_PN_PADDING       .TOC_PADDING 3
5952 .\" Line numbering
5953 .    if !r #LN_GUTTER      .nr #LN_GUTTER 2
5954 .    if !r #Q_LN_GUTTER    .nr #Q_LN_GUTTER 2
5955 .    if !r #BQ_LN_GUTTER   .nr #BQ_LN_GUTTER 2
5956 .    if !d $LN_FAM         .ds $LN_FAM \\*[$DOC_FAM]
5957 .    if !d $LN_FT          .ds $LN_FT R
5958 .    if !d $LN_SIZE_CHANGE .ds $LN_SIZE_CHANGE +0
5959 .    if !d $LN_COLOR       .ds $LN_COLOR black
5960 .\" PDF link colour
5961 .    if !\\n[PDFHREF_COLOR_SET] .PDF_LINK_COLOR 0.0 0.3 0.9
5962 .\" PDF frame
5963 .    if !d pdf-img:frame-weight .ds pdf-img:frame-weight .5
5964 .    if !d pdf-img:frame-color  .ds pdf-img:frame-color  black
5965 .\" Captions, labels, sources
5966 .\" All at default doc specs except leading, which is autolead 2
5967 .   nr label-type-counter 0 1
5968 .   while \\n+[label-type-counter]<=5 \{\
5969 .      if \\n[label-type-counter]=1 .ds label-type eqn
5970 .      if \\n[label-type-counter]=2 .ds label-type pdf-img
5971 .      if \\n[label-type-counter]=3 .ds label-type pic
5972 .      if \\n[label-type-counter]=4 .ds label-type tbl
5973 .      if \\n[label-type-counter]=5 .ds label-type floating
5974 .      nr spec-type-counter 0 1
5975 .      while \\n+[spec-type-counter]<=3 \{\
5976 .         if \\n[spec-type-counter]=1 .ds spec-type label
5977 .         if \\n[spec-type-counter]=2 .ds spec-type caption
5978 .         if \\n[spec-type-counter]=3 .ds spec-type source
5979 .         set-defaults
5980 .         set-inline-specs
5981 .      \}
5982 .      rm label-type
5983 .      rm spec-type
5984 .   \}
5985 .\" String defaults for both PRINTSTYLEs
5986 .    ie \\n[#DOC_TYPE]=1 \{\
5987 .       ie '\\*[$DOCTITLE]'' \{\
5988 .          if \\n[#USER_DEF_HDRFTR_LEFT]=0  .ds $HDRFTR_LEFT \\*[$AUTHOR_1]
5989 .          if \\n[#USER_DEF_HDRFTR_RIGHT]=0 .ds $HDRFTR_RIGHT \\*[$TITLE]
5990 .       \}
5991 .       el \{\
5992 .          if \\n[#COPY_STYLE]=1             .DRAFT_WITH_PAGENUMBER
5993 .          if \\n[#USER_DEF_HDRFTR_LEFT]=0   .ds $HDRFTR_LEFT \\*[$AUTHOR_1]
5994 .          if \\n[#USER_DEF_HDRFTR_CENTER]=0 .ds $HDRFTR_CENTER \\*[$TITLE]
5995 .          if \\n[#USER_DEF_HDRFTR_RIGHT]=0  .ds $HDRFTR_RIGHT \\*[$DOCTITLE]
5996 .       \}
5997 .    \}
5998 .    el \{\
5999 .       if \\n[#USER_DEF_HDRFTR_LEFT]=0  .ds $HDRFTR_LEFT \\*[$AUTHOR_1]
6000 .       if \\n[#USER_DEF_HDRFTR_RIGHT]=0 .ds $HDRFTR_RIGHT \\*[$TITLE]
6001 .    \}
6002 .    if !d $ATTRIBUTE_STRING  .ds $ATTRIBUTE_STRING by
6003 .    if !d $FINIS_STRING      .FINIS_STRING "End"
6004 .    if !r #FINIS_STRING_CAPS .nr #FINIS_STRING_CAPS 1
6005 .\" Covers
6006 .    if !r #DOC_COVERS_OFF           .nr #DOC_COVERS 1
6007 .    if !r #COVERS_OFF               .nr #COVERS 1
6008 .    if !d $COVER_COPYRIGHT_QUAD     .COVER_COPYRIGHT_QUAD R
6009 .    if !d $COVER_MISC_QUAD          .COVER_MISC_QUAD L
6010 .    if !d $MISC_QUAD                .MISC_QUAD L
6011 .    if !d $DOC_COVER_COPYRIGHT_QUAD .DOC_COVER_COPYRIGHT_QUAD R
6012 .    if !d $DOC_COVER_MISC_QUAD      .DOC_COVER_MISC_QUAD L
6013 .\" Defaults for printstyle TYPEWRITE
6014 .    if \\n[#PRINT_STYLE]=1 \{\
6015 .       TYPEWRITER
6016 .       SS DEFAULT
6017 .       if \\n[#UNDERLINE_QUOTES]=1 .UNDERLINE_QUOTES
6018 .       if \\n[#UNDERLINE_QUOTES]=0 .UNDERLINE_QUOTES OFF
6019 .       if !\\n[#HDRFTR_PLAIN] \{\
6020 .          if !r #HDRFTR_RIGHT_CAPS .nr #HDRFTR_RIGHT_CAPS 1
6021 .          if \\n[#HDRFTR_RIGHT_CAPS]=0 \
6022 .             if !d $HDRFTR_RIGHT_SIZE_CHANGE .HDRFTR_RIGHT_SIZE +0
6023 .       \}
6024 .\" +Doctype underlining (if NAMED)
6025 .       if !r #DOCTYPE_UNDERLINE .nr #DOCTYPE_UNDERLINE 1
6026 .\" +Quotes and blockquotes
6027 .       if !r #Q_OFFSET_VALUE \
6028 .          if '\\*[$Q_OFFSET_VALUE]'' \
6029 .             QUOTE_INDENT \\n[#PP_INDENT]u+(\\n[#PP_INDENT]u/2u)
6030 .       if !d $Q_QUAD .QUOTE_LEFT
6031 .       if !d $BQUOTE_QUAD        .BLOCKQUOTE_QUAD LEFT
6032 .       if !r #BQ_OFFSET_VALUE \
6033 .          if '\\*[$BQ_OFFSET_VALUE]'' \
6034 .             BLOCKQUOTE_INDENT \\n[#PP_INDENT]u+(\\n[#PP_INDENT]u/2u)
6035 .\" +Epigraphs
6036 .       if !r #EPI_OFFSET_VALUE \
6037 .          if '\\*[$EPI_OFFSET_VALUE]'' .EPIGRAPH_INDENT 2
6038 .\" +Linebreaks
6039 .       if !d $LINEBREAK_CHAR .LINEBREAK_CHAR * 3 2p
6040 .\" +Footnotes
6041 .       if !d $FN_SIZE_CHANGE .FOOTNOTE_SIZE +0
6042 .       if !r #FN_RULE_LENGTH .FOOTNOTE_RULE_LENGTH 2i
6043 .\" +Endnotes
6044 .       if !r #EN_PP_INDENT .ENDNOTE_PARA_INDENT \\n[#PP_INDENT]
6045 .       if !r #EN_STRING_CAPS .ENDNOTES_HEADER_CAPS
6046 .       if !r #EN_STRING_UNDERLINE .nr #EN_STRING_UNDERLINE 2
6047 .\" +Footnotes
6048 .       if !r #FN_RULE_ADJ .FOOTNOTE_RULE_ADJ 6p
6049 .\" +Slant stuff
6050 .       if !r #SLANT_MEANS_SLANT \{\
6051 .          ie \\n[#UNDERLINE_SLANT]=1 .UNDERLINE_SLANT
6052 .          el .UNDERLINE_SLANT OFF
6053 .       \}
6054 .\" +Bibliography
6055 .       if !r #BIB_STRING_UNDERLINE .nr #BIB_STRING_UNDERLINE 2
6056 .       if !r #BIB_STRING_CAPS .BIBLIOGRAPHY_STRING_CAPS
6057 .    \}
6058 .\" Defaults for printstyle TYPESET
6059 .    if \\n[#PRINT_STYLE]=2 \{\
6060 .       if !d $DOCHEADER_LEAD_ADJ .DOCHEADER_LEAD +0
6061 .\" +Cover
6062 .       if !d $COVER_LEAD_ADJ .COVER_LEAD +0
6063 .       if !d $COVER_FAM      .COVER_FAMILY \\*[$DOC_FAM]
6064 .\" (title)
6065 .       if !d $COVER_TITLE_FAM \{\
6066 .          ie !d $COVER_FAM .COVER_TITLE_FAMILY \\*[$DOC_FAM]
6067 .          el .COVER_TITLE_FAMILY \\*[$COVER_FAM]
6068 .       \}
6069 .       if !d $COVER_TITLE_FT .COVER_TITLE_FONT B
6070 .       if !d $COVER_TITLE_SIZE_CHANGE .COVER_TITLE_SIZE +3.5
6071 .\" (doctitle)
6072 .       if !d $COVER_DOCTITLE_FAM \{\
6073 .          ie !d $DOC_COVER_FAM .COVER_DOCTITLE_FAMILY \\*[$DOC_FAM]
6074 .          el .COVER_DOCTITLE_FAMILY \\*[$COVER_FAM]
6075 .       \}
6076 .       if !d $COVER_DOCTITLE_FT          .COVER_DOCTITLE_FONT B
6077 .       if !d $COVER_DOCTITLE_SIZE_CHANGE .COVER_DOCTITLE_SIZE +3.5
6078 .\" (covertitle)
6079 .       if !d $COVER_COVERTITLE_FAM \{\
6080 .          ie !d $COVER_FAM .COVER_COVERTITLE_FAMILY \\*[$DOC_FAM]
6081 .          el .COVER_COVERTITLE_FAMILY \\*[$COVER_FAM]
6082 .       \}
6083 .       if !d $COVER_COVERTITLE_FT .COVER_COVERTITLE_FONT B
6084 .       if !d $COVER_COVERTITLE_SIZE_CHANGE .COVER_COVERTITLE_SIZE +3.5
6085 .\" (doc_covertitle)
6086 .       if !d $COVER_DOC_COVERTITLE_FAM \{\
6087 .          ie !d $COVER_FAM .COVER_DOC_COVERTITLE_FAMILY \\*[$DOC_FAM]
6088 .          el .COVER_DOC_COVERTITLE_FAMILY \\*[$COVER_FAM]
6089 .       \}
6090 .       if !d $COVER_DOC_COVERTITLE_FT .COVER_DOC_COVERTITLE_FONT B
6091 .       if !d $COVER_DOC_COVERTITLE_SIZE_CHANGE .COVER_DOC_COVERTITLE_SIZE +3.5
6092 .\" (chapter)
6093 .       if !d $COVER_CHAPTER_FAM \{\
6094 .          ie !d $COVER_FAM .COVER_CHAPTER_FAMILY \\*[$DOC_FAM]
6095 .          el .COVER_CHAPTER_FAMILY \\*[$COVER_FAM]
6096 .       \}
6097 .       if !d $COVER_CHAPTER_FT .COVER_CHAPTER_FONT B
6098 .       if !d $COVER_CHAPTER_SIZE_CHANGE .COVER_CHAPTER_SIZE +3.5
6099 .\" (chapter title)
6100 .       if !d $COVER_CHAPTER_TITLE_FAM \{\
6101 .          ie !d $COVER_FAM .COVER_CHAPTER_TITLE_FAMILY \\*[$DOC_FAM]
6102 .          el .COVER_CHAPTER_TITLE_FAMILY \\*[$COVER_FAM]
6103 .       \}
6104 .       if !d $COVER_CHAPTER_TITLE_FT .COVER_CHAPTER_TITLE_FONT BI
6105 .       if !d $COVER_CHAPTER_TITLE_SIZE_CHANGE .COVER_CHAPTER_TITLE_SIZE +4
6106 .\" (subtitle)
6107 .       if !d $COVER_SUBTITLE_FAM \{\
6108 .          ie !d $COVER_FAM .COVER_SUBTITLE_FAMILY \\*[$DOC_FAM]
6109 .          el .COVER_SUBTITLE_FAMILY \\*[$COVER_FAM]
6110 .       \}
6111 .       if !d $COVER_SUBTITLE_FT .COVER_SUBTITLE_FONT R
6112 .       if !d $COVER_SUBTITLE_SIZE_CHANGE .COVER_SUBTITLE_SIZE +0
6113 .\" (attribution and author[s])
6114 .       if !d $COVER_ATTRIBUTE_FAM \{\
6115 .          ie !d $COVER_FAM .COVER_ATTRIBUTE_FAMILY \\*[$DOC_FAM]
6116 .          el .COVER_ATTRIBUTE_FAMILY \\*[$COVER_FAM]
6117 .       \}
6118 .       if !d $COVER_ATTRIBUTE_FT .COVER_ATTRIBUTE_FONT I
6119 .       if !d $COVER_ATTRIBUTE_SIZE_CHANGE .COVER_ATTRIBUTE_SIZE +0
6120 .       if !d $COVER_AUTHOR_FAM \{\
6121 .          ie !d $COVER_FAM .COVER_AUTHOR_FAMILY \\*[$DOC_FAM]
6122 .          el .COVER_AUTHOR_FAMILY \\*[$COVER_FAM]
6123 .       \}
6124 .       if !d $COVER_AUTHOR_FT .COVER_AUTHOR_FONT I
6125 .       if !d $COVER_AUTHOR_SIZE_CHANGE .COVER_AUTHOR_SIZE +0
6126 .\" (doctype if "named")
6127 .       if !d $COVER_DOCTYPE_FAM \{\
6128 .          ie !d $COVER_FAM .COVER_DOCTYPE_FAMILY \\*[$DOC_FAM]
6129 .          el .COVER_DOCTYPE_FAMILY \\*[$COVER_FAM]
6130 .       \}
6131 .       if !d $COVER_DOCTYPE_FT .COVER_DOCTYPE_FONT BI
6132 .       if !d $COVER_DOCTYPE_SIZE_CHANGE .COVER_DOCTYPE_SIZE +3
6133 .\" (copyright)
6134 .       if !d $COVER_COPYRIGHT_FAM \{\
6135 .          ie !d $COVER_FAM .COVER_COPYRIGHT_FAMILY \\*[$DOC_FAM]
6136 .          el .COVER_COPYRIGHT_FAMILY \\*[$COVER_FAM]
6137 .       \}
6138 .       if !d $COVER_COPYRIGHT_FT .COVER_COPYRIGHT_FONT R
6139 .       if !d $COVER_COPYRIGHT_SIZE_CHANGE .COVER_COPYRIGHT_SIZE -2
6140 .\" (misc)
6141 .       if !d $COVER_MISC_FAM         .COVER_MISC_FAMILY \\*[$DOC_FAM]
6142 .       if !d $COVER_MISC_FT          .COVER_MISC_FONT R
6143 .       if !d $COVER_MISC_SIZE_CHANGE .COVER_MISC_SIZE -2
6144 .       if !r #COVER_MISC_LEAD        .COVER_MISC_LEAD 14.5
6145 .\" +Doc cover
6146 .       if !d $DOC_COVER_LEAD_ADJ .DOC_COVER_LEAD +0
6147 .       if !d $DOC_COVER_FAM      .DOC_COVER_FAMILY \\*[$DOC_FAM]
6148 .\" (title)
6149 .       if !d $DOC_COVER_TITLE_FAM \{\
6150 .          ie !d $DOC_COVER_FAM .DOC_COVER_TITLE_FAMILY \\*[$DOC_FAM]
6151 .          el .DOC_COVER_TITLE_FAMILY \\*[$DOC_COVER_FAM]
6152 .       \}
6153 .       if !d $DOC_COVER_TITLE_FT          .DOC_COVER_TITLE_FONT B
6154 .       if !d $DOC_COVER_TITLE_SIZE_CHANGE .DOC_COVER_TITLE_SIZE +3.5
6155 .\" (doctitle)
6156 .       if !d $DOC_COVER_DOCTITLE_FAM \{\
6157 .          ie !d $DOC_COVER_FAM .DOC_COVER_DOCTITLE_FAMILY \\*[$DOC_FAM]
6158 .          el .DOC_COVER_DOCTITLE_FAMILY \\*[$DOC_COVER_FAM]
6159 .       \}
6160 .       if !d $DOC_COVER_DOCTITLE_FT          .DOC_COVER_DOCTITLE_FONT B
6161 .       if !d $DOC_COVER_DOCTITLE_SIZE_CHANGE .DOC_COVER_DOCTITLE_SIZE +3.5
6162 .\" (covertitle)
6163 .       if !d $DOC_COVER_COVERTITLE_FAM \{\
6164 .          ie !d $COVER_FAM .DOC_COVER_COVERTITLE_FAMILY \\*[$DOC_FAM]
6165 .          el .DOC_COVER_COVERTITLE_FAMILY \\*[$COVER_FAM]
6166 .       \}
6167 .       if !d $DOC_COVER_COVERTITLE_FT .DOC_COVER_COVERTITLE_FONT B
6168 .       if !d $DOC_COVER_COVERTITLE_SIZE_CHANGE .DOC_COVER_COVERTITLE_SIZE +3.5
6169 .\" (doc_covertitle)
6170 .       if !d $DOC_COVER_DOC_COVERTITLE_FAM \{\
6171 .          ie !d $COVER_FAM .DOC_COVER_DOC_COVERTITLE_FAMILY \\*[$DOC_FAM]
6172 .          el .DOC_COVER_DOC_COVERTITLE_FAMILY \\*[$COVER_FAM]
6173 .       \}
6174 .       if !d $DOC_COVER_DOC_COVERTITLE_FT .DOC_COVER_DOC_COVERTITLE_FONT B
6175 .       if !d $DOC_COVER_DOC_COVERTITLE_SIZE_CHANGE .DOC_COVER_DOC_COVERTITLE_SIZE +3.5
6176 .\" (chapter)
6177 .       if !d $DOC_COVER_CHAPTER_FAM \{\
6178 .          ie !d $DOC_COVER_FAM .DOC_COVER_CHAPTER_FAMILY \\*[$DOC_FAM]
6179 .          el .DOC_COVER_CHAPTER_FAMILY \\*[$DOC_COVER_FAM]
6180 .       \}
6181 .       if !d $DOC_COVER_CHAPTER_FT          .DOC_COVER_CHAPTER_FONT B
6182 .       if !d $DOC_COVER_CHAPTER_SIZE_CHANGE .DOC_COVER_CHAPTER_SIZE +3.5
6183 .\" (chapter title)
6184 .       if !d $DOC_COVER_CHAPTER_TITLE_FAM \{\
6185 .          ie !d $DOC_COVER_FAM .DOC_COVER_CHAPTER_TITLE_FAMILY \\*[$DOC_FAM]
6186 .          el .DOC_COVER_CHAPTER_TITLE_FAMILY \\*[$DOC_COVER_FAM]
6187 .       \}
6188 .       if !d $DOC_COVER_CHAPTER_TITLE_FT .DOC_COVER_CHAPTER_TITLE_FONT BI
6189 .       if !d $DOC_COVER_CHAPTER_TITLE_SIZE_CHANGE .DOC_COVER_CHAPTER_TITLE_SIZE +4
6190 .\" (subtitle)
6191 .       if !d $DOC_COVER_SUBTITLE_FAM \{\
6192 .          ie !d $DOC_COVER_FAM .DOC_COVER_SUBTITLE_FAMILY \\*[$DOC_FAM]
6193 .          el .DOC_COVER_SUBTITLE_FAMILY \\*[$DOC_COVER_FAM]
6194 .       \}
6195 .       if !d $DOC_COVER_SUBTITLE_FT .DOC_COVER_SUBTITLE_FONT R
6196 .       if !d $DOC_COVER_SUBTITLE_SIZE_CHANGE .DOC_COVER_SUBTITLE_SIZE +0
6197 .\" (attribution and author[s])
6198 .       if !d $DOC_COVER_ATTRIBUTE_FAM \{\
6199 .          ie !d $DOC_COVER_FAM .DOC_COVER_ATTRIBUTE_FAMILY \\*[$DOC_FAM]
6200 .          el .DOC_COVER_ATTRIBUTE_FAMILY \\*[$DOC_COVER_FAM]
6201 .       \}
6202 .       if !d $DOC_COVER_ATTRIBUTE_FT .DOC_COVER_ATTRIBUTE_FONT I
6203 .       if !d $DOC_COVER_ATTRIBUTE_SIZE_CHANGE .DOC_COVER_ATTRIBUTE_SIZE +0
6204 .       if !d $DOC_COVER_AUTHOR_FAM \{\
6205 .          ie !d $DOC_COVER_FAM .DOC_COVER_AUTHOR_FAMILY \\*[$DOC_FAM]
6206 .          el .DOC_COVER_AUTHOR_FAMILY \\*[$DOC_COVER_FAM]
6207 .       \}
6208 .       if !d $DOC_COVER_AUTHOR_FT .DOC_COVER_AUTHOR_FONT I
6209 .       if !d $DOC_COVER_AUTHOR_SIZE_CHANGE .DOC_COVER_AUTHOR_SIZE +0
6210 .\" (doctype if "named")
6211 .       if !d $DOC_COVER_DOCTYPE_FAM \{\
6212 .          ie !d $DOC_COVER_FAM .DOC_COVER_DOCTYPE_FAMILY \\*[$DOC_FAM]
6213 .          el .DOC_COVER_DOCTYPE_FAMILY \\*[$DOC_COVER_FAM]
6214 .       \}
6215 .       if !d $DOC_COVER_DOCTYPE_FT .DOC_COVER_DOCTYPE_FONT BI
6216 .       if !d $DOC_COVER_DOCTYPE_SIZE_CHANGE .DOC_COVER_DOCTYPE_SIZE +3
6217 .\" (copyright)
6218 .       if !d $DOC_COVER_COPYRIGHT_FAM \{\
6219 .          ie !d $DOC_COVER_FAM .DOC_COVER_COPYRIGHT_FAMILY \\*[$DOC_FAM]
6220 .          el .DOC_COVER_COPYRIGHT_FAMILY \\*[$DOC_COVER_FAM]
6221 .       \}
6222 .       if !d $DOC_COVER_COPYRIGHT_FT .DOC_COVER_COPYRIGHT_FONT R
6223 .       if !d $DOC_COVER_COPYRIGHT_SIZE_CHANGE .DOC_COVER_COPYRIGHT_SIZE -2
6224 .\" (misc)
6225 .       if !d $DOC_COVER_MISC_FAM         .DOC_COVER_MISC_FAMILY \\*[$DOC_FAM]
6226 .       if !d $DOC_COVER_MISC_FT          .DOC_COVER_MISC_FONT R
6227 .       if !d $DOC_COVER_MISC_SIZE_CHANGE .DOC_COVER_MISC_SIZE -2
6228 .       if !r #DOC_COVER_MISC_LEAD        .DOC_COVER_MISC_LEAD 14.5
6229 .\" +Docheader
6230 .       if !d $DOCHEADER_FAM .DOCHEADER_FAMILY \\*[$DOC_FAM]
6231 .       if !d $TITLE_FAM \{\
6232 .          ie !d $DOCHEADER_FAM .TITLE_FAMILY \\*[$DOC_FAM]
6233 .          el .TITLE_FAMILY \\*[$DOCHEADER_FAM]
6234 .       \}
6235 .       if !d $TITLE_FT .TITLE_FONT B
6236 .\" Title size change
6237 .       if !d $TITLE_SIZE_CHANGE \{\
6238 .          ie \\n[#DOC_TYPE]=2 .TITLE_SIZE +4
6239 .          el .TITLE_SIZE +3.5
6240 .       \}
6241 .       if !d $CHAPTER_FAM \{\
6242 .          ie !d $DOCHEADER_FAM .CHAPTER_FAMILY \\*[$DOC_FAM]
6243 .          el .CHAPTER_FAMILY \\*[$DOCHEADER_FAM]
6244 .       \}
6245 .       if !d $CHAPTER_FT .CHAPTER_FONT B
6246 .       if !d $CHAPTER_SIZE_CHANGE .CHAPTER_SIZE +4
6247 .       if !d $CHAPTER_TITLE_FAM \{\
6248 .          ie !d $DOCHEADER_FAM .CHAPTER_TITLE_FAMILY \\*[$DOC_FAM]
6249 .          el .CHAPTER_TITLE_FAMILY \\*[$DOCHEADER_FAM]
6250 .       \}
6251 .       if !d $CHAPTER_TITLE_FT          .CHAPTER_TITLE_FONT BI
6252 .       if !d $CHAPTER_TITLE_SIZE_CHANGE .CHAPTER_TITLE_SIZE +4
6253 .       if !d $SUBTITLE_FAM \{\
6254 .          ie !d $DOCHEADER_FAM .SUBTITLE_FAMILY \\*[$DOC_FAM]
6255 .          el .SUBTITLE_FAMILY \\*[$DOCHEADER_FAM]
6256 .       \}
6257 .       if !d $SUBTITLE_FT          .SUBTITLE_FONT R
6258 .       if !d $SUBTITLE_SIZE_CHANGE .SUBTITLE_SIZE +0
6259 .       if !d $ATTRIBUTE_FAM \{\
6260 .          ie !d $DOCHEADER_FAM .ATTRIBUTE_FAMILY \\*[$DOC_FAM]
6261 .          el .ATTRIBUTE_FAMILY \\*[$DOCHEADER_FAM]
6262 .       \}
6263 .       if !d $ATTRIBUTE_FT          .ATTRIBUTE_FONT I
6264 .       if !d $ATTRIBUTE_SIZE_CHANGE .ATTRIBUTE_SIZE +0
6265 .       if !d $AUTHOR_FAM \{\
6266 .          ie !d $DOCHEADER_FAM .AUTHOR_FAMILY \\*[$DOC_FAM]
6267 .          el .AUTHOR_FAMILY \\*[$DOCHEADER_FAM]
6268 .       \}
6269 .       if !d $AUTHOR_FT          .AUTHOR_FONT I
6270 .       if !d $AUTHOR_SIZE_CHANGE .AUTHOR_SIZE +0
6271 .       if !d $DOCTYPE_FAM \{\
6272 .          ie !d $DOCHEADER_FAM .DOCTYPE_FAMILY \\*[$DOC_FAM]
6273 .          el .DOCTYPE_FAMILY \\*[$DOCHEADER_FAM]
6274 .       \}
6275 .       if !d $DOCTYPE_FT          .DOCTYPE_FONT BI
6276 .       if !d $DOCTYPE_SIZE_CHANGE .DOCTYPE_SIZE +3
6277 .\" +Headers and footers
6278 .       if !\\n[#HDRFTR_PLAIN] \{\
6279 .          if !d $HDRFTR_LEFT_FAM \
6280 .             HDRFTR_LEFT_FAMILY \\*[$DOC_FAM]
6281 .          if !d $HDRFTR_LEFT_FT \
6282 .              HDRFTR_LEFT_FONT R
6283 .          if \\n[#HDRFTR_LEFT_CAPS] \
6284 .             if !d $HDRFTR_LEFT_SIZE_CHANGE \
6285 .                HDRFTR_LEFT_SIZE -2
6286 .          if !d $HDRFTR_LEFT_SIZE_CHANGE \
6287 .              HDRFTR_LEFT_SIZE -.5
6288 .          if !d $HDRFTR_CENTER_FAM \
6289 .              HDRFTR_CENTER_FAMILY \\*[$DOC_FAM]
6290 .          if !d $HDRFTR_CENTER_FT .HDRFTR_CENTER_FONT I
6291 .          if \\n[#HDRFTR_CENTER_CAPS] \
6292 .             if !d $HDRFTR_CENTER_SIZE_CHANGE \
6293 .                HDRFTR_CENTER_SIZE -2
6294 .          if !d $HDRFTR_CENTER_SIZE_CHANGE \
6295 .              HDRFTR_CENTER_SIZE -.5
6296 .          if !d $HDRFTR_RIGHT_FAM \
6297 .             HDRFTR_RIGHT_FAMILY \\*[$DOC_FAM]
6298 .          if !d $HDRFTR_RIGHT_FT .HDRFTR_RIGHT_FONT R
6299 .          ie !r #HDRFTR_RIGHT_CAPS \{\
6300 .             nr #HDRFTR_RIGHT_CAPS 1
6301 .             if !d $HDRFTR_RIGHT_SIZE_CHANGE \
6302 .                HDRFTR_RIGHT_SIZE -2
6303 .          \}
6304 .          el \{\
6305 .             if \\n[#HDRFTR_RIGHT_CAPS]=0 \
6306 .                if !d $HDRFTR_RIGHT_SIZE_CHANGE \
6307 .                   HDRFTR_RIGHT_SIZE -.5
6308 .          \}
6309 .          ie !\\n[#HDRFTR_RIGHT_SMALLCAPS] \{\
6310 .             if \\n[#HDRFTR_RIGHT_CAPS] \
6311 .                if !d $HDRFTR_RIGHT_SIZE_CHANGE \
6312 .                   HDRFTR_RIGHT_SIZE -2
6313 .          \}
6314 .          el \{\
6315 .             nr #SKIP_CAPS_SMALLCAPS_WARNING 1
6316 .             if \\n[#HDRFTR_RIGHT_CAPS] .HDRFTR_RIGHT_CAPS OFF
6317 .          \}
6318 .          if !d $HDRFTR_RIGHT_SIZE_CHANGE .HDRFTR_RIGHT_SIZE -.5
6319 .       \}
6320 .\" +Quotes
6321 .       if !d $QUOTE_FAM         .QUOTE_FAMILY \\*[$DOC_FAM]
6322 .       if !d $QUOTE_FT          .QUOTE_FONT I
6323 .       if !d $QUOTE_SIZE_CHANGE .QUOTE_SIZE +0
6324 .       if !r #Q_OFFSET_VALUE \
6325 .          if '\\*[$Q_OFFSET_VALUE]'' .QUOTE_INDENT 3
6326 .       if !d $Q_QUAD .QUOTE_LEFT
6327 .\" +Blockquotes
6328 .\"  Note: the leading for quotes and blockquotes is set after .DEFAULTS in START
6329 .       if !d $BQUOTE_FAM         .BLOCKQUOTE_FAMILY \\*[$DOC_FAM]
6330 .       if !d $BQUOTE_FT          .BLOCKQUOTE_FONT R
6331 .       if !d $BQUOTE_SIZE_CHANGE .BLOCKQUOTE_SIZE -1
6332 .       if !d $BQUOTE_QUAD        .BLOCKQUOTE_QUAD LEFT
6333 .       if !r #BQ_OFFSET_VALUE \
6334 .          if '\\*[$BQ_OFFSET_VALUE]'' .BLOCKQUOTE_INDENT 3
6335 .\" +Epigraphs
6336 .       if !d $EPI_FAM         .EPIGRAPH_FAMILY \\*[$DOC_FAM]
6337 .       if !d $EPI_FT          .EPIGRAPH_FONT R
6338 .       if !d $EPI_SIZE_CHANGE .EPIGRAPH_SIZE -1.5
6339 .       if !r #EPI_AUTOLEAD    .EPIGRAPH_AUTOLEAD 2
6340 .       if !d $EPI_QUAD        .EPIGRAPH_QUAD \\*[$DOC_QUAD]
6341 .       if !r #EPI_OFFSET_VALUE \
6342 .          if '\\*[$EPI_OFFSET_VALUE]'' .EPIGRAPH_INDENT 3
6343 .\" +Linebreaks
6344 .       if !d $LINEBREAK_CHAR  .LINEBREAK_CHAR * 3 3p
6345 .       if !d $LINEBREAK_COLOR .LINEBREAK_COLOR black
6346 .\" +Footnotes
6347 .       if !r #FN_RULE_LENGTH .FOOTNOTE_RULE_LENGTH 4P
6348 .       if !r #FN_RULE_ADJ    .FOOTNOTE_RULE_ADJ 3p
6349 .       if !d $FN_SIZE_CHANGE .FOOTNOTE_SIZE -2
6350 .       if !r #FN_AUTOLEAD    .FOOTNOTE_AUTOLEAD 2
6351 .\" +Endnotes
6352 .       if !r #EN_PS                 .ENDNOTE_PT_SIZE (\\n[#DOC_PT_SIZE]u)
6353 .       if !d $EN_STRING_FT          .ENDNOTES_HEADER_FONT B
6354 .       if !d $EN_STRING_SIZE_CHANGE .ENDNOTES_HEADER_SIZE +3.5
6355 .       if !d $EN_TITLE_FT           .ENDNOTE_TITLE_FONT B
6356 .       if !d $EN_TITLE_SIZE_CHANGE  .ENDNOTE_TITLE_SIZE +0
6357 .       if !d $EN_NUMBER_FT          .ENDNOTE_NUMBER_FONT B
6358 .       if !d $EN_LN_FT              .ENDNOTE_LINENUMBER_FONT R
6359 .       if !d $EN_NUMBER_SIZE_CHANGE .ENDNOTE_NUMBER_SIZE +0
6360 .       if !d $EN_LN_SIZE_CHANGE     .ENDNOTE_LINENUMBER_SIZE +0
6361 .       if !r #EN_PP_INDENT          .ENDNOTE_PARA_INDENT 1.5m
6362 .       if !d $EN_SPACE              .ENDNOTE_SPACING 0
6363 .\" +Bibliography
6364 .       if !r #BIB_LIST               .BIBLIOGRAPHY_TYPE PLAIN
6365 .       if !r #BIB_PS                 .BIBLIOGRAPHY_PT_SIZE (\\n[#DOC_PT_SIZE]u)
6366 .       if !d $BIB_STRING_FT          .BIBLIOGRAPHY_STRING_FONT B
6367 .       if !d $BIB_STRING_SIZE_CHANGE .BIBLIOGRAPHY_STRING_SIZE +3.5
6368 .\" +Table of contents
6369 .       if !d $TOC_FAM                .TOC_FAMILY \\*[$DOC_FAM]
6370 .       if !r #TOC_PS                 .TOC_PT_SIZE (\\n[#DOC_PT_SIZE]u)
6371 .       if '\\*[$TOC_LEAD]''          .TOC_LEAD \\n[#DOC@LEAD]u ADJUST
6372 .       if !d $TOC_HEADER_FAM         .TOC_HEADER_FAMILY \\*[$TOC_FAM]
6373 .       if !d $TOC_HEADER_SIZE_CHANGE .TOC_HEADER_SIZE +3.5
6374 .       if !d $TOC_HEADER_FT          .TOC_HEADER_FONT B
6375 .       if !d $TOC_PN_FAM             .TOC_PN_FAMILY \\*[$TOC_FAM]
6376 .       if !d $TOC_PN_FT              .TOC_PN_FONT R
6377 .       if !d $TOC_PN_SIZE_CHANGE     .TOC_PN_SIZE +0
6378 .       if !d $TOC_TITLE_FAM          .TOC_TITLE_FAMILY \\*[$TOC_FAM]
6379 .    \}
6380 .\" +Refer support
6381 .    if !r #EN_REF .nr #FN_REF 1
6382 .    if !d $REF_FN_INDENT \{\
6383 .       if \\n[#PRINT_STYLE]=1 .INDENT_REFS FOOTNOTE .5i
6384 .       if \\n[#PRINT_STYLE]=2 .INDENT_REFS FOOTNOTE 2m
6385 .    \}
6386 .    if !d $REF_EN_INDENT \{\
6387 .       if \\n[#PRINT_STYLE]=1 .INDENT_REFS ENDNOTE .5i
6388 .       if \\n[#PRINT_STYLE]=2 .INDENT_REFS ENDNOTE 2m
6389 .    \}
6390 .    if !d $REF_BIB_INDENT \{\
6391 .       if \\n[#PRINT_STYLE]=1 .INDENT_REFS BIBLIO .5i
6392 .       if \\n[#PRINT_STYLE]=2 .INDENT_REFS BIBLIO 2m
6393 .    \}
6394 .\" Define strings for idem entries
6395 .    if \\n[#PRINT_STYLE]=1 .char \[idem] \[hy]\[hy]\[hy]
6396 .    if \\n[#PRINT_STYLE]=2 .char \[idem] \v'-.3m'\l'3m'\v'.3m'
6397 .\" Adjust doc leading for PRINTSTYLE TYPESET
6398 .    if \\n[#PRINT_STYLE]=2 \
6399 .       if \\n[#ADJ_DOC_LEAD]=1 .DOC_LEAD_ADJUST
6400 .\" This diversion is to get a value for #FN_AUTOLEAD
6401 .    di NULL
6402 .       if \\n[#AUTO_LEAD] \{\
6403 .          nr #RESTORE_AUTO_LEAD 1
6404 .          nr #SAVED_AUTOLEAD_VALUE \\n[#AUTOLEAD_VALUE]
6405 .       \}
6406 .       ev NULL
6407 .       if \\n[#PRINT_STYLE]=1 \{\
6408 .          ps \\*[$TYPEWRITER_PS]
6409 .          ie \\n[#SINGLE_SPACE]=1 .vs \\n[#ORIGINAL_DOC_LEAD]u
6410 .          el .vs \\n[#ORIGINAL_DOC_LEAD]u/2u
6411 .       \}
6412 .       if \\n[#PRINT_STYLE]=2 \{\
6413 .          ps  \\n[#DOC_PT_SIZE]u\\*[$FN_SIZE_CHANGE]
6414 .          vs \\n[.ps]u+\\n[#FN_AUTOLEAD]u
6415 .       \}
6416 .       nr #FN_LEAD \\n[#LEAD]
6417 .       ev
6418 .    di
6419 .    if \\n[#RESTORE_AUTO_LEAD] \{\
6420 .       nr #AUTO_LEAD 1
6421 .       nr #AUTOLEAD_VALUE  \\n[#SAVED_AUTOLEAD_VALUE]
6422 .    \}
6423 .    if !\\n[#SKIP_TRAPS] .TRAPS
6424 .    rr #SKIP_TRAPS
6425 .    if \\n[#REMOVE_ADJ] .DOC_LEAD \\n[#DOC_LEAD]u-\\n[#DOC_LEAD_ADJ]u
6426 .    if (\\n[#FOOTER_MARGIN]+\\n[.v]>=\\n[#B_MARGIN]) \{\
6427 .       tm1 "[mom]: Your chosen bottom margin for running text is too close to the footer margin.
6428 .       tm1 "       No footers or bottom-of-page page numbers will be printed.
6429 .       tm1 "       Please reset B_MARGIN or FOOTER_MARGIN to allow enough space.
6430 .       tm1 "       If no footers or bottom-of-page page numbers are required,
6431 .       tm1 "       invoke .FOOTER_MARGIN 0 before .START
6432 .       nr #SKIP_FOOTER 1
6433 .    \}
6434 .\" Endnote, bibliography and toc leading
6435 .    nr #OK_PROCESS_LEAD 1
6436 .    nr #RESTORE_DOC_LEAD \\n[.v]
6437 .    nr #RESTORE_B_MARGIN \\n[#B_MARGIN]
6438 .    if \\n[#PRINT_STYLE]=1 \{\
6439 .       ie \\n[#SINGLE_SPACE] \{\
6440 .          ENDNOTE_LEAD      12 ADJUST
6441 .          BIBLIOGRAPHY_LEAD 12 ADJUST
6442 .       \}
6443 .       el \{\
6444 .          ie \\n[#EN_SINGLESPACE] .ENDNOTE_LEAD 12 ADJUST
6445 .          el .ENDNOTE_LEAD 24 ADJUST
6446 .          ie \\n[#BIB_SINGLESPACE] .BIBLIOGRAPHY_LEAD 12 ADJUST
6447 .          el .BIBLIOGRAPHY_LEAD 24 ADJUST
6448 .       \}
6449 .    \}
6450 .    if \\n[#PRINT_STYLE]=2 \{\
6451 .       ie !d $EN_LEAD  .ENDNOTE_LEAD \\n[#UNADJUSTED_DOC_LEAD]u ADJUST
6452 .       el .ENDNOTE_LEAD \\*[$EN_LEAD] \\*[$ADJUST_EN_LEAD]
6453 .       ie !d $BIB_LEAD .BIBLIOGRAPHY_LEAD \\n[#UNADJUSTED_DOC_LEAD]u ADJUST
6454 .       el .BIBLIOGRAPHY_LEAD \\*[$BIB_LEAD] \\*[$ADJUST_BIB_LEAD]
6455 .       ie !d $TOC_LEAD .TOC_LEAD \\n[#UNADJUSTED_DOC_LEAD]u \\*[$ADJUST_TOC_LEAD]
6456 .       el .TOC_LEAD \\*[$TOC_LEAD] \\*[$ADJUST_TOC_LEAD]
6457 .    \}
6458 .    ie !d $BIB_SPACE .BIBLIOGRAPHY_SPACING 0
6459 .    el \{\
6460 .       if \\n[#DEFER_BIB_SPACING]=1 \{\
6461 .          BIBLIOGRAPHY_SPACING \\*[$BIB_SPACE]
6462 .          rr #DEFER_BIB_SPACING
6463 .       \}
6464 .    \}
6465 .    nr #DOC_LEAD \\n[#RESTORE_DOC_LEAD]u
6466 .    nr #B_MARGIN \\n[#RESTORE_B_MARGIN]
6467 .    vs \\n[#DOC_LEAD]u
6468 .    if !\\n[#PRINT_STYLE]=1 \{\
6469 .       if \\n[#RERUN_TRAPS] \{\
6470 .          TRAPS
6471 .          rr #RERUN_TRAPS
6472 .       \}
6473 .    \}
6474 .\" Set default heading and toc-entry family if not done already
6475 .    nr #HD_LEVEL 0 1 \" loop step
6476 .    nr #LOOP 9       \" loop count
6477 .    while \\n+[#HD_LEVEL]<=\\n[#LOOP] \{\
6478 .       if '\\*[$HEAD_\\n[#HD_LEVEL]_FAM]'' \
6479 .           ds $HEAD_\\n[#HD_LEVEL]_FAM \\*[$DOC_FAM]
6480 .       if '\\*[$HEAD_\\n[#HD_LEVEL]_BASELINE_ADJ]'' \
6481 .           ds $HEAD_\\n[#HD_LEVEL]_BASELINE_ADJ \\n[.v]/10
6482 .       if '\\*[$TOC_HEAD_\\n[#HD_LEVEL]_FAM]'' \
6483 .           ds $TOC_HEAD_\\n[#HD_LEVEL]_FAM \\*[$TOC_FAM]
6484 .    \}
6485 .    if '\\*[$TOC_TITLE_FAM]'' .TOC_TITLE_FAMILY \\*[$DOC_FAM]
6486 .\" Re-run MNinit to capture strings and registers set in DEFAULTS.
6487 .    if !'\\*[$MN-arg1]'' \{\
6488 .       MNinit \
6489 \\*[$MN-arg1] \\*[$MN-arg2] \
6490 \\*[$MN-arg3] \\*[$MN-arg4] \
6491 \\*[$MN-arg5] \\*[$MN-arg6] \
6492 \\*[$MN-arg7] \\*[$MN-arg8] \
6493 \\*[$MN-arg9]
6494 .    \}
6495 .    if \\n[#PRINT_STYLE]=1 .nr #IGNORE 1
6496 .    if \\n[#AUTO_LEAD] \{\
6497 .       rr #AUTO_LEAD
6498 .       rr #AUTOLEAD_VALUE
6499 .    \}
6500 .END
6501 \#
6502 \# =================================================================
6503 \#
6504 \# Macros and aliases needed for doccover, cover, and docheader in
6505 \# START.
6506 \#
6507 .MAC DOC_HEADER_QUAD END
6508 .    if '\\$0'DOC_HEADER_QUAD' .ds $CALLING_MACRO DOCHEADER
6509 .    if '\\$0'COVER_H_POS'     .ds $CALLING_MACRO COVER
6510 .    if '\\$0'DOC_COVER_H_POS' .ds $CALLING_MACRO DOC_COVER
6511 .    substring $\\*[$CALLING_MACRO]_QUAD 0 0
6512 .    ie !'\\*[$\\*[$CALLING_MACRO]_QUAD]'' \{\
6513 .       if '\\*[$\\*[$CALLING_MACRO]_QUAD]'L' .LEFT
6514 .       if '\\*[$\\*[$CALLING_MACRO]_QUAD]'C' .CENTER
6515 .       if '\\*[$\\*[$CALLING_MACRO]_QUAD]'C' .RIGHT
6516 .    \}
6517 .    el .CENTER
6518 .END
6519 .
6520 .ALIAS COVER_H_POS     DOC_HEADER_QUAD
6521 .ALIAS DOC_COVER_H_POS DOC_HEADER_QUAD
6522 \#
6523 .MAC DO_TITLE_OR_AUTHOR END
6524 .    ie '\\$0'DO_AUTHORS' .ds $TTL_AUTH AUTHOR
6525 .    el .ds $TTL_AUTH TITLE
6526 .    if !'\\*[$\\*[$PRFX]\\*[$TTL_AUTH]_1]'' \{\
6527 .       if '\\$0'DO_SUBTITLE' \{\
6528 .          if '\\*[$PRFX]'\\*[DOC_]COVER_SUB' \{\
6529 .             ds $PRFX SUB
6530 .             nr #\\*[DOC_]COVER_SUB 1
6531 .          \}
6532 .       \}
6533 .       if !\\n[#PRINT_STYLE]=1 \{\
6534 \#.          if (\\n[#COVER]=1):(\\n[#DOC_COVER]=1) \
6535 \#.             rn $PRFX $PRFX_SAVED
6536 .          fam  \\*[$\\*[$COVER_TYPE]\\*[$PRFX]\\*[$TTL_AUTH]_FAM]
6537 .          ft   \\*[$\\*[$COVER_TYPE]\\*[$PRFX]\\*[$TTL_AUTH]_FT]
6538 .          ps \
6539 \\n[#DOC_PT_SIZE]u\\*[$\\*[$COVER_TYPE]\\*[$PRFX]\\*[$TTL_AUTH]_SIZE_CHANGE]
6540 .          if '\\*[$COVER_TYPE]'' .vs \\n[#DOCHEADER_LEAD]u
6541 .          if !'\\*[$\\*[$COVER_TYPE]\\*[$PRFX]\\*[$TTL_AUTH]_LEAD]'' \{\
6542 .             vs \\*[$\\*[$COVER_TYPE]\\*[$PRFX]\\*[$TTL_AUTH]_LEAD]
6543 .             if \\n[#DOCHEADER] .sp |\\n[#T_MARGIN]u-1v
6544 .          \}
6545 .          if \\n[#CHAPTER+TITLE]=1 .ALD \\n[.v]u/4u \" A little space before the chapter title
6546 .          if \\n[#\\*[$COVER_TYPE]\\*[$PRFX]\\*[$TTL_AUTH]_COLOR]=1 \
6547 .             COLOR \\*[$\\*[$COVER_TYPE]\\*[$PRFX]\\*[$TTL_AUTH]_COLOR]
6548 .          if \\n[#\\*[$COVER_TYPE]\\*[$PRFX]\\*[$TTL_AUTH]_CAPS]=1 .CAPS
6549 .          if \\n[#\\*[$COVER_TYPE]\\*[$PRFX]\\*[$TTL_AUTH]_SMALLCAPS]=1 .SMALLCAPS
6550 \#.          if (\\n[#COVER]=1):(\\n[#DOC_COVER]=1) \
6551 \#.             rn $PRFX_SAVED $PRFX
6552 .       \}
6553 .       if \\n[#\\*[DOC_]COVER_SUB] \{\
6554 .          rr #\\*[DOC_]COVER_SUB
6555 .          ds $PRFX \\*[DOC_]COVER_SUB
6556 .          ds $SAVED_COVER_TYPE \\*[$COVER_TYPE]
6557 .          rm $COVER_TYPE
6558 .       \}
6559 .       nr #ARG_NUM 0 1
6560 .       while \\n[#\\*[$PRFX]\\*[$TTL_AUTH]_NUM]>=\\n+[#ARG_NUM] \{\
6561 .          ie \\n[#\\*[$COVER_TYPE]\\*[$PRFX]\\*[$TTL_AUTH]_UNDERLINE] \{\
6562 .             ds $TITLE_TYPE \\*[$COVER_TYPE]\\*[$PRFX]\\*[$TTL_AUTH]
6563 .             ie \\n[#\\*[$COVER_TYPE]\\*[$PRFX]\\*[$TTL_AUTH]_UNDERLINE]=2 \{\
6564 .                ie !\\n[#PRINT_STYLE]=1 \
6565 .                   UNDERSCORE2 \\*[$\\*[$PRFX]\\*[$TTL_AUTH]_UNDERLINE_GAP] \
6566 \\*[$\\*[$PRFX]\\*[$TTL_AUTH]_RULE_GAP] \
6567 "\\*[$\\*[$PRFX]\\*[$TTL_AUTH]_\\n[#ARG_NUM]]
6568 .                el .UNDERSCORE "\\*[$\\*[$PRFX]\\*[$TTL_AUTH]_\\n[#ARG_NUM]]
6569 .             \}
6570 .             el \{\
6571 .                ie !\\n[#PRINT_STYLE]=1 \
6572 .                   UNDERSCORE "\\*[$\\*[$PRFX]\\*[$TTL_AUTH]_\\n[#ARG_NUM]]
6573 .                el .PRINT "\\*[$\\*[$PRFX]\\*[$TTL_AUTH]_\\n[#ARG_NUM]]
6574 .             \}
6575 .          \}
6576 .          el \{\
6577 .             PRINT "\\*[$\\*[$PRFX]\\*[$TTL_AUTH]_\\n[#ARG_NUM]]
6578 .          \}
6579 .          if \\n[#ARG_NUM]>1 .as PDF_BM " \"
6580 .          as PDF_BM \\*[$\\*[$PRFX]\\*[$TTL_AUTH]_\\n[#ARG_NUM]]
6581 .       \}
6582 .       rm $TITLE_TYPE
6583 .       if \\n[#PRINT_STYLE]=2 .vs
6584 .       if \\n[#\\*[$COVER_TYPE]\\*[$PRFX]\\*[$TTL_AUTH]_COLOR]=1 \
6585 .          gcolor
6586 .       SMALLCAPS off
6587 .       CAPS off
6588 .    \}
6589 .    if !'\\*[$SAVED_COVER_TYPE]'' \{\
6590 .      ds $COVER_TYPE \\*[$SAVED_COVER_TYPE]
6591 .      rm $SAVED_COVER_TYPE
6592 .   \}
6593 .END
6594 .
6595 .ALIAS DO_TITLE    DO_TITLE_OR_AUTHOR
6596 .ALIAS DO_SUBTITLE DO_TITLE_OR_AUTHOR
6597 .ALIAS DO_AUTHORS  DO_TITLE_OR_AUTHOR
6598 \#
6599 .MAC DO_CHAPTER END
6600 .    fam \\*[$\\*[DOC_]COVER_CHAPTER_FAM]
6601 .    ft     \\*[$\\*[DOC_]COVER_CHAPTER_FT]
6602 .    ps \\n[#DOC_PT_SIZE]u\\*[$\\*[DOC_]COVER_CHAPTER_SIZE_CHANGE]
6603 .    if \\n[#\\*[DOC_]COVER_CHAPTER_COLOR]=1 \
6604 .       COLOR \\*[$\\*[DOC_]COVER_CHAPTER_COLOR]
6605 .    if \\n[#\\*[DOC_]COVER_CHAPTER_CAPS]=1 .CAPS
6606 .    if \\n[#\\*[DOC_]COVER_CHAPTER_SMALLCAPS]=1 .SMALLCAPS
6607 .    ie \\n[#\\*[DOC_]COVER_CHAPTER_UNDERLINE] \{\
6608 .       ds $TITLE_TYPE \\*[$COVER_TYPE]CHAPTER
6609 .       ie \\n[#\\*[DOC_]COVER_CHAPTER_UNDERLINE]=2 \
6610 .          UNDERSCORE2 \\*[$\\*[DOC_]COVER_CHAPTER_UNDERLINE_GAP] \
6611 \\*[$\\*[DOC_]COVER_CHAPTER_RULE_GAP] "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"
6612 .       el .UNDERSCORE "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"
6613 .    \}
6614 .    el .PRINT "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"
6615 .    gcolor
6616 .    SMALLCAPS off
6617 .    CAPS off
6618 .END
6619 .
6620 .ALIAS DO_TITLE    DO_TITLE_OR_AUTHOR
6621 .ALIAS DO_SUBTITLE DO_TITLE_OR_AUTHOR
6622 .ALIAS DO_AUTHORS  DO_TITLE_OR_AUTHOR
6623 \#
6624 .MAC DO_CHAPTER END
6625 .    fam \\*[$\\*[DOC_]COVER_CHAPTER_FAM]
6626 .    ft     \\*[$\\*[DOC_]COVER_CHAPTER_FT]
6627 .    ps \\n[#DOC_PT_SIZE]u\\*[$\\*[DOC_]COVER_CHAPTER_SIZE_CHANGE]
6628 .    if \\n[#\\*[DOC_]COVER_CHAPTER_COLOR]=1 \
6629 .       COLOR \\*[$\\*[DOC_]COVER_CHAPTER_COLOR]
6630 .    if \\n[#\\*[DOC_]COVER_CHAPTER_CAPS]=1 .CAPS
6631 .    if \\n[#\\*[DOC_]COVER_CHAPTER_SMALLCAPS]=1 .SMALLCAPS
6632 .    ie \\n[#\\*[DOC_]COVER_CHAPTER_UNDERLINE] \{\
6633 .       ds $TITLE_TYPE \\*[$COVER_TYPE]CHAPTER
6634 .       ie \\n[#\\*[DOC_]COVER_CHAPTER_UNDERLINE]=2 \
6635 .          UNDERSCORE2 \\*[$\\*[DOC_]COVER_CHAPTER_UNDERLINE_GAP] \
6636 \\*[$\\*[DOC_]COVER_CHAPTER_RULE_GAP] "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"
6637 .       el .UNDERSCORE "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"
6638 .    \}
6639 .    el .PRINT "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"
6640 .    gcolor
6641 .    SMALLCAPS off
6642 .    CAPS off
6643 .END
6644 \#
6645 \# Spacing adjustments for (doc)cover and docheader elements
6646 \#
6647 .MAC _SPACE END
6648 .   ds $\\$0R \\$1
6649 .END
6650 .
6651 .ds SPACER_TYPE_1 SUBTITLE
6652 .ds SPACER_TYPE_2 ATTRIBUTE
6653 .ds SPACER_TYPE_3 AUTHOR
6654 .ds SPACER_TYPE_4 CHAPTER_TITLE
6655 .ds SPACER_TYPE_5 DOCTYPE
6656 .
6657 .nr #LOOP 0 1
6658 .while \n+[#LOOP]<=5 \{\
6659 .   ALIAS \*[SPACER_TYPE_\n[#LOOP]]_SPACE           _SPACE
6660 .   ALIAS COVER_\*[SPACER_TYPE_\n[#LOOP]]_SPACE     _SPACE
6661 .   ALIAS DOC_COVER_\*[SPACER_TYPE_\n[#LOOP]]_SPACE _SPACE
6662 .\}
6663 \#
6664 .MAC DEFAULT_DOCHEADER END
6665 .    nr #DOCHEADER 1
6666 .    DOC_HEADER_QUAD
6667 .    vs \\n[#DOCHEADER_LEAD]u
6668 .    if \\n[#PRINT_STYLE]=2 \
6669 .       if \\n[#DOCHEADER_COLOR]=1 \
6670 .          COLOR \\*[$DOCHEADER_COLOR]
6671 .    DO_TITLE
6672 .    rr #DOCHEADER
6673 .    if !'\\*[$SUBTITLE_1]'' \{\
6674 .       ds $PRFX SUB
6675 .       if !'\\*[$SUBTITLE_SPACER]'' .sp \\*[$SUBTITLE_SPACER]
6676 .       if \\n[#PRINT_STYLE]=2 \
6677 .          if \\n[#DOCHEADER_COLOR]=1 \
6678 .             COLOR \\*[$DOCHEADER_COLOR]
6679 .       DO_SUBTITLE
6680 .       rm $PRFX
6681 .    \}
6682 .    if !\\n[#NO_PRINT_AUTHOR] \{\
6683 .       if !'\\*[$AUTHOR_1]'' \{\
6684 .          ie \\n[#PRINT_STYLE]=1 \{\
6685 .             TYPEWRITER
6686 .             ie \\n[#SINGLE_SPACE]=1 .vs \\n[#DOC_LEAD]u
6687 .             el .vs \\n[#DOC_LEAD]u/2u
6688 .             sp
6689 .          \}
6690 .          el .vs \\n[#DOC_LEAD]u\\*[$DOCHEADER_LEAD_ADJ]
6691 .          if d$ATTRIBUTE_STRING \{\
6692 .             FAMILY \\*[$ATTRIBUTE_FAM]
6693 .             FT     \\*[$ATTRIBUTE_FT]
6694 .             ps \
6695 \\n[#DOC_PT_SIZE]u\\*[$ATTRIBUTE_SIZE_CHANGE]
6696 .             if \\n[#DOCHEADER_COLOR]=1 \
6697 .                COLOR \\*[$DOCHEADER_COLOR]
6698 .             if \\n[#ATTRIBUTE_COLOR]=1 \
6699 .                COLOR \\*[$ATTRIBUTE_COLOR]
6700 .             if \\n[#ATTRIBUTE_CAPS]=1 .CAPS
6701 .             if !'\\*[$ATTRIBUTE_SPACER]'' \
6702 .                sp \\*[$ATTRIBUTE_SPACER]
6703 .             ie \\n[#ATTRIBUTE_UNDERLINE] \{\
6704 .                ds $TITLE_TYPE ATTRIBUTE
6705 .                ie \\n[#ATTRIBUTE_UNDERLINE]=2 \
6706 .                   UNDERSCORE2 \\*[$ATTRIBUTE_UNDERLINE_GAP] \
6707 \\*[$ATTRIBUTE_RULE_GAP] "\\*[$ATTRIBUTE_STRING]"
6708 .                el .UNDERSCORE "\\*[$ATTRIBUTE_STRING]"
6709 .             \}
6710 .             el .PRINT "\\*[$ATTRIBUTE_STRING]"
6711 .             if \\n[#ATTRIBUTE_COLOR]=1 .gcolor
6712 .             CAPS off
6713 .          \}
6714 .          if !'\\*[$AUTHOR_SPACER]'' .sp \\*[$AUTHOR_SPACER]
6715 .          if \\n[#DOCHEADER_COLOR]=1 \
6716 .             COLOR \\*[$DOCHEADER_COLOR]
6717 .          DO_AUTHORS
6718 .       \}
6719 .    \}
6720 .    FAMILY \\*[$DOC_FAM]
6721 .    FT R
6722 .END
6723 \#
6724 .MAC DEFAULT_DOCHEADER_TYPEWRITE END
6725 .    CENTER
6726 .    TYPEWRITER
6727 .    if !\\n[#SINGLE_SPACE] \{\
6728 .       vs \\n[#DOC_LEAD]u/2u
6729 .       sp |\\n[#T_MARGIN]u-1v
6730 .    \}
6731 .    if !'\\*[$TITLE_1]'' \{\
6732 .       ie \\n[#SINGLE_SPACE] \
6733 .          vs \\n[#DOC_LEAD]u+(\\n[#DOC_LEAD]u/4u)
6734 .       el .vs (\\n[#DOC_LEAD]u/2u)+(\\n[#DOC_LEAD]u/4u)
6735 .       CAPS
6736 .       DO_TITLE
6737 .       CAPS OFF
6738 .       vs
6739 .    \}
6740 .    if !'\\*[$SUBTITLE]'' \{\
6741 .       ds $PRFX SUB
6742 .       sp
6743 .       DO_SUBTITLE
6744 .       rm $PRFX
6745 .    \}
6746 .    if !\\n[#NO_PRINT_AUTHOR] \{\
6747 .       if !'\\*[$AUTHOR_1]'' \{\
6748 .          sp
6749 .          if d$ATTRIBUTE_STRING .PRINT "\\*[$ATTRIBUTE_STRING]
6750 .          sp
6751 .          DO_AUTHORS
6752 .       \}
6753 .    \}
6754 .END
6755 \#
6756 .MAC CHAPTER_DOCHEADER END
6757 .    DOC_HEADER_QUAD
6758 .    FAMILY  \\*[$CHAPTER_FAM]
6759 .    FT      \\*[$CHAPTER_FT]
6760 .    ps \\n[#DOC_PT_SIZE]u\\*[$CHAPTER_SIZE_CHANGE]
6761 .    vs \\n[#DOCHEADER_LEAD]u
6762 .\" Chapter title only
6763 .    ie '\\*[$CHAPTER]'' \{\
6764 .       if \\n[#PRINT_STYLE]=2 \
6765 .          if \\n[#DOCHEADER_COLOR]=1 \
6766 .             COLOR \\*[$DOCHEADER_COLOR]
6767 .       if !'\\*[$CHAPTER_TITLE_1]'' \{\
6768 .          ds $PRFX CHAPTER_
6769 .          nr #DOCHEADER 1
6770 .          DO_TITLE
6771 .          rr #DOCHEADER
6772 .          rm $PRFX
6773 .       \}
6774 .    \}
6775 .\" Chapter string, possibly with a chapter title
6776 .    el \{\
6777 .       if \\n[#PRINT_STYLE]=2 \{\
6778 .          if \\n[#DOCHEADER_COLOR]=1 \
6779 .             COLOR \\*[$DOCHEADER_COLOR]
6780 .          if \\n[#CHAPTER_COLOR]=1 \
6781 .             COLOR \\*[$CHAPTER_COLOR]
6782 .       \}
6783 .       if \\n[#CHAPTER_CAPS]=1 .CAPS
6784 .       ie \\n[#CHAPTER_UNDERLINE] \{\
6785 .          ds $TITLE_TYPE CHAPTER
6786 .          ie \\n[#CHAPTER_UNDERLINE]=2 \
6787 .             UNDERSCORE2 \\*[$CHAPTER_UNDERLINE_GAP] \
6788 \\*[$CHAPTER_RULE_GAP] "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"
6789 .          el .UNDERSCORE "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"
6790 .       \}
6791 .       el .PRINT "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"
6792 .       rm $TITLE_TYPE
6793 .       if \\n[#PRINT_STYLE]=2 \
6794 .          if \\n[#CHAPTER_COLOR]=1 .gcolor
6795 .       CAPS off
6796 .       if !'\\*[$CHAPTER_TITLE_1]'' \{\
6797 .          ds $PRFX CHAPTER_
6798 .          if \\n[#PRINT_STYLE]=2 \{\
6799 .             nr #CHAPTER+TITLE 1
6800 .             if \\n[#DOCHEADER_COLOR]=1 \
6801 .                COLOR \\*[$DOCHEADER_COLOR]
6802 .          \}
6803 .          if !'\\*[$CHAPTER_TITLE_SPACER]'' \
6804 .             sp \\*[$CHAPTER_TITLE_SPACER]
6805 .          DO_TITLE
6806 .          rm $PRFX
6807 .          rr #CHAPTER+TITLE
6808 .          RLD \\n[#DOC_LEAD]u \" Just looks better this way
6809 .       \}
6810 .    \}
6811 .    FAMILY \\*[$DOC_FAM]
6812 .    FT R
6813 .END
6814 \#
6815 .MAC CHAPTER_DOCHEADER_TYPEWRITE END
6816 .    CENTER
6817 .    TYPEWRITER
6818 .    if !\\n[#SINGLE_SPACE] \{\
6819 .       vs \\n[#DOC_LEAD]u/2u
6820 .       sp |\\n[#T_MARGIN]u-1v
6821 .    \}
6822 .    ie '\\*[$CHAPTER]'' \{\
6823 .       CAPS
6824 .       ie !'\\*[$CHAPTER_TITLE]'' \{\
6825 .          vs \\n[.v]u+(\\n[.v]u/3u)
6826 .          nr #ARG_NUM 0 1
6827 .          while \\n[#CHAPTER_TITLE_NUM]>=\\n+[#ARG_NUM] \{\
6828 .             UNDERSCORE 3p "\\*[$CHAPTER_TITLE_\\n[#ARG_NUM]]"
6829 .          \}
6830 .          vs
6831 .       \}
6832 .       el \{\
6833 .          CAPS
6834 .          UNDERSCORE 3p "\\*[$CHAPTER_STRING]"
6835 .       \}
6836 .       CAPS OFF
6837 .       RLD 1v
6838 .    \}
6839 .    el \{\
6840 .       CAPS
6841 .       UNDERSCORE 3p "\\*[$CHAPTER_STRING] \\*[$CHAPTER]
6842 .       CAPS OFF
6843 .       if !'\\*[$CHAPTER_TITLE]'' \{\
6844 .          sp
6845 .          nr #ARG_NUM 0 1
6846 .          while \\n[#CHAPTER_TITLE_NUM]>=\\n+[#ARG_NUM] \{\
6847 .             PRINT "\\*[$CHAPTER_TITLE_\\n[#ARG_NUM]]
6848 .          \}
6849 .       \}
6850 .       sp -1
6851 .    \}
6852 .    vs \\n[#DOC_LEAD]u
6853 .    if \\n[#SINGLE_SPACE] .sp 2
6854 .END
6855 \#
6856 .MAC NAMED_DOCHEADER END
6857 .    DEFAULT_DOCHEADER
6858 .    if !\\n[#NO_PRINT_DOCTYPE] \{\
6859 .       FAMILY  \\*[$DOCTYPE_FAM]
6860 .       FT      \\*[$DOCTYPE_FT]
6861 .       ps \\n[#DOC_PT_SIZE]u\\*[$DOCTYPE_SIZE_CHANGE]
6862 .       vs \\n[#DOCHEADER_LEAD]u
6863 .       ALD     \\n[#DOCHEADER_LEAD]u
6864 .       if \\n[#DOCHEADER_COLOR]=1 \
6865 .          COLOR \\*[$DOCHEADER_COLOR]
6866 .       if \\n[#DOCTYPE_COLOR]=1 \
6867 .          COLOR \\*[$DOCTYPE_COLOR]
6868 .       if \\n[#DOCTYPE_CAPS]=1 .CAPS
6869 .       if !'\\*[$DOCTYPE_SPACER]'' .sp \\*[$DOCTYPE_SPACER]
6870 .       ie \\n[#DOCTYPE_UNDERLINE] \{\
6871 .          ds $TITLE_TYPE DOCTYPE
6872 .          ie \\n[#DOCTYPE_UNDERLINE]=2 \
6873 .              UNDERSCORE2 \\*[$DOCTYPE_UNDERLINE_GAP] \
6874 \\*[$DOCTYPE_RULE_GAP] "\\*[$DOC_TYPE]
6875 .          el .UNDERSCORE "\\*[$DOC_TYPE]
6876 .       \}
6877 .       el .PRINT "\\*[$DOC_TYPE]
6878 .       gcolor
6879 .       CAPS off
6880 .    \}
6881 .    FAMILY \\*[$DOC_FAM]
6882 .    FT R
6883 .END
6884 \#
6885 \# COVER PAGE
6886 \# ----------
6887 \# *Arguments:
6888 \#   TITLE | DOCTITLE | CHAPTER | CHAPTER_TITLE | CHAPTER+TITLE | COVERTITLE \
6889 \#   [ SUBTITLE AUTHOR DOCTYPE COPYRIGHT MISC BLANKPAGE PDF_OUTLINE_LABEL ]
6890 \# *Function:
6891 \#   Toggles the number register for each cover page element
6892 \#   passed as an argument.
6893 \# *Notes:
6894 \#   TITLE, DOCTITLE, CHAPTER, CHAPTER_TITLE or CHAPTER+TITLE must
6895 \#   be supplied.  After that, users may enter as many or as few of
6896 \#   the arguments as they like.  BLANKPAGE inserts a blank page
6897 \#   after the cover.
6898 \#
6899 \#   If called as DOC_COVER, performs the same operations, but
6900 \#   applies everything to a doc cover.
6901 \#
6902 .MAC COVER END
6903 .    rm DOC_
6904 .    ie '\\$0'DOC_COVER' \{\
6905 .       nr #DOC_COVER 1
6906 .       ds DOC_ DOC_
6907 .    \}
6908 .    el .nr #COVER 1
6909 .    nr #ARG_NUM 0 1
6910 .    nr #COVER_ITEM \\n[#NUM_ARGS]  \"loop count
6911 .    if \\n[#NUM_ARGS]=1 \
6912 .       if '\\$1'\\*[DOC_]COVERTEXT' \
6913 .          nr #\\*[DOC_]COVERTEXT_ONLY 1
6914 .    while \\n+[#ARG_NUM]<=\\n[#COVER_ITEM] \{\
6915 .       if '\\$1'DOCTITLE' \{\
6916 .          nr #\\*[DOC_]COVER_TITLE 2
6917 .          shift
6918 .       \}
6919 .       if '\\$1'TITLE' \{\
6920 .          nr #\\*[DOC_]COVER_TITLE 1
6921 .          if \\n[#FROM_\\*[DOC_]COVERTITLE] \{\
6922 .             nr #\\*[DOC_]COVER_TITLE 7
6923 .             rr #FROM_\\*[DOC_]COVERTITLE
6924 .          \}
6925 .          shift
6926 .       \}
6927 .       if '\\$1'CHAPTER' \{\
6928 .          nr #\\*[DOC_]COVER_TITLE 3
6929 .          shift
6930 .       \}
6931 .       if '\\$1'CHAPTER_TITLE' \{\
6932 .          nr #\\*[DOC_]COVER_TITLE 4
6933 .          shift
6934 .       \}
6935 .       if '\\$1'CHAPTER+TITLE' \{\
6936 .          nr #\\*[DOC_]COVER_TITLE 5
6937 .          shift
6938 .       \}
6939 .       if '\\$1'COVERTITLE' \{\
6940 .          nr #COVERTITLE 1
6941 .          nr #\\*[DOC_]COVER_TITLE 6
6942 .          shift
6943 .       \}
6944 .       if '\\$1'DOC_COVERTITLE' \{\
6945 .          nr #DOC_COVERTITLE 1
6946 .          nr #\\*[DOC_]COVER_TITLE 7
6947 .          shift
6948 .       \}
6949 .       if '\\$1'SUBTITLE' \{\
6950 .          nr #\\*[DOC_]COVER_SUBTITLE 1
6951 .          shift
6952 .       \}
6953 .       if '\\$1'AUTHOR' \{\
6954 .          nr #\\*[DOC_]COVER_AUTHOR 1
6955 .          shift
6956 .       \}
6957 .       if '\\$1'DOCTYPE' \{\
6958 .          nr #\\*[DOC_]COVER_DOCTYPE 1
6959 .          shift
6960 .       \}
6961 .       if '\\$1'COPYRIGHT' \{\
6962 .          nr #\\*[DOC_]COVER_COPYRIGHT 1
6963 .          shift
6964 .       \}
6965 .       if '\\$1'MISC' \{\
6966 .          nr #\\*[DOC_]COVER_MISC 1
6967 .          shift
6968 .       \}
6969 .       if '\\$1'\\*[DOC_]COVERTEXT' \{\
6970 .          nr #\\*[DOC_]COVERTEXT 1
6971 .          shift
6972 .       \}
6973 .       if '\\$1'\\*[DOC_]COVER_IMAGE' \{\
6974 .          nr #\\*[DOC_]COVER_IMAGE 1
6975 .          shift
6976 .       \}
6977 .       if '\\$1'PDF_OUTLINE_LABEL' \{\
6978 .          shift
6979 .          ds $PDF_\\*[DOC_]COVER_LABEL \\$1
6980 .          shift
6981 .       \}
6982 .       if '\\$1'BLANKPAGE' \{\
6983 .          nr #\\*[DOC_]COVER_BLANKPAGE 1
6984 .          shift
6985 .       \}
6986 .    \}
6987 .    if '\\$0'DOC_COVER' .rm DOC_
6988 .END
6989 \#
6990 \# COVER TITLE
6991 \# -----------
6992 \# *Arguments:
6993 \#   <covertitle>
6994 \# *Function:
6995 \#   Stores cover title in string(s) for output on cover pages.
6996 \#
6997 .MAC COVERTITLE END
6998 .    rm DOC_
6999 .    if '\\$0'DOC_COVERTITLE' \{\
7000 .       ds DOC_ DOC_
7001 .       nr #FROM_\\*[DOC_]COVERTITLE 1
7002 .    \}
7003 .    ie \\n[#NUM_ARGS]=0 \{\
7004 .       nr argc 0 1
7005 .       while \\n+[argc]<=3 \{\
7006 .          if \\n[#\\*[DOC_]COVER_TITLE_NUM] \{\
7007 .             nr #ITEM 0 1
7008 .             while \\n[#\\*[DOC_]COVERTITLE_NUM]>\\n[#ITEM] \{\
7009 .                rm $\\*[DOC_]COVERTITLE_\\n+[#ITEM]
7010 .             \}
7011 .             rr #\\*[DOC_]COVERTITLE_NUM
7012 .             rm $\\*[DOC_]COVERTITLE
7013 .          \}
7014 .       \}
7015 .    \}
7016 .    el \{\
7017 .       nr #\\*[DOC_]COVERTITLE_NUM 0 1
7018 .       while \\n[#NUM_ARGS]>\\n[#\\*[DOC_]COVERTITLE_NUM] \{\
7019 .          ds \
7020 $\\*[DOC_]COVERTITLE_\\n+[#\\*[DOC_]COVERTITLE_NUM] \\$\\n[#\\*[DOC_]COVERTITLE_NUM]
7021 .          nr #\\*[DOC_]COVERTITLE_NUM \\n[#\\*[DOC_]COVERTITLE_NUM]
7022 .       \}
7023 .       ds $\\*[DOC_]COVERTITLE \\$*
7024 .    \}
7025 .END
7026 \#
7027 .MAC COVER_ATTRIBUTE_STRING END
7028 .    if '\\$0'DOC_COVER_ATTRIBUTE_STRING' \
7029 .       ds DOC_ DOC_
7030 .    ds $\\*[DOC_]COVER_ATTRIBUTE_STRING \\$1 
7031 .    rm DOC_
7032 .END
7033 .
7034 .ALIAS DOC_COVER_ATTRIBUTE_STRING COVER_ATTRIBUTE_STRING
7035 \#
7036 \# COVER TEXT
7037 \# ----------
7038 \# *Arguments:
7039 \#   [ START <vertical pos> ] | <anything>
7040 \# *Function:
7041 \#   With no arg, begins a diversion holding the cover text for
7042 \#   output on the cover page.  With START <pos>, sets a vertical
7043 \#   starting position relative to the top edge of the page.  With
7044 \#   any other arg, ends the diversion.
7045 \# *Notes:
7046 \#   Aliased as DOC_COVERTEXT.
7047 \#
7048 \#   If no other items assigned to cover pages, starts 1/3 of the
7049 \#   way down the cover page unless START pos is given, otherwise
7050 \#   starts underneath the last of title, subtitle, author(s) or
7051 \#   doctype, preceded by a blank line.
7052 \#
7053 \#   Does not persist.
7054 \#
7055 .MAC COVERTEXT END
7056 .    rm DOC_
7057 .    if '\\$0'DOC_COVERTEXT' .ds DOC_ DOC_
7058 .    if '\\$1'START' \{\
7059 .       shift
7060 .       nr #\\*[DOC_]COVERTEXT_START_POS (u;\\$1)
7061 .       shift
7062 .    \}
7063 .    ie '\\$1'' \{\
7064 .       nr #COVERTEXT_PP 1
7065 .       di \\*[DOC_]COVER_TEXT
7066 .       ev 1
7067 \!.     ie !\\n[#\\*[DOC_]COVERTEXT_START_POS] \{\
7068 \!.        sp |\\n[.p]u/3u-1v
7069 \!.     \}
7070 \!.     el \{\
7071 \!.        vs 0
7072 \!.        sp |0i
7073 \!.        vs \\\\n[#DOC_LEAD]u+\\\\*[$\\*[DOC_]COVER_LEAD_ADJ]
7074 \!.        sp |\\n[#\\*[DOC_]COVERTEXT_START_POS]u-1
7075 \!.     \}
7076 \!.     vpt
7077 .    \}
7078 .    el \{\
7079 .       br
7080 \!.     vpt 0
7081 .       ev
7082 .       di
7083 .       rm $FONT
7084 .       rr #COVERTEXT_PP
7085 .       IQ CLEAR
7086 .    \}
7087 .    rm DOC_
7088 .END
7089 .
7090 .ALIAS DOC_COVERTEXT COVERTEXT
7091 \#
7092 \# COVER IMAGE
7093 \# -----------
7094 \#*Arguments:
7095 \#  <image file> <width> <height> [ -L|-C|-R|-I <ind> Y-pos [ X-pos ] ]
7096 \#*Function:
7097 \#  Places an image on doccovers and covers.
7098 \#*Notes:
7099 \#  Aliased as DOC_COVER_IMAGE.
7100 \#
7101 \#  <width> and <height> are required.  With no further args, images
7102 \#  are set at 0,0 by default so that full page images fill the entire
7103 \#  printer sheet.
7104 \#  
7105 \#  Positioning args are the same as PDF_IMAGE.  -L, -R, -C and -I <ind>
7106 \#  observe the left and right margins.
7107 \#
7108 \#  Y-pos is required for all but full page images; without it, images
7109 \#  are flush with the top of the page.  X-pos is only needed if the
7110 \#  user prefers to give absolute X,Y positioning.
7111 \#
7112 \#  Note that Y-pos comes before X-pos in the args.
7113 \#
7114 .MAC COVER_IMAGE END
7115 . if '\\$0'DOC_COVER_IMAGE' .ds DOC_ DOC_
7116 . ds \\*[DOC_]COVER_IMG_FILE \\$1
7117 . nr \\*[DOC_]COVER_IMG_W (z;\\$2)
7118 . nr \\*[DOC_]COVER_IMG_H (z;\\$3)
7119 . if !'\\$4'' \{\
7120 .   ie !\B'\\$4' \{\
7121 .     if '\\$4'-L' .nr \\*[DOC_]COVER_IMG_IND \
7122         \\n[#L_MARGIN]u
7123 .     if '\\$4'-C' .nr \\*[DOC_]COVER_IMG_IND \
7124         \\n[#PAGE_WIDTH]u-\\n[\\*[DOC_]COVER_IMG_W]u/2
7125 .     if '\\$4'-R' .nr \\*[DOC_]COVER_IMG_IND \
7126         \\n[#L_MARGIN]+\\n[.l]u-\\n[\\*[DOC_]COVER_IMG_W]u
7127 .     if '\\$4'-I' \{\
7128 .       nr \\*[DOC_]COVER_IMG_IND \\n[#L_MARGIN]+\\$5
7129 .       if !'\\$6'' .nr \\*[DOC_]COVER_IMG_Y (u;\\$6)
7130 .       shift \\n[#NUM_ARGS]
7131 .     \}
7132 .     if \B'\\$5' .nr \\*[DOC_]COVER_IMG_Y (u;\\$5)
7133 .   \}
7134 .   el \{\
7135 .     nr \\*[DOC_]COVER_IMG_Y (u;\\$4)
7136 .     if \B'\\$5' .nr \\*[DOC_]COVER_IMG_X (u;\\$5)
7137 .   \}
7138 . \}
7139 . rm DOC_
7140 .END
7141 .
7142 .ALIAS DOC_COVER_IMAGE COVER_IMAGE
7143 \#
7144 .MAC DO_COVER_IMAGE END
7145 .    ll \\n[#PAGE_WIDTH]u
7146 .    po 0
7147 .    vs 0
7148 .    sp |0i
7149 .    if \\n[\\*[DOC_]COVER_IMG_Y]   .sp \\n[\\*[DOC_]COVER_IMG_Y]u
7150 .    if \\n[\\*[DOC_]COVER_IMG_X]   .in \\n[\\*[DOC_]COVER_IMG_X]u
7151 .    if \\n[\\*[DOC_]COVER_IMG_IND] .in \\n[\\*[DOC_]COVER_IMG_IND]u
7152 .    if \\n[.u]=1 .nf
7153 .    nop \X'pdf: pdfpic \\*[\\*[DOC_]COVER_IMG_FILE] -L \
7154 \\n[\\*[DOC_]COVER_IMG_W]z \\n[\\*[DOC_]COVER_IMG_H]z'
7155 .    in
7156 .    vs
7157 .    po
7158 .    ll
7159 .END
7160 .
7161 .ALIAS DO_DOC_COVER_IMAGE DO_COVER_IMAGE
7162 \#
7163 \# COVER PAGE LEADING
7164 \# ------------------
7165 \# *Arguments:
7166 \#   <+|- amount by which to in/decrease leading of cover/doc cover>
7167 \# *Function:
7168 \#   Stores user supplied lead in/decrease in string $COVER_LEAD_ADJ
7169 \#   or $DOC_COVER_LEAD_ADJ, depending on whether the macro was called
7170 \#   with an alias (DOC_COVER_LEAD).
7171 \# *Notes:
7172 \#   A unit of measure must be supplied.  Decimal fractions OK.
7173 \#   Default is +0, i.e. same as DOC_LEAD.
7174 \#
7175 .MAC COVER_LEAD END
7176 .    ie '\\$0'DOC_COVER_LEAD' .ds $DOC_COVER_LEAD_ADJ \\$1
7177 .    el .ds $COVER_LEAD_ADJ \\$1
7178 .END
7179 \#
7180 \# MISC_AUTOLEAD functionality has been removed.  Leading for MISCs
7181 \# is now entered as an absolute value.  The macro emits a warning.
7182 \#
7183 .MAC MISC_AUTOLEAD END
7184 .    ds replacement \\$0
7185 .    substring replacement 0 -9
7186 .    ds replacement \\*[replacement]LEAD
7187 .    ds cover-type \\$0
7188 .    substring cover-type 0 2
7189 .    ie '\\*[cover-type]'COV' .ds cover-type cover
7190 .    el .ds cover-type doc-cover
7191 .    tm1 "[mom]: \\$0 at line \\n[.c] of '\\n[.F]' is no longer valid.
7192 .    tm1 "       Leading of \\*[cover-type] MISC items is now set with \\*[replacement], which
7193 .    tm1 "       takes an absolute leading value.  Please update your document.
7194 .    ab   [mom]: Aborting.
7195 .END
7196 .
7197 .ALIAS DOC_COVER_MISC_AUTOLEAD MISC_AUTOLEAD
7198 .ALIAS COVER_MISC_AUTOLEAD     MISC_AUTOLEAD
7199 \#
7200 \# COVER PAGE START POSITION
7201 \# -------------------------
7202 \# *Arguments:
7203 \#   <distance from page top at which to start cover/doc cover>
7204 \# *Function:
7205 \#   Stores user supplied lead in/decrease in #COVER_START_POS
7206 \#   or #DOC_COVER_START_POS, depending on whether the macro was
7207 \#   called by an alias (DOC_COVER_ADVANCE).
7208 \# *Notes:
7209 \#   A unit of measure must be supplied.  Decimal fractions OK.
7210 \#   If user doesn't invoke this macro, the default starting
7211 \#   position for both covers and doc covers is 1/3 of the way
7212 \#   down the page (setup in DO_COVER).
7213 \#
7214 .MAC COVER_ADVANCE END
7215 .    ds COVER_TYPE \\$0
7216 .    substring COVER_TYPE 0 2
7217 .    ie 'COVER_TYPE'DOC' .nr #DOC_COVER_START_POS (\\$1)
7218 .    el .nr #COVER_START_POS (\\$1)
7219 .END
7220 .
7221 .ALIAS DOC_COVER_ADVANCE   COVER_ADVANCE
7222 .ALIAS DOC_COVER_START_POS COVER_ADVANCE
7223 .ALIAS COVER_ADVANCE       COVER_ADVANCE
7224 .ALIAS COVER_START_POS     COVER_ADVANCE
7225 \#
7226 \# COVERS - WHETHER TO PRINT
7227 \# -------------------------
7228 \# *Arguments:
7229 \#   <none> | <anything>
7230 \# *Function:
7231 \#   Creates or removes registers #COVERS and #COVERS_OFF, checked for
7232 \#   in DEFAULTS (in START) prior to printing
7233 \#
7234 .MAC COVERS END
7235 .    ie '\\$0'DOC_COVERS' \{\
7236 .       ie '\\$1'' \{\
7237 .          rr #DOC_COVERS_OFF
7238 .          nr #DOC_COVERS 1
7239 .       \}
7240 .       el \{\
7241 .          rr #DOC_COVERS
7242 .          nr #DOC_COVERS_OFF 1
7243 .       \}
7244 .    \}
7245 .    el \{\
7246 .       ie '\\$1'' \{\
7247 .          rr #COVERS_OFF
7248 .          nr #COVERS 1
7249 .       \}
7250 .       el \{\
7251 .          rr #COVERS
7252 .          nr #COVERS_OFF 1
7253 .       \}
7254 .    \}
7255 .END
7256 \#
7257 \# COVER_COUNTS_PAGES
7258 \# ------------------
7259 \# *Arguments:
7260 \#   <none> | <anything>
7261 \# *Function:
7262 \#   Creates or removes registers #COVERS_COUNT or #DOCCOVERS_COUNT,
7263 \#   used in END_COVER to determine whether to increment the page
7264 \#   number silently when doc covers or covers are output.
7265 \#
7266 .MAC COVER_COUNTS_PAGES END
7267 .    if '\\$0'DOC_COVER_COUNTS_PAGES' \{\
7268 .       ie '\\$1'' .nr #DOCCOVERS_COUNT 1
7269 .       el .rr #DOCCOVERS_COUNT
7270 .       return
7271 .    \}
7272 .    if '\\$0'COVER_COUNTS_PAGES' \{\
7273 .       ie '\\$1'' .nr #COVERS_COUNT 1
7274 .       el .rr #COVERS_COUNT
7275 .       return
7276 .    \}
7277 .END
7278 \#
7279 .MAC DO_COVER END
7280 .    nr #DOING_COVER 1
7281 .    ev COVER
7282 .    evc 0
7283 .    vpt 0
7284 .    if \\n[#PAGINATE]=1 \{\
7285 .       nr #PAGINATION_WAS_ON 1
7286 .       rr #PAGINATE
7287 .    \}
7288 .    if \\n[#HEADERS_ON]=1 \{\
7289 .       nr #HEADERS_WERE_ON 1
7290 .       HEADERS OFF
7291 .    \}
7292 .    if \\n[#FOOTERS_ON]=1 \{\
7293 .       nr #FOOTERS_WERE_ON 1
7294 .       FOOTERS OFF
7295 .    \}
7296 .    if \\n[#COLUMNS]=1 \{\
7297 .       nr #COLUMNS_WERE_ON 1
7298 .       rr #COLUMNS
7299 .    \}
7300 .    ds PDF_BM
7301 .    ie '\\$0'DO_DOC_COVER' \{\
7302 .       ds  DOC_  DOC_
7303 .       nr #DOC_COVER_DONE 1
7304 .       if '\\*[$PDF_DOC_COVER_LABEL]'' \
7305 .          ds $PDF_DOC_COVER_LABEL Cover:
7306 .    \}
7307 .    el \
7308 .       if '\\*[$PDF_COVER_LABEL]'' \
7309 .          ds $PDF_COVER_LABEL Title Page:
7310 .    ds $COVER_TYPE \\*[DOC_]COVER_
7311 .    if !r#\\*[DOC_]COVER_START_POS \
7312 .       nr #\\*[DOC_]COVER_START_POS \\n[#PAGE_LENGTH]/3
7313 .    if \\n[#PRINT_STYLE]=1 \
7314 .       if !\\n[#SINGLE_SPACE]=1 .vs \\n[#DOC_LEAD]u/2u
7315 .    if \\n[#PRINT_STYLE]=2 \{\
7316 .       vs \\n[#DOC_LEAD]u\\*[$\\*[DOC_]COVER_LEAD_ADJ]
7317 .       nr #\\*[DOC_]COVER_LEAD \\n[.v]
7318 .    \}
7319 .    if \\n[.ns] .rs
7320 .    if '\\$0'DO_COVER' \{\
7321 .       if \\n[TOC.RELOCATE]==5 \
7322 .          if !rTOC_BH .TOC_BEFORE_HERE
7323 .    \}
7324 .    if '\\$0'DO_DOC_COVER' \{\
7325 .       if \\n[TOC.RELOCATE]==3 \
7326 .          if !rTOC_BH .TOC_BEFORE_HERE
7327 .    \}
7328 .    RV_HARD_SET_MARGINS
7329 .\" Cover image
7330 .    if \\n[#\\*[DOC_]COVER_IMAGE]=1 \{\
7331 .       DO_\\*[DOC_]COVER_IMAGE
7332 .       rr #\\*[DOC_]COVER_IMAGE
7333 .    \}
7334 .\" Start cover
7335 .    sp |\\n[#\\*[DOC_]COVER_START_POS]u-1v
7336 .    if !\\n[#PRINT_STYLE]=1 \
7337 .       if \\n[#\\*[DOC_]COVER_COLOR]=1 \
7338 .          COLOR \\*[$\\*[DOC_]COVER_COLOR]
7339 .    \\*[DOC_]COVER_H_POS
7340 .    if \\n[#\\*[DOC_]COVER_TITLE]=2 .ds DOC DOC
7341 .    fam \\*[$\\*[DOC_]COVER_\\*[DOC]TITLE_FAM]
7342 .    ft  \\*[$\\*[DOC_]COVER_\\*[DOC]TITLE_FT]
7343 .    ps  \\*[$\\*[DOC_]COVER_\\*[DOC]TITLE_SIZE_CHANGE]
7344 .    ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
7345 .    el .vs \\n[#\\*[DOC_]COVER_LEAD]u
7346 .    nr PDFHREF.VIEW.LEADING \\n[PDFHREF.VIEW.LEADING.C]
7347 .\" Title and/or doctitle
7348 .    if (\\n[#\\*[DOC_]COVER_TITLE]=1):(\\n[#\\*[DOC_]COVER_TITLE]=2) \{\
7349 .       ie \\n[#PRINT_STYLE]=1 \{\
7350 .          vs \\n[.v]u*2u
7351 .          sp -1.5
7352 .          CAPS
7353 .          nr #ARG_NUM 0 1
7354 .          while \\n[#TITLE_NUM]>=\\n+[#ARG_NUM] \{\
7355 .             UNDERSCORE "\\*[$TITLE_\\n[#ARG_NUM]]"
7356 .             if \\n[#ARG_NUM]>1 .as PDF_BM " \"
7357 .             as PDF_BM \\*[$TITLE_\\n[#ARG_NUM]]
7358 .          \}
7359 .          CAPS OFF
7360 .          vs
7361 .       \}
7362 .       el \{\
7363 .          DO_TITLE
7364 .          rm $PRFX
7365 .       \}
7366 .       PDF_BOOKMARK 1 \\*[$PDF_\\*[DOC_]COVER_LABEL] \\*[PDF_BM]
7367 .    \}
7368 .\" Chapter
7369 .    if \\n[#\\*[DOC_]COVER_TITLE]=3 \{\
7370 .       ie \\n[#PRINT_STYLE]=1 \{\
7371 .          CAPS
7372 .          UNDERSCORE "\\*[$CHAPTER_STRING] \\*[$CHAPTER]
7373 .          CAPS OFF
7374 .       \}
7375 .       el .DO_CHAPTER
7376 .       PDF_BOOKMARK 1 \
7377 \\*[$PDF_\\*[DOC_]COVER_LABEL] \\*[$CHAPTER_STRING] \\*[$CHAPTER]
7378 .       if \\n[#\\*[DOC_]COVER_CHAPTER_CAPS]=1 .CAPS off
7379 .    \}
7380 .\" Chapter title
7381 .    if \\n[#\\*[DOC_]COVER_TITLE]=4 \{\
7382 .       ie \\n[#PRINT_STYLE]=1 \{\
7383 .          CAPS
7384 .          nr #ARG_NUM 0 1
7385 .          vs \\n[.v]u*2u
7386 .          sp -1.5
7387 .             while \\n[#CHAPTER_TITLE_NUM]>=\\n[#ARG_NUM] \{\
7388 .                UNDERSCORE "\\*[$CHAPTER_TITLE_\\n+[#ARG_NUM]]"
7389 .                if \\n[#ARG_NUM]>1 .as PDF_BM " \"
7390 .                as PDF_BM \\*[$CHAPTER_TITLE_\\n[#ARG_NUM]]
7391 .             \}
7392 .          CAPS OFF
7393 .          vs
7394 .       \}
7395 .       el \{\
7396 .          ds $PRFX CHAPTER_
7397 .          DO_TITLE
7398 .          rm $PRFX
7399 .       \}
7400 .       PDF_BOOKMARK 1 \\*[$PDF_\\*[DOC_]COVER_LABEL] \\*[PDF_BM]
7401 .    \}
7402 .\" Chapter + chapter title
7403 .    if \\n[#\\*[DOC_]COVER_TITLE]=5 \{\
7404 .       ie \\n[#PRINT_STYLE]=1 \{\
7405 .          CAPS
7406 .          UNDERSCORE "\\*[$CHAPTER_STRING] \\*[$CHAPTER]
7407 .          CAPS OFF
7408 .       \}
7409 .       el .DO_CHAPTER
7410 .       if !'\\*[$CHAPTER_TITLE_1]'' \{\
7411 .          ie \\n[#PRINT_STYLE]=1 \{\
7412 .             ie \\n[#SINGLE_SPACE]=0 .vs \\n[#DOC_LEAD]u/2u
7413 .             el .vs \\n[#DOC_LEAD]u
7414 .             sp
7415 .             nr #ARG_NUM 0 1
7416 .             while \\n[#CHAPTER_TITLE_NUM]>=\\n+[#ARG_NUM] \{\
7417 .                PRINT "\\*[$CHAPTER_TITLE_\\n[#ARG_NUM]]"
7418 .                if \\n[#ARG_NUM]>1 .as PDF_BM " \"
7419 .                as PDF_BM \\*[$CHAPTER_TITLE_\\n[#ARG_NUM]]
7420 .             \}
7421 .             if \\n[#SINGLE_SPACE]=0 .vs \\n[#DOC_LEAD]u
7422 .          \}
7423 .          el \{\
7424 .             ds $PRFX CHAPTER_
7425 .             if \\n[#PRINT_STYLE]=2 .nr #CHAPTER+TITLE 1
7426 .             if !'\\*[$\\*[DOC_]COVER_CHAPTER_TITLE_SPACER]'' \
7427 .                sp \\*[$\\*[DOC_]COVER_CHAPTER_TITLE_SPACER]
7428 .             DO_TITLE
7429 .             rr #CHAPTER+TITLE
7430 .             rm $PRFX
7431 .          \}
7432 .       \}
7433 .       PDF_BOOKMARK 1 \\*[$PDF_\\*[DOC_]COVER_LABEL] \\*[PDF_BM]
7434 .    \}
7435 .\"  (Doc)covertitle
7436 .\"    Titles to (doc)covers that are entered with
7437 .\"      .TITLE DOC_COVER title
7438 .\"    and included in (DOC)COVER with TITLE get treated as
7439 .\"    (DOC_)COVERTITLEs, so we define the appropriate strings and
7440 .\"    registers from their (DOC_)COVER_TITLE equivalents.
7441 .\"
7442 .    if (\\n[#\\*[DOC_]COVER_TITLE]=6):(\\n[#\\*[DOC_]COVER_TITLE]=7) \{\
7443 .       ds $\\*[DOC_]COVER_\\*[DOC_]COVERTITLE_FAM \
7444 \\*[$\\*[DOC_]COVER_TITLE_FAM]
7445 .       ds $\\*[DOC_]COVER_\\*[DOC_]COVERTITLE_FT \
7446 \\*[$\\*[DOC_]COVER_TITLE_FT]
7447 .       ds $\\*[DOC_]COVER_\\*[DOC_]COVERTITLE_COLOR \
7448 \\*[$\\*[DOC_]COVER_TITLE_COLOR]
7449 .       nr #\\*[DOC_]COVER_\\*[DOC_]COVERTITLE_COLOR \
7450 \\n[#\\*[DOC_]COVER_TITLE_COLOR]
7451 .       nr #\\*[DOC_]COVER_\\*[DOC_]COVERTITLE_CAPS  \
7452 \\n[#\\*[DOC_]COVER_TITLE_CAPS]
7453 .       nr #\\*[DOC_]COVER_\\*[DOC_]COVERTITLE_SMALLCAPS  \
7454 \\n[#\\*[DOC_]COVER_TITLE_SMALLCAPS]
7455 .       ds $\\*[DOC_]COVER_\\*[DOC_]COVERTITLE_LEAD  \
7456 \\*[$\\*[DOC_]COVER_TITLE_LEAD]
7457 .       ds $\\*[DOC_]COVER_\\*[DOC_]COVERTITLE_SIZE_CHANGE \
7458 \\*[$\\*[DOC_]COVER_TITLE_SIZE_CHANGE]
7459 .       nr #\\*[DOC_]COVER_\\*[DOC_]COVERTITLE_UNDERLINE \
7460 \\n[#\\*[DOC_]COVER_TITLE_UNDERLINE]
7461 .       nr #\\*[DOC_]COVER_\\*[DOC_]COVERTITLE_UNDERLINE_WEIGHT \
7462 \\n[#\\*[DOC_]COVER_TITLE_UNDERLINE_WEIGHT]
7463 .       nr #\\*[DOC_]COVER_\\*[DOC_]COVERTITLE_UNDERLINE_WEIGHT_ADJ \
7464 \\n[#\\*[DOC_]COVER_TITLE_UNDERLINE_WEIGHT_ADJ]
7465 .       ds $\\*[DOC_]COVER_\\*[DOC_]COVERTITLE_UNDERLINE_GAP \
7466 \\*[$\\*[DOC_]COVER_TITLE_UNDERLINE_GAP]
7467 .       ds $\\*[DOC_]COVER_\\*[DOC_]COVERTITLE_RULE_GAP \
7468 \\*[$\\*[DOC_]COVER_TITLE_RULE_GAP]
7469 .       ie \\n[#PRINT_STYLE]=1 \{\
7470 .          CAPS
7471 .          vs \\n[.v]u*2u
7472 .          nr #ARG_NUM 0 1
7473 .          while \\n[#\\*[DOC_]COVERTITLE_NUM]>=\\n+[#ARG_NUM] \{\
7474 .             UNDERSCORE "\\*[$\\*[DOC_]COVERTITLE_\\n[#ARG_NUM]]"
7475 .                if \\n[#ARG_NUM]>1 .as PDF_BM " \"
7476 .                as PDF_BM \\*[$\\*[DOC_]COVERTITLE_\\n[#ARG_NUM]]
7477 .          \}
7478 .          vs
7479 .          CAPS OFF
7480 .       \}
7481 .       el \{\
7482 .          ds $PRFX \\*[DOC_]COVER
7483 .          DO_TITLE
7484 .          rm $PRFX
7485 .       \}
7486 .       PDF_BOOKMARK 1 \\*[$PDF_\\*[DOC_]COVER_LABEL] \\*[PDF_BM]
7487 .    \}
7488 .    ie !'\\*[DOC_]'' \
7489 .       if !\\n[#DOC_COVER_TITLE] .PDF_BOOKMARK 1 Cover page
7490 .    el \
7491 .       if !\\n[#COVER_TITLE] .PDF_BOOKMARK 1 Title page
7492 .    rr #\\*[DOC_]COVER_TITLE
7493 .\" Subtitle
7494 .    if \\n[#\\*[DOC_]COVER_SUBTITLE]=1 \{\
7495 .       ie \\n[#PRINT_STYLE]=1 \{\
7496 .          if !'\\*[$\\*[DOC_]COVER_SUBTITLE_1]'' \
7497 .             ds $PRFX \\*[DOC_]COVER_
7498 .          sp 2
7499 .          nr #ARG_NUM 0 1
7500 .          while \\n[#\\*[$PRFX]SUBTITLE_NUM]>=\\n+[#ARG_NUM] \{\
7501 .             PRINT "\\*[$\\*[$PRFX]SUBTITLE_\\n[#ARG_NUM]]"
7502 .          \}
7503 .          rm $PRFX
7504 .       \}
7505 .       el \{\
7506 .          ie !'\\*[$\\*[DOC_]COVER_SUBTITLE_1]'' .ds $PRFX \\*[DOC_]COVER_SUB
7507 .          el .ds $PRFX SUB
7508 .          if !'\\*[$\\*[DOC_]COVER_SUBTITLE_SPACER]'' \
7509 .             sp \\*[$\\*[DOC_]COVER_SUBTITLE_SPACER]
7510 .          DO_SUBTITLE
7511 .          rm $PRFX
7512 .       \}
7513 .    \}
7514 .    if \\n[#PRINT_STYLE]=1 \
7515 .       if !r#\\*[DOC_]COVER_SUBTITLE .sp
7516 .\" Author (plus attribution)
7517 .    if \\n[#\\*[DOC_]COVER_AUTHOR]=1 \{\
7518 .       ie \\n[#PRINT_STYLE]=1 \
7519 .          sp
7520 .       el \{\
7521 .          ie !'\\*[$\\*[DOC_]COVER_AUTHOR_LEAD]'' \
7522 .             vs \\*[$\\*[DOC_]COVER_AUTHOR_LEAD]
7523 .          el .vs \\n[#\\*[DOC_]COVER_LEAD]u
7524 .       \}
7525 .       if '\\*[$\\*[DOC_]COVER_ATTRIBUTE_STRING]'' \
7526 .          ds $\\*[DOC_]COVER_ATTRIBUTE_STRING \
7527               \\*[$ATTRIBUTE_STRING]
7528 .       ie !\\n[#PRINT_STYLE]=1 \{\
7529 .          fam \\*[$\\*[DOC_]COVER_ATTRIBUTE_FAM]
7530 .          ft  \\*[$\\*[DOC_]COVER_ATTRIBUTE_FT]
7531 .          ps \
7532 \\n[#DOC_PT_SIZE]u\\*[$\\*[DOC_]COVER_ATTRIBUTE_SIZE_CHANGE]
7533 .          if \\n[#\\*[DOC_]COVER_ATTRIBUTE_COLOR]=1 \
7534 .             COLOR \\*[$\\*[DOC_]COVER_ATTRIBUTE_COLOR]
7535 .          if \\n[#\\*[DOC_]COVER_ATTRIBUTE_CAPS]=1 .CAPS
7536 .          if \\n[#\\*[DOC_]COVER_ATTRIBUTE_SMALLCAPS]=1 .SMALLCAPS
7537 .          if !'\\*[$\\*[DOC_]COVER_ATTRIBUTE_SPACER]'' \
7538 .             sp \\*[$\\*[DOC_]COVER_ATTRIBUTE_SPACER]
7539 .          ie \\n[#\\*[DOC_]COVER_ATTRIBUTE_UNDERLINE] \{\
7540 .             ds $TITLE_TYPE \\*[DOC_]COVER_ATTRIBUTE
7541 .             ie \\n[#\\*[DOC_]COVER_ATTRIBUTE_UNDERLINE]=2 \
7542 .                UNDERSCORE2 \\*[$\\*[DOC_]COVER_ATTRIBUTE_UNDERLINE_GAP] \
7543 \\*[$\\*[DOC_]COVER_ATTRIBUTE_RULE_GAP] "\\*[$\\*[DOC_]COVER_ATTRIBUTE_STRING]"
7544 .             el .UNDERSCORE \\*[$\\*[DOC_]COVER_ATTRIBUTE_STRING] 
7545 .          \}
7546 .          el .PRINT "\\*[$\\*[DOC_]COVER_ATTRIBUTE_STRING]"
7547 .          SMALLCAPS off
7548 .          CAPS off
7549 .          if \\n[#\\*[DOC_]COVER_ATTRIBUTE_COLOR]=1 \
7550 .             gcolor
7551 .       \}
7552 .       el \
7553 .          PRINT "\\*[$\\*[DOC_]COVER_ATTRIBUTE_STRING]"
7554 .       ie \\n[#PRINT_STYLE]=1 .sp
7555 .       el \{\
7556 .          if !'\\*[$\\*[DOC_]COVER_AUTHOR_SPACER]'' \
7557 .             sp \\*[$\\*[DOC_]COVER_AUTHOR_SPACER]
7558 .       \}
7559 .       if '\\$0'COVER' \
7560 .          ds $PRFX COVER_
7561 .       if '\\$0'DOC_COVER' \
7562 .          ds $PRFX DOC_COVER_
7563 .       DO_AUTHORS
7564 .       rm $PRFX
7565 .    \}
7566 .\" Named doctype string
7567 .    if \\n[#DOC_TYPE]=3 \{\
7568 .       if \\n[#\\*[DOC_]COVER_DOCTYPE]=1 \{\
7569 .          ie \\n[#PRINT_STYLE]=1 \{\
7570 .             TYPEWRITER
7571 .             sp 1.5
7572 .             UNDERSCORE2 3p 2p "\\*[$DOC_TYPE]
7573 .          \}
7574 .          el \{\
7575 .             fam \\*[$\\*[DOC_]COVER_DOCTYPE_FAM]
7576 .             ft  \\*[$\\*[DOC_]COVER_DOCTYPE_FT]
7577 .             ps \
7578 \\n[#DOC_PT_SIZE]u\\*[$\\*[DOC_]COVER_DOCTYPE_SIZE_CHANGE]
7579 .             if \\n[#\\*[DOC_]COVER_DOCTYPE_COLOR]=1 \
7580 .                COLOR \\*[$\\*[DOC_]COVER_DOCTYPE_COLOR]
7581 .          sp
7582 .          if \\n[#\\*[DOC_]COVER_DOCTYPE_CAPS]=1 .CAPS
7583 .          if \\n[#\\*[DOC_]COVER_DOCTYPE_SMALLCAPS]=1 .SMALLCAPS
7584 .          if !'\\*[$\\*[DOC_]COVER_DOCTYPE_SPACER]'' \
7585 .             sp \\*[$\\*[DOC_]COVER_DOCTYPE_SPACER]
7586 .          ie \\n[#\\*[DOC_]COVER_DOCTYPE_UNDERLINE] \{\
7587 .             ds $TITLE_TYPE \\*[DOC_]COVER_DOCTYPE
7588 .             ie \\n[#\\*[DOC_]COVER_DOCTYPE_UNDERLINE]=2 \
7589 .                UNDERSCORE2 \\*[$\\*[DOC_]COVER_DOCTYPE_UNDERLINE_GAP] \
7590 \\*[$\\*[DOC_]COVER_DOCTYPE_RULE_GAP] "\\*[$DOC_TYPE]"
7591 .             el .UNDERSCORE "\\*[$DOC_TYPE]" 
7592 .          \}
7593 .          el .PRINT "\\*[$DOC_TYPE]"
7594 .          SMALLCAPS off
7595 .          CAPS off
7596 .          if \\n[#\\*[DOC_]COVER_DOCTYPE_COLOR]=1 \
7597 .             gcolor
7598 .          \}
7599 .       \}
7600 .    \}
7601 .\" Covertext
7602 .    if \\n[#\\*[DOC_]COVERTEXT]=1 \{\
7603 .       nr #DOING_COVERTEXT 1
7604 .       if !\\n[#\\*[DOC_]COVERTEXT_START_POS] .sp
7605 .       if \\n[#\\*[DOC_]COVERTEXT]=1 \{\
7606 .          ev \\*[DOC_]COVERTEXT
7607 .          nf
7608 .          \\*[DOC_]COVER_TEXT
7609 .          ev
7610 .       \}
7611 .       rr #\\*[DOC_]COVERTEXT
7612 .       rm \\*[DOC_]COVER_TEXT
7613 .       rr #DOING_COVERTEXT
7614 .       rr #\\*[DOC_]COVERTEXT_START_POS
7615 .    \}
7616 .    sp |\\n[#VISUAL_B_MARGIN]u
7617 .\" Copyright
7618 .    ie \\n[#PRINT_STYLE]=1 \
7619 .       if !\\n[#SINGLE_SPACE] .sp
7620 .    el \{\
7621 .       fam \\*[$\\*[DOC_]COVER_COPYRIGHT_FAM]
7622 .       ft  \\*[$\\*[DOC_]COVER_COPYRIGHT_FT]
7623 .       ps \\n[#DOC_PT_SIZE]u\\*[$\\*[DOC_]COVER_COPYRIGHT_SIZE_CHANGE]
7624 .       nr #COPYRIGHT_V_POS \\n[#DOC_LEAD]-\\n[.v]
7625 .       sp \\n[#COPYRIGHT_V_POS]u
7626 .       rr #COPYRIGHT_V_POS
7627 .    \}
7628 .    if \\n[#\\*[DOC_]COVER_COPYRIGHT]=1 \{\
7629 .       QUAD \\*[$\\*[DOC_]COVER_COPYRIGHT_QUAD]
7630 .       if \\n[#\\*[DOC_]COVER_COPYRIGHT_COLOR]=1 \
7631 .          COLOR \\*[$\\*[DOC_]COVER_COPYRIGHT_COLOR]
7632 .       ie !'\\*[$COPYRIGHT_V_ADJ]'' \
7633 .          PRINT \v'\\*[$COPYRIGHT_V_ADJ]'\\*[$\\*[DOC_]COVER_COPYRIGHT]
7634 .       el \
7635 .          PRINT \\*[$\\*[DOC_]COVER_COPYRIGHT]
7636 .       if \\n[#\\*[DOC_]COVER_COPYRIGHT_COLOR]=1 \
7637 .          gcolor
7638 .    \}
7639 .    sp |\\n[#VISUAL_B_MARGIN]u
7640 .\" Misc
7641 .    if \\n[#\\*[DOC_]COVER_MISC]=1 \{\
7642 .       if \\n[#PRINT_STYLE]=2 \{\
7643 .          fam \\*[$\\*[DOC_]COVER_MISC_FAM]
7644 .          ft  \\*[$\\*[DOC_]COVER_MISC_FT]
7645 .          ps \\n[#DOC_PT_SIZE]u\\*[$\\*[DOC_]COVER_MISC_SIZE_CHANGE]
7646 .          vs \\*[$\\*[DOC_]COVER_MISC_LEAD]
7647 .          if \\n[#\\*[DOC_]COVER_MISC_COLOR]=1 \
7648 .             COLOR \\*[$\\*[DOC_]COVER_MISC_COLOR]
7649 .       \}
7650 .       ie !'\\*[$\\*[DOC_]COVER_MISC_1]'' \{\
7651 .          QUAD \\*[$\\*[DOC_]COVER_MISC_QUAD]
7652 .          da MISC_DIV
7653 .          nr #NEXT_MISC 0 1
7654 .          while \\n[#\\*[DOC_]COVER_MISC_LINES]>=\\n+[#NEXT_MISC] \{\
7655 .             nop \\*[$\\*[DOC_]COVER_MISC_\\n[#NEXT_MISC]]
7656 .             br
7657 .          \}
7658 .          da
7659 .       \}
7660 .       el \{\
7661 .          QUAD \\*[$MISC_QUAD]
7662 .          da MISC_DIV
7663 .          nr #NEXT_MISC 0 1
7664 .          while \\n[#MISC_LINES]>=\\n+[#NEXT_MISC] \{\
7665 .             nop \\*[$MISC_\\n[#NEXT_MISC]]
7666 .             br
7667 .          \}
7668 .          da
7669 .       \}
7670 .       nr #MISC_V_ADJ \\n[#DOC_LEAD]-\\n[.v]
7671 .       sp \\n[#MISC_V_ADJ]u
7672 .       sp -\\n[dn]u+1
7673 .       nf
7674 .       MISC_DIV
7675 .       if \\n[#MISC_COLOR]=1 .gcolor
7676 .       if \\n[#\\*[DOC_]COVER_MISC_COLOR]=1 .gcolor
7677 .       rm MISC_DIV
7678 .       rr #MISC_DEPTH
7679 .    \}
7680 .    if \\n[TOC.RELOCATE]==1 \{\
7681 .       if !\\n[#COVER_BLANKPAGE] \
7682 .          if !rTOC_BH .TOC_AFTER_HERE
7683 .    \}
7684 .    if '\\$0'DO_COVER' \{\
7685 .       if \\n[TOC.RELOCATE]==6 \
7686 .          if !rTOC_BH .TOC_AFTER_HERE
7687 .    \}
7688 .    if '\\$0'DO_DOC_COVER' \{\
7689 .       if \\n[TOC.RELOCATE]==4 \
7690 .          if !rTOC_BH .TOC_AFTER_HERE
7691 .    \}
7692 .    if '\\$0'DO_DOC_COVER' .rm DOC_
7693 .    END_COVER
7694 .END
7695 \#
7696 \# Macro to terminate (doc)cover processing
7697 \#
7698 .MAC END_COVER END
7699 .    EOL
7700 .    vpt
7701 .    if '\\*[$COVER_TYPE]'DOC_COVER_' .ds DOC DOC
7702 .    rm $COVER_TYPE
7703 .    if \\n[#DOC_TYPE]=5 .nr #SKIP 1
7704 .    nr #END_COVER 1
7705 .    NEWPAGE
7706 .    rr #NEWPAGE
7707 .    rr #SKIP
7708 .    if \\n[#PAGINATION_WAS_ON]=1 .nr % +1
7709 .    ie \\n[#\\*[DOC]COVER_BLANKPAGE]=1 \{\
7710 .       if \\n[TOC.RELOCATE] \
7711 .          if !\\n[#TOC_BH] .TOC_AFTER_HERE
7712 .\" Without the empty PDF_BOOKMARK, (doc)cover BLANKPAGE causes
7713 .\" the PDF outline to place the first doc or chapter before the TOC,
7714 .\" even though PDF output is correct.
7715 .       PDF_BOOKMARK 1
7716 .       nop \&
7717 .       bp
7718 .       rr #\\*[DOC]COVER_BLANKPAGE
7719 .       if !\\n[#\\*[DOC]COVERS_COUNT]=1 .nr % -2
7720 .    \}
7721 .    el \
7722 .       if !\\n[#\\*[DOC]COVERS_COUNT]=1 .nr #PAGE_NUM_ADJ -1
7723 .    if !'\\n[.ev]'0' .ev
7724 .    if \\n[#PAGINATION_WAS_ON] \{\
7725 .       rr #PAGINATION_WAS_ON
7726 .       PAGINATE
7727 .       PAGENUMBER \\n%+\\n[#PAGE_NUM_ADJ]-1
7728 .    \}
7729 .    if \\n[#HEADERS_WERE_ON] \{\
7730 .       rr #HEADERS_WERE_ON
7731 .       HEADERS
7732 .    \}
7733 .    if \\n[#FOOTERS_WERE_ON] \{\
7734 .       rr #FOOTERS_WERE_ON
7735 .       FOOTERS
7736 .    \}
7737 .    if \\n[#COLUMNS_WERE_ON]=1 \{\
7738 .       rr #COLUMNS_WERE_ON 1
7739 .       nr #COLUMNS 1
7740 .    \}
7741 .    rr #DOING_COVER
7742 .    if \\n[.ns] .nop \&
7743 .    if \\n[#RECTO_VERSO] .nr #RV_POST_COVER 1
7744 .END
7745 \#
7746 \# +++START THE DOCUMENT+++
7747 \#
7748 \# THE START MACRO
7749 \# ---------------
7750 \# *Arguments:
7751 \#   <none>
7752 \# *Function:
7753 \#   Macro to start document processing.  Reads in default document
7754 \#   style parameters and any parameters the user has changed before
7755 \#   issuing START.  Using the information gathered in the opening
7756 \#   macros, prints appropriate title (or chapter #), subtitle,
7757 \#   author and document type (if appropriate).
7758 \# *Notes:
7759 \#   The .PRINT \& (zero-width character) is required to get the
7760 \#   subsequent .sp request to work as advertised.
7761 \#
7762 \#   The overall document line length, family, and point-size
7763 \#   are stored in #DOC_L_LENGTH, $DOC_FAM, and #DOC_PT_SIZE for
7764 \#   use in the HEADER and FOOTER macros.
7765 \#
7766 .MAC START END
7767 .    nr #DOCS 1
7768 .    if \\n[TOC.RELOCATE]==2 \
7769 .       if !\\n[TOC_BH] .TOC_BEFORE_HERE
7770 .    if !n .nop \X'ps: exec 0 setlinejoin'\X'ps: exec 0 setlinecap'
7771 .    if !\\n[#PRINT_STYLE] \{\
7772 .       PRINTSTYLE TYPEWRITE
7773 .       PRINT \&
7774 .       po 6P
7775 .       ll 39P
7776 .       ta \\n[.l]u
7777 .       sp |1i-1v
7778 .       CENTER
7779 .       PRINT "You neglected to enter a PRINTSTYLE."
7780 .       ab [mom]: PRINTSTYLE missing.  Aborting '\\n[.F]'.
7781 .    \}
7782 .    if \\n[#LINENUMBERS]=1 \{\
7783 .       nm
7784 .       NUMBER_LINES OFF
7785 .       nr #LINENUMBERS 2
7786 .    \}
7787 .    if \\n[#COLLATE] \{\
7788 .       COPYSTYLE \\*[$COPY_STYLE]
7789 .       nr #HEADERS_ON \\n[#HEADER_STATE]
7790 .       if \\n[#PAGE_NUM_V_POS]=1 .nr #PAGINATE \\n[#PAGINATION_STATE]
7791 .       PRINT \&
7792 .       if !'\\*[$RESTORE_PAGENUM_STYLE]'' \{\
7793 .          PAGENUM_STYLE \\*[$RESTORE_PAGENUM_STYLE]
7794 .          rm $RESTORE_PAGENUM_STYLE
7795 .       \}
7796 .       if \\n[#PAGINATE_WAS_ON] \{\
7797 .          PAGINATE
7798 .          rr #PAGINATE_WAS_ON
7799 .       \}
7800 .    \}
7801 .    DEFAULTS
7802 .    nr #PAGE_TOP \\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
7803 .    rr #RESET_TRAPS
7804 .    if !r#EN_Q_AUTOLEAD  .nr #EN_Q_LEAD \\n[#EN_LEAD]
7805 .    if !r#EN_BQ_AUTOLEAD .nr #EN_BQ_LEAD \\n[#EN_LEAD]
7806 .\"  TOC/recto-verso stuff
7807 .    nr @L_MARGIN \\n[#DOC_L_MARGIN]
7808 .    nr @R_MARGIN \\n[#DOC_R_MARGIN]
7809 .\" Covers and doc covers
7810 .    if \\n[#DOC_COVERS]=1 \
7811 .       if \\n[#DOC_COVER]=1 .DO_DOC_COVER
7812 .    if \\n[#COVERS]=1 \
7813 .       if \\n[#COVER]=1 .DO_COVER
7814 .    nr PDFHREF.VIEW.LEADING \\n[PDFHREF.VIEW.LEADING.T]
7815 .    if !\\n[#TOC] .RV_HARD_SET_MARGINS
7816 .    if \\n[#COLUMNS] .COLUMNS \\n[#NUM_COLS] \\n[#GUTTER]u
7817 .    sp |\\n[#DOCHEADER_ADVANCE]u-\\n[#DOC_LEAD]u
7818 .\" Collect TITLE for TOC.
7819 .    if !\\n[#TOC]=1 \{\
7820 .       nr #TOC_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
7821 .       af #TOC_ENTRY_PN \\g[#PAGENUMBER]
7822 .       ie \\n[#USER_SET_TITLE_ITEM] \{\
7823 .          ds $TOC_TITLE_ITEM \\*[$USER_SET_TITLE_ITEM]
7824 .          rr #USER_SET_TITLE_ITEM
7825 .          rm $USER_SET_TITLE_ITEM
7826 .       \}
7827 .       el \{\
7828 .          ie \\n[#DOC_TYPE]=2 \{\
7829 .             ie '\\*[$CHAPTER_TITLE]'' \
7830 .                ds $TOC_TITLE_ITEM \\*[$CHAPTER_STRING] \\*[$CHAPTER]
7831 .             el \{\
7832 .                ie '\\*[$CHAPTER]'' \
7833 .                   ds $TOC_TITLE_ITEM \\*[$CHAPTER_TITLE]
7834 .                el \
7835 .                   ds $TOC_TITLE_ITEM \
7836 \\*[$CHAPTER_STRING] \\*[$CHAPTER]: \\*[$CHAPTER_TITLE]
7837 .             \}
7838 .          \}
7839 .          el \
7840 .             ds $TOC_TITLE_ITEM \\*[$TITLE]
7841 .       \}
7842 .       if \\n[#TOC_AUTHORS]=1 \{\
7843 .          ie '\\*[$TOC_AUTHORS]'' \
7844 .             as $TOC_TITLE_ITEM / \\*[$AUTHOR_1]
7845 .          el \{\
7846 .             as $TOC_TITLE_ITEM / \\*[$TOC_AUTHORS]
7847 .             rm $TOC_AUTHORS
7848 .          \}
7849 .       \}
7850 .       as $TOC_TITLE_ITEM \|
7851 .       if \\n[#PREFIX_CH_NUM] \
7852 .          ds $TOC_CH_NUM \
7853               \\n[#CH_NUM].\[toc-hd-num-spacer]
7854 .       if \\n[#TOC_PREFIX_CH_NUM] \{\
7855 .          rn $TOC_TITLE_ITEM $TOC_TITLE_ITEM_OLD
7856 .          ds $TOC_CH_NUM \
7857               \\n[#CH_NUM].\[toc-hd-num-spacer]
7858 .          if (\\n[#PAD_TOC_CH_NUM]=2)&(\\n[#CH_NUM]<10) \
7859 .                ds $TOC_CH_NUM \h'\w'\0'u'\\*[$TOC_CH_NUM]
7860 .          if \\n[#PAD_TOC_CH_NUM]=3 \{\
7861 .             if \\n[#CH_NUM]<10 \
7862 .                ds $TOC_CH_NUM \h'\w'\0'u*2u'\\*[$TOC_CH_NUM]
7863 .             if (\\n[#CH_NUM]>=10)&(\\n[#CH_NUM]<100) \
7864 .                ds $TOC_CH_NUM \h'\w'\0'u'\\*[$TOC_CH_NUM]
7865 .          \}
7866 .          if \\n[#PAD_TOC_CH_NUM]=4 \{\
7867 .             if \\n[#CH_NUM]<10 \
7868 .                ds $TOC_CH_NUM \h'\w'\0'u*3u'\\*[$TOC_CH_NUM]
7869 .             if (\\n[#CH_NUM]>=10)&(\\n[#CH_NUM]<100) \
7870 .                ds $TOC_CH_NUM \h'\w'\0'u*2u'\\*[$TOC_CH_NUM]
7871 .             if (\\n[#CH_NUM]>=100)&(\\n[#CH_NUM]<1000) \
7872 .                ds $TOC_CH_NUM \h'\w'\0'u'\\*[$TOC_CH_NUM]
7873 .          \}
7874 .          ds $TOC_TITLE_ITEM \\*[$TOC_CH_NUM]\\*[$TOC_TITLE_ITEM_OLD]
7875 .          rm $TOC_TITLE_ITEM_OLD
7876 .       \}
7877 .    \}
7878 .    if !\\n[#TOC] \{\
7879 .       if !'\\*[$TOC_TITLE_ITEM]'' \{\
7880 .          PDF_BOOKMARK 1 \\*[$TOC_TITLE_ITEM]
7881 .          TITLE_TO_TOC
7882 .       \}
7883 .    \}
7884 .    if !\\n[#TOC] .nr #POST_TOP 1
7885 .\" End TITLE collection
7886 .    if \\n[#PRINT_PAGENUM_ON_PAGE_1] \{\
7887 .       if \\n[#PAGE_NUM_V_POS]=1 \{\
7888 .          br
7889 .          sp |\\n[#HEADER_MARGIN]u
7890 .          PRINT_PAGE_NUMBER
7891 .       \}
7892 .    \}
7893 .    rr #COLLATE
7894 .    rr #PAGINATION_STATE
7895 .\" End collate stuff
7896 .    sp |\\n[#DOCHEADER_ADVANCE]u-\\n[#DOC_LEAD]u
7897 .    ie \\n[#DOC_HEADER]=0 \{\
7898 .       if \\n[.ns] .rs
7899 .       if \\n[#DOC_TYPE]=4 \
7900 .          if !'\\n[.z]'' .di
7901 .       nr #STORED_PP_INDENT \\n[#PP_INDENT]
7902 .       PARA_INDENT 0
7903 .       PP
7904 .       PARA_INDENT \\n[#STORED_PP_INDENT]u
7905 .       rr #STORED_PP_INDENT
7906 .       ie r#ADVANCE_FROM_TOP \{\
7907 .          br
7908 .          sp |\\n[#ADVANCE_FROM_TOP]u-1v
7909 .          if \\n[#ADJ_DOC_LEAD]=1 \
7910 .             if !\\n[#DOCHEADER_NO_SHIM] .SHIM_1
7911 .       \}
7912 .       el \{\
7913 .          br
7914 .          sp |\\n[#T_MARGIN]u-1v
7915 .       \}
7916 .       if \\n[#COLUMNS] \{\
7917 .          mk dc
7918 .          nr #COL_NUM 0 1
7919 .          po \\n[#COL_\\n+[#COL_NUM]_L_MARGIN]u
7920 .          nr #L_MARGIN \\n[.o]
7921 .          ll \\n[#COL_L_LENGTH]u
7922 .       \}
7923 .       nr #PP 0
7924 .    \}
7925 .    el \{\
7926 .       if \\n[#AUTO_LEAD] .nr #RESTORE_AUTO_LEAD 1
7927 .       nr #CURRENT_LEAD \\n[.v]
7928 .       if \\n[#PRINT_STYLE]=2 .vs \\n[#DOC_LEAD]u\\*[$DOCHEADER_LEAD_ADJ]
7929 .       nr #DOCHEADER_LEAD_DIFF \\n[#CURRENT_LEAD]-\\n[.v]
7930 .       sp +\\n[#DOCHEADER_LEAD_DIFF]u
7931 .       if \\n[#RESTORE_AUTO_LEAD] \{\
7932 .          nr #AUTO_LEAD 1
7933 .          nr #AUTOLEAD_VALUE  \\n[#SAVED_AUTOLEAD_VALUE]
7934 .       \}
7935 .       nr #DOCHEADER_LEAD \\n[.v]
7936 .       vpt 0
7937 .\" Default doctype
7938 .       if \\n[#DOC_TYPE]=1 \{\
7939 .          if \\n[.ns] \{\
7940 .             rs
7941 .             nop \&
7942 .             sp -1
7943 .          \}
7944 .          ev DOCHEADER
7945 .          evc 0
7946 .          L_MARGIN \\n[#DOC_L_MARGIN]u
7947 .          LL       \\n[#DOC_L_LENGTH]u
7948 .          ta \\n[.l]u
7949 .          if \\n[#PRINT_STYLE]=1 .DEFAULT_DOCHEADER_TYPEWRITE
7950 .          if \\n[#PRINT_STYLE]=2 .DEFAULT_DOCHEADER
7951 .          ev
7952 .       \}
7953 .\" Chapter doctype
7954 .       if \\n[#DOC_TYPE]=2 \{\
7955 .          if \\n[.ns] .rs
7956 .          ev DOCHEADER
7957 .          evc 0
7958 .          if \\n[#DOCHEADER_COLOR]=1 \
7959 .             COLOR \\*[$DOCHEADER_COLOR]
7960 .          L_MARGIN \\n[#DOC_L_MARGIN]u
7961 .          LL       \\n[#DOC_L_LENGTH]u
7962 .          ta \\n[.l]u
7963 .          if \\n[#PRINT_STYLE]=1 .CHAPTER_DOCHEADER_TYPEWRITE
7964 .          if \\n[#PRINT_STYLE]=2 .CHAPTER_DOCHEADER
7965 .          ev
7966 .       \}
7967 .\" Named
7968 .       if \\n[#DOC_TYPE]=3 \{\
7969 .          if \\n[.ns] \{\
7970 .             rs
7971 .             nop \&
7972 .             sp -1
7973 .          \}
7974 .          ev DOCHEADER
7975 .          evc 0
7976 .          if \\n[#DOCHEADER_COLOR]=1 \
7977 .             COLOR \\*[$DOCHEADER_COLOR]
7978 .          L_MARGIN \\n[#DOC_L_MARGIN]u
7979 .          LL       \\n[#DOC_L_LENGTH]u
7980 .          ta \\n[.l]u
7981 .          if \\n[#PRINT_STYLE]=1 \{\
7982 .             DEFAULT_DOCHEADER_TYPEWRITE
7983 .             if !\\n[#NO_PRINT_DOCTYPE] \{\
7984 .                sp
7985 .                UNDERSCORE2 3p 2p "\\*[$DOC_TYPE]"
7986 .             \}
7987 .          \}
7988 .          if \\n[#PRINT_STYLE]=2 .NAMED_DOCHEADER
7989 .          ev
7990 .       \}
7991 .       if !\\n[#DOC_TYPE]=4 \{\
7992 .          if \\n[#PRINT_STYLE]=1 .sp
7993 .          if \\n[#PRINT_STYLE]=2 .sp \\n[#DOC_LEAD]u*2u
7994 .          if \\n[#COLUMNS] \{\
7995 .             nr #COL_NUM 0 1
7996 .             nr #L_LENGTH_FOR_EPI \\n[#L_LENGTH]
7997 .             ie \\n[#RV_POST_COVER] \{\
7998 .                nr #COL_\\n+[#COL_NUM]_L_MARGIN \\n[#DOC_L_MARGIN]
7999 .                po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
8000 .                nr #L_MARGIN \\n[.o]
8001 .                rr #RV_POST_COVER
8002 .             \}
8003 .             el \{\
8004 .                po \\n[#COL_\\n+[#COL_NUM]_L_MARGIN]u
8005 .                nr #L_MARGIN \\n[.o]
8006 .             \}
8007 .             LL \\n[#COL_L_LENGTH]u
8008 .             ta \\n[.l]u
8009 .          \}
8010 .       \}
8011 .       nr #NO_PRINT_AUTHOR  1
8012 .       nr #NO_PRINT_DOCTYPE 1
8013 .    \}
8014 .    vs \\n[#DOC_LEAD]u
8015 .    if \\n[#PRINT_STYLE]=1 \
8016 .       if \\n[#SINGLE_SPACE]=1 .sp
8017 .    if \\n[#ADJ_DOC_LEAD]=1 \
8018 .       if \\n[#ADVANCE_FROM_TOP]=0 \
8019 .          if \\n[#DOC_HEADER]=1 \
8020 .             if !\\n[#DOCHEADER_NO_SHIM] .SHIM_1
8021 .    if \\n[#COLUMNS] .mk dc
8022 .    FAMILY \\*[$DOC_FAM]
8023 .    QUAD \\*[$DOC_QUAD]
8024 .    CLEANUP_DEFAULTS
8025 .    nr #START_FOR_FOOTERS 1
8026 .    if !\\n[#DOC_TYPE]=4 .em TERMINATE
8027 .    if \\n[#LINENUMBERS]=2 \{\
8028 .       ie \\n[#PER_SECTION] .NUMBER_LINES 1
8029 .       el .NUMBER_LINES RESUME
8030 .       nr #LINENUMBERS 1
8031 .    \}
8032 .    if \\n[#RUN_ON]=1 \{\
8033 .       if \\n[#FN_MARKER_STYLE]=1 .RUNON_WARNING
8034 .       if \\n[#FN_MARKER_STYLE]=2 .RUNON_WARNING
8035 .    \}
8036 .    nr PDFHREF.VIEW.LEADING \\n[PDFHREF.VIEW.LEADING.H]
8037 .    vpt
8038 .    if !r flex .nr flex 1
8039 .    nr flex-spaces 0
8040 .\" If one-page, don't flex.
8041 .    if !dPDF.EXPORT \{\
8042 .       if \\n[#FLEX_ACTIVE] \{\
8043 .          if !\\n[#NO_FLEX] \{\
8044 .             if d pre-toc-\\n%@\\n[#COL_NUM] \
8045 .                nr #NO_FLEX 1
8046 .             if d pre-list-\\n%@\\n[#COL_NUM] \
8047 .                nr #NO_FLEX 1
8048 .             if d page-\\n%@\\n[#COL_NUM] \
8049 .                nr #NO_FLEX 1
8050 .             if '\\*[last-page]'\\n%@\\n[#COL_NUM]' \
8051 .                nr #NO_FLEX 1
8052 .          \}
8053 .       \}
8054 .    \}
8055 .    if \\n[#DOC_TYPE]=5 \{\
8056 .       if \\n[#HDRFTR_BOTH] \
8057 .          HEADER_RECTO \\*[$HDR_RECTO_QUAD] "\\*[$HDR_RECTO_STRING]"
8058 .       if \\n[#SLIDE_HEADERS] .HEADER
8059 .       if \\n[#HDRFTR_BOTH] \
8060 .          FOOTER_RECTO \\*[$FTR_RECTO_QUAD] "\\*[$FTR_RECTO_STRING]"
8061 .       if \\n[#SLIDE_FOOTERS] \
8062 .          PRINT_FOOTER
8063 .       sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
8064 .       vpt
8065 .    \}
8066 .END
8067 \#
8068 .MAC RR_ADVANCE_FROM_TOP END
8069 .    rr #ADVANCE_FROM_TOP
8070 .    ch RR_ADVANCE_FROM_TOP
8071 .END
8072 \#
8073 .MAC CLEANUP_DEFAULTS END
8074 .    nr #START 1
8075 .    if \\n[#DOC_HEADER]=1 .nr #DOC_HEADER 2
8076 .    rm $TOC_TITLE_ITEM
8077 .    rr #MISC_NUM
8078 .    rr #MISCS
8079 .    rr #NEXT_AUTHOR
8080 .    rr #NEXT_MISC
8081 .    wh \\n[nl]u+1u RR_ADVANCE_FROM_TOP
8082 .    rr #DOCHEADER_NO_SHIM
8083 .END
8084 \#
8085 \# ====================================================================
8086 \#
8087 \# +++MACROS TO CHANGE SOME DEFAULTS+++
8088 \#
8089 \# DOCUMENT HEADER
8090 \# ---------------
8091 \# *Argument:
8092 \#   <none> | <anything> [distance to advance from top of page] [NO_SHIM]
8093 \# *Function:
8094 \#   Turns printing of document header on or off.  If a second
8095 \#   numeric argument with units of measure is given, advances that
8096 \#   distance from the top of the page without printing the document
8097 \#   header.
8098 \# *Notes:
8099 \#   Default is on.  If the 1st argument is <anything> (which turns
8100 \#   document headers off), the optional 2nd argument may be given
8101 \#   (with a unit of measure).
8102 \#
8103 .MAC DOCHEADER END
8104 .    if \\n[#NUM_ARGS]=0 .nr #DOC_HEADER 1
8105 .    if \\n[#NUM_ARGS]=1 \{\
8106 .       ie '\\$1'NO_SHIM' .nr #DOCHEADER_NO_SHIM 1
8107 .       el .nr #DOC_HEADER 0
8108 .    \}
8109 .    if \\n[#NUM_ARGS]>1 \{\
8110 .       nr #DOC_HEADER 0
8111 .       if \B'\\$2' .nr #ADVANCE_FROM_TOP \\$2
8112 .       if '\\$3'NO_SHIM' .nr #DOCHEADER_NO_SHIM 1
8113 .    \}
8114 .END
8115 \#
8116 \# DOCUMENT HEADER LEADING
8117 \# -----------------------
8118 \# *Arguments:
8119 \#   <+|- amount by which to in/decrease leading of doc header>
8120 \# *Function:
8121 \#   Stores user supplied lead in/decrease in string $DOCHEADER_LEAD_ADJ.
8122 \# *Notes:
8123 \#   A unit of measure must be supplied.  Decimal fractions OK.
8124 \#   Default is +0, i.e. same as DOC_LEAD.
8125 \#
8126 .MAC DOCHEADER_LEAD END
8127 .    ds $DOCHEADER_LEAD_ADJ \\$1
8128 .END
8129 \#
8130 \# DOCHEADER ADVANCE
8131 \# -----------------
8132 \# *Arguments:
8133 \#   <docheader start position>
8134 \# *Function:
8135 \#   Creates register #DOCHEADER_ADVANCE, used in START.
8136 \# *Notes:
8137 \#   Unit of measure required.
8138 \#   Default is same as T_MARGIN.
8139 \#
8140 .MAC DOCHEADER_ADVANCE END
8141 .    nr #DOCHEADER_ADVANCE \\$1
8142 .END
8143 \#
8144 \# DOCUMENT LEFT MARGIN
8145 \# --------------------
8146 \# *Argument:
8147 \#   <left margin of document>
8148 \# *Function:
8149 \#   Creates or modifies register #DOC_L_MARGIN.
8150 \# *Notes:
8151 \#   Affects everything on the page.
8152 \#
8153 .MAC DOC_LEFT_MARGIN END
8154 .    if !\\n[#DOCS] .DOC_MACRO_ERROR \\$0
8155 .    br
8156 .    nr #DOC_L_MARGIN (\\$1)
8157 .    L_MARGIN \\n[#DOC_L_MARGIN]u
8158 .END
8159 \#
8160 \# DOCUMENT RIGHT MARGIN
8161 \# ---------------------
8162 \# *Argument:
8163 \#   <right margin of document>
8164 \# *Function:
8165 \#   Creates or modifies register #DOC_R_MARGIN.
8166 \# *Notes:
8167 \#   Affects everything on the page.
8168 \#
8169 .MAC DOC_RIGHT_MARGIN END
8170 .    br
8171 .    nr #DOC_R_MARGIN (\\$1)
8172 .    R_MARGIN \\n[#DOC_R_MARGIN]
8173 .    nr #DOC_L_LENGTH \\n[#L_LENGTH]
8174 .END
8175 \#
8176 \# DOCUMENT LINE LENGTH
8177 \# --------------------
8178 \# *Argument:
8179 \#   <line length of document>
8180 \# *Function:
8181 \#   Creates or modifies register #DOC_L_LENGTH.
8182 \# *Notes:
8183 \#   Affects everything on the page.
8184 \#
8185 .MAC DOC_LINE_LENGTH END
8186 .    if !\\n[DOCS] .DOC_MACRO_ERROR \\$0
8187 .    br
8188 .    nr #DOC_L_LENGTH (\\$1)
8189 .    LL \\n[#DOC_L_LENGTH]u
8190 .    ta \\n[.l]u
8191 .END
8192 \#
8193 \# DOCUMENT FAMILY
8194 \# ---------------
8195 \# *Argument:
8196 \#   <family of running text>
8197 \# *Function:
8198 \#   Creates or modifies string $DOC_FAM.
8199 \# *Notes:
8200 \#   Affects everything except headers and footers.
8201 \#
8202 .MAC DOC_FAMILY END
8203 .    if !\\n[DOCS] .DOC_MACRO_ERROR \\$0
8204 .    br
8205 .    ds $DOC_FAM \\$1
8206 .    ds $FAMILY  \\*[$DOC_FAM]
8207 .    AUTHOR_FAMILY     \\*[$DOC_FAM]
8208 .    BLOCKQUOTE_FAMILY \\*[$DOC_FAM]
8209 .    DOCHEADER_FAMILY  \\*[$DOC_FAM]
8210 .    DOCTYPE_FAMILY    \\*[$DOC_FAM]
8211 .    EPIGRAPH_FAMILY   \\*[$DOC_FAM]
8212 .    FOOTNOTE_FAMILY   \\*[$DOC_FAM]
8213 .    HDRFTR_FAMILY     \\*[$DOC_FAM]
8214 .    LINENUMBER_FAMILY \\*[$DOC_FAM]
8215 .    QUOTE_FAMILY      \\*[$DOC_FAM]
8216 .    SUBTITLE_FAMILY   \\*[$DOC_FAM]
8217 .    TITLE_FAMILY      \\*[$DOC_FAM]
8218 .END
8219 \#
8220 \# DOCUMENT POINT SIZE
8221 \# -------------------
8222 \# *Argument:
8223 \#   <point size of running text>
8224 \# *Function:
8225 \#   Creates or modifies register #DOC_PT_SIZE.
8226 \# *Notes:
8227 \#   DOC_PT_SIZE is the basis for calculating all type sizes in
8228 \#   a document.  Ignored if PRINTSTYLE TYPEWRITE.
8229 \#
8230 .ALIAS DOC_PT_SIZE PT_SIZE
8231 \#
8232 \# DOCUMENT LEAD
8233 \# -------------
8234 \# *Argument:
8235 \#   <lead (".vs") of running text> [ADJUST]
8236 \# *Function:
8237 \#   Creates or modifies register #DOC_LEAD.  If the optional
8238 \#   ADJUST argument is given, adjusts leading so that the last
8239 \#   line of text falls exactly on #B_MARGIN.
8240 \# *Notes:
8241 \#   DOC_LEAD is the basis for calculating all leading changes in
8242 \#   a document.  Default for TYPESET is 16; 24 for TYPEWRITE.
8243 \#
8244 \#   Because the visible bottom or footer margin of a page depends
8245 \#   on the overall document lead supplied by the register #DOC_LEAD,
8246 \#   DOC_LEAD, in the body of a document, should always be associated
8247 \#   with the start of a new page (in other words, just before or
8248 \#   just after a manual NEWPAGE).  Ignored if PRINTSTYLE TYPEWRITE.
8249 \#
8250 .MAC DOC_LEAD END
8251 .    if \\n[#IGNORE] .return
8252 .    if !\\n[#DOCS] .DOC_MACRO_ERROR \\$0
8253 .    br
8254 .    if '\\$0'DOC_LEAD' \{\
8255 .       vs \\$1
8256 .       rr #DOC_AUTOLEAD
8257 .       rr #DOC_AUTOLEAD_FACTOR
8258 .       nr #DOC_LEAD \\n[.v]
8259 .    \}
8260 .    nr #RESET_TRAPS 1
8261 .    if !\\n[#ADJ_DOC_LEAD] .nr #REMOVE_ADJ 1
8262 .    if !'\\$0'DOC_LEAD' \{\
8263 .       if '\\$0'EN_LEAD'  .nr #DOC_LEAD \\n[#EN_LEAD]
8264 .       if '\\$0'BIB_LEAD' .nr #DOC_LEAD \\n[#BIB_LEAD]
8265 .       if '\\$0'TOC_LEAD' .nr #DOC_LEAD \\n[#TOC_LEAD]
8266 .       if '\\$2'ADJUST'   .TRAPS
8267 .       rr #RESET_TRAPS
8268 .    \}
8269 .END
8270 \#
8271 \# ADJUST DOCUMENT LEAD
8272 \# --------------------
8273 \# *Arguments:
8274 \#   <none> | <anything>
8275 \# *Function:
8276 \#   Adjusts document lead so that the last line of text falls exactly
8277 \#   on #B_MARGIN.
8278 \#
8279 .MAC DOC_LEAD_ADJUST END
8280 .    ie '\\$1'' \{\
8281 .       nr #ADJ_DOC_LEAD 1
8282 .       rr #DOC_LEAD_ADJUST_OFF
8283 .    \}
8284 .    el \{\
8285 .       nr #ADJ_DOC_LEAD 0
8286 .       nr #DOC_LEAD_ADJUST_OFF 1
8287 .    \}
8288 .END
8289 \#
8290 \# SHIM
8291 \# ----
8292 \# *Argument:
8293 \#   None
8294 \# *Function:
8295 \#   Advances to the next valid baseline.
8296 \# *Notes:
8297 \#   If a user plays around with spacing in a doc (say, with ALD),
8298 \#   it isn't easy to get mom back on track so she can achieve
8299 \#   perfectly flush bottom margins.  Any time SHIM is used, it
8300 \#   ensures that the next output line falls on a valid baseline.
8301 \#
8302 \# First, a little convenience macro
8303 \#
8304 .MAC PROCESS_SHIM END
8305 .    if !\\n[nl]=\\n[#VALID_BASELINE] \{\
8306 .       while \\n+[#VALID_BASELINE]<\\n[#CURRENT_V_POS] .
8307 .       nr #SHIM \\n[#VALID_BASELINE]-\\n[#CURRENT_V_POS]
8308 .    \}
8309 .END
8310 \#
8311 \# And a macro to disable SHIM
8312 \#
8313 .MAC NO_SHIM END
8314 .    ie '\\$1'' \{\
8315 .       nr #NO_SHIM 1
8316 .       nr #FLEX_ACTIVE 1
8317 .    \}
8318 .    el \{\
8319 .       rr #NO_SHIM
8320 .       rr #SHIM
8321 .       rr #FLEX_ACTIVE 1
8322 .   \}
8323 .END
8324 \#
8325 .nr #NO_SHIM 2 \" Restored to 1 in DEFAULTS.
8326 \#
8327 .MAC SHIM END
8328 .    if \\n[#NO_SHIM] \
8329 .       if !'\\$0'SHIM_1' .return
8330 .    if !\\n[#NO_FLEX] \{\
8331 .       if !'\\$0'SHIM_1' \{\
8332 .          tm1 "[mom]: 
8333 SHIM, line \\n[.c], is incompatible with flex-spacing, which is enabled.
8334 .          tm1 "       
8335 Flex-spacing must be disabled with NO_FLEX before using SHIM.
8336 .          ab [mom]: Aborting '\\n[.F]', line \\n[.c].
8337 .       \}
8338 .    \}
8339 .    nr #VALID_BASELINE \\n[#T_MARGIN]-\\n[#DOC_LEAD] \\n[#DOC_LEAD]
8340 .    if !r#CURRENT_V_POS .nr #CURRENT_V_POS \\n[.d]
8341 .    ie \\n[#ADVANCE_FROM_TOP] \{\
8342 .       ie \\n[#CURRENT_V_POS]<(\\n[#T_MARGIN]-1v) \{\
8343 .          while \\n-[#VALID_BASELINE]>\\n[#CURRENT_V_POS] .
8344 .          nr #VALID_BASELINE +\\n[#DOC_LEAD]
8345 .          nr #SHIM \\n[#VALID_BASELINE]-\\n[#CURRENT_V_POS]
8346 .       \}
8347 .       el .PROCESS_SHIM
8348 .    \}
8349 .    el .PROCESS_SHIM
8350 .    nr #SHIM_MAX \\n[#DOC_LEAD]*10/15
8351 .    if !\\n[#CALCULATE_ONLY] \{\
8352 .       if !\\n[defer-count] \
8353 .          if \\n[#SHIM]>\\n[#SHIM_MAX] .sp -1
8354 '          sp \\n[#SHIM]u
8355 .       \}
8356 .    rr #CURRENT_V_POS
8357 .END
8358 \#
8359 .ALIAS SHIM_1 SHIM
8360 \#
8361 \# ====================================================================
8362 \#
8363 \# +++FLEX SPACING+++
8364 \#
8365 \# INSERT FLEX SPACE
8366 \# -----------------
8367 \# *Arguments:
8368 \#   FORCE
8369 \# *Function:
8370 \#   Inserts flexible whitespace ("flex-space").
8371 \# *Notes:
8372 \#   FORCE restores flex-spacing if an .ns is preventing it.
8373 \#   Useful in conjunction with deferred floated material that
8374 \#   plants an .ns after outputting the last deferred float.
8375 \#
8376 .MAC FLEX END
8377 .    if !\\n[#NO_SHIM] \{\
8378 .       if \\n[#NO_FLEX] \{\
8379 .          tm1 "[mom]: \
8380 FLEX, line \\n[.c], is incompatible with shimming, which is presently enabled.
8381 .          tm1 "       \
8382 Shimming must be disabled with NO_SHIM before using FLEX.
8383 .          ab   [mom]: Aborting '\\n[.F]', line \\n[.c].
8384 .       \}
8385 .    \}
8386 .    if '\\$1'FORCE' \{\
8387 .       nr flex:force 1
8388 .       return
8389 .    \}
8390 .    if !\\n[#NO_FLEX] \{\
8391 .       if !\\n[.ns] \{\
8392 .          if !\\n[.t]<=\\n[.v] \{\
8393 .             nr flex-spaces +1
8394 .             if dflex-space:\\n[flex]@\\n[#COL_NUM] \{\
8395 .                sp \\*[flex-space:\\n[flex]@\\n[#COL_NUM]]
8396 .             \}
8397 .          \}
8398 .       \}
8399 .    \}
8400 .END
8401 \#
8402 .MAC NO_FLEX END
8403 .    rr flexed
8404 .    ie '\\$1'' \{\
8405 .       nr #NO_FLEX 1
8406 .       if \\n[#FLEX_ACTIVE] .rr #FLEX_ACTIVE
8407 .    \}
8408 .    el \
8409 .       if !\\n[#DOC_TYPE]=5 .rr #NO_FLEX
8410 .END
8411 \#
8412 \# CALCULATE FLEX SPACES
8413 \# ---------------------
8414 \# *Function:
8415 \#   Derives flex-space size by dividing the space remaining before
8416 \#   FOOTER by the number of times FLEX was used on the page/col.
8417 \# *Notes:
8418 \#   .h is reliable for determining space remaining, but can't be used
8419 \#   for columns because it can't be zeroed from one col to the
8420 \#   next.  Workaround is to use nl for columns and compensate for
8421 \#   .br's, .sp's, and .ne's.  Here be dragons.
8422 \#
8423 .MAC CALCULATE_FLEX END
8424 .    nr flex:target-pos \\n[.p]+\\n[#VARIABLE_FOOTER_POS]-1
8425 .    nr flex:current-pos \\n[.h]-\\n[.v]
8426 .    if \\n[#COLUMNS] \{\
8427 .       ie \\n[.trunc] \
8428 .          nr flex:current-pos \\n[nl]-\\n[.v]-(\\n[.trunc]-1)
8429 .       el .nr flex:current-pos \\n[nl]-\\n[.v]
8430 .       if '\\n[.ev]'tbl*end' \{\
8431 .          nr flex:current-pos \\n[nl]-(\\n[.trunc]-1)
8432 .          if \\n[tbl*boxed] .nr flex:current-pos -.65v
8433 .       \}
8434 .       ie \\n[nl-from-heading] \{\
8435 .          nr flex:current-pos \\n[nl-from-heading]-\\n[.v]
8436 .          rr nl-from-heading
8437 .       \}
8438 .       el \{\
8439 .          if !\\n[.pe] \{\
8440 .             if \\n[nl]=(\\n[.p]+(\\n[#VARIABLE_FOOTER_POS]-1)) \
8441 .                nr flex-spaces -1
8442 .          \}
8443 .       \}
8444 .    \}
8445 .    nr flex:space-remaining \
8446         \\n[flex:target-pos]-\\n[flex:current-pos]
8447 .    if \\n[flex-spaces] \{\
8448 .       nr flex-space:\\n[flex]@\\n[#COL_NUM] \
8449            \\n[flex:space-remaining]/\\n[flex-spaces]
8450 .       if dPDF.EXPORT \{\
8451 .          tm .ds flex-space:\\n[flex]@\\n[#COL_NUM] \
8452               \\n[flex-space:\\n[flex]@\\n[#COL_NUM]]u
8453 .\" For debugging: catch edge-cases that result in negative
8454 .\" flex-spacing and don't apply flex to the page/column.
8455 .          if \\n[flex-space:\\n[flex]@\\n[#COL_NUM]]<0 \{\
8456 .             tm .ds flex-space:\\n[flex]@\\n[#COL_NUM] 0
8457 .             tm .ds Negative flex space \\n%@\\n[#COL_NUM] (\\n[flex-space:\\n[flex]@\\n[#COL_NUM]])
8458 .          \}
8459 .       \}
8460 .    \}
8461 .END
8462 \#
8463 \# ====================================================================
8464 \#
8465 \# +++INTERNATIONALIZATION+++
8466 \#
8467 \# ATTRIBUTE STRING
8468 \# ----------------
8469 \# *Argument:
8470 \#   <what goes in the "by" slot before author in the document header>
8471 \# *Function:
8472 \#   Creates or modifies string $ATTRIBUTE_STRING.
8473 \# *Notes:
8474 \#   Default is "by".  A blank string ("") may be used if no
8475 \#   attribution is desired.  Blank line results.
8476 \#
8477 .MAC ATTRIBUTE_STRING END
8478 .    if !'\\$1'DOC_COVER' \
8479 .       if !'\\$1'COVER' .nr #NEITHER 1
8480 .    if !'\\$1'COVER' \
8481 .       if !'\\$1'DOC_COVER' .nr #NEITHER 1
8482 .    if '\\$1'DOC_COVER' \{\
8483 .       ds $DOC_COVER_ATTRIBUTE_STRING \\$2
8484 .       if '\\*[$DOC_COVER_ATTRIBUTE_STRING]'' \
8485 .          ds $DOC_COVER_ATTRIBUTE_STRING \&
8486 .    \}
8487 .    if '\\$1'COVER' \{\
8488 .       ds $COVER_ATTRIBUTE_STRING \\$2
8489 .       if '\\*[$COVER_ATTRIBUTE_STRING]'' \
8490 .          ds $COVER_ATTRIBUTE_STRING \&
8491 .    \}
8492 .    if \\n[#NEITHER]=1 \{\
8493 .       ds $ATTRIBUTE_STRING \\$1
8494 .       rr #NEITHER
8495 .    \}
8496 .END
8497 \#
8498 \# CHAPTER STRING
8499 \# --------------
8500 \# *Argument:
8501 \#   <what to print any time the word "chapter" is required>
8502 \# *Function:
8503 \#   Creates or modifies string $CHAPTER_STRING.
8504 \# *Notes:
8505 \#   Default is "chapter".
8506 \#
8507 .MAC CHAPTER_STRING END
8508 .    ds $CHAPTER_STRING \\$1
8509 .END
8510 \#
8511 \# DRAFT STRING
8512 \# ------------
8513 \# *Argument:
8514 \#   <what to print any time the word "draft" is required>
8515 \# *Function:
8516 \#   Creates or modifies string $DRAFT_STRING.
8517 \# *Notes:
8518 \#   Default is "draft".
8519 \#
8520 .MAC DRAFT_STRING END
8521 .    ds $DRAFT_STRING \\$1
8522 .END
8523 \#
8524 \# REVISION STRING
8525 \# ---------------
8526 \# *Argument:
8527 \#   <what to print any time the word "revision" is required>
8528 \# *Function:
8529 \#   Creates or modifies string $REVISION_STRING.
8530 \# *Notes:
8531 \#   Default is "revision".
8532 \#
8533 .MAC REVISION_STRING END
8534 .    ds $REVISION_STRING \\$1
8535 .END
8536 \#
8537 \# FINIS STRING
8538 \# ------------
8539 \# *Argument:
8540 \#   <what to print with the finis macro>
8541 \# *Function:
8542 \#   Creates or modifies string $FINIS_STRING.
8543 \# *Notes:
8544 \#   Default is "END".
8545 \#
8546 .MAC FINIS_STRING END
8547 .    ds $FINIS_STRING \\$1
8548 .END
8549 \#
8550 \# ====================================================================
8551 \#
8552 \# +++RECTO/VERSO+++
8553 \#
8554 \# RECTO_VERSO
8555 \# -----------
8556 \# *Arguments:
8557 \#   <none> | <anything>
8558 \# *Function:
8559 \#   Switches HDRFTR_LEFT and HDRFTR_RIGHT on alternate pages.  Also
8560 \#   switches page numbers left and right if either is chosen rather
8561 \#   than the default centered page numbers.  Switches left and right
8562 \#   margins if differing values have been entered.
8563 \# *Notes:
8564 \#   Default is OFF.
8565 \#
8566 .MAC RECTO_VERSO END
8567 .    ie '\\$1'' .nr #RECTO_VERSO 1
8568 .    el .nr #RECTO_VERSO 0
8569 .END
8570 \#
8571 \# FORCE RECTO
8572 \# -----------
8573 \# *Function:
8574 \#   Forces doccover and cover pages to recto
8575 \#
8576 .MAC FORCE_RECTO END
8577 .    ie '\\$1'' .nr #FORCE_RECTO 1
8578 .    el .rr #FORCE_RECTO
8579 .END
8580 \#
8581 .MAC RV_HARD_SET_MARGINS END
8582 .    DOC_LEFT_MARGIN  \\n[@L_MARGIN]u
8583 .    DOC_RIGHT_MARGIN \\n[@R_MARGIN]u
8584 .    po \\n[#DOC_L_MARGIN]u
8585 .    LL \\n[#DOC_L_LENGTH]u
8586 .END
8587 \#
8588 \# ====================================================================
8589 \#
8590 \# +++EPIGRAPHS+++
8591 \#
8592 \# EPIGRAPH INDENT
8593 \# ---------------
8594 \# *Argument:
8595 \#   <value by which to multiply PP_INDENT for block epigraphs>
8596 \# *Function:
8597 \#   Creates or modifies register #EPI_OFFSET_VALUE.
8598 \# *Notes:
8599 \#   Default is 2 for TYPEWRITE, 3 for TYPESET.
8600 \#
8601 .MAC EPIGRAPH_INDENT END
8602 .    rr #EPI_OFFSET_VALUE
8603 .    rm $EPI_OFFSET_VALUE
8604 .    ds $EVAL_EI_ARG \\$1
8605 .    substring $EVAL_EI_ARG -1
8606 .    ie \B'\\*[$EVAL_EI_ARG]' .nr #EPI_OFFSET_VALUE \\$1
8607 .    el .ds $EPI_OFFSET_VALUE \\$1
8608 .    rm $EVAL_EI_ARG
8609 .END
8610 \#
8611 \# EPIGRAPH AUTOLEAD
8612 \# -----------------
8613 \# *Argument:
8614 \#   <amount of lead to add to the epigraph ps for epigraph leading>
8615 \# *Function:
8616 \#   Creates or modifies register #EPI_AUTOLEAD.
8617 \# *Notes:
8618 \#   Default is 2 (for TYPESET; TYPEWRITE doesn't require this).
8619 \#
8620 .MAC EPIGRAPH_AUTOLEAD END
8621 .    nr #EPI_AUTOLEAD (p;\\$1)
8622 .END
8623 \#
8624 \# EPIGRAPH
8625 \# --------
8626 \# *Arguments:
8627 \#   BLOCK | <anything>
8628 \# *Function:
8629 \#   Places an epigraph before the document's text, after the
8630 \#   document header, or after a HEAD.
8631 \# *Notes:
8632 \#   #EPIGRAPH 1 = centered; 2 = block
8633 \#
8634 \#   By default, epigraphs are centered, allowing the user
8635 \#   to input them on a line per line basis.  To change this
8636 \#   behaviour, the user can supply the argument BLOCK, which
8637 \#   will produce indented, filled text similar to BLOCKQUOTE.
8638 \#
8639 \#   If a block epigraph contains more than one para, ALL paras of
8640 \#   the epigraph must be preceded by PP.  Otherwise, PP is optional.
8641 \#
8642 .MAC EPIGRAPH END
8643 .    nr #PP_STYLE 2
8644 .    nr #Q_PP     0
8645 .    if \\n[#LINENUMBERS]=1 \{\
8646 .       NUMBER_LINES OFF
8647 .       nr #LINENUMBERS 2
8648 .    \}
8649 .    if \\n[#START] \{\
8650 .       if \\n[#PRINT_STYLE]=1 \
8651 .          if \\n[#AUTHOR_LINES]=1 .sp \\n[#DOC_LEAD]u
8652 .    \}
8653 .    ie '\\$1'' \{\
8654 .       nr #EPIGRAPH 1
8655 .       ev EPIGRAPH
8656 .       nr #IN_DIVER 1
8657 .       ll \\n[#L_LENGTH]u
8658 .       ta \\n[.l]u
8659 .       CHECK_INDENT
8660 .       if \\n[#COLUMNS] \{\
8661 .          ie \\n[#START] \{\
8662 .              ll \\n[#DOC_L_LENGTH]u
8663 .              ta \\n[.l]u
8664 .          \}
8665 .          el \{\
8666 .             ll \\n[#COL_L_LENGTH]u
8667 .             ta \\n[.l]u
8668 .          \}
8669 .       \}
8670 .       CENTER
8671 .       if \\n[#PRINT_STYLE]=1 \{\
8672 .          fam \\*[$TYPEWRITER_FAM]
8673 .          ft  R
8674 .          if '\\*[$EPI_FT]'I' .FT I
8675 .          ps  \\*[$TYPEWRITER_PS]
8676 .          ie \\n[#SINGLE_SPACE] .vs \\n[#DOC_LEAD]u
8677 .          el .vs \\n[#DOC_LEAD]u/2u
8678 .          nr #EPI_LEAD      \\n[#LEAD]
8679 .          nr #EPI_LEAD_DIFF \\n[#DOC_LEAD]-\\n[#EPI_LEAD]
8680 .       \}
8681 .       if \\n[#PRINT_STYLE]=2 \{\
8682 .          FAMILY   \\*[$EPI_FAM]
8683 .          FT       \\*[$EPI_FT]
8684 .          ps  \\n[#DOC_PT_SIZE]u\\*[$EPI_SIZE_CHANGE]
8685 .          if \\n[#EPI_COLOR]=1 \{\
8686 .             nf
8687 \m[\\*[$EPI_COLOR]]
8688 .             EOL
8689 .          \}
8690 .          vs \\n[.ps]u+\\n[#EPI_AUTOLEAD]u
8691 .          nr #EPI_LEAD      \\n[#LEAD]
8692 .          nr #EPI_LEAD_DIFF \\n[#DOC_LEAD]-\\n[#EPI_LEAD]
8693 .       \}
8694 .       di EPI_TEXT
8695 .       nr #DIVERSIONS_HY_MARGIN (p;\\n[.ps]u*2.75)/1000
8696 .       HY_SET 1 \\n[#DIVERSIONS_HY_MARGIN]u (\\n[#PT_SIZE]u/1000u/8u)p
8697 .       hy 14
8698 .       nr #EPI_ACTIVE 1
8699 .    \}
8700 .    el \{\
8701 .       ie '\\$1'BLOCK' \{\
8702 .          nr #EPIGRAPH 2
8703 .          ev EPIGRAPH
8704 .          evc 0
8705 .          ie \\n[#START] \{\
8706 .             ie \\n[#COLUMNS] \{\
8707 .                ie r#EPI_OFFSET_VALUE \
8708 .                   ll \
8709 \\n[#L_LENGTH_FOR_EPI]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
8710 .                el \
8711 .                   ll \
8712 \\n[#L_LENGTH_FOR_EPI]u-(\\*[$EPI_OFFSET_VALUE]u*2u)
8713 .                ta \\n[.l]u
8714 .             \}
8715 .             el \{\
8716 .                ie r#EPI_OFFSET_VALUE \
8717 .                   ll \
8718 \\n[#L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
8719 .                el \
8720 .                   ll \\n[#L_LENGTH]u-(\\*[$EPI_OFFSET_VALUE]*2u)
8721 .                ta \\n[.l]u
8722 .             \}
8723 .          \}
8724 .          el \{\
8725 .             ie r#EPI_OFFSET_VALUE \
8726 .                ll \
8727 \\n[#L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
8728 .             el \
8729 .                ll \\n[#L_LENGTH]u-(\\*[$EPI_OFFSET_VALUE]*2u)
8730 .             ta \\n[.l]u
8731 .             if \\n[#COLUMNS] \{\
8732 .                ie r#EPI_OFFSET_VALUE \
8733 .                   ll \
8734 \\n[#COL_L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
8735 .                el \
8736 .                   ll \\n[#COL_L_LENGTH]u-(\\*[$EPI_OFFSET_VALUE]*2u)
8737 .                ta \\n[.l]u
8738 .             \}
8739 .             CHECK_INDENT
8740 .          \}
8741 .          if \\n[#PRINT_STYLE]=1 \{\
8742 .             fam \\*[$TYPEWRITER_FAM]
8743 .             ft  R
8744 .             if '\\*[$EPI_FT]'I' .FT I
8745 .             ps  \\*[$TYPEWRITER_PS]
8746 .             ie \\n[#SINGLE_SPACE] .vs \\n[#DOC_LEAD]u
8747 .             el .vs \\n[#DOC_LEAD]u/2u
8748 .             QUAD LEFT
8749 .             HY OFF
8750 .             nr #EPI_LEAD \\n[#LEAD]
8751 .             nr #EPI_LEAD_DIFF \\n[#DOC_LEAD]-\\n[#EPI_LEAD]
8752 .             di EPI_TEXT
8753 .             nr #EPI_ACTIVE 1
8754 .          \}
8755 .          if \\n[#PRINT_STYLE]=2 \{\
8756 .             FAMILY   \\*[$EPI_FAM]
8757 .             FT       \\*[$EPI_FT]
8758 .             ps  \\n[#DOC_PT_SIZE]u\\*[$EPI_SIZE_CHANGE]
8759 .             if \\n[#EPI_COLOR]=1 \{\
8760 .                nf
8761 \m[\\*[$EPI_COLOR]]
8762 .                EOL
8763 .             \}
8764 .             vs \\n[.ps]u+\\n[#EPI_AUTOLEAD]u
8765 .             QUAD     \\*[$EPI_QUAD]
8766 .             nr #DIVERSIONS_HY_MARGIN (p;\\n[.ps]u*2.75)/1000
8767 .             HY_SET 1 \\n[#DIVERSIONS_HY_MARGIN]u (\\n[#PT_SIZE]u/1000u/8u)p
8768 .             hy 14
8769 .             nr #EPI_LEAD \\n[#LEAD]
8770 .             nr #EPI_LEAD_DIFF \\n[#DOC_LEAD]-\\n[#EPI_LEAD]
8771 .             di EPI_TEXT
8772 .             nr #EPI_ACTIVE 1
8773 .          \}
8774 .       \}
8775 .       el .DO_EPIGRAPH
8776 .    \}
8777 .END
8778 \#
8779 \# DO EPIGRAPH
8780 \# -----------
8781 \# *Arguments:
8782 \#   <none>
8783 \# *Function:
8784 \#   Ends diversion started in EPIGRAPH.  Makes spacing
8785 \#   adjustments to compensate for the difference between epigraph
8786 \#   leading and overall document leading, so that the bottom of
8787 \#   the pages remain flush.
8788 \# *Notes:
8789 \#   In addition to its usual place at the beginning of a
8790 \#   document, EPIGRAPH may also be used after HEAD.
8791 \#
8792 .MAC DO_EPIGRAPH END
8793 .    br
8794 .    di
8795 .    rr #IN_DIVER
8796 .    if \\n[#RESET_FN_COUNTERS]=2 \{\
8797 .       if !\\n[#FN_COUNT]=1 \{\
8798 .          if ((\\n[#PAGE_LENGTH]+\\n[#VARIABLE_FOOTER_POS])+\\n[#DIVER_DEPTH])>(\\n[#PAGE_LENGTH]+\\n[#VARIABLE_FOOTER_POS]) \{\
8799 .             DIVER_FN_2_POST
8800 .             rr #RESET_FN_COUNTERS
8801 .          \}
8802 .       \}
8803 .    \}
8804 .    nr #SAVED_FN_NUMBER \\n[#FN_NUMBER]
8805 .    nr #DONE_ONCE 0 1
8806 .    REMOVE_INDENT
8807 .    ev
8808 .    nr #EPI_DEPTH \\n[#DIVER_DEPTH]-\\n[#EPI_LEAD]
8809 .    nr #EPI_LINES \\n[#EPI_DEPTH]/\\n[#EPI_LEAD]
8810 .    ie \\n[#START] \{\
8811 .       if !\\n[#NO_SHIM] .RLD \\n[#SHIM]u
8812 .       nr #EPI_WHITESPACE (\\n[#DOC_LEAD]*\\n[#EPI_LINES])-\\n[#EPI_DEPTH]
8813 .       while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
8814 .          nr #EPI_WHITESPACE -\\n[#DOC_LEAD]
8815 .       \}
8816 .       if \\n[#PRINT_STYLE]=1 \
8817 .          if !\\n[#SINGLE_SPACE]=1 .ALD \\n[#DOC_LEAD]u
8818 .       if \\n[#PRINT_STYLE]=2 \{\
8819 .          ie !\\n[#DOC_TYPE]=2 .RLD \\n[#DOC_LEAD]u
8820 .          el \{\
8821 .             ie '\\*[$CHAPTER_TITLE]'' .RLD \\n[#DOC_LEAD]u
8822 .             el .if '\\*[$CHAPTER]''   .RLD \\n[#DOC_LEAD]u
8823 .          \}
8824 .          if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \
8825 .             ALD \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)
8826 .          if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \
8827 .             ALD \
8828 \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)-\\n[#DOC_LEAD]u
8829 .       \}
8830 .    \}
8831 .    el \{\
8832 .       ie \\n[#EPI_DEPTH]<\\n[#TRAP_DISTANCE] \{\
8833 .          nr #EPI_FITS 1
8834 .          nr #EPI_WHITESPACE (\\n[#DOC_LEAD]*\\n[#EPI_LINES])-\\n[#EPI_DEPTH]
8835 .          while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
8836 .             nr #EPI_WHITESPACE -\\n[#DOC_LEAD]
8837 .          \}
8838 .          ie \\n[#PRINT_STYLE]=1 \{\
8839 .             if \\n[#EPI_WHITESPACE]=\\n[#DOC_LEAD] \
8840 .                ALD \\n[#EPI_WHITESPACE]u/2u
8841 .          \}
8842 .          el \{\
8843 .             if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \
8844 .                ALD \
8845 \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)
8846 .             if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \
8847 .                ALD \
8848 \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)-\\n[#DOC_LEAD]u
8849 .          \}
8850 .          if \\n[#DIVER_FN]=2 .rr #DIVER_FN
8851 .       \}
8852 .       el \{\
8853 .          nr #EPI_LINES_TO_TRAP 0 1
8854 .          while \\n[#EPI_LEAD]*\\n+[#EPI_LINES_TO_TRAP]<\\n[#TRAP_DISTANCE] \{\
8855 .             nr #LOOP 1
8856 .          \}
8857 .          nr #EPI_LINES_TO_TRAP -1
8858 .          nr #EPI_WHITESPACE \
8859 (\\n[#EPI_LINES_TO_TRAP]*\\n[#DOC_LEAD])-(\\n[#EPI_LINES_TO_TRAP]*\\n[#EPI_LEAD])
8860 .          while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
8861 .             nr #EPI_WHITESPACE -\\n[#DOC_LEAD]
8862 .          \}
8863 .          if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \
8864 .             ALD \\n[#EPI_WHITESPACE]u
8865 .          if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \
8866 .             ALD \\n[#EPI_WHITESPACE]u-\\n[#DOC_LEAD]u
8867 .       \}
8868 .    \}
8869 .    if \\n[#EPIGRAPH]=1 \{\
8870 .       po \\n[#L_MARGIN]u
8871 .       if \\n[#COLUMNS] \{\
8872 .          po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
8873 .          nr #L_MARGIN \\n[.o]
8874 .       \}
8875 .    \}
8876 .    if \\n[#EPIGRAPH]=2 \{\
8877 .       ie !\\n[#EPI_OFFSET_VALUE]=0 \
8878 .          nr #EPI_OFFSET \
8879 \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
8880 .       el \
8881 .          if !'\\*[$EPI_OFFSET_VALUE]'' \
8882 .             nr #EPI_OFFSET \\n[#L_MARGIN]+\\*[$EPI_OFFSET_VALUE]
8883 .       if \\n[#COLUMNS] \{\
8884 .          ie !\\n[#EPI_OFFSET_VALUE]=0 \
8885 .             nr #EPI_OFFSET \
8886 \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
8887 .          el \
8888 .             if !'\\*[$EPI_OFFSET_VALUE]'' \
8889 .                nr #EPI_OFFSET \
8890 \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+\\*[$EPI_OFFSET_VALUE]
8891 .       \}
8892 .       if !\\n[#EPI_OFFSET]=0 .po \\n[#EPI_OFFSET]u
8893 .    \}
8894 .    nf
8895 .    EPI_TEXT
8896 .    br
8897 .    ie \\n[#START] \{\
8898 .       if \\n[#PRINT_STYLE]=1 .SHIM
8899 .       if \\n[#PRINT_STYLE]=2 \{\
8900 .          if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \
8901 .             ALD \\n[#EPI_WHITESPACE]u/2u
8902 .          if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \
8903 .             ALD (\\n[#EPI_WHITESPACE]u/2u)-\\n[#DOC_LEAD]u
8904 .          SHIM
8905 .       \}
8906 .    \}
8907 .    el \{\
8908 .       rr #EPI_ACTIVE
8909 .       ie \\n[#EPI_FITS] \{\
8910 .          ie \\n[#FN_FOR_EPI] \{\
8911 .             nr #EPI_LINES_TO_END 1
8912 .             nr #EPI_WHITESPACE \
8913 (\\n[#EPI_LINES_TO_END]*\\n[#DOC_LEAD])-(\\n[#EPI_LINES_TO_END]*\\n[#EPI_LEAD])
8914 .             while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
8915 .                nr #EPI_WHITESPACE -\\n[#DOC_LEAD]
8916 .             \}
8917 .             ALD \\n[#EPI_WHITESPACE]u-(\\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u)
8918 .          \}
8919 .          el \{\
8920 .             ie \\n[#PRINT_STYLE]=1 \{\
8921 .                if \\n[#EPI_WHITESPACE]=\\n[#DOC_LEAD] \
8922 .                   ALD \\n[#EPI_WHITESPACE]u
8923 .             \}
8924 .             el \{\
8925 .                if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \
8926 .                   ALD \\n[#EPI_WHITESPACE]u/2u
8927 .                if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \
8928 .                   ALD (\\n[#EPI_WHITESPACE]u/2u)-\\n[#DOC_LEAD]u
8929 .             \}
8930 .          \}
8931 .       \}
8932 .       el \{\
8933 .          nr #EPI_LINES_TO_END \\n[#EPI_LINES]-\\n[#EPI_LINES_TO_TRAP]
8934 .          if \\n[#LOOP] .nr #EPI_LINES_TO_END +1
8935 .          rr #LOOP
8936 .          nr #EPI_WHITESPACE \
8937 (\\n[#EPI_LINES_TO_END]*\\n[#DOC_LEAD])-(\\n[#EPI_LINES_TO_END]*\\n[#EPI_LEAD])
8938 .          while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
8939 .             nr #EPI_WHITESPACE -\\n[#DOC_LEAD]
8940 .          \}
8941 .          ALD \\n[#EPI_WHITESPACE]u-(\\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u)
8942 .          if \\n[#PRINT_STYLE]=1 \{\
8943 .             if !\\n[#SINGLE_SPACE] \{\
8944 .                nr #EPI_LINES_EVEN \\n[#EPI_LINES_TO_END]%2
8945 .                ie \\n[#EPI_LINES_EVEN] .ALD .5v
8946 .                el .RLD .5v
8947 .                rr #EPI_LINES_EVEN
8948 .             \}
8949 .          \}
8950 .       \}
8951 .    \}
8952 .    nr #PP_STYLE 1
8953 .    rr #EPI_FITS
8954 .    ALD \\n[#DOC_LEAD]u
8955 .    QUAD \\*[$DOC_QUAD]
8956 .    po \\n[#L_MARGIN]u
8957 .    if \\n[#COLUMNS] \{\
8958 .       po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
8959 .       nr #L_MARGIN \\n[.o]
8960 .    \}
8961 .    if \\n[#START] \{\
8962 .       if \\n[#COLUMNS] \{\
8963 .          po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
8964 .          nr #L_MARGIN \\n[.o]
8965 .          mk dc
8966 .       \}
8967 .    \}
8968 .    if \\n[#LINENUMBERS]=2 \{\
8969 .       NUMBER_LINES RESUME
8970 .       nr #LINENUMBERS 1
8971 .    \}
8972 .END
8973 \#
8974 \# ====================================================================
8975 \#
8976 \# +++FINIS MACRO+++
8977 \#
8978 \# FINIS
8979 \# -----
8980 \# *Arguments:
8981 \#   <none>
8982 \# *Function:
8983 \#   Deposits --END-- at the end of a document.
8984 \#
8985 .MAC FINIS END
8986 .    if !\\n[@TOP] \{\
8987 .       if \\n[.t]<=2v \{\
8988 .          tm1 "[mom]: '\\n[.F]': Insufficient room to print \\$0 on last page.
8989 .          return
8990 .       \}
8991 .    \}
8992 .    br
8993 .    ev FINIS
8994 .    evc 0
8995 .    if \\n[#TAB_ACTIVE] .TQ
8996 .    if \\n[#INDENT_ACTIVE] .IQ CLEAR
8997 .    nr #EM_ADJUST (1m/8)
8998 .    if \\n[#COLUMNS] \{\
8999 .       po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
9000 .       nr #L_MARGIN \\n[.o]
9001 .    \}
9002 .    ALD \\n[#DOC_LEAD]u
9003 .    CENTER
9004 .    if \\n[#FINIS_STRING_CAPS]=1 .CAPS
9005 .    if \\n[#PRINT_STYLE]=1 \{\
9006 .       ie !\\n[#FINIS_NO_DASHES] .PRINT "--\\*[$FINIS_STRING]--
9007 .       el .PRINT "\\*[$FINIS_STRING]
9008 .    \}
9009 .    if \\n[#PRINT_STYLE]=2 \{\
9010 .       if \\n[#FINIS_COLOR]=1 .COLOR \\*[$FINIS_COLOR]
9011 .       ie !\\n[#FINIS_NO_DASHES] .ds $FINIS_DASH \
9012 \v'-\\n[#EM_ADJUST]u'\[em]\v'+\\n[#EM_ADJUST]u'
9013 .       el .rm $FINIS_DASH
9014 .       PRINT \
9015 \\*[$FINIS_DASH]\\*[$FINIS_STRING]\\*[$FINIS_DASH]\c
9016 .    \}
9017 .    EL
9018 .    if \\n[#FINIS_COLOR]=1 .gcolor
9019 .    if \\n[#FINIS_STRING_CAPS]=1 .CAPS OFF
9020 .    ev
9021 .    pdfsync
9022 .END
9023 \#
9024 .MAC FINIS_STRING_CAPS END
9025 .    ie '\\$1'' .nr #FINIS_STRING_CAPS 1
9026 .    el .nr #FINIS_STRING_CAPS 0
9027 .END
9028 .
9029 .ALIAS FINIS_CAPS FINIS_STRING_CAPS
9030 \#
9031 .MAC FINIS_NO_DASHES END
9032 .    nr #FINIS_NO_DASHES 1
9033 .END
9034 \#
9035 \# ====================================================================
9036 \#
9037 \# +++HEADERS/FOOTERS+++
9038 \#
9039 \# Define a string so that the current page number can be incorporated
9040 \# into the strings for hdrftr left, right, and center.  NOTE: This is
9041 \# not the same thing as using the shortform # in hdrftr strings.
9042 \#
9043 .ds PAGE# \En[#PAGENUMBER]
9044 .ALIAS SLIDE# PAGE#
9045 \#
9046 .MAC RESTORE_SPACE END
9047 .   vpt 0
9048 .   if \\n[@TOP] \{\
9049 .      ch RR_@TOP
9050 .      rr @TOP
9051 .   \}
9052 .   if \\n[#NEWPAGE] .rr #NEWPAGE
9053 .   if \\n[.u]=1 .nr #FILLED 1
9054 .   nf
9055 .   rs
9056 .   nop \&
9057 .   sp -1
9058 .   if \\n[#FILLED] \{\
9059 .      fi
9060 .      rr #FILLED
9061 .   \}
9062 .   vpt
9063 .END
9064 \#
9065 \# HDRFTR RULE GAP
9066 \# ---------------
9067 \# *Argument:
9068 \#   <amount of space between header/footer and header/footer rule>
9069 \# *Function:
9070 \#   Creates or modifies register #HDRFTR_RULE_GAP to hold amount
9071 \#   of space between header/footer and header/footer rule.
9072 \# *Notes:
9073 \#   Default is 4p.
9074 \#
9075 .MAC HDRFTR_RULE_GAP END
9076 .    nr #HDRFTR_RULE_GAP (\\$1)
9077 .    if '\\$0'HEADER_RULE_GAP' \
9078 .       nr #HEADER_RULE_GAP \\n[#HDRFTR_RULE_GAP]
9079 .    if '\\$0'FOOTER_RULE_GAP' \
9080 .       nr #FOOTER_RULE_GAP \\n[#HDRFTR_RULE_GAP]
9081 .END
9082 \#
9083 \# HDRFTR LEFT
9084 \# -----------
9085 \# *Argument:
9086 \#   <what to put in the left position of page header/footers>
9087 \# *Function:
9088 \#   Creates or modifies string $HDRFTR_LEFT.
9089 \#   Creates register #USER_DEF_HDRFTR_LEFT, which, if 1,
9090 \#   overrides the $HDRFTR_LEFT string created by default
9091 \#   in DEFAULTS.
9092 \# *Notes:
9093 \#   Especially useful if doc has more than one author, and a list
9094 \#   of authors by last name is desired in header/footers.
9095 \#   Default is author.
9096 \#
9097 \#   If the argument is the # character, simply prints the current
9098 \#   page number.
9099 \#
9100 \#   If the user wants to incorporate the page number into the string,
9101 \#   \*[PAGE#] must be used.  For example, if the user wants to put
9102 \#   an ellipsis before the page number in the string, s/he should use
9103 \#   ...\*[PAGE#], not ...#
9104 \#
9105 .MAC HDRFTR_LEFT END
9106 .    nr #USER_DEF_HDRFTR_LEFT 1
9107 .    ds $HDRFTR_LEFT \\$1
9108 .END
9109 \#
9110 \# HDRFTR <POSITION> CAPS AND SMALLCAPS
9111 \# ------------------------------------
9112 \# *Argument:
9113 \#   <none> | <anything>
9114 \# *Function:
9115 \#   Turns capitalisation of $HDRFTR_<POSITION> on or off.
9116 \# *Notes:
9117 \#   Default for RIGHT (ie AUTHOR) is on.
9118 \#
9119 .MAC CAPS_SMALLCAPS_WARNING END
9120 .    tm1 "[mom]: At line \\n[.c], both CAPS and SMALLCAPS have been enabled for HEADER_\\$1.
9121 .    tm1 "       CAPS takes precedence.
9122 .END
9123 .
9124 .MAC _HDRFTR_CAPS END
9125 .    ds $HDR_FTR \\$0
9126 .    substring $HDR_FTR 0 5 \" HEADER or FOOTER
9127 .    ds POSITION \\$0
9128 .    substring POSITION 7 7
9129 .    if '\\*[POSITION]'L' .ds POSITION LEFT
9130 .    if '\\*[POSITION]'C' .ds POSITION CENTER
9131 .    if '\\*[POSITION]'R' .ds POSITION RIGHT
9132 .    if \\n[#HDRFTR_\\*[POSITION]_SMALLCAPS]=1 \
9133 .       CAPS_SMALLCAPS_WARNING \\*[POSITION]
9134 .    ie '\\$1'' .nr #HDRFTR_\\*[POSITION]_CAPS 1
9135 .    el \{\
9136 .       nr #HDRFTR_\\*[POSITION]_CAPS 0
9137 .       ds $HDRFTR_\\*[POSITION]_SIZE_CHANGE +0
9138 .    \}
9139 .END
9140 .
9141 .MAC _HDRFTR_SMALLCAPS END
9142 .    ds $HDR_FTR \\$0
9143 .    substring $HDR_FTR 0 5 \" HEADER or FOOTER
9144 .    ds POSITION \\$0
9145 .    substring POSITION 7 7
9146 .    if '\\*[POSITION]'L' .ds POSITION LEFT
9147 .    if '\\*[POSITION]'C' .ds POSITION CENTER
9148 .    if '\\*[POSITION]'R' .ds POSITION RIGHT
9149 .    if \\n[#HDRFTR_\\*[POSITION]_CAPS]=1 \
9150 .       CAPS_SMALLCAPS_WARNING \\*[POSITION]
9151 .    ie '\\$1'' .nr #HDRFTR_\\*[POSITION]_SMALLCAPS 1
9152 .    el \
9153 .       nr #HDRFTR_\\*[POSITION]_SMALLCAPS 0
9154 .END
9155 \#
9156 \# HDRFTR CENTER
9157 \# -------------
9158 \# *Argument:
9159 \#   <what to put in the centre position of page header/footers>
9160 \# *Function:
9161 \#   Creates or modifies string $HDRFTR_CENTER.
9162 \#   Creates register #USER_DEF_HDRFTR_CENTER, which, if 1,
9163 \#   overrides the $HDRFTR_CENTER string created by default
9164 \#   in COPYSTYLE.
9165 \# *Notes:
9166 \#   Default is document type if DOCTYPE NAMED, Chapter # if DOCTYPE
9167 \#   CHAPTER, draft and revision number if COPYSTYLE DRAFT.
9168 \#
9169 \#   If the argument is the # character, simply prints the current
9170 \#   page number.
9171 \#
9172 \#   If the user wants to incorporate the page number into the string,
9173 \#   \*[PAGE#] must be used.  For example, if the user wants to put
9174 \#   an ellipsis before the page number in the string, s/he should use
9175 \#   ...\*[PAGE#], not ...#
9176 \#
9177 .MAC HDRFTR_CENTER END
9178 .    nr #USER_DEF_HDRFTR_CENTER 1
9179 .    if '\\$0'HEADER_CENTER' \{\
9180 .       ds $HDRFTR_CENTER_OLD \\*[$HDRFTR_CENTER]
9181 .       ds $HDRFTR_CENTER_NEW \\$1
9182 .    \}
9183 .    if '\\$0'FOOTER_CENTRE' \{\
9184 .       ds $HDRFTR_CENTER_OLD \\*[$HDRFTR_CENTER]
9185 .       ds $HDRFTR_CENTER_NEW \\$1
9186 .    \}
9187 .    ie '\\$1'TOC' .ds $TOC_HDRFTR_CENTER \\$2
9188 .    el .ds $HDRFTR_CENTER \\$1
9189 .END
9190 \#
9191 \# HDRFTR CENTER CAPS AND SMALLCAPS
9192 \# --------------------------------
9193 \# *Argument:
9194 \#   <none> | <anything>
9195 \# *Function:
9196 \#   Turns capitalisation of $HDRFTR_CENTER (typically, doctype of
9197 \#   the document) on or off.
9198 \# *Notes:
9199 \#   Default is on.
9200 \#
9201 .MAC HDRFTR_CENTER_SMALLCAPS END
9202 .    if \\n[#HDRFTR_CENTER_SMALLCAPS]=1 \
9203 .       CAPS_SMALLCAPS_WARNING CENTER
9204 .    ie '\\$1'' .nr #HDRFTR_CENTER_SMALLCAPS 1
9205 .    el \
9206 .       nr #HDRFTR_CENTER_SMALLCAPS 0
9207 .END
9208 \#
9209 \# HDRFTR CENTER PADDING
9210 \# ---------------------
9211 \# *Argument:
9212 \#   LEFT | RIGHT <amount of padding to put left or right of hdrftr
9213 \#   center string>
9214 \# *Function:
9215 \#   Creates or modifies registers #HDRFTR_CTR_PAD_LEFT or
9216 \#   #HDRFTR_CTR_PAD_RIGHT.
9217 \# *Notes:
9218 \#   By default, the HDRFTR_CENTER string is centered on the doc
9219 \#   line length.  Long titles or long author names can screw up
9220 \#   visual centering, or create overprints.  This macro allows the
9221 \#   user to pad the center string by the specified amount of space
9222 \#   to fix these problems.
9223 \#
9224 \#   A unit of measure is required.
9225 \#
9226 .MAC HDRFTR_CENTER_PAD END
9227 .    if '\\$1'LEFT'  .nr #HDRFTR_CTR_PAD_LEFT  (\\$2)
9228 .    if '\\$1'RIGHT' .nr #HDRFTR_CTR_PAD_RIGHT (\\$2)
9229 .END
9230 \#
9231 \# SWITCH HDRFTR CENTER PADDING SIDE (support macro)
9232 \# -------------------------------------------------
9233 \# *Argument:
9234 \#   <none>
9235 \# *Function:
9236 \#   Switches the padding side of hdrftr center padding.
9237 \# *Notes:
9238 \#   Required to keep spacing around hdrftr string constant
9239 \#   in recto/verso documents.
9240 \#
9241 .MAC SWITCH_HDRFTR_CENTER_PAD END
9242 .    nr #HDRFTR_CTR_PAD_TMP  \\n[#HDRFTR_CTR_PAD_LEFT]
9243 .    HDRFTR_CENTER_PAD LEFT  \\n[#HDRFTR_CTR_PAD_RIGHT]u
9244 .    HDRFTR_CENTER_PAD RIGHT \\n[#HDRFTR_CTR_PAD_TMP]u
9245 .END
9246 \#
9247 \# HDRFTR RIGHT
9248 \# ------------
9249 \# *Argument:
9250 \#   <what to put in the right position of page header/footers>
9251 \# *Function:
9252 \#   Creates or modifies string $HDRFTR_RIGHT.
9253 \#   Creates register #USER_DEF_HDRFTR_RIGHT, which, if 1,
9254 \#   overrides the $HDRFTR_RIGHT string created by default
9255 \#   in DEFAULTS.
9256 \# *Notes:
9257 \#   Default is document title.
9258 \#
9259 \#   If the argument is the # character, simply prints the current
9260 \#   page number.
9261 \#
9262 \#   If the user wants to incorporate the page number into the string,
9263 \#   \*[PAGE#] must be used.  For example, if the user wants to put
9264 \#   an ellipsis before the page number in the string, s/he should use
9265 \#   ...\*[PAGE#], not ...#
9266 \#
9267 .MAC HDRFTR_RIGHT END
9268 .    nr #USER_DEF_HDRFTR_RIGHT 1
9269 .    ds $HDRFTR_RIGHT \\$1
9270 .END
9271 \#
9272 \# HDRFTR RIGHT CAPS AND SMALLCAPS
9273 \# -------------------------------
9274 \# *Argument:
9275 \#   <none> | <anything>
9276 \# *Function:
9277 \#   Turns capitalisation of $HDRFTR_RIGHT (typically, the title of
9278 \#   the document) on or off.
9279 \# *Notes:
9280 \#   Default is on.
9281 \#
9282 .MAC HDRFTR_RIGHT_SMALLCAPS END
9283 .    if \\n[#HDRFTR_RIGHT_SMALLCAPS]=1 \
9284 .       CAPS_SMALLCAPS_WARNING RIGHT
9285 .    ie '\\$1'' .nr #HDRFTR_RIGHT_SMALLCAPS 1
9286 .    el \
9287 .       nr #HDRFTR_RIGHT_SMALLCAPS 0
9288 .END
9289 \#
9290 \# HDRFTR RULE
9291 \# -----------
9292 \# *Arguments:
9293 \#   <none> | <anything>
9294 \# *Function:
9295 \#   If invoked via the alias HDRFTR_RULE_INTERNAL in HDRFTR, prints a rule
9296 \#   under the header/over the footer.  Otherwise, turns HDRFTR_RULE
9297 \#   on or off.
9298 \#
9299 .MAC HDRFTR_RULE END
9300 .    if r #HEADERS_ON \
9301 .       if \\n[#HEADERS_ON]=1 .nr #HDRFTR_RULE_GAP \\n[#HEADER_RULE_GAP]
9302 .    if r #FOOTERS_ON \
9303 .       if \\n[#FOOTERS_ON]=1 .nr #HDRFTR_RULE_GAP \\n[#FOOTER_RULE_GAP]
9304 .    if '\\$0'HDRFTR_RULE_INTERNAL' \{\
9305 .       ie \\n[#USERDEF_HDRFTR] \{\
9306 .          nr #CAP_HEIGHT_ADJUST \\n[#HDRFTR_HEIGHT]
9307 .          if \\n[#HEADERS_ON] \{\
9308 .             rt \\n[y]u
9309 .             ALD \\n[#HDRFTR_RULE_GAP]u
9310 .             nr #HDRFTR_RULE_WEIGHT \\n[#HEADER_RULE_WEIGHT]
9311 .             nr #HDRFTR_RULE_WEIGHT_ADJ \\n[#HEADER_RULE_WEIGHT_ADJ]
9312 .          \}
9313 .          if \\n[#FOOTERS_ON] \{\
9314 .             rt \\n[y]u
9315 .             RLD \
9316 \\n[#HDRFTR_RULE_GAP]u+\\n[#CAP_HEIGHT_ADJUST]u+\\n[#FOOTER_RULE_WEIGHT]u
9317 .             nr #HDRFTR_RULE_WEIGHT \\n[#FOOTER_RULE_WEIGHT]
9318 .             nr #HDRFTR_RULE_WEIGHT_ADJ \\n[#FOOTER_RULE_WEIGHT_ADJ]
9319 .          \}
9320 .          ie \\n[#HDRFTR_RULE_COLOR]=1 \{\
9321 \m[\\*[$HDRFTR_RULE_COLOR]]\
9322 \D't \\n[#HDRFTR_RULE_WEIGHT]u'\
9323 \h'|0'\
9324 \v'+\\n[#HDRFTR_RULE_WEIGHT_ADJ]u'\
9325 \D'l \\n[#DOC_L_LENGTH]u 0'\
9326 \D't \\n[#RULE_WEIGHT]u'\
9327 \h'-\\n[#RULE_WEIGHT]u'\
9328 \m[]
9329 .          \}
9330 .          el \{\
9331 \D't \\n[#HDRFTR_RULE_WEIGHT]u'\
9332 \h'|0'\
9333 \v'+\\n[#HDRFTR_RULE_WEIGHT_ADJ]u'\
9334 \D'l \\n[#DOC_L_LENGTH]u 0'\
9335 \D't \\n[#RULE_WEIGHT]u'\
9336 \h'-\\n[#RULE_WEIGHT]u'
9337 .          \}
9338 .          br
9339 .       \}
9340 .       el \{\
9341 .          if \\n[#PRINT_STYLE]=1 .nr #CAP_HEIGHT_ADJUST \\n[#CAP_HEIGHT]
9342 .          if \\n[#PRINT_STYLE]=2 \{\
9343 .             ie \\n[#LEFT_CAP_HEIGHT]>\\n[#CENTER_CAP_HEIGHT] \
9344 .                nr #CAP_HEIGHT_ADJUST \\n[#LEFT_CAP_HEIGHT]
9345 .             el .nr #CAP_HEIGHT_ADJUST \\n[#CENTER_CAP_HEIGHT]
9346 .             ie \\n[#CAP_HEIGHT_ADJUST]>\\n[#RIGHT_CAP_HEIGHT] \
9347 .                nr #CAP_HEIGHT_ADJUST \\n[#CAP_HEIGHT_ADJUST]
9348 .             el .nr #CAP_HEIGHT_ADJUST \\n[#RIGHT_CAP_HEIGHT]
9349 .          \}
9350 .          if \\n[#HEADERS_ON] \{\
9351 .             rt \\n[y]u
9352 .             ALD \\n[#HDRFTR_RULE_GAP]u
9353 .             nr #HDRFTR_RULE_WEIGHT \\n[#HEADER_RULE_WEIGHT]
9354 .             nr #HDRFTR_RULE_WEIGHT_ADJ \\n[#HEADER_RULE_WEIGHT_ADJ]
9355 .          \}
9356 .          if \\n[#FOOTERS_ON] \{\
9357 .             rt \\n[y]u
9358 .             RLD \
9359 \\n[#HDRFTR_RULE_GAP]u+\\n[#CAP_HEIGHT_ADJUST]u+\\n[#FOOTER_RULE_WEIGHT]u
9360 .             nr #HDRFTR_RULE_WEIGHT \\n[#FOOTER_RULE_WEIGHT]
9361 .             nr #HDRFTR_RULE_WEIGHT_ADJ \\n[#FOOTER_RULE_WEIGHT_ADJ]
9362 .          \}
9363 .          ie \\n[#HDRFTR_RULE_COLOR]=1 \{\
9364 \m[\\*[$HDRFTR_RULE_COLOR]]\
9365 \D't \\n[#HDRFTR_RULE_WEIGHT]u'\
9366 \h'|0'\
9367 \v'+\\n[#HDRFTR_RULE_WEIGHT_ADJ]u'\
9368 \D'l \\n[#DOC_L_LENGTH]u 0'\
9369 \D't \\n[#RULE_WEIGHT]u'\
9370 \h'-\\n[#RULE_WEIGHT]u'\
9371 \m[]
9372 .          \}
9373 .          el \{\
9374 \D't \\n[#HDRFTR_RULE_WEIGHT]u'\
9375 \h'|0'\
9376 \v'+\\n[#HDRFTR_RULE_WEIGHT_ADJ]u'\
9377 \D'l \\n[#DOC_L_LENGTH]u 0'\
9378 \D't \\n[#RULE_WEIGHT]u'\
9379 \h'-\\n[#RULE_WEIGHT]u'
9380 .          \}
9381 .          br
9382 .       \}
9383 .    \}
9384 .    if '\\$0'HEADER_RULE' \{\
9385 .       ie '\\$1'' \{\
9386 .          nr #HEADER_RULE 1
9387 .          nr #HDRFTR_RULE 1
9388 .       \}
9389 .       el \{\
9390 .          nr #HEADER_RULE 0
9391 .          nr #HDRFTR_RULE 0
9392 .       \}
9393 .    \}
9394 .    if '\\$0'FOOTER_RULE' \{\
9395 .       ie '\\$1'' \{\
9396 .          nr #FOOTER_RULE 1
9397 .          nr #HDRFTR_RULE 1
9398 .       \}
9399 .       el \{\
9400 .          nr #FOOTER_RULE 0
9401 .          nr #HDRFTR_RULE 0
9402 .       \}
9403 .    \}
9404 .    if '\\$0'HDRFTR_RULE' \{\
9405 .       ie '\\$1'' .nr #HDRFTR_RULE 1
9406 .       el .nr #HDRFTR_RULE 0
9407 .    \}
9408 .END
9409 .
9410 .ALIAS HDRFTR_RULE_INTERNAL HDRFTR_RULE
9411 \#
9412 \# HDRFTR PLAIN
9413 \# ------------
9414 \# *Arguments:
9415 \#   <none>
9416 \# *Function:
9417 \#   Sets the family, font, and point size of all strings in
9418 \#   header/footers to the same family and point size as running
9419 \#   text.  Font for the header/footer becomes roman throughout.
9420 \#
9421 .MAC HDRFTR_PLAIN END
9422 .    nr #HDRFTR_PLAIN 1
9423 .    rm $HDRFTR_FAMILY
9424 .    rm #HDRFTR_PT_SIZE
9425 .    rm $HDRFTR_COLOR
9426 .    rm $HDRFTR_LEFT_FAMILY
9427 .    rm $HDRFTR_LEFT_FONT
9428 .    rm $HDRFTR_LEFT_SIZE_CHANGE
9429 .    rr #HDRFTR_LEFT_CAPS
9430 .    rr #HDRFTR_LEFT_SMALLCAPS
9431 .    rr #HDRFTR_LEFT_COLOR
9432 .    rm $HDRFTR_CENTER_FAMILY
9433 .    rm $HDRFTR_CENTER_FONT
9434 .    rm $HDRFTR_CENTER_SIZE_CHANGE
9435 .    rr #HDRFTR_CENTER_CAPS
9436 .    rr #HDRFTR_CENTER_SMALLCAPS
9437 .    rr #HDRFTR_CENTER_COLOR
9438 .    rm $HDRFTR_RIGHT_FAMILY
9439 .    rm $HDRFTR_RIGHT_FONT
9440 .    rm $HDRFTR_RIGHT_SIZE_CHANGE
9441 .    rr #HDRFTR_RIGHT_CAPS
9442 .    rr #HDRFTR_RIGHT_SMALLCAPS
9443 .    rr #HDRFTR_RIGHT_COLOR
9444 .END
9445 \#
9446 \# SWITCH HDRFTR
9447 \# -------------
9448 \# *Arguments:
9449 \#   <none> | <anything>
9450 \# *Function:
9451 \#   Creates or modifies register #SWITCH_HDRFTR, used to switch
9452 \#   default location of HDRFTR_LEFT and HDRFTR_RIGHT.
9453 \# *Notes:
9454 \#   Default is OFF.
9455 \#
9456 \# Typically, the author string appears at the left of header/footers,
9457 \# and the title string appears at the right.  This switches the
9458 \# location of the two.  Useful in conjunction with RECTO_VERSO to tweak
9459 \# switches on alternate pages to come out as the user wishes.  The
9460 \# assumption of RECTO_VERSO is that the first page of the document
9461 \# (recto) is odd, and even though it has no header/footer, if it did
9462 \# have one, it would print as AUTHOR...CENTER...TITLE (or whatever
9463 \# strings the user has supplied for HDRFTR_LEFT/RIGHT), meaning that
9464 \# the next page, which does have a header/footer, will come out as
9465 \# TITLE...CENTER...AUTHOR (or whatever strings the user has supplied
9466 \# for HDRFTR_LEFT/RIGHT).  SWITCH_HDRFTRS allows the user to get the
9467 \# desired string in the desired place on the desired recto/verso page.
9468 \#
9469 .MAC SWITCH_HDRFTR END
9470 .    ie '\\$1'' .nr #SWITCH_HDRFTR 1
9471 .    el .nr #SWITCH_HDRFTR 0
9472 .END
9473 \#
9474 \# USER DEFINED HDRFTR RECTO
9475 \# -------------------------
9476 \# *Arguments:
9477 \#   L | LEFT | C | CENTER | CENTER | R | RIGHT <hdrftr_recto_string>
9478 \# *Function:
9479 \#   Toggles #USERDEF_HDRFTR on, stores quad as #USERDEF_HDRFTR_RECTO_QUAD,
9480 \#   stores string in $USERDEF_HDRFTR_RECTO.
9481 \# *Notes:
9482 \#   For use when users don't want 3-part headers/footers, but rather
9483 \#   want to design their own headers/footers and need different
9484 \#   headers/footers on recto and verso pages.  Using just
9485 \#   HEADER_RECTO or FOOTER_RECTO, even when recto/verso is not on,
9486 \#   allows users to design their own headers/footers for doc pages.
9487 \#
9488 .MAC HDRFTR_RECTO END
9489 .    nr #USERDEF_HDRFTR 1
9490 .    ds $QUAD_TYPE \\$1
9491 .    substring $QUAD-TYPE 0 0
9492 .    if '\\*[$QUAD_TYPE]'L' .nr #USERDEF_HDRFTR_RECTO_QUAD 1
9493 .    if '\\*[$QUAD_TYPE]'C' .nr #USERDEF_HDRFTR_RECTO_QUAD 2
9494 .    if '\\*[$QUAD_TYPE]'R' .nr #USERDEF_HDRFTR_RECTO_QUAD 3
9495 .    shift
9496 .    ie '\\$1'CAPS' \{\
9497 .       nr #HDRFTR_RECTO_CAPS 1
9498 .       ds $USERDEF_HDRFTR_RECTO \\$2
9499 .    \}
9500 .    el .ds $USERDEF_HDRFTR_RECTO \\$1
9501 .END
9502 \#
9503 \# USER DEFINED HDRFTR VERSO
9504 \# -------------------------
9505 \# *Arguments:
9506 \#   L | LEFT | C | CENTER | CENTER | R | RIGHT <hdrftr_verso_string>
9507 \# *Function:
9508 \#   Toggles #USERDEF_HDRFTR on, stores quad as #USERDEF_HDRFTR_VERSO_QUAD,
9509 \#   stores string in $USERDEF_HDRFTR_VERSO.
9510 \# *Notes:
9511 \#   For use when users don't want 3-part headers/footers, but rather
9512 \#   want to design their own headers/footers and need different
9513 \#   headers/footers on recto and verso pages.
9514 \#
9515 .MAC HDRFTR_VERSO END
9516 .    nr #USERDEF_HDRFTR 1
9517 .    ds $QUAD_TYPE \\$1
9518 .    substring $QUAD-TYPE 0 0
9519 .    if '\\*[$QUAD_TYPE]'L'     .nr #USERDEF_HDRFTR_VERSO_QUAD 1
9520 .    if '\\*[$QUAD_TYPE]\\$1'C' .nr #USERDEF_HDRFTR_VERSO_QUAD 2
9521 .    if '\\*[$QUAD_TYPE]\\$1'R' .nr #USERDEF_HDRFTR_VERSO_QUAD 3
9522 .    shift
9523 .    ie '\\$1'CAPS' \{\
9524 .       nr #HDRFTR_VERSO_CAPS 1
9525 .       ds $USERDEF_HDRFTR_VERSO \\$2
9526 .    \}
9527 .    el .ds $USERDEF_HDRFTR_VERSO \\$1
9528 .END
9529 \#
9530 \# PRINT FOOTER ON FIRST PAGE
9531 \# --------------------------
9532 \# *Arguments:
9533 \#   <none> | <anything>
9534 \# *Function:
9535 \#   Toggles register #PRINT_FOOTER_ON_PAGE_1
9536 \# *Notes:
9537 \#   Lets user choose whether to print footer on first
9538 \#   page of doc.
9539 \#
9540 .MAC FOOTER_ON_FIRST_PAGE END
9541 .    ie '\\$1'' .nr #PRINT_FOOTER_ON_PAGE_1 1
9542 .    el .rr #PRINT_FOOTER_ON_PAGE_1
9543 .END
9544 \#
9545 \# PRINT PAGE NUMBER ON FIRST PAGE
9546 \# -------------------------------
9547 \# *Arguments:
9548 \#   <none> | <anything>
9549 \# *Function:
9550 \#   Toggles register #PRINT_PAGENUM_ON_PAGE_1
9551 \# *Notes:
9552 \#   Lets user choose whether to print page number on first
9553 \#   page of doc and after collate when footers are on or page numbering
9554 \#   has been user set at top of page.
9555 \#
9556 .MAC PAGENUM_ON_FIRST_PAGE END
9557 .    ie '\\$1'' .nr #PRINT_PAGENUM_ON_PAGE_1 1
9558 .    el .rr #PRINT_PAGENUM_ON_PAGE_1
9559 .END
9560 \#
9561 \# PRINT HEADER/FOOTER
9562 \# -------------------
9563 \# *Arguments:
9564 \#   <none>
9565 \# *Function:
9566 \#   Based on defaults or values entered by user, prints a
9567 \#   three-part title at either the top or the bottom of the page.
9568 \# *Notes:
9569 \#   Called from within either HEADER or FOOTER.
9570 \#
9571 .MAC PRINT_HDRFTR END
9572 .    if \\n[#DOC_TYPE]=4 .nr #SUITE \En[.pn]
9573 .    if \\n[#FOOTERS_ON] \{\
9574 .       if \\n[#START_FOR_FOOTERS] \{\
9575 .          rr #START_FOR_FOOTERS
9576 .          if \\n[#DOC_TYPE]=5 \{\
9577 .             if !\\n[#HDRFTR_BOTH] .PRINT_USERDEF_HDRFTR
9578 .             return
9579 .          \}
9580 .          if !\\n[#PRINT_FOOTER_ON_PAGE_1] \{\
9581 .             ie !\\n[#HDRFTR_BOTH] .return
9582 .             el \{\
9583 .                rr #FOOTERS_ON
9584 .                if !\\n[#COLLATE] .nr #HEADERS_ON 1
9585 .                ie \\n[#HEADER_RULE]=1 .HEADER_RULE
9586 .                el .HEADER_RULE OFF
9587 .                ie \\n[#HDRFTR_BOTH] .HEADER_VERSO \\*[$HDR_VERSO_QUAD] "\\*[$HDR_VERSO_STRING]"
9588 .                el .HEADER_RECTO \\*[$HDR_RECTO_QUAD] "\\*[$HDR_RECTO_STRING]"
9589 .                return
9590 .             \}
9591 .          \}
9592 .       \}
9593 .    \}
9594 .    if \\n[#USERDEF_HDRFTR] \{\
9595 .       PRINT_USERDEF_HDRFTR
9596 .       return
9597 .    \}
9598 .    if \\n[#SWITCH_HDRFTR] \{\
9599 .       ds $HDRFTR_TMP_SWITCH             \\*[$HDRFTR_LEFT]
9600 .       ds $HDRFTR_LEFT                   \\*[$HDRFTR_RIGHT]
9601 .       ds $HDRFTR_RIGHT                  \\*[$HDRFTR_TMP_SWITCH]
9602 .       ds $HDRFTR_TMP_SIZE_CHANGE_SWITCH \\*[$HDRFTR_LEFT_SIZE_CHANGE]
9603 .       ds $HDRFTR_LEFT_SIZE_CHANGE       \\*[$HDRFTR_RIGHT_SIZE_CHANGE]
9604 .       ds $HDRFTR_RIGHT_SIZE_CHANGE      \\*[$HDRFTR_TMP_SIZE_CHANGE_SWITCH]
9605 .       nr #HDRFTR_TMP_CAPS_SWITCH        \\n[#HDRFTR_LEFT_CAPS]
9606 .       nr #HDRFTR_LEFT_CAPS              \\n[#HDRFTR_RIGHT_CAPS]
9607 .       nr #HDRFTR_TMP_SMALLCAPS_SWITCH   \\n[#HDRFTR_LEFT_SMALLCAPS]
9608 .       nr #HDRFTR_LEFT_SMALLCAPS         \\n[#HDRFTR_RIGHT_SMALLCAPS]
9609 .       nr #HDRFTR_RIGHT_CAPS             \\n[#HDRFTR_TMP_CAPS_SWITCH]
9610 .       ds $HDRFTR_TMP_COLOR_SWITCH       \\*[$HDRFTR_LEFT_COLOR]
9611 .       ds $HDRFTR_LEFT_COLOR             \\*[$HDRFTR_RIGHT_COLOR]
9612 .       ds $HDRFTR_RIGHT_COLOR            \\*[$HDRFTR_TMP_COLOR_SWITCH]
9613 .       rr #HDRFTR_TMP_CAPS_SWITCH
9614 .       rm $HDRFTR_TMP_SWITCH
9615 .       rm $HDRFTR_TMP_SIZE_CHANGE_SWITCH
9616 .       rm $HDRFTR_TMP_COLOR_SWITCH
9617 .       nr #SWITCH_HDRFTR 0
9618 .    \}
9619 .    nr #PAGENUMBER \\n%+\\n[#PAGE_NUM_ADJ]
9620 .    if \\n[#ENDNOTES] .PAGENUM_STYLE \\*[$EN_PN_STYLE]
9621 .    if \\n[#PRINT_STYLE]=1 \{\
9622 .       if \\n[#FOOTERS_ON] \{\
9623 .          di NULL
9624 .          SIZESPECS
9625 .          nr #LEFT_CAP_HEIGHT \\n[#CAP_HEIGHT]
9626 .          di
9627 .       \}
9628 .       if o .RIGHT
9629 .       if e .LEFT
9630 .       if \\n[#RECTO_VERSO]=0 .LEFT
9631 .       if \\n[#HDRFTR_LEFT_CAPS] .CAPS
9632 .       ie '\\*[$HDRFTR_LEFT]'#' .PRINT \\n[#PAGENUMBER]
9633 .       el \{\
9634 .          ie !'\\*[$HDRFTR_LEFT]'' .PRINT \\*[$HDRFTR_LEFT]
9635 .          el .PRINT \&
9636 .       \}
9637 .       if \\n[#HDRFTR_LEFT_CAPS] .CAPS OFF
9638 .       CENTER
9639 .       if \\n[#HDRFTR_CENTER_CAPS] .CAPS
9640 .       rt \\n[y]u
9641 .       ie '\\*[$HDRFTR_CENTER]'#' .PRINT \
9642 \h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\n[#PAGENUMBER]\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'
9643 .       el \{\
9644 .          ie !'\\*[$HDRFTR_CENTER]'' .PRINT \
9645 \h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\*[$HDRFTR_CENTER]\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'
9646 .          el .PRINT \&
9647 .       \}
9648 .       if \\n[#HDRFTR_CENTER_CAPS] .CAPS OFF
9649 .       if o .LEFT
9650 .       if e .RIGHT
9651 .       if \\n[#RECTO_VERSO]=0 .RIGHT
9652 .       if \\n[#HDRFTR_RIGHT_CAPS] .CAPS
9653 .       rt \\n[y]u
9654 .       ie '\\*[$HDRFTR_RIGHT]'#' .PRINT \\n[#PAGENUMBER]
9655 .       el \{\
9656 .          ie !'\\*[$HDRFTR_RIGHT]'' .PRINT \\*[$HDRFTR_RIGHT]
9657 .          el .PRINT \&
9658 .       \}
9659 .       if \\n[#HDRFTR_RIGHT_CAPS] .CAPS OFF
9660 .    \}
9661 .    if \\n[#PRINT_STYLE]=2 \{\
9662 .       if \\n[#HDRFTR_COLOR]=1 \{\
9663 .          nf
9664 \m[\\*[$HDRFTR_COLOR]]
9665 .       \}
9666 .       fam \\*[$HDRFTR_LEFT_FAM]
9667 .       ft  \\*[$HDRFTR_LEFT_FT]
9668 .       ps  \\n[#HDRFTR_PT_SIZE]u\\*[$HDRFTR_LEFT_SIZE_CHANGE]
9669 .       if \\n[#FOOTERS_ON] \{\
9670 .          di NULL
9671 .          SIZESPECS
9672 .          nr #LEFT_CAP_HEIGHT \\n[#CAP_HEIGHT]
9673 .          di
9674 .       \}
9675 .       if o .LEFT
9676 .       if e .RIGHT
9677 .       if \\n[#RECTO_VERSO]=0 .LEFT
9678 .       if \\n[#HDRFTR_LEFT_SMALLCAPS] .SMALLCAPS
9679 .       if \\n[#HDRFTR_LEFT_CAPS] .CAPS
9680 .       ie '\\*[$HDRFTR_LEFT]'#' \{\
9681 .          ie \\n[#HDRFTR_LEFT_COLOR]=1 \
9682 .             PRINT \m[\\*[$HDRFTR_LEFT_COLOR]]\\n[#PAGENUMBER]\m[]
9683 .          el \
9684 .             PRINT \\n[#PAGENUMBER]
9685 .       \}
9686 .       el \{\
9687 .          ie !'\\*[$HDRFTR_LEFT]'' \{\
9688 .             ie \\n[#HDRFTR_LEFT_COLOR]=1 \
9689 .                PRINT \m[\\*[$HDRFTR_LEFT_COLOR]]\\*[$HDRFTR_LEFT]\m[]
9690 .             el \
9691 .                PRINT \\*[$HDRFTR_LEFT]
9692 .          \}
9693 .          el .nop \&
9694 .       \}
9695 .       if \\n[#HDRFTR_LEFT_CAPS] .CAPS OFF
9696 .       if \\n[#HDRFTR_LEFT_SMALLCAPS] .SMALLCAPS OFF
9697 .       fam     \\*[$HDRFTR_CENTER_FAM]
9698 .       ft      \\*[$HDRFTR_CENTER_FT]
9699 .       ps      \\n[#HDRFTR_PT_SIZE]u\\*[$HDRFTR_CENTER_SIZE_CHANGE]
9700 .       if \\n[#FOOTERS_ON] \{\
9701 .          di NULL
9702 .          SIZESPECS
9703 .          nr #CENTER_CAP_HEIGHT \\n[#CAP_HEIGHT]
9704 .          di
9705 .       \}
9706 .       CENTER
9707 .       if \\n[#HDRFTR_CENTER_SMALLCAPS] .SMALLCAPS
9708 .       if \\n[#HDRFTR_CENTER_CAPS] .CAPS
9709 .       rt \\n[y]u
9710 .       ie '\\*[$HDRFTR_CENTER]'#' \{\
9711 .          ie \\n[#HDRFTR_CENTER_COLOR]=1 .PRINT \
9712 \h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\m[\\*[$HDRFTR_CENTER_COLOR]]\
9713 \\n[#PAGENUMBER]\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'\m[]
9714 .          el .PRINT \
9715 \h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\n[#PAGENUMBER]\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'
9716 .       \}
9717 .       el \{\
9718 .          ie !'\\*[$HDRFTR_CENTER]'' \{\
9719 .             ie \\n[#HDRFTR_CENTER_COLOR]=1 .PRINT \
9720 \h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\m[\\*[$HDRFTR_CENTER_COLOR]]\
9721 \\*[$HDRFTR_CENTER]\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'\m[]
9722 .             el .PRINT \
9723 \h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\*[$HDRFTR_CENTER]\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'
9724 .          \}
9725 .          el .PRINT \&
9726 .       \}
9727 .       if \\n[#HDRFTR_CENTER_CAPS] .CAPS OFF
9728 .       if \\n[#HDRFTR_CENTER_SMALLCAPS] .SMALLCAPS OFF
9729 .       fam \\*[$HDRFTR_RIGHT_FAM]
9730 .       ft  \\*[$HDRFTR_RIGHT_FT]
9731 .       ps  \\n[#HDRFTR_PT_SIZE]u\\*[$HDRFTR_RIGHT_SIZE_CHANGE]
9732 .       if \\n[#FOOTERS_ON] \{\
9733 .          di NULL
9734 .          SIZESPECS
9735 .          nr #RIGHT_CAP_HEIGHT \\n[#CAP_HEIGHT]
9736 .          di
9737 .       \}
9738 .       if o .RIGHT
9739 .       if e .LEFT
9740 .       if \\n[#RECTO_VERSO]=0 .RIGHT
9741 .       if \\n[#HDRFTR_RIGHT_SMALLCAPS] .SMALLCAPS
9742 .       if \\n[#HDRFTR_RIGHT_CAPS] .CAPS
9743 .       rt \\n[y]u
9744 .       ie '\\*[$HDRFTR_RIGHT]'#' \{\
9745 .          ie \\n[#HDRFTR_RIGHT_COLOR]=1 \
9746 .             PRINT \m[\\*[$HDRFTR_RIGHT_COLOR]]\\n[#PAGENUMBER]\m[]
9747 .          el \
9748 .             PRINT \\n[#PAGENUMBER]
9749 .       \}
9750 .       el \{\
9751 .          ie !'\\*[$HDRFTR_RIGHT]'' \{\
9752 .             ie \\n[#HDRFTR_RIGHT_COLOR]=1 \
9753 .                PRINT \m[\\*[$HDRFTR_RIGHT_COLOR]]\\*[$HDRFTR_RIGHT]\m[]
9754 .             el \
9755 .                PRINT \\*[$HDRFTR_RIGHT]
9756 .          \}
9757 .          el .PRINT \&
9758 .       \}
9759 .       if \\n[#HDRFTR_RIGHT_CAPS] .CAPS OFF
9760 .       if \\n[#HDRFTR_RIGHT_SMALLCAPS] .SMALLCAPS OFF
9761 .    \}
9762 .    if \\n[#HDRFTR_RULE] .HDRFTR_RULE_INTERNAL
9763 .    br
9764 .END
9765 \#
9766 \# PRINT USER DEFINED HEADER/FOOTER
9767 \# --------------------------------
9768 \# *Arguments:
9769 \#   <none>
9770 \# *Function:
9771 \#   Based on defaults or values entered by user, prints a single part
9772 \#   (i.e. not 3-part) title at either the top or the bottom of the page.
9773 \# *Notes:
9774 \#   Called from within PRINT_HDRFTR.
9775 \#
9776 .MAC PRINT_USERDEF_HDRFTR END
9777 .    nr #PAGENUMBER \\n%+\\n[#PAGE_NUM_ADJ]
9778 .    fc ^ #
9779 .    if \\n[#PRINT_STYLE]=2 \{\
9780 .       fam \\*[$HDRFTR_FAM]
9781 .       ft  R
9782 .       ps \\n[#HDRFTR_PT_SIZE]u
9783 .       if \\n[#HDRFTR_COLOR]=1 \{\
9784 .          nf
9785 .          COLOR \\*[$HDRFTR_COLOR]
9786 .       \}
9787 .    \}
9788 .    ie \\n[#RECTO_VERSO] \{\
9789 .       if o \{\
9790 .          if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=1 .LEFT
9791 .          if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=2 .CENTER
9792 .          if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=3 .RIGHT
9793 .          if \\n[#HDRFTR_RECTO_CAPS]=1 .CAPS
9794 .          if '\\n[.ev]'FOOTER' .vs 0
9795 .          PRINT \\*[$USERDEF_HDRFTR_RECTO]
9796 .          if '\\n[.ev]'FOOTER' .vs
9797 .          if \\n[#HDRFTR_RECTO_CAPS]=1 .CAPS OFF
9798 .          EOL
9799 .          if \\n[#FOOTERS_ON] \{\
9800 .             di NULL
9801 .             SIZESPECS
9802 .             nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
9803 .             di
9804 .          \}
9805 .       \}
9806 .       if e \{\
9807 .          ie !'\\*[$USERDEF_HDRFTR_VERSO]'' \{\
9808 .             if \\n[#USERDEF_HDRFTR_VERSO_QUAD]=1 .LEFT
9809 .             if \\n[#USERDEF_HDRFTR_VERSO_QUAD]=2 .CENTER
9810 .             if \\n[#USERDEF_HDRFTR_VERSO_QUAD]=3 .RIGHT
9811 .             if \\n[#HDRFTR_VERSO_CAPS]=1 .CAPS
9812 .             if '\\n[.ev]'FOOTER' .vs 0
9813 .             PRINT \\*[$USERDEF_HDRFTR_VERSO]
9814 .             if '\\n[.ev]'FOOTER' .vs
9815 .             if \\n[#HDRFTR_VERSO_CAPS]=1 .CAPS OFF
9816 .             EOL
9817 .             if \\n[#FOOTERS_ON] \{\
9818 .                di NULL
9819 .                SIZESPECS
9820 .                nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
9821 .                di
9822 .             \}
9823 .          \}
9824 .          el \{\
9825 .             if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=1 .LEFT
9826 .             if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=2 .CENTER
9827 .             if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=3 .RIGHT
9828 .             if \\n[#HDRFTR_RECTO_CAPS]=1 .CAPS
9829 .             if '\\n[.ev]'FOOTER' .vs 0
9830 .             PRINT \\*[$USERDEF_HDRFTR_RECTO]
9831 .             if '\\n[.ev]'FOOTER' .vs
9832 .             if \\n[#HDRFTR_RECTO_CAPS]=1 .CAPS OFF
9833 .             EOL
9834 .             if \\n[#FOOTERS_ON] \{\
9835 .                di NULL
9836 .                SIZESPECS
9837 .                nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
9838 .                di
9839 .             \}
9840 .          \}
9841 .       \}
9842 .    \}
9843 .    el \{\
9844 .       if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=1 .LEFT
9845 .       if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=2 .CENTER
9846 .       if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=3 .RIGHT
9847 .       if \\n[#HDRFTR_RECTO_CAPS]=1 .CAPS
9848 .       if '\\n[.ev]'FOOTER' .vs 0
9849 .       if !r #SKIP .PRINT \\*[$USERDEF_HDRFTR_RECTO]
9850 .       if '\\n[.ev]'FOOTER' .vs
9851 .       if \\n[#HDRFTR_RECTO_CAPS]=1 .CAPS OFF
9852 .       EOL
9853 .       if \\n[#FOOTERS_ON] \{\
9854 .          di NULL
9855 .          SIZESPECS
9856 .          nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
9857 .          di
9858 .       \}
9859 .    \}
9860 .    fc
9861 .    if \\n[#PRINT_STYLE]=2 \{\
9862 .       ie \\n[#HDRFTR_COLOR]=1 \m[\\*[$HDRFTR_COLOR]]
9863 .       el \m[black]
9864 .    \}
9865 .    if \\n[#HDRFTR_RULE] \
9866 .       HDRFTR_RULE_INTERNAL
9867 .END
9868 \#
9869 \# +++HEADERS+++
9870 \#
9871 \# HEADERS (off or on)
9872 \# -------------------
9873 \# *Arguments:
9874 \#   <none> | <anything>
9875 \# *Function:
9876 \#   Turns headers at the top of the page off or on.
9877 \# *Notes:
9878 \#   Default is on.
9879 \#
9880 .MAC HEADERS END
9881 .    ie '\\$1'' .nr #HEADERS_ON 1
9882 .    el .nr #HEADERS_ON 0
9883 .END
9884 \#
9885 \# HEADER MARGIN
9886 \# -------------
9887 \# *Argument:
9888 \#   <amount of space between top of page and header>
9889 \# *Function:
9890 \#   Creates or modifies register #HEADER_MARGIN to hold amount
9891 \#   of space between top of page and header.
9892 \# *Notes:
9893 \#   Requires unit of measure.  Default is 4P+6p, measured top-of-page
9894 \#   to baseline.
9895 \#
9896 .MAC HEADER_MARGIN END
9897 .    nr #HEADER_MARGIN (\\$1)
9898 .END
9899 \#
9900 \# HEADER GAP
9901 \# ----------
9902 \# *Argument:
9903 \#   <amount of space between header and running text>
9904 \# *Function:
9905 \#   Creates or modifies register #HEADER_GAP to hold amount
9906 \#   of space between header and running text.
9907 \# *Notes:
9908 \#   Default is 1P+6p.
9909 \#
9910 .MAC HEADER_GAP END
9911 .    nr #HEADER_GAP (\\$1)
9912 .END
9913 \#
9914 \# HEADER
9915 \# ------
9916 \# *Arguments:
9917 \#   <none>
9918 \# *Function:
9919 \#   Resets margin notes, processes footnote and margin note
9920 \#   leftover, takes care of recto-verso, prepares for columns after
9921 \#   first, determines whether to flex-space the page,,outputs
9922 \#   deferred floats, and does some tbl magic.  If headers are
9923 \#   enabled, prints header appropriate to DOC_TYPE, PRINTSTYLE, and
9924 \#   COPYSTYLE.
9925 \#
9926 .MAC HEADER END
9927 .    vpt 0
9928 .    if \\n[#DOC_TYPE]=5 \{\
9929 .       if \\n[#SLIDE_FOOTERS] \{\
9930 .          PRINT_FOOTER
9931 .       if \\n[#HDRFTR_BOTH] \
9932 .          HEADER_RECTO \\*[$HDR_RECTO_QUAD] "\\*[$HDR_RECTO_STRING]"
9933 .       \}
9934 .    \}
9935 .    nr flex-spaces 0
9936 .    nr flex +1
9937 .    if \\n[#NEW_DOC_PT_SIZE] .nr #DOC_PT_SIZE \\n[#NEW_DOC_PT_SIZE]
9938 .    rr #NEW_DOC_PT_SIZE
9939 .    if \\n[#RESET_TRAPS] \{\
9940 .       TRAPS
9941 .       if \\n[#REMOVE_ADJ] .nr #DOC_LEAD -\\n[#DOC_LEAD_ADJ]
9942 .    \}
9943 .    rr #REMOVE_ADJ
9944 .    rr #RESET_TRAPS
9945 .    MNtop
9946 .    rr #FROM_FOOTER
9947 .    nr #FROM_HEADER 1
9948 .    nr #LAST_FN_COUNT_FOR_COLS \\n[#FN_COUNT_FOR_COLS]
9949 .    if \\n[#FN_DEPTH] .PROCESS_FN_LEFTOVER
9950 .    rr #RULED
9951 .    if \\n[#RESET_FN_NUMBER] .nr #FN_NUMBER 0 1
9952 .    if !\\n[#DIVERTED] .rr #PREV_FN_DEFERRED
9953 .    po \\n[#DOC_L_MARGIN]u
9954 .    if \\n[#RECTO_VERSO] \{\
9955 .       if !\\n[#TOC_RV_SWITCH]=2 \{\
9956 .          nr #DOC_LR_MARGIN_TMP \\n[#DOC_L_MARGIN]
9957 .          DOC_LEFT_MARGIN  \\n[#DOC_R_MARGIN]u
9958 .          if \\n[#CROPS] .DOC_LEFT_MARGIN  \\n[#DOC_R_MARGIN]u+\\n[cropmarks]u
9959 .          DOC_RIGHT_MARGIN \\n[#DOC_LR_MARGIN_TMP]u
9960 .          if \\n[#CROPS] .DOC_RIGHT_MARGIN \\n[#DOC_LR_MARGIN_TMP]u-\\n[cropmarks]u
9961 .          SWITCH_HDRFTR_CENTER_PAD
9962 .       \}
9963 .    \}
9964 .    ev HEADER
9965 .    if \\n[#PAGE_NUM_V_POS]=1 .vs 0
9966 .    sp |\\n[#HEADER_MARGIN]u-1v
9967 .    mk y
9968 .    ll \\n[#DOC_L_LENGTH]u
9969 .    ta \\n[.l]u
9970 .    if \\n[#PRINT_STYLE]=1 \{\
9971 .       fam \\*[$TYPEWRITER_FAM]
9972 .       ft  R
9973 .       ps  \\*[$TYPEWRITER_PS]\\*[$HDRFTR_SIZE_CHANGE]
9974 .    \}
9975 .    if \\n[#PRINT_STYLE]=2 \{\
9976 .      fam \\*[$HDRFTR_FAM]
9977 .      ft  R
9978 .      ps  \\n[#DOC_PT_SIZE]u\\*[$HDRFTR_SIZE_CHANGE]
9979 .    \}
9980 .    nr #HDRFTR_PT_SIZE \\n[#PT_SIZE]
9981 .    if \\n[#CAPS_ON] \{\
9982 .       nr #CAPS_WAS_ON 1
9983 .       CAPS OFF
9984 .    \}
9985 .    if \\n[#PRINT_STYLE]=1 \{\
9986 .       if \\n[#ENDNOTES]=1 \{\
9987 .\" Single-spaced endnotes have a different lead
9988 .          if \\n[#EN_SINGLESPACE] \{\
9989 .             nr #RESTORE_DOC_LEAD \\n[#DOC_LEAD]
9990 .             nr #DOC_LEAD \\n[#EN_LEAD]u
9991 .          \}
9992 .       \}
9993 .    \}
9994 .    if !n .nop \X'ps: exec 0 setlinejoin'\X'ps: exec 0 setlinecap'
9995 .    sp -1v
9996 .    if \\n[#DOC_TYPE]=5 \{\
9997 .       if \\n[#SLIDE_HEADERS] \{\
9998 .          HEADERS
9999 .          if \\n[#SLIDE_FOOTERS] \{\
10000 .             FOOTERS off
10001 .\" So rule prints after header on first page
10002 .             if !r #SKIP_RULE \{\
10003 .                sp
10004 .                if \\n[#HEADER_RULE] .HEADER_RULE
10005 .                nr #SKIP_RULE 1
10006 .             \}
10007 .          \}
10008 .       \}
10009 .    \}
10010 .    ie \\n[#HEADERS_ON] .PRINT_HDRFTR
10011 .    el \{\
10012 .       if \\n[#PAGE_NUM_V_POS]=1 \
10013 .          if \\n[#PAGINATE] .PRINT_PAGE_NUMBER
10014 .    \}
10015 .    sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
10016 .    if \\n[#PRINT_STYLE]=1 \{\
10017 .       if \\n[#ENDNOTES]=1 \{\
10018 .          if \\n[#EN_SINGLESPACE] \{\
10019 .             nr #DOC_LEAD \\n[#RESTORE_DOC_LEAD]u
10020 .             rr #RESTORE_DOC_LEAD
10021 .          \}
10022 .       \}
10023 .    \}
10024 .    nr #PAGE_TOP \\n[nl]
10025 .    ev
10026 .    po \\n[#L_MARGIN]u
10027 .    if \\n[#RECTO_VERSO] .nr #L_MARGIN +\\n[#L_MARGIN_DIFF]
10028 .    if \\n[#CAPS_WAS_ON] \{\
10029 .       CAPS
10030 .       rr #CAPS_WAS_ON
10031 .    \}
10032 .    if \\n[#TAB_ACTIVE] .TAB \\n[#CURRENT_TAB]
10033 .    if \\n[#QUOTE] \{\
10034 .       ie \\n[#TAB_ACTIVE] .TAB \\n[#CURRENT_TAB]
10035 .       el \{\
10036 .          ie \\n[#Q_OFFSET_VALUE] .nr #Q_OFFSET \
10037 \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE])
10038 .          el .nr #Q_OFFSET \\n[#L_MARGIN]+\\*[$Q_OFFSET_VALUE]
10039 .          po \\n[#Q_OFFSET]u
10040 .       \}
10041 .       if \\n[#PRINT_STYLE]=2 .sp \\n[#Q_LEAD_DIFF]u
10042 .    \}
10043 .    if \\n[#IN_LIST] \
10044 .       po +\\n[#LIST_OFFSET_VALUE]u
10045 .    if \\n[#RESET_FN_COUNTERS]=1 \{\
10046 .       rr #RESET_FN_COUNTERS
10047 .       PROCESS_FN_IN_DIVER
10048 .       nr #FN_COUNT \\n[#SAVED_FN_COUNT] 1
10049 .       if \\n[#COLUMNS]=1 .nr #FN_COUNT_FOR_COLS \\n[#SAVED_FN_COUNT_FOR_COLS] 1
10050 .       ie \\n[#RESET_FN_NUMBER]=1 .nr #FN_NUMBER \\n[#SAVED_FN_NUMBER] 1
10051 .       el .nr #FN_NUMBER \\n[#FN_NUMBER] 1
10052 .       rm FN_IN_DIVER
10053 .       if dRUNON_FN_IN_DIVER .rm RUNON_FN_IN_DIVER
10054 .    \}
10055 .    if \\n[#EPIGRAPH] \{\
10056 .       ie \\n[#TAB_ACTIVE] .TAB \\n[#CURRENT_TAB]
10057 .       el \{\
10058 .          ie r#EPI_OFFSET_VALUE \
10059 .             nr #EPI_OFFSET \
10060 \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
10061 .          el \
10062 .             nr #EPI_OFFSET \\n[#L_MARGIN]+\\*[$EPI_OFFSET_VALUE]
10063 .          po \\n[#EPI_OFFSET]u
10064 .       \}
10065 .    \}
10066 .    ie \\n[#EPIGRAPH] \{\
10067 .       ie !\\n[#EPI_ACTIVE] \{\
10068 .          ns
10069 .          rr #EPI_ACTIVE
10070 .       \}
10071 .       el \{\
10072 .          ie \\n[#EPI_FITS] .ns
10073 .          el .sp \\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u
10074 .       \}
10075 .    \}
10076 .    el .ns
10077 .    if \\n[#COLUMNS] \{\
10078 .       nr #FN_COUNT_FOR_COLS 0 1
10079 .       nr #L_MARGIN \\n[#DOC_L_MARGIN]
10080 .       if \\n[#RECTO_VERSO] .COLUMNS \\n[#NUM_COLS] \\n[#GUTTER]u
10081 .       nr #COL_NUM 0 1
10082 .       mk dc
10083 .       po \\n[#COL_\\n+[#COL_NUM]_L_MARGIN]u
10084 .       nr #L_MARGIN \\n[.o]
10085 .       if \\n[#TAB_ACTIVE] .TAB \\n[#CURRENT_TAB]
10086 .       ll \\n[#COL_L_LENGTH]u
10087 .       ta \\n[.l]u
10088 .       if \\n[#QUOTE] \{\
10089 .          ie \\n[#\\*[BQ]_OFFSET_VALUE] \
10090 .             po +(\\n[#PP_INDENT]u*\\n[#\\*[BQ]_OFFSET_VALUE]u)
10091 .          el \
10092 .             po +\\*[$\\*[BQ]_OFFSET_VALUE]
10093 .       \}
10094 .       if \\n[#EPIGRAPH] \{\
10095 .          if \\n[#EPI_ACTIVE] \{\
10096 .             ie \\n[#EPI_FITS] .
10097 .             el .nr dc -\\n[#EPI_LEAD_DIFF]
10098 .          \}
10099 .          ie r#EPI_OFFSET_VALUE \{\
10100 .             po \
10101 \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u+(\\n[#PP_INDENT]u*\\n[#EPI_OFFSET_VALUE]u)
10102 .          \}
10103 .          el .po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u+\\*[$EPI_OFFSET_VALUE]
10104 .       \}
10105 .    \}
10106 .    rr #FROM_HEADER
10107 .    rr #DEFER_SPACE_ADDED
10108 .    if !\\n[#FN_DEPTH] .if r #DIVERTED .rr #DIVERTED
10109 .    if \\n[#MN_OVERFLOW_LEFT]=1 \{\
10110 .       MN LEFT
10111 .       nf
10112 .       MN_OVERFLOW_LEFT
10113 .       MN
10114 .    \}
10115 .    if \\n[#MN_OVERFLOW_RIGHT]=1 \{\
10116 .       MN RIGHT
10117 .       nf
10118 .       MN_OVERFLOW_RIGHT
10119 .       MN
10120 .    \}
10121 .    rm MN_OVERFLOW_LEFT
10122 .    rr #MN_OVERFLOW_LEFT
10123 .    rr #no-repeat-MN-left
10124 .    rm MN_OVERFLOW_RIGHT
10125 .    rr #MN_OVERFLOW_RIGHT
10126 .    rr #no-repeat-MN-right
10127 .    if \\n[#PRE_COLLATE]=1 .rr #PRE_COLLATE
10128 .    if \\n[#UNDERLINE_WAS_ON]=1 \{\
10129 .       vs 0
10130 .       ie !n \
10131 .          nop \R'#UNDERLINE_ON 1'\X'ps: exec \\n[_w] \\n[_d] decorline'
10132 .       el .ul 1000
10133 .       br
10134 .       ns
10135 .       rr #UNDERLINE_WAS_ON
10136 .    \}
10137 .    if \\n[#RESTORE_PAGINATION] \{\
10138 .       PAGINATE
10139 .       rr #RESTORE_PAGINATION
10140 .    \}
10141 .    ch RR_@TOP
10142 .    ie \\n[tbl*have-header] .rr @TOP
10143 .    el .wh \\n[nl]u+1u RR_@TOP
10144 .    if \\n[#FLEX_ACTIVE] \{\
10145 .       if \\n[#RESTORE_FLEX] \{\
10146 .          rr #NO_FLEX
10147 .          rr #RESTORE_FLEX
10148 .       \}
10149 .       if \\n[#RESTORE_COL_FLEX] \{\
10150 .          rr #NO_FLEX
10151 .          rr #RESTORE_COL_FLEX
10152 .       \}
10153 .    \}
10154 .\" Don't flex the last page/col, or the page/col before a COLLATE,
10155 .\" NEWPAGE, COL_NEXT, or BLANKPAGE.
10156 .    if !dPDF.EXPORT \{\
10157 .       if \\n[#FLEX_ACTIVE] \
10158 .          if !\\n[#NO_FLEX] \
10159 .             nr #RESTORE_FLEX 1
10160 .       if '\\*[last-page]'\\n%@\\n[#COL_NUM]' \
10161 .          if !\\n[#NO_FLEX] .nr #NO_FLEX 1
10162 .       if '\\*[pre-collate-\\n%]'\\n%@\\n[#COL_NUM]' \
10163 .          if !\\n[#NO_FLEX] .nr #NO_FLEX 1
10164 .       if '\\*[pre-newpage-\\n%]'\\n%@\\n[#COL_NUM]' \
10165 .          if !\\n[#NO_FLEX] .nr #NO_FLEX 1
10166 .       if d page-\\n%@\\n[#COL_NUM] .nr #NO_FLEX 1
10167 .    \}
10168 .    ie \\n[defer] .PROCESS_FLOATS
10169 .    el \{\
10170 .\" These two sets of conditions only occur if the .br in .TS causes
10171 .\" a page break.
10172 .       if !\\n[doing-tbl] \{\
10173 .          if (\\n[tbl*have-caption]=1)&(\\n[tbl*caption-after-label]=0) \{\
10174 .             RESTORE_SPACE
10175 .             if !\\n[span] \{\
10176 .                ie \\n[#MLA] .sp \\n[tbl*label-lead-diff]u
10177 .                el .sp \\n[tbl*caption-lead-diff]u
10178 .             \}
10179 .          \}
10180 .       \}
10181 .    \}
10182 .\" So tables without TH that don't fit don't overprint first row
10183 .\" at top of page
10184 .    ie \\n[tbl*no-header] \{\
10185 .       rs
10186 .       nop \&
10187 .       vpt
10188 .       rr \\n[tbl*no-header]
10189 .       SHIM_1
10190 .    \}
10191 .    el .vpt
10192 .    if \\n[span] \{\
10193 .       ev FLOAT
10194 .       if \\n[#INDENT_LEFT_ACTIVE] .in \\n[#L_INDENT]u/2u
10195 .       nf
10196 .       RESTORE_SPACE
10197 .       if !\\n[tbl*no-top-hook] \
10198 .          if \\n[tbl*have-header:1] .tbl*print-header
10199 .       ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
10200 .       ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u
10201 .    \}
10202 .    if !\\n[begin-tbl] \
10203 .       if !r tbl*no-top-hook .tbl@top-hook
10204 .    rr tbl*no-top-hook
10205 .    if r flex:force .rr flex:force
10206 .    rr ref*last
10207 .    if !\\n[float*defer] .ev 0
10208 .END
10209 \#
10210 \# ====================================================================
10211 \#
10212 \# +++FOOTERS+++
10213 \#
10214 \# FOOTERS (off or on)
10215 \# -------------------
10216 \# *Arguments:
10217 \#   <none> | <anything>
10218 \# *Function:
10219 \#   Turns footers at the bottom of the page off or on.
10220 \# *Notes:
10221 \#   Default is off.  If on, page numbers automatically go at
10222 \#   the top, centered, unless pagination has been turned off,
10223 \#   or the pagenumber position has been changed to left or right.
10224 \#
10225 .MAC FOOTERS END
10226 .    ie '\\$1'' \{\
10227 .       rr #HEADERS_ON
10228 .       nr #FOOTERS_ON 1
10229 .       PAGENUM_POS TOP CENTER
10230 .    \}
10231 .    el .nr #FOOTERS_ON 0
10232 .END
10233 \#
10234 \# FOOTER MARGIN
10235 \# -------------
10236 \# *Argument:
10237 \#   <footer margin>
10238 \# *Function:
10239 \#   Creates or modifies register #FOOTER_MARGIN which holds the
10240 \#   amount of space to leave between the page number and the bottom
10241 \#   of the page.
10242 \# *Notes:
10243 \#   Unit of measure required.  Default is 3P.
10244 \#
10245 .MAC FOOTER_MARGIN END
10246 .    ie \\n%>0 .nr #FOOTER_MARGIN (\\$1)
10247 .    el .
10248 .END
10249 \#
10250 \# FOOTER GAP
10251 \# ----------
10252 \# *Argument:
10253 \#   <distance from end of running text to page # or footer>
10254 \# *Function:
10255 \#   Creates or modifies register #FOOTER_GAP which holds the
10256 \#   amount of space to leave between running text and the page number.
10257 \# *Notes:
10258 \#   Requires unit of measure.  Default is 3P.  Measured baseline to
10259 \#   baseline.
10260 \#
10261 .MAC FOOTER_GAP END
10262 .    ie \\n%>0 .nr #FOOTER_GAP (\\$1)
10263 .    el .
10264 .END
10265 \#
10266 \# FOOTER
10267 \# ------
10268 \# *Arguments:
10269 \#   <none>
10270 \# *Function:
10271 \#   Gathers strings for flex-spacing, processes margin notes and
10272 \#   footnotes, prepares for move to next column or page.  Places
10273 \#   footer at bottom of page if #FOOTERS=1, otherwise places page
10274 \#   number at bottom of page (if #PAGINATE=1).  Page numbers are
10275 \#   in arabic or roman according to COPYSTYLE.  DRAFT starts the
10276 \#   document at page 1 regardless of PAGENUMBER.  FINAL respects
10277 \#   PAGENUMBER.
10278 \#
10279 .MAC FOOTER END
10280 .    if r #START .rr #START
10281 .    CALCULATE_FLEX
10282 .    if \\n[#DOING_COVERTEXT] \{\
10283 .       tm1 "[mom]: COVERTEXT exceeds cover page depth.
10284 .       ab   [mom]: Aborting '\\n[.F]'.
10285 .    \}
10286 .    vpt 0
10287 .    rr #LB_4_HD
10288 .    rr #QUOTE_4_HD
10289 .    nr #SAVED_LEAD \\n[.v]
10290 .    if !r pg-trans .nr pg-trans 0 1
10291 .    ev PAGE_TRANSITION\\n+[pg-trans]
10292 .    pdfmarksuspend
10293 .    ie !n .nop \X'ps: exec decornone'
10294 .    el .ul 0
10295 .    br
10296 .    if \\n[#UNDERLINE_ON]=1 .nr #UNDERLINE_WAS_ON 1
10297 .    if \\n[MN-left]>0 \{\
10298 .       if !\\n[#no-repeat-MN-left]=1 \{\
10299 .          MNbottom-left
10300 .          nr #no-repeat-MN-left 1
10301 .       \}
10302 .       if '\\n[.z]'MN_OVERFLOW_LEFT' \{\
10303 .          di
10304 .          nr #MN_OVERFLOW_LEFT 1
10305 .          rr #OVERFLOW_LEFT
10306 .       \}
10307 .    \}
10308 .    if \\n[MN-right]>0 \{\
10309 .       if !\\n[#no-repeat-MN-right]=1 .MNbottom-right
10310 .       if '\\n[.z]'MN_OVERFLOW_RIGHT' \{\
10311 .          di
10312 .          nr #MN_OVERFLOW_RIGHT 1
10313 .          rr #OVERFLOW_RIGHT
10314 .       \}
10315 .    \}
10316 \# Table bottom hook, draws the table borders in
10317 \# multipage boxed tables.
10318 .    tbl@bottom-hook
10319 .    ch MN_OVERFLOW_TRAP
10320 .    nr #L_MARGIN_DIFF \\n[#L_MARGIN]-\\n[#DOC_L_MARGIN]
10321 .    if !\\n[#FN_DEFER] \{\
10322 .       nr #DIVER_DEPTH 0
10323 .       if \\n[#FN_DEPTH] \{\
10324 .          if \\n[#DIVERTED]=3 .nr #FN_DEPTH +\\n[#VFP_DIFF]
10325 .          vpt 0
10326 .          sp \
10327 |\\n[#PAGE_LENGTH]u-(\\n[#B_MARGIN]u+\\n[#FN_DEPTH]u-\\n[#DOC_LEAD]u)
10328 .          vpt
10329 .          po \\n[#DOC_L_MARGIN]u
10330 .          if \\n[#COLUMNS] \{\
10331 .             po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
10332 .             nr #L_MARGIN \\n[.o]
10333 .             nr #FROM_FOOTER 1
10334 .          \}
10335 .          nf
10336 .          ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u
10337 .          FOOTNOTES
10338 .          rm FOOTNOTES
10339 .          if d RUNON_FOOTNOTES   .rm RUNON_FOOTNOTES
10340 .          if \\n[#PRINT_STYLE]=1 .vs \\n[#SAVED_LEAD]u
10341 .          if \\n[#PRINT_STYLE]=2 .vs \\n[#SAVED_LEAD]u
10342 .          if '\\n[.z]'FN_OVERFLOW' \{\
10343 .             di
10344 .             nr #FN_OVERFLOW_DEPTH \\n[#DIVER_DEPTH]
10345 .          \}
10346 .          nr #FN_COUNT_AT_FOOTER \\n[#FN_COUNT]
10347 .          nr #FN_COUNT 0
10348 .          if \\n[#COL_NEXT] \{\
10349 .             ie !\\n[#COL_NUM]=\\n[#NUM_COLS] .nr #COL_NUM \\n-[#COL_NUM]
10350 .             el .nr #COL_NUM \\n[#NUM_COLS] 1
10351 .          \}
10352 .       \}
10353 .       rr #DIVERTED
10354 .    \}
10355 .    nr @TOP 1
10356 .    ie \\n[#COLUMNS]=1 \{\
10357 .       ie (\\n[#COL_NUM]=\\n[#NUM_COLS]):(\\n[#NEWPAGE]=1) .DO_FOOTER
10358 .       el \{\
10359 .          ie (\\n[#ENDNOTES]=1):(\\n[#BIBLIOGRAPHY]=1) \{\
10360 .             if \\n[#ENDNOTES] .sp |\\n[ec]u-\\n[#EN_LEAD]u
10361 .             if \\n[#BIBLIOGRAPHY] .sp |\\n[bc]u-\\n[#BIB_LEAD]u
10362 .          \}
10363 .          el \{\
10364 .            vs \\n[#SAVED_LEAD]u
10365 .            rt \\n[dc]u
10366 .            nr flex-spaces 0
10367 .          \}
10368 .          if d page-\\n%@\\n[#COL_NUM] \{\
10369 .             rr #NO_FLEX
10370 .             rr #RESTORE_COL_FLEX
10371 .          \}
10372 .          po \\n[#COL_\\n+[#COL_NUM]_L_MARGIN]u
10373 .          if !dPDF.EXPORT \{\
10374 .             if \\n[#FLEX_ACTIVE] \{\
10375 .                if !\\n[#NO_FLEX] \{\
10376 .                   if '\\*[last-page]'\\n%@\\n[#COL_NUM]' \
10377 .                       nr #NO_FLEX 1
10378 .                   if '\\*[pre-collate]'\\n%@\\n[#COL_NUM]' \
10379 .                       nr #NO_FLEX 1
10380 .                   if '\\*[pre-newpage-\\n%]'\\n%@\\n[#COL_NUM]' \{\
10381 .                      nr #NO_FLEX 1
10382 .                      nr #RESTORE_FLEX 1
10383 .                   \}
10384 .                   if d page-\\n%@\\n[#COL_NUM] \{\
10385 .                      nr #NO_FLEX 1
10386 .                      nr #RESTORE_COL_FLEX 1
10387 .                   \}
10388 .                \}
10389 .             \}
10390 .          \}
10391 .          nr #L_MARGIN \\n[.o]
10392 .          if \\n[#FN_DEPTH] .PROCESS_FN_LEFTOVER
10393 .          vs \\n[#SAVED_LEAD]u
10394 .          if \\n[#PREV_FN_DEFERRED] .nr #PREV_FN_DEFERRED 2
10395 .          rr #RULED
10396 .          if !\\n[#EPIGRAPH] .rr #COL_NEXT
10397 .          if !\\n[#QUOTE] .rr #COL_NEXT
10398 .          if \\n[#RESET_FN_COUNTERS]=1 \{\
10399 .             rr #RESET_FN_COUNTERS
10400 .             PROCESS_FN_IN_DIVER
10401 .             LS \\n[#SAVED_LEAD]u
10402 .             nr #FN_COUNT \\n[#FN_COUNT] 1
10403 .             nr #FN_COUNT_FOR_COLS \\n[#FN_COUNT_FOR_COLS] 1
10404 .             rm FN_IN_DIVER
10405 .             if dRUNON_FN_IN_DIVER .rm RUNON_FN_IN_DIVER
10406 .          \}
10407 .          rr #DEFER_SPACE_ADDED
10408 .          if \\n[#TAB_ACTIVE] .TAB \\n[#CURRENT_TAB]
10409 .          if \\n[#QUOTE] \{\
10410 .             ie \\n[#TAB_ACTIVE] .TAB \\n[#CURRENT_TAB]
10411 .             el \{\
10412 .                ie \\n[#Q_OFFSET_VALUE] \
10413 .                   nr #Q_OFFSET \
10414 \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE])
10415 .                el \
10416 .                   nr #Q_OFFSET \\n[#L_MARGIN]+\\*[$Q_OFFSET_VALUE]
10417 .                if \\n[#COLUMNS] \{\
10418 .                   ie \\n[#Q_OFFSET_VALUE] .nr #Q_OFFSET \
10419 \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE])
10420 .                   el .nr #Q_OFFSET \
10421 \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+\\*[$Q_OFFSET_VALUE]
10422 .                \}
10423 .                po \\n[#Q_OFFSET]u
10424 .             \}
10425 .          \}
10426 .          if \\n[#EPIGRAPH] \{\
10427 .             ie \\n[#TAB_ACTIVE] .TAB \\n[#CURRENT_TAB]
10428 .             el \{\
10429 .                ie r#EPI_OFFSET_VALUE .nr #EPI_OFFSET \
10430 \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
10431 .                el .nr #EPI_OFFSET \
10432 \\n[#L_MARGIN]+\\*[$EPI_OFFSET_VALUE]
10433 .                if \\n[#COLUMNS] \{\
10434 .                   ie r#EPI_OFFSET_VALUE .nr #EPI_OFFSET \
10435 \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
10436 .                   el .nr #EPI_OFFSET \
10437 \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+\\*[$EPI_OFFSET_VALUE]
10438 .                \}
10439 .                po \\n[#EPI_OFFSET]u
10440 .             \}
10441 .          \}
10442 .          ie \\n[tbl*interrupted] \{\
10443 .             tbl*print-header
10444 .             rr tbl*interrupted
10445 .            \}
10446 .          el .if !r tbl*no-top-hook .tbl@top-hook
10447 .          rr tbl*no-top-hook
10448 .          ie \\n[#EPIGRAPH] \{\
10449 .             ie !\\n[#EPI_ACTIVE] \{\
10450 .                ns
10451 .                rr #EPI_ACTIVE
10452 .             \}
10453 .             el \{\
10454 .                sp |\\n[dc]u+(\\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u)
10455 .                rr #EPI_ACTIVE
10456 .             \}
10457 .          \}
10458 .          el .ns
10459 .          ev
10460 .       \}
10461 .       ns
10462 .       rr #DIVERTED
10463 .       ch RR_@TOP
10464 .       wh \\n[nl]u+1u RR_@TOP
10465 .       if \\n[tbl*have-header] .tbl@bottom-hook
10466 .       if \\n[defer] .PROCESS_FLOATS
10467 .       ie \\n[tbl*no-header] \{\
10468 .          rs
10469 .          nop \&
10470 .          vpt
10471 .          rr \\n[tbl*no-header]
10472 .          SHIM_1
10473 .       \}
10474 .       el .vpt
10475 .       if '\\n[.ev]'caption' .rs
10476 .       if \\n[tbl*interrupted] .tbl*print-header
10477 .       rr tbl*interrupted
10478 .    \}
10479 .    el .DO_FOOTER
10480 .    pdfmarkrestart
10481 .END
10482 \#
10483 \# PROCESS FOOTER
10484 \# --------------
10485 \# *Arguments:
10486 \#   <none>
10487 \# *Function:
10488 \#   Prints footer (page number, or 3-part footer).
10489 \#   Resets CAPS and UNDERLINE if they were on.
10490 \#
10491 .MAC DO_FOOTER END
10492 .\" Part of workaround for refer spitting out a blank page if the
10493 .\" last reference falls on the bottom line.
10494 .    if \\n[num*refs] \{\
10495 .       if \\n[ref*num]=\\n[num*refs] \{\
10496 .          rr num*refs
10497 .          nr ref*last 1
10498 .       \}
10499 .    \}
10500 .    ie !\\n[#DOC_TYPE]=5 .PRINT_FOOTER
10501 .    el .vpt
10502 .    if !\\n[ref*last] \{\
10503 .       ie \\n[defer]>0 \{\
10504 \c
10505 '          bp
10506 .       \}
10507 .       el 'bp
10508 .    \}
10509 .END
10510 \#
10511 .MAC PRINT_FOOTER END
10512 .    if r #SAVED_FOOTER_POS .ch FOOTER \\n[#SAVED_FOOTER_POS]u
10513 .    rr #SAVED_FOOTER_POS
10514 .    vpt 0
10515 .    sp -1
10516 .    ev FOOTER
10517 .    ie n \
10518 .       sp |\\n[#PAGE_LENGTH]u-\\n[#FOOTER_MARGIN]u
10519 .    el \
10520 .       sp |\\n[#PAGE_LENGTH]u-\\n[#FOOTER_MARGIN]u-\\n[#FOOTER_ADJ]u
10521 .    mk y
10522 .    UNDERLINE OFF
10523 .    po \\n[#DOC_L_MARGIN]u
10524 .    ll \\n[#DOC_L_LENGTH]u
10525 .    ta \\n[.l]u
10526 .    if \\n[#PRINT_STYLE]=1 .TYPEWRITER
10527 .    if \\n[#PRINT_STYLE]=2 \{\
10528 .       fam  \\*[$HDRFTR_FAM]
10529 .       ft   R
10530 .       ps \\n[#DOC_PT_SIZE]u\\*[$HDRFTR_SIZE_CHANGE]
10531 .    \}
10532 .    nr #HDRFTR_PT_SIZE \\n[#PT_SIZE]
10533 .    if \\n[#CAPS_ON] \{\
10534 .       nr #CAPS_WAS_ON 1
10535 .       CAPS OFF
10536 .    \}
10537 .    ie \\n[#FOOTERS_ON] \{\
10538 .       if !\\n[#SKIP_FOOTER]>0 .PRINT_HDRFTR
10539 .       if \\n[#HDRFTR_BOTH] \
10540 .          HEADER_RECTO \\*[$HDR_RECTO_QUAD] "\\*[$HDR_RECTO_STRING]"
10541 .       if \\n[#DOC_TYPE]=5 .FOOTERS
10542 .    \}
10543 .    el \{\
10544 .       if \\n[#PAGINATE] \{\
10545 .          if \\n[#PAGE_NUM_V_POS]=2 \
10546 .             if !\\n[#SKIP_FOOTER]>0 .PRINT_PAGE_NUMBER
10547 .       \}
10548 .    \}
10549 .    rr #SKIP_FOOTER
10550 .    if \\n[#CAPS_WAS_ON] \{\
10551 .       CAPS
10552 .       rr #CAPS_WAS_ON
10553 .    \}
10554 .    ev
10555 .    vpt
10556 .END
10557 \#
10558 \# ====================================================================
10559 \#
10560 \# +++HEADERS AND FOOTERS+++
10561 \#
10562 \# HEADERS_AND_FOOTERS
10563 \# -------------------
10564 \# *Arguments:
10565 \#   HEADER_RECTO_QUAD \
10566 \#   HEADER_RECTO_STRING \
10567 \#   FOOTER_RECTO_QUAD \
10568 \#   FOOTER_RECTO_STRING \
10569 \#   HEADER_VERSO_QUAD \
10570 \#   HEADER_VERSO_STRING \
10571 \#   FOOTER_VERSO_QUAD \
10572 \#   FOOTER_VERSO_STRING
10573 \#   | <anything>
10574 \# *Function:
10575 \#   Allows having both headers and footers.  Sets register
10576 \#   #HDRFTR_BOTH to 1; collects HEADER/FOOTER_RECTO/VERSO
10577 \#   information; appends FOOTER_RECTO and FOOTER_VERSO to
10578 \#   START and turns off pagination; appends to macros
10579 \#   PRINT_USERDEF_HDRFTR and HEADER the necessary number
10580 \#   register manipulations and redefinitions of the
10581 \#   HEADER/FOOTER_RECTO/VERSO strings so that both
10582 \#   headers and footers get printed, with the appropriate
10583 \#   strings for each
10584 \# *Notes:
10585 \#   Works in conjunction with HDRFTR_RECTO and HDRFTR_VERSO (qqv.),
10586 \#   ergo all style changes must be done inline in the strings
10587 \#   passed as arguments.
10588 \#
10589 .MAC HEADERS_AND_FOOTERS END
10590 .    ie \\n[#NUM_ARGS]>1 \{\
10591 .    nr #HDRFTR_BOTH 1
10592 .    nr #FOOTERS_ON  1
10593 .    if !r#HEADER_RULE .nr #HEADER_RULE 1
10594 .    if !r#FOOTER_RULE .nr #FOOTER_RULE 1
10595 .    ds $HDR_RECTO_QUAD   \\$1
10596 .    ds $HDR_RECTO_STRING \\$2
10597 .    ds $FTR_RECTO_QUAD   \\$3
10598 .    ds $FTR_RECTO_STRING \\$4
10599 .    ds $HDR_VERSO_QUAD   \\$5
10600 .    ds $HDR_VERSO_STRING \\$6
10601 .    ds $FTR_VERSO_QUAD   \\$7
10602 .    ds $FTR_VERSO_STRING \\$8
10603 .am START DONE
10604 .   if \\\\n[#HDRFTR_BOTH]=1 \{\
10605 .      FOOTER_RECTO \\\\*[$FTR_RECTO_QUAD] "\\\\*[$FTR_RECTO_STRING]"
10606 .      FOOTER_VERSO \\\\*[$FTR_VERSO_QUAD] "\\\\*[$FTR_VERSO_STRING]"
10607 .      if \\\\n[#HEADER_RULE]=1 .HEADER_RULE
10608 .      ie \\\\n[#FOOTER_RULE]=1 .FOOTER_RULE
10609 .      el .FOOTER_RULE OFF
10610 .      if r #PAGINATE .rr #PAGINATE
10611 .      if r #PAGE_NUM_V_POS .rr #PAGE_NUM_V_POS
10612 .   \}
10613 .DONE
10614 .am PRINT_USERDEF_HDRFTR DONE
10615 .   if \\\\n[#HDRFTR_BOTH]=1 \{\
10616 .      if \\n[#FOOTERS_ON]=1 \{\
10617 .         if !\\\\n[#COLLATE]=1 \{\
10618 .            HEADER_RECTO \\*[$HDR_RECTO_QUAD] "\\*[$HDR_RECTO_STRING]"
10619 .            HEADER_VERSO \\*[$HDR_VERSO_QUAD] "\\*[$HDR_VERSO_STRING]"
10620 .            rr #FOOTERS_ON
10621 .            nr #HEADERS_ON 1
10622 .            ie \\\\n[#HEADER_RULE]=1 .HEADER_RULE
10623 .            el .HEADER_RULE OFF
10624 .         \}
10625 .      \}
10626 .      if \\n[#HEADERS_ON]=1 \{\
10627 .         FOOTER_RECTO \\*[$FTR_RECTO_QUAD] "\\*[$FTR_RECTO_STRING]"
10628 .         FOOTER_VERSO \\*[$FTR_VERSO_QUAD] "\\*[$FTR_VERSO_STRING]"
10629 .      \}
10630 .   \}
10631 .DONE
10632 .am HEADER DONE
10633 .   if \\\\n[#HDRFTR_BOTH]=1 \{\
10634 .      if r #START_FOR_FOOTERS .rr #START_FOR_FOOTERS
10635 .      rr #HEADERS_ON
10636 .      nr #FOOTERS_ON 1
10637 .      FOOTER_RECTO \\*[$FTR_RECTO_QUAD] "\\*[$FTR_RECTO_STRING]"
10638 .      FOOTER_VERSO \\*[$FTR_VERSO_QUAD] "\\*[$FTR_VERSO_STRING]"
10639 .      ie \\\\n[#FOOTER_RULE]=1 .FOOTER_RULE
10640 .      el .FOOTER_RULE OFF
10641 .   \}
10642 .DONE
10643 .    \}
10644 .    el \{\
10645 .       rr #HDRFTR_BOTH
10646 .       rr #USERDEF_HDRFTR
10647 .       rm $USERDEF_HDRFTR_RECTO
10648 .       rm $USERDEF_HDRFTR_VERSO
10649 .       FOOTERS OFF
10650 .       HEADERS
10651 .       if \\n[#COLLATE]=1 \{\
10652 .          nr #HEADER_STATE 1
10653 .          nr #PAGINATION_STATE 1
10654 .       \}
10655 .       PAGINATE
10656 .       PAGENUM_POS BOTTOM CENTER
10657 .       nr #HF_OFF 1
10658 .    \}
10659 .END
10660 \#
10661 \# ====================================================================
10662 \#
10663 \# +++HEADINGS+++
10664 \#
10665 .char \[hd-num-spacer]     \0
10666 .char \[parahead-spacer]   \~\~
10667 .char \[toc-hd-num-spacer] \h'\w'\[en]'u'
10668 .ds toc-word-space \ \" ie an unbreakable space
10669 \#
10670 \# HEADING
10671 \# -------
10672 \# *Arguments:
10673 \#   <heading level> [PARAHEAD] [NAMED <pdf-id>] <heading text>
10674 \# *Function:
10675 \#   Assigns a heading level to the heading text and prints heading
10676 \#   in the style set up for that level.  If PARAHEAD given, the
10677 \#   heading is attached to the body of the paragraph.  If NAMED
10678 \#   given, creates a target for pdf links.  Collects the heading
10679 \#   for the TOC and sets TOC indenting appropriate for the level.
10680 \# *Notes:
10681 \#   If PARAHEAD given, HEADING must come after PP.
10682 \#
10683 .MAC HEADING END
10684 '    br
10685 .    if \\n[@TOP] .br
10686 .    if !\B'\\$1' \{\
10687 .       tm1 "[mom]: The first argument to \\$0 must be a numeric heading level.
10688 .       ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
10689 .    \}
10690 .    if r #QUOTE     .rr #QUOTE
10691 .    if r #END_QUOTE .rr #END_QUOTE
10692 .    if r #EPIGRAPH  .rr #EPIGRAPH
10693 .    vs \\n[#DOC_LEAD]u
10694 .    if \\$1<\\n[#LEVEL] \
10695 .       nr #ACTIVE_LEVELS \\n[#LEVEL] \" loop count for resetting numbering registers
10696 .    nr #LAST_LEVEL \\n[#LEVEL]       \" used during TOC collection, if SPACE_TOC_ITEMS
10697 .    nr #LEVEL \\$1                   \" resets #LEVEL to arg
10698 .    shift
10699 .    nr #ARG_NUM 0 1
10700 .    while \\n+[#ARG_NUM]<=2 \{\
10701 .      if '\\$1'NAMED' \{\
10702 .         ds PDF_NM "\\$1 \\$2
10703 .         shift 2 \" \\$1 is now heading text
10704 .      \}
10705 .      if '\\$1'PARAHEAD' \{\
10706 .         nr #PARAHEAD 1
10707 .         shift \" \\$1 is now NAMED, if we have it; otherwise heading text
10708 .      \}
10709 .    \}
10710 .\" Spacing
10711 .    if \\n[#Q_LEAD_DIFF_CHECK] .sp -1
10712 .    if \\n[.t]<\\n[.v] .nr nl-from-heading \\n[nl]
10713 .    ie !\\n[#PARAHEAD] \{\
10714 .       if !\\n[@TOP] \{\
10715 .          nr #HEAD 1
10716 .          ie !\\n[#START] \{\
10717 .             nr #HEADING_NEEDS \\n[#NUM_ARGS]v+\\*[$HEAD_\\n[#LEVEL]_NEEDS]v+1v
10718 .             if \\n[#HEAD_\\n[#LEVEL]_SPACE_AFTER] .nr #HEADING_NEEDS +1v
10719 .             if \\n[.t]<\\n[#HEADING_NEEDS] .sp \\n[.t]u
10720 .             vpt 0
10721 .             if !\\n[#SPACE_ADDED] .if !\\n[#LINEBREAK] .sp
10722 .          \}
10723 .          el \{\
10724 .             ie !\\n[#PP] \{\
10725 .                rr #START
10726 .                RESTORE_SPACE
10727 .                if !\\n[#SPACE_ADDED] \
10728 .                   if !\\n[#COLUMNS] .sp
10729 .             \}
10730 .             el .sp
10731 .          \}
10732 .          if \\n[#EPIGRAPH] \
10733 .             if \\n[#SINGLE_SPACE] .sp
10734 .       \}
10735 .       if \\n[#PP_SPACE] \
10736 .          if \\n[#QUOTE_4_HD] .sp .5v
10737 .       ie !\\n[#SPACE_ADDED] \{\
10738 .          if !\\n[.ns] \{\
10739 .             ie !\\n[#NO_SHIM] \
10740 .                if !\\n[#HEAD_\\n[#LEVEL]_NO_SHIM] .SHIM
10741 .             el \{\
10742 .                if !\\n[#NO_FLEX] \
10743 .                   if !\\n[#HEAD_\\n[#LEVEL]_NO_FLEX] .FLEX 
10744 .             \}
10745 .          \}
10746 .       \}
10747 .       el .rr #SPACE_ADDED
10748 .       vpt
10749 .    \}
10750 .    el \{\
10751 .       if \\n[#NUM_ARGS]>1 \{\
10752 .          tm1 "[mom]: Error at line \\n[.c], \\$0.
10753 .          tm1 "       PARAHEAD may not be given more than 1 line of text.
10754 .          ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
10755 .       \}
10756 .       vpt 0
10757 .       if !(\\n[#PRINT_STYLE]=1)&(\\n[#SINGLE_SPACE]=1) .sp -1v
10758 .       if \\n[#QUOTE_4_HD] \{\
10759 .          sp -1v
10760 .          if \\n[#PP_SPACE] \{\
10761 .             sp .5v
10762 .             SHIM
10763 .         \}
10764 .       \}
10765 .       if (\\n[#QUOTE_4_HD]=0)&(\\n[#LB_4_HD]=0)&(\\n[#START]=0) \
10766 .          if !\\n[#LB_4_PARAHEAD] .sp -1v
10767 .    \}
10768 .    ev HEADING
10769 .    evc 0
10770 .\" Style
10771 .    if \\n[#PRINT_STYLE]=2 \{\
10772 .       fam \\*[$HEAD_\\n[#LEVEL]_FAM]
10773 .       ft  \\*[$HEAD_\\n[#LEVEL]_FT]
10774 .       ps  \\n[#DOC_PT_SIZE]u\\*[$HEAD_\\n[#LEVEL]_SIZE]
10775 .       nf
10776 .    \}
10777 .\" Numbering
10778 .    ds $TOC_HD_NUM_PREV \\*[$TOC_HD_NUM]
10779 .    rm $TOC_HD_NUM
10780 .    rm $PDF_HD_NUM
10781 .    ie \\n[#NUMBER_HEAD_\\n[#LEVEL]] \{\
10782 .       if \\n[#PREFIX_CH_NUM] .ds $HD_NUM \\n[#CH_NUM].
10783 .       nr #HEAD_\\n[#LEVEL]_NUM +1       \" incremented manually here; still auto-increments
10784 .\" Reset numbering registers for headings beneath current level
10785 .       nr @LEVEL \\n[#LEVEL] 1           \" loop step
10786 .       nr #LOOP \\n[#ACTIVE_LEVELS]      \" loop count
10787 .       while \\n+[@LEVEL]<=\\n[#LOOP] \
10788 .          if \\n[#HEAD_\\n[@LEVEL]_NUM] \
10789 .             nr #HEAD_\\n[@LEVEL]_NUM 0 1
10790 .\" Build numbering strings for body and toc
10791 .       nr @LEVEL 0 1                     \" loop step
10792 .       nr #LOOP \\n[#LEVEL]              \" loop count
10793 .       while \\n+[@LEVEL]<=\\n[#LOOP] \
10794 .          if \\n[#HEAD_\\n[@LEVEL]_NUM] \
10795 .             as $HD_NUM \\n[#HEAD_\\n[@LEVEL]_NUM].
10796 .       ie \\n[#TRUNC_TOC_HD_NUM] \
10797 .          ds $TOC_HD_NUM \\n[#HEAD_\\n[#LEVEL]_NUM].
10798 .       el .ds $TOC_HD_NUM \\*[$HD_NUM]
10799 .       if \\n[#LEVEL]=1 \
10800 .          ds $TOC_HD_NUM_PREV \\*[$TOC_HD_NUM]
10801 .       if \\n[#TOC_NO_HD_NUM] .rm $TOC_HD_NUM
10802 .       if !\\n[#HEAD_\\n[#LEVEL]_NUM]] .rm $TOC_HD_NUM
10803 .       as $HD_NUM \[hd-num-spacer]
10804 .       ds $PDF_HD_NUM \\*[$TOC_HD_NUM]
10805 .       if !'\\*[$TOC_HD_NUM]'' .as $TOC_HD_NUM \[toc-hd-num-spacer]
10806 .       if !'\\*[$PDF_HD_NUM]'' .as $PDF_HD_NUM " "
10807 .    \}
10808 .    el .nr @LEVEL \\n[#LEVEL] 1
10809 .\" TOC collection and formatting
10810 .    nr #TOC_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
10811 .    af #TOC_ENTRY_PN \\g[#PAGENUMBER]
10812 .    nr #ARG_NUM 0 1
10813 .    while \\n[#ARG_NUM]<\\n[#NUM_ARGS] \{\
10814 .       as $TOC_HEAD_\\n[#LEVEL]_ITEM "\\$[\\n+[#ARG_NUM]]
10815 .       if \\n[#NUM_ARGS]>\\n[#ARG_NUM] \
10816 .          as $TOC_HEAD_\\n[#LEVEL]_ITEM "\\*[toc-word-space]
10817 .    \}
10818 .    PDF_BOOKMARK \
10819         \\*[PDF_NM] \\n[#LEVEL]+1 \
10820         \\*[$PDF_HD_NUM] \\*[$TOC_HEAD_\\n[#LEVEL]_ITEM]
10821 .    rm PDF_NM
10822 .    rm $PDF_HD_NUM
10823 .    ev TOC_EV
10824 .    ie \\n[#PRINT_STYLE]=1 \{\
10825 .       fam \\*[$TYPEWRITER_FAM]
10826 .       ft  R
10827 .       ps  \\*[$TYPEWRITER_PS]
10828 .    \}
10829 .    el \{\
10830 .       FAMILY  \\*[$TOC_HEAD_\\n[#LEVEL]_FAM]
10831 .       FT      \\*[$TOC_HEAD_\\n[#LEVEL]_FT]
10832 .       ps \\n[#TOC_PS]u\\*[$TOC_HEAD_\\n[#LEVEL]_SIZE]
10833 .    \}
10834 .\" Indents for TOC heading levels.
10835 .\" First, numbered heads.  @LEVEL here is #LEVEL+1
10836 .    ie \\n[#NUMBER_HEAD_\\n[#LEVEL]] \{\
10837 .       ie !\\n[#TOC_NO_HD_NUM] \{\
10838 .          ie \\n[#TRUNC_TOC_HD_NUM] \{\
10839 .             if !\\n[#TOC_HEAD_\\n[@LEVEL]_INDENT_SET] \{\
10840 .                ie !\\n[#FROM_STYLE_\\n[@LEVEL]] \{\
10841 .                   ie !\\n[#NUMBER_HEAD_\\n[@LEVEL]] \
10842 .                      nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10843 \\n[#TOC_HEAD_\\n-[@LEVEL]_INDENT]+\
10844 \w'\\*[$TOC_HD_NUM]'+\
10845 1.5m
10846 .                   el \
10847 .                      nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10848 \\n[#TOC_HEAD_\\n-[@LEVEL]_INDENT]+\
10849 \w'\\*[$TOC_HD_NUM]'
10850 .                \}
10851 .                el \
10852 .                   nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10853                       \\n[#TOC_HEAD_\\n-[@LEVEL]_INDENT]
10854 .             \}
10855 .          \}
10856 .          el \{\
10857 .             if !\\n[#TOC_HEAD_\\n[@LEVEL]_INDENT_SET] \{\
10858 .                ie !\\n[#FROM_STYLE_\\n[@LEVEL]] \{\
10859 .                   ie \\n[#NUMBER_HEAD_\\n-[@LEVEL]] \{\
10860 .                      ie !\\n[#NUMBER_HEAD_\\n+[@LEVEL]] \
10861 .                         nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10862 \\n[#TOC_HEAD_\\n-[@LEVEL]_INDENT]+\
10863 \w'\\*[$TOC_HD_NUM_PREV]'+\
10864 1.5m
10865 .                      el \{\
10866 .\" Get the number of digits in the chapter number
10867 .                         ds ch-num-width \\n[#CH_NUM]
10868 .                         length ch-num-width \\*[ch-num-width]
10869 .                         nr ch-num-width -1
10870 .                         nr num-ch-digits \w'\0'*\\n[ch-num-width]
10871 .                         nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10872 \\n[#TOC_HEAD_\\n-[@LEVEL]_INDENT]+\
10873 \\n[num-ch-digits]+\
10874 \w'.\[toc-hd-num-spacer]'
10875 .                      \}
10876 .                   \}
10877 .                   el \
10878 .                      nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10879 \\n[#TOC_HEAD_\\n-[@LEVEL]_INDENT]+\
10880 \w'\\n[#TOC_HD_NUM].'
10881 .                   ie \\n[#LEVEL]=1 \
10882 .                      nr #TOC_HEAD_\\n+[@LEVEL]_INDENT +\w'\0'
10883 .                   el \{\
10884 .                      if !\\n[#NUMBER_HEAD_\\n[@LEVEL]] \{\
10885 .                         nr @LEVEL \\n+[@LEVEL] 1
10886 .                         nr #TOC_HEAD_\\n+[@LEVEL]_INDENT +\w'\0'
10887 .                      \}
10888 .                   \}
10889 .                \}
10890 .                el \
10891 .                   nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10892 \\n[#TOC_HEAD_\\n-[@LEVEL]_INDENT]+\
10893 \\n[#TOC_HEAD_\\n+[@LEVEL]_INDENT]
10894 .             \}
10895 .             if \\n[#LEVEL]=1 \{\
10896 .                if \\n[#NUMBER_HEAD_\\n[@LEVEL]] \{\
10897 .                   if \\n[#PREFIX_CH_NUM] \
10898 .                      nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10899 \w'\\*[$TOC_HD_NUM]'
10900 .                \}
10901 .             \}
10902 .          \}
10903 .       \}
10904 .       el \{\
10905 .          ie !\\n[#FROM_STYLE_\\n[@LEVEL]] \{\
10906 .             if !\\n[#TOC_HEAD_\\n[@LEVEL]_INDENT_SET] \
10907 .                nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10908                     \\n[#TOC_HEAD_\\n-[@LEVEL]_INDENT]+1.5m
10909 .          \}
10910 .          el \{\
10911 .             if !\\n[#TOC_HEAD_\\n[@LEVEL]_INDENT_SET] \
10912 .                nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10913 \\n[#TOC_HEAD_\\n-[@LEVEL]_INDENT]+\
10914 \\n[#TOC_HEAD_\\n+[@LEVEL]_INDENT]
10915 .          \}
10916 .       \}
10917 .    \}
10918 .\" Non-numbered heads
10919 .    el \{\
10920 .       nr @LEVEL \\n[#LEVEL] 1
10921 .\" increments @LEVEL even if false
10922 .       ie \\n[#FROM_STYLE_\\n+[@LEVEL]] \{\
10923 .          if !\\n[#TOC_HEAD_\\n[@LEVEL]_INDENT_SET] \{\
10924 .             nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10925 \\n[#TOC_HEAD_\\n[#LEVEL]_INDENT]+\
10926 \\n[#TOC_HEAD_\\n[@LEVEL]_INDENT]
10927 .             if !\\n[#LEVEL]=\\n[#LAST_LEVEL] \{\
10928 .                if \\n[#NUMBER_HEAD_\\n[@LEVEL]] \
10929 .                   nr #TOC_HEAD_\\n[#LEVEL]_INDENT \
10930 \\n[#TOC_HEAD_\\n[@LEVEL]_INDENT]+\
10931 \w'\\*[$TOC_HD_NUM_PREV]'
10932 .             \}
10933 .          \}
10934 .       \}
10935 .       el \{\
10936 .          nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10937               \\n[#TOC_HEAD_\\n-[@LEVEL]_INDENT]+1.5m
10938 .          if \\n[#LEVEL]=1 \{\
10939 .             if !\\n[#FROM_STYLE_1] \
10940 .                nr #TOC_HEAD_1_INDENT 0
10941 .          \}
10942 .       \}
10943 .    \}
10944 .    nr #TOC_HEAD_\\n[@LEVEL]_INDENT_SET 1
10945 .    HD_TO_TOC
10946 .    rm $TOC_HEAD_\\n[#LEVEL]_ITEM
10947 .\" Print heading
10948 .    if !\\n[#PARAHEAD] .\\*[$HEAD_\\n[#LEVEL]_QUAD]
10949 .    if \\n[#CAPS_ON] \{\
10950 .       CAPS OFF
10951 .       nr #CAPS_RESTORE 1
10952 .    \}
10953 .    if \\n[#HEAD_\\n[#LEVEL]_CAPS] \{\
10954 .       CAPS 
10955 .       nr #CAPS_OFF 1
10956 .    \}
10957 .    if \\n[#SMALLCAPS_ON] \{\
10958 .       SMALLCAPS OFF
10959 .       nr #SMALLCAPS_RESTORE 1
10960 .    \}
10961 .    if \\n[#HEAD_\\n[#LEVEL]_SMALLCAPS] \{\
10962 .       SMALLCAPS 
10963 .       nr #SMALLCAPS_OFF 1
10964 .    \}
10965 .    if !'\\*[$HEAD_\\n[#LEVEL]_COLOR]'' \
10966 .       COLOR \\*[$HEAD_\\n[#LEVEL]_COLOR]
10967 .    nop \X'ps: exec decornone'\c
10968 .    nr #ARG_NUM 0 1
10969 .    while \\n+[#ARG_NUM]<=\\n[#NUM_ARGS] \{\
10970 .       if \\n[#PARAHEAD] \
10971 .          nr #PP_TEXT_OFFSET \
10972               \w'\\*[$HD_NUM]\\$[\\n[#ARG_NUM]]'+\w'\[parahead-spacer]'
10973 .       if (\\n[#HEAD_\\n[#LEVEL]_UNDERSCORE]=0)&(\\n[#HEAD_\\n[#LEVEL]_UNDERSCORE2]=0) \{\
10974 .          ie \\n[#HD_NUM_INDENT] \{\
10975 .             if !'\\*[$HEAD_\\n[#LEVEL]_QUAD]'CENTER' \
10976 .                ti \\n[#HD_NUM_INDENT]u 
10977 .             PRINT \
10978 "\v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\\$[\\n[#ARG_NUM]]
10979 .             br
10980 .          \}
10981 .          el \{\
10982 .             ie !\\n[#PARAHEAD] \{\
10983 .                PRINT \
10984 "\v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\\*[$HD_NUM]\\$[\\n[#ARG_NUM]]
10985 .                br
10986 .             \}
10987 .             el \{\
10988 .                if (\\n[#PP]>0):(\\n[#INDENT_FIRST_PARAS]) \{\
10989 .                   if !\\n[#LB_4_PARAHEAD] \{\
10990 .                      if !\\n[#START] \{\
10991 .                         if \\n[#PP_ACTIVE] \{\
10992 .                            ie \\n[#PP]=1 .br
10993 .                            el \{\
10994 .                               nr #PP_TEXT_OFFSET +\\n[#PP_INDENT]
10995 .                               ti \\n[#PP_INDENT]u
10996 .                            \}
10997 .                         \}
10998 .                      \}
10999 .                   \}
11000 .                \}
11001 .                ie \\n[#PRINT_STYLE]=1 \
11002 .                   PRINT "\\*[UL]\\*[$HD_NUM]\\$[\\n[#ARG_NUM]]\\*[ULX]
11003 .                el .PRINT "\\*[$HD_NUM]\\$[\\n[#ARG_NUM]]
11004 .                rr #LB_4_PARAHEAD
11005 .                sp -1v
11006 .             \}
11007 .          \}
11008 .       \}
11009 .       if \\n[#HEAD_\\n[#LEVEL]_UNDERSCORE] \{\
11010 .          nr #SAVED_UL_WEIGHT \\n[#UNDERSCORE_WEIGHT]
11011 .          UNDERSCORE_WEIGHT \\*[$HEAD_\\n[#LEVEL]_UL_WEIGHT]
11012 .          ie \\n[#HD_NUM_INDENT] \{\
11013 .             if !'\\*[$HEAD_\\n[#LEVEL]_QUAD]'CENTER' \
11014 .                ti \\n[#HD_NUM_INDENT]u 
11015 .             UNDERSCORE \\*[$HEAD_\\n[#LEVEL]_UL_GAP] \
11016                 "\v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\\$[\\n[#ARG_NUM]]
11017 .             br
11018 .          \}
11019 .          el \{\
11020 .             ie !\\n[#PARAHEAD] \{\
11021 .                UNDERSCORE \\*[$HEAD_\\n[#LEVEL]_UL_GAP] \
11022 "\v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\\*[$HD_NUM]\\$[\\n[#ARG_NUM]]
11023 .                br
11024 .             \}
11025 .             el \{\
11026 .                if (\\n[#PP]>0):(\\n[#INDENT_FIRST_PARAS]) \{\
11027 .                   if !\\n[#LB_4_HD] \{\
11028 .                      if !\\n[#START] \{\
11029 .                         if \\n[#PP_ACTIVE] \{\
11030 .                   nr #PP_TEXT_OFFSET +\\n[#PP_INDENT]
11031 .                   if (\\n[#PRINT_STYLE]=1)&(\\n[#SINGLE_SPACE]=1) .sp -1v
11032 .                   ti \\n[#PP_INDENT]u
11033 .                         \}
11034 .                      \}
11035 .                   \}
11036 .                \}
11037 .                UNDERSCORE \\*[$HEAD_\\n[#LEVEL]_UL_GAP] \
11038                    "\\*[$HD_NUM]\\$[\\n[#ARG_NUM]]
11039 .                sp -1v
11040 .             \}
11041 .          \}
11042 .          nr #UNDERSCORE_WEIGHT \\n[#SAVED_UL_WEIGHT]
11043 .       \}
11044 .       if \\n[#HEAD_\\n[#LEVEL]_UNDERSCORE2] \{\
11045 .          nr #SAVED_UL2_WEIGHT \\n[#UNDERSCORE_WEIGHT]
11046 .          UNDERSCORE_WEIGHT \\*[$HEAD_\\n[#LEVEL]_UL2_WEIGHT]
11047 .          ie \\n[#HD_NUM_INDENT] \{\
11048 .             if !'\\*[$HEAD_\\n[#LEVEL]_QUAD]'CENTER' \
11049 .                ti \\n[#HD_NUM_INDENT]u 
11050 .             UNDERSCORE2 \\*[$HEAD_\\n[#LEVEL]_UL2_GAP_1] \
11051                 \\*[$HEAD_\\n[#LEVEL]_UL2_GAP_2] \
11052                 "\v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\\$[\\n[#ARG_NUM]]
11053 .             br
11054 .          \}
11055 .          el \{\
11056 .             ie !\\n[#PARAHEAD] \{\
11057 .                UNDERSCORE2 \\*[$HEAD_\\n[#LEVEL]_UL2_GAP_1] \
11058                    \\*[$HEAD_\\n[#LEVEL]_UL2_GAP_2] \
11059 "\v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\\*[$HD_NUM]\\$[\\n[#ARG_NUM]]
11060 .                br
11061 .             \}
11062 .             el \{\
11063 .                if (\\n[#PP]>0):(\\n[#INDENT_FIRST_PARAS]) \{\
11064 .                   if !\\n[#LB_4_HD] \{\
11065 .                      if !\\n[#START] \{\
11066 .                         if \\n[#PP_ACTIVE] \{\
11067 .                            nr #PP_TEXT_OFFSET +\\n[#PP_INDENT]
11068 .                            if (\\n[#PRINT_STYLE]=1)&(\\n[#SINGLE_SPACE]=1) \
11069 .                               sp -1v
11070 .                            ti \\n[#PP_INDENT]u
11071 .                         \}
11072 .                      \}
11073 .                   \}
11074 .                \}
11075 .                UNDERSCORE2 \\*[$HEAD_\\n[#LEVEL]_UL2_GAP_1] \
11076 \\*[$HEAD_\\n[#LEVEL]_UL2_GAP_2] "\\*[$HD_NUM]\\$[\\n[#ARG_NUM]]
11077 .                sp -1v
11078 .             \}
11079 .          \}
11080 .          nr #UNDERSCORE_WEIGHT \\n[#SAVED_UL2_WEIGHT]
11081 .       \}
11082 .       if !\\n[#HD_NUM_INDENT] .nr #HD_NUM_INDENT \w'\\*[$HD_NUM]'
11083 .    \}
11084 .    if !\\n[#PARAHEAD] \
11085 .       if \\n[#HEAD_\\n[#LEVEL]_SPACE_AFTER] .sp
11086 .    if \\n[#CAPS_OFF] \{\
11087 .       CAPS OFF
11088 .       rr #CAPS_OFF
11089 .    \}
11090 .    if \\n[#CAPS_RESTORE] \{\
11091 .       CAPS
11092 .       rr #CAPS_RESTORE
11093 .    \}
11094 .    if \\n[#SMALLCAPS_OFF] \{\
11095 .       SMALLCAPS OFF
11096 .       rr #SMALLCAPS_OFF
11097 .    \}
11098 .    if \\n[#SMALLCAPS_RESTORE] \{\
11099 .       SMALLCAPS
11100 .       rr #SMALLCAPS_RESTORE
11101 .    \}
11102 .    ev
11103 .    rm $HD_NUM
11104 .    rr #HD_NUM_INDENT
11105 .    if \\n[#PARAHEAD]   .ti \\n[#PP_TEXT_OFFSET]u
11106 .    if !\\n[#PARAHEAD]  .nr #PP 0
11107 .    rr #PARAHEAD
11108 .    if \\n[#LB_4_HD]    .rr #LB_4_HD
11109 .    if \\n[#QUOTE_4_HD] .rr #QUOTE_4_HD
11110 .    if \\n[@TOP] \{\
11111 .       ch RR_@TOP
11112 .       rr @TOP
11113 .       rs
11114 .       nop \&
11115 .       sp -1
11116 .    \}
11117 .    vpt
11118 .    rr nl-from-heading
11119 .END
11120 \#
11121 \# HEADING_STYLE
11122 \# -------------
11123 \# *Arguments:
11124 \#   <level>
11125 \#   FAMILY <family>
11126 \#   FONT   <font>
11127 \#   SIZE   <+|-n>
11128 \#   COLOR  <color>
11129 \#   CAPS | NO_CAPS
11130 \#---when called as HEADING_STYLE, these are also available---
11131 \#   QUAD   <direction>
11132 \#   NUMBER | NO_NUMBER
11133 \#   SPACE_AFTER | NO_SPACE_AFTER
11134 \#   UNDERSCORE <weight> <gap> | UNDERSCORE2 <weight> <gap1> <gap2> 
11135 \#   NO_UNDERSCORE | NO_UNDERSCORE2
11136 \#   BASELINE_ADJUST
11137 \#---when called as TOC_ENTRY_STYLE this is also available---
11138 \#   INDENT
11139 \# *Function:
11140 \#   Sets up complete style parameters for HEADING <level>.  If
11141 \#   invoked as TOC_ENTRY_STYLE, sets up parameters for the
11142 \#   corresponding TOC entry at <level>.
11143 \# *Notes:
11144 \#   Arguments may be given in any order.  Any not given retain
11145 \#   their current values.  Defaults for an initial 9 levels of
11146 \#   heading are set up in PRINTSTYLE.
11147 \#
11148 \#   NUMBER indicates that hierarchic numbering of <level> should be
11149 \#   prepended to heading text.  If invoked as TOC_ENTRY_STYLE,
11150 \#   prepend numbering to TOC entries at <level> (only works if
11151 \#   NUMBER is given to the corresponding HEADING <level>).
11152 \#
11153 \#   INDENT refers to the indent for <level> in the TOC.  It is
11154 \#   measured from the left offset of the entry level above it
11155 \#   (including numbering, if present).  TOC entry levels beneath
11156 \#   <level> will have their indents adjusted accordingly.
11157 \#
11158 .MAC HEADING_STYLE END
11159 .    if !\B'\\$1' \{\
11160 .       tm1 "[mom]: The first argument to \\$0 must be a numeric heading level.
11161 .       ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
11162 .    \}
11163 .    nr #LEVEL \\$1
11164 .    if \\n[#FROM_OLDSTYLE] .nr #LEVEL_\\n[#LEVEL]_SET 1
11165 .    shift
11166 .\" Prepend TOC_ to style strings if called as TOC_ENTRY_STYLE
11167 .    if '\\$0'TOC_ENTRY_STYLE' .ds $TOC TOC_
11168 .    nr #ARG_NUM 0 1
11169 .    nr #ATTRIB \\n[#NUM_ARGS]
11170 .    while \\n+[#ARG_NUM]<=\\n[#ATTRIB] \{\
11171 .       if '\\$1'UNDERSCORE' \{\
11172 .          nr #HEAD_\\n[#LEVEL]_UNDERSCORE 1
11173 .          shift
11174 .          if '\\$1'' \{\
11175 .             tm1 "[mom]: The UNDERSCORE argument to \\$0 requires a rule weight.
11176 .             ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
11177 .          \}
11178 .          ds $HEAD_\\n[#LEVEL]_UL_WEIGHT \\$1
11179 .          shift
11180 .          if '\\$1'' \{\
11181 .             tm1 "[mom]: The UNDERSCORE argument to \\$0 requires a rule gap.
11182 .             ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
11183 .          \}
11184 .          ds $HEAD_\\n[#LEVEL]_UL_GAP \\$1
11185 .          shift
11186 .       \}
11187 .       if '\\$1'NO_UNDERSCORE' \{\
11188 .          rr #HEAD_\\n[#LEVEL]_UNDERSCORE
11189 .          shift
11190 .       \}
11191 .       if '\\$1'UNDERSCORE2' \{\
11192 .          nr #HEAD_\\n[#LEVEL]_UNDERSCORE2 1
11193 .          shift
11194 .          if '\\$1'' \{\
11195 .             tm1 "[mom]: The UNDERSCORE2 argument to \\$0 requires a rule weight.
11196 .             ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
11197 .          \}
11198 .          ds $HEAD_\\n[#LEVEL]_UL2_WEIGHT \\$1
11199 .          shift
11200 .          if '\\$1'' \{\
11201 .             tm1 "[mom]: The UNDERSCORE2 argument to \\$0 requires a rule gap.
11202 .             ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
11203 .          \}
11204 .          ds $HEAD_\\n[#LEVEL]_UL2_GAP_1 \\$1
11205 .          shift
11206 .          if '\\$1'' \{\
11207 .             tm1 "[mom]: The UNDERSCORE2 argument to \\$0 requires an inter-rule gap.
11208 .             ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
11209 .          \}
11210 .          ds $HEAD_\\n[#LEVEL]_UL2_GAP_2  \\$1
11211 .          shift
11212 .       \}
11213 .       if '\\$1'NO_UNDERSCORE2' \{\
11214 .          rr #HEAD_\\n[#LEVEL]_UNDERSCORE2
11215 .          shift
11216 .       \}
11217 .       if '\\$1'SPACE_AFTER' \{\
11218 .          nr #HEAD_\\n[#LEVEL]_SPACE_AFTER 1
11219 .          shift
11220 .       \}
11221 .       if '\\$1'NO_SPACE_AFTER' \{\
11222 .          rr #HEAD_\\n[#LEVEL]_SPACE_AFTER
11223 .          shift
11224 .       \}
11225 .       if '\\$1'FAMILY' \{\
11226 .          shift
11227 .          ds $\\*[$TOC]HEAD_\\n[#LEVEL]_FAM  \\$1
11228 .          shift
11229 .       \}
11230 .       if '\\$1'FONT' \{\
11231 .          shift
11232 .          ds $\\*[$TOC]HEAD_\\n[#LEVEL]_FT   \\$1
11233 .          shift
11234 .       \}
11235 .       if '\\$1'SIZE' \{\
11236 .          shift
11237 .          ds $\\*[$TOC]HEAD_\\n[#LEVEL]_SIZE \\$1
11238 .          shift
11239 .       \}
11240 .       if '\\$1'QUAD' \{\
11241 .          shift
11242 .          ds $QUAD_TYPE \\$1
11243 .          substring $QUAD_TYPE 0 0
11244 .          if '\\*[$QUAD_TYPE]'L' .ds $HEAD_\\n[#LEVEL]_QUAD LEFT
11245 .          if '\\*[$QUAD_TYPE]'C' .ds $HEAD_\\n[#LEVEL]_QUAD CENTER
11246 .          if '\\*[$QUAD_TYPE]'R' .ds $HEAD_\\n[#LEVEL]_QUAD RIGHT
11247 .          shift
11248 .       \}
11249 .       if '\\$1'COLOR' \{\
11250 .          shift
11251 .          ds $\\*[$TOC]HEAD_\\n[#LEVEL]_COLOR \\$1
11252 .          shift
11253 .       \}
11254 .       if '\\$1'BASELINE_ADJUST' \{\
11255 .          shift
11256 .          ds $HEAD_\\n[#LEVEL]_BASELINE_ADJ \\$1
11257 .          shift
11258 .       \}
11259 .       if '\\$1'CAPS' \{\
11260 .          nr #\\*[$TOC]HEAD_\\n[#LEVEL]_CAPS 1
11261 .          shift
11262 .       \}
11263 .       if '\\$1'NO_CAPS' \{\
11264 .          rr #HEAD_\\n[#LEVEL]_CAPS
11265 .          shift
11266 .       \}
11267 .       if '\\$1'SMALLCAPS' \{\
11268 .          nr #\\*[$TOC]HEAD_\\n[#LEVEL]_SMALLCAPS 1
11269 .          shift
11270 .       \}
11271 .       if '\\$1'NO_SMALLCAPS' \{\
11272 .          rr #HEAD_\\n[#LEVEL]_SMALLCAPS
11273 .          shift
11274 .       \}
11275 .       if '\\$1'NUMBER' \{\
11276 .          nr #NUMBER_HEAD_\\n[#LEVEL] 1
11277 .          nr #HEAD_\\n[#LEVEL]_NUM 0 1
11278 .          shift
11279 .       \}
11280 .       if '\\$1'NO_NUMBER' \{\
11281 .          rr #NUMBER_HEAD_\\n[#LEVEL]
11282 .          shift
11283 .       \}
11284 .       if '\\$1'INDENT' \{\
11285 .          shift
11286 .          nr #TOC_HEAD_\\n[#LEVEL]_INDENT \\$1
11287 .          nr #FROM_STYLE_\\n[#LEVEL] 1
11288 .          shift
11289 .       \}
11290 .       if '\\$1'NEEDS' \{\
11291 .          shift
11292 .          ds $HEAD_\\n[#LEVEL]_NEEDS \\$1
11293 .          shift
11294 .       \}
11295 .       if '\\$1'SHIM' \{\
11296 .          rr #HEAD_\\n[#LEVEL]_NO_SHIM
11297 .          shift
11298 .       \}
11299 .       if '\\$1'NO_SHIM' \{\
11300 .          nr #HEAD_\\n[#LEVEL]_NO_SHIM 1
11301 .          shift
11302 .       \}
11303 .       if '\\$1'FLEX' \{\
11304 .          rr #HEAD_\\n[#LEVEL]_NO_FLEX
11305 .          shift
11306 .       \}
11307 .       if '\\$1'NO_FLEX' \{\
11308 .          nr #HEAD_\\n[#LEVEL]_NO_FLEX 1
11309 .          shift
11310 .       \}
11311 .    \}
11312 .    rr #LEVEL
11313 .    if d$TOC .rm $TOC
11314 .END
11315 .
11316 .ALIAS TOC_ENTRY_STYLE HEADING_STYLE
11317 \#
11318 \# OLDSTYLE HEADINGS
11319 \# -----------------
11320 \# *Arguments:
11321 \#   None.
11322 \# *Function:
11323 \#   Called from HEAD, SUBHEAD, and SUBSUBHEAD, sets style
11324 \#   parameters for HEADINGs 1-3 to former mom defaults for those macros.
11325 \#   Any styles already assigned to those levels are retained.
11326 \#
11327 \#   Called by user with no argument, allows use of old style HEAD,
11328 \#   SUBHEAD, and SUBSUBHEAD without generating the deprecated msg.
11329 \# *Notes:
11330 \#   For backward compatibility, and to ease the transition to
11331 \#   the HEADING scheme for heads.
11332 \#
11333 \#   Paraheads must be set with .HEADING <level> PARAHEAD; attempts
11334 \#   to call PARAHEAD abort with an instructive message.
11335 \#
11336 .MAC OLDSTYLE_HEADINGS END
11337 .    if '\\$1'' .nr #SKIP_MSG 1
11338 .    nr #FROM_OLDSTYLE 1 \" Used in HEADING
11339 .    if \\n[#PRINT_STYLE]=1 \{\
11340 .       if !\\n[#LEVEL_1_SET] \{\
11341 .          HEADING_STYLE 1 \
11342              FONT R \
11343              SIZE +0 \
11344              QUAD C \
11345              CAPS \
11346              UNDERSCORE .5 2p \
11347              BASELINE_ADJUST 0 \
11348              SPACE_AFTER
11349 .            nr #OLDSTYLE_HD 1
11350 .            return
11351 .       \}
11352 .       if !\\n[#LEVEL_2_SET] \{\
11353 .          HEADING_STYLE 2 \
11354              FONT R \
11355              SIZE +0 \
11356              UNDERSCORE .5 2p \
11357              BASELINE_ADJUST \\n[.v]/8
11358 .            nr #OLDSTYLE_SH 1
11359 .            return
11360 .       \}
11361 .       if !\\n[#LEVEL_3_SET] \{\
11362 .          HEADING_STYLE 3 \
11363              FONT R \
11364              SIZE +0 \
11365              BASELINE_ADJUST \\n[.v]/8
11366 .            nr #OLDSTYLE_SSH 1
11367 .            return
11368 .       \}
11369 .    \}
11370 .    if \\n[#PRINT_STYLE]=2 \{\
11371 .       if !\\n[#LEVEL_1_SET] \{\
11372 .          HEADING_STYLE 1 \
11373              FAMILY \E*[$DOC_FAM] \
11374              FONT B \
11375              SIZE +1 \
11376              QUAD C \
11377              CAPS \
11378              UNDERSCORE .5 2p \
11379              BASELINE_ADJUST 0 \
11380              SPACE_AFTER
11381 .            nr #OLDSTYLE_HD 1
11382 .            return
11383 .       \}
11384 .       if !\\n[#LEVEL_2_SET] \{\
11385 .          HEADING_STYLE 2 \
11386              FAMILY \E*[$DOC_FAM] \
11387              FONT B \
11388              SIZE +.5 \
11389              BASELINE_ADJUST \\n[.v]/8
11390 .            nr #OLDSTYLE_SH 1
11391 .            return
11392 .       \}
11393 .       if !\\n[#LEVEL_3_SET] \{\
11394 .          HEADING_STYLE 3 \
11395              FAMILY \E*[$DOC_FAM] \
11396              FONT I \
11397              SIZE +.5 \
11398              BASELINE_ADJUST \\n[.v]/8
11399 .            nr #OLDSTYLE_SSH 1
11400 .            return
11401 .       \}
11402 .    \}
11403 .    rr #FROM_OLDSTYLE
11404 .END
11405 \#
11406 \# "Deprecated" message
11407 \#
11408 .MAC DEPRECATED END
11409 .    if !\\n[#SKIP_MSG] \{\
11410 .       tm1 "[mom]: Macro '\\$1' at line \\n[.c] is deprecated.
11411 .       tm1 "       Invoking HEADING \\$2 instead and assigning style defaults
11412 .       tm1 "          from former \\$1 as described in the documentation.
11413 .       tm1 "       If another style is desired, use HEADING_STYLE \\$2 to
11414 .       tm1 "          create it (see docs).
11415 .       tm1 "       Further warnings will not be emitted for \\$1.
11416 .       tm1 "       To avoid this message when using the deprecated HEAD,
11417 .       tm1 "          SUBHEAD, and SUBSUBHEAD macros, add '.OLDSTYLE_HEADINGS'
11418 .       tm1 "          after PRINTSTYLE before START.
11419 .       rm $MACRO
11420 .    \}
11421 .END
11422 \#
11423 \# Wrappers around old-style headings.
11424 \#
11425 .MAC HEAD END
11426 .    if !\\n[#OLDSTYLE_HD] \{\
11427 .       DEPRECATED HEAD 1
11428 .       OLDSTYLE_HEADINGS HEAD
11429 .    \}
11430 .    HEADING 1 \\$@
11431 .END
11432 \#
11433 .MAC SUBHEAD END
11434 .    if !\\n[#OLDSTYLE_SH] \{\
11435 .       DEPRECATED SUBHEAD 2
11436 .       OLDSTYLE_HEADINGS SUBHEAD
11437 .    \}
11438 .     HEADING 2 \\$@
11439 .END
11440 \#
11441 .MAC SUBSUBHEAD END
11442 .    if !\\n[#OLDSTYLE_SSH] \{\
11443 .       DEPRECATED SUBSUBHEAD 3
11444 .       OLDSTYLE_HEADINGS SUBSUBHEAD
11445 .    \}
11446 .    HEADING 3 \\$@
11447 .END
11448 \#
11449 .MAC PARAHEAD END
11450 .    tm1 "[mom]: \\$0 is no longer a valid macro.
11451 .    tm1 "       Use 'HEADING <level> PARAHEAD <text>' instead.
11452 .    tm1 "       You will probably want to invoke HEADING_STYLE to set
11453 .    tm1 "       the type parameters for the parahead.  See docs.
11454 .    ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
11455 .END
11456 \#
11457 \# Wrapper macro for oldstyle NUMBER_HEADS, NUMBER_SUBHEADS...
11458 \#
11459 .MAC HEADING_NUMBERS END
11460 .    if '\\$0'NUMBER_PARAHEADS' \{\
11461 .       tm1 "[mom]: \\$0 is no longer a valid macro.
11462 .       tm1 "       Use 'HEADING_STYLE <level> NUMBER' instead.  See docs.
11463 .       ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
11464 .       return
11465 .    \}
11466 .    if '\\$0'NUMBER_HEADS'       .nr level 1
11467 .    if '\\$0'NUMBER_SUBHEADS'    .nr level 2
11468 .    if '\\$0'NUMBER_SUBSUBHEADS' .nr level 3
11469 .    ds mom "[mom]:\"
11470 .    ie '\\$1'' .ds $PARAM NUMBER
11471 .    el \{\
11472 .       ds $PARAM NO_NUMBER
11473 .       ds $SWITCH " \\$1
11474 .    \}
11475 .    HEADING_STYLE \\n[level] \\*[$PARAM]
11476 .    if (\\n[#OLDSTYLE_HD]=1):(\\n[#OLDSTYLE_SH]=1):(\\n[#OLDSTYLE_SSH]=1) \{\
11477 .       tm1 "\\*[mom] OLDSTYLE_HEADINGS detected.
11478 .       ds mom "      \"
11479 .    \}
11480 .    tm1 "\\*[mom] Setting HEADING_STYLE \\n[level] to '\\*[$PARAM]' at '\\$0\\*[$SWITCH]', line \\n[.c].
11481 .    rm $PARAM
11482 .    rm $SWITCH
11483 .END
11484 .
11485 .ALIAS NUMBER_HEADS       HEADING_NUMBERS
11486 .ALIAS NUMBER_SUBHEADS    HEADING_NUMBERS
11487 .ALIAS NUMBER_SUBSUBHEADS HEADING_NUMBERS
11488 .ALIAS NUMBER_PARAHEADS   HEADING_NUMBERS
11489 \#
11490 \# PREFIX CHAPTER NUMBERS TO HEADINGS/TOC ENTRIES
11491 \# ----------------------------------------------
11492 \# *Arguments:
11493 \#   <none> | <chapter number> | <anything>
11494 \# *Function:
11495 \#   Toggles register #PREFIX_CH_NUM. Sets register #CH_NUM from
11496 \#   string $CHAPTER if $CHAPTER is a digit; if <chapter number> arg
11497 \#   given, sets #CH_NUM to arg.
11498 \# *Notes:
11499 \#   Default is OFF.
11500 \#
11501 .MAC PREFIX_CHAPTER_NUMBER END
11502 .    ie '\\$1'' .nr #PREFIX_CH_NUM 1
11503 .    el .rr #PREFIX_CH_NUM
11504 .END
11505 \#
11506 \# ====================================================================
11507 \#
11508 \# +++LINE BREAKS+++
11509 \#
11510 \# LINEBREAK CHARACTER
11511 \# -------------------
11512 \# *Arguments:
11513 \#   [character] [iterations] [vertical adjustment]
11514 \# *Function:
11515 \#   Allows user to specify a line break character and the number
11516 \#   of times to repeat it horizontally.
11517 \# *Notes:
11518 \#   Without an argument, LINEBREAK_CHAR will deposit a blank line.
11519 \#
11520 \#   Vertical adjustment requires a unit of measure (most likely
11521 \#   "p"), and has to be preceded by +|-
11522 \#
11523 .MAC LINEBREAK_CHAR END
11524 .    nr #REPEAT 1
11525 .    ds $LINEBREAK_CHAR \\$1
11526 .    if !'\\$2'' .nr #LB_CHAR_ITERATIONS \\$2
11527 .    if !'\\$3'' .ds $LINEBREAK_CHAR_V_ADJ \\$3
11528 .    if '\\*[$LINEBREAK_CHAR_V_ADJ]'' .ds $LINEBREAK_CHAR_V_ADJ +0
11529 .    if \\n[#LB_CHAR_ITERATIONS] \{\
11530 .       while (\\n[#LB_CHAR_ITERATIONS]>\\n[#REPEAT]) \{\
11531 .          as $LINEBREAK_CHAR "\\ \\$1
11532 .          nr #REPEAT \\n[#REPEAT]+1
11533 .       \}
11534 .    \}
11535 .    rr #REPEAT
11536 .    rr #LB_CHAR_ITERATIONS
11537 .END
11538 \#
11539 \# LINE BREAK
11540 \# ----------
11541 \# *Arguments:
11542 \#   <none>
11543 \# *Function:
11544 \#   Deposits line break character.
11545 \# *Notes:
11546 \#   If $LINEBREAK_CHAR is blank, simply advances 2 line spaces.
11547 \#
11548 .MAC LINEBREAK END
11549 .    if r #Q_AT_TOP .rr #Q_AT_TOP
11550 .    ie  '\\*[$LINEBREAK_CHAR]'' .sp 2
11551 .    el \{\
11552 .       ie \\n[#END_QUOTE] .
11553 .       el .sp
11554 .       ev LINEBREAK
11555 .       evc 0
11556 .       CENTER
11557 .       PRINT \
11558 \m[\\*[$LINEBREAK_COLOR]]\v'\\*[$LINEBREAK_CHAR_V_ADJ]'\
11559 \\*[$LINEBREAK_CHAR]\m[]
11560 .       sp
11561 .       ev
11562 .       QUAD \\*[$DOC_QUAD]
11563 .    \}
11564 .    nr #LINEBREAK 1
11565 .    if r #QUOTE .rr #QUOTE
11566 .    if r #END_QUOTE .rr #END_QUOTE
11567 .    nr #PP 0
11568 .    nr #LB_4_HD       1
11569 .    nr #LB_4_PARAHEAD 1
11570 .END
11571 \#
11572 \# ====================================================================
11573 \#
11574 \# +++PARAGRAPHS+++
11575 \#
11576 \# PARAGRAPH FONT
11577 \# --------------
11578 \# *Argument:
11579 \#   <font of running text>
11580 \# *Function:
11581 \#   Creates or modifies string $PP_FT.
11582 \# *Notes:
11583 \#   Affects all paragraphs.
11584 \#
11585 .MAC PP_FONT END
11586 .    if \\n[#PRINT_STYLE]=1 \{\
11587 .       ie \\n[#ITALIC_MEANS_ITALIC] .nop
11588 .       el .return
11589 .    \}
11590 .    if \\n[#COLLATE]=1 \
11591 .       if !'\\*[$SAVED_PP_FT]'' .rm $SAVED_PP_FT
11592 .    ds $PP_FT \\$1
11593 .    FT \\*[$PP_FT]
11594 .END
11595 \#
11596 \# PARAGRAPH INDENT
11597 \# ----------------
11598 \# *Argument:
11599 \#   <amount to indent paragraphs in running text (ipPcm)>
11600 \# *Function:
11601 \#   Allows user to change the default para indent.  The change will
11602 \#   affect the indent of QUOTEs and BLOCKQUOTEs as well.
11603 \# *Notes:
11604 \#   Default for printstyle TYPEWRITE is 1/2-inch.  Default for
11605 \#   printstyle TYPESET is 2 ems.  The defaults are set in
11606 \#   PRINTSTYLE, not DEFAULTS.
11607 \#
11608 .MAC PARA_INDENT END
11609 .    ie \B'\\$1' \{\
11610 .       nr #PP_INDENT (\\$1)
11611 .       nr #SAVED_PP_INDENT \\n[#PP_INDENT]
11612 .    \}
11613 .    el \{\
11614 .       ie '\\$1'' \{\
11615 .          nr #PP_INDENT \\n[#SAVED_PP_INDENT]
11616 .          rr #SAVED_PP_INDENT
11617 .       \}
11618 .       el \{\
11619 .          nr #SAVED_PP_INDENT \\n[#PP_INDENT]
11620 .          rr #PP_INDENT
11621 .       \}
11622 .    \}
11623 .END
11624 \#
11625 \# INDENT FIRST PARAGRAPHS
11626 \# -----------------------
11627 \# *Arguments:
11628 \#   <none> | <anything>
11629 \# *Function:
11630 \#   By default, the first para of a document, as well as the first
11631 \#   paras of blockquotes and block-style epigraphs are not indented.
11632 \#   When invoked, this macro will indent all paras.
11633 \# *Notes:
11634 \#   Default is OFF.
11635 \#
11636 .MAC INDENT_FIRST_PARAS END
11637 .    ie '\\$1'' .nr #INDENT_FIRST_PARAS 1
11638 .    el .rr #INDENT_FIRST_PARAS
11639 .END
11640 \#
11641 \# INTER-PARAGRAPH SPACING
11642 \# -----------------------
11643 \# *Arguments:
11644 \#   <none> | <anything>
11645 \# *Function:
11646 \#   Adds a line space between paragraphs in body text.  Block quotes
11647 \#   are unaffected.
11648 \# *Notes:
11649 \#   Default is OFF.  PARA_SPACE is not recommended for use with
11650 \#   PRINTSTYLE TYPEWRITE without SINGLESPACE.
11651 \#
11652 .MAC PARA_SPACE END
11653 .    ie '\\$1'' \
11654 .       nr #PP_SPACE 1
11655 .    el \{\
11656 .       ie \B'\\$1' \{\
11657 .          nr #PP_SPACE 1
11658 .          ds $PP_SPACE_AMOUNT \\$1
11659 .       \}
11660 .       el .rr #PP_SPACE
11661 .    \}
11662 .END
11663 \#
11664 \# PARAGRAPH
11665 \# ---------
11666 \# *Arguments:
11667 \#   <none>
11668 \# *Function:
11669 \#   Figures out what to do with paragraphs under differing conditions.
11670 \# *Notes:
11671 \#   Note the use of transparent line break (\!.br) to get
11672 \#   PP to work within blockquotes and epigraphs.
11673 \#
11674 \#   PP_STYLE 1 = regular paras; 2 = blockquotes, epigraphs
11675 \#
11676 .MAC PP END
11677 .    if \\n[#COVERTEXT_PP] \{\
11678 .       ie \\n[#INDENT_ACTIVE] .ti \\n[#INDENT]u+\\n[#PP_INDENT]u
11679 .       el .ti \\n[#PP_INDENT]u
11680 .       return
11681 .    \}
11682 .    if \\n[#DOC_TYPE]=4 \{\
11683 .       if !'\\n[.z]'' .di
11684 .       nr #TOTAL_FIELDS \\n[#FIELD]
11685 .       nr #FIELD        0 1
11686 .       nr #NUM_FIELDS   0 1
11687 .       if \\n[#TOTAL_FIELDS]>0 \{\
11688 .          while \\n+[#NUM_FIELDS]<=\\n[#TOTAL_FIELDS] \{\
11689 .             nf
11690 .             LETTERHEAD\\n+[#FIELD]
11691 .             QUAD \\*[$DOC_QUAD]
11692 .             ALD \\n[#DOC_LEAD]u
11693 .             if \\n[#DATE_FIRST]=1 .ALD \\n[#DOC_LEAD]u
11694 .             rr #DATE_FIRST
11695 .             rm LETTERHEAD\\n[#FIELD]
11696 .          \}
11697 .          rr #FIELD
11698 .          rr #NUM_FIELDS
11699 .          rr #TOTAL_FIELDS
11700 .       \}
11701 .    \}
11702 .    rr #PP_ACTIVE
11703 .    if r #Q_AT_TOP .rr #Q_AT_TOP
11704 .    if \\n[#PP_STYLE]=1 \{\
11705 .       if \\n[#ENDNOTE] \{\
11706 .          nr #RESET_PARA_SPACE \\n[#PP_SPACE]
11707 .          ie \\n[#EN_PP_SPACE] .PARA_SPACE
11708 .          el .PARA_SPACE OFF
11709 .       \}
11710 .       if !\\n[#ENDNOTE] .po \\n[#L_MARGIN]u
11711 .       if \\n[#COLUMNS] \{\
11712 .          if !\\n[#ENDNOTE] \{\
11713 .             po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
11714 .             nr #L_MARGIN \\n[.o]
11715 .          \}
11716 .       \}
11717 .       if \\n[#TAB_ACTIVE] .TAB \\n[#CURRENT_TAB]
11718 .       ie \\n[#PRINT_STYLE]=1 \{\
11719 .          TYPEWRITER
11720 .          ie \\n[#ENDNOTE] .vs \\n[#EN_LEAD]u
11721 .          el .vs \\n[#DOC_LEAD]u
11722 .          QUAD \\*[$DOC_QUAD]
11723 .          if \\n[#SLANT_ON] \
11724 .             if \\n[#UNDERLINE_SLANT] .UNDERLINE
11725 .          if '\\*[$PP_FT]'I' \
11726 .             if \\n[#ITALIC_MEANS_ITALIC] .FT I
11727 .       \}
11728 .       el \{\
11729 .          ie \\n[#ENDNOTE] \{\
11730 .             FAMILY  \\*[$EN_FAM]
11731 .             FT      \\*[$EN_FT]
11732 .             ps \\n[#EN_PS]u
11733 .             vs \\n[#EN_LEAD]u
11734 .             QUAD    \\*[$EN_QUAD]
11735 .          \}
11736 .          el \{\
11737 .             FAMILY  \\*[$DOC_FAM]
11738 .             if !'\\*[$SAVED_PP_FT]'' \{\
11739 .                ds $PP_FT \\*[$SAVED_PP_FT]
11740 .                rm $SAVED_PP_FT
11741 .             \}
11742 .             FT \\*[$PP_FT]
11743 .             ps \\n[#DOC_PT_SIZE]u
11744 .             vs      \\n[#DOC_LEAD]u
11745 .             QUAD    \\*[$DOC_QUAD]
11746 .          \}
11747 .       \}
11748 .       ie \\n[#PP]=0 \{\
11749 .          if \\n[#INDENT_FIRST_PARAS] \{\
11750 .             ie \\n[#INDENT_ACTIVE] .ti \\n[#INDENT]u+\\n[#PP_INDENT]u
11751 .             el .ti \\n[#PP_INDENT]u
11752 .             if '\\n[.z]'END_NOTES' \
11753 .                ti \\n[#EN_PP_INDENT]u+\\n[#EN_TEXT_INDENT]u
11754 .          \}
11755 .          if r #END_QUOTE \{\
11756 .             if \\n[#END_QUOTE] \{\
11757 .                if !\\n[#LINEBREAK] \{\
11758 .                   ie \\n[#INDENT_ACTIVE] .ti \\n[#INDENT]u+\\n[#PP_INDENT]u
11759 .                   el .ti \\n[#PP_INDENT]u
11760 .                   if '\\n[.z]'END_NOTES' \
11761 .                      ti \\n[#EN_PP_INDENT]u+\\n[#EN_TEXT_INDENT]u
11762 .                \}
11763 .             \}
11764 .          \}
11765 .       \}
11766 .       el \{\
11767 .          if \\n[#PP_SPACE] \{\
11768 .             ie \\n[#END_QUOTE] \{\
11769 .                ie !'\\*[$PP_SPACE_AMOUNT]'' .sp \\*[$PP_SPACE_AMOUNT]
11770 .                el .sp
11771 .                rr #END_QUOTE
11772 .                nr #NO_SPACE 1
11773 .                nr #BASELINE_MARK \\n[nl]
11774 .             \}
11775 .             el \{\
11776 .                if \\n[#NO_SPACE]=1 .rr #NO_SPACE
11777 .                if \\n[post-float] \{\
11778 .                   if (\\n[.t]-1)<\\*[$PP_SPACE_AMOUNT] \{\
11779 .                      ie \\n[#COLS] .COL_NEXT
11780 .                      el .NEWPAGE
11781 .                   \}
11782 .                   rr post-float
11783 .                \}
11784 .                if !\\n[nl]=\\n[#BASELINE_MARK] \{\
11785 .                   ie !'\\*[$PP_SPACE_AMOUNT]'' .sp \\*[$PP_SPACE_AMOUNT]
11786 .                   el .sp
11787 .                   rr #BASELINE_MARK
11788 .                \}
11789 .             \}
11790 .          \}
11791 .          ie \\n[#INDENT_ACTIVE] .ti \\n[#INDENT]u+\\n[#PP_INDENT]u
11792 .          el .ti \\n[#PP_INDENT]u
11793 .          if '\\n[.z]'END_NOTES' \
11794 .             ti \\n[#EN_PP_INDENT]u+\\n[#EN_TEXT_INDENT]u
11795 .       \}
11796 .       if r #START     .rr #START
11797 .       if r #QUOTE     .rr #QUOTE
11798 .       if r #END_QUOTE .rr #END_QUOTE
11799 .       if r #HEAD      .rr #HEAD
11800 .       if r #SUBHEAD   .rr #SUBHEAD
11801 .       if r #EPIGRAPH  .rr #EPIGRAPH
11802 .       if r #Q_FITS    .rr #Q_FITS
11803 .       if r #LINEBREAK .rr #LINEBREAK
11804 .       if \\n[#ENDNOTE] \{\
11805 .          ie \\n[#RESET_PARA_SPACE] .PARA_SPACE
11806 .          el .PARA_SPACE OFF
11807 .       \}
11808 .       if \\n[#CONDENSE] \{\
11809 \E*[COND]\c
11810 .       \}
11811 .       if \\n[#EXTEND]=1 \{\
11812 \E*[EXT]\c
11813 .       \}
11814 .       nr #PP +1
11815 .    \}
11816 .    if \\n[#PP_STYLE]=2 \{\
11817 \!.     br
11818 .       ie \\n[#Q_PP]=0 \{\
11819 .          if \\n[#INDENT_FIRST_PARAS] \
11820 .             ti \\n[#PP_INDENT]u/2u
11821 .          if \\n[#ENDNOTE] \{\
11822 .             ie \\n[#INDENT_FIRSTS] .ti \\n[#PP_INDENT]u/2u
11823 .             el .ti 0
11824 .          \}
11825 .       \}
11826 .       el \{\
11827 .          ti \\n[#PP_INDENT]u/2u
11828 .          if \\n[#PP_SPACE]=1 \{\
11829 .             ie !'\\*[$PP_SPACE_AMOUNT]'' .ALD \\*[$PP_SPACE_AMOUNT]
11830 .             el .sp
11831 .          \}
11832 .       \}
11833 .       if \\n[#CONDENSE] \{\
11834 \E*[COND]\c
11835 .       \}
11836 .       if \\n[#EXTEND]=1 \{\
11837 \E*[EXT]\c
11838 .       \}
11839 .    nr #Q_PP +1
11840 .    \}
11841 .\" This takes care of multi-paragraph dialogue, where each para
11842 .\" is introduced by an open quote whereas the previous para has
11843 .\" no close quote.
11844 .    if \\n[#OPEN_CLOSE]=1 .nr #OPEN_CLOSE 0
11845 .    nr #PP_ACTIVE 1
11846 .    UNDERLINE OFF
11847 .    if r #QUOTE_4_HD .rr #QUOTE_4_HD
11848 .    if r #LB_4_HD .rr #LB_4_HD
11849 .END
11850 \# ====================================================================
11851 \#
11852 \# +++QUOTES+++
11853 \#
11854 \# ---Line for line quotes, i.e. poetry or code snippets---
11855 \#
11856 \# UNDERLINE QUOTES
11857 \# ----------------
11858 \# *Arguments:
11859 \#   <none> | <anything>
11860 \# *Function:
11861 \#   Creates or modifies register #UNDERLINE_QUOTES (toggle).
11862 \#   If on, line for line quotes are underlined when printstyle
11863 \#   is TYPEWRITE.
11864 \# *Notes:
11865 \#   Default is ON for printstyle TYPEWRITE.
11866 \#
11867 .MAC UNDERLINE_QUOTES END
11868 .    ie '\\$1'' .nr #UNDERLINE_QUOTES 1
11869 .    el .rr #UNDERLINE_QUOTES
11870 .END
11871 \#
11872 \# QUOTE INDENT
11873 \# ------------
11874 \# *Argument:
11875 \#   <integer> | <integer with unit of measure appended>
11876 \# *Function:
11877 \#   Creates or modifies register #Q_OFFSET_VALUE or string
11878 \#   $Q_OFFSET_VALUE.
11879 \# *Notes:
11880 \#   If just an integer given, value by which to multiply PARA_INDENT
11881 \#   to get quote indent.  If integer with a unit of measure appended,
11882 \#   absolute value of quote indent.
11883 \#
11884 \#  Default is 3 for typeset; 2 for typewrite.
11885 \#
11886 .MAC QUOTE_INDENT END
11887 .    if '\\$0'BLOCKQUOTE_INDENT' .ds BQ BQ
11888 .    if '\\$0'QUOTE_INDENT'      .ds BQ Q
11889 .    rr #\\*[BQ]_OFFSET_VALUE
11890 .    rm $\\*[BQ]_OFFSET_VALUE
11891 .    ds $EVAL_QI_ARG \\$1
11892 .    substring $EVAL_QI_ARG -1
11893 .    ie \B'\\*[$EVAL_QI_ARG]' .nr #\\*[BQ]_OFFSET_VALUE \\$1
11894 .    el .ds $\\*[BQ]_OFFSET_VALUE \\$1
11895 .    rm BQ
11896 .END
11897 .
11898 .ALIAS BLOCKQUOTE_INDENT QUOTE_INDENT
11899 \#
11900 \# QUOTE_AUTOLEAD
11901 \# --------------
11902 \# *Arguments:
11903 \#   <autolead value>
11904 \# *Function:
11905 \#   Sets autolead for quotes and/or blockquotes.
11906 \#
11907 .MAC QUOTE_AUTOLEAD END
11908 .    rr #\\$0_DEFAULT
11909 .    if '\\$0'QUOTE_AUTOLEAD'              .nr #Q_AUTOLEAD (p;\\$1)
11910 .    if '\\$0'BLOCKQUOTE_AUTOLEAD'         .nr #BQ_AUTOLEAD (p;\\$1)
11911 .    if '\\$0'ENDNOTE_QUOTE_AUTOLEAD'      .nr #EN_Q_AUTOLEAD (p;\\$1)
11912 .    if '\\$0'ENDNOTE_BLOCKQUOTE_AUTOLEAD' .nr #EN_BQ_AUTOLEAD (p;\\$1)
11913 .END
11914 .
11915 .ALIAS BLOCKQUOTE_AUTOLEAD         QUOTE_AUTOLEAD
11916 .ALIAS ENDNOTE_QUOTE_AUTOLEAD      QUOTE_AUTOLEAD
11917 .ALIAS ENDNOTE_BLOCKQUOTE_AUTOLEAD QUOTE_AUTOLEAD
11918 \#
11919 \# ALWAYS FULLSPACE QUOTES
11920 \# -----------------------
11921 \# *Arguments:
11922 \#   <none> | <anything>
11923 \# *Function:
11924 \#   Toggles register #FULLSPACE_QUOTES.
11925 \# *Notes:
11926 \#   If user doesn't like the default 1/2 line space above and below
11927 \#   quotes, s/he can turn it off here.  Has no effect in TYPEWRITE.
11928 \#
11929 .MAC ALWAYS_FULLSPACE_QUOTES END
11930 .    if '\\$1'' .nr #FULLSPACE_QUOTES 1
11931 .    el .rr #FULLSPACE_QUOTES
11932 .END
11933 \#
11934 \# QUOTE
11935 \# -----
11936 \# *Arguments:
11937 \#   <none> | <anything>
11938 \# *Function:
11939 \#   Indents quoted text on a line for line basis, or turns QUOTE off.
11940 \# *Notes:
11941 \#   Owing to the need to bottom align TYPESET pages, quoted text gets
11942 \#   diverted so its depth can be measured (in DO_QUOTE) for determining
11943 \#   how much space to put before and after.
11944 \#
11945 .MAC QUOTE END
11946 .    ie \\n[@TOP] \
11947 .       br
11948 .    el 'br
11949 .    if \\n[#PP]>0 .rr #START
11950 .    if \\n[#LINENUMBERS]=1 \{\
11951 .       nr #LINENUMBERS 2
11952 .       nr #NEXT_LN \\n[ln]
11953 .       nm
11954 .    \}
11955 .    if '\\$1'ADJUST' \{\
11956 .       ds $Q_SPACE_ADJUST \\$2
11957 .       shift 2
11958 .    \}
11959 .    ie '\\$1'' \{\
11960 .       ev QUOTE
11961 .       evc 0
11962 .       if \\n[.i] .in 0
11963 .       if \\n[#LINENUMBERS]=2 \
11964 .          if \\n[#SILENT_QUOTE_LN]=1 .nm \\n[#NEXT_LN] 1000 -4
11965 .       nr #IN_DIVER 1
11966 .       nr #QUOTE 1
11967 .       di P_QUOTE
11968 .       if '\\*[$Q_QUAD]'LEFT' \{\
11969 .          ie !'\\*[$Q_OFFSET_VALUE]'' .ll \\n[#L_LENGTH]u-\\*[$Q_OFFSET_VALUE]
11970 .          el .ll \\n[#L_LENGTH]u-(\\n[#PP_INDENT]u*\\n[#Q_OFFSET_VALUE]u)
11971 .       \}
11972 .       ta \\n[.l]u
11973 .       if \\n[#COLUMNS] \{\
11974 .          ie \\n[#Q_OFFSET_VALUE] \
11975 .             ll \\n[#COL_L_LENGTH]u-(\\n[#PP_INDENT]u*\\n[#Q_OFFSET_VALUE]u)
11976 .          el .ll \\n[#COL_L_LENGTH]u-\\*[$Q_OFFSET_VALUE]
11977 .          ta \\n[.l]u
11978 .       \}
11979 .       if \\n[#PRINT_STYLE]=1 \{\
11980 .          TYPEWRITER
11981 .          vs \\n[#DOC_LEAD]u
11982 .          LEFT
11983 .       \}
11984 .       if \\n[#PRINT_STYLE]=2 \{\
11985 .          FAMILY  \\*[$QUOTE_FAM]
11986 .          FT      \\*[$QUOTE_FT]
11987 .          ps \\n[#DOC_PT_SIZE]u\\*[$QUOTE_SIZE_CHANGE]
11988 .          ie !r #Q_AUTOLEAD .vs \\n[#DOC_LEAD]u
11989 .          el \{\
11990 .             vs \\n[.ps]u+\\n[#Q_AUTOLEAD]u
11991 .             nr #Q_LEAD \\n[.v]
11992 .          \}
11993 .          if \\n[#ENDNOTE] \{\
11994 .             ps \\n[#EN_PS]u\\*[$QUOTE_SIZE_CHANGE]
11995 .             ie !r #EN_Q_AUTOLEAD .vs \\n[#EN_Q_LEAD]u
11996 .             el \{\
11997 .                vs \\n[.ps]u+\\n[#EN_Q_AUTOLEAD]u
11998 .                nr #EN_Q_LEAD \\n[.v]
11999 .             \}
12000 .          \}
12001 .          nr #Q_LEAD_REAL \\n[.v]
12002 .          if \\n[#QUOTE_COLOR]=1 \{\
12003 .             nf
12004 .             COLOR \\*[$QUOTE_COLOR]
12005 .          \}
12006 .          \\*[$Q_QUAD]
12007 .       \}
12008 .       if \\n[#LINENUMBERS]=2 \{\
12009 .          ie \\n[#QUOTE_LN]=1 \{\
12010 .             if '\\n[#Q_LN_GUTTER]'' .nr #Q_LN_GUTTER \\n[#LN_GUTTER]
12011 .             LN_PARAMS
12012 .             nm \\n[ln] "" \\n[#Q_LN_GUTTER] -3-\\n[#Q_LN_GUTTER]
12013 .             RESTORE_PARAMS
12014 .          \}
12015 .          el \
12016 .             if !\\n[#SILENT_QUOTE_LN] .NUMBER_LINES OFF
12017 .       \}
12018 .       nr #Q_TOP \\n[nl]
12019 .       if \\n[#PRINT_STYLE]=1 \
12020 .          if \\n[#UNDERLINE_QUOTES] .FT I
12021 .    \}
12022 .    el .DO_QUOTE
12023 .END
12024 \#
12025 \# CODE
12026 \# ----
12027 \# *Arguments:
12028 \#   <none> [ BR | BREAK | SPREAD ]
12029 \#    or
12030 \#   <anything> [ BR | BREAK | SPREAD ]
12031 \# *Function:
12032 \#   Takes care of administrivia associated with setting code snippets.
12033 \#
12034 .MAC CODE END
12035 \c
12036 .    if '\\$1'BR' \{\
12037 .       ie '\\n[.z]'FLOAT*DIV' 'br
12038 .       el .br
12039 .       shift
12040 .    \}
12041 .    if '\\$1'BREAK' \{\
12042 .       ie '\\n[.z]'FLOAT*DIV' 'br
12043 .       el .br
12044 .       shift
12045 .    \}
12046 .    if '\\$1'SPREAD' \{\
12047 .       ie '\\n[.z]'FLOAT*DIV' 'brp
12048 .       el .brp
12049 .       shift
12050 .    \}
12051 .    ie '\\$1'' \{\
12052 .       ds $RESTORE_FAM \\n[.fam]
12053 .       ds $RESTORE_FT  \\n[.sty]
12054 .       ie \\n[#PRINT_STYLE]=1 \{\
12055 .          CODE_FAMILY C
12056 .          ie \\n[#CODE_FT]=1 .ft \\*[$CODE_FT]
12057 .          el \{\
12058 .             CODE_FONT R
12059 .             ft R
12060 .             char ' \[aq]
12061 .          \}
12062 .          if \\n[#UNDERLINE_QUOTES]=1 \{\
12063 .             nr #RESTORE_UNDERLINE 1
12064 .             UNDERLINE_QUOTES OFF
12065 .             FT \\*[$CODE_FT]
12066 .             char ' \[aq]
12067 .          \}
12068 .       \}
12069 .       el \{\
12070 .          ie \\n[#CODE_FAM]=1 .fam \\*[$CODE_FAM]
12071 .          el \{\
12072 .             CODE_FAMILY C
12073 .             fam \\*[$CODE_FAM]
12074 .          \}
12075 .          ie \\n[#CODE_FT]=1 .ft \\*[$CODE_FT]
12076 .          el \{\
12077 .             CODE_FONT R
12078 .             ft \\*[$CODE_FT]
12079 .          \}
12080 .          if \\n[#CODE_COLOR]=1 .COLOR \\*[$CODE_COLOR]
12081 .          char ' \[aq]
12082 .          if !\\n[#CODE_SIZE_ADJ]=0 \{\
12083 .             nr #RESTORE_SIZE \\n[.s]
12084 .             ps \\n[#PT_SIZE]u*\\n[#CODE_SIZE_ADJ]u/100u
12085 .          \}
12086 .          if \\n[#SQ_ON] \{\
12087 .             nr #SQ_WAS_ON 1
12088 .             SMARTQUOTES OFF
12089 .          \}
12090 .       \}
12091 .    \}
12092 .    el \{\
12093 .       fam \\*[#RESTORE_FAM]
12094 .       ft  \\*[#RESTORE_FT]
12095 .       if !\\n[#CODE_SIZE_ADJ]=0 .ps \\n[#RESTORE_SIZE]
12096 .       rm $RESTORE_FAM
12097 .       rm $RESTORE_FT
12098 .       rm $RESTORE_SIZE
12099 .       if \\n[#PRINT_STYLE]=2 .char ' \[cq]
12100 .       if !'\\n[.z]'' \
12101 .          if \\n[#LINENUMBERS] .nn
12102 .       if \\n[#CODE_COLOR]=1 .gcolor
12103 .       if \\n[#RESTORE_UNDERLINE]=1 \{\
12104 .          rr #RESTORE_UNDERLINE
12105 .          UNDERLINE_QUOTES
12106 .       \}
12107 .       if \\n[#SQ_WAS_ON]=1 \{\
12108 .          rr #SQ_WAS_ON
12109 .          SMARTQUOTES
12110 .       \}
12111 .       if \\n[#QUOTE] .sp -1
12112 .    \}
12113 .END
12114 \#
12115 \# ---Blockquotes---
12116 \#
12117 \# BLOCKQUOTE
12118 \# ----------
12119 \# *Arguments:
12120 \#   <none> | <anything>
12121 \# *Function:
12122 \#   Indents quoted text in fill mode and shortens line length
12123 \#   equivalently, or turns BLOCKQUOTE off.
12124 \# *Notes:
12125 \#   Owing to the need to bottom align TYPESET pages, quoted text gets
12126 \#   diverted so its depth can be measured (in DO_QUOTE) for determining
12127 \#   how much space to put before and after.
12128 \#
12129 \#   .PP after blockquote is optional if there's only one para,
12130 \#   but required if there's more than one.
12131 \#
12132 .MAC BLOCKQUOTE END
12133 .    br
12134 .    if \\n[#PP]>0 .rr #START
12135 .    if \\n[#LINENUMBERS]=1 \{\
12136 .       nr #LINENUMBERS 2
12137 .       nr #NEXT_LN \\n[ln]
12138 .       nm
12139 .    \}
12140 .    if '\\$1'ADJUST' \{\
12141 .       ds $BQ_SPACE_ADJUST \\$2
12142 .       shift 2
12143 .    \}
12144 .    if \\n[in-cutaround] .nr #PP_INDENT \\n[restore-pp-ind]/2
12145 .    ie '\\$1'' \{\
12146 .       ev BLOCKQUOTE
12147 .       evc 0
12148 .       if \\n[.i] .in 0
12149 .       if \\n[#LINENUMBERS]=2 \
12150 .          if \\n[#SILENT_BQUOTE_LN]=1 .nm \\n[#NEXT_LN] 1000 -4
12151 .       nr #IN_DIVER 1
12152 .       nr #QUOTE    2
12153 .       nr #PP_STYLE 2
12154 .       nr #Q_PP     0
12155 .       if \\n[in-cutaround] \{\
12156 .          if '\\*[cutaround-type]'RIGHT' \{\
12157 .             nr reset-ll 1
12158 .             nr #L_LENGTH \\n[#DOC_L_LENGTH]-\\n[cutaround-width]-1v\\*[width-adj]
12159 .          \}
12160 .       \}
12161 .       di B_QUOTE
12162 .       ie !'\\*[$BQ_OFFSET_VALUE]'' .ll \\n[#L_LENGTH]u-(\\*[$BQ_OFFSET_VALUE]*2u)
12163 .       el .ll \\n[#L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#BQ_OFFSET_VALUE]u*2u))
12164 .       if \\n[in-cutaround] .nr #PP_INDENT \\n[.i]+\\n[pp-ind-tmp]
12165 .       if \\n[#ENDNOTE] \{\
12166 .          if \\n[#EN_NUMBERS_ALIGN_RIGHT] \{\
12167 .             ie r#BQ_OFFSET_VALUE \
12168 .                ll \
12169 \\n[#RESET_L_LENGTH]u-\\n[#EN_TEXT_INDENT]u-(\\n[#EN_PP_INDENT]u*(\\n[#BQ_OFFSET_VALUE]u*2u))
12170 .             el \
12171 .                ll \
12172 \\n[#RESET_L_LENGTH]u-\\n[#EN_TEXT_INDENT]u-(\\*[$BQ_OFFSET_VALUE]*2u)
12173 .          \}
12174 .          if \\n[#EN_NUMBERS_ALIGN_LEFT] \{\
12175 .             ie r#BQ_OFFSET_VALUE \
12176 .                ll \\n[#L_LENGTH]u-(\\n[#EN_PP_INDENT]u*(\\n[#BQ_OFFSET_VALUE]u*2u))
12177 .             el \
12178 .                ll \\n[#L_LENGTH]u-(\\*[$BQ_OFFSET_VALUE]u*2u)
12179 .          \}
12180 .       \}
12181 .       ta \\n[.l]u
12182 .       CHECK_INDENT
12183 .       if \\n[#COLUMNS] \{\
12184 .          ie r#BQ_OFFSET_VALUE \
12185 .             ll \
12186 \\n[#COL_L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#BQ_OFFSET_VALUE]u*2u))
12187 .          el \
12188 .             ll \\n[#COL_L_LENGTH]u-(\\*[$BQ_OFFSET_VALUE]*2u)
12189 .          if \\n[#ENDNOTE] \{\
12190 .             if \\n[#EN_NUMBERS_ALIGN_RIGHT] \{\
12191 .                ie r#BQ_OFFSET_VALUE \
12192 .                   ll \
12193 \\n[#RESET_L_LENGTH]u-\\n[#EN_TEXT_INDENT]u-(\\n[#EN_PP_INDENT]u*(\\n[#BQ_OFFSET_VALUE]u*2u))
12194 .                el \
12195 .                   ll \
12196 \\n[#RESET_L_LENGTH]u-\\n[#EN_TEXT_INDENT]u-(\\*[$BQ_OFFSET_VALUE]*2u)
12197 .             \}
12198 .             if \\n[#EN_NUMBERS_ALIGN_LEFT] \{\
12199 .                ie r#BQ_OFFSET_VALUE \
12200 .                   ll \
12201 \\n[#COL_L_LENGTH]u-(\\n[#EN_PP_INDENT]u*(\\n[#BQ_OFFSET_VALUE]u*2u))
12202 .                el \
12203 .                   ll \\n[#COL_L_LENGTH]u-(\\*[$BQ_OFFSET_VALUE]*2u)
12204 .             \}
12205 .          \}
12206 .          ta \\n[.l]u
12207 .       \}
12208 .       if \\n[#PRINT_STYLE]=1 \{\
12209 .          TYPEWRITER
12210 .          vs \\n[#DOC_LEAD]u
12211 .          QUAD LEFT
12212 .          HY OFF
12213 .       \}
12214 .       if \\n[#PRINT_STYLE]=2 \{\
12215 .          FAMILY  \\*[$BQUOTE_FAM]
12216 .          FT      \\*[$BQUOTE_FT]
12217 .          ps \\n[#DOC_PT_SIZE]u\\*[$BQUOTE_SIZE_CHANGE]
12218 .          ie !r #BQ_AUTOLEAD .vs \\n[#DOC_LEAD]u
12219 .          el \{\
12220 .             vs \\n[.ps]u+\\n[#BQ_AUTOLEAD]u
12221 .             nr #BQ_LEAD \\n[.v]
12222 .          \}
12223 .          if \\n[#ENDNOTE] \{\
12224 .             ps \\n[#EN_PS]u\\*[$BQUOTE_SIZE_CHANGE]
12225 .             ie !r#EN_BQ_AUTOLEAD .vs \\n[#EN_BQ_LEAD]u
12226 .             el \{\
12227 .                vs \\n[.ps]u+\\n[#EN_BQ_AUTOLEAD]u
12228 .                nr #EN_BQ_LEAD \\n[.v]
12229 .             \}
12230 .          \}
12231 .          nr #BQ_LEAD_REAL \\n[.v]
12232 .          if \\n[#BQUOTE_COLOR]=1 \{\
12233 .             nf
12234 .             COLOR \\*[$BQUOTE_COLOR]
12235 .          \}
12236 .          QUAD \\*[$BQUOTE_QUAD]
12237 .          nr #DIVERSIONS_HY_MARGIN (p;\\n[.ps]u*2.75)/1000
12238 .          HY_SET 1 \\n[#DIVERSIONS_HY_MARGIN]u (\\n[#PT_SIZE]u/1000u/8u)p
12239 .          hy 14
12240 .       \}
12241 .       if \\n[#LINENUMBERS]=2 \{\
12242 .          ie \\n[#BQUOTE_LN]=1 \{\
12243 .             if '\\n[#BQ_LN_GUTTER]'' .nr #BQ_LN_GUTTER \\n[#LN_GUTTER]
12244 .             LN_PARAMS
12245 .             nm \\n[ln] "" \\n[#BQ_LN_GUTTER] -3-\\n[#BQ_LN_GUTTER]
12246 .             RESTORE_PARAMS
12247 .          \}
12248 .          el \
12249 .             if !\\n[#SILENT_BQUOTE_LN] .NUMBER_LINES OFF
12250 .       \}
12251 .       nr #Q_TOP \\n[nl]
12252 .       if \\n[#INDENT_FIRST_PARAS] \{\
12253 .          ie !\\n[#ENDNOTE] \{\
12254 .             if \\n[#PRINT_STYLE]=1 .ti \\n[#PP_INDENT]u/2u
12255 .             if \\n[#PRINT_STYLE]=2 .ti \\n[#PP_INDENT]u/2u
12256 .          \}
12257 .          el \{\
12258 .             if \\n[#INDENT_FIRSTS]=1 \{\
12259 .                if \\n[#PRINT_STYLE]=1 .ti \\n[#EN_PP_INDENT]u/2u
12260 .                if \\n[#PRINT_STYLE]=2 .ti \\n[#EN_PP_INDENT]u/2u
12261 .             \}
12262 .          \}
12263 .       \}
12264 .    \}
12265 .    el .DO_BLOCKQUOTE
12266 .END
12267 \#
12268 \# DO QUOTE
12269 \# --------
12270 \# *Arguments:
12271 \#   <none>
12272 \# *Function:
12273 \#   Ends the diversion P_QUOTE or B_QUOTE.  Spaces them according to
12274 \#   PRINTSTYLE, whether there's inter-paragraph spacing, and page
12275 \#   position.  TYPEWRITE treats spacing the same way in all circumstance
12276 \#   (viz. an extra line space).  TYPESET puts in only half
12277 \#   line spaces if the entire quote plus 1 line of body under the quote
12278 \#   fits on the page; otherwise it puts in a full extra blank
12279 \#   line.  (This is to ensure the page remains bottom aligned).
12280 \#
12281 .MAC DO_QUOTE END
12282 .    br
12283 .    if \\n[#DIVER_LN_OFF] \{\
12284 \!.     NUMBER_LINES OFF
12285 .       rr #DIVER_LN_OFF
12286 .    \}
12287 .    nr #Q_DEPTH \\n[.d]
12288 .    di
12289 .    if '\\$0'DO_BLOCKQUOTE' .ds BQ BQ
12290 .    if '\\$0'DO_QUOTE'      .ds BQ Q
12291 .    if \\n[in-cutaround] \{\
12292 .       if \\n[dn]>\\n[.t] \{\
12293 .          tm1 "[mom]: Blockquote depth exceeds cutaround depth."
12294 .          ab   [mom]: Aborting at line \\n[.c].
12295 .       \}
12296 .    \}
12297 .    rr #IN_DIVER
12298 .    if \\n[#RESET_FN_COUNTERS]=2 \{\
12299 .       if !\\n[#FN_COUNT]=1 \{\
12300 .          if ((\\n[#PAGE_LENGTH]+\\n[#VARIABLE_FOOTER_POS])+\\n[#DIVER_DEPTH])>(\\n[#PAGE_LENGTH]+\\n[#VARIABLE_FOOTER_POS]) \{\
12301 .             DIVER_FN_2_POST
12302 .             rr #RESET_FN_COUNTERS
12303 .          \}
12304 .       \}
12305 .    \}
12306 .    nr #SAVED_FN_NUMBER \\n[#FN_NUMBER]
12307 .    nr #DONE_ONCE 0 1
12308 .    REMOVE_INDENT
12309 .    ev
12310 .    nr #Q_LEAD_DIFF \\n[#LEAD]-\\n[#\\*[BQ]_LEAD_REAL]
12311 .    if !'\\n[.z]'FLOAT*DIV' \{\
12312 .       br
12313 .       nr #CALCULATE_ONLY 1
12314 .       nr #CURRENT_V_POS \\n[nl]+\\n[#Q_DEPTH]
12315 .       SHIM
12316 .       rr #CALCULATE_ONLY
12317 .       nr #Q_SPACE_EQ (\\n[#SHIM]/2)
12318 .       nr #TRAP \\n[.t]-1
12319 .    \}
12320 .    if \\n[#ENDNOTE] \{\
12321 .       nr #RESET_QUOTE_SPACING \\n[#FULLSPACE_QUOTES]
12322 .       ALWAYS_FULLSPACE_QUOTES
12323 .    \}
12324 .    if \\n[#PRINT_STYLE]=1 \{\
12325 .       if \\n[#START]=1 .
12326 .       if \\n[#START]=0 \
12327 .          if !\\n[#LINEBREAK] .ALD \\n[#DOC_LEAD]u
12328 .       if \\n[#HEAD] \
12329 .          if \\n[#HEAD]=1 .RLD \\n[#DOC_LEAD]u
12330 .    \}
12331 .    if \\n[#PRINT_STYLE]=2 \{\
12332 .       ie \\n[#PP_SPACE] \{\
12333 .          ie \\n[#HEAD] .
12334 .          el \{\
12335 .             ie \\n[#START] .
12336 .             el \{\
12337 .                ie \\n[#FULLSPACE_QUOTES] .ALD \\n[#DOC_LEAD]u
12338 .                el .ALD \\n[#DOC_LEAD]u/2u
12339 .             \}
12340 .          \}
12341 .       \}
12342 .       el \{\
12343 .          if !\\n[nl]=\\n[#PAGE_TOP] \{\
12344 .             ie \\n[#Q_DEPTH]<(\\n[#TRAP_DISTANCE]-1) \{\
12345 .                ie ((\\n[#TRAP_DISTANCE]-1)-\\n[#Q_DEPTH])<\\n[#DOC_LEAD] \{\
12346 .                   ie !\\n[in-cutaround] .Q_NOFIT
12347 .                   el .Q_FITS
12348 .                \}
12349 .                el \{\
12350 .                   ie (\\n[#TRAP_DISTANCE]-\\n[#DOC_LEAD])<\\n[#DOC_LEAD] .Q_NOFIT
12351 .                   el \{\
12352 .                      ie (\\n[#Q_DEPTH]+\\n[.v])=(\\n[#TRAP_DISTANCE]-1) .Q_NOFIT
12353 .                      el .Q_FITS
12354 .                   \}
12355 .                \}
12356 .             \}
12357 .             el .Q_NOFIT
12358 .          \}
12359 .       \}
12360 .       if \\n[#LINEBREAK] \{\
12361 .          vpt 0
12362 .          ie !\\n[@TOP] .sp -\\n[#DOC_LEAD]u
12363 .          el \{\
12364 .             nop
12365 .             sp |\\n[#T_MARGIN]u-\\n[#BQ_LEAD]u
12366 .          \}
12367 .         vpt
12368 .       \}
12369 .    \}
12370 .    ie !'\\*[$\\*[BQ]_OFFSET_VALUE]'' \
12371 .       nr #\\*[BQ]_OFFSET \\n[#L_MARGIN]+(\\*[$\\*[BQ]_OFFSET_VALUE])
12372 .    el \
12373 .       nr #\\*[BQ]_OFFSET \
12374 \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#\\*[BQ]_OFFSET_VALUE])
12375 .    if \\n[#COLUMNS] \{\
12376 .       ie r#\\*[BQ]_OFFSET_VALUE \
12377 .          nr #\\*[BQ]_OFFSET \
12378 \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#\\*[BQ]_OFFSET_VALUE])
12379 .       el .nr #\\*[BQ]_OFFSET \
12380 \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+\\*[$\\*[BQ]_OFFSET_VALUE]
12381 .    \}
12382 .    if !\\n[#ENDNOTE] \{\
12383 .       ie '\\*[BQ]'Q' \{\
12384 .          if '\\*[$Q_QUAD]'LEFT' \{\
12385 .             po \\n[#Q_OFFSET]u
12386 .             if '\\n[.z]'FLOAT*DIV' \!.po \\n[#Q_OFFSET]u
12387 .          \}
12388 .       \}
12389 .       el \{\
12390 .          po \\n[#\\*[BQ]_OFFSET]u
12391 .          if '\\n[.z]'FLOAT*DIV' \!.po \\n[#\\*[BQ]_OFFSET]u
12392 .       \}
12393 .    \}
12394 .    if \\n[#ENDNOTE] \{\
12395 .       ie \\n[#\\*[BQ]_OFFSET_VALUE] \
12396 .          in +\\n[#EN_PP_INDENT]u*\\n[#\\*[BQ]_OFFSET_VALUE]u
12397 .       el .in +\\*[$\\*[BQ]_OFFSET_VALUE]
12398 .    \}
12399 .    ie \\n[#START]=1 \{\
12400 .       ie !\\n[#Q_LEAD_DIFF]<0 \
12401 .          if !\\n[#NO_SHIM] .sp \\n[#Q_SPACE_EQ]u
12402 .       el .RLD 0-\\n[#Q_LEAD_DIFF]u
12403 .    \}
12404 .    el \{\
12405 .       if \\n[#PRINT_STYLE]=2 \
12406 .          ie !\\n[#NO_SHIM] \
12407 .             sp \\n[#Q_SPACE_EQ]u+(\\n[#Q_LEAD_DIFF]u/2u)
12408 .          el .if !\\n[#NO_FLEX] .FLEX
12409 .    \}
12410 .    if \\n[#QUOTE]=1 \{\
12411 .       if !'\\*[$Q_SPACE_ADJUST]'' .sp +\\*[$Q_SPACE_ADJUST]
12412 .       nf
12413 .       P_QUOTE
12414 .       if !'\\*[$Q_SPACE_ADJUST]'' \{\
12415 .          sp -\\*[$Q_SPACE_ADJUST]
12416 .          rm $Q_SPACE_ADJUST
12417 .       \}
12418 .    \}
12419 .    if \\n[#QUOTE]=2 \{\
12420 .       if !'\\*[$BQ_SPACE_ADJUST]'' .sp +\\*[$BQ_SPACE_ADJUST]
12421 .       nf
12422 .       B_QUOTE
12423 .       if !'\\*[$BQ_SPACE_ADJUST]'' \{\
12424 .          sp -\\*[$BQ_SPACE_ADJUST]
12425 .          rm $BQ_SPACE_ADJUST
12426 .       \}
12427 .    \}
12428 .    if !\\n[#START] .rr #QUOTE
12429 .    if \\n[in-cutaround] .nr #PP_INDENT \\n[pp-ind-tmp]
12430 \#.    if !\\n[ev-popped] .ev \" Needed once cutarounds are implemented
12431 .    rr delay-ev-pop
12432 .    if \\n[reset-ll] \{\
12433 .       if '\\*[cutaround-type]'RIGHT' \{\
12434 .          ll \\n[#DOC_L_LENGTH]u
12435 .          rr reset-ll
12436 .       \}
12437 .    \}
12438 .    if !'\\n[.z]'FLOAT*DIV' \{\
12439 .       if \\n[#PRINT_STYLE]=1 \
12440 .          if !\\n[.v]=\\n[#DOC_LEAD] \{\
12441 .             ie !\\n[#NO_SHIM] .SHIM
12442 .             el \
12443 .                if !\\n[#NO_FLEX] .FLEX
12444 .          \}
12445 .       if \\n[#PRINT_STYLE]=2 \{\
12446 .          ie \\n[#START] \{\
12447 .             ie \\n[#PP_SPACE] .
12448 .             el \{\
12449 .                sp \\n[#DOC_LEAD]u
12450 .                ie !\\n[#NO_SHIM] .SHIM
12451 .                el \
12452 .                   if !\\n[#NO_FLEX] .FLEX
12453 .             \}
12454 .          \}
12455 .          el \{\
12456 .             ie \\n[#HEAD]=1 \{\
12457 .                sp \\n[#DOC_LEAD]u
12458 .                ie !\\n[#NO_SHIM] .SHIM
12459 .                el \
12460 .                   if !\\n[#NO_FLEX] .FLEX
12461 .             \}
12462 .             el \{\
12463 .                ie \\n[#FULLSPACE_QUOTES] \{\
12464 .                   ie \\n[#ENDNOTE] .ALD \\n[#EN_LEAD]u
12465 .                   el !'\\n[.z]'FLOAT*DIV' .ALD \\n[#DOC_LEAD]u
12466 .                \}
12467 .                el \
12468 .                   if !'\\n[.z]'FLOAT*DIV' .ALD \\n[#DOC_LEAD]u/2u
12469 .                ie \\n[#Q_FITS] \{\
12470 .                   ie (\\n[#Q_TOP]=\\n[#PAGE_TOP]):(\\n[@TOP]=1) \{\
12471 .                      if \\n[has-label] .sp \\n[#DOC_LEAD]u/2u
12472 .                      if !'\\n[.z]'FLOAT*DIV' \{\
12473 .                         nr #Q_AT_TOP 1
12474 .                         nr #DELAY_SHIM 1
12475 .                      \}
12476 .                   \}
12477 .                   el \{\
12478 .                      ie !\\n[#NO_SHIM] .SHIM
12479 .                      el \
12480 .                         if !\\n[#NO_FLEX] .FLEX
12481 .                   \}
12482 .                \}
12483 .                el \{\
12484 .                   ie !\\n[#NO_SHIM] .SHIM
12485 .                   el \
12486 .                      if !\\n[#NO_FLEX] .FLEX
12487 .\" Make sure that Q_LEAD_DIFF is not added to the first line of
12488 .\" normal text at the top of any page following output of a quote
12489 .\" whose last line falls on B_MARGIN of the previous page.
12490 .                   if \\n[#Q_LEAD_DIFF] \{\
12491 .                      if \\n[nl]=(\\n[#T_MARGIN]-\\n[#DOC_LEAD]+\\n[#Q_LEAD_DIFF]) \{\
12492 .                         PRINT \&
12493 .                         br
12494 .                         sp -1v-\\n[#Q_LEAD_DIFF]u
12495 .                         nr #Q_LEAD_DIFF_CHECK 1
12496 .                      \}
12497 .                   \}
12498 .                \}
12499 .             \}
12500 .          \}
12501 .       \}
12502 .    \}
12503 .    if \\n[#RESTORE_NO_SHIM] .nr #NO_SHIM 1
12504 .    rr #Q_SPACE_EQ
12505 .    if \\n[#LINENUMBERS]=2 \{\
12506 .       nr #LINENUMBERS 1
12507 .       if !\\n[#ENDNOTE] \{\
12508 .          ie \\n[#RESTORE_LN_NUM]=1 \{\
12509 .             LN_PARAMS
12510 .             nm \\n[#NEXT_LN]
12511 .             RESTORE_PARAMS
12512 .          \}
12513 .          el \{\
12514 .             LN_PARAMS
12515 .             nm +0
12516 .             RESTORE_PARAMS
12517 .          \}
12518 .       \}
12519 .    \}
12520 .    if \\n[#ENDNOTE] \
12521 .       nr #FULLSPACE_QUOTES \\n[#RESET_QUOTE_SPACING]
12522 .    if r #HEAD .rr #HEAD
12523 .    if r #EPIGRAPH .rr #EPIGRAPH
12524 .    rr #Q_PP
12525 .    rr #LINEBREAK
12526 .    nr #PP_STYLE  1
12527 .    nr #END_QUOTE 1
12528 .    if !\\n[#ENDNOTE] \
12529 .       po \\n[#L_MARGIN]u
12530 .    if \\n[#ENDNOTE]  .in \\n[#EN_TEXT_INDENT]u
12531 .    if \\n[#COLUMNS] \{\
12532 .       if !\\n[#ENDNOTE] \{\
12533 .          po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
12534 .          nr #L_MARGIN \\n[.o]
12535 .       \}
12536 .       if \\n[#ENDNOTE] .in \\n[#EN_TEXT_INDENT]u
12537 .    \}
12538 .    ie !\\n[#ENDNOTE] .QUAD \\*[$DOC_QUAD]
12539 .    el .QUAD \\*[EN_QUAD]
12540 .    if r #DELAY_SHIM \{\
12541 .       ie !\\n[#NO_SHIM] .SHIM
12542 .       el \
12543 .          if !\\n[#NO_FLEX] .FLEX
12544 .       rr #DELAY_SHIM
12545 .    \}
12546 .    if \\n[#PRINT_STYLE]=1 \
12547 .       if \\n[#UNDERLINE_QUOTES] .FT R
12548 .    nr #QUOTE_4_HD 1
12549 .    rr #\\*[BQ]_LEAD_REAL
12550 .    rm BQ
12551 .    if \\n[#DOC_TYPE]=5 .NO_SHIM
12552 .    if '\\n[.z]'FLOAT*DIV' \!.po \\n[#L_MARGIN]u
12553 .END
12554 .
12555 .ALIAS DO_BLOCKQUOTE DO_QUOTE
12556 \#
12557 \# Utility macros for DO_QUOTE
12558 \# ---------------------------
12559 \#
12560 .MAC Q_FITS END
12561 .    nr #Q_FITS 1
12562 .    ie \\n[#HEAD]=1 .ALD \\n[#Q_LEAD_DIFF]u
12563 .    el \{\
12564 .       ie \\n[#START] .
12565 .       el \{\
12566 .          ie \\n[#FULLSPACE_QUOTES] \{\
12567 .             ie \\n[#ENDNOTE] .ALD \\n[#EN_LEAD]u+\\n[#Q_LEAD_DIFF]u
12568 .             el .ALD \\n[#DOC_LEAD]u+\\n[#Q_LEAD_DIFF]u
12569 .          \}
12570 .          el \{\
12571 .\" This seems to be the only way to get the baseline of quotes that
12572 .\" start at the top of the page to fall on the first line of the
12573 .\" grid (ie. on the first valid baseline of the page).
12574 .             ie \\n[#Q_TOP]=\\n[#PAGE_TOP] \{\
12575 .                if \\n[#QUOTE]=1 .ds $QUOTE_TYPE Q
12576 .                if \\n[#QUOTE]=2 .ds $QUOTE_TYPE B 
12577 .                rn \\*[$QUOTE_TYPE]_QUOTE Q_TEMP
12578 .                di \\*[$QUOTE_TYPE]_QUOTE
12579 .                nf
12580 .                if \\n[#QUOTE]=1 .vs \\n[#Q_LEAD]u
12581 .                if \\n[#QUOTE]=2 .vs \\n[#BQ_LEAD]u
12582 .                PRINT \&
12583 .                sp -1v+\\n[#Q_LEAD_DIFF]u
12584 .                Q_TEMP
12585 .                di
12586 .                rm Q_TEMP
12587 .                sp \\n[#DOC_LEAD]u/2u
12588 .             \}
12589 .             el \
12590 .                sp \\n[#DOC_LEAD]u/2u
12591 .          \}
12592 .       \}
12593 .       if \\n[#DIVER_FN]=2 .rr #DIVER_FN
12594 .       if !\\n[#NO_FLEX] .FLEX
12595 .    \}
12596 .    rm $QUOTE_TYPE
12597 .END
12598 \#
12599 .MAC Q_NOFIT END
12600 .    rr #Q_FITS
12601 .    if \\n[#QUOTE]=1 \{\
12602 .       ds $QUOTE_TYPE Q
12603 .       ds quote-type quote
12604 .    \}
12605 .    if \\n[#QUOTE]=2 \{\
12606 .       ds $QUOTE_TYPE B 
12607 .       ds quote-type blockquote
12608 .    \}
12609 .    if \\n[has-caption] \{\
12610 .       if !\\n[@TOP] \
12611 .          if !\\n[nl]=\\n[#PAGE_TOP] \
12612 .             if (\\n[.t]-1)<\
12613 \\n[#DOC_LEAD]+(\\n[#DOC_LEAD]/4)\
12614 +\\n[#\\*[QUOTE_TYPE]_LEAD] \{\
12615 .          tm1 "[mom]: Insufficient room for caption and at least one line of \\*[quote-type]
12616 .          tm1 "       on page \\n[%] (line \\n[.c]).  Moving quote to next page or column.
12617 .          ie \\n[#COLUMNS] .COL_NEXT
12618 .          el .NEWPAGE
12619 .       \}
12620 .    \}
12621 .    ie r#HEAD \
12622 .       if \\n[#HEAD]=1 .
12623 .    el \{\
12624 .       if \\n[#Q_DEPTH]=0 \
12625 .          if \\n[.ns] .rs
12626 .       ie \\n[#FULLSPACE_QUOTES] \{\
12627 .          ie \\n[#ENDNOTE] .sp \\n[#EN_LEAD]u+\\n[#Q_LEAD_DIFF]u
12628 .          el .sp \\n[#DOC_LEAD]u+\\n[#Q_LEAD_DIFF]u
12629 .       \}
12630 .       el \{\
12631 .          if '\\*[$QUOTE_TYPE]'Q' .sp \\n[#DOC_LEAD]u
12632 .          if \\n[@TOP] .rs
12633 .       \}
12634 .       ie \\n[#Q_LEAD_REAL] \
12635 .          nr #Q_PARTIAL_DEPTH 0 \\n[#Q_LEAD_REAL]
12636 .       el .nr #Q_PARTIAL_DEPTH 0 \\n[#BQ_LEAD_REAL]
12637 .       while \\n+[#Q_PARTIAL_DEPTH]<(\\n[#TRAP_DISTANCE]-1) \{\
12638 .
12639 .       \}
12640 .       if !\\n[#Q_LEAD_REAL]=\\n[#DOC_LEAD] \{\
12641 .          ie \\n[#Q_LEAD_REAL] \
12642 .             nr #Q_PARTIAL_DEPTH -\\n[#Q_LEAD_REAL]
12643 .          el .nr #Q_PARTIAL_DEPTH -\\n[#BQ_LEAD_REAL]
12644 .       \}
12645 .       nr #Q_SPACE_EQ \
12646 (\\n[#TRAP_DISTANCE]-1)-\\n[#Q_PARTIAL_DEPTH]+(\\n[#Q_LEAD_DIFF]u/2u)
12647 .       if \\n[#FN_COUNT]>0 .nr #Q_SPACE_EQ (\\n[#Q_SPACE_EQ] / 2u)
12648 .\" Hack to deal with the fact that even though the above routine
12649 .\" makes the bottom line of the quote fall exactly on the bottom
12650 .\" margin when traps are disabled, it refuses to do so when traps
12651 .\" are on.  The difference by which it's off is #Q_LEAD_DIFF
12652 .\" (the +\\n[#Q_LEAD_DIFF] at the end of the line, above).  Hack
12653 .\" solution: temporarily lower the FOOTER trap position.
12654 .       if !\\n[#Q_DEPTH]=0 \{\
12655 .          nr #SAVED_FOOTER_POS \\n[#VARIABLE_FOOTER_POS]
12656 .          ch FOOTER \\n[#VARIABLE_FOOTER_POS]u+.25v
12657 .       \}
12658 .    \}
12659 .END
12660 \#
12661 \# ====================================================================
12662 \#
12663 \# +++PAGINATION+++
12664 \#
12665 \# PAGINATE
12666 \# --------
12667 \# *Arguments:
12668 \#   <none> | <anything>
12669 \# *Function:
12670 \#   Turns page numbering off or on during document processing.
12671 \# *Notes:
12672 \#   Default is on.
12673 \#
12674 .MAC PAGINATE END
12675 .    ie '\\$1'' .nr #PAGINATE 1
12676 .    el \{\
12677 .      nr #PAGINATE 0
12678 .      rr #PAGE_NUM_V_POS
12679 .    \}
12680 .    if \\n[#HF_OFF]=1 \{\
12681 .       rr #PAGINATION_STATE
12682 .       rr #HF_OFF
12683 .    \}
12684 .END
12685 \#
12686 \# SUSPEND PAGINATION (before ENDNOTES)
12687 \# ------------------
12688 \# *Argument:
12689 \#   <none>
12690 \# *Function:
12691 \#   Creates register #SUSPEND_PAGINATION
12692 \# *Notes:
12693 \#   Useful only to suspend pagination before outputting endnotes.
12694 \#
12695 .MAC SUSPEND_PAGINATION END
12696 .    nr #SUSPEND_PAGINATION 1
12697 .END
12698 \#
12699 \# RESTORE PAGINATION (after ENDNOTES)
12700 \# ------------------
12701 \# *Argument:
12702 \#   <none>
12703 \# *Function:
12704 \#   Removes register #SUSPEND_PAGINATION.  Creates register
12705 \#   #DEFER_PAGINATION
12706 \# *Notes:
12707 \#   Useful only to restore pagination after outputting endnotes.
12708 \#
12709 .MAC RESTORE_PAGINATION END
12710 .    rr #SUSPEND_PAGINATION
12711 .    if \\n[#PAGE_NUM_V_POS]=1 .PAGINATE
12712 .    if \\n[#PAGE_NUM_V_POS]=2 .nr #DEFER_PAGINATION 1
12713 .END
12714 \#
12715 \# PAGE NUMBER FORMAT
12716 \# ------------------
12717 \# *Arguments:
12718 \#   DIGIT | ROMAN | roman | ALPHA | alpha
12719 \# *Function:
12720 \#   Assigns user entered format to #PAGENUMBER.
12721 \#
12722 .MAC PAGENUM_STYLE END
12723 .    nr #PAGENUM_STYLE_SET 1
12724 .    if '\\$1'DIGIT' \{\
12725 .       ds $PAGENUM_STYLE \\$1
12726 .       af #PAGENUMBER 1
12727 .    \}
12728 .    if '\\$1'ROMAN' \{\
12729 .       ds $PAGENUM_STYLE \\$1
12730 .       af #PAGENUMBER I
12731 .    \}
12732 .    if '\\$1'roman' \{\
12733 .       ds $PAGENUM_STYLE \\$1
12734 .       af #PAGENUMBER i
12735 .    \}
12736 .    if '\\$1'ALPHA' \{\
12737 .       ds $PAGENUM_STYLE \\$1
12738 .       af #PAGENUMBER A
12739 .    \}
12740 .    if '\\$1'alpha' \{\
12741 .       ds $PAGENUM_STYLE \\$1
12742 .       af #PAGENUMBER a
12743 .    \}
12744 .END
12745 \#
12746 \# HYPHENS AROUND PAGE NUMBERS
12747 \# ---------------------------
12748 \# *Arguments:
12749 \#   <none> | <anything>
12750 \# *Function:
12751 \#   Creates or modifies register #PAGE_NUM_HYPHENS.
12752 \#   Used to dis/enable hyphens on either side of page numbers.
12753 \# *Notes:
12754 \#   Default is on.
12755 \#
12756 .MAC PAGENUM_HYPHENS END
12757 .    nr #PAGE_NUM_HYPHENS_SET 1
12758 .    ie '\\$1'' .nr #PAGE_NUM_HYPHENS 1
12759 .    el .rr #PAGE_NUM_HYPHENS
12760 .END
12761 \#
12762 \# PAGENUMBER POSITION
12763 \# -------------------
12764 \# *Arguments:
12765 \#   TOP | BOTTOM  LEFT | CENTER | RIGHT
12766 \# *Function:
12767 \#   Creates or modifies various PAGE_NUM_H | V_POS registers.
12768 \#   Used to position page numbers.
12769 \# *Notes:
12770 \#   Default is center/bottom.
12771 \#
12772 .MAC PAGENUM_POS END
12773 .    nr #PAGE_NUM_POS_SET 1
12774 .    if '\\$1'TOP'    .nr #PAGE_NUM_V_POS 1
12775 .    if '\\$1'BOTTOM' .nr #PAGE_NUM_V_POS 2
12776 .    if '\\$2'LEFT'   .nr #PAGE_NUM_H_POS 1
12777 .    if '\\$2'CENTER' .nr #PAGE_NUM_H_POS 2
12778 .    if '\\$2'CENTRE' .nr #PAGE_NUM_H_POS 2
12779 .    if '\\$2'RIGHT'  .nr #PAGE_NUM_H_POS 3
12780 .END
12781 \#
12782 .MAC PN_WITH_HYPHENS END
12783 .    nr #HYPHEN_ADJ \\n[#CAP_HEIGHT]/12
12784 .    ds $HYPHEN \v'-\En[#HYPHEN_ADJ]u'-\v'\En[#HYPHEN_ADJ]u'
12785 .    ds $PN_FOR_KN \\n[#PAGENUMBER]
12786 .\"  Check for initial or terminal 1's or 7's, and apply a little kerning
12787 .    substring $PN_FOR_KN 0 0 \" 1st digit
12788 .    if '\\*[$PN_FOR_KN]'1' .ds $PRE_HY_KN \*[BU3]
12789 .    if '\\*[$PN_FOR_KN]'7' .ds $PRE_HY_KN \*[BU3]
12790 .    ds $PN_FOR_KN \\n[#PAGENUMBER]
12791 .    substring $PN_FOR_KN -1 -1 \" last digit
12792 .    if '\\*[$PN_FOR_KN]'1' .ds $POST_HY_KN \*[BU3]
12793 .    if '\\*[$PN_FOR_KN]'7' .ds $POST_HY_KN \*[BU3]
12794 .    PRINT \
12795 \m[\\*[$PAGE_NUM_COLOR]]\
12796 \\*[$HYPHEN]\|\\*[$PRE_HY_KN]\\n[#PAGENUMBER]\\*[$POST_HY_KN]\|\\*[$HYPHEN]
12797 .    br
12798 .    rm $PRE_HY_KERN
12799 .    rm $POST_HY_KERN
12800 .END
12801 \#
12802 \# PRINT PAGE NUMBER
12803 \# -----------------
12804 \# *Arguments:
12805 \#   <none>
12806 \# *Function:
12807 \#   Prints page number if PAGINATE=1.
12808 \#
12809 .MAC PRINT_PAGE_NUMBER END
12810 .    ev PAGENUMBER
12811 .    nf
12812 .    po  \\n[#DOC_L_MARGIN]u
12813 .    ll  \\n[#DOC_L_LENGTH]u
12814 .    ta  \\n[.l]u
12815 .    fam \\*[$PAGE_NUM_FAM]
12816 .    ft  \\*[$PAGE_NUM_FT]
12817 .    ps  \\n[#DOC_PT_SIZE]u\\*[$PAGE_NUM_SIZE_CHANGE]
12818 .    if  \\n[#PRINT_STYLE]=1 .TYPEWRITER
12819 .    if  \\n[#PAGE_NUM_V_POS]=1 .vs 0
12820 .    if o \{\
12821 .       ie \\n[#PAGE_NUM_H_POS]=1 .LEFT
12822 .       el .RIGHT
12823 .    \}
12824 .    if e \{\
12825 .       ie \\n[#PAGE_NUM_H_POS]=1 .RIGHT
12826 .       el .LEFT
12827 .    \}
12828 .    if \\n[#PAGE_NUM_H_POS]=2 .CENTER
12829 .    if \\n[#RECTO_VERSO]=0 \{\
12830 .       if \\n[#PAGE_NUM_H_POS]=1 .LEFT
12831 .       if \\n[#PAGE_NUM_H_POS]=2 .CENTER
12832 .       if \\n[#PAGE_NUM_H_POS]=3 .RIGHT
12833 .    \}
12834 .    nr #PAGENUMBER \\n%+\\n[#PAGE_NUM_ADJ]
12835 .    if \\n[#EN_FIRST_PAGE] \{\
12836 .       if \\n[#EN_FIRST_PN] .PAGENUMBER \\n[#EN_FIRST_PN]
12837 .       rr #EN_FIRST_PAGE
12838 .    \}
12839 .    if \\n[#BIB_FIRST_PAGE] \{\
12840 .       if \\n[#BIB_FIRST_PN] .PAGENUMBER \\n[#BIB_FIRST_PN]
12841 .       rr #BIB_FIRST_PAGE
12842 .    \}
12843 .    ie \\n[#DRAFT_WITH_PAGENUM] \{\
12844 .       ie '\\*[$REVISION]'' \
12845 .          PRINT "\\*[$DRAFT_STRING]\\*[$DRAFT] / \\n[#PAGENUMBER]"
12846 .       el \{\
12847 .          ie '\\*[$DRAFT]'' \
12848 .             PRINT "\\*[$REVISION_STRING] \\*[$REVISION] / \\n[#PAGENUMBER]"
12849 .          el \
12850 .             PRINT \
12851 "\\*[$DRAFT_STRING]\\*[$DRAFT], \\*[$REVISION_STRING] \\*[$REVISION] / \
12852 \\n[#PAGENUMBER]"
12853 .       \}
12854 .    \}
12855 .    el \{\
12856 .       ie \\n[#PAGE_NUM_HYPHENS] \{\
12857 .          if '\\*[$PAGENUM_STYLE]'DIGIT' \{\
12858 .             di NULL
12859 1\\R'#CAP_HEIGHT \\n[.cht]'
12860 .             di
12861 .             PN_WITH_HYPHENS
12862 .          \}
12863 .          if '\\*[$PAGENUM_STYLE]'ROMAN' \{\
12864 .             di NULL
12865 I\\R'#CAP_HEIGHT \\n[.cht]'
12866 .             di
12867 .             PN_WITH_HYPHENS
12868 .          \}
12869 .          if '\\*[$PAGENUM_STYLE]'ALPHA' \{\
12870 .             di NULL
12871 E\\R'#CAP_HEIGHT \\n[.cht]'
12872 .             di
12873 .             PN_WITH_HYPHENS
12874 .          \}
12875 .          if '\\*[$PAGENUM_STYLE]'roman' \
12876 .             PRINT \m[\\*[$PAGE_NUM_COLOR]]-\|\\n[#PAGENUMBER]\|-
12877 .          if '\\*[$PAGENUM_STYLE]'alpha' \
12878 .             PRINT \m[\\*[$PAGE_NUM_COLOR]]-\|\\n[#PAGENUMBER]\|-
12879 .       \}
12880 .       el \{\
12881 .          ie !d$PAGENUM_STRING .PRINT \m[\\*[$PAGE_NUM_COLOR]]\\n[#PAGENUMBER]
12882 .          el .PRINT \m[\\*[$PAGE_NUM_COLOR]]\\*[$PAGENUM_STRING]
12883 .       \}
12884 .    \}
12885 .    ev
12886 .    nr #DIVER_DEPTH 0
12887 .END
12888 \#
12889 \# ====================================================================
12890 \#
12891 \# +++FOOTNOTES+++
12892 \#
12893 \# Mom's footnote handling is baroque, to say the least.  There are
12894 \# redundancies in a number of the macros involved, as well as some
12895 \# registers that probably don't get used anymore.  The baggage is left
12896 \# in in case some new footnote oddity/challenge gets thrown at her.
12897 \#
12898 \# The macros are heavily commented.
12899 \#
12900 \# FOOTNOTE AUTOLEAD
12901 \# -----------------
12902 \# *Arguments:
12903 \#   <autolead value for footnotes>
12904 \# *Function:
12905 \#   Creates or modifies register #FN_AUTOLEAD.
12906 \# *Notes:
12907 \#   Default is #DOC_LEAD/2 for TYPEWRITE; 2 for TYPESET
12908 \#
12909 .MAC FOOTNOTE_AUTOLEAD END
12910 .    nr #FN_AUTOLEAD (p;\\$1)
12911 .END
12912 \#
12913 \# FOOTNOTE MARKERS
12914 \# ----------------
12915 \# *Arguments:
12916 \#   <none> | <anything>
12917 \# *Function:
12918 \#   Turns generation of footnote markers on or off.
12919 \# *Notes:
12920 \#   Default is on.
12921 \#
12922 .MAC FOOTNOTE_MARKERS END
12923 .    ie '\\$1'' .nr #FN_MARKERS 1
12924 .    el .nr #FN_MARKERS 0
12925 .END
12926 \#
12927 \# FOOTNOTE MARKER STYLE
12928 \# ---------------------
12929 \# *Arguments:
12930 \#   STAR | NUMBER | LINE
12931 \# *Function:
12932 \#   Sets register #FN_MARKER_STYLE, used in FOOTNOTE to determine
12933 \#   the style of footnote markers.
12934 \# *Notes:
12935 \#   1=STAR; 2=NUMBER; 3=LINE.  LINE means "use output line numbers".
12936 \#   Default is STAR.
12937 \#
12938 .MAC FOOTNOTE_MARKER_STYLE END
12939 .    if '\\$1'STAR' \{\
12940 .       if \\n[#FN_MARKER_STYLE]=3 \{\
12941 .          if !\\n[#NEWPAGE]=1 \{\
12942 .             tm1 "[mom]: Your current FOOTNOTE_MARKER STYLE is LINE.
12943 .             tm1 "       You cannot change footnote marker style without
12944 .             tm1 "       first breaking to a new page with NEWPAGE.
12945 .             tm1 "       Ignoring request FOOTNOTE_MARKER_STYLE STAR at line \\n[.c].
12946 .             return
12947 .          \}
12948 .       \}
12949 .       if \\n[#RUN_ON]=1 \{\
12950 .          tm1 "[mom]: FOOTNOTE_MARKER_STYLE STAR at line \\n[.c] is incompatible
12951 .          tm1 "       with RUN_ON footnotes.  Ignoring request.
12952 .          return
12953 .       \}
12954 .       nr #FN_MARKER_STYLE 1
12955 .       if \\n[#NEWPAGE]=1 .rr #NEWPAGE
12956 .       FOOTNOTE_MARKERS
12957 .    \}
12958 .    if '\\$1'NUMBER' \{\
12959 .       if \\n[#FN_MARKER_STYLE]=3 \{\
12960 .          if !\\n[#NEWPAGE]=1 \{\
12961 .             tm1 "[mom]: Your current FOOTNOTE_MARKER STYLE is NUMBER.
12962 .             tm1 "       You cannot change footnote marker style without
12963 .             tm1 "       first breaking to a new page with NEWPAGE.
12964 .             tm1 "       Ignoring request FOOTNOTE_MARKER_STYLE NUMBER at line \\n[.c].
12965 .             return
12966 .          \}
12967 .       \}
12968 .       if \\n[#RUN_ON]=1 \{\
12969 .          tm1 "[mom]: FOOTNOTE_MARKER_STYLE NUMBER at line \\n[.c] is incompatible
12970 .          tm1 "       with RUN_ON footnotes.  Ignoring request.
12971 .          return
12972 .       \}
12973 .       nr #FN_MARKER_STYLE 2
12974 .       shift
12975 .       if '\\$1'NO_SUPERSCRIPT' .nr #NO_SUPERSCRIPT 1
12976 .       if \\n[#NEWPAGE]=1 .rr #NEWPAGE
12977 .       FOOTNOTE_MARKERS
12978 .    \}
12979 .    if '\\$1'LINE' \{\
12980 .       nr #FN_MARKER_STYLE 3
12981 .       FOOTNOTE_MARKERS OFF
12982 .       if !\\n[#FN_LN_SEP] \
12983 .          if !\\n[#FN_LN_BRACKETS] .FOOTNOTE_LINENUMBER_BRACKETS SQUARE
12984 .    \}
12985 .END
12986 \#
12987 \# FOOTNOTE NUMBER PLACEHOLDERS
12988 \# ----------------------------
12989 \# *Argument:
12990 \#   <number of placeholders>
12991 \# *Function:
12992 \#   Sets register #FN_NUMBER_PLACEHOLDERS, used to establish whether to
12993 \#   right pad a footnote number (in the footnote itself, not body copy).
12994 \# *Notes:
12995 \#   No default is set for this; user must determine if, and where, it's
12996 \#   required
12997 \#
12998 .MAC FOOTNOTE_NUMBER_PLACEHOLDERS END
12999 .    nr #FN_NUMBER_PLACEHOLDERS \\$1
13000 .END
13001 \#
13002 \# FOOTNOTE LINENUMBER MARK
13003 \# ------------------------
13004 \# *Function:
13005 \#   This string, when called inline, stores the current output line
13006 \#   number in register #FN_MARK for use with FOOTNOTE.
13007 \#
13008 .ds FN_MARK \R'#FN_MARK \En[ln]'
13009 \#
13010 \# FOOTNOTE LINENUMBER SEPARATOR
13011 \# -----------------------------
13012 \# *Argument:
13013 \#   <user-defined separator>
13014 \# *Function:
13015 \#   Stores user-defined separator (for use then
13016 \#   FOOTNOTE_MARKER_STYLE is LINE) in string $FN_LN_SEP.  The
13017 \#   separator is intended to be used when the user wishes a
13018 \#   separator, rather than the choice of brackets offered by
13019 \#   FOOTNOTE_LINENUMBER_BRACKETS.
13020 \#
13021 .MAC FOOTNOTE_LINENUMBER_SEPARATOR END
13022 .    rr #FN_LN_BRACKETS
13023 .    nr #FN_LN_SEP 1
13024 .    ds $FN_LN_SEP "\\$1
13025 .END
13026 \#
13027 \# FOOTNOTE LINENUMBER BRACKETS
13028 \# ----------------------------
13029 \# *Argument:
13030 \#   PARENS | SQUARE | BRACES or ( | [ | {
13031 \# *Function:
13032 \#   Sets register #FN_LN_BRACKETS to 1, and creates strings
13033 \#   $FN_OPEN_BRACKET and $FN_CLOSE_BRACKET according to the given
13034 \#   argument.
13035 \#
13036 .MAC FOOTNOTE_LINENUMBER_BRACKETS END
13037 .    rr #FN_LN_SEP
13038 .    nr #FN_LN_BRACKETS 1
13039 .    if '\\$1'PARENS' \{\
13040 .       ds $FN_OPEN_BRACKET (
13041 .       ds $FN_CLOSE_BRACKET )
13042 .    \}
13043 .    if '\\$1'(' \{\
13044 .       ds $FN_OPEN_BRACKET (
13045 .       ds $FN_CLOSE_BRACKET )
13046 .    \}
13047 .    if '\\$1'SQUARE' \{\
13048 .       ds $FN_OPEN_BRACKET [
13049 .       ds $FN_CLOSE_BRACKET ]
13050 .    \}
13051 .    if '\\$1'[' \{\
13052 .       ds $FN_OPEN_BRACKET [
13053 .       ds $FN_CLOSE_BRACKET ]
13054 .    \}
13055 .    if '\\$1'BRACES' \{\
13056 .       ds $FN_OPEN_BRACKET {
13057 .       ds $FN_CLOSE_BRACKET }
13058 .    \}
13059 .    if '\\$1'{' \{\
13060 .       ds $FN_OPEN_BRACKET {
13061 .       ds $FN_CLOSE_BRACKET }
13062 .    \}
13063 .END
13064 \#
13065 \# RESET FOOTNOTE NUMBER
13066 \# ---------------------
13067 \# *Arguments:
13068 \#   <none> | PAGE
13069 \# *Function:
13070 \#   Resets register #FN_NUMBER to 1.  If argument is PAGE, creates
13071 \#   toggle #RESET_FN_NUMBER which is checked in HEADER.  If 1,
13072 \#   numbered footnotes on every page start at 1.
13073 \#
13074 .MAC RESET_FOOTNOTE_NUMBER END
13075 .    ie '\\$1'' .nr #FN_NUMBER 0 1
13076 .    el .nr #RESET_FN_NUMBER 1
13077 .END
13078 \#
13079 \# FOOTNOTE RULE LENGTH
13080 \# --------------------
13081 \# *Arguments:
13082 \#   <length of rule used to separate footnotes from running text>
13083 \# *Function:
13084 \#   Creates or modifies registers #FN_RULE_LENGTH.
13085 \# *Notes:
13086 \#   Requires unit of measure (iPpcm).
13087 \#   Default is 4P for both PRINTSTYLEs.
13088 \#
13089 .MAC FOOTNOTE_RULE_LENGTH END
13090 .    nr #FN_RULE_LENGTH (\\$1)
13091 .END
13092 \#
13093 \# FOOTNOTE_RULE_ADJ
13094 \# -----------------
13095 \# *Arguments:
13096 \#   <number of points to raise footnote rule from it's baseline position>
13097 \# *Function:
13098 \#   Creates or modifies register #FN_RULE_ADJ.
13099 \# *Notes:
13100 \#   Default is 3p for both TYPESTYLES.
13101 \#
13102 \#   Requires unit of measure.
13103 \#
13104 .MAC FOOTNOTE_RULE_ADJ END
13105 .    nr #FN_RULE_ADJ (\\$1)
13106 .END
13107 \#
13108 \# FOOTNOTE RULE
13109 \# -------------
13110 \# *Arguments:
13111 \#   <none> | <anything>
13112 \# *Function:
13113 \#   Turns printing of footnote separator rule on or off.  If invoked as
13114 \#   PRINT_FOOTNOTE_RULE, prints footnote separator rule.
13115 \# *Notes:
13116 \#   Default is on.
13117 \#
13118 \#   Invoked in FOOTNOTE (as PRINT_FOOTNOTE_RULE) as 1st line of a footnote
13119 \#   if the footnote number (#FN_COUNT) is 1.
13120 \#
13121 .MAC FOOTNOTE_RULE END
13122 .    ie '\\$0'PRINT_FOOTNOTE_RULE' \{\
13123 .       if \\n[#FN_RULE]=0 .RLD 1v
13124 .       RLD 1v
13125 .       LEFT
13126 \v'-\\n[#FN_RULE_ADJ]u-\\n[#FN_RULE_WEIGHT_ADJ]u'\
13127 \D't \\n[#FN_RULE_WEIGHT]'\
13128 \h'-\\n[#FN_RULE_WEIGHT]u'\
13129 \D'l \\n[#FN_RULE_LENGTH]u 0'\
13130 \v'+\\n[#FN_RULE_ADJ]u+\\n[#FN_RULE_WEIGHT_ADJ]u'
13131 \!.     ps \\n[#DOC_PT_SIZE]u\\*$[FN_SIZE_CHANGE]
13132 .       QUAD \\*[$FN_QUAD]
13133 .    \}
13134 .    el \{\
13135 .       ie '\\$1'' .nr #FN_RULE 1
13136 .       el .nr #FN_RULE 0
13137 .    \}
13138 .END
13139 \#
13140 \# FOOTNOTE SPACING
13141 \# ----------------
13142 \# *Arguments:
13143 \#   <per item post footnote spacing> | <anything>
13144 \# *Function:
13145 \#   Enables printing of post footnote spacing.
13146 \# *Notes:
13147 \#   Default is no space.
13148 \#
13149 .MAC FOOTNOTE_SPACING END
13150 .    ie \B'\\$1' .ds $FN_SPACE \\$1
13151 .    el .rm $FN_SPACE
13152 .END
13153 \#
13154 \# FOOTNOTE FIRST LINE INDENT
13155 \# --------------------------
13156 \# *Arguments:
13157 \#   <indent>
13158 \# *Function:
13159 \#   Indents first line of footnotes.
13160 \# *Notes:
13161 \#   Default is no indent.
13162 \#
13163 .MAC FOOTNOTE_INDENT END
13164 . nr #FN_INDENT \\$1
13165 .END
13166 \#
13167 \# RUN ON FOOTNOTES
13168 \# ----------------
13169 \# *Arguments:
13170 \#   <none> | <anything>
13171 \# *Function:
13172 \#   Toggles run-on footnotes on or off.
13173 \#
13174 .MAC FOOTNOTES_RUN_ON END
13175 .    ie '\\$1'' \{\
13176 .       if \\n[#FN_COUNT]>0 \{\
13177 .          tm1 "[mom]: Switching to run-on footnotes at line \\n[.c] will cause
13178 .          tm1 "       you to loose footnotes already formatted for this page.
13179 .          tm1 "       Ignoring request FOOTNOTES_RUN_ON.
13180 .          rr #RUN_ON
13181 .          return
13182 .       \}
13183 .       nr #RUN_ON 1
13184 .       if \\n[#FN_MARKER_STYLE]=1 .RUNON_WARNING
13185 .       if \\n[#FN_MARKER_STYLE]=2 .RUNON_WARNING
13186 .    \}
13187 .    el \{\
13188 .       if \\n[#FN_COUNT]>0 \{\
13189 .          if \\n[#RUN_ON]=1 \{\
13190 .             tm1 "[mom]: Switching off run-on footnotes at line \\n[.c] will cause
13191 .             tm1 "       you to loose footnotes already formatted for this page.
13192 .             tm1 "       Ignoring request FOOTNOTES_RUN_ON \\$1.
13193 .             return
13194 .          \}
13195 .       \}
13196 .       rr #RUN_ON
13197 .    \}
13198 .END
13199 \#
13200 .MAC RUNON_WARNING END
13201 .    if \\n[#FN_MARKER_STYLE]=1 \{\
13202 .       tm1 "[mom]: The footnote marker style active at line \\n[.c] is STAR,
13203 .       tm1 "       which is incompatible with run-on footnotes.  Please change
13204 .       tm1 "       the footnote marker style to LINE.  Continuing to process,
13205 .       tm1 "       but ignoring request FOOTNOTES_RUN_ON.
13206 .       rr #RUN_ON
13207 .    \}
13208 .    if \\n[#FN_MARKER_STYLE]=2 \{\
13209 .       tm1 "[mom]: The footnote marker style active at line \\n[.c] is NUMBER,
13210 .       tm1 "       which is incompatible with run-on footnotes.  Please change
13211 .       tm1 "       the footnote marker style to LINE.  Continuing to process,
13212 .       tm1 "       but ignoring request FOOTNOTES_RUN_ON.
13213 .       rr #RUN_ON
13214 .    \}
13215 .END
13216 \#
13217 \# FOOTNOTE
13218 \# --------
13219 \# *Arguments:
13220 \#   <none> | INDENT  L|LEFT|R|RIGHT|B|BOTH  <indent value> | <anything>
13221 \# *Function:
13222 \#   Begins collecting and diverting footnote text if no argument
13223 \#   given.  Otherwise, ends diversion FOOTNOTES, measures footnote
13224 \#   depth, and sets footnote trap.
13225 \# *Notes:
13226 \#   The input line preceding a footnote call MUST terminate with \c
13227 \#   or the footnote marker will be spaced away from the word it
13228 \#   should be joined to.
13229 \#
13230 \#   If FOOTNOTE is invoked with INDENT, the footnote will
13231 \#   be indented.  An indent style and an indent value must be given.
13232 \#   Subsequent footnotes will NOT be indented; INDENT must be given
13233 \#   for each footnote the user wants indented.
13234 \#
13235 .MAC FOOTNOTE END
13236 .    ie '\\$1'' \{\
13237 .       if \\n[#UNDERLINE_ON] \{\
13238 .          UNDERLINE OFF
13239 .          nr #UNDERLINE_WAS_ON_FN 1
13240 .       \}
13241 .       if \\n[#FN_MARKER_STYLE]=3 \{\
13242 .          if !\\n[#LINENUMBERS] \{\
13243 .             tm1 "[mom]: Line numbering must be enabled with NUMBER_LINES when
13244 .             tm1 "       FOOTNOTE_MARKER_STYLE is LINE.
13245 .             ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
13246 .          \}
13247 .          if \\n[#FN_MARK]=0 .nr #FN_MARK \\n[ln]
13248 .          nr #FN_MARK_2 \\n[ln]
13249 .          if '\\n[.z]'P_QUOTE' \{\
13250 .             nr #FN_MARK -1
13251 .             nr #FN_MARK_2 -1
13252 .          \}
13253 .          if \\n[#IN_DIVER]=1 \{\
13254 .             if '\\n[.z]'P_QUOTE' \{\
13255 .                if !\\n[#QUOTE_LN]=1 \{\
13256 .                   if !\\n[#SILENT_QUOTE_LN]=1 \{\
13257 .                      tm1 "[mom]: You have requested a line-numbered footnote inside a
13258 .                      tm1 "       QUOTE at line \\n[.c], but line-numbering has not been enabled
13259 .                      tm1 "       for QUOTES.  Printing footnote with label "0".
13260 .                      rr #FN_MARK
13261 .                      rr #FN_MARK_2
13262 .                   \}
13263 .                \}
13264 .             \}
13265 .             if '\\n[.z]'B_QUOTE' \{\
13266 .                if !\\n[#BQUOTE_LN]=1 \{\
13267 .                   if !\\n[#SILENT_BQUOTE_LN]=1 \{\
13268 .                      tm1 "[mom]: You have requested a line-numbered footnote inside a
13269 .                      tm1 "       BLOCKQUOTE at line \\n[.c], but line-numbering has not been enabled
13270 .                      tm1 "       for BLOCKQUOTES.  Printing footnote with label "0".
13271 .                      rr #FN_MARK
13272 .                      rr #FN_MARK_2
13273 .                   \}
13274 .                \}
13275 .             \}
13276 .          \}
13277 .       \}
13278 .\" Begin processing footnotes that occur inside QUOTE, BLOCKQUOTE
13279 .\" or EPIGRAPH.
13280 .       if \\n[#IN_DIVER]=1 \{\
13281 .          nr #PAGE_POS \\n[nl]+\\n[.d]+\\n[#DOC_LEAD]
13282 .          nr #FOOTER_POS \\n[#PAGE_LENGTH]+(\\n[#VARIABLE_FOOTER_POS]-1)
13283 .          nr #SPACE_TO_FOOTER \\n[#FOOTER_POS]-\\n[#PAGE_POS]
13284 .\" Are we on a "defer" line?  If so, defer the text of the footnote.
13285 .          ie \\n[#SPACE_TO_FOOTER]<=\\n[#DOC_LEAD] \
13286 .             nr #DIVER_FN 2 \" treat like a normal deferred footnote
13287 .          el \
13288 .             nr #DIVER_FN 2 \" treat like a normal footnote
13289 .          if \\n[#PAGE_POS]>\\n[#FOOTER_POS] \
13290 .             nr #DIVER_FN 1 \" move this footnote
13291 .\" Test for situation where, because a final line of QUOTE, BLOCKQUOTE
13292 .\" or EPIGRAPH isn't yet adjusted at this point, the last word on the
13293 .\" line may *seem* to belong to the final line of the page, but will,
13294 .\" in fact, become the first word of the subsequent page.  In such
13295 .\" circumstances, we want the footnote to be treated as a "moved"
13296 .\" diversion footnote.
13297 .          if \\n[.k]>\\n[.l] .nr #DIVER_FN 1
13298 .          if r #DIVER_FN \{\
13299 .             if !\\n[#DIVER_FN]=2 .\\n+[#DONE_ONCE]
13300 .\" A footnote inside a diversion will become the 1st footnote on the
13301 .\" following page/column.
13302 .             if \\n[#DIVER_FN]=1 .DIVER_FN_1_PRE
13303 .\" A footnote inside a diversion that should be treated like a
13304 .\" normal footnote (including defers.)
13305 .             if \\n[#DIVER_FN]=2 .DIVER_FN_2_PRE
13306 .          \}
13307 .          nr #SAVED_FN_COUNT \\n[#FN_COUNT]+1
13308 .          nr #SAVED_FN_COUNT_FOR_COLS \\n[#FN_COUNT_FOR_COLS]+1
13309 .       \}
13310 .\" End processing footnotes that occur inside QUOTE, BLOCKQUOTE or
13311 .\" EPIGRAPH.
13312 .\"
13313 .\" Test for situation where, because a final line of running text
13314 .\" isn't yet adjusted at this point, the last word on the line may
13315 .\" *seem* to belong to the final line of the page, but will, in
13316 .\" fact, become the first word of the subsequent page.  In such
13317 .\" circumstances, we want the footnote marker in running text to
13318 .\" be the correct one for the 1st footnote on the page.
13319 .       if \\n[.k]>\\n[.l] \{\
13320 .          if (\\n[nl]+\\n[#DOC_LEAD])>(\\n[#PAGE_LENGTH]+\\n[#VARIABLE_FOOTER_POS]) \{\
13321 .             ie \\n[#COLUMNS]=1 \{\
13322 .                if \\n[#COL_NUM]=\\n[#NUM_COLS] \{\
13323 .                   if \\n[#FN_MARKER_STYLE]=1 .nr #FN_COUNT_FOR_COLS 0 1
13324 .                   if \\n[#FN_MARKER_STYLE]=2 \{\
13325 .                      if \\n[#RESET_FN_NUMBER] \{\
13326 .                         nr #FN_NUMBER 0 1
13327 .                         nr #NOT_YET_ADJUSTED 1
13328 .                      \}
13329 .                   \}
13330 .                \}
13331 .             \}
13332 .             el \{\
13333 .                if \\n[#FN_MARKER_STYLE]=1 .nr #FN_COUNT 0 1
13334 .                if \\n[#FN_MARKER_STYLE]=2 \{\
13335 .                   if \\n[#RESET_FN_NUMBER] \{\
13336 .                      nr #FN_NUMBER 0 1
13337 .                      nr #NOT_YET_ADJUSTED 1
13338 .                   \}
13339 .                \}
13340 .             \}
13341 .          \}
13342 .       \}
13343 .       if \\n[#FN_MARKERS] \{\
13344 .\" Housekeeping
13345 .          if \\n[#CONDENSE] \*[CONDX]\c
13346 .          if \\n[#EXTEND] \*[EXTX]\c
13347 .\" Add footnote markers to running text...
13348 .          if !\\n[#NO_FN_MARKER] \{\
13349 .\" ...but not if TERMINATE has not been called
13350 .             if !r#TERMINATE \{\
13351 .\" Marker style star/dagger/double-dagger
13352 .                if \\n[#FN_MARKER_STYLE]=1 \{\
13353 .\" Columnar docs either move col to col, or last col to next page.
13354 .\" They require their own special FN_COUNT because regular FN_COUNT
13355 .\" is used to figure out things like whether or not to put a rule
13356 .\" above footnotes (in addition to keeping track of the footnote
13357 .\" count in non-columnar docs).
13358 .                   ie \\n[#COLUMNS]=1 \{\
13359 .                      if \\n[#FN_COUNT_FOR_COLS]=0 .PRINT \*[BU2]*\c
13360 .                      if \\n[#FN_COUNT_FOR_COLS]=1 .PRINT \*[BU1]\[dg]\c
13361 .                      if \\n[#FN_COUNT_FOR_COLS]=2 .PRINT \[dd]\c
13362 .                      if \\n[#FN_COUNT_FOR_COLS]=3 .PRINT \*[BU2]**\c
13363 .                      if \\n[#FN_COUNT_FOR_COLS]=4 .PRINT \*[BU1]\[dg]\[dg]\c
13364 .                      if \\n[#FN_COUNT_FOR_COLS]=5 .PRINT \[dd]\[dd]\c
13365 .                      if \\n[#FN_COUNT_FOR_COLS]=6 .PRINT \*[BU2]***\c
13366 .                      if \\n[#FN_COUNT_FOR_COLS]=7 .PRINT \*[BU1]\[dg]\[dg]\[dg]\c
13367 .                      if \\n[#FN_COUNT_FOR_COLS]=8 .PRINT \[dd]\[dd]\[dd]\c
13368 .                      if \\n[#FN_COUNT_FOR_COLS]=9 .PRINT \*[BU2]****\c
13369 .                   \}
13370 .                   el \{\
13371 .                      if \\n[#FN_COUNT]=0 .PRINT \*[BU2]*\c
13372 .                      if \\n[#FN_COUNT]=1 .PRINT \*[BU1]\[dg]\c
13373 .                      if \\n[#FN_COUNT]=2 .PRINT \[dd]\c
13374 .                      if \\n[#FN_COUNT]=3 .PRINT \*[BU2]**\c
13375 .                      if \\n[#FN_COUNT]=4 .PRINT \*[BU1]\[dg]\[dg]\c
13376 .                      if \\n[#FN_COUNT]=5 .PRINT \[dd]\[dd]\c
13377 .                      if \\n[#FN_COUNT]=6 .PRINT \*[BU2]***\c
13378 .                      if \\n[#FN_COUNT]=7 .PRINT \*[BU1]\[dg]\[dg]\[dg]\c
13379 .                      if \\n[#FN_COUNT]=8 .PRINT \[dd]\[dd]\[dd]\c
13380 .                      if \\n[#FN_COUNT]=9 .PRINT \*[BU2]****\c
13381 .                   \}
13382 .                \}
13383 .\" Marker style superscript numbers
13384 .                if \\n[#FN_MARKER_STYLE]=2 \{\
13385 .                   if \\n[#PRINT_STYLE]=1 \
13386 .                      PRINT \
13387 "\s-2\v'-\\n[#DOC_LEAD]u/5u'\\n+[#FN_NUMBER]\v'+\\n[#DOC_LEAD]u/5u'\s+2\c"
13388 .                   if \\n[#PRINT_STYLE]=2 \
13389 .                      PRINT \
13390 "\*[SUP]\\n+[#FN_NUMBER]\*[SUPX]\c"
13391 .                \}
13392 .             \}
13393 .          \}
13394 .       \}
13395 .\" More housekeeping
13396 .\"
13397 .\" #SPACE_REMAINING is the space left between where we are
13398 .\" on the page and the bottom margin.  It's used to determine whether
13399 .\" or not the footnote will overflow, and how many lines of
13400 .\" footnotes will fit on the page if some have to overflow.
13401 .       ie \\n[#DIVER_FN]=2 \
13402 .          nr #SPACE_REMAINING (\\n[#PAGE_LENGTH]-\\n[#B_MARGIN])-(\\n[#PAGE_POS])
13403 .       el \
13404 .          nr #SPACE_REMAINING (\\n[#PAGE_LENGTH]-\\n[#B_MARGIN])-\\n[nl]
13405 .       if \\n[#FROM_DIVERT_FN]=1 \{\
13406 .          nr #SPACE_REMAINING \\n[#PAGE_LENGTH]-\\n[#B_MARGIN]
13407 .          rr #FROM_DIVERT_FN
13408 .       \}
13409 .       nr #PP_STYLE_PREV \\n[#PP_STYLE]
13410 .       nr #PP_STYLE 2
13411 .       if \\n[#INDENT_FIRST_PARAS] .nr #INDENT_FIRSTS 1
13412 .       INDENT_FIRST_PARAS
13413 .\" Prepare FOOTNOTE to receive footnote text.
13414 .       ev FOOTNOTES
13415 .       ll \\n[#DOC_L_LENGTH]u
13416 .       ta \\n[.l]u
13417 .       if \\n[#COLUMNS]=1 \{\
13418 .          ll \\n[#COL_L_LENGTH]u
13419 .          ta \\n[.l]u
13420 .       \}
13421 .       if \\n[#FN_R_INDENT] \{\
13422 .          ll -\\n[#FN_R_INDENT]u
13423 .          ta \\n[.l]u
13424 .       \}
13425 .       if \\n[#FN_BR_INDENT] \{\
13426 .          ll -\\n[#FN_BR_INDENT]u
13427 .          ta \\n[.l]u
13428 .       \}
13429 .       FAMILY   \\*[$FN_FAM]
13430 .       FT       \\*[$FN_FT]
13431 .       ps  \\n[#DOC_PT_SIZE]u\\*[$FN_SIZE_CHANGE]
13432 .       vs \\n[.ps]u+\\n[#FN_AUTOLEAD]u
13433 .       QUAD     \\*[$FN_QUAD]
13434 .       if \\n[#PRINT_STYLE]=1 \{\
13435 .          TYPEWRITER
13436 .          ie \\n[#SINGLE_SPACE] .vs \\n[#ORIGINAL_DOC_LEAD]u
13437 .          el .vs \\n[#ORIGINAL_DOC_LEAD]u/2u
13438 .          QUAD LEFT
13439 .          HY OFF
13440 .       \}
13441 .       nr #FN_LEAD \\n[#LEAD]
13442 .\" Begin diversion FOOTNOTES or FN_IN_DIVER
13443 .       ie r#COUNTERS_RESET \{\
13444 .          ie \\n[#DONE_ONCE]=1 \{\
13445 .             ie \\n[#RUN_ON] \{\
13446 .                di RUNON_FN_IN_DIVER
13447 .                nr #RUNON_FN_IN_DIVER 1
13448 .             \}
13449 .             el .di FN_IN_DIVER
13450 .          \}
13451 .          el \{\
13452 .             ie \\n[#RUN_ON] \{\
13453 .                da RUNON_FN_IN_DIVER
13454 .                nr #RUNON_FN_IN_DIVER 1
13455 .             \}
13456 .             el .da FN_IN_DIVER
13457 .          \}
13458 .       \\n+[#DONE_ONCE]
13459 .       \}
13460 .       el \{\
13461 .          ie \\n[#RUN_ON] \{\
13462 .             da RUNON_FOOTNOTES
13463 .             nr #RUNON_FOOTNOTES 1
13464 .          \}
13465 .          el .da FOOTNOTES
13466 .       \}
13467 .       if \\n[#FOOTNOTE_COLOR]=1 \{\
13468 .          TRAP OFF
13469 .          nf
13470 \m[\\*[$FOOTNOTE_COLOR]]
13471 .          EOL
13472 .          fi
13473 .          TRAP
13474 .       \}
13475 .       if \\n[#EPIGRAPH] .nr #FN_FOR_EPI 1
13476 .\" When a deferred footnote is also the 1st footnote on the page,
13477 .\" and when the page it's output on also has footnotes, some
13478 .\" whitespace is needed between the deferred footnote and the
13479 .\" first footnote belonging to the output page so that there's
13480 .\" no confusion when two stars (or two number 1s) appear in
13481 .\" footnotes...
13482 .       if \\n[#FN_DEFER_SPACE] \{\
13483 .\" ...but only add the extra space if TERMINATE has not been called
13484 .          if !r#TERMINATE \{\
13485 .\" ...and not if defer space has already been added
13486 .             if !\\n[#DEFER_SPACE_ADDED] \{\
13487 .\" ...and not if the footnote count the last time we checked for
13488 .\" a defer situation inside a diversion is greater than 1.
13489 .                if !\\n[#SAVED_DIVER_FN_COUNT]>1 \{\
13490 .                   if \\n[#FN_MARKER_STYLE]=1 .ALD 1v
13491 .                   if \\n[#RESET_FN_NUMBER] .ALD 1v
13492 .                   nr #DEFER_SPACE_ADDED 1
13493 .                \}
13494 .             \}
13495 .          \}
13496 .          rr #FN_DEFER_SPACE
13497 .          rr #SAVED_DIVER_FN_COUNT
13498 .       \}
13499 .       if \\n[#DIVERTED]=3 \{\
13500 .          if \\n[#FN_COUNT]>0 \{\
13501 \!.           RLD 1v
13502 .          \}
13503 .       \}
13504 .\" Add footnote rule (or, if no rule, some whitespace).
13505 .\" N.B.- this line increments #FN_COUNT each and every time FOOTNOTE
13506 .\" is run.
13507 .       if \\n+[#FN_COUNT]=1 \{\
13508 .\" If a footnote is called in a diversion, and the footnote has to
13509 .\" be moved, don't put in the rule now (it's taken care of when
13510 .\" FN_IN_DIVER is output into FOOTNOTE in PROCESS_FN_IN_DIVER).
13511 .          if !\\n[#DONT_RULE_ME]=1 \{\
13512 .             if !\\n[#FN_DEPTH] \{\
13513 .                if \\n[#PRINT_STYLE]=1 \
13514 .                   if !\\n[#RUN_ON] .sp \\n[#DOC_LEAD]u
13515 .                ie \\n[#FN_RULE]=1 \{\
13516 .                   if !\\n[#RUN_ON] \{\
13517 .                      if \\n[#SINGLE_SPACE] .sp \\n[#DOC_LEAD]u
13518 .                      PRINT_FOOTNOTE_RULE
13519 .                      if !'\\*[$FN_SPACE]'' .sp -\\*[$FN_SPACE]
13520 .                   \}
13521 .                \}
13522 .                el .sp
13523 .                nr #RULED 1
13524 .             \}
13525 .          \}
13526 .       \}
13527 .       rr #DONT_RULE_ME
13528 .       ds $RESTORE_SS_VAR \\*[$SS_VAR]
13529 .       SS 0
13530 .\" Add footnote markers to footnote text...
13531 .       ie \\n[#FN_MARKERS] \{\
13532 .          if !'\\*[$FN_SPACE]'' \
13533 .             if \\n[#FN_COUNT]>0 .ALD \\*[$FN_SPACE]
13534 .          if !\\n[#NO_FN_MARKER] \{\
13535 .\" ...but not if TERMINATE has been called.
13536 .             if !r#TERMINATE \{\
13537 .                if \\n[#REF]=1 \{\
13538 .                   nr #REF_FN_INDENT (u;\\*[$REF_FN_INDENT])
13539 .                   ti \\n[#REF_FN_INDENT]u
13540 .                \}
13541 .                if \\n[#FN_MARKER_STYLE]=1 \{\
13542 .                   ie \\n[#COLUMNS]=1 \{\
13543 .                      \\n+[#FN_COUNT_FOR_COLS]
13544 .                      if \\n[#FN_COUNT_FOR_COLS]=1 .PRINT \h'0+\\n[#FN_INDENT]u'*\c
13545 .                      if \\n[#FN_COUNT_FOR_COLS]=2 .PRINT \h'0+\\n[#FN_INDENT]u'\[dg]\c
13546 .                      if \\n[#FN_COUNT_FOR_COLS]=3 .PRINT \h'0+\\n[#FN_INDENT]u'\[dd]\c
13547 .                      if \\n[#FN_COUNT_FOR_COLS]=4 .PRINT \h'0+\\n[#FN_INDENT]u'**\c
13548 .                      if \\n[#FN_COUNT_FOR_COLS]=5 .PRINT \h'0+\\n[#FN_INDENT]u'\[dg]\[dg]\c
13549 .                      if \\n[#FN_COUNT_FOR_COLS]=6 .PRINT \h'0+\\n[#FN_INDENT]u'\[dd]\[dd]\c
13550 .                      if \\n[#FN_COUNT_FOR_COLS]=7 .PRINT \h'0+\\n[#FN_INDENT]u'***\c
13551 .                      if \\n[#FN_COUNT_FOR_COLS]=8 .PRINT \h'0+\\n[#FN_INDENT]u'\[dg]\[dg]\[dg]\c
13552 .                      if \\n[#FN_COUNT_FOR_COLS]=9 .PRINT \h'0+\\n[#FN_INDENT]u'\[dd]\[dd]\[dd]\c
13553 .                      if \\n[#FN_COUNT_FOR_COLS]=10 .PRINT \h'0+\\n[#FN_INDENT]u'****\c
13554 .                   \}
13555 .                   el \{\
13556 .                      if \\n[#FN_COUNT]=1 .PRINT \h'0+\\n[#FN_INDENT]u'*\c
13557 .                      if \\n[#FN_COUNT]=2 .PRINT \h'0+\\n[#FN_INDENT]u'\[dg]\c
13558 .                      if \\n[#FN_COUNT]=3 .PRINT \h'0+\\n[#FN_INDENT]u'\[dd]\c
13559 .                      if \\n[#FN_COUNT]=4 .PRINT \h'0+\\n[#FN_INDENT]u'**\c
13560 .                      if \\n[#FN_COUNT]=5 .PRINT \h'0+\\n[#FN_INDENT]u'\[dg]\[dg]\c
13561 .                      if \\n[#FN_COUNT]=6 .PRINT \h'0+\\n[#FN_INDENT]u'\[dd]\[dd]\c
13562 .                      if \\n[#FN_COUNT]=7 .PRINT \h'0+\\n[#FN_INDENT]u'***\c
13563 .                      if \\n[#FN_COUNT]=8 .PRINT \h'0+\\n[#FN_INDENT]u'\[dg]\[dg]\[dg]\c
13564 .                      if \\n[#FN_COUNT]=9 .PRINT \h'0+\\n[#FN_INDENT]u'\[dd]\[dd]\[dd]\c
13565 .                      if \\n[#FN_COUNT]=10 .PRINT \h'0+\\n[#FN_INDENT]u'****\c
13566 .                   \}
13567 .                \}
13568 .                if \\n[#FN_MARKER_STYLE]=2 \{\
13569 .                   ds $FN_NUMBER \\n[#FN_NUMBER]
13570 .                   length #FN_NUMBER_LENGTH \\*[$FN_NUMBER]
13571 .                   if \\n[#COLUMNS]=1 \
13572 .                      \\n+[#FN_COUNT_FOR_COLS]
13573 .                   if \\n[#NOT_YET_ADJUSTED]=1 \{\
13574 .                      nr #FN_NUMBER 1 1
13575 .                      rr #NOT_YET_ADJUSTED
13576 .                   \}
13577 .                   if \\n[#PRINT_STYLE]=1 \{\
13578 .                      ie \\n[#NO_SUPERSCRIPT] \{\
13579 .                         ie \\n[#FN_NUMBER_LENGTH]<\\n[#FN_NUMBER_PLACEHOLDERS] \
13580 .                            PRINT "\h'0+\\n[#FN_INDENT]u'\0(\\n[#FN_NUMBER])\|\c"
13581 .                         el \
13582 .                            PRINT "\h'0+\\n[#FN_INDENT]u'(\\n[#FN_NUMBER])\|\c"
13583 .                      \}
13584 .                      el \{\
13585 .                         ie \\n[#FN_NUMBER_LENGTH]<\\n[#FN_NUMBER_PLACEHOLDERS] \
13586 .                            PRINT \
13587 "\h'0+\\n[#FN_INDENT]u'\s-2\v'-\\n[.v]u/5u'\0\\n[#FN_NUMBER]\|\v'+\\n[.v]u/5u'\s+2\|\c"
13588 .                         el \
13589 .                            PRINT \
13590 "\h'0+\\n[#FN_INDENT]u'\s-2\v'-\\n[.v]u/5u'\\n[#FN_NUMBER]\|\v'+\\n[.v]u/5u'\s+2\|\c"
13591 .                      \}
13592 .                   \}
13593 .                   if \\n[#PRINT_STYLE]=2 \{\
13594 .                      ie \\n[#FN_NUMBER_LENGTH]<\\n[#FN_NUMBER_PLACEHOLDERS] \
13595 .                         PRINT "\h'0+\\n[#FN_INDENT]u'\*[SUP]\0\\n[#FN_NUMBER]\*[SUPX]\*[FU 3]\c"
13596 .                      el \
13597 .                         PRINT "\h'0+\\n[#FN_INDENT]u'\*[SUP]\\n[#FN_NUMBER]\*[SUPX]\*[FU 3]\c"
13598 .                   \}
13599 .                \}
13600 .             \}
13601 .          \}
13602 .       \}
13603 .       el \{\
13604 .\" Line-numbered footnotes handling
13605 .          if \\n[#FN_MARKER_STYLE]=3 \{\
13606 .             if \\n[#FN_SPACE]>0 \{\
13607 .                if !\\n[#RUN_ON]=1 \
13608 .                   if \\n[#FN_COUNT]>0 .ALD \\n[#FN_SPACE]u
13609 .             \}
13610 .             if \\n[#REF]=1 \{\
13611 .                if !\\n[#RUN_ON]=1 \{\
13612 \!.                 ti +\\n[#REF_FN_INDENT]uu
13613 .                \}
13614 .             \}
13615 .             ie \\n[#FN_LN_BRACKETS]=1 \{\
13616 .                ds $FN_LINENUMBER \h'0+\\n[#FN_INDENT]u'\v'-.085m'\\*[$FN_OPEN_BRACKET]\v'.085m'
13617 .                ie \\n[#FN_MARK_2]=\\n[#FN_MARK] \
13618 .                   as $FN_LINENUMBER \
13619 \\n[#FN_MARK]\v'-.085m'\\*[$FN_CLOSE_BRACKET]\v'.085m'\h'.25m'
13620 .                el \
13621 .                   as $FN_LINENUMBER \
13622 \\n[#FN_MARK]\v'-.1m'-\v'.1m'\\n[#FN_MARK_2]\v'-.085m'\
13623 \\*[$FN_CLOSE_BRACKET]\v'.085m'\h'.25m'
13624 .             \}
13625 .             el \{\
13626 .                ie \\n[#FN_MARK_2]=\\n[#FN_MARK] \
13627 .                   ds $FN_LINENUMBER \\n[#FN_MARK]\\*[$FN_LN_SEP]
13628 .                el \
13629 .                   ds $FN_LINENUMBER \
13630 \h'0+\\n[#FN_INDENT]u'\\n[#FN_MARK]\v'-.1m'-\v'.1m'\\n[#FN_MARK_2]\\*[$FN_LN_SEP]
13631 .                \}
13632 .             \}
13633 .          if !\\n[#NO_FN_MARKER] \
13634 .             PRINT \\*[$FN_LINENUMBER]\c
13635 .          rm $FN_LINENUMBER
13636 .          nr #FN_MARK 0
13637 .       \}
13638 .    \}
13639 .    el \{\
13640 .\" If INDENT arg is passed to FOOTNOTE, calculate the indent...
13641 .       ie '\\$1'INDENT' \{\
13642 .          ev FOOTNOTES
13643 .          if '\\$2'L' .in (\\$3)
13644 .          if '\\$2'LEFT' .in (\\$3)
13645 .          if '\\$2'R' .nr #FN_R_INDENT (\\$3)
13646 .          if '\\$2'RIGHT' .nr #FN_R_INDENT (\\$3)
13647 .          if '\\$2'B' \{\
13648 .             nr #FN_BL_INDENT (\\$3)
13649 .             ie '\\$4'' .nr #FN_BR_INDENT \\n[#FN_BL_INDENT]
13650 .             el .nr #FN_BR_INDENT (\\$4)
13651 .             in \\n[#FN_BL_INDENT]u
13652 .          \}
13653 .          if '\\$2'BOTH' \{\
13654 .             nr #FN_BL_INDENT (\\$3)
13655 .             ie '\\$4'' .nr #FN_BR_INDENT \\n[#FN_BL_INDENT]
13656 .             el .nr #FN_BR_INDENT (\\$4)
13657 .             in \\n[#FN_BL_INDENT]u
13658 .          \}
13659 .          ev
13660 .\" ...then re-run FOOTNOTE without an argument.
13661 .          FOOTNOTE
13662 .       \}
13663 .       el \{\
13664 .          br
13665 .\" Add "defer space" if the previously diverted footnote was the
13666 .\" 1st footnote proper to its page (i.e. it looks like a deferred
13667 .\" footnote but it's really an overflow).
13668 .          if \\n[#DIVERTED] \{\
13669 .             if \\n[#PREV_FN_DEFERRED]=1 \{\
13670 .                if \\n[#FN_MARKER_STYLE]=1 .ALD \\n[#FN_LEAD]u
13671 .                if \\n[#RESET_FN_NUMBER] .ALD \\n[#FN_LEAD]u
13672 .                nr #PREV_FN_DEFERRED 2
13673 .             \}
13674 .          \}
13675 .          if \\n[#REF]=1 \{\
13676 \!.           in
13677 .          \}
13678 .\" Terminate FOOTNOTES or FN_IN_DIVER diversion
13679 .          di
13680 .          HY_SET 1 \\n[#DIVERSIONS_HY_MARGIN]u (\\n[#PT_SIZE]u/1000u/8u)p
13681 .          hy 14
13682 .\" More housekeeping
13683 .\" Turn off indent possibly set by FOOTNOTE INDENT
13684 .          in 0
13685 .          ev
13686 .          if \\n[#UNDERLINE_WAS_ON_FN] \{\
13687 .             UNDERLINE
13688 .             rr #UNDERLINE_WAS_ON_FN
13689 .          \}
13690 .\" Restore sentence spacing
13691 .          if \\n[#PRINT_STYLE]=2 \{\
13692 .             if d $RESTORE_SS_VAR .SS \\*[$RESTORE_SS_VAR]
13693 .             rm $RESTORE_SS_VAR
13694 .          \}
13695 .          rr #FN_R_INDENT
13696 .          rr #FN_BR_INDENT
13697 .          nr #PP_STYLE \\n[#PP_STYLE_PREV]
13698 .          if !\\n[#INDENT_FIRSTS] .INDENT_FIRST_PARAS OFF
13699 .          rr #INDENT_FIRSTS
13700 .\" Calculate footnote depth, but not if #COUNTERS_RESET (created in
13701 .\" DIVER_FN_1_PRE) to instruct FOOTNOTES to skip this step for now
13702 .\" (it's taken care of when FN_IN_DIVER is output into FOOTNOTES in
13703 .\" PROCESS_FN_IN_DIVER).
13704 .          ie r#COUNTERS_RESET .rr #COUNTERS_RESET
13705 .          el \{\
13706 .             nr #GET_DEPTH 1
13707 .\" If the footnote is the 1st on the page and it falls too close
13708 .\" to the bottom margin, defer the footnote text to the next page...
13709 .             if (\\n[#SPACE_REMAINING]-1)<=(\\n[.v]) \{\
13710 .\" ...but not if PROCESS_FN_LEFTOVER has set #PREV_FN_DEFERRED to 1
13711 .                if !\\n[#PREV_FN_DEFERRED]=1 \{\
13712 .                   nr #FN_DEFER 1
13713 .                   nr #FN_DEPTH +\\n[#DIVER_DEPTH]
13714 .                   rr #GET_DEPTH
13715 .\" This is required so that the defer space clause can distinguish
13716 .\" a real #FN_COUNT=1 from one generated if FOOTNOTE is run inside
13717 .\" QUOTE, BLOCKQUOTE or EPIGRAPH
13718 .                   if \\n[#DIVER_FN]=2 \{\
13719 .                      nr #SAVED_DIVER_FN_COUNT \\n[#FN_COUNT]
13720 .                      rr #DIVER_FN
13721 .                   \}
13722 .                \}
13723 .             \}
13724 .\" Calculate the footnote depth.
13725 .             if \\n[#GET_DEPTH]=1 \{\
13726 .\" Save the previous footnote depth (for use when there will be
13727 .\" some overflowed footnote text).
13728 .                nr #SAVED_FN_DEPTH_1 \\n[#FN_DEPTH]
13729 .\" Add the depth of the current footnote to any already existent
13730 .\" footnotes.
13731 .                nr #FN_DEPTH +\\n[#DIVER_DEPTH]
13732 .\" Special handling for run-on footnotes
13733 .                if \\n[#RUN_ON]=1 \{\
13734 .                   if \\n[#RUNON_FOOTNOTES]   .unformat RUNON_FOOTNOTES
13735 .                   if \\n[#RUNON_FN_IN_DIVER] .unformat RUNON_FN_IN_DIVER
13736 .                   ev FOOTNOTES
13737 .\" Recreate FOOTNOTES with rule followed by text of unformatted
13738 .\" run-on footnotes.
13739 .                   di FOOTNOTES
13740 .                   ie \\n[#FN_RULE]=0 .RLD 1v
13741 .                   el \{\
13742 \v'-\\n[#FN_RULE_ADJ]u-\\n[#FN_RULE_WEIGHT_ADJ]u'\
13743 \D't \\n[#FN_RULE_WEIGHT]'\
13744 \h'-\\n[#FN_RULE_WEIGHT]u'\
13745 \D'l \\n[#FN_RULE_LENGTH]u 0'\
13746 \v'+\\n[#FN_RULE_ADJ]u+\\n[#FN_RULE_WEIGHT_ADJ]u'
13747 .                   \}
13748 .                   br
13749 .                   if \\n[#RUNON_FOOTNOTES] \{\
13750 .                      RUNON_FOOTNOTES
13751 .                      rr #RUNON_FOOTNOTES
13752 .                   \}
13753 .                   if \\n[#RUNON_FN_IN_DIVER] \{\
13754 .                      RUNON_FN_IN_DIVER
13755 .                      rr #RUNON_FN_IN_DIVER
13756 .                   \}
13757 .                   br
13758 .                   di
13759 .                   ev
13760 .                   nr #FN_DEPTH \\n[#DIVER_DEPTH]
13761 .                   nr #SAVED_VFP 0+\\n[#VARIABLE_FOOTER_POS]
13762 .                   nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]u
13763 .                \}
13764 .\" Save the new depth
13765 .                nr #SAVED_FN_DEPTH_2 \\n[#FN_DEPTH]
13766 .\" Signal that defer space should be added when PROCESS_FN_LEFTOVER
13767 .\" processes deferred footnotes.
13768 .                if \\n[#FN_DEFER] \{\
13769 .                   if \\n[#FN_COUNT]=2 \{\
13770 .                      ie \\n[#COLUMNS] \{\
13771 .                         if !\\n[#FROM_FOOTER] \{\
13772 .                            if \\n[#FN_DEFER]=1 .nr #FN_DEFER_SPACE 1
13773 .                            if \\n[#FN_COUNT_FOR_COLS]>=1 .rr #FN_DEFER_SPACE
13774 .                            if \\n[#FROM_HEADER] .nr #FN_DEFER_SPACE 1
13775 .                         \}
13776 .                      \}
13777 .                      el .nr #FN_DEFER_SPACE 1
13778 .                   \}
13779 .                   rr #FN_DEFER
13780 .                \}
13781 .\" If the depth of the whole footnote won't fit in the space
13782 .\" between where we are on the page and the bottom margin, calculate
13783 .\" how much of it will fit.
13784 .                if \\n[#FN_DEPTH]>\\n[#SPACE_REMAINING] \{\
13785 .                   nr #FN_LINES 0 1
13786 .                   while (\\n+[#FN_LINES]*\\n[#FN_LEAD])<\\n[#SPACE_REMAINING] \{\
13787 .                      nr #FN_DEPTH (\\n[#FN_LINES]*\\n[#FN_LEAD])
13788 .                   \}
13789 .                   nr #VFP_DIFF \\n[#FN_DEPTH]-\\n[#SAVED_FN_DEPTH_1]
13790 .                   nr #OVERFLOW 1
13791 .\" Very occasionally, #VFP_DIFF, on a 1st footnote that isn't to
13792 .\" be deferred, comes up with a depth equal to exactly 1 line
13793 .\" of footnotes, i.e. enough room to print the rule and nothing
13794 .\" else.  The following tests for such a condition, and rather than
13795 .\" attempting to treat the footnote as an overflow, it tells mom to
13796 .\" treat it as a special kind of deferred footnote (#FN_DEFER 2).
13797 .                   if \\n[#SAVED_FN_DEPTH_1]=0 \{\
13798 .                      if \\n[#FN_DEPTH]=\\n[#FN_LEAD] \{\
13799 .                         nr #FN_DEFER 2
13800 .                         nr #FN_DEPTH \\n[#SAVED_FN_DEPTH_2]
13801 .                         rr #OVERFLOW
13802 .                      \}
13803 .                   \}
13804 .                \}
13805 .\" Calculate VFP based on whether the footnote overflows, or is to
13806 .\" be treated normally.
13807 .                ie \\n[#OVERFLOW]=1 \{\
13808 .                   if \\n[#RUN_ON] \{\
13809 .                      rr #VARIABLE_FOOTER_POS
13810 .                      nr #VARIABLE_FOOTER_POS \\n[#SAVED_VFP]
13811 .                   \}
13812 .                   ie \\n[#FN_COUNT]=1 \{\
13813 .                      ie \\n[#RULED]=1 \{\
13814 .                         ie \\n[#COLUMNS]=1 \{\
13815 .                            ie \\n[#COL_NUM]=\\n[#NUM_COLS] \{\
13816 .                               ie \\n[#FROM_FOOTER] \{\
13817 .                                  ie \\n[#FN_COUNT_FOR_COLS]>1 \{\
13818 .                                     nr #FN_DEPTH -\\n[#FN_DEPTH]
13819 .                                     if \\n[#DIVERTED]=1 .nr #DIVERTED 3
13820 .                                     if !\\n[#PREV_FN_DEFERRED]=1 \
13821 .                                        nr #FN_DEPTH -\\n[#VFP_DIFF]
13822 .                                  \}
13823 .                                  el \{\
13824 .                                     nr #VARIABLE_FOOTER_POS -\\n[#FN_DEPTH]
13825 .                                     if \\n[#DIVERTED]=1 .nr #DIVERTED 3
13826 .                                  \}
13827 .                               \}
13828 .                               el .nr #VARIABLE_FOOTER_POS -(\\n[#FN_DEPTH])
13829 .                            \}
13830 .                            el .nr #VARIABLE_FOOTER_POS -(\\n[#FN_DEPTH])
13831 .                         \}
13832 .                         el .nr #VARIABLE_FOOTER_POS -(\\n[#FN_DEPTH])
13833 .                      \}
13834 .                      el \{\
13835 .                         nr #VARIABLE_FOOTER_POS -\\n[#VFP_DIFF]
13836 .                         if \\n[#DIVERTED]=1 .nr #DIVERTED 3
13837 .                         if !\\n[#PREV_FN_DEFERRED]=1 \{\
13838 .                            ie \\n[#COLUMNS]=1 \
13839 .                               if !\\n[#FROM_FOOTER] .
13840 .                            el .nr #FN_DEPTH -\\n[#VFP_DIFF]
13841 .                         \}
13842 .                         if \\n[#DIVERTED]=3 \{\
13843 .                            if !\\n[#PREV_FN_DEFERRED] \{\
13844 .                               if !\\n[#FROM_FOOTER] \{\
13845 .                                  if \\n[#FN_COUNT]=1 \{\
13846 .                                     if !\\n[#VFP_DIFF] \{\
13847 .                                        if \\n[#FN_MARKER_STYLE]=1 \{\
13848 .                                           da FOOTNOTES
13849 \!.                                            ALD \\n[#FN_LEAD]u
13850 .                                           di
13851 .                                        \}
13852 .                                        if \\n[#RESET_FN_NUMBER] \{\
13853 .                                           da FOOTNOTES
13854 \!.                                            ALD \\n[#FN_LEAD]u
13855 .                                           di
13856 .                                        \}
13857 .                                     \}
13858 .                                  \}
13859 .                               \}
13860 .                            \}
13861 .                         \}
13862 .                      \}
13863 .                      nr #FN_DEPTH \\n[#SAVED_FN_DEPTH_1]+\\n[#VFP_DIFF]
13864 .                   \}
13865 .                   el \{\
13866 .                      nr #VARIABLE_FOOTER_POS -\\n[#VFP_DIFF]
13867 .                      nr #FN_DEPTH \\n[#SAVED_FN_DEPTH_1]+\\n[#VFP_DIFF]
13868 .                   \}
13869 .                   rr #OVERFLOW
13870 .                   rr #RULED
13871 .                \}
13872 .                el \{\
13873 .                   nr #VARIABLE_FOOTER_POS -\\n[#DIVER_DEPTH]
13874 .                   if \\n[#PREV_FN_DEFERRED]=1 \{\
13875 .                      if \\n[#DIVERTED] \{\
13876 .                         if !\\n[#FN_DEPTH]=\\n[#SAVED_FN_DEPTH_1] \{\
13877 .                            nr #FN_DEPTH +\\n[#FN_LEAD]
13878 .                            nr #VARIABLE_FOOTER_POS -\\n[#FN_LEAD]
13879 .                            rr #PREV_FN_DEFERRED
13880 .                         \}
13881 .                      \}
13882 .                   \}
13883 .                   if \\n[#FN_COUNT]>1 \{\
13884 .                      nr #NO_BACK_UP 1
13885 .                      rr #DIVERTED
13886 .                      rr #RULED
13887 .                   \}
13888 .                \}
13889 .             \}
13890 .          \}
13891 .          ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
13892 .\" If we have a footnote whose text has to be deferred to the next
13893 .\" page, reset the FOOTER trap to its original location.
13894 .          if \\n[#FN_DEFER] \{\
13895 .             nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]u
13896 .             ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
13897 .          \}
13898 .       \}
13899 .       nr #NO_FN_MARKER 0
13900 .    \}
13901 .    if \\n[#NUM_ARGS]=2 \{\
13902 .       if '\\$2'BREAK' .BR
13903 .       if '\\$2'BR' .BR
13904 .    \}
13905 .END
13906 \#
13907 \# Utility macros to manage footnotes that occur inside diversions
13908 \# ---------------------------------------------------------------
13909 \#
13910 \# There are some redundancies here; they're left in in case unforeseen
13911 \# footnote situations crop up in the future that might require
13912 \# manipulation of them.
13913 \#
13914 \# 1. Pre-footnote processing for footnotes in diversions
13915 \#
13916 \# a) A footnote inside a diversion will be moved entirely (marker
13917 \# in running text and text of footnote) to the next page/column.
13918 \#
13919 .MAC DIVER_FN_1_PRE END
13920 .    nr #RESET_FN_COUNTERS 1
13921 .    nr #COUNTERS_RESET 1
13922 .    if \\n[#DONE_ONCE]=1 \{\
13923 .       if \\n[#FN_DEFER] \{\
13924 .          if \\n[#SAVED_DIVER_FN_COUNT]=1 \{\
13925 .             ie \\n[#COLUMNS]=1 \
13926 .                if \\n[#COL_NUM]=\\n[#NUM_COLS] .nr #FN_DEFER_SPACE 1
13927 .             el .nr #FN_DEFER_SPACE 1
13928 .          \}
13929 .       \}
13930 .       if \\n[#FN_MARKER_STYLE]=1 \{\
13931 .          if \\n[#FN_COUNT]>0 .nr #FN_COUNT 0 1
13932 .          if \\n[#COLUMNS]=1 \
13933 .             if \\n[#COL_NUM]=\\n[#NUM_COLS] .nr #FN_COUNT_FOR_COLS 0 1
13934 .       \}
13935 .       if \\n[#FN_MARKER_STYLE]=2 \{\
13936 .          if \\n[#RESET_FN_NUMBER]=1 \{\
13937 .             ie \\n[#COLUMNS]=1 \
13938 .                if \\n[#COL_NUM]=\\n[#NUM_COLS] .nr #FN_NUMBER 0 1
13939 .             el .nr #FN_NUMBER 0 1
13940 .          \}
13941 .       \}
13942 .    \}
13943 .END
13944 \#
13945 \# b) Treat as a normal footnote, including defers.
13946 \#
13947 .MAC DIVER_FN_2_PRE END
13948 .    nr #RESET_FN_COUNTERS 2
13949 .END
13950 \#
13951 \# 2. Post-footnote processing for footnotes in diversions
13952 \#
13953 \# Even when a footnote inside a diversion is treated as
13954 \# "normal," some manipulation of registers is required.  The
13955 \# macro is called in DO_QUOTE (i.e. at the termination of
13956 \# quotes and blockquotes) and in DO_EPIGRAPH.
13957 \#
13958 .MAC DIVER_FN_2_POST END
13959 .    if \\n[#DONE_ONCE]=1 \{\
13960 .       if \\n[#FN_MARKER_STYLE]=1 \{\
13961 .          if \\n[#FN_COUNT]=0 .nr #DONT_RULE_ME 1
13962 .          if \\n[#FN_COUNT]>0 .nr #FN_COUNT 0 1
13963 .          if \\n[#COLUMNS]=1 \{\
13964 .             if \\n[#COL_NUM]=\\n[#NUM_COLS] .nr #FN_COUNT_FOR_COLS 0 1
13965 .             if !\\n[#COL_NUM]=\\n[#NUM_COLS] .
13966 .          \}
13967 .       \}
13968 .       if \\n[#FN_MARKER_STYLE]=2 \{\
13969 .          if \\n[#FN_COUNT]=0 .nr #DONT_RULE_ME 1
13970 .          if \\n[#FN_COUNT]>0 .nr #FN_COUNT 0 1
13971 .          if \\n[#RESET_FN_NUMBER]=1 \{\
13972 .             ie \\n[#COLUMNS]=1 \
13973 .                if \\n[#COL_NUM]=\\n[#NUM_COLS] .nr #FN_NUMBER 0 1
13974 .             el .nr #FN_NUMBER 0 1
13975 .          \}
13976 .       \}
13977 .    \}
13978 .END
13979 \#
13980 \# The main macros that handle footnote processing.
13981 \# -----------------------------------------------
13982 \#
13983 \# FN_OVERFLOW_TRAP starts off "underneath" FOOTER, but is revealed
13984 \# as #VARIABLE_FOOTER_POSITION changes the position of FOOTER.
13985 \# FN_OVERFLOW_TRAP simply starts diversion FN_OVERFLOW to "catch"
13986 \# the overflow.  The diversion is ended in FOOTER, immediately after
13987 \# FOOTER outputs the diversion, FOOTNOTES, before PROCESS_FN_LEFTOVER
13988 \# is run (either in HEADER, or in FOOTER if moving col to col).
13989 \#
13990 .MAC FN_OVERFLOW_TRAP END
13991 .    if \\n[#FN_COUNT] \{\
13992 .       di FN_OVERFLOW
13993 .       ie !\\n[#NO_BACK_UP]=1 \{\
13994 .          if \\n[#PREV_FN_DEFERRED] \{\
13995 .             ie \\n[#COLUMNS]=1 \{\
13996 .                if \\n[#FROM_FOOTER] \{\
13997 .                   if \\n[#PREV_FN_DEFERRED] \{\
13998 .                      if !\\n[#COL_NUM]=\\n[#NUM_COLS] \
13999 .                      rr #PREV_FN_DEFERRED
14000 .                   \}
14001 .                \}
14002 .                if !\\n[#FROM_FOOTER] \{\
14003 .                   if !\\n[#COL_NUM]=\\n[#NUM_COLS] \{\
14004 .                      if !\\n[#LAST_FN_COUNT_FOR_COLS]>1 \{\
14005 \!.                       RLD \\n[#FN_LEAD]u
14006 .                      \}
14007 .                   \}
14008 .                \}
14009 .             \}
14010 .             el \{\
14011 \!.              RLD \\n[#FN_LEAD]u
14012 .             \}
14013 .          \}
14014 .       \}
14015 .       el \{\
14016 .          rr #NO_BACK_UP
14017 .          rr #PREV_FN_DEFERRED
14018 .       \}
14019 .    \}
14020 .\" When #FROM_DIVERT_FN is 1, it signals to FOOTNOTE, when run from
14021 .\" within DIVERT_FN_LEFTOVER, to set #SPACE_REMAINING to the total
14022 .\" area allowable for running text.
14023 .    nr #FROM_DIVERT_FN 1
14024 .END
14025 \#
14026 \# PROCESS_FN_LEFTOVER is called at the top of HEADER, and in
14027 \# FOOTER if we're moving from one column to the next (i.e. after
14028 \# outputting FOOTNOTES).  It checks for whether we have a "deferred
14029 \# footnote" situation, and resets counters and number registers
14030 \# accordingly.  Lastly, if we have some footnote overflow, it calls
14031 \# DIVERT_FN_OVERFLOW.
14032 \#
14033 .MAC PROCESS_FN_LEFTOVER END
14034 .    if \\n[#PREV_FN_DEFERRED]=2 \
14035 .       if \\n[#FN_COUNT_AT_FOOTER]>1 .rr #PREV_FN_DEFERRED
14036 .    ie !\\n[#FN_DEFER] \{\
14037 .       nr #FN_COUNT 0 1
14038 .       nr #FN_DEPTH 0
14039 .       nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]
14040 .    \}
14041 .    el \{\
14042 .       if \\n[#FN_DEFER]=1 .nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]
14043 .       if \\n[#FN_DEFER]=2 \{\
14044 .          nr #FN_DEPTH 0
14045 .          nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]
14046 .       \}
14047 .    \}
14048 .    nr #SPACE_REMAINING 0
14049 .    ch FOOTER -\\n[#B_MARGIN]u
14050 .    if \\n[#FN_DEFER] \{\
14051 .       nr #NO_FN_MARKER 1
14052 .       rn FOOTNOTES DEFERRED-FOOTNOTE
14053 .       nr #FN_DEPTH 0
14054 .       FOOTNOTE
14055 .       nf
14056 .       DEFERRED-FOOTNOTE
14057 .       FOOTNOTE OFF
14058 .       ie \\n[#COLUMNS]=1 \{\
14059 .          if \\n[#COL_NUM]=\\n[#NUM_COLS] \{\
14060 .             if !\\n[#FROM_FOOTER] \
14061 .                if \\n[#FN_COUNT_FOR_COLS]=1 .nr #PREV_FN_DEFERRED 1
14062 .          \}
14063 .       \}
14064 .       el .nr #PREV_FN_DEFERRED 1
14065 .    \}
14066 .    if !\\n[#FN_DEFER] \
14067 .       if \\n[#FN_OVERFLOW_DEPTH] .DIVERT_FN_LEFTOVER
14068 .    ie \\n[#COLUMNS]=1 \{\
14069 .       if \\n[#COL_NUM]>1 \
14070 .          if \\n[#COL_NUM]=\\n[#NUM_COLS] .nr #FN_COUNT 0 1
14071 .    \}
14072 .    el .nr #FN_COUNT 0 1
14073 .    if \\n[#DIVER_FN]=2 .rr #DIVER_FN
14074 .    rr #FROM_DIVERT_FN
14075 .END
14076 \#
14077 \# DIVERT_FN_LEFTOVER is called in PROCESS_FN_LEFTOVER (at
14078 \# the top of HEADER, and in FOOTER if we're moving from one column
14079 \# to the next).
14080 \#
14081 .MAC DIVERT_FN_LEFTOVER END
14082 .    nr #NO_FN_MARKER 1
14083 .    nr #DIVERTED 1
14084 .    FOOTNOTE
14085 .    nf
14086 .    FN_OVERFLOW
14087 .    FOOTNOTE OFF
14088 .    if \\n[#PREV_FN_DEFERRED] \{\
14089 .       nr #FN_DEPTH -\\n[#FN_LEAD]
14090 .       nr #VARIABLE_FOOTER_POS +\\n[#FN_LEAD]
14091 .       ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
14092 .       if \\n[#PREV_FN_DEFERRED]=2 \{\
14093 .          nr #PREV_FN_DEFERRED 1
14094 .          rr #DIVERTED
14095 .       \}
14096 .    \}
14097 .    rr #FN_OVERFLOW_DEPTH
14098 .END
14099 \#
14100 \# This is a special macro to deal with footnotes that are set inside
14101 \# diversions (QUOTE, BLOCKQUOTE and EPIGRAPH).  It's called in HEADER
14102 \# (and in FOOTER, if we're moving from column to column), and comes
14103 \# after PROCESS_FOOTNOTE_LEFTOVER in those two macros.
14104 \#
14105 .MAC PROCESS_FN_IN_DIVER END
14106 .    nr #SPACE_REMAINING 0
14107 .    ch FOOTER -\\n[#B_MARGIN]u
14108 .    nr #NO_FN_MARKER 1
14109 .    if !\\n[#RESET_FN_COUNTERS]=2 .rr #RESET_FN_COUNTERS
14110 .    FOOTNOTE
14111 .    if \\n[#FN_OVERFLOW_DEPTH] .nf
14112 .    ie dRUNON_FN_IN_DIVER \{\
14113 .       RUNON_FN_IN_DIVER
14114 .       rm RUNON_FN_IN_DIVER
14115 .    \}
14116 .    el \{\
14117 .       nf
14118 .       FN_IN_DIVER
14119 .    \}
14120 .    FOOTNOTE OFF
14121 .    rr #DIVER_FN
14122 .END
14123 \#
14124 \# ====================================================================
14125 \#
14126 \# +++ENDNOTES+++
14127 \#
14128 \# When endnotes are output, the spacing between the notes is always
14129 \# 1 extra linespace.  This can have bottom margin consequences.  If
14130 \# this doesn't bother you, don't worry about it.  If it does bother
14131 \# you, and you want to adjust the spacing between any two endnotes (as
14132 \# they're output), make the spacing adjustments (.ALD/.RLD) at the
14133 \# *end* of endnotes (i.e. just before .ENDNOTE OFF), not at the top.
14134 \#
14135 \# Endnotes must be output manually with .ENDNOTES. This allows user
14136 \# the flexibility to output endnotes at the end of each collated
14137 \# document, or to output them at the end of the entire document.
14138 \#
14139 \# Control macros
14140 \# --------------
14141 \#
14142 \# ENDNOTE POINT SIZE
14143 \# ------------------
14144 \# *Argument:
14145 \#   <base point size for endnotes>
14146 \# *Function:
14147 \#   Creates or modifies register #EN_PS.
14148 \# *Notes:
14149 \#   Default is same as running text in body of document.
14150 \#
14151 \#   This size control macro differs from other size control macros
14152 \#   in that it sets an absolute point size, not a relative one.  This
14153 \#   is because a) endnotes always appear separate from the body of
14154 \#   a document and therefore don't need to be relative to the body
14155 \#   of the document, and b) there are quite a few elements of the
14156 \#   endnotes page(s) that need to be relative to the base point size
14157 \#   of that page.  If the base endnote point size were relative to
14158 \#   the body of the document (i.e. a _SIZE macro taking a +|- value)
14159 \#   getting the rest of the endnote elements sized properly could
14160 \#   become very confusing.
14161 \#
14162 .MAC ENDNOTE_PT_SIZE END
14163 .    nr #EN_PS (p;\\$1)
14164 .END
14165 \#
14166 \# ENDNOTE SPACING
14167 \# ----------------
14168 \# *Arguments:
14169 \#   <per item endnote spacing> | <anything>
14170 \# *Function:
14171 \#   Enables space between endnotes items.
14172 \# *Notes:
14173 \#   Default is no space.
14174 \#
14175 .MAC ENDNOTE_SPACING END
14176 .    ie \B'\\$1' .ds $EN_SPACE \\$1
14177 .    el .rm $EN_SPACE
14178 .END
14179 \#
14180 \# ENDNOTES_HDRFTR_CENTER
14181 \# ----------------------
14182 \# *Argument:
14183 \#   toggle
14184 \# *Function:
14185 \#   Creates or removes toggle register #EN_HDRFTR_CENTER, used to
14186 \#   determine whether mom should print a/the hdrftr center string
14187 \#   on the endnotes page.  Primarily to enable/disable printing of the
14188 \#   chapter name in hdrftrs when DOCTYPE CHAPTER.
14189 \# *Notes:
14190 \#   Default is OFF
14191 \#
14192 .MAC ENDNOTES_HDRFTR_CENTER END
14193 .    ie '\\$1'' .nr #EN_HDRFTR_CENTER 1
14194 .    el .rr #EN_HDRFTR_CENTER
14195 .END
14196 \#
14197 \# ENDNOTE STRING
14198 \# --------------
14199 \# *Argument:
14200 \#   <title for endnotes page>
14201 \# *Function:
14202 \#   Creates or modifies string $EN_STRING.
14203 \# *Notes:
14204 \#   Default is "Endnotes"
14205 \#
14206 .MAC ENDNOTES_HEADER_STRING END
14207 .    ds $EN_STRING \\$1
14208 .END
14209 .
14210 .ALIAS ENDNOTE_STRING ENDNOTES_HEADER_STRING
14211 \#
14212 \# ENDNOTE STRING START POSITION
14213 \# ----------------------------
14214 \# *Argument:
14215 \#   <distance from page top>
14216 \# *Function:
14217 \#   Creates or modifies register #EN_STRING_V_POS
14218 \#
14219 .MAC ENDNOTES_HEADER_V_POS END
14220 .    nr #EN_STRING_V_POS (\\$1)
14221 .END
14222 .
14223 .ALIAS ENDNOTE_STRING_ADVANCE  ENDNOTES_HEADER_V_POS
14224 .ALIAS ENDNOTE_STRING_V_POS    ENDNOTES_HEADER_V_POS
14225 .ALIAS ENDNOTES_HEADER_V_POS   ENDNOTES_HEADER_V_POS
14226 \#
14227 \# ENDNOTE HEADER CAPS and SMALLCAPS
14228 \# ---------------------------------
14229 \# *Arguments:
14230 \#   <none> | <anything>
14231 \# *Function:
14232 \#   Turns capitalization or smallcaps style of the endnotes pages
14233 \#   title string "Endnotes" on or off.
14234 \# *Notes:
14235 \#   Users may want the endnotes pages title string to be in
14236 \#   caps, but the toc entry for endnotes in lower case.  If the
14237 \#   argument to ENDNOTES_HEADER_STRING is in lower case and
14238 \#   ENDNOTES_HEADER_CAPS is turned on, this is exactly what will
14239 \#   happen.  Ditto for smallcaps.
14240 \#
14241 \#   Default for CAPS is on.
14242 \#
14243 .MAC ENDNOTES_HEADER_CAPS END
14244 .   ie '\\$1'' .nr #EN_STRING_CAPS 1
14245 .   el .nr #EN_STRING_CAPS 0
14246 .END
14247 .
14248 .ALIAS ENDNOTE_STRING_CAPS ENDNOTES_HEADER_CAPS
14249 .
14250 .MAC ENDNOTES_HEADER_SMALLCAPS END
14251 .   ie '\\$1'' .nr #EN_STRING_SMALLCAPS 1
14252 .   el .nr #EN_STRING_SMALLCAPS 0
14253 .END
14254 .
14255 .ALIAS ENDNOTE_STRING_SMALLCAPS ENDNOTES_HEADER_SMALLCAPS
14256 \#
14257 \# ENDNOTE TITLE
14258 \# -------------
14259 \# *Argument:
14260 \#   <string that appears before the first endnote pertaining to any document>
14261 \# *Function:
14262 \#   Creates string $EN_TITLE.
14263 \# *Notes:
14264 \#   Default is the document title, or, if doc is a chapter, "Chapter #"
14265 \#
14266 .MAC ENDNOTE_TITLE END
14267 .    ds $EN_TITLE \\$1
14268 .END
14269 \#
14270 \# ENDNOTE MARKER STYLE
14271 \# --------------------
14272 \# *Arguments:
14273 \#   NUMBER | LINE | SUPERSCRIPT
14274 \# *Function:
14275 \#   Sets register #EN_MARKER_STYLE, used in ENDNOTE to determine
14276 \#   the style of endnote markers (labels).
14277 \# *Notes:
14278 \#   1=NUMBER; 2=LINE.  LINE means "use output line numbers".
14279 \#   Default is NUMBER.
14280 \#
14281 .MAC ENDNOTE_MARKER_STYLE END
14282 .    if '\\$1'NUMBER' .nr #EN_MARKER_STYLE 1
14283 .    if '\\$1'LINE' \{\
14284 .       nr #EN_MARKER_STYLE 2
14285 .       if !\\n[#EN_LN_SEP] \
14286 .          if !\\n[#EN_LN_BRACKETS] .ENDNOTE_LINENUMBER_BRACKETS SQUARE
14287 .    \}
14288 .    if '\\$1'SUPERSCRIPT' .nr #EN_MARKER_STYLE 3
14289 .END
14290 \#
14291 \# ENDNOTE LINENUMBER MARK
14292 \# -----------------------
14293 \# *Function:
14294 \#   This string, when called inline, stores the current output line
14295 \#   number in register #EN_MARK for use with ENDNOTE.
14296 \#
14297 .ds EN_MARK \R'#EN_MARK \En[ln]'
14298 \#
14299 \# ENDNOTE LINENUMBER SEPARATOR
14300 \# ----------------------------
14301 \# *Argument:
14302 \#   <user-defined separator>
14303 \# *Function:
14304 \#   Stores user-defined separator (for use then
14305 \#   ENDNOTE_MARKER_STYLE is LINE) in string $EN_LN_SEP.  The
14306 \#   separator is intended to be used when the user wishes a
14307 \#   separator, rather than the choice of brackets offered by
14308 \#   ENDNOTE_LINENUMBER_BRACKETS.
14309 \#
14310 .MAC ENDNOTE_LINENUMBER_SEPARATOR END
14311 .    rr #EN_LN_BRACKETS
14312 .    nr #EN_LN_SEP 1
14313 .    ds $EN_LN_SEP "\\$1
14314 .END
14315 \#
14316 \# ENDNOTE LINENUMBER BRACKETS
14317 \# ---------------------------
14318 \# *Argument:
14319 \#   PARENS | SQUARE | BRACES or ( | [ | {
14320 \# *Function:
14321 \#   Sets register #EN_LN_BRACKETS to 1, and creates strings
14322 \#   $EN_OPEN_BRACKET and $EN_CLOSE_BRACKET according to the given argument.
14323 \#
14324 .MAC ENDNOTE_LINENUMBER_BRACKETS END
14325 .    rr #EN_LN_SEP
14326 .    nr #EN_LN_BRACKETS 1
14327 .    if '\\$1'PARENS' \{\
14328 .       ds $EN_OPEN_BRACKET (
14329 .       ds $EN_CLOSE_BRACKET )
14330 .    \}
14331 .    if '\\$1'(' \{\
14332 .       ds $EN_OPEN_BRACKET (
14333 .       ds $EN_CLOSE_BRACKET )
14334 .    \}
14335 .    if '\\$1'SQUARE' \{\
14336 .       ds $EN_OPEN_BRACKET [
14337 .       ds $EN_CLOSE_BRACKET ]
14338 .    \}
14339 .    if '\\$1'[' \{\
14340 .       ds $EN_OPEN_BRACKET [
14341 .       ds $EN_CLOSE_BRACKET ]
14342 .    \}
14343 .    if '\\$1'BRACES' \{\
14344 .       ds $EN_OPEN_BRACKET {
14345 .       ds $EN_CLOSE_BRACKET }
14346 .    \}
14347 .    if '\\$1'{' \{\
14348 .       ds $EN_OPEN_BRACKET {
14349 .       ds $EN_CLOSE_BRACKET }
14350 .    \}
14351 .END
14352 \#
14353 \# ENDNOTE LINENUMBER GAP
14354 \# ----------------------
14355 \# *Argument:
14356 \#   <space between line-number labels and endnotes text>
14357 \# *Function:
14358 \#   Defines string $EN_LN_GAP, used during printing of line-number
14359 \#   labels in ENDNOTE.
14360 \#
14361 .MAC ENDNOTE_LINENUMBER_GAP END
14362 .    nr #EN_LN_GAP (u;\\$1)
14363 .END
14364 \#
14365 \# ENDNOTE NUMBERS ALIGNMENT
14366 \# -------------------------
14367 \# *Argument:
14368 \#   LEFT | RIGHT <max. number of digit placeholders that will appear in endnotes>
14369 \# *Function:
14370 \#   Creates registers for _LEFT or _RIGHT; creates register
14371 \#   #EN_NUMBER_PLACEHOLDERS.
14372 \# *Notes:
14373 \#   Default is for endnote numbers to be right aligned to 2 placeholders.
14374 \#
14375 .MAC ENDNOTE_NUMBERS_ALIGN END
14376 .    if '\\$1'LEFT' \{\
14377 .       rr #EN_NUMBERS_ALIGN_RIGHT
14378 .       nr #EN_NUMBERS_ALIGN_LEFT 1
14379 .    \}
14380 .    if '\\$1'RIGHT' \{\
14381 .       rr #EN_NUMBERS_ALIGN_LEFT
14382 .       nr #EN_NUMBERS_ALIGN_RIGHT 1
14383 .    \}
14384 .    nr #EN_NUMBER_PLACEHOLDERS \\$2
14385 .END
14386 \#
14387 \# ENDNOTE PARAGRAPH INDENT
14388 \# ------------------------
14389 \# *Argument:
14390 \#   <first line indent of paras subsequent to 1st in endnotes>
14391 \# *Function:
14392 \#   Creates register #EN_PP_INDENT for use in .PP.
14393 \# *Notes:
14394 \#   Requires a unit of measure.
14395 \#
14396 \#   Default is 1.5m for TYPESET; same indent as PARA_INDENT for TYPEWRITE.
14397 \#
14398 .MAC ENDNOTE_PARA_INDENT END
14399 .    nr #EN_PP_INDENT (\\$1)
14400 .END
14401 \#
14402 \# TURN OFF COLUMN MODE FOR ENDNOTES
14403 \# ---------------------------------
14404 \# *Argument:
14405 \#   <none> | <anything>
14406 \# *Function:
14407 \#   Creates or removes register #EN_NO_COLS
14408 \# *Notes:
14409 \#   Allows user to tell mom not to set endnotes in columnar
14410 \#   documents in columns.  Default is to set endnotes in columns.
14411 \#
14412 .MAC ENDNOTES_NO_COLUMNS END
14413 .    ie '\\$1'' .nr #EN_NO_COLS 1
14414 .    el .rr #EN_NO_COLS
14415 .END
14416 \#
14417 \# NO FIRST PAGE NUMBER ON ENDNOTES FIRST PAGE
14418 \# -------------------------------------------
14419 \# *Argument:
14420 \#   <none> | <anything>
14421 \# *Function:
14422 \#   Creates or removes register #EN_NO_FIRST_PN
14423 \# *Notes:
14424 \#   For use if FOOTERS are on.  Tells ENDNOTES not to put a page
14425 \#   number on the first endnotes page.  Some users may want this.
14426 \#   Default is to print a page number at the top of the first
14427 \#   endnotes page when footers are on.
14428 \#
14429 .MAC ENDNOTES_NO_FIRST_PAGENUM END
14430 .    ie '\\$1'' .nr #EN_NO_FIRST_PN 1
14431 .    el .rr #EN_NO_FIRST_PN
14432 .END
14433 \#
14434 \# PAGE HEADERS ON ENDNOTES PAGES
14435 \# ------------------------------
14436 \# *Argument:
14437 \#   <none> | ALL
14438 \# *Function:
14439 \#   Creates or removes register #EN_ALLOWS_HEADERS or
14440 \#   #EN_ALLOWS_HEADERS_ALL
14441 \# *Notes:
14442 \#   Whether ENDNOTES puts a page header at the top of endnotes
14443 \#   pages if page headers are used throughout the document.
14444 \#   Default is to insert the page headers, but not on the first
14445 \#   page.  If the optional argument ALL is given, ENDNOTES puts a
14446 \#   page header on the first page as well.
14447 \#
14448 .MAC ENDNOTES_ALLOWS_HEADERS END
14449 .    ie '\\$1'' .nr #EN_ALLOWS_HEADERS 1
14450 .    el \{\
14451 .       ie '\\$1'ALL' \{\
14452 .          nr #EN_ALLOWS_HEADERS 1
14453 .          nr #EN_ALLOWS_HEADERS_ALL 1
14454 .       \}
14455 .       el \{\
14456 .          nr #EN_ALLOWS_HEADERS 0
14457 .          nr #EN_ALLOWS_HEADERS_ALL 0
14458 .       \}
14459 .    \}
14460 .END
14461 \#
14462 \# ENDNOTES PAGES PAGE NUMBERING STYLE
14463 \# -----------------------------------
14464 \# *Argument:
14465 \#   DIGIT | ROMAN | roman | ALPHA | alpha
14466 \# *Function:
14467 \#   Creates or modifies $EN_PN_STYLE.
14468 \# *Notes:
14469 \#   Allows user to define what style should be used for endnotes
14470 \#   pages page numbering.  Arguments are the same as for
14471 \#   PAGENUM_STYLE.
14472 \#
14473 \#   Default is DIGIT.
14474 \#
14475 .MAC ENDNOTES_PAGENUM_STYLE END
14476 .    ds $EN_PN_STYLE \\$1
14477 .END
14478 \#
14479 \# FIRST PAGE NUMBER FOR ENDNOTES
14480 \# ------------------------------
14481 \# *Argument:
14482 \#   <page number that appears on page 1 of endnotes pages>
14483 \# *Function:
14484 \#   Creates or modifies string $EN_FIRST_PN
14485 \# *Notes:
14486 \#   To be used with caution, only if all endnotes
14487 \#   are to be output at once, i.e. not at the end of the separate
14488 \#   docs of a collated doc
14489 \#
14490 .MAC ENDNOTES_FIRST_PAGENUMBER END
14491 .    nr #EN_FIRST_PN \\$1
14492 .END
14493 \#
14494 \# SINGLESPACE ENDNOTES
14495 \# --------------------
14496 \# *Argument:
14497 \#   <none> | <anything>
14498 \# *Function:
14499 \#   Sets lead of endnotes pages in TYPEWRITE to 12 points,
14500 \#   adjusted.
14501 \# *Notes:
14502 \#   Default is to double-space endnotes pages.
14503 \#
14504 .MAC SINGLESPACE_ENDNOTES END
14505 .    if \\n[#PRINT_STYLE]=1 \{\
14506 .       ie \\n[#SINGLE_SPACE] \{\
14507 .          nr #EN_SINGLESPACE 1
14508 .          rr #IGNORE
14509 .          if \\n[#OK_PROCESS_LEAD] \{\
14510 .             ENDNOTE_LEAD 12 ADJUST
14511 .             nr #IGNORE 1
14512 .          \}
14513 .       \}
14514 .       el \{\
14515 .          ie '\\$1'' \{\
14516 .             nr #EN_SINGLESPACE 1
14517 .             rr #IGNORE
14518 .             if \\n[#OK_PROCESS_LEAD] \{\
14519 .                ENDNOTE_LEAD 12 ADJUST
14520 .                nr #IGNORE 1
14521 .             \}
14522 .          \}
14523 .          el \{\
14524 .             rr #EN_SINGLESPACE
14525 .             rr #IGNORE
14526 .             if \\n[#OK_PROCESS_LEAD] \{\
14527 .                ENDNOTE_LEAD 24 ADJUST
14528 .                nr #IGNORE 1
14529 .             \}
14530 .          \}
14531 .       \}
14532 .    \}
14533 .END
14534 \#
14535 \# ENDNOTE PARAGRAPH SPACE
14536 \# -----------------------
14537 \# *Argument:
14538 \#   toggle
14539 \# *Function:
14540 \#   Creates toggle register #EN_PP_SPACE for use in .PP.
14541 \# *Notes:
14542 \#   Like PARA_SPACE.  Default is not to space endnote paras.
14543 \#
14544 .MAC ENDNOTE_PARA_SPACE END
14545 .    ie '\\$1'' .nr #EN_PP_SPACE 1
14546 .    el .rr #EN_PP_SPACE
14547 .END
14548 \#
14549 \# ENDNOTE
14550 \# -------
14551 \# *Argument:
14552 \#   toggle
14553 \# *Function:
14554 \#   Places superscript endnote number in text, then collects and
14555 \#   processes endnote in diversion END_NOTES.
14556 \# *Notes:
14557 \#   \c must be appended to the word immediately preceding .ENDNOTE
14558 \#   when ENDNOTE_MARKER_STYLE is NUMBER.
14559 \#
14560 .MAC ENDNOTE END
14561 .    ie '\\$1'' \{\
14562 .       nr #ENDNOTE 1
14563 .       ie !\\n[#EN_MARKER_STYLE]=2 \{\
14564 .          if \\n[#CONDENSE] .nop \*[CONDX]\c
14565 .          if \\n[#EXTEND] .nop \*[EXTX]\c
14566 .             if \\n[#UNDERLINE_ON] \{\
14567 .                nr #UNDERLINE_WAS_ON 1
14568 .                UNDERLINE OFF
14569 .             \}
14570 .          if \\n[#PRINT_STYLE]=1 \{\
14571 .             if \\n[#SLANT_ON] \{\
14572 .                 nr #SLANT_WAS_ON 1
14573 .                 nop \*[SLANTX]\c
14574 .             \}
14575 .\" Vertical raise amount here is more than when the same string is printed in
14576 .\" the endnotes so bottom of number aligns with top of bowl.
14577 .             PRINT \
14578 "\s-2\v'-\\n[#DOC_LEAD]u/5u'\\n+[#EN_NUMBER]\v'+\\n[#DOC_LEAD]u/5u'\s+2\c"
14579 .          \}
14580 .          if \\n[#PRINT_STYLE]=2 .PRINT \*[SUP]\\n+[#EN_NUMBER]\*[SUPX]\c
14581 .       \}
14582 .       el \{\
14583 .          ie r#EN_NUMBER .nr #EN_NUMBER \\n[#EN_NUMBER]+1
14584 .          el .nr #EN_NUMBER 1 1
14585 .          if !\\n[#LINENUMBERS] \{\
14586 .             tm1 "[mom]: Line numbering must be enabled with NUMBER_LINES when
14587 .             tm1 "       ENDNOTE_MARKER_STYLE is LINE.
14588 .             ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
14589 .          \}
14590 .          if \\n[#EN_MARK]=0 .nr #EN_MARK \\n[ln]
14591 .          nr #EN_MARK_2 \\n[ln]
14592 .          if '\\n[.z]'P_QUOTE' \{\
14593 .             nr #EN_MARK -1
14594 .             nr #EN_MARK_2 -1
14595 .          \}
14596 .       \}
14597 .       nr #PP_STYLE_PREV \\n[#PP_STYLE]
14598 .       nr #PP_STYLE 1
14599 .       if \\n[#INDENT_FIRST_PARAS] .nr #INDENT_FIRSTS 1
14600 .       INDENT_FIRST_PARAS
14601 .       ev EN
14602 .       da END_NOTES
14603 .       LL \\n[#DOC_L_LENGTH]u
14604 .       ta \\n[.l]u
14605 .       if \\n[#COLUMNS] \{\
14606 .          ie \\n[#EN_NO_COLS] .LL \\n[#DOC_L_LENGTH]u
14607 .          el .LL \\n[#COL_L_LENGTH]u
14608 .          ta \\n[.l]u
14609 .       \}
14610 \!.     if \\\\n[.vpt]=0 .vpt
14611 \!.     ne 3
14612 .       vs \\n[#EN_LEAD]u
14613 .\" Print identifying doc title (e.g., Chapter n)
14614 .       if \\n[#EN_NUMBER]=1 \{\
14615 .          if \\n[#PRINT_STYLE]=1 .TYPEWRITER
14616 .          if \\n[#PRINT_STYLE]=2 \{\
14617 .             FAMILY  \\*[$EN_TITLE_FAM]
14618 .             FT      \\*[$EN_TITLE_FT]
14619 .             ps \\n[#EN_PS]u\\*[$EN_TITLE_SIZE_CHANGE]
14620 .             if \\n[#EN_TITLE_COLOR] .COLOR \\*[$EN_TITLE_COLOR]
14621 .             if \\n[#ENDNOTE_TITLE_SMALLCAPS] .SMALLCAPS
14622 .             if \\n[#ENDNOTE_TITLE_CAPS] .CAPS
14623 .          \}
14624 .          ie \\n[#SINGLE_SPACE]=1 .sp 2
14625 .          el .sp
14626 .          if !'\\*[$EN_TITLE]'' \{\
14627 .             substring $EN_TITLE_QUAD 0 0
14628 .             if '\\*[$EN_TITLE_QUAD]'L' .LEFT
14629 .             if '\\*[$EN_TITLE_QUAD]'C' .CENTER
14630 .             if '\\*[$EN_TITLE_QUAD]'R' .RIGHT
14631 \!.           vpt 0
14632 .             sp -.25v
14633 .             ie \\n[#EN_TITLE_UNDERLINE] \
14634 .                UNDERSCORE "\\*[$EN_TITLE]"
14635 .             el \{\
14636 .                ie \\n[#PRINT_STYLE]=1 \
14637 .                   UNDERSCORE "\\*[$EN_TITLE]"
14638 .                el .PRINT "\\*[$EN_TITLE]"
14639 .             \}
14640 .             sp .25v
14641 \!.           vpt
14642 .          \}
14643 .          if \\n[#EN_TITLE_COLOR] .gcolor
14644 .          if \\n[#ENDNOTE_TITLE_SMALLCAPS] .SMALLCAPS OFF
14645 .          if \\n[#ENDNOTE_TITLE_CAPS] .CAPS OFF
14646 .       \}
14647 .\" Get indent from endnotes point size; convert string to reg in
14648 .\" case indent string is, e.g., m or n
14649 .       ps \\n[#EN_PS]u
14650 .       nr #REF_EN_INDENT (u;\\*[$REF_EN_INDENT])
14651 .       if \\n[#PRINT_STYLE]=1 \{\
14652 .          TYPEWRITER
14653 .          if \\n[#EN_NUMBER]=1 \{\
14654 .             ie \\n[#SINGLE_SPACE]=1 .sp
14655 .             el .sp .25
14656 .           \}
14657 .          if \\n[#EN_MARKER_STYLE]=3 .ps -2
14658 .       \}
14659 .       if \\n[#PRINT_STYLE]=2 \{\
14660 .          if \\n[#EN_MARKER_STYLE]=1 \{\
14661 .             FAMILY  \\*[$EN_NUMBER_FAM]
14662 .             FT      \\*[$EN_NUMBER_FT]
14663 .             ps \\n[#EN_PS]u\\*[$EN_NUMBER_SIZE_CHANGE]
14664 .          \}
14665 .          if \\n[#EN_MARKER_STYLE]=2 \{\
14666 .             FAMILY  \\*[$EN_LN_FAM]
14667 .             FT      \\*[$EN_LN_FT]
14668 .             ps \\n[#EN_PS]u\\*[$EN_LN_SIZE_CHANGE]
14669 .          \}
14670 .          if \\n[#EN_MARKER_STYLE]=3 \{\
14671 .             FAMILY  \\*[$EN_NUMBER_FAM]
14672 .             FT      \\*[$EN_NUMBER_FT]
14673 .             ps \\n[#PT_SIZE_IN_UNITS]u*6u/10u
14674 .          \}
14675 .       \}
14676 .\" Build string for line-numbered endnotes
14677 .       if \\n[#EN_MARKER_STYLE]=2 \{\
14678 .          ie \\n[#EN_LN_BRACKETS]=1 \{\
14679 .             ds $EN_LINENUMBER \v'-.085m'\\*[$EN_OPEN_BRACKET]\v'.085m'
14680 .             ie \\n[#EN_MARK_2]=\\n[#EN_MARK] .as $EN_LINENUMBER \
14681 \\n[#EN_MARK]\v'-.085m'\\*[$EN_CLOSE_BRACKET]\v'.085m'\"
14682 .             el .as $EN_LINENUMBER \
14683 \\n[#EN_MARK]\v'-.1m'-\v'.1m'\\n[#EN_MARK_2]\v'-.085m'\
14684 \\*[$EN_CLOSE_BRACKET]\v'.085m'\"
14685 .          \}
14686 .          el \{\
14687 .             ie \\n[#EN_MARK_2]=\\n[#EN_MARK] \
14688 .                ds $EN_LINENUMBER \
14689 \\n[#EN_MARK]\\*[$EN_LN_SEP]
14690 .             el \
14691 .                ds $EN_LINENUMBER \
14692 \\n[#EN_MARK]\v'-.1m'-\v'.1m'\\n[#EN_MARK_2]\\*[$EN_LN_SEP]
14693 .          \}
14694 .          nr #EN_MARK 0
14695 .       \}
14696 .       vpt 0
14697 .       ie \\n[#EN_NUMBERS_ALIGN_RIGHT] .RIGHT
14698 .       el .LEFT
14699 .       if \\n[#EN_MARKER_STYLE]=1 \
14700 .          nr #EN_NUMBER_L_LENGTH \w'\0'*\\n[#EN_NUMBER_PLACEHOLDERS]+\w'.'
14701 .       if \\n[#EN_MARKER_STYLE]=2 \{\
14702 .          ie \\n[#EN_LN_BRACKETS]=1 .nr #EN_NUMBER_L_LENGTH \
14703 (\w'\0'*(\\n[#EN_NUMBER_PLACEHOLDERS]*2))+\w'-[]'
14704 .          el .nr #EN_NUMBER_L_LENGTH \
14705 (\w'\0'*(\\n[#EN_NUMBER_PLACEHOLDERS]*2))+\w'-\\*[$EN_LN_SEP]'
14706 .          RIGHT
14707 .       \}
14708 .       if \\n[#EN_MARKER_STYLE]=3 \{\
14709 .          nr #EN_NUMBER_L_LENGTH \
14710 \w'\0'*\\n[#EN_NUMBER_PLACEHOLDERS]+.15m
14711 .          RIGHT
14712 .       \}
14713 .       ie \\n[#REF]=1 \
14714 .          ll \\n[#EN_NUMBER_L_LENGTH]u+\\n[#REF_EN_INDENT]u
14715 .       el .ll \\n[#EN_NUMBER_L_LENGTH]u
14716 .       if \\n[#EN_MARKER_STYLE]=1 \{\
14717 .          if \\n[#REF]=1 .ti \\n[#REF_EN_INDENT]u
14718 .          nop \En[#EN_NUMBER].
14719 .       \}
14720 .       if \\n[#EN_MARKER_STYLE]=2 \{\
14721 .          nop \\*[$EN_LINENUMBER]
14722 .          rm $EN_LINENUMBER
14723 .       \}
14724 .       if \\n[#EN_MARKER_STYLE]=3 \{\
14725 \!.        vpt 0
14726 .          ps \" Reset ps changed to get width of s-script numbers
14727 .          ie \\n[#PRINT_STYLE]=1 \{\
14728 .\" Vertical raise amount here is less than when the same string is printed in
14729 .\" the body of the text because number precedes a cap.
14730 .             nop \
14731 \s-2\v'-\\n[#DOC_LEAD]u/7u'\\n[#EN_NUMBER]\|\v'+\\n[#DOC_LEAD]u/7u'\s+2
14732 .          \}
14733 .          el .nop \E*[SUP]\\n[#EN_NUMBER]\E*[SUPX]\h'.15m'
14734 .       \}
14735 .       EOL
14736 .       ll
14737 \!.     vpt
14738 .       nr #EN_FIGURE_SPACE \w'\0'
14739 .       if \\n[#EN_MARKER_STYLE]=1 \{\
14740 .          ie \\n[#REF]=1 .ti \
14741 \\n[#EN_NUMBER_L_LENGTH]u+\\n[#REF_EN_INDENT]u+\\n[#EN_FIGURE_SPACE]u
14742 .          el .in \
14743 \\n[#EN_NUMBER_L_LENGTH]u+\\n[#EN_FIGURE_SPACE]u
14744 .       \}
14745 .       if \\n[#EN_MARKER_STYLE]=2 \{\
14746 .          ie \\n[#REF]=1 .ti \
14747 \\n[#EN_NUMBER_L_LENGTH]u+\\n[#REF_EN_INDENT]u+\\n[#EN_LN_GAP]u
14748 .          el .ti \
14749 \\n[#EN_NUMBER_L_LENGTH]u+\\n[#EN_LN_GAP]u
14750 .       \}
14751 .       if \\n[#EN_MARKER_STYLE]=3 \{\
14752 .          ie \\n[#REF]=1 .ti \
14753 \\n[#EN_NUMBER_L_LENGTH]u+\\n[#REF_EN_INDENT]u+\w'\|'u
14754 .          el .in \
14755 \\n[#EN_NUMBER_L_LENGTH]u
14756 .       \}
14757 .       nr #EN_TEXT_INDENT \\n[.i]
14758 .       QUAD \\*[$EN_QUAD]
14759 .       vpt
14760 .       if \\n[#PRINT_STYLE]=1 .TYPEWRITER
14761 .       if \\n[#PRINT_STYLE]=2 \{\
14762 .          FAMILY  \\*[$EN_FAM]
14763 .          FT      \\*[$EN_FT]
14764 .          ps \\n[#EN_PS]u
14765 .       \}
14766 .    \}
14767 .    el \{\
14768 \!.     ie \\n[#EN_NUMBER]=\\\\n[#LAST_EN] .vpt 0
14769 \!.     el .br
14770 .       if \\n[#PRINT_STYLE]=2 .sp \\*[$EN_SPACE]
14771 .       in 0
14772 .       if \\n[#EN_MARKER_STYLE]=2 \{\
14773 \!.        in 0
14774 .       \}
14775 .       da
14776 .\" Restore sentence spacing
14777 .       if \\n[#PRINT_STYLE]=2 \{\
14778 .          if d$RESTORE_SS_VAR .SS \\*[$RESTORE_SS_VAR]
14779 .          rm $RESTORE_SS_VAR
14780 .       \}
14781 .       ev
14782 .\" Restore lead -- need
14783 .       nr #PP_STYLE \\n[#PP_STYLE_PREV]
14784 .       if !\\n[#INDENT_FIRSTS] .INDENT_FIRST_PARAS OFF
14785 .       rr #INDENT_FIRSTS
14786 .       rr #ENDNOTE
14787 .       if \\n[#UNDERLINE_WAS_ON] \{\
14788 .          rr #UNDERLINE_WAS_ON
14789 .          UNDERLINE
14790 .       \}
14791 .       if \\n[#SLANT_WAS_ON] \{\
14792 .          rr #SLANT_WAS_ON
14793 \*[SLANT]\c
14794 .       \}
14795 .    \}
14796 .    if \\n[#NUM_ARGS]=2 \{\
14797 .       if '\\$2'BREAK' .BR
14798 .       if '\\$2'BR' .BR
14799 .    \}
14800 .END
14801 \#
14802 \# Endnotes (user space macro)
14803 \# ---------------------------
14804 \#
14805 \# ENDNOTES
14806 \# --------
14807 \# *Arguments:
14808 \#   none
14809 \# *Function:
14810 \#   Sets new document leading from #EN_LEAD, breaks to a new page,
14811 \#   sets up an endnotes page based on registers and strings associated
14812 \#   with endnotes, then outputs diversion END_NOTES.
14813 \#
14814 .MAC ENDNOTES END
14815 .    if \\n[defer] .NEWPAGE
14816 .    nr #LAST_EN \\n[#EN_NUMBER]
14817 .    nr #ENDNOTES 1
14818 .    nr #EN_FIRST_PAGE 1
14819 .    SETUP_ENDNOTES
14820 .    if !\\n[#PRINT_STYLE]=1 .chop END_NOTES
14821 .    nf
14822 .    END_NOTES
14823 .    rm END_NOTES
14824 .    ps \\n[#DOC_PT_SIZE]u
14825 .    if \\n[#PRINT_STYLE]=1 .vs \\n[#DOC_LEAD]u
14826 .    if \\n[#PRINT_STYLE]=2 \{\
14827 .       ie \\n[#ADJ_EN_LEAD] \
14828 .          nr #DOC_LEAD \\n[#RESTORE_DOC_LEAD]
14829 .       el .DOC_LEAD \\n[#RESTORE_DOC_LEAD]u
14830 .       rr #RESTORE_DOC_LEAD
14831 .    \}
14832 .    if \\n[#COLUMNS_WERE_ON] .nr #COLUMNS 1
14833 .    if \\n[#HEADER_STATE]=1 .HEADERS
14834 .    if \\n[#LINENUMBERS]=2 \{\
14835 .       NUMBER_LINES RESUME
14836 .       nr #LINENUMBERS 1
14837 .    \}
14838 .    rr #ENDNOTES
14839 .END
14840 \#
14841 \# Macros common to endnotes, bibliography, and toc
14842 \# ------------------------------------------------
14843 \#
14844 .MAC SETUP_BIB_EN END
14845 .    if '\\$0'SETUP_BIBLIOGRAPHY' .ds EN-OR-BIB BIB
14846 .    if '\\$0'SETUP_ENDNOTES'     .ds EN-OR-BIB EN
14847 .    nr #HEADER_STATE \\n[#HEADERS_ON]
14848 .    ds $RESTORE_PAGENUM_STYLE \\*[$PAGENUM_STYLE]
14849 .    if \\n[#LINENUMBERS]=1 \{\
14850 .       NUMBER_LINES OFF
14851 .       nr #LINENUMBERS 2
14852 .    \}
14853 .    if \\n[#HEADERS_ON]=1 \
14854 .       if !\\n[#\\*[EN-OR-BIB]_ALLOWS_HEADERS_ALL] .HEADERS OFF
14855 .    if \\n[#HEADER_STATE]=1 \{\
14856 .       ie \\n[#\\*[EN-OR-BIB]_HDRFTR_CENTER]=1 .
14857 .       el .rm $HDRFTR_CENTER
14858 .    \}
14859 .    ie !\\n[#SUSPEND_PAGINATION] \{\
14860 .       if \\n[#PAGINATE]=1 \{\
14861 .          if \\n[#PAGE_NUM_V_POS]=1 \{\
14862 .             PAGENUM_STYLE \\*[$\\*[EN-OR-BIB]_PN_STYLE]
14863 .             if \\n[#\\*[EN-OR-BIB]_FIRST_PN] .PAGENUMBER \\n[#\\*[EN-OR-BIB]_FIRST_PN]-1
14864 .             if r #\\*[EN-OR-BIB]_NO_FIRST_PN .nr #PAGINATE 0
14865 .          \}
14866 .       \}
14867 .    \}
14868 .    el \{\
14869 .       ie \\n[#PAGE_NUM_V_POS]=2 .nr #PAGINATE 1
14870 .       el .nr #PAGINATE 0
14871 .    \}
14872 .    if \\n[#FOOTERS_ON]=1 \{\
14873 .       if !'\\*[$HDRFTR_CENTER_OLD]'' \
14874 .          ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_OLD]
14875 .    \}
14876 .    NEWPAGE
14877 .    if \\n[#FOOTERS_ON]=1 \{\
14878 .       ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_NEW]
14879 .       rm $HDRFTR_CENTER_OLD
14880 .       rm $HDRFTR_CENTER_NEW
14881 .    \}
14882 .    ie !\\n[#SUSPEND_PAGINATION] \{\
14883 .       if \\n[#PAGE_NUM_V_POS]=1 \{\
14884 .          if r #\\*[EN-OR-BIB]_NO_FIRST_PN \
14885 .             if \\n[#PAGINATION_STATE]=1 .nr #PAGINATE 1
14886 .       \}
14887 .    \}
14888 .    el \
14889 .       if \\n[#PAGE_NUM_V_POS]=2 .nr #PAGINATE 0
14890 .    rr #PAGINATION_STATE
14891 .    PAGENUM_STYLE \\*[$\\*[EN-OR-BIB]_PN_STYLE]
14892 .    if \\n[#\\*[EN-OR-BIB]_FIRST_PN] .PAGENUMBER \\n[#\\*[EN-OR-BIB]_FIRST_PN]
14893 .    if \\n[#HEADER_STATE]=1 \
14894 .       if \\n[#\\*[EN-OR-BIB]_ALLOWS_HEADERS] .HEADERS
14895 .\" Collect endnotes title string for TOC
14896 .    nr #TOC_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
14897 .    af #TOC_ENTRY_PN \\g[#PAGENUMBER]
14898 .    ds $TOC_TITLE_ITEM \\*[$\\*[EN-OR-BIB]_STRING]\|
14899 .    PDF_BOOKMARK 1 \\*[$\\*[EN-OR-BIB]_STRING]
14900 .    TITLE_TO_TOC
14901 .\" End collection of endnotes title string for TOC
14902 .\" Process endnotes
14903 .    if \\n[#PRINT_STYLE]=1 .vs \\n[#\\*[EN-OR-BIB]_LEAD]u
14904 .    if \\n[#PRINT_STYLE]=2 \{\
14905 .       if \\n[#\\*[EN-OR-BIB]_NO_COLS] \{\
14906 .          if \\n[#COLUMNS] .nr #COLUMNS_WERE_ON 1
14907 .          nr #COLUMNS 0
14908 .       \}
14909 .       nr #RESTORE_DOC_LEAD \\n[#DOC_LEAD]
14910 .       ie \\n[#ADJ_\\*[EN-OR-BIB]_LEAD] .nr #DOC_LEAD \\n[#\\*[EN-OR-BIB]_LEAD]
14911 .       el .DOC_LEAD \\n[#\\*[EN-OR-BIB]_LEAD]u
14912 .    \}
14913 .    vpt 0
14914 .    RESTORE_SPACE
14915 .    ie r#\\*[EN-OR-BIB]_STRING_V_POS .sp |\\n[#\\*[EN-OR-BIB]_STRING_V_POS]u-1v
14916 .    el .sp |\\n[#T_MARGIN]u-\\n[#\\*[EN-OR-BIB]_LEAD]u
14917 .    vpt
14918 .    mk ec
14919 .    if \\n[#SLANT_ON] \{\
14920 \*[SLANTX]\c
14921 .    \}
14922 .    sp
14923 .    if !'\\*[$\\*[EN-OR-BIB]_STRING]'' \{\
14924 .       if \\n[#PRINT_STYLE]=1 \{\
14925 .          TYPEWRITER
14926 .          vs \\n[#\\*[EN-OR-BIB]_LEAD]u
14927 .       \}
14928 .       if \\n[#PRINT_STYLE]=2 \{\
14929 .          LL \\n[#DOC_L_LENGTH]u
14930 .          ta \\n[.l]u
14931 .          if \\n[#COLUMNS] \{\
14932 .             ie \\n[#\\*[EN-OR-BIB]_NO_COLS] .LL \\n[#DOC_L_LENGTH]u
14933 .             el .LL \\n[#COL_L_LENGTH]u
14934 .             ta \\n[.l]u
14935 .          \}
14936 .          FAMILY  \\*[$\\*[EN-OR-BIB]_STRING_FAM]
14937 .          FT      \\*[$\\*[EN-OR-BIB]_STRING_FT]
14938 .          ps \\n[#\\*[EN-OR-BIB]_PS]u\\*[$\\*[EN-OR-BIB]_STRING_SIZE_CHANGE]
14939 .          vs      \\n[#\\*[EN-OR-BIB]_LEAD]u
14940 .       \}
14941 .       substring $\\*[EN-OR-BIB]_STRING_QUAD 0 0
14942 .       if '\\*[$\\*[EN-OR-BIB]_STRING_QUAD]'L' .LEFT
14943 .       if '\\*[$\\*[EN-OR-BIB]_STRING_QUAD]'C' .CENTER
14944 .       if '\\*[$\\*[EN-OR-BIB]_STRING_QUAD]'R' .RIGHT
14945 .       EOL
14946 .       if \\n[#\\*[EN-OR-BIB]_STRING_COLOR]=1 .COLOR \\*[$\\*[EN-OR-BIB]_STRING_COLOR]
14947 .       if \\n[#\\*[EN-OR-BIB]_STRING_CAPS] .CAPS
14948 .       if \\n[#\\*[EN-OR-BIB]_STRING_SMALLCAPS] .SMALLCAPS
14949 .       ie \\n[#\\*[EN-OR-BIB]_STRING_UNDERLINE] \{\
14950 .          if \\n[#PRINT_STYLE]=2 .ds $TITLE_TYPE \\*[EN-OR-BIB]_STRING
14951 .          ie \\n[#PRINT_STYLE]=1 \
14952 .             UNDERSCORE2 3p 2p "\\*[$\\*[EN-OR-BIB]_STRING]"
14953 .          el \{\
14954 .             ie \\n[#\\*[EN-OR-BIB]_STRING_UNDERLINE]=2 \
14955 .                UNDERSCORE2 \\*[$\\*[EN-OR-BIB]_UNDERLINE_GAP] \\*[$\\*[EN-OR-BIB]_RULE_GAP] "\\*[$\\*[EN-OR-BIB]_STRING]"
14956 .             el .UNDERSCORE "\\*[$\\*[EN-OR-BIB]_STRING]"
14957 .          \}
14958 .       \}
14959 .       el .PRINT "\\*[$\\*[EN-OR-BIB]_STRING]
14960 .    \}
14961 .    SMALLCAPS OFF
14962 .    if \\n[#\\*[EN-OR-BIB]_STRING_COLOR]=1 .gcolor
14963 .    CAPS OFF
14964 .    FAMILY \\*[$\\*[EN-OR-BIB]_FAMILY]
14965 .    FT \\*[$\\*[EN-OR-BIB]_FT]
14966 .    ps -\\*[$\\*[EN-OR-BIB]_STRING_SIZE_CHANGE]
14967 .    ie \\n[#PRINT_STYLE]=1 \{\
14968 .       ie \\n[#SINGLE_SPACE]=1 .sp
14969 .       el \{\
14970 .          ie \\n[#\\*[EN-OR-BIB]_SINGLESPACE]=1 .sp
14971 .          el .
14972 .       \}
14973 .    \}
14974 .    el \{\
14975 .       ie '\\*[EN-OR-BIB]'BIB' .sp 2
14976 .       el .sp
14977 .    \}
14978 .    SHIM
14979 .    QUAD \\*[$\\*[EN-OR-BIB]_QUAD]
14980 .END
14981 .
14982 .ALIAS SETUP_BIBLIOGRAPHY SETUP_BIB_EN
14983 .ALIAS SETUP_ENDNOTES     SETUP_BIB_EN
14984 \#
14985 \# ENDNOTES, BIBLIOGRAPHY and TOC LEADING
14986 \# --------------------------------------
14987 \# *Argument:
14988 \#   <leading> [ ADJUST ]
14989 \# *Function:
14990 \#   Depending on the name by which it's called, creates or modifies
14991 \#   register #<type>_LEAD, where <type> is BIB, EN, or TOC.  Creates or removes
14992 \#   register #ADJ_<type>_LEAD.  Stores arguments in strings if BIB,
14993 \#   EN, or TOC leading are set before START.
14994 \# *Notes:
14995 \#   Default is same as doc lead for TYPESET, adjusted; 24 for TYPEWRITE.
14996 \#
14997 .MAC _LEAD END
14998 .    if '\\$0'BIBLIOGRAPHY_LEAD' .ds $SECTION BIB
14999 .    if '\\$0'ENDNOTE_LEAD' .ds $SECTION EN
15000 .    if '\\$0'TOC_LEAD' .ds $SECTION TOC
15001 .    rr #ADJ_\\*[$SECTION]_LEAD
15002 .    ds $\\*[$SECTION]_LEAD \\$1
15003 .    rm $ADJUST_\\*[$SECTION]_LEAD
15004 .    if '\\$2'ADJUST' \{\
15005 .       nr #ADJ_\\*[$SECTION]_LEAD 1
15006 .       ds $ADJUST_\\*[$SECTION]_LEAD ADJUST
15007 .    \}
15008 .    if !\\n[#OK_PROCESS_LEAD] .return
15009 .    nr #\\*[$SECTION]_LEAD (p;\\$1)
15010 .END
15011 .
15012 .ALIAS BIBLIOGRAPHY_LEAD _LEAD
15013 .ALIAS ENDNOTE_LEAD      _LEAD
15014 .ALIAS TOC_LEAD          _LEAD
15015 \#
15016 \# ====================================================================
15017 \#
15018 \# +++BIBLIOGRAPHY+++
15019 \#
15020 \# Mom treats bibliographies and endnotes very similarly.  The chief
15021 \# difference is that endnotes are collected and formatted inside a
15022 \# diversion, while bibliographies are built "by hand."  ENDNOTES sets
15023 \# up the endnotes page and outputs the formatted diversion.
15024 \# BIBLIOGRAPHY sets up the bibliography page, then awaits refer
15025 \# commands.
15026 \#
15027 \# All of the bibliography control macros have their exact
15028 \# counterparts in the endnotes control macros.  See, therefore,
15029 \# Arguments, Functions, and Notes in the Endnotes section.
15030 \#
15031 \# Bibliography control macros
15032 \#
15033 .MAC BIBLIOGRAPHY_PT_SIZE END
15034 .    nr #BIB_PS (p;\\$1)
15035 .END
15036 \#
15037 .MAC BIBLIOGRAPHY_HDRFTR_CENTER END
15038 .    ie '\\$1'' .nr #BIB_HDRFTR_CENTER 1
15039 .    el .rr #BIB_HDRFTR_CENTER
15040 .END
15041 \#
15042 .MAC BIBLIOGRAPHY_STRING END
15043 .    ds $BIB_STRING \\$1
15044 .END
15045 \#
15046 .MAC BIBLIOGRAPHY_STRING_ADVANCE END
15047 .    nr #BIB_STRING_V_POS (u;\\$1)
15048 .END
15049 \#
15050 .MAC BIBLIOGRAPHY_STRING_V_POS END
15051 .    nr #BIB_STRING_V_POS (u;\\$1)
15052 .END
15053 .
15054 .ALIAS BIBLIOGRAPHY_HEADER_V_POS BIBLIOGRAPHY_STRING_V_POS
15055 \#
15056 .MAC BIBLIOGRAPHY_NO_COLUMNS END
15057 .    ie '\\$1'' .nr #BIB_NO_COLS 1
15058 .    el .rr #BIB_NO_COLS
15059 .END
15060 \#
15061 .MAC BIBLIOGRAPHY_NO_FIRST_PAGENUM END
15062 .    ie '\\$1'' .nr #BIB_NO_FIRST_PN 1
15063 .    el .rr #BIB_NO_FIRST_PN
15064 .END
15065 \#
15066 .MAC BIBLIOGRAPHY_ALLOWS_HEADERS END
15067 .    ie '\\$1'' .nr #BIB_ALLOWS_HEADERS 1
15068 .    el \{\
15069 .       ie '\\$1'ALL' \{\
15070 .          nr #BIB_ALLOWS_HEADERS 1
15071 .          nr #BIB_ALLOWS_HEADERS_ALL 1
15072 .       \}
15073 .       el \{\
15074 .          rr #BIB_ALLOWS_HEADERS
15075 .          rr #BIB_ALLOWS_HEADERS_ALL
15076 .       \}
15077 .    \}
15078 .END
15079 \#
15080 .MAC BIBLIOGRAPHY_PAGENUM_STYLE END
15081 .    ds $BIB_PN_STYLE \\$1
15082 .END
15083 \#
15084 .MAC BIBLIOGRAPHY_FIRST_PAGENUMBER END
15085 .    nr #BIB_FIRST_PN \\$1
15086 .END
15087 \#
15088 .MAC SINGLESPACE_BIBLIOGRAPHY END
15089 .    if \\n[#PRINT_STYLE]=1 \{\
15090 .       ie \\n[#SINGLE_SPACE] \{\
15091 .          nr #BIB_SINGLESPACE 1
15092 .          rr #IGNORE
15093 .          if \\n[#OK_PROCESS_LEAD] \{\
15094 .             BIBLIOGRAPHY_LEAD 12 ADJUST
15095 .             nr #IGNORE 1
15096 .          \}
15097 .       \}
15098 .       el \{\
15099 .          ie '\\$1'' \{\
15100 .             nr #BIB_SINGLESPACE 1
15101 .             rr #IGNORE
15102 .             if \\n[#OK_PROCESS_LEAD] \{\
15103 .                BIBLIOGRAPHY_LEAD 12 ADJUST
15104 .                nr #IGNORE 1
15105 .             \}
15106 .          \}
15107 .          el \{\
15108 .             rr #BIB_SINGLESPACE
15109 .             rr #IGNORE
15110 .             if \\n[#OK_PROCESS_LEAD] \{\
15111 .                BIBLIOGRAPHY_LEAD 24 ADJUST
15112 .                nr #IGNORE 1
15113 .             \}
15114 .          \}
15115 .       \}
15116 .    \}
15117 .END
15118 \#
15119 \# Style for outputting collected bibliographic references
15120 \# -------------------------------------------------------
15121 \# *Argument:
15122 \#   LIST | PLAIN [ <list separator> ] [ <list prefix> ]
15123 \# *Function:
15124 \#   Sets #BIB_LIST to 1 for numbered list style, 0 for plain output
15125 \# *Notes:
15126 \#   Technically, user is supposed to enter PLAIN if s/he wants an
15127 \#   unnumbered bibliography, but the el clause says "any arg but
15128 \#   LIST means unnumbered."  Effectively, any arg but LIST produces
15129 \#   a "plain" bibliographic list.
15130 \#
15131 \# The 2nd and 3rd args have the same options as the 2nd and 3rd
15132 \# args to LIST.
15133 \#
15134 .MAC BIBLIOGRAPHY_TYPE END
15135 .    ie '\\$1'LIST' \{\
15136 .       nr #BIB_LIST 1
15137 .       ie '\\$2'' \
15138 .          if '\\*[$BIB_LIST_SEPARATOR]'' .ds $BIB_LIST_SEPARATOR .
15139 .       el .ds $BIB_LIST_SEPARATOR \\$2
15140 .       ie '\\$3'' .ds $BIB_LIST_PREFIX
15141 .       el .ds $BIB_LIST_PREFIX \\$3
15142 .    \}
15143 .    el .nr #BIB_LIST 0
15144 .END
15145 \#
15146 \# Spacing between items in bibliographies
15147 \# ---------------------------------------
15148 \# *Argument:
15149 \#   <amount of space>
15150 \# *Function:
15151 \#   Gets value for #BIB_SPACE in units.
15152 \# *Notes:
15153 \#   Requires a unit of measure.
15154 \#
15155 .MAC BIBLIOGRAPHY_SPACING END
15156 .    ds $BIB_SPACE \\$1
15157 .    if \\n[#BIB_LEAD]=0 \{\
15158 .       nr #DEFER_BIB_SPACING 1
15159 .       return
15160 .    \}
15161 .    ds $EVAL_BIB_SPACE \\*[$BIB_SPACE]
15162 .    substring $EVAL_BIB_SPACE -1
15163 .    ie '\\*[$EVAL_BIB_SPACE]'v' \{\
15164 .       substring $BIB_SPACE 0 0
15165 .       nr #BIB_SPACE \\n[#BIB_LEAD]*\\*[$BIB_SPACE]
15166 .    \}
15167 .    el .nr #BIB_SPACE (\\$1)
15168 .END
15169 \#
15170 \# Bibliography (user space macro)
15171 \# -------------------------------
15172 \# *Function:
15173 \#   Sets up a new page, with title, ready to accept the output
15174 \#   of refer's $LIST$ or .R1 bibliography .R2
15175 \# *Notes:
15176 \#   Bibliography pages are set up almost identically to endnotes pages.
15177 \#
15178 .MAC BIBLIOGRAPHY END
15179 .    if \\n[defer] .NEWPAGE
15180 .    ie '\\$1'' \{\
15181 .       rr #FN_REF
15182 .       rr #EN_REF
15183 .       nr #BIBLIOGRAPHY 1
15184 .       nr #BIB_FIRST_PAGE 1
15185 .       nr #SKIP_FOOTER +1
15186 .       SETUP_BIBLIOGRAPHY
15187 .       nr #SKIP_FOOTER -1
15188 .       if \\n[#PRINT_STYLE]=1 \{\
15189 .          ie \\n[#SINGLE_SPACE]=1 .vs \\n[#BIB_LEAD]u
15190 .          el \{\
15191 .             ie \\n[#BIB_SINGLESPACE]=1 .vs \\n[#BIB_LEAD]u
15192 .             el .vs \\n[#BIB_LEAD]u
15193 .          \}
15194 .       \}
15195 .       if \\n[#PRINT_STYLE]=2 \{\
15196 .          ie \\n[#ADJ_BIB_LEAD] \
15197 .             nr #DOC_LEAD \\n[#RESTORE_DOC_LEAD]
15198 .          el .DOC_LEAD \\n[#RESTORE_DOC_LEAD]u
15199 .          rr #RESTORE_DOC_LEAD
15200 .       \}
15201 .       if \\n[#COLUMNS_WERE_ON] .nr #COLUMNS 1
15202 .       if \\n[#HEADER_STATE]=1 .HEADERS
15203 .       if \\n[#LINENUMBERS]=2 \{\
15204 .          NUMBER_LINES RESUME
15205 .          nr #LINENUMBERS 1
15206 .       \}
15207 .       di BIB
15208 .    \}
15209 .    el \{\
15210 .       br
15211 .       di
15212 .\" Part of workaround for refer spitting out a blank page if the
15213 .\" last ref falls on the bottom line.
15214 .       nr num*refs \\n[ref*num*first-pass]
15215 .       nf
15216 .       chop BIB
15217 .       BIB
15218 .    \}
15219 .    rr #BIBLIOGRAPHY
15220 .END
15221 \#
15222 \# ====================================================================
15223 \#
15224 \# +++TABLE OF CONTENTS+++
15225 \#
15226 \# Strings to allocate space for leaders and entry page numbers
15227 \#
15228 .ds $TOC_PN \\*[ST102]\F[\\*[$TOC_PN_FAM]]\f[\\*[$TOC_PN_FT]]\
15229 \s[\\n[#TOC_PS]u]^\\*[ST102X]\\*[ST103]\s[\\*[$TOC_PN_SIZE_CHANGE]]\
15230 \h'.2n'\h'\w'0'u*\\n[#TOC_PN_PADDING]u'\\*[ST103X]
15231 \#
15232 .ds $TOC_PN_TYPEWRITE \\*[ST102]^\\*[ST102X]\\*[ST103]\
15233 \h'\w'0'u*\\n[#TOC_PN_PADDING]u'\\*[ST103X]
15234 \#
15235 \# TOC collector
15236 \#
15237 .MAC TO_TOC END
15238 .    if !'\\n[.ev]'TOC_EV' .ev TOC_EV
15239 .    nr #TOC_CH_NUM_INDENT \w'\\*[$TOC_CH_NUM]'
15240 .    da TOC_ENTRIES
15241 \!.  ie \\\\n[#SKIP_ENTRY]=1 \{\
15242 .     rr #SKIP_ENTRY
15243 \!.  \}
15244 \!.  el \{\
15245 .       TQ
15246 .       ie \\n[#PRINT_STYLE]=1 \{\
15247 \!.        fam \\*[$TYPEWRITER_FAM]
15248 \!.        ft  R
15249 \!.        ps \\*[$TYPEWRITER_PS]
15250 .          ds _TYPEWRITE _TYPEWRITE
15251 .       \}
15252 .       el \{\
15253 .          ie '\\$0'HD_TO_TOC' \{\
15254 \!.           ps \\n[#TOC_PS]u\\*[$TOC_HEAD_\\n[#LEVEL]_SIZE]
15255 .          \}
15256 .          el \{\
15257 \!.           FAMILY \\*[$TOC_TITLE_FAM]
15258 \!.           FT     \\*[$TOC_TITLE_FT]
15259 \!.           ps \\n[#TOC_PS]u\\*[$TOC_TITLE_SIZE]
15260 .          \}
15261 .       \}
15262 .       if \\n[#PRINT_STYLE]=2 \{\
15263 .          rm _TYPEWRITE
15264 .          if \\n[#SPACE_TOC_ITEMS] \{\
15265 .             if \\n[#POST_TOP]=1 \{\
15266 .                ie !\\n[#LEVEL]=\\n[#LAST_LEVEL] \{\
15267 .                   ie \\n[#LEVEL]>\\n[#LAST_LEVEL] \!.sp .2v
15268 .                   el \!.sp .4v
15269 .                \}
15270 .                el \{\
15271 .                   if \\n[#COLLATED_DOC] \
15272 .                      if '\\$0'TITLE_TO_TOC' \!.sp .4v
15273 .                \}
15274 .             \}
15275 .          \}
15276 .       \}
15277 \!.     PAD_MARKER ^
15278 .       if !'\\$0'HD_TO_TOC' \{\
15279 \!.        if \\n[#TOC_TITLE_CAPS]=1 .CAPS
15280 .       \}
15281 .       if '\\$0'HD_TO_TOC' \{\
15282 .          nr #POST_TOP 1
15283 \!.        if \\n[#TOC_HEAD_\\n[#LEVEL]_CAPS]=1 .CAPS
15284 .       \}
15285 \!.     vpt 0
15286 .       ie '\\$0'HD_TO_TOC' \{\
15287 .          if \\n[#PRINT_STYLE]=1 \{\
15288 .             ds $TOC_HEAD_\\n[#LEVEL]_FAM] \\*[$TYPEWRITER_FAM]
15289 .             ds $TOC_HEAD_\\n[#LEVEL]_FT]  R
15290 .          \}
15291 \!.        PAD \
15292 "\f[\\*[$TOC_HEAD_\\n[#LEVEL]_FAM]\
15293 \\*[$TOC_HEAD_\\n[#LEVEL]_FT]]\
15294 \h'\\\\n[#TOC_INDENT_ADJ]u'\h'\\n[#TOC_HEAD_\\n[#LEVEL]_INDENT]u'\
15295 \\*[$TOC_HD_NUM]\\*[$TOC_HEAD_\\n[#LEVEL]_ITEM]\\*[$TOC_PN\\*[_TYPEWRITE]]" \
15296 "\\*[PDFBOOKMARK.NAME]"
15297 .       \}
15298 .       el \{\
15299 .          if \\n[#PRINT_STYLE]=1 \{\
15300 .             ds $TOC_TITLE_FAM \\*[$TYPEWRITER_FAM]
15301 .             ds $TOC_TITLE_FT  R
15302 .          \}
15303 \!.        PAD \
15304 "\f[\\*[$TOC_TITLE_FAM]\\*[$TOC_TITLE_FT]]\
15305 \h'\\n[#TOC_TITLE_INDENT]u'\\*[$TOC_TITLE_ITEM]\\*[$TOC_PN\\*[_TYPEWRITE]]" \
15306 "\\*[PDFBOOKMARK.NAME]"
15307 .       \}
15308 .       ie '\\$0'HD_TO_TOC' \
15309 \!.        if \\n[#TOC_HEAD_\\n[#LEVEL]_CAPS]=1 .CAPS OFF
15310 .       el \
15311 \!.        if \\n[#TOC_TITLE_CAPS]=1 .CAPS OFF
15312 \!.     PAD_MARKER #
15313 \!.     EOL
15314 \!.     ST 102 L
15315 \!.     ST 103 R QUAD
15316 .       if \\n[#PRINT_STYLE]=2 \{\
15317 \!.        FAMILY  \\*[$TOC_PN_FAM]
15318 \!.        FT      \\*[$TOC_PN_FT]
15319 \!.        ps \\n[#TOC_PS]u
15320 .       \}
15321 \!.     TAB 102
15322 \!.     PRINT \fR\\*[LEADER]\f[]
15323 \!.     TN
15324 .       if \\n[#PRINT_STYLE]=2 \{\
15325 \!.        ps \\*[$TOC_PN_SIZE_CHANGE]
15326 .       \}
15327 \!.     PRINT \\n[#TOC_ENTRY_PN]
15328 \!. \}
15329 .   da
15330 .   ev
15331 .END
15332 .
15333 .ALIAS HD_TO_TOC    TO_TOC
15334 .ALIAS TITLE_TO_TOC TO_TOC
15335 \#
15336 \# Control macros for toc
15337 \# ----------------------
15338 \#
15339 \# TOC TITLE STYLE
15340 \# ---------------
15341 \# *Arguments:
15342 \#   FAMILY <family>
15343 \#   FONT   <font>
15344 \#   SIZE   <+|-n>
15345 \#   COLOR  <color>
15346 \#   CAPS
15347 \#   INDENT
15348 \# *Function:
15349 \#   Assigns complete style parameters to TITLEs (doc titles,
15350 \#   chapter titles, etc) in the TOC.
15351 \# *Notes:
15352 \#   TITLEs are not headings, therefore they require their own style
15353 \#   macro.  Otherwise, the same as TOC_ENTRY_STYLE.
15354 \#
15355 .MAC TOC_TITLE_STYLE END
15356 .    nr #ARG_NUM 0 1
15357 .    nr #ATTRIB \\n[#NUM_ARGS]
15358 .    while \\n+[#ARG_NUM]<=\\n[#ATTRIB] \{\
15359 .       if '\\$1'FAMILY' \{\
15360 .          shift
15361 .          ds $TOC_TITLE_FAM  \\$1
15362 .          shift
15363 .       \}
15364 .       if '\\$1'FONT' \{\
15365 .          shift
15366 .          ds $TOC_TITLE_FT   \\$1
15367 .          shift
15368 .       \}
15369 .       if '\\$1'SIZE' \{\
15370 .          shift
15371 .          ds $TOC_TITLE_SIZE \\$1
15372 .          shift
15373 .       \}
15374 .       if '\\$1'CAPS' \{\
15375 .          nr #TOC_TITLE_CAPS 1
15376 .          shift
15377 .       \}
15378 .       if '\\$1'NO_CAPS' \{\
15379 .          rr #TOC_TITLE_CAPS
15380 .          shift
15381 .       \}
15382 .       if '\\$1'SMALLCAPS' \{\
15383 .          nr #TOC_TITLE_SMALLCAPS 1
15384 .          shift
15385 .       \}
15386 .       if '\\$1'NO_SMALLCAPS' \{\
15387 .          rr #TOC_TITLE_SMALLCAPS
15388 .          shift
15389 .       \}
15390 .       if '\\$1'INDENT' \{\
15391 .          shift
15392 .          nr #TOC_TITLE_INDENT \\$1
15393 .          shift
15394 .       \}
15395 .    \}
15396 .END
15397 \#
15398 \# TOC HEADER STRING
15399 \# -----------------
15400 \# *Argument:
15401 \#   <string for "doc header" of first toc page>
15402 \# *Function:
15403 \#   Creates or modifies string $TOC_HEADER_STRING
15404 \# *Notes:
15405 \#   Default is "Contents".
15406 \#
15407 .MAC TOC_HEADER_STRING END
15408 .    ds $TOC_HEADER_STRING \\$1
15409 .END
15410 \#
15411 \# TOC HEADER CAPS and SMALLCAPS
15412 \# -----------------------------
15413 \# *Arguments:
15414 \#   <none> | <anything>
15415 \# *Function:
15416 \#   Turns capitalization or smallcaps style of the toc title string
15417 \#   on or off.
15418 \# *Notes:
15419 \#   Users may want the toc title string to be in
15420 \#   caps, but the page header to be in lower case.  If the
15421 \#   argument to TOC_HEADER_STRING is in lower case and
15422 \#   TOC_HEADER_CAPS is turned on, this is exactly what will
15423 \#   happen.  Ditto for SMALLCAPS.
15424 \#
15425 .MAC TOC_HEADER_CAPS END
15426 .   ie '\\$1'' .nr #TOC_STRING_CAPS 1
15427 .   el .nr #TOC_STRING_CAPS 0
15428 .END
15429 .
15430 .MAC TOC_HEADER_SMALLCAPS END
15431 .   ie '\\$1'' .nr #TOC_STRING_SMALLCAPS 1
15432 .   el .nr #TOC_STRING_SMALLCAPS 0
15433 .END
15434 .
15435 \#
15436 \# TOC VERTICAL PLACEMENT
15437 \# ----------------------
15438 \# *Argument:
15439 \#   <distance from page top>
15440 \# *Function:
15441 \#   Creates register #TOC_HEADER_V_POS.
15442 \# *Notes:
15443 \#   Default is same as normal docheader position.
15444 \#
15445 .MAC TOC_HEADER_V_POS END
15446 .    nr #TOC_HEADER_V_POS (u;\\$1)
15447 .END
15448 \#
15449 \#
15450 \# TOC POINT SIZE
15451 \# --------------
15452 \# *Argument:
15453 \#   <base point size for toc pages>
15454 \# *Function:
15455 \#   Creates or modifies register #TOC_PS.
15456 \# *Notes:
15457 \#   This size control macro differs from other size control macros
15458 \#   in that it sets an absolute point size, not a relative one.
15459 \#   See notes for ENDNOTE_PT_SIZE for explanation.
15460 \#
15461 \#   No unit of measure required (points assumed).  Default is 12.5
15462 \#   for TYPESET.
15463 \#
15464 .MAC TOC_PT_SIZE END
15465 .    nr #TOC_PS (p;\\$1)
15466 .END
15467 \#
15468 \# TOC ENTRIES PAGE NUMBERS PADDING
15469 \# --------------------------------
15470 \# *Argument:
15471 \#   <number of placeholders for toc entries page numbers>
15472 \# *Function:
15473 \#   Creates or modifies register #TOC_PN_PADDING.
15474 \# *Notes:
15475 \#   "Placeholders" is the maximum number of digits in a page
15476 \#   number numeral.
15477 \#
15478 \#   Default is 3.
15479 \#
15480 .MAC TOC_PADDING END
15481 .    nr #TOC_PN_PADDING \\$1
15482 .END
15483 \#
15484 \# PAGINATE TOC
15485 \# ------------
15486 \# *Argument:
15487 \#   <none> | <anything>
15488 \# *Function:
15489 \#   Creates or removes register #PAGINATE_TOC.
15490 \# *Notes:
15491 \#   Default is to paginate toc.
15492 \#
15493 .MAC PAGINATE_TOC END
15494 .    ie '\\$1'' .nr #PAGINATE_TOC 1
15495 .    el .nr #PAGINATE_TOC 0
15496 .END
15497 \#
15498 .MAC TOC_FIRST_PAGENUM END
15499 .    nr #TOC_START_PAGENUM \\$1
15500 .END
15501 \#
15502 \# TOC PAGES PAGE-NUMBERING STYLE
15503 \# ------------------------------
15504 \# *Argument:
15505 \#   DIGIT | ROMAN | roman | ALPHA | alpha
15506 \# *Function:
15507 \#   Creates or modifies string $TOC_PN_STYLE
15508 \# *Notes:
15509 \#   Page numbering style for page numbers that appear in the
15510 \#   headers/footers of toc pages.  See notes for PAGENUM_STYLE.
15511 \#
15512 \#   Default is roman.
15513 \#
15514 .MAC TOC_PAGENUM_STYLE END
15515 .    ds $TOC_PN_STYLE \\$1
15516 .END
15517 \#
15518 \# TOC RECTO_VERSO SWITCH
15519 \# ----------------------
15520 \# *Argument:
15521 \#   <none> | <anything>
15522 \# *Function:
15523 \#   Creates or removes register #TOC_RV_SWITCH
15524 \# *Notes:
15525 \#   Allows switching of L/R margins if a doc is recto/verso and
15526 \#   the first toc page happens to fall the wrong way
15527 \#
15528 .MAC TOC_RV_SWITCH END
15529 .    ie '\\$1'' .nr #TOC_RV_SWITCH 1
15530 .    el .rr #TOC_RV_SWITCH
15531 .END
15532 \#
15533 \# TOC ENTRY SPACING
15534 \# -----------------
15535 \# *Arguments:
15536 \#   <none> | <anything>
15537 \# *Function:
15538 \#   Toggles whether a small amount of space is inserted between TOC
15539 \#   entries for greater legibility.
15540 \#
15541 .MAC SPACE_TOC_ITEMS END
15542 .    ie !'\\$1'' .rr #SPACE_TOC_ITEMS
15543 .    el .nr #SPACE_TOC_ITEMS 1
15544 .END
15545 \#
15546 \# NUMBERING OF TOC CHAPTER/SECTION ENTRIES
15547 \# ----------------------------------------
15548 \# *Arguments:
15549 \#   <none> | <anything>
15550 \# *Function:
15551 \#   Determines whether chapter numbers are prefixed to title
15552 \#   entries in the TOC (title here means chapter/chapter-title
15553 \#   or, if the doctype is DEFAULT or NAMED, the section title.
15554 \# *Notes:
15555 \#   Aliased as TOC_PREFIX_SECTION_NUMBER.
15556 \#
15557 .MAC TOC_PREFIX_CHAPTER_NUMBER END
15558 .    ie '\\$1'' .nr #TOC_PREFIX_CH_NUM 1
15559 .    el .rr #TOC_PREFIX_CH_NUM
15560 .END
15561 .
15562 .ALIAS TOC_PREFIX_SECTION_NUMBER TOC_PREFIX_CHAPTER_NUMBER
15563 \#
15564 \# PADDING OF TOC CHAPTER/SECTION NUMBERS
15565 \# --------------------------------------
15566 \# *Arguments:
15567 \#   <amount of padding> | <anything>
15568 \# *Function:
15569 \#   Insert figure spaces before toc chapter numbers so they
15570 \#   right align.
15571 \# *Notes:
15572 \#   Aliased as PAD_TOC_SECTION_NUMBERS.
15573 \#
15574 .MAC PAD_TOC_CHAPTER_NUMBERS END
15575 .    ie !'\\$1'' .nr #PAD_TOC_CH_NUM \\$1
15576 .    el .rr #PAD_TOC_CH_NUM
15577 .END
15578 .
15579 .ALIAS PAD_TOC_SECTION_NUMBERS PAD_TOC_CHAPTER_NUMBERS
15580 \#
15581 \# NUMBERING OF TOC HEAD ENTRIES
15582 \# -----------------------------
15583 \# *Arguments:
15584 \#   FULL | TRUNCATE | NONE
15585 \# *Function:
15586 \#   Determines how, or whether, to prepend heading numbers to TOC
15587 \#   entries.
15588 \# *Notes:
15589 \#   FULL means the complete numbering string (default).
15590 \#
15591 \#   TRUNCATE means prepend a single digit sufficient to identify
15592 \#   an entry's place in the numbering scheme with reference to the
15593 \#   level above it.  Thus, if a HEADING 1 is the second HEADING 1
15594 \#   and therefore numbered "2.", a HEADING 2 beneath it (in the TOC)
15595 \#   will have only "1." prepended to the entry; TOC indenting makes it
15596 \#   evident under which level the HEADING 2 belongs.
15597 \#
15598 \#   Note that TRUNCATE also removes chapter numbers, if
15599 \#   PREFIX_CHAPTER_NUMBER is on.
15600 \#
15601 .MAC TOC_ENTRY_NUMBERS END
15602 .    if '\\$1'TRUNCATE' .nr #TRUNC_TOC_HD_NUM 1
15603 .    if '\\$1'FULL'     .nr #TRUNC_TOC_HD_NUM 0
15604 .    if '\\$1'NONE'     .nr #TOC_NO_HD_NUM 1
15605 .END
15606 \#
15607 \# User defined TITLE entry string
15608 \#
15609 .MAC TOC_TITLE_ENTRY END
15610 .    nr #USER_SET_TITLE_ITEM 1
15611 .    ds $USER_SET_TITLE_ITEM \\$1
15612 .END
15613 \#
15614 \# APPEND AUTHOR(S) TO TOC DOC TITLE ENTRIES
15615 \# -----------------------------------------
15616 \# *Argument:
15617 \#   <none> | <name(s) of author(s) as they should appear in toc doc title entries>
15618 \# *Function:
15619 \#   Creates register #TOC_AUTHORS (to tell TOC to append authors
15620 \#   to toc doc title entries).  Optionally creates string
15621 \#   $TOC_AUTHORS.
15622 \# *Notes:
15623 \#   Normally, TOC does not append the author(s) to a toc doc title
15624 \#   entry.  This special macro instructs TOC to do so.
15625 \#
15626 \#   If user has multiple authors for each doc when collating,
15627 \#   TOC_APPENDS_AUTHOR "<string>" must be inserted somewhere between
15628 \#   COLLATE and START in each doc.  Otherwise, mom prints only the
15629 \#   first author given to AUTHOR.
15630 \#
15631 .MAC TOC_APPENDS_AUTHOR END
15632 .    nr #TOC_AUTHORS 1
15633 .    if !'\\$1'' .ds $TOC_AUTHORS \\$1
15634 .END
15635 \#
15636 \# TABLE OF CONTENTS PAGE SETUP
15637 \# ----------------------------
15638 \# *Arguments:
15639 \#   <none> | <anything>
15640 \# *Function:
15641 \#   Some changes to the TOC layout (e.g. margins and page headers)
15642 \#   are not covered by the TOC and endnotes control macros.  This
15643 \#   macro permits access to any and all page setup macros not so
15644 \#   covered.
15645 \# *Notes
15646 \#   Wraps a diversion that ends when the macro is invoked with an
15647 \#   argument.  The contained formatting macros must be preceded by
15648 \#   '\!'.  The diversion is output before START in TOC.
15649 \#
15650 .MAC TOC_PAGE_SETTINGS END
15651 .    nr #TOC_PAGE_PARAMS 1
15652 .    ie '\\$1'' \
15653 .       di TOC_PAGE_PARAMS
15654 .    el .di
15655 .END
15656 \#
15657 \# TABLE OF CONTENTS
15658 \# -----------------
15659 \# *Arguments:
15660 \#   none
15661 \# *Function:
15662 \#   Takes care of the administrivia of setting up the TOC as if
15663 \#   it's a collated doc, then outputs the formatted TOC_ENTRIES
15664 \#   diversion.
15665 \#
15666 .MAC TOC END
15667 .    ie (\\n[@TOP]=0)&(\\n[.t]<=\\n[.v]) \
15668 '       br  \" When last line of text is on or near b-margin.
15669 .    el .br \" All other cases
15670 .    if dPDF.EXPORT \
15671 .       if \\n[#FLEX_ACTIVE] \
15672 .          if !\\n[#NO_FLEX] \
15673 .             tm .ds pre-toc-\\n%@\\n[#COL_NUM] 1
15674 .    if \\n[#TOC_RV_SWITCH]=1 .nr #TOC_RV_SWITCH 2
15675 .    char \[leader] " .
15676 .    LEADER_CHARACTER \[leader]
15677 .    if !\\n[#TOC_HEAD_1_INDENT] \
15678 .       nr #TOC_INDENT_ADJ 1.5m
15679 .    if \\n[#TOC_PREFIX_CH_NUM] \
15680 .       nr #TOC_INDENT_ADJ \\n[#TOC_CH_NUM_INDENT]
15681 .    if !\\n[#DOC_TYPE]=2 \{\
15682 .       if !'\\$1'INCLUDE_TITLE' \{\
15683 .          if r #LEVEL .nr #SKIP_ENTRY 1
15684 .          nr #TOC_INDENT_ADJ 0
15685 .       \}
15686 .    \}
15687 .    nr #TOC 1
15688 .    nr TOC.RELOCATE 0
15689 .    if \\n[#LINENUMBERS]=1 \{\
15690 .       NUMBER_LINES OFF
15691 .       nr #LINENUMBERS 2
15692 .    \}
15693 .    if !r #PAGINATE_TOC .PAGINATE_TOC
15694 .    nr #TOC_FIRST_PAGE 1
15695 .    if \\n[#FINIS] \{\
15696 .       if \\n[#FOOTERS_WERE_ON] \
15697 .          FOOTERS \" Have to turn FOOTERS on for next bit to work, so we can't skip this step
15698 .    \}
15699 .    if \\n[#FOOTERS_ON]=1 \{\
15700 .       if !'\\*[$HDRFTR_CENTER_OLD]'' \
15701 .          ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_OLD]
15702 .       ie \\n[#PAGINATE_TOC]=1 .PAGINATE
15703 .       el .PAGINATION OFF
15704 .    \}
15705 .    if \\n[#FOOTERS_WERE_ON] .FOOTERS OFF  \" But have to turn FOOTERS off again so they don't print when FINIS was called
15706 .    rr #COLUMNS
15707 .    COLLATE
15708 .    if \\n[#PRINT_STYLE]=1 \{\
15709 .       rr #IGNORE
15710 .       if \\n[#SINGLE_SPACE] .DOC_LEAD 24
15711 .       DOC_LEAD_ADJUST
15712 .       TRAPS
15713 .       nr #IGNORE 1
15714 .    \}
15715 .    if \\n[#FINIS] \{\
15716 .       if \\n[#FOOTERS_WERE_ON] .FOOTERS  \" Finally, turn footers on if they were on
15717 .       rr #FOOTERS_WERE_ON
15718 .       if \\n[#PAGINATION_WAS_ON] \{\
15719 .          nr #PAGINATE 1
15720 .          rr #PAGINATION_WAS_ON
15721 .       \}
15722 .       rr #FINIS
15723 .    \}
15724 .    ie \\n[#PAGINATE_TOC]=1 .PAGINATE
15725 .    el .PAGINATION OFF
15726 .    ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_NEW]
15727 .    rm $HDRFTR_CENTER_OLD
15728 .    rm $HDRFTR_CENTER_NEW
15729 .    rr #COLLATED_DOC
15730 .    if !r #TOC_START_PAGENUM .nr #TOC_START_PAGENUM 1
15731 .    PAGENUMBER \\n[#TOC_START_PAGENUM]
15732 .    if \\n[#LINENUMBERS]=2 .nr #LINENUMBERS 3
15733 .    L_MARGIN \\n[#DOC_L_MARGIN]u
15734 .    LL       \\n[#DOC_L_LENGTH]u
15735 .    HEADER_CENTER "\\*[$TOC_HEADER_STRING]
15736 .    if \\n[#SLANT_ON] .nop \\*[SLANTX]
15737 .    PAGENUM_STYLE \\*[$TOC_PN_STYLE]
15738 .    PAGENUM_FAMILY \\*[$TOC_PN_FAM]
15739 .    if r #TOC_PAGE_PARAMS .TOC_PAGE_PARAMS
15740 .    ie \\n[#ADJ_TOC_LEAD] \{\
15741 .       DOC_LEAD \\*[$TOC_LEAD] ADJUST
15742 .       TRAPS
15743 .    \}
15744 .    el .DOC_LEAD \\*[$TOC_LEAD]
15745 .    ie \\n[#TOC_HEADER_V_POS] \
15746 .      DOCHEADER OFF \\n[#TOC_HEADER_V_POS]u-\\n[#DOC_LEAD]u 
15747 .    el .DOCHEADER OFF \\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
15748 .    if (\\n[#PRINT_STYLE]=1)&(\\n[#SINGLE_SPACE]=1) \
15749 .       DOCHEADER OFF \\n[#T_MARGIN]u-(\\n[#DOC_LEAD]u*2u)
15750 .    START
15751 .    PDF_BOOKMARK 1 \\*[$TOC_HEADER_STRING]
15752 .    if \\n[#PRINT_STYLE]=1 .TYPEWRITER
15753 .    if \\n[#PRINT_STYLE]=2 \{\
15754 .       FAMILY \\*[$TOC_HEADER_FAM]
15755 .       FT     \\*[$TOC_HEADER_FT]
15756 .       ps \\n[#TOC_PS]u\\*[$TOC_HEADER_SIZE_CHANGE]
15757 .       if \\n[#TOC_HEADER_COLOR]=1 \
15758 .          COLOR \\*[$TOC_HEADER_COLOR]
15759 .    \}
15760 .    QUAD \\*[$TOC_HEADER_QUAD]
15761 .    if \\n[#TOC_STRING_CAPS] .CAPS
15762 .    if \\n[#TOC_STRING_SMALLCAPS] .SMALLCAPS
15763 .    if \\n[#PRINT_STYLE]=1 \
15764 .       UNDERSCORE 3p "\\*[$TOC_HEADER_STRING]"
15765 .    if \\n[#PRINT_STYLE]=2 \{\
15766 .       ie \\n[#TOC_HEADER_UNDERLINE] \{\
15767 .          ds $TITLE_TYPE TOC_HEADER
15768 .          ie \\n[#TOC_HEADER_UNDERLINE]=2 \
15769 .             UNDERSCORE2 \\*[$TOC_UNDERLINE_GAP] \\*[$TOC_RULE_GAP] "\\*[$TOC_HEADER_STRING]"
15770 .          el .UNDERSCORE "\\*[$TOC_HEADER_STRING]"
15771 .       \}
15772 .       el .PRINT \\*[$TOC_HEADER_STRING]
15773 .    \}
15774 .    SMALLCAPS OFF
15775 .    CAPS OFF
15776 .    if \\n[#TOC_HEADER_COLOR]=1 .gcolor
15777 .    br
15778 .    sp
15779 .    SHIM_1
15780 .    nf
15781 .    TOC_ENTRIES
15782 .    if \\n[#LINENUMBERS]=3 \{\
15783 .       NUMBER_LINES RESUME
15784 .       nr #LINENUMBERS 1
15785 .       nn 1
15786 .    \}
15787 .    rr #TOC
15788 .    rr #TOC_RV_SWITCH
15789 .    pdfsync
15790 .END
15791 \#
15792 \# ====================================================================
15793 \#
15794 \# +++COLUMNS+++
15795 \#
15796 \# COLUMNS
15797 \# -------
15798 \# *Arguments:
15799 \#   <number of columns>  <width of gutters>
15800 \# *Function:
15801 \#   Creates registers associated with setting docs in columns.
15802 \#   Calculates column line lengths and offsets
15803 \# *Notes:
15804 \#   COLUMNS, if used, s/b the last macro invoked before START.
15805 \#
15806 .MAC COLUMNS END
15807 .    if \\n[#IGNORE_COLUMNS]=1 .return
15808 .    nr #COLUMNS 1
15809 .    nr #NUM_COLS \\$1
15810 .    nr #GUTTER (\\$2)
15811 .    nr #COL_L_LENGTH \\n[#L_LENGTH]-(\\n[#GUTTER]*(\\n[#NUM_COLS]-1))/\\n[#NUM_COLS]
15812 .    nr #COL_TOTAL 0 \\n[#COL_L_LENGTH]+\\n[#GUTTER]
15813 .    nr #COL_NUM 0 1
15814 .    while !\\n[#COL_NUM]=\\n[#NUM_COLS] \{\
15815 .       nr #COL_\\n+[#COL_NUM]_L_MARGIN \\n[#L_MARGIN]+\\n[#COL_TOTAL]
15816 .       nr #COL_TOTAL \\n+[#COL_TOTAL]
15817 .    \}
15818 .    if \\n[#NUM_COLS]=1 \
15819 .       if !\\n[#COLLATE]=1 .MN_INIT
15820 .    rr #COL_TOTAL
15821 .    rr #COL_NUM
15822 .END
15823 \#
15824 \# MARK COL V-POSITION AFTER DOCHEADER
15825 \# -----------------------------------
15826 \# *Arguments:
15827 \#   none
15828 \# *Function:
15829 \#   Sets 1st page dc register.
15830 \# *Notes:
15831 \#   Only required if manual spacing, positive or negative, precedes
15832 \#   start of columns on first page of doc.
15833 \#
15834 .MAC COL_MARK END
15835 .    mk dc
15836 .END
15837 \#
15838 \# NEXT COLUMN
15839 \# -----------
15840 \# *Arguments:
15841 \#   <none>
15842 \# *Function:
15843 \#   Breaks current column and moves to next column.
15844 \#   If current column is the last on the page, breaks
15845 \#   to a new page.
15846 \#
15847 .MAC COL_NEXT END
15848 .    if \\n[#COLUMNS] \{\
15849 .       nr #COL_NEXT 1
15850 .       vpt 0
15851 .       if !'\\$1'internal' \
15852 .          if dPDF.EXPORT \
15853 .             if \\n[#FLEX_ACTIVE] \
15854 .                if !\\n[#NO_FLEX] \
15855 .                   if \\n[#COL_NUM]>1 \
15856 .                      tm .ds page-\\n%@\\n[#COL_NUM] 1
15857 .       ie '\\$0'COL_NEXT' .br
15858 .       el \{\
15859 .          brp
15860 .          RLD 1v
15861 .       \}
15862 .       vpt
15863 .       ie \\n[#COL_NUM]=\\n[#NUM_COLS] .NEWPAGE
15864 .       el .FOOTER
15865 .    \}
15866 .END
15867 \#
15868 \# ====================================================================
15869 \#
15870 \# +++LISTS+++
15871 \#
15872 \# LIST
15873 \# ----
15874 \# *Arguments:
15875 \#   [ BULLET | DASH | DIGIT | alpha | ALPHA | roman | ROMAN | USER ] \
15876 \#   [ <separator> | NONE ] [ <prefix> ] [ <anything> ]
15877 \# *Function:
15878 \#   Stores indent information in effect prior to invocation and
15879 \#   initializes a list with the supplied enumerator (and separator).
15880 \# *Notes:
15881 \#   Default enumerator is a bullet.
15882 \#
15883 \#   Enumerator *must* be supplied for every list that's to the
15884 \#   right of another list, every time, unless the default bullet is
15885 \#   desired.
15886 \#
15887 \#   <anything> moves back one list level intuitively, or exits lists
15888 \#   completely if the level in which it's invoked is the first.
15889 \#
15890 .MAC LIST END
15891 .    br
15892 .    ds $1ST_LETTER \\$1
15893 .    if !'\\*[$1ST_LETTER]'' .substring $1ST_LETTER 0 0
15894 .    if '\\*[$1ST_LETTER]'r' .ds $1ST_LETTER R
15895 .    ie '\\*[$1ST_LETTER]'R' \{\
15896 .       if r #ROMAN_LIST .rr #ROMAN_LIST
15897 .       if '\\$1'ROMAN'  .nr #ROMAN_LIST 1
15898 .       if '\\$1'roman'  .nr #ROMAN_LIST 1
15899 .       ds $LAST_CHAR \\$1
15900 .       substring $LAST_CHAR -1
15901 .       if !\B'\\*[$LAST_CHAR]' \{\
15902 .          if !r #ROMAN_LIST \{\
15903 .             LIST OFF
15904 .             return
15905 .          \}
15906 .          tm1 "[mom]: You must append a number to the '\\$1' argument to \\$0.
15907 .          tm1 "       The number should be the total number of items in this list.
15908 .          tm1 "       See the documentation.
15909 .          ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
15910 .       \}
15911 .       ds $ROMAN_WIDTH \\$1
15912 .          substring $ROMAN_WIDTH 1
15913 .       while !\B'\\*[$ROMAN_WIDTH]' \{\
15914 .          substring $ROMAN_WIDTH 1
15915 .       \}
15916 .       length #ROMAN_LENGTH \\*[$ROMAN_WIDTH]
15917 .       ds $LIST_ARG_1 \\$1
15918 .       substring $LIST_ARG_1 0 -(\\n[#ROMAN_LENGTH]+1)
15919 .    \}
15920 .    el .ds $LIST_ARG_1 \\$1
15921 .    if !r#DEPTH \{\
15922 .       if \\n[#INDENT_ACTIVE] \{\
15923 .          nr #STORED_HL_INDENT \\n[#HL_INDENT]
15924 .          nr #STORED_T_INDENT  \\n[#T_INDENT]
15925 .          if \\n[#INDENT_STYLE_LEFT] \
15926 .             nr #STORED_L_INDENT \\n[#L_INDENT]
15927 .          if \\n[#INDENT_STYLE_RIGHT] \
15928 .             nr #STORED_R_INDENT \\n[#R_INDENT]
15929 .          if \\n[#INDENT_STYLE_BOTH] \{\
15930 .             nr #STORED_BL_INDENT \\n[#BL_INDENT]
15931 .             nr #STORED_BR_INDENT \\n[#BR_INDENT]
15932 .          \}
15933 .       \}
15934 .       nr #CURRENT_L_LENGTH \\n[.l]
15935 .       nr #DEPTH 0 1
15936 .       if \\n[#INDENT_ACTIVE]=1 \{\
15937 .          if \\n[#INDENT_LEFT_ACTIVE]=1 \
15938 .             nr #RESTORE_PREV_INDENT 1
15939 .          if \\n[#INDENT_BOTH_ACTIVE]=1 \{\
15940 .             ie \\n[#DOC_TYPE]=5 .IBX CLEAR
15941 .             el .IBX
15942 .             nr #ORIG_L_LENGTH \\n[.l]
15943 .             IB
15944 .             nr #RESTORE_PREV_INDENT 2
15945 .          \}
15946 .          if \\n[#INDENT_RIGHT_ACTIVE]=1 \{\
15947 .             ie \\n[#DOC_TYPE]=5 .IRX CLEAR
15948 .             el .IRX
15949 .             nr #ORIG_L_LENGTH \\n[.l]
15950 .             IR
15951 .             nr #RESTORE_PREV_INDENT 3
15952 .             if \\n[#INDENT_LEFT_ACTIVE]=1 \
15953 .                nr #RESTORE_PREV_INDENT 4
15954 .          \}
15955 .       \}
15956 .    \}
15957 .    ds pre-list-quad \\*[$QUAD_VALUE]
15958 .    substring pre-list-quad 0 0
15959 .    if '\\*[pre-list-quad]'C' \{\
15960 .       if !'\\n[.z]'LIST*DIV' \{\
15961 .          nr #PRE_LIST_QUAD \\n[.j]
15962 .          nr #LIST_CENTER 1
15963 .          if !'\\n[.z]'LIST*DIV' .di LIST*DIV
15964 \!.        nr #IN_LIST 1
15965 .          ad l
15966 .       \}
15967 .    \}
15968 .    if '\\*[pre-list-quad]'R' \{\
15969 .       if !'\\n[.z]'LIST*DIV' \{\
15970 .          nr #PRE_LIST_QUAD \\n[.j]
15971 .          nr #LIST_RIGHT 1
15972 .          if !'\\n[.z]'LIST*DIV' .di LIST*DIV
15973 \!.        nr #IN_LIST 1
15974 .          ad l
15975 .       \}
15976 .    \}
15977 .    ie \\n[#NUM_ARGS]=0 \{\
15978 .       nr #ARGS_TO_LIST 1 \" So default behaves as if LIST BULLET
15979 .       ds $ENUMERATOR\\n+[#DEPTH] \[bu]
15980 .       ds $ENUMERATOR_TYPE\\n[#DEPTH] other
15981 .       ds $SEPARATOR
15982 .       ds $PREFIX
15983 .       ds $SEPARATOR\\n[#DEPTH]
15984 .       ds $PREFIX\\n[#DEPTH]
15985 .    \}
15986 .    el \{\
15987 .       rr #ARGS_TO_LIST \" Clear this before processing arg 1.
15988 .       if '\\*[$LIST_ARG_1]'DASH' \{\
15989 .          nr #ARGS_TO_LIST 1
15990 .          ds $ENUMERATOR\\n+[#DEPTH] \[en]
15991 .          ds $ENUMERATOR_TYPE\\n[#DEPTH] other
15992 .          ds $SEPARATOR\\n[#DEPTH]
15993 .          ds $PREFIX\\n[#DEPTH]
15994 .       \}
15995 .       if '\\*[$LIST_ARG_1]'BULLET' \{\
15996 .          nr #ARGS_TO_LIST 1
15997 .          ds $ENUMERATOR\\n+[#DEPTH] \[bu]
15998 .          ds $ENUMERATOR_TYPE\\n[#DEPTH] other
15999 .          ds $SEPARATOR\\n[#DEPTH]
16000 .          ds $PREFIX\\n[#DEPTH]
16001 .       \}
16002 .       if '\\*[$LIST_ARG_1]'DIGIT' \{\
16003 .          nr #ARGS_TO_LIST 1
16004 .          nr #ENUMERATOR\\n+[#DEPTH] 0 1
16005 .          ds $ENUMERATOR_TYPE\\n[#DEPTH] register
16006 .          ds $SEPARATOR\\n[#DEPTH] .
16007 .          ds $PREFIX\\n[#DEPTH]
16008 .          if \\n[#NUM_ARGS]>=2 \{\
16009 .             ie '\\$2'NONE' .ds $SEPARATOR\\n[#DEPTH]
16010 .             el .ds $SEPARATOR\\n[#DEPTH] \\$2
16011 .             if \\n[#NUM_ARGS]=3 .ds $PREFIX\\n[#DEPTH] \\$3
16012 .          \}
16013 .       \}
16014 .       if '\\*[$LIST_ARG_1]'alpha' \{\
16015 .          nr #ARGS_TO_LIST 1
16016 .          nr #ENUMERATOR\\n+[#DEPTH] 0 1
16017 .          af #ENUMERATOR\\n[#DEPTH] a
16018 .          ds $ENUMERATOR_TYPE\\n[#DEPTH] register
16019 .          ds $SEPARATOR\\n[#DEPTH] )
16020 .          ds $PREFIX\\n[#DEPTH]
16021 .          if \\n[#NUM_ARGS]>=2 \{\
16022 .             ie '\\$2'NONE' .ds $SEPARATOR\\n[#DEPTH]
16023 .             el .ds $SEPARATOR\\n[#DEPTH] \\$2
16024 .             if \\n[#NUM_ARGS]=3 .ds $PREFIX\\n[#DEPTH] \\$3
16025 .          \}
16026 .       \}
16027 .       if '\\*[$LIST_ARG_1]'ALPHA' \{\
16028 .          nr #ARGS_TO_LIST 1
16029 .          nr #ENUMERATOR\\n+[#DEPTH] 0 1
16030 .          af #ENUMERATOR\\n[#DEPTH] A
16031 .          ds $ENUMERATOR_TYPE\\n[#DEPTH] register
16032 .          ds $SEPARATOR\\n[#DEPTH] )
16033 .          ds $PREFIX\\n[#DEPTH]
16034 .          if \\n[#NUM_ARGS]>=2 \{\
16035 .             ie '\\$2'NONE' .ds $SEPARATOR\\n[#DEPTH]
16036 .             el .ds $SEPARATOR\\n[#DEPTH] \\$2
16037 .             if \\n[#NUM_ARGS]=3 \
16038 .                ds $PREFIX\\n[#DEPTH] \\$3
16039 .          \}
16040 .       \}
16041 .       if '\\*[$1ST_LETTER]'R' \{\
16042 .          nr #ARGS_TO_LIST 1
16043 .          nr #ENUMERATOR\\n+[#DEPTH] 0 1
16044 .          if '\\*[$LIST_ARG_1]'roman' .af #ENUMERATOR\\n[#DEPTH] i
16045 .          if '\\*[$LIST_ARG_1]'ROMAN' .af #ENUMERATOR\\n[#DEPTH] I
16046 .          ds $ENUMERATOR_TYPE\\n[#DEPTH] roman
16047 .          ds $SEPARATOR\\n[#DEPTH] )
16048 .          ds $PREFIX\\n[#DEPTH]
16049 .          if \\n[#NUM_ARGS]>=2 \{\
16050 .             ie '\\$2'NONE' .ds $SEPARATOR\\n[#DEPTH]
16051 .             el .ds $SEPARATOR\\n[#DEPTH] \\$2
16052 .             if \\n[#NUM_ARGS]=3 .ds $PREFIX\\n[#DEPTH] \\$3
16053 .          \}
16054 .       \}
16055 .       if '\\*[$LIST_ARG_1]'USER' \{\
16056 .          nr #ARGS_TO_LIST 1
16057 .          ds $ENUMERATOR\\n+[#DEPTH] \\$2
16058 .          ds $ENUMERATOR_TYPE\\n[#DEPTH] other
16059 .          ds $SEPARATOR\\n[#DEPTH]
16060 .          ds $PREFIX\\n[#DEPTH]
16061 .       \}
16062 .       if '\\*[$LIST_ARG_1]'VARIABLE' \{\
16063 .          if \\n[#NUM_ARGS]<2 \{\
16064 .             tm1 "[mom]: You must follow the \\$1 argument to \\$0 with the widest
16065 .             tm1 "       enumerator to be used.  See the documentation.
16066 .             ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
16067 .          \}
16068 .          nr #ARGS_TO_LIST 1
16069 .          ds $ENUMERATOR\\n+[#DEPTH]
16070 .          ds $ENUMERATOR_TYPE\\n[#DEPTH] variable
16071 .          ds $ENUMERATOR_WIDTH\\n[#DEPTH] \w'\\$2\ '
16072 .          ds $SEPARATOR\\n[#DEPTH]
16073 .          ds $PREFIX\\n[#DEPTH]
16074 .       \}
16075 .       if '\\*[$LIST_ARG_1]'PLAIN' \{\
16076 .          nr #ARGS_TO_LIST 1
16077 .          ds $ENUMERATOR\\n+[#DEPTH]
16078 .          ds $ENUMERATOR_TYPE\\n[#DEPTH] plain
16079 .          ds $SEPARATOR\\n[#DEPTH]
16080 .          ds $PREFIX\\n[#DEPTH]
16081 .       \}
16082 .       if \\n[#NUM_ARGS]=1 \{\
16083 .          if !r#ARGS_TO_LIST \{\
16084 .             ie \\n[#DEPTH]=1 \{\
16085 .                ie \\n[#NEXT_DEPTH_BACK]=0 \{\
16086 .                   SET_LIST_INDENT
16087 .                   if \\n[#QUIT]=1 \{\
16088 .                      QUIT_LISTS
16089 .                      return
16090 .                   \}
16091 .                   return
16092 .                \}
16093 .                el \{\
16094 .                   QUIT_LISTS
16095 .                   return
16096 .                \}
16097 .             \}
16098 .             el \{\
16099 .                SET_LIST_INDENT
16100 .                return
16101 .             \}
16102 .          \}
16103 .       \}
16104 .    \}
16105 .    nr #TOTAL_LISTS \\n[#DEPTH]
16106 .    if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'register' \{\
16107 .       nr #LIST_INDENT\\n[#DEPTH] \
16108 \w'\\*[$PREFIX\\n[#DEPTH]]m\\*[$SEPARATOR\\n[#DEPTH]]\ '
16109 .       if '\\*[$LIST_ARG_1]'ALPHA' .nr #LIST_INDENT\\n[#DEPTH] \
16110 \w'\\*[$PREFIX\\n[#DEPTH]]M\\*[$SEPARATOR\\n[#DEPTH]]\ '
16111 .    \}
16112 .    if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'roman' \
16113 .       GET_ROMAN_INDENT
16114 .    if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'other' \
16115 .       nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$ENUMERATOR\\n[#DEPTH]]\ '
16116 .    if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'variable' \
16117 .       nr #LIST_INDENT\\n[#DEPTH] \\*[$ENUMERATOR_WIDTH\\n[#DEPTH]]
16118 .    ll \\n[#CURRENT_L_LENGTH]u
16119 .    ie \\n[#DEPTH]=1 \{\
16120 .       ie \\n[#INDENT_ACTIVE]=1 \{\
16121 .          if \\n[#INDENT_STYLE_LEFT]=1 \{\
16122 .             if \\n[#L_INDENT_ILX] \{\
16123 .                rr #L_INDENT 
16124 .                rr #L_INDENT_ILX
16125 .             \}
16126 .             nr #L_INDENT \\n[#L_INDENT]+\\n[#LIST_INDENT\\n[#DEPTH]]
16127 .             nr #HL_INDENT\\n[#DEPTH] \\n[#LIST_INDENT\\n[#DEPTH]]
16128 .             nr #LIST_INDENT\\n[#DEPTH] \\n[#L_INDENT]
16129 .          \}
16130 .          if \\n[#INDENT_BOTH_ACTIVE]=1 \{\
16131 .             nr #L_INDENT \\n[#BL_INDENT]+\\n[#LIST_INDENT\\n[#DEPTH]]
16132 .             nr #HL_INDENT\\n[#DEPTH] \\n[#LIST_INDENT\\n[#DEPTH]]
16133 .             nr #LIST_INDENT\\n[#DEPTH] \\n[#L_INDENT]
16134 .          \}
16135 .          if \\n[#INDENT_RIGHT_ACTIVE]=1 \{\
16136 .             ie \\n[#INDENT_LEFT_ACTIVE]=1 \{\
16137 .             \" Don't do anything; we already have a left indent
16138 .             \}
16139 .             el \{\
16140 .                nr #L_INDENT +\\n[#LIST_INDENT\\n[#DEPTH]]
16141 .                nr #HL_INDENT\\n[#DEPTH] \\n[#LIST_INDENT\\n[#DEPTH]]
16142 .             \}
16143 .          \}
16144 .       \}
16145 .       el \{\
16146 .          nr #L_INDENT +\\n[#LIST_INDENT\\n[#DEPTH]]
16147 .          nr #HL_INDENT\\n[#DEPTH] \\n[#LIST_INDENT\\n[#DEPTH]]
16148 .       \}
16149 .    \}
16150 .    el \{\
16151 .       nr #L_INDENT +\\n[#LIST_INDENT\\n[#DEPTH]]
16152 .       nr #HL_INDENT\\n[#DEPTH] \\n[#LIST_INDENT\\n[#DEPTH]]
16153 .    \}
16154 .END
16155 \#
16156 \# ITEM
16157 \# ----
16158 \# *Arguments:
16159 \#   <none> | <space before item>
16160 \# *Function:
16161 \#   Prints enumerator for a given list depth and prepares mom to
16162 \#   receive the text of an item.
16163 \#
16164 .MAC ITEM END
16165 .    ie \\n[#NUM_ARGS]=2 .sp \\$2
16166 .    el \
16167 .       if \B'\\$1' .sp \\$1
16168 .    if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'plain' .nop 
16169 .    if !r#DEPTH .return
16170 .    if \\n[#LINENUMBERS]=1 \{\
16171 .       NUMBER_LINES OFF
16172 .       nr #LINENUMBERS 2
16173 .    \}
16174 .    if \\n[#KERN]=1 \{\
16175 .       nr #KERN_WAS_ON 1
16176 .       KERN OFF
16177 .    \}
16178 .    rr #IN_ITEM
16179 .    IL
16180 .    nr #IN_ITEM 1
16181 .    ll \\n[#CURRENT_L_LENGTH]u \" Set ll again because IL turns IB off.
16182 .    ie !'\\n[.z]'' \!.TRAP OFF
16183 .    el .TRAP OFF
16184 .    HI \\n[#HL_INDENT\\n[#DEPTH]]u
16185 .    if '\\*[$SEPARATOR\\n[#DEPTH]]')' .nr #SEP_TYPE 1
16186 .    if '\\*[$SEPARATOR\\n[#DEPTH]]']' .nr #SEP_TYPE 1
16187 .    if '\\*[$SEPARATOR\\n[#DEPTH]]'}' .nr #SEP_TYPE 1
16188 .    ie \\n[#IN_BIB_LIST]=1 \{\
16189 .       ie \\n[#ENUMERATOR\\n[#DEPTH]]<9 \{\
16190 .          ie \\n[#SEP_TYPE]=1 .PRINT \
16191 \v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\
16192 \\n+[#ENUMERATOR\\n[#DEPTH]]\v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
16193 .          el .PRINT \
16194 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16195 .       \}
16196 .       el \{\
16197 .          ie \\n[#SEP_TYPE]=1 .PRINT \
16198 \h'-\w'\0'u'\v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\
16199 \\n+[#ENUMERATOR\\n[#DEPTH]]\v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
16200 .          el .PRINT \
16201 \h'-\w'\0'u'\
16202 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16203 .       \}
16204 .    \}
16205 .    el \{\
16206 .       ie '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'register' \{\
16207 .\" DIGIT
16208 .          ie '\\g[#ENUMERATOR\\n[#DEPTH]]'0' \{\
16209 .             ie \\n[#PAD_LIST_DIGITS\\n[#DEPTH]]=1 \{\
16210 .                ie \\n[#ENUMERATOR\\n[#DEPTH]]<9 \{\
16211 .                   ie \\n[#SEP_TYPE]=1 .PRINT \
16212 \0\v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\\n+[#ENUMERATOR\\n[#DEPTH]]\
16213 \v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
16214 .                   el .PRINT \
16215 \0\\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16216 .                \}
16217 .                el \{\
16218 .                   ie \\n[#SEP_TYPE]=1 .PRINT \
16219 \v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\\n+[#ENUMERATOR\\n[#DEPTH]]\
16220 \v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
16221 .                   el .PRINT \
16222 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16223 .                \}
16224 .             \}
16225 .             el \{\
16226 .                ie \\n[#SEP_TYPE]=1 .PRINT \
16227 \v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\\n+[#ENUMERATOR\\n[#DEPTH]]\
16228 \v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
16229 .                el .PRINT \
16230 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16231 .             \}
16232 .          \}
16233 .          el \{\
16234 .\" ALPHA
16235 .             ie '\\g[#ENUMERATOR\\n[#DEPTH]]'A' \{\
16236 .                ie \\n[#SEP_TYPE]=1 .PRINT \
16237 \v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\\n+[#ENUMERATOR\\n[#DEPTH]]\
16238 \v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
16239 .                el .PRINT \
16240 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16241 .             \}
16242 .\" alpha
16243 .             el .PRINT \
16244 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16245 .          \}
16246 .       \}
16247 .       if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'roman' \{\
16248 .          ie \\n[#PAD_LIST_DIGITS\\n[#DEPTH]]=1 \{\
16249 .\" ROMAN I, padded
16250 .             ie '\\g[#ENUMERATOR\\n[#DEPTH]]'I' \{\
16251 .                ie \\n[#SEP_TYPE]=1 .PRINT \
16252 \h'\\n[#HL_INDENT\\n[#DEPTH]]u'\h'-\w'\\*[$PREFIX\\n[#DEPTH]]\
16253 \\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]\0'u'\
16254 \v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\\n[#ENUMERATOR\\n[#DEPTH]]\
16255 \v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
16256 .                el .PRINT \
16257 \h'\\n[#HL_INDENT\\n[#DEPTH]]u'\h'-\w'\\*[$PREFIX\\n[#DEPTH]]\
16258 \\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]\
16259 \0'u'\\*[$PREFIX\\n[#DEPTH]]\\n[#ENUMERATOR\\n[#DEPTH]]\
16260 \\*[$SEPARATOR\\n[#DEPTH]]
16261 .             \}
16262 .\" roman i, padded
16263 .             el .PRINT \
16264 \h'\\n[#HL_INDENT\\n[#DEPTH]]u'\h'-\w'\\*[$PREFIX\\n[#DEPTH]]\
16265 \\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]\0'u'\
16266 \\*[$PREFIX\\n[#DEPTH]]\\n[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16267 .          \}
16268 .\" No pad
16269 .          el \{\
16270 .\" ROMAN I, no pad
16271 .             ie '\\g[#ENUMERATOR\\n[#DEPTH]]'I' \{\
16272 .                ie \\n[#SEP_TYPE]=1 .PRINT \
16273 \v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\\n+[#ENUMERATOR\\n[#DEPTH]]\
16274 \v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
16275 .                el .PRINT \
16276 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16277 .             \}
16278 .\" roman i, no pad
16279 .             el .PRINT \
16280 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16281 .          \}
16282 .       \}
16283 .       if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'other' \
16284 .          PRINT \\*[$ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16285 .       if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'variable' \
16286 .          PRINT  \\$1
16287 .    \}
16288 .    rr #SEP_TYPE
16289 .    EOL
16290 .    if \\n[#REF]=1 \{\
16291 .       IL +\\n[#REF_BIB_INDENT]u
16292 .       ti \\n[#L_INDENT]u-\\n[#REF_BIB_INDENT]u
16293 .    \}
16294 .    ie !'\\n[.z]'' \!.TRAP
16295 .    el .TRAP
16296 .    if \\n[#KERN_WAS_ON]=1 \{\
16297 .       KERN
16298 .       rr #KERN_WAS_ON
16299 .    \}
16300 .    if \\n[#LINENUMBERS]=2 \{\
16301 .       NUMBER_LINES RESUME
16302 .       nr #LINENUMBERS 1
16303 .    \}
16304 .END
16305 \#
16306 \# A utility macro that determines the space to reserve for
16307 \# roman numeral enumerated lists.  Limit is 20 roman numerals
16308 \# per list.  If this isn't enough, the user can add to the
16309 \# macro.
16310 \#
16311 .MAC GET_ROMAN_INDENT END
16312 .    if '\\*[$LIST_ARG_1]'roman' \{\
16313 .       if '\\*[$ROMAN_WIDTH]'1' \{\
16314 .          ds $ROMAN_WIDTH\\n[#DEPTH] 1
16315 .          nr #LIST_INDENT\\n[#DEPTH] \
16316 \w'\\*[$PREFIX\\n[#DEPTH]]i\\*[$SEPARATOR\\n[#DEPTH]]\0'
16317 .       \}
16318 .       if '\\*[$ROMAN_WIDTH]'2' \{\
16319 .          ds $ROMAN_WIDTH\\n[#DEPTH] 2
16320 .          nr #LIST_INDENT\\n[#DEPTH] \
16321 \w'\\*[$PREFIX\\n[#DEPTH]]ii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16322 .       \}
16323 .       if '\\*[$ROMAN_WIDTH]'3' \{\
16324 .          ds $ROMAN_WIDTH\\n[#DEPTH] 3
16325 .          nr #LIST_INDENT\\n[#DEPTH] \
16326 \w'\\*[$PREFIX\\n[#DEPTH]]iii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16327 .       \}
16328 .       if '\\*[$ROMAN_WIDTH]'4' \{\
16329 .          ds $ROMAN_WIDTH\\n[#DEPTH] 4
16330 .          nr #LIST_INDENT\\n[#DEPTH] \
16331 \w'\\*[$PREFIX\\n[#DEPTH]]iii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16332 .       \}
16333 .       if '\\*[$ROMAN_WIDTH]'5' \{\
16334 .          ds $ROMAN_WIDTH\\n[#DEPTH] 5
16335 .          nr #LIST_INDENT\\n[#DEPTH] \
16336 \w'\\*[$PREFIX\\n[#DEPTH]]iii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16337 .       \}
16338 .       if '\\*[$ROMAN_WIDTH]'6' \{\
16339 .          ds $ROMAN_WIDTH\\n[#DEPTH] 6
16340 .          nr #LIST_INDENT\\n[#DEPTH] \
16341 \w'\\*[$PREFIX\\n[#DEPTH]]iii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16342 .       \}
16343 .       if '\\*[$ROMAN_WIDTH]'7' \{\
16344 .          ds $ROMAN_WIDTH\\n[#DEPTH] 7
16345 .          nr #LIST_INDENT\\n[#DEPTH] \
16346 \w'\\*[$PREFIX\\n[#DEPTH]]vii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16347 .       \}
16348 .       if '\\*[$ROMAN_WIDTH]'8' \{\
16349 .          ds $ROMAN_WIDTH\\n[#DEPTH] 8
16350 .          nr #LIST_INDENT\\n[#DEPTH] \
16351 \w'\\*[$PREFIX\\n[#DEPTH]]viii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16352 .       \}
16353 .       if '\\*[$ROMAN_WIDTH]'9' \{\
16354 .          ds $ROMAN_WIDTH\\n[#DEPTH] 9
16355 .          nr #LIST_INDENT\\n[#DEPTH] \
16356 \w'\\*[$PREFIX\\n[#DEPTH]]viii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16357 .       \}
16358 .       if '\\*[$ROMAN_WIDTH]'10' \{\
16359 .          ds $ROMAN_WIDTH\\n[#DEPTH] 10
16360 .          nr #LIST_INDENT\\n[#DEPTH] \
16361 \w'\\*[$PREFIX\\n[#DEPTH]]viii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16362 .       \}
16363 .       if '\\*[$ROMAN_WIDTH]'11' \{\
16364 .          ds $ROMAN_WIDTH\\n[#DEPTH] 11
16365 .          nr #LIST_INDENT\\n[#DEPTH] \
16366 \w'\\*[$PREFIX\\n[#DEPTH]]viii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16367 .       \}
16368 .       if '\\*[$ROMAN_WIDTH]'12' \{\
16369 .          ds $ROMAN_WIDTH\\n[#DEPTH] 12
16370 .          nr #LIST_INDENT\\n[#DEPTH] \
16371 \w'\\*[$PREFIX\\n[#DEPTH]]viii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16372 .       \}
16373 .       if '\\*[$ROMAN_WIDTH]'13' \{\
16374 .          ds $ROMAN_WIDTH\\n[#DEPTH] 13
16375 .          nr #LIST_INDENT\\n[#DEPTH] \
16376 \w'\\*[$PREFIX\\n[#DEPTH]]xiii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16377 .       \}
16378 .       if '\\*[$ROMAN_WIDTH]'14' \{\
16379 .          ds $ROMAN_WIDTH\\n[#DEPTH] 14
16380 .          nr #LIST_INDENT\\n[#DEPTH] \
16381 \w'\\*[$PREFIX\\n[#DEPTH]]xiii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16382 .       \}
16383 .       if '\\*[$ROMAN_WIDTH]'15' \{\
16384 .          ds $ROMAN_WIDTH\\n[#DEPTH] 15
16385 .          nr #LIST_INDENT\\n[#DEPTH] \
16386 \w'\\*[$PREFIX\\n[#DEPTH]]xiii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16387 .       \}
16388 .       if '\\*[$ROMAN_WIDTH]'16' \{\
16389 .          ds $ROMAN_WIDTH\\n[#DEPTH] 16
16390 .          nr #LIST_INDENT\\n[#DEPTH] \
16391 \w'\\*[$PREFIX\\n[#DEPTH]]xiii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16392 .       \}
16393 .       if '\\*[$ROMAN_WIDTH]'17' \{\
16394 .          ds $ROMAN_WIDTH\\n[#DEPTH] 17
16395 .          nr #LIST_INDENT\\n[#DEPTH] \
16396 \w'\\*[$PREFIX\\n[#DEPTH]]xvii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16397 .       \}
16398 .       if '\\*[$ROMAN_WIDTH]'18' \{\
16399 .          ds $ROMAN_WIDTH\\n[#DEPTH] 18
16400 .          nr #LIST_INDENT\\n[#DEPTH] \
16401 \w'\\*[$PREFIX\\n[#DEPTH]]xviii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16402 .       \}
16403 .       if '\\*[$ROMAN_WIDTH]'19' \{\
16404 .          ds $ROMAN_WIDTH\\n[#DEPTH] 19
16405 .          nr #LIST_INDENT\\n[#DEPTH] \
16406 \w'\\*[$PREFIX\\n[#DEPTH]]xviii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16407 .       \}
16408 .       if '\\*[$ROMAN_WIDTH]'20' \{\
16409 .          ds $ROMAN_WIDTH\\n[#DEPTH] 20
16410 .          nr #LIST_INDENT\\n[#DEPTH] \
16411 \w'\\*[$PREFIX\\n[#DEPTH]]xviii\\*[$SEPARATOR\\n[#DEPTH]]\0'
16412 .       \}
16413 .    \}
16414 .    if '\\*[$LIST_ARG_1]'ROMAN' \{\
16415 .       if '\\*[$ROMAN_WIDTH]'1' \{\
16416 .          ds $ROMAN_WIDTH\\n[#DEPTH] 1
16417 .          nr #LIST_INDENT\\n[#DEPTH] \
16418 \w'\\*[$PREFIX\\n[#DEPTH]]I\\*[$SEPARATOR\\n[#DEPTH]]\0'
16419 .       \}
16420 .       if '\\*[$ROMAN_WIDTH]'2' \{\
16421 .          ds $ROMAN_WIDTH\\n[#DEPTH] 2
16422 .          nr #LIST_INDENT\\n[#DEPTH] \
16423 \w'\\*[$PREFIX\\n[#DEPTH]]II\\*[$SEPARATOR\\n[#DEPTH]]\0'
16424 .       \}
16425 .       if '\\*[$ROMAN_WIDTH]'3' \{\
16426 .          ds $ROMAN_WIDTH\\n[#DEPTH] 3
16427 .          nr #LIST_INDENT\\n[#DEPTH] \
16428 \w'\\*[$PREFIX\\n[#DEPTH]]III\\*[$SEPARATOR\\n[#DEPTH]]\0'
16429 .       \}
16430 .       if '\\*[$ROMAN_WIDTH]'4' \{\
16431 .          ds $ROMAN_WIDTH\\n[#DEPTH] 4
16432 .          nr #LIST_INDENT\\n[#DEPTH] \
16433 \w'\\*[$PREFIX\\n[#DEPTH]]IV\\*[$SEPARATOR\\n[#DEPTH]]\0'
16434 .       \}
16435 .       if '\\*[$ROMAN_WIDTH]'5' \{\
16436 .          ds $ROMAN_WIDTH\\n[#DEPTH] 5
16437 .          nr #LIST_INDENT\\n[#DEPTH] \
16438 \w'\\*[$PREFIX\\n[#DEPTH]]IV\\*[$SEPARATOR\\n[#DEPTH]]\0'
16439 .       \}
16440 .       if '\\*[$ROMAN_WIDTH]'6' \{\
16441 .          ds $ROMAN_WIDTH\\n[#DEPTH] 6
16442 .          nr #LIST_INDENT\\n[#DEPTH] \
16443 \w'\\*[$PREFIX\\n[#DEPTH]]IV\\*[$SEPARATOR\\n[#DEPTH]]\0'
16444 .       \}
16445 .       if '\\*[$ROMAN_WIDTH]'7' \{\
16446 .          ds $ROMAN_WIDTH\\n[#DEPTH] 7
16447 .          nr #LIST_INDENT\\n[#DEPTH] \
16448 \w'\\*[$PREFIX\\n[#DEPTH]]VII\\*[$SEPARATOR\\n[#DEPTH]]\0'
16449 .       \}
16450 .       if '\\*[$ROMAN_WIDTH]'8' \{\
16451 .          ds $ROMAN_WIDTH\\n[#DEPTH] 8
16452 .          nr #LIST_INDENT\\n[#DEPTH] \
16453 \w'\\*[$PREFIX\\n[#DEPTH]]VIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
16454 .       \}
16455 .       if '\\*[$ROMAN_WIDTH]'9' \{\
16456 .          ds $ROMAN_WIDTH\\n[#DEPTH] 9
16457 .          nr #LIST_INDENT\\n[#DEPTH] \
16458 \w'\\*[$PREFIX\\n[#DEPTH]]VIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
16459 .       \}
16460 .       if '\\*[$ROMAN_WIDTH]'10' \{\
16461 .          ds $ROMAN_WIDTH\\n[#DEPTH] 10
16462 .          nr #LIST_INDENT\\n[#DEPTH] \
16463 \w'\\*[$PREFIX\\n[#DEPTH]]VIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
16464 .       \}
16465 .       if '\\*[$ROMAN_WIDTH]'11' \{\
16466 .          ds $ROMAN_WIDTH\\n[#DEPTH] 11
16467 .          nr #LIST_INDENT\\n[#DEPTH] \
16468 \w'\\*[$PREFIX\\n[#DEPTH]]VIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
16469 .       \}
16470 .       if '\\*[$ROMAN_WIDTH]'12' \{\
16471 .          ds $ROMAN_WIDTH\\n[#DEPTH] 12
16472 .          nr #LIST_INDENT\\n[#DEPTH] \
16473 \w'\\*[$PREFIX\\n[#DEPTH]]VIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
16474 .       \}
16475 .       if '\\*[$ROMAN_WIDTH]'13' \{\
16476 .          ds $ROMAN_WIDTH\\n[#DEPTH] 13
16477 .          nr #LIST_INDENT\\n[#DEPTH] \
16478 \w'\\*[$PREFIX\\n[#DEPTH]]XIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
16479 .       \}
16480 .       if '\\*[$ROMAN_WIDTH]'14' \{\
16481 .          ds $ROMAN_WIDTH\\n[#DEPTH] 14
16482 .          nr #LIST_INDENT\\n[#DEPTH] \
16483 \w'\\*[$PREFIX\\n[#DEPTH]]XIV\\*[$SEPARATOR\\n[#DEPTH]]\0'
16484 .       \}
16485 .       if '\\*[$ROMAN_WIDTH]'15' \{\
16486 .          ds $ROMAN_WIDTH\\n[#DEPTH] 15
16487 .          nr #LIST_INDENT\\n[#DEPTH] \
16488 \w'\\*[$PREFIX\\n[#DEPTH]]XIV\\*[$SEPARATOR\\n[#DEPTH]]\0'
16489 .       \}
16490 .       if '\\*[$ROMAN_WIDTH]'16' \{\
16491 .          ds $ROMAN_WIDTH\\n[#DEPTH] 16
16492 .          nr #LIST_INDENT\\n[#DEPTH] \
16493 \w'\\*[$PREFIX\\n[#DEPTH]]XIV\\*[$SEPARATOR\\n[#DEPTH]]\0'
16494 .       \}
16495 .       if '\\*[$ROMAN_WIDTH]'17' \{\
16496 .          ds $ROMAN_WIDTH\\n[#DEPTH] 17
16497 .          nr #LIST_INDENT\\n[#DEPTH] \
16498 \w'\\*[$PREFIX\\n[#DEPTH]]XVII\\*[$SEPARATOR\\n[#DEPTH]]\0'
16499 .       \}
16500 .       if '\\*[$ROMAN_WIDTH]'18' \{\
16501 .          ds $ROMAN_WIDTH\\n[#DEPTH] 18
16502 .          nr #LIST_INDENT\\n[#DEPTH] \
16503 \w'\\*[$PREFIX\\n[#DEPTH]]XVIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
16504 .       \}
16505 .       if '\\*[$ROMAN_WIDTH]'19' \{\
16506 .          ds $ROMAN_WIDTH\\n[#DEPTH] 19
16507 .          nr #LIST_INDENT\\n[#DEPTH] \
16508 \w'\\*[$PREFIX\\n[#DEPTH]]XVIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
16509 .       \}
16510 .       if '\\*[$ROMAN_WIDTH]'20' \{\
16511 .          ds $ROMAN_WIDTH\\n[#DEPTH] 20
16512 .          nr #LIST_INDENT\\n[#DEPTH] \
16513 \w'\\*[$PREFIX\\n[#DEPTH]]XVIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
16514 .       \}
16515 .    \}
16516 .END
16517 \#
16518 \# SHIFT LIST
16519 \# ----------
16520 \# *Arguments:
16521 \#   <amount by which to indent a list to the right>
16522 \# *Function:
16523 \#   Adds the value of the arg to the current list's indent.
16524 \# *Notes:
16525 \#   Requires a unit of measure.
16526 \#
16527 .MAC SHIFT_LIST END
16528 .    nr #SHIFT_LIST\\n[#DEPTH] (\\$1)
16529 .    nr #L_INDENT +\\n[#SHIFT_LIST\\n[#DEPTH]]
16530 .END
16531 \#
16532 \# PAD LIST DIGITS
16533 \# ---------------
16534 \# *Arguments:
16535 \#   [ LEFT ]
16536 \# *Function:
16537 \#   Adds a figure space to a list's hanging and left indent.  If
16538 \#   LEFT is given, sets reg. #PAD_LIST_DIGITS to 1 for use in ITEM.
16539 \#
16540 .MAC PAD_LIST_DIGITS END
16541 .    if '\\g[#ENUMERATOR\\n[#DEPTH]]'0' \{\
16542 .       nr #LIST_INDENT\\n[#DEPTH] +\\w'\\0'
16543 .       nr #L_INDENT \\n[#LIST_INDENT\\n[#DEPTH]]+\\n[#LIST_INDENT\\n-[#DEPTH]]
16544 .       nr #HL_INDENT\\n+[#DEPTH] +\\w'\\n[#ENUMERATOR\\n[#DEPTH]]'
16545 .       if '\\$1'LEFT' .nr #PAD_LIST_DIGITS\\n[#DEPTH] 1
16546 .    \}
16547 .    if '\\g[#ENUMERATOR\\n[#DEPTH]]'i' \
16548 .       if '\\$1'LEFT' .nr #PAD_LIST_DIGITS\\n[#DEPTH] 1
16549 .    if '\\g[#ENUMERATOR\\n[#DEPTH]]'I' \
16550 .       if '\\$1'LEFT' .nr #PAD_LIST_DIGITS\\n[#DEPTH] 1
16551 .END
16552 \#
16553 \# RESET LIST
16554 \# ----------
16555 \# *Arguments:
16556 \#   none
16557 \# *Function:
16558 \#   Resets register enumerators to 1 or a.
16559 \#
16560 .MAC RESET_LIST END
16561 .    ie '\\$1'' .nr #ENUMERATOR\\n[#DEPTH] 0 1
16562 .    el .nr #ENUMERATOR\\n[#DEPTH] \\$1-1 1
16563 .END
16564 \#
16565 \# QUIT LISTS
16566 \# ----------
16567 \# *Arguments:
16568 \#   none
16569 \# *Function:
16570 \#   Exits lists cleanly and restores any indents that were in
16571 \#   effect prior to LIST.
16572 \#
16573 .MAC QUIT_LISTS END
16574 .   br
16575 .   if '\\n[.z]'LIST*DIV' \{\
16576 \!.    rr #IN_LIST
16577 .      di
16578 .   \}
16579 .   IQ CLEAR
16580 .   nr #HL_INDENT \\n[#STORED_HL_INDENT]
16581 .   nr #T_INDENT  \\n[#STORED_T_INDENT]
16582 .   nr #L_INDENT  \\n[#STORED_L_INDENT]
16583 .   nr #R_INDENT \\n[#STORED_R_INDENT]
16584 .   nr #BL_INDENT \\n[#STORED_BL_INDENT]
16585 .   nr #BR_INDENT \\n[#STORED_BR_INDENT]
16586 .   rr #STORED_HL_INDENT
16587 .   if \\n[#LIST_CENTER] \
16588 .      nr #LIST_OFFSET_VALUE \\n[.l]-\\n[dl]/2
16589 .   if \\n[#LIST_RIGHT] \
16590 .      nr #LIST_OFFSET_VALUE \\n[.l]-\\n[dl]
16591 .   po +\\n[#LIST_OFFSET_VALUE]u
16592 .   if \\n[.u] .nr #FILLED 1
16593 .   nf
16594 .   if dLIST*DIV \{\
16595 .      LIST*DIV
16596 .      rm LIST*DIV
16597 .   \}
16598 .   if \\n[#FILLED] .fi
16599 .   if !\\n[#PRE_LIST_QUAD]=\\n[.j] .ad \\n[#PRE_LIST_QUAD]
16600 .   rr #FILLED
16601 .   po
16602 .   rr #PRE_LIST_QUAD
16603 .   if \\n[#RESTORE_PREV_INDENT]=1 \
16604 .      IL
16605 .   if \\n[#RESTORE_PREV_INDENT]=2 \{\
16606 .      ll \\n[#ORIG_L_LENGTH]u
16607 .      IB
16608 .   \}
16609 .   if \\n[#RESTORE_PREV_INDENT]=3 \{\
16610 .      ll \\n[#ORIG_L_LENGTH]u
16611 .      IR
16612 .   \}
16613 .   if \\n[#RESTORE_PREV_INDENT]=4 \{\
16614 .      nr #R_INDENT \\n[#STORED_R_INDENT]
16615 .      nr #L_INDENT \\n[#STORED_L_INDENT]
16616 .      ll \\n[#ORIG_L_LENGTH]u
16617 .      IR
16618 .      IL
16619 .   \}
16620 .\" Clean up after exiting last depth of list
16621 .   nr #REMOVE 0 1
16622 .   while \\n+[#REMOVE]<=\\n[#TOTAL_LISTS] \{\
16623 .      rr #LIST_INDENT\\n[#REMOVE]
16624 .      rr #ENUMERATOR\\n[#REMOVE]
16625 .      rm $ENUMERATOR\\n[#REMOVE]
16626 .      rm $SEPARATOR\\n[#REMOVE]
16627 .      rm $ENUMERATOR_TYPE\\n[#REMOVE]
16628 .      rr #PAD_LIST_DIGITS\\n[#REMOVE]
16629 .      rr #SHIFT_LIST\\n[#REMOVE]
16630 .   \}
16631 .   rr #STORED_L_INDENT
16632 .   rr #STORED_BL_INDENT
16633 .   rr #STORED_BR_INDENT
16634 .   rr #STORED_R_INDENT
16635 .   rr #STORED_R_INDENT
16636 .   rr #REMOVE
16637 .   rr #TOTAL_LISTS
16638 .   rr #QUIT
16639 .   rr #DEPTH
16640 .   rr #NEXT_DEPTH_BACK
16641 .   rr #RESTORE_PREV_INDENT
16642 .   rr #ORIG_L_LENGTH
16643 .   rr #CURRENT_L_LENGTH
16644 .   rr #IN_ITEM
16645 .   rr #IN_ITEM_L_INDENT
16646 .END
16647 \#
16648 \# SET LIST INDENT
16649 \# ---------------
16650 \# *Arguments:
16651 \#   none
16652 \# *Function:
16653 \#   Restores indent of prev. list in nested lists.  Also sets the
16654 \#   #QUIT register if an invocation of LIST OFF applies to the first
16655 \#   level of list.
16656 \#
16657 .MAC SET_LIST_INDENT END
16658 .    nr #NEXT_DEPTH_BACK \\n[#DEPTH]-1
16659 .    if \\n[#NEXT_DEPTH_BACK]=0 \{\
16660 .       nr #QUIT 1
16661 .       if \\n[#INDENT_ACTIVE]=1 \{\
16662 .          if \\n[#INDENT_STYLE_BOTH]=1 \{\
16663 .             ie \\n[#DOCS] \
16664 .                ll \\n[#DOC_L_LENGTH]u-\\n[#STORED_BR_INDENT]u
16665 .             el \
16666 .                ll \\n[#L_LENGTH]u-\\n[#STORED_BR_INDENT]u
16667 .             in \\n[#BL_INDENT]u
16668 .          \}
16669 .          if \\n[#INDENT_STYLE_LEFT] \{\
16670 .             in \\n[#STORED_L_INDENT]u
16671 .          \}
16672 .          if \\n[#INDENT_STYLE_RIGHT] \{\
16673 .             ie \\n[#DOCS] \
16674 .                ll \\n[#DOC_L_LENGTH]u-\\n[#STORED_R_INDENT]u
16675 .             el \
16676 .                ll \\n[#L_LENGTH]u-\\n[#STORED_R_INDENT]u
16677 .          \}
16678 .       \}
16679 .       return
16680 .    \}
16681 .    nr #L_INDENT -\\n[#LIST_INDENT\\n[#DEPTH]]+\\n[#SHIFT_LIST\\n[#DEPTH]]
16682 .    nr #HL_INDENT \\n[#HL_INDENT\\n-[#DEPTH]]
16683 .END
16684 \#
16685 \# ====================================================================
16686 \#
16687 \# +++DOCUMENT PROCESSING MISC AND SUPPORT MACROS+++
16688 \#
16689 \# COLLATE
16690 \# -------
16691 \# *Arguments:
16692 \#   <none>
16693 \# *Function:
16694 \#   Turns headers off (if on) and saves header state, sets register
16695 \#   #COLLATE to 1 (toggle), and breaks to a new page.
16696 \# *Notes:
16697 \#   COLLATE exists primarily to allow putting multiple chapters in
16698 \#   a single file, although it can be used for any document type.  After
16699 \#   COLLATE, any of the macros that normally precede START may be
16700 \#   used, and should behave as expected.
16701 \#
16702 \#   N.B.--the START macro must be used after every COLLATE
16703 \#
16704 .MAC COLLATE END
16705 .    if dPDF.EXPORT .tm .ds pre-collate-\\n% \\n%@\\n[#COL_NUM]
16706 .    if \\n[defer] \{\
16707 .       nr #BLANKPAGE_AFTER_DEFER 1
16708 .       bp
16709 .    \}
16710 .    nr #HEADER_STATE \\n[#HEADERS_ON]
16711 .    if (\\n[defer]=0)&(\\n[float*defer]=0) .HEADERS OFF
16712 .    if \\n[#LINENUMBERS] \{\
16713 .       NUMBER_LINES off
16714 .       nr #LINENUMBERS 2
16715 .    \}
16716 .    if \\n[#BLANKPAGE] \{\
16717 .       if \\n[nl]=\\n[#PAGE_TOP] \{\
16718 .          nr #NO_NEWPAGE 1
16719 .          RESTORE_SPACE
16720 .       \}
16721 .       rr #BLANKPAGE
16722 .    \}
16723 .    if \\n[defer] \
16724 .       DO_FOOTER
16725 .    EOL
16726 .    ds $SAVED_DOC_FAM \\*[$DOC_FAM]
16727 .    ds $SAVED_PP_FT   \\*[$PP_FT]
16728 .    nr #COLLATE 1
16729 .    nr #PRE_COLLATE 1
16730 .    nr #POST_TOP 1
16731 .    nr #HEAD_1_NUM 0 1
16732 .    if !\\n[#LISTS] \{\
16733 .       if \\n[eqn*label-with-chapter]=1     .nr eqn*label-num 0 1
16734 .       if \\n[float*label-with-chapter]=1   .nr fig*label-num 0 1
16735 .       if \\n[pdf-img*label-with-chapter]=1 .nr fig*label-num 0 1
16736 .       if \\n[pic*label-with-chapter]=1     .nr fig*label-num 0 1
16737 .       if \\n[tbl*label-with-chapter]=1     .nr tbl*label-num 0 1
16738 .    \}
16739 .    if \\n[#DOC_HEADER]=2 .nr #DOC_HEADER 1
16740 .    if \\n[#PAGE_NUM_V_POS]=1 \{\
16741 .       nr #PAGINATION_STATE \\n[#PAGINATE]
16742 .       PAGINATION OFF
16743 .    \}
16744 .    IQ CLEAR
16745 .    TQ
16746 .    LL \\n[#DOC_L_LENGTH]u
16747 .    QUAD \\*[$DOC_QUAD]
16748 .    nr #SAVED_DOC_LEAD \\n[#DOC_LEAD]
16749 .    nr #COLLATED_DOC 1
16750 .    vs \\n[#DOC_LEAD]u
16751 \*[SLANTX]
16752 \*[CONDX]
16753 \*[EXTX]
16754 .    if \\n[#TOC] \{\
16755 .       if \\n[TOC_BH]=1 .pdfswitchtopage before MOM:TOC
16756 .       if \\n[TOC_BH]=2 .pdfswitchtopage after MOM:TOC
16757 .    \}
16758 .    if !\\n[#NO_NEWPAGE] .NEWPAGE
16759 .    if !\\n[#TOC] \{\
16760 .       if \\n[#FORCE_RECTO] \{\
16761 .          ds $PN_FORMAT_CURR \\g[#PAGENUMBER]
16762 .          af #PAGENUMBER 1
16763 .          if \\n[#PAGENUMBER]%2=1 .nr #ODD_PAGENUM 1
16764 .          af #PAGENUMBER \\*[$PN_FORMAT_CURR]
16765 .          if \\n[#ODD_PAGENUM] .BLANKPAGE 1 DIVIDER
16766 .          rr #ODD_PAGENUM
16767 .          rr #BLANKPAGE_AFTER_DEFER
16768 .       \}
16769 .    \}
16770 .    rr #NO_NEWPAGE
16771 .    ch RR_@TOP
16772 .    rr @TOP
16773 .    if \\n[.ns] \{\
16774 .      rs
16775 .      nop \&
16776 .    \}
16777 .    if '\\n[.ev]'PAGE_TRANSITION\\n[pg-trans]' .ev
16778 .    if \\n[#DEFER_PAGINATION] .PAGINATE
16779 .    if !'\\*[$RESTORE_PAGENUM_STYLE]'' \{\
16780 .       PAGENUM_STYLE \\*[$RESTORE_PAGENUM_STYLE]
16781 .       rm $RESTORE_PAGENUM_STYLE
16782 .    \}
16783 .    if \\n[#CH_NUM] \
16784 .       if \\n[#TOC]=0 .nr #CH_NUM +1
16785 .    rm $EN_TITLE
16786 .    COVERTITLE
16787 .    DOC_COVERTITLE
16788 .    TITLE
16789 .    CHAPTER
16790 .    CHAPTER_TITLE
16791 .    SUBTITLE
16792 .    MISC
16793 .    rr #COVER_TITLE
16794 .    rr #DOC_COVER_TITLE
16795 .    rr #MISC
16796 .    rr #COVER_MISC
16797 .    rr #DOC_COVER_MISC
16798 .    rr #COPYRIGHT
16799 .    rr #COVER_COPYRIGHT
16800 .    rr #DOC_COVER_COPYRIGHT
16801 .    rr #COVER_AUTHOR
16802 .    rr #DOC_COVER_AUTHOR
16803 .    rm COVER_TEXT
16804 .    rm DOC_COVER_TEXT
16805 .    rm $COPYRIGHT
16806 .    rm $COVER_COPYRIGHT
16807 .    rm $DOC_COVER_COPYRIGHT
16808 .    rr #END_QUOTE
16809 .    rr #PAGENUM_STYLE_SET
16810 .    rr #DOC_COVER
16811 .    rr #COVER
16812 .    rr #LAST_LEVEL
16813 .    rr #LEVEL
16814 .    if \\n[#RESTORE_PN_V_POS] \{\
16815 .       nr #PAGE_NUM_V_POS \\n[#RESTORE_PN_V_POS]
16816 .       rr #RESTORE_PN_V_POS
16817 .    \}
16818 .    nr #LOOP 0 1
16819 .    while \\n+[#LOOP]<=\\n[@LEVEL] \
16820 .       rr #TOC_HEAD_\\n[#LOOP]_INDENT_SET 1
16821 .    if \\n[#FLEX_ACTIVE] .rr #NO_FLEX
16822 .END
16823 \#
16824 \# NUMBER_LINES
16825 \# ------------
16826 \# *Arguments:
16827 \#   <starting line number> [ <increment> [ <gutter> ] ]
16828 \#   or
16829 \#   <anything> | RESUME
16830 \# *Function:
16831 \#   Begin, suspend/turn off, or resume numbering of output lines.
16832 \#
16833 .MAC NUMBER_LINES END
16834 .    br
16835 .    if '\\n[.z]'EPI_TEXT' .return
16836 .    if '\\$1'' \{\
16837 .       tm1 "[mom]: NUMBER_LINES at line \\n[.c] has no argument.
16838 .       tm1 "       You have forgotten to give a starting line number or 'RESUME'.
16839 .       ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
16840 .    \}
16841 .    if !\\n[#LINENUMBERS]=2 .nr #LINENUMBERS 1
16842 .\" Test whether the first arg is a digit.
16843 .    if \B'\\$1' \{\
16844 .       if \\n[#QUOTE] \{\
16845 .          if \\n[#QUOTE]=1 .ds macro QUOTE
16846 .          if \\n[#QUOTE]=2 .ds macro BLOCKQUOTE
16847 .          tm1 "[mom]: \\$0 at line \\n[.c] may not be used inside \\*[macro].
16848 .          tm1 "       Please set NUMBER_LINES before \\*[macro], followed by
16849 .          tm1 "       NUMBER_\\*[macro]_LINES.
16850 .          ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
16851 .       \}
16852 .       nr #LN \\$1
16853 .       ds $LN_NUM \\$1
16854 .       if !'\\n[.z]'' .nr #RESTORE_LN_NUM 1
16855 .       ie '\\$2'' \
16856 .          if '\\*[$LN_INC]'' .ds $LN_INC 1
16857 .       el .ds $LN_INC \\$2
16858 .       ie '\\$3'' \
16859 .          if !\\n[#LN_GUTTER] .nr #LN_GUTTER 2
16860 .       el .nr #LN_GUTTER \\$3
16861 .    \}
16862 .    ie !\\n[#LN] \{\
16863 .\" In other words, the first arg was not a digit.
16864 .       rr #LN
16865 .       ie '\\$1'RESUME' \{\
16866 .          LN_PARAMS
16867 .          nm \\*[$LN_NUM]
16868 .          RESTORE_PARAMS
16869 .       \}
16870 .       el \{\
16871 .          nm
16872 .\"  Register ln is still set and may confuse preprocessors like tbl.
16873 .\"  Still, resuming line numbering must be possible, so save ln in
16874 .\"  $LN_NUM
16875 .          ds $LN_NUM \\n[ln]
16876 .          if !\\n[#QUOTE] .nr ln 0
16877 .          if !\\n[#LINENUMBERS]=2 .rr #LINENUMBERS
16878 .       \}
16879 .    \}
16880 .    el \{\
16881 .       LN_PARAMS
16882 .       nm \\*[$LN_NUM] \\*[$LN_INC] \\n[#LN_GUTTER] -3-\\n[#LN_GUTTER]
16883 .       RESTORE_PARAMS
16884 .       if !'\\n[.z]'' .nr #DIVER_LN_OFF 1
16885 .    \}
16886 .    rr #LN
16887 .END
16888 \#
16889 \# LINENUMBER STYLE PARAMETERS
16890 \# ---------------------------
16891 \# *Arguments:
16892 \#   none
16893 \# *Function:
16894 \#   LN_PARAMS sets parameters for line numbers.
16895 \#   RESTORE_PARAMS restores them after internal calls to .nm
16896 \# *Notes:
16897 \#   It's not documented, but groff's linenumbering is processed
16898 \#   in a unique environment reserved for the numbers, such that
16899 \#   whatever style params were in effect prior to the invocation
16900 \#   of .nm remain in effect for the numbers even if the running
16901 \#   text has different params.  Eg, If you set .gcolor to 'purple'
16902 \#   before .nm then set it back to what it was, the numbers will be
16903 \#   purple while the text remains at the default color.
16904 \#
16905 .MAC LN_PARAMS END
16906 .    ie d$LN_FAM .fam \\*[$LN_FAM]
16907 .    el .fam \\n[.fam]
16908 .    ie d$LN_FT .ft \\*[$LN_FT]
16909 .    el .ft \\n[.sty]
16910 .    ie d$LN_SIZE_CHANGE .ps \\*[$LN_SIZE_CHANGE]
16911 .    el .ps \\n[.s]
16912 .    ie d$LN_COLOR .COLOR \\*[$LN_COLOR]
16913 .    el .gcolor \\n[.m]
16914 .END
16915 \#
16916 .MAC RESTORE_PARAMS END
16917 .    fam
16918 .    ft
16919 .    ps
16920 .    gcolor
16921 .END
16922 \#
16923 \# Whether, at COLLATE, to reset line number to 1.
16924 \#
16925 \# NUMBER LINES PER SECTION
16926 \# ------------------------
16927 \# *Argument:
16928 \#   none
16929 \# *Function:
16930 \#   Sets register that determines whether, at COLLATE, to reset
16931 \#   line number to 1.
16932 \# *Notes:
16933 \#   The default is to continue the line numbering from where it
16934 \#   left off.
16935 \#
16936 .MAC NUMBER_LINES_PER_SECTION END
16937 .    nr #PER_SECTION 1
16938 .END
16939 \#
16940 \# NUMBER QUOTE AND BLOCKQUOTE LINES AS PART OF RUNNING TEXT
16941 \# ---------------------------------------------------------
16942 \# *Argument:
16943 \#   <gutter> | <anything>
16944 \# *Function:
16945 \#   Sets #(B)QUOTE_LN to 1 if no argument, or a single numeric
16946 \#   argument, is given; otherwise, turns (BLOCK)QUOTE linenumbering
16947 \#   off.
16948 \# *Notes:
16949 \#   #(B)QUOTE is checked for in QUOTE and BLOCKQUOTE.
16950 \#   The single numeric argument allows establishing a different gutter from
16951 \#   the one used for line numbers in running text.
16952 \#
16953 .MAC NUMBER_QUOTE_LINES END
16954 .    ie \\n[#NUM_ARGS]=0 .nr #QUOTE_LN 1
16955 .    el \{\
16956 .       ie \B'\\$1' \{\
16957 .          nr #QUOTE_LN 1
16958 .          nr #Q_LN_GUTTER \\$1
16959 .       \}
16960 .       el \{\
16961 .          ie '\\$1'SILENT' .nr #SILENT_QUOTE_LN 1
16962 .          el \{\
16963 .             rr #QUOTE_LN
16964 .             rr #SILENT_QUOTE_LN
16965 .          \}
16966 .       \}
16967 .    \}
16968 .END
16969 \#
16970 .MAC NUMBER_BLOCKQUOTE_LINES END
16971 .    ie \\n[#NUM_ARGS]=0 .nr #BQUOTE_LN 1
16972 .    el \{\
16973 .       ie \B'\\$1' \{\
16974 .          nr #BQUOTE_LN 1
16975 .          nr #BQ_LN_GUTTER \\$1
16976 .       \}
16977 .       el \{\
16978 .          ie '\\$1'SILENT' .nr #SILENT_BQUOTE_LN 1
16979 .          el \{\
16980 .             rr #BQUOTE_LN
16981 .             rr #SILENT_BQUOTE_LN
16982 .          \}
16983 .       \}
16984 .    \}
16985 .END
16986 \#
16987 \# OUTPUT BLANK PAGES
16988 \# ------------------
16989 \# *Argument:
16990 \#   <number of blank pages to output> [ DIVIDER [ NULL ] ]
16991 \# *Function:
16992 \#   Outputs blank pages.
16993 \# *Notes:
16994 \#   If recto/verso, each page is recto/verso, even if there's
16995 \#   nothing on it.
16996 \#
16997 \#   The 1st argument to BLANKPAGE is non-optional.  DIVIDER is for
16998 \#   blank pages before endnotes, bibliographies, tocs, new chapters.
16999 \#
17000 .MAC BLANKPAGE END
17001 .    nr #BLANKPAGE 1
17002 .    nr #HOW_MANY \\$1
17003 .    shift
17004 .    nr #PAGES 0 1
17005 .    if \\n[#LINENUMBERS] \{\
17006 .       nr #LINENUMBERS_WERE_ON 1
17007 .       NUMBER_LINES OFF
17008 .    \}
17009 .    while \\n+[#PAGES]<=\\n[#HOW_MANY] \{\
17010 .       if \\n[#HEADERS_ON]=1 \{\
17011 .          nr #HEADERS_WERE_ON 1
17012 .          HEADERS OFF
17013 .       \}
17014 .       if \\n[#PAGE_NUM_V_POS]=1 \{\
17015 .          if \\n[#PAGINATE]=1 .nr #PAGINATE_WAS_ON 1
17016 .          nr #RESTORE_PN_V_POS \\n[#PAGE_NUM_V_POS]
17017 .          PAGINATION OFF
17018 .       \}
17019 .       NEWPAGE \" Break to blank page
17020 .       nop \&
17021 .       br
17022 .       if \\n[#FOOTERS_ON]=1 \{\
17023 .          nr #FOOTERS_WERE_ON 1
17024 .          FOOTERS OFF
17025 .       \}
17026 .       if \\n[#PAGE_NUM_V_POS]=2 \{\
17027 .          if \\n[#PAGINATE]=1 .nr #PAGINATE_WAS_ON 1
17028 .          nr #RESTORE_PN_V_POS \\n[#PAGE_NUM_V_POS]
17029 .          PAGINATION OFF
17030 .       \}
17031 .       if !'\\$1'DIVIDER' .if \\n[#HEADERS_WERE_ON] .HEADERS
17032 .    \}
17033 .    NEWPAGE
17034 .    ie '\\$1'DIVIDER' \{\
17035 .       nop \&
17036 .       if \\n[#BLANKPAGE_AFTER_DEFER] .bp
17037 .       if \\n[#FOOTERS_WERE_ON] .FOOTERS
17038 .          if \\n[#RESTORE_PN_V_POS] \{\
17039 .             if \\n[#PAGINATE_WAS_ON] .PAGINATE
17040 .             nr #PAGE_NUM_V_POS \\n[#RESTORE_PN_V_POS]
17041 .          \}
17042 .       if \\n[#HEADERS_WERE_ON] .HEADERS
17043 .       shift
17044 .       if '\\$1'NULL' .nr #PAGE_NUM_ADJ -\\n[#HOW_MANY]
17045 .    \}
17046 .    el \{\
17047 .       if '\\$1'' \{\
17048 .          if \\n[#FOOTERS_WERE_ON] .FOOTERS
17049 .          if \\n[#RESTORE_PN_V_POS] \{\
17050 .             if \\n[#PAGINATE_WAS_ON] .PAGINATE
17051 .             nr #PAGE_NUM_V_POS \\n[#RESTORE_PN_V_POS]
17052 .          \}
17053 .       \}
17054 .       if '\\$1'NULL' \{\
17055 .          if \\n[#FOOTERS_WERE_ON] .FOOTERS
17056 .          if \\n[#PAGE_NUM_V_POS]=2 \
17057 .             if \\n[#PAGINATE_WAS_ON] .PAGINATE
17058 .       \}
17059 .    \}
17060 .    if \\n[#PAGINATE]=1 \
17061 .       if '\\$1'NULL' .nr #PAGE_NUM_ADJ -\\n[#HOW_MANY]
17062 .       if \\n[#RESTORE_PN_V_POS]=1 \{\
17063 .          RESTORE_SPACE
17064 .          sp |\\n[#HEADER_MARGIN]u
17065 .          PRINT_PAGE_NUMBER
17066 .       \}
17067 .    if \\n[#LINENUMBERS_WERE_ON] .NUMBER_LINES RESUME
17068 .    rr #HOW_MANY
17069 .    rr #HEADERS_WERE_ON
17070 .    rr #FOOTERS_WERE_ON
17071 .    rr #PAGINATE_WAS_ON
17072 .END
17073 \#
17074 \# FLOATS
17075 \# ------
17076 \#
17077 .am PSPIC \" Need to do this for PSPIC inside a float
17078 .  vpt 0
17079 \h'(\\n[ps-offset]u + \\n[ps-deswid]u)'
17080 .  sp -1
17081 .  vpt
17082 ..
17083 \#
17084 .MAC PROCESS_FLOATS END
17085 .    if \\n[#TAB_ACTIVE] \{\
17086 .       nr #RESTORE_TAB 1
17087 .       TQ
17088 .    \}
17089 .    if !\\n[tbl*no-top-hook] .tbl@top-hook
17090 .    rr tbl*no-top-hook
17091 .    sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
17092 .    nr defer-count \\n[defer]
17093 .    nr #TMP_PAGE_OFFSET \\n[.o]
17094 .    po \\n[#L_MARGIN]u
17095 .    ev protect
17096 .    evc FLOAT
17097 .    nf
17098 .    RESTORE_SPACE
17099 .    if '\\*[float*type:\\n[defer]]'boxed-tbl:\\n[defer]' \{\
17100 .       ch RR_@TOP
17101 .\" Get depth of the first deferred float when there's more than one.
17102 .       if (\\n[.t] >= 1)&(\\n[float-depth:\\n[defer]] > (\\n[.t]+\\n[#DOC_LEAD])) \
17103 .          tbl*float-warning
17104 .       if \\n[#MLA] .sp \\n[tbl*label-lead-diff]u
17105 .       if (\\n[tbl*have-caption:\\n[defer]]=1)&(\\n[tbl*caption-after-label]=0) \
17106 .          sp \\n[tbl*caption-lead-diff]u
17107 .       if \\n[tbl*caption-after-label] \
17108 .          sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
17109 .    \}
17110 .    if \\n[float*pic:1] \{\
17111 .       if (\\n[pic*have-caption]=1)&(\\n[pic*caption-after-label]=0) \{\
17112 .          ie \\n[#COLUMNS] \
17113 .             sp |\\n[dc]u+\\n[pic*caption-lead-diff]u
17114 .          el .sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u+\\n[pic*caption-lead-diff]u
17115 .       \}
17116 .       rr pic*caption-lead-diff
17117 .       rr pic*top-lead-diff
17118 .       rr float*pic
17119 .    \}
17120 .    if \\n[float*img] \{\
17121 .       ie \\n[#COLUMNS] \
17122 .          sp |\\n[dc]u
17123 .       el \
17124 .          sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
17125 .       if \\n[pdf-img:frame] \{\
17126 .          sp -(\\*[pdf-img:frame-weight]p*2u)
17127 .          rr pdf-img:frame
17128 .       \}
17129 .    \}
17130 .    nr loop-count  0 1
17131 .    nr new-defer   0 1
17132 .    while \\n+[loop-count]<=\\n[defer-count] \{\
17133 .       nr tbl*no-top-hook 1
17134 .       rnn defer float*defer \" So '.if \n[defer]' is skipped during float output
17135 .       vpt
17136 .       ch RR_@TOP
17137 .       rr @TOP
17138 .       if \\n[pdf-img*have-caption] \
17139 .          if !\\n[pdf-img*caption-after-label] .sp -.5v
17140 .       rr pdf-img*have-caption
17141 .       rr pic*have-caption
17142 .       if '\\*[float*type:\\n[loop-count]]'table:\\n[loop-count]' \{\
17143 .          ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
17144 .          ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u
17145 .       \}
17146 .       ie !\\n[float-span:\\n[loop-count]] \{\
17147 .          ie ((\\n[float-depth:\\n[loop-count]]-\\n[.v])>\\n[.t]):(\\n[D-float:\\n[loop-count]]>\\n[.t]) \{\
17148 .\" Insufficient space, defer to next page
17149 .             rn FLOAT*DIV:\\n[loop-count] NEW*FLOAT*DIV:\\n+[new-defer]
17150 .             rnn float-depth:\\n[loop-count] new-float-depth:\\n[new-defer]
17151 .             rnn D-float:\\n[loop-count] new-D-float:\\n[new-defer]
17152 .          \}
17153 .          el \{\
17154 .             output-float
17155 .             ie (\\n[.t]-1)<(\\n[#DOC_LEAD]u/2) .SHIM_1
17156 .             el .sp .5
17157 .          \}
17158 .       \}
17159 .       el \{\
17160 .          rr tbl*no-top-hook
17161 .          if \\n[float-span:\\n[loop-count]] \
17162 .             rn tbl*header-div:\\n[loop-count] tbl*header-div:span
17163 .          output-float
17164 .          sp .5
17165 .       \}
17166 .       if !\\n[loop-count]=\\n[defer-count] .rr flexed
17167 .       rr float-span:\\n[loop-count]
17168 .       rr float*tbl:\\n[loop-count]
17169 .       rr tbl*have-caption:\\n[loop-count]
17170 .       rr float*tbl*center:\\n[loop-count]
17171 .       rr tbl*have-header:\\n[loop-count]
17172 .       rm float*div:\\n[loop-count]
17173 .       rr float-depth:\\n[loop-count]
17174 .       rm tbl*header-div:\\n[loop-count]
17175 .       rm float*type:\\n[loop-count]
17176 .    \}
17177 .    if !\\n[float*defer]=1 \{\
17178 .       if !(\\n[loop-count]-1)=1 \{\
17179 .          if !\\n[.t]=1 .sp -.5
17180 .       \}
17181 .    \}
17182 .    if !\\n[@no-shim] \
17183 .       if !\\n[q-float] \
17184 .          if !\\n[#NO_SHIM] .SHIM
17185 .\" FLOAT arrays are empty now
17186 .\" Rename new arrays (FLOATs deferred to next page) to proper names
17187 .    rr float*defer
17188 .    rnn new-defer defer
17189 .    nr loop-count 0 1
17190 .    while \\n+[loop-count]<=\\n[defer] \{\
17191 .       rn NEW*FLOAT*DIV:\\n[loop-count] FLOAT*DIV:\\n[loop-count]
17192 .       rnn new-float-depth:\\n[loop-count] float-depth:\\n[loop-count]
17193 .       rnn new-D-float:\\n[loop-count] D-float:\\n[loop-count]
17194 .    \}
17195 .    if !\\n[#TMP_PAGE_OFFSET]=\\n[.o] .po \\n[#TMP_PAGE_OFFSET]u
17196 .    rr #TMP_PAGE_OFFSET
17197 .    ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
17198 .    ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u
17199 .    if !\\n[.t]=1 .if \\n[.t]<\\n[.v] .bp
17200 .    ie !\\n[#NO_SHIM] .SHIM
17201 .    el \{\
17202 .       if !\\n[#NO_FLEX] \
17203 .          if !\\n[flexed] .FLEX 
17204 .    \}
17205 .    if !\\n[#NO_SHIM] \
17206 .       if \\n[#SHIM]>(\\n[#DOC_LEAD]-(\\n[#DOC_LEAD]/4)) \
17207 '             sp -\\n[#DOC_LEAD]u
17208 .    ie !\\n[flex:force] .ns
17209 .    el \{\
17210 .       rr flex:force
17211 .       if !\\n[#NO_FLEX] .FLEX
17212 .    \}
17213 .    nr tbl*have-header 0
17214 .    rr tbl*have-caption
17215 .    rr loop-count
17216 .    rr defer-count
17217 .    rr float*before-shim
17218 .    rr float*after-shim
17219 .    rm float-adj
17220 .    rr check-indent
17221 .    if \\n[#NEWPAGE] \{\
17222 .       vpt
17223 '       bp
17224 .       rr #NEWPAGE
17225 .    \}
17226 .    rr float*img
17227 .    rr float*eqn
17228 .    rr float*tbl
17229 .    rr float*pic
17230 .    if \\n[#RESTORE_TAB] \{\
17231 .       TAB \\n[#CURRENT_TAB]
17232 .       rr #RESTORE_TAB
17233 .    \}
17234 .END
17235 \#
17236 .MAC output-float END
17237 .    if \\n[float*img] \{\
17238 .       nr no-top-space:1 1
17239 .    \}
17240 .    vpt 0
17241 .    if \\n[.ns] \{\
17242 .       rs
17243 .       nop \&
17244 .       sp -1
17245 .    \}
17246 .    if \\n[no-top-space:1] \{\
17247 .       ie !\\n[#COLUMNS] \{\
17248 .          sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
17249 .          ns
17250 .       \}
17251 .       el .sp |\\n[dc]u
17252 .       if \\n[float*tbl:1] \{\
17253 .          RESTORE_SPACE
17254 .          ie \\n[tbl*caption-top-lead-diff] \{\
17255 .             sp \\n[tbl*caption-top-lead-diff]u
17256 .             rr tbl*caption-top-lead-diff
17257 .          \}
17258 .          el \{\
17259 .             if '\\*[float*type:1]'boxed-tbl:1' \{\
17260 .                ie (\\n[tbl*have-caption]=1)&(\\n[tbl*caption-after-label]=0) .sp .3n
17261 .                el .sp (\\n[#DOC_LEAD]u/2u)+.3n
17262 .             \}
17263 .          \}
17264 .          rr float*tbl:1
17265 .       \}
17266 .       if \\n[float*img:1] \{\
17267 .          RESTORE_SPACE
17268 .          if \\n[pdf-img*caption-top-lead-diff] \{\
17269 .             sp \\n[pdf-img*caption-top-lead-diff]u
17270 .             rr float*img:1
17271 .             rr pdf-img*caption-top-lead-diff
17272 .          \}
17273 .       \}
17274 .    \}
17275 .    if \\n[float*pic] \{\
17276 .       nr pic*top-space-adj \\n[#DOC_LEAD]-\\n[pic@text-lead]
17277 .       if (\\n[pic*have-caption]=0):(\\n[pic*caption-after-label]=1) \
17278 .          sp \\n[pic*top-space-adj]u
17279 .       if \\n[#COLUMNS] \
17280 .          if !'\\*[pic*space-adj:\\n[loop-count]]'' \
17281 .             sp \\*[pic*space-adj:\\n[loop-count]]
17282 .    \}
17283 .    nf
17284 .    if \\n[q-float] \
17285 .       if !\\n[has-caption] .sp \\n[#Q_LEAD_DIFF]u
17286 .    ns
17287 .    vpt
17288 .    if \\n[check-indent] \{\
17289 .       if \\n[#INDENT_LEFT_ACTIVE] \{\
17290 .          in \\n[#L_INDENT]u/2u
17291 .       \}
17292 .    \}
17293 .    rr no-top-space:1
17294 .    if \\n[loop-count]>1 \{\
17295 .       if !'\\*[float-adj:\\n[loop-count]]'' \{\
17296 .          rs
17297 .          sp \\*[float-adj:\\n[loop-count]]
17298 .          ns
17299 .          nr restore-v-pos 1
17300 .       \}
17301 .    \}
17302 .    nr check-indent 1
17303 .    FLOAT*DIV:\\n[loop-count]
17304 .    if \\n[no-top-space:1] \
17305 .       RESTORE_SPACE
17306 .    if \\n[restore-v-pos] \{\
17307 .       sp -\\*[float-adj:\\n[loop-count]]
17308 .       rm float-adj:\\n[loop-count]
17309 .       rr restore-v-pos
17310 .    \}
17311 .    if \\n[#COLUMNS] \
17312 .       if !'\\*[pic*space-adj:\\n[loop-count]]'' .sp -\\*[pic*space-adj:\\n[loop-count]]
17313 .    rm pic*space-adj:\\n[loop-count]
17314 .    if \\n[D-float:1] \
17315 .       rr D-float:1
17316 .    rr D-float
17317 .    rr @no-shim
17318 .    rr q-float
17319 .    rm B_QUOTE
17320 .    rm P_QUOTE
17321 .END
17322 \#
17323 \# FLOAT
17324 \# -----
17325 \# *Arguments:
17326 \#   [ ADJUST +|-<amount> ] [ FORCE] [ SPAN] [ NO_SHIM] | [ NO_FLEX ] [ TARGET ] | <anything>
17327 \# *Function:
17328 \#   Captures input in a diversion, which is output immediately if
17329 \#   there's room on the page; otherwise outputs diversion at top of
17330 \#   next page.
17331 \# *Notes:
17332 \#   ADJUST allows for raising or lowering the contents of
17333 \#   the diversion within the space allotted.  FORCE breaks to
17334 \#   a new page immediately.
17335 \#
17336 .MAC FLOAT END
17337 .    if \\n[#NUM_ARGS]>0 \{\
17338 .       nr loop-count 0 1
17339 .       nr loop-counter \\n[#NUM_ARGS]
17340 .       while \\n+[loop-count]<=\\n[loop-counter] \{\
17341 .          if '\\$1'FORCE' \{\
17342 .             nr #FORCE 1
17343 .             shift
17344 .          \}
17345 .          if '\\$1'SPAN' \{\
17346 .              nr float-span 1
17347 .              shift
17348 .          \}
17349 .          if '\\$1'ADJUST' \{\
17350 .             shift
17351 .             ds float-adj \\$1
17352 .             shift
17353 .          \}
17354 .          if '\\$1'CENTER' \{\
17355 .             nr center-float 1
17356 .             shift
17357 .          \}
17358 .          if '\\$1'CENTRE' \{\
17359 .             nr center-float 1
17360 .             shift
17361 .          \}
17362 .          if '\\$1'INDENT' \{\
17363 .             shift
17364 .             nr indent-float \\$1
17365 .             shift
17366 .          \}
17367 .          if '\\$1'RIGHT' \{\
17368 .             nr right-float 1
17369 .             shift
17370 .          \}
17371 .          if '\\$1'NO_SHIM' \{\
17372 .             nr @no-shim 1
17373 .             shift
17374 .          \}
17375 .          if '\\$1'NO_FLEX' \{\
17376 .             nr @no-flex 1
17377 .             shift 1
17378 .          \}
17379 .          if '\\$1'TARGET' \{\
17380 .             shift
17381 .             ds float*target "\\$1
17382 .             shift 1
17383 .          \}
17384 .       \}
17385 .    \}
17386 .    ie \\n[float*started] .rr float*started
17387 .    el \{\
17388 .       while !'\\$1'' .shift 1
17389 .       nr float*started 1
17390 .    \}
17391 .    ie '\\$1'' \{\
17392 .\" Harmonize floats treated as defers and floats proper to the top
17393 .\" of the next page between passes when flex is enabled.
17394 .\"
17395 .\" Without this, floats near the bottom of the page may be deferred
17396 .\" on the first pass, but when flex-spacing moves the line just
17397 .\" before the float to the bottom of the page, the upcoming .br
17398 .\" causes the float to be proper to the next page instead of
17399 .\" deferred to it.
17400 .       nr floatnum +1
17401 .       ie !\\n[#NO_FLEX] \{\
17402 .\" Only on 2nd pass
17403 .          if !dPDF.EXPORT \{\
17404 .             ie d float\\n[floatnum]:no-defer .br
17405 .             el \{\
17406 .\" .v in the following is arbitrary.  Groff rounds down decimal
17407 .\" fractions so flex-spacing may be slightly short.  Since there
17408 .\" are no conditions under which a .t-1 (bottom margin) < .v
17409 .\" on the 1st pass doesn't cause a float to be deferred, all floats
17410 .\" on the second pass that meet the condition are also, correctly,
17411 .\" deferred.
17412 .                if (\\n[.t]-1)<\\n[.v] \
17413 .                   if !\\n[@TOP] .nr no-break 1
17414 .             \}
17415 .          \}
17416 .\" Only on 1st pass
17417 .          ie !\\n[no-break] \{\
17418 .             ds pre-float:page@col \\n%@\\n[#COL_NUM]
17419 .             br
17420 .             ds post-float:page@col \\n%@\\n[#COL_NUM]
17421 .             if dPDF.EXPORT \{\
17422 .                if !'\\*[pre-float:page@col]'\\*[post-float:page@col]' \
17423 .                   tm .ds float\\n[floatnum]:no-defer 1
17424 .             \}
17425 .          \}
17426 .          el .rr no-break
17427 .       \}
17428 .       el .br
17429 .       if \\n[nl]=\\n[#PAGE_TOP] \
17430 .          RESTORE_SPACE
17431 .       ds ev-pre-float \\n[.ev]
17432 .       ev FLOAT
17433 .       evc \\*[ev-pre-float]
17434 .       di FLOAT*DIV
17435 .       if !'\\*[float*target]'' .PDF_TARGET "\\*[float*target]
17436 .       rm float*target
17437 .       nf
17438 .    \}
17439 .    el \{\
17440 .       br
17441 .\" So @no-shim persists if float output with output-float
17442 .       if r @no-shim .nr float*no-shim 1
17443 .       if \\n[float-span] \{\
17444 .          nr span 1
17445 \!.        rr span
17446 .       \}
17447 \!.     rm tbl*header-div:span
17448 \!.     nr tbl*no-print-header 1
17449 .       di
17450 .       if \\n[float-span] \{\
17451 .          nr dn-save \\n[dn]
17452 .          da FLOAT*DIV
17453 \!.        rr float-span
17454 .          da
17455 .          nr dn \\n[dn-save]
17456 .          rr dn-save
17457 .       \}
17458 .       ie \\n[float*tbl] \
17459 .          if !\\n[tbl*have-header] .ev 0
17460 .       el .ev 0
17461 .       if \\n[tbl*boxed] \{\
17462 .          ch FOOTER \\n[#VARIABLE_FOOTER_POS]u+\\n[#DOC_LEAD]u
17463 .          ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u+\\n[#DOC_LEAD]u
17464 .          ie !\\n[#MLA] \{\
17465 .             ie (\\n[tbl@label]=1):(\\n[tbl@source]=1):(\\n[tbl*autolabel]=1) .nr dn -.65v
17466 .             el .nr dn +.65v
17467 .             rr tbl@label
17468 .             rr tbl@source
17469 .          \}
17470 .          el .if !\\n[tbl@source] .nr dn -1.65v
17471 .       \}
17472 .\" Defer float
17473 .       if (\\n[dn]>\\n[.t]):(\\n[D-float]>\\n[.t]):(\\n[defer]>0) \{\
17474 .          if !\\n[float-span] \{\
17475 .             if (\\n[dn]+(\\n[.v]*2)>(\\n[.p]-\\n[#TOP_MARGIN]-\\n[#DOC_LEAD]-\\n[#B_MARGIN])) \{\
17476 .                tm1 "[mom]: Floated element exceeds page depth.
17477 .                ab   [mom]: Aborting '\\n[.F]' at line \\n[.c].
17478 .             \}
17479 .          \}
17480 .\" Save depth of diversion here.  The .da zeroes it.
17481 .          nr dn-save \\n[dn]
17482 .          if \\n[#FLEX_ACTIVE] \{\
17483 .             if !\\n[@no-flex] \{\
17484 .                da FLOAT*DIV
17485 \!.              FLEX
17486 \!.              nr flexed 1
17487 .                da
17488 .             \}
17489 .          \}
17490 .          nr dn \\n[dn-save]
17491 .          rr dn-save
17492 .          ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
17493 .          ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u
17494 .          ev 0
17495 .          ie \\n[@TOP] \{\
17496 .             br
17497 .             if \\n[tbl*boxed] .rs
17498 .             rr tbl*boxed
17499 .          \}
17500 .          el \{\
17501 .             if !\\n[defer] .nr defer 0 1
17502 .             rn FLOAT*DIV FLOAT*DIV:\\n+[defer]
17503 .             if !'\\*[float-adj]'' \
17504 .                rn float-adj float-adj:\\n[defer]
17505 .             if \\n[float-span] \
17506 .                if !\\n[tbl*boxed] .rnn float-span float-span:\\n[defer]
17507 .             if \\n[float*tbl] \{\
17508 .                if \\n[defer]>0 \{\
17509 .                   nr no-top-space:\\n[defer] 1
17510 .                   nr float*tbl:\\n[defer] 1
17511 .                   if \\n[tbl*have-caption] \
17512 .                      nr tbl*have-caption:\\n[defer] 1
17513 .                \}
17514 .                ie \\n[tbl*boxed] \
17515 .                   ds float*type:\\n[defer] boxed-tbl:\\n[defer]
17516 .                el .ds float*type:\\n[defer] table:\\n[defer]
17517 .                if \\n[tbl*center] .nr float*tbl-center:\\n[defer] 1
17518 .                if \\n[tbl*have-header] .rnn tbl*have-header tbl*have-header:\\n[defer]
17519 .                rn tbl*header-div tbl*header-div:\\n[defer]
17520 .                rr tbl*center
17521 .             \}
17522 .             if \\n[float*eqn] \{\
17523 .                if \\n[defer]=1 .nr no-top-space:\\n[defer] 1
17524 .                ds float*type:\\n[defer] eqn
17525 .             \}
17526 .             if \\n[float*pic] \{\
17527 .                ds float*type:\\n[defer] pic
17528 .                nr float*pic:\\n[defer] 1
17529 .                rn pic*space-adj pic*space-adj:\\n[defer]
17530 .             \}
17531 .             if \\n[float*img] \{\
17532 .                ds float*type:\\n[defer] img
17533 .                nr float*img:\\n[defer] 1
17534 .                nr no-top-space:\\n[defer] 1
17535 .             \}
17536 .             if \\n[D-float] .nr D-float:\\n[defer] \\n[D-float]
17537 .             nr float-depth:\\n[defer] \\n[dn]
17538 .             if \\n[#FORCE] \{\
17539 .                ie \\n[#COLUMNS] .COL_NEXT
17540 .                el .NEWPAGE
17541 .                rr #FORCE
17542 .             \}
17543 .             if \\n[tbl*boxed] .rr tbl*boxed
17544 .             if \\n[table] .rr table
17545 .             br
17546 .             return \" output div after header
17547 .          \}
17548 .       \}
17549 .       nr dn-save \\n[dn]
17550 .       if \\n[#FLEX_ACTIVE] \{\
17551 .          if !\\n[@no-flex] \{\
17552 .             da FLOAT*DIV
17553 \!.           FLEX
17554 \!.           nr flexed 1
17555 .             da
17556 .          \}
17557 .       \}
17558 .       nr dn \\n[dn-save]
17559 .       ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
17560 .       ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u
17561 .       vpt 0
17562 .       if !'\\*[float-adj]'' .sp \\*[float-adj]
17563 .       if \\n[.u] .nr fill 1
17564 .       if \\n[@TOP] \{\
17565 .          nr no-adjust 1
17566 .          rr @TOP
17567 .       \}
17568 .       if \\n[float*tbl] \{\
17569 .          if (\\n[#MLA]=1)&(\\n[tbl@source]=0) \
17570 .             chop FLOAT*DIV
17571 .          if \\n[nl]=\\n[#PAGE_TOP] \{\
17572 .             ie (\\n[tbl*have-caption]=1)&(\\n[tbl*caption-after-label]=0) \{\
17573 .                ie !\\n[#MLA] .sp \\n[tbl*caption-lead-diff]u
17574 .                el .ch RR_@TOP
17575 .             \}
17576 .             el \{\
17577 .                ev protect
17578 .                evc FLOAT
17579 .                nf
17580 .                rs
17581 .                ie \\n[tbl*boxed] .sp |\\n[#PAGE_TOP]u+.3n
17582 .                el .sp |\\n[#PAGE_TOP]u-.25v
17583 .             \}
17584 .          \}
17585 .       \}
17586 .       if \\n[float*img] \
17587 .          if \\n[pdf-img:frame] \
17588 .             sp -(\\*[pdf-img:frame-weight]p*2u)
17589 .       if !'\\n[.ev]'protect' \{\
17590 .          ev protect
17591 .          evc FLOAT
17592 '           nf
17593 .       \}
17594 .       if \\n[float*tbl] \{\
17595 .          if \\n[tbl*boxed] \
17596 .             if \\n[tbl*center] \
17597 .                if \\n[#L_INDENT] \
17598 .                   in -\\n[#L_INDENT]u/2u
17599 .       \}
17600 .       if \\n[center-float] \
17601 .          in (\\n[.l]u-\\n[dl]u)/2u
17602 .       if \\n[indent-float] \
17603 .          in \\n[indent-float]u
17604 .       if \\n[right-float] \
17605 .          in \\n[.l]u-\\n[dl]u
17606 .       FLOAT*DIV
17607 .       if (\\n[center-float]>0):(\\n[indent-float]>0):(\\n[right-float]>0) \
17608 .          in
17609 .       ev
17610 .       if \\n[float*tbl] \{\
17611 .          rr tbl*no-print-header
17612 .          ie \\n[tbl*boxed] \{\
17613 .             ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
17614 .             ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u
17615 .             ie \\n[nl]>(\\n[.p]+\\n[#VARIABLE_FOOTER_POS]) \{\
17616 .                ie \\n[#COLUMNS] .COL_NEXT
17617 .                el .NEWPAGE
17618 .             \}
17619 .             el \{\
17620 .                if \\n[dn-save]=\\n[bx-tbl-depth] .sp .35v
17621 .                rr dn-save
17622 .                ie \\n[tbl*plain-boxed] .sp .5v
17623 .                el \{\
17624 .                   if !\\n[tbl*autolabel] \{\
17625 .                      if !\\n[#MLA] \{\
17626 .                        if \\n[tbl@label]=1 .sp .5
17627 .                      \}
17628 .                   \}
17629 .                \}
17630 .                rr tbl*boxed
17631 .                rr bx-tbl-depth
17632 .             \}
17633 .          \}
17634 .          el \{\
17635 .             if !'\\*[tbl*label]'' \
17636 .                if \\n[tbl*autolabel]=0 .sp .5
17637 .          \}
17638 .          rr float*tbl
17639 .          rr tbl*center
17640 .          rm tbl*header-div
17641 .          rr tbl*have-caption
17642 .          rr tbl*have-label
17643 .          rr tbl*have-source
17644 .          rm tbl*caption
17645 .          rm tbl*label
17646 .          rm tbl*source
17647 .       \}
17648 .       if \\n[float*img] \
17649 .          if (\\n[.t]-1)>(\\n[#DOC_LEAD]u/2u) .sp .5
17650 .       if \\n[D-float] \{\
17651 .          ie \\n[dn]=0 .sp \\n[D-float]u+\\n[#DOC_LEAD]u
17652 .          el \
17653 .             if \\n[dn]<\\n[D-float] \
17654 .                sp \\n[D-float]u+\\n[#DOC_LEAD]u-\\n[dn]u
17655 .\" Flex won't grab .h of D-floats without a dummy text line.
17656 .          vpt 0
17657 .          nop \&
17658 .          sp -1
17659 .          vpt 1
17660 .       \}
17661 .       if \\n[fill] \{\
17662 .          fi
17663 .          rr fill
17664 .       \}
17665 .       rm FLOAT*DIV
17666 .       if !'\\*[float-adj]'' \
17667 .          if !\\n[no-adjust] .sp -\\*[float-adj]
17668 .       vpt
17669 .       if !\\n[#NO_SHIM] \
17670 .          if !\\n[@no-shim] .SHIM
17671 .       rm float-adj
17672 .       rm no-adjust
17673 .       rr center-float
17674 .       rr indent-float
17675 .       rr right-float
17676 .       rr D-float
17677 .       rr @no-shim
17678 .       rr @no-flex
17679 .       rr #FORCE
17680 .       rm P_QUOTE
17681 .       rm B_QUOTE
17682 .       if \\n[float*img] .rr float*img
17683 .       if \\n[float*pic] .rr float*pic
17684 .       if \\n[float*eqn] .rr float*eqn
17685 .       rr float*target
17686 .       rm float*target
17687 .       if \\n[#NO_SHIM] \
17688 .          if !\\n[#NO_FLEX] .nr post-float 1
17689 .       ev \\*[ev-pre-float]
17690 .       rm ev-pre-float
17691 .    \}
17692 .END
17693 \#
17694 \# SET TRAPS FOR HEADERS/FOOTERS/FOOTNOTES
17695 \# ---------------------------------------
17696 \# *Arguments:
17697 \#   <none>
17698 \# *Function:
17699 \#   Sets header/footer/footnotes/etc... traps.
17700 \#
17701 \#   TRAPS calculates the number of lines that actually fit on a
17702 \#   page based on #B_MARGIN and resets page bottom trap to coincide
17703 \#   with the depth of that number of lines, or, if #ADJ_DOC_LEAD=1,
17704 \#   adjusts #DOC_LEAD so that the last line of text on a page falls
17705 \#   exactly on #B_MARGIN.
17706 \#
17707 .MAC RR_@TOP END \" Trap-invoked after first line of text on a new page
17708 .    rr @TOP
17709 .    if \\n[.ns] \{\
17710 .       vpt 0
17711 .       rs
17712 .       if \\n[.u] .nr fill 1
17713 .       nf
17714 .       nop \&
17715 .       sp -1
17716 .       if \\n[fill] .fi
17717 .       if r #NEWPAGE .rr #NEWPAGE
17718 .    \}
17719 .    if \\n[.vpt]=0 .vpt
17720 .END
17721 \#
17722 .MAC TRAPS END
17723 .    if !\\n[#UNADJUSTED_DOC_LEAD] .nr #UNADJUSTED_DOC_LEAD \\n[#DOC@LEAD]
17724 .\" Remove all header/footer traps
17725 .    if !\\n[#NO_TRAP_RESET] \{\
17726 .       ch DO_T_MARGIN
17727 .       ch DO_B_MARGIN
17728 .       ch HEADER
17729 .       ch FOOTER
17730 .       ch FN_OVERFLOW_TRAP
17731 .\" Plant header trap
17732 .       wh 0 HEADER
17733 .    \}
17734 .\" Adjust lead so last line of text falls on B_MARGIN
17735 .       nr #LINES_PER_PAGE 0 1
17736 .       nr #DOC_LEAD_ADJ 0 1
17737 .       nr #DEPTH_TO_B_MARGIN \\n[#PAGE_LENGTH]-\\n[#ORIGINAL_B_MARGIN]-\\n[#DOC_LEAD]
17738 .\" Get the number of unadjusted lines that fit on the page; always a
17739 .\" bit short of the bottom margin
17740 .       while \\n[#T_MARGIN]+(\\n[#DOC_LEAD]*\\n+[#LINES_PER_PAGE])<\\n[#DEPTH_TO_B_MARGIN] \{\
17741 .
17742 .       \}
17743 .       nr #LINES_PER_PAGE -1
17744 .\" Add machine units, 1 at a time, increasing the leading until the
17745 .\" new leading fills the page properly
17746 .       while \\n[#T_MARGIN]+(\\n[#DOC_LEAD]+\\n+[#DOC_LEAD_ADJ]*\\n[#LINES_PER_PAGE])<=\\n[#DEPTH_TO_B_MARGIN] \{\
17747 .
17748 .       \}
17749 .       DOC_LEAD \\n[#DOC_LEAD]u+\\n[#DOC_LEAD_ADJ]u
17750 .\" The "visual" bottom margin is what \n[nl] would report on the
17751 .\" last line before the FOOTER trap is sprung
17752 .       nr #VISUAL_B_MARGIN \\n[#T_MARGIN]+(\\n[#LINES_PER_PAGE]*\\n[#DOC_LEAD])
17753 .\" Get the difference between #B_MARGIN and #VISUAL_B_MARGIN
17754 .       nr #FOOTER_DIFF (\\n[#PAGE_LENGTH]-\\n[#B_MARGIN])-\\n[#VISUAL_B_MARGIN]
17755 .\" Set #B_MARGIN to 1 machine unit lower on the page than #VISUAL_B_MARGIN
17756 .       nr #B_MARGIN \\n[#B_MARGIN]+(\\n[#FOOTER_DIFF]-1)
17757 .\" Set the FN_OVERFLOW_TRAP position
17758 .       nr #FN_OVERFLOW_TRAP_POS \\n[#B_MARGIN]-\\n[#FN_LEAD]
17759 .       if \\n[#PRINT_STYLE]=1 .nr #FN_OVERFLOW_TRAP_POS \\n[#ORIGINAL_B_MARGIN]u
17760 .\" Set footer and footnote overflow traps
17761 .    if !\\n[#NO_TRAP_RESET] \{\
17762 .       nr #FN_COUNT 0 1
17763 .       nr #SPACE_REMAINING 0
17764 .       nr #FN_DEPTH 0
17765 .       nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]u
17766 .       wh \\n[.p]u FOOTER
17767 .       wh -(\\n[#FN_OVERFLOW_TRAP_POS]u) FN_OVERFLOW_TRAP
17768 .       ch FOOTER -\\n[#B_MARGIN]u
17769 .    \}
17770 .END
17771 \#
17772 \# CHECK INDENT
17773 \# ------------
17774 \# *Arguments:
17775 \#   <none>
17776 \# *Function:
17777 \#   Adds left, right, or both indent values to document elements
17778 \#   like heads and subheads that are processed in environments.
17779 \#
17780 .MAC CHECK_INDENT END
17781 .    if \\n[#INDENT_LEFT_ACTIVE] \{\
17782 .       in \\n[#L_INDENT]u
17783 .       if \\n[#QUOTE] \{\
17784 .          in -\\n[#L_INDENT]u \"Because we added an indent in 2nd line of macro
17785 .          ll -\\n[#L_INDENT]u
17786 .          ta \\n[.l]u
17787 .       \}
17788 .       if \\n[#EPIGRAPH] \{\
17789 .          in -\\n[#L_INDENT]u
17790 .          ll -\\n[#L_INDENT]u
17791 .          ta \\n[.l]u
17792 .       \}
17793 .    \}
17794 .    if \\n[#INDENT_RIGHT_ACTIVE] \{\
17795 .       ll -\\n[#R_INDENT]u
17796 .       ta \\n[.l]u
17797 .    \}
17798 .    if \\n[#INDENT_BOTH_ACTIVE] \{\
17799 .       in \\n[#BL_INDENT]u
17800 .       ll -\\n[#BR_INDENT]u
17801 .       ta \\n[.l]u
17802 .       if \\n[#QUOTE] \{\
17803 .          in -\\n[#BL_INDENT]u
17804 .          ie \\n[#BR_INDENT]=\\n[#BL_INDENT] \{\
17805 .             ll -\\n[#BR_INDENT]u
17806 .             ta \\n[.l]u
17807 .          \}
17808 .          el \{\
17809 .             ll -(\\n[#BR_INDENT]u/2u)
17810 .             ta \\n[.l]u
17811 .          \}
17812 .       \}
17813 .       if \\n[#EPIGRAPH] \{\
17814 .          in -\\n[#BL_INDENT]u
17815 .          ie \\n[#BR_INDENT]=\\n[#BL_INDENT] \{\
17816 .             ll -\\n[#BR_INDENT]u
17817 .             ta \\n[.l]u
17818 .          \}
17819 .          el \{\
17820 .             ll -(\\n[#BR_INDENT]u/2u)
17821 .             ta \\n[.l]u
17822 .          \}
17823 .       \}
17824 .    \}
17825 .END
17826 \#
17827 \# REMOVE INDENT
17828 \# -------------
17829 \# *Arguments:
17830 \#   <none>
17831 \# *Function:
17832 \#   Removes left, right, or both indent values from document elements
17833 \#   like heads and subheads that are processed in environments.
17834 \#
17835 .MAC REMOVE_INDENT END
17836 .    in 0
17837 .    ll \\n[#L_LENGTH]u
17838 .    ta \\n[.l]u
17839 .END
17840 \#
17841 \# This .em (for all DOC_TYPEs, except 4 [LETTER]) ensures that
17842 \# deferred footnotes and floats that happen on the 2nd to last page
17843 \# get output, and the last page/col isn't flexed.
17844 \#
17845 .MAC TERMINATE END
17846 .    if dPDF.EXPORT .tm .ds last-page \\n%@\\n[#COL_NUM]
17847 .    ie \\n[#FN_DEPTH] \{\
17848 .       ie \\n[#FN_DEFER] \{\
17849 .          br
17850 .          nr #TERMINATE 1
17851 .          FOOTNOTE
17852 .          nf
17853 .          FOOTNOTE OFF
17854 .       \}
17855 .       el \{\
17856 .          br
17857 .          ch FN_OVERFLOW_TRAP
17858 .          FOOTER
17859 .       \}
17860 .    \}
17861 .    el \{\
17862 .       br
17863 .       ch FN_OVERFLOW_TRAP
17864 .       FOOTER
17865 .    \}
17866 .    if \\n[defer] \
17867 '       bp
17868 .END
17869 \#
17870 \# END MACRO FOR LETTERS
17871 \# ---------------------
17872 \# *Arguments:
17873 \#   none
17874 \# *Function:
17875 \#   The .em macro executed at the end of letters.  Turns footers
17876 \#   and pagination off, terminates and outputs diversion CLOSING
17877 \#   (indented with the author's name underneath).
17878 \#
17879 .MAC ALL_DONE END
17880 .    ch FOOTER
17881 .    ch HEADER
17882 .    br
17883 .    if \\n[#DOC_TYPE]=4 \{\
17884 .       if !'\\n[.z]'' \{\
17885 .          br
17886 .          ALD \\*[$SIG_SPACE]
17887 .          di
17888 .       \}
17889 .       IQ CLEAR
17890 .       TQ
17891 .       LEFT
17892 .       ie !'\\*[$CLOSE_INDENT]'' .IL \\*[$CLOSE_INDENT]
17893 .       el .IL \\n[#DOC_L_LENGTH]u/2u
17894 .       sp
17895 .       if \\n[#CLOSING] \{\
17896 .          CLOSING_TEXT
17897 .          br
17898 .       \}
17899 .       PRINT \\*[$AUTHOR_1]
17900 .    \}
17901 .END
17902 \#
17903 \# Set up a default papersize of US letter
17904 \#
17905 .PAPER LETTER
17906 \#
17907 \# ====================================================================
17908 \#
17909 \# +++DOCUMENT PROCESSING ALIASES+++
17910 \#
17911 \# Create aliases to make life easier for users: synonyms, short forms
17912 \# and alternate spellings.
17913 \#
17914 .ALIAS CITATION            BLOCKQUOTE
17915 .ALIAS CITE                BLOCKQUOTE
17916 .ALIAS DOC_R_MARGIN        DOC_RIGHT_MARGIN
17917 .ALIAS DOC_L_MARGIN        DOC_LEFT_MARGIN
17918 .ALIAS DOC_L_LENGTH        DOC_LINE_LENGTH
17919 .ALIAS DOC_RMARGIN         DOC_RIGHT_MARGIN
17920 .ALIAS DOC_LMARGIN         DOC_LEFT_MARGIN
17921 .ALIAS DOC_LLENGTH         DOC_LINE_LENGTH
17922 .ALIAS DOC_FAM             DOC_FAMILY
17923 .ALIAS DOC_LS              DOC_LEAD
17924 .ALIAS DOC_PS              DOC_PT_SIZE
17925 .ALIAS FILL                QUAD
17926 .ALIAS PAGENUM             PAGENUMBER
17927 .ALIAS PAGINATION          PAGINATE
17928 .ALIAS PP_FT               PP_FONT
17929 .ALIAS TOC_PS              TOC_PT_SIZE
17930 \#
17931 \# HEADER and FOOTER macros
17932 \# ------------------------
17933 \# Because the type-style of headers and footers are managed
17934 \# identically, and the type-style macros (_<type parameter>) all
17935 \# require the correct name of the calling macro, it's necessary
17936 \# to create HEADER_ and FOOTER_ macros here that are basically
17937 \# aliases with an argument.
17938 \#
17939 .MAC FOOTER_CENTER_COLOR END
17940 .    HDRFTR_CENTER_COLOR \\$1
17941 .END
17942 \#
17943 .MAC FOOTER_CENTER_COLOUR END
17944 .    HDRFTR_CENTER_COLOR \\$1
17945 .END
17946 \#
17947 .MAC FOOTER_CENTER_FAM END
17948 .    HDRFTR_CENTER_FAMILY \\$1
17949 .END
17950 \#
17951 .MAC FOOTER_CENTER_FAMILY END
17952 .    HDRFTR_CENTER_FAMILY \\$1
17953 .END
17954 \#
17955 .MAC FOOTER_CENTER_FONT END
17956 .    HDRFTR_CENTER_FONT \\$1
17957 .END
17958 \#
17959 .MAC FOOTER_CENTER_FT END
17960 .    HDRFTR_CENTER_FONT \\$1
17961 .END
17962 \#
17963 .MAC FOOTER_CENTER_PS END
17964 .    HDRFTR_CENTER_SIZE \\$1
17965 .END
17966 \#
17967 .MAC FOOTER_CENTER_SIZE END
17968 .    HDRFTR_CENTER_SIZE \\$1
17969 .END
17970 \#
17971 .MAC FOOTER_CENTRE_CAPS END
17972 .    HDRFTR_CENTER_CAPS \\$1
17973 .END
17974 \#
17975 .MAC FOOTER_CENTRE_COLOR END
17976 .    HDRFTR_CENTER_COLOR \\$1
17977 .END
17978 \#
17979 .MAC FOOTER_CENTRE_COLOUR END
17980 .    HDRFTR_CENTER_COLOR \\$1
17981 .END
17982 \#
17983 .MAC FOOTER_CENTRE_FAM END
17984 .    HDRFTR_CENTER_FAMILY \\$1
17985 .END
17986 \#
17987 .MAC FOOTER_CENTRE_FAMILY END
17988 .    HDRFTR_CENTER_FAMILY \\$1
17989 .END
17990 \#
17991 .MAC FOOTER_CENTRE_FONT END
17992 .    HDRFTR_CENTER_FONT \\$1
17993 .END
17994 \#
17995 .MAC FOOTER_CENTRE_FT END
17996 .    HDRFTR_CENTER_FONT \\$1
17997 .END
17998 \#
17999 .MAC FOOTER_CENTRE_PS END
18000 .    HDRFTR_CENTER_SIZE \\$1
18001 .END
18002 \#
18003 .MAC FOOTER_CENTRE_SIZE END
18004 .    HDRFTR_CENTER_SIZE \\$1
18005 .END
18006 \#
18007 .MAC FOOTER_COLOR END
18008 .    HDRFTR_COLOR \\$1
18009 .END
18010 \#
18011 .MAC FOOTER_COLOUR END
18012 .    HDRFTR_COLOR \\$1
18013 .END
18014 \#
18015 .MAC FOOTER_FAM END
18016 .    HDRFTR_FAMILY \\$1
18017 .END
18018 \#
18019 .MAC FOOTER_FAMILY END
18020 .    HDRFTR_FAMILY \\$1
18021 .END
18022 \#
18023 .MAC FOOTER_LEFT_COLOR END
18024 .    HDRFTR_LEFT_COLOR \\$1
18025 .END
18026 \#
18027 .MAC FOOTER_LEFT_COLOUR END
18028 .    HDRFTR_LEFT_COLOR \\$1
18029 .END
18030 \#
18031 .MAC FOOTER_LEFT_FAM END
18032 .    HDRFTR_LEFT_FAMILY \\$1
18033 .END
18034 \#
18035 .MAC FOOTER_LEFT_FAMILY END
18036 .    HDRFTR_LEFT_FAMILY \\$1
18037 .END
18038 \#
18039 .MAC FOOTER_LEFT_FONT END
18040 .    HDRFTR_LEFT_FONT \\$1
18041 .END
18042 \#
18043 .MAC FOOTER_LEFT_FT END
18044 .    HDRFTR_LEFT_FONT \\$1
18045 .END
18046 \#
18047 .MAC FOOTER_LEFT_PS END
18048 .    HDRFTR_LEFT_SIZE \\$1
18049 .END
18050 \#
18051 .MAC FOOTER_LEFT_SIZE END
18052 .    HDRFTR_LEFT_SIZE \\$1
18053 .END
18054 \#
18055 .MAC FOOTER_RIGHT_COLOR END
18056 .    HDRFTR_RIGHT_COLOR \\$1
18057 .END
18058 \#
18059 .MAC FOOTER_RIGHT_COLOUR END
18060 .    HDRFTR_RIGHT_COLOR \\$1
18061 .END
18062 \#
18063 .MAC FOOTER_RIGHT_FAM END
18064 .    HDRFTR_RIGHT_FAMILY \\$1
18065 .END
18066 \#
18067 .MAC FOOTER_RIGHT_FAMILY END
18068 .    HDRFTR_RIGHT_FAMILY \\$1
18069 .END
18070 \#
18071 .MAC FOOTER_RIGHT_FONT END
18072 .    HDRFTR_RIGHT_FONT \\$1
18073 .END
18074 \#
18075 .MAC FOOTER_RIGHT_FT END
18076 .    HDRFTR_RIGHT_FONT \\$1
18077 .END
18078 \#
18079 .MAC FOOTER_RIGHT_PS END
18080 .    HDRFTR_RIGHT_SIZE \\$1
18081 .END
18082 \#
18083 .MAC FOOTER_RIGHT_SIZE END
18084 .    HDRFTR_RIGHT_SIZE \\$1
18085 .END
18086 \#
18087 .MAC FOOTER_RULE_COLOR END
18088 .    HDRFTR_RULE_COLOR \\$1
18089 .END
18090 \#
18091 .MAC FOOTER_SIZE END
18092 .    HDRFTR_SIZE \\$1
18093 .END
18094 \#
18095 .MAC HEADER_CENTER_COLOR END
18096 .    HDRFTR_CENTER_COLOR \\$1
18097 .END
18098 \#
18099 .MAC HEADER_CENTER_COLOUR END
18100 .    HDRFTR_CENTER_COLOR \\$1
18101 .END
18102 \#
18103 .MAC HEADER_CENTER_FAM END
18104 .    HDRFTR_CENTER_FAMILY \\$1
18105 .END
18106 \#
18107 .MAC HEADER_CENTER_FAMILY END
18108 .    HDRFTR_CENTER_FAMILY \\$1
18109 .END
18110 \#
18111 .MAC HEADER_CENTER_FONT END
18112 .    HDRFTR_CENTER_FONT \\$1
18113 .END
18114 \#
18115 .MAC HEADER_CENTER_FT END
18116 .    HDRFTR_CENTER_FONT \\$1
18117 .END
18118 \#
18119 .MAC HEADER_CENTER_PS END
18120 .    HDRFTR_CENTER_SIZE \\$1
18121 .END
18122 \#
18123 .MAC HEADER_CENTER_SIZE END
18124 .    HDRFTR_CENTER_SIZE \\$1
18125 .END
18126 \#
18127 .MAC HEADER_CENTRE_COLOR END
18128 .    HDRFTR_CENTER_COLOR \\$1
18129 .END
18130 \#
18131 .MAC HEADER_CENTRE_COLOUR END
18132 .    HDRFTR_CENTER_COLOR \\$1
18133 .END
18134 \#
18135 .MAC HEADER_CENTRE_FAM END
18136 .    HDRFTR_CENTER_FAMILY \\$1
18137 .END
18138 \#
18139 .MAC HEADER_CENTRE_FAMILY END
18140 .    HDRFTR_CENTER_FAMILY \\$1
18141 .END
18142 \#
18143 .MAC HEADER_CENTRE_FONT END
18144 .    HDRFTR_CENTER_FONT \\$1
18145 .END
18146 \#
18147 .MAC HEADER_CENTRE_FT END
18148 .    HDRFTR_CENTER_FONT \\$1
18149 .END
18150 \#
18151 .MAC HEADER_CENTRE_PS END
18152 .    HDRFTR_CENTER_SIZE \\$1
18153 .END
18154 \#
18155 .MAC HEADER_CENTRE_SIZE END
18156 .    HDRFTR_CENTER_SIZE \\$1
18157 .END
18158 \#
18159 .MAC HEADER_COLOR END
18160 .    HDRFTR_COLOR \\$1
18161 .END
18162 \#
18163 .MAC HEADER_COLOUR END
18164 .    HDRFTR_COLOR \\$1
18165 .END
18166 \#
18167 .MAC HEADER_FAM END
18168 .    HDRFTR_FAMILY \\$1
18169 .END
18170 \#
18171 .MAC HEADER_FAMILY END
18172 .    HDRFTR_FAMILY \\$1
18173 .END
18174 \#
18175 .MAC HEADER_LEFT_COLOR END
18176 .    HDRFTR_LEFT_COLOR \\$1
18177 .END
18178 \#
18179 .MAC HEADER_LEFT_COLOUR END
18180 .    HDRFTR_LEFT_COLOR \\$1
18181 .END
18182 \#
18183 .MAC HEADER_LEFT_FAM END
18184 .    HDRFTR_LEFT_FAMILY \\$1
18185 .END
18186 \#
18187 .MAC HEADER_LEFT_FAMILY END
18188 .    HDRFTR_LEFT_FAMILY \\$1
18189 .END
18190 \#
18191 .MAC HEADER_LEFT_FONT END
18192 .    HDRFTR_LEFT_FONT \\$1
18193 .END
18194 \#
18195 .MAC HEADER_LEFT_FT END
18196 .    HDRFTR_LEFT_FONT \\$1
18197 .END
18198 \#
18199 .MAC HEADER_LEFT_PS END
18200 .    HDRFTR_LEFT_SIZE \\$1
18201 .END
18202 \#
18203 .MAC HEADER_LEFT_SIZE END
18204 .    HDRFTR_LEFT_SIZE \\$1
18205 .END
18206 \#
18207 .MAC HEADER_RIGHT_COLOR END
18208 .    HDRFTR_RIGHT_COLOR \\$1
18209 .END
18210 \#
18211 .MAC HEADER_RIGHT_COLOUR END
18212 .    HDRFTR_RIGHT_COLOR \\$1
18213 .END
18214 \#
18215 .MAC HEADER_RIGHT_FAM END
18216 .    HDRFTR_RIGHT_FAMILY \\$1
18217 .END
18218 \#
18219 .MAC HEADER_RIGHT_FAMILY END
18220 .    HDRFTR_RIGHT_FAMILY \\$1
18221 .END
18222 \#
18223 .MAC HEADER_RIGHT_FONT END
18224 .    HDRFTR_RIGHT_FONT \\$1
18225 .END
18226 \#
18227 .MAC HEADER_RIGHT_FT END
18228 .    HDRFTR_RIGHT_FONT \\$1
18229 .END
18230 \#
18231 .MAC HEADER_RIGHT_PS END
18232 .    HDRFTR_RIGHT_SIZE \\$1
18233 .END
18234 \#
18235 .MAC HEADER_RIGHT_SIZE END
18236 .    HDRFTR_RIGHT_SIZE \\$1
18237 .END
18238 \#
18239 .MAC HEADER_RULE_COLOR END
18240 .    HDRFTR_RULE_COLOR \\$1
18241 .END
18242 \#
18243 .MAC HEADER_SIZE END
18244 .    HDRFTR_SIZE \\$1
18245 .END
18246 \#
18247 \# Aliases for other HEADER and FOOTER macros.
18248 \#
18249 .ALIAS  BIBLIOGRAPHY_FOOTER_CENTER BIBLIOGRAPHY_HDRFTR_CENTER
18250 .ALIAS  BIBLIOGRAPHY_FOOTER_CENTRE BIBLIOGRAPHY_HDRFTR_CENTER
18251 .ALIAS  BIBLIOGRAPHY_HEADER_CENTER BIBLIOGRAPHY_HDRFTR_CENTER
18252 .ALIAS  BIBLIOGRAPHY_HEADER_CENTRE BIBLIOGRAPHY_HDRFTR_CENTER
18253 .
18254 .ALIAS  ENDNOTES_FOOTER_CENTER ENDNOTES_HDRFTR_CENTER
18255 .ALIAS  ENDNOTES_FOOTER_CENTRE ENDNOTES_HDRFTR_CENTER
18256 .ALIAS  ENDNOTES_HEADER_CENTER ENDNOTES_HDRFTR_CENTER
18257 .ALIAS  ENDNOTES_HEADER_CENTRE ENDNOTES_HDRFTR_CENTER
18258 .
18259 .ALIAS  FOOTER_CENTER           HDRFTR_CENTER
18260 .ALIAS  TOC_PAGEFOOTER_CENTER   HDRFTR_CENTER
18261 .ALIAS  TOC_PAGEFOOTER_CENTRE   HDRFTR_CENTER
18262 .ALIAS  FOOTER_CENTER_CAPS      _HDRFTR_CAPS
18263 .ALIAS  FOOTER_CENTER_PAD       HDRFTR_CENTER_PAD
18264 .ALIAS  FOOTER_CENTER_SMALLCAPS _HDRFTR_SMALLCAPS
18265 .ALIAS  FOOTER_CENTRE           HDRFTR_CENTER
18266 .ALIAS  FOOTER_CENTRE_CAPS      _HDRFTR_CAPS
18267 .ALIAS  FOOTER_CENTRE_PAD       HDRFTR_CENTER_PAD
18268 .ALIAS  FOOTER_CENTRE_SMALLCAPS _HDRFTR_SMALLCAPS
18269 .ALIAS  FOOTER_LEFT             HDRFTR_LEFT
18270 .ALIAS  FOOTER_LEFT_CAPS        _HDRFTR_CAPS
18271 .ALIAS  FOOTER_LEFT_SMALLCAPS   _HDRFTR_SMALLCAPS
18272 .ALIAS  FOOTER_PLAIN            HDRFTR_PLAIN
18273 .ALIAS  FOOTER_RECTO            HDRFTR_RECTO
18274 .ALIAS  FOOTER_RIGHT            HDRFTR_RIGHT
18275 .ALIAS  FOOTER_RIGHT_CAPS       _HDRFTR_CAPS
18276 .ALIAS  FOOTER_RIGHT_SMALLCAPS  _HDRFTR_SMALLCAPS
18277 .ALIAS  FOOTER_RULE             HDRFTR_RULE
18278 .ALIAS  FOOTER_RULE_GAP         HDRFTR_RULE_GAP
18279 .ALIAS  FOOTER_VERSO            HDRFTR_VERSO
18280 .
18281 .ALIAS  HEADER_CENTER           HDRFTR_CENTER
18282 .ALIAS  TOC_PAGEHEADER_CENTER   HDRFTR_CENTER
18283 .ALIAS  TOC_PAGEHEADER_CENTRE   HDRFTR_CENTER
18284 .ALIAS  HEADER_CENTER_CAPS      _HDRFTR_CAPS
18285 .ALIAS  HEADER_CENTER_PAD       HDRFTR_CENTER_PAD
18286 .ALIAS  HEADER_CENTER_SMALLCAPS _HDRFTR_SMALLCAPS
18287 .ALIAS  HEADER_CENTRE           HDRFTR_CENTER
18288 .ALIAS  HEADER_CENTRE_CAPS      _HDRFTR_CAPS
18289 .ALIAS  HEADER_CENTRE_PAD       HDRFTR_CENTER_PAD
18290 .ALIAS  HEADER_CENTRE_SMALLCAPS _HDRFTR_SMALLCAPS
18291 .ALIAS  HEADER_LEFT             HDRFTR_LEFT
18292 .ALIAS  HEADER_LEFT_CAPS        _HDRFTR_CAPS
18293 .ALIAS  HEADER_LEFT_SMALLCAPS   _HDRFTR_SMALLCAPS
18294 .ALIAS  HEADER_PLAIN            HDRFTR_PLAIN
18295 .ALIAS  HEADER_RECTO            HDRFTR_RECTO
18296 .ALIAS  HEADER_RIGHT            HDRFTR_RIGHT
18297 .ALIAS  HEADER_RIGHT_CAPS       _HDRFTR_CAPS
18298 .ALIAS  HEADER_RIGHT_SMALLCAPS  _HDRFTR_SMALLCAPS
18299 .ALIAS  HEADER_RULE             HDRFTR_RULE
18300 .ALIAS  HEADER_RULE_GAP         HDRFTR_RULE_GAP
18301 .ALIAS  HEADER_VERSO            HDRFTR_VERSO
18302 .
18303 .ALIAS  SWITCH_FOOTERS     SWITCH_HDRFTR
18304 .ALIAS  SWITCH_HEADERS     SWITCH_HDRFTR
18305 \#
18306 \# Create type-style aliases for tags, titles, and page elements
18307 \#
18308 \# These are used for creating aliases with while loops
18309 \#
18310 .ds ELEMENT_TYPE_1  BIBLIOGRAPHY_STRING
18311 .ds ELEMENT_TYPE_2  BIBLIOGRAPHY_HEADER
18312 .ds ELEMENT_TYPE_3  BLOCKQUOTE
18313 .ds ELEMENT_TYPE_4  CITATION
18314 .ds ELEMENT_TYPE_5  CITE
18315 .ds ELEMENT_TYPE_6  ENDNOTES_HEADER
18316 .ds ELEMENT_TYPE_7  ENDNOTE_STRING
18317 .ds ELEMENT_TYPE_8  EPIGRAPH
18318 .ds ELEMENT_TYPE_9  HDRFTR_CENTER
18319 .ds ELEMENT_TYPE_10 HDRFTR_LEFT
18320 .ds ELEMENT_TYPE_11 HDRFTR_RIGHT
18321 .ds ELEMENT_TYPE_12 LINENUMBER
18322 .ds ELEMENT_TYPE_13 PAGENUM
18323 .ds ELEMENT_TYPE_14 QUOTE
18324 .ds ELEMENT_TYPE_15 TOC_HEADER
18325 .ds ELEMENT_TYPE_16 CODE
18326 .ds ELEMENT_TYPE_17 FINIS
18327 .ds ELEMENT_TYPE_18 COPYRIGHT
18328 \#
18329 \# Create aliases for _FAMILY
18330 .ALIAS BIBLIOGRAPHY_FAMILY       _FAMILY
18331 .ALIAS COVER_FAMILY              _FAMILY
18332 .ALIAS DOCHEADER_FAMILY          _FAMILY
18333 .ALIAS DOC_COVER_FAMILY          _FAMILY
18334 .ALIAS ENDNOTE_FAMILY            _FAMILY
18335 .ALIAS ENDNOTE_LINENUMBER_FAMILY _FAMILY
18336 .ALIAS ENDNOTE_NUMBER_FAMILY     _FAMILY
18337 .ALIAS ENDNOTE_STRING_FAMILY     _FAMILY
18338 .ALIAS ENDNOTE_TITLE_FAMILY      _FAMILY
18339 .ALIAS FOOTNOTE_FAMILY           _FAMILY
18340 .ALIAS HDRFTR_FAMILY             _FAMILY
18341 .ALIAS PAGENUMBER_FAMILY         _FAMILY
18342 .ALIAS TOC_FAMILY                _FAMILY
18343 .ALIAS TOC_PAGENUMBER_FAMILY     _FAMILY
18344 .ALIAS TOC_PN_FAMILY             _FAMILY
18345 .ALIAS TOC_TITLE_FAMILY          _FAMILY
18346 \#
18347 .nr #LOOP 0 1
18348 .while \n+[#LOOP]<=18 \{\
18349 . ALIAS \*[ELEMENT_TYPE_\n[#LOOP]]_FAMILY _FAMILY
18350 .\}
18351 \# Covers, docheader
18352 .nr #LOOP 0 1
18353 .while \n+[#LOOP]<=12 \{\
18354 . ALIAS \*[TITLE_TYPE_\n[#LOOP]]_FAMILY           _FAMILY
18355 . ALIAS COVER_\*[TITLE_TYPE_\n[#LOOP]]_FAMILY     _FAMILY
18356 . ALIAS DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_FAMILY _FAMILY
18357 .\}
18358 \#
18359 \# Create aliases for _FONT
18360 .ALIAS BIBLIOGRAPHY_FONT       _FONT
18361 .ALIAS ENDNOTE_FONT            _FONT
18362 .ALIAS ENDNOTE_LINENUMBER_FONT _FONT
18363 .ALIAS ENDNOTE_NUMBER_FONT     _FONT
18364 .ALIAS ENDNOTE_TITLE_FONT      _FONT
18365 .ALIAS FOOTNOTE_FONT           _FONT
18366 .ALIAS TOC_PN_FONT             _FONT
18367 \#
18368 .nr #LOOP 0 1
18369 .while \n+[#LOOP]<=18 \{\
18370 . ALIAS \*[ELEMENT_TYPE_\n[#LOOP]]_FONT _FONT
18371 .\}
18372 \# Covers, docheader
18373 .nr #LOOP 0 1
18374 .while \n+[#LOOP]<=12 \{\
18375 . ALIAS \*[TITLE_TYPE_\n[#LOOP]]_FONT           _FONT
18376 . ALIAS COVER_\*[TITLE_TYPE_\n[#LOOP]]_FONT     _FONT
18377 . ALIAS DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_FONT _FONT
18378 .\}
18379 \#
18380 \# Create aliases for _SIZE
18381 .ALIAS   ENDNOTE_LINENUMBER_SIZE _SIZE
18382 .ALIAS   ENDNOTE_NUMBER_SIZE     _SIZE
18383 .ALIAS   ENDNOTE_TITLE_SIZE      _SIZE
18384 .ALIAS   FOOTNOTE_SIZE           _SIZE
18385 .ALIAS   HDRFTR_SIZE             _SIZE
18386 .ALIAS   TOC_PN_SIZE             _SIZE
18387 \#
18388 .nr #LOOP 0 1
18389 .while \n+[#LOOP]<=18 \{\
18390 . ALIAS \*[ELEMENT_TYPE_\n[#LOOP]]_SIZE _SIZE
18391 .\}
18392 \# Covers, docheader
18393 .nr #LOOP 0 1
18394 .while \n+[#LOOP]<=12 \{\
18395 . ALIAS \*[TITLE_TYPE_\n[#LOOP]]_SIZE           _SIZE
18396 . ALIAS COVER_\*[TITLE_TYPE_\n[#LOOP]]_SIZE     _SIZE
18397 . ALIAS DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_SIZE _SIZE
18398 .\}
18399 \#
18400 \# Create aliases for TITLE_LEAD
18401 .nr #LOOP 0 1
18402 .while \n+[#LOOP]<=12 \{\
18403 . ALIAS \*[TITLE_TYPE_\n[#LOOP]]_LEAD           TITLE_LEAD
18404 . ALIAS COVER_\*[TITLE_TYPE_\n[#LOOP]]_LEAD     TITLE_LEAD
18405 . ALIAS DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_LEAD TITLE_LEAD
18406 .\}
18407 \#
18408 \# Create aliases for _UNDERLINE
18409 .ALIAS BIBLIOGRAPHY_HEADER_UNDERLINE  _UNDERLINE
18410 .ALIAS BIBLIOGRAPHY_HEADER_UNDERSCORE _UNDERLINE
18411 .ALIAS BIBLIOGRAPHY_STRING_UNDERLINE  _UNDERLINE
18412 .ALIAS BIBLIOGRAPHY_STRING_UNDERSCORE _UNDERLINE
18413 .ALIAS BIB_STRING_UNDERLINE           _UNDERLINE
18414 .ALIAS ENDNOTES_HEADER_UNDERLINE      _UNDERLINE
18415 .ALIAS ENDNOTES_HEADER_UNDERSCORE     _UNDERLINE
18416 .ALIAS ENDNOTES_STRING_UNDERLINE      _UNDERLINE
18417 .ALIAS ENDNOTES_STRING_UNDERSCORE     _UNDERLINE
18418 .ALIAS ENDNOTE_TITLE_UNDERLINE        _UNDERLINE
18419 .ALIAS ENDNOTE_TITLE_UNDERSCORE       _UNDERLINE
18420 .ALIAS EN_STRING_UNDERLINE            _UNDERLINE
18421 .ALIAS EN_STRING_UNDERSCORE           _UNDERLINE
18422 .ALIAS TOC_HEADER_UNDERLINE           _UNDERLINE
18423 .ALIAS TOC_HEADER_UNDERSCORE          _UNDERLINE
18424 \#
18425 .nr #LOOP 0 1
18426 .while \n+[#LOOP]<=12 \{\
18427 . ALIAS \*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE            _UNDERLINE
18428 . ALIAS \*[TITLE_TYPE_\n[#LOOP]]_UNDERSCORE           _UNDERLINE
18429 . ALIAS COVER_\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE      _UNDERLINE
18430 . ALIAS COVER_\*[TITLE_TYPE_\n[#LOOP]]_UNDERSCORE     _UNDERLINE
18431 . ALIAS DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_UNDERLINE  _UNDERLINE
18432 . ALIAS DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_UNDERSCORE _UNDERLINE
18433 .\}
18434 \#
18435 \# Create aliases for _COLOR
18436 .ALIAS BIBLIOGRAPHY_HEADER_COLOR _COLOR
18437 .ALIAS COVER_COLOR               _COLOR
18438 .ALIAS DOCHEADER_COLOR           _COLOR
18439 .ALIAS ENDNOTE_TITLE_COLOR       _COLOR
18440 .ALIAS FINIS_COLOR               _COLOR
18441 .ALIAS FOOTNOTE_COLOR            _COLOR
18442 .ALIAS HDRFTR_COLOR              _COLOR
18443 .ALIAS HDRFTR_RULE_COLOR         _COLOR
18444 .ALIAS LINEBREAK_COLOR           _COLOR
18445 .ALIAS SECTION_COLOR             _COLOR
18446 \#
18447 .nr #LOOP 0 1
18448 .while \n+[#LOOP]<=18 \{\
18449 . ALIAS \*[ELEMENT_TYPE_\n[#LOOP]]_COLOR _COLOR
18450 .\}
18451 \# Covers, docheader
18452 .nr #LOOP 0 1
18453 .while \n+[#LOOP]<=12 \{\
18454 . ALIAS \*[TITLE_TYPE_\n[#LOOP]]_COLOR           _COLOR
18455 . ALIAS COVER_\*[TITLE_TYPE_\n[#LOOP]]_COLOR     _COLOR
18456 . ALIAS DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_COLOR _COLOR
18457 .\}
18458 \#
18459 \# Create aliases for _CAPS
18460 .ALIAS BIBLIOGRAPHY_HEADER_CAPS _CAPS
18461 .ALIAS BIBLIOGRAPHY_STRING_CAPS _CAPS
18462 .ALIAS ENDNOTE_TITLE_CAPS       _CAPS
18463 \#
18464 .nr #LOOP 0 1
18465 .while \n+[#LOOP]<=12 \{\
18466 . ALIAS \*[TITLE_TYPE_\n[#LOOP]]_CAPS           _CAPS
18467 . ALIAS COVER_\*[TITLE_TYPE_\n[#LOOP]]_CAPS     _CAPS
18468 . ALIAS DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_CAPS _CAPS
18469 .\}
18470 \#
18471 \# Create aliases for _SMALLCAPS
18472 .ALIAS BIBLIOGRAPHY_HEADER_SMALLCAPS _SMALLCAPS
18473 .ALIAS BIBLIOGRAPHY_STRING_SMALLCAPS _SMALLCAPS
18474 .ALIAS ENDNOTE_TITLE_SMALLCAPS       _SMALLCAPS
18475 .ALIAS HDRFTR_CENTER_SMALLCAPS       _SMALLCAPS
18476 .ALIAS HDRFTR_LEFT_SMALLCAPS         _SMALLCAPS
18477 .ALIAS HDRFTR_RIGHT_SMALLCAPS        _SMALLCAPS
18478 \#
18479 .nr #LOOP 0 1
18480 .while \n+[#LOOP]<=12 \{\
18481 . ALIAS \*[TITLE_TYPE_\n[#LOOP]]_SMALLCAPS           _SMALLCAPS
18482 . ALIAS COVER_\*[TITLE_TYPE_\n[#LOOP]]_SMALLCAPS     _SMALLCAPS
18483 . ALIAS DOC_COVER_\*[TITLE_TYPE_\n[#LOOP]]_SMALLCAPS _SMALLCAPS
18484 .\}
18485 \#
18486 \# Create aliases for _QUAD
18487 .ALIAS  BIBLIOGRAPHY_HEADER_QUAD  _QUAD
18488 .ALIAS  BIBLIOGRAPHY_QUAD         _QUAD
18489 .ALIAS  BIBLIOGRAPHY_STRING_QUAD  _QUAD
18490 .ALIAS  BLOCKQUOTE_QUAD           _QUAD
18491 .ALIAS  COPYRIGHT_QUAD            _QUAD
18492 .ALIAS  COVER_COPYRIGHT_QUAD      _QUAD
18493 .ALIAS  COVER_MISC_QUAD           _QUAD
18494 .ALIAS  COVER_QUAD                _QUAD
18495 .ALIAS  DOCHEADER_QUAD            _QUAD
18496 .ALIAS  DOC_COVER_COPYRIGHT_QUAD  _QUAD
18497 .ALIAS  DOC_COVER_MISC_QUAD       _QUAD
18498 .ALIAS  DOC_COVER_QUAD            _QUAD
18499 .ALIAS  DOC_QUAD                  _QUAD
18500 .ALIAS  ENDNOTES_HEADER_QUAD      _QUAD
18501 .ALIAS  ENDNOTE_QUAD              _QUAD
18502 .ALIAS  ENDNOTE_STRING_QUAD       _QUAD
18503 .ALIAS  ENDNOTE_TITLE_QUAD        _QUAD
18504 .ALIAS  EPIGRAPH_QUAD             _QUAD
18505 .ALIAS  FOOTNOTE_QUAD             _QUAD
18506 .ALIAS  MISC_QUAD                 _QUAD
18507 .ALIAS  TOC_HEADER_QUAD           _QUAD
18508 \#
18509 \# Support aliases
18510 \#
18511 .ALIAS   COL_BREAK               COL_NEXT
18512 .ALIAS   DOC_COVER               COVER
18513 .ALIAS   DOC_COVERS              COVERS
18514 .ALIAS   DOC_COVERTITLE          COVERTITLE
18515 .ALIAS   DOC_COVER_COUNTS_PAGES  COVER_COUNTS_PAGES
18516 .ALIAS   DOC_COVER_LEAD          COVER_LEAD
18517 .ALIAS   DOC_DOC_COVERTITLE      COVERTITLE
18518 .ALIAS   DO_DOC_COVER            DO_COVER
18519 .ALIAS   PRINT_FOOTNOTE_RULE     FOOTNOTE_RULE
18520 \#
18521 \# Miscellaneous aliases
18522 .ALIAS   SECTION        LINEBREAK
18523 .ALIAS   SECTION_CHAR   LINEBREAK_CHAR
18524 \#
18525 \# Miscellaneous macros to take care of backward compatibility
18526 \# -----------------------------------------------------------
18527 \#
18528 \# As of 1.1.9, EL and TN got changed to make TRAP...TRAP OFF
18529 \# unnecessary for users.  However, I used both macros extensively
18530 \# throughout this file (in conjunction with TRAP...TRAP OFF).
18531 \# EOL is the old EL; used only in om.tmac.
18532 \#
18533 .MAC EOL END
18534 .    if \\n[.vpt] \{\
18535 .       vpt 0
18536 .       nr #RESTORE_TRAP 1
18537 .    \}
18538 .    br
18539 .    sp -1v
18540 .    if \\n[#RESTORE_TRAP] \{\
18541 .       vpt
18542 .       rr #RESTORE_TRAP
18543 .    \}
18544 .END
18545 \#
18546 \# PREPROCESSOR SUPPORT
18547 \# ====================
18548 \#
18549 \# Utility macros--label and caption styles, lists collector, lists
18550 \# generator.
18551 \#
18552 .nr lists*target 0 1
18553 .
18554 .MAC get-label-type END
18555 .    if \\n[all]=1 .ds label-type eqn
18556 .    if \\n[all]=2 .ds label-type pdf-img
18557 .    if \\n[all]=3 .ds label-type pic
18558 .    if \\n[all]=4 .ds label-type tbl
18559 .    if \\n[all]=5 .ds label-type floating
18560 .END
18561 \#
18562 .MAC set-defaults END
18563 .    if '\\*[\\*[label-type]*\\*[spec-type]-family]'' \
18564 .       ds \\*[label-type]*\\*[spec-type]-family \\*[$DOC_FAM]\"
18565 .    if '\\*[\\*[label-type]*\\*[spec-type]-font]'' \
18566 .       ds \\*[label-type]*\\*[spec-type]-font R\"
18567 .    if '\\*[\\*[label-type]*\\*[spec-type]-size-change]'' \
18568 .       ds \\*[label-type]*\\*[spec-type]-size-change +0\"
18569 .    if !r \\*[label-type]*\\*[spec-type]-autolead \
18570 .       nr \\*[label-type]*\\*[spec-type]-autolead 2
18571 .    if '\\*[\\*[label-type]*\\*[spec-type]-space]'' \
18572 .       ds \\*[label-type]*\\*[spec-type]-space +0\"
18573 .    if '\\*[\\*[label-type]*\\*[spec-type]-color]'' \
18574 .       ds \\*[label-type]*\\*[spec-type]-color black\"
18575 .    if '\\*[\\*[label-type]*\\*[spec-type]-quad]'' \{\
18576 .       ie '\\*[label-type]'eqn' \{\
18577 .          if '\\*[spec-type]'caption' \
18578 .             ds \\*[label-type]*\\*[spec-type]-quad C\"
18579 .       \}
18580 .       el .ds \\*[label-type]*\\*[spec-type]-quad L\"
18581 .    \}
18582 .    if '\\n[\\*[label-type]*\\*[spec-type]-quad-on-ll]'' \
18583 .       nr \\*[label-type]*\\*[spec-type]-quad-on-ll 1
18584 .    if '\\*[spec-type]'caption' \
18585 .       nr default-left 1
18586 .END
18587 \#
18588 .MAC set-inline-specs END
18589 .    ds \\*[label-type]*\\*[spec-type]-specs \
18590 \f[\\*[\\*[label-type]*\\*[spec-type]-family]\\*[\\*[label-type]*\\*[spec-type]-font]]\
18591 \s[\\*[\\*[label-type]*\\*[spec-type]-size-change]]\
18592 \m[\\*[\\*[label-type]*\\*[spec-type]-color]]
18593 .END
18594 \#
18595 \# Line lengths, indents, and quads for captions and labels.
18596 \# Aliased for eqn, pic, pdf-image, and tbl.
18597 \#
18598 .MAC SET_QUAD END
18599 .    ds label-type \\$0
18600 .    substring label-type 0 2
18601 .    if '\\*[label-type]'PDF'   .ds label-type pdf-img
18602 .    if '\\*[label-type]'TBL'   .ds label-type tbl
18603 .    if '\\*[label-type]'PIC'   .ds label-type pic
18604 .    if '\\*[label-type]'EQN'   .ds label-type eqn
18605 .    ds spec-type \\$0
18606 .    substring spec-type -6 -10
18607 .    if '\\*[spec-type]'PTION' .ds spec-type caption
18608 .    if '\\*[spec-type]'LABEL' .ds spec-type label
18609 .    if '\\*[spec-type]'OURCE' .ds spec-type source
18610 .    QUAD \\$1
18611 .    ds \\*[label-type]*\\*[spec-type]-quad \\$1
18612 .    substring \\*[label-type]*\\*[spec-type]-quad 0 0
18613 .    if '\\*[label-type]'pdf-img' \{\
18614 .       if '\\*[\\*[label-type]*\\*[spec-type]-quad]'L' \{\
18615 .          if !\\n[pdf-img*\\*[spec-type]-quad-on-ll] \{\
18616 .             ie !'\\*[pdf-img:pos]'-R' \
18617 .                ll \\n[pdf-img:ind]u+\\n[pdf-img:width]u+\\n[pdf-img:frame-inset]u
18618 .             el .ll -\\n[ind-pre-img]u
18619 .             if '\\*[pdf-img:pos]'-C' \
18620 .                in \\n[pdf-img:ind]u-\\n[pdf-img:frame-inset]u
18621 .             if '\\*[pdf-img:pos]'-R' \
18622 .                in \\n[.l]u-(\\n[pdf-img:width]u+(\\n[pdf-img:frame-inset]u*2u))
18623 .             if '\\*[pdf-img:pos]'-I' \
18624 .                in \\n[pdf-img:ind]u
18625 .          \}
18626 .       \}
18627 .       if '\\*[\\*[label-type]*\\*[spec-type]-quad]'C' \{\
18628 .          if !\\n[pdf-img*\\*[spec-type]-quad-on-ll] \{\
18629 .             if '\\*[pdf-img:pos]'-L' \
18630 .                ll \\n[pdf-img:width]u+(\\n[pdf-img:frame-inset]u*2u)
18631 .             if '\\*[pdf-img:pos]'-C' \{\
18632 .                ll (\\n[ll-pre-img]u-\\n[pdf-img:width]u/2u+(\\n[pdf-img:frame-inset]u))+\\n[pdf-img:width]u
18633 .                in \\n[.l]u-(\\n[pdf-img:width]u+(\\n[pdf-img:frame-inset]u*2u))
18634 .             \}
18635 .             if '\\*[pdf-img:pos]'-R' \{\
18636 .                ll -\\n[ind-pre-img]u
18637 .                in \\n[.l]u-(\\n[pdf-img:width]u+(\\n[pdf-img:frame-inset]u*2u))
18638 .             \}
18639 .             if '\\*[pdf-img:pos]'-I' \{\
18640 .                ll \\n[pdf-img:ind]u+\\n[pdf-img:width]u+(\\n[pdf-img:frame-inset]u*2u)
18641 .                in \\n[pdf-img:ind]u
18642 .             \}
18643 .          \}
18644 .       \}
18645 .       if '\\*[\\*[label-type]*\\*[spec-type]-quad]'R' \{\
18646 .          if !\\n[pdf-img*\\*[spec-type]-quad-on-ll] \{\
18647 .             if '\\*[pdf-img:pos]'-L' \
18648 .                ll \\n[pdf-img:width]u+(\\n[pdf-img:frame-inset]u*2u]
18649 .             if '\\*[pdf-img:pos]'-C' \{\
18650 .                ll (\\n[.l]u-\\n[ind-pre-img]u-\\n[pdf-img:width]u/2u)+\\n[pdf-img:width]u+\\n[pdf-img:frame-inset]u
18651 .                in \\n[pdf-img:ind]u
18652 .             \}
18653 .             if '\\*[pdf-img:pos]'-R' \{\
18654 .                ll -\\n[ind-pre-img]u
18655 .                in \\n[.l]u-\\n[pdf-img:width]u
18656 .             \}
18657 .             if '\\*[pdf-img:pos]'-I' \{\
18658 .                ll \\n[pdf-img:ind]u+\\n[pdf-img:width]u+(\\n[pdf-img:frame-inset]u*2u)
18659 .                in \\n[pdf-img:ind]u
18660 .             \}   
18661 .          \}
18662 .       \}
18663 .    \}
18664 .    if '\\*[label-type]'pic' \{\
18665 .       if !\\n[pic*\\*[spec-type]-quad-on-ll] \{\
18666 .          ie \\n[pic*left] .ll \\n[pic*div-width]u
18667 .          el \{\
18668 .             ll \\n[pic*div-width]u
18669 \!.           in \\n[ll-pre-pic]u-\\n[pic*div-width]u/2u
18670 .          \}
18671 .       \}
18672 .    \}
18673 .    if '\\*[label-type]'tbl' \{\
18674 .       if !\\n[tbl*\\*[spec-type]-quad-on-ll] \{\
18675 .          ie \\n[tbl*center] \{\
18676 .             ie '\\*[spec-type]'label' \{\
18677 .\" Differentiate between a tbl label and a float label
18678 .                ie !'\\*[ev-current]'FLOAT' \{\
18679 .                   ll \\n[ll-pre-tbl]u-\\n[TW]u/2u+\\n[TW]u
18680 .                   if \\n[tbl*have-header] \
18681 .                      in (\\n[ll-pre-tbl]u-\\n[.i]u)-\\n[TW]u/2u+\\n[.i]u
18682 .                \}
18683 .                el \{\
18684 .                   in \\n[ll-pre-tbl]u+\\n[.i]u-\\n[TW]u/2u
18685 .                   ll \\n[.l]u-\\n[.i]u
18686 .                \}
18687 .             \}
18688 .             el \{\
18689 .                if '\\*[spec-type]'source' \{\
18690 .                    ie \\n[float*tbl] \{\
18691 .                       ll \\n[TW]u
18692 \!.                     in \\n[ll-pre-tbl]u-\\n[TW]u/2u+\\n[tmp-ind]u
18693 .                    \}
18694 .                    el \{\
18695 .                       ll \\n[TW]u+\\n[ind-pre-tbl]u
18696 .                       ie \\n[ind-pre-tbl] \
18697 \!.                        in \\n[ll-pre-tbl]u-\\n[TW]u/2u
18698 .                       el \
18699 \!.                        in \\n[ll-pre-tbl]u-\\n[TW]u/2u+\\n[tmp-ind]u
18700 .                    \}
18701 \!.                  ti -\\n[tmp-ind]u
18702 .                \}
18703 .                if '\\*[spec-type]'caption' \{\
18704 .                    ll \\n[ll-pre-tbl]u+\\n[.i]u-\\n[TW]u/2u+\\n[TW]u
18705 .                    in \\n[ll-pre-tbl]u+\\n[.i]u-\\n[TW]u/2u
18706 .                \}
18707 .             \}
18708 .          \}
18709 .          el \{\
18710 .             ll \\n[TW]u+\\n[.i]u
18711 .\" Check the effect of setting a source in non-MLA mode.
18712 .             if '\\*[spec-type]'source' \{\
18713 .                if \\n[#MLA] \{\
18714 .                   ie \\n[float*tbl] \{\
18715 \!.                    ll \\n[TW]u+\\n[ind-pre-tbl]u
18716 \!.                    in \\n[tmp-ind]u+\\n[ind-pre-tbl]u
18717 \!.                    ti -\\n[tmp-ind]u
18718 .                   \}
18719 .                   el \{\
18720 .                      ll \\n[TW]u+\\n[ind-pre-tbl]u
18721 \!.                      in \\n[tmp-ind]u
18722 \!.                      ti -\\n[tmp-ind]u
18723 .                   \}
18724 .                \}
18725 .             \}
18726 .          \}
18727 .       \}
18728 .    \}
18729 .END
18730 \#
18731 .ALIAS TBL*SET_CAPTION_QUAD     SET_QUAD
18732 .ALIAS TBL*SET_LABEL_QUAD       SET_QUAD
18733 .ALIAS TBL*SET_SOURCE_QUAD      SET_QUAD
18734 .ALIAS PDF_IMG*SET_CAPTION_QUAD SET_QUAD
18735 .ALIAS PDF_IMG*SET_LABEL_QUAD   SET_QUAD
18736 .ALIAS PIC*SET_CAPTION_QUAD     SET_QUAD
18737 .ALIAS PIC*SET_LABEL_QUAD       SET_QUAD
18738 \#
18739 .MAC style END
18740 .    ds label-type \\$0
18741 .    substring label-type 0 2
18742 .    if '\\*[label-type]'img' .ds label-type pdf-img
18743 .    if '\\*[label-type]'tbl' .ds label-type tbl
18744 .    if '\\*[label-type]'pic' .ds label-type pic
18745 .    ds spec-type \\$0
18746 .    substring spec-type 4 6
18747 .    if '\\*[spec-type]'cap' .ds spec-type caption
18748 .    if '\\*[spec-type]'lab' .ds spec-type label
18749 .    if '\\*[spec-type]'sou' .ds spec-type source
18750 '    fam \\*[\\*[label-type]*\\*[spec-type]-family]
18751 '    ft \\*[\\*[label-type]*\\*[spec-type]-font]
18752 '    ps \\n[#DOC_PT_SIZE]u\\*[\\*[label-type]*\\*[spec-type]-size-change]
18753 .    COLOR \\*[\\*[label-type]*\\*[spec-type]-color]
18754 .END
18755 \#
18756 .ALIAS tbl*caption-style style
18757 .ALIAS tbl*label-style   style
18758 .ALIAS tbl*source-style  style
18759 .ALIAS img*caption-style style
18760 .ALIAS img*label-style   style
18761 .ALIAS img*source-style  style
18762 .ALIAS pic*caption-style style
18763 .ALIAS pic*label-style   style
18764 .ALIAS pic*source-style  style
18765 \#
18766 \# User style macros
18767 \#
18768 \# TYPE SPECS FOR LABELS, CAPTIONS, AND SOURCES
18769 \# --------------------------------------------
18770 \#  Aliased as CAPTIONS and LABELS for eqn, pic, tbl, and pdf images.
18771 \# *Arguments:
18772 \#   EQN | IMG | PIC | TBL | FLOATING \
18773 \#   Remaining arguments are optional
18774 \#   FAMILY   fam \
18775 \#   FONT     sty \
18776 \#   SIZE     +|-size \
18777 \#   QUAD     LEFT | CENTRE | RIGHT [ ON_LL ] \
18778 \#   COLOR    color \
18779 \#   AUTOLEAD n \
18780 \#   ADJUST   +|-n
18781 \# *Function:
18782 \#   Sets type specs for captions, labels, and sources according to
18783 \#   calling alias name
18784 \# *Notes:
18785 \#   SIZE is relative to running text.
18786 \#   QUAD optional arg says quad on full line length rather than
18787 \#    pdf-img or pre-processor output.  
18788 \#
18789 .MAC CAPTION_LABEL_SPECS END
18790 .    if '\\$0'CAPTIONS' .ds spec-type caption
18791 .    if '\\$0'LABELS'   .ds spec-type label
18792 .    if '\\$0'SOURCES'  .ds spec-type source
18793 .    ds $LABEL-TYPE \\$1
18794 .    if '\\$1'EQN'      .ds label-type eqn
18795 .    if '\\$1'FLOATING' .ds label-type floating
18796 .    if '\\$1'IMG'      .ds label-type pdf-img
18797 .    if '\\$1'PIC'      .ds label-type pic
18798 .    if '\\$1'TBL'      .ds label-type tbl
18799 .    if '\\$1'ALL'      .nr all 1
18800 .    shift
18801 .    nr loop-counter \\n[#NUM_ARGS]
18802 .    nr loop-count 0 1
18803 .    while \\n+[loop-count]<=\\n[loop-counter] \{\
18804 .       if '\\$1'FAMILY' \{\
18805 .          shift
18806 .          ie r all \{\
18807 .             nr all 0 1
18808 .             while \\n+[all]<=5 \{\
18809 .                 get-label-type
18810 .                 ds \\*[label-type]*\\*[spec-type]-family \\$1
18811 .             \}
18812 .          \}
18813 .          el .ds \\*[label-type]*\\*[spec-type]-family \\$1
18814 .          if \\n[#PRINT_STYLE]=1 \
18815 .             ds \\*[label-type]*\\*[spec-type]-family \\*[$TYPEWRITER_FAM]
18816 .          shift
18817 .       \}
18818 .       if '\\$1'FONT' \{\
18819 .          shift
18820 .          ie r all \{\
18821 .             nr all 0 1
18822 .             while \\n+[all]<=5 \{\
18823 .                 get-label-type
18824 .                 ds \\*[label-type]*\\*[spec-type]-font \\$1
18825 .             \}
18826 .          \}
18827 .          el .ds \\*[label-type]*\\*[spec-type]-font \\$1
18828 .          if \\n[#PRINT_STYLE]=1 \
18829 .             ds \\*[label-type]*\\*[spec-type]-font R
18830 .          shift
18831 .       \}
18832 .       if '\\$1'SIZE' \{\
18833 .          shift
18834 .          ie r all \{\
18835 .             nr all 0 1
18836 .             while \\n+[all]<=5 \{\
18837 .                 get-label-type
18838 .                 ds \\*[label-type]*\\*[spec-type]-size-change \\$1
18839 .             \}
18840 .          \}
18841 .          el .ds \\*[label-type]*\\*[spec-type]-size-change \\$1
18842 .          if \\n[#PRINT_STYLE]=1 \
18843 .             ds \\*[label-type]*\\*[spec-type]-size-change +0
18844 .          shift
18845 .       \}
18846 .       if '\\$1'AUTOLEAD' \{\
18847 .          shift
18848 .          ie r all \{\
18849 .             nr all 0 1
18850 .             while \\n+[all]<=5 \{\
18851 .                 get-label-type
18852 .                 nr \\*[label-type]*\\*[spec-type]-autolead (p;\\$1)
18853 .             \}
18854 .          \}
18855 .          el .nr \\*[label-type]*\\*[spec-type]-autolead (p;\\$1)
18856 .          shift
18857 .       \}
18858 .       if '\\$1'QUAD' \{\
18859 .          shift
18860 .          ie r all \{\
18861 .             nr all 0 1
18862 .             while \\n+[all]<=5 \{\
18863 .                 get-label-type
18864 .                 ds \\*[label-type]*\\*[spec-type]-quad \\$1
18865 .                 substring \\*[label-type]*\\*[spec-type]-quad 0 0
18866 .                 if '\\$2'ON_LL' \
18867 .                    nr \\*[label-type]*\\*[spec-type]-quad-on-ll 1
18868 .             \}
18869 .          \}
18870 .          el \{\
18871 .             ds \\*[label-type]*\\*[spec-type]-quad \\$1
18872 .             substring \\*[label-type]*\\*[spec-type]-quad 0 0
18873 .             if \\n[\\*[label-type]*\\*[spec-type]-quad-on-ll] \
18874 .                rr \\*[label-type]*\\*[spec-type]-quad-on-ll 
18875 .             if '\\$2'ON_LL' \
18876 .                nr \\*[label-type]*\\*[spec-type]-quad-on-ll 1
18877 .          \}
18878 .          ie '\\$2'ON_LL' .shift 2
18879 .          el  .shift
18880 .       \}
18881 .       if '\\$1'COLOR' \{\
18882 .          shift
18883 .          ie r all \{\
18884 .             nr all 0 1
18885 .             while \\n+[all]<=5 \{\
18886 .                 get-label-type
18887 .                 ds \\*[label-type]*\\*[spec-type]-color \\$1
18888 .             \}
18889 .          \}
18890 .          el .ds \\*[label-type]*\\*[spec-type]-color \\$1
18891 .          if \\n[#PRINT_STYLE]=1 \
18892 .             ds \\*[label-type]*\\*[spec-type]-color black
18893 .          shift
18894 .       \}
18895 .       if '\\$1'ADJUST' \{\
18896 .          shift
18897 .          ie r all \{\
18898 .             nr all 0 1
18899 .             while \\n+[all]<=5 \{\
18900 .                 get-label-type
18901 .                 ds \\*[label-type]*\\*[spec-type]-space \\$1
18902 .             \}
18903 .          \}
18904 .          el .ds \\*[label-type]*\\*[spec-type]-space \\$1
18905 .          if \\n[#PRINT_STYLE]=1 \
18906 .             ds \\*[label-type]*\\*[spec-type]-space +0
18907 .          shift
18908 .       \}
18909 .       if '\\$1'INDENT' \{\
18910 .          shift
18911 .          ie '\\*[label-type]'floating' \{\
18912 .             ie \B'\\$1' \{\
18913 .                nr \\*[label-type]*\\*[spec-type]-indent-l \\$1
18914 .                shift
18915 .             \}
18916 .             el \{\
18917 .                ie '\\$1'RIGHT' \{\
18918 .                   shift
18919 .                   nr \\*[label-type]*\\*[spec-type]-indent-r \\$1
18920 .                   shift
18921 .                \}
18922 .                el \{\
18923 .                   tm1 \
18924 "[mom]: Missing value for INDENT in macro '\\$0' at line \\n[.c].
18925 .                   ab \
18926 [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
18927 .                \}
18928 .             \}
18929 .          \}
18930 .          el \{\
18931 .             shift
18932 .             if !\\n[#SKIP_INDENT_WARNING] \{\
18933 .                tm1 \
18934 "[mom]: '\\$0 \\*[$LABEL-TYPE]' at line \\n[.c] does not take an indent.
18935 .                tm1 \
18936 "        No indent(s) will be applied.
18937 .                nr #SKIP_INDENT_WARNING 1
18938 .             \}
18939 .             if '\\$1'INDENT' .shift
18940 .             if '\\$1'RIGHT'  .shift
18941 .             if \B'\\$1'      .shift
18942 .          \}
18943 .       \}
18944 .    \}
18945 .    ie r all \{\
18946 .       nr all 0 1
18947 .       while \\n+[all]<=5 \{\
18948 .          get-label-type
18949 .          set-defaults
18950 .          set-inline-specs
18951 .       \}
18952 .    \}
18953 .    el \{\
18954 .       set-defaults
18955 .       set-inline-specs
18956 .    \}
18957 .    ds revert-specs \f[]\s[0]\m[]
18958 .    rr #SKIP_INDENT_WARNING
18959 .    rr all
18960 .END
18961 .
18962 .ALIAS CAPTIONS CAPTION_LABEL_SPECS
18963 .ALIAS LABELS   CAPTION_LABEL_SPECS
18964 .ALIAS SOURCES  CAPTION_LABEL_SPECS
18965 \#
18966 \# LABELS and CAPTIONS (floats and [block]quotes)
18967 \# ----------------------------------------------
18968 \# *Arguments:
18969 \#   <text of label or caption> [ CAPTION <text of caption> ] \
18970 \#   [ TO_LIST FIGURES | EQUATIONS | TABLES ]
18971 \# *Function:
18972 \#   Add label/caption to float, quotes, and blockquotes
18973 \# *Notes:
18974 \#   Aliased as CAPTION.  If called as CAPTION, prints all
18975 \#   double-quoted text strings including ".br" or ".sp";
18976 \#   may come at top or bottom of labelled object, or both.
18977 \#   If called as LABEL, optional arg CAPTION attaches caption
18978 \#   text to the label; may only come at bottom of object and
18979 \#   can only take one double-quoted text string.
18980 \#
18981 \# These strings allow users to create labels of the form
18982 \# 'Fig. \*[chapter].\*[fig-label]', e.g. 'Fig. 1.1'
18983 \#
18984 .ds chapter   \\n[#CH_NUM]
18985 .ds fig-label \\n+[fig*label-num]
18986 .ds tbl-label \\n+[tbl*label-num]
18987 .ds eqn-label \\n+[eqn*label-num]
18988 \#
18989 \#
18990 .MAC LABEL END
18991 .    br
18992 .    if \\n[.ns] \{\
18993 .       vpt 0
18994 .       rs
18995 .       nop \&
18996 .       sp -1
18997 .       vpt
18998 .    \}
18999 .    if r chop-space .sp -1
19000 .    rr chop-space
19001 .    if \\n[#QUOTE] .nr q-float 1
19002 .    if '\\$0'CAPTION' \{\
19003 .       ds labelcap caption
19004 .       ds $FLOATING_CAPTION \\$*
19005 .    \}
19006 .    if '\\$0'LABEL' \{\
19007 .       ds labelcap label
19008 .       ds $FLOATING_LABEL \\$1
19009 .       shift
19010 .       nr loop-counter 0 1
19011 .       nr loop-count \\n[#NUM_ARGS]
19012 .       while \\n+[loop-counter]<=\\n[loop-count] \{\
19013 .          if '\\$1'CAPTION' \{\
19014 .             nr with-caption 1
19015 .             ds $FLOATING_CAPTION \\$2
19016 .             shift 2
19017 .          \}
19018 .          if '\\$1'SHORT_CAPTION' \{\
19019 .             ds $LIST_CAPTION \\$2
19020 .             shift 2
19021 .          \}
19022 .          if '\\$1'TO_LIST' \{\
19023 .             nr to-list 1
19024 .             if '\\$2'FIGURES'   .ds $LIST_OF FIGURES
19025 .             if '\\$2'EQUATIONS' .ds $LIST_OF EQUATIONS
19026 .             if '\\$2'TABLES'    .ds $LIST_OF TABLES
19027 .             shift 2
19028 .          \}
19029 .       \}
19030 .    \}
19031 .    if \\n[D-float] \
19032 .       if \\n[.d]>\\n[D-float] \
19033 .          sp \\n[.d]u-\\n[D-float]u
19034 .    rr has-\\*[labelcap]
19035 .    nr has-\\*[labelcap] 1
19036 .    rr @bottom
19037 .    if !\\n[.d]=0 .nr @bottom 1
19038 .    ds ev-current \\n[.ev]
19039 .    ev floating*labelcap
19040 .    evc \\*[ev-current]
19041 .    ps \\n[#DOC_PT_SIZE]u
19042 .    if \\n[floating*\\*[labelcap]-indent-l] \
19043 .       in \\n[floating*\\*[labelcap]-indent-l]u
19044 .    if \\n[floating*\\*[labelcap]-indent-r] \
19045 .       ll -\\n[floating*\\*[labelcap]-indent-r]u
19046 .    ds $QUAD_PREV \\*[$QUAD_VALUE]
19047 .    QUAD \\*[floating*\\*[labelcap]-quad]
19048 .\" 1/4 space before both captions and labels
19049 \!.  if \\\\n[nl]=\\\\n[#PAGE_TOP] .nr deferred-float 1
19050 .    if !\\n[deferred-float] \{\
19051 .       ie !\\n[@bottom] \{\
19052 .          ie '\\n[.z]'' \
19053 .            sp \\n[#DOC_LEAD]u/4u
19054 .          el \
19055 .            if '\\n[.z]'FLOAT*DIV' .sp \\n[#DOC_LEAD]u/4u
19056 .       \}
19057 .       el \{\
19058 .          sp \\n[#DOC_LEAD]u/4u
19059 .          rr @bottom
19060 .       \}
19061 .    \}
19062 \!.  if \\\\n[deferred-float] \{\
19063 .       if !\\n[#QUOTE] .sp -(\\n[#DOC_LEAD]u/4u)
19064 \!.  \}
19065 .    nr floating*\\*[labelcap]-lead-diff \\n[.v]
19066 .    vs \\n[.ps]u+\\n[floating*\\*[labelcap]-autolead]u
19067 .    nr floating*\\*[labelcap]-lead-diff \
19068         \\n[floating*\\*[labelcap]-lead-diff]-\\n[.v]
19069 .    if !\\n[deferred-float] \
19070 .       RESTORE_SPACE
19071 .    ie '\\*[labelcap]'label' \{\
19072 .       if \\n[to-list] \{\
19073 .\" Strip prefix from label if list-type is being autolabelled
19074 .\" Becomes $LIST_LABEL
19075 .          if '\\*[$LIST_OF]'FIGURES' \
19076 .             if r fig*label-num .STRIP_PRFX_SFFX "\\*[$FLOATING_LABEL]"
19077 .          if '\\*[$LIST_OF]'TABLES' \
19078 .             if r tbl*label-num .STRIP_PRFX_SFFX "\\*[$FLOATING_LABEL]"
19079 .          if '\\*[$LIST_OF]'EQUATIONS' \
19080 .             if r eqn*label-num .STRIP_PRFX_SFFX "\\*[$FLOATING_LABEL]"
19081 .       \}
19082 .       ds $FLOATING_LABEL \
19083 \F[\\\\*[floating*label-family]]\
19084 \f[\\\\*[floating*label-font]]\
19085 \s[\\\\*[floating*label-size-change]]\
19086 \m[\\\\*[floating*label-color]]\
19087 \\*[$FLOATING_LABEL]
19088 .    \}
19089 .    el \{\
19090 .       if !\\n[deferred-float] \
19091 .          sp \\n[floating*caption-lead-diff]u
19092 .       if !'\\*[floating*caption-space]'' \
19093 .          sp \\*[floating*caption-space]
19094 .       while !'\\$1'' \{\
19095 .          nop \
19096 \F[\\*[floating*caption-family]]\
19097 \f[\\*[floating*caption-font]]\
19098 \s[\\*[floating*caption-size-change]]\
19099 \m[\\*[floating*caption-color]]\
19100 \\$1
19101 .          if \\n[.u]=1 .br
19102 .          shift
19103 .       \}
19104 .       if !'\\*[floating*caption-space]'' \
19105 .          sp -\\*[floating*caption-space]
19106 .    \}
19107 .    if \\n[with-caption] \{\
19108 .       nr width-label \w'\\*[$FLOATING_LABEL]'
19109 .       if !\\n[width-label]=0 \
19110 .         as $FLOATING_LABEL \0
19111 .       as $FLOATING_LABEL \
19112 \F[\\\\*[floating*caption-family]]\
19113 \f[\\\\*[floating*caption-font]]\
19114 \s[\\\\*[floating*caption-size-change]]\
19115 \m[\\\\*[floating*caption-color]]\
19116 \\*[$FLOATING_CAPTION]
19117 .       if '\\*[$LIST_CAPTION]'' \
19118 .          ds $LIST_CAPTION \\*[$FLOATING_CAPTION]
19119 .    \}
19120 .    if !'\\*[$FLOATING_LABEL]'' \{\
19121 .       sp \\n[floating*label-lead-diff]u
19122 .       if !'\\*[floating*label-space]'' \
19123 .          sp \\*[floating*label-space]
19124 .       nop \\*[$FLOATING_LABEL]
19125 .       if \\n[.u]=1 .br
19126 .       if !'\\*[floating*label-space]'' \
19127 .          sp -\\*[floating*label-space]
19128 .    \}
19129 .\" 1/4 space after captions and labels
19130 .    ie !\\n[@bottom] \
19131 .       sp \\n[#DOC_LEAD]u/4u
19132 .    el \{\
19133 .       if '\\n[.z]'FLOAT*DIV' \{\
19134 .          sp \\n[#DOC_LEAD]u/4u
19135 \!.        if \\\\n[deferred-float] \
19136 .             sp -(\\n[#DOC_LEAD]u/4u)
19137 .       \}
19138 .    \}
19139 \!.  rr deferred-float
19140 .    ll
19141 .    vs
19142 .    QUAD \\*[$QUAD_PREV]
19143 .    in
19144 .    ev
19145 .    if \\n[to-list] \{\
19146 .       nr loop-counter 0 1
19147 .       nr loop-count 2
19148 .       ds labelcap label
19149 .       while \\n+[loop-counter]<=\\n[loop-count] \{\
19150 .          ds \\*[labelcap]-family      \\*[floating*\\*[labelcap]-family]
19151 .          ds \\*[labelcap]-font        \\*[floating*\\*[labelcap]-font]
19152 .          ds \\*[labelcap]-size-change \\*[floating*\\*[labelcap]-size-change]
19153 .          ds \\*[labelcap]-color       \\*[floating*\\*[labelcap]-color]
19154 .          ie '\\*[$LISTS_FAM]'' \
19155 .             ds floating*\\*[labelcap]-family \\*[$DOC_FAM]
19156 .          el \
19157 .             ds floating*\\*[labelcap]-family \\*[$LISTS_FAM]
19158 .          if '\\*[$LISTS_FT]'' \
19159 .             ds floating*\\*[labelcap]-font R
19160 .          ds floating*\\*[labelcap]-size-change +0
19161 .          ds floating*\\*[labelcap]-color pdf:href.colour
19162 .          ds labelcap caption
19163 .       \}
19164 .       ie '\\*[$LIST_LABEL]'' .TO_\\*[$LIST_OF] "\\*[$FLOATING_LABEL]
19165 .       el .TO_\\*[$LIST_OF] "\\*[$LIST_LABEL]" "\\*[$LIST_CAPTION]
19166 .       rr to-list
19167 .       nr loop-counter 0 1
19168 .       nr loop-count 2
19169 .       ds labelcap label
19170 .       while \\n+[loop-counter]<=\\n[loop-count] \{\
19171 .          ds floating*\\*[labelcap]-family      \\*[\\*[labelcap]-family]
19172 .          ds floating*\\*[labelcap]-font        \\*[\\*[labelcap]-font]
19173 .          ds floating*\\*[labelcap]-size-change \\*[\\*[labelcap]-size-change]
19174 .          ds floating*\\*[labelcap]-color       \\*[\\*[labelcap]-color]
19175 .          ds labelcap caption
19176 .       \}
19177 .    \}
19178 .    rr with-caption
19179 .    rm $FLOATING_CAPTION
19180 .    rm $FLOATING_LABEL
19181 .    rm $LIST_LABEL
19182 .    rm $LIST_CAPTION
19183 .END
19184 .
19185 .ALIAS CAPTION LABEL
19186 .
19187 .MAC STRIP_PRFX_SFFX END
19188 .\" Strip suffix from label string
19189 .       ds suffix \\$1
19190 .       substring suffix -1
19191 .\" If suffix is '.' ',' ':' or ')', remove it.
19192 .       if '\\*[suffix]'.' .nr strip-suffix 1
19193 .       if '\\*[suffix]',' .nr strip-suffix 1
19194 .       if '\\*[suffix]':' .nr strip-suffix 1
19195 .       if '\\*[suffix]')' .nr strip-suffix 1
19196 .       if \\n[strip-suffix] \{\
19197 .          ds $LIST_LABEL \\$1
19198 .          substring $LIST_LABEL 0 -2
19199 .       \}
19200 .       rr strip-suffix
19201 .       if '\\*[$LIST_LABEL]'' .ds $LIST_LABEL \\$1
19202 .\" Remove prefix (e.g. "Fig. ") by looping through $LIST_LABEL
19203 .\" until a digit is encountered
19204 .       nr loop-counter 100 \" arbitrary
19205 .       nr loop-count 0 1
19206 .       while \\n+[loop-count]<=\\n[loop-counter] \{\
19207 .          substring $LIST_LABEL 1
19208 .          if \B'\\*[$LIST_LABEL]' .break
19209 .       \}
19210 .       substring $LIST_LABEL 1
19211 .END
19212 \#
19213 \# CAPTION_AFTER_LABEL
19214 \# -------------------
19215 \# *Arguments:
19216 \#   <none> | <anything>
19217 \# *Function:
19218 \#   Sets register indicating non-MLA captions should come after labels.
19219 \#
19220 .MAC CAPTION_AFTER_LABEL END
19221 .    if '\\$1'IMG' .ds type pdf-img
19222 .    if '\\$1'PIC' .ds type pic
19223 .    if '\\$1'TBL' .ds type tbl
19224 .    if !\\n[#MLA] \{\
19225 .       nr \\*[type]*caption-after-label 1
19226 .       if '\\$1'ALL' \{\
19227 .          nr pdf-img*caption-after-label 1
19228 .          nr tbl*caption-after-label 1
19229 .          nr pic*caption-after-label 1
19230 .       \}
19231 .       if !'\\$2'' \{\
19232 .          ie !'\\$1'ALL' .rr \\*[type]*caption-after-label
19233 .          el \{\
19234 .             rr pdf-img*caption-after-label
19235 .             rr tbl*caption-after-label
19236 .             rr pic*caption-after-label
19237 .          \}
19238 .       \}
19239 .    \}
19240 .END
19241 \#
19242 \# AUTOLABELLING
19243 \# -------------
19244 \# *Argument:
19245 \#   [ PREFIX <prefix> SUFFIX <suffix> ] | <anything>
19246 \# *Function:
19247 \#   Turns label autonumbering on of off; optionally lets user set
19248 \#   prefix and suffix for labels.
19249 \# *Notes:
19250 \#   Aliased for images (pdf), tbl, pic, and eqn.
19251 \#
19252 .MAC AUTOLABEL END
19253 .    if '\\$0'AUTOLABEL_EQUATIONS' .ds label-type eqn
19254 .    if '\\$0'AUTOLABEL_TABLES'    .ds label-type tbl
19255 .    if '\\$0'AUTOLABEL_PIC' \{\
19256 .       ds label-type pic
19257 .       nr fig*autolabel 1
19258 .    \}
19259 .    if '\\$0'AUTOLABEL_IMAGES' \{\
19260 .        ds label-type pdf-img
19261 .        nr fig*autolabel 1
19262 .    \}
19263 .    if !'\\$1'' \{\
19264 .       ds \\*[label-type]-label-args \\$1
19265 .       substring \\*[label-type]-label-args -1 -3
19266 .    \}
19267 .    if '\\*[\\*[label-type]-label-args]'FIX' .nr \\*[label-type]-label-args 1
19268 .    if '\\*[\\*[label-type]-label-args]'TER' .nr \\*[label-type]-label-args 1
19269 .    if !\\n[\\*[label-type]*label-num] \
19270 .       nr \\*[label-type]*label-num 0 1
19271 .    if '\\*[label-type]'pdf-img' \
19272 .       if !\\n[fig*label-num] .nr fig*label-num 0 1
19273 .    if '\\*[label-type]'pic' \
19274 .       if !\\n[pic*label-num] .nr fig*label-num 0 1
19275 .    nr \\*[label-type]*autolabel 1
19276 .    nr loop-counter 0 1
19277 .    nr loop-count \\n[#NUM_ARGS]
19278 .    while \\n+[loop-counter]<=\\n[loop-count] \{\
19279 .       if '\\$1'PREFIX' \{\
19280 .          ds \\*[label-type]*label-prfx \\$2
19281 .          nr \\*[label-type]*label-prfx-set 1
19282 .          shift 2
19283 .       \}
19284 .       if '\\$1'SUFFIX' \{\
19285 .          ds \\*[label-type]*label-sffx \\$2
19286 .          nr \\*[label-type]*label-sffx-set 1
19287 .          shift 2
19288 .       \}
19289 .       if '\\$1'PREFIX_CHAPTER' \{\
19290 .          if \\n[fig*autolabel] .nr fig*label-with-chapter 1
19291 .          nr \\*[label-type]*label-with-chapter 1
19292 .          shift 1
19293 .          if \B'\\$1' \{\
19294 .             nr #CH_NUM \\$1
19295 .             shift
19296 .          \}
19297 .       \}
19298 .    \}
19299 .    if '\\*[\\*[label-type]*label-prfx]'' \{\
19300 .       if '\\*[label-type]'eqn' \
19301 .          if !\\n[\\*[label-type]*label-prfx-set] \
19302 .             ds \\*[label-type]*label-prfx (\"
19303 .       if '\\*[label-type]'pic' \
19304 .          if !\\n[\\*[label-type]*label-prfx-set] \
19305 .             ds \\*[label-type]*label-prfx Fig. \"
19306 .       if '\\*[label-type]'pdf-img' \
19307 .          if !\\n[\\*[label-type]*label-prfx-set] \
19308 .             ds \\*[label-type]*label-prfx Fig. \"
19309 .       if '\\*[label-type]'tbl' \
19310 .          if !\\n[\\*[label-type]*label-prfx-set] \
19311 .             ds \\*[label-type]*label-prfx Table \"
19312 .    \}
19313 .    if '\\*[\\*[label-type]*label-sffx]'' \{\
19314 .       if '\\*[label-type]'eqn' \
19315 .          if !\\n[\\*[label-type]*label-sffx-set] \
19316 .             ds \\*[label-type]*label-sffx )\"
19317 .       if '\\*[label-type]'pic' \
19318 .          if !\\n[\\*[label-type]*label-sffx-set] \
19319 .             ds \\*[label-type]*label-sffx .\"
19320 .       if '\\*[label-type]'pdf-img' \
19321 .          if !\\n[\\*[label-type]*label-sffx-set] \
19322 .             ds \\*[label-type]*label-sffx .\"
19323 .       if '\\*[label-type]'tbl' \
19324 .          if !\\n[\\*[label-type]*label-sffx-set] \
19325 .             ds \\*[label-type]*label-sffx .\"
19326 .    \}
19327 .    if \\n[\\*[label-type]-label-args]>0 \{\
19328 .       if \\n[\\*[label-type]*label-prfx-set]+\\n[\\*[label-type]*label-sffx-set]=1 \{\
19329 .          ie (\\n[\\*[label-type]*label-prfx-set]=1)&(\\n[\\*[label-type]*label-sffx-set]=0) \
19330 .             ds missing-arg SUFFIX
19331 .          el .ds missing-arg PREFIX
19332 .          tm1 "[mom]: You must supply a \\*[missing-arg] argument to \\$0.
19333 .          tm1 "       If you wish the \\*[missing-arg] to be blank, use \\*[missing-arg] "".
19334 .          ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
19335 .       \}
19336 .    \}
19337 .    if \\n[#NUM_ARGS]=1 \{\
19338 .       rr fig*autolabel
19339 .       rr \\*[label-type]*autolabel
19340 .       rr \\*[label-type]*label-prfx-set
19341 .       rr \\*[label-type]*label-sffx-set
19342 .    \}
19343 .    rr \\*[label-type]-label-args
19344 .END
19345 \#
19346 .ALIAS AUTOLABEL_EQUATIONS AUTOLABEL
19347 .ALIAS AUTOLABEL_IMAGES    AUTOLABEL
19348 .ALIAS AUTOLABEL_PIC       AUTOLABEL
19349 .ALIAS AUTOLABEL_TABLES    AUTOLABEL
19350 \#
19351 \# SET AUTOLABEL NUMBER
19352 \# --------------------
19353 \# *Argument:
19354 \#   FIG | TBL | PIC | EQN <n>
19355 \# *Function:
19356 \#   Sets the autolabel number for the corresponding label type.
19357 \# *Notes:
19358 \#   Used to set autolabel number when manual labelling of floats
19359 \#   (in conjunction with TO_LIST) disrupts auto-incrementing.
19360 \#   
19361 .MAC SET_AUTOLABEL END
19362 .    rm labelnum-type
19363 .    if '\\$1'FIG' .ds labelnum-type fig
19364 .    if '\\$1'TBL' .ds labelnum-type tbl
19365 .    if '\\$1'PIC' .ds labelnum-type pic
19366 .    if '\\$1'EQN' .ds labelnum-type eqn
19367 .    nr labelnum \\$2-1
19368 .    nr \\*[labelnum-type]*label-num \\n[labelnum] 1
19369 .END
19370 \#
19371 \# MLA STYLE
19372 \# ---------
19373 \# *Argument:
19374 \#   <none> | <anything>
19375 \# *Function:
19376 \#   Sets or removes register #MLA.
19377 \# *Notes:
19378 \#   MLA formatting differs from other styles wrt caption and
19379 \#   label placement.
19380 \#
19381 .MAC MLA END
19382 .    ie '\\$1'' \{\
19383 .       nr #MLA 1
19384 .       nr pdf-img*caption-after-label 1
19385 .       nr pic*caption-after-label 1
19386 .       rr tbl*caption-after-label
19387 .    \}
19388 .    el \
19389 .       rr #MLA
19390 .END
19391 \#
19392 .MAC mla@error END
19393 .    tm1 "[mom]: MLA style enabled, but \\$1 has no corresponding \\$2.
19394 .    ab   [mom]: Aborting '\\$3' at \\$4, line \\$5.
19395 .END
19396 \#
19397 \# LISTS_OF
19398 \# --------
19399 \# *Aliases:
19400 \#   LIST_OF_EQUATIONS
19401 \#   LIST_OF_FIGURES
19402 \#   LIST_OF_TABLES
19403 \# *Arguments:
19404 \#   [ TITLE_STRING <string> ] [ START_PAGENUM <pagenumber> ]
19405 \# *Function:
19406 \#   Generates lists-of based on calling alias.
19407 \# *Notes:
19408 \#   Called at end of file.
19409 \#   If after TOC, and TOC is being auto-relocated, lists are also
19410 \#   relocated.  If called before, lists are output at end of file.
19411 \#
19412 .MAC LISTS_OF END
19413 .    EOL
19414 .    ds $LIST_TYPE \\$0
19415 .    nr #LISTS 1
19416 .    substring $LIST_TYPE -1 -4
19417 .    if '\\*[$LIST_TYPE]'URES' \{\
19418 .       ds $LIST_TYPE FIGURES
19419 .       ds list-type fig
19420 .       ds label-type fig
19421 .       ds \\*[$LIST_TYPE]_TITLE_STRING "List of Figures
19422 .    \}
19423 .    if '\\*[$LIST_TYPE]'BLES' \{\
19424 .       ds $LIST_TYPE TABLES
19425 .       ds list-type tbl
19426 .       ds label-type tbl
19427 .       ds \\*[$LIST_TYPE]_TITLE_STRING "List of Tables
19428 .    \}
19429 .    if '\\*[$LIST_TYPE]'IONS' \{\
19430 .       ds $LIST_TYPE EQUATIONS
19431 .       ds list-type eqn
19432 .       ds label-type eqn
19433 .       ds \\*[$LIST_TYPE]_TITLE_STRING "List of Equations
19434 .    \}
19435 .    nr #LIST_OF_\\*[$LIST_TYPE] 1
19436 .    nr loop-count 0 1
19437 .    nr loop-counter \\n[#NUM_ARGS]
19438 .    while \\n+[loop-count]<=\\n[loop-counter] \{\
19439 .       if '\\$1'TITLE_STRING' \{\
19440 .          ds \\*[$LIST_TYPE]_TITLE_STRING \\$2
19441 .          shift 2
19442 .       \}
19443 .       if '\\$1'START_PAGENUM' \{\
19444 .          nr #\\*[$LIST_TYPE]_START_PAGENUM \\$2
19445 .          shift 2
19446 .       \}
19447 .    \}
19448 .    if dPDF.EXPORT \
19449 .       if \\n[#FLEX_ACTIVE] \
19450 .          if !\\n[#NO_FLEX] \
19451 .             tm .ds pre-list-\\n%@\\n[#COL_NUM] 1
19452 .    char \[leader] " .
19453 .    LEADER_CHARACTER \[leader]
19454 .    if \\n[#LINENUMBERS]=1 \{\
19455 .       NUMBER_LINES OFF
19456 .       nr #LINENUMBERS 2
19457 .    \}
19458 .    if \\n[#FINIS] \{\
19459 .       if \\n[#FOOTERS_WERE_ON] \
19460 .          FOOTERS
19461 .    \}
19462 .    if \\n[#FOOTERS_ON]=1 \{\
19463 .       if !'\\*[$HDRFTR_CENTER_OLD]'' .ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_OLD]
19464 .       ie \\n[#LISTS_NO_PAGENUM]=1 .PAGINATION OFF
19465 .       el .PAGINATE
19466 .    \}
19467 .    if \\n[#FOOTERS_WERE_ON] \
19468 .       if !\\n[#FINIS] .FOOTERS OFF
19469 .    rr #COLUMNS
19470 .    COLLATE
19471 .    if \\n[#PRINT_STYLE]=1 \{\
19472 .       if \\n[#SINGLE_SPACE] .LS 24
19473 .       DOC_LEAD_ADJUST
19474 .    \}
19475 .    if \\n[#FINIS] \{\
19476 .       if \\n[#FOOTERS_WERE_ON] .FOOTERS
19477 .       rr #FOOTERS_WERE_ON
19478 .       if \\n[#PAGINATION_WAS_ON] \{\
19479 .          nr #PAGINATE 1
19480 .          rr #PAGINATION_WAS_ON
19481 .       \}
19482 .       rr #FINIS
19483 .    \}
19484 .    ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_NEW]
19485 .    rm $HDRFTR_CENTER_OLD
19486 .    rm $HDRFTR_CENTER_NEW
19487 .    rr #COLLATED_DOC
19488 .    DOCTYPE DEFAULT
19489 .    DOCHEADER
19490 .    rr #DOCHEADER_ADVANCE
19491 .    TITLE "\\*[\\*[$LIST_TYPE]_TITLE_STRING]
19492 .    AUTHOR ""
19493 .    L_MARGIN \\n[#DOC_L_MARGIN]u
19494 .    LL       \\n[#DOC_L_LENGTH]u
19495 .    if '\\*[$LISTS_FAM]'' \
19496 .       ds $LISTS_FAM \\*[$TOC_FAM]
19497 .    if '\\*[$LISTS_FT]'' \
19498 .       ds $LISTS_FT \\*[$TOC_TITLE_FT]
19499 .    if !\\n[#LISTS_PS] \
19500 .       nr #LISTS_PS \\n[#TOC_PS]
19501 .    ps \\n[#LISTS_PS]u
19502 .    if !\\n[#LISTS_LEAD] \
19503 .       nr #LISTS_LEAD \\n[#TOC_LEAD]
19504 .    if \\n[#PRINT_STYLE]=2 \{\
19505 .       ie \\n[#LISTS_LEAD_ADJUST]=1 \{\
19506 .          nr #DOC_LEAD \\n[#LISTS_LEAD]
19507 .          DOC_LEAD_ADJUST
19508 .          TRAPS
19509 .       \}
19510 .       el \{\
19511 .          nr #DOC_LEAD \\n[#LISTS_LEAD]
19512 .          DOC_LEAD_ADJUST OFF
19513 .       \}
19514 .    \}
19515 .    ie !'\\*[$LISTS_TITLE_QUAD]'' \
19516 .       DOCHEADER_QUAD \\*[$LISTS_TITLE_QUAD]
19517 .    el .DOCHEADER_QUAD \\*[$TOC_HEADER_QUAD]
19518 .    if !'\\*[$LISTS_TITLE_FAM]'' \
19519 .       TITLE_FAMILY \\*[$LISTS_TITLE_FAM]
19520 .    if !'\\*[$LISTS_TITLE_FT]'' \
19521 .       TITLE_FONT  \\*[$LISTS_TITLE_FT]
19522 .    if !'\\*[$LISTS_TITLE_SIZE]'' \
19523 .       TITLE_SIZE \\*[$LISTS_TITLE_SIZE]
19524 .    if !'\\*[$LISTS_TITLE_COLOR]'' \
19525 .       TITLE_COLOR \\*[$LISTS_TITLE_COLOR]
19526 .    if \\n[#LISTS_TITLE_CAPS] \
19527 .       TITLE_CAPS
19528 .    if \\n[#LISTS_TITLE_SMALLCAPS] \
19529 .       TITLE_SMALLCAPS
19530 .    if \\n[#LISTS_TITLE_UNDERSCORE] \{\
19531 .       TITLE_UNDERSCORE \
19532 \\*[DOUBLE] \
19533 \\*[$LISTS_OF_UL_WT] \
19534 \\*[$LISTS_OF_UL_GAP] \
19535 \\*[$LISTS_OF_RULE_GAP]
19536 .    \}
19537 .    if '\\*[$LISTS_PN_FAM]'' \
19538 .       ds $LISTS_PN_FAM \\*[$TOC_PN_FAM]
19539 .    if '\\*[$LISTS_PN_FT]'' \
19540 .       ds $LISTS_PN_FT \\*[$TOC_PN_FT]
19541 .    if '\\*[$LISTS_PN_SIZE_CHANGE]'' \
19542 .       ds $LISTS_PN_SIZE_CHANGE \\*[$TOC_PN_SIZE_CHANGE]
19543 .    if !\\n[#EQN_PN_PADDING] \
19544 .       nr #EQN_PN_PADDING \\n[#TOC_PN_PADDING]
19545 .    if !\\n[#FIG_PN_PADDING] \
19546 .       nr #FIG_PN_PADDING \\n[#TOC_PN_PADDING]
19547 .    if !\\n[#TBL_PN_PADDING] \
19548 .       nr #TBL_PN_PADDING \\n[#TOC_PN_PADDING]
19549 .    ie '\\*[$LISTS_PAGENUM_STYLE]'' \
19550 .       PAGENUM_STYLE \\*[$TOC_PAGENUM_STYLE]
19551 .    el \
19552 .       PAGENUM_STYLE \\*[$LISTS_PAGENUM_STYLE]
19553 .    if r #\\*[$LIST_TYPE]_START_PAGENUM  \
19554 .       PAGENUMBER \\n[#\\*[$LIST_TYPE]_START_PAGENUM]
19555 .    if r #LISTS_NO_PAGENUM .PAGINATION off
19556 .    HEADER_LEFT "\\*[$HDRFTR_LEFT]
19557 .    HEADER_RIGHT "\\*[$HDRFTR_RIGHT]
19558 .    HEADER_CENTER "\\*[\\*[$LIST_TYPE]_TITLE_STRING]
19559 .    if \\n[#LINENUMBERS]=2 .nr #LINENUMBERS 3
19560 .\" Get num placeholders for ch. num and label num.
19561 .    if \\n[\\*[list-type]*autolabel] \{\
19562 .       if \\n[\\*[label-type]*label-with-chapter] \{\
19563 .          if \\n[#CH_NUM]<1000 .nr chapno-width 3
19564 .          if \\n[#CH_NUM]<100  .nr chapno-width 2
19565 .          if \\n[#CH_NUM]<10   .nr chapno-width 1
19566 .       \}
19567 .       if \\n[\\*[list-type]*label-num]<1000 .nr label-width 3
19568 .       if \\n[\\*[list-type]*label-num]<100  .nr label-width 2
19569 .       if \\n[\\*[list-type]*label-num]<10   .nr label-width 1
19570 .\" Calculate width of label-num tab
19571 .      nr label-width \\n[\\*[list-type]*label-width]
19572 .    \}
19573 .    if \\n[#SLANT_ON] .nop \\*[SLANTX]
19574 .    if \\n[#COLUMNS]=1 .nr #COLUMNS 0
19575 .    START
19576 .    if \\n[#PRINT_STYLE]=2 .sp -1
19577 .    if '\\*[$LIST_TYPE]'FIGURES'   .LIST_OF_FIG
19578 .    if '\\*[$LIST_TYPE]'TABLES'    .LIST_OF_TBL
19579 .    if '\\*[$LIST_TYPE]'EQUATIONS' .LIST_OF_EQN
19580 .    if \\n[#LINENUMBERS]=3 \{\
19581 .       NUMBER_LINES RESUME
19582 .       nr #LINENUMBERS 1
19583 .       nn 1
19584 .    \}
19585 .    rr #LISTS
19586 .    pdfsync
19587 .END
19588 .\"
19589 .ALIAS LIST_OF_EQUATIONS LISTS_OF
19590 .ALIAS LIST_OF_FIGURES   LISTS_OF
19591 .ALIAS LIST_OF_TABLES    LISTS_OF
19592 \#
19593 \# LISTS-OF STYLE
19594 \# --------------
19595 \# *Arguments:
19596 \#   FAMILY        fam \
19597 \#   FONT          sty \
19598 \#   PT_SIZE       size \
19599 \#   LEAD          leading [ADJUST] \
19600 \#   TITLE_FAMILY  fam \
19601 \#   TITLE_FONT    sty \
19602 \#   TITLE_SIZE    +|-size \
19603 \#   TITLE_QUAD    LEFT | CENTER | RIGHT \
19604 \#   TITLE_COLOR   color \
19605 \#   TITLE_CAPS    \
19606 \#   TITLE_NO_CAPS \
19607 \#   TITLE_SMALLCAPS \
19608 \#   TITLE_NO_SMALLCAPS \
19609 \#   TITLE_UNDERSCORE [ DOUBLE] <wt> <gap> (dbl-rule-gap) \
19610 \#   NO_PAGINATION \
19611 \#   PAGENUM_STYLE format \
19612 \#   PN_FAMILY     fam \
19613 \#   PN_FONT       sty \
19614 \#   PN_SIZE       +|-size \
19615 \#   PN_PADDING    n
19616 \# *Function:
19617 \#   Allows setting of all style parameters for lists-of.
19618 \# *Notes:
19619 \#   Assumption is that lists-of will all have the same style.
19620 \#   TOC style is used if LISTS_STYLE is omitted.
19621 \#
19622 .MAC LISTS_STYLE END
19623 .    nr loop-count 0 1
19624 .    nr loop-counter \\n[#NUM_ARGS]
19625 .    while \\n+[loop-count]<=\\n[loop-counter] \{\
19626 .       if '\\$1'FAMILY' \{\
19627 .          ds $LISTS_FAM \\$2
19628 .          shift 2
19629 .       \}
19630 .       if '\\$1'FONT' \{\
19631 .          ds $LISTS_FT \\$2
19632 .          shift 2
19633 .       \}
19634 .       if '\\$1'TITLE_FAMILY' \{\
19635 .          ds $LISTS_TITLE_FAM \\$2
19636 .          shift 2
19637 .       \}
19638 .       if '\\$1'TITLE_FONT' \{\
19639 .          ds $LISTS_TITLE_FT \\$2
19640 .          shift 2
19641 .       \}
19642 .       if '\\$1'TITLE_SIZE' \{\
19643 .          ds $LISTS_TITLE_SIZE \\$2
19644 .          shift 2
19645 .       \}
19646 .       if '\\$1'TITLE_QUAD' \{\
19647 .          ds $LISTS_TITLE_QUAD \\$2
19648 .          shift 2
19649 .       \}
19650 .       if '\\$1'TITLE_COLOR' \{\
19651 .          ds $LISTS_TITLE_COLOR \\$2
19652 .          shift 2
19653 .       \}
19654 .       if '\\$1'TITLE_CAPS' \{\
19655 .          nr #LISTS_TITLE_CAPS 1
19656 .          shift 1
19657 .       \}
19658 .       if '\\$1'TITLE_NO_CAPS' \{\
19659 .          rr #LISTS_TITLE_CAPS
19660 .          shift 1
19661 .       \}
19662 .       if '\\$1'TITLE_SMALLCAPS' \{\
19663 .          nr #LISTS_TITLE_SMALLCAPS 1
19664 .          shift 1
19665 .       \}
19666 .       if '\\$1'TITLE_NO_SMALLCAPS' \{\
19667 .          rr #LISTS_TITLE_NO_SMALLCAPS
19668 .          shift 1
19669 .       \}
19670 .\" UNDERSCORE and UNDERLINE are identical, but we can't evaluate
19671 .\" the results of two string comparisons.
19672 .       if '\\$1'TITLE_UNDERSCORE' \{\
19673 .          nr #LISTS_TITLE_UNDERSCORE 1
19674 .          shift
19675 .          ie '\\$1'DOUBLE' \{\
19676 .             ds DOUBLE DOUBLE
19677 .             shift
19678 .             if \B'\\$1' \{\
19679 .                ds $LISTS_OF_UL_WT \\$1
19680 .                shift
19681 .             \}
19682 .             if \B'\\$1' \{\
19683 .                ds $LISTS_OF_UL_GAP \\$1
19684 .                shift
19685 .             \}
19686 .             if \B'\\$1' \{\
19687 .                ds $LISTS_OF_RULE_GAP \\$1
19688 .                shift
19689 .             \}
19690 .          \}
19691 .          el \{\
19692 .             if \B'\\$1' \{\
19693 .                ds $LISTS_OF_UL_WT \\$1
19694 .                shift
19695 .             \}
19696 .             if \B'\\$1' \{\
19697 .                ds $LISTS_OF_UL_GAP \\$1
19698 .                shift
19699 .             \}
19700 .          \}
19701 .       \}
19702 .       if '\\$1'TITLE_UNDERLINE' \{\
19703 .          nr #LISTS_TITLE_UNDERSCORE 1
19704 .          shift
19705 .          ie '\\$1'DOUBLE' \{\
19706 .             ds DOUBLE DOUBLE
19707 .             shift
19708 .             if \B'\\$1' \{\
19709 .                ds $LISTS_OF_UL_WT \\$1
19710 .                shift
19711 .             \}
19712 .             if \B'\\$1' \{\
19713 .                ds $LISTS_OF_UL_GAP \\$1
19714 .                shift
19715 .             \}
19716 .             if \B'\\$1' \{\
19717 .                ds $LISTS_OF_RULE_GAP \\$1
19718 .                shift
19719 .             \}
19720 .          \}
19721 .          el \{\
19722 .             if \B'\\$1' \{\
19723 .                ds $LISTS_OF_UL_WT \\$1
19724 .                shift
19725 .             \}
19726 .             if \B'\\$1' \{\
19727 .                ds $LISTS_OF_UL_GAP \\$1
19728 .                shift
19729 .             \}
19730 .          \}
19731 .       \}
19732 .       if '\\$1'TITLE_NO_UNDERSCORE' \{\
19733 .          rr #LISTS_TITLE_UNDERSCORE 1
19734 .          rm DOUBLE
19735 .          rm $LISTS_OF_UL_WT
19736 .          rm $LISTS_OF_UL_GAP
19737 .          rm $LISTS_OF_RULE_GAP
19738 .          shift
19739 .       \}
19740 .       if '\\$1'TITLE_NO_UNDERLINE' \{\
19741 .          rr #LISTS_TITLE_UNDERSCORE 1
19742 .          rm DOUBLE
19743 .          rm $LISTS_OF_UL_WT
19744 .          rm $LISTS_OF_UL_GAP
19745 .          rm $LISTS_OF_RULE_GAP
19746 .          shift
19747 .       \}
19748 .       if '\\$1'PT_SIZE' \{\
19749 .          nr #LISTS_PS (p;\\$2)
19750 .          shift 2
19751 .       \}
19752 .       if '\\$1'LEAD' \{\
19753 .          nr #LISTS_LEAD (p;\\$2)
19754 .          ie !'\\$3'ADJUST' \{\
19755 .             nr #LISTS_LEAD_ADJUST 0
19756 .             shift 2
19757 .          \}
19758 .          el \{\
19759 .             nr #LISTS_LEAD_ADJUST 1
19760 .             shift 3
19761 .          \}
19762 .       \}
19763 .       if '\\$1'NO_PAGINATION' \{\
19764 .          nr #LISTS_NO_PAGENUM 1
19765 .          shift 1
19766 .       \}
19767 .       if '\\$1'PAGENUM_STYLE' \{\
19768 .          ds $LISTS_PAGENUM_STYLE \\$2
19769 .          shift 2
19770 .       \}
19771 .       if '\\$1'PN_FAMILY' \{\
19772 .          ds $LISTS_PN_FAM \\$2
19773 .          shift 2
19774 .       \}
19775 .       if '\\$1'PN_FONT' \{\
19776 .          ds $LISTS_PN_FT \\$2
19777 .          shift 2
19778 .       \}
19779 .       if '\\$1'PN_SIZE' \{\
19780 .          ds $LISTS_PN_SIZE_CHANGE \\$2
19781 .          shift 2
19782 .       \}
19783 .       if '\\$1'EQN_PN_PADDING' \{\
19784 .          nr #EQN_PN_PADDING \\$2
19785 .          shift 2
19786 .       \}
19787 .       if '\\$1'FIG_PN_PADDING' \{\
19788 .          nr #FIG_PN_PADDING \\$2
19789 .          shift 2
19790 .       \}
19791 .       if '\\$1'TBL_PN_PADDING' \{\
19792 .          nr #TBL_PN_PADDING \\$2
19793 .          shift 2
19794 .       \}
19795 .    \}
19796 .END
19797 \#
19798 \# Lists-of collector
19799 \# Strings to allocate space for leaders and entry page numbers
19800 \#
19801 .ds $LISTS_PN \\*[ST102]\F[\\*[$LISTS_PN_FAM]]\f[\\*[$LISTS_PN_FT]]\
19802 \s[\\n[#LISTS_PS]u]^\\*[ST102X]\\*[ST103]\s[\\\\*[$LISTS_PN_SIZE_CHANGE]]\
19803 \h'.5m'\h'\w'0'u*\\\\n[#LISTS_PN_PADDING]u'\\*[ST103X]
19804 \#
19805 .ds $LISTS_PN_TYPEWRITE \\*[ST102]^\\*[ST102X]\\*[ST103]\|\
19806 \h'\w'\0'u*\\\\n[#LISTS_PN_PADDING]u'\\*[ST103X]
19807 \#
19808 .MAC LISTS_COLLECTOR END
19809 .    nr #LISTS_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
19810 .    if \\n[#KERN] .nr #RESTORE_KERN 1
19811 .    KERN OFF
19812 .    if '\\$0'TO_EQUATIONS' \{\
19813 .       ds list-type eqn
19814 .       ds label-type eqn
19815 .       da LIST_OF_EQN
19816 \!.     nr #LISTS_PN_PADDING \\\\n[#EQN_PN_PADDING]
19817 .    \}
19818 .    if '\\$0'TO_FIGURES' \{\
19819 .       ds list-type fig
19820 .       ds label-type fig
19821 .       if (\\n[pdf-img*have-label]=1):(\\n[pdf-img*autolabel]=1):\
19822 (\\n[pic*autolabel]=1):(\\n[pic*have-label]=1) \{\
19823 .          nr \\*[label-type]*have-label 1
19824 .          if !'\\*[pdf-img*label]'' .rn pdf-img*label \\*[label-type]*label
19825 .          if !'\\*[pic*label]'' .rn pic*label \\*[label-type]*label
19826 .       \}
19827 .       da LIST_OF_FIG
19828 \!.     nr #LISTS_PN_PADDING \\\\n[#FIG_PN_PADDING]
19829 .    \}
19830 .    if '\\$0'TO_TABLES' \{\
19831 .       ds list-type tbl
19832 .       ds label-type tbl
19833 .       da LIST_OF_TBL
19834 \!.     nr #LISTS_PN_PADDING \\\\n[#TBL_PN_PADDING]
19835 .    \}
19836 .    br
19837 .    ie \\n[#PRINT_STYLE]=1 \{\
19838 \!.     fam \\*[$TYPEWRITER_FAM]
19839 \!.     ft  R
19840 \!.     ps \\*[$TYPEWRITER_PS]
19841 .       ds _TYPEWRITE _TYPEWRITE
19842 .    \}
19843 .    el \{\
19844 \!.     FAMILY \\\\*[$LISTS_FAM]
19845 \!.     FONT \\\\*[$LISTS_FT]
19846 \!.     ps \\\\n[#LISTS_PS]u
19847 .    \}
19848 .    if \\n[#PRINT_STYLE]=2 .rm _TYPEWRITE
19849 \!.  PAD_MARKER ^
19850 \!.  vpt 0
19851 .    ie !\\n[\\*[label-type]*autolabel] \{\
19852 .\" If there is a label...
19853 .       if !'\\*[\\*[label-type]*label]'' \
19854 \!.     PAD \
19855 "\\*[ST100]\h'\w'\\*[\\*[label-type]*label]'u'\\*[ST100X]\0\\*[ST101]\h'\w'\\$2'u'\\*[ST101X]\\\\*[$LISTS_PN\\*[_TYPEWRITE]]" \
19856 "\*[PDFBOOKMARK.NAME]"
19857 .\" If there is no label...
19858 .       if '\\*[\\*[label-type]*label]'' \
19859 \!.     PAD \
19860 "\\*[ST100]\\*[ST100X]\\*[ST101]\h'\w'\\$1'u'\0\\*[ST101X]\\\\*[$LISTS_PN\\*[_TYPEWRITE]]" \
19861 "\*[PDFBOOKMARK.NAME]"
19862 .    \}
19863 .\" If autolabelling...
19864 .    el \
19865 \!.     PAD \
19866 "\\*[ST100]\h'\\\\n[label-width]u'\\*[ST100X]\ \ \ \\*[ST101]\h'\w'\\$2'u'\\*[ST101X]\\\\*[$LISTS_PN\\*[_TYPEWRITE]]" \
19867 "\*[PDFBOOKMARK.NAME]"
19868 \!.  PAD_MARKER #
19869 \!.  EOL
19870 .    ie !\\n[\\*[label-type]*autolabel] \
19871 \!.     ST 100 L
19872 .    el \
19873 \!.     ST 100 R
19874 \!.  ST 101 L
19875 \!.  ST 102 L
19876 \!.  ST 103 R
19877 .    if \\n[#PRINT_STYLE]=2 \{\
19878 \!.     FAMILY  \\\\*[$LISTS_FAM]
19879 \!.     FT      \\\\*[$LISTS_FT]
19880 \!.     ps \\\\n[#LISTS_PS]u
19881 .    \}
19882 \!.  TAB 100
19883 \!.  PDF_LINK \\*[list-type]:\\n[lists*target] "\\$1"
19884 \!.  TN
19885 \!.  vpt 0
19886 \!.  PDF_LINK \\*[list-type]:\\n[lists*target] "\\$2"
19887 \!.  TN
19888 \!.  vpt 0
19889 \!.  PRINT \fR\\*[LEADER]\f[]
19890 \!.  TN
19891 .    if \\n[#PRINT_STYLE]=2 \{\
19892 \!.     FAMILY  \\\\*[$LISTS_PN_FAM]
19893 \!.     FT      \\\\*[$LISTS_PN_FT]
19894 \!.     ps \\\\*[$LISTS_PN_SIZE_CHANGE]
19895 .    \}
19896 \!.  PRINT \\n[#LISTS_ENTRY_PN]
19897 \!.  TQ
19898 \!.  vpt
19899 .    da
19900 .    if \\n[#RESTORE_KERN] .KERN
19901 .END
19902 .
19903 .ALIAS TO_EQUATIONS LISTS_COLLECTOR
19904 .ALIAS TO_FIGURES   LISTS_COLLECTOR
19905 .ALIAS TO_TABLES    LISTS_COLLECTOR
19906 \#
19907 \# ***tbl***
19908 \#
19909 \# Support for multipage tables with headers borrowed from ms and
19910 \# mommified by Robin Haberkorn <robin.haberkorn@googlemail.com>
19911 \# with extensions by Peter Schaffter.
19912 \#
19913 .nr tbl*have-header 0
19914 .ds T&
19915 \#
19916 .MAC TS END
19917 .    if \\n[.t]<\\n[#DOC_LEAD] .nr begin-tbl 1
19918 .    br
19919 .    rr begin-tbl
19920 .    rm tbl*caption
19921 .    rm tbl*label
19922 .    rr tbl*have-caption
19923 .    rr tbl*have-label
19924 .    rr tbl*have-header
19925 .    rr float*tbl
19926 .    rr tbl*boxed
19927 .    nr ind-pre-tbl  \\n[.i]
19928 .    nr ll-pre-tbl   \\n[.l]
19929 .    nr lead-pre-tbl \\n[.v]
19930 .    nr tbl*needs 1
19931 .    nr doing-tbl 1
19932 .    if !'\\n[.z]'FLOAT*DIV' \{\
19933 .       if \\n[.u] .nr fill 1
19934 .       nf
19935 .    \}
19936 .    if '\\n[.z]'FLOAT*DIV' .nr float*tbl 1
19937 .    if !'\\n[.z]'FLOAT*DIV' \{\
19938 .       if \\n[.t]=1 \{\
19939 .          if !\\n[@TOP] \{\
19940 .             ie \\n[#COLUMNS] .COL_NEXT internal
19941 .             el .NEWPAGE
19942 .          \}
19943 .       \}
19944 .    \}
19945 .    nr loop-count 0 1
19946 .    nr loop-counter \\n[#NUM_ARGS]
19947 .    while \\n+[loop-count]<=\\n[loop-counter] \{\
19948 .       if '\\$1'H' \{\
19949 .          nr tbl*have-header 1
19950 .          shift
19951 .          if \\n[#NUM_ARGS]=0 .nr tbl*plain 1
19952 .       \}
19953 .       if '\\$1'BOXED' \{\
19954 .          nr tbl*boxed 1
19955 .          shift
19956 .       \}
19957 .       if '\\$1'CENTER' \{\
19958 .          if \\n[#INDENT_BOTH_ACTIVE] \{\
19959 .             IBX
19960 .             nr #RESTORE_INDENT_BOTH 1
19961 .          \}
19962 .          nr tbl*center 1
19963 .          shift
19964 .       \}
19965 .       if '\\$1'CENTRE' \{\
19966 .          if \\n[#INDENT_BOTH_ACTIVE] \{\
19967 .             IBX
19968 .             nr #RESTORE_INDENT_BOTH 1
19969 .          \}
19970 .          nr tbl*center 1
19971 .          shift
19972 .       \}
19973 .       if '\\$1'NEEDS' \{\
19974 .          nr tbl*needs \\$2
19975 .          shift 2
19976 .       \}
19977 .       if '\\$1'NO_SHIM' \{\
19978 .          nr tbl*no-shim 1
19979 .          shift
19980 .       \}
19981 .       if '\\$1'NO_FLEX' \{\
19982 .          nr tbl*no-flex 1
19983 .          shift
19984 .       \}
19985 .       if '\\$1'ADJUST' \{\
19986 .          ds tbl*space-adj \\$2
19987 .          shift 2
19988 .       \}
19989 .       if '\\$1'CAPTION' \{\
19990 .          nr tbl*have-caption 1
19991 .          ds tbl*caption \\$2
19992 .          shift 2
19993 .       \}
19994 .       if '\\$1'SHORT_CAPTION' \{\
19995 .          ds tbl*caption-short \\$2
19996 .          shift 2
19997 .       \}
19998 .       if '\\$1'LABEL' \{\
19999 .          nr tbl*have-label 1
20000 .          ds tbl*label \\$2
20001 .          shift 2
20002 .       \}
20003 .       if '\\$1'TARGET' \{\
20004 .          ds target "\\$2
20005 .          PDF_TARGET "\\*[target]
20006 .          shift 2
20007 .       \}
20008 .    \}
20009 .    if (\\n[tbl*have-label]=1):(\\n[tbl*autolabel]=1) \
20010 .       ds label-type tbl
20011 .    if (\\n[tbl*have-caption]=1)&(\\n[tbl*have-header]=0) \
20012 .       tbl*caption-warning
20013 .    if \\n[tbl*boxed]=1 \{\
20014 .       if (\\n[tbl*have-label]=0)&(\\n[tbl*have-caption]=0)&\
20015 (\\n[tbl*autolabel]=0)&(\\n[tbl*have-source]=0) \
20016 .       nr tbl*plain-boxed 1
20017 .    \}
20018 .    if !\\n[tbl*have-header] .nr tbl*no-header 1
20019 .    ds tbl*label-sffx-tmp \\*[tbl*label-sffx]
20020 .    if !'\\*[tbl*label-sffx-tmp]'' .substring tbl*label-sffx-tmp -1
20021 .    if '\\*[tbl*label-sffx-tmp]'.' \
20022 .       if (\\n[tbl*caption-after-label]=0):(\\n[#MLA]=1) .chop tbl*label-sffx
20023 .    if \\n[tbl*caption-after-label] \{\
20024 .       if !'\\*[tbl*label-sffx]'' \
20025 .          if '\\*[tbl*caption]'' .chop tbl*label-sffx
20026 .    \}
20027 .    if !'\\*[tbl*caption-short]'' .ds short -short
20028 .    if \\n[tbl*autolabel] \{\
20029 .       if \\n[tbl*label-with-chapter] \
20030 .          ds chapno \\n[#CH_NUM].
20031 .       ds tbl*label \
20032 \\*[tbl*label-prfx]\\*[chapno]\\n+[tbl*label-num]\\*[tbl*label-sffx]\"
20033 .         nr tbl*label-width \w'\\*[tbl*label]'
20034 .    \}
20035 .    ie \\n[@TOP] \{\
20036 .       if !'\\n[.z]'FLOAT*DIV' \{\
20037 .          RESTORE_SPACE
20038 .          nr @TOP 1
20039 .          if \\n[#COLUMNS] \
20040 .             if !'\\*[tbl*space-adj]'' \
20041 .                sp \\*[tbl*space-adj]-1v
20042 .          if \\n[tbl*boxed] .nr tbl*boxed 2
20043 .          vpt
20044 .       \}
20045 .    \}
20046 .    el \
20047 .       if !'\\*[tbl*space-adj]'' .sp \\*[tbl*space-adj]u
20048 .    if !\\n[#MLA] \{\
20049 .      if (\\n[tbl*have-caption]=0):(\\n[tbl*caption-after-label]=1) \{\
20050 .         ie !'\\n[.z]'FLOAT*DIV' \{\
20051 .            ie !\\n[tbl*boxed]=2 \{\
20052 .               if \\n[tbl*have-header] .nr tbl*restore-header 1
20053 .               if !\\n[@TOP] .sp .5v
20054 .               if \\n[tbl*boxed] .sp .25v
20055 .               if \\n[tbl*restore-header]=1 .nr tbl*have-header 1
20056 .            \}
20057 .            el \{\
20058 .               if !\\n[tbl*boxed] .ns
20059 .               sp .25v
20060 .            \}
20061 .         \}
20062 .         el .sp .5v
20063 .      \}
20064 .    \}
20065 .    if \\n[nl]=\\n[#PAGE_TOP] .ns
20066 .    if '\\n[.z]'FLOAT*DIV' \
20067 .       if \\n[defer]>0 .sp .5v
20068 .    if \\n[@TOP] .rr @TOP
20069 .    ds ev-current \\n[.ev]
20070 .    if (\\n[nl]=\\n[#PAGE_TOP]):(\\n[nl]=\\n[dc]) \
20071 .       nr tbl*caption-lead-diff-adj 1
20072 .    if \\n[#MLA] \
20073 .       if \\n[tbl*have-label]+\\n[tbl*have-caption]=0 \
20074 .          sp .5v
20075 .    if \\n[tbl*boxed]=2 \{\
20076 .       if \\n[#MLA]=0 \
20077 .          if (\\n[tbl*caption-after-label]=1):(\\n[tbl*have-caption]=0) \
20078 .             sp 1n
20079 .    \}
20080 .    if \\n[tbl*have-header] \{\
20081 .       di tbl*header-div
20082 .       ev table-header
20083 .       evc \\*[ev-current]
20084 .       if !\\n[float-span] \{\
20085 .          ie '\\*[ev-current]'FLOAT' \{\
20086 .             ie !\\n[tbl*center] \
20087 .                in 0
20088 .             el \{\
20089 .                in 0
20090 \!.              in 0
20091 .             \}
20092 .          \}
20093 .          el \!.in 0
20094 .       \}
20095 .    \}
20096 .END
20097 \#
20098 .MAC TH END
20099 .    ie '\\n[.z]'tbl*header-div' \{\
20100 .       nr T. 0
20101 .       T#
20102 .       di
20103 .       ev
20104 .       if \\n[#PDF_BOOKMARKS] \{\
20105 .          ie !'\\n[.z]'' \{\
20106 .             if (\\n[float*img]=0)&(\\n[float*pic]=0)&(\\n[float*eqn]=0) \{\
20107 \!.              PDF_TARGET tbl:\\\\n+[lists*target]
20108 .                ie !'\\*[tbl*label]'' \
20109 \!.                 TO_TABLES "\\*[tbl*label]" "\\*[tbl*caption\\*[short]]"
20110 .                el \
20111 \!.                 TO_TABLES "\\*[tbl*caption\\*[short]]"
20112 .             \}
20113 .          \}
20114 .          el \{\
20115 .             if '\\n[.z]'' .PDF_TARGET tbl:\\n+[lists*target]
20116 .             ie !'\\*[tbl*label]'' \
20117 .                TO_TABLES "\\*[tbl*label]" "\\*[tbl*caption\\*[short]]"
20118 .             el \
20119 .                TO_TABLES "\\*[tbl*caption\\*[short]]"
20120 .          \}
20121 .       \}
20122 .       if \\n[#MLA] .if !\\n[tbl*have-caption] \
20123 .          mla@error label caption \\n[.F] \\$0 \\n[.c]
20124 .       if !'\\n[.z]'FLOAT*DIV' \{\
20125 .          ie !\\n[tbl*boxed] \{\
20126 .             nr th*needs (u;\\n[dn]+\\n[tbl*needs]v)
20127 .             if \\n[th*needs]>\\n[.t] \{\
20128 .                if dPDF.EXPORT \
20129 .                   if \\n[#FLEX_ACTIVE] \
20130 .                      if !\\n[#NO_FLEX] \
20131 .                         tm .ds pre-newpage-\\n% \\n%@\\n[#COL_NUM]
20132 .                ne \\n[dn]u+\\n[tbl*needs]v
20133 .                nr tbl@needs 1
20134 .             \}
20135 .          \}
20136 .          el \{\
20137 .             nr th*needs (u;\\n[dn]+.3n+\\n[tbl*needs]v)
20138 .             if \\n[th*needs]>\\n[.t] \{\
20139 .                if \\n[#COLUMNS] \
20140 .                   if !\\n[#COL_NUM]=\\n[#NUM_COLS] \
20141 .                      nr tbl*no-top-hook 1
20142 .                nr tbl*no-print-header 1
20143 .                if dPDF.EXPORT \
20144 .                   if \\n[#FLEX_ACTIVE] \
20145 .                      if !\\n[#NO_FLEX] \
20146 .                         tm .ds pre-newpage-\\n% \\n%@\\n[#COL_NUM]
20147 .                ne \\n[dn]u+\\n[tbl*needs]v
20148 .                nr tbl@needs 1
20149 .             \}
20150 .          \}
20151 .       \}
20152 .       ie (\\n[dn]-\\n[.v])>\\n[.t] \{\
20153 .          if !\\n[@TOP] .@error ridiculously long table header
20154 .          if \\n[tbl@needs] \{\
20155 .             if \\n[tbl*boxed] \{\
20156 .                RESTORE_SPACE
20157 .                sp -1n
20158 .             \}
20159 .             rr tbl@needs
20160 .          \}
20161 .          if \\n[tbl*have-caption] .TBL*CAPTION
20162 .       \}
20163 .       el \{\
20164 .          nr tbl*header-ht \\n[dn]
20165 .          if \\n[tbl@needs] \{\
20166 .             if \\n[tbl*boxed] \{\
20167 .                RESTORE_SPACE
20168 .                if !\\n[#MLA] \{\
20169 .                   if (\\n[tbl*have-caption]=0):(\\n[tbl*caption-after-label]=1) \
20170 .                      nop \&
20171 .                   sp -1n
20172 .                \}
20173 .             \}
20174 .             rr tbl@needs
20175 .          \}
20176 .          if (\\n[tbl*have-caption]=1)&(\\n[tbl*caption-after-label]=0) \
20177 .             TBL*CAPTION
20178 .          vs
20179 .          tbl*print-header
20180 .       \}
20181 .    \}
20182 .    el \{\
20183 .       if \\n[tbl*have-caption] \{\
20184 .          TBL*CAPTION
20185 .          nr skip-th-warning 1
20186 .       \}
20187 .       if !\\n[skip-th-warning] .@error .TH without .TS H
20188 .       rr skip-th-warning
20189 .    \}
20190 .\" When centering a boxed table inside a float, .T# won't place
20191 .\" vertical rules in the correct horizontal position unless .ll is
20192 .\" given a nominal value (can be anything) and an indent is set
20193 .\" manually.
20194 .    if '\\n[.z]'FLOAT*DIV' \{\
20195 .       if \\n[tbl*center] \{\
20196 .          nr float*ll \\n[.l]
20197 .          ll 0
20198 .          in \\n[float*ll]u-\\n[TW]u/2u
20199 .       \}
20200 .    \}
20201 .END
20202 \#
20203 .MAC TE END
20204 .    ev tbl*end \" Needed because of .ad changes
20205 .    evc \\*[ev-current] 
20206 .    nh
20207 .    nf
20208 .    rr tbl*no-header
20209 .    if !'\\$1'' \{\
20210 .       if '\\$1'SOURCE' \{\
20211 .          ie !\\n[#MLA] \{\
20212 .             tm1 "[mom]: \\$1 argument to \\$0 at line \\n[.c], but MLA style not enabled.
20213 .             tm1 "       Ignoring \\$1, but continuing to process.
20214 .          \}
20215 .          el \{\
20216 .             nr tbl*have-source 1
20217 .             shift
20218 .          \}
20219 .       \}
20220 .    \}
20221 .    if (\\n[#MLA]=1)&(\\n[tbl*have-source]=0) .tbl*source-warning
20222 .    if !'\\n[.z]'FLOAT*DIV' \{\
20223 .       ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
20224 .       ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u
20225 .       if \\n[.t]<(\\n[.v]/2u) \{\
20226 .          ie (\\n[tbl*have-label]=1):\
20227 (\\n[tbl*caption-after-label]=1):\
20228 (\\n[tbl*have-source]=1):\
20229 (\\n[tbl*autolabel]=1) \{\
20230 .             rm tbl*header-div
20231 .             nr tbl*no-top-hook 1
20232 .             ie \\n[tbl*autolabel] \
20233 .                if \\n[#MLA] \
20234 .                   if !\\n[tbl*have-source] .
20235 .             el \{\
20236 .                nr pgnum \\n%+\\n[#PAGE_NUM_ADJ]
20237 .                if \\n[#COLUMNS]=1 .ds col-num ", column \\n[#COL_NUM]
20238 .                tm1 "[mom]: '\\n[.F]', macro \\$0, line \\n[.c]:
20239 .                tm1 "        Insufficient room for label, caption, and/or source after
20240 .                tm1 "        table on page \\n[pgnum]\\*[col-num].  Omitting, but continuing to process table.
20241 .             \}
20242 .             nr tbl*skip-source 1
20243 .             nr tbl*skip-label 1
20244 .             rr tbl*have-caption
20245 .             ie \\n[#COLUMNS] \
20246 .                COL_NEXT internal
20247 .             el .NEWPAGE
20248 .          \}
20249 .          el \{\
20250 .\" Don't print tbl-header at top of next page or column if tbl
20251 .\" finishes without room for further input at bottom of page
20252 .             rm tbl*header-div
20253 .             nr tbl*no-print-header 1
20254 .             ie \\n[#COLUMNS] \
20255 .                COL_NEXT internal
20256 .             el .NEWPAGE
20257 .          \}
20258 .       \}
20259 .    \}
20260 .    if !\\n[#MLA] \{\
20261 .       if (\\n[tbl*have-label]=1):(\\n[tbl*autolabel]=1):(\\n[tbl*caption-after-label]=1) \{\
20262 .          ev label
20263 .          if '\\*[ev-current]'FLOAT' .evc 0
20264 .          ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
20265 .          el \{\
20266 .             tbl*label-style
20267 .             vs \\n[.ps]u+\\n[tbl*label-autolead]u
20268 .          \}
20269 .          SIZESPECS
20270 .          if \\n[tbl*label-with-chapter] \
20271 .             ds chapno \\n[#CH_NUM].
20272 .          TBL*SET_LABEL_QUAD \\*[tbl*label-quad]
20273 .          di tbl*label-div
20274 .          ie \\n[tbl*boxed] .sp \\n[#CAP_HEIGHT]u
20275 .          el .sp \\n[#DOC_LEAD]u/4u
20276 .          if (\\n[tbl*have-label]=1):(\\n[tbl*autolabel]=1) \{\
20277 .             if !'\\*[tbl*label-space]'' .sp \\*[tbl*label-space]
20278 .             ie \\n[tbl*autolabel] \{\
20279 .                ie !\\n[tbl*caption-after-label] .nop \
20280 \\*[tbl*label-prfx]\\*[chapno]\\n[tbl*label-num]\\*[tbl*label-sffx]
20281 .                el \{\
20282 .                   nop \
20283 \\*[tbl*label-prfx]\\*[chapno]\\n+[tbl*label-num]\\*[tbl*label-sffx]\|
20284 .                   tbl*caption-style
20285 .                   vs \\n[.ps]u+\\n[tbl*caption-autolead]u
20286 .                   ds tbl*caption-old \\*[tbl*caption]
20287 .                   ds tbl*caption " \\*[tbl*caption]
20288 .                   nop \\*[tbl*caption]
20289 .                   ds tbl*caption \\*[tbl*caption-old]
20290 .                \}
20291 .             \}
20292 .             el \{\
20293 .                ie !\\n[tbl*caption-after-label] .nop \\*[tbl*label]
20294 .                el \{\
20295 .                   nop \\*[tbl*label]\ \|\c
20296 .                   tbl*caption-style
20297 .                   vs \\n[.ps]u+\\n[tbl*caption-autolead]u
20298 .                   ds tbl*caption " \\*[tbl*caption]
20299 .                   nop \\*[tbl*caption]
20300 .                \}
20301 .             \}
20302 .          \}
20303 .          br
20304 .          di
20305 .          in 0
20306 .          ev
20307 .          nr pgnum \\n%+\\n[#PAGE_NUM_ADJ]
20308 .          ie !'\\n[.z]'FLOAT*DIV' \{\
20309 .             rr tbl*have-header
20310 .             rr tbl*have-caption
20311 .             ie (\\n[dn]-\\n[.v])>\\n[.t] \{\
20312 .                if \\n[#COLUMNS]=1 .ds col-num ", column \\n[#COL_NUM]
20313 .                tm1 "[mom]: '\\n[.F]', macro \\$0, line \\n[.c]:
20314 .                tm1 "        Insufficient room for label, caption, and/or source after
20315 .                tm1 "        table on page \\n[pgnum]\\*[col-num].  Omitting, but continuing to process.
20316 .                ie \\n[#COLUMNS] \
20317 .                   COL_NEXT internal
20318 .                el .NEWPAGE
20319 .                if d tbl*header-div .rm tbl*header-div
20320 .                rr tbl*caption-top-lead-diff
20321 .                nr tbl*skip-source 1
20322 .                nr tbl*skip-label 1
20323 .             \}
20324 .             el .print-label
20325 .          \}
20326 .          el .print-label
20327 .       \}
20328 .    \}
20329 .    if \\n[tbl*autolabel] \{\
20330 .       ds tbl*label \\*[chapno]\\n[tbl*label-num]
20331 .       if dLABEL.REFS \
20332 .          tm .ds \\*[target] \\*[chapno]\\n[tbl*label-num]
20333 .       rm target
20334 .    \}
20335 .    if !\\n[tbl*skip-source] \{\
20336 .       if \\n[tbl*have-source] \{\
20337 .          ds tbl*source \\$1
20338 .          SIZESPECS
20339 .          ev source
20340 .          evc \\*[ev-current]
20341 .          nf
20342 .          nh
20343 .          ie \\n[#PRINT_STYLE]=1 \{\
20344 .             TYPEWRITER
20345 .             sp
20346 .          \}
20347 .          el \{\
20348 .             tbl*source-style
20349 .             vs \\n[.ps]u+\\n[tbl*source-autolead]u
20350 .          \}
20351 .          di tbl*source-div
20352 .          TBL*SET_SOURCE_QUAD \\*[tbl*source-quad]
20353 .          if (\\n[tbl*have-label]=0)&(\\n[#MLA]=0) \
20354 .             if !\\n[tbl*autolabel] .sp \\n[#CAP_HEIGHT]u
20355 .          if \\n[#MLA] \
20356 .             sp \\n[#CAP_HEIGHT]u
20357 .          if !'\\*[tbl*source-space]'' .sp \\*[tbl*source-space]
20358 .          nop \\*[tbl*source]
20359 .          br
20360 .          di
20361 .          nf
20362 .          tbl*source-div
20363 .          ev
20364 .       \}
20365 .    \}
20366 .    if '\\n[.z]'FLOAT*DIV' .nr bx-tbl-depth \\n[.d]-1v
20367 .    if '\\n[.z]'tbl*header-div' \{\
20368 .       @error .TS with 'H' flag but no corresponding .TH
20369 .       ab Aborting.
20370 .    \}
20371 .    ev
20372 .    if !\\n[tbl*plain] \{\
20373 .       ie \\n[tbl*plain-boxed] \{\
20374 .          ie \\n[#MLA] .if !\\n[tbl*have-source] .sp .5v
20375 .          el .sp .5v
20376 .       \}
20377 .       el \{\
20378 .          if !\\n[tbl*have-source] \{\
20379 .             if (\\n[tbl*have-label]=0)&\
20380 (\\n[tbl*caption-after-label]=0)&(\\n[tbl*autolabel]=0) \
20381 .                sp 1v
20382 .             if (\\n[tbl*have-label]=1):(\\n[tbl*autolabel]=1) \
20383 .                sp .5v
20384 .          \}
20385 .          if '\\n[.z]'FLOAT*DIV' .nr chop-space 1
20386 .       \}
20387 .    \}
20388 .    ll \\n[ll-pre-tbl]u
20389 .    if (\\n[nl]=\\n[dc]):(\\n[nl]=\\n[#PAGE_TOP]) .ns
20390 .    if !'\\*[tbl*space-adj]'' .sp -\\*[tbl*space-adj]u
20391 .    if \\n[#MLA] \
20392 .       sp .5v
20393 .    ie !\\n[tbl*no-shim] \{\
20394 .       ie !\\n[#NO_SHIM] \
20395 .          if !'\\n[.z]'FLOAT*DIV' .SHIM
20396 .       el \
20397 .          if !\\n[tbl*no-flex] \
20398 .             if !\\n[#NO_FLEX] \
20399 .                if !'\\n[.z]'FLOAT*DIV' .FLEX
20400 .    \}
20401 .    el \
20402 .       if !\\n[tbl*no-flex] \
20403 .          if !\\n[#NO_FLEX] \
20404 .             if !'\\n[.z]'FLOAT*DIV' .FLEX
20405 .    TBL*CLEANUP
20406 .END
20407 \#
20408 \# Utility macros for tbl
20409 \#
20410 .MAC TBL*CAPTION END
20411 .    ev caption
20412 .    evc \\*[ev-current]
20413 .    vs \\n[.ps]u+\\n[tbl*caption-autolead]u
20414 .    nr caption-lead \\n[.v]
20415 .    nr tbl*caption-lead-diff \\n[lead-pre-tbl]-\\n[.v]
20416 .    nr tbl*caption-top-lead-diff \\n[tbl*caption-lead-diff]
20417 .    ie !\\n[#MLA] \{\
20418 .       if \\n[tbl*have-caption] \{\
20419 .          ie !'\\n[.z]'FLOAT*DIV' \{\
20420 .             if !\\n[tbl*caption-after-label] \{\
20421 .                ie (\\n[nl]=\\n[#PAGE_TOP]):(\\n[nl]=\\n[dc]) \{\
20422 .                   RESTORE_SPACE
20423 .                   ie \\n[#COLUMNS] .sp |\\n[dc]u
20424 .                   el .sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
20425 .                   sp \\n[tbl*caption-lead-diff]u
20426 .                 \}
20427 .                 el \{\
20428 .                    if \\n[.ns] .if !(\\n[nl]=\\n[#PAGE_TOP]) .rs
20429 .                    sp \\n[#DOC_LEAD]u/2u
20430 .                 \}
20431 .             \}
20432 .          \}
20433 .          nh
20434 .       \}
20435 .    \}
20436 .    el \{\
20437 .       if !\\n[tbl*autolabel] \{\
20438 .          ie !\\n[tbl*have-label] \
20439 .             mla@error caption label \\n[.F] \\$0 \\n[.c]
20440 .          el .ev label
20441 .       \}
20442 .    \}
20443 .    ie \\n[#PRINT_STYLE]=1 .nr tmp-ind 2m
20444 .    el .nr tmp-ind 1.25m
20445 .    ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
20446 .    el \{\
20447 .       if !\\n[#MLA] \{\
20448 .          tbl*caption-style
20449 .          nr lead-current \\n[.v]
20450 .       \}
20451 .    \}
20452 .    ie !\\n[#MLA] \{\
20453 .       ie !\\n[tbl*caption-after-label] \{\
20454 .          di tbl*caption-div
20455 .          ie \\n[tbl*center] \!.in -\\n[ind-pre-tbl]u
20456 .          el \!.in 0
20457 .          TBL*SET_CAPTION_QUAD \\*[tbl*caption-quad]
20458 .          nop \\*[tbl*caption]
20459 .          br
20460 .          di
20461 .          evc 0
20462 .          if !'\\n[.z]'FLOAT*DIV' \{\
20463 .             ch FOOTER \\n[#VARIABLE_FOOTER_POS]u+\\n[#DOC_LEAD]u
20464 .             ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u+\\n[#DOC_LEAD]u
20465 .             nr caption-needs 2
20466 .             ie \\n[tbl*boxed] .nr tbl*lead \\n[.v]+3n
20467 .             el .nr tbl*lead \\n[.v]
20468 .             if \
20469 (\\n[dn]+(\\n[tbl*lead]*(\\n[tbl*needs]+1)))>=\\n[.t] \{\
20470 .                nr pgnum \\n%+\\n[#PAGE_NUM_ADJ]
20471 .                if \\n[#COLUMNS]=1 .ds col-num ", column \\n[#COL_NUM]
20472 .                tm1 \
20473 "[mom]: Table with caption at line \\n[.c] \
20474 does not fit on page \\n[pgnum]\\*[col-num].
20475 .                tm1 \
20476 "       Shifting table to next page or column.
20477 .                ie (\\n[#COLUMNS]=1)&(\\n[#COL_NUM]=\\n[#NUM_COLS]) \{\
20478 .                   rr tbl*no-header
20479 .                   NEWPAGE
20480 .                \}
20481 .                el \{\
20482 .                   nr tbl*no-top-hook -1
20483 .                   sp \\n[.t]u
20484 .                   ie \\n[#COLUMNS] \
20485 .                      sp |\\n[dc]u+\\n[tbl*caption-lead-diff]u
20486 .                   el .sp |\\n[#PAGE_TOP]u+\\n[tbl*caption-lead-diff]u
20487 .                \}
20488 .             \}
20489 .             ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
20490 .             ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u
20491 .          \}
20492 .          if \\n[.u] .nr fill 1
20493 .          nf
20494 .          if \\n[.ns] .RESTORE_SPACE
20495 .          tbl*caption-div
20496 .          if \\n[#PRINT_STYLE]=1 .sp .5v
20497 .          if !'\\*[tbl*caption-space]'' \
20498 .             sp \\*[tbl*caption-space]
20499 .          if \\n[tbl*caption-lead-diff-adj] \{\
20500 .             sp -\\n[tbl*caption-lead-diff]u
20501 .             rr tbl*label-lead-diff-adj
20502 .          \}
20503 .          if \\n[fill] .fi
20504 .          rr fill
20505 .       \}
20506 .       el \{\
20507 .          if (\\n[tbl*have-label]=0) \{\
20508 .             if !\\n[tbl*autolabel] \{\
20509 .                tm1 "[mom]: CAPTION_AFTER_LABEL enabled, but no label given
20510 .                tm1 "       for table at line \\n[.c].
20511 .                tm1 "       Skipping caption but continuing to process.
20512 .             \}
20513 .          \}
20514 .       \}
20515 .    \}
20516 .    el \{\
20517 .       if (\\n[tbl*have-label]=1):(\\n[tbl*autolabel]=1) \{\
20518 .          ie !\\n[tbl*have-caption] \
20519 .             mla@error label caption \\n[.F] \\$0 \\n[.c]
20520 .          el \{\
20521 .             ie !'\\n[.z]'FLOAT*DIV' \{\
20522 .                ie (\\n[nl]=\\n[#PAGE_TOP]):(\\n[nl]=\\n[dc]) \{\
20523 .                   ie !\\n[#COLUMNS] \
20524 .                      sp |\\n[#PAGE_TOP]u+\\n[tbl*caption-lead-diff]u
20525 .                   el .sp |\\n[dc]u+\\n[tbl*caption-lead-diff]u
20526 .                \}
20527 .                el .sp .5v
20528 .             \}
20529 .             el .sp .5v
20530 .          \}
20531 .          ev label
20532 .          evc \\*[ev-current]
20533 .          nh
20534 .          ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
20535 .          el \{\
20536 .             tbl*label-style
20537 .             vs \\n[.ps]u+\\n[tbl*label-autolead]u
20538 .             nr tbl*label-lead-diff \\n[lead-pre-tbl]-\\n[.v]
20539 .          \}
20540 .          if \\n[tbl*label-with-chapter] \
20541 .             ds chapno \\n[#CH_NUM].
20542 .          TBL*SET_LABEL_QUAD \\*[tbl*label-quad]
20543 .          di tbl*mla-label-caption
20544 \!.        in 0
20545 .          ie \\n[tbl*autolabel] \{\
20546 .             ds label \
20547 \\*[tbl*label-prfx]\\*[chapno]\\n[tbl*label-num]\\*[tbl*label-sffx]\"
20548 .             nop \\*[label]
20549 .             nr tbl*label-width \w'\\*[label]'
20550 .             rr label
20551 .          \}
20552 .          el \{\
20553 .             if !'\\*[tbl*label]'' \{\
20554 .                nop \\*[tbl*label]
20555 .                nr tbl*label-width \w'\\*[tbl*label]'
20556 .             \}
20557 .          \}
20558 .          if \\n[tbl*autolabel] \
20559 .             ds tbl*label \\*[chapno]\\n[tbl*label-num]
20560 .          br
20561 .          di
20562 .       \}
20563 .       da tbl*mla-label-caption
20564 .       ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
20565 .       el .tbl*caption-style
20566 .       if '\\*[tbl*caption-quad]'L' \{\
20567 .           EOL
20568 .           ie \\n[float*tbl] \{\
20569 .              ie \\n[tbl*center] \
20570 .                 ll \\n[ll-pre-tbl]u-\\n[TW]u/2u+\\n[TW]u-\\n[tmp-ind]u
20571 .              el \
20572 .                 ll \\n[TW]u+\\n[.i]u-\\n[tmp-ind]u
20573 \!.            in \\n[tmp-ind]u
20574 .              ti -\\n[tmp-ind]u
20575 .           \}
20576 .           el \{\
20577 .              ie \\n[tbl*center] \{\
20578 .                 if '\\*[tbl*label-quad]'L' \{\
20579 .                    ll \\n[ll-pre-tbl]u-\\n[TW]u/2u+\\n[TW]u
20580 \!.                  in \\n[tmp-ind]u
20581 .                 \}
20582 .              \}
20583 .              el \
20584 .                 in \\n[tmp-ind]u+\\n[ind-pre-tbl]u
20585 .           \}
20586 .           ti -\\n[tmp-ind]u
20587 .       \}
20588 .       nop \\*[tbl*caption]
20589 .       br
20590 \!.     in
20591 .       da
20592 .       if !'\\n[.z]'FLOAT*DIV' \{\
20593 .          ch FOOTER \\n[#VARIABLE_FOOTER_POS]u+\\n[#DOC_LEAD]u
20594 .          ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u+\\n[#DOC_LEAD]u
20595 .          ie \\n[#MLA] .nr caption-needs 3
20596 .          el .nr caption-needs 2
20597 .          if \
20598 (\\n[dn]+(\\n[#DOC_LEAD]*\\n[tbl*needs])+(\\n[caption-needs]*\\n[caption-lead]))>\\n[.t] \{\
20599 .             nr pgnum \\n%+\\n[#PAGE_NUM_ADJ]
20600 .             if \\n[#COLUMNS] .ds col-num ", column \\n[#COL_NUM]
20601 .             tm1 \
20602 "[mom]: Table with caption at line \\n[.c] \
20603 does not fit on page \\n[pgnum]\\*[col-num].
20604 .             tm1 \
20605 "       Shifting table to next column or page.
20606 .             ie (\\n[#COLUMNS]=1)&(\\n[#COL_NUM]=\\n[#NUM_COLS]) \{\
20607 .                rr tbl*no-header
20608 .                if \\n[defer] .nr skip-th-warning 1
20609 .                NEWPAGE
20610 .             \}
20611 .             el \{\
20612 .                nr tbl*no-top-hook 1
20613 .                sp \\n[.t]u
20614 .                if (\\n[tbl*caption-after-label]=1):(\\n[tbl*plain]=1) \
20615 .                   sp 1n-.3n
20616 .             \}
20617 .          \}
20618 .          ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
20619 .          ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u
20620 .       \}
20621 .       nf
20622 .       if (\\n[nl]=\\n[#PAGE_TOP]):(\\n[nl]=\\n[dc]) \
20623 .          nr tbl*label-lead-diff-adj 1
20624 .       ie (\\n[.t]>1)&(\\n[@TOP]=0) \{\
20625 .          if !\\n[#NO_FLEX] \{\
20626 .             NO_FLEX
20627 .             nr #RESTORE_FLEX 1
20628 .          \}
20629 .          if \\n[.ns] .rs
20630 .          sp \\n[tbl*label-lead-diff]u
20631 .       \}
20632 .       el \{\
20633 .          if \\n[.t]=1 .sp \\n[.t]u
20634 .          ie \\n[#COL_NUM]>1 \
20635 .             ie (\\n[nl]=\\n[#PAGE_TOP]):(\\n[nl]=\\n[dc]) \
20636 .                sp |\\n[dc]u+\\n[tbl*label-lead-diff]u
20637 .             el .sp .5v
20638 .       \}
20639 .       tbl*mla-label-caption
20640 .    \}
20641 .    ie \\n[#PRINT_STYLE]=1 .sp .5v
20642 .    el .sp .5n
20643 .    if \\n[tbl*label-lead-diff-adj] \{\
20644 .       sp -\\n[tbl*label-lead-diff]u
20645 .       rr tbl*label-lead-diff-adj
20646 .    \}
20647 .    br
20648 .    if !'\\*[tbl*caption-space]'' .sp \\*[tbl*caption-space]
20649 \!.  if \\\\n[float*tbl] .ev FLOAT
20650 .    ev \\*[ev-current]
20651 .END
20652 \#
20653 .MAC TBL*CLEANUP END
20654 .    if !'\\n[.z]'FLOAT*DIV' \{\
20655 .       rm tbl*header-div
20656 .       rm short
20657 .       rm tbl*caption
20658 .       rm tbl*caption-short
20659 .       rm tbl*label
20660 .       rr tbl*center
20661 .       rr tbl*caption-top-lead-diff
20662 .       rr tbl*have-header
20663 .       rr tbl*no-print-header
20664 .       rr tbl*have-caption
20665 .       rr tbl*have-label
20666 .       rr tbl*plain-boxed
20667 .       rr tbl*boxed
20668 .    \}
20669 .    rr doing-tbl
20670 .    rm tbl*space-adj
20671 .    rr tbl*skip-label
20672 .    rr tbl*skip-source
20673 .    rr tbl*label-warning
20674 .    rr tbl*no-shim
20675 .    rr tbl*no-flex
20676 .    rr tbl*plain
20677 .    rr tbl*caption-top-lead-diff
20678 .    rnn tbl*have-label tbl@label
20679 .    rnn tbl*have-source tbl@source
20680 .    if '\\*[tbl*label-sffx-tmp]'.' .ds tbl*label-sffx .
20681 .    if \\n[#RESTORE_INDENT_BOTH] \{\
20682 .       IB
20683 .       rr #RESTORE_INDENT_BOTH
20684 .    \}
20685 .    if \\n[#RESTORE_INDENT_LEFT] \{\
20686 .       IL
20687 .       rr #RESTORE_INDENT_LEFT
20688 .    \}
20689 .    if \\n[#RESTORE_FLEX] \{\
20690 .       NO_FLEX off
20691 .       rr #RESTORE_FLEX
20692 .    \}
20693 .END
20694 \#
20695 .MAC print-label END
20696 .    if \\n[.u] .nr fill 1
20697 .    nf
20698 .    if \\n[tbl*center] \{\
20699 .       if '\\n[.z]'' \{\
20700 .          ll \\n[.l]u-\\n[TW]u/2u+\\n[TW]u
20701 .          if \\n[ind-pre-tbl] \
20702 .             in \\n[ind-pre-tbl]u-(\\n[ind-pre-tbl]u/2u)
20703 .       \}
20704 .    \}
20705 .    if !\\n[tbl*skip-label] \
20706 .       tbl*label-div
20707 .    if \\n[tbl*center] \{\
20708 .       if '\\n[.z]'' \{\
20709 .          ll
20710 .          in 0
20711 .       \}
20712 .    \}
20713 .    if \\n[fill] .fi
20714 .    rr fill
20715 .END
20716 \#
20717 .MAC tbl@top-hook END
20718 .    if (\\n[tbl*have-header:1]=1):(\\n[tbl*have-header]=1) \{\
20719 .       if !r tbl*no-print-header \{\
20720 .          nf
20721 .          rr @TOP
20722 .          ch RR_@TOP
20723 .          ev top-hook
20724 .          evc 0
20725 .          rs
20726 .          nop \&
20727 .          ie !\\n[tbl*boxed] .sp -1
20728 .          el .sp -1n
20729 .          tbl*print-header
20730 .          ev
20731 .       \}
20732 .    \}
20733 .END
20734 \#
20735 .MAC tbl*print-header END
20736 .    if \\n[.u]=1 \{\
20737 .       nf
20738 .       nr fill 1
20739 .    \}
20740 .    if \\n[#COL_NUM]>1 \
20741 .       if !\\n[tbl*have-caption] \
20742 .          if (\\n[@TOP]=1):(\\n[nl]=\\n[dc]) \
20743 .             sp .3n
20744 .    if \\n[tbl*center] \!.in \\n[ind-pre-tbl]u/2u
20745 .    ie d tbl*header-div:span .tbl*header-div:span
20746 .    el .tbl*header-div
20747 .    if '\\n[.z]'FLOAT*DIV' \
20748 .       if \\n[tbl*center] .ce 1000
20749 .    mk #T
20750 .    if !'\\n[.z]'FLOAT*DIV' \{\
20751 .       ch FOOTER \\n[#VARIABLE_FOOTER_POS]u+\\n[#DOC_LEAD]u
20752 .       ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u+\\n[#DOC_LEAD]u
20753 .    \}
20754 .END
20755 \#
20756 .MAC tbl@bottom-hook END
20757 .       rr #DIVERTED
20758 .       rr @TOP
20759 .       ch RR_@TOP
20760 .END
20761 \#
20762 .MAC tbl*float-warning END
20763 .    tm1 "[mom]: Table in FLOAT, output page \\n[#PAGENUMBER], exceeds page vertical limits.
20764 .    tm1 "       Multipage boxed tables cannot be contained within floats.
20765 .    ab   [mom]: Aborting '\\n[.F]', approx. line \\n[.c].
20766 .END
20767 \#
20768 .MAC tbl*caption-warning END
20769 .    tm1 "[mom]: TS at line \\n[.c] has CAPTION but no H argument.
20770 .    tm1 "       CAPTION requires H with a corresponding .TH.
20771 .    ab   [mom]: Aborting '\\n[.F]'.
20772 .END
20773 \#
20774 .MAC tbl*source-warning END
20775 .    tm1 "[mom]: MLA enabled, but TE at line \\n[.c] has no SOURCE.
20776 .    tm1 "       MLA style for tables requires that a source be cited.
20777 .    ab   [mom]: Aborting '\\n[.F]'.
20778 .END
20779 \#
20780 .MAC ds@need END \" Move vertically until there is enough space for \$1
20781 .    if '\\n(.z'' \{\
20782 .       while \\n[.t]<=(\\$1)&(\\n[nl]>\\n[#PAGE_TOP]) \{\
20783 .          rs
20784 '          sp \\n[.t]u
20785 .       \}
20786 .    \}
20787 .END
20788 \#
20789 \# ***eqn***
20790 \#
20791 \# EQ/EN macros borrowed from ms, mommified by Robin Haberkorn
20792 \# <robin.haberkorn@googlemail.com>, expanded by Peter Schaffter.
20793 \#
20794 \# EQ [ -L | -C | -I <indent> ] [label]
20795 \# EN [ CONT | CONTINUED | ... ]
20796 \#
20797 \# Equations are centered by default, but can be left-justified
20798 \# (EQ -L), explicitly centered, or indented (EQ -I).
20799 \#
20800 \# Each eqn block for multi-line equations aligned with 'mark' and
20801 \# 'lineup' should be terminated by passing 'CONT' or 'CONTINUED'
20802 \# or '...' to EN.
20803 \#
20804 \# Note that geqn mark and lineup work correctly in centered equations.
20805 \#
20806 .MAC EQ END
20807 .    if \\n[eqn*copy-in]=1 \{\
20808 .       if !\\n[eqn-linenum] .nr eqn-linenum \\n[.c]
20809 .       if !\\n[pgnum] .nr pgnum \\n%+\\n[#PAGE_NUM_ADJ]
20810 .       br
20811 .       if \\n[.u] .nr fill 1
20812 .       na
20813 .       rr float*eqn
20814 .       if '\\n[.z]'FLOAT*DIV' .nr float*eqn 1
20815 .       nr eqn*restore-adj \\n[.j]
20816 .       if !\\n[continued] \{\
20817 .          PDF_TARGET eqn:\\n+[lists*target]
20818 .          rr eqn*type
20819 .          nr loop-counter \\n[#NUM_ARGS]
20820 .          nr loop-count 0 1
20821 .          while \\n+[loop-count]<=\\n[loop-counter] \{\
20822 .             if '\\$1'-L' \{\
20823 .                nr eqn*left 1
20824 .                nr eqn*type 1
20825 .                shift
20826 .             \}
20827 .             if '\\$1'-I' \{\
20828 .                nr eqn*ind  1
20829 .                nr eqn*type 2
20830 .                shift
20831 .                ds DI \\$1
20832 .                ds DI@cont \\*[DI]
20833 .                shift
20834 .             \}
20835 .             if '\\$1'-C' \{\
20836 .                nr eqn*center 1
20837 .                nr eqn*type   3
20838 .                shift
20839 .             \}
20840 .             if '\\$1'ADJUST' \{\
20841 .                ds eqn*space-adj \\$2
20842 .                shift 2
20843 .             \}
20844 .             if '\\$1'LABEL' \{\
20845 .                ds eqn*label \\$2
20846 .                shift 2
20847 .             \}
20848 .             if '\\$1'SHIFT_LABEL' \{\
20849 .                ds eqn*shift-label \\$2
20850 .                shift 2
20851 .             \}
20852 .             if '\\$1'CAPTION' \{\
20853 .                ds eqn*caption \\$2
20854 .                shift 2
20855 .             \}
20856 .             if '\\$1'SHORT_CAPTION' \{\
20857 .                ds eqn*caption-short \\$2
20858 .                shift 2
20859 .             \}
20860 .             if '\\$1'TARGET' \{\
20861 .                ds target "\\$2
20862 .                PDF_TARGET "\\*[target]
20863 .                shift 2
20864 .             \}
20865 .             if '\\$1'NO_SHIM' \{\
20866 .                nr @no-shim 1
20867 .                shift 1
20868 .             \}
20869 .             if '\\$1'NO_FLEX' \{\
20870 .                nr eqn*no-flex
20871 .                shift
20872 .             \}
20873 .          \}
20874 .       \}
20875 .       if (\\n[eqn*have-label]=1):(\\n[eqn*autolabel]=1) \
20876 .          ds label-type eqn
20877 .       if '\\*[eqn*shift-label]'' .ds eqn*shift-label 0
20878 .       if !\\n[eqn*type] \{\
20879 .          nr eqn*center 1
20880 .          nr eqn*type   3
20881 .          shift
20882 .       \}
20883 .       if !'\\*[eqn*caption]'' \{\
20884 .          if '\\*[caption-quad]'L' \{\
20885 .             if \\n[default-left] .ds caption-quad R
20886 .             rr default-left
20887 .          \}
20888 .       \}
20889 .       if !\\n[continued] \{\
20890 .          if !'\\*[eqn*caption-short]'' .ds short -short
20891 .          if \\n[eqn*autolabel] \{\
20892 .             if \\n[eqn*label-with-chapter] \
20893 .                ds chapno \\n[#CH_NUM].
20894 .             ds eqn*label \\*[chapno]\\n+[eqn*label-num]
20895 .             nr eqn*label-width \w'\\*[eqn*label]'
20896 .             if dLABEL.REFS \
20897 .                tm .ds \\*[target] \\*[chapno]\\n[eqn*label-num]
20898 .             rm target
20899 .             nr eqn*label-num -1
20900 .          \}
20901 .          ie !'\\n[.z]'' \{\
20902 .             if (\\n[float*img]=0)&(\\n[float*pic]=0)&(\\n[float*tbl]=0) \{\
20903 \!.              PDF_TARGET eqn:\\\\n+[lists*target]
20904 .                ie !'\\*[eqn*label]'' \
20905 \!.                 TO_EQUATIONS "\\*[eqn*label]" "\\*[eqn*caption\\*[short]]"
20906 .                el \
20907 \!.                 TO_EQUATIONS "\\*[eqn*caption\\*[short]]"
20908 .             \}
20909 .          \}
20910 .          el \{\
20911 .             PDF_TARGET eqn:\\n+[lists*target]
20912 .             ie !'\\*[eqn*label]'' \
20913 .                TO_EQUATIONS "\\*[eqn*label]" "\\*[eqn*caption\\*[short]]"
20914 .             el \
20915 .                TO_EQUATIONS "\\*[eqn*caption\\*[short]]"
20916 .          \}
20917 .       \}
20918 .       if \\n[continued] \{\
20919 .          rm continued
20920 .          rr continued
20921 .       \}
20922 .       if \\n[eqn@left*cont] .nr eqn*type 1
20923 .       if \\n[eqn@ind*cont]  \{\
20924 .           nr eqn*type 2
20925 .           ds DI \\*[DI@cont]
20926 .       \}
20927 .    \}
20928 .    if \\n[eqn@center*cont] .nr eqn*type 3
20929 .    ev EQN
20930 .    evc 0
20931 .    di eqn*div
20932 .    in 0
20933 .    nf
20934 .END
20935 \#
20936 .MAC EN END
20937 .    if !'\\n[.z]'eqn*div' \{\
20938 .       @error mismatched EN
20939 .       return
20940 .    \}
20941 .    br
20942 .    di
20943 .    ev
20944 .    if !'\\*[eqn*label]''   .nr eqn*have-label   1
20945 .    if !'\\*[eqn*caption]'' .nr eqn*have-caption 1
20946 .    if !'\\$1'' \{\
20947 .       ie '\\$1'...' .ds continued CONT
20948 .       el .ds continued \\$1
20949 .       substring continued 0 3
20950 .       ie '\\*[continued]'CONT' \{\
20951 .          nr continued 1
20952 .          rm continued
20953 .          if \\n[eqn*ind]    .nr eqn@ind*cont    1
20954 .          if \\n[eqn*left]   .nr eqn@left*cont   1
20955 .          if \\n[eqn*center] .nr eqn@center*cont 1
20956 .       \}
20957 .       el \{\
20958 .          tm1 "[mom]: Invalid argument \\$1 to \\$0.
20959 .          tm1 "       Must be 'CONTINUED', 'CONT', or '...'
20960 .          ab   [mom]: Aborting '\\n[.F]' at line \\n[.c].
20961 .       \}
20962 .    \}
20963 .    if \\n[dl]:\\n[eqn*have-label] \{\
20964 .       ds eqn*tabs \\n[.tabs]
20965 .       ie \\n[dl] \{\
20966 .          if !'\\n[.z]'FLOAT*DIV' \{\
20967 .             ie \\n[eqn*have-caption] .ne \\n[dn]u-\\n[.V]
20968 .             el .ne \\n[dn]u-1v-\\n[.V]
20969 .          \}
20970 .          chop eqn*div
20971 .          if '\\*[DD]'' \{\
20972 .             ds DD .5v
20973 .             if !\\n[@TOP] \{\
20974 .                sp \\*[DD]
20975 .                if !'\\*[eqn*space-adj]'' .sp \\*[eqn*space-adj]u
20976 .             \}
20977 .          \}
20978 .          if \\n[cutaround] .ll \\n[eqn*cutaround-width]u
20979 .          ie \\n[eqn*type]=1 \{\
20980 .             ta (u;\\n[.l]-\\n[.i])R
20981 .             ie \\n[continued] .nop \\*[eqn*div]
20982 .             el \{\
20983 .                ie \\n[eqn*autolabel] \
20984 .nop \
20985 \\*[eqn*div]\
20986 \\*[eqn*label-specs]\
20987 \t\v'+\\*[eqn*shift-label]'\
20988 \\*[eqn*label-prfx]\\*[chapno]\\n+[eqn*label-num]\\*[eqn*label-sffx]\
20989 \v'-\\*[eqn*shift-label]'\
20990 \\*[revert-specs]
20991 .                el \
20992 .nop \
20993 \\*[eqn*div]\
20994 \\*[eqn*label-specs]\
20995 \t\v'+\\*[eqn*shift-label]'\
20996 \\*[eqn*label]\
20997 \v'-\\*[eqn*shift-label]'\
20998 \\*[revert-specs]
20999 .             \}
21000 .             if \\n[eqn-cutaround] .ll
21001 .             if !\\n[continued] \{\
21002 .                if \\n[eqn*have-caption] \
21003 .                   ADD_CAPTION
21004 .             \}
21005 .          \}
21006 .          el \{\
21007 .             ie \\n[eqn*type]=2 \{\
21008 .                ie '\\*[eqn*label-quad]'L' \{\
21009 .                   ta \\*[DI]
21010 .                   ie \\n[continued] .nop \t\\*[eqn*div]
21011 .                   el \{\
21012 .                      ie \\n[eqn*autolabel] \
21013 .nop \
21014 \\*[eqn*label-specs]\
21015 \v'+\\*[eqn*shift-label]'\
21016 \\*[eqn*label-prfx]\\*[chapno]\\n+[eqn*label-num]\\*[eqn*label-sffx]\
21017 \v'-\\*[eqn*shift-label]'\
21018 \t\\*[eqn*div]\
21019 \\*[revert-specs]
21020 .                      el \
21021 .nop \
21022 \\*[eqn*label-specs]\
21023 \v'+\\*[eqn*shift-label]'\
21024 \\*[eqn*label]\
21025 \v'-\\*[eqn*shift-label]'\
21026 \\*[revert-specs]\
21027 \t\\*[eqn*div]
21028 .                   \}
21029 .                \}
21030 .                el \{\
21031 .                   ta \\*[DI] (u;\\n[.l]-\\n[.i])R
21032 .                   ie \\n[continued] .nop \t\\*[eqn*div]
21033 .                   el \{\
21034 .                      ie \\n[eqn*autolabel] \
21035 .nop \
21036 \t\\*[eqn*div]\
21037 \\*[eqn*label-specs]\
21038 \t\v'+\\*[eqn*shift-label]'\
21039 \\*[eqn*label-prfx]\\*[chapno]\\n+[eqn*label-num]\\*[eqn*label-sffx]\
21040 \v'-\\*[eqn*shift-label]'\
21041 \\*[revert-specs]
21042 .                      el \
21043 .nop \
21044 \t\\*[eqn*div]\
21045 \\*[eqn*label-specs]\
21046 \t\v'+\\*[eqn*shift-label]'\
21047 \\*[eqn*label]\
21048 \v'-\\*[eqn*shift-label]'\
21049 \\*[revert-specs]
21050 .                   \}
21051 .                \}
21052 .                if !\\n[continued] \{\
21053 .                   if \\n[eqn*have-caption] \
21054 .                      ADD_CAPTION
21055 .                \}
21056 .             \}
21057 .             el \{\
21058 .                ie '\\*[eqn*label-quad]'L' \{\
21059 .                   ta (u;\\n[.l]-\\n[.i]/2)C
21060 .                   ie \\n[continued] .nop \t\\*[eqn*div]
21061 .                   el \{\
21062 .                      ie \\n[eqn*autolabel] \
21063 .nop \
21064 \\*[eqn*label-specs]\
21065 \v'+\\*[eqn*shift-label]'\
21066 \\*[eqn*label-prfx]\\*[chapno]\\n+[eqn*label-num]\\*[eqn*label-sffx]\
21067 \v'-\\*[eqn*shift-label]'\
21068 \t\\*[eqn*div]\
21069 \\*[revert-specs]
21070 .                      el \
21071 .nop \
21072 \\*[eqn*label-specs]\
21073 \v'+\\*[eqn*shift-label]'\
21074 \\*[eqn*label]\
21075 \v'-\\*[eqn*shift-label]'\
21076 \\*[revert-specs]\
21077 \t\\*[eqn*div]
21078 .                   \}
21079 .                \}
21080 .                el \{\
21081 .                   ta (u;\\n[.l]-\\n[.i]/2)C (u;\\n[.l]-\\n[.i])R
21082 .                   ie \\n[continued] .nop \t\\*[eqn*div]
21083 .                   el \{\
21084 .                      ie \\n[eqn*autolabel] \
21085 .nop \
21086 \t\\*[eqn*div]\
21087 \\*[eqn*label-specs]\
21088 \t\v'+\\*[eqn*shift-label]'\
21089 \\*[eqn*label-prfx]\\*[chapno]\\n+[eqn*label-num]\\*[eqn*label-sffx]\
21090 \v'-\\*[eqn*shift-label]'\
21091 \\*[revert-specs]
21092 .                      el \
21093 .nop \
21094 \t\\*[eqn*div]\
21095 \\*[eqn*label-specs]\
21096 \t\v'+\\*[eqn*shift-label]'\
21097 \\*[eqn*label]\
21098 \v'-\\*[eqn*shift-label]'\
21099 \\*[revert-specs]
21100 .                   \}
21101 .                \}
21102 .                if !\\n[continued] \{\
21103 .                   if \\n[eqn*have-caption] \
21104 .                      ADD_CAPTION
21105 .                \}
21106 .             \}
21107 .          \}
21108 .       \}
21109 .       el \{\
21110 .          ta (u;\\n[.l]-\\n[.i])R
21111 .nop \
21112 \\*[eqn*label-specs]\
21113 \t\v'+\\*[eqn*shift-label]'\
21114 \t\\*[eqn*label]\
21115 \v'-\\*[eqn*shift-label]'\
21116 \\*[revert-specs]
21117 .       \}
21118 .       ta \\*[eqn*tabs]
21119 .\" if continuing (ie is a multi-line equation), don't space and SHIM
21120 .       if !\\n[continued] \{\
21121 .          br
21122 .          if !\\n[@TOP] \
21123 .             if !\\n[.t]<(\\*[DD]+1) \
21124 .                sp \\*[DD]
21125 .          if !'\\*[eqn*space-adj]'' .sp -\\*[eqn*space-adj]u
21126 .          ie !\\n[eqn*no-shim] \{\
21127 .             ie !\\n[#NO_SHIM] \
21128 .                if !'\\n[.z]'FLOAT*DIV' .SHIM
21129 .             el \
21130 .                if !\\n[eqn*no-flex] \
21131 .                   if !\\n[#NO_FLEX] \
21132 .                      if !'\\n[.z]'FLOAT*DIV' .FLEX
21133 .          \}
21134 .          el \
21135 .             if !\\n[eqn*no-flex] \
21136 .                if !\\n[#NO_FLEX] \
21137 .                   if !'\\n[.z]'FLOAT*DIV' .FLEX
21138 .          rm DD
21139 .          rm eqn*caption
21140 .          rm eqn*caption-short
21141 .          rm eqn*label
21142 .          rm short
21143 .          rr eqn*copy-in
21144 .       \}
21145 .       rm DI@cont
21146 .       rr eqn*center
21147 .       rr eqn@center*cont
21148 .       rr eqn*have-label
21149 .       rr eqn*have-caption
21150 .       rr eqn*ind
21151 .       rr eqn@ind*cont
21152 .       rr eqn*left
21153 .       rr eqn@left*cont
21154 .       if !\\n[eqn-cutaround] .rm eqn*space-adj
21155 .    \}
21156 .    nr eqn*copy-in 1
21157 .    ad \\n[eqn*restore-adj]
21158 .    if \\n[fill] .fi
21159 .    rr fill
21160 .END
21161 \#
21162 .MAC ADD_CAPTION END
21163 .    ie \\n[.t]<\\n[.v] \{\
21164 .       if !'\\n[.z]'FLOAT*DIV' \{\
21165 .          if \\n[#COLUMNS]=1 .ds col-num ", column \\n[#COL_NUM]
21166 .          tm1 "[mom]: '\\n[.F]', macro EQ, line \\n[eqn-linenum]:
21167 .          tm1 "       Insufficient room for equation caption on page \\n[pgnum]\\*[col-num].
21168 .          tm1 "       Skipping caption but continuing to process.
21169 .          if !\\n[@TOP] \{\
21170 .             ie \\n[#COLUMNS] \
21171 .                COL_NEXT internal
21172 .             el .NEWPAGE
21173 .          \}
21174 .          rr eqn-linenum
21175 .          rr pgnum
21176 .       \}
21177 .    \}
21178 .    el \{\
21179 .       if \\n[#PRINT_STYLE]=2 \{\
21180 .          ps \\*[eqn*caption-size-change]
21181 .          nr lead-curr \\n[.v]
21182 .          sp .5v
21183 .          vs \\n[.ps]u+\\n[eqn*caption-autolead]u
21184 .          nr eqn*caption-lead-diff \\n[lead-curr]-\\n[.v]
21185 .          sp \\n[eqn*caption-lead-diff]u
21186 .          ps
21187 .          if !'\\*[eqn*caption-space]'' \
21188 .             sp \\*[eqn*caption-space]
21189 .       \}
21190 .       if '\\*[eqn*caption-quad]'L' \{\
21191 .          fi
21192 .          ad l
21193 .          nop \
21194 \\*[eqn*caption-specs]\
21195 \\*[eqn*caption]\
21196 \\*[revert-specs]
21197 .          nf
21198 .       \}
21199 .       if '\\*[eqn*caption-quad]'C' \{\
21200 .          fi
21201 .          ad c
21202 .          nop \
21203 \\*[eqn*caption-specs]\
21204 \\*[eqn*caption]\
21205 \\*[revert-specs]
21206 .          nf
21207 .       \}
21208 .       if '\\*[eqn*caption-quad]'R' \{\
21209 .          fi
21210 .          ad r
21211 .          nop \
21212 \\*[eqn*caption-specs]\
21213 \\*[eqn*caption]\
21214 \\*[revert-specs]
21215 .          nf
21216 .       \}
21217 .       if !'\\*[eqn*caption-space]'' \
21218 .          sp -\\*[eqn*caption-space]
21219 .       vs
21220 .    \}
21221 .END
21222 \#
21223 \# ***pic***
21224 \#
21225 .MAC have-adjust END
21226 .    nr #ARGS  0 1
21227 .    nr #COUNT \\n[#NUM_ARGS]
21228 .    while \\n+[#ARGS]<=\\n[#COUNT] \{\
21229 .       if '\\$1'ADJUST' \{\
21230 .          ds pic*space-adj \\$2
21231 .          break
21232 .       \}
21233 .       shift
21234 .    \}
21235 .END
21236 \#
21237 \# User settable text style for pic
21238 \#
21239 \# PIC_TEXT_STYLE
21240 \# --------------
21241 \# *Argument:
21242 \#   <offset from page left>
21243 \# *Function:
21244 \#   Stores user supplied page offset in register #L_MARGIN.
21245 \#   Sets .po to user supplied offset.
21246 \# *Notes:
21247 \#   Requires unit of measure.
21248 \#
21249 .MAC PIC_TEXT_STYLE END
21250 .    nr #ARGS  0 1
21251 .    nr #COUNT \\n[#NUM_ARGS]
21252 .    while \\n+[#ARGS]<=\\n[#COUNT] \{\
21253 .       if '\\$1'FAMILY' \{\
21254 .          shift
21255 .          ds pic*text-family \\$1
21256 .          shift
21257 .       \}
21258 .       if '\\$1'FONT' \{\
21259 .          shift
21260 .          ds pic*text-font \\$1
21261 .          shift
21262 .       \}
21263 .       if '\\$1'SIZE' \{\
21264 .          shift
21265 .          ds pic*text-size-change \\$1
21266 .          shift
21267 .       \}
21268 .       if '\\$1'AUTOLEAD' \{\
21269 .          shift
21270 .          nr pic*text-autolead \\$1
21271 .          shift
21272 .       \}
21273 .    \}
21274 .END
21275 \#
21276 \# Main macros
21277 \#
21278 .MAC PS END
21279 .    if !\\n[#PP] .nop
21280 .    br
21281 .    have-adjust \\$@ \" Adjusting is handled by FLOAT
21282 .    if !'\\n[.z]'FLOAT*DIV' .FLOAT ADJUST \\*[pic*space-adj]
21283 .    PDF_TARGET fig:\\n+[lists*target]
21284 .    ds ev-current \\n[.ev]
21285 .    rr float*pic
21286 .    nr float*pic 1
21287 .    nr ind-pre-pic  \\n[.i]
21288 .    nr ll-pre-pic   \\n[.l]
21289 .    nr lead-pre-pic \\n[.v]
21290 .    if \\n[#MLA] .sp .5v
21291 .    in 0
21292 .    ev PIC
21293 .    evc \\n[ev-current]
21294 .    nf
21295 .    ie \\n[#NUM_ARGS]<2 .@error bad arguments to PS (not preprocessed with pic?)
21296 .    el \{\
21297 .       if \B'\\$1' \{\
21298 .          ie !\B'\\$2' .ds pic*scale-width \\$1
21299 .          el .ds pic*scale-width \\$2
21300 .       \}
21301 .    \}
21302 .\" This is a bit confusing. pic is decorated with 2 args (width
21303 .\" and height), which are read during pre-processing but have to be
21304 .\" ignored when parsing args during main processing.  We shift pic's
21305 .\" args out of the way, then pop them off the arg stack because
21306 .\" they're not needed during macro processing.
21307 .    while \B'\\$1' .shift
21308 .    nr loop-counter \\n[#NUM_ARGS]
21309 .    nr loop-count 0 1
21310 .    while \\n+[loop-count]<=\\n[loop-counter] \{\
21311 .       if '\\$1'LEFT' \{\
21312 .          nr pic*left 1
21313 .          shift 1
21314 .       \}
21315 .       if '\\$1'CAPTION' \{\
21316 .          nr pic*have-caption 1
21317 .          ds pic*caption \\$2
21318 .          shift 2
21319 .       \}
21320 .       if '\\$1'SHORT_CAPTION' \{\
21321 .          ds pic*caption-short \\$2
21322 .          shift 2
21323 .       \}
21324 .       if '\\$1'LABEL' \{\
21325 .          nr pic*have-label 1
21326 .          ds pic*label \\$2
21327 .          shift 2
21328 .       \}
21329 .       if '\\$1'TARGET' \{\
21330 .          ds target "\\$2
21331 .          PDF_TARGET "\\*[target]
21332 .          shift 2
21333 .       \}
21334 .       if '\\$1'NO_SHIM' \{\
21335 .          nr @no-shim 1
21336 .          shift 1
21337 .       \}
21338 .       if '\\$1'NO_FLEX' \{\
21339 .          nr @no-flex 1
21340 .          shift 1
21341 .       \}
21342 .       if '\\$1'GRAP' \{\
21343 .          nr grap 1
21344 .          shift 1
21345 .       \}
21346 .    \}
21347 .    if (\\n[pic*have-label]=1):(\\n[pic*autolabel]=1) \
21348 .       ds label-type pic
21349 .    ds pic*label-sffx-tmp \\*[pic*label-sffx]
21350 .    if !'\\*[pic*label-sffx-tmp]'' \
21351 .       substring pic*label-sffx-tmp -1
21352 .    if '\\*[pic*label-sffx-tmp]'.' \
21353 .       if \\n[pic*caption-after-label]=0 .chop pic*label-sffx
21354 .    if \\n[#MLA] \{\
21355 .       if (\\n[pic*have-label]=1):(\\n[pic*autolabel]=1) \{\
21356 .          if !\\n[pic*have-caption] \
21357 .             mla@error label caption \\n[.F] \\$0 \\n[.c]
21358 .       \}
21359 .       if \\n[pic*have-caption] \{\
21360 .          if !\\n[pic*have-label] \{\
21361 .             if !\\n[pic*autolabel] \
21362 .                mla@error caption label \\n[.F] \\$0 \\n[.c]
21363 .          \}
21364 .       \}
21365 .    \}
21366 .    if !'\\*[pic*text-family]'' \
21367 .       fam \\*[pic*text-family]
21368 .    if !'\\*[pic*text-font]'' \
21369 .       ft \\*[pic*text-font]
21370 .    if !'\\*[pic*text-size-change]'' \
21371 .       ps \\n[#DOC_PT_SIZE]u\\*[pic*text-size-change]
21372 .    nr lead-current \\n[.v]
21373 .    ie \\n[pic*text-autolead] \
21374 .       vs \\n[.ps]u+(\\n[pic*text-autolead]u*1000u)
21375 .    el .vs \\n[.ps]u
21376 .    nr pic@text-lead \\n[.v]
21377 .    nr pic@text-size \\n[.ps]
21378 .    if !'\\*[pic*text-color]'' .COLOR \\*[pic*text-color]
21379 .    if \\n[@TOP] \{\
21380 .       RESTORE_SPACE
21381 .       nr pic*top-lead-adj 1
21382 .    \}
21383 .    nr pic*top-lead-diff \\n[lead-pre-pic]u-\\n[.v]u
21384 .    if (\\n[pic*have-caption]=0):(\\n[pic*caption-after-label]=1) \{\
21385 .       ie \\n[pic*top-lead-adj] \{\
21386 .          sp \\n[pic*top-lead-diff]u
21387 .          rr pic*top-lead-adj
21388 .       \}
21389 .       el .if (\\n[pic*caption-after-label]=0):(\\n[#MLA]=0) \
21390 .          sp \\n[lead-pre-pic]u/2u
21391 .    \}
21392 .    if \\n[pic*label-with-chapter] \
21393 .       ds chapno \\n[#CH_NUM].
21394 .    if \\n[pic*autolabel] \
21395 .       ds pic*label \\*[pic*label-prfx]\\*[chapno]\\n+[fig*label-num]\\*[pic*label-sffx]
21396 .    nr fig*label-width \w'\\*[pic*label]'
21397 .    if !'\\*[pic*caption-short]'' .ds short -short
21398 .    if \\n[#PDF_BOOKMARKS] \{\
21399 .       ie !'\\*[pic*label]'' \
21400 \!.        TO_FIGURES "\\*[pic*label]" "\\*[pic*caption\\*[short]]"
21401 .       el \
21402 \!.        TO_FIGURES "\\*[pic*caption\\*[short]]"
21403 .    \}
21404 .    di pic*div
21405 .END
21406 \#
21407 .MAC PE END
21408 .    di
21409 .    nr pic*div-width \\n[dl]
21410 .    if \\n[@TOP] \
21411 .       RESTORE_SPACE
21412 .    if !\\n[nl]=\\n[#PAGE_TOP] .sp \\n[lead-pre-pic]u/2u
21413 .    if (\\n[pic*have-caption]=1)&(\\n[pic*caption-after-label]=0) \{\
21414 .       ev caption
21415 .       evc \\*[ev-current]
21416 .       nh
21417 .       ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
21418 .       el \{\
21419 .          if \\n[.u] \{\
21420 .             nr fill 1
21421 .             nf
21422 .          \}
21423 .          pic*caption-style
21424 .          if \\n[fill] .fi
21425 .          rr fill
21426 .          nr lead-current \\n[.v]
21427 .          vs \\n[.ps]u+\\n[pic*caption-autolead]u
21428 .          nr pic*caption-lead-diff \\n[lead-current]-\\n[.v]
21429 .          in \\n[ind-pre-pic]u
21430 .       \}
21431 .       PIC*SET_CAPTION_QUAD \\*[pic*caption-quad]
21432 .       if \\n[@TOP] .RESTORE_SPACE
21433 \!.     in -\\n[ind-pre-pic]u
21434 .       sp \\n[pic*caption-lead-diff]u
21435 \!.     if \\\\n[.ns] .rs
21436 .       nop \\*[pic*caption]
21437 .       if \\n[#PRINT_STYLE]=1 .sp .5v
21438 .       if !'\\*[pic*caption-space]'' \
21439 .          sp \\*[pic*caption-space]
21440 .       br
21441 .       if \\n[grap] \!.sp -2v
21442 .       ev
21443 .    \}
21444 .    if !\\n[pic*left] \!.in \\n[ll-pre-pic]u-\\n[pic*div-width]u/2u
21445 .    if (\\n[grap]=1)&(\\n[pic*caption-after-label]=1) \!.sp -2
21446 .    pic*div
21447 .    br
21448 .    if (\\n[pic*have-label]=1):(\\n[pic*autolabel]=1):(\\n[pic*caption-after-label]=1) \{\
21449 .       nr lead-pre-label \\n[.v]
21450 .       ev label
21451 .       evc \\*[ev-current]
21452 .       ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
21453 .       el \{\
21454 .          pic*label-style
21455 .          nr lead-current \\n[.v]
21456 .          vs \\n[.ps]u+\\n[pic*label-autolead]u
21457 .          in \\n[ind-pre-pic]u
21458 .          sp \\n[lead-current]u-\\n[.v]u
21459 .       \}
21460 .       PIC*SET_LABEL_QUAD \\*[pic*label-quad]
21461 \!.     in -\\n[ind-pre-pic]u
21462 .       sp \\n[lead-pre-label]u-\\n[.v]u
21463 .       if !'\\*[pic*label-space]'' .sp \\*[pic*label-space]
21464 .       if \\n[#PRINT_STYLE]=1 .sp .5v
21465 .       if \\n[#PRINT_STYLE]=2 .sp .25v
21466 .       ie \\n[pic*autolabel] \
21467 .          nop \\*[pic*label-prfx]\\*[chapno]\\n[fig*label-num]\\*[pic*label-sffx]\|
21468 .       el \
21469 .          if !'\\*[pic*label]'' .nop \\*[pic*label]
21470 .       if dLABEL.REFS \{\
21471 .          if \\n[pic*autolabel] \
21472 .             tm .ds \\*[target] \\*[chapno]\\n[fig*label-num]
21473 .          if \\n[pic*have-label] \
21474 .             tm .ds \\*[target] \\*[pic*label]
21475 .       \}
21476 .       rm target
21477 .       fam
21478 .       ft
21479 .       ps
21480 .       gcolor
21481 .       ie !\\n[pic*caption-after-label] .br
21482 .       el \{\
21483 .          if !'\\*[pic*caption]'' .nop \
21484 \\*[pic*caption-specs]\\*[pic*caption]\\*[revert-specs]
21485 .          br
21486 .       \}
21487 .       ev
21488 .       in 0
21489 .    \}
21490 .    ev
21491 .    sp .5v
21492 .    FLOAT off
21493 .    in \\n[ind-pre-pic]u
21494 .    rm pic*caption
21495 .    if !\\n[defer] .rm pic*label
21496 .    rm pic*left
21497 .    rm short
21498 .    if !\\n[cutaround] .rm pic*space-adj
21499 .    if !\\n[defer] .rr pic*have-caption
21500 .    rr grap
21501 .    rr float*pic
21502 .    if '\\*[pic*label-sffx-tmp]'.' .ds pic*label-sffx .
21503 .END
21504 \#
21505 \# ***refer***
21506 \#
21507 \# Footnote references
21508 \# -------------------
21509 \# *Function:
21510 \#   Instruct REF to put references in footnotes.
21511 \#
21512 .MAC FOOTNOTE_REFS END
21513 .    ie !'\\$1'' .rr #FN_REF
21514 .    el \{\
21515 .       if r #EN_REF .rr #EN_REF
21516 .       nr #FN_REF 1
21517 .    \}
21518 .    REF_STYLE NOTE
21519 .END
21520 \#
21521 \# Endnote references
21522 \# ------------------
21523 \# *Function:
21524 \#   Instruct REF to collect references for endnotes output.
21525 \#
21526 .MAC ENDNOTE_REFS END
21527 .    ie !'\\$1'' .rr #EN_REF
21528 .    el \{\
21529 .       if r #FN_REF .rr #FN_REF
21530 .       nr #EN_REF 1
21531 .       if !r#EN_MARKER_STYLE .ENDNOTE_MARKER_STYLE SUPERSCRIPT
21532 .    \}
21533 .    REF_STYLE NOTE
21534 .END
21535 \#
21536 \# Prepare mom for a reference
21537 \# ---------------------------
21538 \# *Argument:
21539 \#   <none> | INDENT  L|LEFT|R|RIGHT|B|BOTH  <indent value>
21540 \# *Function:
21541 \#   Calls FOOTNOTE or ENDNOTE, depending on whether #REF_FN or
21542 \#   #REF_EN is set to 1.
21543 \# *Notes:
21544 \#   For convenience, REF is a toggle.
21545 \#
21546 \#   REF optionally takes the same arguments as FOOTNOTE, allowing
21547 \#   users to indent references that go in footnotes when footnote
21548 \#   indenting is required.  FOOTNOTE_REFS must be on for this.
21549 \#
21550 .MAC REF END
21551 .    ie \\n[#FN_REF]+\\n[#EN_REF]=0 \{\
21552 .       if !\\n[#REF_WARNING]=1 \{\
21553 .          tm1 "[mom]: Before REF at line \\n[.c], neither FOOTNOTE_REFS nor ENDNOTE_REFS
21554 .          tm1 "       has been selected.  If "sort" and "accumulate" are in your refer
21555 .          tm1 "       commands, references will be collected for later output with $LIST$.
21556 .          tm1 "       Otherwise, they will disappear.
21557 .          nr #REF_WARNING 1
21558 .       \}
21559 .    \}
21560 .    el \{\
21561 .       ie \\n[#REF]=1 \{\
21562 .          if \\n[#FN_REF]=1 .FOOTNOTE OFF
21563 .          if \\n[#EN_REF]=1 .ENDNOTE OFF
21564 .          rr #REF
21565 .       \}
21566 .       el \{\
21567 .          rr #REF_WARNING
21568 .          nr #REF 1
21569 .          if \\n[#FN_REF]=1 .FOOTNOTE \\$1 \\$2 \\$3
21570 .          if \\n[#EN_REF]=1 .ENDNOTE
21571 .       \}
21572 .    \}
21573 .END
21574 \#
21575 \# Embedded references in text (with brackets)
21576 \# -------------------------------------------
21577 \#
21578 .MAC REF_BRACKETS_NOTICE END
21579 .    tm1 "[mom]: \\$1 has been removed from mom.  See the mom documentation 'refer.html'
21580 .    tm1 "       for instructions on parenthetical insertions of references into text.
21581 .    ie '\\$1'REF_STYLE' .tm1 "       Continuing to process '\\n[.F]' from line \\n[.c].
21582 .    el .ab   [mom]: Aborting '\\n[.F]' at \\$1, line \\n[.c].
21583 .END
21584 \#
21585 .MAC REF_BRACKETS_START END
21586 .    REF_BRACKETS_NOTICE \\$0
21587 .END
21588 \#
21589 .MAC REF_BRACKETS_END END
21590 .    REF_BRACKETS_NOTICE \\$0
21591 .END
21592 \#
21593 \# These four pairs of aliases allow users to embed references in
21594 \# text and have them surrounded by (), [], {} or <>.
21595 \#
21596 .ALIAS REF( REF_BRACKETS_START
21597 .ALIAS REF) REF_BRACKETS_END
21598 \#
21599 .ALIAS REF[ REF_BRACKETS_START
21600 .ALIAS REF] REF_BRACKETS_END
21601 \#
21602 .ALIAS REF{ REF_BRACKETS_START
21603 .ALIAS REF} REF_BRACKETS_END
21604 \#
21605 .ALIAS REF< REF_BRACKETS_START
21606 .ALIAS REF> REF_BRACKETS_END
21607 \#
21608 .MAC REF_STYLE END
21609 .    REF_BRACKETS_NOTICE \\$0
21610 .END
21611 \#
21612 \# Refer indenting
21613 \# ---------------
21614 \# *Argument:
21615 \#   FOOTNOTE | ENDNOTE | BIBLIO <indent for 2nd and subsequent lines of discrete reference entries>
21616 \# *Function:
21617 \#   Sets registers #REF_FN_INDENT, #REF_EN_INDENT or #REF_BIB_INDENT.
21618 \# *Notes:
21619 \#   Indent value requires a unit of measure.  If refs are going
21620 \#   into footnotes or endnotes, first lines get indented; if going
21621 \#   into a bibliography, second lines get indented
21622 \#
21623 .MAC INDENT_REFS END
21624 .    if '\\$1'FOOTNOTE' .ds $REF_FN_INDENT  \\$2
21625 .    if '\\$1'ENDNOTE'  .ds $REF_EN_INDENT  \\$2
21626 .    if '\\$1'BIBLIO'   .ds $REF_BIB_INDENT \\$2
21627 .END
21628 \#
21629 .ALIAS REF_INDENT INDENT_REFS
21630 \#
21631 \# Hyphenation of references
21632 \# -------------------------
21633 \# *Argument:
21634 \#   <none> | <anything>
21635 \# *Function:
21636 \#   Sets register #REF_HY
21637 \#
21638 .MAC HYPHENATE_REFS END
21639 .    ie '\\$1'' .nr #REF_HY 1
21640 .    el \
21641 .       if r #REF_HY .rr #REF_HY
21642 .END
21643 \#
21644 \# The remainder of the definitions in this section are modified
21645 \# versions of the definitions found in the refer module of s.tmac.
21646 \#
21647 .de @error
21648 .tm [mom]: '\\n[.F]', line \\n[.c]: \\$*
21649 ..
21650 \#
21651 \# Underlining unavoidably turns off sentence spacing.
21652 \#
21653 .de ref*restore-ss
21654 \c
21655 .SS \\*[$SAVED_SS_VAR]
21656 .if '\\n[.z]'END_NOTES' \{\
21657 \c
21658 \E*[PREV]\c
21659 .\}
21660 ..
21661 \# The following strings define the order of entries for different
21662 \# types of references.  Each letter in the string refers to a database
21663 \# field (A for author, T1/T2 for article and book titles, etc).
21664 \#
21665 .de ref*specs
21666 .if \\n[#PRINT_STYLE]=1 \{\
21667 .   char '     \[aq]
21668 .   char \[oq] \[aq]
21669 .\}
21670 .\" Internet site - type 0
21671 .ds ref*spec!0 i Q A m p T2 s o D c a u n
21672 .\" Journal article - type 1
21673 .ds ref*spec!1 i Q A m p T2 q O J V S N D P n
21674 .\" Book - type 2
21675 .ds ref*spec!2 i Q A m p T1 q b d l r E S e V O C I D P t n
21676 .\" Article within book - type 3
21677 .ds ref*spec!3 i Q A m p T2 B b d l r E S e V O C I D P t n
21678 .\" Tech report - type 4
21679 .ds ref*spec!4 i Q A m p T1 R G O C I D P n
21680 .\" Magazine or newspaper article - type 5
21681 .ds ref*spec!5 i Q A m p T2 O M V S N D P n
21682 ..
21683 \#
21684 \# Refer's "1st" macro.  Since it is possible to define database
21685 \# fields using any single letter, we remove all possible string
21686 \# definitions of the form [X and [x.  Also, reset ref*spec!<n>
21687 \# strings to their defaults.
21688 \#
21689 .de ]-
21690 .ref*specs
21691 .rm [A [B [C [D [E [F [G [H [I [J [K [L [M \
21692     [N [O [P [Q [R [S [T [U [V [W [X [Y [Z \
21693     [a [b [c [d [e [f [g [h [i [j [k [l [m \
21694     [n [o [p [q [r [s [t [u [v [w [x [y [z
21695 .if r [e .rr [e \" [e persists if %e field is last
21696 .rr ref*type
21697 .rm ref*string
21698 ..
21699 \#
21700 \# Refer's "2nd" macro; builds up a reference with ref*build, and
21701 \# prints it with ref*print.
21702 \#
21703 .de ][
21704 .nr ref*type \\$1
21705 .if \\n[ref*type]=0 \{\
21706 .   ie d [C \{\
21707 .      if !d [I \{\
21708 .         nr pre-1900 1 \" If pre-1900, MLA allows excluding publisher
21709 .         nr ref*type 2
21710 .      \}
21711 .   \}
21712 .   el .nr ref*type 2
21713 .   if d [q .nr ref*type 2
21714 .\}
21715 .if \\n[ref*type]=3 \{\
21716 .   if !'\\*([R'' \{\
21717 .      nr ref*type 4
21718 .      ds ref*spec!4 i Q A m p T2 B R O C I D P n
21719 .   \}
21720 .   if !'\\*([G'' \{\
21721 .      nr ref*type 4
21722 .      ds ref*spec!4 i A m p T2 B G O C I D P O n
21723 .   \}
21724 .\}
21725 .if r [T \{\
21726 .   als [T1 [T
21727 .   als [T2 [T
21728 .\}
21729 .ie d ref*spec!\\n[ref*type] .ref*build \\*[ref*spec!\\n[ref*type]]
21730 .el \{\
21731 .   @error unknown reference type '\\n[ref*type]'
21732 .   ref*build \\*[ref*spec!0]
21733 .\}
21734 .if !\\n[.hy]=0 \{\
21735 .nr #RESTORE_HY \\n[.hy]
21736 .if !r#REF_HY .nh
21737 .\}
21738 .ref*print
21739 .if !\\n[#RESTORE_HY]=0 .hy \\n[#RESTORE_HY]
21740 .rr #RESTORE_HY
21741 .rm ref*string
21742 .rm [F [T1 [T2
21743 ..
21744 \#
21745 \# Refer's "3rd" macros, which set up and terminate the output
21746 \# of collected references
21747 \#
21748 .de ]<
21749 .als ref*print ref*end-print
21750 .nr #REF 1
21751 .if \\n[#BIB_LIST]=1 \{\
21752 .   nr #IN_BIB_LIST 1
21753 .   LIST DIGIT \\*[$BIB_LIST_SEPARATOR] \\*[$BIB_LIST_PREFIX]
21754 .\}
21755 ..
21756 \#
21757 .de ]>
21758 .LIST OFF
21759 .rr #REF
21760 .rr #IN_BIB_LIST
21761 .als ref*print ref*normal-print
21762 ..
21763 \#
21764 \# Output
21765 \# ------
21766 \#
21767 \# Output normal, non-collected refs
21768 \#
21769 .de ref*normal-print
21770 .nr #CURRENT_HY \\n[.hy]
21771 \\*[ref*string]
21772 ..
21773 \#
21774 \# Output collected refs
21775 \#
21776 .de ref*end-print
21777 .\" 10 is arbitrary
21778 .nn 10
21779 .nr #REF_BIB_INDENT (u;\\*[$REF_BIB_INDENT])
21780 .ie \\n[#BIB_LIST]=0 \{\
21781 .   in +\\n[#REF_BIB_INDENT]u
21782 .   ti -\\n[#REF_BIB_INDENT]u
21783 .\}
21784 .el .ITEM
21785 .\" Part of workaround for refer spitting out a blank page if the
21786 .\" last ref falls on the bottom line.
21787 \\*[ref*string]\R'ref*num*first-pass +1'\?\R'ref*num +1'\?
21788 .sp \\n[#BIB_SPACE]u
21789 .ie \\n[#BIB_LIST]=0 .in
21790 .el .IL -\\n[#REF_BIB_INDENT]u
21791 .nn 0
21792 ..
21793 \#
21794 .als ref*print ref*normal-print
21795 \#
21796 \# Build up the ref*string
21797 \#
21798 \# Correct MLA "typewritten" style (printstyle TYPEWRITE) demands
21799 \# two spaces after each period.  The spaces are hardwired into the
21800 \# string definitions (ref*add-<x>), so we have to make sure that there
21801 \# aren't two spaces when the printstyle is TYPESET.  Since I find that
21802 \# references look a bit crowded with 0 sentence space, I've bumped it
21803 \# up to +4.  User's sentence spacing is reset in FOOTNOTES and ENDNOTES.
21804 \#
21805 .de ref*build
21806 .if \\n[#PRINT_STYLE]=2 \{\
21807 .   ds $RESTORE_SS_VAR \\*[$SS_VAR]
21808 .   SS +8
21809 .\}
21810 .rm ref*string
21811 .while \\n[.$] \{\
21812 .   if d [\\$1 \{\
21813 .      ie d ref*add-\\$1 .ref*add-\\$1
21814 .      el .ref*add-dflt \\$1
21815 .   \}
21816 .   shift
21817 .\}
21818 .\" now add a final period
21819 .ie d ref*string \{\
21820 .   if !\\n[ref*suppress-period] .as ref*string .
21821 .   if d ref*post-punct \{\
21822 .      as ref*string "\\*[ref*post-punct]
21823 .      rm ref*post-punct
21824 .   \}
21825 .\}
21826 .el .ds ref*string
21827 ..
21828 \#
21829 \# The following macros determine how entries are formatted WRT
21830 \# punctuation, type style, additional strings, etc.
21831 \#
21832 \# o First argument is the database field letter.
21833 \# o Second argument is the punctuation character to use to separate this
21834 \#   field from the previous field.
21835 \# o Third argument is a string with which to prefix this field.
21836 \# o Fourth argument is a string with which to postfix this field.
21837 \# o Fifth argument is a string to add after the punctuation character
21838 \#   supplied by the next field.
21839 \#
21840 \# %A Author(s)
21841 .de ref*add-A
21842 .ds eval*[A \\*([A
21843 .substring eval*[A -1
21844 .if '\\*[eval*[A]'.' \
21845 .   if !'\\*[$REF_STYLE]'NOTE' .chop [A
21846 .\" Per MLA, NOTE should not use idem, therefore if %i contains other than
21847 .\" idem (e.g., ed., trans.), transpose it to after author's name
21848 .ie '\\*[$REF_STYLE]'NOTE' \{\
21849 .   ie !'\\*[idem]'' .ref*field A "" "" ", \\*[idem]"
21850 .   el .ref*field A
21851 .   rm idem
21852 .el .ref*field A
21853 .\}
21854 .if \\n([A .nr ref*suppress-period 1
21855 ..
21856 \# %i Idem.  BIBLIO: In all instances, removes %A field and replaces
21857 \# it with a dash; if %i field contains other than the word, idem,
21858 \# appends it to the dash
21859 .de ref*add-i
21860 .ie '\\*[$REF_STYLE]'NOTE' \{\
21861 .   ie '\\*([i'idem' .rm [i
21862 .   el .ds idem \\*([i
21863 .\}
21864 .el \{\
21865 .   ie '\\*([i'idem' \{\
21866 .      rm [A
21867 .      rm [i
21868 .      ref*field i "" \[idem] "" " "
21869 .   \}
21870 .   el \{\
21871 .      ds eval*[i \\*([i
21872 .      substring eval*[i -1
21873 .      if '\\*[eval*[i]'.' \{\
21874 .         chop [i
21875 .         ds idem \\*([i
21876 .      \}
21877 .      rm [i
21878 .      rm [A
21879 .      ref*field i "" \[idem] ", \\*[idem]" " "
21880 .   \}
21881 .\}
21882 ..
21883 \# %m Multiple authors (et al.)
21884 .de ref*add-m
21885 .if !'\\*[$REF_STYLE]'NOTE' \{\
21886 .   ds eval*[m \\*([m
21887 .   substring eval*[m -1
21888 .   if '\\*[eval*[m]'.' .chop [m
21889 .\}
21890 .ref*field m ,
21891 ..
21892 \# %p Post-author string (e.g., Preface, Foreword, etc)
21893 .de ref*add-p
21894 .\" Convert first letter to uppercase, per MLA, if BIBLIO
21895 .if '\\*[$REF_STYLE]'BIBLIO' \{\
21896 .   ds initial*cap \\*([p
21897 .   substring initial*cap 0 0
21898 .   ds [p*string \\*([p
21899 .   substring [p*string 1
21900 .   ds [p \E*[UC]\\*[initial*cap]\E*[LC]\\*[[p*string]
21901 .\}
21902 .ie '\\*[$REF_STYLE]'NOTE' .ref*field p ,
21903 .el .ref*field p . " "
21904 ..
21905 \# %Q Author(s) when author is not a person
21906 .de ref*add-Q
21907 .ie '\\*[$REF_STYLE]'NOTE' .ref*field Q
21908 .el .ref*field Q
21909 ..
21910 \# %T Title (generic)
21911 .de ref*add-T1
21912 .ie '\\*[$REF_STYLE]'NOTE' .ref*field T , \E*[IT] \E*[ref*restore-ss]
21913 .el \{\
21914 .   ie !'\\*([A'' .ref*field T . " \E*[IT]" \E*[ref*restore-ss]
21915 .   el \{\
21916 .      ie !'\\*([Q'' .ref*field T . " \E*[IT]" \E*[ref*restore-ss]
21917 .      el .ref*field T . \E*[IT] \E*[ref*restore-ss]
21918 .   \}
21919 .\}
21920 .if \\n([T .nr ref*suppress-period \\n([T
21921 .
21922 ..
21923 \# %T Title of a chapter or article
21924 .de ref*add-T2
21925 .ie '\\*[$REF_STYLE]'NOTE' \
21926 .   ref*field T , \[lq] "" \[rq]
21927 .el \{\
21928 .   ie '\\*([A'' \{\
21929 .      ref*field T . \[lq] "" \[rq]
21930 .      if !'\\*([Q''.ref*field T . " \[lq]" "" \[rq]
21931 .   \}
21932 .   el .ref*field T . " \[lq]" "" \[rq]
21933 .\}
21934 .if \\n([T .nr ref*suppress-period \\n([T
21935 ..
21936 \# %B Book title (when citing an article from a book)
21937 .de ref*add-B
21938 .ie '\\*[$REF_STYLE]'NOTE' \{\
21939 .   ie \\n([T .ref*field B "" \E*[IT] \E*[ref*restore-ss]
21940 .   el .ref*field B , \E*[IT] \E*[ref*restore-ss]
21941 .\}
21942 .el \{\
21943 .   ie \\n([T .ref*field B "" ".\E*[IT]" \E*[ref*restore-ss]
21944 .   el .ref*field B . " \E*[IT]" \E*[ref*restore-ss]
21945 .\}
21946 \# refer doesn't set reg [T to 1 for these book titles, so we do it here
21947 .ds eval*[B \\*([B
21948 .substring eval*[B -1
21949 .rr [T
21950 .if '\\*[eval*[B]'!' .nr [T 1
21951 .if '\\*[eval*[B]'?' .nr [T 1
21952 .rm eval*[B
21953 ..
21954 \# %q Titles that must go in quotes (e.g. an unpublished dissertation)
21955 .de ref*add-q
21956 .ie '\\*[$REF_STYLE]'NOTE' .ref*field q , \[lq] "" \[rq]
21957 .el \{\
21958 .   ie !'\\*([A'' .ref*field q . " \[lq]" "" \[rq]
21959 .   el \{\
21960 .      ie !'\\*([Q'' .ref*field q . " \[lq]" "" \[rq]
21961 .      el .ref*field q . \[lq] "" \[rq]
21962 .   \}
21963 .\}
21964 ..
21965 \# %R Report number for technical reports
21966 .de ref*add-R
21967 .ref*field R . " "
21968 ..
21969 \# %J Journal name
21970 .de ref*add-J
21971 .ie '\\*[$REF_STYLE]'NOTE' \{\
21972 .   ie \\n([T .ref*field J "" "\E*[IT]" \E*[ref*restore-ss]
21973 .   el .ref*field J , "\E*[IT]" \E*[ref*restore-ss]
21974 .\}
21975 .el \{\
21976 .   ie \\n([T .ref*field J "" " \E*[IT]" \E*[ref*restore-ss]
21977 .   el .ref*field J . " \E*[IT]" \E*[ref*restore-ss]
21978 .\}
21979 ..
21980 \# %M Magazine or newspaper name
21981 .de ref*add-M
21982 .ie '\\*[$REF_STYLE]'NOTE' \{\
21983 .   ie \\n([T .ref*field M "" "\E*[IT]" \E*[ref*restore-ss]
21984 .   el .ref*field M , "\E*[IT]" \E*[ref*restore-ss]
21985 .\}
21986 .el \{\
21987 .   ie \\n([T .ref*field M "" " \E*[IT]" \E*[ref*restore-ss]
21988 .   el .ref*field M . " \E*[IT]" \E*[ref*restore-ss]
21989 .\}
21990 ..
21991 \# %E Editor(s)
21992 .de ref*add-E
21993 .ds eval*[E \\*([E
21994 .substring eval*[E -1
21995 .if '\\*[eval*[E]'.' \{\
21996 .   if !\\n[#FN_REF]+\\n[#EN_REF] .chop [E
21997 .   rm eval*[E
21998 .\}
21999 .\" Workaround for join-authors also joining editors.  MLA style
22000 .\" requires a comma after first editor only if there are more than
22001 .\" two, whereas join-authors always puts a comma after the first if
22002 .\" there's more than one.
22003 .rm eval*[E
22004 .nr position 1 1
22005 .nr counter 1 1
22006 .while !'\\*[eval*[E]',' \{\
22007 .   ds eval*[E \\*([E
22008 .   substring eval*[E \\n+[position] \\n[position]
22009 .   if \\n+[counter]>30 .break \" 30 is arbitrary
22010 .\}
22011 .\" Check for " and"
22012 .if '\\*[eval*[E]',' \{\
22013 .   ds eval*[E \\*([E
22014 .   nr and-check \\n[position]+4
22015 .   substring eval*[E \\n+[position] \\n[and-check]
22016 .\}
22017 .if '\\*[eval*[E]' and' \{\
22018 .   nr counter 1 1
22019 .   nr start-range -1 1
22020 .   nr end-range 3 1
22021 .   while !'\\*[eval*[E]', and' \{\
22022 .      ds eval*[E \\*([E
22023 .      substring eval*[E \\n+[start-range] \\n+[end-range]
22024 .      if \\n+[counter]>50 .break \" just in case; 50 is arbitrary
22025 .   \}
22026 .   if '\\*[eval*[E]', and' \{\
22027 .      length len*[E \\*([E
22028 .      nr rhs \\n[len*[E]-\\n[start-range]
22029 .      ds lhs \\*([E
22030 .      ds rhs \\*([E
22031 .      substring lhs 0 \\n[start-range]-1
22032 .      substring rhs -(\\n[rhs]-1)
22033 .      ds [E \\*[lhs]\\*[rhs]
22034 .   \}
22035 .   rm lhs
22036 .   rm rhs
22037 .   rr and-check
22038 .   rr counter
22039 .   rr start-range
22040 .   rr end-range
22041 .   rr len*[E
22042 .\}
22043 .\" End workaround
22044 .ie !\\n[ref*type]=0 \{\
22045 .   ie \\n([E>0 \{\
22046 .      ie '\\*[$REF_STYLE]'NOTE' \{\
22047 .         ie \\n([T .ref*field E "" "ed. "
22048 .         el .ref*field E , "ed. "
22049 .      \}
22050 .      el \{\
22051 .         ie \\n([T .ref*field E "" " Eds. "
22052 .         el .ref*field E . " Eds. "
22053 .      \}
22054 .   \}
22055 .   el \{\
22056 .      ie '\\*[$REF_STYLE]'NOTE' \{\
22057 .         ie \\n([T .ref*field E "" "ed. "
22058 .         el .ref*field E , "ed. "
22059 .      \}
22060 .      el \{\
22061 .         ie \\n([T .ref*field E "" " Ed. "
22062 .         el .ref*field E . " Ed. "
22063 .      \}
22064 .   \}
22065 .\}
22066 .el \{\
22067 .   ie \\n([T .ref*field E "" " "
22068 .   el .ref*field E . " "
22069 .\}
22070 .rr [T
22071 .rr [E
22072 ..
22073 \# %e Edition
22074 .de ref*add-e
22075 .ie \\n([T .ref*field e "" "" " ed."
22076 .el \{\
22077 .   ie '\\*[$REF_STYLE]'NOTE' .ref*field e , "" " ed."
22078 .   el .ref*field e . " " " ed."
22079 .\}
22080 .nr ref*suppress-period 1
22081 .nr [e 1
22082 .rr [T
22083 ..
22084 \# %V Volume (of a journal, or series of books); for journals, %N may be preferable
22085 .de ref*add-V
22086 .if \\n[ref*type]=1 \
22087 .   ref*field V
22088 .if \\n[ref*type]=2 \{\
22089 .   ie '\\*[$REF_STYLE]'NOTE' .ref*field V , "vol. "
22090 .   el \{\
22091 .      ie \\n([T .ref*field V "" " Vol. "
22092 .      el .ref*field V . " Vol. "
22093 .   \}
22094 .\}
22095 .if \\n[ref*type]=3 \{\
22096 .   ie \\n([T .ref*field V "" " "
22097 .   el .ref*field V . " "
22098 .\}
22099 .rr [T
22100 ..
22101 \# %N Journal number
22102 .de ref*add-N
22103 .ref*field N
22104 ..
22105 \# %S Series (books or journals)
22106 .de ref*add-S
22107 .if \\n[ref*type]=1 \
22108 .   ref*field S
22109 .if \\n[ref*type]=2 \{\
22110 .   ie '\\*[$REF_STYLE]'NOTE' \{\
22111 .      ie \\n([T .ref*field S
22112 .      el .ref*field S ,
22113 .   \}
22114 .   el \{\
22115 .      ie \\n([T .ref*field S "" " "
22116 .      el .ref*field S . " "
22117 .   \}
22118 .\}
22119 .if \\n[ref*type]=3 \{\
22120 .   ie \\n([T .ref*field S "" " "
22121 .   el .ref*field S . " "
22122 .\}
22123 .rr [T
22124 \# refer doesn't set reg [T to 1 for series titles, so we do it here
22125 .ds eval*[S \\*([S
22126 .substring eval*[S -1
22127 .if '\\*[eval*[S]'!' .nr [T 1
22128 .if '\\*[eval*[S]'?' .nr [T 1
22129 .rm eval*[S
22130 ..
22131 \# %C City
22132 .de ref*add-C
22133 .ie '\\*[$REF_STYLE]'NOTE' \{\
22134 .   ie r [d \{\
22135 .      ref*field C
22136 .      rr [d
22137 .   \}
22138 .   el \
22139 .      ref*field C "" \*[FU 2](
22140 .   if \\n([T .nr ref*suppress-period \\n([T
22141 .\}
22142 .el \{\
22143 .   ie \\n([T .ref*field C "" " "
22144 .   el \{\
22145 .      ie r [e .ref*field C "" " "
22146 .      el .ref*field C . " "
22147 .   \}
22148 .\}
22149 .rr [T
22150 .rr [e
22151 ..
22152 \# %I Publisher (I stands for Issuer)
22153 .de ref*add-I
22154 .ie '\\*[$REF_STYLE]'NOTE' \{\
22155 .   ie !'\\*([C'' .ref*field I :
22156 .   el .ref*field I "" (
22157 .\}
22158 .el \{\
22159 .   ie !'\\*([C'' .ref*field I :
22160 .   el \{\
22161 .      ie \\n([T .ref*field I "" " "
22162 .      el .ref*field I . " "
22163 .   \}
22164 .\}
22165 .rr [T
22166 ..
22167 \# %D Date of publication
22168 .de ref*add-D
22169 .if \\n[ref*type]=0 \{\
22170 .   ie '\\*[$REF_STYLE]'NOTE' .ref*field D ,
22171 .   el .ref*field D . " "
22172 .\}
22173 .if \\n[ref*type]=1 \
22174 .   ref*field D "" "(" ")"
22175 .if \\n[ref*type]=2 \{\
22176 .   ie '\\*[$REF_STYLE]'NOTE' .ref*field D , "" )
22177 .   el .ref*field D ,
22178 .\}
22179 .if \\n[ref*type]=3 \{\
22180 .   ie !'\\*([C'' \{\
22181 .      ie '\\*[$REF_STYLE]'NOTE' .ref*field D , "" )
22182 .      el .ref*field D ,
22183 .   \}
22184 .   el \{\
22185 .      if '\\*([I'' \{\
22186 .         ds eval*[D \\*([D
22187 .         substring eval*[D 0 -4
22188 .         ie '\\*[eval*[D]'1' .ds kern \*[BU3]
22189 .         el .ds kern \*[BU2]
22190 .         ie \\n[#PRINT_STYLE]=2 \
22191 .           if '\\*[$REF_STYLE]'NOTE' .ref*field D "" (\\*[kern] )
22192 .         el .ref*field D
22193 .      \}
22194 .      rm eval*[D
22195 .      rm kern
22196 .   \}
22197 .\}
22198 .if \\n[ref*type]=4 .ref*field D ,
22199 .if \\n[ref*type]=5 .ref*field D
22200 .ds eval*[D \\*([D
22201 .substring eval*[D -1
22202 .if '\\*[eval*[D]'.' .nr ref*suppress-period 1
22203 ..
22204 \# %P Page number(s)
22205 .de ref*add-P
22206 .if \\n[ref*type]=5 .nr ref*type 1
22207 .ie '\\*[$REF_STYLE]'NOTE' \{\
22208 .   ie \\n[ref*type]=1 .ref*field P : "" .
22209 .   el .ref*field P "" "\|"
22210 .   if \\n[ref*type]=1 .nr ref*suppress-period 1
22211 .\}
22212 .el \{\
22213 .   ie \\n[ref*type]=1 .ref*field P \|:
22214 .   el \{\
22215 .      ie d [n .ref*field P . \| .
22216 .      el .ref*field P . " "
22217 .   \}
22218 .\}
22219 ..
22220 \# %G Gov't. ordering number
22221 .de ref*add-G
22222 .ie '\\*[$REF_STYLE]'NOTE' ref*field G ,
22223 .el .ref*field G . " "
22224 ..
22225 \# %O Other (info that goes after %T [or %B] but is hard to categorize; e.g., a dissertation)
22226 .de ref*add-O
22227 .ds eval*[O \\*([O
22228 .substring eval*[O -1
22229 .if '\\*[eval*[O]'.' .nr [O 1
22230 .ds initial*cap \\*([O
22231 .substring initial*cap 0 0
22232 .ds [O*string \\*([O
22233 .substring [O*string 1
22234 .if '\\*[$REF_STYLE]'BIBLIO' \
22235 .   ds [O \E*[UC]\\*[initial*cap]\E*[LC]\\*[[O*string]
22236 .ie '\\*[$REF_STYLE]'NOTE' .ref*field O ,
22237 .el \{\
22238 .   if \\n([O=1 .chop [O
22239 .   ie r [e .ref*field O "" " "
22240 .   el \{\
22241 .      ie !d [A .ref*field O
22242 .      el .ref*field O . " "
22243 .   \}
22244 .\}
22245 .rr [O
22246 .rr [e
22247 ..
22248 \# %n Annotations (after ref)
22249 .de ref*add-n
22250 .ds eval*[n \\*([n
22251 .substring eval*[n -1
22252 .if '\\*[eval*[n]'.' .chop [n
22253 .if '\\*[eval*[n]'?' .nr [n 1
22254 .if '\\*[eval*[n]'!' .nr [n 1
22255 .ie '\\*[$REF_STYLE]'NOTE' .ref*field n ,
22256 .el \{\
22257 .   ie !'\\*([P'' .ref*field n "" " "
22258 .   el .ref*field n . " "
22259 .\}
22260 .if r [n .nr ref*suppress-period 1
22261 .rr [n
22262 ..
22263 \#
22264 .de ref*add-dflt
22265 .ref*field \\$1 ,
22266 ..
22267 \#
22268 \# Book reprints
22269 \# -------------
22270 \# %d date of publication (the original date of publication)
22271 .de ref*add-d
22272 .ie '\\*[$REF_STYLE]'NOTE' \{\
22273 .   ref*field d "" ( ;
22274 .   nr [d 1
22275 .\}
22276 .el \{\
22277 .   ie \\n([T .ref*field d "" " "
22278 .   el .ref*field d . " "
22279 .\}
22280 .rr [T
22281 ..
22282 \# %b main author when citing from a preface, introduction, foreword
22283 \# or afterword
22284 .de ref*add-b
22285 .ie '\\*[$REF_STYLE]'NOTE' \{\
22286 .   ie \\n([T .ref*field b "" "by"
22287 .   el .ref*field b , "by "
22288 .\}
22289 .el \{\
22290 .   ie \\n([T .ref*field b "" " By "
22291 .   el .ref*field b . " By "
22292 .\}
22293 .rr [T
22294 ..
22295 \# %t title, if different from original title (the T field, which s/b
22296 \# the original title)
22297 .de ref*add-t
22298 .ie '\\*[$REF_STYLE]'NOTE' .ref*field t , "rpt. of \E*[IT] " \E*[ref*restore-ss]
22299 .el \{\
22300 .   ie \\n([T .ref*field t "" " Rpt. of \E*[IT] " \E*[ref*restore-ss]
22301 .   el .ref*field t . " Rpt. of \E*[IT] " \E*[ref*restore-ss]
22302 .\}
22303 .rr [T
22304 ..
22305 \#
22306 \# Translated works
22307 \# ----------------
22308 \# %l Trans(l)ator
22309 .de ref*add-l
22310 .ie '\\*[$REF_STYLE]'NOTE' \{\
22311 .   ie \\n([T .ref*field l "" "trans. "
22312 .   el .ref*field l , "trans. "
22313 .\}
22314 .el \{\
22315 .   ie \\n([T .ref*field l "" " Trans. "
22316 .   el .ref*field l . " Trans. "
22317 .\}
22318 .rr [T
22319 ..
22320 \# %r Translato(r) and edito(r)
22321 .de ref*add-r
22322 .ie '\\*[$REF_STYLE]'NOTE' .ref*field r , "trans. and ed. "
22323 .el \{\
22324 .   ie \\n([T .ref*field r "" " Trans. and ed. "
22325 .   el .ref*field r . " Trans. and ed. "
22326 .\}
22327 .rr [T
22328 ..
22329 \#
22330 \# Internet
22331 \# --------
22332 \# %s Site name
22333 .de ref*add-s
22334 .ie '\\*[$REF_STYLE]'NOTE' .ref*field s , \E*[IT] \E*[ref*restore-ss]
22335 .el \{\
22336 .ie \\n([s .ref*field s "" ".\E*[IT]" \E*[ref*restore-ss]
22337 .el .ref*field s . " \E*[IT]" \E*[ref*restore-ss]
22338 .\}
22339 .\" refer doesn't set reg [T to 1 for these titles, so we do it here
22340 .if !'\\*[$REF_STYLE]'NOTE' \{\
22341 .   ds eval*[s \\*([s
22342 .   substring eval*[s -1
22343 .   rr [T
22344 .   if '\\*[eval*[s]'.' .nr [T 1
22345 .   if '\\*[eval*[s]'!' .nr [T 1
22346 .   if '\\*[eval*[s]'?' .nr [T 1
22347 .   rm eval*[s
22348 .\}
22349 ..
22350 \# %c content of site (ie. Web, Online posting, etc)
22351 .de ref*add-c
22352 .ie '\\*[$REF_STYLE]'NOTE' .ref*field c ,
22353 .el \{\
22354 .   ie \\n([T .ref*field c "" " "
22355 .   el .ref*field c . " "
22356 .\}
22357 .rr [T
22358 ..
22359 \# %o organization, group or sponsor of site
22360 .de ref*add-o
22361 .ie '\\*[$REF_STYLE]'NOTE' .ref*field o ,
22362 .el \{\
22363 .   ie \\n([T .ref*field o "" " "
22364 .   el .ref*field o . " "
22365 .\}
22366 .rr [T
22367 ..
22368 \# %a access date, i.e. the date you read it
22369 .de ref*add-a
22370 .ie '\\*[$REF_STYLE]'NOTE' .ref*field a ,
22371 .el \{\
22372 .   ie \\n([T .ref*field a "" " "
22373 .   el .ref*field a . " "
22374 .\}
22375 .rr [T
22376 ..
22377 \# %u URL
22378 .de ref*add-u
22379 .ref*field u "" < >
22380 .rr [T
22381 ..
22382 .de ref*add-z
22383 .ref*field z
22384 ..
22385 \#
22386 \# Build up reference string from ref*add-<x> macros.
22387 \#
22388 \# First, a string to ensure next field's font is reset to roman
22389 \# (TYPESET) or non-underlined (TYPEWRITE)
22390 \#
22391 .ie !n .ds ref*roman \f[R]\X'ps: exec decornone'\?\R'#UNDERLINE_ON 0'\?
22392 .el .ds ref*roman \f[R]\?\R'#UNDERLINE_ON 0'\?
22393 \#
22394 .de ref*field
22395 .if d ref*string \{\
22396 .   ie d ref*post-punct \{\
22397 .      as ref*string "\\$2\\*[ref*post-punct] \"
22398 .      rm ref*post-punct
22399 .   \}
22400 .   el .as ref*string "\\$2 \"
22401 .\}
22402 .as ref*string "\\$3\\*([\\$1\\$4\E*[ref*roman]
22403 .if \\n[.$]>4 .ds ref*post-punct "\\$5\E*[ref*roman]
22404 .nr ref*suppress-period 0
22405 ..
22406 \#
22407 \# MARGIN NOTES
22408 \# ------------
22409 \#
22410 \# Wrapper for MNinit.
22411 \#
22412 .MAC MN_INIT END
22413 .    if \B'\\$2' \{\
22414 .       tm1 "[mom]: 1.x-style \\$0 detected, but you are using v2.x.
22415 .       tm1 "       v2.x requires flags before arguments to \\$0.
22416 .       tm1 "       Please read docelement.html#mn-init and update your file.
22417 .       ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
22418 .    \}
22419 .    nr #ARGS  0 1
22420 .    nr #COUNT 9
22421 .    while \\n+[#ARGS]<=\\n[#COUNT] \
22422 .      ds $MN-arg\\n[#ARGS] @
22423 .    nr #FLAG 0 1
22424 .    nr #COUNT \\n[#NUM_ARGS]
22425 .    while \\n+[#FLAG]<=\\n[#COUNT] \{\
22426 .       if '\\$1'RAGGED' \{\
22427 .          ds $MN-arg1 \\$1
22428 .       shift
22429 .       \}
22430 .       if '\\$1'SYMMETRIC' \{\
22431 .          ds $MN-arg1 \\$1
22432 .          shift
22433 .       \}
22434 .       if '\\$1'L_WIDTH' \{\
22435 .          shift
22436 .          ds $MN-arg2 \\$1
22437 .          shift
22438 .       \}
22439 .       if '\\$1'R_WIDTH' \{\
22440 .          shift
22441 .          ds $MN-arg3 \\$1
22442 .          shift
22443 .       \}
22444 .       if '\\$1'GUTTER' \{\
22445 .          shift
22446 .          ds $MN-arg4 \\$1
22447 .          shift
22448 .       \}
22449 .       if '\\$1'FONTSTYLE' \{\
22450 .          shift
22451 .          ds $MN-arg5 \\$1
22452 .          shift
22453 .       \}
22454 .       if '\\$1'SIZE' \{\
22455 .          shift
22456 .          ds $MN-arg6 \\$1
22457 .          shift
22458 .       \}
22459 .       if '\\$1'LEAD' \{\
22460 .          shift
22461 .          ds $MN-arg7 \\$1
22462 .          shift
22463 .       \}
22464 .       if '\\$1'COLOR' \{\
22465 .          shift
22466 .          ds $MN-arg8 \\$1
22467 .          shift
22468 .       \}
22469 .       if '\\$1'HY' \{\
22470 .          shift
22471 .          ds $MN-arg9 \\$1
22472 .          shift
22473 .       \}
22474 .    \}
22475 .    if '\\*[$MN-arg5]'@' .ds $MN-arg5 \E*[$DOC_FAM]R
22476 .    MNinit \
22477 \\*[$MN-arg1] \\*[$MN-arg2] \
22478 \\*[$MN-arg3] \\*[$MN-arg4] \
22479 \\*[$MN-arg5] \\*[$MN-arg6] \
22480 \\*[$MN-arg7] \\*[$MN-arg8] \
22481 \\*[$MN-arg9]
22482 .END
22483 \#
22484 .MAC MN_OVERFLOW_TRAP END
22485 .    if \\n[#OVERFLOW_LEFT]=1 \{\
22486 .       nr #no-repeat-MN-left 1
22487 .       di MN_OVERFLOW_LEFT
22488 .    \}
22489 .    if \\n[#OVERFLOW_RIGHT]=1 \{\
22490 .       nr #no-repeat-MN-right 1
22491 .       di MN_OVERFLOW_RIGHT
22492 .    \}
22493 .    rr #OVERFLOW_LEFT
22494 .    rr #OVERFLOW_RIGHT
22495 .END
22496 \#
22497 \# The remainder of the margin notes macros and routines are adapted
22498 \# from Werner Lemberg's MN.tmac.
22499 \#
22500 \# MNinit
22501 \# ------
22502 \# Usage:
22503 \# MNinit [ragged|symmetric] \
22504 \#        left-width right-width separation \
22505 \#        font fontsize vertical-spacing \
22506 \#        color hyphenation-flags
22507 \#
22508 \# Initialize margin notes.  Empty arguments (denoted with "") set
22509 \# default values.  If the first argument is the string 'ragged',
22510 \# left and right margin notes are printed ragged-right.  If it is
22511 \# 'symmetric', left margin notes are printed ragged-left and right
22512 \# margin notes ragged-right.  If omitted, margin notes are left
22513 \# and right adjusted.
22514 \#
22515 .de MNinit
22516 .  nr #MNinit 1
22517 .  ds MN-left-ad b\"
22518 .  ds MN-right-ad b\"
22519 .  if '\\$1'@' .shift
22520 .  if '\\$1'RAGGED' \{\
22521 .    ds MN-left-ad l\"
22522 .    ds MN-right-ad l\"
22523 .    shift
22524 .  \}
22525 .  if '\\$1'SYMMETRIC' \{\
22526 .    ds MN-left-ad r\"
22527 .    ds MN-right-ad l\"
22528 .    shift
22529 .  \}
22530 .  ie \B'\\$3' .nr MN-sep (n;\\$3)
22531 .  el .nr MN-sep 1m
22532 .  if ((\\n[.o] - \\n[MN-sep]) < 1n) \
22533 .    ab MN: Left margin too small (<1n) for requested margin notes separation.
22534 .  ie \B'\\$1' \{\
22535 .    nr MN-left-width (n;\\$1)
22536 .    nr MN-left-start (\\n[.o] - \\n[MN-sep] - \\n[MN-left-width])
22537 .  \}
22538 .  el \{\
22539 .    nr MN-left-width (\\n[.o] - \\n[MN-sep])
22540 .    nr MN-left-start 0
22541 .  \}
22542 .  if (\\n[MN-left-start] < 0) \
22543 .    ab MN: Left margin too small for requested margin notes settings.
22544 .  if (\\n[MN-left-width] < 1n) \
22545 .    ab MN: Left margin notes width too small (<1n).
22546 .  ie \B'\\$2' \{\
22547 .    nr MN-right-width (n;\\$2)
22548 .    nr MN-right-start (\\n[.o] + \\n[.l] + \\n[MN-sep])
22549 .    if \\n[#COLUMNS]=1 \{\
22550 .      if !\\n[#NUM_COLS]=1 \
22551 .        nr MN-right-start (\\n[#COL_2_L_MARGIN] + \\n[#COL_L_LENGTH] + \\n[MN-sep])
22552 .    \}
22553 .  \}
22554 .  el \{\
22555 .    nr MN-right-width \\n[MN-left-width]
22556 .    nr MN-right-start (\\n[.o] + \\n[.l] + \\n[MN-sep])
22557 .    if \\n[#COLUMNS]=1 \{\
22558 .      if !\\n[#NUM_COLS]=1 \
22559 .        nr MN-right-start (\\n[#COL_2_L_MARGIN] + \\n[#COL_L_LENGTH] + \\n[MN-sep])
22560 .    \}
22561 .  \}
22562 .  ie \A'\\$4' \{\
22563 .    ds MN-font \\$4\"
22564 .    if \\n[#PRINT_STYLE]=1 .ds MN-font CR
22565 .  \}
22566 .  el \{\
22567 .    ds MN-font \\*[$PP_FT]
22568 .    if \\n[#PRINT_STYLE]=1 .ds MN-font CR
22569 .  \}
22570 .  ie \B'\\$5' \{\
22571 .    ps \\$5
22572 .    nr MN-size \\n[.ps]
22573 .    ps
22574 .    if \\n[#PRINT_STYLE]=1 \{\
22575 .       ps \\*[$TYPEWRITER_PS]
22576 .       nr MN-size \\n[.ps]
22577 .       ps
22578 .    \}
22579 .  \}
22580 .  el \
22581 .    nr MN-size \\n[#DOC_PT_SIZE]
22582 .  ie \B'\\$6' \{\
22583 '    vs \\$6
22584 .    nr MN-spacing \\n[.v]
22585 '    vs
22586 .    if \\n[#PRINT_STYLE]=1 \
22587 .       nr MN-spacing \\n[#DOC_LEAD]
22588 .  \}
22589 .  el .nr MN-spacing \\n[#DOC_LEAD]
22590 .  ie \A'\\$7' \
22591 .    if !\\n[#PRINT_STYLE]=1 .ds MN-color \\$7\"
22592 .  el \
22593 .    if !\\n[#PRINT_STYLE]=1 .ds MN-color
22594 .  ie \B'\\$8' .nr MN-hy \\$8
22595 .  el .nr MN-hy \\n[.hy]
22596 .  ev MNbottom-left-env
22597 .  if \A'\\*[MN-font]' .ft \\*[MN-font]
22598 .  if \\n[MN-size] .ps \\n[MN-size]u
22599 .  if \\n[MN-spacing] .vs \\n[MN-spacing]u
22600 .  ll \\n[MN-left-width]u
22601 .  ad \\*[MN-left-ad]
22602 .  hy \\n[MN-hy]
22603 '  in 0
22604 .  nop \m[\\*[MN-color]]\c
22605 .  ev
22606 .  ev MNbottom-right-env
22607 .  if \A'\\*[MN-font]' .ft \\*[MN-font]
22608 .  if \\n[MN-size] .ps \\n[MN-size]u
22609 .  if \\n[MN-spacing] .vs \\n[MN-spacing]u
22610 .  ll \\n[MN-right-width]u
22611 .  ad \\*[MN-right-ad]
22612 .  hy \\n[MN-hy]
22613 '  in 0
22614 .  nop \m[\\*[MN-color]]\c
22615 .  ev
22616 .  nr MN-active 0
22617 ..
22618 \# MN
22619 \# --
22620 \# Usage:
22621 \#
22622 \#   MN LEFT|RIGHT
22623 \#   margin note text
22624 \#   MN
22625 \#
22626 \# With a parameter, start a margin note, otherwise end a margin note.
22627 \# If the parameter is the string 'left', define a left margin note,
22628 \# otherwise define a right margin note.
22629 \#
22630 .de MN
22631 . ds MN-dir \\$1
22632 . if !'\\$1'LEFT' \{\
22633 .   if !'\\$1'RIGHT' \{\
22634 .     MN_QUIT
22635 .     return
22636 .   \}
22637 . \}
22638 . if \\n[#COLUMNS]=1 \{\
22639 .  if \\n[#NUM_COLS]>2 \{\
22640 .    tm [mom]: Macro MN: More than two columns.  Ignoring margin notes.
22641 .    return
22642 .  \}
22643 .  if !\\n[#NUM_COLS]=1 \{\
22644 .    ie \\n[#COL_NUM]=1 .ds MN-dir LEFT
22645 .    el .ds MN-dir RIGHT
22646 .  \}
22647 . \}
22648 .  if !\\n[#MNinit]=1 \{\
22649 .    tm1 "[mom]: Macro MN: You must set parameters with MN_INIT before using MN.
22650 .    ab   [mom]: Aborting '\\n[.F]' at MN, line \\n[.c].
22651 .  \}
22652 .  ie !'\\$1'' \{\
22653 .    if \\n[MN-active] \{\
22654 .      tm [mom]: Macro MN: Can't handle nested margin notes, line \\n[.c].
22655 .      return
22656 .    \}
22657 .    nr MN-active 1
22658 .    ev MN-env
22659 .    ie '\\*[MN-dir]'LEFT' \{\
22660 .      nr MN-left +1
22661 .      ds MN-curr l-\\n[MN-left]\"
22662 .      evc MNbottom-left-env
22663 .    \}
22664 .    el \{\
22665 .      nr MN-right +1
22666 .      ds MN-curr r-\\n[MN-right]\"
22667 .      evc MNbottom-right-env
22668 .    \}
22669 .    mk MN-mk-\\*[MN-curr]
22670 .    di MN-div-\\*[MN-curr]
22671 .  \}
22672 .  el .MN_QUIT
22673 ..
22674 \#
22675 \# MN_QUIT
22676 \# -------
22677 \# Utility macro to handle .MN OFF | QUIT | X etc
22678 \#
22679 .de MN_QUIT
22680 .   if \\n[MN-active] \{\
22681 .      br
22682 .      di
22683 .      nr MN-div-\\*[MN-curr]-depth \\n[dn]
22684 .      ev
22685 .   \}
22686 .   nr MN-active 0
22687 ..
22688 \#
22689 \# MNtop
22690 \# -----
22691 \# Resets these registers (called in HEADER)
22692 .de MNtop
22693 .  nr MN-left 0
22694 .  nr MN-right 0
22695 .  nr MN-active 0
22696 .  rr MN-shifted
22697 .  ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
22698 ..
22699 \#
22700 \# MNbottom
22701 \# --------
22702 \# Executed in FOOTER.
22703 \#
22704 .de MNbottom
22705 .   if '\\$0'MNbottom-left' \{\
22706 .      ds MN-pos left
22707 .      ds l-r l
22708 .      ds Left-Right Left
22709 .   \}
22710 .   if '\\$0'MNbottom-right' \{\
22711 .      ds MN-pos right
22712 .      ds l-r r
22713 .      ds Left-Right Right
22714 .   \}
22715 .   nr MN-curr 0
22716 .   nr MN-last-pos 0
22717 .   nr MN-lead-adj \\n[#DOC_LEAD]-\\n[MN-spacing]
22718 .   vpt 0
22719 .   if \\n[MN-active] \{\
22720 .     di
22721 .     tm [mom]: Macro MN: Margin note finished by new page.  Ignored.
22722 .   \}
22723 .   if \\n[#RECTO_VERSO] \{\
22724 .      if e \{\
22725 .         if '\\*[MN-pos]'right' \
22726 .            nr MN-\\*[MN-pos]-start (\\n[.o]+\\n[.l]+\\n[MN-sep])
22727 .         if '\\*[MN-pos]'left' \
22728 .            nr MN-\\*[MN-pos]-start (\\n[.o]-\\n[MN-sep]-\\n[MN-left-width])
22729 .      \}
22730 .   \}
22731 .   po \\n[MN-\\*[MN-pos]-start]u
22732 .   ev MNbottom-\\*[MN-pos]-env
22733 .   nr #P \\n%+\\n[#PAGE_NUM_ADJ]
22734 .   while (\\n[MN-curr] < \\n[MN-\\*[MN-pos]]) \{\
22735 .      nr MN-curr +1
22736 .      ie (\\n[MN-last-pos] < \\n[MN-mk-\\*[l-r]-\\n[MN-curr]]) \
22737 .         sp |\\n[MN-mk-\\*[l-r]-\\n[MN-curr]]u+\\n[MN-lead-adj]u
22738 .      el \{\
22739 .         nr MN-shifted 1
22740 .         sp 1v
22741 .         SHIM
22742 .         if \\n[#SHIM]>\\n[MN-spacing] .sp -(1v+\\n[MN-lead-adj]u)
22743 .         tm [mom]: Macro MN: Warning: \\*[Left-Right] margin note #\\n[MN-curr] on page \\n[#P] shifted down.
22744 .      \}
22745 .\" If last margin note doesn't fit
22746 .      if ( (\\n[nl]+\\n[MN-div-\\*[l-r]-\\n[MN-curr]-depth]) > (\\n[.p]+\\n[#VARIABLE_FOOTER_POS]-1) ) \{\
22747 .         if \\n[MN-shifted]=1 \{\
22748 .            sp -(1v+\\n[#SHIM]u)
22749 .            rm MN-div-\\*[l-r]-\\n[MN-curr]
22750 .            tm1 "[mom]: \
22751 No room to start \\*[MN-pos] margin note #\\n[MN-curr] on page \\n[#P].
22752 .            tm1 "      Ignoring margin note.
22753 .            rr MN-shifted
22754 .         \}
22755 .         nr #no-repeat-MN-\\*[MN-pos] 1
22756 .         if '\\*[MN-pos]'left'  .nr #OVERFLOW_LEFT 1
22757 .         if '\\*[MN-pos]'right' .nr #OVERFLOW_RIGHT 1
22758 .         ie \\n[#FN_COUNT]=0 \{\
22759 .            ch FOOTER \\n[.p]u
22760 .            wh \\n[#VARIABLE_FOOTER_POS]u+\\n[MN-lead-adj]u+1u MN_OVERFLOW_TRAP
22761 .         \}
22762 .         el \
22763 .            wh \\n[.p]u+\\n[#VARIABLE_FOOTER_POS]u-1u MN_OVERFLOW_TRAP
22764 .         vpt
22765 .      \}
22766 .      nf
22767 .      MN-div-\\*[l-r]-\\n[MN-curr]
22768 .      fi
22769 .      br
22770 .      nr MN-last-pos \\n[nl]
22771 .   \}
22772 .   ev
22773 .   po
22774 .   if !\\n[#no-repeat-MN-\\*[MN-pos]]=1 .vpt
22775 ..
22776 .
22777 .ALIAS MNbottom-right MNbottom
22778 .ALIAS MNbottom-left  MNbottom
22779 \#
22780 \# PDF SUPPORT
22781 \# ===========
22782 \#
22783 \# Initial setup
22784 \#
22785 .nr CURRENT_LEVEL 0
22786 .nr VIRTUAL_LEVEL 0
22787 .nr #PDF_BOOKMARKS 1
22788 .nr #PDF_BOOKMARKS_OPEN 1
22789 .pdfview /PageMode /UseOutlines
22790 \#
22791 \# TOC_BEFORE_HERE
22792 \# ---------------
22793 \#
22794 \# Call this and the TOC will be placed preceding this page
22795 \#
22796 .MAC TOC_BEFORE_HERE END
22797 .    nr TOC_BH 1
22798 .    pdfpagename MOM:TOC
22799 .END
22800 \#
22801 \# TOC_AFTER_HERE
22802 \# ---------------
22803 \#
22804 \# Call this and the TOC will be placed after this page
22805 \#
22806 .MAC TOC_AFTER_HERE END
22807 .    nr TOC_BH 2
22808 .    pdfpagename MOM:TOC
22809 .END
22810 \#
22811 \# PDF_LINK_COLOR
22812 \# -----------------
22813 \#
22814 \# Arguments:-
22815 \#   <name defined by previous call to XCOLOR or NEWCOLOR> or
22816 \#   <red> <green> <blue> all 0.0 -> 1.0
22817 \# Notes
22818 \#   Should be called before START but can also be called at any time to change colour
22819 \#   The colour assigned at the end of the document is used for all links in the TOC
22820 \#
22821 .MAC PDF_LINK_COLOR END
22822 .    ie \\n[.$]==3 \{\
22823 .       ds PDFHREF.COLOUR \\$*
22824 .       if !(\B'\\$1' & \B'\\$2' & \B'\\$3') \{\
22825 .          tm1 "[mom]: All three arguments to \\$0 at line \\n[.c] must be decimal.
22826 .          tm1 "       Continuing to process using default link color.
22827 .          ds PDFHREF.COLOUR 0.0 0.3 0.9
22828 .       \}
22829 .       defcolor pdf:href.colour rgb \\*[PDFHREF.COLOUR]
22830 .       ds PDFHREF.TEXT.COLOUR pdf:href.colour
22831 .    \}
22832 .    el \{\
22833 .       ie \\n[.$]==0 \{\
22834 .          if dPDFHREF.TEXTCOL.DEFAULT \
22835 .             PDF_LINK_COLOR \\*[PDFHREF.TEXTCOL.DEFAULT]
22836 .       \}
22837 .       el \{\
22838 .          ds ARG_1 \\$1
22839 .          substring ARG_1 0 0
22840 .          ie '\\*[ARG_1]'#' \{\
22841 .             defcolor pdf:href.colour rgb \\$1
22842 .             ds PDFHREF.TEXT.COLOUR pdf:href.colour
22843 .          \}
22844 .          el \{\
22845 .             ie dCOLAL_\\$1 .ds PDFHREF.TEXT.COLOUR \\*[COLAL_\\$1]
22846 .             el .ds PDFHREF.TEXT.COLOUR \\$1
22847 .          \}
22848 .       \}
22849 .    \}
22850 .    if !\\n[PDFHREF_COLOR_SET]=1 \
22851 .       nr PDFHREF_COLOR_SET 1
22852 .END
22853 \#
22854 .ALIAS PDF_LINK_COLOUR PDF_LINK_COLOR
22855 \#
22856 \# AUTO_RELOCATE_TOC
22857 \# -----------------
22858 \#
22859 \# Call before START to have TOC automatically relocated to after the
22860 \# DOC COVER (if there is one) or the COVER if there isn't
22861 \#
22862 .MAC AUTO_RELOCATE_TOC END
22863 .    if '\\$1''                .nr TOC.RELOCATE 1
22864 .    if '\\$1'TOP'             .nr TOC.RELOCATE 2
22865 .    if '\\$1'BEFORE_DOCCOVER' .nr TOC.RELOCATE 3 \" Same as TOP unless no DOCCOVER
22866 .    if '\\$1'AFTER_DOCCOVER'  .nr TOC.RELOCATE 4
22867 .    if '\\$1'BEFORE_COVER'    .nr TOC.RELOCATE 5
22868 .    if '\\$1'AFTER_COVER'     .nr TOC.RELOCATE 6
22869 .END
22870 \#
22871 .ALIAS AUTO_TOC_RELOCATE AUTO_RELOCATE_TOC
22872 \#
22873 \# PDF_BOOKMARK
22874 \# ------------
22875 \# *Argument:
22876 \#   Hierarchy Level
22877 \#   Bookmark Text
22878 \# *Function:
22879 \#   Creates a bookmark using the given text
22880 \#   The level controls the hierarchy of the bookmarks
22881 \# *Notes
22882 \#   Bookmarks can be turned off (will not be added to document outline) by calling
22883 \#   "PDF_BOOKMARKS NO" and turned on with "PDF_BOOKMARKS".
22884 \#
22885 \#   Bookmarks can be open or closed by calling PDF_BOOKMARKS_OPEN
22886 \#
22887 .MAC PDF_BOOKMARK END
22888 .    if \\n[#PDF_BOOKMARKS] \{\
22889 .       ie '\\$1'NAMED' \{\
22890 .          ds PDF_NM -T \\$2
22891 .          ds PDF_NM2 \\$2
22892 .          shift 2
22893 .       \}
22894 .       el .ds PDF_NM
22895 .       nr LEVEL_REQ \\$1
22896 .       shift
22897 .       ie \\n[LEVEL_REQ]>\\n[VIRTUAL_LEVEL] \{\
22898 .          nr VIRTUAL_LEVEL \\n[LEVEL_REQ]
22899 .          nr LEVEL_REQ \\n[CURRENT_LEVEL]+1
22900 .       \}
22901 .       el \{\
22902 .          ie \\n[LEVEL_REQ]<\\n[VIRTUAL_LEVEL] \{\
22903 .             nr VIRTUAL_DIFF \\n[VIRTUAL_LEVEL]-\\n[LEVEL_REQ]
22904 .             nr VIRTUAL_LEVEL \\n[LEVEL_REQ]
22905 .             nr LEVEL_REQ (\\n[CURRENT_LEVEL]-\\n[VIRTUAL_DIFF])>?1
22906 .          \}
22907 .          el .nr LEVEL_REQ \\n[CURRENT_LEVEL]
22908 .       \}
22909 .       ds PDF_TX \\$*
22910 .       pdfmomclean PDF_TX
22911 .       nr PDF_LEV (\\n[LEVEL_REQ]*\\n[#PDF_BOOKMARKS_OPEN])
22912 .       ie '\\*[.T]'ps' \{\
22913 .           if !'\\*[PDF_NM]'' \{\
22914 .              pdfhref M -N \\*[PDF_NM2] -- \\*[PDF_TX]
22915 .              if !dpdf:href.map .tm gropdf-info:href \\*[PDF_NM2] \\*[PDF_TX]
22916 .           \}
22917 .           pdfbookmark \\n[PDF_LEV] \\*[PDF_TX]
22918 .       \}
22919 .       el .pdfbookmark \\*[PDF_NM] \\n[PDF_LEV] \\$*
22920 .       nr CURRENT_LEVEL \\n[LEVEL_REQ]
22921 .       rr LEVEL_REQ
22922 .       rr PDF_LEV
22923 .       rr VIRTUAL_DIFF
22924 .       rm PDF_NM
22925 .    \}
22926 .END
22927 \#
22928 \# PDF_TITLE
22929 \# ---------
22930 \# *Argument:
22931 \#   Title Text
22932 \# *Function
22933 \#   Set the PDF title (this is often used by PDF readers to title the main window)
22934 \#
22935 .MAC PDF_TITLE END
22936 .    ds pdftitle \\$*
22937 .    pdfmomclean pdftitle
22938 .    nop \!x X ps:exec [/Title (\\*[pdftitle]) /DOCINFO pdfmark
22939 .END
22940 \#
22941 \# PDF_BOOKMARKS
22942 \# -------------
22943 \# *Argument:
22944 \#   <nothing> | <anything>
22945 \# *Function:
22946 \#   With no parameter turns on outline bookmarks
22947 \#   With any parameter turns off outline bookmarks
22948 \#
22949 .MAC PDF_BOOKMARKS END
22950 .    ie '\\$1'' .nr #PDF_BOOKMARKS 1
22951 .    el .nr #PDF_BOOKMARKS 0
22952 .END
22953 \#
22954 \# PDF_BOOKMARKS_OPEN
22955 \# ------------------
22956 \# *Argument:
22957 \#   <number> | <nothing> | <text>
22958 \# *Function:
22959 \#   If arg is numeric all Bookmark levels > arg are closed
22960 \#   If arg is empty all bookmarks are open
22961 \#   If arg is any text then any following bookmarks are closed
22962 \#
22963 .MAC PDF_BOOKMARKS_OPEN END
22964 .    ie \B'\\$1' \{\
22965 .       nr PDFOUTLINE.FOLDLEVEL \\$1
22966 .       nr #PDF_BOOKMARKS_OPEN 1
22967 .    \}
22968 .    el .if '\\*[.T]'pdf' \{\
22969 .       nr PDFOUTLINE.FOLDLEVEL 10000
22970 .       ie '\\$1'' .nr #PDF_BOOKMARKS_OPEN 1
22971 .       el .nr #PDF_BOOKMARKS_OPEN 0-1
22972 .    \}
22973 .END
22974 \#
22975 \# PDF_LINK
22976 \# --------
22977 \# *Arguments:
22978 \#    $1 = named link
22979 \#    [PREFIX text] : text to prefix link
22980 \#    [SUFFIX text] : text after link
22981 \#    text
22982 \#
22983 \# *Notes
22984 \#    Text is output as a hotspot link to named destination.
22985 \#    If text has final '*' it is replaced with the text associated with the link
22986 \#
22987 .MAC PDF_LINK END
22988 .    ds PDF_NM \\$1
22989 .    shift
22990 .    ie '\\$1'PREFIX' \{\
22991 .       ds PDF_PRE -P "\&\\$2"
22992 .       shift 2
22993 .    \}
22994 .    el .ds PDF_PRE
22995 .    ie '\\$1'SUFFIX' \{\
22996 .       ds PDF_POST -A "\\$2"
22997 .       shift 2
22998 .    \}
22999 .    el .ds PDF_POST
23000 .    ds PDF_AST_Q
23001 .    ds PDF_TXT \&\\$1
23002 .    ds PDF_AST \\*[PDF_TXT]
23003 .    substring PDF_AST -1 -1
23004 .    if '\\*[PDF_AST]'+' \{\
23005 .       ds PDF_AST *
23006 .       ds PDF_AST_Q ""
23007 .    \}
23008 .    if '\\*[PDF_AST]'*' \{\
23009 .        chop PDF_TXT
23010 .        ie '\\*[.T]'pdf' \{\
23011 .           ie d pdf:look(\\*[PDF_NM]) \
23012 .               as PDF_TXT \&\\*[PDF_AST_Q]\\*[pdf:look(\\*[PDF_NM])]\\*[PDF_AST_Q]
23013 .           el \{\
23014 .               as PDF_TXT Unknown
23015 .               if !rPDF_UNKNOWN .tm \
23016 \\n[.F]:\\n[.c]: forward reference detected (please run using 'pdfmom')
23017 .               nr PDF_UNKNOWN 1
23018 .           \}
23019 .        \}
23020 .        el \{\
23021 .            ie d pdf:href(\\*[PDF_NM]).info \
23022 .               as PDF_TXT \&\\*[PDF_AST_Q]\\*[pdf:href(\\*[PDF_NM]).info]\\*[PDF_AST_Q]
23023 .            el .as PDF_TXT Unknown
23024 .       \}
23025 .    \}
23026 .    pdfhref L \\*[PDF_PRE] \\*[PDF_POST] -D \\*[PDF_NM] -- \\*[PDF_TXT]
23027 .    rm PDF_NM
23028 .    rm PDF_PRE
23029 .    rm PDF_POST
23030 .    rm PDF_TXT
23031 .    rm PDF_AST
23032 .    rm PDF_AST_Q
23033 .END
23034 \#
23035 .MAC PDF_WWW_LINK END
23036 .    ds PDF_NM \\$1
23037 .    shift
23038 .    ie '\\$1'PREFIX' \{\
23039 .       ds PDF_PRE -P "\\$2"
23040 .       shift 2
23041 .    \}
23042 .    el .ds PDF_PRE
23043 .    ie '\\$1'SUFFIX' \{\
23044 .       ds PDF_POST -A "\\$2"
23045 .       shift 2
23046 .    \}
23047 .    el .ds PDF_POST
23048 .    ds PDF_AST_Q
23049 .    ds PDF_TXT \\$1
23050 .    ie !'\\*[PDF_TXT]'' \{\
23051 .       ds PDF_AST \\*[PDF_TXT]
23052 .       substring PDF_AST -1 -1
23053 .       if '\\*[PDF_AST]'+' \{\
23054 .          ds PDF_AST *
23055 .          ds PDF_AST_Q ""
23056 .       \}
23057 .       if '\\*[PDF_AST]'*' \{\
23058 .          chop PDF_TXT
23059 .          as PDF_TXT \&\\*[PDF_AST_Q]\\*[PDF_NM]\\*[PDF_AST_Q]
23060 .       \}
23061 .    \}
23062 .    el .ds PDF_TXT \\*[PDF_NM]
23063 .    pdfhref W -D "\\*[PDF_NM]" \\*[PDF_PRE] \\*[PDF_POST] -- \\*[PDF_TXT]
23064 .    rm PDF_NM
23065 .    rm PDF_PRE
23066 .    rm PDF_POST
23067 .    rm PDF_TXT
23068 .    rm PDF_AST PDF_AST_Q
23069 .END
23070 \#
23071 .MAC PDF_TARGET END
23072 .    ds ARG_1 \\$1
23073 .    shift
23074 .    ie '\\$*'' .pdfhref M -N \\*[ARG_1] -- \\$*
23075 .    el .pdfhref M -N \\*[ARG_1] -E -- \\$*
23076 .    if '\\*[.T]'ps' .if !dpdf:href.map .tm gropdf-info:href \\*[ARG_1] \\$*
23077 .END
23078 \#
23079 \# PDF_IMAGE
23080 \# ---------
23081 \# *Arguments:
23082 \#   [ -L -| -R | -C | -I <indent> ] \
23083 \#     <image file> <width> <height> \
23084 \#     [ SCALE <factor> ] [ ADJUST +|-<vertical shift> ] [ TARGET <pdf target> ] \
23085 \#     [ NO_SHIM ] [ NO_FLEX ]
23086 \# *Function:
23087 \#   Allows embedding of PDF images with the same arguments as PSPIC
23088 \#   plus SCALE and ADJUST options.
23089 \# *Notes:
23090 \#   <image file> <width> <height> are required.
23091 \#
23092 .MAC PDF_IMAGE END
23093 .    if !'\\n[.z]'FLOAT*DIV' \{\
23094 .       nr pdf-img:float 1
23095 .       FLOAT
23096 .       PDF_TARGET fig:\\n+[lists*target]
23097 .    \}
23098 .    nr float*img 1
23099 .    ds ev-current \\n[.ev]
23100 .    ev IMG
23101 .    evc \\*[ev-current]
23102 .    if \\n[#HYPHENATE] .nh
23103 .    nr ind-pre-img \\n[.i]
23104 .    nr ll-pre-img  \\n[.l]
23105 .    in 0
23106 .    ds pos:tmp \\$1
23107 .    substring pos:tmp 0 0
23108 .    ie !'\\*[pos:tmp]'-' .ds pdf-img:pos -C
23109 .    el \{\
23110 .       ds pdf-img:pos \\$1
23111 .       shift
23112 .    \}
23113 .    if '\\*[pdf-img:pos]'-I' \{\
23114 .       nr pdf-img:ind \\$1
23115 .       shift
23116 .    \}
23117 .    ds pdf-img:file \\$1
23118 .    ds pdf-img@file \\$1
23119 .    substring pdf-img@file -1 -3
23120 .    if !'\\*[pdf-img@file]'pdf' \{\
23121 .       tm1 "[mom]: Image file '\\*[pdf-img:file]' at line \\n[.c] not found, or not a PDF image.
23122 .       ab   [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
23123 .    \}
23124 .    nr pdf-img:width \\$2
23125 .    nr pdf-img:depth \\$3
23126 .    shift 3
23127 .    nr loop-counter \\n[#NUM_ARGS]
23128 .    nr loop-count 0 1
23129 .    while \\n+[loop-count]<=\\n[loop-counter] \{\
23130 .       if '\\$1'SCALE' \{\
23131 .          shift
23132 .          nr pdf-img:scale \\$1
23133 .          shift
23134 .          nr pdf-img:width \\n[pdf-img:width]*\\n[pdf-img:scale]/100
23135 .          nr pdf-img:depth \\n[pdf-img:depth]*\\n[pdf-img:scale]/100
23136 .       \}
23137 .       if '\\$1'ADJUST' \{\
23138 .         shift
23139 .         ds pdf-img:adj \\$1
23140 .         shift
23141 .       \}
23142 .       if '\\$1'FRAME' \{\
23143 .          nr pdf-img:frame 1
23144 .          if !r pdf-img:frame-inset .nr pdf-img:frame-inset 6p
23145 .          shift
23146 .       \}
23147 .       if '\\$1'CAPTION' \{\
23148 .          nr pdf-img*have-caption 1
23149 .          ds pdf-img*caption \\$2
23150 .          shift 2
23151 .       \}
23152 .       if '\\$1'SHORT_CAPTION' \{\
23153 .          ds pdf-img*caption-short \\$2
23154 .          shift 2
23155 .       \}
23156 .       if '\\$1'LABEL' \{\
23157 .          nr pdf-img*have-label 1
23158 .          ds pdf-img*label \\$2
23159 .          ds label-type pdf-img
23160 .          shift 2
23161 .       \}
23162 .       if '\\$1'TARGET' \{\
23163 .          ds target "\\$2
23164 .          PDF_TARGET "\\*[target]
23165 .          shift 2
23166 .       \}
23167 .       if '\\$1'NO_SHIM' \{\
23168 .          if !'\\n[.z]'FLOAT*DIV' .nr pdf-img*no-shim 1
23169 .          nr @no-shim 1
23170 .          shift 1
23171 .       \}
23172 .       if '\\$1'NO_FLEX' \{\
23173 .          nr pdf-img*no-flex 1
23174 .          nr @no-flex 1
23175 .          shift 1
23176 .       \}
23177 .    \}
23178 .    if (\\n[pdf-img*have-label]=1):(\\n[pdf-img*autolabel]=1) \
23179 .       ds label-type pdf-img
23180 .    if !'\\*[pdf-img*label-sffx]'' \{\
23181 .       ds pdf-img*label-sffx-tmp \\*[pdf-img*label-sffx]
23182 .       substring pdf-img*label-sffx-tmp -1
23183 .       if '\\*[pdf-img*label-sffx-tmp]'.' \
23184 .          if \\n[pdf-img*caption-after-label]=0 .chop pdf-img*label-sffx
23185 .    \}
23186 .    if '\\*[pdf-img:pos]'-C' \
23187 .       nr pdf-img:ind (\\n[.ll]-\\n[ind-pre-img]-\\n[pdf-img:width])/2
23188 .    if '\\*[pdf-img:pos]'-R' \
23189 .       nr pdf-img:ind \\n[.ll]-\\n[pdf-img:width]-\\n[ind-pre-img]
23190 .    if \\n[pdf-img*label-with-chapter] \
23191 .       ds chapno \\n[#CH_NUM].
23192 .    if \\n[pdf-img*autolabel] \{\
23193 .       ds pdf-img*label \\*[pdf-img*label-prfx]\\*[chapno]\\n+[fig*label-num]\\*[pdf-img*label-sffx]
23194 .       nr fig*label-width \w'\\*[pdf-img*label]'
23195 .       nr fig*label-num -1
23196 .    \}
23197 .    if !'\\*[pdf-img*caption-short]'' .ds short -short
23198 .    if \\n[#PDF_BOOKMARKS] \{\
23199 .       ie (\\n[pdf-img*have-label]=1):(\\n[pdf-img*autolabel]=1) \{\
23200 \!.        TO_FIGURES "\\*[pdf-img*label]" "\\*[pdf-img*caption\\*[short]]"
23201 .       \}
23202 .       el \{\
23203 \!.        if !'\\*[pdf-img*caption\\*[short]]'' \
23204 \!.           TO_FIGURES "\\*[pdf-img*caption\\*[short]]"
23205 .       \}
23206 .    \}
23207 .    di PDF*IMAGE
23208 .    if \\n[@TOP] \{\
23209 .       ch RR_@TOP
23210 .       rs
23211 .       nop \&
23212 .       sp -1v
23213 .    \}
23214 .    if \\n[pdf-img*have-caption] \{\
23215 .       if !\\n[pdf-img*autolabel] \{\
23216 .          if !\\n[pdf-img*have-label] \{\
23217 .             if \\n[#MLA] \
23218 .                mla@error caption label \\n[.F] \\$0 \\n[.c]
23219 .          \}
23220 .       \}
23221 .       if !\\n[pdf-img*caption-after-label] \{\
23222 .          if !\\n[@TOP] .sp .5v
23223 .          nr lead-pre-caption \\n[.v]
23224 .          ev caption
23225 .          evc IMG
23226 .          ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
23227 .          el \{\
23228 .             img*caption-style
23229 .             vs \\n[.ps]u+\\n[pdf-img*caption-autolead]u
23230 .          \}
23231 .          PDF_IMG*SET_CAPTION_QUAD \\*[pdf-img*caption-quad]
23232 .          nr pdf-img*caption-top-lead-diff \\n[lead-pre-caption]-\\n[.v]
23233 .          sp \\n[lead-pre-caption]u-\\n[.v]u
23234 .          nop \\*[pdf-img*caption]
23235 .          br
23236 .          if !'\\*[pdf-img*caption-space]'' .sp \\*[pdf-img*caption-space]
23237 .          ev
23238 .          in 0
23239 .          sp -.5v
23240 .       \}
23241 .    \}
23242 .    nf
23243 .    if \\n[pdf-img:frame] \{\
23244 .       nr frame-width \\n[pdf-img:width]+(\\n[pdf-img:frame-inset]*2)
23245 .       nr frame-depth \\n[pdf-img:depth]+(\\n[pdf-img:frame-inset]*2)
23246 .       if '\\*[pdf-img:pos]'-L' \{\
23247 .          nr pdf-img:ind \\n[pdf-img:frame-inset]
23248 .          nr pdf-img:dbx-ind 0
23249 .       \}
23250 .       if '\\*[pdf-img:pos]'-C' \{\
23251 .          nr pdf-img:dbx-ind \
23252 \\n[.ll]-\\n[ind-pre-img]-\\n[pdf-img:width]/2-\\n[pdf-img:frame-inset]
23253 .       \}
23254 .       if '\\*[pdf-img:pos]'-R' \{\
23255 .          nr pdf-img:ind -\\n[pdf-img:frame-inset]
23256 .          nr pdf-img:dbx-ind \
23257 \\n[.l]u-(\\n[pdf-img:width]u+(\\n[pdf-img:frame-inset]u*2u)+\\n[ind-pre-img]u)
23258 .       \}
23259 .       if '\\*[pdf-img:pos]'-I' \{\
23260 .          nr pdf-img:ind +\\n[pdf-img:frame-inset]
23261 .          nr pdf-img:dbx-ind \\n[pdf-img:ind]-\\n[pdf-img:frame-inset]
23262 .       \}
23263 .       DBX \\*[pdf-img:frame-weight] \
23264             \\n[pdf-img:dbx-ind]u \
23265             \\n[frame-width]u \
23266             \\n[frame-depth]u \
23267             \\*[pdf-img:frame-color]
23268 .       sp \\n[pdf-img:frame-inset]u
23269 .       nr pdf-img:ind -\\n[pdf-img:frame-inset]
23270 .    \}
23271 .    ti \\n[pdf-img:ind]u+\\n[pdf-img:frame-inset]u
23272 .    nop \X'pdf: pdfpic \\*[pdf-img:file] -L \\n[pdf-img:width]z \\n[pdf-img:depth]z'
23273 .    if '\\*[pdf-img:pos]'-C' .nr pdf-img:ind +\\n[pdf-img:frame-inset]
23274 .    sp \\n[pdf-img:depth]u
23275 .    if \\n[pdf-img:frame] .sp \\n[pdf-img:frame-inset]u
23276 .    if (\\n[pdf-img*have-label]=1):(\\n[pdf-img*autolabel]=1):(\\n[pdf-img*caption-after-label]=1) \{\
23277 .       if \\n[#MLA] \{\
23278 .          if (\\n[pdf-img*have-label]=1):(\\n[pdf-img*autolabel]=1) \{\
23279 .             if !\\n[pdf-img*have-caption] \
23280 .                mla@error label caption \\n[.F] \\$0 \\n[.c]
23281 .          \}
23282 .       \}
23283 .       nr lead-pre-label \\n[.v]
23284 .       ev label
23285 .       evc IMG
23286 .       ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
23287 .       el \{\
23288 .          img*label-style
23289 .          vs \\n[.ps]u+\\n[pdf-img*label-autolead]u
23290 .       \}
23291 .       if \\n[pdf-img*label-with-chapter] \
23292 .          ds chapno \\n[#CH_NUM].
23293 .       PDF_IMG*SET_LABEL_QUAD \\*[pdf-img*label-quad]
23294 .       sp \\n[lead-pre-label]u-\\n[.v]u
23295 .       if !'\\*[pdf-img*label-space]'' .sp \\*[pdf-img*label-space]
23296 .       ie \\n[pdf-img*autolabel] \{\
23297 .          nop \
23298 \\*[pdf-img*label-prfx]\\*[chapno]\\n+[fig*label-num]\\*[pdf-img*label-sffx]\|
23299 .          ds pdf-img*label \\*[chapno]\\n[fig*label-num]
23300 .          if dLABEL.REFS \
23301 .             tm .ds \\*[target] \\*[chapno]\\n[fig*label-num]
23302 .          rm target
23303 .       \}
23304 .       el .if !'\\*[pdf-img*label]'' .nop \\*[pdf-img*label]
23305 .       fam
23306 .       ft
23307 .       ps
23308 .       gcolor
23309 .       if !'\\*[pdf-img*caption]'' \{\
23310 .          if \\n[pdf-img*caption-after-label] \{\
23311 .             ds pdf-img*caption-old \\*[pdf-img*caption]
23312 .             ds pdf-img*caption " \\*[pdf-img*caption]
23313 .             nop \\*[pdf-img*caption-specs]\\*[pdf-img*caption]\\*[revert-specs]
23314 .             ds pdf-img*caption \\*[pdf-img*caption-old]
23315 .          \}
23316 .       \}
23317 .       br
23318 .       ev
23319 .       in 0
23320 .    \}
23321 \!.  in
23322 .    di
23323 .    nf
23324 .    vpt 0
23325 .    if !'\\*[pdf-img:adj]'' \{\
23326 .       if \\n[@TOP] \
23327 .          if \\n[#COLUMNS]>1 \
23328 \!.           rs
23329 \!.     sp \\*[pdf-img:adj]
23330 .    \}
23331 .    PDF*IMAGE
23332 .    if !'\\*[pdf-img:adj]'' \
23333 .       if !\\n[@TOP] \!.sp -\\*[pdf-img:adj]
23334 .    vpt
23335 .    ev
23336 .    if \\n[pdf-img:float] \{\
23337 .       FLOAT off
23338 .       nr dl \\n[pdf-img:width]
23339 .    \}
23340 .    if !\\n[pdf-img:float] \{\
23341 .       ie !\\n[#NO_SHIM] \
23342 .          if !\\n[pdf-img*no-shim] .SHIM
23343 .       el \
23344 .          if !\\n[#NO_FLEX] \
23345 .             if !\\n[pdf-img*no-flex] .FLEX
23346 .    \}
23347 .    PDF_IMAGE_CLEAN 
23348 .END
23349 \#
23350 \# PDF_IMAGE_FRAME
23351 \# ---------------
23352 \# *Arguments:
23353 \#   [ <inset> ] [ <rule weight> ] [ <color> ]
23354 \# *Function:
23355 \#   Sets parameters for pdf image frames.
23356 \# *Notes:
23357 \#   Defaults are '6p' '.5' 'black'.  Arguments to be left at default
23358 \#   must be entered as "".
23359 \#
23360 .MAC PDF_IMAGE_FRAME END
23361 .    ie !'\\$1''\{\
23362 .       ds frame-arg \\$1
23363 .       substring frame-arg -1
23364 .       ie \B'\\*[frame-arg]' \{\
23365 .          tm1 "[mom]: \\$0 inset argument at line \\n[.c]
23366 .          tm1 "       of '\\n[.F]' requires a unit of measure.
23367 .          tm1 "       Default 6 point inset will be used instead.
23368 .       \}
23369 .       el \{\
23370 .          nr pdf-img:frame-inset \\$1
23371 .          shift
23372 .       \}
23373 .    \}
23374 .    el .shift
23375 .    ie !'\\$1'' \{\
23376 .       ds frame-arg \\$1
23377 .       substring frame-arg -1
23378 .       ie \B'\\*[frame-arg]' \{\
23379 .          ds pdf-img:frame-weight \\$1
23380 .          shift
23381 .       \}
23382 .       el \{\
23383 .          ds frame-arg \\$1
23384 .          substring frame-arg -1 
23385 .          length arg-len \\*[frame-arg]
23386 .          if \\n[arg-len]=1 \{\
23387 .             tm1 "[mom]: \\$0 rule weight argument at line \\n[.c]
23388 .             tm1 "       of '\\n[.F]' must not have a unit of measure appended.
23389 .             tm1 "       Default .5 rule weight will be used instead.
23390 .             shift
23391 .          \}
23392 .       \}
23393 .    \}
23394 .    el .shift
23395 .    if !'\\$1'' \{\
23396 .       ie m \\$1 .ds pdf-img:frame-color \\$1
23397 .       el \{\
23398 .          tm1 "[mom]: \\$0 color argument '\\$1' at line \\n[.c]
23399 .          tm1 "       of '\\n[.F]' is not a valid color.
23400 .          tm1 "       Default black will be used instead.
23401 .       \}
23402 .    \}
23403 .END
23404 \#
23405 .MAC PDF_IMAGE_CLEAN END
23406 .    rm PDF*IMAGE
23407 .    rm pdf-img:adj
23408 .    rm pdf-img*caption
23409 .    rm pdf-img*caption-short
23410 .    rm pdf-img:file
23411 .    rm pdf-img*label
23412 .    rm pdf-img:pos
23413 .    rm short
23414 .    rr ind-pre-img
23415 .    rr pdf-img:depth
23416 .    rr pdf-img:float
23417 .    if !\\n[pdf-img:frame] \
23418 .       rr pdf-img:frame
23419 .    rr pdf-img:ind
23420 .    rr pdf-img:no-shim
23421 .    rr pdf-img:no-flex
23422 .    rr pdf-img:scale
23423 .\" Cutarounds not yet implemented
23424 .    if !\\n[defer] \
23425 .       if !\\n[cutaround] \
23426 .          rr pdf-img*have-caption
23427 .    if !\\n[cutaround] \{\
23428 .       rr pdf-img:frame-inset
23429 .       rr pdf-img:width
23430 .    \}
23431 .    if '\\*[pdf-img*label-sffx-tmp]'.' .ds pdf-img*label-sffx .
23432 .END
23433 \#
23434 .de pdfmomclean
23435 .   ie '\\n[.z]'' \{\
23436 .      ds pdfcleaned \\$*
23437 .      ev pdfcln
23438 .      tr \[em]-
23439 .      nf
23440 .      box pdf:clean
23441 .      nop \\*[\\*[pdfcleaned]]
23442 .      fl
23443 .      box
23444 .      chop pdf:clean
23445 .      asciify pdf:clean
23446 .      ev
23447 .      ds \\*[pdfcleaned] "\\*[pdf:clean]
23448 .      rm pdf:clean
23449 .      tr \[em]\[em]
23450 .    \}
23451 .    el .nop \!.pdfmomclean \\$@
23452 ..
23453 \#
23454 .MAC PAUSE END
23455 .    vpt 0
23456 .    br
23457 .    vpt
23458 .    ie !'\\n[.z]'' \{\
23459 \!.     pdfpause
23460 \!.     pdftransition BLOCK \\$1
23461 .    \}
23462 .    el \{\
23463 .       pdfpause
23464 .       pdftransition BLOCK \\$1
23465 .    \}
23466 .END
23467 \#
23468 .MAC TRANSITION END
23469 .    ie !'\\n[.z]'' \
23470 \!.     pdftransition PAGE \\$1
23471 .    el .pdftransition PAGE \\$1
23472 .END
23473 \#
23474 \# Local Variables:
23475 \# mode: nroff
23476 \# End:
23477 \# vim: filetype=groff: