2 Mom -- a typesetting/document-processing macro set for groff.
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>
8 This file is part of groff.
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.
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
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/>.
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.
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.
35 "<anything>" in the description of arguments that can be passed
36 to a macro means that any argument turns the feature off.
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).
46 \# ====================================================================
49 . ab [mom]: The groff mom macros do not work in compatibility mode.
50 \# Check that GNU troff is being run
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.
59 . ab [mom]: Version \*[version]
62 .ds short_revision \n[.Y]
63 .substring short_revision 0 0
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
176 \# Instruct grops to use square linecaps and joins.
177 \# This instruction is also executed in DO_B_MARGIN, NEWPAGE, and HEADER
179 .if !n \X'ps: exec 0 setlinejoin'\X'ps: exec 0 setlinecap'
181 \# The following PostScript, provided by Tadziu Hoffmann, permits
182 \# no-fail underlining
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
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
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]
230 \# ====================================================================
232 \# TYPESETTING MACROS, STRINGS, AND ALIASES
233 \# ========================================
237 \# Alias .als as ALIAS, and .aln (number registers) as ALIASN
242 \# ALIASES FOR GROFF REQUESTS
243 \# --------------------------
252 \# ALIASES FOR NUMBER REGISTERS
253 \# ----------------------------
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
264 \# ====================================================================
268 .nr #L_MARGIN \n[.o] \" Tabs, etc require #L_MARGIN
269 .cflags 4 /\[en] \" So slash and en-dashes get broken
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.
278 \# ====================================================================
282 \# Macros that control the physical layout of the page: paper size
288 \# <width of printer sheet>
290 \# Stores user supplied page width in register #PAGE_WIDTH.
292 \# #PAGE_WIDTH is used to establish the default LL (and right margin).
293 \# Requires unit of measure.
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
306 \# <offset from page left>
308 \# Stores user supplied page offset in register #L_MARGIN.
309 \# Sets .po to user supplied offset.
311 \# Requires unit of measure.
315 . nr #L_MARGIN (\\$1)
322 \# <width of right margin>
324 \# Stores user supplied right margin in register #R_MARGIN.
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.
330 \# N.B. -- PAGEWIDTH and L_MARGIN have to be defined before R_MARGIN.
332 \# Requires unit of measure.
336 . nr #R_MARGIN (\\$1)
337 . ll \\n[#PAGE_WIDTH]u-\\n[#L_MARGIN]u-\\n[#R_MARGIN]u
339 . nr #L_LENGTH \\n[.l]
345 \# <distance to advance from top of page>
347 \# Stores the user supplied top margin in register #T_MARGIN.
348 \# Advances user supplied depth from the top of the page.
350 \# Requires unit of measure.
353 . nr #T_MARGIN (\\$1)
354 . if !\\n[#DOCS] .sp |\\n[#T_MARGIN]u-1v
361 \# <space to leave at the bottom of the page>
363 \# Stores the user supplied bottom margin in register #B_MARGIN.
365 \# Requires unit of measure.
369 . nr #B_MARGIN (\\$1)
370 . nr #ORIGINAL_B_MARGIN \\n[#B_MARGIN]
372 . wh -\\n[#B_MARGIN]u DO_B_MARGIN
378 \# <pagewidth> [pagelength [leftmargin [rightmargin [topmargin [bottommargin]]]]]
380 \# Page set-up. Collects arguments and passes them to the appropriate
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.)
387 \# All arguments require a unit of measure.
393 . ie '\\$3'' .L_MARGIN \\n[.o]
395 . ie '\\$4'' .R_MARGIN 1i
397 . if !'\\$5'' .T_MARGIN \\$5
398 . if !'\\$6'' .B_MARGIN \\$6
401 \# gropdf: pass pagelength to postprocessor; no need for -P-p
405 . if '\\*[.T]'pdf' \X'papersize=\\n[#PAGE_WIDTH]z,\\n[#PAGE_LENGTH]z'\c
408 \# =====================================================================
410 \# +++PAGE CONTROL+++
412 \# Generic macros for breaking pages.
419 \# Plants the top margin at the top of each page.
421 \# The trap is set in .T_MARGIN or .PAGE
425 . sp |\\n[#T_MARGIN]u-1v
434 \# Plants the bottom margin at the bottom of each page.
436 \# The trap is set in .B_MARGIN or .PAGE.
439 . nr #T_MARGIN_LEAD_ADJ \\n[#LEAD]-12000
441 . if !n .nop \X'ps: exec 0 setlinejoin'\X'ps: exec 0 setlinecap'
443 . if !\\n[#NEWPAGE] .bp
453 \# Breaks to a new page.
455 \# If a B_MARGIN has been set, processes that, otherwise, just
456 \# breaks to a new page.
460 . if \\n[#DOC_TYPE]=5 \{\
461 . if \\n[#NUM_ARGS]>0 \
462 . pdftransition PAGE \\$1
466 . rr tbl*no-print-header
469 . if \\n[#B_MARGIN_SET]=1 .DO_B_MARGIN
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
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) \
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
490 .ALIAS NEWSLIDE NEWPAGE
492 \# =====================================================================
494 \# +++GENERAL STYLE MACROS+++
501 \# Stores user supplied line length in register #L_LENGTH.
502 \# Sets .ll to #L_LENGTHu
504 \# Requires unit of measure.
507 . nr #USER_SET_L_LENGTH 1
509 . nr #L_LENGTH \\n[.l]
513 \# +++FAMILY AND FONT+++
518 \# <fallback font> [ ABORT | WARN ] | ABORT | WARN
520 \# Sets register #ABORT_FT_ERRORS to 1, or defines a fallback font
521 \# called "dummy" at font position 0.
523 \# Calls to non-existent families cause mom to continue processing
524 \# files using the fallback font until a valid family is entered.
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.
532 .MAC FALLBACK_FONT END
533 . if \\n[#NUM_ARGS]=1 \{\
534 . if '\\$1'ABORT' .nr #ABORT_FT_ERRORS 1
536 . if r #ABORT_FT_ERRORS .nr #ABORT_FT_ERRORS 0
538 . if !'\\$1'WARN' .fp 0 dummy \\$1
540 . if \\n[#NUM_ARGS]=2 \{\
542 . if '\\$2'ABORT' .nr #ABORT_FT_ERRORS 1
543 . if '\\$2'WARN' .nr #ABORT_FT_ERRORS 0
547 .FALLBACK_FONT CR ABORT
554 \# Stores user supplied font family in string $FAMILY. Sets .fam
558 . if '\\n[.ev]'COVER_TEXT' .ds $SAVED_DOC_FAM \\n[.fam]
559 . if \\n[#COLLATE] .rm $SAVED_DOC_FAM
561 . if \\n[#PRINT_STYLE]=1 \{\
562 . fam \\*[$TYPEWRITER_FAM]
565 . if \\n[#IGNORE] \{\
566 . fam \\*[$TYPEWRITER_FAM]
569 . if (\\n[.x]\\n[.y]\\*[short_revision] >= 1192) .ds $SAVED_STYLE \\n[.sty]
572 . if (\\n[.x]\\n[.y]\\*[short_revision] >= 1192) \{\
573 . ft \\*[$SAVED_STYLE]
574 . if !F\\n[.fn] .ft 0
576 . ie \\n[#PRE_COLLATE]=1 .
578 . if \\n[#COLLATE]=1 \
579 . if !r#START .ds $DOC_FAM \\*[$FAMILY]
586 \# R | I | B | BI | <other style extension>
588 \# Stores user supplied font in $FONT and sets .ft to $FONT.
592 . if \\n[#PRINT_STYLE]=1 \{\
594 . if \\n[#UNDERLINE_ITALIC]=1 \{\
598 . if \\n[#ITALIC_MEANS_ITALIC]=1 \{\
609 . if (\\n[.x]\\n[.y]\\*[short_revision] >= 1192) \{\
610 . if '\\n[.sty]'' \{\
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].
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].
633 \# <point size of type>
635 \# Sets point size to user supplied value in scaled points.
636 \# If #AUTO_LEAD is on, resets lead accordingly.
638 \# Must NOT use a unit of measure.
641 . if \\n[#PRINT_STYLE]=1 .return
642 . if \\n[#IGNORE] .return
644 . nr #PT_SIZE_IN_UNITS \\n[.ps]
645 . ie '\\$0'DOC_PT_SIZE' \{\
646 . if !\\n[#DOCS] .DOC_MACRO_ERROR \\$0
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]
656 . el .if \\n[#AUTO_LEAD] .vs \\n[.ps]u+\\n[#AUTOLEADING]u
662 \# <point size of type>
664 \# Sets point size to user supplied value in scaled points.
665 \# Intended to be called inline with \*[SIZE <n><unit>]
667 \# Can be used with a unit of measure or not.
677 \# <leading between lines of text>
679 \# Turns off #AUTOLEAD if it's on.
680 \# Sets .vs to user supplied value.
682 \# Does not require unit of measure. LS automatically turns off AUTOLEAD.
686 . if \\n[#PRINT_STYLE]=1 .return
687 . if \\n[#IGNORE] .return
688 . if \\n[#AUTO_LEAD] \{\
695 . if \\n[.t]<\\n[.v] 'bp
701 \# <leading value to add to #PT_SIZE> [FACTOR]
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.
708 \# With the optional FACTOR argument, the current point size is
709 \# multiplied by #AUTOLEAD_VALUE/1000 instead of the two being added
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]
721 . el .nr #AUTOLEADING \\n[#AUTOLEAD_VALUE]
722 . vs \\n[.ps]u+\\n[#AUTOLEADING]u
725 \# STRINGS FOR INLINE CONTROL OF GENERAL TYPE STYLE
726 \# ------------------------------------------------
734 \# =====================================================================
738 \# AUTOMATIC PAIRWISE KERNING
739 \# --------------------------
741 \# <none> | <anything>
743 \# Turns automatic pairwise kerning on or off.
756 \# INLINE KERNING AND HORIZONTAL MOVEMENT
757 \# --------------------------------------
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.
768 \# The default value for U may be changed or reset with the
772 . ie '\\$1'DEFAULT' .ds $KERN_UNIT 36
773 . el .ds $KERN_UNIT \\$1
777 .ds BU \h'-(\En[.ps]u/\E*[$KERN_UNIT]u*\\$1u)'
778 .ds FU \h'(\En[.ps]u/\E*[$KERN_UNIT]u*\\$1u)'
780 \# Initialize strings for pre-1.1.3c-style BU and FU
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)'
788 \# Horizontal movements
789 \# --------------------
790 \# BP1...12.75 and FP1...12.75 move backwards or forwards inline by the
791 \# specified number of points.
800 .ds BP1.25 \h'-1.25p'
802 .ds BP1.75 \h'-1.75p'
804 .ds BP2.25 \h'-2.25p'
806 .ds BP2.75 \h'-2.75p'
808 .ds BP3.25 \h'-3.25p'
810 .ds BP3.75 \h'-3.75p'
812 .ds BP4.25 \h'-4.25p'
814 .ds BP4.75 \h'-4.75p'
816 .ds BP5.25 \h'-5.25p'
818 .ds BP5.75 \h'-5.75p'
820 .ds BP6.25 \h'-6.25p'
822 .ds BP6.75 \h'-6.75p'
824 .ds BP7.25 \h'-7.25p'
826 .ds BP7.75 \h'-7.75p'
828 .ds BP8.25 \h'-8.25p'
830 .ds BP8.75 \h'-8.75p'
832 .ds BP9.25 \h'-9.25p'
834 .ds BP9.75 \h'-9.75p'
836 .ds BP10.25 \h'-10.25p'
837 .ds BP10.5 \h'-10.5p'
838 .ds BP10.75 \h'-10.75p'
840 .ds BP11.25 \h'-11.25p'
841 .ds BP11.5 \h'-11.5p'
842 .ds BP11.75 \h'-11.75p'
844 .ds BP12.25 \h'-12.25p'
845 .ds BP12.5 \h'-12.5p'
846 .ds BP12.75 \h'-12.75p'
888 .ds FP10.25 \h'10.25p'
890 .ds FP10.75 \h'10.75p'
892 .ds FP11.25 \h'11.25p'
894 .ds FP11.75 \h'11.75p'
896 .ds FP12.25 \h'12.25p'
898 .ds FP12.75 \h'12.75p'
900 \# WHOLE LINE (TRACK) KERNING
901 \# --------------------------
903 \# <amount of track kerning>
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.
912 \# Decimal values are acceptable.
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.
918 \# \n[.f] holds the current font number, which is acceptable to .tkf.
920 \# RW and EW must be reset to 0 to cancel their effect on subsequent
924 . if \\n[#BR_AT_LINE_KERN] \{\
925 . ie \\n[#JUSTIFY]=1 .brp
932 . tkf \\n[.f] 1 -\\$1 1 -\\$1
936 . if \\n[#BR_AT_LINE_KERN] \{\
937 . ie \\n[#JUSTIFY]=1 .brp
944 . tkf \\n[.f] 1 \\$1 1 \\$1
947 \# BREAK AT LINE KERN
948 \# ------------------
952 \# Enables/disables .br's before .RW and .EW
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.
958 .MAC BR_AT_LINE_KERN END
959 . ie '\\$1'' .nr #BR_AT_LINE_KERN 1
960 . el .rr #BR_AT_LINE_KERN
963 \# =====================================================================
970 \# <none> | <anything> | DEFAULT
972 \# LINES <n> | MARGIN <n> | SPACE <n>
974 \# Turns auto hyphenation on or off, resets the hyphenation style
975 \# to default, or permits the setting of various hyphenation
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).
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.
987 \# HY LINES <n> sets the number of allowable consecutive hyphenated lines.
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).
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.
999 . if \\n[#LINES] .hlm \\n[#LINES]
1000 . if \\n[#MARGIN] .hym \\n[#MARGIN]]
1001 . if \\n[#SPACE] .hys \\n[#SPACE]
1005 . if !'\\$1'LINES' \{\
1009 . if !'\\$1'MARGIN' \{\
1013 . if !'\\$1'SPACE' \{\
1017 . if !'\\$1'DEFAULT' \{\
1021 . if '\\$1'LINES' \{\
1025 . if '\\$1'MARGIN' \{\
1027 . nr #HY_MARGIN \\$2
1029 . if '\\$1'SPACE' \{\
1033 . if '\\$1'DEFAULT' \{\
1044 \# HYPHENATION PARAMETERS
1045 \# ----------------------
1047 \# <# of lines> | <size of margin> | <amount of interword space>
1049 \# Allows user to specify .HY LINES, MARGIN, and SPACE with a single command.
1058 \# =====================================================================
1060 \# +++VERTICAL SPACING+++
1065 \# <user supplied lead to advance below current baseline>
1067 \# Creates or modifies register #ALD. Adds user supplied lead
1068 \# below current baseline.
1070 \# Requires a unit of measure.
1077 . if '\\$0'ADD_SPACE' \{\
1083 . sp |\\n[#T_MARGIN]u-1v+\\n[#ALD]u
1088 . if '\\$0'SPACE' .sp \\$1
1089 . if '\\$0'SP' .sp \\$1
1095 \# <user supplied lead to reverse above current baseline>
1097 \# Creates or modifies register #RLD. Reverses user supplied
1098 \# lead above current baseline.
1100 \# Requires a unit of measure.
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>].
1123 .ds ALD1.25 \v'1.25p'
1125 .ds ALD1.75 \v'1.75p'
1127 .ds ALD2.25 \v'2.25p'
1129 .ds ALD2.75 \v'2.75p'
1131 .ds ALD3.25 \v'3.25p'
1133 .ds ALD3.75 \v'3.75p'
1135 .ds ALD4.25 \v'4.25p'
1137 .ds ALD4.75 \v'4.75p'
1139 .ds ALD5.25 \v'5.25p'
1141 .ds ALD5.75 \v'5.75p'
1143 .ds ALD6.25 \v'6.25p'
1145 .ds ALD6.75 \v'6.75p'
1147 .ds ALD7.25 \v'7.25p'
1149 .ds ALD7.75 \v'7.75p'
1151 .ds ALD8.25 \v'8.25p'
1153 .ds ALD8.75 \v'8.75p'
1155 .ds ALD9.25 \v'9.25p'
1157 .ds ALD9.75 \v'9.75p'
1159 .ds ALD10.25 \v'10.25p'
1160 .ds ALD10.5 \v'10.5p'
1161 .ds ALD10.75 \v'10.75p'
1163 .ds ALD11.25 \v'11.25p'
1164 .ds ALD11.5 \v'11.5p'
1165 .ds ALD11.75 \v'11.75p'
1167 .ds ALD12.25 \v'12.5p'
1168 .ds ALD12.5 \v'12.5p'
1169 .ds ALD12.75 \v'12.75p'
1171 .ds RLD.25 \v'-.25p'
1173 .ds RLD.75 \v'-.75p'
1175 .ds RLD1.25 \v'-1.25p'
1176 .ds RLD1.5 \v'-1.5p'
1177 .ds RLD1.75 \v'-1.75p'
1179 .ds RLD2.25 \v'-2.25p'
1180 .ds RLD2.5 \v'-2.5p'
1181 .ds RLD2.75 \v'-2.75p'
1183 .ds RLD3.25 \v'-3.25p'
1184 .ds RLD3.5 \v'-3.5p'
1185 .ds RLD3.75 \v'-3.75p'
1187 .ds RLD4.25 \v'-4.25p'
1188 .ds RLD4.5 \v'-4.5p'
1189 .ds RLD4.75 \v'-4.75p'
1191 .ds RLD5.25 \v'-5.25p'
1192 .ds RLD5.5 \v'-5.5p'
1193 .ds RLD5.75 \v'-5.75p'
1195 .ds RLD6.25 \v'-6.25p'
1196 .ds RLD6.5 \v'-6.5p'
1197 .ds RLD6.75 \v'-6.75p'
1199 .ds RLD7.25 \v'-7.25p'
1200 .ds RLD7.5 \v'-7.5p'
1201 .ds RLD7.75 \v'-7.75p'
1203 .ds RLD8.25 \v'-8.25p'
1204 .ds RLD8.5 \v'-8.5p'
1205 .ds RLD8.75 \v'-8.75p'
1207 .ds RLD9.25 \v'-9.25p'
1208 .ds RLD9.5 \v'-9.5p'
1209 .ds RLD9.75 \v'-9.75p'
1211 .ds RLD10.25 \v'-10.25p'
1212 .ds RLD10.5 \v'-10.5p'
1213 .ds RLD10.75 \v'-10.75p'
1215 .ds RLD11.25 \v'-11.25p'
1216 .ds RLD11.5 \v'-11.5p'
1217 .ds RLD11.75 \v'-11.75p'
1219 .ds RLD12.25 \v'-12.5p'
1220 .ds RLD12.5 \v'-12.5p'
1221 .ds RLD12.75 \v'-12.75p'
1223 \# =====================================================================
1225 \# +++REFINEMENTS+++
1227 \# AUTOMATIC LIGATURES
1228 \# -------------------
1230 \# <none> | <anything>
1232 \# Turns automatic ligature generation on or off.
1234 \# Ligatures may be supplied manually with \[fi], \[fl], etc.
1250 \# [ ,, ] | [ << ] | [ >> ] | <anything>
1252 \# [ DA | DE | EN | ES | FR | IT | NL | NO | PT | SV ] | <anything>
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.
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.
1264 .char " \\*[$QUOTE\\n[#OPEN_CLOSE]]\R'#OPEN_CLOSE (1-\\n[#OPEN_CLOSE])'
1267 .MAC SMARTQUOTES END
1268 .\" First " will be translated to $QUOTE0
1271 . if !'\\*[$RESTORE_SQ]'' \{\
1272 . SMARTQUOTES \\*[$RESTORE_SQ]
1275 .\" Default smart quotes (English)
1285 . ds $RESTORE_SQ \\$1
1292 . ds $RESTORE_SQ \\$1
1299 . ds $RESTORE_SQ \\$1
1306 . ds $RESTORE_SQ \\$1
1313 . ds $RESTORE_SQ \\$1
1320 . ds $RESTORE_SQ \\$1
1327 . ds $RESTORE_SQ \\$1
1332 . ds $QUOTE0 \[Fo]\|
1333 . ds $QUOTE1 \|\[Fc]
1334 . ds $RESTORE_SQ \\$1
1339 . ds $QUOTE0 \[Fo]\|
1340 . ds $QUOTE1 \|\[Fc]
1341 . ds $RESTORE_SQ \\$1
1348 . ds $RESTORE_SQ \\$1
1355 . ds $RESTORE_SQ \\$1
1362 . ds $RESTORE_SQ \\$1
1369 . ds $RESTORE_SQ \\$1
1373 .\" None of the above -> turn smartquotes off
1382 \# Strings for foot and inch marks
1387 \# =====================================================================
1389 \# +++LINE BREAKS+++
1396 \# Breaks a line without advancing.
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.
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.
1407 . if \\n[#PSEUDO_FILL]=1 \&
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)
1418 .ds B \h'|0'\R'#NO_ADVANCE 1'\c
1420 \# =====================================================================
1422 \# +++FILLING/QUADDING/JUSTIFYING+++
1429 \# Turns fill on and sets .ad to b.
1431 \# Justifies text left and right.
1434 . if \\n[#TAB_ACTIVE]=0 \{\
1436 . ds $RESTORE_QUAD_VALUE \\*[$QUAD_VALUE]
1440 . if \\n[#PRINT_STYLE]=1 .QUAD L
1447 \# L | LEFT | R | RIGHT | C | CENTER/CENTRE
1449 \# Turns fill on and sets .ad to l, r, or c.
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
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 \{\
1465 . ds $RESTORE_QUAD_VALUE \\*[$QUAD_VALUE]
1469 . if '\\*[$QUAD_VALUE]'L' \{\
1473 . if '\\*[$QUAD_VALUE]'R' \{\
1477 . if '\\*[$QUAD_VALUE]'C' \{\
1481 . if '\\*[$QUAD_VALUE]'J' \{\
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.
1503 \# Turns fill mode off. Allows user to quad lines left without
1504 \# requiring the .BR or .br macro.
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.
1511 . if \\n[#TAB_ACTIVE]=0 \{\
1513 . ds $RESTORE_QUAD_VALUE LEFT
1518 .\" Fix for a little conflict with DOCTYPE LETTER
1519 . if '\\n[.z]'LETTERHEAD1' .rr #DATE_FIRST
1527 \# Turns fill on. Allows user to quad lines right without
1528 \# requiring the .BR or .br macro.
1530 \# Lines that exceed the current LL will be broken, with the excess
1531 \# text quadded right.
1534 . if \\n[#TAB_ACTIVE]=0 \{\
1536 . ds $RESTORE_QUAD_VALUE RIGHT
1548 \# Turns fill off. Allows user to center lines without
1549 \# requiring the .BR or .br macro.
1551 \# Lines that exceed the current LL will be broken, with the excess
1555 . if \\n[#TAB_ACTIVE]=0 \{\
1557 . ds $RESTORE_QUAD_VALUE CENTER
1564 \# CENTER BLOCKS OF TYPE
1565 \# ---------------------
1567 \# <none> | <anything>
1569 \# Allows users to centre blocks of type on the page without
1570 \# altering their quad.
1572 .MAC CENTER_BLOCK END
1574 . ie !\\n[.$] .di CENTER*BLOCK
1577 . in \\n[.l]u-\\n[dl]u/2u
1578 . if \\n[.u] .nr #FILLED 1
1581 . if \\n[#FILLED] .fi
1587 .ALIAS CENTRE_BLOCK CENTER_BLOCK
1589 \# =====================================================================
1593 \# There are two different kinds of tabs: typesetting tabs and
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.
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.
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
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.
1619 \# Strings for string tab inlines
1620 \# ------------------------------
1621 \# Initialize string tab markers numbered 1 to 19.
1624 .while \n+[#LOOP]<20 \{\
1625 . ds ST\n[#LOOP] \Ek[#ST\n[#LOOP]_OFFSET]
1629 .while \n+[#LOOP]<20 \{\
1630 . ds ST\n[#LOOP]X \Ek[#ST\n[#LOOP]_MARK]
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]
1644 \# QUAD AND SET STRING TABS
1645 \# ------------------------
1647 \# <stringtab number> L | R | C | J [QUAD]
1649 \# Creates strings $ST<#>_QUAD_DIR and $ST<#>_FILL, then sets up a
1650 \# tab based on the collected information.
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
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]
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]
1665 . TAB_SET \\$1 \\n[#ST\\$1_OFFSET]u \\n[#ST\\$1_LENGTH]u \
1666 \\*[$ST\\$1_QUAD_DIR] \\*[$ST\\$1_FILL]
1672 \# <n> ident(ipPcm) length(ipPcm) [L | R | C | J [QUAD]]
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.)
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
1687 \# QUAD = fill tab (so it behaves as if .QUAD LRC or .JUSTIFY
1690 \# N.B. -- indents *must* be turned off before setting tabs
1692 \# Tabs are not columnar in behaviour. .TN and \*[TB+] permit
1693 \# bottom-line to bottom-line tab movement.
1695 \# When resetting tabs, .TQ must be invoked before .TAB_SET.
1697 \# Indents are turned off automatically whenever a new tab is called
1700 \# Generally, it's a good idea to make sure all indents are off
1701 \# before setting tabs.
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 \{\
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
1725 . po \\\\n[#L_MARGIN]u+\\\\n[#TAB_OFFSET\\\\*[$CURRENT_TAB]]u
1726 . ll \\n[#TAB_LENGTH]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
1737 . if '\\$4'R' .RIGHT
1738 . if '\\$4'C' .CENTER
1739 . if '\\$4'J' .JUSTIFY
1741 . if \\\\n[#TN]=1 \{\
1752 \# <tab number to tab into>
1754 \# Moves to tab number passed as an argument.
1757 . ds $TAB_NUMBER \\$1
1758 . TAB\\*[$TAB_NUMBER]
1767 \# Automatically moves to TAB<n+1> on the same line as the last
1768 \# line of the previous tab.
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.
1777 . nr #NEXT_TAB \\n[#CURRENT_TAB]+1
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.
1787 "\c\R'#TB+ 1'\R'#TN 1'\R'#NEXT_TAB \\n[#CURRENT_TAB]+1'\\*[TAB\\n[#NEXT_TAB]]\c
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.
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.
1811 . while \\n+[#LOOP]<20 \{\
1812 . rm $ST\\n[#LOOP]_FILL
1815 . ie '\\n[.z]'FLOAT*DIV' \{\
1816 \!. po \\n[#L_MARGIN]u
1817 \!. ll \\n[#L_LENGTH]u
1820 . po \\n[#L_MARGIN]u
1821 . ll \\n[#L_LENGTH]u
1823 . ll \\n[#L_LENGTH]u
1826 . ie '\\*[$RESTORE_QUAD_VALUE]'J' .JUSTIFY
1827 . el .QUAD \\*[$RESTORE_QUAD_VALUE]
1830 . if '\\*[$RESTORE_QUAD_VALUE]'LEFT' .LEFT
1831 . if '\\*[$RESTORE_QUAD_VALUE]'RIGHT' .RIGHT
1832 . if '\\*[$RESTORE_QUAD_VALUE]'CENTER' .CENTER
1836 \# ====================================================================
1844 \# <pre-defined NEWCOLOR or XCOLOR>
1846 \# Allows the inline escape for setting color to be called
1860 \# <color name> [<color scheme>] <color definition>
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.
1867 \# With only two args, the default color scheme is rgb.
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.
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
1889 \# <x color name> [<alias>]
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.
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.
1900 . if \\n[#NUM_ARGS]=2 \{\
1902 . ds $\\$2_FILL \\$1
1903 . ds COLAL_\\$2 \\$1
1907 \# Pre-define xcolors black and white
1915 \# =====================================================================
1917 \# +++MISCELLANEOUS USEFUL MACROS AND STRINGS+++
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.
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
1944 \# <none> | <anything>
1946 \# Simulates typewriter-style underlining of italic passages.
1948 \# Defaults for rule weight and distance from baseline are below.
1949 \# UNDERLINE_SPECS lets user change them
1951 .MAC UNDERLINE_SPECS END
1952 . ie \B'\\$1' .nr _w (u;\\$1)
1954 . ie '\\$1'DEFAULT' .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.
1963 . ie \B'\\$1' .nr _d (u;\\$1)
1965 . ie '\\$1'DEFAULT' .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.
1977 . ds $SAVED_SS_VAR \\*[$SS_VAR]
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
1985 . nr #UNDERLINE_ON 0
1986 . if !'\\*[$SAVED_SS_VAR]'' .SS \\*[$SAVED_SS_VAR]
1987 . ie !n .nop \X'ps: exec decornone'\c
1997 \# Simulates typewriter-style underlining of italic passages.
1999 \# Intended to be called with inline escapes \*[UL] (underline
2000 \# on) and \*[ULX] (underline off).
2004 . ds $SAVED_SS_VAR \\*[$SS_VAR]
2005 . ss \\n[.ss] (\\n[.ss]-\\n[.ss])
2006 . ie !'\\n[.z]'' \{\
2009 . if !\\n[.k]=0 \?\h'-\w'\\n[.ss]'u'\?
2010 \?\R'#UNDERLINE_ON 1'\X'ps: exec \\n[_w] \\n[_d] decorline'\?\c
2013 \?\R'#UNDERLINE_ON 1'\?\c
2019 . nr #UNDERLINE_ON 1
2020 . nop \X'ps: exec \\n[_w] \\n[_d] decorline'\c
2023 \R'#UNDERLINE_ON 1'\c
2031 . SS \\*[$SAVED_SS_VAR]
2033 . ie !'\\n[.z]'' \{\
2036 \?\R'#UNDERLINE_ON 0'\X'ps: exec decornone'\?\c
2039 \?\R'#UNDERLINE_ON 0'\?\c
2045 . nr #UNDERLINE_ON 0
2046 . nop \X'ps: exec decornone'\c
2049 . nr #UNDERLINE_ON 0
2058 \# [<points below baseline>] "text"
2060 \# Places an underscore 2 points under the string if no lead given,
2061 \# otherwise places underscore under string by user specified amount.
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.
2067 \# .UNDERSCORE "Text to be underscored
2069 \# .UNDERSCORE 2p "Text to be underscored
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
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
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]
2090 . nr #TEXT_WIDTH \w'\\$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
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)'
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
2117 \# DOUBLE UNDERSCORE
2118 \# -----------------
2120 \# [points below baseline] [points distance between rules] "text"
2122 \# Same as UNDERSCORE, except it produces a double underscore. The default
2123 \# distance between the rules is 2 points.
2125 \# The same double-quote requirement as UNDERSCORE.
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
2136 . if \\n[#NUM_ARGS]=3 \{\
2137 . ds $UNDERSCORE_GAP \\$1
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]
2147 . nr #TEXT_WIDTH \w'\\$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
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)'
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
2178 \# Default underscoring underline and rule gaps
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
2186 .ds $TOC_HEADER_RULE_GAP 2p
2187 .ds $TOC_HEADER_UNDERLINE_GAP 2p
2188 .ds $UNDERSCORE_GAP 2p
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
2203 \# Prints everything after inline invocation as superscript.
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.
2210 \# Default raise/lower amount
2211 .ds $SUP_RAISE \v'-.3m'
2212 .ds $SUP_LOWER \v'.3m'
2214 \# SUPERSCRIPT RAISE
2215 \# -----------------
2217 \# <amount to raise superscript>
2219 \# Defines strings $SUP_RAISE and $SUP_LOWER for use with \*[SUP],
2220 \# \*[CONDSUP] and \*[EXTSUP].
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]'
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]
2233 .ds SUPX \s[\En[#PT_SIZE_IN_UNITS]u]\E*[$SUP_LOWER]
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]
2240 .ds CONDSUPX \s[\En[#PT_SIZE_IN_UNITS]u]\E*[$SUP_LOWER]\E*[COND]
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]
2247 .ds EXTSUPX \s[\En[#PT_SIZE_IN_UNITS]u]\E*[$SUP_LOWER]\E*[EXT]
2255 \# <number of degrees> | RESET
2257 \# Modifies register #DEGREES for use with \*[SLANT], or resets
2258 \# it to the default. Defines string \*[SLANTX]
2260 \# \*[SLANT] permits pseudo-italicizing of a font in cases where
2261 \# no italic font exists in a particular family.
2263 \# Default # of degrees is 15.
2265 \# Do not use unit of measure with arg to SETSLANT.
2267 \# It may be necessary to adjust the spacing on either side of
2268 \# [SLANT] and [SLANTX].
2270 \# In docs, SLANT carries over from para to para.
2273 .ds SLANT \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
2274 .ds SLANTX \ER'#SLANT_ON 0'\ES'0'
2277 . ie '\\$1'RESET' \{\
2279 . if \\n[#PRINT_STYLE]=1 \
2280 . if \\n[#UNDERLINE_SLANT] .return
2281 . ds SLANT \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
2285 . if \\n[#PRINT_STYLE]=1 \
2286 . if \\n[#UNDERLINE_SLANT] .return
2287 . ds SLANT \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
2289 . ds SLANTX \ER'#SLANT_ON 0'\ES'0'
2298 \# <amount of emboldening> | RESET
2300 \# Modifies register #BOLDER_UNITS for use with \*[BOLDER], or resets
2301 \# it to the default 700 units.
2303 \# \*[BOLDER] allows pseudo-emboldening of a font where no bold
2304 \# font exists in a particular family.
2306 \# Default for SETBOLDER is 700 units. Do not use unit of measure
2307 \# with arg to SETBOLDER.
2309 .nr #BOLDER_UNITS 700
2312 . if \\n[#IGNORE]=1 .return
2313 . ie '\\$1'RESET' .nr #BOLDER_UNITS 700
2314 . el .nr #BOLDER_UNITS \\$1
2319 .bd \\n[.f] \\n[#BOLDER_UNITS]
2327 \# +++CONDENSE/EXTEND+++
2332 \# <percentage to condense/expand type size>
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
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.
2343 \# There is no default setting for CONDENSE or EXTEND.
2344 \# 80 is a good approximation of condensed type, 120 is okay
2347 \# The value set by CONDENSE or EXTEND applies to all
2348 \# subsequent \*[COND] or \*[EXT] escapes until a new value is set.
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.
2354 .MAC CONDENSE_OR_EXTEND END
2355 . if '\\$0'CONDENSE' \{\
2356 . ds $COND_PERCENT \\$1
2357 . if \\n[#PRINT_STYLE]=1 \{\
2359 . ds $COND_PERCENT 100
2362 \R'#PT_SIZE_IN_UNITS \En[.ps]'\
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'
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'
2370 . if '\\$0'EXTEND' \{\
2371 . ds $EXT_PERCENT \\$1
2372 . if \\n[#PRINT_STYLE]=1 \{\
2374 . ds $EXT_PERCENT 100
2377 \R'#PT_SIZE_IN_UNITS \En[.ps]'\
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'
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'
2388 \ER'#CONDENSE 0'\Es[0]\R'#PT_SIZE_IN_UNITS \En[.ps]'\H'\En[#PT_SIZE_IN_UNITS]u'
2390 \ER'#EXTEND 0'\Es[0]\R'#PT_SIZE_IN_UNITS \En[.ps]'\H'\En[#PT_SIZE_IN_UNITS]u'
2392 \# +++PAD LINES+++ (insert space)
2397 \# <character to use for marking pad points>
2399 \# Defines string $PAD_MARKER, used in PAD
2401 \# $PAD_MARKER is normally # (the pound sign).
2404 . ds $PAD_MARKER \\$1
2410 \# "<string of text with padding markers inserted>"
2411 \# "<id of bookmark created by .PDF_BOOKMARK>"
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.
2419 \# String tabs may be marked off during PAD.
2422 . if \\n[.u]=1 .nr fill 1
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
2433 . fam \\*[$FAMILY_FOR_PAD]
2434 \f[\\*[$FONT_FOR_PAD]]\s[\\n[#SIZE_FOR_PAD]u]\\*[$PAD_STRING]
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
2442 . char \\*[$PAD_MARKER] \
2443 \R'#SPACE_TO_END \En[.l]-\En[p]'\R'#PAD_SPACE \En[#SPACE_TO_END]/\En[#PAD_COUNT]'
2445 . fam \\*[$FAMILY_FOR_PAD]
2446 \f[\\*[$FONT_FOR_PAD]]\s[\\n[#SIZE_FOR_PAD]u]\\*[$PAD_STRING]
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]
2457 . ie !'\\$2'NOBREAK' .pdfhref L -D "\\$2" -E -- \&\\*[$PAD_STRING]
2458 . el .nop \\*[$PAD_STRING]
2460 . if \\n[#SILENT] .SILENT OFF
2471 . rchar \\*[$PAD_MARKER]
2472 . if '\\$2'NOBREAK' \{\
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.
2489 \# SET LEADER CHARACTER
2490 \# --------------------
2492 \# <character to use whenever \*[LEADER] is invoked>
2494 \# Set leader character.
2496 .MAC LEADER_CHARACTER END
2507 \# <family of drop cap>
2509 \# Creates or modifies string $DC_FAM.
2511 .MAC DROPCAP_FAMILY END
2518 \# <font of drop cap>
2520 \# Creates or modifies string $DC_FT.
2522 .MAC DROPCAP_FONT END
2529 \# <pre-defined XCOLOR or NEWCOLOR>
2531 \# Defines string $DC_COLOR to argument.
2533 \# User must define an XCOLOR or NEWCOLOR before using
2536 .MAC DROPCAP_COLOR END
2537 . if \\n[#PRINT_STYLE]=1 .return
2545 \# <width of gutter between drop cap and indented text>
2547 \# Creates or modifies register #DC_GUT.
2549 \# Requires unit of measure. Default is 3p.
2551 .MAC DROPCAP_GUTTER END
2558 \# <+|- # of points to in/decrease point size of drop cap letter>
2560 \# Creates or modifies string $DC_ADJUST.
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.
2567 \# Requires the + or - sign.
2569 .MAC DROPCAP_ADJUST END
2570 . ds $DC_ADJUST \\$1
2576 \# <dropcap letter> <# of lines> [COND <% to condense> | EXT <% to extend>]
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).
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
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.
2595 . if \\n[#IGNORE]=1 \{\
2605 . if \\n[#PRINT_STYLE]=1 \{\
2609 . if \\n[#PRINT_STYLE]=2 \{\
2611 . if \\n[#PP_STYLE]=2 \{\
2616 . if \\n[#PP_INDENT] .ti \\n[#PP_INDENT]u
2624 . nr #DC_LINES \\$2-1
2625 . if \\n[#CONDENSE]=1 \{\
2626 . ds $RESTORE_COND \\*[$COND_PERCENT]
2628 . nr #CONDENSE_WAS_ON 1
2630 . if \\n[#EXTEND]=1 \{\
2631 . ds $RESTORE_EXT \\*[$EXT_PERCENT]
2633 . nr #EXTEND_WAS_ON 1
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]
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
2653 . nr #GET_DC_HEIGHT \\n[#CAP_HEIGHT]
2655 . if d$DC_ADJUST .ps \\*[$DC_ADJUST]p
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]
2661 "[mom]: Dropcap at line \\n[.c] does not fit on page \\n[pgnum]\\*[col-num].
2663 " Shifting paragraph to next page or column.
2664 . ie \\n[#COLUMNS] .COL_NEXT
2667 . ie \\n[#DC_COLOR]=1 \{\
2671 \\*[DOWN \\n[#DC_LINES]v]\
2672 \m[\\*[$DC_COLOR]]\\*[COND]\\*[$DROPCAP]\\*[CONDX]\m[]\\*[UP \\n[#DC_LINES]v]
2675 \\*[DOWN \\n[#DC_LINES]v]\
2676 \m[\\*[$DC_COLOR]]\\*[EXT]\\*[$DROPCAP]\\*[EXTX]\m[]\\*[UP \\n[#DC_LINES]v]
2679 \\*[DOWN \\n[#DC_LINES]v]\
2680 \m[\\*[$DC_COLOR]]\\*[$DROPCAP]\m[]\\*[UP \\n[#DC_LINES]v]
2686 \\*[DOWN \\n[#DC_LINES]v]\
2687 \\*[COND]\\*[$DROPCAP]\\*[CONDX]\\*[UP \\n[#DC_LINES]v]
2690 \\*[DOWN \\n[#DC_LINES]v]\
2691 \\*[EXT]\\*[$DROPCAP]\\*[EXTX]\\*[UP \\n[#DC_LINES]v]
2694 \\*[DOWN \\n[#DC_LINES]v]\
2695 \\*[$DROPCAP]\\*[UP \\n[#DC_LINES]v]
2697 . if '\\$3'COND' \E*[COND]
2698 . if '\\$3'EXT' \E*[EXT]
2702 . in +\w'\\*[$DROPCAP]'u+\\n[#DC_GUT]u
2708 . in \w'\\*[$DROPCAP]'u+\\n[#DC_GUT]u
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]
2720 . if \\n[#EXTEND_WAS_ON] \{\
2721 . EXTEND \\*[$RESTORE_EXT]
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
2734 . rr #RESTORE_PT_SIZE
2735 . rr #RESTORE_INDENT
2741 .MAC DROPCAP_OFF END
2742 ' in \\n[#RESTORE_INDENT]u
2746 \# =====================================================================
2748 \# +++GRAPHICAL OBJECTS+++
2750 \# Set params for graphical objects.
2752 .MAC GRAPHICAL_OBJ END
2757 . if \\n[.vpt]=1 \{\
2759 . nr #RESTORE_TRAP 1
2761 . ie !\\n[#NO_ADVANCE]=1 .br
2768 . nr #FILL_MODE \\n[.j]
2772 . if \\n[.ce]>0 .nr #NOFILL_MODE 3
2773 . if \\n[.rj]>0 .nr #NOFILL_MODE 5
2780 \# HORIZONTAL RULE - DRH
2781 \# ---------------------
2783 \# <none> | <rule weight> <indent> <length> [ <color> ]
2785 \# With no arg, draws a full measure rule. With args, draws
2786 \# described horizontal rule.
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
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]
2804 . if \\n[#NUM_ARGS]>=1 .RULE_WEIGHT \\*[$RL_WEIGHT]
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
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]'
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
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
2847 . if \\n[#NOFILL]=1 \{\
2848 . if \\n[#NOFILL_MODE]=3 .CENTER
2849 . if \\n[#NOFILL_MODE]=5 .RIGHT
2852 . nr #RULE_WEIGHT \\n[#SAVED_WEIGHT]
2853 . nr #RULE_WEIGHT_ADJ \\n[#SAVED_WEIGHT_ADJ]
2855 . rr #SAVED_WEIGHT_ADJ
2856 . if \\n[#RESTORE_TRAP]=1 \{\
2860 . if '\\n[.z]'FLOAT*DIV' \
2861 . if !(\\n[.d]+\\n[#WEIGHT])<\\n[D-float] .nr D-float \\n[.d]+\\n[#WEIGHT]
2869 \# Draws a rule the length of the current measure.
2871 \# A convenience macro. DRH with no argument does the same thing.
2872 \# Kept in for backward compatibility.
2877 . ds $CURRENT_QUAD \\*[$QUAD_VALUE]
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
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
2888 . rr #RESTORE_L_LENGTH
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
2899 . QUAD \\*[$CURRENT_QUAD]
2905 \# VERTICAL RULE - DRV
2906 \# -------------------
2908 \# <rule weight> <indent> <depth> [ <color> ]
2910 \# Draws described vertical rule.
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
2919 . ds $RL_WEIGHT \\$1
2920 . ds $RL_INDENT \\$2
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
2941 . if \\n[#NOFILL]=1 \{\
2942 . if \\n[#NOFILL_MODE]=3 .CENTER
2943 . if \\n[#NOFILL_MODE]=5 .RIGHT
2946 . nr #RULE_WEIGHT \\n[#SAVED_WEIGHT]
2947 . nr #RULE_WEIGHT_ADJ \\n[#SAVED_WEIGHT_ADJ]
2948 . if \\n[#RESTORE_TRAP]=1 \{\
2952 . if '\\n[.z]'FLOAT*DIV' \
2953 . if !(\\n[.d]+\\*[$RL_DEPTH])<\\n[D-float] .nr D-float \\n[.d]+\\*[$RL_DEPTH]
2959 \# <rule weight> | SOLID> <indent> <length> <depth> [ <color> ]
2961 \# Draws described box.
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.
2971 . ie '\\$1'SOLID' .nr #BX_SOLID 1
2972 . el .ds $BX_WEIGHT \\$1
2973 . ds $BX_INDENT \\$2
2977 . ie d$\\$5_FILL .ds $BX_COLOR \\*[$\\$5_FILL]
2978 . el .ds $BX_COLOR \\$5
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]'
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]'
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
3009 . if \\n[#NOFILL]=1 \{\
3010 . if \\n[#NOFILL_MODE]=3 .CENTER
3011 . if \\n[#NOFILL_MODE]=5 .RIGHT
3013 . nr #RULE_WEIGHT \\n[#SAVED_WEIGHT]
3014 . nr #WEIGHT_ADJ \\n[#SAVED_WEIGHT_ADJ]
3016 . rr #SAVED_WEIGHT_ADJ
3017 . if \\n[#RESTORE_TRAP]=1 \{\
3021 . if '\\n[.z]'FLOAT*DIV' \
3022 . if !(\\n[.d]+\\*[$BX_DEPTH])<\\n[D-float] .nr D-float \\n[.d]+\\*[$BX_DEPTH]
3028 \# <rule weight> | SOLID> <indent> <width> <depth> [ <color> ]
3030 \# Draws described ellipses.
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
3041 . ie '\\$1'SOLID' .nr #CL_SOLID 1
3042 . el .ds $CL_WEIGHT \\$1
3043 . ds $CL_INDENT \\$2
3047 . ie d$\\$5_FILL .ds $CL_COLOR \\*[$\\$5_FILL]
3048 . el .ds $CL_COLOR \\$5
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'
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]'
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
3082 . if \\n[#NOFILL]=1 \{\
3083 . if \\n[#NOFILL_MODE]=3 .CENTER
3084 . if \\n[#NOFILL_MODE]=5 .RIGHT
3086 . nr #RULE_WEIGHT \\n[#SAVED_WEIGHT]
3087 . nr #WEIGHT_ADJ \\n[#SAVED_WEIGHT_ADJ]
3089 . rr #SAVED_WEIGHT_ADJ
3090 . if \\n[#RESTORE_TRAP]=1 \{\
3094 . if '\\n[.z]'FLOAT*DIV' \
3095 . if !(\\n[.d]+\\*[$CL_DEPTH])<\\n[D-float] .nr D-float \\n[.d]+\\*[$CL_DEPTH]
3101 \# <weight of rules in points>
3103 \# Sets \D't <n>' to the correct number of machine units for the
3104 \# argument given in points.
3106 \# Decimal fractions are allowed. Rule weight must be < 100.
3108 .MAC RULE_WEIGHT END
3109 . di NULL \" Diverted so there's no problem with breaks, spacing, etc.
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].
3116 . length #STR_LENGTH \\$1
3118 . substring $ARG 0 0
3119 . ie '\\*[$ARG]'.' \{\
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
3131 . length #ARG_LENGTH \\*[$ARG]
3132 . if \\n[#ARG_LENGTH]>1 .substring $ARG 1 1
3133 . ie '\\*[$ARG]'.' \{\
3135 . substring $LHS 0 0
3138 . nr #WEIGHT \\*[$LHS]\\*[$RHS]*100
3139 . if (\\n[#WEIGHT]>=10000) \{\
3140 . while (\\n[#WEIGHT]>=10000) \{\
3141 . nr #WEIGHT \\n[#WEIGHT]/10
3146 . ie \\n[#STR_LENGTH]<=2 .nr #WEIGHT \\$1*1000
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.
3158 . substring $LHS 0 1
3161 . nr #WEIGHT \\*[$LHS]\\*[$RHS]*1000
3162 . if (\\n[#WEIGHT]>=100000) \{\
3163 . while (\\n[#WEIGHT]>=100000) \{\
3164 . nr #WEIGHT \\n[#WEIGHT]/10
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' \
3182 . length type-len _TYPE
3183 . if \\n[type-len]>17 \{\
3184 . substring _TYPE 0 -17
3185 . ds $TITLE_TYPE \\*[_TYPE]
3187 . if !'\\*[$TITLE_TYPE]'' \{\
3188 . nr #\\*[$TITLE_TYPE]UNDERLINE_WEIGHT \\n[#WEIGHT]
3189 . nr #\\*[$TITLE_TYPE]UNDERLINE_WEIGHT_ADJ \\n[#WEIGHT_ADJ]
3191 . if '\\$0'RULE_WEIGHT' \{\
3192 . nr #RULE_WEIGHT \\n[#WEIGHT]
3193 . nr #RULE_WEIGHT_ADJ \\n[#WEIGHT_ADJ]
3195 . if '\\$0'UNDERSCORE_WEIGHT' \{\
3196 . nr #UNDERSCORE_WEIGHT \\n[#WEIGHT]
3197 . nr #UNDERSCORE_WEIGHT_ADJ \\n[#WEIGHT_ADJ]
3199 . if '\\$0'FOOTER_RULE_WEIGHT' \{\
3200 . nr #FOOTER_RULE_WEIGHT \\n[#WEIGHT]
3201 . nr #FOOTER_RULE_WEIGHT_ADJ \\n[#WEIGHT_ADJ]
3203 . if '\\$0'FOOTNOTE_RULE_WEIGHT' \{\
3204 . nr #FN_RULE_WEIGHT \\n[#WEIGHT]
3205 . nr #FN_RULE_WEIGHT_ADJ \\n[#WEIGHT_ADJ]
3207 . if '\\$0'HEADER_RULE_WEIGHT' \{\
3208 . nr #HEADER_RULE_WEIGHT \\n[#WEIGHT]
3209 . nr #HEADER_RULE_WEIGHT_ADJ \\n[#WEIGHT_ADJ]
3214 \# Aliases for RULE_WEIGHT
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
3228 \# Default rule weights
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
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
3252 \# Read in remaining aliases and default rule weights
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
3270 \# Set default rule weight
3276 \# =====================================================================
3278 \# +++WORD AND SENTENCE SPACING+++
3280 \# WORD SPACE CONTROL
3281 \# ------------------
3283 \# <+|->wordspace | DEFAULT
3285 \# Increases or decreases interword space by user supplied amount.
3286 \# If DEFAULT, value is set to 12 (groff default).
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.
3292 \# \n[.sss] holds the current sentence space value.
3295 . ds $WS_CURR \\n[.ss]
3297 . ie '\\$1'DEFAULT' .ss 12 \\n[.sss]
3299 . ds $WS (\\*[$WS_CURR]+\\*[$WS_VAR])
3300 . ie \\n[.sss]=12 .ss \\*[$WS] 12
3302 . ss \\*[$WS] (\\*[$WS]+\\*[$SS_VAR])
3308 \# SENTENCE SPACE CONTROL
3309 \# ----------------------
3311 \# <+-sentencespace> | 0 | DEFAULT
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).
3317 \# Because the user supplied value requires a literal + or - sign,
3318 \# the macro argument is stored in a string.
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.
3325 \# \n[.ss] holds the current wordspace value.
3326 \# \n[.sss] holds the current sentence space value.
3330 . ie '\\$1'0' .ss \\n[.ss] (\\n[.ss]-\\n[.ss])
3332 . ie '\\$1'DEFAULT' .ss \\n[.ss]
3333 . el .ss \\n[.ss] (0+\\*[$SS_VAR])
3337 \# =====================================================================
3342 \# +++INDENT LEFT+++
3345 . if \\n[#INDENT_STYLE_BOTH] .IBX
3346 . nr #INDENT_STYLE_LEFT 1
3347 . nr #INDENT_ACTIVE 1
3348 . nr #INDENT_LEFT_ACTIVE 1
3351 . in \\n[#L_INDENT]u
3352 . ta \\n[.l]u-\\n[#L_INDENT]u
3356 . nr #L_INDENT +(\\$1)
3357 . in \\n[#L_INDENT]u
3358 . ta \\n[.l]u-\\n[#L_INDENT]u
3360 . if \\n[#IN_ITEM] .nr #IN_ITEM_L_INDENT +(\\$1)
3363 \# +++INDENT RIGHT+++
3366 . if \\n[#INDENT_STYLE_BOTH] .IBX
3367 . nr #INDENT_STYLE_RIGHT 1
3368 . nr #INDENT_ACTIVE 1
3369 . nr #INDENT_RIGHT_ACTIVE 1
3372 . ie \\n[#TAB_ACTIVE] \{\
3373 . ll \\n[.l]u-\\n[#R_INDENT]u
3374 . ta \\n[.l]u-\\n[#L_INDENT]u
3377 . ll \\n[.l]u-\\n[#R_INDENT]u
3378 . ta \\n[.l]u-\\n[#L_INDENT]u
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
3389 . ll \\n[.l]u-\\n[#R_INDENT]u
3390 . ta \\n[.l]u-\\n[#L_INDENT]u
3395 \# +++INDENT BOTH+++
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
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
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]
3416 . ll \\n[.l]u-\\n[#BR_INDENT]u
3417 . in \\n[#BL_INDENT]u
3418 . ta \\n[.l]u-\\n[#BR_INDENT]u
3422 \# +++TEMPORARY INDENT+++
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
3432 . nr #T_INDENT (\\$1)
3433 . ti \\n[#T_INDENT]u
3437 \# +++HANGING INDENT+++
3440 . ie '\\$1'' .ti -\\n[#HL_INDENT]u
3442 . nr #HL_INDENT (\\$1)
3443 . ti -\\n[#HL_INDENT]u
3447 \# +++INDENTS OFF+++
3450 . ie \\n[#IN_ITEM] .nr #L_INDENT -\\n[#IN_ITEM_L_INDENT]
3454 . rr #INDENT_LEFT_ACTIVE
3455 . nr #L_INDENT_ILX \\n[#L_INDENT]
3457 . if '\\$1'CLEAR' \{\
3459 . rr #INDENT_STYLE_LEFT
3467 . rr #INDENT_RIGHT_ACTIVE
3468 . ie \\n[#TAB_ACTIVE] .TAB\\n[#CURRENT_TAB]
3470 . ie \\n[#COLUMNS] \{\
3471 . ll \\n[#COL_L_LENGTH]u
3475 . ll \\n[#L_LENGTH]u
3479 . if '\\$1'CLEAR' \{\
3481 . rr #INDENT_STYLE_RIGHT
3489 . rr #INDENT_BOTH_ACTIVE
3490 . ie \\n[#TAB_ACTIVE] .TAB\\n[#CURRENT_TAB]
3492 . ie \\n[#COLUMNS] \{\
3493 . ll \\n[#COL_L_LENGTH]u
3497 . ll \\n[#L_LENGTH]u
3501 . if '\\$1'CLEAR' \{\
3504 . rr #INDENT_STYLE_BOTH
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.
3519 . rr #INDENT_LEFT_ACTIVE
3520 . rr #INDENT_RIGHT_ACTIVE
3521 . rr #INDENT_BOTH_ACTIVE
3523 . if \\n[#INDENT_STYLE_RIGHT] \{\
3524 . ie \\n[#TAB_ACTIVE] .TAB\\n[#CURRENT_TAB]
3526 . ie \\n[#COLUMNS] \{\
3527 . ll \\n[#COL_L_LENGTH]u
3531 . ll \\n[#L_LENGTH]u
3536 . if \\n[#INDENT_STYLE_BOTH] \{\
3537 . ie \\n[#TAB_ACTIVE] .TAB\\n[#CURRENT_TAB]
3539 . ie \\n[#COLUMNS] \{\
3540 . ll \\n[#COL_L_LENGTH]u
3544 . ll \\n[#L_LENGTH]u
3549 . if '\\$1'CLEAR' \{\
3550 . if \\n[#INDENT_STYLE_RIGHT] \{\
3551 . ie \\n[#TAB_ACTIVE] .TAB\\n[#CURRENT_TAB]
3553 . ie \\n[#COLUMNS] \{\
3554 . ll \\n[#COL_L_LENGTH]u
3558 . ll \\n[#L_LENGTH]u
3563 . if \\n[#INDENT_STYLE_BOTH] \{\
3564 . ie \\n[#TAB_ACTIVE] .TAB\\n[#CURRENT_TAB]
3566 . ie \\n[#COLUMNS] \{\
3567 . ll \\n[#COL_L_LENGTH]u
3571 . ll \\n[#L_LENGTH]u
3582 . rr #INDENT_STYLE_LEFT
3583 . rr #INDENT_STYLE_RIGHT
3584 . rr #INDENT_STYLE_BOTH
3588 \# =====================================================================
3590 \# +++HANGING CHARACTERS+++
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
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.
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].
3614 . ie '\\$0'LEFT_HANG' \{\
3620 . ie !\\n[.z] .po -\\n[#HANG]u
3621 . el \!.po -\\n[#HANG]u
3634 .ALIAS NO_HANG LEFT_HANG
3638 .if '\\$1'\[rq]' .nr #OPEN_CLOSE 0
3644 \# =====================================================================
3646 \# +++MULTIPLE COLUMNS+++
3648 \# MULTIPLE COLUMNS ON
3649 \# -------------------
3653 \# Marks the top of a column set
3659 \# MULTIPLE COLUMN RETURN
3660 \# ----------------------
3664 \# Returns to the top of a column set
3672 \# MULTIPLE COLUMNS OFF
3673 \# --------------------
3675 \# <none> | <lead to advance beneath bottom of deepest column>
3677 \# Advances to the end of a column set
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.
3688 . if '\\n[.z]'FLOAT*DIV' \!.TQ
3693 . nr #MCX_ALD (\\$1)
3695 . ie \\n[#MCX_ALD]=0 .sp |\\n[.h]u-1v
3696 . el .sp |\\n[.h]u+\\n[#MCX_ALD]u
3702 \# =====================================================================
3704 \# +++TYPESETTING SUPPORT MACROS+++
3711 \# Enables/disables traps.
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.
3727 \# <none> | <anything>
3729 \# Diverts text so that it doesn't print, or turns the function off.
3731 \# Useful for setting up autotabs where you don't want the line with
3732 \# the tab marks to print.
3734 \# Also aliased as COMMENT, in case user wants to input a batch of
3735 \# text that doesn't print.
3740 . ie '\\$1'' .di NO_FLASH
3752 \# Prints anything. A macro that helps keep my code nicely indented.
3758 \# Numbered strings for while loop in SMALLCAPS.
3881 \# <none> | <anything>
3883 \# Converts text to caps, or, if OFF, reverts to normal caps/lc.
3885 \# For inline control of capitalization style, use \*[UC] and
3911 \# Perform lowercase conversion to caps or revert to lowercase
3913 .MAC CONVERT_CASE END
3914 . if '\\$0'LC_TO_CAPS' \{\
3916 . while \\n+[#LOOP]<=58 \{\
3917 . tr \\*[$c\\n[#LOOP]]\\*[$C\\n[#LOOP]]
3920 . if '\\$0'CAPS_TO_LC' \{\
3922 . while \\n+[#LOOP]<=58 \{\
3923 . tr \\*[$c\\n[#LOOP]]\\*[$c\\n[#LOOP]]
3928 .ALIAS LC_TO_CAPS CONVERT_CASE
3929 .ALIAS CAPS_TO_LC CONVERT_CASE
3935 \# <none> | <anything>
3937 \# Converts text to smallcaps, or, if <anything>, reverts to normal
3940 \# SMALLCAPS has no inline escape eqiv. to \*[UC].
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
3948 . nr #SMALLCAPS_ON 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'\
3954 \h'\\n[sc*wt-adj-factor]u'\\*[$C\\n[#LOOP]]\s[0]
3959 . while \\n+[#LOOP]<=58 \{\
3960 . rchar \\*[$c\\n[#LOOP]]
3962 . rr sc*wt-adj-factor
3963 . rr sc*extend-factor
3971 \# <size> [ <weight adjustment>
3973 \# Sets registers 'sc*factor', 'sc*wt-adj', and sc*extend.
3975 \# Weight adjustment pseudo-emboldens small caps to visually match the
3976 \# weight of the larger real caps.
3978 \# Both sc*factor (size) and sc*wt-adj (weight adjustment) args are
3979 \# expressed as percentages of type size.
3981 .MAC SMALLCAPS_STYLE END
3983 . while \\n+[#LOOP]<=\\n[#NUM_ARGS] \{\
3984 . if '\\$1'SIZE' \{\
3986 . nr sc*factor (z;\\$1)/100
3989 . if '\\$1'WEIGHT_ADJ' \{\
3991 . nr sc*wt-adj (z;\\$1)/100
3994 . if '\\$1'EXTEND' \{\
3996 . nr sc*extend (z;\\$1)/100
4000 . if \\n[sc*wt-adj]=0 .rr sc*wt-adj
4001 . if \\n[sc*extend]=0 .rr sc*extend
4014 \# Gets cap-height, x-height, and descender depth of the
4015 \# current font at the current point size.
4017 \# The routine is diverted so it remains invisible to output.
4020 . if '\\n[.z]'FLOAT*DIV' \
4021 . if \\n[dn] .nr saved-dn \\n[dn]
4023 E\R'#CAP_HEIGHT \\n[.cht]'
4024 e\R'#X_HEIGHT \\n[.cht]'
4025 y\R'#DESCENDER \\n[.cdp]'
4027 . ds $CAP_HEIGHT \\n[#CAP_HEIGHT]u
4028 . ds $X_HEIGHT \\n[#X_HEIGHT]u
4029 . ds $DESCENDER \\n[#DESCENDER]u
4031 . if '\\n[.z]'FLOAT*DIV' \
4032 . nr dn \\n[saved-dn]
4035 \# =====================================================================
4037 \# +++TYPESETTING ALIASES+++
4039 .ALIAS ADD_SPACE ALD
4040 .ALIAS CENTRE CENTER
4042 .ALIAS COMMENT SILENT
4043 .ALIAS CONDENSE CONDENSE_OR_EXTEND
4044 .ALIAS EXTEND CONDENSE_OR_EXTEND
4048 .ALIAS HYPHENATION HY
4054 .ALIAS LIG LIGATURES
4055 .ALIAS NEWCOLOUR NEWCOLOR
4056 .ALIAS PADMARKER PAD_MARKER
4059 .ALIAS TABSET TAB_SET
4061 .ALIAS UNDERSCORE_2 UNDERSCORE2
4062 .ALIAS XCOLOUR XCOLOR
4064 \# ====================================================================
4066 \# DOCUMENT PROCESSING MACROS, STRINGS AND ALIASES
4067 \# ===============================================
4074 \# Warning message if DOC_<PARAMETER> called before START.
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.
4089 \# +++PAGE DIMENSIONS+++
4094 \# LETTER | LEGAL | STATEMENT | TABLOID | LEDGER | FOLIO | QUARTO | 10x14 | EXECUTIVE | A3 | A4 | A5 | B4 | B5
4096 \# Sets up dimensions for different paper sizes.
4100 . if '\\*[$PAPER]'LETTER' \{\
4104 . if '\\*[$PAPER]'LEGAL' \{\
4108 . if '\\*[$PAPER]'STATEMENT' \{\
4112 . if '\\*[$PAPER]'TABLOID' \{\
4116 . if '\\*[$PAPER]'LEDGER' \{\
4120 . if '\\*[$PAPER]'FOLIO' \{\
4124 . if '\\*[$PAPER]'QUARTO' \{\
4128 . if '\\*[$PAPER]'10x14' \{\
4132 . if '\\*[$PAPER]'EXECUTIVE' \{\
4136 . if '\\*[$PAPER]'A3' \{\
4140 . if '\\*[$PAPER]'A4' \{\
4144 . if '\\*[$PAPER]'A5' \{\
4148 . if '\\*[$PAPER]'B4' \{\
4152 . if '\\*[$PAPER]'B5' \{\
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
4161 . if !r#L_MARGIN .L_MARGIN \\n[.o]
4162 . if !r#R_MARGIN .R_MARGIN 1i
4165 \# ====================================================================
4167 \# +++PRINTSTYLE -- TYPEWRITE OR TYPESET+++
4172 \# TYPESET | TYPEWRITE [SINGLESPACE]
4174 \# Sets type specs for typewriter-style or typeset output.
4176 \# Number registers: TYPEWRITE=1, TYPESET=2.
4179 . if !\\n[#COLLATE]=1 \{\
4180 . if !d$PAPER .PAPER LETTER
4181 . if '\\$1'TYPEWRITE' \{\
4183 . if !\\n[#DOC_TYPE]=4 \{\
4187 . ds $TYPEWRITER_FAM C
4188 . ds $TYPEWRITER_PS 12
4191 . ie '\\$2'SINGLESPACE' \{\
4192 . nr #SINGLE_SPACE 1
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]
4199 . if !\\n[#DOC_TYPE]=4 \{\
4201 . nr #FOOTER_ADJ \\n[.v]/2
4202 . nr #ORIGINAL_DOC_LEAD \\n[.v]
4208 . if !\\n[#PP_INDENT] .nr #PP_INDENT 3P
4210 . nr #BOLDER_UNITS 0
4213 . if !\\n[#ITALIC_MEANS_ITALIC] .rm IT
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
4227 . if '\\$1'TYPESET' \{\
4229 . if !\\n[#DOC_TYPE]=5 \{\
4230 . if !\\n[#DOC_TYPE]=4 \{\
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
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
4255 . rr #IGNORE_COLUMNS
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] \
4267 .\" Set up default style for nine levels of TOC headings
4268 . TOC_ENTRY_STYLE \\n[#HD_LEVEL] \
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
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]
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
4292 \# Set limited parameters to TYPEWRITE.
4294 .MAC TYPEWRITER_FAMILY END
4295 . ds $TYPEWRITER_FAM \\$1
4298 .ALIAS TYPEWRITER_FAM TYPEWRITER_FAMILY
4300 .MAC TYPEWRITER_SIZE END
4301 . ds $TYPEWRITER_PS \\$1
4305 . fam \\*[$TYPEWRITER_FAM]
4307 . ps \\*[$TYPEWRITER_PS]
4310 \# ITALIC MEANS ITALIC
4311 \# -------------------
4315 \# Instructs TYPEWRITE to treat italics as italics, whether
4316 \# invoked via control lines or inline.
4318 \# ITALIC_MEANS_ITALIC and UNDERLINE_ITALIC are mutually exclusive,
4319 \# hence invoking the one automatically turns off the other.
4321 .MAC ITALIC_MEANS_ITALIC END
4322 . if \\n[#PRINT_STYLE]=1 \{\
4323 . nr #ITALIC_MEANS_ITALIC 1
4324 . rr #UNDERLINE_ITALIC
4339 \# Instructs TYPEWRITE to underline italics, whether invoked
4340 \# via control lines or inline.
4342 \# UNDERLINE_ITALIC and ITALIC_MEANS_ITALIC are mutually exclusive,
4343 \# hence invoking the one automatically turns off the other.
4345 \# UNDERLINE_ITALIC is the default for TYPEWRITE.
4347 .MAC UNDERLINE_ITALIC END
4348 . if \\n[#PRINT_STYLE]=1 \{\
4349 . nr #UNDERLINE_ITALIC 1
4350 . rr #ITALIC_MEANS_ITALIC
4363 \# <none> | <anything>
4365 \# Instructs TYPEWRITE to underline occurrences of \*[SLANT], or
4366 \# turns feature off.
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).
4373 \# UNDERLINE_SLANT and SLANT_MEANS_SLANT are mutually exclusive,
4374 \# hence invoking the one automatically turns off the other.
4376 \# UNDERLINE_SLANT is the default for TYPEWRITE.
4378 .MAC UNDERLINE_SLANT END
4379 . if \\n[#PRINT_STYLE]=1 \{\
4380 . rr #SLANT_MEANS_SLANT
4381 . nr #UNDERLINE_SLANT 1
4384 . ds SLANT \ER'#SLANT_ON 1'\E*[UL]
4385 . ds SLANTX \ER'#SLANT_ON 0'\E*[ULX]
4389 .MAC SLANT_MEANS_SLANT END
4390 . if \\n[#PRINT_STYLE]=1 \{\
4391 . rr #UNDERLINE_SLANT
4392 . nr #SLANT_MEANS_SLANT 1
4395 . ds SLANT \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
4396 . ds SLANTX \ER'#SLANT_ON 0'\ES'0'
4400 .MAC IGNORE_COLUMNS END
4401 . if \\n[#PRINT_STYLE]=1 .nr #NO_COLUMNS 1
4404 \# ====================================================================
4406 \# +++COPY STYLE -- DRAFT OR FINAL+++
4413 \# Sets registers that are used to determine what to put
4414 \# in the default header, and how to number pages.
4416 \# DOCTYPE must come before COPYSTYLE.
4419 . ds $COPY_STYLE \\$1
4420 . if '\\*[$COPY_STYLE]'DRAFT' \{\
4422 . if !d$DRAFT .DRAFT 1
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."
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
4436 . ie '\\*[$REVISION]'' \{\
4437 . ds $HDRFTR_CENTER \
4438 \\*[$DRAFT_STRING]\\*[$DRAFT]
4441 . ds $HDRFTR_CENTER \
4442 \\*[$DRAFT_STRING]\\*[$DRAFT], \
4443 \\*[$REVISION_STRING] \\*[$REVISION]
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 \{\
4454 . rr #USER_DEF_HDRFTR_CENTER
4459 . if \\n[#DOC_TYPE]=2 \{\
4461 . ie \\n[#COPY_STYLE]=1 \{\
4462 . ie \\n[#PAGENUM_STYLE_SET] \
4463 . PAGENUM_STYLE \\*[$PAGENUM_STYLE]
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]
4474 . ie !'\\*[$CHAPTER_TITLE_1]'' \
4475 . ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
4476 . el .ds $HDRFTR_CENTER \\*[$CHAPTER_STRING] \\*[$CHAPTER]
4480 . ie '\\*[$REVISION]'' \{\
4481 . ie '\\*[$CHAPTER]'' \{\
4482 . ie !'\\*[$CHAPTER_TITLE_1]'' \{\
4483 . ie '\\*[$DRAFT]'' \
4484 . ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
4486 . ds $HDRFTR_CENTER \
4487 \\*[$CHAPTER_TITLE], \
4488 \\*[$DRAFT_STRING]\\*[$DRAFT]
4492 . ie '\\*[$DRAFT]'' \{\
4493 . ds $HDRFTR_CENTER \
4494 \\*[$CHAPTER_STRING]
4497 . ds $HDRFTR_CENTER \
4498 \\*[$CHAPTER_STRING], \
4499 \\*[$DRAFT_STRING]\\*[$DRAFT]
4504 . ie !'\\*[$CHAPTER_TITLE_1]'' \{\
4505 . ie '\\*[$DRAFT]'' \
4506 . ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
4508 . ds $HDRFTR_CENTER \
4509 \\*[$CHAPTER_TITLE_1], \
4510 \\*[$DRAFT_STRING]\\*[$DRAFT]
4514 . ie '\\*[$DRAFT]'' \{\
4515 . ds $HDRFTR_CENTER \
4516 \\*[$CHAPTER_STRING] \\*[$CHAPTER]
4519 . ds $HDRFTR_CENTER \
4520 \\*[$CHAPTER_STRING] \\*[$CHAPTER], \
4521 \\*[$DRAFT_STRING]\\*[$DRAFT]
4527 . ie '\\*[$CHAPTER]'' \{\
4528 . ie !'\\*[$CHAPTER_TITLE_1]'' \{\
4529 . ie '\\*[$DRAFT]'' \{\
4530 . ds $HDRFTR_CENTER \
4531 \\*[$CHAPTER_TITLE], \
4532 \\*[$REVISION_STRING] \\*[$REVISION]
4535 . ds $HDRFTR_CENTER \
4536 \\*[$CHAPTER_TITLE], \
4537 \\*[$DRAFT_STRING]\\*[$DRAFT], \
4538 \\*[$REVISION_STRING] \\*[$REVISION]
4542 . ie '\\*[$DRAFT]'' \{\
4543 . ds $HDRFTR_CENTER \
4544 \\*[$CHAPTER_STRING], \
4545 \\*[$REVISION_STRING] \\*[$REVISION]
4548 . ds $HDRFTR_CENTER \
4549 \\*[$CHAPTER_STRING], \
4550 \\*[$DRAFT_STRING]\\*[$DRAFT], \
4551 \\*[$REVISION_STRING] \\*[$REVISION]
4556 . ie !'\\*[$CHAPTER_TITLE_1]'' \{\
4557 . ie '\\*[$DRAFT]'' \{\
4558 . ds $HDRFTR_CENTER \
4559 \\*[$CHAPTER_TITLE], \
4560 \\*[$REVISION_STRING] \\*[$REVISION]
4563 . ds $HDRFTR_CENTER \
4564 \\*[$CHAPTER_TITLE], \
4565 \\*[$DRAFT_STRING]\\*[$DRAFT], \
4566 \\*[$REVISION_STRING] \\*[$REVISION]
4570 . ie '\\*[$DRAFT]'' \{\
4571 . ds $HDRFTR_CENTER \
4572 \\*[$CHAPTER_STRING] \\*[$CHAPTER], \
4573 \\*[$REVISION_STRING] \\*[$REVISION]
4576 . ds $HDRFTR_CENTER \
4577 \\*[$CHAPTER_STRING] \\*[$CHAPTER], \
4578 \\*[$DRAFT_STRING]\\*[$DRAFT], \
4579 \\*[$REVISION_STRING] \\*[$REVISION]
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]
4598 . ds $HDRFTR_CENTER \\*[$CHAPTER_STRING]
4601 . ie !'\\*[$CHAPTER_TITLE_1]'' \
4602 . ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
4604 . ds $HDRFTR_CENTER \\*[$CHAPTER_STRING] \\*[$CHAPTER]
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]
4617 . if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
4618 . ie '\\*[$REVISION]'' \{\
4619 . ie '\\*[$DRAFT]'' \
4620 . ds $HDRFTR_CENTER \\*[$DOC_TYPE]
4622 . ds $HDRFTR_CENTER \
4624 \\*[$DRAFT_STRING]\\*[$DRAFT]
4628 . ie '\\*[$DRAFT]'' \{\
4629 . ds $HDRFTR_CENTER \
4631 \\*[$REVISION_STRING] \\*[$REVISION]
4634 . ds $HDRFTR_CENTER \
4636 \\*[$DRAFT_STRING]\\*[$DRAFT], \
4637 \\*[$REVISION_STRING] \\*[$REVISION]
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]
4654 \# ====================================================================
4656 \# +++COLLECT DOC INFO (reference macros, metadata)+++
4659 \# various string/register arguments
4661 \# Set strings and registers for covers, docheaders, page headers.
4665 . nr #DOCTITLE_NUM 0 1
4666 . while \\n[#NUM_ARGS]>\\n[#DOCTITLE_NUM] \{\
4667 . ds $DOCTITLE_\\n+[#DOCTITLE_NUM] \\$\\n[#DOCTITLE_NUM]
4670 . PDF_TITLE \\*[$DOCTITLE]
4673 .MAC TITLE END \"Document title
4674 . if '\\$1'DOC_COVER' \{\
4676 . DOC_COVERTITLE \\$@
4679 . if '\\$1'COVER' \{\
4684 . ie \\n[#NUM_ARGS]=0 \{\
4685 . if \\n[#TITLE_NUM] \{\
4687 . while \\n[#TITLE_NUM]>\\n[#ITEM] \{\
4688 . rm $TITLE_\\n+[#ITEM]
4695 . while \\n[#NUM_ARGS]>\\n[#TITLE_NUM] \{\
4696 . ds $TITLE_\\n+[#TITLE_NUM] \\$\\n[#TITLE_NUM]
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] \
4708 . if \\n[#\\*[COVER_]SUBTITLE_NUM] \{\
4710 . while \\n[#\\*[COVER_]SUBTITLE_NUM]>\\n[#ITEM] \{\
4711 . rm $\\*[COVER_]SUBTITLE_\\n+[#ITEM]
4713 . rr #\\*[COVER_]SUBTITLE_NUM
4718 . if '\\$1'DOC_COVER' \{\
4719 . ds COVER_ DOC_COVER_
4722 . if '\\$1'COVER' \{\
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]
4736 .MAC CHAPTER END \"If document is a chapter, the chapter number
4737 . nr #CHAPTER_CALLED 1
4739 . if \B'\\*[$CHAPTER]' .nr #CH_NUM \\*[$CHAPTER]
4740 . if !r #CH_NUM .nr #CH_NUM 1
4743 .MAC CHAPTER_NUMBER END
4747 .MAC CHAPTER_TITLE END \" This defines what comes after Chapter #
4748 . ie \\n[#NUM_ARGS]=0 \{\
4749 . if \\n[#CHAPTER_TITLE_NUM] \{\
4751 . while \\n[#CHAPTER_TITLE_NUM]>\\n[#ITEM] \{\
4752 . rm $CHAPTER_TITLE_\\n+[#ITEM]
4754 . rr #CHAPTER_TITLE_NUM
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]
4765 . ds $CHAPTER_TITLE \\$*
4769 .MAC DRAFT END \"Draft number
4770 . ie '\\$1'' .ds $DRAFT
4771 . el .ds $DRAFT " \\$1
4774 .MAC REVISION END \"Revision number
4778 .MAC DRAFT_WITH_PAGENUMBER END \"Attach draft/revision strings to page number
4779 . nr #DRAFT_WITH_PAGENUM 1
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_
4788 . if '\\$1'COVER' \{\
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]]'' \
4798 "\\*[$\\*[COVER_]AUTHOR_\\n[#\\*[COVER_]AUTHOR_NUM]], \"
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
4807 .ALIAS EDITOR AUTHOR
4809 .MAC COPYRIGHT END \"For use on cover pages only
4810 . ie \\n[#NUM_ARGS]=1 \
4811 . ds $COVER_COPYRIGHT \[co]\\$1
4813 . if '\\$1'DOC_COVER' .ds $DOC_COVER_COPYRIGHT \[co]\\$2
4816 .MAC COPYRIGHT_V_ADJUST END
4817 . ds $COPYRIGHT_V_ADJ \\$1
4820 .MAC MISC END \"Doc cover and cover pages only; enclose all args in double quotes
4822 . ie \\n[#NUM_ARGS]=0 \{\
4823 . if \\n[#DOC_COVER_MISC_LINES] \
4824 . ds COVER_ DOC_COVER_
4825 . if \\n[#COVER_MISC_LINES] \
4827 . if \\n[#\\*[COVER_]MISC_LINES] \{\
4829 . while \\n[#\\*[COVER_]MISC_LINES]>\\n[#LINE] \{\
4830 . rm $\\*[COVER_]MISC_\\n+[#LINE]
4832 . rr #\\*[COVER_]MISC_LINES
4836 . if '\\$1'DOC_COVER' \{\
4837 . ds COVER_ DOC_COVER_
4840 . if '\\$1'COVER' \{\
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]]
4849 . nr #\\*[COVER_]MISC_LINES \\n[#NUM_ARGS]
4854 \# Page number that appears on page one.
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
4862 \# Replacement string for pagenumber.
4863 .MAC PAGENUMBER_STRING END
4864 . ds $PAGENUM_STRING \\$1
4867 \# ====================================================================
4869 \# +++TYPE OF DOCUMENT+++
4874 \# DEFAULT | CHAPTER | NAMED "<whatever> | LETTER
4876 \# Creates strings and sets registers for document types.
4878 \# Number registers: DEFAULT=1, CHAPTER=2, NAMED=3, LETTER=4
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
4888 . if '\\$1'LETTER' \{\
4894 . nr #FOOTER_ADJ \\n[.v]
4897 . INDENT_FIRST_PARAS
4899 . ds $SUITE \En[#SUITE]
4900 . HEADER_MARGIN 3P+6p
4906 . FOOTER_RIGHT_SIZE +0
4907 . FOOTER_RIGHT "\&.../\E*[$SUITE]
4908 . FOOTER_ON_FIRST_PAGE
4911 . if '\\$1'SLIDES' \{\
4914 . PRINTSTYLE TYPESET
4917 . QUOTE_STYLE QUAD CENTER
4918 . BLOCKQUOTE_STYLE \
4935 . PAGENUM_HYPHENS off
4941 . nr loop-counter \\n[#NUM_ARGS]
4942 .\" Default 16:9 setup if no ASPECT
4943 . PAGE 11i 6.1875i 36p 36p 80p 72p
4947 . while \\n+[loop-count]<=\\n[loop-counter] \{\
4948 . if '\\$1'ASPECT' \{\
4950 . PAGE 11i 8.25i 36p 36p 90p 84p
4955 . if '\\$2'16:9' \{\
4956 . PAGE 11i 6.1875i 36p 36p 80p 72p
4963 . if '\\$1'HEADER' \{\
4965 . nr #SLIDE_HEADERS 1
4966 . ds $SLIDE_HDR_L \\$1
4967 . ds $SLIDE_HDR_C \\$2
4968 . ds $SLIDE_HDR_R \\$3
4972 . if '\\$1'FOOTER' \{\
4974 . nr #SLIDE_FOOTERS 1
4975 . ds $SLIDE_FTR_L \\$1
4976 . ds $SLIDE_FTR_C \\$2
4977 . ds $SLIDE_FTR_R \\$3
4980 . if '\\$1'TRANSITION' \{\
4982 . ds $TRANS_TYPE \\$1
4985 . if '\\$1'PAUSE' \{\
4987 . ds $PAUSE_TYPE \\$1
4991 . if d $TRANS_TYPE \
4992 . pdftransition PAGE \\*[$TRANS_TYPE]
4993 . if d $PAUSE_TYPE \
4994 . pdftransition BLOCK \\*[$PAUSE_TYPE]
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]^"
5001 . if \\n[#SLIDE_HEADERS] \{\
5003 . HEADER_RECTO L "^\\*[$SLIDE_HDR_L]#\\*[$SLIDE_HDR_C]#\\*[$SLIDE_HDR_R]^" \
5005 . if \\n[#SLIDE_FOOTERS] \{\
5007 . FOOTER_RECTO L "^\\*[$SLIDE_FTR_L]#\\*[$SLIDE_FTR_C]#\\*[$SLIDE_FTR_R]^"
5012 \# +++LETTER MACROS+++
5014 \# First, create a register to hold incrementing numbers to be
5015 \# appended to LETTERHEAD.
5024 \# Stores date (entered on the line after .DATE) in diversion
5028 . if !'\\n[.z]'' .di
5029 . di LETTERHEAD\\n+[#FIELD]
5030 . ie \\n[#FIELD]=1 \{\
5042 \# Stores addressee address (entered on the line after .TO) in
5043 \# diversion LETTERHEAD<n>
5046 . if !'\\n[.z]'' .di
5047 . di LETTERHEAD\\n+[#FIELD]
5056 \# Stores addresser address (entered on the line after .FROM) in
5057 \# diversion LETTERHEAD<n>
5060 . if !'\\n[.z]'' .di
5061 . di LETTERHEAD\\n+[#FIELD]
5070 \# Stores greeting (entered on the line after .GREETING) in
5071 \# diversion LETTERHEAD<n>
5074 . if !'\\n[.z]'' .di
5075 . di LETTERHEAD\\n+[#FIELD]
5084 \# Stores greeting in diversion CLOSING.
5087 . if '\\*[$SIG_SPACE]'' .ds $SIG_SPACE 3v
5088 . ie ( (2v+\\*[$SIG_SPACE]) > \\n[.t] ) \{\
5093 . tm1 "[mom]: Insufficient room for \\$0 and signature line.
5094 . ab [mom]: Terminating '\\n[.F]' before closing.
5106 \# <amount to indent closing from left margin>
5108 \# Defines string $CLOSE_INDENT for use in macro, ALL_DONE.
5110 .MAC CLOSING_INDENT END
5111 . ds $CLOSE_INDENT \\$1
5117 \# <amount of space to leave for signature>
5119 \# Defines string $SIG_SPACE for use in macro, ALL_DONE.
5121 .MAC SIGNATURE_SPACE END
5122 . ds $SIG_SPACE \\$1
5130 \# Redefines $FOOTER_RIGHT to blank so that a suite number doesn't
5131 \# appear at the bottom of letter pages.
5137 \# ====================================================================
5139 \# +++DEFAULTS FOR DOCUMENT PROCESSING+++
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.
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
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
5172 . ds PARAM SIZE_CHANGE
5173 . ds ELEMENT \\$0_CHANGE
5174 . if '\\$0'CODE_SIZE' \{\
5176 . ds ELEMENT \\$0_ADJ
5178 . if '\\$0'COPYRIGHT_SIZE' \
5179 . ds ELEMENT COVER_COPYRIGHT_SIZE_CHANGE
5180 . ds FROM_ALIAS \\$0
5181 . ASSIGN_ELEMENT \\$1
5185 . if \\n[#PRINT_STYLE]=1 .return
5188 . if '\\$0'COPYRIGHT_COLOR' \
5189 . ds ELEMENT COVER_COPYRIGHT_COLOR
5190 . ds FROM_ALIAS \\$0
5191 . ASSIGN_ELEMENT \\$1
5196 . substring CAPS_TYPE 0 7
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
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
5210 . ie '\\$0'TOC_HEADER_NO_CAPS' .rr #TOC_STRING_CAPS
5212 . ds REGISTER_TYPE \\$0
5213 . substring REGISTER_TYPE 0 -8
5214 . as REGISTER_TYPE CAPS
5215 . rr #\\*[REGISTER_TYPE]
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
5229 .ALIAS _NO_CAPS _CAPS
5232 . ds SMALLCAPS_TYPE \\$0
5233 . substring SMALLCAPS_TYPE 0 7
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
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
5247 . ie '\\$0'TOC_HEADER_NO_SMALLCAPS' .rr #TOC_STRING_SMALLCAPS
5249 . ds REGISTER_TYPE \\$0
5250 . substring REGISTER_TYPE 0 -13
5251 . as REGISTER_TYPE SMALLCAPS
5252 . rr #\\*[REGISTER_TYPE]
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
5266 .ALIAS _NO_SMALLCAPS _SMALLCAPS
5269 . if '\\$0'BIBLIOGRAPHY_QUAD' \{\
5270 . if '\\$1'R' .QUAD-ERROR \\$0
5271 . if '\\$1'C' .QUAD-ERROR \\$0
5273 . if '\\$0'ENDNOTE_QUAD' \{\
5274 . if '\\$1'R' .QUAD-ERROR \\$0
5275 . if '\\$1'C' .QUAD-ERROR \\$0
5277 . if '\\$0'DOC_QUAD' \
5278 . if !\\n[#DOCS] .DOC_MACRO_ERROR \\$0
5281 . if '\\$0'COPYRIGHT_QUAD' \
5282 . ds ELEMENT COVER_COPYRIGHT_QUAD
5283 . ds FROM_ALIAS \\$0
5284 . ASSIGN_ELEMENT \\$1
5287 \# Special handling for QUOTE quadding
5291 . substring $Q_QUAD 6
5294 .ALIAS QUOTE_LEFT QUOTE_QUAD
5295 .ALIAS QUOTE_CENTER QUOTE_QUAD
5296 .ALIAS QUOTE_RIGHT QUOTE_QUAD
5299 . tm1 "[mom]: \\$1 at line \\n[.c] of '\\n[.F]' must be set to either L or J.
5300 . ab [mom]: Aborting.
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
5319 . if !\\n[hdrftr-pos-element] \{\
5320 . ds c1-c5 \\*[ELEMENT]
5321 . substring c1-c5 0 4 \" Grab first five letters of the alias
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
5337 . ds $\\*[ELEMENT] \\$1
5338 . nr #\\*[ELEMENT] 1
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
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
5359 . rr hdrftr-pos-element
5360 . rm hdrftr-pos-element
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
5370 . ds ELEMENT \\*[FROM_ALIAS]
5371 . substring ELEMENT 12 \\n[substr-index]
5372 . if '\\*[ELEMENT]'_HEADER_' \
5373 . ds ELEMENT _STRING_
5375 . if '\\$1'BQUOTE_' .rm ELEMENT
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_' \
5384 . if '\\$1'EPI_' .rm ELEMENT
5385 . if '\\$1'FN_' .rm ELEMENT
5386 . if '\\$1'HDRFTR_' \{\
5387 . if '\\*[ELEMENT]'HDRFTR_FAM' \{\
5389 . ds $HDRFTR_FAM \\$2
5390 . ds $HDRFTR_LEFT_FAM \\$2
5391 . ds $HDRFTR_CENTER_FAM \\$2
5392 . ds $HDRFTR_RIGHT_FAM \\$2
5394 . if '\\*[ELEMENT]'HDRFTR_COLOR' \{\
5396 . nr #HDRFTR_COLOR 1
5397 . ds $HDRFTR_COLOR \\$2
5399 . if '\\*[ELEMENT]'HDRFTR_SIZE_CHANGE' \{\
5401 . ds $HDRFTR_SIZE_CHANGE \\$2
5403 . if '\\*[PARAM]'SIZE_CHANGE' \{\
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
5413 . substring ELEMENT 7 \\n[substr-index]
5414 . if '\\*[ELEMENT]'_LEFT' .ds ELEMENT _STRING_
5417 . if '\\$1'LN_' .rm ELEMENT
5418 . if '\\$1'PAGE_NUM_' .rm ELEMENT
5420 . ds $\\$1\\*[ELEMENT]\\*[PARAM] \\$2
5421 . nr #\\$1\\*[ELEMENT]\\*[PARAM] 1
5424 . rm hdrftr-pos-element
5432 . substring $TYPE 0 2
5433 . if '\\*[$TYPE]'DOC' .nr DOC_ 1
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
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.
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
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]
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
5477 . nr #STYLE_PARAMS \\n[#NUM_ARGS]
5478 . while \\n+[#LOOP]<=\\n[#STYLE_PARAMS] \{\
5479 . if '\\$1'FAMILY' \{\
5481 . \\*[$STYLE_TYPE]_FAMILY \\$1
5484 . if '\\$1'FONT' \{\
5486 . \\*[$STYLE_TYPE]_FONT \\$1
5489 . if '\\$1'SIZE' \{\
5491 . \\*[$STYLE_TYPE]_SIZE \\$1
5494 . if '\\$1'COLOR' \{\
5496 . \\*[$STYLE_TYPE]_COLOR \\$1
5499 . if '\\$1'CAPS' \{\
5500 . if \\n[#\\*[$STYLE_TYPE]_SMALLCAPS] \{\
5502 "[mom]: '\\*[$STYLE_TYPE]_STYLE' contains CAPS and SMALLCAPS. \
5503 CAPS takes precedence.
5504 . rr #\\*[$STYLE_TYPE]_SMALLCAPS
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
5513 . if '\\$1'NO_CAPS' \{\
5514 . nr #\\*[$STYLE_TYPE]_CAPS 0
5515 . if !'\\*[$BIB-EN-TOC]'' \
5516 . rr #\\*[$BIB-EN-TOC]_CAPS
5519 . if '\\$1'SMALLCAPS' \{\
5520 . if \\n[#\\*[$STYLE_TYPE]_CAPS] \{\
5522 "[mom]: '\\*[$STYLE_TYPE]_STYLE' contains CAPS and SMALLCAPS. \
5523 SMALLCAPS takes precedence.
5524 . rr #\\*[$STYLE_TYPE]_CAPS
5526 . \\*[$STYLE_TYPE]_SMALLCAPS
5529 . if '\\$1'NO_SMALLCAPS' \{\
5530 . rr #\\*[$STYLE_TYPE]_SMALLCAPS
5531 . if !'\\*[$BIB-EN-TOC]'' \
5532 . rr #\\*[$BIB-EN-TOC]_SMALLCAPS
5535 . if '\\$1'LEAD' \{\
5537 . \\*[$STYLE_TYPE]_LEAD \\$1
5540 . if '\\$1'AUTOLEAD' \{\
5542 . \\*[$STYLE_TYPE]_AUTOLEAD \\$1
5545 . if '\\$1'SPACE' \{\
5547 . \\*[$STYLE_TYPE]_SPACE \\$1
5550 . if '\\$1'QUAD' \{\
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
5559 . el .\\*[$STYLE_TYPE]_QUAD \\$1
5562 . if '\\$1'INDENT' \{\
5564 . \\*[$STYLE_TYPE]_INDENT \\$1
5567 .\" UNDERLINE and UNDERSCORE are identical but we can't use : or &
5568 .\" in string comparisons.
5569 . if '\\$1'UNDERLINE' \{\
5571 . if '\\$1'DOUBLE' \{\
5572 . as ul-args \\$1 \"
5576 . while \\n+[#COUNT]<=3 \{\
5578 . as ul-args \\$1 \"
5582 . \\*[$STYLE_TYPE]_UNDERSCORE \\*[ul-args]
5584 . if '\\$1'UNDERSCORE' \{\
5586 . if '\\$1'DOUBLE' \{\
5587 . as ul-args \\$1 \"
5591 . while \\n+[#COUNT]<=3 \{\
5593 . as ul-args \\$1 \"
5597 . \\*[$STYLE_TYPE]_UNDERSCORE \\*[ul-args]
5599 . if '\\$1'NO_UNDERSCORE' \{\
5600 . rr #\\*[$STYLE_TYPE]_UNDERLINE
5601 . if !'\\*[$BIB-EN-TOC]'' \
5602 . rr #\\*[$BIB-EN-TOC]_UNDERLINE
5605 . if '\\$1'NO_UNDERLINE' \{\
5606 . rr #\\*[$STYLE_TYPE]_UNDERLINE
5607 . if !'\\*[$BIB-EN-TOC]'' \
5608 . rr #\\*[$BIB-EN-TOC]_UNDERLINE
5611 . if '\\$1'V_ADJUST' \{\
5613 . COPYRIGHT_V_ADJUST \\$1
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
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
5674 \# UNDERLINE CONTROL
5675 \# -----------------
5677 \# [ DOUBLE ] [ <underline weight> [<underline gap>] ] | <none> | <anything>
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.
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]
5693 .\" Called as _UNDERSCORE
5694 . ds $GET_TITLE_TYPE \\$0
5695 . substring $GET_TITLE_TYPE 0 -11
5696 . ds $TITLE_TYPE \\*[$GET_TITLE_TYPE]
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
5711 . ie \\n[#NUM_ARGS]=1 \{\
5713 . if !\\n[#PRINT_STYLE]=1 \{\
5714 . \\*[$TITLE_TYPE]UNDERLINE_WEIGHT \\$1
5715 . nr #\\*[$TITLE_TYPE]UNDERLINE 1
5719 . ie '\\$1'DOUBLE' .nr #\\*[$TITLE_TYPE]UNDERLINE 2
5720 . el .nr #\\*[$TITLE_TYPE]UNDERLINE 0
5724 . if !\\n[#PRINT_STYLE]=1 \{\
5725 . nr #\\*[$TITLE_TYPE]UNDERLINE 1
5726 . if '\\$1'DOUBLE' \{\
5727 . nr #\\*[$TITLE_TYPE]UNDERLINE 2
5730 . \\*[$TITLE_TYPE]UNDERLINE_WEIGHT \\$1
5732 . ds $\\*[$TITLE_TYPE]UNDERLINE_GAP \\$2
5734 . ds $\\*[$TITLE_TYPE]RULE_GAP \\$3
5741 .ALIAS ENDNOTE_STRING_UNDERLINE _UNDERLINE
5742 .ALIAS ENDNOTE_STRING_UNDERSCORE _UNDERLINE
5749 \# Sets up defaults if no values are entered prior to START.
5751 \# The defaults for $CHAPTER_STRING, $DRAFT_STRING, and
5752 \# $REVISION_STRING are in the COPYSTYLE macro.
5755 . if !\\n[#DOC_TYPE]=5 \{\
5756 . ie !d $PAPER .PAPER LETTER
5757 . el .PAPER \\*[$PAPER]
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]
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
5771 . if \\n[#PRINT_STYLE]=1 .PRINTSTYLE TYPEWRITE SINGLESPACE
5773 . if \\n[#COPY_STYLE]=1 \{\
5777 . if !r #DOC_HEADER .DOCHEADER
5778 . if !r #HEADERS_ON .HEADERS
5779 . if !r #PAGINATE .PAGINATE
5781 . if !r #HEADER_MARGIN .HEADER_MARGIN 4P+6p
5782 . if !r #HEADER_GAP .HEADER_GAP 3P
5784 . if \\n[#FOOTERS_ON] \{\
5786 . ie \\n[#PAGINATE] \
5787 . if \\n[#PAGE_NUM_POS_SET]=0 .PAGENUM_POS TOP CENTER
5789 . if !\\n[#T_MARGIN] .T_MARGIN 6P
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]
5797 . el .if !r #T_MARGIN .T_MARGIN 6P
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
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]
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]
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] \{\
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
5844 . ie \\n[#ADJ_DOC_LEAD]=1 .
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
5851 . el .ds $DOC_QUAD \\*[$QUAD_VALUE]
5852 . if '\\*[$FONT]'' .FT R
5853 . if '\\*[$PP_FT]'' .ds $PP_FT \\*[$FONT]
5859 . nr #FN_COUNT_FOR_COLS 0 1
5861 .\" Enable shimming if user hasn't turned it off
5862 . if \\n[#NO_SHIM]=2 \{\
5866 .\" General style defaults for both PRINTSTYLEs
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
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
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]
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]"
5915 . ie '\\*[$CHAPTER]'' .ENDNOTE_TITLE "\\*[$CHAPTER_STRING]"
5916 . el .ENDNOTE_TITLE "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"
5919 . el .ENDNOTE_TITLE "\\*[$TITLE]"
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
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]
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
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
5961 . if !\\n[PDFHREF_COLOR_SET] .PDF_LINK_COLOR 0.0 0.3 0.9
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
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]
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]
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]
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
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 \{\
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
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)
6036 . if !r #EPI_OFFSET_VALUE \
6037 . if '\\*[$EPI_OFFSET_VALUE]'' .EPIGRAPH_INDENT 2
6039 . if !d $LINEBREAK_CHAR .LINEBREAK_CHAR * 3 2p
6041 . if !d $FN_SIZE_CHANGE .FOOTNOTE_SIZE +0
6042 . if !r #FN_RULE_LENGTH .FOOTNOTE_RULE_LENGTH 2i
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
6048 . if !r #FN_RULE_ADJ .FOOTNOTE_RULE_ADJ 6p
6050 . if !r #SLANT_MEANS_SLANT \{\
6051 . ie \\n[#UNDERLINE_SLANT]=1 .UNDERLINE_SLANT
6052 . el .UNDERLINE_SLANT OFF
6055 . if !r #BIB_STRING_UNDERLINE .nr #BIB_STRING_UNDERLINE 2
6056 . if !r #BIB_STRING_CAPS .BIBLIOGRAPHY_STRING_CAPS
6058 .\" Defaults for printstyle TYPESET
6059 . if \\n[#PRINT_STYLE]=2 \{\
6060 . if !d $DOCHEADER_LEAD_ADJ .DOCHEADER_LEAD +0
6062 . if !d $COVER_LEAD_ADJ .COVER_LEAD +0
6063 . if !d $COVER_FAM .COVER_FAMILY \\*[$DOC_FAM]
6065 . if !d $COVER_TITLE_FAM \{\
6066 . ie !d $COVER_FAM .COVER_TITLE_FAMILY \\*[$DOC_FAM]
6067 . el .COVER_TITLE_FAMILY \\*[$COVER_FAM]
6069 . if !d $COVER_TITLE_FT .COVER_TITLE_FONT B
6070 . if !d $COVER_TITLE_SIZE_CHANGE .COVER_TITLE_SIZE +3.5
6072 . if !d $COVER_DOCTITLE_FAM \{\
6073 . ie !d $DOC_COVER_FAM .COVER_DOCTITLE_FAMILY \\*[$DOC_FAM]
6074 . el .COVER_DOCTITLE_FAMILY \\*[$COVER_FAM]
6076 . if !d $COVER_DOCTITLE_FT .COVER_DOCTITLE_FONT B
6077 . if !d $COVER_DOCTITLE_SIZE_CHANGE .COVER_DOCTITLE_SIZE +3.5
6079 . if !d $COVER_COVERTITLE_FAM \{\
6080 . ie !d $COVER_FAM .COVER_COVERTITLE_FAMILY \\*[$DOC_FAM]
6081 . el .COVER_COVERTITLE_FAMILY \\*[$COVER_FAM]
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]
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
6093 . if !d $COVER_CHAPTER_FAM \{\
6094 . ie !d $COVER_FAM .COVER_CHAPTER_FAMILY \\*[$DOC_FAM]
6095 . el .COVER_CHAPTER_FAMILY \\*[$COVER_FAM]
6097 . if !d $COVER_CHAPTER_FT .COVER_CHAPTER_FONT B
6098 . if !d $COVER_CHAPTER_SIZE_CHANGE .COVER_CHAPTER_SIZE +3.5
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]
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
6107 . if !d $COVER_SUBTITLE_FAM \{\
6108 . ie !d $COVER_FAM .COVER_SUBTITLE_FAMILY \\*[$DOC_FAM]
6109 . el .COVER_SUBTITLE_FAMILY \\*[$COVER_FAM]
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]
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]
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]
6131 . if !d $COVER_DOCTYPE_FT .COVER_DOCTYPE_FONT BI
6132 . if !d $COVER_DOCTYPE_SIZE_CHANGE .COVER_DOCTYPE_SIZE +3
6134 . if !d $COVER_COPYRIGHT_FAM \{\
6135 . ie !d $COVER_FAM .COVER_COPYRIGHT_FAMILY \\*[$DOC_FAM]
6136 . el .COVER_COPYRIGHT_FAMILY \\*[$COVER_FAM]
6138 . if !d $COVER_COPYRIGHT_FT .COVER_COPYRIGHT_FONT R
6139 . if !d $COVER_COPYRIGHT_SIZE_CHANGE .COVER_COPYRIGHT_SIZE -2
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
6146 . if !d $DOC_COVER_LEAD_ADJ .DOC_COVER_LEAD +0
6147 . if !d $DOC_COVER_FAM .DOC_COVER_FAMILY \\*[$DOC_FAM]
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]
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
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]
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
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]
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]
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
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]
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
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]
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
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]
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]
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]
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]
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
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]
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
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
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]
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
6241 . if !d $CHAPTER_FAM \{\
6242 . ie !d $DOCHEADER_FAM .CHAPTER_FAMILY \\*[$DOC_FAM]
6243 . el .CHAPTER_FAMILY \\*[$DOCHEADER_FAM]
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]
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]
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]
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]
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]
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
6305 . if \\n[#HDRFTR_RIGHT_CAPS]=0 \
6306 . if !d $HDRFTR_RIGHT_SIZE_CHANGE \
6307 . HDRFTR_RIGHT_SIZE -.5
6309 . ie !\\n[#HDRFTR_RIGHT_SMALLCAPS] \{\
6310 . if \\n[#HDRFTR_RIGHT_CAPS] \
6311 . if !d $HDRFTR_RIGHT_SIZE_CHANGE \
6312 . HDRFTR_RIGHT_SIZE -2
6315 . nr #SKIP_CAPS_SMALLCAPS_WARNING 1
6316 . if \\n[#HDRFTR_RIGHT_CAPS] .HDRFTR_RIGHT_CAPS OFF
6318 . if !d $HDRFTR_RIGHT_SIZE_CHANGE .HDRFTR_RIGHT_SIZE -.5
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
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
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
6344 . if !d $LINEBREAK_CHAR .LINEBREAK_CHAR * 3 3p
6345 . if !d $LINEBREAK_COLOR .LINEBREAK_COLOR black
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
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
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]
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
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
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
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
6402 . if \\n[#AUTO_LEAD] \{\
6403 . nr #RESTORE_AUTO_LEAD 1
6404 . nr #SAVED_AUTOLEAD_VALUE \\n[#AUTOLEAD_VALUE]
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
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
6416 . nr #FN_LEAD \\n[#LEAD]
6419 . if \\n[#RESTORE_AUTO_LEAD] \{\
6421 . nr #AUTOLEAD_VALUE \\n[#SAVED_AUTOLEAD_VALUE]
6423 . if !\\n[#SKIP_TRAPS] .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
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
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
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]
6458 . ie !d $BIB_SPACE .BIBLIOGRAPHY_SPACING 0
6460 . if \\n[#DEFER_BIB_SPACING]=1 \{\
6461 . BIBLIOGRAPHY_SPACING \\*[$BIB_SPACE]
6462 . rr #DEFER_BIB_SPACING
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] \{\
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]
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]'' \{\
6489 \\*[$MN-arg1] \\*[$MN-arg2] \
6490 \\*[$MN-arg3] \\*[$MN-arg4] \
6491 \\*[$MN-arg5] \\*[$MN-arg6] \
6492 \\*[$MN-arg7] \\*[$MN-arg8] \
6495 . if \\n[#PRINT_STYLE]=1 .nr #IGNORE 1
6496 . if \\n[#AUTO_LEAD] \{\
6498 . rr #AUTOLEAD_VALUE
6502 \# =================================================================
6504 \# Macros and aliases needed for doccover, cover, and docheader in
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
6520 .ALIAS COVER_H_POS DOC_HEADER_QUAD
6521 .ALIAS DOC_COVER_H_POS DOC_HEADER_QUAD
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' \{\
6530 . nr #\\*[DOC_]COVER_SUB 1
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]
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
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
6553 . if \\n[#\\*[DOC_]COVER_SUB] \{\
6554 . rr #\\*[DOC_]COVER_SUB
6555 . ds $PRFX \\*[DOC_]COVER_SUB
6556 . ds $SAVED_COVER_TYPE \\*[$COVER_TYPE]
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]]
6571 . ie !\\n[#PRINT_STYLE]=1 \
6572 . UNDERSCORE "\\*[$\\*[$PRFX]\\*[$TTL_AUTH]_\\n[#ARG_NUM]]
6573 . el .PRINT "\\*[$\\*[$PRFX]\\*[$TTL_AUTH]_\\n[#ARG_NUM]]
6577 . PRINT "\\*[$\\*[$PRFX]\\*[$TTL_AUTH]_\\n[#ARG_NUM]]
6579 . if \\n[#ARG_NUM]>1 .as PDF_BM " \"
6580 . as PDF_BM \\*[$\\*[$PRFX]\\*[$TTL_AUTH]_\\n[#ARG_NUM]]
6583 . if \\n[#PRINT_STYLE]=2 .vs
6584 . if \\n[#\\*[$COVER_TYPE]\\*[$PRFX]\\*[$TTL_AUTH]_COLOR]=1 \
6589 . if !'\\*[$SAVED_COVER_TYPE]'' \{\
6590 . ds $COVER_TYPE \\*[$SAVED_COVER_TYPE]
6591 . rm $SAVED_COVER_TYPE
6595 .ALIAS DO_TITLE DO_TITLE_OR_AUTHOR
6596 .ALIAS DO_SUBTITLE DO_TITLE_OR_AUTHOR
6597 .ALIAS DO_AUTHORS DO_TITLE_OR_AUTHOR
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]"
6614 . el .PRINT "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"
6620 .ALIAS DO_TITLE DO_TITLE_OR_AUTHOR
6621 .ALIAS DO_SUBTITLE DO_TITLE_OR_AUTHOR
6622 .ALIAS DO_AUTHORS DO_TITLE_OR_AUTHOR
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]"
6639 . el .PRINT "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"
6645 \# Spacing adjustments for (doc)cover and docheader elements
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
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
6664 .MAC DEFAULT_DOCHEADER END
6667 . vs \\n[#DOCHEADER_LEAD]u
6668 . if \\n[#PRINT_STYLE]=2 \
6669 . if \\n[#DOCHEADER_COLOR]=1 \
6670 . COLOR \\*[$DOCHEADER_COLOR]
6673 . if !'\\*[$SUBTITLE_1]'' \{\
6675 . if !'\\*[$SUBTITLE_SPACER]'' .sp \\*[$SUBTITLE_SPACER]
6676 . if \\n[#PRINT_STYLE]=2 \
6677 . if \\n[#DOCHEADER_COLOR]=1 \
6678 . COLOR \\*[$DOCHEADER_COLOR]
6682 . if !\\n[#NO_PRINT_AUTHOR] \{\
6683 . if !'\\*[$AUTHOR_1]'' \{\
6684 . ie \\n[#PRINT_STYLE]=1 \{\
6686 . ie \\n[#SINGLE_SPACE]=1 .vs \\n[#DOC_LEAD]u
6687 . el .vs \\n[#DOC_LEAD]u/2u
6690 . el .vs \\n[#DOC_LEAD]u\\*[$DOCHEADER_LEAD_ADJ]
6691 . if d$ATTRIBUTE_STRING \{\
6692 . FAMILY \\*[$ATTRIBUTE_FAM]
6693 . FT \\*[$ATTRIBUTE_FT]
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]"
6710 . el .PRINT "\\*[$ATTRIBUTE_STRING]"
6711 . if \\n[#ATTRIBUTE_COLOR]=1 .gcolor
6714 . if !'\\*[$AUTHOR_SPACER]'' .sp \\*[$AUTHOR_SPACER]
6715 . if \\n[#DOCHEADER_COLOR]=1 \
6716 . COLOR \\*[$DOCHEADER_COLOR]
6720 . FAMILY \\*[$DOC_FAM]
6724 .MAC DEFAULT_DOCHEADER_TYPEWRITE END
6727 . if !\\n[#SINGLE_SPACE] \{\
6728 . vs \\n[#DOC_LEAD]u/2u
6729 . sp |\\n[#T_MARGIN]u-1v
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)
6740 . if !'\\*[$SUBTITLE]'' \{\
6746 . if !\\n[#NO_PRINT_AUTHOR] \{\
6747 . if !'\\*[$AUTHOR_1]'' \{\
6749 . if d$ATTRIBUTE_STRING .PRINT "\\*[$ATTRIBUTE_STRING]
6756 .MAC CHAPTER_DOCHEADER END
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]'' \{\
6775 .\" Chapter string, possibly with a chapter title
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]
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]"
6791 . el .PRINT "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"
6793 . if \\n[#PRINT_STYLE]=2 \
6794 . if \\n[#CHAPTER_COLOR]=1 .gcolor
6796 . if !'\\*[$CHAPTER_TITLE_1]'' \{\
6798 . if \\n[#PRINT_STYLE]=2 \{\
6799 . nr #CHAPTER+TITLE 1
6800 . if \\n[#DOCHEADER_COLOR]=1 \
6801 . COLOR \\*[$DOCHEADER_COLOR]
6803 . if !'\\*[$CHAPTER_TITLE_SPACER]'' \
6804 . sp \\*[$CHAPTER_TITLE_SPACER]
6808 . RLD \\n[#DOC_LEAD]u \" Just looks better this way
6811 . FAMILY \\*[$DOC_FAM]
6815 .MAC CHAPTER_DOCHEADER_TYPEWRITE END
6818 . if !\\n[#SINGLE_SPACE] \{\
6819 . vs \\n[#DOC_LEAD]u/2u
6820 . sp |\\n[#T_MARGIN]u-1v
6822 . ie '\\*[$CHAPTER]'' \{\
6824 . ie !'\\*[$CHAPTER_TITLE]'' \{\
6825 . vs \\n[.v]u+(\\n[.v]u/3u)
6827 . while \\n[#CHAPTER_TITLE_NUM]>=\\n+[#ARG_NUM] \{\
6828 . UNDERSCORE 3p "\\*[$CHAPTER_TITLE_\\n[#ARG_NUM]]"
6834 . UNDERSCORE 3p "\\*[$CHAPTER_STRING]"
6841 . UNDERSCORE 3p "\\*[$CHAPTER_STRING] \\*[$CHAPTER]
6843 . if !'\\*[$CHAPTER_TITLE]'' \{\
6846 . while \\n[#CHAPTER_TITLE_NUM]>=\\n+[#ARG_NUM] \{\
6847 . PRINT "\\*[$CHAPTER_TITLE_\\n[#ARG_NUM]]
6852 . vs \\n[#DOC_LEAD]u
6853 . if \\n[#SINGLE_SPACE] .sp 2
6856 .MAC NAMED_DOCHEADER END
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]
6877 . el .PRINT "\\*[$DOC_TYPE]
6881 . FAMILY \\*[$DOC_FAM]
6888 \# TITLE | DOCTITLE | CHAPTER | CHAPTER_TITLE | CHAPTER+TITLE | COVERTITLE \
6889 \# [ SUBTITLE AUTHOR DOCTYPE COPYRIGHT MISC BLANKPAGE PDF_OUTLINE_LABEL ]
6891 \# Toggles the number register for each cover page element
6892 \# passed as an argument.
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
6899 \# If called as DOC_COVER, performs the same operations, but
6900 \# applies everything to a doc cover.
6904 . ie '\\$0'DOC_COVER' \{\
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
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
6927 . if '\\$1'CHAPTER' \{\
6928 . nr #\\*[DOC_]COVER_TITLE 3
6931 . if '\\$1'CHAPTER_TITLE' \{\
6932 . nr #\\*[DOC_]COVER_TITLE 4
6935 . if '\\$1'CHAPTER+TITLE' \{\
6936 . nr #\\*[DOC_]COVER_TITLE 5
6939 . if '\\$1'COVERTITLE' \{\
6941 . nr #\\*[DOC_]COVER_TITLE 6
6944 . if '\\$1'DOC_COVERTITLE' \{\
6945 . nr #DOC_COVERTITLE 1
6946 . nr #\\*[DOC_]COVER_TITLE 7
6949 . if '\\$1'SUBTITLE' \{\
6950 . nr #\\*[DOC_]COVER_SUBTITLE 1
6953 . if '\\$1'AUTHOR' \{\
6954 . nr #\\*[DOC_]COVER_AUTHOR 1
6957 . if '\\$1'DOCTYPE' \{\
6958 . nr #\\*[DOC_]COVER_DOCTYPE 1
6961 . if '\\$1'COPYRIGHT' \{\
6962 . nr #\\*[DOC_]COVER_COPYRIGHT 1
6965 . if '\\$1'MISC' \{\
6966 . nr #\\*[DOC_]COVER_MISC 1
6969 . if '\\$1'\\*[DOC_]COVERTEXT' \{\
6970 . nr #\\*[DOC_]COVERTEXT 1
6973 . if '\\$1'\\*[DOC_]COVER_IMAGE' \{\
6974 . nr #\\*[DOC_]COVER_IMAGE 1
6977 . if '\\$1'PDF_OUTLINE_LABEL' \{\
6979 . ds $PDF_\\*[DOC_]COVER_LABEL \\$1
6982 . if '\\$1'BLANKPAGE' \{\
6983 . nr #\\*[DOC_]COVER_BLANKPAGE 1
6987 . if '\\$0'DOC_COVER' .rm DOC_
6995 \# Stores cover title in string(s) for output on cover pages.
6999 . if '\\$0'DOC_COVERTITLE' \{\
7001 . nr #FROM_\\*[DOC_]COVERTITLE 1
7003 . ie \\n[#NUM_ARGS]=0 \{\
7005 . while \\n+[argc]<=3 \{\
7006 . if \\n[#\\*[DOC_]COVER_TITLE_NUM] \{\
7008 . while \\n[#\\*[DOC_]COVERTITLE_NUM]>\\n[#ITEM] \{\
7009 . rm $\\*[DOC_]COVERTITLE_\\n+[#ITEM]
7011 . rr #\\*[DOC_]COVERTITLE_NUM
7012 . rm $\\*[DOC_]COVERTITLE
7017 . nr #\\*[DOC_]COVERTITLE_NUM 0 1
7018 . while \\n[#NUM_ARGS]>\\n[#\\*[DOC_]COVERTITLE_NUM] \{\
7020 $\\*[DOC_]COVERTITLE_\\n+[#\\*[DOC_]COVERTITLE_NUM] \\$\\n[#\\*[DOC_]COVERTITLE_NUM]
7021 . nr #\\*[DOC_]COVERTITLE_NUM \\n[#\\*[DOC_]COVERTITLE_NUM]
7023 . ds $\\*[DOC_]COVERTITLE \\$*
7027 .MAC COVER_ATTRIBUTE_STRING END
7028 . if '\\$0'DOC_COVER_ATTRIBUTE_STRING' \
7030 . ds $\\*[DOC_]COVER_ATTRIBUTE_STRING \\$1
7034 .ALIAS DOC_COVER_ATTRIBUTE_STRING COVER_ATTRIBUTE_STRING
7039 \# [ START <vertical pos> ] | <anything>
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.
7046 \# Aliased as DOC_COVERTEXT.
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.
7053 \# Does not persist.
7057 . if '\\$0'DOC_COVERTEXT' .ds DOC_ DOC_
7058 . if '\\$1'START' \{\
7060 . nr #\\*[DOC_]COVERTEXT_START_POS (u;\\$1)
7064 . nr #COVERTEXT_PP 1
7065 . di \\*[DOC_]COVER_TEXT
7067 \!. ie !\\n[#\\*[DOC_]COVERTEXT_START_POS] \{\
7068 \!. sp |\\n[.p]u/3u-1v
7073 \!. vs \\\\n[#DOC_LEAD]u+\\\\*[$\\*[DOC_]COVER_LEAD_ADJ]
7074 \!. sp |\\n[#\\*[DOC_]COVERTEXT_START_POS]u-1
7090 .ALIAS DOC_COVERTEXT COVERTEXT
7095 \# <image file> <width> <height> [ -L|-C|-R|-I <ind> Y-pos [ X-pos ] ]
7097 \# Places an image on doccovers and covers.
7099 \# Aliased as DOC_COVER_IMAGE.
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
7105 \# Positioning args are the same as PDF_IMAGE. -L, -R, -C and -I <ind>
7106 \# observe the left and right margins.
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.
7112 \# Note that Y-pos comes before X-pos in the args.
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)
7121 . if '\\$4'-L' .nr \\*[DOC_]COVER_IMG_IND \
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
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]
7132 . if \B'\\$5' .nr \\*[DOC_]COVER_IMG_Y (u;\\$5)
7135 . nr \\*[DOC_]COVER_IMG_Y (u;\\$4)
7136 . if \B'\\$5' .nr \\*[DOC_]COVER_IMG_X (u;\\$5)
7142 .ALIAS DOC_COVER_IMAGE COVER_IMAGE
7144 .MAC DO_COVER_IMAGE END
7145 . ll \\n[#PAGE_WIDTH]u
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
7153 . nop \X'pdf: pdfpic \\*[\\*[DOC_]COVER_IMG_FILE] -L \
7154 \\n[\\*[DOC_]COVER_IMG_W]z \\n[\\*[DOC_]COVER_IMG_H]z'
7161 .ALIAS DO_DOC_COVER_IMAGE DO_COVER_IMAGE
7163 \# COVER PAGE LEADING
7164 \# ------------------
7166 \# <+|- amount by which to in/decrease leading of cover/doc cover>
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).
7172 \# A unit of measure must be supplied. Decimal fractions OK.
7173 \# Default is +0, i.e. same as DOC_LEAD.
7176 . ie '\\$0'DOC_COVER_LEAD' .ds $DOC_COVER_LEAD_ADJ \\$1
7177 . el .ds $COVER_LEAD_ADJ \\$1
7180 \# MISC_AUTOLEAD functionality has been removed. Leading for MISCs
7181 \# is now entered as an absolute value. The macro emits a warning.
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.
7197 .ALIAS DOC_COVER_MISC_AUTOLEAD MISC_AUTOLEAD
7198 .ALIAS COVER_MISC_AUTOLEAD MISC_AUTOLEAD
7200 \# COVER PAGE START POSITION
7201 \# -------------------------
7203 \# <distance from page top at which to start cover/doc cover>
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).
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).
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)
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
7226 \# COVERS - WHETHER TO PRINT
7227 \# -------------------------
7229 \# <none> | <anything>
7231 \# Creates or removes registers #COVERS and #COVERS_OFF, checked for
7232 \# in DEFAULTS (in START) prior to printing
7235 . ie '\\$0'DOC_COVERS' \{\
7237 . rr #DOC_COVERS_OFF
7242 . nr #DOC_COVERS_OFF 1
7257 \# COVER_COUNTS_PAGES
7258 \# ------------------
7260 \# <none> | <anything>
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.
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
7272 . if '\\$0'COVER_COUNTS_PAGES' \{\
7273 . ie '\\$1'' .nr #COVERS_COUNT 1
7274 . el .rr #COVERS_COUNT
7284 . if \\n[#PAGINATE]=1 \{\
7285 . nr #PAGINATION_WAS_ON 1
7288 . if \\n[#HEADERS_ON]=1 \{\
7289 . nr #HEADERS_WERE_ON 1
7292 . if \\n[#FOOTERS_ON]=1 \{\
7293 . nr #FOOTERS_WERE_ON 1
7296 . if \\n[#COLUMNS]=1 \{\
7297 . nr #COLUMNS_WERE_ON 1
7301 . ie '\\$0'DO_DOC_COVER' \{\
7303 . nr #DOC_COVER_DONE 1
7304 . if '\\*[$PDF_DOC_COVER_LABEL]'' \
7305 . ds $PDF_DOC_COVER_LABEL Cover:
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]
7320 . if '\\$0'DO_COVER' \{\
7321 . if \\n[TOC.RELOCATE]==5 \
7322 . if !rTOC_BH .TOC_BEFORE_HERE
7324 . if '\\$0'DO_DOC_COVER' \{\
7325 . if \\n[TOC.RELOCATE]==3 \
7326 . if !rTOC_BH .TOC_BEFORE_HERE
7328 . RV_HARD_SET_MARGINS
7330 . if \\n[#\\*[DOC_]COVER_IMAGE]=1 \{\
7331 . DO_\\*[DOC_]COVER_IMAGE
7332 . rr #\\*[DOC_]COVER_IMAGE
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 \{\
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]]
7366 . PDF_BOOKMARK 1 \\*[$PDF_\\*[DOC_]COVER_LABEL] \\*[PDF_BM]
7369 . if \\n[#\\*[DOC_]COVER_TITLE]=3 \{\
7370 . ie \\n[#PRINT_STYLE]=1 \{\
7372 . UNDERSCORE "\\*[$CHAPTER_STRING] \\*[$CHAPTER]
7377 \\*[$PDF_\\*[DOC_]COVER_LABEL] \\*[$CHAPTER_STRING] \\*[$CHAPTER]
7378 . if \\n[#\\*[DOC_]COVER_CHAPTER_CAPS]=1 .CAPS off
7381 . if \\n[#\\*[DOC_]COVER_TITLE]=4 \{\
7382 . ie \\n[#PRINT_STYLE]=1 \{\
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]]
7400 . PDF_BOOKMARK 1 \\*[$PDF_\\*[DOC_]COVER_LABEL] \\*[PDF_BM]
7402 .\" Chapter + chapter title
7403 . if \\n[#\\*[DOC_]COVER_TITLE]=5 \{\
7404 . ie \\n[#PRINT_STYLE]=1 \{\
7406 . UNDERSCORE "\\*[$CHAPTER_STRING] \\*[$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
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]]
7421 . if \\n[#SINGLE_SPACE]=0 .vs \\n[#DOC_LEAD]u
7425 . if \\n[#PRINT_STYLE]=2 .nr #CHAPTER+TITLE 1
7426 . if !'\\*[$\\*[DOC_]COVER_CHAPTER_TITLE_SPACER]'' \
7427 . sp \\*[$\\*[DOC_]COVER_CHAPTER_TITLE_SPACER]
7433 . PDF_BOOKMARK 1 \\*[$PDF_\\*[DOC_]COVER_LABEL] \\*[PDF_BM]
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.
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 \{\
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]]
7482 . ds $PRFX \\*[DOC_]COVER
7486 . PDF_BOOKMARK 1 \\*[$PDF_\\*[DOC_]COVER_LABEL] \\*[PDF_BM]
7488 . ie !'\\*[DOC_]'' \
7489 . if !\\n[#DOC_COVER_TITLE] .PDF_BOOKMARK 1 Cover page
7491 . if !\\n[#COVER_TITLE] .PDF_BOOKMARK 1 Title page
7492 . rr #\\*[DOC_]COVER_TITLE
7494 . if \\n[#\\*[DOC_]COVER_SUBTITLE]=1 \{\
7495 . ie \\n[#PRINT_STYLE]=1 \{\
7496 . if !'\\*[$\\*[DOC_]COVER_SUBTITLE_1]'' \
7497 . ds $PRFX \\*[DOC_]COVER_
7500 . while \\n[#\\*[$PRFX]SUBTITLE_NUM]>=\\n+[#ARG_NUM] \{\
7501 . PRINT "\\*[$\\*[$PRFX]SUBTITLE_\\n[#ARG_NUM]]"
7506 . ie !'\\*[$\\*[DOC_]COVER_SUBTITLE_1]'' .ds $PRFX \\*[DOC_]COVER_SUB
7508 . if !'\\*[$\\*[DOC_]COVER_SUBTITLE_SPACER]'' \
7509 . sp \\*[$\\*[DOC_]COVER_SUBTITLE_SPACER]
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 \
7521 . ie !'\\*[$\\*[DOC_]COVER_AUTHOR_LEAD]'' \
7522 . vs \\*[$\\*[DOC_]COVER_AUTHOR_LEAD]
7523 . el .vs \\n[#\\*[DOC_]COVER_LEAD]u
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]
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]
7546 . el .PRINT "\\*[$\\*[DOC_]COVER_ATTRIBUTE_STRING]"
7549 . if \\n[#\\*[DOC_]COVER_ATTRIBUTE_COLOR]=1 \
7553 . PRINT "\\*[$\\*[DOC_]COVER_ATTRIBUTE_STRING]"
7554 . ie \\n[#PRINT_STYLE]=1 .sp
7556 . if !'\\*[$\\*[DOC_]COVER_AUTHOR_SPACER]'' \
7557 . sp \\*[$\\*[DOC_]COVER_AUTHOR_SPACER]
7561 . if '\\$0'DOC_COVER' \
7562 . ds $PRFX DOC_COVER_
7566 .\" Named doctype string
7567 . if \\n[#DOC_TYPE]=3 \{\
7568 . if \\n[#\\*[DOC_]COVER_DOCTYPE]=1 \{\
7569 . ie \\n[#PRINT_STYLE]=1 \{\
7572 . UNDERSCORE2 3p 2p "\\*[$DOC_TYPE]
7575 . fam \\*[$\\*[DOC_]COVER_DOCTYPE_FAM]
7576 . ft \\*[$\\*[DOC_]COVER_DOCTYPE_FT]
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]
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]"
7593 . el .PRINT "\\*[$DOC_TYPE]"
7596 . if \\n[#\\*[DOC_]COVER_DOCTYPE_COLOR]=1 \
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
7608 . \\*[DOC_]COVER_TEXT
7611 . rr #\\*[DOC_]COVERTEXT
7612 . rm \\*[DOC_]COVER_TEXT
7613 . rr #DOING_COVERTEXT
7614 . rr #\\*[DOC_]COVERTEXT_START_POS
7616 . sp |\\n[#VISUAL_B_MARGIN]u
7618 . ie \\n[#PRINT_STYLE]=1 \
7619 . if !\\n[#SINGLE_SPACE] .sp
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
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]
7635 . PRINT \\*[$\\*[DOC_]COVER_COPYRIGHT]
7636 . if \\n[#\\*[DOC_]COVER_COPYRIGHT_COLOR]=1 \
7639 . sp |\\n[#VISUAL_B_MARGIN]u
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]
7650 . ie !'\\*[$\\*[DOC_]COVER_MISC_1]'' \{\
7651 . QUAD \\*[$\\*[DOC_]COVER_MISC_QUAD]
7654 . while \\n[#\\*[DOC_]COVER_MISC_LINES]>=\\n+[#NEXT_MISC] \{\
7655 . nop \\*[$\\*[DOC_]COVER_MISC_\\n[#NEXT_MISC]]
7661 . QUAD \\*[$MISC_QUAD]
7664 . while \\n[#MISC_LINES]>=\\n+[#NEXT_MISC] \{\
7665 . nop \\*[$MISC_\\n[#NEXT_MISC]]
7670 . nr #MISC_V_ADJ \\n[#DOC_LEAD]-\\n[.v]
7671 . sp \\n[#MISC_V_ADJ]u
7675 . if \\n[#MISC_COLOR]=1 .gcolor
7676 . if \\n[#\\*[DOC_]COVER_MISC_COLOR]=1 .gcolor
7680 . if \\n[TOC.RELOCATE]==1 \{\
7681 . if !\\n[#COVER_BLANKPAGE] \
7682 . if !rTOC_BH .TOC_AFTER_HERE
7684 . if '\\$0'DO_COVER' \{\
7685 . if \\n[TOC.RELOCATE]==6 \
7686 . if !rTOC_BH .TOC_AFTER_HERE
7688 . if '\\$0'DO_DOC_COVER' \{\
7689 . if \\n[TOC.RELOCATE]==4 \
7690 . if !rTOC_BH .TOC_AFTER_HERE
7692 . if '\\$0'DO_DOC_COVER' .rm DOC_
7696 \# Macro to terminate (doc)cover processing
7701 . if '\\*[$COVER_TYPE]'DOC_COVER_' .ds DOC DOC
7703 . if \\n[#DOC_TYPE]=5 .nr #SKIP 1
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.
7718 . rr #\\*[DOC]COVER_BLANKPAGE
7719 . if !\\n[#\\*[DOC]COVERS_COUNT]=1 .nr % -2
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
7727 . PAGENUMBER \\n%+\\n[#PAGE_NUM_ADJ]-1
7729 . if \\n[#HEADERS_WERE_ON] \{\
7730 . rr #HEADERS_WERE_ON
7733 . if \\n[#FOOTERS_WERE_ON] \{\
7734 . rr #FOOTERS_WERE_ON
7737 . if \\n[#COLUMNS_WERE_ON]=1 \{\
7738 . rr #COLUMNS_WERE_ON 1
7742 . if \\n[.ns] .nop \&
7743 . if \\n[#RECTO_VERSO] .nr #RV_POST_COVER 1
7746 \# +++START THE DOCUMENT+++
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).
7759 \# The .PRINT \& (zero-width character) is required to get the
7760 \# subsequent .sp request to work as advertised.
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.
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
7779 . PRINT "You neglected to enter a PRINTSTYLE."
7780 . ab [mom]: PRINTSTYLE missing. Aborting '\\n[.F]'.
7782 . if \\n[#LINENUMBERS]=1 \{\
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]
7792 . if !'\\*[$RESTORE_PAGENUM_STYLE]'' \{\
7793 . PAGENUM_STYLE \\*[$RESTORE_PAGENUM_STYLE]
7794 . rm $RESTORE_PAGENUM_STYLE
7796 . if \\n[#PAGINATE_WAS_ON] \{\
7798 . rr #PAGINATE_WAS_ON
7802 . nr #PAGE_TOP \\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
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
7828 . ie \\n[#DOC_TYPE]=2 \{\
7829 . ie '\\*[$CHAPTER_TITLE]'' \
7830 . ds $TOC_TITLE_ITEM \\*[$CHAPTER_STRING] \\*[$CHAPTER]
7832 . ie '\\*[$CHAPTER]'' \
7833 . ds $TOC_TITLE_ITEM \\*[$CHAPTER_TITLE]
7835 . ds $TOC_TITLE_ITEM \
7836 \\*[$CHAPTER_STRING] \\*[$CHAPTER]: \\*[$CHAPTER_TITLE]
7840 . ds $TOC_TITLE_ITEM \\*[$TITLE]
7842 . if \\n[#TOC_AUTHORS]=1 \{\
7843 . ie '\\*[$TOC_AUTHORS]'' \
7844 . as $TOC_TITLE_ITEM / \\*[$AUTHOR_1]
7846 . as $TOC_TITLE_ITEM / \\*[$TOC_AUTHORS]
7850 . as $TOC_TITLE_ITEM \|
7851 . if \\n[#PREFIX_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
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]
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]
7874 . ds $TOC_TITLE_ITEM \\*[$TOC_CH_NUM]\\*[$TOC_TITLE_ITEM_OLD]
7875 . rm $TOC_TITLE_ITEM_OLD
7879 . if !'\\*[$TOC_TITLE_ITEM]'' \{\
7880 . PDF_BOOKMARK 1 \\*[$TOC_TITLE_ITEM]
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 \{\
7889 . sp |\\n[#HEADER_MARGIN]u
7894 . rr #PAGINATION_STATE
7895 .\" End collate stuff
7896 . sp |\\n[#DOCHEADER_ADVANCE]u-\\n[#DOC_LEAD]u
7897 . ie \\n[#DOC_HEADER]=0 \{\
7899 . if \\n[#DOC_TYPE]=4 \
7900 . if !'\\n[.z]'' .di
7901 . nr #STORED_PP_INDENT \\n[#PP_INDENT]
7904 . PARA_INDENT \\n[#STORED_PP_INDENT]u
7905 . rr #STORED_PP_INDENT
7906 . ie r#ADVANCE_FROM_TOP \{\
7908 . sp |\\n[#ADVANCE_FROM_TOP]u-1v
7909 . if \\n[#ADJ_DOC_LEAD]=1 \
7910 . if !\\n[#DOCHEADER_NO_SHIM] .SHIM_1
7914 . sp |\\n[#T_MARGIN]u-1v
7916 . if \\n[#COLUMNS] \{\
7919 . po \\n[#COL_\\n+[#COL_NUM]_L_MARGIN]u
7920 . nr #L_MARGIN \\n[.o]
7921 . ll \\n[#COL_L_LENGTH]u
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] \{\
7933 . nr #AUTOLEAD_VALUE \\n[#SAVED_AUTOLEAD_VALUE]
7935 . nr #DOCHEADER_LEAD \\n[.v]
7938 . if \\n[#DOC_TYPE]=1 \{\
7946 . L_MARGIN \\n[#DOC_L_MARGIN]u
7947 . LL \\n[#DOC_L_LENGTH]u
7949 . if \\n[#PRINT_STYLE]=1 .DEFAULT_DOCHEADER_TYPEWRITE
7950 . if \\n[#PRINT_STYLE]=2 .DEFAULT_DOCHEADER
7954 . if \\n[#DOC_TYPE]=2 \{\
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
7963 . if \\n[#PRINT_STYLE]=1 .CHAPTER_DOCHEADER_TYPEWRITE
7964 . if \\n[#PRINT_STYLE]=2 .CHAPTER_DOCHEADER
7968 . if \\n[#DOC_TYPE]=3 \{\
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
7981 . if \\n[#PRINT_STYLE]=1 \{\
7982 . DEFAULT_DOCHEADER_TYPEWRITE
7983 . if !\\n[#NO_PRINT_DOCTYPE] \{\
7985 . UNDERSCORE2 3p 2p "\\*[$DOC_TYPE]"
7988 . if \\n[#PRINT_STYLE]=2 .NAMED_DOCHEADER
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] \{\
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]
8004 . po \\n[#COL_\\n+[#COL_NUM]_L_MARGIN]u
8005 . nr #L_MARGIN \\n[.o]
8007 . LL \\n[#COL_L_LENGTH]u
8011 . nr #NO_PRINT_AUTHOR 1
8012 . nr #NO_PRINT_DOCTYPE 1
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]
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
8032 . if \\n[#RUN_ON]=1 \{\
8033 . if \\n[#FN_MARKER_STYLE]=1 .RUNON_WARNING
8034 . if \\n[#FN_MARKER_STYLE]=2 .RUNON_WARNING
8036 . nr PDFHREF.VIEW.LEADING \\n[PDFHREF.VIEW.LEADING.H]
8038 . if !r flex .nr flex 1
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] \
8046 . if d pre-list-\\n%@\\n[#COL_NUM] \
8048 . if d page-\\n%@\\n[#COL_NUM] \
8050 . if '\\*[last-page]'\\n%@\\n[#COL_NUM]' \
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] \
8063 . sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
8068 .MAC RR_ADVANCE_FROM_TOP END
8069 . rr #ADVANCE_FROM_TOP
8070 . ch RR_ADVANCE_FROM_TOP
8073 .MAC CLEANUP_DEFAULTS END
8075 . if \\n[#DOC_HEADER]=1 .nr #DOC_HEADER 2
8076 . rm $TOC_TITLE_ITEM
8081 . wh \\n[nl]u+1u RR_ADVANCE_FROM_TOP
8082 . rr #DOCHEADER_NO_SHIM
8085 \# ====================================================================
8087 \# +++MACROS TO CHANGE SOME DEFAULTS+++
8092 \# <none> | <anything> [distance to advance from top of page] [NO_SHIM]
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
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).
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
8109 . if \\n[#NUM_ARGS]>1 \{\
8111 . if \B'\\$2' .nr #ADVANCE_FROM_TOP \\$2
8112 . if '\\$3'NO_SHIM' .nr #DOCHEADER_NO_SHIM 1
8116 \# DOCUMENT HEADER LEADING
8117 \# -----------------------
8119 \# <+|- amount by which to in/decrease leading of doc header>
8121 \# Stores user supplied lead in/decrease in string $DOCHEADER_LEAD_ADJ.
8123 \# A unit of measure must be supplied. Decimal fractions OK.
8124 \# Default is +0, i.e. same as DOC_LEAD.
8126 .MAC DOCHEADER_LEAD END
8127 . ds $DOCHEADER_LEAD_ADJ \\$1
8130 \# DOCHEADER ADVANCE
8131 \# -----------------
8133 \# <docheader start position>
8135 \# Creates register #DOCHEADER_ADVANCE, used in START.
8137 \# Unit of measure required.
8138 \# Default is same as T_MARGIN.
8140 .MAC DOCHEADER_ADVANCE END
8141 . nr #DOCHEADER_ADVANCE \\$1
8144 \# DOCUMENT LEFT MARGIN
8145 \# --------------------
8147 \# <left margin of document>
8149 \# Creates or modifies register #DOC_L_MARGIN.
8151 \# Affects everything on the page.
8153 .MAC DOC_LEFT_MARGIN END
8154 . if !\\n[#DOCS] .DOC_MACRO_ERROR \\$0
8156 . nr #DOC_L_MARGIN (\\$1)
8157 . L_MARGIN \\n[#DOC_L_MARGIN]u
8160 \# DOCUMENT RIGHT MARGIN
8161 \# ---------------------
8163 \# <right margin of document>
8165 \# Creates or modifies register #DOC_R_MARGIN.
8167 \# Affects everything on the page.
8169 .MAC DOC_RIGHT_MARGIN END
8171 . nr #DOC_R_MARGIN (\\$1)
8172 . R_MARGIN \\n[#DOC_R_MARGIN]
8173 . nr #DOC_L_LENGTH \\n[#L_LENGTH]
8176 \# DOCUMENT LINE LENGTH
8177 \# --------------------
8179 \# <line length of document>
8181 \# Creates or modifies register #DOC_L_LENGTH.
8183 \# Affects everything on the page.
8185 .MAC DOC_LINE_LENGTH END
8186 . if !\\n[DOCS] .DOC_MACRO_ERROR \\$0
8188 . nr #DOC_L_LENGTH (\\$1)
8189 . LL \\n[#DOC_L_LENGTH]u
8196 \# <family of running text>
8198 \# Creates or modifies string $DOC_FAM.
8200 \# Affects everything except headers and footers.
8203 . if !\\n[DOCS] .DOC_MACRO_ERROR \\$0
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]
8220 \# DOCUMENT POINT SIZE
8221 \# -------------------
8223 \# <point size of running text>
8225 \# Creates or modifies register #DOC_PT_SIZE.
8227 \# DOC_PT_SIZE is the basis for calculating all type sizes in
8228 \# a document. Ignored if PRINTSTYLE TYPEWRITE.
8230 .ALIAS DOC_PT_SIZE PT_SIZE
8235 \# <lead (".vs") of running text> [ADJUST]
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.
8241 \# DOC_LEAD is the basis for calculating all leading changes in
8242 \# a document. Default for TYPESET is 16; 24 for TYPEWRITE.
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.
8251 . if \\n[#IGNORE] .return
8252 . if !\\n[#DOCS] .DOC_MACRO_ERROR \\$0
8254 . if '\\$0'DOC_LEAD' \{\
8257 . rr #DOC_AUTOLEAD_FACTOR
8258 . nr #DOC_LEAD \\n[.v]
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
8271 \# ADJUST DOCUMENT LEAD
8272 \# --------------------
8274 \# <none> | <anything>
8276 \# Adjusts document lead so that the last line of text falls exactly
8279 .MAC DOC_LEAD_ADJUST END
8281 . nr #ADJ_DOC_LEAD 1
8282 . rr #DOC_LEAD_ADJUST_OFF
8285 . nr #ADJ_DOC_LEAD 0
8286 . nr #DOC_LEAD_ADJUST_OFF 1
8295 \# Advances to the next valid baseline.
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.
8302 \# First, a little convenience macro
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]
8311 \# And a macro to disable SHIM
8325 .nr #NO_SHIM 2 \" Restored to 1 in DEFAULTS.
8328 . if \\n[#NO_SHIM] \
8329 . if !'\\$0'SHIM_1' .return
8330 . if !\\n[#NO_FLEX] \{\
8331 . if !'\\$0'SHIM_1' \{\
8333 SHIM, line \\n[.c], is incompatible with flex-spacing, which is enabled.
8335 Flex-spacing must be disabled with NO_FLEX before using SHIM.
8336 . ab [mom]: Aborting '\\n[.F]', line \\n[.c].
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]
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
8361 \# ====================================================================
8363 \# +++FLEX SPACING+++
8365 \# INSERT FLEX SPACE
8366 \# -----------------
8370 \# Inserts flexible whitespace ("flex-space").
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.
8377 . if !\\n[#NO_SHIM] \{\
8378 . if \\n[#NO_FLEX] \{\
8380 FLEX, line \\n[.c], is incompatible with shimming, which is presently enabled.
8382 Shimming must be disabled with NO_SHIM before using FLEX.
8383 . ab [mom]: Aborting '\\n[.F]', line \\n[.c].
8386 . if '\\$1'FORCE' \{\
8390 . if !\\n[#NO_FLEX] \{\
8392 . if !\\n[.t]<=\\n[.v] \{\
8394 . if dflex-space:\\n[flex]@\\n[#COL_NUM] \{\
8395 . sp \\*[flex-space:\\n[flex]@\\n[#COL_NUM]]
8406 . if \\n[#FLEX_ACTIVE] .rr #FLEX_ACTIVE
8409 . if !\\n[#DOC_TYPE]=5 .rr #NO_FLEX
8412 \# CALCULATE FLEX SPACES
8413 \# ---------------------
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.
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.
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] \{\
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
8434 . ie \\n[nl-from-heading] \{\
8435 . nr flex:current-pos \\n[nl-from-heading]-\\n[.v]
8436 . rr nl-from-heading
8440 . if \\n[nl]=(\\n[.p]+(\\n[#VARIABLE_FOOTER_POS]-1)) \
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]])
8463 \# ====================================================================
8465 \# +++INTERNATIONALIZATION+++
8470 \# <what goes in the "by" slot before author in the document header>
8472 \# Creates or modifies string $ATTRIBUTE_STRING.
8474 \# Default is "by". A blank string ("") may be used if no
8475 \# attribution is desired. Blank line results.
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 \&
8487 . if '\\$1'COVER' \{\
8488 . ds $COVER_ATTRIBUTE_STRING \\$2
8489 . if '\\*[$COVER_ATTRIBUTE_STRING]'' \
8490 . ds $COVER_ATTRIBUTE_STRING \&
8492 . if \\n[#NEITHER]=1 \{\
8493 . ds $ATTRIBUTE_STRING \\$1
8501 \# <what to print any time the word "chapter" is required>
8503 \# Creates or modifies string $CHAPTER_STRING.
8505 \# Default is "chapter".
8507 .MAC CHAPTER_STRING END
8508 . ds $CHAPTER_STRING \\$1
8514 \# <what to print any time the word "draft" is required>
8516 \# Creates or modifies string $DRAFT_STRING.
8518 \# Default is "draft".
8520 .MAC DRAFT_STRING END
8521 . ds $DRAFT_STRING \\$1
8527 \# <what to print any time the word "revision" is required>
8529 \# Creates or modifies string $REVISION_STRING.
8531 \# Default is "revision".
8533 .MAC REVISION_STRING END
8534 . ds $REVISION_STRING \\$1
8540 \# <what to print with the finis macro>
8542 \# Creates or modifies string $FINIS_STRING.
8544 \# Default is "END".
8546 .MAC FINIS_STRING END
8547 . ds $FINIS_STRING \\$1
8550 \# ====================================================================
8552 \# +++RECTO/VERSO+++
8557 \# <none> | <anything>
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.
8566 .MAC RECTO_VERSO END
8567 . ie '\\$1'' .nr #RECTO_VERSO 1
8568 . el .nr #RECTO_VERSO 0
8574 \# Forces doccover and cover pages to recto
8576 .MAC FORCE_RECTO END
8577 . ie '\\$1'' .nr #FORCE_RECTO 1
8578 . el .rr #FORCE_RECTO
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
8588 \# ====================================================================
8595 \# <value by which to multiply PP_INDENT for block epigraphs>
8597 \# Creates or modifies register #EPI_OFFSET_VALUE.
8599 \# Default is 2 for TYPEWRITE, 3 for TYPESET.
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
8611 \# EPIGRAPH AUTOLEAD
8612 \# -----------------
8614 \# <amount of lead to add to the epigraph ps for epigraph leading>
8616 \# Creates or modifies register #EPI_AUTOLEAD.
8618 \# Default is 2 (for TYPESET; TYPEWRITE doesn't require this).
8620 .MAC EPIGRAPH_AUTOLEAD END
8621 . nr #EPI_AUTOLEAD (p;\\$1)
8627 \# BLOCK | <anything>
8629 \# Places an epigraph before the document's text, after the
8630 \# document header, or after a HEAD.
8632 \# #EPIGRAPH 1 = centered; 2 = block
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.
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.
8645 . if \\n[#LINENUMBERS]=1 \{\
8649 . if \\n[#START] \{\
8650 . if \\n[#PRINT_STYLE]=1 \
8651 . if \\n[#AUTHOR_LINES]=1 .sp \\n[#DOC_LEAD]u
8657 . ll \\n[#L_LENGTH]u
8660 . if \\n[#COLUMNS] \{\
8661 . ie \\n[#START] \{\
8662 . ll \\n[#DOC_L_LENGTH]u
8666 . ll \\n[#COL_L_LENGTH]u
8671 . if \\n[#PRINT_STYLE]=1 \{\
8672 . fam \\*[$TYPEWRITER_FAM]
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]
8681 . if \\n[#PRINT_STYLE]=2 \{\
8682 . FAMILY \\*[$EPI_FAM]
8684 . ps \\n[#DOC_PT_SIZE]u\\*[$EPI_SIZE_CHANGE]
8685 . if \\n[#EPI_COLOR]=1 \{\
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]
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
8701 . ie '\\$1'BLOCK' \{\
8705 . ie \\n[#START] \{\
8706 . ie \\n[#COLUMNS] \{\
8707 . ie r#EPI_OFFSET_VALUE \
8709 \\n[#L_LENGTH_FOR_EPI]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
8712 \\n[#L_LENGTH_FOR_EPI]u-(\\*[$EPI_OFFSET_VALUE]u*2u)
8716 . ie r#EPI_OFFSET_VALUE \
8718 \\n[#L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
8720 . ll \\n[#L_LENGTH]u-(\\*[$EPI_OFFSET_VALUE]*2u)
8725 . ie r#EPI_OFFSET_VALUE \
8727 \\n[#L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
8729 . ll \\n[#L_LENGTH]u-(\\*[$EPI_OFFSET_VALUE]*2u)
8731 . if \\n[#COLUMNS] \{\
8732 . ie r#EPI_OFFSET_VALUE \
8734 \\n[#COL_L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
8736 . ll \\n[#COL_L_LENGTH]u-(\\*[$EPI_OFFSET_VALUE]*2u)
8741 . if \\n[#PRINT_STYLE]=1 \{\
8742 . fam \\*[$TYPEWRITER_FAM]
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
8750 . nr #EPI_LEAD \\n[#LEAD]
8751 . nr #EPI_LEAD_DIFF \\n[#DOC_LEAD]-\\n[#EPI_LEAD]
8755 . if \\n[#PRINT_STYLE]=2 \{\
8756 . FAMILY \\*[$EPI_FAM]
8758 . ps \\n[#DOC_PT_SIZE]u\\*[$EPI_SIZE_CHANGE]
8759 . if \\n[#EPI_COLOR]=1 \{\
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
8769 . nr #EPI_LEAD \\n[#LEAD]
8770 . nr #EPI_LEAD_DIFF \\n[#DOC_LEAD]-\\n[#EPI_LEAD]
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.
8789 \# In addition to its usual place at the beginning of a
8790 \# document, EPIGRAPH may also be used after HEAD.
8792 .MAC DO_EPIGRAPH END
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]) \{\
8800 . rr #RESET_FN_COUNTERS
8804 . nr #SAVED_FN_NUMBER \\n[#FN_NUMBER]
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]
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
8821 . ie '\\*[$CHAPTER_TITLE]'' .RLD \\n[#DOC_LEAD]u
8822 . el .if '\\*[$CHAPTER]'' .RLD \\n[#DOC_LEAD]u
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] \
8828 \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)-\\n[#DOC_LEAD]u
8832 . ie \\n[#EPI_DEPTH]<\\n[#TRAP_DISTANCE] \{\
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]
8838 . ie \\n[#PRINT_STYLE]=1 \{\
8839 . if \\n[#EPI_WHITESPACE]=\\n[#DOC_LEAD] \
8840 . ALD \\n[#EPI_WHITESPACE]u/2u
8843 . if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \
8845 \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)
8846 . if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \
8848 \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)-\\n[#DOC_LEAD]u
8850 . if \\n[#DIVER_FN]=2 .rr #DIVER_FN
8853 . nr #EPI_LINES_TO_TRAP 0 1
8854 . while \\n[#EPI_LEAD]*\\n+[#EPI_LINES_TO_TRAP]<\\n[#TRAP_DISTANCE] \{\
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]
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
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]
8876 . if \\n[#EPIGRAPH]=2 \{\
8877 . ie !\\n[#EPI_OFFSET_VALUE]=0 \
8879 \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
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 \
8886 \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
8888 . if !'\\*[$EPI_OFFSET_VALUE]'' \
8890 \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+\\*[$EPI_OFFSET_VALUE]
8892 . if !\\n[#EPI_OFFSET]=0 .po \\n[#EPI_OFFSET]u
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
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]
8917 . ALD \\n[#EPI_WHITESPACE]u-(\\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u)
8920 . ie \\n[#PRINT_STYLE]=1 \{\
8921 . if \\n[#EPI_WHITESPACE]=\\n[#DOC_LEAD] \
8922 . ALD \\n[#EPI_WHITESPACE]u
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
8933 . nr #EPI_LINES_TO_END \\n[#EPI_LINES]-\\n[#EPI_LINES_TO_TRAP]
8934 . if \\n[#LOOP] .nr #EPI_LINES_TO_END +1
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]
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
8947 . rr #EPI_LINES_EVEN
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]
8961 . if \\n[#START] \{\
8962 . if \\n[#COLUMNS] \{\
8963 . po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
8964 . nr #L_MARGIN \\n[.o]
8968 . if \\n[#LINENUMBERS]=2 \{\
8969 . NUMBER_LINES RESUME
8974 \# ====================================================================
8976 \# +++FINIS MACRO+++
8983 \# Deposits --END-- at the end of a document.
8987 . if \\n[.t]<=2v \{\
8988 . tm1 "[mom]: '\\n[.F]': Insufficient room to print \\$0 on last page.
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]
9002 . ALD \\n[#DOC_LEAD]u
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]
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
9015 \\*[$FINIS_DASH]\\*[$FINIS_STRING]\\*[$FINIS_DASH]\c
9018 . if \\n[#FINIS_COLOR]=1 .gcolor
9019 . if \\n[#FINIS_STRING_CAPS]=1 .CAPS OFF
9024 .MAC FINIS_STRING_CAPS END
9025 . ie '\\$1'' .nr #FINIS_STRING_CAPS 1
9026 . el .nr #FINIS_STRING_CAPS 0
9029 .ALIAS FINIS_CAPS FINIS_STRING_CAPS
9031 .MAC FINIS_NO_DASHES END
9032 . nr #FINIS_NO_DASHES 1
9035 \# ====================================================================
9037 \# +++HEADERS/FOOTERS+++
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.
9043 .ds PAGE# \En[#PAGENUMBER]
9046 .MAC RESTORE_SPACE END
9052 . if \\n[#NEWPAGE] .rr #NEWPAGE
9053 . if \\n[.u]=1 .nr #FILLED 1
9058 . if \\n[#FILLED] \{\
9068 \# <amount of space between header/footer and header/footer rule>
9070 \# Creates or modifies register #HDRFTR_RULE_GAP to hold amount
9071 \# of space between header/footer and header/footer rule.
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]
9086 \# <what to put in the left position of page header/footers>
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
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.
9097 \# If the argument is the # character, simply prints the current
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 ...#
9105 .MAC HDRFTR_LEFT END
9106 . nr #USER_DEF_HDRFTR_LEFT 1
9107 . ds $HDRFTR_LEFT \\$1
9110 \# HDRFTR <POSITION> CAPS AND SMALLCAPS
9111 \# ------------------------------------
9113 \# <none> | <anything>
9115 \# Turns capitalisation of $HDRFTR_<POSITION> on or off.
9117 \# Default for RIGHT (ie AUTHOR) is on.
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.
9124 .MAC _HDRFTR_CAPS END
9126 . substring $HDR_FTR 0 5 \" HEADER or FOOTER
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
9136 . nr #HDRFTR_\\*[POSITION]_CAPS 0
9137 . ds $HDRFTR_\\*[POSITION]_SIZE_CHANGE +0
9141 .MAC _HDRFTR_SMALLCAPS END
9143 . substring $HDR_FTR 0 5 \" HEADER or FOOTER
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
9153 . nr #HDRFTR_\\*[POSITION]_SMALLCAPS 0
9159 \# <what to put in the centre position of page header/footers>
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
9166 \# Default is document type if DOCTYPE NAMED, Chapter # if DOCTYPE
9167 \# CHAPTER, draft and revision number if COPYSTYLE DRAFT.
9169 \# If the argument is the # character, simply prints the current
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 ...#
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
9183 . if '\\$0'FOOTER_CENTRE' \{\
9184 . ds $HDRFTR_CENTER_OLD \\*[$HDRFTR_CENTER]
9185 . ds $HDRFTR_CENTER_NEW \\$1
9187 . ie '\\$1'TOC' .ds $TOC_HDRFTR_CENTER \\$2
9188 . el .ds $HDRFTR_CENTER \\$1
9191 \# HDRFTR CENTER CAPS AND SMALLCAPS
9192 \# --------------------------------
9194 \# <none> | <anything>
9196 \# Turns capitalisation of $HDRFTR_CENTER (typically, doctype of
9197 \# the document) on or off.
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
9206 . nr #HDRFTR_CENTER_SMALLCAPS 0
9209 \# HDRFTR CENTER PADDING
9210 \# ---------------------
9212 \# LEFT | RIGHT <amount of padding to put left or right of hdrftr
9215 \# Creates or modifies registers #HDRFTR_CTR_PAD_LEFT or
9216 \# #HDRFTR_CTR_PAD_RIGHT.
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.
9224 \# A unit of measure is required.
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)
9231 \# SWITCH HDRFTR CENTER PADDING SIDE (support macro)
9232 \# -------------------------------------------------
9236 \# Switches the padding side of hdrftr center padding.
9238 \# Required to keep spacing around hdrftr string constant
9239 \# in recto/verso documents.
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
9250 \# <what to put in the right position of page header/footers>
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
9257 \# Default is document title.
9259 \# If the argument is the # character, simply prints the current
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 ...#
9267 .MAC HDRFTR_RIGHT END
9268 . nr #USER_DEF_HDRFTR_RIGHT 1
9269 . ds $HDRFTR_RIGHT \\$1
9272 \# HDRFTR RIGHT CAPS AND SMALLCAPS
9273 \# -------------------------------
9275 \# <none> | <anything>
9277 \# Turns capitalisation of $HDRFTR_RIGHT (typically, the title of
9278 \# the document) on or off.
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
9287 . nr #HDRFTR_RIGHT_SMALLCAPS 0
9293 \# <none> | <anything>
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
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] \{\
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]
9313 . if \\n[#FOOTERS_ON] \{\
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]
9320 . ie \\n[#HDRFTR_RULE_COLOR]=1 \{\
9321 \m[\\*[$HDRFTR_RULE_COLOR]]\
9322 \D't \\n[#HDRFTR_RULE_WEIGHT]u'\
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'\
9331 \D't \\n[#HDRFTR_RULE_WEIGHT]u'\
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'
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]
9350 . if \\n[#HEADERS_ON] \{\
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]
9356 . if \\n[#FOOTERS_ON] \{\
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]
9363 . ie \\n[#HDRFTR_RULE_COLOR]=1 \{\
9364 \m[\\*[$HDRFTR_RULE_COLOR]]\
9365 \D't \\n[#HDRFTR_RULE_WEIGHT]u'\
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'\
9374 \D't \\n[#HDRFTR_RULE_WEIGHT]u'\
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'
9384 . if '\\$0'HEADER_RULE' \{\
9394 . if '\\$0'FOOTER_RULE' \{\
9404 . if '\\$0'HDRFTR_RULE' \{\
9405 . ie '\\$1'' .nr #HDRFTR_RULE 1
9406 . el .nr #HDRFTR_RULE 0
9410 .ALIAS HDRFTR_RULE_INTERNAL HDRFTR_RULE
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.
9421 .MAC HDRFTR_PLAIN END
9422 . nr #HDRFTR_PLAIN 1
9424 . rm #HDRFTR_PT_SIZE
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
9449 \# <none> | <anything>
9451 \# Creates or modifies register #SWITCH_HDRFTR, used to switch
9452 \# default location of HDRFTR_LEFT and HDRFTR_RIGHT.
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.
9469 .MAC SWITCH_HDRFTR END
9470 . ie '\\$1'' .nr #SWITCH_HDRFTR 1
9471 . el .nr #SWITCH_HDRFTR 0
9474 \# USER DEFINED HDRFTR RECTO
9475 \# -------------------------
9477 \# L | LEFT | C | CENTER | CENTER | R | RIGHT <hdrftr_recto_string>
9479 \# Toggles #USERDEF_HDRFTR on, stores quad as #USERDEF_HDRFTR_RECTO_QUAD,
9480 \# stores string in $USERDEF_HDRFTR_RECTO.
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.
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
9496 . ie '\\$1'CAPS' \{\
9497 . nr #HDRFTR_RECTO_CAPS 1
9498 . ds $USERDEF_HDRFTR_RECTO \\$2
9500 . el .ds $USERDEF_HDRFTR_RECTO \\$1
9503 \# USER DEFINED HDRFTR VERSO
9504 \# -------------------------
9506 \# L | LEFT | C | CENTER | CENTER | R | RIGHT <hdrftr_verso_string>
9508 \# Toggles #USERDEF_HDRFTR on, stores quad as #USERDEF_HDRFTR_VERSO_QUAD,
9509 \# stores string in $USERDEF_HDRFTR_VERSO.
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.
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
9523 . ie '\\$1'CAPS' \{\
9524 . nr #HDRFTR_VERSO_CAPS 1
9525 . ds $USERDEF_HDRFTR_VERSO \\$2
9527 . el .ds $USERDEF_HDRFTR_VERSO \\$1
9530 \# PRINT FOOTER ON FIRST PAGE
9531 \# --------------------------
9533 \# <none> | <anything>
9535 \# Toggles register #PRINT_FOOTER_ON_PAGE_1
9537 \# Lets user choose whether to print footer on first
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
9545 \# PRINT PAGE NUMBER ON FIRST PAGE
9546 \# -------------------------------
9548 \# <none> | <anything>
9550 \# Toggles register #PRINT_PAGENUM_ON_PAGE_1
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.
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
9561 \# PRINT HEADER/FOOTER
9562 \# -------------------
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.
9569 \# Called from within either HEADER or FOOTER.
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
9580 . if !\\n[#PRINT_FOOTER_ON_PAGE_1] \{\
9581 . ie !\\n[#HDRFTR_BOTH] .return
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]"
9594 . if \\n[#USERDEF_HDRFTR] \{\
9595 . PRINT_USERDEF_HDRFTR
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
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] \{\
9625 . nr #LEFT_CAP_HEIGHT \\n[#CAP_HEIGHT]
9630 . if \\n[#RECTO_VERSO]=0 .LEFT
9631 . if \\n[#HDRFTR_LEFT_CAPS] .CAPS
9632 . ie '\\*[$HDRFTR_LEFT]'#' .PRINT \\n[#PAGENUMBER]
9634 . ie !'\\*[$HDRFTR_LEFT]'' .PRINT \\*[$HDRFTR_LEFT]
9637 . if \\n[#HDRFTR_LEFT_CAPS] .CAPS OFF
9639 . if \\n[#HDRFTR_CENTER_CAPS] .CAPS
9641 . ie '\\*[$HDRFTR_CENTER]'#' .PRINT \
9642 \h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\n[#PAGENUMBER]\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'
9644 . ie !'\\*[$HDRFTR_CENTER]'' .PRINT \
9645 \h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\*[$HDRFTR_CENTER]\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'
9648 . if \\n[#HDRFTR_CENTER_CAPS] .CAPS OFF
9651 . if \\n[#RECTO_VERSO]=0 .RIGHT
9652 . if \\n[#HDRFTR_RIGHT_CAPS] .CAPS
9654 . ie '\\*[$HDRFTR_RIGHT]'#' .PRINT \\n[#PAGENUMBER]
9656 . ie !'\\*[$HDRFTR_RIGHT]'' .PRINT \\*[$HDRFTR_RIGHT]
9659 . if \\n[#HDRFTR_RIGHT_CAPS] .CAPS OFF
9661 . if \\n[#PRINT_STYLE]=2 \{\
9662 . if \\n[#HDRFTR_COLOR]=1 \{\
9664 \m[\\*[$HDRFTR_COLOR]]
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] \{\
9672 . nr #LEFT_CAP_HEIGHT \\n[#CAP_HEIGHT]
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[]
9684 . PRINT \\n[#PAGENUMBER]
9687 . ie !'\\*[$HDRFTR_LEFT]'' \{\
9688 . ie \\n[#HDRFTR_LEFT_COLOR]=1 \
9689 . PRINT \m[\\*[$HDRFTR_LEFT_COLOR]]\\*[$HDRFTR_LEFT]\m[]
9691 . PRINT \\*[$HDRFTR_LEFT]
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] \{\
9703 . nr #CENTER_CAP_HEIGHT \\n[#CAP_HEIGHT]
9707 . if \\n[#HDRFTR_CENTER_SMALLCAPS] .SMALLCAPS
9708 . if \\n[#HDRFTR_CENTER_CAPS] .CAPS
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[]
9715 \h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\n[#PAGENUMBER]\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'
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[]
9723 \h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\*[$HDRFTR_CENTER]\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'
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] \{\
9735 . nr #RIGHT_CAP_HEIGHT \\n[#CAP_HEIGHT]
9740 . if \\n[#RECTO_VERSO]=0 .RIGHT
9741 . if \\n[#HDRFTR_RIGHT_SMALLCAPS] .SMALLCAPS
9742 . if \\n[#HDRFTR_RIGHT_CAPS] .CAPS
9744 . ie '\\*[$HDRFTR_RIGHT]'#' \{\
9745 . ie \\n[#HDRFTR_RIGHT_COLOR]=1 \
9746 . PRINT \m[\\*[$HDRFTR_RIGHT_COLOR]]\\n[#PAGENUMBER]\m[]
9748 . PRINT \\n[#PAGENUMBER]
9751 . ie !'\\*[$HDRFTR_RIGHT]'' \{\
9752 . ie \\n[#HDRFTR_RIGHT_COLOR]=1 \
9753 . PRINT \m[\\*[$HDRFTR_RIGHT_COLOR]]\\*[$HDRFTR_RIGHT]\m[]
9755 . PRINT \\*[$HDRFTR_RIGHT]
9759 . if \\n[#HDRFTR_RIGHT_CAPS] .CAPS OFF
9760 . if \\n[#HDRFTR_RIGHT_SMALLCAPS] .SMALLCAPS OFF
9762 . if \\n[#HDRFTR_RULE] .HDRFTR_RULE_INTERNAL
9766 \# PRINT USER DEFINED HEADER/FOOTER
9767 \# --------------------------------
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.
9774 \# Called from within PRINT_HDRFTR.
9776 .MAC PRINT_USERDEF_HDRFTR END
9777 . nr #PAGENUMBER \\n%+\\n[#PAGE_NUM_ADJ]
9779 . if \\n[#PRINT_STYLE]=2 \{\
9780 . fam \\*[$HDRFTR_FAM]
9782 . ps \\n[#HDRFTR_PT_SIZE]u
9783 . if \\n[#HDRFTR_COLOR]=1 \{\
9785 . COLOR \\*[$HDRFTR_COLOR]
9788 . ie \\n[#RECTO_VERSO] \{\
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
9799 . if \\n[#FOOTERS_ON] \{\
9802 . nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
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
9817 . if \\n[#FOOTERS_ON] \{\
9820 . nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
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
9834 . if \\n[#FOOTERS_ON] \{\
9837 . nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
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
9853 . if \\n[#FOOTERS_ON] \{\
9856 . nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
9861 . if \\n[#PRINT_STYLE]=2 \{\
9862 . ie \\n[#HDRFTR_COLOR]=1 \m[\\*[$HDRFTR_COLOR]]
9865 . if \\n[#HDRFTR_RULE] \
9866 . HDRFTR_RULE_INTERNAL
9871 \# HEADERS (off or on)
9872 \# -------------------
9874 \# <none> | <anything>
9876 \# Turns headers at the top of the page off or on.
9881 . ie '\\$1'' .nr #HEADERS_ON 1
9882 . el .nr #HEADERS_ON 0
9888 \# <amount of space between top of page and header>
9890 \# Creates or modifies register #HEADER_MARGIN to hold amount
9891 \# of space between top of page and header.
9893 \# Requires unit of measure. Default is 4P+6p, measured top-of-page
9896 .MAC HEADER_MARGIN END
9897 . nr #HEADER_MARGIN (\\$1)
9903 \# <amount of space between header and running text>
9905 \# Creates or modifies register #HEADER_GAP to hold amount
9906 \# of space between header and running text.
9908 \# Default is 1P+6p.
9911 . nr #HEADER_GAP (\\$1)
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
9928 . if \\n[#DOC_TYPE]=5 \{\
9929 . if \\n[#SLIDE_FOOTERS] \{\
9931 . if \\n[#HDRFTR_BOTH] \
9932 . HEADER_RECTO \\*[$HDR_RECTO_QUAD] "\\*[$HDR_RECTO_STRING]"
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] \{\
9941 . if \\n[#REMOVE_ADJ] .nr #DOC_LEAD -\\n[#DOC_LEAD_ADJ]
9948 . nr #LAST_FN_COUNT_FOR_COLS \\n[#FN_COUNT_FOR_COLS]
9949 . if \\n[#FN_DEPTH] .PROCESS_FN_LEFTOVER
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
9965 . if \\n[#PAGE_NUM_V_POS]=1 .vs 0
9966 . sp |\\n[#HEADER_MARGIN]u-1v
9968 . ll \\n[#DOC_L_LENGTH]u
9970 . if \\n[#PRINT_STYLE]=1 \{\
9971 . fam \\*[$TYPEWRITER_FAM]
9973 . ps \\*[$TYPEWRITER_PS]\\*[$HDRFTR_SIZE_CHANGE]
9975 . if \\n[#PRINT_STYLE]=2 \{\
9976 . fam \\*[$HDRFTR_FAM]
9978 . ps \\n[#DOC_PT_SIZE]u\\*[$HDRFTR_SIZE_CHANGE]
9980 . nr #HDRFTR_PT_SIZE \\n[#PT_SIZE]
9981 . if \\n[#CAPS_ON] \{\
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
9994 . if !n .nop \X'ps: exec 0 setlinejoin'\X'ps: exec 0 setlinecap'
9996 . if \\n[#DOC_TYPE]=5 \{\
9997 . if \\n[#SLIDE_HEADERS] \{\
9999 . if \\n[#SLIDE_FOOTERS] \{\
10001 .\" So rule prints after header on first page
10002 . if !r #SKIP_RULE \{\
10004 . if \\n[#HEADER_RULE] .HEADER_RULE
10010 . ie \\n[#HEADERS_ON] .PRINT_HDRFTR
10012 . if \\n[#PAGE_NUM_V_POS]=1 \
10013 . if \\n[#PAGINATE] .PRINT_PAGE_NUMBER
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
10024 . nr #PAGE_TOP \\n[nl]
10026 . po \\n[#L_MARGIN]u
10027 . if \\n[#RECTO_VERSO] .nr #L_MARGIN +\\n[#L_MARGIN_DIFF]
10028 . if \\n[#CAPS_WAS_ON] \{\
10032 . if \\n[#TAB_ACTIVE] .TAB \\n[#CURRENT_TAB]
10033 . if \\n[#QUOTE] \{\
10034 . ie \\n[#TAB_ACTIVE] .TAB \\n[#CURRENT_TAB]
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
10041 . if \\n[#PRINT_STYLE]=2 .sp \\n[#Q_LEAD_DIFF]u
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
10053 . if dRUNON_FN_IN_DIVER .rm RUNON_FN_IN_DIVER
10055 . if \\n[#EPIGRAPH] \{\
10056 . ie \\n[#TAB_ACTIVE] .TAB \\n[#CURRENT_TAB]
10058 . ie r#EPI_OFFSET_VALUE \
10060 \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
10062 . nr #EPI_OFFSET \\n[#L_MARGIN]+\\*[$EPI_OFFSET_VALUE]
10063 . po \\n[#EPI_OFFSET]u
10066 . ie \\n[#EPIGRAPH] \{\
10067 . ie !\\n[#EPI_ACTIVE] \{\
10072 . ie \\n[#EPI_FITS] .ns
10073 . el .sp \\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u
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
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
10088 . if \\n[#QUOTE] \{\
10089 . ie \\n[#\\*[BQ]_OFFSET_VALUE] \
10090 . po +(\\n[#PP_INDENT]u*\\n[#\\*[BQ]_OFFSET_VALUE]u)
10092 . po +\\*[$\\*[BQ]_OFFSET_VALUE]
10094 . if \\n[#EPIGRAPH] \{\
10095 . if \\n[#EPI_ACTIVE] \{\
10096 . ie \\n[#EPI_FITS] .
10097 . el .nr dc -\\n[#EPI_LEAD_DIFF]
10099 . ie r#EPI_OFFSET_VALUE \{\
10101 \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u+(\\n[#PP_INDENT]u*\\n[#EPI_OFFSET_VALUE]u)
10103 . el .po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u+\\*[$EPI_OFFSET_VALUE]
10107 . rr #DEFER_SPACE_ADDED
10108 . if !\\n[#FN_DEPTH] .if r #DIVERTED .rr #DIVERTED
10109 . if \\n[#MN_OVERFLOW_LEFT]=1 \{\
10115 . if \\n[#MN_OVERFLOW_RIGHT]=1 \{\
10118 . MN_OVERFLOW_RIGHT
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 \{\
10131 . nop \R'#UNDERLINE_ON 1'\X'ps: exec \\n[_w] \\n[_d] decorline'
10135 . rr #UNDERLINE_WAS_ON
10137 . if \\n[#RESTORE_PAGINATION] \{\
10139 . rr #RESTORE_PAGINATION
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] \{\
10149 . if \\n[#RESTORE_COL_FLEX] \{\
10151 . rr #RESTORE_COL_FLEX
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
10168 . ie \\n[defer] .PROCESS_FLOATS
10170 .\" These two sets of conditions only occur if the .br in .TS causes
10172 . if !\\n[doing-tbl] \{\
10173 . if (\\n[tbl*have-caption]=1)&(\\n[tbl*caption-after-label]=0) \{\
10175 . if !\\n[span] \{\
10176 . ie \\n[#MLA] .sp \\n[tbl*label-lead-diff]u
10177 . el .sp \\n[tbl*caption-lead-diff]u
10182 .\" So tables without TH that don't fit don't overprint first row
10184 . ie \\n[tbl*no-header] \{\
10188 . rr \\n[tbl*no-header]
10194 . if \\n[#INDENT_LEFT_ACTIVE] .in \\n[#L_INDENT]u/2u
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
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
10207 . if !\\n[float*defer] .ev 0
10210 \# ====================================================================
10214 \# FOOTERS (off or on)
10215 \# -------------------
10217 \# <none> | <anything>
10219 \# Turns footers at the bottom of the page off or on.
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.
10229 . PAGENUM_POS TOP CENTER
10231 . el .nr #FOOTERS_ON 0
10239 \# Creates or modifies register #FOOTER_MARGIN which holds the
10240 \# amount of space to leave between the page number and the bottom
10243 \# Unit of measure required. Default is 3P.
10245 .MAC FOOTER_MARGIN END
10246 . ie \\n%>0 .nr #FOOTER_MARGIN (\\$1)
10253 \# <distance from end of running text to page # or footer>
10255 \# Creates or modifies register #FOOTER_GAP which holds the
10256 \# amount of space to leave between running text and the page number.
10258 \# Requires unit of measure. Default is 3P. Measured baseline to
10261 .MAC FOOTER_GAP END
10262 . ie \\n%>0 .nr #FOOTER_GAP (\\$1)
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
10280 . if r #START .rr #START
10282 . if \\n[#DOING_COVERTEXT] \{\
10283 . tm1 "[mom]: COVERTEXT exceeds cover page depth.
10284 . ab [mom]: Aborting '\\n[.F]'.
10289 . nr #SAVED_LEAD \\n[.v]
10290 . if !r pg-trans .nr pg-trans 0 1
10291 . ev PAGE_TRANSITION\\n+[pg-trans]
10293 . ie !n .nop \X'ps: exec decornone'
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 \{\
10300 . nr #no-repeat-MN-left 1
10302 . if '\\n[.z]'MN_OVERFLOW_LEFT' \{\
10304 . nr #MN_OVERFLOW_LEFT 1
10305 . rr #OVERFLOW_LEFT
10308 . if \\n[MN-right]>0 \{\
10309 . if !\\n[#no-repeat-MN-right]=1 .MNbottom-right
10310 . if '\\n[.z]'MN_OVERFLOW_RIGHT' \{\
10312 . nr #MN_OVERFLOW_RIGHT 1
10313 . rr #OVERFLOW_RIGHT
10316 \# Table bottom hook, draws the table borders in
10317 \# multipage boxed tables.
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]
10327 |\\n[#PAGE_LENGTH]u-(\\n[#B_MARGIN]u+\\n[#FN_DEPTH]u-\\n[#DOC_LEAD]u)
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
10336 . ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u
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' \{\
10344 . nr #FN_OVERFLOW_DEPTH \\n[#DIVER_DEPTH]
10346 . nr #FN_COUNT_AT_FOOTER \\n[#FN_COUNT]
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
10356 . ie \\n[#COLUMNS]=1 \{\
10357 . ie (\\n[#COL_NUM]=\\n[#NUM_COLS]):(\\n[#NEWPAGE]=1) .DO_FOOTER
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
10364 . vs \\n[#SAVED_LEAD]u
10368 . if d page-\\n%@\\n[#COL_NUM] \{\
10370 . rr #RESTORE_COL_FLEX
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]' \
10378 . if '\\*[pre-collate]'\\n%@\\n[#COL_NUM]' \
10380 . if '\\*[pre-newpage-\\n%]'\\n%@\\n[#COL_NUM]' \{\
10382 . nr #RESTORE_FLEX 1
10384 . if d page-\\n%@\\n[#COL_NUM] \{\
10386 . nr #RESTORE_COL_FLEX 1
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
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
10405 . if dRUNON_FN_IN_DIVER .rm RUNON_FN_IN_DIVER
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]
10412 . ie \\n[#Q_OFFSET_VALUE] \
10414 \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE])
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]
10423 . po \\n[#Q_OFFSET]u
10426 . if \\n[#EPIGRAPH] \{\
10427 . ie \\n[#TAB_ACTIVE] .TAB \\n[#CURRENT_TAB]
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]
10439 . po \\n[#EPI_OFFSET]u
10442 . ie \\n[tbl*interrupted] \{\
10444 . rr tbl*interrupted
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] \{\
10454 . sp |\\n[dc]u+(\\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u)
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] \{\
10471 . rr \\n[tbl*no-header]
10475 . if '\\n[.ev]'caption' .rs
10476 . if \\n[tbl*interrupted] .tbl*print-header
10477 . rr tbl*interrupted
10488 \# Prints footer (page number, or 3-part footer).
10489 \# Resets CAPS and UNDERLINE if they were on.
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] \{\
10500 . ie !\\n[#DOC_TYPE]=5 .PRINT_FOOTER
10502 . if !\\n[ref*last] \{\
10503 . ie \\n[defer]>0 \{\
10511 .MAC PRINT_FOOTER END
10512 . if r #SAVED_FOOTER_POS .ch FOOTER \\n[#SAVED_FOOTER_POS]u
10513 . rr #SAVED_FOOTER_POS
10518 . sp |\\n[#PAGE_LENGTH]u-\\n[#FOOTER_MARGIN]u
10520 . sp |\\n[#PAGE_LENGTH]u-\\n[#FOOTER_MARGIN]u-\\n[#FOOTER_ADJ]u
10523 . po \\n[#DOC_L_MARGIN]u
10524 . ll \\n[#DOC_L_LENGTH]u
10526 . if \\n[#PRINT_STYLE]=1 .TYPEWRITER
10527 . if \\n[#PRINT_STYLE]=2 \{\
10528 . fam \\*[$HDRFTR_FAM]
10530 . ps \\n[#DOC_PT_SIZE]u\\*[$HDRFTR_SIZE_CHANGE]
10532 . nr #HDRFTR_PT_SIZE \\n[#PT_SIZE]
10533 . if \\n[#CAPS_ON] \{\
10534 . nr #CAPS_WAS_ON 1
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
10544 . if \\n[#PAGINATE] \{\
10545 . if \\n[#PAGE_NUM_V_POS]=2 \
10546 . if !\\n[#SKIP_FOOTER]>0 .PRINT_PAGE_NUMBER
10550 . if \\n[#CAPS_WAS_ON] \{\
10558 \# ====================================================================
10560 \# +++HEADERS AND FOOTERS+++
10562 \# HEADERS_AND_FOOTERS
10563 \# -------------------
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
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
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.
10589 .MAC HEADERS_AND_FOOTERS END
10590 . ie \\n[#NUM_ARGS]>1 \{\
10591 . nr #HDRFTR_BOTH 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
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
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]"
10622 . ie \\\\n[#HEADER_RULE]=1 .HEADER_RULE
10623 . el .HEADER_RULE OFF
10626 . if \\n[#HEADERS_ON]=1 \{\
10627 . FOOTER_RECTO \\*[$FTR_RECTO_QUAD] "\\*[$FTR_RECTO_STRING]"
10628 . FOOTER_VERSO \\*[$FTR_VERSO_QUAD] "\\*[$FTR_VERSO_STRING]"
10633 . if \\\\n[#HDRFTR_BOTH]=1 \{\
10634 . if r #START_FOR_FOOTERS .rr #START_FOR_FOOTERS
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
10646 . rr #USERDEF_HDRFTR
10647 . rm $USERDEF_HDRFTR_RECTO
10648 . rm $USERDEF_HDRFTR_VERSO
10651 . if \\n[#COLLATE]=1 \{\
10652 . nr #HEADER_STATE 1
10653 . nr #PAGINATION_STATE 1
10656 . PAGENUM_POS BOTTOM CENTER
10661 \# ====================================================================
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
10673 \# <heading level> [PARAHEAD] [NAMED <pdf-id>] <heading text>
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.
10681 \# If PARAHEAD given, HEADING must come after PP.
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].
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
10700 . while \\n+[#ARG_NUM]<=2 \{\
10701 . if '\\$1'NAMED' \{\
10702 . ds PDF_NM "\\$1 \\$2
10703 . shift 2 \" \\$1 is now heading text
10705 . if '\\$1'PARAHEAD' \{\
10707 . shift \" \\$1 is now NAMED, if we have it; otherwise heading text
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] \{\
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
10721 . if !\\n[#SPACE_ADDED] .if !\\n[#LINEBREAK] .sp
10727 . if !\\n[#SPACE_ADDED] \
10728 . if !\\n[#COLUMNS] .sp
10732 . if \\n[#EPIGRAPH] \
10733 . if \\n[#SINGLE_SPACE] .sp
10735 . if \\n[#PP_SPACE] \
10736 . if \\n[#QUOTE_4_HD] .sp .5v
10737 . ie !\\n[#SPACE_ADDED] \{\
10739 . ie !\\n[#NO_SHIM] \
10740 . if !\\n[#HEAD_\\n[#LEVEL]_NO_SHIM] .SHIM
10742 . if !\\n[#NO_FLEX] \
10743 . if !\\n[#HEAD_\\n[#LEVEL]_NO_FLEX] .FLEX
10747 . el .rr #SPACE_ADDED
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].
10757 . if !(\\n[#PRINT_STYLE]=1)&(\\n[#SINGLE_SPACE]=1) .sp -1v
10758 . if \\n[#QUOTE_4_HD] \{\
10760 . if \\n[#PP_SPACE] \{\
10765 . if (\\n[#QUOTE_4_HD]=0)&(\\n[#LB_4_HD]=0)&(\\n[#START]=0) \
10766 . if !\\n[#LB_4_PARAHEAD] .sp -1v
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]
10778 . ds $TOC_HD_NUM_PREV \\*[$TOC_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 " "
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]
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]
10819 \\*[PDF_NM] \\n[#LEVEL]+1 \
10820 \\*[$PDF_HD_NUM] \\*[$TOC_HEAD_\\n[#LEVEL]_ITEM]
10824 . ie \\n[#PRINT_STYLE]=1 \{\
10825 . fam \\*[$TYPEWRITER_FAM]
10827 . ps \\*[$TYPEWRITER_PS]
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]
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]'+\
10847 . nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10848 \\n[#TOC_HEAD_\\n-[@LEVEL]_INDENT]+\
10849 \w'\\*[$TOC_HD_NUM]'
10852 . nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10853 \\n[#TOC_HEAD_\\n-[@LEVEL]_INDENT]
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]'+\
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]'
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'
10884 . if !\\n[#NUMBER_HEAD_\\n[@LEVEL]] \{\
10885 . nr @LEVEL \\n+[@LEVEL] 1
10886 . nr #TOC_HEAD_\\n+[@LEVEL]_INDENT +\w'\0'
10891 . nr #TOC_HEAD_\\n[@LEVEL]_INDENT \
10892 \\n[#TOC_HEAD_\\n-[@LEVEL]_INDENT]+\
10893 \\n[#TOC_HEAD_\\n+[@LEVEL]_INDENT]
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]'
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
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]
10918 .\" Non-numbered heads
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]'
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
10944 . nr #TOC_HEAD_\\n[@LEVEL]_INDENT_SET 1
10946 . rm $TOC_HEAD_\\n[#LEVEL]_ITEM
10948 . if !\\n[#PARAHEAD] .\\*[$HEAD_\\n[#LEVEL]_QUAD]
10949 . if \\n[#CAPS_ON] \{\
10951 . nr #CAPS_RESTORE 1
10953 . if \\n[#HEAD_\\n[#LEVEL]_CAPS] \{\
10957 . if \\n[#SMALLCAPS_ON] \{\
10959 . nr #SMALLCAPS_RESTORE 1
10961 . if \\n[#HEAD_\\n[#LEVEL]_SMALLCAPS] \{\
10963 . nr #SMALLCAPS_OFF 1
10965 . if !'\\*[$HEAD_\\n[#LEVEL]_COLOR]'' \
10966 . COLOR \\*[$HEAD_\\n[#LEVEL]_COLOR]
10967 . nop \X'ps: exec decornone'\c
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
10978 "\v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\\$[\\n[#ARG_NUM]]
10982 . ie !\\n[#PARAHEAD] \{\
10984 "\v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\\*[$HD_NUM]\\$[\\n[#ARG_NUM]]
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
10994 . nr #PP_TEXT_OFFSET +\\n[#PP_INDENT]
10995 . ti \\n[#PP_INDENT]u
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
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]]
11020 . ie !\\n[#PARAHEAD] \{\
11021 . UNDERSCORE \\*[$HEAD_\\n[#LEVEL]_UL_GAP] \
11022 "\v'-\\*[$HEAD_\\n[#LEVEL]_BASELINE_ADJ]'\\*[$HD_NUM]\\$[\\n[#ARG_NUM]]
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
11037 . UNDERSCORE \\*[$HEAD_\\n[#LEVEL]_UL_GAP] \
11038 "\\*[$HD_NUM]\\$[\\n[#ARG_NUM]]
11042 . nr #UNDERSCORE_WEIGHT \\n[#SAVED_UL_WEIGHT]
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]]
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]]
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) \
11070 . ti \\n[#PP_INDENT]u
11075 . UNDERSCORE2 \\*[$HEAD_\\n[#LEVEL]_UL2_GAP_1] \
11076 \\*[$HEAD_\\n[#LEVEL]_UL2_GAP_2] "\\*[$HD_NUM]\\$[\\n[#ARG_NUM]]
11080 . nr #UNDERSCORE_WEIGHT \\n[#SAVED_UL2_WEIGHT]
11082 . if !\\n[#HD_NUM_INDENT] .nr #HD_NUM_INDENT \w'\\*[$HD_NUM]'
11084 . if !\\n[#PARAHEAD] \
11085 . if \\n[#HEAD_\\n[#LEVEL]_SPACE_AFTER] .sp
11086 . if \\n[#CAPS_OFF] \{\
11090 . if \\n[#CAPS_RESTORE] \{\
11094 . if \\n[#SMALLCAPS_OFF] \{\
11096 . rr #SMALLCAPS_OFF
11098 . if \\n[#SMALLCAPS_RESTORE] \{\
11100 . rr #SMALLCAPS_RESTORE
11104 . rr #HD_NUM_INDENT
11105 . if \\n[#PARAHEAD] .ti \\n[#PP_TEXT_OFFSET]u
11106 . if !\\n[#PARAHEAD] .nr #PP 0
11108 . if \\n[#LB_4_HD] .rr #LB_4_HD
11109 . if \\n[#QUOTE_4_HD] .rr #QUOTE_4_HD
11118 . rr nl-from-heading
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
11137 \#---when called as TOC_ENTRY_STYLE this is also available---
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>.
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.
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>).
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.
11158 .MAC HEADING_STYLE END
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].
11164 . if \\n[#FROM_OLDSTYLE] .nr #LEVEL_\\n[#LEVEL]_SET 1
11166 .\" Prepend TOC_ to style strings if called as TOC_ENTRY_STYLE
11167 . if '\\$0'TOC_ENTRY_STYLE' .ds $TOC TOC_
11169 . nr #ATTRIB \\n[#NUM_ARGS]
11170 . while \\n+[#ARG_NUM]<=\\n[#ATTRIB] \{\
11171 . if '\\$1'UNDERSCORE' \{\
11172 . nr #HEAD_\\n[#LEVEL]_UNDERSCORE 1
11175 . tm1 "[mom]: The UNDERSCORE argument to \\$0 requires a rule weight.
11176 . ab [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
11178 . ds $HEAD_\\n[#LEVEL]_UL_WEIGHT \\$1
11181 . tm1 "[mom]: The UNDERSCORE argument to \\$0 requires a rule gap.
11182 . ab [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
11184 . ds $HEAD_\\n[#LEVEL]_UL_GAP \\$1
11187 . if '\\$1'NO_UNDERSCORE' \{\
11188 . rr #HEAD_\\n[#LEVEL]_UNDERSCORE
11191 . if '\\$1'UNDERSCORE2' \{\
11192 . nr #HEAD_\\n[#LEVEL]_UNDERSCORE2 1
11195 . tm1 "[mom]: The UNDERSCORE2 argument to \\$0 requires a rule weight.
11196 . ab [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
11198 . ds $HEAD_\\n[#LEVEL]_UL2_WEIGHT \\$1
11201 . tm1 "[mom]: The UNDERSCORE2 argument to \\$0 requires a rule gap.
11202 . ab [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
11204 . ds $HEAD_\\n[#LEVEL]_UL2_GAP_1 \\$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].
11210 . ds $HEAD_\\n[#LEVEL]_UL2_GAP_2 \\$1
11213 . if '\\$1'NO_UNDERSCORE2' \{\
11214 . rr #HEAD_\\n[#LEVEL]_UNDERSCORE2
11217 . if '\\$1'SPACE_AFTER' \{\
11218 . nr #HEAD_\\n[#LEVEL]_SPACE_AFTER 1
11221 . if '\\$1'NO_SPACE_AFTER' \{\
11222 . rr #HEAD_\\n[#LEVEL]_SPACE_AFTER
11225 . if '\\$1'FAMILY' \{\
11227 . ds $\\*[$TOC]HEAD_\\n[#LEVEL]_FAM \\$1
11230 . if '\\$1'FONT' \{\
11232 . ds $\\*[$TOC]HEAD_\\n[#LEVEL]_FT \\$1
11235 . if '\\$1'SIZE' \{\
11237 . ds $\\*[$TOC]HEAD_\\n[#LEVEL]_SIZE \\$1
11240 . if '\\$1'QUAD' \{\
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
11249 . if '\\$1'COLOR' \{\
11251 . ds $\\*[$TOC]HEAD_\\n[#LEVEL]_COLOR \\$1
11254 . if '\\$1'BASELINE_ADJUST' \{\
11256 . ds $HEAD_\\n[#LEVEL]_BASELINE_ADJ \\$1
11259 . if '\\$1'CAPS' \{\
11260 . nr #\\*[$TOC]HEAD_\\n[#LEVEL]_CAPS 1
11263 . if '\\$1'NO_CAPS' \{\
11264 . rr #HEAD_\\n[#LEVEL]_CAPS
11267 . if '\\$1'SMALLCAPS' \{\
11268 . nr #\\*[$TOC]HEAD_\\n[#LEVEL]_SMALLCAPS 1
11271 . if '\\$1'NO_SMALLCAPS' \{\
11272 . rr #HEAD_\\n[#LEVEL]_SMALLCAPS
11275 . if '\\$1'NUMBER' \{\
11276 . nr #NUMBER_HEAD_\\n[#LEVEL] 1
11277 . nr #HEAD_\\n[#LEVEL]_NUM 0 1
11280 . if '\\$1'NO_NUMBER' \{\
11281 . rr #NUMBER_HEAD_\\n[#LEVEL]
11284 . if '\\$1'INDENT' \{\
11286 . nr #TOC_HEAD_\\n[#LEVEL]_INDENT \\$1
11287 . nr #FROM_STYLE_\\n[#LEVEL] 1
11290 . if '\\$1'NEEDS' \{\
11292 . ds $HEAD_\\n[#LEVEL]_NEEDS \\$1
11295 . if '\\$1'SHIM' \{\
11296 . rr #HEAD_\\n[#LEVEL]_NO_SHIM
11299 . if '\\$1'NO_SHIM' \{\
11300 . nr #HEAD_\\n[#LEVEL]_NO_SHIM 1
11303 . if '\\$1'FLEX' \{\
11304 . rr #HEAD_\\n[#LEVEL]_NO_FLEX
11307 . if '\\$1'NO_FLEX' \{\
11308 . nr #HEAD_\\n[#LEVEL]_NO_FLEX 1
11313 . if d$TOC .rm $TOC
11316 .ALIAS TOC_ENTRY_STYLE HEADING_STYLE
11318 \# OLDSTYLE HEADINGS
11319 \# -----------------
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.
11327 \# Called by user with no argument, allows use of old style HEAD,
11328 \# SUBHEAD, and SUBSUBHEAD without generating the deprecated msg.
11330 \# For backward compatibility, and to ease the transition to
11331 \# the HEADING scheme for heads.
11333 \# Paraheads must be set with .HEADING <level> PARAHEAD; attempts
11334 \# to call PARAHEAD abort with an instructive message.
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 \
11347 BASELINE_ADJUST 0 \
11349 . nr #OLDSTYLE_HD 1
11352 . if !\\n[#LEVEL_2_SET] \{\
11353 . HEADING_STYLE 2 \
11357 BASELINE_ADJUST \\n[.v]/8
11358 . nr #OLDSTYLE_SH 1
11361 . if !\\n[#LEVEL_3_SET] \{\
11362 . HEADING_STYLE 3 \
11365 BASELINE_ADJUST \\n[.v]/8
11366 . nr #OLDSTYLE_SSH 1
11370 . if \\n[#PRINT_STYLE]=2 \{\
11371 . if !\\n[#LEVEL_1_SET] \{\
11372 . HEADING_STYLE 1 \
11373 FAMILY \E*[$DOC_FAM] \
11379 BASELINE_ADJUST 0 \
11381 . nr #OLDSTYLE_HD 1
11384 . if !\\n[#LEVEL_2_SET] \{\
11385 . HEADING_STYLE 2 \
11386 FAMILY \E*[$DOC_FAM] \
11389 BASELINE_ADJUST \\n[.v]/8
11390 . nr #OLDSTYLE_SH 1
11393 . if !\\n[#LEVEL_3_SET] \{\
11394 . HEADING_STYLE 3 \
11395 FAMILY \E*[$DOC_FAM] \
11398 BASELINE_ADJUST \\n[.v]/8
11399 . nr #OLDSTYLE_SSH 1
11403 . rr #FROM_OLDSTYLE
11406 \# "Deprecated" message
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.
11423 \# Wrappers around old-style headings.
11426 . if !\\n[#OLDSTYLE_HD] \{\
11427 . DEPRECATED HEAD 1
11428 . OLDSTYLE_HEADINGS HEAD
11434 . if !\\n[#OLDSTYLE_SH] \{\
11435 . DEPRECATED SUBHEAD 2
11436 . OLDSTYLE_HEADINGS SUBHEAD
11441 .MAC SUBSUBHEAD END
11442 . if !\\n[#OLDSTYLE_SSH] \{\
11443 . DEPRECATED SUBSUBHEAD 3
11444 . OLDSTYLE_HEADINGS SUBSUBHEAD
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].
11457 \# Wrapper macro for oldstyle NUMBER_HEADS, NUMBER_SUBHEADS...
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].
11466 . if '\\$0'NUMBER_HEADS' .nr level 1
11467 . if '\\$0'NUMBER_SUBHEADS' .nr level 2
11468 . if '\\$0'NUMBER_SUBSUBHEADS' .nr level 3
11470 . ie '\\$1'' .ds $PARAM NUMBER
11472 . ds $PARAM NO_NUMBER
11473 . ds $SWITCH " \\$1
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.
11480 . tm1 "\\*[mom] Setting HEADING_STYLE \\n[level] to '\\*[$PARAM]' at '\\$0\\*[$SWITCH]', line \\n[.c].
11485 .ALIAS NUMBER_HEADS HEADING_NUMBERS
11486 .ALIAS NUMBER_SUBHEADS HEADING_NUMBERS
11487 .ALIAS NUMBER_SUBSUBHEADS HEADING_NUMBERS
11488 .ALIAS NUMBER_PARAHEADS HEADING_NUMBERS
11490 \# PREFIX CHAPTER NUMBERS TO HEADINGS/TOC ENTRIES
11491 \# ----------------------------------------------
11493 \# <none> | <chapter number> | <anything>
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.
11501 .MAC PREFIX_CHAPTER_NUMBER END
11502 . ie '\\$1'' .nr #PREFIX_CH_NUM 1
11503 . el .rr #PREFIX_CH_NUM
11506 \# ====================================================================
11508 \# +++LINE BREAKS+++
11510 \# LINEBREAK CHARACTER
11511 \# -------------------
11513 \# [character] [iterations] [vertical adjustment]
11515 \# Allows user to specify a line break character and the number
11516 \# of times to repeat it horizontally.
11518 \# Without an argument, LINEBREAK_CHAR will deposit a blank line.
11520 \# Vertical adjustment requires a unit of measure (most likely
11521 \# "p"), and has to be preceded by +|-
11523 .MAC LINEBREAK_CHAR END
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
11536 . rr #LB_CHAR_ITERATIONS
11544 \# Deposits line break character.
11546 \# If $LINEBREAK_CHAR is blank, simply advances 2 line spaces.
11549 . if r #Q_AT_TOP .rr #Q_AT_TOP
11550 . ie '\\*[$LINEBREAK_CHAR]'' .sp 2
11552 . ie \\n[#END_QUOTE] .
11558 \m[\\*[$LINEBREAK_COLOR]]\v'\\*[$LINEBREAK_CHAR_V_ADJ]'\
11559 \\*[$LINEBREAK_CHAR]\m[]
11562 . QUAD \\*[$DOC_QUAD]
11565 . if r #QUOTE .rr #QUOTE
11566 . if r #END_QUOTE .rr #END_QUOTE
11569 . nr #LB_4_PARAHEAD 1
11572 \# ====================================================================
11574 \# +++PARAGRAPHS+++
11579 \# <font of running text>
11581 \# Creates or modifies string $PP_FT.
11583 \# Affects all paragraphs.
11586 . if \\n[#PRINT_STYLE]=1 \{\
11587 . ie \\n[#ITALIC_MEANS_ITALIC] .nop
11590 . if \\n[#COLLATE]=1 \
11591 . if !'\\*[$SAVED_PP_FT]'' .rm $SAVED_PP_FT
11596 \# PARAGRAPH INDENT
11597 \# ----------------
11599 \# <amount to indent paragraphs in running text (ipPcm)>
11601 \# Allows user to change the default para indent. The change will
11602 \# affect the indent of QUOTEs and BLOCKQUOTEs as well.
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.
11608 .MAC PARA_INDENT END
11610 . nr #PP_INDENT (\\$1)
11611 . nr #SAVED_PP_INDENT \\n[#PP_INDENT]
11615 . nr #PP_INDENT \\n[#SAVED_PP_INDENT]
11616 . rr #SAVED_PP_INDENT
11619 . nr #SAVED_PP_INDENT \\n[#PP_INDENT]
11625 \# INDENT FIRST PARAGRAPHS
11626 \# -----------------------
11628 \# <none> | <anything>
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.
11636 .MAC INDENT_FIRST_PARAS END
11637 . ie '\\$1'' .nr #INDENT_FIRST_PARAS 1
11638 . el .rr #INDENT_FIRST_PARAS
11641 \# INTER-PARAGRAPH SPACING
11642 \# -----------------------
11644 \# <none> | <anything>
11646 \# Adds a line space between paragraphs in body text. Block quotes
11649 \# Default is OFF. PARA_SPACE is not recommended for use with
11650 \# PRINTSTYLE TYPEWRITE without SINGLESPACE.
11652 .MAC PARA_SPACE END
11658 . ds $PP_SPACE_AMOUNT \\$1
11669 \# Figures out what to do with paragraphs under differing conditions.
11671 \# Note the use of transparent line break (\!.br) to get
11672 \# PP to work within blockquotes and epigraphs.
11674 \# PP_STYLE 1 = regular paras; 2 = blockquotes, epigraphs
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
11682 . if \\n[#DOC_TYPE]=4 \{\
11683 . if !'\\n[.z]'' .di
11684 . nr #TOTAL_FIELDS \\n[#FIELD]
11686 . nr #NUM_FIELDS 0 1
11687 . if \\n[#TOTAL_FIELDS]>0 \{\
11688 . while \\n+[#NUM_FIELDS]<=\\n[#TOTAL_FIELDS] \{\
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
11695 . rm LETTERHEAD\\n[#FIELD]
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
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]
11717 . if \\n[#TAB_ACTIVE] .TAB \\n[#CURRENT_TAB]
11718 . ie \\n[#PRINT_STYLE]=1 \{\
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
11729 . ie \\n[#ENDNOTE] \{\
11730 . FAMILY \\*[$EN_FAM]
11733 . vs \\n[#EN_LEAD]u
11734 . QUAD \\*[$EN_QUAD]
11737 . FAMILY \\*[$DOC_FAM]
11738 . if !'\\*[$SAVED_PP_FT]'' \{\
11739 . ds $PP_FT \\*[$SAVED_PP_FT]
11743 . ps \\n[#DOC_PT_SIZE]u
11744 . vs \\n[#DOC_LEAD]u
11745 . QUAD \\*[$DOC_QUAD]
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
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
11767 . if \\n[#PP_SPACE] \{\
11768 . ie \\n[#END_QUOTE] \{\
11769 . ie !'\\*[$PP_SPACE_AMOUNT]'' .sp \\*[$PP_SPACE_AMOUNT]
11773 . nr #BASELINE_MARK \\n[nl]
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
11784 . if !\\n[nl]=\\n[#BASELINE_MARK] \{\
11785 . ie !'\\*[$PP_SPACE_AMOUNT]'' .sp \\*[$PP_SPACE_AMOUNT]
11787 . rr #BASELINE_MARK
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
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
11808 . if \\n[#CONDENSE] \{\
11811 . if \\n[#EXTEND]=1 \{\
11816 . if \\n[#PP_STYLE]=2 \{\
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
11827 . ti \\n[#PP_INDENT]u/2u
11828 . if \\n[#PP_SPACE]=1 \{\
11829 . ie !'\\*[$PP_SPACE_AMOUNT]'' .ALD \\*[$PP_SPACE_AMOUNT]
11833 . if \\n[#CONDENSE] \{\
11836 . if \\n[#EXTEND]=1 \{\
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
11847 . if r #QUOTE_4_HD .rr #QUOTE_4_HD
11848 . if r #LB_4_HD .rr #LB_4_HD
11850 \# ====================================================================
11854 \# ---Line for line quotes, i.e. poetry or code snippets---
11856 \# UNDERLINE QUOTES
11857 \# ----------------
11859 \# <none> | <anything>
11861 \# Creates or modifies register #UNDERLINE_QUOTES (toggle).
11862 \# If on, line for line quotes are underlined when printstyle
11865 \# Default is ON for printstyle TYPEWRITE.
11867 .MAC UNDERLINE_QUOTES END
11868 . ie '\\$1'' .nr #UNDERLINE_QUOTES 1
11869 . el .rr #UNDERLINE_QUOTES
11875 \# <integer> | <integer with unit of measure appended>
11877 \# Creates or modifies register #Q_OFFSET_VALUE or string
11878 \# $Q_OFFSET_VALUE.
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.
11884 \# Default is 3 for typeset; 2 for typewrite.
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
11898 .ALIAS BLOCKQUOTE_INDENT QUOTE_INDENT
11903 \# <autolead value>
11905 \# Sets autolead for quotes and/or blockquotes.
11907 .MAC QUOTE_AUTOLEAD END
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)
11915 .ALIAS BLOCKQUOTE_AUTOLEAD QUOTE_AUTOLEAD
11916 .ALIAS ENDNOTE_QUOTE_AUTOLEAD QUOTE_AUTOLEAD
11917 .ALIAS ENDNOTE_BLOCKQUOTE_AUTOLEAD QUOTE_AUTOLEAD
11919 \# ALWAYS FULLSPACE QUOTES
11920 \# -----------------------
11922 \# <none> | <anything>
11924 \# Toggles register #FULLSPACE_QUOTES.
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.
11929 .MAC ALWAYS_FULLSPACE_QUOTES END
11930 . if '\\$1'' .nr #FULLSPACE_QUOTES 1
11931 . el .rr #FULLSPACE_QUOTES
11937 \# <none> | <anything>
11939 \# Indents quoted text on a line for line basis, or turns QUOTE off.
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.
11949 . if \\n[#PP]>0 .rr #START
11950 . if \\n[#LINENUMBERS]=1 \{\
11951 . nr #LINENUMBERS 2
11952 . nr #NEXT_LN \\n[ln]
11955 . if '\\$1'ADJUST' \{\
11956 . ds $Q_SPACE_ADJUST \\$2
11963 . if \\n[#LINENUMBERS]=2 \
11964 . if \\n[#SILENT_QUOTE_LN]=1 .nm \\n[#NEXT_LN] 1000 -4
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)
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]
11979 . if \\n[#PRINT_STYLE]=1 \{\
11981 . vs \\n[#DOC_LEAD]u
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
11990 . vs \\n[.ps]u+\\n[#Q_AUTOLEAD]u
11991 . nr #Q_LEAD \\n[.v]
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
11997 . vs \\n[.ps]u+\\n[#EN_Q_AUTOLEAD]u
11998 . nr #EN_Q_LEAD \\n[.v]
12001 . nr #Q_LEAD_REAL \\n[.v]
12002 . if \\n[#QUOTE_COLOR]=1 \{\
12004 . COLOR \\*[$QUOTE_COLOR]
12008 . if \\n[#LINENUMBERS]=2 \{\
12009 . ie \\n[#QUOTE_LN]=1 \{\
12010 . if '\\n[#Q_LN_GUTTER]'' .nr #Q_LN_GUTTER \\n[#LN_GUTTER]
12012 . nm \\n[ln] "" \\n[#Q_LN_GUTTER] -3-\\n[#Q_LN_GUTTER]
12016 . if !\\n[#SILENT_QUOTE_LN] .NUMBER_LINES OFF
12018 . nr #Q_TOP \\n[nl]
12019 . if \\n[#PRINT_STYLE]=1 \
12020 . if \\n[#UNDERLINE_QUOTES] .FT I
12028 \# <none> [ BR | BREAK | SPREAD ]
12030 \# <anything> [ BR | BREAK | SPREAD ]
12032 \# Takes care of administrivia associated with setting code snippets.
12037 . ie '\\n[.z]'FLOAT*DIV' 'br
12041 . if '\\$1'BREAK' \{\
12042 . ie '\\n[.z]'FLOAT*DIV' 'br
12046 . if '\\$1'SPREAD' \{\
12047 . ie '\\n[.z]'FLOAT*DIV' 'brp
12052 . ds $RESTORE_FAM \\n[.fam]
12053 . ds $RESTORE_FT \\n[.sty]
12054 . ie \\n[#PRINT_STYLE]=1 \{\
12056 . ie \\n[#CODE_FT]=1 .ft \\*[$CODE_FT]
12062 . if \\n[#UNDERLINE_QUOTES]=1 \{\
12063 . nr #RESTORE_UNDERLINE 1
12064 . UNDERLINE_QUOTES OFF
12070 . ie \\n[#CODE_FAM]=1 .fam \\*[$CODE_FAM]
12073 . fam \\*[$CODE_FAM]
12075 . ie \\n[#CODE_FT]=1 .ft \\*[$CODE_FT]
12080 . if \\n[#CODE_COLOR]=1 .COLOR \\*[$CODE_COLOR]
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
12086 . if \\n[#SQ_ON] \{\
12093 . fam \\*[#RESTORE_FAM]
12094 . ft \\*[#RESTORE_FT]
12095 . if !\\n[#CODE_SIZE_ADJ]=0 .ps \\n[#RESTORE_SIZE]
12099 . if \\n[#PRINT_STYLE]=2 .char ' \[cq]
12101 . if \\n[#LINENUMBERS] .nn
12102 . if \\n[#CODE_COLOR]=1 .gcolor
12103 . if \\n[#RESTORE_UNDERLINE]=1 \{\
12104 . rr #RESTORE_UNDERLINE
12107 . if \\n[#SQ_WAS_ON]=1 \{\
12111 . if \\n[#QUOTE] .sp -1
12115 \# ---Blockquotes---
12120 \# <none> | <anything>
12122 \# Indents quoted text in fill mode and shortens line length
12123 \# equivalently, or turns BLOCKQUOTE off.
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.
12129 \# .PP after blockquote is optional if there's only one para,
12130 \# but required if there's more than one.
12132 .MAC BLOCKQUOTE END
12134 . if \\n[#PP]>0 .rr #START
12135 . if \\n[#LINENUMBERS]=1 \{\
12136 . nr #LINENUMBERS 2
12137 . nr #NEXT_LN \\n[ln]
12140 . if '\\$1'ADJUST' \{\
12141 . ds $BQ_SPACE_ADJUST \\$2
12144 . if \\n[in-cutaround] .nr #PP_INDENT \\n[restore-pp-ind]/2
12149 . if \\n[#LINENUMBERS]=2 \
12150 . if \\n[#SILENT_BQUOTE_LN]=1 .nm \\n[#NEXT_LN] 1000 -4
12155 . if \\n[in-cutaround] \{\
12156 . if '\\*[cutaround-type]'RIGHT' \{\
12158 . nr #L_LENGTH \\n[#DOC_L_LENGTH]-\\n[cutaround-width]-1v\\*[width-adj]
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 \
12169 \\n[#RESET_L_LENGTH]u-\\n[#EN_TEXT_INDENT]u-(\\n[#EN_PP_INDENT]u*(\\n[#BQ_OFFSET_VALUE]u*2u))
12172 \\n[#RESET_L_LENGTH]u-\\n[#EN_TEXT_INDENT]u-(\\*[$BQ_OFFSET_VALUE]*2u)
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))
12178 . ll \\n[#L_LENGTH]u-(\\*[$BQ_OFFSET_VALUE]u*2u)
12183 . if \\n[#COLUMNS] \{\
12184 . ie r#BQ_OFFSET_VALUE \
12186 \\n[#COL_L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#BQ_OFFSET_VALUE]u*2u))
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 \
12193 \\n[#RESET_L_LENGTH]u-\\n[#EN_TEXT_INDENT]u-(\\n[#EN_PP_INDENT]u*(\\n[#BQ_OFFSET_VALUE]u*2u))
12196 \\n[#RESET_L_LENGTH]u-\\n[#EN_TEXT_INDENT]u-(\\*[$BQ_OFFSET_VALUE]*2u)
12198 . if \\n[#EN_NUMBERS_ALIGN_LEFT] \{\
12199 . ie r#BQ_OFFSET_VALUE \
12201 \\n[#COL_L_LENGTH]u-(\\n[#EN_PP_INDENT]u*(\\n[#BQ_OFFSET_VALUE]u*2u))
12203 . ll \\n[#COL_L_LENGTH]u-(\\*[$BQ_OFFSET_VALUE]*2u)
12208 . if \\n[#PRINT_STYLE]=1 \{\
12210 . vs \\n[#DOC_LEAD]u
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
12220 . vs \\n[.ps]u+\\n[#BQ_AUTOLEAD]u
12221 . nr #BQ_LEAD \\n[.v]
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
12227 . vs \\n[.ps]u+\\n[#EN_BQ_AUTOLEAD]u
12228 . nr #EN_BQ_LEAD \\n[.v]
12231 . nr #BQ_LEAD_REAL \\n[.v]
12232 . if \\n[#BQUOTE_COLOR]=1 \{\
12234 . COLOR \\*[$BQUOTE_COLOR]
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
12241 . if \\n[#LINENUMBERS]=2 \{\
12242 . ie \\n[#BQUOTE_LN]=1 \{\
12243 . if '\\n[#BQ_LN_GUTTER]'' .nr #BQ_LN_GUTTER \\n[#LN_GUTTER]
12245 . nm \\n[ln] "" \\n[#BQ_LN_GUTTER] -3-\\n[#BQ_LN_GUTTER]
12249 . if !\\n[#SILENT_BQUOTE_LN] .NUMBER_LINES OFF
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
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
12265 . el .DO_BLOCKQUOTE
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).
12283 . if \\n[#DIVER_LN_OFF] \{\
12284 \!. NUMBER_LINES OFF
12287 . nr #Q_DEPTH \\n[.d]
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].
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]) \{\
12302 . rr #RESET_FN_COUNTERS
12306 . nr #SAVED_FN_NUMBER \\n[#FN_NUMBER]
12307 . nr #DONE_ONCE 0 1
12310 . nr #Q_LEAD_DIFF \\n[#LEAD]-\\n[#\\*[BQ]_LEAD_REAL]
12311 . if !'\\n[.z]'FLOAT*DIV' \{\
12313 . nr #CALCULATE_ONLY 1
12314 . nr #CURRENT_V_POS \\n[nl]+\\n[#Q_DEPTH]
12316 . rr #CALCULATE_ONLY
12317 . nr #Q_SPACE_EQ (\\n[#SHIM]/2)
12318 . nr #TRAP \\n[.t]-1
12320 . if \\n[#ENDNOTE] \{\
12321 . nr #RESET_QUOTE_SPACING \\n[#FULLSPACE_QUOTES]
12322 . ALWAYS_FULLSPACE_QUOTES
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
12329 . if \\n[#HEAD]=1 .RLD \\n[#DOC_LEAD]u
12331 . if \\n[#PRINT_STYLE]=2 \{\
12332 . ie \\n[#PP_SPACE] \{\
12337 . ie \\n[#FULLSPACE_QUOTES] .ALD \\n[#DOC_LEAD]u
12338 . el .ALD \\n[#DOC_LEAD]u/2u
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
12350 . ie (\\n[#TRAP_DISTANCE]-\\n[#DOC_LEAD])<\\n[#DOC_LEAD] .Q_NOFIT
12352 . ie (\\n[#Q_DEPTH]+\\n[.v])=(\\n[#TRAP_DISTANCE]-1) .Q_NOFIT
12360 . if \\n[#LINEBREAK] \{\
12362 . ie !\\n[@TOP] .sp -\\n[#DOC_LEAD]u
12365 . sp |\\n[#T_MARGIN]u-\\n[#BQ_LEAD]u
12370 . ie !'\\*[$\\*[BQ]_OFFSET_VALUE]'' \
12371 . nr #\\*[BQ]_OFFSET \\n[#L_MARGIN]+(\\*[$\\*[BQ]_OFFSET_VALUE])
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]
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
12390 . po \\n[#\\*[BQ]_OFFSET]u
12391 . if '\\n[.z]'FLOAT*DIV' \!.po \\n[#\\*[BQ]_OFFSET]u
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]
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
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
12410 . if \\n[#QUOTE]=1 \{\
12411 . if !'\\*[$Q_SPACE_ADJUST]'' .sp +\\*[$Q_SPACE_ADJUST]
12414 . if !'\\*[$Q_SPACE_ADJUST]'' \{\
12415 . sp -\\*[$Q_SPACE_ADJUST]
12416 . rm $Q_SPACE_ADJUST
12419 . if \\n[#QUOTE]=2 \{\
12420 . if !'\\*[$BQ_SPACE_ADJUST]'' .sp +\\*[$BQ_SPACE_ADJUST]
12423 . if !'\\*[$BQ_SPACE_ADJUST]'' \{\
12424 . sp -\\*[$BQ_SPACE_ADJUST]
12425 . rm $BQ_SPACE_ADJUST
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
12432 . if \\n[reset-ll] \{\
12433 . if '\\*[cutaround-type]'RIGHT' \{\
12434 . ll \\n[#DOC_L_LENGTH]u
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
12443 . if !\\n[#NO_FLEX] .FLEX
12445 . if \\n[#PRINT_STYLE]=2 \{\
12446 . ie \\n[#START] \{\
12447 . ie \\n[#PP_SPACE] .
12449 . sp \\n[#DOC_LEAD]u
12450 . ie !\\n[#NO_SHIM] .SHIM
12452 . if !\\n[#NO_FLEX] .FLEX
12456 . ie \\n[#HEAD]=1 \{\
12457 . sp \\n[#DOC_LEAD]u
12458 . ie !\\n[#NO_SHIM] .SHIM
12460 . if !\\n[#NO_FLEX] .FLEX
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
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' \{\
12478 . ie !\\n[#NO_SHIM] .SHIM
12480 . if !\\n[#NO_FLEX] .FLEX
12484 . ie !\\n[#NO_SHIM] .SHIM
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]) \{\
12494 . sp -1v-\\n[#Q_LEAD_DIFF]u
12495 . nr #Q_LEAD_DIFF_CHECK 1
12503 . if \\n[#RESTORE_NO_SHIM] .nr #NO_SHIM 1
12505 . if \\n[#LINENUMBERS]=2 \{\
12506 . nr #LINENUMBERS 1
12507 . if !\\n[#ENDNOTE] \{\
12508 . ie \\n[#RESTORE_LN_NUM]=1 \{\
12520 . if \\n[#ENDNOTE] \
12521 . nr #FULLSPACE_QUOTES \\n[#RESET_QUOTE_SPACING]
12522 . if r #HEAD .rr #HEAD
12523 . if r #EPIGRAPH .rr #EPIGRAPH
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]
12536 . if \\n[#ENDNOTE] .in \\n[#EN_TEXT_INDENT]u
12538 . ie !\\n[#ENDNOTE] .QUAD \\*[$DOC_QUAD]
12539 . el .QUAD \\*[EN_QUAD]
12540 . if r #DELAY_SHIM \{\
12541 . ie !\\n[#NO_SHIM] .SHIM
12543 . if !\\n[#NO_FLEX] .FLEX
12546 . if \\n[#PRINT_STYLE]=1 \
12547 . if \\n[#UNDERLINE_QUOTES] .FT R
12549 . rr #\\*[BQ]_LEAD_REAL
12551 . if \\n[#DOC_TYPE]=5 .NO_SHIM
12552 . if '\\n[.z]'FLOAT*DIV' \!.po \\n[#L_MARGIN]u
12555 .ALIAS DO_BLOCKQUOTE DO_QUOTE
12557 \# Utility macros for DO_QUOTE
12558 \# ---------------------------
12562 . ie \\n[#HEAD]=1 .ALD \\n[#Q_LEAD_DIFF]u
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
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
12580 . if \\n[#QUOTE]=1 .vs \\n[#Q_LEAD]u
12581 . if \\n[#QUOTE]=2 .vs \\n[#BQ_LEAD]u
12583 . sp -1v+\\n[#Q_LEAD_DIFF]u
12587 . sp \\n[#DOC_LEAD]u/2u
12590 . sp \\n[#DOC_LEAD]u/2u
12593 . if \\n[#DIVER_FN]=2 .rr #DIVER_FN
12594 . if !\\n[#NO_FLEX] .FLEX
12601 . if \\n[#QUOTE]=1 \{\
12603 . ds quote-type quote
12605 . if \\n[#QUOTE]=2 \{\
12607 . ds quote-type blockquote
12609 . if \\n[has-caption] \{\
12611 . if !\\n[nl]=\\n[#PAGE_TOP] \
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
12622 . if \\n[#HEAD]=1 .
12624 . if \\n[#Q_DEPTH]=0 \
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
12631 . if '\\*[$QUOTE_TYPE]'Q' .sp \\n[#DOC_LEAD]u
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) \{\
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]
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
12661 \# ====================================================================
12663 \# +++PAGINATION+++
12668 \# <none> | <anything>
12670 \# Turns page numbering off or on during document processing.
12675 . ie '\\$1'' .nr #PAGINATE 1
12678 . rr #PAGE_NUM_V_POS
12680 . if \\n[#HF_OFF]=1 \{\
12681 . rr #PAGINATION_STATE
12686 \# SUSPEND PAGINATION (before ENDNOTES)
12687 \# ------------------
12691 \# Creates register #SUSPEND_PAGINATION
12693 \# Useful only to suspend pagination before outputting endnotes.
12695 .MAC SUSPEND_PAGINATION END
12696 . nr #SUSPEND_PAGINATION 1
12699 \# RESTORE PAGINATION (after ENDNOTES)
12700 \# ------------------
12704 \# Removes register #SUSPEND_PAGINATION. Creates register
12705 \# #DEFER_PAGINATION
12707 \# Useful only to restore pagination after outputting endnotes.
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
12715 \# PAGE NUMBER FORMAT
12716 \# ------------------
12718 \# DIGIT | ROMAN | roman | ALPHA | alpha
12720 \# Assigns user entered format to #PAGENUMBER.
12722 .MAC PAGENUM_STYLE END
12723 . nr #PAGENUM_STYLE_SET 1
12724 . if '\\$1'DIGIT' \{\
12725 . ds $PAGENUM_STYLE \\$1
12728 . if '\\$1'ROMAN' \{\
12729 . ds $PAGENUM_STYLE \\$1
12732 . if '\\$1'roman' \{\
12733 . ds $PAGENUM_STYLE \\$1
12736 . if '\\$1'ALPHA' \{\
12737 . ds $PAGENUM_STYLE \\$1
12740 . if '\\$1'alpha' \{\
12741 . ds $PAGENUM_STYLE \\$1
12746 \# HYPHENS AROUND PAGE NUMBERS
12747 \# ---------------------------
12749 \# <none> | <anything>
12751 \# Creates or modifies register #PAGE_NUM_HYPHENS.
12752 \# Used to dis/enable hyphens on either side of page numbers.
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
12762 \# PAGENUMBER POSITION
12763 \# -------------------
12765 \# TOP | BOTTOM LEFT | CENTER | RIGHT
12767 \# Creates or modifies various PAGE_NUM_H | V_POS registers.
12768 \# Used to position page numbers.
12770 \# Default is center/bottom.
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
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]
12795 \m[\\*[$PAGE_NUM_COLOR]]\
12796 \\*[$HYPHEN]\|\\*[$PRE_HY_KN]\\n[#PAGENUMBER]\\*[$POST_HY_KN]\|\\*[$HYPHEN]
12802 \# PRINT PAGE NUMBER
12803 \# -----------------
12807 \# Prints page number if PAGINATE=1.
12809 .MAC PRINT_PAGE_NUMBER END
12812 . po \\n[#DOC_L_MARGIN]u
12813 . ll \\n[#DOC_L_LENGTH]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
12821 . ie \\n[#PAGE_NUM_H_POS]=1 .LEFT
12825 . ie \\n[#PAGE_NUM_H_POS]=1 .RIGHT
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
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
12839 . if \\n[#BIB_FIRST_PAGE] \{\
12840 . if \\n[#BIB_FIRST_PN] .PAGENUMBER \\n[#BIB_FIRST_PN]
12841 . rr #BIB_FIRST_PAGE
12843 . ie \\n[#DRAFT_WITH_PAGENUM] \{\
12844 . ie '\\*[$REVISION]'' \
12845 . PRINT "\\*[$DRAFT_STRING]\\*[$DRAFT] / \\n[#PAGENUMBER]"
12847 . ie '\\*[$DRAFT]'' \
12848 . PRINT "\\*[$REVISION_STRING] \\*[$REVISION] / \\n[#PAGENUMBER]"
12851 "\\*[$DRAFT_STRING]\\*[$DRAFT], \\*[$REVISION_STRING] \\*[$REVISION] / \
12856 . ie \\n[#PAGE_NUM_HYPHENS] \{\
12857 . if '\\*[$PAGENUM_STYLE]'DIGIT' \{\
12859 1\\R'#CAP_HEIGHT \\n[.cht]'
12863 . if '\\*[$PAGENUM_STYLE]'ROMAN' \{\
12865 I\\R'#CAP_HEIGHT \\n[.cht]'
12869 . if '\\*[$PAGENUM_STYLE]'ALPHA' \{\
12871 E\\R'#CAP_HEIGHT \\n[.cht]'
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]\|-
12881 . ie !d$PAGENUM_STRING .PRINT \m[\\*[$PAGE_NUM_COLOR]]\\n[#PAGENUMBER]
12882 . el .PRINT \m[\\*[$PAGE_NUM_COLOR]]\\*[$PAGENUM_STRING]
12886 . nr #DIVER_DEPTH 0
12889 \# ====================================================================
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.
12898 \# The macros are heavily commented.
12900 \# FOOTNOTE AUTOLEAD
12901 \# -----------------
12903 \# <autolead value for footnotes>
12905 \# Creates or modifies register #FN_AUTOLEAD.
12907 \# Default is #DOC_LEAD/2 for TYPEWRITE; 2 for TYPESET
12909 .MAC FOOTNOTE_AUTOLEAD END
12910 . nr #FN_AUTOLEAD (p;\\$1)
12913 \# FOOTNOTE MARKERS
12914 \# ----------------
12916 \# <none> | <anything>
12918 \# Turns generation of footnote markers on or off.
12922 .MAC FOOTNOTE_MARKERS END
12923 . ie '\\$1'' .nr #FN_MARKERS 1
12924 . el .nr #FN_MARKERS 0
12927 \# FOOTNOTE MARKER STYLE
12928 \# ---------------------
12930 \# STAR | NUMBER | LINE
12932 \# Sets register #FN_MARKER_STYLE, used in FOOTNOTE to determine
12933 \# the style of footnote markers.
12935 \# 1=STAR; 2=NUMBER; 3=LINE. LINE means "use output line numbers".
12936 \# Default is STAR.
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].
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.
12954 . nr #FN_MARKER_STYLE 1
12955 . if \\n[#NEWPAGE]=1 .rr #NEWPAGE
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].
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.
12973 . nr #FN_MARKER_STYLE 2
12975 . if '\\$1'NO_SUPERSCRIPT' .nr #NO_SUPERSCRIPT 1
12976 . if \\n[#NEWPAGE]=1 .rr #NEWPAGE
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
12987 \# FOOTNOTE NUMBER PLACEHOLDERS
12988 \# ----------------------------
12990 \# <number of placeholders>
12992 \# Sets register #FN_NUMBER_PLACEHOLDERS, used to establish whether to
12993 \# right pad a footnote number (in the footnote itself, not body copy).
12995 \# No default is set for this; user must determine if, and where, it's
12998 .MAC FOOTNOTE_NUMBER_PLACEHOLDERS END
12999 . nr #FN_NUMBER_PLACEHOLDERS \\$1
13002 \# FOOTNOTE LINENUMBER MARK
13003 \# ------------------------
13005 \# This string, when called inline, stores the current output line
13006 \# number in register #FN_MARK for use with FOOTNOTE.
13008 .ds FN_MARK \R'#FN_MARK \En[ln]'
13010 \# FOOTNOTE LINENUMBER SEPARATOR
13011 \# -----------------------------
13013 \# <user-defined separator>
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.
13021 .MAC FOOTNOTE_LINENUMBER_SEPARATOR END
13022 . rr #FN_LN_BRACKETS
13024 . ds $FN_LN_SEP "\\$1
13027 \# FOOTNOTE LINENUMBER BRACKETS
13028 \# ----------------------------
13030 \# PARENS | SQUARE | BRACES or ( | [ | {
13032 \# Sets register #FN_LN_BRACKETS to 1, and creates strings
13033 \# $FN_OPEN_BRACKET and $FN_CLOSE_BRACKET according to the given
13036 .MAC FOOTNOTE_LINENUMBER_BRACKETS END
13038 . nr #FN_LN_BRACKETS 1
13039 . if '\\$1'PARENS' \{\
13040 . ds $FN_OPEN_BRACKET (
13041 . ds $FN_CLOSE_BRACKET )
13044 . ds $FN_OPEN_BRACKET (
13045 . ds $FN_CLOSE_BRACKET )
13047 . if '\\$1'SQUARE' \{\
13048 . ds $FN_OPEN_BRACKET [
13049 . ds $FN_CLOSE_BRACKET ]
13052 . ds $FN_OPEN_BRACKET [
13053 . ds $FN_CLOSE_BRACKET ]
13055 . if '\\$1'BRACES' \{\
13056 . ds $FN_OPEN_BRACKET {
13057 . ds $FN_CLOSE_BRACKET }
13060 . ds $FN_OPEN_BRACKET {
13061 . ds $FN_CLOSE_BRACKET }
13065 \# RESET FOOTNOTE NUMBER
13066 \# ---------------------
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.
13074 .MAC RESET_FOOTNOTE_NUMBER END
13075 . ie '\\$1'' .nr #FN_NUMBER 0 1
13076 . el .nr #RESET_FN_NUMBER 1
13079 \# FOOTNOTE RULE LENGTH
13080 \# --------------------
13082 \# <length of rule used to separate footnotes from running text>
13084 \# Creates or modifies registers #FN_RULE_LENGTH.
13086 \# Requires unit of measure (iPpcm).
13087 \# Default is 4P for both PRINTSTYLEs.
13089 .MAC FOOTNOTE_RULE_LENGTH END
13090 . nr #FN_RULE_LENGTH (\\$1)
13093 \# FOOTNOTE_RULE_ADJ
13094 \# -----------------
13096 \# <number of points to raise footnote rule from it's baseline position>
13098 \# Creates or modifies register #FN_RULE_ADJ.
13100 \# Default is 3p for both TYPESTYLES.
13102 \# Requires unit of measure.
13104 .MAC FOOTNOTE_RULE_ADJ END
13105 . nr #FN_RULE_ADJ (\\$1)
13111 \# <none> | <anything>
13113 \# Turns printing of footnote separator rule on or off. If invoked as
13114 \# PRINT_FOOTNOTE_RULE, prints footnote separator rule.
13118 \# Invoked in FOOTNOTE (as PRINT_FOOTNOTE_RULE) as 1st line of a footnote
13119 \# if the footnote number (#FN_COUNT) is 1.
13121 .MAC FOOTNOTE_RULE END
13122 . ie '\\$0'PRINT_FOOTNOTE_RULE' \{\
13123 . if \\n[#FN_RULE]=0 .RLD 1v
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]
13135 . ie '\\$1'' .nr #FN_RULE 1
13136 . el .nr #FN_RULE 0
13140 \# FOOTNOTE SPACING
13141 \# ----------------
13143 \# <per item post footnote spacing> | <anything>
13145 \# Enables printing of post footnote spacing.
13147 \# Default is no space.
13149 .MAC FOOTNOTE_SPACING END
13150 . ie \B'\\$1' .ds $FN_SPACE \\$1
13154 \# FOOTNOTE FIRST LINE INDENT
13155 \# --------------------------
13159 \# Indents first line of footnotes.
13161 \# Default is no indent.
13163 .MAC FOOTNOTE_INDENT END
13164 . nr #FN_INDENT \\$1
13167 \# RUN ON FOOTNOTES
13168 \# ----------------
13170 \# <none> | <anything>
13172 \# Toggles run-on footnotes on or off.
13174 .MAC FOOTNOTES_RUN_ON END
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.
13184 . if \\n[#FN_MARKER_STYLE]=1 .RUNON_WARNING
13185 . if \\n[#FN_MARKER_STYLE]=2 .RUNON_WARNING
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.
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.
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.
13220 \# <none> | INDENT L|LEFT|R|RIGHT|B|BOTH <indent value> | <anything>
13222 \# Begins collecting and diverting footnote text if no argument
13223 \# given. Otherwise, ends diversion FOOTNOTES, measures footnote
13224 \# depth, and sets footnote trap.
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.
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.
13237 . if \\n[#UNDERLINE_ON] \{\
13239 . nr #UNDERLINE_WAS_ON_FN 1
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].
13247 . if \\n[#FN_MARK]=0 .nr #FN_MARK \\n[ln]
13248 . nr #FN_MARK_2 \\n[ln]
13249 . if '\\n[.z]'P_QUOTE' \{\
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".
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".
13278 .\" Begin processing footnotes that occur inside QUOTE, BLOCKQUOTE
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
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
13307 . nr #SAVED_FN_COUNT \\n[#FN_COUNT]+1
13308 . nr #SAVED_FN_COUNT_FOR_COLS \\n[#FN_COUNT_FOR_COLS]+1
13310 .\" End processing footnotes that occur inside QUOTE, BLOCKQUOTE or
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
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
13343 . if \\n[#FN_MARKERS] \{\
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
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
13383 .\" Marker style superscript numbers
13384 . if \\n[#FN_MARKER_STYLE]=2 \{\
13385 . if \\n[#PRINT_STYLE]=1 \
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 \
13390 "\*[SUP]\\n+[#FN_NUMBER]\*[SUPX]\c"
13395 .\" More housekeeping
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])
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
13409 . nr #PP_STYLE_PREV \\n[#PP_STYLE]
13411 . if \\n[#INDENT_FIRST_PARAS] .nr #INDENT_FIRSTS 1
13412 . INDENT_FIRST_PARAS
13413 .\" Prepare FOOTNOTE to receive footnote text.
13415 . ll \\n[#DOC_L_LENGTH]u
13417 . if \\n[#COLUMNS]=1 \{\
13418 . ll \\n[#COL_L_LENGTH]u
13421 . if \\n[#FN_R_INDENT] \{\
13422 . ll -\\n[#FN_R_INDENT]u
13425 . if \\n[#FN_BR_INDENT] \{\
13426 . ll -\\n[#FN_BR_INDENT]u
13429 . FAMILY \\*[$FN_FAM]
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 \{\
13436 . ie \\n[#SINGLE_SPACE] .vs \\n[#ORIGINAL_DOC_LEAD]u
13437 . el .vs \\n[#ORIGINAL_DOC_LEAD]u/2u
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
13449 . el .di FN_IN_DIVER
13452 . ie \\n[#RUN_ON] \{\
13453 . da RUNON_FN_IN_DIVER
13454 . nr #RUNON_FN_IN_DIVER 1
13456 . el .da FN_IN_DIVER
13461 . ie \\n[#RUN_ON] \{\
13462 . da RUNON_FOOTNOTES
13463 . nr #RUNON_FOOTNOTES 1
13467 . if \\n[#FOOTNOTE_COLOR]=1 \{\
13470 \m[\\*[$FOOTNOTE_COLOR]]
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
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
13496 . rr #FN_DEFER_SPACE
13497 . rr #SAVED_DIVER_FN_COUNT
13499 . if \\n[#DIVERTED]=3 \{\
13500 . if \\n[#FN_COUNT]>0 \{\
13504 .\" Add footnote rule (or, if no rule, some whitespace).
13505 .\" N.B.- this line increments #FN_COUNT each and every time FOOTNOTE
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]
13528 . ds $RESTORE_SS_VAR \\*[$SS_VAR]
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
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
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
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
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"
13582 . PRINT "\h'0+\\n[#FN_INDENT]u'(\\n[#FN_NUMBER])\|\c"
13585 . ie \\n[#FN_NUMBER_LENGTH]<\\n[#FN_NUMBER_PLACEHOLDERS] \
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"
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"
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"
13597 . PRINT "\h'0+\\n[#FN_INDENT]u'\*[SUP]\\n[#FN_NUMBER]\*[SUPX]\*[FU 3]\c"
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
13610 . if \\n[#REF]=1 \{\
13611 . if !\\n[#RUN_ON]=1 \{\
13612 \!. ti +\\n[#REF_FN_INDENT]uu
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'
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'
13626 . ie \\n[#FN_MARK_2]=\\n[#FN_MARK] \
13627 . ds $FN_LINENUMBER \\n[#FN_MARK]\\*[$FN_LN_SEP]
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]
13633 . if !\\n[#NO_FN_MARKER] \
13634 . PRINT \\*[$FN_LINENUMBER]\c
13635 . rm $FN_LINENUMBER
13640 .\" If INDENT arg is passed to FOOTNOTE, calculate the indent...
13641 . ie '\\$1'INDENT' \{\
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)
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
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
13660 .\" ...then re-run FOOTNOTE without an argument.
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
13675 . if \\n[#REF]=1 \{\
13678 .\" Terminate FOOTNOTES or FN_IN_DIVER diversion
13680 . HY_SET 1 \\n[#DIVERSIONS_HY_MARGIN]u (\\n[#PT_SIZE]u/1000u/8u)p
13682 .\" More housekeeping
13683 .\" Turn off indent possibly set by FOOTNOTE INDENT
13686 . if \\n[#UNDERLINE_WAS_ON_FN] \{\
13688 . rr #UNDERLINE_WAS_ON_FN
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
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
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 \{\
13713 . nr #FN_DEPTH +\\n[#DIVER_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]
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
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
13737 .\" Recreate FOOTNOTES with rule followed by text of unformatted
13738 .\" run-on footnotes.
13740 . ie \\n[#FN_RULE]=0 .RLD 1v
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'
13749 . if \\n[#RUNON_FOOTNOTES] \{\
13751 . rr #RUNON_FOOTNOTES
13753 . if \\n[#RUNON_FN_IN_DIVER] \{\
13754 . RUNON_FN_IN_DIVER
13755 . rr #RUNON_FN_IN_DIVER
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
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
13777 . el .nr #FN_DEFER_SPACE 1
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] \{\
13786 . while (\\n+[#FN_LINES]*\\n[#FN_LEAD])<\\n[#SPACE_REMAINING] \{\
13787 . nr #FN_DEPTH (\\n[#FN_LINES]*\\n[#FN_LEAD])
13789 . nr #VFP_DIFF \\n[#FN_DEPTH]-\\n[#SAVED_FN_DEPTH_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] \{\
13800 . nr #FN_DEPTH \\n[#SAVED_FN_DEPTH_2]
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]
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]
13824 . nr #VARIABLE_FOOTER_POS -\\n[#FN_DEPTH]
13825 . if \\n[#DIVERTED]=1 .nr #DIVERTED 3
13828 . el .nr #VARIABLE_FOOTER_POS -(\\n[#FN_DEPTH])
13830 . el .nr #VARIABLE_FOOTER_POS -(\\n[#FN_DEPTH])
13832 . el .nr #VARIABLE_FOOTER_POS -(\\n[#FN_DEPTH])
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]
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 \{\
13849 \!. ALD \\n[#FN_LEAD]u
13852 . if \\n[#RESET_FN_NUMBER] \{\
13854 \!. ALD \\n[#FN_LEAD]u
13863 . nr #FN_DEPTH \\n[#SAVED_FN_DEPTH_1]+\\n[#VFP_DIFF]
13866 . nr #VARIABLE_FOOTER_POS -\\n[#VFP_DIFF]
13867 . nr #FN_DEPTH \\n[#SAVED_FN_DEPTH_1]+\\n[#VFP_DIFF]
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
13883 . if \\n[#FN_COUNT]>1 \{\
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
13899 . nr #NO_FN_MARKER 0
13901 . if \\n[#NUM_ARGS]=2 \{\
13902 . if '\\$2'BREAK' .BR
13907 \# Utility macros to manage footnotes that occur inside diversions
13908 \# ---------------------------------------------------------------
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.
13914 \# 1. Pre-footnote processing for footnotes in diversions
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.
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
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
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
13945 \# b) Treat as a normal footnote, including defers.
13947 .MAC DIVER_FN_2_PRE END
13948 . nr #RESET_FN_COUNTERS 2
13951 \# 2. Post-footnote processing for footnotes in diversions
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.
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] .
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
13980 \# The main macros that handle footnote processing.
13981 \# -----------------------------------------------
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).
13990 .MAC FN_OVERFLOW_TRAP END
13991 . if \\n[#FN_COUNT] \{\
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
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
14011 \!. RLD \\n[#FN_LEAD]u
14017 . rr #PREV_FN_DEFERRED
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
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.
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] \{\
14039 . nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]
14042 . if \\n[#FN_DEFER]=1 .nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]
14043 . if \\n[#FN_DEFER]=2 \{\
14045 . nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]
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
14056 . DEFERRED-FOOTNOTE
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
14064 . el .nr #PREV_FN_DEFERRED 1
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
14072 . el .nr #FN_COUNT 0 1
14073 . if \\n[#DIVER_FN]=2 .rr #DIVER_FN
14074 . rr #FROM_DIVERT_FN
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
14081 .MAC DIVERT_FN_LEFTOVER END
14082 . nr #NO_FN_MARKER 1
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
14097 . rr #FN_OVERFLOW_DEPTH
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.
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
14111 . if \\n[#FN_OVERFLOW_DEPTH] .nf
14112 . ie dRUNON_FN_IN_DIVER \{\
14113 . RUNON_FN_IN_DIVER
14114 . rm RUNON_FN_IN_DIVER
14124 \# ====================================================================
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.
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.
14142 \# ENDNOTE POINT SIZE
14143 \# ------------------
14145 \# <base point size for endnotes>
14147 \# Creates or modifies register #EN_PS.
14149 \# Default is same as running text in body of document.
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.
14162 .MAC ENDNOTE_PT_SIZE END
14163 . nr #EN_PS (p;\\$1)
14167 \# ----------------
14169 \# <per item endnote spacing> | <anything>
14171 \# Enables space between endnotes items.
14173 \# Default is no space.
14175 .MAC ENDNOTE_SPACING END
14176 . ie \B'\\$1' .ds $EN_SPACE \\$1
14180 \# ENDNOTES_HDRFTR_CENTER
14181 \# ----------------------
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.
14192 .MAC ENDNOTES_HDRFTR_CENTER END
14193 . ie '\\$1'' .nr #EN_HDRFTR_CENTER 1
14194 . el .rr #EN_HDRFTR_CENTER
14200 \# <title for endnotes page>
14202 \# Creates or modifies string $EN_STRING.
14204 \# Default is "Endnotes"
14206 .MAC ENDNOTES_HEADER_STRING END
14207 . ds $EN_STRING \\$1
14210 .ALIAS ENDNOTE_STRING ENDNOTES_HEADER_STRING
14212 \# ENDNOTE STRING START POSITION
14213 \# ----------------------------
14215 \# <distance from page top>
14217 \# Creates or modifies register #EN_STRING_V_POS
14219 .MAC ENDNOTES_HEADER_V_POS END
14220 . nr #EN_STRING_V_POS (\\$1)
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
14227 \# ENDNOTE HEADER CAPS and SMALLCAPS
14228 \# ---------------------------------
14230 \# <none> | <anything>
14232 \# Turns capitalization or smallcaps style of the endnotes pages
14233 \# title string "Endnotes" on or off.
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.
14241 \# Default for CAPS is on.
14243 .MAC ENDNOTES_HEADER_CAPS END
14244 . ie '\\$1'' .nr #EN_STRING_CAPS 1
14245 . el .nr #EN_STRING_CAPS 0
14248 .ALIAS ENDNOTE_STRING_CAPS ENDNOTES_HEADER_CAPS
14250 .MAC ENDNOTES_HEADER_SMALLCAPS END
14251 . ie '\\$1'' .nr #EN_STRING_SMALLCAPS 1
14252 . el .nr #EN_STRING_SMALLCAPS 0
14255 .ALIAS ENDNOTE_STRING_SMALLCAPS ENDNOTES_HEADER_SMALLCAPS
14260 \# <string that appears before the first endnote pertaining to any document>
14262 \# Creates string $EN_TITLE.
14264 \# Default is the document title, or, if doc is a chapter, "Chapter #"
14266 .MAC ENDNOTE_TITLE END
14267 . ds $EN_TITLE \\$1
14270 \# ENDNOTE MARKER STYLE
14271 \# --------------------
14273 \# NUMBER | LINE | SUPERSCRIPT
14275 \# Sets register #EN_MARKER_STYLE, used in ENDNOTE to determine
14276 \# the style of endnote markers (labels).
14278 \# 1=NUMBER; 2=LINE. LINE means "use output line numbers".
14279 \# Default is NUMBER.
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
14288 . if '\\$1'SUPERSCRIPT' .nr #EN_MARKER_STYLE 3
14291 \# ENDNOTE LINENUMBER MARK
14292 \# -----------------------
14294 \# This string, when called inline, stores the current output line
14295 \# number in register #EN_MARK for use with ENDNOTE.
14297 .ds EN_MARK \R'#EN_MARK \En[ln]'
14299 \# ENDNOTE LINENUMBER SEPARATOR
14300 \# ----------------------------
14302 \# <user-defined separator>
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.
14310 .MAC ENDNOTE_LINENUMBER_SEPARATOR END
14311 . rr #EN_LN_BRACKETS
14313 . ds $EN_LN_SEP "\\$1
14316 \# ENDNOTE LINENUMBER BRACKETS
14317 \# ---------------------------
14319 \# PARENS | SQUARE | BRACES or ( | [ | {
14321 \# Sets register #EN_LN_BRACKETS to 1, and creates strings
14322 \# $EN_OPEN_BRACKET and $EN_CLOSE_BRACKET according to the given argument.
14324 .MAC ENDNOTE_LINENUMBER_BRACKETS END
14326 . nr #EN_LN_BRACKETS 1
14327 . if '\\$1'PARENS' \{\
14328 . ds $EN_OPEN_BRACKET (
14329 . ds $EN_CLOSE_BRACKET )
14332 . ds $EN_OPEN_BRACKET (
14333 . ds $EN_CLOSE_BRACKET )
14335 . if '\\$1'SQUARE' \{\
14336 . ds $EN_OPEN_BRACKET [
14337 . ds $EN_CLOSE_BRACKET ]
14340 . ds $EN_OPEN_BRACKET [
14341 . ds $EN_CLOSE_BRACKET ]
14343 . if '\\$1'BRACES' \{\
14344 . ds $EN_OPEN_BRACKET {
14345 . ds $EN_CLOSE_BRACKET }
14348 . ds $EN_OPEN_BRACKET {
14349 . ds $EN_CLOSE_BRACKET }
14353 \# ENDNOTE LINENUMBER GAP
14354 \# ----------------------
14356 \# <space between line-number labels and endnotes text>
14358 \# Defines string $EN_LN_GAP, used during printing of line-number
14359 \# labels in ENDNOTE.
14361 .MAC ENDNOTE_LINENUMBER_GAP END
14362 . nr #EN_LN_GAP (u;\\$1)
14365 \# ENDNOTE NUMBERS ALIGNMENT
14366 \# -------------------------
14368 \# LEFT | RIGHT <max. number of digit placeholders that will appear in endnotes>
14370 \# Creates registers for _LEFT or _RIGHT; creates register
14371 \# #EN_NUMBER_PLACEHOLDERS.
14373 \# Default is for endnote numbers to be right aligned to 2 placeholders.
14375 .MAC ENDNOTE_NUMBERS_ALIGN END
14376 . if '\\$1'LEFT' \{\
14377 . rr #EN_NUMBERS_ALIGN_RIGHT
14378 . nr #EN_NUMBERS_ALIGN_LEFT 1
14380 . if '\\$1'RIGHT' \{\
14381 . rr #EN_NUMBERS_ALIGN_LEFT
14382 . nr #EN_NUMBERS_ALIGN_RIGHT 1
14384 . nr #EN_NUMBER_PLACEHOLDERS \\$2
14387 \# ENDNOTE PARAGRAPH INDENT
14388 \# ------------------------
14390 \# <first line indent of paras subsequent to 1st in endnotes>
14392 \# Creates register #EN_PP_INDENT for use in .PP.
14394 \# Requires a unit of measure.
14396 \# Default is 1.5m for TYPESET; same indent as PARA_INDENT for TYPEWRITE.
14398 .MAC ENDNOTE_PARA_INDENT END
14399 . nr #EN_PP_INDENT (\\$1)
14402 \# TURN OFF COLUMN MODE FOR ENDNOTES
14403 \# ---------------------------------
14405 \# <none> | <anything>
14407 \# Creates or removes register #EN_NO_COLS
14409 \# Allows user to tell mom not to set endnotes in columnar
14410 \# documents in columns. Default is to set endnotes in columns.
14412 .MAC ENDNOTES_NO_COLUMNS END
14413 . ie '\\$1'' .nr #EN_NO_COLS 1
14414 . el .rr #EN_NO_COLS
14417 \# NO FIRST PAGE NUMBER ON ENDNOTES FIRST PAGE
14418 \# -------------------------------------------
14420 \# <none> | <anything>
14422 \# Creates or removes register #EN_NO_FIRST_PN
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.
14429 .MAC ENDNOTES_NO_FIRST_PAGENUM END
14430 . ie '\\$1'' .nr #EN_NO_FIRST_PN 1
14431 . el .rr #EN_NO_FIRST_PN
14434 \# PAGE HEADERS ON ENDNOTES PAGES
14435 \# ------------------------------
14439 \# Creates or removes register #EN_ALLOWS_HEADERS or
14440 \# #EN_ALLOWS_HEADERS_ALL
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.
14448 .MAC ENDNOTES_ALLOWS_HEADERS END
14449 . ie '\\$1'' .nr #EN_ALLOWS_HEADERS 1
14451 . ie '\\$1'ALL' \{\
14452 . nr #EN_ALLOWS_HEADERS 1
14453 . nr #EN_ALLOWS_HEADERS_ALL 1
14456 . nr #EN_ALLOWS_HEADERS 0
14457 . nr #EN_ALLOWS_HEADERS_ALL 0
14462 \# ENDNOTES PAGES PAGE NUMBERING STYLE
14463 \# -----------------------------------
14465 \# DIGIT | ROMAN | roman | ALPHA | alpha
14467 \# Creates or modifies $EN_PN_STYLE.
14469 \# Allows user to define what style should be used for endnotes
14470 \# pages page numbering. Arguments are the same as for
14473 \# Default is DIGIT.
14475 .MAC ENDNOTES_PAGENUM_STYLE END
14476 . ds $EN_PN_STYLE \\$1
14479 \# FIRST PAGE NUMBER FOR ENDNOTES
14480 \# ------------------------------
14482 \# <page number that appears on page 1 of endnotes pages>
14484 \# Creates or modifies string $EN_FIRST_PN
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
14490 .MAC ENDNOTES_FIRST_PAGENUMBER END
14491 . nr #EN_FIRST_PN \\$1
14494 \# SINGLESPACE ENDNOTES
14495 \# --------------------
14497 \# <none> | <anything>
14499 \# Sets lead of endnotes pages in TYPEWRITE to 12 points,
14502 \# Default is to double-space endnotes pages.
14504 .MAC SINGLESPACE_ENDNOTES END
14505 . if \\n[#PRINT_STYLE]=1 \{\
14506 . ie \\n[#SINGLE_SPACE] \{\
14507 . nr #EN_SINGLESPACE 1
14509 . if \\n[#OK_PROCESS_LEAD] \{\
14510 . ENDNOTE_LEAD 12 ADJUST
14516 . nr #EN_SINGLESPACE 1
14518 . if \\n[#OK_PROCESS_LEAD] \{\
14519 . ENDNOTE_LEAD 12 ADJUST
14524 . rr #EN_SINGLESPACE
14526 . if \\n[#OK_PROCESS_LEAD] \{\
14527 . ENDNOTE_LEAD 24 ADJUST
14535 \# ENDNOTE PARAGRAPH SPACE
14536 \# -----------------------
14540 \# Creates toggle register #EN_PP_SPACE for use in .PP.
14542 \# Like PARA_SPACE. Default is not to space endnote paras.
14544 .MAC ENDNOTE_PARA_SPACE END
14545 . ie '\\$1'' .nr #EN_PP_SPACE 1
14546 . el .rr #EN_PP_SPACE
14554 \# Places superscript endnote number in text, then collects and
14555 \# processes endnote in diversion END_NOTES.
14557 \# \c must be appended to the word immediately preceding .ENDNOTE
14558 \# when ENDNOTE_MARKER_STYLE is NUMBER.
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
14570 . if \\n[#PRINT_STYLE]=1 \{\
14571 . if \\n[#SLANT_ON] \{\
14572 . nr #SLANT_WAS_ON 1
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.
14578 "\s-2\v'-\\n[#DOC_LEAD]u/5u'\\n+[#EN_NUMBER]\v'+\\n[#DOC_LEAD]u/5u'\s+2\c"
14580 . if \\n[#PRINT_STYLE]=2 .PRINT \*[SUP]\\n+[#EN_NUMBER]\*[SUPX]\c
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].
14590 . if \\n[#EN_MARK]=0 .nr #EN_MARK \\n[ln]
14591 . nr #EN_MARK_2 \\n[ln]
14592 . if '\\n[.z]'P_QUOTE' \{\
14597 . nr #PP_STYLE_PREV \\n[#PP_STYLE]
14599 . if \\n[#INDENT_FIRST_PARAS] .nr #INDENT_FIRSTS 1
14600 . INDENT_FIRST_PARAS
14603 . LL \\n[#DOC_L_LENGTH]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
14610 \!. if \\\\n[.vpt]=0 .vpt
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
14624 . ie \\n[#SINGLE_SPACE]=1 .sp 2
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
14633 . ie \\n[#EN_TITLE_UNDERLINE] \
14634 . UNDERSCORE "\\*[$EN_TITLE]"
14636 . ie \\n[#PRINT_STYLE]=1 \
14637 . UNDERSCORE "\\*[$EN_TITLE]"
14638 . el .PRINT "\\*[$EN_TITLE]"
14643 . if \\n[#EN_TITLE_COLOR] .gcolor
14644 . if \\n[#ENDNOTE_TITLE_SMALLCAPS] .SMALLCAPS OFF
14645 . if \\n[#ENDNOTE_TITLE_CAPS] .CAPS OFF
14647 .\" Get indent from endnotes point size; convert string to reg in
14648 .\" case indent string is, e.g., m or n
14650 . nr #REF_EN_INDENT (u;\\*[$REF_EN_INDENT])
14651 . if \\n[#PRINT_STYLE]=1 \{\
14653 . if \\n[#EN_NUMBER]=1 \{\
14654 . ie \\n[#SINGLE_SPACE]=1 .sp
14657 . if \\n[#EN_MARKER_STYLE]=3 .ps -2
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]
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]
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
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'\"
14687 . ie \\n[#EN_MARK_2]=\\n[#EN_MARK] \
14688 . ds $EN_LINENUMBER \
14689 \\n[#EN_MARK]\\*[$EN_LN_SEP]
14691 . ds $EN_LINENUMBER \
14692 \\n[#EN_MARK]\v'-.1m'-\v'.1m'\\n[#EN_MARK_2]\\*[$EN_LN_SEP]
14697 . ie \\n[#EN_NUMBERS_ALIGN_RIGHT] .RIGHT
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]'
14708 . if \\n[#EN_MARKER_STYLE]=3 \{\
14709 . nr #EN_NUMBER_L_LENGTH \
14710 \w'\0'*\\n[#EN_NUMBER_PLACEHOLDERS]+.15m
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].
14720 . if \\n[#EN_MARKER_STYLE]=2 \{\
14721 . nop \\*[$EN_LINENUMBER]
14722 . rm $EN_LINENUMBER
14724 . if \\n[#EN_MARKER_STYLE]=3 \{\
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.
14731 \s-2\v'-\\n[#DOC_LEAD]u/7u'\\n[#EN_NUMBER]\|\v'+\\n[#DOC_LEAD]u/7u'\s+2
14733 . el .nop \E*[SUP]\\n[#EN_NUMBER]\E*[SUPX]\h'.15m'
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
14743 \\n[#EN_NUMBER_L_LENGTH]u+\\n[#EN_FIGURE_SPACE]u
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
14749 \\n[#EN_NUMBER_L_LENGTH]u+\\n[#EN_LN_GAP]u
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
14755 \\n[#EN_NUMBER_L_LENGTH]u
14757 . nr #EN_TEXT_INDENT \\n[.i]
14758 . QUAD \\*[$EN_QUAD]
14760 . if \\n[#PRINT_STYLE]=1 .TYPEWRITER
14761 . if \\n[#PRINT_STYLE]=2 \{\
14762 . FAMILY \\*[$EN_FAM]
14768 \!. ie \\n[#EN_NUMBER]=\\\\n[#LAST_EN] .vpt 0
14770 . if \\n[#PRINT_STYLE]=2 .sp \\*[$EN_SPACE]
14772 . if \\n[#EN_MARKER_STYLE]=2 \{\
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
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
14787 . if \\n[#UNDERLINE_WAS_ON] \{\
14788 . rr #UNDERLINE_WAS_ON
14791 . if \\n[#SLANT_WAS_ON] \{\
14796 . if \\n[#NUM_ARGS]=2 \{\
14797 . if '\\$2'BREAK' .BR
14802 \# Endnotes (user space macro)
14803 \# ---------------------------
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.
14815 . if \\n[defer] .NEWPAGE
14816 . nr #LAST_EN \\n[#EN_NUMBER]
14818 . nr #EN_FIRST_PAGE 1
14820 . if !\\n[#PRINT_STYLE]=1 .chop 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
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
14841 \# Macros common to endnotes, bibliography, and toc
14842 \# ------------------------------------------------
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 \{\
14851 . nr #LINENUMBERS 2
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
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
14869 . ie \\n[#PAGE_NUM_V_POS]=2 .nr #PAGINATE 1
14870 . el .nr #PAGINATE 0
14872 . if \\n[#FOOTERS_ON]=1 \{\
14873 . if !'\\*[$HDRFTR_CENTER_OLD]'' \
14874 . ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_OLD]
14877 . if \\n[#FOOTERS_ON]=1 \{\
14878 . ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_NEW]
14879 . rm $HDRFTR_CENTER_OLD
14880 . rm $HDRFTR_CENTER_NEW
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
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]
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
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
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
14919 . if \\n[#SLANT_ON] \{\
14923 . if !'\\*[$\\*[EN-OR-BIB]_STRING]'' \{\
14924 . if \\n[#PRINT_STYLE]=1 \{\
14926 . vs \\n[#\\*[EN-OR-BIB]_LEAD]u
14928 . if \\n[#PRINT_STYLE]=2 \{\
14929 . LL \\n[#DOC_L_LENGTH]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
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
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
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]"
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]"
14959 . el .PRINT "\\*[$\\*[EN-OR-BIB]_STRING]
14962 . if \\n[#\\*[EN-OR-BIB]_STRING_COLOR]=1 .gcolor
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
14970 . ie \\n[#\\*[EN-OR-BIB]_SINGLESPACE]=1 .sp
14975 . ie '\\*[EN-OR-BIB]'BIB' .sp 2
14979 . QUAD \\*[$\\*[EN-OR-BIB]_QUAD]
14982 .ALIAS SETUP_BIBLIOGRAPHY SETUP_BIB_EN
14983 .ALIAS SETUP_ENDNOTES SETUP_BIB_EN
14985 \# ENDNOTES, BIBLIOGRAPHY and TOC LEADING
14986 \# --------------------------------------
14988 \# <leading> [ ADJUST ]
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.
14995 \# Default is same as doc lead for TYPESET, adjusted; 24 for TYPEWRITE.
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
15008 . if !\\n[#OK_PROCESS_LEAD] .return
15009 . nr #\\*[$SECTION]_LEAD (p;\\$1)
15012 .ALIAS BIBLIOGRAPHY_LEAD _LEAD
15013 .ALIAS ENDNOTE_LEAD _LEAD
15014 .ALIAS TOC_LEAD _LEAD
15016 \# ====================================================================
15018 \# +++BIBLIOGRAPHY+++
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
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.
15031 \# Bibliography control macros
15033 .MAC BIBLIOGRAPHY_PT_SIZE END
15034 . nr #BIB_PS (p;\\$1)
15037 .MAC BIBLIOGRAPHY_HDRFTR_CENTER END
15038 . ie '\\$1'' .nr #BIB_HDRFTR_CENTER 1
15039 . el .rr #BIB_HDRFTR_CENTER
15042 .MAC BIBLIOGRAPHY_STRING END
15043 . ds $BIB_STRING \\$1
15046 .MAC BIBLIOGRAPHY_STRING_ADVANCE END
15047 . nr #BIB_STRING_V_POS (u;\\$1)
15050 .MAC BIBLIOGRAPHY_STRING_V_POS END
15051 . nr #BIB_STRING_V_POS (u;\\$1)
15054 .ALIAS BIBLIOGRAPHY_HEADER_V_POS BIBLIOGRAPHY_STRING_V_POS
15056 .MAC BIBLIOGRAPHY_NO_COLUMNS END
15057 . ie '\\$1'' .nr #BIB_NO_COLS 1
15058 . el .rr #BIB_NO_COLS
15061 .MAC BIBLIOGRAPHY_NO_FIRST_PAGENUM END
15062 . ie '\\$1'' .nr #BIB_NO_FIRST_PN 1
15063 . el .rr #BIB_NO_FIRST_PN
15066 .MAC BIBLIOGRAPHY_ALLOWS_HEADERS END
15067 . ie '\\$1'' .nr #BIB_ALLOWS_HEADERS 1
15069 . ie '\\$1'ALL' \{\
15070 . nr #BIB_ALLOWS_HEADERS 1
15071 . nr #BIB_ALLOWS_HEADERS_ALL 1
15074 . rr #BIB_ALLOWS_HEADERS
15075 . rr #BIB_ALLOWS_HEADERS_ALL
15080 .MAC BIBLIOGRAPHY_PAGENUM_STYLE END
15081 . ds $BIB_PN_STYLE \\$1
15084 .MAC BIBLIOGRAPHY_FIRST_PAGENUMBER END
15085 . nr #BIB_FIRST_PN \\$1
15088 .MAC SINGLESPACE_BIBLIOGRAPHY END
15089 . if \\n[#PRINT_STYLE]=1 \{\
15090 . ie \\n[#SINGLE_SPACE] \{\
15091 . nr #BIB_SINGLESPACE 1
15093 . if \\n[#OK_PROCESS_LEAD] \{\
15094 . BIBLIOGRAPHY_LEAD 12 ADJUST
15100 . nr #BIB_SINGLESPACE 1
15102 . if \\n[#OK_PROCESS_LEAD] \{\
15103 . BIBLIOGRAPHY_LEAD 12 ADJUST
15108 . rr #BIB_SINGLESPACE
15110 . if \\n[#OK_PROCESS_LEAD] \{\
15111 . BIBLIOGRAPHY_LEAD 24 ADJUST
15119 \# Style for outputting collected bibliographic references
15120 \# -------------------------------------------------------
15122 \# LIST | PLAIN [ <list separator> ] [ <list prefix> ]
15124 \# Sets #BIB_LIST to 1 for numbered list style, 0 for plain output
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.
15131 \# The 2nd and 3rd args have the same options as the 2nd and 3rd
15134 .MAC BIBLIOGRAPHY_TYPE END
15135 . ie '\\$1'LIST' \{\
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
15143 . el .nr #BIB_LIST 0
15146 \# Spacing between items in bibliographies
15147 \# ---------------------------------------
15149 \# <amount of space>
15151 \# Gets value for #BIB_SPACE in units.
15153 \# Requires a unit of measure.
15155 .MAC BIBLIOGRAPHY_SPACING END
15156 . ds $BIB_SPACE \\$1
15157 . if \\n[#BIB_LEAD]=0 \{\
15158 . nr #DEFER_BIB_SPACING 1
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]
15167 . el .nr #BIB_SPACE (\\$1)
15170 \# Bibliography (user space macro)
15171 \# -------------------------------
15173 \# Sets up a new page, with title, ready to accept the output
15174 \# of refer's $LIST$ or .R1 bibliography .R2
15176 \# Bibliography pages are set up almost identically to endnotes pages.
15178 .MAC BIBLIOGRAPHY END
15179 . if \\n[defer] .NEWPAGE
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
15191 . ie \\n[#BIB_SINGLESPACE]=1 .vs \\n[#BIB_LEAD]u
15192 . el .vs \\n[#BIB_LEAD]u
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
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
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]
15222 \# ====================================================================
15224 \# +++TABLE OF CONTENTS+++
15226 \# Strings to allocate space for leaders and entry page numbers
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]
15232 .ds $TOC_PN_TYPEWRITE \\*[ST102]^\\*[ST102X]\\*[ST103]\
15233 \h'\w'0'u*\\n[#TOC_PN_PADDING]u'\\*[ST103X]
15238 . if !'\\n[.ev]'TOC_EV' .ev TOC_EV
15239 . nr #TOC_CH_NUM_INDENT \w'\\*[$TOC_CH_NUM]'
15241 \!. ie \\\\n[#SKIP_ENTRY]=1 \{\
15246 . ie \\n[#PRINT_STYLE]=1 \{\
15247 \!. fam \\*[$TYPEWRITER_FAM]
15249 \!. ps \\*[$TYPEWRITER_PS]
15250 . ds _TYPEWRITE _TYPEWRITE
15253 . ie '\\$0'HD_TO_TOC' \{\
15254 \!. ps \\n[#TOC_PS]u\\*[$TOC_HEAD_\\n[#LEVEL]_SIZE]
15257 \!. FAMILY \\*[$TOC_TITLE_FAM]
15258 \!. FT \\*[$TOC_TITLE_FT]
15259 \!. ps \\n[#TOC_PS]u\\*[$TOC_TITLE_SIZE]
15262 . if \\n[#PRINT_STYLE]=2 \{\
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
15271 . if \\n[#COLLATED_DOC] \
15272 . if '\\$0'TITLE_TO_TOC' \!.sp .4v
15278 . if !'\\$0'HD_TO_TOC' \{\
15279 \!. if \\n[#TOC_TITLE_CAPS]=1 .CAPS
15281 . if '\\$0'HD_TO_TOC' \{\
15283 \!. if \\n[#TOC_HEAD_\\n[#LEVEL]_CAPS]=1 .CAPS
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
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]"
15299 . if \\n[#PRINT_STYLE]=1 \{\
15300 . ds $TOC_TITLE_FAM \\*[$TYPEWRITER_FAM]
15301 . ds $TOC_TITLE_FT R
15304 "\f[\\*[$TOC_TITLE_FAM]\\*[$TOC_TITLE_FT]]\
15305 \h'\\n[#TOC_TITLE_INDENT]u'\\*[$TOC_TITLE_ITEM]\\*[$TOC_PN\\*[_TYPEWRITE]]" \
15306 "\\*[PDFBOOKMARK.NAME]"
15308 . ie '\\$0'HD_TO_TOC' \
15309 \!. if \\n[#TOC_HEAD_\\n[#LEVEL]_CAPS]=1 .CAPS OFF
15311 \!. if \\n[#TOC_TITLE_CAPS]=1 .CAPS OFF
15316 . if \\n[#PRINT_STYLE]=2 \{\
15317 \!. FAMILY \\*[$TOC_PN_FAM]
15318 \!. FT \\*[$TOC_PN_FT]
15319 \!. ps \\n[#TOC_PS]u
15322 \!. PRINT \fR\\*[LEADER]\f[]
15324 . if \\n[#PRINT_STYLE]=2 \{\
15325 \!. ps \\*[$TOC_PN_SIZE_CHANGE]
15327 \!. PRINT \\n[#TOC_ENTRY_PN]
15333 .ALIAS HD_TO_TOC TO_TOC
15334 .ALIAS TITLE_TO_TOC TO_TOC
15336 \# Control macros for toc
15337 \# ----------------------
15349 \# Assigns complete style parameters to TITLEs (doc titles,
15350 \# chapter titles, etc) in the TOC.
15352 \# TITLEs are not headings, therefore they require their own style
15353 \# macro. Otherwise, the same as TOC_ENTRY_STYLE.
15355 .MAC TOC_TITLE_STYLE END
15357 . nr #ATTRIB \\n[#NUM_ARGS]
15358 . while \\n+[#ARG_NUM]<=\\n[#ATTRIB] \{\
15359 . if '\\$1'FAMILY' \{\
15361 . ds $TOC_TITLE_FAM \\$1
15364 . if '\\$1'FONT' \{\
15366 . ds $TOC_TITLE_FT \\$1
15369 . if '\\$1'SIZE' \{\
15371 . ds $TOC_TITLE_SIZE \\$1
15374 . if '\\$1'CAPS' \{\
15375 . nr #TOC_TITLE_CAPS 1
15378 . if '\\$1'NO_CAPS' \{\
15379 . rr #TOC_TITLE_CAPS
15382 . if '\\$1'SMALLCAPS' \{\
15383 . nr #TOC_TITLE_SMALLCAPS 1
15386 . if '\\$1'NO_SMALLCAPS' \{\
15387 . rr #TOC_TITLE_SMALLCAPS
15390 . if '\\$1'INDENT' \{\
15392 . nr #TOC_TITLE_INDENT \\$1
15398 \# TOC HEADER STRING
15399 \# -----------------
15401 \# <string for "doc header" of first toc page>
15403 \# Creates or modifies string $TOC_HEADER_STRING
15405 \# Default is "Contents".
15407 .MAC TOC_HEADER_STRING END
15408 . ds $TOC_HEADER_STRING \\$1
15411 \# TOC HEADER CAPS and SMALLCAPS
15412 \# -----------------------------
15414 \# <none> | <anything>
15416 \# Turns capitalization or smallcaps style of the toc title string
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.
15425 .MAC TOC_HEADER_CAPS END
15426 . ie '\\$1'' .nr #TOC_STRING_CAPS 1
15427 . el .nr #TOC_STRING_CAPS 0
15430 .MAC TOC_HEADER_SMALLCAPS END
15431 . ie '\\$1'' .nr #TOC_STRING_SMALLCAPS 1
15432 . el .nr #TOC_STRING_SMALLCAPS 0
15436 \# TOC VERTICAL PLACEMENT
15437 \# ----------------------
15439 \# <distance from page top>
15441 \# Creates register #TOC_HEADER_V_POS.
15443 \# Default is same as normal docheader position.
15445 .MAC TOC_HEADER_V_POS END
15446 . nr #TOC_HEADER_V_POS (u;\\$1)
15453 \# <base point size for toc pages>
15455 \# Creates or modifies register #TOC_PS.
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.
15461 \# No unit of measure required (points assumed). Default is 12.5
15464 .MAC TOC_PT_SIZE END
15465 . nr #TOC_PS (p;\\$1)
15468 \# TOC ENTRIES PAGE NUMBERS PADDING
15469 \# --------------------------------
15471 \# <number of placeholders for toc entries page numbers>
15473 \# Creates or modifies register #TOC_PN_PADDING.
15475 \# "Placeholders" is the maximum number of digits in a page
15480 .MAC TOC_PADDING END
15481 . nr #TOC_PN_PADDING \\$1
15487 \# <none> | <anything>
15489 \# Creates or removes register #PAGINATE_TOC.
15491 \# Default is to paginate toc.
15493 .MAC PAGINATE_TOC END
15494 . ie '\\$1'' .nr #PAGINATE_TOC 1
15495 . el .nr #PAGINATE_TOC 0
15498 .MAC TOC_FIRST_PAGENUM END
15499 . nr #TOC_START_PAGENUM \\$1
15502 \# TOC PAGES PAGE-NUMBERING STYLE
15503 \# ------------------------------
15505 \# DIGIT | ROMAN | roman | ALPHA | alpha
15507 \# Creates or modifies string $TOC_PN_STYLE
15509 \# Page numbering style for page numbers that appear in the
15510 \# headers/footers of toc pages. See notes for PAGENUM_STYLE.
15512 \# Default is roman.
15514 .MAC TOC_PAGENUM_STYLE END
15515 . ds $TOC_PN_STYLE \\$1
15518 \# TOC RECTO_VERSO SWITCH
15519 \# ----------------------
15521 \# <none> | <anything>
15523 \# Creates or removes register #TOC_RV_SWITCH
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
15528 .MAC TOC_RV_SWITCH END
15529 . ie '\\$1'' .nr #TOC_RV_SWITCH 1
15530 . el .rr #TOC_RV_SWITCH
15533 \# TOC ENTRY SPACING
15534 \# -----------------
15536 \# <none> | <anything>
15538 \# Toggles whether a small amount of space is inserted between TOC
15539 \# entries for greater legibility.
15541 .MAC SPACE_TOC_ITEMS END
15542 . ie !'\\$1'' .rr #SPACE_TOC_ITEMS
15543 . el .nr #SPACE_TOC_ITEMS 1
15546 \# NUMBERING OF TOC CHAPTER/SECTION ENTRIES
15547 \# ----------------------------------------
15549 \# <none> | <anything>
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.
15555 \# Aliased as TOC_PREFIX_SECTION_NUMBER.
15557 .MAC TOC_PREFIX_CHAPTER_NUMBER END
15558 . ie '\\$1'' .nr #TOC_PREFIX_CH_NUM 1
15559 . el .rr #TOC_PREFIX_CH_NUM
15562 .ALIAS TOC_PREFIX_SECTION_NUMBER TOC_PREFIX_CHAPTER_NUMBER
15564 \# PADDING OF TOC CHAPTER/SECTION NUMBERS
15565 \# --------------------------------------
15567 \# <amount of padding> | <anything>
15569 \# Insert figure spaces before toc chapter numbers so they
15572 \# Aliased as PAD_TOC_SECTION_NUMBERS.
15574 .MAC PAD_TOC_CHAPTER_NUMBERS END
15575 . ie !'\\$1'' .nr #PAD_TOC_CH_NUM \\$1
15576 . el .rr #PAD_TOC_CH_NUM
15579 .ALIAS PAD_TOC_SECTION_NUMBERS PAD_TOC_CHAPTER_NUMBERS
15581 \# NUMBERING OF TOC HEAD ENTRIES
15582 \# -----------------------------
15584 \# FULL | TRUNCATE | NONE
15586 \# Determines how, or whether, to prepend heading numbers to TOC
15589 \# FULL means the complete numbering string (default).
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.
15598 \# Note that TRUNCATE also removes chapter numbers, if
15599 \# PREFIX_CHAPTER_NUMBER is on.
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
15607 \# User defined TITLE entry string
15609 .MAC TOC_TITLE_ENTRY END
15610 . nr #USER_SET_TITLE_ITEM 1
15611 . ds $USER_SET_TITLE_ITEM \\$1
15614 \# APPEND AUTHOR(S) TO TOC DOC TITLE ENTRIES
15615 \# -----------------------------------------
15617 \# <none> | <name(s) of author(s) as they should appear in toc doc title entries>
15619 \# Creates register #TOC_AUTHORS (to tell TOC to append authors
15620 \# to toc doc title entries). Optionally creates string
15623 \# Normally, TOC does not append the author(s) to a toc doc title
15624 \# entry. This special macro instructs TOC to do so.
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.
15631 .MAC TOC_APPENDS_AUTHOR END
15632 . nr #TOC_AUTHORS 1
15633 . if !'\\$1'' .ds $TOC_AUTHORS \\$1
15636 \# TABLE OF CONTENTS PAGE SETUP
15637 \# ----------------------------
15639 \# <none> | <anything>
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
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.
15650 .MAC TOC_PAGE_SETTINGS END
15651 . nr #TOC_PAGE_PARAMS 1
15653 . di TOC_PAGE_PARAMS
15657 \# TABLE OF CONTENTS
15658 \# -----------------
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
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
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
15688 . nr TOC.RELOCATE 0
15689 . if \\n[#LINENUMBERS]=1 \{\
15691 . nr #LINENUMBERS 2
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
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
15705 . if \\n[#FOOTERS_WERE_ON] .FOOTERS OFF \" But have to turn FOOTERS off again so they don't print when FINIS was called
15708 . if \\n[#PRINT_STYLE]=1 \{\
15710 . if \\n[#SINGLE_SPACE] .DOC_LEAD 24
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] \{\
15720 . rr #PAGINATION_WAS_ON
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
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
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)
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]
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]"
15772 . el .PRINT \\*[$TOC_HEADER_STRING]
15776 . if \\n[#TOC_HEADER_COLOR]=1 .gcolor
15782 . if \\n[#LINENUMBERS]=3 \{\
15783 . NUMBER_LINES RESUME
15784 . nr #LINENUMBERS 1
15788 . rr #TOC_RV_SWITCH
15792 \# ====================================================================
15799 \# <number of columns> <width of gutters>
15801 \# Creates registers associated with setting docs in columns.
15802 \# Calculates column line lengths and offsets
15804 \# COLUMNS, if used, s/b the last macro invoked before START.
15807 . if \\n[#IGNORE_COLUMNS]=1 .return
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]
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]
15818 . if \\n[#NUM_COLS]=1 \
15819 . if !\\n[#COLLATE]=1 .MN_INIT
15824 \# MARK COL V-POSITION AFTER DOCHEADER
15825 \# -----------------------------------
15829 \# Sets 1st page dc register.
15831 \# Only required if manual spacing, positive or negative, precedes
15832 \# start of columns on first page of doc.
15843 \# Breaks current column and moves to next column.
15844 \# If current column is the last on the page, breaks
15848 . if \\n[#COLUMNS] \{\
15851 . if !'\\$1'internal' \
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
15863 . ie \\n[#COL_NUM]=\\n[#NUM_COLS] .NEWPAGE
15868 \# ====================================================================
15875 \# [ BULLET | DASH | DIGIT | alpha | ALPHA | roman | ROMAN | USER ] \
15876 \# [ <separator> | NONE ] [ <prefix> ] [ <anything> ]
15878 \# Stores indent information in effect prior to invocation and
15879 \# initializes a list with the supplied enumerator (and separator).
15881 \# Default enumerator is a bullet.
15883 \# Enumerator *must* be supplied for every list that's to the
15884 \# right of another list, every time, unless the default bullet is
15887 \# <anything> moves back one list level intuitively, or exits lists
15888 \# completely if the level in which it's invoked is the first.
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 \{\
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].
15911 . ds $ROMAN_WIDTH \\$1
15912 . substring $ROMAN_WIDTH 1
15913 . while !\B'\\*[$ROMAN_WIDTH]' \{\
15914 . substring $ROMAN_WIDTH 1
15916 . length #ROMAN_LENGTH \\*[$ROMAN_WIDTH]
15917 . ds $LIST_ARG_1 \\$1
15918 . substring $LIST_ARG_1 0 -(\\n[#ROMAN_LENGTH]+1)
15920 . el .ds $LIST_ARG_1 \\$1
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]
15934 . nr #CURRENT_L_LENGTH \\n[.l]
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
15942 . nr #ORIG_L_LENGTH \\n[.l]
15944 . nr #RESTORE_PREV_INDENT 2
15946 . if \\n[#INDENT_RIGHT_ACTIVE]=1 \{\
15947 . ie \\n[#DOC_TYPE]=5 .IRX CLEAR
15949 . nr #ORIG_L_LENGTH \\n[.l]
15951 . nr #RESTORE_PREV_INDENT 3
15952 . if \\n[#INDENT_LEFT_ACTIVE]=1 \
15953 . nr #RESTORE_PREV_INDENT 4
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
15968 . if '\\*[pre-list-quad]'R' \{\
15969 . if !'\\n[.z]'LIST*DIV' \{\
15970 . nr #PRE_LIST_QUAD \\n[.j]
15972 . if !'\\n[.z]'LIST*DIV' .di LIST*DIV
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
15983 . ds $SEPARATOR\\n[#DEPTH]
15984 . ds $PREFIX\\n[#DEPTH]
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]
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]
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
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
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
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
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]
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].
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]
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]
16082 . if \\n[#NUM_ARGS]=1 \{\
16083 . if !r#ARGS_TO_LIST \{\
16084 . ie \\n[#DEPTH]=1 \{\
16085 . ie \\n[#NEXT_DEPTH_BACK]=0 \{\
16087 . if \\n[#QUIT]=1 \{\
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]]\ '
16112 . if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'roman' \
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] \{\
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]
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]
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
16140 . nr #L_INDENT +\\n[#LIST_INDENT\\n[#DEPTH]]
16141 . nr #HL_INDENT\\n[#DEPTH] \\n[#LIST_INDENT\\n[#DEPTH]]
16146 . nr #L_INDENT +\\n[#LIST_INDENT\\n[#DEPTH]]
16147 . nr #HL_INDENT\\n[#DEPTH] \\n[#LIST_INDENT\\n[#DEPTH]]
16151 . nr #L_INDENT +\\n[#LIST_INDENT\\n[#DEPTH]]
16152 . nr #HL_INDENT\\n[#DEPTH] \\n[#LIST_INDENT\\n[#DEPTH]]
16159 \# <none> | <space before item>
16161 \# Prints enumerator for a given list depth and prepares mom to
16162 \# receive the text of an item.
16165 . ie \\n[#NUM_ARGS]=2 .sp \\$2
16167 . if \B'\\$1' .sp \\$1
16168 . if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'plain' .nop
16169 . if !r#DEPTH .return
16170 . if \\n[#LINENUMBERS]=1 \{\
16172 . nr #LINENUMBERS 2
16174 . if \\n[#KERN]=1 \{\
16175 . nr #KERN_WAS_ON 1
16181 . ll \\n[#CURRENT_L_LENGTH]u \" Set ll again because IL turns IB off.
16182 . ie !'\\n[.z]'' \!.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'
16194 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
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'
16202 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16206 . ie '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'register' \{\
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'
16215 \0\\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
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'
16222 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
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'
16230 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
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'
16240 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16244 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
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'
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]]
16262 .\" roman i, padded
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]]
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'
16276 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16278 .\" roman i, no pad
16280 \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16283 . if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'other' \
16284 . PRINT \\*[$ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
16285 . if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'variable' \
16290 . if \\n[#REF]=1 \{\
16291 . IL +\\n[#REF_BIB_INDENT]u
16292 . ti \\n[#L_INDENT]u-\\n[#REF_BIB_INDENT]u
16294 . ie !'\\n[.z]'' \!.TRAP
16296 . if \\n[#KERN_WAS_ON]=1 \{\
16300 . if \\n[#LINENUMBERS]=2 \{\
16301 . NUMBER_LINES RESUME
16302 . nr #LINENUMBERS 1
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
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
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'
16521 \# <amount by which to indent a list to the right>
16523 \# Adds the value of the arg to the current list's indent.
16525 \# Requires a unit of measure.
16527 .MAC SHIFT_LIST END
16528 . nr #SHIFT_LIST\\n[#DEPTH] (\\$1)
16529 . nr #L_INDENT +\\n[#SHIFT_LIST\\n[#DEPTH]]
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.
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
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
16558 \# Resets register enumerators to 1 or a.
16560 .MAC RESET_LIST END
16561 . ie '\\$1'' .nr #ENUMERATOR\\n[#DEPTH] 0 1
16562 . el .nr #ENUMERATOR\\n[#DEPTH] \\$1-1 1
16570 \# Exits lists cleanly and restores any indents that were in
16571 \# effect prior to LIST.
16573 .MAC QUIT_LISTS END
16575 . if '\\n[.z]'LIST*DIV' \{\
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
16598 . if \\n[#FILLED] .fi
16599 . if !\\n[#PRE_LIST_QUAD]=\\n[.j] .ad \\n[#PRE_LIST_QUAD]
16602 . rr #PRE_LIST_QUAD
16603 . if \\n[#RESTORE_PREV_INDENT]=1 \
16605 . if \\n[#RESTORE_PREV_INDENT]=2 \{\
16606 . ll \\n[#ORIG_L_LENGTH]u
16609 . if \\n[#RESTORE_PREV_INDENT]=3 \{\
16610 . ll \\n[#ORIG_L_LENGTH]u
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
16620 .\" Clean up after exiting last depth of list
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]
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
16640 . rr #NEXT_DEPTH_BACK
16641 . rr #RESTORE_PREV_INDENT
16642 . rr #ORIG_L_LENGTH
16643 . rr #CURRENT_L_LENGTH
16645 . rr #IN_ITEM_L_INDENT
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
16657 .MAC SET_LIST_INDENT END
16658 . nr #NEXT_DEPTH_BACK \\n[#DEPTH]-1
16659 . if \\n[#NEXT_DEPTH_BACK]=0 \{\
16661 . if \\n[#INDENT_ACTIVE]=1 \{\
16662 . if \\n[#INDENT_STYLE_BOTH]=1 \{\
16664 . ll \\n[#DOC_L_LENGTH]u-\\n[#STORED_BR_INDENT]u
16666 . ll \\n[#L_LENGTH]u-\\n[#STORED_BR_INDENT]u
16667 . in \\n[#BL_INDENT]u
16669 . if \\n[#INDENT_STYLE_LEFT] \{\
16670 . in \\n[#STORED_L_INDENT]u
16672 . if \\n[#INDENT_STYLE_RIGHT] \{\
16674 . ll \\n[#DOC_L_LENGTH]u-\\n[#STORED_R_INDENT]u
16676 . ll \\n[#L_LENGTH]u-\\n[#STORED_R_INDENT]u
16681 . nr #L_INDENT -\\n[#LIST_INDENT\\n[#DEPTH]]+\\n[#SHIFT_LIST\\n[#DEPTH]]
16682 . nr #HL_INDENT \\n[#HL_INDENT\\n-[#DEPTH]]
16685 \# ====================================================================
16687 \# +++DOCUMENT PROCESSING MISC AND SUPPORT MACROS+++
16694 \# Turns headers off (if on) and saves header state, sets register
16695 \# #COLLATE to 1 (toggle), and breaks to a new page.
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.
16702 \# N.B.--the START macro must be used after every COLLATE
16705 . if dPDF.EXPORT .tm .ds pre-collate-\\n% \\n%@\\n[#COL_NUM]
16706 . if \\n[defer] \{\
16707 . nr #BLANKPAGE_AFTER_DEFER 1
16710 . nr #HEADER_STATE \\n[#HEADERS_ON]
16711 . if (\\n[defer]=0)&(\\n[float*defer]=0) .HEADERS OFF
16712 . if \\n[#LINENUMBERS] \{\
16714 . nr #LINENUMBERS 2
16716 . if \\n[#BLANKPAGE] \{\
16717 . if \\n[nl]=\\n[#PAGE_TOP] \{\
16726 . ds $SAVED_DOC_FAM \\*[$DOC_FAM]
16727 . ds $SAVED_PP_FT \\*[$PP_FT]
16729 . nr #PRE_COLLATE 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
16739 . if \\n[#DOC_HEADER]=2 .nr #DOC_HEADER 1
16740 . if \\n[#PAGE_NUM_V_POS]=1 \{\
16741 . nr #PAGINATION_STATE \\n[#PAGINATE]
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
16755 . if \\n[TOC_BH]=1 .pdfswitchtopage before MOM:TOC
16756 . if \\n[TOC_BH]=2 .pdfswitchtopage after MOM:TOC
16758 . if !\\n[#NO_NEWPAGE] .NEWPAGE
16759 . if !\\n[#TOC] \{\
16760 . if \\n[#FORCE_RECTO] \{\
16761 . ds $PN_FORMAT_CURR \\g[#PAGENUMBER]
16763 . if \\n[#PAGENUMBER]%2=1 .nr #ODD_PAGENUM 1
16764 . af #PAGENUMBER \\*[$PN_FORMAT_CURR]
16765 . if \\n[#ODD_PAGENUM] .BLANKPAGE 1 DIVIDER
16767 . rr #BLANKPAGE_AFTER_DEFER
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
16783 . if \\n[#CH_NUM] \
16784 . if \\n[#TOC]=0 .nr #CH_NUM +1
16794 . rr #DOC_COVER_TITLE
16797 . rr #DOC_COVER_MISC
16799 . rr #COVER_COPYRIGHT
16800 . rr #DOC_COVER_COPYRIGHT
16802 . rr #DOC_COVER_AUTHOR
16804 . rm DOC_COVER_TEXT
16806 . rm $COVER_COPYRIGHT
16807 . rm $DOC_COVER_COPYRIGHT
16809 . rr #PAGENUM_STYLE_SET
16814 . if \\n[#RESTORE_PN_V_POS] \{\
16815 . nr #PAGE_NUM_V_POS \\n[#RESTORE_PN_V_POS]
16816 . rr #RESTORE_PN_V_POS
16819 . while \\n+[#LOOP]<=\\n[@LEVEL] \
16820 . rr #TOC_HEAD_\\n[#LOOP]_INDENT_SET 1
16821 . if \\n[#FLEX_ACTIVE] .rr #NO_FLEX
16827 \# <starting line number> [ <increment> [ <gutter> ] ]
16829 \# <anything> | RESUME
16831 \# Begin, suspend/turn off, or resume numbering of output lines.
16833 .MAC NUMBER_LINES END
16835 . if '\\n[.z]'EPI_TEXT' .return
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].
16841 . if !\\n[#LINENUMBERS]=2 .nr #LINENUMBERS 1
16842 .\" Test whether the first arg is a digit.
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].
16854 . if !'\\n[.z]'' .nr #RESTORE_LN_NUM 1
16856 . if '\\*[$LN_INC]'' .ds $LN_INC 1
16857 . el .ds $LN_INC \\$2
16859 . if !\\n[#LN_GUTTER] .nr #LN_GUTTER 2
16860 . el .nr #LN_GUTTER \\$3
16863 .\" In other words, the first arg was not a digit.
16865 . ie '\\$1'RESUME' \{\
16872 .\" Register ln is still set and may confuse preprocessors like tbl.
16873 .\" Still, resuming line numbering must be possible, so save ln in
16875 . ds $LN_NUM \\n[ln]
16876 . if !\\n[#QUOTE] .nr ln 0
16877 . if !\\n[#LINENUMBERS]=2 .rr #LINENUMBERS
16882 . nm \\*[$LN_NUM] \\*[$LN_INC] \\n[#LN_GUTTER] -3-\\n[#LN_GUTTER]
16884 . if !'\\n[.z]'' .nr #DIVER_LN_OFF 1
16889 \# LINENUMBER STYLE PARAMETERS
16890 \# ---------------------------
16894 \# LN_PARAMS sets parameters for line numbers.
16895 \# RESTORE_PARAMS restores them after internal calls to .nm
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.
16906 . ie d$LN_FAM .fam \\*[$LN_FAM]
16907 . el .fam \\n[.fam]
16908 . ie d$LN_FT .ft \\*[$LN_FT]
16910 . ie d$LN_SIZE_CHANGE .ps \\*[$LN_SIZE_CHANGE]
16912 . ie d$LN_COLOR .COLOR \\*[$LN_COLOR]
16913 . el .gcolor \\n[.m]
16916 .MAC RESTORE_PARAMS END
16923 \# Whether, at COLLATE, to reset line number to 1.
16925 \# NUMBER LINES PER SECTION
16926 \# ------------------------
16930 \# Sets register that determines whether, at COLLATE, to reset
16931 \# line number to 1.
16933 \# The default is to continue the line numbering from where it
16936 .MAC NUMBER_LINES_PER_SECTION END
16937 . nr #PER_SECTION 1
16940 \# NUMBER QUOTE AND BLOCKQUOTE LINES AS PART OF RUNNING TEXT
16941 \# ---------------------------------------------------------
16943 \# <gutter> | <anything>
16945 \# Sets #(B)QUOTE_LN to 1 if no argument, or a single numeric
16946 \# argument, is given; otherwise, turns (BLOCK)QUOTE linenumbering
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.
16953 .MAC NUMBER_QUOTE_LINES END
16954 . ie \\n[#NUM_ARGS]=0 .nr #QUOTE_LN 1
16958 . nr #Q_LN_GUTTER \\$1
16961 . ie '\\$1'SILENT' .nr #SILENT_QUOTE_LN 1
16964 . rr #SILENT_QUOTE_LN
16970 .MAC NUMBER_BLOCKQUOTE_LINES END
16971 . ie \\n[#NUM_ARGS]=0 .nr #BQUOTE_LN 1
16975 . nr #BQ_LN_GUTTER \\$1
16978 . ie '\\$1'SILENT' .nr #SILENT_BQUOTE_LN 1
16981 . rr #SILENT_BQUOTE_LN
16987 \# OUTPUT BLANK PAGES
16988 \# ------------------
16990 \# <number of blank pages to output> [ DIVIDER [ NULL ] ]
16992 \# Outputs blank pages.
16994 \# If recto/verso, each page is recto/verso, even if there's
16997 \# The 1st argument to BLANKPAGE is non-optional. DIVIDER is for
16998 \# blank pages before endnotes, bibliographies, tocs, new chapters.
17002 . nr #HOW_MANY \\$1
17005 . if \\n[#LINENUMBERS] \{\
17006 . nr #LINENUMBERS_WERE_ON 1
17009 . while \\n+[#PAGES]<=\\n[#HOW_MANY] \{\
17010 . if \\n[#HEADERS_ON]=1 \{\
17011 . nr #HEADERS_WERE_ON 1
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]
17019 . NEWPAGE \" Break to blank page
17022 . if \\n[#FOOTERS_ON]=1 \{\
17023 . nr #FOOTERS_WERE_ON 1
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]
17031 . if !'\\$1'DIVIDER' .if \\n[#HEADERS_WERE_ON] .HEADERS
17034 . ie '\\$1'DIVIDER' \{\
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]
17042 . if \\n[#HEADERS_WERE_ON] .HEADERS
17044 . if '\\$1'NULL' .nr #PAGE_NUM_ADJ -\\n[#HOW_MANY]
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]
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
17060 . if \\n[#PAGINATE]=1 \
17061 . if '\\$1'NULL' .nr #PAGE_NUM_ADJ -\\n[#HOW_MANY]
17062 . if \\n[#RESTORE_PN_V_POS]=1 \{\
17064 . sp |\\n[#HEADER_MARGIN]u
17065 . PRINT_PAGE_NUMBER
17067 . if \\n[#LINENUMBERS_WERE_ON] .NUMBER_LINES RESUME
17069 . rr #HEADERS_WERE_ON
17070 . rr #FOOTERS_WERE_ON
17071 . rr #PAGINATE_WAS_ON
17077 .am PSPIC \" Need to do this for PSPIC inside a float
17079 \h'(\\n[ps-offset]u + \\n[ps-deswid]u)'
17084 .MAC PROCESS_FLOATS END
17085 . if \\n[#TAB_ACTIVE] \{\
17086 . nr #RESTORE_TAB 1
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
17099 . if '\\*[float*type:\\n[defer]]'boxed-tbl:\\n[defer]' \{\
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
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
17116 . rr pic*caption-lead-diff
17117 . rr pic*top-lead-diff
17120 . if \\n[float*img] \{\
17121 . ie \\n[#COLUMNS] \
17124 . sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
17125 . if \\n[pdf-img:frame] \{\
17126 . sp -(\\*[pdf-img:frame-weight]p*2u)
17130 . nr loop-count 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
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
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]
17155 . ie (\\n[.t]-1)<(\\n[#DOC_LEAD]u/2) .SHIM_1
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
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]
17177 . if !\\n[float*defer]=1 \{\
17178 . if !(\\n[loop-count]-1)=1 \{\
17179 . if !\\n[.t]=1 .sp -.5
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
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]
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
17202 . if !\\n[#NO_FLEX] \
17203 . if !\\n[flexed] .FLEX
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
17211 . if !\\n[#NO_FLEX] .FLEX
17213 . nr tbl*have-header 0
17214 . rr tbl*have-caption
17217 . rr float*before-shim
17218 . rr float*after-shim
17221 . if \\n[#NEWPAGE] \{\
17230 . if \\n[#RESTORE_TAB] \{\
17231 . TAB \\n[#CURRENT_TAB]
17236 .MAC output-float END
17237 . if \\n[float*img] \{\
17238 . nr no-top-space:1 1
17246 . if \\n[no-top-space:1] \{\
17247 . ie !\\n[#COLUMNS] \{\
17248 . sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
17252 . if \\n[float*tbl:1] \{\
17254 . ie \\n[tbl*caption-top-lead-diff] \{\
17255 . sp \\n[tbl*caption-top-lead-diff]u
17256 . rr tbl*caption-top-lead-diff
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
17266 . if \\n[float*img:1] \{\
17268 . if \\n[pdf-img*caption-top-lead-diff] \{\
17269 . sp \\n[pdf-img*caption-top-lead-diff]u
17271 . rr pdf-img*caption-top-lead-diff
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]]
17284 . if \\n[q-float] \
17285 . if !\\n[has-caption] .sp \\n[#Q_LEAD_DIFF]u
17288 . if \\n[check-indent] \{\
17289 . if \\n[#INDENT_LEFT_ACTIVE] \{\
17290 . in \\n[#L_INDENT]u/2u
17293 . rr no-top-space:1
17294 . if \\n[loop-count]>1 \{\
17295 . if !'\\*[float-adj:\\n[loop-count]]'' \{\
17297 . sp \\*[float-adj:\\n[loop-count]]
17299 . nr restore-v-pos 1
17302 . nr check-indent 1
17303 . FLOAT*DIV:\\n[loop-count]
17304 . if \\n[no-top-space:1] \
17306 . if \\n[restore-v-pos] \{\
17307 . sp -\\*[float-adj:\\n[loop-count]]
17308 . rm float-adj:\\n[loop-count]
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] \
17326 \# [ ADJUST +|-<amount> ] [ FORCE] [ SPAN] [ NO_SHIM] | [ NO_FLEX ] [ TARGET ] | <anything>
17328 \# Captures input in a diversion, which is output immediately if
17329 \# there's room on the page; otherwise outputs diversion at top of
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.
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' \{\
17345 . if '\\$1'SPAN' \{\
17349 . if '\\$1'ADJUST' \{\
17351 . ds float-adj \\$1
17354 . if '\\$1'CENTER' \{\
17355 . nr center-float 1
17358 . if '\\$1'CENTRE' \{\
17359 . nr center-float 1
17362 . if '\\$1'INDENT' \{\
17364 . nr indent-float \\$1
17367 . if '\\$1'RIGHT' \{\
17371 . if '\\$1'NO_SHIM' \{\
17375 . if '\\$1'NO_FLEX' \{\
17379 . if '\\$1'TARGET' \{\
17381 . ds float*target "\\$1
17386 . ie \\n[float*started] .rr float*started
17388 . while !'\\$1'' .shift 1
17389 . nr float*started 1
17392 .\" Harmonize floats treated as defers and floats proper to the top
17393 .\" of the next page between passes when flex is enabled.
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.
17401 . ie !\\n[#NO_FLEX] \{\
17402 .\" Only on 2nd pass
17403 . if !dPDF.EXPORT \{\
17404 . ie d float\\n[floatnum]:no-defer .br
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,
17412 . if (\\n[.t]-1)<\\n[.v] \
17413 . if !\\n[@TOP] .nr no-break 1
17416 .\" Only on 1st pass
17417 . ie !\\n[no-break] \{\
17418 . ds pre-float:page@col \\n%@\\n[#COL_NUM]
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
17429 . if \\n[nl]=\\n[#PAGE_TOP] \
17431 . ds ev-pre-float \\n[.ev]
17433 . evc \\*[ev-pre-float]
17435 . if !'\\*[float*target]'' .PDF_TARGET "\\*[float*target]
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] \{\
17447 \!. rm tbl*header-div:span
17448 \!. nr tbl*no-print-header 1
17450 . if \\n[float-span] \{\
17451 . nr dn-save \\n[dn]
17455 . nr dn \\n[dn-save]
17458 . ie \\n[float*tbl] \
17459 . if !\\n[tbl*have-header] .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
17470 . el .if !\\n[tbl@source] .nr dn -1.65v
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].
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] \{\
17490 . nr dn \\n[dn-save]
17492 . ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
17493 . ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u
17497 . if \\n[tbl*boxed] .rs
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
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]
17522 . if \\n[float*eqn] \{\
17523 . if \\n[defer]=1 .nr no-top-space:\\n[defer] 1
17524 . ds float*type:\\n[defer] eqn
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]
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
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
17543 . if \\n[tbl*boxed] .rr tbl*boxed
17544 . if \\n[table] .rr table
17546 . return \" output div after header
17549 . nr dn-save \\n[dn]
17550 . if \\n[#FLEX_ACTIVE] \{\
17551 . if !\\n[@no-flex] \{\
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
17562 . if !'\\*[float-adj]'' .sp \\*[float-adj]
17563 . if \\n[.u] .nr fill 1
17568 . if \\n[float*tbl] \{\
17569 . if (\\n[#MLA]=1)&(\\n[tbl@source]=0) \
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
17581 . ie \\n[tbl*boxed] .sp |\\n[#PAGE_TOP]u+.3n
17582 . el .sp |\\n[#PAGE_TOP]u-.25v
17586 . if \\n[float*img] \
17587 . if \\n[pdf-img:frame] \
17588 . sp -(\\*[pdf-img:frame-weight]p*2u)
17589 . if !'\\n[.ev]'protect' \{\
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
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
17607 . if (\\n[center-float]>0):(\\n[indent-float]>0):(\\n[right-float]>0) \
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
17620 . if \\n[dn-save]=\\n[bx-tbl-depth] .sp .35v
17622 . ie \\n[tbl*plain-boxed] .sp .5v
17624 . if !\\n[tbl*autolabel] \{\
17625 . if !\\n[#MLA] \{\
17626 . if \\n[tbl@label]=1 .sp .5
17635 . if !'\\*[tbl*label]'' \
17636 . if \\n[tbl*autolabel]=0 .sp .5
17640 . rm tbl*header-div
17641 . rr tbl*have-caption
17642 . rr tbl*have-label
17643 . rr tbl*have-source
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
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.
17666 . if !'\\*[float-adj]'' \
17667 . if !\\n[no-adjust] .sp -\\*[float-adj]
17669 . if !\\n[#NO_SHIM] \
17670 . if !\\n[@no-shim] .SHIM
17682 . if \\n[float*img] .rr float*img
17683 . if \\n[float*pic] .rr float*pic
17684 . if \\n[float*eqn] .rr float*eqn
17687 . if \\n[#NO_SHIM] \
17688 . if !\\n[#NO_FLEX] .nr post-float 1
17689 . ev \\*[ev-pre-float]
17694 \# SET TRAPS FOR HEADERS/FOOTERS/FOOTNOTES
17695 \# ---------------------------------------
17699 \# Sets header/footer/footnotes/etc... traps.
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.
17707 .MAC RR_@TOP END \" Trap-invoked after first line of text on a new page
17712 . if \\n[.u] .nr fill 1
17717 . if r #NEWPAGE .rr #NEWPAGE
17719 . if \\n[.vpt]=0 .vpt
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] \{\
17730 . ch FN_OVERFLOW_TRAP
17731 .\" Plant header trap
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] \{\
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] \{\
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] \{\
17763 . nr #SPACE_REMAINING 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
17777 \# Adds left, right, or both indent values to document elements
17778 \# like heads and subheads that are processed in environments.
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
17788 . if \\n[#EPIGRAPH] \{\
17789 . in -\\n[#L_INDENT]u
17790 . ll -\\n[#L_INDENT]u
17794 . if \\n[#INDENT_RIGHT_ACTIVE] \{\
17795 . ll -\\n[#R_INDENT]u
17798 . if \\n[#INDENT_BOTH_ACTIVE] \{\
17799 . in \\n[#BL_INDENT]u
17800 . ll -\\n[#BR_INDENT]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
17809 . ll -(\\n[#BR_INDENT]u/2u)
17813 . if \\n[#EPIGRAPH] \{\
17814 . in -\\n[#BL_INDENT]u
17815 . ie \\n[#BR_INDENT]=\\n[#BL_INDENT] \{\
17816 . ll -\\n[#BR_INDENT]u
17820 . ll -(\\n[#BR_INDENT]u/2u)
17832 \# Removes left, right, or both indent values from document elements
17833 \# like heads and subheads that are processed in environments.
17835 .MAC REMOVE_INDENT END
17837 . ll \\n[#L_LENGTH]u
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.
17846 . if dPDF.EXPORT .tm .ds last-page \\n%@\\n[#COL_NUM]
17847 . ie \\n[#FN_DEPTH] \{\
17848 . ie \\n[#FN_DEFER] \{\
17857 . ch FN_OVERFLOW_TRAP
17863 . ch FN_OVERFLOW_TRAP
17870 \# END MACRO FOR LETTERS
17871 \# ---------------------
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).
17883 . if \\n[#DOC_TYPE]=4 \{\
17884 . if !'\\n[.z]'' \{\
17886 . ALD \\*[$SIG_SPACE]
17892 . ie !'\\*[$CLOSE_INDENT]'' .IL \\*[$CLOSE_INDENT]
17893 . el .IL \\n[#DOC_L_LENGTH]u/2u
17895 . if \\n[#CLOSING] \{\
17899 . PRINT \\*[$AUTHOR_1]
17903 \# Set up a default papersize of US letter
17907 \# ====================================================================
17909 \# +++DOCUMENT PROCESSING ALIASES+++
17911 \# Create aliases to make life easier for users: synonyms, short forms
17912 \# and alternate spellings.
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
17926 .ALIAS PAGENUM PAGENUMBER
17927 .ALIAS PAGINATION PAGINATE
17928 .ALIAS PP_FT PP_FONT
17929 .ALIAS TOC_PS TOC_PT_SIZE
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.
17939 .MAC FOOTER_CENTER_COLOR END
17940 . HDRFTR_CENTER_COLOR \\$1
17943 .MAC FOOTER_CENTER_COLOUR END
17944 . HDRFTR_CENTER_COLOR \\$1
17947 .MAC FOOTER_CENTER_FAM END
17948 . HDRFTR_CENTER_FAMILY \\$1
17951 .MAC FOOTER_CENTER_FAMILY END
17952 . HDRFTR_CENTER_FAMILY \\$1
17955 .MAC FOOTER_CENTER_FONT END
17956 . HDRFTR_CENTER_FONT \\$1
17959 .MAC FOOTER_CENTER_FT END
17960 . HDRFTR_CENTER_FONT \\$1
17963 .MAC FOOTER_CENTER_PS END
17964 . HDRFTR_CENTER_SIZE \\$1
17967 .MAC FOOTER_CENTER_SIZE END
17968 . HDRFTR_CENTER_SIZE \\$1
17971 .MAC FOOTER_CENTRE_CAPS END
17972 . HDRFTR_CENTER_CAPS \\$1
17975 .MAC FOOTER_CENTRE_COLOR END
17976 . HDRFTR_CENTER_COLOR \\$1
17979 .MAC FOOTER_CENTRE_COLOUR END
17980 . HDRFTR_CENTER_COLOR \\$1
17983 .MAC FOOTER_CENTRE_FAM END
17984 . HDRFTR_CENTER_FAMILY \\$1
17987 .MAC FOOTER_CENTRE_FAMILY END
17988 . HDRFTR_CENTER_FAMILY \\$1
17991 .MAC FOOTER_CENTRE_FONT END
17992 . HDRFTR_CENTER_FONT \\$1
17995 .MAC FOOTER_CENTRE_FT END
17996 . HDRFTR_CENTER_FONT \\$1
17999 .MAC FOOTER_CENTRE_PS END
18000 . HDRFTR_CENTER_SIZE \\$1
18003 .MAC FOOTER_CENTRE_SIZE END
18004 . HDRFTR_CENTER_SIZE \\$1
18007 .MAC FOOTER_COLOR END
18008 . HDRFTR_COLOR \\$1
18011 .MAC FOOTER_COLOUR END
18012 . HDRFTR_COLOR \\$1
18015 .MAC FOOTER_FAM END
18016 . HDRFTR_FAMILY \\$1
18019 .MAC FOOTER_FAMILY END
18020 . HDRFTR_FAMILY \\$1
18023 .MAC FOOTER_LEFT_COLOR END
18024 . HDRFTR_LEFT_COLOR \\$1
18027 .MAC FOOTER_LEFT_COLOUR END
18028 . HDRFTR_LEFT_COLOR \\$1
18031 .MAC FOOTER_LEFT_FAM END
18032 . HDRFTR_LEFT_FAMILY \\$1
18035 .MAC FOOTER_LEFT_FAMILY END
18036 . HDRFTR_LEFT_FAMILY \\$1
18039 .MAC FOOTER_LEFT_FONT END
18040 . HDRFTR_LEFT_FONT \\$1
18043 .MAC FOOTER_LEFT_FT END
18044 . HDRFTR_LEFT_FONT \\$1
18047 .MAC FOOTER_LEFT_PS END
18048 . HDRFTR_LEFT_SIZE \\$1
18051 .MAC FOOTER_LEFT_SIZE END
18052 . HDRFTR_LEFT_SIZE \\$1
18055 .MAC FOOTER_RIGHT_COLOR END
18056 . HDRFTR_RIGHT_COLOR \\$1
18059 .MAC FOOTER_RIGHT_COLOUR END
18060 . HDRFTR_RIGHT_COLOR \\$1
18063 .MAC FOOTER_RIGHT_FAM END
18064 . HDRFTR_RIGHT_FAMILY \\$1
18067 .MAC FOOTER_RIGHT_FAMILY END
18068 . HDRFTR_RIGHT_FAMILY \\$1
18071 .MAC FOOTER_RIGHT_FONT END
18072 . HDRFTR_RIGHT_FONT \\$1
18075 .MAC FOOTER_RIGHT_FT END
18076 . HDRFTR_RIGHT_FONT \\$1
18079 .MAC FOOTER_RIGHT_PS END
18080 . HDRFTR_RIGHT_SIZE \\$1
18083 .MAC FOOTER_RIGHT_SIZE END
18084 . HDRFTR_RIGHT_SIZE \\$1
18087 .MAC FOOTER_RULE_COLOR END
18088 . HDRFTR_RULE_COLOR \\$1
18091 .MAC FOOTER_SIZE END
18095 .MAC HEADER_CENTER_COLOR END
18096 . HDRFTR_CENTER_COLOR \\$1
18099 .MAC HEADER_CENTER_COLOUR END
18100 . HDRFTR_CENTER_COLOR \\$1
18103 .MAC HEADER_CENTER_FAM END
18104 . HDRFTR_CENTER_FAMILY \\$1
18107 .MAC HEADER_CENTER_FAMILY END
18108 . HDRFTR_CENTER_FAMILY \\$1
18111 .MAC HEADER_CENTER_FONT END
18112 . HDRFTR_CENTER_FONT \\$1
18115 .MAC HEADER_CENTER_FT END
18116 . HDRFTR_CENTER_FONT \\$1
18119 .MAC HEADER_CENTER_PS END
18120 . HDRFTR_CENTER_SIZE \\$1
18123 .MAC HEADER_CENTER_SIZE END
18124 . HDRFTR_CENTER_SIZE \\$1
18127 .MAC HEADER_CENTRE_COLOR END
18128 . HDRFTR_CENTER_COLOR \\$1
18131 .MAC HEADER_CENTRE_COLOUR END
18132 . HDRFTR_CENTER_COLOR \\$1
18135 .MAC HEADER_CENTRE_FAM END
18136 . HDRFTR_CENTER_FAMILY \\$1
18139 .MAC HEADER_CENTRE_FAMILY END
18140 . HDRFTR_CENTER_FAMILY \\$1
18143 .MAC HEADER_CENTRE_FONT END
18144 . HDRFTR_CENTER_FONT \\$1
18147 .MAC HEADER_CENTRE_FT END
18148 . HDRFTR_CENTER_FONT \\$1
18151 .MAC HEADER_CENTRE_PS END
18152 . HDRFTR_CENTER_SIZE \\$1
18155 .MAC HEADER_CENTRE_SIZE END
18156 . HDRFTR_CENTER_SIZE \\$1
18159 .MAC HEADER_COLOR END
18160 . HDRFTR_COLOR \\$1
18163 .MAC HEADER_COLOUR END
18164 . HDRFTR_COLOR \\$1
18167 .MAC HEADER_FAM END
18168 . HDRFTR_FAMILY \\$1
18171 .MAC HEADER_FAMILY END
18172 . HDRFTR_FAMILY \\$1
18175 .MAC HEADER_LEFT_COLOR END
18176 . HDRFTR_LEFT_COLOR \\$1
18179 .MAC HEADER_LEFT_COLOUR END
18180 . HDRFTR_LEFT_COLOR \\$1
18183 .MAC HEADER_LEFT_FAM END
18184 . HDRFTR_LEFT_FAMILY \\$1
18187 .MAC HEADER_LEFT_FAMILY END
18188 . HDRFTR_LEFT_FAMILY \\$1
18191 .MAC HEADER_LEFT_FONT END
18192 . HDRFTR_LEFT_FONT \\$1
18195 .MAC HEADER_LEFT_FT END
18196 . HDRFTR_LEFT_FONT \\$1
18199 .MAC HEADER_LEFT_PS END
18200 . HDRFTR_LEFT_SIZE \\$1
18203 .MAC HEADER_LEFT_SIZE END
18204 . HDRFTR_LEFT_SIZE \\$1
18207 .MAC HEADER_RIGHT_COLOR END
18208 . HDRFTR_RIGHT_COLOR \\$1
18211 .MAC HEADER_RIGHT_COLOUR END
18212 . HDRFTR_RIGHT_COLOR \\$1
18215 .MAC HEADER_RIGHT_FAM END
18216 . HDRFTR_RIGHT_FAMILY \\$1
18219 .MAC HEADER_RIGHT_FAMILY END
18220 . HDRFTR_RIGHT_FAMILY \\$1
18223 .MAC HEADER_RIGHT_FONT END
18224 . HDRFTR_RIGHT_FONT \\$1
18227 .MAC HEADER_RIGHT_FT END
18228 . HDRFTR_RIGHT_FONT \\$1
18231 .MAC HEADER_RIGHT_PS END
18232 . HDRFTR_RIGHT_SIZE \\$1
18235 .MAC HEADER_RIGHT_SIZE END
18236 . HDRFTR_RIGHT_SIZE \\$1
18239 .MAC HEADER_RULE_COLOR END
18240 . HDRFTR_RULE_COLOR \\$1
18243 .MAC HEADER_SIZE END
18247 \# Aliases for other HEADER and FOOTER macros.
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
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
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
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
18303 .ALIAS SWITCH_FOOTERS SWITCH_HDRFTR
18304 .ALIAS SWITCH_HEADERS SWITCH_HDRFTR
18306 \# Create type-style aliases for tags, titles, and page elements
18308 \# These are used for creating aliases with while loops
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
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
18348 .while \n+[#LOOP]<=18 \{\
18349 . ALIAS \*[ELEMENT_TYPE_\n[#LOOP]]_FAMILY _FAMILY
18351 \# Covers, docheader
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
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
18369 .while \n+[#LOOP]<=18 \{\
18370 . ALIAS \*[ELEMENT_TYPE_\n[#LOOP]]_FONT _FONT
18372 \# Covers, docheader
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
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
18389 .while \n+[#LOOP]<=18 \{\
18390 . ALIAS \*[ELEMENT_TYPE_\n[#LOOP]]_SIZE _SIZE
18392 \# Covers, docheader
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
18400 \# Create aliases for TITLE_LEAD
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
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
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
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
18448 .while \n+[#LOOP]<=18 \{\
18449 . ALIAS \*[ELEMENT_TYPE_\n[#LOOP]]_COLOR _COLOR
18451 \# Covers, docheader
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
18459 \# Create aliases for _CAPS
18460 .ALIAS BIBLIOGRAPHY_HEADER_CAPS _CAPS
18461 .ALIAS BIBLIOGRAPHY_STRING_CAPS _CAPS
18462 .ALIAS ENDNOTE_TITLE_CAPS _CAPS
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
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
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
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
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
18521 \# Miscellaneous aliases
18522 .ALIAS SECTION LINEBREAK
18523 .ALIAS SECTION_CHAR LINEBREAK_CHAR
18525 \# Miscellaneous macros to take care of backward compatibility
18526 \# -----------------------------------------------------------
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.
18536 . nr #RESTORE_TRAP 1
18540 . if \\n[#RESTORE_TRAP] \{\
18546 \# PREPROCESSOR SUPPORT
18547 \# ====================
18549 \# Utility macros--label and caption styles, lists collector, lists
18552 .nr lists*target 0 1
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
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\"
18580 . el .ds \\*[label-type]*\\*[spec-type]-quad L\"
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
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]]
18595 \# Line lengths, indents, and quads for captions and labels.
18596 \# Aliased for eqn, pic, pdf-image, and tbl.
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
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
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))
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))
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
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
18653 . if '\\*[pdf-img:pos]'-R' \{\
18654 . ll -\\n[ind-pre-img]u
18655 . in \\n[.l]u-\\n[pdf-img:width]u
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
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
18668 . ll \\n[pic*div-width]u
18669 \!. in \\n[ll-pre-pic]u-\\n[pic*div-width]u/2u
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
18684 . in \\n[ll-pre-tbl]u+\\n[.i]u-\\n[TW]u/2u
18685 . ll \\n[.l]u-\\n[.i]u
18689 . if '\\*[spec-type]'source' \{\
18690 . ie \\n[float*tbl] \{\
18692 \!. in \\n[ll-pre-tbl]u-\\n[TW]u/2u+\\n[tmp-ind]u
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
18699 \!. in \\n[ll-pre-tbl]u-\\n[TW]u/2u+\\n[tmp-ind]u
18701 \!. ti -\\n[tmp-ind]u
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
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' \{\
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
18720 . ll \\n[TW]u+\\n[ind-pre-tbl]u
18721 \!. in \\n[tmp-ind]u
18722 \!. ti -\\n[tmp-ind]u
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
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]
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
18766 \# User style macros
18768 \# TYPE SPECS FOR LABELS, CAPTIONS, AND SOURCES
18769 \# --------------------------------------------
18770 \# Aliased as CAPTIONS and LABELS for eqn, pic, tbl, and pdf images.
18772 \# EQN | IMG | PIC | TBL | FLOATING \
18773 \# Remaining arguments are optional
18777 \# QUAD LEFT | CENTRE | RIGHT [ ON_LL ] \
18782 \# Sets type specs for captions, labels, and sources according to
18783 \# calling alias name
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.
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
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' \{\
18808 . while \\n+[all]<=5 \{\
18810 . ds \\*[label-type]*\\*[spec-type]-family \\$1
18813 . el .ds \\*[label-type]*\\*[spec-type]-family \\$1
18814 . if \\n[#PRINT_STYLE]=1 \
18815 . ds \\*[label-type]*\\*[spec-type]-family \\*[$TYPEWRITER_FAM]
18818 . if '\\$1'FONT' \{\
18822 . while \\n+[all]<=5 \{\
18824 . ds \\*[label-type]*\\*[spec-type]-font \\$1
18827 . el .ds \\*[label-type]*\\*[spec-type]-font \\$1
18828 . if \\n[#PRINT_STYLE]=1 \
18829 . ds \\*[label-type]*\\*[spec-type]-font R
18832 . if '\\$1'SIZE' \{\
18836 . while \\n+[all]<=5 \{\
18838 . ds \\*[label-type]*\\*[spec-type]-size-change \\$1
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
18846 . if '\\$1'AUTOLEAD' \{\
18850 . while \\n+[all]<=5 \{\
18852 . nr \\*[label-type]*\\*[spec-type]-autolead (p;\\$1)
18855 . el .nr \\*[label-type]*\\*[spec-type]-autolead (p;\\$1)
18858 . if '\\$1'QUAD' \{\
18862 . while \\n+[all]<=5 \{\
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
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
18878 . ie '\\$2'ON_LL' .shift 2
18881 . if '\\$1'COLOR' \{\
18885 . while \\n+[all]<=5 \{\
18887 . ds \\*[label-type]*\\*[spec-type]-color \\$1
18890 . el .ds \\*[label-type]*\\*[spec-type]-color \\$1
18891 . if \\n[#PRINT_STYLE]=1 \
18892 . ds \\*[label-type]*\\*[spec-type]-color black
18895 . if '\\$1'ADJUST' \{\
18899 . while \\n+[all]<=5 \{\
18901 . ds \\*[label-type]*\\*[spec-type]-space \\$1
18904 . el .ds \\*[label-type]*\\*[spec-type]-space \\$1
18905 . if \\n[#PRINT_STYLE]=1 \
18906 . ds \\*[label-type]*\\*[spec-type]-space +0
18909 . if '\\$1'INDENT' \{\
18911 . ie '\\*[label-type]'floating' \{\
18913 . nr \\*[label-type]*\\*[spec-type]-indent-l \\$1
18917 . ie '\\$1'RIGHT' \{\
18919 . nr \\*[label-type]*\\*[spec-type]-indent-r \\$1
18924 "[mom]: Missing value for INDENT in macro '\\$0' at line \\n[.c].
18926 [mom]: Aborting '\\n[.F]' at \\$0, line \\n[.c].
18932 . if !\\n[#SKIP_INDENT_WARNING] \{\
18934 "[mom]: '\\$0 \\*[$LABEL-TYPE]' at line \\n[.c] does not take an indent.
18936 " No indent(s) will be applied.
18937 . nr #SKIP_INDENT_WARNING 1
18939 . if '\\$1'INDENT' .shift
18940 . if '\\$1'RIGHT' .shift
18941 . if \B'\\$1' .shift
18947 . while \\n+[all]<=5 \{\
18957 . ds revert-specs \f[]\s[0]\m[]
18958 . rr #SKIP_INDENT_WARNING
18962 .ALIAS CAPTIONS CAPTION_LABEL_SPECS
18963 .ALIAS LABELS CAPTION_LABEL_SPECS
18964 .ALIAS SOURCES CAPTION_LABEL_SPECS
18966 \# LABELS and CAPTIONS (floats and [block]quotes)
18967 \# ----------------------------------------------
18969 \# <text of label or caption> [ CAPTION <text of caption> ] \
18970 \# [ TO_LIST FIGURES | EQUATIONS | TABLES ]
18972 \# Add label/caption to float, quotes, and blockquotes
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.
18981 \# These strings allow users to create labels of the form
18982 \# 'Fig. \*[chapter].\*[fig-label]', e.g. 'Fig. 1.1'
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]
18999 . if r chop-space .sp -1
19001 . if \\n[#QUOTE] .nr q-float 1
19002 . if '\\$0'CAPTION' \{\
19003 . ds labelcap caption
19004 . ds $FLOATING_CAPTION \\$*
19006 . if '\\$0'LABEL' \{\
19007 . ds labelcap label
19008 . ds $FLOATING_LABEL \\$1
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
19018 . if '\\$1'SHORT_CAPTION' \{\
19019 . ds $LIST_CAPTION \\$2
19022 . if '\\$1'TO_LIST' \{\
19024 . if '\\$2'FIGURES' .ds $LIST_OF FIGURES
19025 . if '\\$2'EQUATIONS' .ds $LIST_OF EQUATIONS
19026 . if '\\$2'TABLES' .ds $LIST_OF TABLES
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
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] \{\
19053 . sp \\n[#DOC_LEAD]u/4u
19055 . if '\\n[.z]'FLOAT*DIV' .sp \\n[#DOC_LEAD]u/4u
19058 . sp \\n[#DOC_LEAD]u/4u
19062 \!. if \\\\n[deferred-float] \{\
19063 . if !\\n[#QUOTE] .sp -(\\n[#DOC_LEAD]u/4u)
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] \
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]"
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]
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'' \{\
19096 \F[\\*[floating*caption-family]]\
19097 \f[\\*[floating*caption-font]]\
19098 \s[\\*[floating*caption-size-change]]\
19099 \m[\\*[floating*caption-color]]\
19104 . if !'\\*[floating*caption-space]'' \
19105 . sp -\\*[floating*caption-space]
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]
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]
19126 . if !'\\*[floating*label-space]'' \
19127 . sp -\\*[floating*label-space]
19129 .\" 1/4 space after captions and labels
19130 . ie !\\n[@bottom] \
19131 . sp \\n[#DOC_LEAD]u/4u
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)
19139 \!. rr deferred-float
19142 . QUAD \\*[$QUAD_PREV]
19145 . if \\n[to-list] \{\
19146 . nr loop-counter 0 1
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]
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
19164 . ie '\\*[$LIST_LABEL]'' .TO_\\*[$LIST_OF] "\\*[$FLOATING_LABEL]
19165 . el .TO_\\*[$LIST_OF] "\\*[$LIST_LABEL]" "\\*[$LIST_CAPTION]
19167 . nr loop-counter 0 1
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
19179 . rm $FLOATING_CAPTION
19180 . rm $FLOATING_LABEL
19185 .ALIAS CAPTION LABEL
19187 .MAC STRIP_PRFX_SFFX END
19188 .\" Strip suffix from label string
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
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
19210 . substring $LIST_LABEL 1
19213 \# CAPTION_AFTER_LABEL
19214 \# -------------------
19216 \# <none> | <anything>
19218 \# Sets register indicating non-MLA captions should come after labels.
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
19232 . ie !'\\$1'ALL' .rr \\*[type]*caption-after-label
19234 . rr pdf-img*caption-after-label
19235 . rr tbl*caption-after-label
19236 . rr pic*caption-after-label
19245 \# [ PREFIX <prefix> SUFFIX <suffix> ] | <anything>
19247 \# Turns label autonumbering on of off; optionally lets user set
19248 \# prefix and suffix for labels.
19250 \# Aliased for images (pdf), tbl, pic, and eqn.
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
19259 . if '\\$0'AUTOLABEL_IMAGES' \{\
19260 . ds label-type pdf-img
19261 . nr fig*autolabel 1
19264 . ds \\*[label-type]-label-args \\$1
19265 . substring \\*[label-type]-label-args -1 -3
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
19284 . if '\\$1'SUFFIX' \{\
19285 . ds \\*[label-type]*label-sffx \\$2
19286 . nr \\*[label-type]*label-sffx-set 1
19289 . if '\\$1'PREFIX_CHAPTER' \{\
19290 . if \\n[fig*autolabel] .nr fig*label-with-chapter 1
19291 . nr \\*[label-type]*label-with-chapter 1
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 \"
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 .\"
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].
19337 . if \\n[#NUM_ARGS]=1 \{\
19339 . rr \\*[label-type]*autolabel
19340 . rr \\*[label-type]*label-prfx-set
19341 . rr \\*[label-type]*label-sffx-set
19343 . rr \\*[label-type]-label-args
19346 .ALIAS AUTOLABEL_EQUATIONS AUTOLABEL
19347 .ALIAS AUTOLABEL_IMAGES AUTOLABEL
19348 .ALIAS AUTOLABEL_PIC AUTOLABEL
19349 .ALIAS AUTOLABEL_TABLES AUTOLABEL
19351 \# SET AUTOLABEL NUMBER
19352 \# --------------------
19354 \# FIG | TBL | PIC | EQN <n>
19356 \# Sets the autolabel number for the corresponding label type.
19358 \# Used to set autolabel number when manual labelling of floats
19359 \# (in conjunction with TO_LIST) disrupts auto-incrementing.
19361 .MAC SET_AUTOLABEL END
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
19374 \# <none> | <anything>
19376 \# Sets or removes register #MLA.
19378 \# MLA formatting differs from other styles wrt caption and
19379 \# label placement.
19384 . nr pdf-img*caption-after-label 1
19385 . nr pic*caption-after-label 1
19386 . rr tbl*caption-after-label
19393 . tm1 "[mom]: MLA style enabled, but \\$1 has no corresponding \\$2.
19394 . ab [mom]: Aborting '\\$3' at \\$4, line \\$5.
19400 \# LIST_OF_EQUATIONS
19404 \# [ TITLE_STRING <string> ] [ START_PAGENUM <pagenumber> ]
19406 \# Generates lists-of based on calling alias.
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.
19414 . ds $LIST_TYPE \\$0
19416 . substring $LIST_TYPE -1 -4
19417 . if '\\*[$LIST_TYPE]'URES' \{\
19418 . ds $LIST_TYPE FIGURES
19420 . ds label-type fig
19421 . ds \\*[$LIST_TYPE]_TITLE_STRING "List of Figures
19423 . if '\\*[$LIST_TYPE]'BLES' \{\
19424 . ds $LIST_TYPE TABLES
19426 . ds label-type tbl
19427 . ds \\*[$LIST_TYPE]_TITLE_STRING "List of Tables
19429 . if '\\*[$LIST_TYPE]'IONS' \{\
19430 . ds $LIST_TYPE EQUATIONS
19432 . ds label-type eqn
19433 . ds \\*[$LIST_TYPE]_TITLE_STRING "List of Equations
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
19443 . if '\\$1'START_PAGENUM' \{\
19444 . nr #\\*[$LIST_TYPE]_START_PAGENUM \\$2
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 \{\
19456 . nr #LINENUMBERS 2
19458 . if \\n[#FINIS] \{\
19459 . if \\n[#FOOTERS_WERE_ON] \
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
19467 . if \\n[#FOOTERS_WERE_ON] \
19468 . if !\\n[#FINIS] .FOOTERS OFF
19471 . if \\n[#PRINT_STYLE]=1 \{\
19472 . if \\n[#SINGLE_SPACE] .LS 24
19475 . if \\n[#FINIS] \{\
19476 . if \\n[#FOOTERS_WERE_ON] .FOOTERS
19477 . rr #FOOTERS_WERE_ON
19478 . if \\n[#PAGINATION_WAS_ON] \{\
19480 . rr #PAGINATION_WAS_ON
19484 . ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_NEW]
19485 . rm $HDRFTR_CENTER_OLD
19486 . rm $HDRFTR_CENTER_NEW
19490 . rr #DOCHEADER_ADVANCE
19491 . TITLE "\\*[\\*[$LIST_TYPE]_TITLE_STRING]
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]
19511 . nr #DOC_LEAD \\n[#LISTS_LEAD]
19512 . DOC_LEAD_ADJUST OFF
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] \
19528 . if \\n[#LISTS_TITLE_SMALLCAPS] \
19530 . if \\n[#LISTS_TITLE_UNDERSCORE] \{\
19531 . TITLE_UNDERSCORE \
19533 \\*[$LISTS_OF_UL_WT] \
19534 \\*[$LISTS_OF_UL_GAP] \
19535 \\*[$LISTS_OF_RULE_GAP]
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]
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
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]
19573 . if \\n[#SLANT_ON] .nop \\*[SLANTX]
19574 . if \\n[#COLUMNS]=1 .nr #COLUMNS 0
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
19589 .ALIAS LIST_OF_EQUATIONS LISTS_OF
19590 .ALIAS LIST_OF_FIGURES LISTS_OF
19591 .ALIAS LIST_OF_TABLES LISTS_OF
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 \
19607 \# TITLE_SMALLCAPS \
19608 \# TITLE_NO_SMALLCAPS \
19609 \# TITLE_UNDERSCORE [ DOUBLE] <wt> <gap> (dbl-rule-gap) \
19611 \# PAGENUM_STYLE format \
19614 \# PN_SIZE +|-size \
19617 \# Allows setting of all style parameters for lists-of.
19619 \# Assumption is that lists-of will all have the same style.
19620 \# TOC style is used if LISTS_STYLE is omitted.
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
19630 . if '\\$1'FONT' \{\
19631 . ds $LISTS_FT \\$2
19634 . if '\\$1'TITLE_FAMILY' \{\
19635 . ds $LISTS_TITLE_FAM \\$2
19638 . if '\\$1'TITLE_FONT' \{\
19639 . ds $LISTS_TITLE_FT \\$2
19642 . if '\\$1'TITLE_SIZE' \{\
19643 . ds $LISTS_TITLE_SIZE \\$2
19646 . if '\\$1'TITLE_QUAD' \{\
19647 . ds $LISTS_TITLE_QUAD \\$2
19650 . if '\\$1'TITLE_COLOR' \{\
19651 . ds $LISTS_TITLE_COLOR \\$2
19654 . if '\\$1'TITLE_CAPS' \{\
19655 . nr #LISTS_TITLE_CAPS 1
19658 . if '\\$1'TITLE_NO_CAPS' \{\
19659 . rr #LISTS_TITLE_CAPS
19662 . if '\\$1'TITLE_SMALLCAPS' \{\
19663 . nr #LISTS_TITLE_SMALLCAPS 1
19666 . if '\\$1'TITLE_NO_SMALLCAPS' \{\
19667 . rr #LISTS_TITLE_NO_SMALLCAPS
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
19675 . ie '\\$1'DOUBLE' \{\
19679 . ds $LISTS_OF_UL_WT \\$1
19683 . ds $LISTS_OF_UL_GAP \\$1
19687 . ds $LISTS_OF_RULE_GAP \\$1
19693 . ds $LISTS_OF_UL_WT \\$1
19697 . ds $LISTS_OF_UL_GAP \\$1
19702 . if '\\$1'TITLE_UNDERLINE' \{\
19703 . nr #LISTS_TITLE_UNDERSCORE 1
19705 . ie '\\$1'DOUBLE' \{\
19709 . ds $LISTS_OF_UL_WT \\$1
19713 . ds $LISTS_OF_UL_GAP \\$1
19717 . ds $LISTS_OF_RULE_GAP \\$1
19723 . ds $LISTS_OF_UL_WT \\$1
19727 . ds $LISTS_OF_UL_GAP \\$1
19732 . if '\\$1'TITLE_NO_UNDERSCORE' \{\
19733 . rr #LISTS_TITLE_UNDERSCORE 1
19735 . rm $LISTS_OF_UL_WT
19736 . rm $LISTS_OF_UL_GAP
19737 . rm $LISTS_OF_RULE_GAP
19740 . if '\\$1'TITLE_NO_UNDERLINE' \{\
19741 . rr #LISTS_TITLE_UNDERSCORE 1
19743 . rm $LISTS_OF_UL_WT
19744 . rm $LISTS_OF_UL_GAP
19745 . rm $LISTS_OF_RULE_GAP
19748 . if '\\$1'PT_SIZE' \{\
19749 . nr #LISTS_PS (p;\\$2)
19752 . if '\\$1'LEAD' \{\
19753 . nr #LISTS_LEAD (p;\\$2)
19754 . ie !'\\$3'ADJUST' \{\
19755 . nr #LISTS_LEAD_ADJUST 0
19759 . nr #LISTS_LEAD_ADJUST 1
19763 . if '\\$1'NO_PAGINATION' \{\
19764 . nr #LISTS_NO_PAGENUM 1
19767 . if '\\$1'PAGENUM_STYLE' \{\
19768 . ds $LISTS_PAGENUM_STYLE \\$2
19771 . if '\\$1'PN_FAMILY' \{\
19772 . ds $LISTS_PN_FAM \\$2
19775 . if '\\$1'PN_FONT' \{\
19776 . ds $LISTS_PN_FT \\$2
19779 . if '\\$1'PN_SIZE' \{\
19780 . ds $LISTS_PN_SIZE_CHANGE \\$2
19783 . if '\\$1'EQN_PN_PADDING' \{\
19784 . nr #EQN_PN_PADDING \\$2
19787 . if '\\$1'FIG_PN_PADDING' \{\
19788 . nr #FIG_PN_PADDING \\$2
19791 . if '\\$1'TBL_PN_PADDING' \{\
19792 . nr #TBL_PN_PADDING \\$2
19798 \# Lists-of collector
19799 \# Strings to allocate space for leaders and entry page numbers
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]
19805 .ds $LISTS_PN_TYPEWRITE \\*[ST102]^\\*[ST102X]\\*[ST103]\|\
19806 \h'\w'\0'u*\\\\n[#LISTS_PN_PADDING]u'\\*[ST103X]
19808 .MAC LISTS_COLLECTOR END
19809 . nr #LISTS_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
19810 . if \\n[#KERN] .nr #RESTORE_KERN 1
19812 . if '\\$0'TO_EQUATIONS' \{\
19814 . ds label-type eqn
19816 \!. nr #LISTS_PN_PADDING \\\\n[#EQN_PN_PADDING]
19818 . if '\\$0'TO_FIGURES' \{\
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
19828 \!. nr #LISTS_PN_PADDING \\\\n[#FIG_PN_PADDING]
19830 . if '\\$0'TO_TABLES' \{\
19832 . ds label-type tbl
19834 \!. nr #LISTS_PN_PADDING \\\\n[#TBL_PN_PADDING]
19837 . ie \\n[#PRINT_STYLE]=1 \{\
19838 \!. fam \\*[$TYPEWRITER_FAM]
19840 \!. ps \\*[$TYPEWRITER_PS]
19841 . ds _TYPEWRITE _TYPEWRITE
19844 \!. FAMILY \\\\*[$LISTS_FAM]
19845 \!. FONT \\\\*[$LISTS_FT]
19846 \!. ps \\\\n[#LISTS_PS]u
19848 . if \\n[#PRINT_STYLE]=2 .rm _TYPEWRITE
19851 . ie !\\n[\\*[label-type]*autolabel] \{\
19852 .\" If there is a label...
19853 . if !'\\*[\\*[label-type]*label]'' \
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]'' \
19860 "\\*[ST100]\\*[ST100X]\\*[ST101]\h'\w'\\$1'u'\0\\*[ST101X]\\\\*[$LISTS_PN\\*[_TYPEWRITE]]" \
19861 "\*[PDFBOOKMARK.NAME]"
19863 .\" If autolabelling...
19866 "\\*[ST100]\h'\\\\n[label-width]u'\\*[ST100X]\ \ \ \\*[ST101]\h'\w'\\$2'u'\\*[ST101X]\\\\*[$LISTS_PN\\*[_TYPEWRITE]]" \
19867 "\*[PDFBOOKMARK.NAME]"
19870 . ie !\\n[\\*[label-type]*autolabel] \
19877 . if \\n[#PRINT_STYLE]=2 \{\
19878 \!. FAMILY \\\\*[$LISTS_FAM]
19879 \!. FT \\\\*[$LISTS_FT]
19880 \!. ps \\\\n[#LISTS_PS]u
19883 \!. PDF_LINK \\*[list-type]:\\n[lists*target] "\\$1"
19886 \!. PDF_LINK \\*[list-type]:\\n[lists*target] "\\$2"
19889 \!. PRINT \fR\\*[LEADER]\f[]
19891 . if \\n[#PRINT_STYLE]=2 \{\
19892 \!. FAMILY \\\\*[$LISTS_PN_FAM]
19893 \!. FT \\\\*[$LISTS_PN_FT]
19894 \!. ps \\\\*[$LISTS_PN_SIZE_CHANGE]
19896 \!. PRINT \\n[#LISTS_ENTRY_PN]
19900 . if \\n[#RESTORE_KERN] .KERN
19903 .ALIAS TO_EQUATIONS LISTS_COLLECTOR
19904 .ALIAS TO_FIGURES LISTS_COLLECTOR
19905 .ALIAS TO_TABLES LISTS_COLLECTOR
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.
19913 .nr tbl*have-header 0
19917 . if \\n[.t]<\\n[#DOC_LEAD] .nr begin-tbl 1
19922 . rr tbl*have-caption
19923 . rr tbl*have-label
19924 . rr tbl*have-header
19927 . nr ind-pre-tbl \\n[.i]
19928 . nr ll-pre-tbl \\n[.l]
19929 . nr lead-pre-tbl \\n[.v]
19932 . if !'\\n[.z]'FLOAT*DIV' \{\
19933 . if \\n[.u] .nr fill 1
19936 . if '\\n[.z]'FLOAT*DIV' .nr float*tbl 1
19937 . if !'\\n[.z]'FLOAT*DIV' \{\
19939 . if !\\n[@TOP] \{\
19940 . ie \\n[#COLUMNS] .COL_NEXT internal
19945 . nr loop-count 0 1
19946 . nr loop-counter \\n[#NUM_ARGS]
19947 . while \\n+[loop-count]<=\\n[loop-counter] \{\
19949 . nr tbl*have-header 1
19951 . if \\n[#NUM_ARGS]=0 .nr tbl*plain 1
19953 . if '\\$1'BOXED' \{\
19957 . if '\\$1'CENTER' \{\
19958 . if \\n[#INDENT_BOTH_ACTIVE] \{\
19960 . nr #RESTORE_INDENT_BOTH 1
19965 . if '\\$1'CENTRE' \{\
19966 . if \\n[#INDENT_BOTH_ACTIVE] \{\
19968 . nr #RESTORE_INDENT_BOTH 1
19973 . if '\\$1'NEEDS' \{\
19974 . nr tbl*needs \\$2
19977 . if '\\$1'NO_SHIM' \{\
19981 . if '\\$1'NO_FLEX' \{\
19985 . if '\\$1'ADJUST' \{\
19986 . ds tbl*space-adj \\$2
19989 . if '\\$1'CAPTION' \{\
19990 . nr tbl*have-caption 1
19991 . ds tbl*caption \\$2
19994 . if '\\$1'SHORT_CAPTION' \{\
19995 . ds tbl*caption-short \\$2
19998 . if '\\$1'LABEL' \{\
19999 . nr tbl*have-label 1
20000 . ds tbl*label \\$2
20003 . if '\\$1'TARGET' \{\
20005 . PDF_TARGET "\\*[target]
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
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
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].
20032 \\*[tbl*label-prfx]\\*[chapno]\\n+[tbl*label-num]\\*[tbl*label-sffx]\"
20033 . nr tbl*label-width \w'\\*[tbl*label]'
20036 . if !'\\n[.z]'FLOAT*DIV' \{\
20039 . if \\n[#COLUMNS] \
20040 . if !'\\*[tbl*space-adj]'' \
20041 . sp \\*[tbl*space-adj]-1v
20042 . if \\n[tbl*boxed] .nr tbl*boxed 2
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
20058 . if !\\n[tbl*boxed] .ns
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
20073 . if \\n[tbl*have-label]+\\n[tbl*have-caption]=0 \
20075 . if \\n[tbl*boxed]=2 \{\
20077 . if (\\n[tbl*caption-after-label]=1):(\\n[tbl*have-caption]=0) \
20080 . if \\n[tbl*have-header] \{\
20081 . di tbl*header-div
20083 . evc \\*[ev-current]
20084 . if !\\n[float-span] \{\
20085 . ie '\\*[ev-current]'FLOAT' \{\
20086 . ie !\\n[tbl*center] \
20099 . ie '\\n[.z]'tbl*header-div' \{\
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]]"
20111 \!. TO_TABLES "\\*[tbl*caption\\*[short]]"
20115 . if '\\n[.z]'' .PDF_TARGET tbl:\\n+[lists*target]
20116 . ie !'\\*[tbl*label]'' \
20117 . TO_TABLES "\\*[tbl*label]" "\\*[tbl*caption\\*[short]]"
20119 . TO_TABLES "\\*[tbl*caption\\*[short]]"
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] \{\
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
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
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
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] \{\
20161 . if \\n[tbl*have-caption] .TBL*CAPTION
20164 . nr tbl*header-ht \\n[dn]
20165 . if \\n[tbl@needs] \{\
20166 . if \\n[tbl*boxed] \{\
20168 . if !\\n[#MLA] \{\
20169 . if (\\n[tbl*have-caption]=0):(\\n[tbl*caption-after-label]=1) \
20176 . if (\\n[tbl*have-caption]=1)&(\\n[tbl*caption-after-label]=0) \
20183 . if \\n[tbl*have-caption] \{\
20185 . nr skip-th-warning 1
20187 . if !\\n[skip-th-warning] .@error .TH without .TS H
20188 . rr skip-th-warning
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
20194 . if '\\n[.z]'FLOAT*DIV' \{\
20195 . if \\n[tbl*center] \{\
20196 . nr float*ll \\n[.l]
20198 . in \\n[float*ll]u-\\n[TW]u/2u
20204 . ev tbl*end \" Needed because of .ad changes
20205 . evc \\*[ev-current]
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.
20216 . nr tbl*have-source 1
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] \
20234 . if !\\n[tbl*have-source] .
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.
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
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
20260 . if !\\n[#MLA] \{\
20261 . if (\\n[tbl*have-label]=1):(\\n[tbl*autolabel]=1):(\\n[tbl*caption-after-label]=1) \{\
20263 . if '\\*[ev-current]'FLOAT' .evc 0
20264 . ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
20267 . vs \\n[.ps]u+\\n[tbl*label-autolead]u
20270 . if \\n[tbl*label-with-chapter] \
20271 . ds chapno \\n[#CH_NUM].
20272 . TBL*SET_LABEL_QUAD \\*[tbl*label-quad]
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]
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]
20293 . ie !\\n[tbl*caption-after-label] .nop \\*[tbl*label]
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]
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
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
20329 . if \\n[tbl*autolabel] \{\
20330 . ds tbl*label \\*[chapno]\\n[tbl*label-num]
20332 . tm .ds \\*[target] \\*[chapno]\\n[tbl*label-num]
20335 . if !\\n[tbl*skip-source] \{\
20336 . if \\n[tbl*have-source] \{\
20337 . ds tbl*source \\$1
20340 . evc \\*[ev-current]
20343 . ie \\n[#PRINT_STYLE]=1 \{\
20349 . vs \\n[.ps]u+\\n[tbl*source-autolead]u
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
20356 . sp \\n[#CAP_HEIGHT]u
20357 . if !'\\*[tbl*source-space]'' .sp \\*[tbl*source-space]
20358 . nop \\*[tbl*source]
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
20372 . if !\\n[tbl*plain] \{\
20373 . ie \\n[tbl*plain-boxed] \{\
20374 . ie \\n[#MLA] .if !\\n[tbl*have-source] .sp .5v
20378 . if !\\n[tbl*have-source] \{\
20379 . if (\\n[tbl*have-label]=0)&\
20380 (\\n[tbl*caption-after-label]=0)&(\\n[tbl*autolabel]=0) \
20382 . if (\\n[tbl*have-label]=1):(\\n[tbl*autolabel]=1) \
20385 . if '\\n[.z]'FLOAT*DIV' .nr chop-space 1
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
20393 . ie !\\n[tbl*no-shim] \{\
20394 . ie !\\n[#NO_SHIM] \
20395 . if !'\\n[.z]'FLOAT*DIV' .SHIM
20397 . if !\\n[tbl*no-flex] \
20398 . if !\\n[#NO_FLEX] \
20399 . if !'\\n[.z]'FLOAT*DIV' .FLEX
20402 . if !\\n[tbl*no-flex] \
20403 . if !\\n[#NO_FLEX] \
20404 . if !'\\n[.z]'FLOAT*DIV' .FLEX
20408 \# Utility macros for tbl
20410 .MAC TBL*CAPTION END
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]) \{\
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
20428 . if \\n[.ns] .if !(\\n[nl]=\\n[#PAGE_TOP]) .rs
20429 . sp \\n[#DOC_LEAD]u/2u
20437 . if !\\n[tbl*autolabel] \{\
20438 . ie !\\n[tbl*have-label] \
20439 . mla@error caption label \\n[.F] \\$0 \\n[.c]
20443 . ie \\n[#PRINT_STYLE]=1 .nr tmp-ind 2m
20444 . el .nr tmp-ind 1.25m
20445 . ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
20447 . if !\\n[#MLA] \{\
20448 . tbl*caption-style
20449 . nr lead-current \\n[.v]
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
20457 . TBL*SET_CAPTION_QUAD \\*[tbl*caption-quad]
20458 . nop \\*[tbl*caption]
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]
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]
20473 "[mom]: Table with caption at line \\n[.c] \
20474 does not fit on page \\n[pgnum]\\*[col-num].
20476 " Shifting table to next page or column.
20477 . ie (\\n[#COLUMNS]=1)&(\\n[#COL_NUM]=\\n[#NUM_COLS]) \{\
20482 . nr tbl*no-top-hook -1
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
20489 . ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
20490 . ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u
20492 . if \\n[.u] .nr fill 1
20494 . if \\n[.ns] .RESTORE_SPACE
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
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.
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]
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
20532 . evc \\*[ev-current]
20534 . ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
20537 . vs \\n[.ps]u+\\n[tbl*label-autolead]u
20538 . nr tbl*label-lead-diff \\n[lead-pre-tbl]-\\n[.v]
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
20545 . ie \\n[tbl*autolabel] \{\
20547 \\*[tbl*label-prfx]\\*[chapno]\\n[tbl*label-num]\\*[tbl*label-sffx]\"
20549 . nr tbl*label-width \w'\\*[label]'
20553 . if !'\\*[tbl*label]'' \{\
20554 . nop \\*[tbl*label]
20555 . nr tbl*label-width \w'\\*[tbl*label]'
20558 . if \\n[tbl*autolabel] \
20559 . ds tbl*label \\*[chapno]\\n[tbl*label-num]
20563 . da tbl*mla-label-caption
20564 . ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
20565 . el .tbl*caption-style
20566 . if '\\*[tbl*caption-quad]'L' \{\
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
20572 . ll \\n[TW]u+\\n[.i]u-\\n[tmp-ind]u
20573 \!. in \\n[tmp-ind]u
20574 . ti -\\n[tmp-ind]u
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
20584 . in \\n[tmp-ind]u+\\n[ind-pre-tbl]u
20586 . ti -\\n[tmp-ind]u
20588 . nop \\*[tbl*caption]
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
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]
20602 "[mom]: Table with caption at line \\n[.c] \
20603 does not fit on page \\n[pgnum]\\*[col-num].
20605 " Shifting table to next column or page.
20606 . ie (\\n[#COLUMNS]=1)&(\\n[#COL_NUM]=\\n[#NUM_COLS]) \{\
20608 . if \\n[defer] .nr skip-th-warning 1
20612 . nr tbl*no-top-hook 1
20614 . if (\\n[tbl*caption-after-label]=1):(\\n[tbl*plain]=1) \
20618 . ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
20619 . ch FN_OVERFLOW_TRAP -\\n[#FN_OVERFLOW_TRAP_POS]u
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] \{\
20627 . nr #RESTORE_FLEX 1
20630 . sp \\n[tbl*label-lead-diff]u
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
20639 . tbl*mla-label-caption
20641 . ie \\n[#PRINT_STYLE]=1 .sp .5v
20643 . if \\n[tbl*label-lead-diff-adj] \{\
20644 . sp -\\n[tbl*label-lead-diff]u
20645 . rr tbl*label-lead-diff-adj
20648 . if !'\\*[tbl*caption-space]'' .sp \\*[tbl*caption-space]
20649 \!. if \\\\n[float*tbl] .ev FLOAT
20650 . ev \\*[ev-current]
20653 .MAC TBL*CLEANUP END
20654 . if !'\\n[.z]'FLOAT*DIV' \{\
20655 . rm tbl*header-div
20658 . rm tbl*caption-short
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
20671 . rr tbl*skip-label
20672 . rr tbl*skip-source
20673 . rr tbl*label-warning
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] \{\
20683 . rr #RESTORE_INDENT_BOTH
20685 . if \\n[#RESTORE_INDENT_LEFT] \{\
20687 . rr #RESTORE_INDENT_LEFT
20689 . if \\n[#RESTORE_FLEX] \{\
20695 .MAC print-label END
20696 . if \\n[.u] .nr fill 1
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)
20705 . if !\\n[tbl*skip-label] \
20707 . if \\n[tbl*center] \{\
20708 . if '\\n[.z]'' \{\
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 \{\
20727 . ie !\\n[tbl*boxed] .sp -1
20735 .MAC tbl*print-header END
20740 . if \\n[#COL_NUM]>1 \
20741 . if !\\n[tbl*have-caption] \
20742 . if (\\n[@TOP]=1):(\\n[nl]=\\n[dc]) \
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
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
20756 .MAC tbl@bottom-hook END
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].
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]'.
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]'.
20780 .MAC ds@need END \" Move vertically until there is enough space for \$1
20782 . while \\n[.t]<=(\\$1)&(\\n[nl]>\\n[#PAGE_TOP]) \{\
20791 \# EQ/EN macros borrowed from ms, mommified by Robin Haberkorn
20792 \# <robin.haberkorn@googlemail.com>, expanded by Peter Schaffter.
20794 \# EQ [ -L | -C | -I <indent> ] [label]
20795 \# EN [ CONT | CONTINUED | ... ]
20797 \# Equations are centered by default, but can be left-justified
20798 \# (EQ -L), explicitly centered, or indented (EQ -I).
20800 \# Each eqn block for multi-line equations aligned with 'mark' and
20801 \# 'lineup' should be terminated by passing 'CONT' or 'CONTINUED'
20804 \# Note that geqn mark and lineup work correctly in centered equations.
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]
20811 . if \\n[.u] .nr fill 1
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]
20819 . nr loop-counter \\n[#NUM_ARGS]
20820 . nr loop-count 0 1
20821 . while \\n+[loop-count]<=\\n[loop-counter] \{\
20832 . ds DI@cont \\*[DI]
20840 . if '\\$1'ADJUST' \{\
20841 . ds eqn*space-adj \\$2
20844 . if '\\$1'LABEL' \{\
20845 . ds eqn*label \\$2
20848 . if '\\$1'SHIFT_LABEL' \{\
20849 . ds eqn*shift-label \\$2
20852 . if '\\$1'CAPTION' \{\
20853 . ds eqn*caption \\$2
20856 . if '\\$1'SHORT_CAPTION' \{\
20857 . ds eqn*caption-short \\$2
20860 . if '\\$1'TARGET' \{\
20862 . PDF_TARGET "\\*[target]
20865 . if '\\$1'NO_SHIM' \{\
20869 . if '\\$1'NO_FLEX' \{\
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] \{\
20883 . if !'\\*[eqn*caption]'' \{\
20884 . if '\\*[caption-quad]'L' \{\
20885 . if \\n[default-left] .ds caption-quad R
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]'
20897 . tm .ds \\*[target] \\*[chapno]\\n[eqn*label-num]
20899 . nr eqn*label-num -1
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]]"
20907 \!. TO_EQUATIONS "\\*[eqn*caption\\*[short]]"
20911 . PDF_TARGET eqn:\\n+[lists*target]
20912 . ie !'\\*[eqn*label]'' \
20913 . TO_EQUATIONS "\\*[eqn*label]" "\\*[eqn*caption\\*[short]]"
20915 . TO_EQUATIONS "\\*[eqn*caption\\*[short]]"
20918 . if \\n[continued] \{\
20922 . if \\n[eqn@left*cont] .nr eqn*type 1
20923 . if \\n[eqn@ind*cont] \{\
20925 . ds DI \\*[DI@cont]
20928 . if \\n[eqn@center*cont] .nr eqn*type 3
20937 . if !'\\n[.z]'eqn*div' \{\
20938 . @error mismatched EN
20944 . if !'\\*[eqn*label]'' .nr eqn*have-label 1
20945 . if !'\\*[eqn*caption]'' .nr eqn*have-caption 1
20947 . ie '\\$1'...' .ds continued CONT
20948 . el .ds continued \\$1
20949 . substring continued 0 3
20950 . ie '\\*[continued]'CONT' \{\
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
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].
20963 . if \\n[dl]:\\n[eqn*have-label] \{\
20964 . ds eqn*tabs \\n[.tabs]
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]
20971 . if '\\*[DD]'' \{\
20973 . if !\\n[@TOP] \{\
20975 . if !'\\*[eqn*space-adj]'' .sp \\*[eqn*space-adj]u
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]
20983 . ie \\n[eqn*autolabel] \
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]'\
20994 \\*[eqn*label-specs]\
20995 \t\v'+\\*[eqn*shift-label]'\
20997 \v'-\\*[eqn*shift-label]'\
21000 . if \\n[eqn-cutaround] .ll
21001 . if !\\n[continued] \{\
21002 . if \\n[eqn*have-caption] \
21007 . ie \\n[eqn*type]=2 \{\
21008 . ie '\\*[eqn*label-quad]'L' \{\
21010 . ie \\n[continued] .nop \t\\*[eqn*div]
21012 . ie \\n[eqn*autolabel] \
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]'\
21022 \\*[eqn*label-specs]\
21023 \v'+\\*[eqn*shift-label]'\
21025 \v'-\\*[eqn*shift-label]'\
21031 . ta \\*[DI] (u;\\n[.l]-\\n[.i])R
21032 . ie \\n[continued] .nop \t\\*[eqn*div]
21034 . ie \\n[eqn*autolabel] \
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]'\
21045 \\*[eqn*label-specs]\
21046 \t\v'+\\*[eqn*shift-label]'\
21048 \v'-\\*[eqn*shift-label]'\
21052 . if !\\n[continued] \{\
21053 . if \\n[eqn*have-caption] \
21058 . ie '\\*[eqn*label-quad]'L' \{\
21059 . ta (u;\\n[.l]-\\n[.i]/2)C
21060 . ie \\n[continued] .nop \t\\*[eqn*div]
21062 . ie \\n[eqn*autolabel] \
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]'\
21072 \\*[eqn*label-specs]\
21073 \v'+\\*[eqn*shift-label]'\
21075 \v'-\\*[eqn*shift-label]'\
21081 . ta (u;\\n[.l]-\\n[.i]/2)C (u;\\n[.l]-\\n[.i])R
21082 . ie \\n[continued] .nop \t\\*[eqn*div]
21084 . ie \\n[eqn*autolabel] \
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]'\
21095 \\*[eqn*label-specs]\
21096 \t\v'+\\*[eqn*shift-label]'\
21098 \v'-\\*[eqn*shift-label]'\
21102 . if !\\n[continued] \{\
21103 . if \\n[eqn*have-caption] \
21110 . ta (u;\\n[.l]-\\n[.i])R
21112 \\*[eqn*label-specs]\
21113 \t\v'+\\*[eqn*shift-label]'\
21115 \v'-\\*[eqn*shift-label]'\
21119 .\" if continuing (ie is a multi-line equation), don't space and SHIM
21120 . if !\\n[continued] \{\
21123 . if !\\n[.t]<(\\*[DD]+1) \
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
21130 . if !\\n[eqn*no-flex] \
21131 . if !\\n[#NO_FLEX] \
21132 . if !'\\n[.z]'FLOAT*DIV' .FLEX
21135 . if !\\n[eqn*no-flex] \
21136 . if !\\n[#NO_FLEX] \
21137 . if !'\\n[.z]'FLOAT*DIV' .FLEX
21140 . rm eqn*caption-short
21147 . rr eqn@center*cont
21148 . rr eqn*have-label
21149 . rr eqn*have-caption
21154 . if !\\n[eqn-cutaround] .rm eqn*space-adj
21157 . ad \\n[eqn*restore-adj]
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
21179 . if \\n[#PRINT_STYLE]=2 \{\
21180 . ps \\*[eqn*caption-size-change]
21181 . nr lead-curr \\n[.v]
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
21187 . if !'\\*[eqn*caption-space]'' \
21188 . sp \\*[eqn*caption-space]
21190 . if '\\*[eqn*caption-quad]'L' \{\
21194 \\*[eqn*caption-specs]\
21199 . if '\\*[eqn*caption-quad]'C' \{\
21203 \\*[eqn*caption-specs]\
21208 . if '\\*[eqn*caption-quad]'R' \{\
21212 \\*[eqn*caption-specs]\
21217 . if !'\\*[eqn*caption-space]'' \
21218 . sp -\\*[eqn*caption-space]
21225 .MAC have-adjust END
21227 . nr #COUNT \\n[#NUM_ARGS]
21228 . while \\n+[#ARGS]<=\\n[#COUNT] \{\
21229 . if '\\$1'ADJUST' \{\
21230 . ds pic*space-adj \\$2
21237 \# User settable text style for pic
21242 \# <offset from page left>
21244 \# Stores user supplied page offset in register #L_MARGIN.
21245 \# Sets .po to user supplied offset.
21247 \# Requires unit of measure.
21249 .MAC PIC_TEXT_STYLE END
21251 . nr #COUNT \\n[#NUM_ARGS]
21252 . while \\n+[#ARGS]<=\\n[#COUNT] \{\
21253 . if '\\$1'FAMILY' \{\
21255 . ds pic*text-family \\$1
21258 . if '\\$1'FONT' \{\
21260 . ds pic*text-font \\$1
21263 . if '\\$1'SIZE' \{\
21265 . ds pic*text-size-change \\$1
21268 . if '\\$1'AUTOLEAD' \{\
21270 . nr pic*text-autolead \\$1
21279 . if !\\n[#PP] .nop
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]
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
21293 . evc \\n[ev-current]
21295 . ie \\n[#NUM_ARGS]<2 .@error bad arguments to PS (not preprocessed with pic?)
21298 . ie !\B'\\$2' .ds pic*scale-width \\$1
21299 . el .ds pic*scale-width \\$2
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' \{\
21315 . if '\\$1'CAPTION' \{\
21316 . nr pic*have-caption 1
21317 . ds pic*caption \\$2
21320 . if '\\$1'SHORT_CAPTION' \{\
21321 . ds pic*caption-short \\$2
21324 . if '\\$1'LABEL' \{\
21325 . nr pic*have-label 1
21326 . ds pic*label \\$2
21329 . if '\\$1'TARGET' \{\
21331 . PDF_TARGET "\\*[target]
21334 . if '\\$1'NO_SHIM' \{\
21338 . if '\\$1'NO_FLEX' \{\
21342 . if '\\$1'GRAP' \{\
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
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]
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]
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)
21376 . nr pic@text-lead \\n[.v]
21377 . nr pic@text-size \\n[.ps]
21378 . if !'\\*[pic*text-color]'' .COLOR \\*[pic*text-color]
21381 . nr pic*top-lead-adj 1
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
21389 . el .if (\\n[pic*caption-after-label]=0):(\\n[#MLA]=0) \
21390 . sp \\n[lead-pre-pic]u/2u
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]]"
21402 \!. TO_FIGURES "\\*[pic*caption\\*[short]]"
21409 . nr pic*div-width \\n[dl]
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) \{\
21415 . evc \\*[ev-current]
21417 . ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
21423 . pic*caption-style
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
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]
21441 . if \\n[grap] \!.sp -2v
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
21448 . if (\\n[pic*have-label]=1):(\\n[pic*autolabel]=1):(\\n[pic*caption-after-label]=1) \{\
21449 . nr lead-pre-label \\n[.v]
21451 . evc \\*[ev-current]
21452 . ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
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
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]\|
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]
21481 . ie !\\n[pic*caption-after-label] .br
21483 . if !'\\*[pic*caption]'' .nop \
21484 \\*[pic*caption-specs]\\*[pic*caption]\\*[revert-specs]
21493 . in \\n[ind-pre-pic]u
21495 . if !\\n[defer] .rm pic*label
21498 . if !\\n[cutaround] .rm pic*space-adj
21499 . if !\\n[defer] .rr pic*have-caption
21502 . if '\\*[pic*label-sffx-tmp]'.' .ds pic*label-sffx .
21507 \# Footnote references
21508 \# -------------------
21510 \# Instruct REF to put references in footnotes.
21512 .MAC FOOTNOTE_REFS END
21513 . ie !'\\$1'' .rr #FN_REF
21515 . if r #EN_REF .rr #EN_REF
21521 \# Endnote references
21522 \# ------------------
21524 \# Instruct REF to collect references for endnotes output.
21526 .MAC ENDNOTE_REFS END
21527 . ie !'\\$1'' .rr #EN_REF
21529 . if r #FN_REF .rr #FN_REF
21531 . if !r#EN_MARKER_STYLE .ENDNOTE_MARKER_STYLE SUPERSCRIPT
21536 \# Prepare mom for a reference
21537 \# ---------------------------
21539 \# <none> | INDENT L|LEFT|R|RIGHT|B|BOTH <indent value>
21541 \# Calls FOOTNOTE or ENDNOTE, depending on whether #REF_FN or
21542 \# #REF_EN is set to 1.
21544 \# For convenience, REF is a toggle.
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.
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
21561 . ie \\n[#REF]=1 \{\
21562 . if \\n[#FN_REF]=1 .FOOTNOTE OFF
21563 . if \\n[#EN_REF]=1 .ENDNOTE OFF
21569 . if \\n[#FN_REF]=1 .FOOTNOTE \\$1 \\$2 \\$3
21570 . if \\n[#EN_REF]=1 .ENDNOTE
21575 \# Embedded references in text (with brackets)
21576 \# -------------------------------------------
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].
21585 .MAC REF_BRACKETS_START END
21586 . REF_BRACKETS_NOTICE \\$0
21589 .MAC REF_BRACKETS_END END
21590 . REF_BRACKETS_NOTICE \\$0
21593 \# These four pairs of aliases allow users to embed references in
21594 \# text and have them surrounded by (), [], {} or <>.
21596 .ALIAS REF( REF_BRACKETS_START
21597 .ALIAS REF) REF_BRACKETS_END
21599 .ALIAS REF[ REF_BRACKETS_START
21600 .ALIAS REF] REF_BRACKETS_END
21602 .ALIAS REF{ REF_BRACKETS_START
21603 .ALIAS REF} REF_BRACKETS_END
21605 .ALIAS REF< REF_BRACKETS_START
21606 .ALIAS REF> REF_BRACKETS_END
21609 . REF_BRACKETS_NOTICE \\$0
21615 \# FOOTNOTE | ENDNOTE | BIBLIO <indent for 2nd and subsequent lines of discrete reference entries>
21617 \# Sets registers #REF_FN_INDENT, #REF_EN_INDENT or #REF_BIB_INDENT.
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
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
21629 .ALIAS REF_INDENT INDENT_REFS
21631 \# Hyphenation of references
21632 \# -------------------------
21634 \# <none> | <anything>
21636 \# Sets register #REF_HY
21638 .MAC HYPHENATE_REFS END
21639 . ie '\\$1'' .nr #REF_HY 1
21641 . if r #REF_HY .rr #REF_HY
21644 \# The remainder of the definitions in this section are modified
21645 \# versions of the definitions found in the refer module of s.tmac.
21648 .tm [mom]: '\\n[.F]', line \\n[.c]: \\$*
21651 \# Underlining unavoidably turns off sentence spacing.
21655 .SS \\*[$SAVED_SS_VAR]
21656 .if '\\n[.z]'END_NOTES' \{\
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).
21666 .if \\n[#PRINT_STYLE]=1 \{\
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
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
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.
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
21700 \# Refer's "2nd" macro; builds up a reference with ref*build, and
21701 \# prints it with ref*print.
21705 .if \\n[ref*type]=0 \{\
21708 . nr pre-1900 1 \" If pre-1900, MLA allows excluding publisher
21712 . el .nr ref*type 2
21713 . if d [q .nr ref*type 2
21715 .if \\n[ref*type]=3 \{\
21716 . if !'\\*([R'' \{\
21718 . ds ref*spec!4 i Q A m p T2 B R O C I D P n
21720 . if !'\\*([G'' \{\
21722 . ds ref*spec!4 i A m p T2 B G O C I D P O n
21729 .ie d ref*spec!\\n[ref*type] .ref*build \\*[ref*spec!\\n[ref*type]]
21731 . @error unknown reference type '\\n[ref*type]'
21732 . ref*build \\*[ref*spec!0]
21734 .if !\\n[.hy]=0 \{\
21735 .nr #RESTORE_HY \\n[.hy]
21739 .if !\\n[#RESTORE_HY]=0 .hy \\n[#RESTORE_HY]
21745 \# Refer's "3rd" macros, which set up and terminate the output
21746 \# of collected references
21749 .als ref*print ref*end-print
21751 .if \\n[#BIB_LIST]=1 \{\
21752 . nr #IN_BIB_LIST 1
21753 . LIST DIGIT \\*[$BIB_LIST_SEPARATOR] \\*[$BIB_LIST_PREFIX]
21761 .als ref*print ref*normal-print
21767 \# Output normal, non-collected refs
21769 .de ref*normal-print
21770 .nr #CURRENT_HY \\n[.hy]
21774 \# Output collected refs
21777 .\" 10 is arbitrary
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
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
21794 .als ref*print ref*normal-print
21796 \# Build up the ref*string
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.
21806 .if \\n[#PRINT_STYLE]=2 \{\
21807 . ds $RESTORE_SS_VAR \\*[$SS_VAR]
21813 . ie d ref*add-\\$1 .ref*add-\\$1
21814 . el .ref*add-dflt \\$1
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
21829 \# The following macros determine how entries are formatted WRT
21830 \# punctuation, type style, additional strings, etc.
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.
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]"
21854 .if \\n([A .nr ref*suppress-period 1
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
21860 .ie '\\*[$REF_STYLE]'NOTE' \{\
21861 . ie '\\*([i'idem' .rm [i
21862 . el .ds idem \\*([i
21865 . ie '\\*([i'idem' \{\
21868 . ref*field i "" \[idem] "" " "
21871 . ds eval*[i \\*([i
21872 . substring eval*[i -1
21873 . if '\\*[eval*[i]'.' \{\
21879 . ref*field i "" \[idem] ", \\*[idem]" " "
21883 \# %m Multiple authors (et al.)
21885 .if !'\\*[$REF_STYLE]'NOTE' \{\
21886 . ds eval*[m \\*([m
21887 . substring eval*[m -1
21888 . if '\\*[eval*[m]'.' .chop [m
21892 \# %p Post-author string (e.g., Preface, Foreword, etc)
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]
21902 .ie '\\*[$REF_STYLE]'NOTE' .ref*field p ,
21903 .el .ref*field p . " "
21905 \# %Q Author(s) when author is not a person
21907 .ie '\\*[$REF_STYLE]'NOTE' .ref*field Q
21910 \# %T Title (generic)
21912 .ie '\\*[$REF_STYLE]'NOTE' .ref*field T , \E*[IT] \E*[ref*restore-ss]
21914 . ie !'\\*([A'' .ref*field T . " \E*[IT]" \E*[ref*restore-ss]
21916 . ie !'\\*([Q'' .ref*field T . " \E*[IT]" \E*[ref*restore-ss]
21917 . el .ref*field T . \E*[IT] \E*[ref*restore-ss]
21920 .if \\n([T .nr ref*suppress-period \\n([T
21923 \# %T Title of a chapter or article
21925 .ie '\\*[$REF_STYLE]'NOTE' \
21926 . ref*field T , \[lq] "" \[rq]
21929 . ref*field T . \[lq] "" \[rq]
21930 . if !'\\*([Q''.ref*field T . " \[lq]" "" \[rq]
21932 . el .ref*field T . " \[lq]" "" \[rq]
21934 .if \\n([T .nr ref*suppress-period \\n([T
21936 \# %B Book title (when citing an article from a book)
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]
21943 . ie \\n([T .ref*field B "" ".\E*[IT]" \E*[ref*restore-ss]
21944 . el .ref*field B . " \E*[IT]" \E*[ref*restore-ss]
21946 \# refer doesn't set reg [T to 1 for these book titles, so we do it here
21948 .substring eval*[B -1
21950 .if '\\*[eval*[B]'!' .nr [T 1
21951 .if '\\*[eval*[B]'?' .nr [T 1
21954 \# %q Titles that must go in quotes (e.g. an unpublished dissertation)
21956 .ie '\\*[$REF_STYLE]'NOTE' .ref*field q , \[lq] "" \[rq]
21958 . ie !'\\*([A'' .ref*field q . " \[lq]" "" \[rq]
21960 . ie !'\\*([Q'' .ref*field q . " \[lq]" "" \[rq]
21961 . el .ref*field q . \[lq] "" \[rq]
21965 \# %R Report number for technical reports
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]
21976 . ie \\n([T .ref*field J "" " \E*[IT]" \E*[ref*restore-ss]
21977 . el .ref*field J . " \E*[IT]" \E*[ref*restore-ss]
21980 \# %M Magazine or newspaper name
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]
21987 . ie \\n([T .ref*field M "" " \E*[IT]" \E*[ref*restore-ss]
21988 . el .ref*field M . " \E*[IT]" \E*[ref*restore-ss]
21994 .substring eval*[E -1
21995 .if '\\*[eval*[E]'.' \{\
21996 . if !\\n[#FN_REF]+\\n[#EN_REF] .chop [E
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.
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
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]
22017 .if '\\*[eval*[E]' and' \{\
22019 . nr start-range -1 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
22026 . if '\\*[eval*[E]', and' \{\
22027 . length len*[E \\*([E
22028 . nr rhs \\n[len*[E]-\\n[start-range]
22031 . substring lhs 0 \\n[start-range]-1
22032 . substring rhs -(\\n[rhs]-1)
22033 . ds [E \\*[lhs]\\*[rhs]
22044 .ie !\\n[ref*type]=0 \{\
22046 . ie '\\*[$REF_STYLE]'NOTE' \{\
22047 . ie \\n([T .ref*field E "" "ed. "
22048 . el .ref*field E , "ed. "
22051 . ie \\n([T .ref*field E "" " Eds. "
22052 . el .ref*field E . " Eds. "
22056 . ie '\\*[$REF_STYLE]'NOTE' \{\
22057 . ie \\n([T .ref*field E "" "ed. "
22058 . el .ref*field E , "ed. "
22061 . ie \\n([T .ref*field E "" " Ed. "
22062 . el .ref*field E . " Ed. "
22067 . ie \\n([T .ref*field E "" " "
22068 . el .ref*field E . " "
22075 .ie \\n([T .ref*field e "" "" " ed."
22077 . ie '\\*[$REF_STYLE]'NOTE' .ref*field e , "" " ed."
22078 . el .ref*field e . " " " ed."
22080 .nr ref*suppress-period 1
22084 \# %V Volume (of a journal, or series of books); for journals, %N may be preferable
22086 .if \\n[ref*type]=1 \
22088 .if \\n[ref*type]=2 \{\
22089 . ie '\\*[$REF_STYLE]'NOTE' .ref*field V , "vol. "
22091 . ie \\n([T .ref*field V "" " Vol. "
22092 . el .ref*field V . " Vol. "
22095 .if \\n[ref*type]=3 \{\
22096 . ie \\n([T .ref*field V "" " "
22097 . el .ref*field V . " "
22101 \# %N Journal number
22105 \# %S Series (books or journals)
22107 .if \\n[ref*type]=1 \
22109 .if \\n[ref*type]=2 \{\
22110 . ie '\\*[$REF_STYLE]'NOTE' \{\
22111 . ie \\n([T .ref*field S
22112 . el .ref*field S ,
22115 . ie \\n([T .ref*field S "" " "
22116 . el .ref*field S . " "
22119 .if \\n[ref*type]=3 \{\
22120 . ie \\n([T .ref*field S "" " "
22121 . el .ref*field S . " "
22124 \# refer doesn't set reg [T to 1 for series titles, so we do it here
22126 .substring eval*[S -1
22127 .if '\\*[eval*[S]'!' .nr [T 1
22128 .if '\\*[eval*[S]'?' .nr [T 1
22133 .ie '\\*[$REF_STYLE]'NOTE' \{\
22139 . ref*field C "" \*[FU 2](
22140 . if \\n([T .nr ref*suppress-period \\n([T
22143 . ie \\n([T .ref*field C "" " "
22145 . ie r [e .ref*field C "" " "
22146 . el .ref*field C . " "
22152 \# %I Publisher (I stands for Issuer)
22154 .ie '\\*[$REF_STYLE]'NOTE' \{\
22155 . ie !'\\*([C'' .ref*field I :
22156 . el .ref*field I "" (
22159 . ie !'\\*([C'' .ref*field I :
22161 . ie \\n([T .ref*field I "" " "
22162 . el .ref*field I . " "
22167 \# %D Date of publication
22169 .if \\n[ref*type]=0 \{\
22170 . ie '\\*[$REF_STYLE]'NOTE' .ref*field D ,
22171 . el .ref*field D . " "
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 ,
22179 .if \\n[ref*type]=3 \{\
22180 . ie !'\\*([C'' \{\
22181 . ie '\\*[$REF_STYLE]'NOTE' .ref*field D , "" )
22182 . el .ref*field D ,
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] )
22198 .if \\n[ref*type]=4 .ref*field D ,
22199 .if \\n[ref*type]=5 .ref*field D
22201 .substring eval*[D -1
22202 .if '\\*[eval*[D]'.' .nr ref*suppress-period 1
22204 \# %P Page number(s)
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
22213 . ie \\n[ref*type]=1 .ref*field P \|:
22215 . ie d [n .ref*field P . \| .
22216 . el .ref*field P . " "
22220 \# %G Gov't. ordering number
22222 .ie '\\*[$REF_STYLE]'NOTE' ref*field G ,
22223 .el .ref*field G . " "
22225 \# %O Other (info that goes after %T [or %B] but is hard to categorize; e.g., a dissertation)
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 ,
22238 . if \\n([O=1 .chop [O
22239 . ie r [e .ref*field O "" " "
22241 . ie !d [A .ref*field O
22242 . el .ref*field O . " "
22248 \# %n Annotations (after ref)
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 ,
22257 . ie !'\\*([P'' .ref*field n "" " "
22258 . el .ref*field n . " "
22260 .if r [n .nr ref*suppress-period 1
22270 \# %d date of publication (the original date of publication)
22272 .ie '\\*[$REF_STYLE]'NOTE' \{\
22273 . ref*field d "" ( ;
22277 . ie \\n([T .ref*field d "" " "
22278 . el .ref*field d . " "
22282 \# %b main author when citing from a preface, introduction, foreword
22285 .ie '\\*[$REF_STYLE]'NOTE' \{\
22286 . ie \\n([T .ref*field b "" "by"
22287 . el .ref*field b , "by "
22290 . ie \\n([T .ref*field b "" " By "
22291 . el .ref*field b . " By "
22295 \# %t title, if different from original title (the T field, which s/b
22296 \# the original title)
22298 .ie '\\*[$REF_STYLE]'NOTE' .ref*field t , "rpt. of \E*[IT] " \E*[ref*restore-ss]
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]
22306 \# Translated works
22307 \# ----------------
22310 .ie '\\*[$REF_STYLE]'NOTE' \{\
22311 . ie \\n([T .ref*field l "" "trans. "
22312 . el .ref*field l , "trans. "
22315 . ie \\n([T .ref*field l "" " Trans. "
22316 . el .ref*field l . " Trans. "
22320 \# %r Translato(r) and edito(r)
22322 .ie '\\*[$REF_STYLE]'NOTE' .ref*field r , "trans. and ed. "
22324 . ie \\n([T .ref*field r "" " Trans. and ed. "
22325 . el .ref*field r . " Trans. and ed. "
22334 .ie '\\*[$REF_STYLE]'NOTE' .ref*field s , \E*[IT] \E*[ref*restore-ss]
22336 .ie \\n([s .ref*field s "" ".\E*[IT]" \E*[ref*restore-ss]
22337 .el .ref*field s . " \E*[IT]" \E*[ref*restore-ss]
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
22344 . if '\\*[eval*[s]'.' .nr [T 1
22345 . if '\\*[eval*[s]'!' .nr [T 1
22346 . if '\\*[eval*[s]'?' .nr [T 1
22350 \# %c content of site (ie. Web, Online posting, etc)
22352 .ie '\\*[$REF_STYLE]'NOTE' .ref*field c ,
22354 . ie \\n([T .ref*field c "" " "
22355 . el .ref*field c . " "
22359 \# %o organization, group or sponsor of site
22361 .ie '\\*[$REF_STYLE]'NOTE' .ref*field o ,
22363 . ie \\n([T .ref*field o "" " "
22364 . el .ref*field o . " "
22368 \# %a access date, i.e. the date you read it
22370 .ie '\\*[$REF_STYLE]'NOTE' .ref*field a ,
22372 . ie \\n([T .ref*field a "" " "
22373 . el .ref*field a . " "
22379 .ref*field u "" < >
22386 \# Build up reference string from ref*add-<x> macros.
22388 \# First, a string to ensure next field's font is reset to roman
22389 \# (TYPESET) or non-underlined (TYPEWRITE)
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'\?
22395 .if d ref*string \{\
22396 . ie d ref*post-punct \{\
22397 . as ref*string "\\$2\\*[ref*post-punct] \"
22398 . rm ref*post-punct
22400 . el .as ref*string "\\$2 \"
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
22410 \# Wrapper for MNinit.
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].
22421 . while \\n+[#ARGS]<=\\n[#COUNT] \
22422 . ds $MN-arg\\n[#ARGS] @
22424 . nr #COUNT \\n[#NUM_ARGS]
22425 . while \\n+[#FLAG]<=\\n[#COUNT] \{\
22426 . if '\\$1'RAGGED' \{\
22430 . if '\\$1'SYMMETRIC' \{\
22434 . if '\\$1'L_WIDTH' \{\
22439 . if '\\$1'R_WIDTH' \{\
22444 . if '\\$1'GUTTER' \{\
22449 . if '\\$1'FONTSTYLE' \{\
22454 . if '\\$1'SIZE' \{\
22459 . if '\\$1'LEAD' \{\
22464 . if '\\$1'COLOR' \{\
22475 . if '\\*[$MN-arg5]'@' .ds $MN-arg5 \E*[$DOC_FAM]R
22477 \\*[$MN-arg1] \\*[$MN-arg2] \
22478 \\*[$MN-arg3] \\*[$MN-arg4] \
22479 \\*[$MN-arg5] \\*[$MN-arg6] \
22480 \\*[$MN-arg7] \\*[$MN-arg8] \
22484 .MAC MN_OVERFLOW_TRAP END
22485 . if \\n[#OVERFLOW_LEFT]=1 \{\
22486 . nr #no-repeat-MN-left 1
22487 . di MN_OVERFLOW_LEFT
22489 . if \\n[#OVERFLOW_RIGHT]=1 \{\
22490 . nr #no-repeat-MN-right 1
22491 . di MN_OVERFLOW_RIGHT
22493 . rr #OVERFLOW_LEFT
22494 . rr #OVERFLOW_RIGHT
22497 \# The remainder of the margin notes macros and routines are adapted
22498 \# from Werner Lemberg's MN.tmac.
22503 \# MNinit [ragged|symmetric] \
22504 \# left-width right-width separation \
22505 \# font fontsize vertical-spacing \
22506 \# color hyphenation-flags
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.
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\"
22525 . if '\\$1'SYMMETRIC' \{\
22526 . ds MN-left-ad r\"
22527 . ds MN-right-ad l\"
22530 . ie \B'\\$3' .nr MN-sep (n;\\$3)
22532 . if ((\\n[.o] - \\n[MN-sep]) < 1n) \
22533 . ab MN: Left margin too small (<1n) for requested margin notes separation.
22535 . nr MN-left-width (n;\\$1)
22536 . nr MN-left-start (\\n[.o] - \\n[MN-sep] - \\n[MN-left-width])
22539 . nr MN-left-width (\\n[.o] - \\n[MN-sep])
22540 . nr MN-left-start 0
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).
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])
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])
22563 . ds MN-font \\$4\"
22564 . if \\n[#PRINT_STYLE]=1 .ds MN-font CR
22567 . ds MN-font \\*[$PP_FT]
22568 . if \\n[#PRINT_STYLE]=1 .ds MN-font CR
22572 . nr MN-size \\n[.ps]
22574 . if \\n[#PRINT_STYLE]=1 \{\
22575 . ps \\*[$TYPEWRITER_PS]
22576 . nr MN-size \\n[.ps]
22581 . nr MN-size \\n[#DOC_PT_SIZE]
22584 . nr MN-spacing \\n[.v]
22586 . if \\n[#PRINT_STYLE]=1 \
22587 . nr MN-spacing \\n[#DOC_LEAD]
22589 . el .nr MN-spacing \\n[#DOC_LEAD]
22591 . if !\\n[#PRINT_STYLE]=1 .ds MN-color \\$7\"
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]
22604 . nop \m[\\*[MN-color]]\c
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]
22614 . nop \m[\\*[MN-color]]\c
22623 \# margin note text
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.
22632 . if !'\\$1'LEFT' \{\
22633 . if !'\\$1'RIGHT' \{\
22638 . if \\n[#COLUMNS]=1 \{\
22639 . if \\n[#NUM_COLS]>2 \{\
22640 . tm [mom]: Macro MN: More than two columns. Ignoring margin notes.
22643 . if !\\n[#NUM_COLS]=1 \{\
22644 . ie \\n[#COL_NUM]=1 .ds MN-dir LEFT
22645 . el .ds MN-dir RIGHT
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].
22653 . if \\n[MN-active] \{\
22654 . tm [mom]: Macro MN: Can't handle nested margin notes, line \\n[.c].
22659 . ie '\\*[MN-dir]'LEFT' \{\
22661 . ds MN-curr l-\\n[MN-left]\"
22662 . evc MNbottom-left-env
22666 . ds MN-curr r-\\n[MN-right]\"
22667 . evc MNbottom-right-env
22669 . mk MN-mk-\\*[MN-curr]
22670 . di MN-div-\\*[MN-curr]
22677 \# Utility macro to handle .MN OFF | QUIT | X etc
22680 . if \\n[MN-active] \{\
22683 . nr MN-div-\\*[MN-curr]-depth \\n[dn]
22691 \# Resets these registers (called in HEADER)
22697 . ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
22702 \# Executed in FOOTER.
22705 . if '\\$0'MNbottom-left' \{\
22708 . ds Left-Right Left
22710 . if '\\$0'MNbottom-right' \{\
22713 . ds Left-Right Right
22717 . nr MN-lead-adj \\n[#DOC_LEAD]-\\n[MN-spacing]
22719 . if \\n[MN-active] \{\
22721 . tm [mom]: Macro MN: Margin note finished by new page. Ignored.
22723 . if \\n[#RECTO_VERSO] \{\
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])
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]]) \{\
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
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.
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]
22751 No room to start \\*[MN-pos] margin note #\\n[MN-curr] on page \\n[#P].
22752 . tm1 " Ignoring margin note.
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
22763 . wh \\n[.p]u+\\n[#VARIABLE_FOOTER_POS]u-1u MN_OVERFLOW_TRAP
22767 . MN-div-\\*[l-r]-\\n[MN-curr]
22770 . nr MN-last-pos \\n[nl]
22774 . if !\\n[#no-repeat-MN-\\*[MN-pos]]=1 .vpt
22777 .ALIAS MNbottom-right MNbottom
22778 .ALIAS MNbottom-left MNbottom
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
22794 \# Call this and the TOC will be placed preceding this page
22796 .MAC TOC_BEFORE_HERE END
22798 . pdfpagename MOM:TOC
22804 \# Call this and the TOC will be placed after this page
22806 .MAC TOC_AFTER_HERE END
22808 . pdfpagename MOM:TOC
22812 \# -----------------
22815 \# <name defined by previous call to XCOLOR or NEWCOLOR> or
22816 \# <red> <green> <blue> all 0.0 -> 1.0
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
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
22829 . defcolor pdf:href.colour rgb \\*[PDFHREF.COLOUR]
22830 . ds PDFHREF.TEXT.COLOUR pdf:href.colour
22833 . ie \\n[.$]==0 \{\
22834 . if dPDFHREF.TEXTCOL.DEFAULT \
22835 . PDF_LINK_COLOR \\*[PDFHREF.TEXTCOL.DEFAULT]
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
22845 . ie dCOLAL_\\$1 .ds PDFHREF.TEXT.COLOUR \\*[COLAL_\\$1]
22846 . el .ds PDFHREF.TEXT.COLOUR \\$1
22850 . if !\\n[PDFHREF_COLOR_SET]=1 \
22851 . nr PDFHREF_COLOR_SET 1
22854 .ALIAS PDF_LINK_COLOUR PDF_LINK_COLOR
22856 \# AUTO_RELOCATE_TOC
22857 \# -----------------
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
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
22871 .ALIAS AUTO_TOC_RELOCATE AUTO_RELOCATE_TOC
22879 \# Creates a bookmark using the given text
22880 \# The level controls the hierarchy of the bookmarks
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".
22885 \# Bookmarks can be open or closed by calling PDF_BOOKMARKS_OPEN
22887 .MAC PDF_BOOKMARK END
22888 . if \\n[#PDF_BOOKMARKS] \{\
22889 . ie '\\$1'NAMED' \{\
22890 . ds PDF_NM -T \\$2
22895 . nr LEVEL_REQ \\$1
22897 . ie \\n[LEVEL_REQ]>\\n[VIRTUAL_LEVEL] \{\
22898 . nr VIRTUAL_LEVEL \\n[LEVEL_REQ]
22899 . nr LEVEL_REQ \\n[CURRENT_LEVEL]+1
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
22907 . el .nr LEVEL_REQ \\n[CURRENT_LEVEL]
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]
22917 . pdfbookmark \\n[PDF_LEV] \\*[PDF_TX]
22919 . el .pdfbookmark \\*[PDF_NM] \\n[PDF_LEV] \\$*
22920 . nr CURRENT_LEVEL \\n[LEVEL_REQ]
22933 \# Set the PDF title (this is often used by PDF readers to title the main window)
22937 . pdfmomclean pdftitle
22938 . nop \!x X ps:exec [/Title (\\*[pdftitle]) /DOCINFO pdfmark
22944 \# <nothing> | <anything>
22946 \# With no parameter turns on outline bookmarks
22947 \# With any parameter turns off outline bookmarks
22949 .MAC PDF_BOOKMARKS END
22950 . ie '\\$1'' .nr #PDF_BOOKMARKS 1
22951 . el .nr #PDF_BOOKMARKS 0
22954 \# PDF_BOOKMARKS_OPEN
22955 \# ------------------
22957 \# <number> | <nothing> | <text>
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
22963 .MAC PDF_BOOKMARKS_OPEN END
22965 . nr PDFOUTLINE.FOLDLEVEL \\$1
22966 . nr #PDF_BOOKMARKS_OPEN 1
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
22979 \# [PREFIX text] : text to prefix link
22980 \# [SUFFIX text] : text after link
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
22990 . ie '\\$1'PREFIX' \{\
22991 . ds PDF_PRE -P "\&\\$2"
22995 . ie '\\$1'SUFFIX' \{\
22996 . ds PDF_POST -A "\\$2"
23001 . ds PDF_TXT \&\\$1
23002 . ds PDF_AST \\*[PDF_TXT]
23003 . substring PDF_AST -1 -1
23004 . if '\\*[PDF_AST]'+' \{\
23008 . if '\\*[PDF_AST]'*' \{\
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]
23014 . as PDF_TXT Unknown
23015 . if !rPDF_UNKNOWN .tm \
23016 \\n[.F]:\\n[.c]: forward reference detected (please run using 'pdfmom')
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
23026 . pdfhref L \\*[PDF_PRE] \\*[PDF_POST] -D \\*[PDF_NM] -- \\*[PDF_TXT]
23035 .MAC PDF_WWW_LINK END
23038 . ie '\\$1'PREFIX' \{\
23039 . ds PDF_PRE -P "\\$2"
23043 . ie '\\$1'SUFFIX' \{\
23044 . ds PDF_POST -A "\\$2"
23050 . ie !'\\*[PDF_TXT]'' \{\
23051 . ds PDF_AST \\*[PDF_TXT]
23052 . substring PDF_AST -1 -1
23053 . if '\\*[PDF_AST]'+' \{\
23057 . if '\\*[PDF_AST]'*' \{\
23059 . as PDF_TXT \&\\*[PDF_AST_Q]\\*[PDF_NM]\\*[PDF_AST_Q]
23062 . el .ds PDF_TXT \\*[PDF_NM]
23063 . pdfhref W -D "\\*[PDF_NM]" \\*[PDF_PRE] \\*[PDF_POST] -- \\*[PDF_TXT]
23068 . rm PDF_AST PDF_AST_Q
23071 .MAC PDF_TARGET END
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] \\$*
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 ]
23087 \# Allows embedding of PDF images with the same arguments as PSPIC
23088 \# plus SCALE and ADJUST options.
23090 \# <image file> <width> <height> are required.
23093 . if !'\\n[.z]'FLOAT*DIV' \{\
23094 . nr pdf-img:float 1
23096 . PDF_TARGET fig:\\n+[lists*target]
23099 . ds ev-current \\n[.ev]
23101 . evc \\*[ev-current]
23102 . if \\n[#HYPHENATE] .nh
23103 . nr ind-pre-img \\n[.i]
23104 . nr ll-pre-img \\n[.l]
23107 . substring pos:tmp 0 0
23108 . ie !'\\*[pos:tmp]'-' .ds pdf-img:pos -C
23110 . ds pdf-img:pos \\$1
23113 . if '\\*[pdf-img:pos]'-I' \{\
23114 . nr pdf-img:ind \\$1
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].
23124 . nr pdf-img:width \\$2
23125 . nr pdf-img:depth \\$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' \{\
23132 . nr pdf-img:scale \\$1
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
23137 . if '\\$1'ADJUST' \{\
23139 . ds pdf-img:adj \\$1
23142 . if '\\$1'FRAME' \{\
23143 . nr pdf-img:frame 1
23144 . if !r pdf-img:frame-inset .nr pdf-img:frame-inset 6p
23147 . if '\\$1'CAPTION' \{\
23148 . nr pdf-img*have-caption 1
23149 . ds pdf-img*caption \\$2
23152 . if '\\$1'SHORT_CAPTION' \{\
23153 . ds pdf-img*caption-short \\$2
23156 . if '\\$1'LABEL' \{\
23157 . nr pdf-img*have-label 1
23158 . ds pdf-img*label \\$2
23159 . ds label-type pdf-img
23162 . if '\\$1'TARGET' \{\
23164 . PDF_TARGET "\\*[target]
23167 . if '\\$1'NO_SHIM' \{\
23168 . if !'\\n[.z]'FLOAT*DIV' .nr pdf-img*no-shim 1
23172 . if '\\$1'NO_FLEX' \{\
23173 . nr pdf-img*no-flex 1
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
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
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]]"
23203 \!. if !'\\*[pdf-img*caption\\*[short]]'' \
23204 \!. TO_FIGURES "\\*[pdf-img*caption\\*[short]]"
23214 . if \\n[pdf-img*have-caption] \{\
23215 . if !\\n[pdf-img*autolabel] \{\
23216 . if !\\n[pdf-img*have-label] \{\
23218 . mla@error caption label \\n[.F] \\$0 \\n[.c]
23221 . if !\\n[pdf-img*caption-after-label] \{\
23222 . if !\\n[@TOP] .sp .5v
23223 . nr lead-pre-caption \\n[.v]
23226 . ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
23228 . img*caption-style
23229 . vs \\n[.ps]u+\\n[pdf-img*caption-autolead]u
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]
23236 . if !'\\*[pdf-img*caption-space]'' .sp \\*[pdf-img*caption-space]
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
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]
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)
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]
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]
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) \{\
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]
23283 . nr lead-pre-label \\n[.v]
23286 . ie \\n[#PRINT_STYLE]=1 .TYPEWRITER
23289 . vs \\n[.ps]u+\\n[pdf-img*label-autolead]u
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] \{\
23298 \\*[pdf-img*label-prfx]\\*[chapno]\\n+[fig*label-num]\\*[pdf-img*label-sffx]\|
23299 . ds pdf-img*label \\*[chapno]\\n[fig*label-num]
23301 . tm .ds \\*[target] \\*[chapno]\\n[fig*label-num]
23304 . el .if !'\\*[pdf-img*label]'' .nop \\*[pdf-img*label]
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]
23325 . if !'\\*[pdf-img:adj]'' \{\
23327 . if \\n[#COLUMNS]>1 \
23329 \!. sp \\*[pdf-img:adj]
23332 . if !'\\*[pdf-img:adj]'' \
23333 . if !\\n[@TOP] \!.sp -\\*[pdf-img:adj]
23336 . if \\n[pdf-img:float] \{\
23338 . nr dl \\n[pdf-img:width]
23340 . if !\\n[pdf-img:float] \{\
23341 . ie !\\n[#NO_SHIM] \
23342 . if !\\n[pdf-img*no-shim] .SHIM
23344 . if !\\n[#NO_FLEX] \
23345 . if !\\n[pdf-img*no-flex] .FLEX
23353 \# [ <inset> ] [ <rule weight> ] [ <color> ]
23355 \# Sets parameters for pdf image frames.
23357 \# Defaults are '6p' '.5' 'black'. Arguments to be left at default
23358 \# must be entered as "".
23360 .MAC PDF_IMAGE_FRAME END
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.
23370 . nr pdf-img:frame-inset \\$1
23376 . ds frame-arg \\$1
23377 . substring frame-arg -1
23378 . ie \B'\\*[frame-arg]' \{\
23379 . ds pdf-img:frame-weight \\$1
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.
23396 . ie m \\$1 .ds pdf-img:frame-color \\$1
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.
23405 .MAC PDF_IMAGE_CLEAN END
23408 . rm pdf-img*caption
23409 . rm pdf-img*caption-short
23417 . if !\\n[pdf-img:frame] \
23420 . rr pdf-img:no-shim
23421 . rr pdf-img:no-flex
23423 .\" Cutarounds not yet implemented
23425 . if !\\n[cutaround] \
23426 . rr pdf-img*have-caption
23427 . if !\\n[cutaround] \{\
23428 . rr pdf-img:frame-inset
23431 . if '\\*[pdf-img*label-sffx-tmp]'.' .ds pdf-img*label-sffx .
23435 . ie '\\n[.z]'' \{\
23436 . ds pdfcleaned \\$*
23441 . nop \\*[\\*[pdfcleaned]]
23445 . asciify pdf:clean
23447 . ds \\*[pdfcleaned] "\\*[pdf:clean]
23451 . el .nop \!.pdfmomclean \\$@
23458 . ie !'\\n[.z]'' \{\
23460 \!. pdftransition BLOCK \\$1
23464 . pdftransition BLOCK \\$1
23468 .MAC TRANSITION END
23470 \!. pdftransition PAGE \\$1
23471 . el .pdftransition PAGE \\$1
23474 \# Local Variables:
23477 \# vim: filetype=groff: