* src/devices/grops/grops.man: Improve section on creating EPS.
[s-roff.git] / contrib / mom / om.tmac
blob4f4f2a81b009e3505cb05f1468e8fc6dea4f4c8b
1 .\" om.tmac
2 .\"
3 .\" Mom -- a typesetting/document-processing macro set for groff.
4 .\"
5 .\" Copyright (C) 2002, 2003 Free Software Foundation, Inc.
6 .\"      Written by Peter Schaffter (df191@ncf.ca)
7 .\"
8 .\" This file is part of groff.
9 .\"
10 .\" groff is free software; you can redistribute it and/or modify it under
11 .\" the terms of the GNU General Public License as published by the Free
12 .\" Software Foundation; either version 2, or (at your option) any later
13 .\" version.
14 .\"
15 .\" groff is distributed in the hope that it will be useful, but WITHOUT ANY
16 .\" WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 .\" FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
18 .\" for more details.
19 .\"
20 .\" You should have received a copy of the GNU General Public License along
21 .\" with groff; see the file COPYING.  If not, write to the Free Software
22 .\" Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 .\"
24 .\"
25 .\"
26 \# Version 1.1.6-e
27 \# ---------------
29 .if (\n[.x]\n[.y] < 118) \
30 .  ab You need GNU troff version 1.18 or higher to run this version of mom!
32 \# Inasmuch as possible, macros that turn a feature on or off follow
33 \# a similar style.  Invoking the macro without an argument turns
34 \# the feature on.  Invoking it with any other argument turns it off.
35 \# Use of the argument OFF is recommended, but not required; users
36 \# may find other conventions preferable (e.g. NO, X, END, QUIT, etc.).
38 \# "<anything>" in the description of arguments that can be passed
39 \# to a macro means that any argument turns the feature off.
41 \# ====================================================================
43 \# TYPESETTING MACROS, STRINGS, AND ALIASES
44 \# ========================================
46 \# +++ALIASES+++
48 .als      ALIAS           als   \"Alias .als as ALIAS
49 .als      ALIASN          aln   \"Alias .aln (number registers) as ALIASN
51 .ALIAS    MAC             de
52 .ALIAS    BR              br
53 .ALIAS    SPACE           sp
54 .ALIAS    SP              sp
55 .ALIAS    PAGELENGTH      pl
56 .ALIAS    NEWPAGE         bp
57 .ALIAS    SPREAD          brp
58 .ALIAS    STRING          ds
60 \# ALIASES FOR NUMBER REGISTERS
61 \# ----------------------------
63 .ALIASN  #PT_SIZE        .ps    \"fractional point size in units
64 .ALIASN  #DIVER_DEPTH     dn    \"diversion depth
65 .ALIASN  #DIVER_WIDTH     dl    \"diversion width
66 .ALIASN  #TRAP_DISTANCE  .t     \"distance to next trap
67 .ALIASN  #LEAD           .v     \"line space (.vs, not .ls)
68 .ALIASN  #PAGE_LENGTH    .p     \"page length
69 .ALIASN  #NUM_ARGS       .$     \"number of arguments passed to a macro
70 .ALIASN  #INDENT         .i     \"value of current indent
72 \# ====================================================================
74 \# MISCELLANEOUS
75 \# =============
76 .cflags 4 /\(en      \" So slash and en-dashes get broken
77 .nr #L_MARGIN \n(.o  \" Tabs, etc require #L_MARGIN
79 \# ====================================================================
81 \# END MACRO FOR LETTERS
82 \# ---------------------
83 \# *Arguments:
84 \#   none
85 \# *Function:
86 \#   The .em macro executed at the end of letters.  Turns footers and
87 \#   pagination off, terminates and outputs diversion CLOSING, indented with
88 \#   the author's name underneath.
90 .MAC ALL_DONE END
91 .    br
92 .    FOOTERS OFF
93 .    PAGINATION OFF
94 .    if \\n[#DOC_TYPE]=4 \{\
95 .       br
96 .       if !'\\n(.z'' \{ .di \}
97 .       IQ CLEAR
98 .       TQ
99 .       TAB_SET 1 \\n[#DOC_L_LENGTH]u/2u \\n[#DOC_L_LENGTH]u/2u LEFT
100 .       ALD \\n[#DOC_LEAD]u*2u
101 .       TAB 1
102 .       if \\n[#CLOSING] \{\
103 .          nf
104 .          CLOSING
105 .       \}
106 .       ALD \\n[#DOC_LEAD]u*3u
107 .       PRINT \\*[$AUTHOR_1]
108 .    \}
109 .    DO_FOOTER
110 .END
113 \# =====================================================================
115 \# +++PAGE LAYOUT+++
117 \# Macros that control the physical layout of the page: paper size
118 \# and margins.
120 \# PAGE WIDTH
121 \# ----------
122 \# *Argument:
123 \#   <width of printer sheet (ipPc)>
124 \# *Function:
125 \#   Stores user supplied page width in register #PAGE_WIDTH.
126 \# *Notes:
127 \#   #PAGE_WIDTH is used to establish the default LL (and right margin).
128 \#   Requires unit of measure.
130 .MAC PAGEWIDTH END
131 .    br
132 .    nr #PAGE_WIDTH \\$1
133 .    if !r#L_MARGIN \{ .L_MARGIN \\n(.o \}
134 .    if !r#R_MARGIN \{ .R_MARGIN 1i \}
135 .END
138 \# L_MARGIN
139 \# --------
140 \# *Argument:
141 \#   <offset from page left (ipPc)>
142 \# *Function:
143 \#   Stores user supplied page offset in register #L_MARGIN.
144 \#   Sets .po to user supplied offset.
145 \# *Notes:
146 \#   Requires unit of measure.
148 .MAC L_MARGIN END
149 .    br
150 .    nr #L_MARGIN (\\$1)
151 .    po \\n[#L_MARGIN]u
152 .END
155 \# R_MARGIN
156 \# --------
157 \# *Argument:
158 \#   <width of right margin (ipPc)>
159 \# *Function:
160 \#   Stores user supplied right margin in register #R_MARGIN.
161 \# *Notes:
162 \#   This is a pseudo-margin.  Right margin is actually a function of
163 \#   line length.  The macro calculates line length from the page offset
164 \#   and the value plugged into #R_MARGIN.
166 \#   N.B. -- PAGEWIDTH and L_MARGIN have to be defined before R_MARGIN.
168 \#   Requires unit of measure.
170 .MAC R_MARGIN END
171 .    br
172 .    nr #R_MARGIN (\\$1)
173 .    ll \\n[#PAGE_WIDTH]u-\\n[#L_MARGIN]u-\\n[#R_MARGIN]u
174 .    ta \\n(.lu
175 .    nr #L_LENGTH \\n(.l
176 .END
179 \# T_MARGIN
180 \# --------
181 \# *Argument:
182 \#   <distance to advance from top of page (ipPcv)>
183 \# *Function:
184 \#   Stores the user supplied top margin in register #T_MARGIN.
185 \#   Advances user supplied depth from the top of the page.
186 \# *Notes:
187 \#   Requires unit of measure.
189 .MAC T_MARGIN END
190 .    br
191 .    nr #T_MARGIN (\\$1)
192 .    nr #T_MARGIN_SET 1
193 .    if !\\n[#DOCS] \{\
194 .       PRINT \&
195 .       sp |\\n[#T_MARGIN]u-1v
196 .    \}
197 .    wh 0i DO_T_MARGIN
198 .END
201 \# B_MARGIN
202 \# --------
203 \# *Argument:
204 \#   <space to leave at the bottom of the page (ipPcv)>
205 \# *Function:
206 \#   Stores the user supplied bottom margin in register #B_MARGIN.
207 \# *Notes:
208 \#   Requires unit of measure.
210 .MAC B_MARGIN END
211 .    br
212 .    nr #B_MARGIN (\\$1)
213 .    wh -\\n[#B_MARGIN]u DO_B_MARGIN
214 .END
217 \# PAGE
218 \# ----
219 \# *Arguments:
220 \#   <pagewidth>  [pagelength [leftmargin [rightmargin [topmargin [bottommargin]]]]]
221 \# *Function:
222 \#   Page set-up.  Collects arguments and passes them to the appropriate
223 \#   macros.
224 \# *Notes:
225 \#   All arguments after pagewidth are optional, but must appear
226 \#   in the order given above.  (User can fill in as much or as
227 \#   little as desired.)
229 \#   All arguments require a unit of measure.
231 .MAC PAGE END
232 .    br
233 .    PAGEWIDTH                \\$1
234 .    PAGELENGTH               \\$2
235 .    ie '\\$3'' \{ .L_MARGIN  \\n(.o \}
236 .    el \{ .L_MARGIN          \\$3 \}
237 .    ie '\\$4'' \{ .R_MARGIN  1i \}
238 .    el \{ .R_MARGIN          \\$4 \}
239 .    if !'\\$5'' \{ .T_MARGIN \\$5 \}
240 .    if !'\\$6'' \{ .B_MARGIN \\$6 \}
241 .END
243 \# =====================================================================
245 \# +++PAGE CONTROL+++
247 \# Generic macros for breaking pages.
249 \# DO_T_MARGIN
250 \# -----------
251 \# *Argument:
252 \#   <none>
253 \# *Function:
254 \#   Plants the top margin (set in .PAGE) at the top of each page.
255 \# *Notes:
256 \#   The trap is set in .PAGE
258 .MAC DO_T_MARGIN END
259 .    ev 1
260 .    sp |\\n[#T_MARGIN]u-1v
261 .    ev
262 .END
265 \# DO_B_MARGIN
266 \# -----------
267 \# *Argument:
268 \#   <none>
269 \# *Function:
270 \#   Plants the bottom margin (set in .PAGE) at the bottom of each page.
271 \# *Notes:
272 \#   The trap is set in .PAGE.
274 .MAC DO_B_MARGIN END
275 .    ev 1
276 .    bp
277 .    ev
278 .END
280 \# =====================================================================
282 \# +++GENERAL STYLE MACROS+++
284 \# Macros that are likely to appear together to define general
285 \# type style: line length, family, font, point size, and line
286 \# spacing.
288 \# LINE LENGTH
289 \# -----------
290 \# *Argument:
291 \#   <line length (iPpc)>
292 \# *Function:
293 \#   Stores user supplied line length in register #L_LENGTH.
294 \#   Sets .ll to #L_LENGTHu
295 \# *Notes:
296 \#   Requires unit of measure.
298 .MAC LL END
299 .    nr #L_LENGTH (\\$1)
300 .    nr #USER_SET_L_LENGTH 1
301 .    ll \\n[#L_LENGTH]u
302 .    ta \\n(.lu
303 .END
306 \# FAMILY
307 \# ------
308 \# *Argument:
309 \#   <font family>
310 \# *Function:
311 \#   Stores user supplied font family in string $FAMILY.  Sets .fam
312 \#   to $FAMILY.
314 .MAC FAMILY END
315 .    if \\n[#PRINT_STYLE]=1 \{ .return \}
316 .    if \\n[#IGNORE]        \{ .return \}
317 .    ds $FAMILY \\$1
318 .    fam \\*[$FAMILY]
319 .END
322 \# FONT
323 \# ----
324 \# *Argument:
325 \#   R | I | B | BI
326 \# *Function:
327 \#  Stores user supplied font in $FONT and sets .ft to $FONT.
329 .MAC FT END
330 .    if \\n[#PRINT_STYLE]=1 \{\
331 .       ie '\\$1'I' \{\
332 .          if \\n[#UNDERLINE_ITALIC]=1 \{\
333 .             UNDERLINE
334 .             return
335 .          \}
336 .          if \\n[#ITALIC_MEANS_ITALIC]=1 \{\
337 .             ds $FONT \\$1
338 .             ft \\*[$FONT]
339 .             return
340 .          \}
341 .       \}
342 .       el \{ .UNDERLINE OFF \}
343 .       return
344 .    \}
345 .    ds $FONT \\$1
346 .    ft \\*[$FONT]
347 .END
350 \# POINT SIZE
351 \# ----------
352 \# *Arguments:
353 \#   <point size of type>
354 \# *Function:
355 \#   Sets point size to user supplied value in scaled points.
356 \#   If #AUTO_LEAD is on, sets .vs to #AUTOLEAD_VALUE+#PT_SIZE.
357 \# *Notes:
358 \#   Must NOT use a unit of measure.
360 .MAC PT_SIZE END
361 .    if \\n[#PRINT_STYLE]=1 \{ .return \}
362 .    if \\n[#IGNORE]        \{ .return \}
363 .    nr #PT_SIZE_SET 1
364 .    ps \\$1
365 .    if \\n[#AUTO_LEAD] \{\
366 .       ie \\n[#AUTOLEAD_FACTOR] \{ .vs \\n[#PT_SIZE]u*\\n[#AUTOLEAD_VALUE]u/1000u \}
367 .       el \{ .vs \\n[#PT_SIZE]u+\\n[#AUTOLEAD_VALUE]u \}
368 .    \}
369 .    nr #PT_SIZE_IN_UNITS \\n[.ps]
370 .END
373 \# LEADING
374 \# -------
375 \# *Argument:
376 \#   <leading between lines of text>
377 \# *Function:
378 \#   Turns off #AUTO_LEAD if it's on.
379 \#   Sets .vs to user supplied value.
380 \# *Notes:
381 \#   Does not require unit of measure.  LEAD automatically turns off AUTOLEAD.
383 .MAC LS END
384 .    if \\n[#PRINT_STYLE]=1 \{ .return \}
385 .    if \\n[#IGNORE]        \{ .return \}
386 .    nr #LEAD_SET 1
387 .    if \\n[#AUTO_LEAD] \{\
388 .       rr #AUTO_LEAD
389 .       rr #AUTOLEAD_FACTOR
390 .    \}
391 .    vs \\$1
392 .    if \\n[#T_MARGIN_SET]=1 \{\
393 .       sp |\\n[#T_MARGIN]u-1v
394 .       rr #T_MARGIN_SET
395 .    \}
396 .END
399 \# AUTOLEAD
400 \# --------
401 \# *Argument:
402 \#   <leading value to add to #PT_SIZE> [FACTOR]
403 \# *Function:
404 \#   Stores user supplied auto-lead value in register #AUTOLEAD_VALUE.
405 \#   Adds #AUT0LEAD_VALUE to #PT_SIZE when invoked to set leading.
406 \#   All subsequent PT_SIZE requests reset the leading in the same way until
407 \#   AUTOLEAD is turned off.
408 \# *Notes:
409 \#   With the optional FACTOR argument, the current point size is
410 \#   multiplied by #AUTOLEAD_VALUE instead of the two being added
411 \#   together.
413 .MAC AUTOLEAD END
414 .    if \\n[#PRINT_STYLE]=1 \{ .return \}
415 .    if \\n[#IGNORE]        \{ .return \}
416 .    nr #AUTO_LEAD 1
417 .    nr #AUTOLEAD_VALUE (p;\\$1)
418 .    ie \\n[#NUM_ARGS]=2 \{\
419 .       if '\\$2'FACTOR' \{\
420 .          nr #AUTOLEAD_FACTOR 1
421 .          vs \\n[#PT_SIZE]u*\\n[#AUTOLEAD_VALUE]u/1000u
422 .       \}
423 .    \}
424 .    el \{\
425 .       vs \\n[#PT_SIZE]u+\\n[#AUTOLEAD_VALUE]u
426 .    \}
427 .    if \\n[#T_MARGIN_SET] \{\
428 .       sp |\\n[#T_MARGIN]u-1v
429 .       rr #T_MARGIN_SET
430 .    \}
431 .END
434 \# STRINGS FOR INLINE CONTROL OF GENERAL TYPE STYLE
435 \# ------------------------------------------------
436 .ds ROM  \EfR
437 .ds IT   \EfI
438 .ds BD   \EfB
439 .ds BDI  \Ef(BI
440 .ds PREV \EfP
441 .ds S    \Es
444 \# =====================================================================
446 \# +++KERNING+++
448 \# AUTOMATIC PAIRWISE KERNING
449 \# --------------------------
450 \# *Arguments:
451 \#   <none> | <anything>
452 \# *Function:
453 \#   Turns automatic pairwise kerning on or off.
455 .MAC KERN END
456 .    ie '\\$1'' \{\
457 .       kern
458 .       nr #KERN 1
459 .    \}
460 .    el \{\
461 .       kern 0
462 .       nr #KERN 0
463 .    \}
464 .END
467 \# INLINE KERNING AND HORIZONTAL MOVEMENT
468 \# --------------------------------------
469 \# *Kerning
470 \#  Inline kerning provides a simple method for users to adjust the
471 \#  amount of space between any two letters.  It's predicated on a
472 \#  unit of measure "U", which is 1/36 of the current point size as
473 \#  returned by \n[.ps].  E.g., if the current point size is 18,
474 \#  \n[.ps] returns 18000u, therefore U=500u.  Since U remains
475 \#  proportional relative to the current point size, the amount
476 \#  of kerning between two letters as expressed in Us remains
477 \#  visually similar regardless of changes in point size.
479 \#  N.B.--the amount of inline kerning supplied by \*[BU#] or
480 \#  \*[FU#] is added to or subtracted from any kerning that already
481 \#  takes place between two characters when automatic kerning is
482 \#  turned on.
484 \#  In groff v. 1.17.2, it was not possible to pass arguments to macros that
485 \#  were executed with inline escapes, nor thence to evaluate conditional
486 \#  expressions.  Consequently, each pseudo-escape \[BU#] had to be defined
487 \#  separately with ".char".
489 \#  As of v. 1.18, one can pass arguments to inline strings/macros,
490 \#  hence it is now possible to do \*[BU n] where n, inline, is the desired
491 \#  number of kern units.  The original .char definitions have been left in
492 \#  for backward compatibility with documents created prior to mom-1.1.3c.
495 .nr #KERN_UNIT 36
496 .ds BU   \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*\\$1u)'
497 .ds FU   \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*\\$1u)'
499 .ds BU1  \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*1u)'
500 .ds BU2  \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*2u)'
501 .ds BU3  \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*3u)'
502 .ds BU4  \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*4u)'
503 .ds BU5  \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*5u)'
504 .ds BU6  \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*6u)'
505 .ds BU7  \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*7u)'
506 .ds BU8  \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*8u)'
507 .ds BU9  \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*9u)'
508 .ds BU10 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*10u)'
509 .ds BU11 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*11u)'
510 .ds BU12 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*12u)'
511 .ds BU13 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*13u)'
512 .ds BU14 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*14u)'
513 .ds BU15 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*15u)'
514 .ds BU16 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*16u)'
515 .ds BU17 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*17u)'
516 .ds BU18 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*18u)'
517 .ds BU19 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*19u)'
518 .ds BU20 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*20u)'
519 .ds BU21 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*21u)'
520 .ds BU22 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*22u)'
521 .ds BU23 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*23u)'
522 .ds BU24 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*24u)'
523 .ds BU25 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*25u)'
524 .ds BU26 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*26u)'
525 .ds BU27 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*27u)'
526 .ds BU28 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*28u)'
527 .ds BU29 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*29u)'
528 .ds BU30 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*30u)'
529 .ds BU31 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*31u)'
530 .ds BU32 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*32u)'
531 .ds BU33 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*33u)'
532 .ds BU34 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*34u)'
533 .ds BU35 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*35u)'
534 .ds BU36 \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*36u)'
537 .ds FU1  \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*1u)'
538 .ds FU2  \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*2u)'
539 .ds FU3  \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*3u)'
540 .ds FU4  \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*4u)'
541 .ds FU5  \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*5u)'
542 .ds FU6  \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*6u)'
543 .ds FU7  \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*7u)'
544 .ds FU8  \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*8u)'
545 .ds FU9  \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*9u)'
546 .ds FU10 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*10u)'
547 .ds FU11 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*11u)'
548 .ds FU12 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*12u)'
549 .ds FU13 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*13u)'
550 .ds FU14 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*14u)'
551 .ds FU15 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*15u)'
552 .ds FU16 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*16u)'
553 .ds FU17 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*17u)'
554 .ds FU18 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*18u)'
555 .ds FU19 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*19u)'
556 .ds FU20 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*20u)'
557 .ds FU21 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*21u)'
558 .ds FU22 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*22u)'
559 .ds FU23 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*23u)'
560 .ds FU24 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*24u)'
561 .ds FU25 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*25u)'
562 .ds FU26 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*26u)'
563 .ds FU27 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*27u)'
564 .ds FU28 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*28u)'
565 .ds FU29 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*29u)'
566 .ds FU30 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*30u)'
567 .ds FU31 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*31u)'
568 .ds FU32 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*32u)'
569 .ds FU33 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*33u)'
570 .ds FU34 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*34u)'
571 .ds FU35 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*35u)'
572 .ds FU36 \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*36u)'
575 \# *Horizontal movements
576 \#  BP1...12.75 and FP1...12.75 move backwards or forwards inline by the
577 \#  specified number of points.
578 \#  Left in for backward compatibility with mom-1.1.3c, the preferred
579 \#  methods for inline horizontal movements are now \*[BCK #<unit>] and
580 \#  \*[FWD #<unit>].
582 .ds BCK  \h'-\\$1\\$2'
583 .ds FWD  \h'\\$1\\$2'
585 .ds BP.25    \h'-.25'
586 .ds BP.5     \h'-.5'
587 .ds BP.75    \h'-.75'
588 .ds BP1      \h'-1p'
589 .ds BP1.25   \h'-1.25p'
590 .ds BP1.5    \h'-1.5p'
591 .ds BP1.75   \h'-1.75p'
592 .ds BP2      \h'-2p'
593 .ds BP2.25   \h'-2.25p'
594 .ds BP2.5    \h'-2.5p'
595 .ds BP2.75   \h'-2.75p'
596 .ds BP3      \h'-3p'
597 .ds BP3.25   \h'-3.25p'
598 .ds BP3.5    \h'-3.5p'
599 .ds BP3.75   \h'-3.75p'
600 .ds BP4      \h'-4p'
601 .ds BP4.25   \h'-4.25p'
602 .ds BP4.5    \h'-4.5p'
603 .ds BP4.75   \h'-4.75p'
604 .ds BP5      \h'-5p'
605 .ds BP5.25   \h'-5.25p'
606 .ds BP5.5    \h'-5.5p'
607 .ds BP5.75   \h'-5.75p'
608 .ds BP6      \h'-6p'
609 .ds BP6.25   \h'-6.25p'
610 .ds BP6.5    \h'-6.5p'
611 .ds BP6.75   \h'-6.75p'
612 .ds BP7      \h'-7p'
613 .ds BP7.25   \h'-7.25p'
614 .ds BP7.5    \h'-7.5p'
615 .ds BP7.75   \h'-7.75p'
616 .ds BP8      \h'-8p'
617 .ds BP8.25   \h'-8.25p'
618 .ds BP8.5    \h'-8.5p'
619 .ds BP8.75   \h'-8.75p'
620 .ds BP9      \h'-9p'
621 .ds BP9.25   \h'-9.25p'
622 .ds BP9.5    \h'-9.5p'
623 .ds BP9.75   \h'-9.75p'
624 .ds BP10     \h'-10p'
625 .ds BP10.25  \h'-10.25p'
626 .ds BP10.5   \h'-10.5p'
627 .ds BP10.75  \h'-10.75p'
628 .ds BP11     \h'-11p'
629 .ds BP11.25  \h'-11.25p'
630 .ds BP11.5   \h'-11.5p'
631 .ds BP11.75  \h'-11.75p'
632 .ds BP12     \h'-12p'
633 .ds BP12.25  \h'-12.25p'
634 .ds BP12.5   \h'-12.5p'
635 .ds BP12.75  \h'-12.75p'
637 .ds FP.25    \h'.25'
638 .ds FP.5     \h'.5'
639 .ds FP.75    \h'.75'
640 .ds FP1      \h'1p'
641 .ds FP1.25   \h'1.25p'
642 .ds FP1.5    \h'1.5p'
643 .ds FP1.75   \h'1.75p'
644 .ds FP2      \h'2p'
645 .ds FP2.25   \h'2.25p'
646 .ds FP2.5    \h'2.5p'
647 .ds FP2.75   \h'2.75p'
648 .ds FP3      \h'3p'
649 .ds FP3.25   \h'3.25p'
650 .ds FP3.5    \h'3.5p'
651 .ds FP3.75   \h'3.75p'
652 .ds FP4      \h'4p'
653 .ds FP4.25   \h'4.25p'
654 .ds FP4.5    \h'4.5p'
655 .ds FP4.75   \h'4.75p'
656 .ds FP5      \h'5p'
657 .ds FP5.25   \h'5.25p'
658 .ds FP5.5    \h'5.5p'
659 .ds FP5.75   \h'5.75p'
660 .ds FP6      \h'6p'
661 .ds FP6.25   \h'6.25p'
662 .ds FP6.5    \h'6.5p'
663 .ds FP6.75   \h'6.75p'
664 .ds FP7      \h'7p'
665 .ds FP7.25   \h'7.25p'
666 .ds FP7.5    \h'7.5p'
667 .ds FP7.75   \h'7.75p'
668 .ds FP8      \h'8p'
669 .ds FP8.25   \h'8.25p'
670 .ds FP8.5    \h'8.5p'
671 .ds FP8.75   \h'8.75p'
672 .ds FP9      \h'9p'
673 .ds FP9.25   \h'9.25p'
674 .ds FP9.5    \h'9.5p'
675 .ds FP9.75   \h'9.75p'
676 .ds FP10     \h'10p'
677 .ds FP10.25  \h'10.25p'
678 .ds FP10.5   \h'10.5p'
679 .ds FP10.75  \h'10.75p'
680 .ds FP11     \h'11p'
681 .ds FP11.25  \h'11.25p'
682 .ds FP11.5   \h'11.5p'
683 .ds FP11.75  \h'11.75p'
684 .ds FP12     \h'12p'
685 .ds FP12.25  \h'12.25p'
686 .ds FP12.5   \h'12.5p'
687 .ds FP12.75  \h'12.75p'
690 \# WHOLE LINE KERNING (RW and EW)
691 \# -----------------------------
692 \# The line kerning macros are special instances of track kerning,
693 \# used where a complete line needs to be tightened (or relaxed) in
694 \# order to accomodate or remove one or two more characters
695 \# than the default justification permits.
697 \# *Argument:
698 \#   <amount of overall "kerning" (letter spacing) to apply to the line>
699 \# *Function:
700 \#   Invokes .tkf (track kerning) for the current font with
701 \#   1 as both the upper and lower point size limits, so that
702 \#   the value entered by the user applies regardless of point
703 \#   size.  RW ("Reduce Whitespace") reduces the amount of space
704 \#   between all characters by an equal amount.  EW ("Extra
705 \#   Whitespace") increases the amount of space.
706 \# *Notes:
707 \#   Decimal values are acceptable.
709 \#   The groff documentation is a tad confusing about what unit of
710 \#   measure is used in track kerning, only that the width of each
711 \#   character is increased or decreased by the amount(s) passed as
712 \#   arguments to .tkf, and something about linear function of point
713 \#   size.  In fact, with the way I've put this macro together, it
714 \#   doesn't matter.  All the user needs to know is that a value
715 \#   of one will produce an unacceptably tight or loose line at most
716 \#   text point sizes; therefore, effective use of RW and EW is in
717 \#   the fractional range below 1 (e.g. .25, .5).  Given that RW
718 \#   and EW are for massaging type, a certain amount of
719 \#   experimentation and previewing is expected and necessary.
721 \#   \n(.f holds the current font number, which is acceptable to .tkf.
723 \#   RW and EW must be reset to 0 to cancel their effect on
724 \#   subsequent output lines.
726 .MAC RW END
727 .    if \\n[#BR_AT_LINE_KERN] \{ .br \}
728 .    tkf 1 1 -\\$1 1 -\\$1
729 .    tkf 2 1 -\\$1 1 -\\$1
730 .    tkf 3 1 -\\$1 1 -\\$1
731 .    tkf 4 1 -\\$1 1 -\\$1
732 .END
735 .MAC EW END
736 .    if \\n[#BR_AT_LINE_KERN] \{ .br \}
737 .    tkf 1 1 \\$1 1 \\$1
738 .    tkf 2 1 \\$1 1 \\$1
739 .    tkf 3 1 \\$1 1 \\$1
740 .    tkf 4 1 \\$1 1 \\$1
741 .END
744 \# BREAK AT LINE KERN
745 \# ------------------
746 \# *Arguments:
747 \#   toggle
748 \# *Function:
749 \#   Enables/disables .br's before .RW and .EW
750 \# *Notes:
751 \#   Mostly, users will want .br's before any kind of line kerning, but
752 \#   there may be cases where they don't.  BR_BEFORE_LINE_KERN is off by
753 \#   default and must be invoked explicitly.
755 .MAC BR_AT_LINE_KERN END
756 .    ie '\\$1'' \{ .nr #BR_AT_LINE_KERN  1 \}
757 .    el         \{ .rr #BR_AT_LINE_KERN \}
758 .END
760 \# =====================================================================
762 \# +++HYPHENATION+++
764 \# AUTO HYPHENATION
765 \# ----------------
766 \# *Arguments:
767 \#   <none> | <anything> | DEFAULT
768 \#                 or
769 \#   LINES <#> | MARGIN <#> | SPACE <#>
770 \# *Function:
771 \#   Turns auto hyphenation on or off, resets the hyphenation style
772 \#   to default, or permits the setting of various hyphenation
773 \#   parameters.
774 \# *Notes:
775 \#   HY ON defaults to .hy 14, i.e. no hyphens after the
776 \#   first two or before the last two characters of a word, and
777 \#   no hyphenation of the last line prior to a trap (e.g.,
778 \#   at the bottom of a page).
780 \#   HY DEFAULT resets the hyphenation style to .hy 14 (see
781 \#   above) if that behaviour is desired after changes have been
782 \#   made to LINES, MARGIN, or SPACE.
784 \#   HY LINES <#> sets the number of allowable consecutive hyphenated lines.
786 \#   HY MARGIN <#> sets the amount of space (ipPcm) allowed at the end
787 \#   of a line in QUAD mode before hyphenation is tripped (e.g. if there's
788 \#   only 6 points left, groff won't try to hyphenate the next word).
790 \#   HY SPACE sets the amount of extra interword space (ipPcm) that can
791 \#   be added in JUSTIFY mode to prevent a line from being hyphenated.
793 .MAC HY END
794 .    ie '\\$1'' \{\
795 .       hy 14
796 .       nr #HYPHENATE 1
797 .    \}
798 .    el \{\
799 .       if !'\\$1'LINES'  \{\
800 .          nh
801 .          nr #HYPHENATE 0
802 .       \}
803 .       if !'\\$1'MARGIN' \{\
804 .          nh
805 .          nr #HYPHENATE 0
806 .       \}
807 .       if !'\\$1'SPACE'  \{\
808 .          nh
809 .          nr #HYPHENATE 0
810 .       \}
811 .       if !'\\$1'DEFAULT'  \{\
812 .          nh
813 .          nr #HYPHENATE 0
814 .       \}
815 .       if '\\$1'LINES'   \{ .hlm \\$2 \}
816 .       if '\\$1'MARGIN'  \{ .hym \\$2 \}
817 .       if '\\$1'SPACE'   \{ .hys \\$2 \}
818 .       if '\\$1'DEFAULT' \{\
819 .          hlm -1
820 .          hym 0
821 .          hys 0
822 .       \}
823 .    \}
824 .END
827 \# HYPHENATION PARAMETERS
828 \# ----------------------
829 \# *Arguments:
830 \#   <# of lines> | <size of margin> | <amount of interword space>
831 \# *Function:
832 \#   Allows user to specify .HY LINES, MARGIN, and SPACE with a single command.
834 .MAC HY_SET END
835 .    nr #HY_SET 1
836 .    hlm \\$1
837 .    hym \\$2
838 .    hys \\$3
839 .END
841 \# =====================================================================
843 \# +++VERTICAL SPACING+++
845 \# ADVANCE LEAD
846 \# ------------
847 \# *Argument:
848 \#   <user supplied lead to advance below current baseline>
849 \# *Function:
850 \#   Creates or modifies register #ALD.  Adds user supplied lead
851 \#   below current baseline.
852 \# *Notes:
853 \#   Requires unit of measure ipPcmv.
855 .MAC ALD END
856 .    nr #ALD (\\$1)
857 .    sp \\n[#ALD]u
858 .END
861 \# REVERSE LEAD
862 \# ------------
863 \# *Argument:
864 \#   <user supplied lead to reverse above current baseline>
865 \# *Function:
866 \#   Creates or modifies register #RLD.  Reverses user supplied
867 \#   lead above current baseline.
868 \# *Notes:
869 \#   Requires unit of measure ipPcmv.
871 .MAC RLD END
872 .    nr #RLD (\\$1)
873 .    sp -\\n[#RLD]u
874 .END
876 \# ALD/RLD STRINGS
877 \# ---------------
878 \# The strings \*[ALD.25]...\*[ALD12.75] and their corresponding \*[RLD]
879 \# forms have been left in for backward compatibility with documents
880 \# created using mom-1.1.3c or earlier.  The prefered methods of advancing
881 \# and reversing on the page inline are \*[UP #<unit>] and \*[DOWN #<unit>].
883 .ds DOWN      \v'\\$1\\$2'
884 .ds UP        \v'-\\$1\\$2'
886 .ds ALD.25    \v'.25p'
887 .ds ALD.5     \v'.5p'
888 .ds ALD.75    \v'.75p'
889 .ds ALD1      \v'1p'
890 .ds ALD1.25   \v'1.25p'
891 .ds ALD1.5    \v'1.5p'
892 .ds ALD1.75   \v'1.75p'
893 .ds ALD2      \v'2p'
894 .ds ALD2.25   \v'2.25p'
895 .ds ALD2.5    \v'2.5p'
896 .ds ALD2.75   \v'2.75p'
897 .ds ALD3      \v'3p'
898 .ds ALD3.25   \v'3.25p'
899 .ds ALD3.5    \v'3.5p'
900 .ds ALD3.75   \v'3.75p'
901 .ds ALD4      \v'4p'
902 .ds ALD4.25   \v'4.25p'
903 .ds ALD4.5    \v'4.5p'
904 .ds ALD4.75   \v'4.75p'
905 .ds ALD5      \v'5p'
906 .ds ALD5.25   \v'5.25p'
907 .ds ALD5.5    \v'5.5p'
908 .ds ALD5.75   \v'5.75p'
909 .ds ALD6      \v'6p'
910 .ds ALD6.25   \v'6.25p'
911 .ds ALD6.5    \v'6.5p'
912 .ds ALD6.75   \v'6.75p'
913 .ds ALD7      \v'7p'
914 .ds ALD7.25   \v'7.25p'
915 .ds ALD7.5    \v'7.5p'
916 .ds ALD7.75   \v'7.75p'
917 .ds ALD8      \v'8p'
918 .ds ALD8.25   \v'8.25p'
919 .ds ALD8.5    \v'8.5p'
920 .ds ALD8.75   \v'8.75p'
921 .ds ALD9      \v'9p'
922 .ds ALD9.25   \v'9.25p'
923 .ds ALD9.5    \v'9.5p'
924 .ds ALD9.75   \v'9.75p'
925 .ds ALD10     \v'10p'
926 .ds ALD10.25  \v'10.25p'
927 .ds ALD10.5   \v'10.5p'
928 .ds ALD10.75  \v'10.75p'
929 .ds ALD11     \v'11p'
930 .ds ALD11.25  \v'11.25p'
931 .ds ALD11.5   \v'11.5p'
932 .ds ALD11.75  \v'11.75p'
933 .ds ALD12     \v'12p'
934 .ds ALD12.25  \v'12.5p'
935 .ds ALD12.5   \v'12.5p'
936 .ds ALD12.75  \v'12.75p'
938 .ds RLD.25    \v'-.25p'
939 .ds RLD.5     \v'-.5p'
940 .ds RLD.75    \v'-.75p'
941 .ds RLD1      \v'-1p'
942 .ds RLD1.25   \v'-1.25p'
943 .ds RLD1.5    \v'-1.5p'
944 .ds RLD1.75   \v'-1.75p'
945 .ds RLD2      \v'-2p'
946 .ds RLD2.25   \v'-2.25p'
947 .ds RLD2.5    \v'-2.5p'
948 .ds RLD2.75   \v'-2.75p'
949 .ds RLD3      \v'-3p'
950 .ds RLD3.25   \v'-3.25p'
951 .ds RLD3.5    \v'-3.5p'
952 .ds RLD3.75   \v'-3.75p'
953 .ds RLD4      \v'-4p'
954 .ds RLD4.25   \v'-4.25p'
955 .ds RLD4.5    \v'-4.5p'
956 .ds RLD4.75   \v'-4.75p'
957 .ds RLD5      \v'-5p'
958 .ds RLD5.25   \v'-5.25p'
959 .ds RLD5.5    \v'-5.5p'
960 .ds RLD5.75   \v'-5.75p'
961 .ds RLD6      \v'-6p'
962 .ds RLD6.25   \v'-6.25p'
963 .ds RLD6.5    \v'-6.5p'
964 .ds RLD6.75   \v'-6.75p'
965 .ds RLD7      \v'-7p'
966 .ds RLD7.25   \v'-7.25p'
967 .ds RLD7.5    \v'-7.5p'
968 .ds RLD7.75   \v'-7.75p'
969 .ds RLD8      \v'-8p'
970 .ds RLD8.25   \v'-8.25p'
971 .ds RLD8.5    \v'-8.5p'
972 .ds RLD8.75   \v'-8.75p'
973 .ds RLD9      \v'-9p'
974 .ds RLD9.25   \v'-9.25p'
975 .ds RLD9.5    \v'-9.5p'
976 .ds RLD9.75   \v'-9.75p'
977 .ds RLD10     \v'-10p'
978 .ds RLD10.25  \v'-10.25p'
979 .ds RLD10.5   \v'-10.5p'
980 .ds RLD10.75  \v'-10.75p'
981 .ds RLD11     \v'-11p'
982 .ds RLD11.25  \v'-11.25p'
983 .ds RLD11.5   \v'-11.5p'
984 .ds RLD11.75  \v'-11.75p'
985 .ds RLD12     \v'-12p'
986 .ds RLD12.25  \v'-12.5p'
987 .ds RLD12.5   \v'-12.5p'
988 .ds RLD12.75  \v'-12.75p'
990 \# =====================================================================
992 \# +++REFINEMENTS+++
994 \# AUTOMATIC LIGATURES
995 \# -------------------
996 \# *Arguments:
997 \#   <none> | <anything>
998 \# *Function:
999 \#   Turns automatic ligature generation on or off.
1000 \# *Notes:
1001 \#   Ligatures may be supplied manually with \(fi, \(fl, etc.
1003 .MAC LIGATURES END
1004 .    ie '\\$1''   \{\
1005 .       lg
1006 .       nr #LIGATURES 1
1007 .    \}
1008 .    el \{\
1009 .       lg 0
1010 .       nr #LIGATURES 0
1011 .    \}
1012 .END
1015 \# SMARTQUOTES
1016 \# -----------
1017 \# *Arguments:
1018 \#   <none> | <anything>
1019 \# *Function:
1020 \#   Turns smartquotes on or off.
1021 \# *Notes:
1022 \#   The " character is read outside the macro when mom is
1023 \#   processed.  The strings for open/close ($QUOTE#) are then
1024 \#   defined in the macro.  \N'34' is the ASCII code for ".  If
1025 \#   incompatibilities arise, find the code for " that applies
1026 \#   to your system and plug in that code instead.
1028 .char " \\*[$QUOTE\\n[#OPEN_CLOSE]]\R'#OPEN_CLOSE (1-\\n[#OPEN_CLOSE])'
1030 .MAC SMARTQUOTES END
1031 .    ie '\\$1'' \{\
1032 .       nr #OPEN_CLOSE 0
1033 .       ds $QUOTE0 ``
1034 .       ds $QUOTE1 ''
1035 .       nr #SMART_QUOTES 1
1036 .    \}
1037 .    el \{\
1038 .       ds $QUOTE0 \\N'34'
1039 .       ds $QUOTE1 \\N'34'
1040 .       nr #SMART_QUOTES 0
1041 .    \}
1042 .END
1044 .ds FOOT \(fm
1045 .ds INCH \(fm\(fm
1047 \# =====================================================================
1049 \# +++LINE BREAKS+++
1051 \# NO-SPACE BREAK
1052 \# --------------
1053 \# *Argument:
1054 \#   <none>
1055 \# *Function:
1056 \#   Breaks a line without advancing.
1057 \# *Notes:
1058 \#   EL is the mnemonic used on older, dedicated typesetting machines
1059 \#   to indicate "process the line, then return to the left margin
1060 \#   without advancing the galley medium."  It stands for End Line.
1062 \#   Sadly, EL is only a fake.  It will work in all instances EXCEPT
1063 \#   when the line to be EL'd is the last line before a footer trap.
1064 \#   Use TRAP OFF/TRAP to circumvent this.
1066 .MAC EL END
1067 .    br
1068 .    sp -1v
1069 .END
1071 \# =====================================================================
1073 \# +++FILLING/QUADDING/JUSTIFYING+++
1075 \# JUSTIFY
1076 \# -------
1077 \# *Argument:
1078 \#   <none>
1079 \# *Function:
1080 \#  Turns fill on and sets .ad to b.
1081 \# *Notes:
1082 \#  Justifies text left and right.
1084 .MAC JUSTIFY END
1085 .    if \\n[#TAB_ACTIVE]=0 \{\
1086 .       nr #QUAD 1
1087 .       ds $RESTORE_QUAD_VALUE \\*[$QUAD_VALUE]
1088 .    \}
1089 '    ce 0
1090 .    QUAD J
1091 .    if \\n[#PRINT_STYLE]=1 \{ .QUAD L \}
1092 .    nr #FILL 0
1093 .END
1096 \# QUAD
1097 \# ----
1098 \# *Arguments:
1099 \#   L | LEFT | R | RIGHT | C | CENTER/CENTRE
1100 \# *Function:
1101 \#   Turns fill on and sets .ad to l, r, or c.
1102 \# *Notes:
1103 \#   Terminology is a problem here.  Some people call quad left
1104 \#   left justified, flush left, or flush left/rag right (and the
1105 \#   reverse for quad right).  Quad center is sometimes called rag
1106 \#   both.  For our purposes, all "quad" modes mean that groff fill
1107 \#   mode is enabled.
1109 .MAC QUAD END
1110 .    ds $QUAD_VALUE \\$1
1111 .    if \\n[#TAB_ACTIVE]=0 \{\
1112 .       nr #QUAD 1
1113 .       ds $RESTORE_QUAD_VALUE \\*[$QUAD_VALUE]
1114 .    \}
1115 '    ce 0
1116 '    fi
1117 .    if '\\*[$QUAD_VALUE]'L'       \{ .ad l \}
1118 .    if '\\*[$QUAD_VALUE]'LEFT'    \{ .ad l \}
1119 .    if '\\*[$QUAD_VALUE]'R'       \{ .ad r \}
1120 .    if '\\*[$QUAD_VALUE]'RIGHT'   \{ .ad r \}
1121 .    if '\\*[$QUAD_VALUE]'C'       \{ .ad c \}
1122 .    if '\\*[$QUAD_VALUE]'CENTER'  \{ .ad c \}
1123 .    if '\\*[$QUAD_VALUE]'CENTRE'  \{ .ad c \}
1124 .    if '\\*[$QUAD_VALUE]'J'       \{ .ad b \}
1125 .    if '\\*[$QUAD_VALUE]'JUSTIFY' \{ .ad b \}
1126 .    nr #FILL 0
1127 .END
1130 \# LEFT, RIGHT, AND CENTER
1131 \# -----------------------
1132 \# The purpose of these macros is to allow the user to enter lines
1133 \# of text that will be quadded LRC *without* the user having to
1134 \# enter .BR or .br between lines.  For the sake of consistency,
1135 \# all three appear to behave similarly (from the point of view of the user),
1136 \# although the underlying primitives don't.  For this reason, LEFT,
1137 \# RIGHT, and CENTER must be followed by .QUAD [L R C J] or .JUSTIFY
1138 \# to restore text to groff fill mode.
1140 \# LEFT
1141 \# ----
1142 \# *Argument:
1143 \#   <none>
1144 \# *Function:
1145 \#   Turns fill mode off.  Allows user to quad lines left without
1146 \#   requiring the .BR or .br macro.
1147 \# *Notes:
1148 \#   LEFT simply turns fill off.  Lines that exceed the current LL will
1149 \#   not be broken, simply continued (indefinitely) until a return is
1150 \#   encountered.  Note that this behaviour differs from the RIGHT and
1151 \#   CENTER macros.
1153 .MAC LEFT END
1154 .    if \\n[#TAB_ACTIVE]=0 \{\
1155 .       rr #QUAD
1156 .       ds $RESTORE_QUAD_VALUE LEFT
1157 .    \}
1158 .    ce 0
1159 .    nf
1160 .    nr #FILL 1
1161 .END
1164 \# RIGHT
1165 \# -----
1166 \# *Argument:
1167 \#   <none>
1168 \# *Function:
1169 \#   Turns fill on.  Allows user to quad lines right without
1170 \#   requiring the .BR or .br macro.
1171 \# *Notes:
1172 \#   Lines that exceed the current LL will be broken, with the excess
1173 \#   text quadded right.
1175 .MAC RIGHT END
1176 .    if \\n[#TAB_ACTIVE]=0 \{\
1177 .       rr #QUAD
1178 .       ds $RESTORE_QUAD_VALUE RIGHT
1179 .    \}
1180 .    fi
1181 .    rj 100000
1182 .    nr #FILL 1
1183 .END
1186 \# CENTER
1187 \# ------
1188 \# *Argument:
1189 \#   <none>
1190 \# *Function:
1191 \#   Turns fill on.  Allows user to center lines without
1192 \#   requiring the .BR or .br macro.
1193 \# *Notes:
1194 \#   Lines that exceed the current LL will be broken, with the excess
1195 \#   text centered.
1197 .MAC CENTER END
1198 .    if \\n[#TAB_ACTIVE]=0 \{\
1199 .       ds $RESTORE_QUAD_VALUE CENTER
1200 .    \}
1201 .    fi
1202 .    ce 100000
1203 .    nr #FILL 1
1204 .END
1206 \# =====================================================================
1208 \# +++TABS+++
1210 \#   There are two different kinds of tabs available: typesetting tabs
1211 \#   and string tabs.
1213 \#   Typesetting tabs are set with TAB_SET, which requires a tab number,
1214 \#   an indent (offset) from the left margin and a length (optionally
1215 \#   with a quad direction and an instruction to fill lines).  After tabs
1216 \#   are set with TS, they are called with .TAB n, where "n"
1217 \#   corresponds to the number passed to TAB_SET as a valid tab number.
1219 \#   String tabs allow the user to mark off tab positions inline.  Tab
1220 \#   indents and lengths are calculated from the beginning and end
1221 \#   positions of the marks.  Up to 19 string tabs may be created,
1222 \#   numbered 1-19.  Once created, they are called with .TAB n,
1223 \#   just like typesetting tabs.
1225 \#   Setting up string tabs is a two-step procedure.  First, the user
1226 \#   enters an input line in which s/he wants to mark off string tabs.
1227 \#   The beginning of a tab is marked with \*[STn], where "n" is
1228 \#   the desired number of the tab.  The end of the the tab is marked
1229 \#   with \*[STnX].  All ST's must have a matching STX.  String tabs
1230 \#   may be nested.
1232 \#   Next, the user invokes .ST n for every string tab defined, and
1233 \#   optionally passes quad information to it.  That done, string tabs
1234 \#   can be called just like typesetting tabs.
1236 \#   String tabs don't preview properly with gxditview.  Use gv instead.
1238 \# Strings for string tab inlines
1239 \# ------------------------------
1241 .ds ST1 \Ek[#ST1_OFFSET]
1242 .ds ST2 \Ek[#ST2_OFFSET]
1243 .ds ST3 \Ek[#ST3_OFFSET]
1244 .ds ST4 \Ek[#ST4_OFFSET]
1245 .ds ST5 \Ek[#ST5_OFFSET]
1246 .ds ST6 \Ek[#ST6_OFFSET]
1247 .ds ST7 \Ek[#ST7_OFFSET]
1248 .ds ST8 \Ek[#ST8_OFFSET]
1249 .ds ST9 \Ek[#ST9_OFFSET]
1250 .ds ST10 \Ek[#ST10_OFFSET]
1251 .ds ST11 \Ek[#ST11_OFFSET]
1252 .ds ST12 \Ek[#ST12_OFFSET]
1253 .ds ST13 \Ek[#ST13_OFFSET]
1254 .ds ST14 \Ek[#ST14_OFFSET]
1255 .ds ST15 \Ek[#ST15_OFFSET]
1256 .ds ST16 \Ek[#ST16_OFFSET]
1257 .ds ST17 \Ek[#ST17_OFFSET]
1258 .ds ST18 \Ek[#ST18_OFFSET]
1259 .ds ST19 \Ek[#ST19_OFFSET]
1261 .ds ST1X \Ek[#ST1_MARK]
1262 .ds ST2X \Ek[#ST2_MARK]
1263 .ds ST3X \Ek[#ST3_MARK]
1264 .ds ST4X \Ek[#ST4_MARK]
1265 .ds ST5X \Ek[#ST5_MARK]
1266 .ds ST6X \Ek[#ST6_MARK]
1267 .ds ST7X \Ek[#ST7_MARK]
1268 .ds ST8X \Ek[#ST8_MARK]
1269 .ds ST9X \Ek[#ST9_MARK]
1270 .ds ST10X \Ek[#ST10_MARK]
1271 .ds ST11X \Ek[#ST11_MARK]
1272 .ds ST12X \Ek[#ST12_MARK]
1273 .ds ST13X \Ek[#ST13_MARK]
1274 .ds ST14X \Ek[#ST14_MARK]
1275 .ds ST15X \Ek[#ST15_MARK]
1276 .ds ST16X \Ek[#ST16_MARK]
1277 .ds ST17X \Ek[#ST17_MARK]
1278 .ds ST18X \Ek[#ST18_MARK]
1279 .ds ST19X \Ek[#ST19_MARK]
1280 \# Reserved ST numbers for internal use
1281 .ds ST100  \Ek[#ST100_OFFSET]
1282 .ds ST100X \Ek[#ST100_MARK]
1283 .ds ST101  \Ek[#ST101_OFFSET]
1284 .ds ST101X \Ek[#ST101_MARK]
1287 \# QUAD AND SET STRING TABS
1288 \# ------------------------
1289 \# *Arguments:
1290 \#   <stringtab number>  L | R | C | J  [QUAD]
1291 \# *Function:
1292 \#   Creates strings $ST<#>_QUAD_DIR and $ST<#>_FILL, then sets up a
1293 \#   tab based on the collected information.
1294 \# *Notes:
1295 \#   Like TS, ST invoked without a quad direction will default to LEFT.
1296 \#   If lines should be filled and quadded, use the optional argument QUAD.
1297 \#   N.B. -- indents *must* be turned off before setting string tabs
1298 \#   inside .PAD
1300 .MAC ST END
1301 .    ds $ST\\$1_QUAD_DIR \\$2
1302 .    if \\n[#NUM_ARGS]=3 \{\
1303 .       ds $ST\\$1_FILL QUAD
1304 .    \}
1305 .    nr #ST\\$1_LENGTH \\n[#ST\\$1_MARK]-\\n[#ST\\$1_OFFSET]
1306 .    ie \\n[#IN_TAB] \{\
1307 .       TAB_SET \\$1 \\n[#ST\\$1_OFFSET]u+\\n[#ST_OFFSET]u \\n[#ST\\$1_LENGTH]u \\*[$ST\\$1_QUAD_DIR] \\*[$ST\\$1_FILL]
1308 .    \}
1309 .    el \{\
1310 .       TAB_SET \\$1 \\n[#ST\\$1_OFFSET]u \\n[#ST\\$1_LENGTH]u \\*[$ST\\$1_QUAD_DIR] \\*[$ST\\$1_FILL]
1311 .    \}
1312 .END
1315 \# TAB SET
1316 \# -------
1317 \# *Arguments:
1318 \#   <#>  ident(ipPcm)  length(ipPcm)  [L | R | C | J [QUAD]]
1319 \# *Function:
1320 \#   Creates macros TABn and TAB n, where "n" is any arbitrary number.
1321 \#   TABn is a typesetting tab (i.e. a tab defined as an indent
1322 \#   from the page left offset plus a line length.)
1323 \# *Notes:
1324 \#   n      = arbitrary digit to identify the tab
1325 \#   indent = indent from left margin; unit of measure required
1326 \#   length = length of tab (unit of measure required; can be
1327 \#            \w'<string>'u--if more than one word in string, surround
1328 \#            with double quotes "\w'<three word string>'"
1329 \#   LRCJ   = quad for tab (left, right, center, justified)
1330 \#            If option QUAD afterwards is not given, quad is line for line
1331 \#            (no fill mode), meaning that there's no need for .BR or .br
1332 \#            between lines.
1333 \#   QUAD   = fill tab (so it behaves as if .QUAD LRC or .JUSTIFY
1334 \#            had been given).
1336 \#   N.B. -- indents *must* be turned off before setting tabs
1338 \#   Examples:
1340 \#     .TAB_SET 1 2P+6p 12P C
1342 \#   means "create a tab numbered 1 that starts 2 picas and 6 points from
1343 \#   the left margin, is 12 picas long, and centre each input line."
1345 \#     .TAB_SET 1 2P+6P 12P C QUAD
1347 \#   means exactly the same thing, except that input lines are joined and
1348 \#   the area delimted by the tab filled with centered text.
1350 \#   TAB n can be called at any time after being set.
1352 \#   Tabs are NOT columnar in behaviour.  If the text inside a
1353 \#   tab runs to several lines, when you call the next tab a break
1354 \#   occurs, meaning that the new tab starts one line below the last
1355 \#   line in the previous tab.  For columnar behaviour, you must
1356 \#   use the multi-column macros in addition to tabs.
1358 \#   If you want tabs to line up bottom-line to bottom-line (most likely
1359 \#   single line tabs), use .TN (provided the tabs are numbered sequentially).
1360 \#   Otherwise, you must use .EL then .TAB # if you want them to align.
1362 \#   If you want to reset tabs, you must use .TQ before .TAB_SET.
1364 \#   Note that indents are turned off automatically whenever a new
1365 \#   tab is called with TAB n.
1367 \#   Tabs themselves are user-invoked using the TAB macro with a numeric
1368 \#   argument, e.g. TAB 1.
1370 \#   Generally, in order not to get confused, it's a good idea
1371 \#   to make sure all indents are off before setting tabs.
1373 .MAC TAB_SET END
1374 .    br
1375 .    nr #TAB_NUMBER \\$1
1376 .    ds $CURRENT_TAB \\n[#TAB_NUMBER]
1377 .    nr #TAB_OFFSET (\\$2)
1378 .    nr #TAB_LENGTH (\\$3)
1379 .    MAC TAB\\n[#TAB_NUMBER] DONE \"Define TAB macro
1380 .        br
1381 .        in 0
1382 .        nr #TAB_ACTIVE 1
1383 .        nr #CURRENT_TAB \\n[#TAB_NUMBER]
1384 .        po \\n[#L_MARGIN]u+\\n[#TAB_OFFSET]u
1385 .        nr #ST_OFFSET \\n[#TAB_OFFSET]
1386 .        nr #TAB_OFFSET\\*[$CURRENT_TAB] \\n[#TAB_OFFSET]
1387 .        ll \\n[#TAB_LENGTH]u
1388 .        ta \En(.lu
1389 .        ie '\\$5'QUAD' \{\
1390 .           if '\\$4'L' \{ .QUAD L  \}
1391 .           if '\\$4'R' \{ .QUAD R  \}
1392 .           if '\\$4'C' \{ .QUAD C  \}
1393 .           if '\\$4'J' \{ .JUSTIFY \}
1394 .        \}
1395 .        el \{\
1396 .           if '\\$4''  \{ .LEFT    \}
1397 .           if '\\$4'L' \{ .LEFT    \}
1398 .           if '\\$4'R' \{ .RIGHT   \}
1399 .           if '\\$4'C' \{ .CENTER  \}
1400 .           if '\\$4'J' \{ .JUSTIFY \}
1401 .        \}
1402 .DONE
1403 .    rr #TAB_ACTIVE
1404 .END
1407 \# TAB
1408 \# ---
1409 \# *Arguments:
1410 \#   <tab number to tab into>
1411 \# *Function:
1412 \#   Moves to tab number passed as an argument.
1414 .MAC TAB END
1415 .    ds $TAB_NUMBER \\$1
1416 .    TAB\\*[$TAB_NUMBER]
1417 .    nr #IN_TAB 1
1418 .    po \\n[#L_MARGIN]u+\\n[#TAB_OFFSET\\*[$TAB_NUMBER]]u
1419 .END
1422 \# TAB NEXT
1423 \# --------
1424 \# *Argument:
1425 \#   <none>
1426 \# *Function:
1427 \#   Automagically moves to TAB#+1 on the same line as the last
1428 \#   line of the previous tab.
1429 \# *Notes:
1430 \#   If the tabs being aligned fall too close to the footer
1431 \#   trap, the line entered after .TN will appear on the next page,
1432 \#   unless TRAP...TRAP OFF is used.
1434 .MAC TN END
1435 .    br
1436 .    nr #NEXT_TAB \\n[#CURRENT_TAB]+1
1437 .    TAB\\n[#NEXT_TAB]
1438 .    sp -1v
1439 .END
1442 \# TAB QUIT
1443 \# --------
1444 \# *Argument:
1445 \#   <none>
1446 \# *Function:
1447 \#   Sets #TAB_ACTIVE to "0" (off).
1448 \#   Resets left margin to value in effect prior to tabs.
1449 \#   Resets line length to value in effect prior to tabs.
1450 \#   Checks #QUAD to see if we were in flush or quad mode
1451 \#   prior to tabs (0=off, 1=on).
1452 \#   Resets QUAD [ L|R|C ], LEFT, RIGHT, CENTER, or JUSTIFY
1453 \#   in effect prior to tabs.
1454 \# *Notes:
1455 \#   TQ *must* come before setting any new tabs if you want the
1456 \#   tabs' indents measured from page left.  Otherwise, the tabs'
1457 \#   indents are measured from the left margin of the tab you're
1458 \#   currently in.
1460 .MAC TQ END
1461 .    br
1462 .    rr #TAB_ACTIVE
1463 .    rr #IN_TAB
1464 .    po \\n[#L_MARGIN]u
1465 .    ll \\n[#L_LENGTH]u
1466 .    ta \\n(.lu
1467 .    ie \\n[#QUAD] \{\
1468 .       ie '\\*[$RESTORE_QUAD_VALUE]'J' \{ .JUSTIFY \}
1469 .       el                              \{ .QUAD \\*[$RESTORE_QUAD_VALUE] \}
1470 .    \}
1471 .    el \{\
1472 .       if '\\*[$RESTORE_QUAD_VALUE]'LEFT'   \{ .LEFT \}
1473 .       if '\\*[$RESTORE_QUAD_VALUE]'RIGHT'  \{ .RIGHT \}
1474 .       if '\\*[$RESTORE_QUAD_VALUE]'CENTER' \{ .CENTER \}
1475 .    \}
1476 .END
1478 \# =====================================================================
1480 \# +++MISCELLANEOUS USEFUL MACROS AND STRINGS+++
1482 \# UNDERLINE
1483 \# ---------
1484 \# *Arguments:
1485 \#   <none> | <anything>
1486 \# *Function:
1487 \#   When on, underlines all letters, words, and digits in a passage,
1488 \#   ignoring punctuation and spaces.
1489 \# *Notes:
1490 \#   Only for use when the font family is COURIER, to simulate
1491 \#   typewriter-style underlining of italic  passages.
1493 .MAC UNDERLINE END
1494 .    ie '\\$1'' \{\
1495 .       nr #UNDERLINE_ON 1
1496 .       char A _\bA
1497 .       char B _\bB
1498 .       char C _\bC
1499 .       char D _\bD
1500 .       char E _\bE
1501 .       char F _\bF
1502 .       char G _\bG
1503 .       char H _\bH
1504 .       char I _\bI
1505 .       char J _\bJ
1506 .       char K _\bK
1507 .       char L _\bL
1508 .       char M _\bM
1509 .       char N _\bN
1510 .       char O _\bO
1511 .       char P _\bP
1512 .       char Q _\bQ
1513 .       char R _\bR
1514 .       char S _\bS
1515 .       char T _\bT
1516 .       char U _\bU
1517 .       char V _\bV
1518 .       char W _\bW
1519 .       char X _\bX
1520 .       char Y _\bY
1521 .       char Z _\bZ
1522 .       char \[`A] _\b\[`A]
1523 .       char \[^A] _\b\[^A]
1524 .       char \['A] _\b\['A]
1525 .       char \[:A] _\b\[:A]
1526 .       char \[oA] _\b\[oA]
1527 .       char \[~A] _\b\[~A]
1528 .       char \[AE] _\b\[AE]
1529 .       char \[`E] _\b\[`E]
1530 .       char \[^E] _\b\[^E]
1531 .       char \['E] _\b\['E]
1532 .       char \[:E] _\b\[:E]
1533 .       char \[`I] _\b\[`I]
1534 .       char \[^I] _\b\[^I]
1535 .       char \['I] _\b\['I]
1536 .       char \[:I] _\b\[:I]
1537 .       char \[`O] _\b\[`O]
1538 .       char \[^O] _\b\[^O]
1539 .       char \['O] _\b\['O]
1540 .       char \[:O] _\b\[:O]
1541 .       char \[~O] _\b\[~O]
1542 .       char \[/O] _\b\[/O]
1543 .       char \[`U] _\b\[`U]
1544 .       char \[^U] _\b\[^U]
1545 .       char \['U] _\b\['U]
1546 .       char \[:U] _\b\[:U]
1547 .       char \[,C] _\b\[,C]
1548 .       char \[-D] _\b\[-D]
1549 .       char \[~N] _\b\[~N]
1550 .       char \[TP] _\b\[TP]
1551 .       char \['Y] _\b\['Y]
1552 .       char \[:Y] _\b\[:Y]
1553 .       char a _\ba
1554 .       char b _\bb
1555 .       char c _\bc
1556 .       char d _\bd
1557 .       char e _\be
1558 .       char f _\bf
1559 .       char g _\bg
1560 .       char h _\bh
1561 .       char i _\bi
1562 .       char j _\bj
1563 .       char k _\bk
1564 .       char l _\bl
1565 .       char m _\bm
1566 .       char n _\bn
1567 .       char o _\bo
1568 .       char p _\bp
1569 .       char q _\bq
1570 .       char r _\br
1571 .       char s _\bs
1572 .       char t _\bt
1573 .       char u _\bu
1574 .       char v _\bv
1575 .       char w _\bw
1576 .       char x _\bx
1577 .       char y _\by
1578 .       char z _\bz
1579 .       char \[`a] _\b\[`a]
1580 .       char \[^a] _\b\[^a]
1581 .       char \['a] _\b\['a]
1582 .       char \[:a] _\b\[:a]
1583 .       char \[oa] _\b\[oa]
1584 .       char \[~a] _\b\[~a]
1585 .       char \[ae] _\b\[ae]
1586 .       char \[`e] _\b\[`e]
1587 .       char \[^e] _\b\[^e]
1588 .       char \['e] _\b\['e]
1589 .       char \[:e] _\b\[:e]
1590 .       char \[`i] _\b\[`i]
1591 .       char \[^i] _\b\[^i]
1592 .       char \['i] _\b\['i]
1593 .       char \[:i] _\b\[:i]
1594 .       char \[`o] _\b\[`o]
1595 .       char \[^o] _\b\[^o]
1596 .       char \['o] _\b\['o]
1597 .       char \[:o] _\b\[:o]
1598 .       char \[~o] _\b\[~o]
1599 .       char \[/o] _\b\[/o]
1600 .       char \[`u] _\b\[`u]
1601 .       char \[^u] _\b\[^u]
1602 .       char \['u] _\b\['u]
1603 .       char \[:u] _\b\[:u]
1604 .       char \[,c] _\b\[,c]
1605 .       char \[Sd] _\b\[Sd]
1606 .       char \[~n] _\b\[~n]
1607 .       char \[Tp] _\b\[Tp]
1608 .       char \['y] _\b\['y]
1609 .       char \[:y] _\b\[:y]
1610 .       char \[ss] _\b\[ss]
1611 .       char ' _\b'
1612 .       char 1 _\b1
1613 .       char 2 _\b2
1614 .       char 3 _\b3
1615 .       char 4 _\b4
1616 .       char 5 _\b5
1617 .       char 6 _\b6
1618 .       char 7 _\b7
1619 .       char 8 _\b8
1620 .       char 9 _\b9
1621 .       char 0 _\b0
1622 .    \}
1623 .    el \{\
1624 .       nr #UNDERLINE_ON 0
1625 .       rchar A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
1626         a b c d e f g h i j k l m n o p q r s t u v w x y z \
1627         \[`A] \[^A] \['A] \[:A] \[oA] \[~A] \[AE] \[`E] \[^E] \['E] \[:E] \
1628         \[`I] \[^I] \['I] \[:I] \[`O] \[^O] \['O] \[:O] \[~O] \[/O] \[`U] \
1629         \[^U] \['U] \[:U] \[,C] \[-D] \[~N] \[TP] \['Y] \[:Y] \
1630         \[`a] \[^a] \['a] \[:a] \[oa] \[~a] \[ae] \[`e] \[^e] \['e] \[:e] \[`i] \
1631         \[^i] \['i] \[:i] \[`o] \[^o] \['o] \[:o] \[~o] \[/o] \[`u] \[^u] \['u] \
1632         \[:u] \[,c] \[Sd] \[~n] \[Tp] \['y] \[:y] \[ss] \
1633         ' 1 2 3 4 5 6 7 8 9 0
1634 .    \}
1635 .END
1638 \# UL/ULX
1639 \# ------
1640 \# *Arguments:
1641 \#   <none>
1642 \# *Function:
1643 \#   Underscores all letters, words, and digits in a passage,
1644 \#   ignoring punctuation and spaces.
1645 \# *Notes:
1646 \#   Intended to be called with inline escapes \*[UL] (underline
1647 \#   on) and \*[ULX] (underline off).  Only works when the font family
1648 \#   is COURIER, to simulate typewriter-style underlining of italic
1649 \#   passages.
1651 .MAC UL END
1652 \c\R'#UNDERLINE_ON 1'
1653 .       char A _\bA
1654 .       char B _\bB
1655 .       char C _\bC
1656 .       char D _\bD
1657 .       char E _\bE
1658 .       char F _\bF
1659 .       char G _\bG
1660 .       char H _\bH
1661 .       char I _\bI
1662 .       char J _\bJ
1663 .       char K _\bK
1664 .       char L _\bL
1665 .       char M _\bM
1666 .       char N _\bN
1667 .       char O _\bO
1668 .       char P _\bP
1669 .       char Q _\bQ
1670 .       char R _\bR
1671 .       char S _\bS
1672 .       char T _\bT
1673 .       char U _\bU
1674 .       char V _\bV
1675 .       char W _\bW
1676 .       char X _\bX
1677 .       char Y _\bY
1678 .       char Z _\bZ
1679 .       char \[`A] _\b\[`A]
1680 .       char \[^A] _\b\[^A]
1681 .       char \['A] _\b\['A]
1682 .       char \[:A] _\b\[:A]
1683 .       char \[oA] _\b\[oA]
1684 .       char \[~A] _\b\[~A]
1685 .       char \[AE] _\b\[AE]
1686 .       char \[`E] _\b\[`E]
1687 .       char \[^E] _\b\[^E]
1688 .       char \['E] _\b\['E]
1689 .       char \[:E] _\b\[:E]
1690 .       char \[`I] _\b\[`I]
1691 .       char \[^I] _\b\[^I]
1692 .       char \['I] _\b\['I]
1693 .       char \[:I] _\b\[:I]
1694 .       char \[`O] _\b\[`O]
1695 .       char \[^O] _\b\[^O]
1696 .       char \['O] _\b\['O]
1697 .       char \[:O] _\b\[:O]
1698 .       char \[~O] _\b\[~O]
1699 .       char \[/O] _\b\[/O]
1700 .       char \[`U] _\b\[`U]
1701 .       char \[^U] _\b\[^U]
1702 .       char \['U] _\b\['U]
1703 .       char \[:U] _\b\[:U]
1704 .       char \[,C] _\b\[,C]
1705 .       char \[-D] _\b\[-D]
1706 .       char \[~N] _\b\[~N]
1707 .       char \[TP] _\b\[TP]
1708 .       char \['Y] _\b\['Y]
1709 .       char \[:Y] _\b\[:Y]
1710 .       char a _\ba
1711 .       char b _\bb
1712 .       char c _\bc
1713 .       char d _\bd
1714 .       char e _\be
1715 .       char f _\bf
1716 .       char g _\bg
1717 .       char h _\bh
1718 .       char i _\bi
1719 .       char j _\bj
1720 .       char k _\bk
1721 .       char l _\bl
1722 .       char m _\bm
1723 .       char n _\bn
1724 .       char o _\bo
1725 .       char p _\bp
1726 .       char q _\bq
1727 .       char r _\br
1728 .       char s _\bs
1729 .       char t _\bt
1730 .       char u _\bu
1731 .       char v _\bv
1732 .       char w _\bw
1733 .       char x _\bx
1734 .       char y _\by
1735 .       char z _\bz
1736 .       char \[`a] _\b\[`a]
1737 .       char \[^a] _\b\[^a]
1738 .       char \['a] _\b\['a]
1739 .       char \[:a] _\b\[:a]
1740 .       char \[oa] _\b\[oa]
1741 .       char \[~a] _\b\[~a]
1742 .       char \[ae] _\b\[ae]
1743 .       char \[`e] _\b\[`e]
1744 .       char \[^e] _\b\[^e]
1745 .       char \['e] _\b\['e]
1746 .       char \[:e] _\b\[:e]
1747 .       char \[`i] _\b\[`i]
1748 .       char \[^i] _\b\[^i]
1749 .       char \['i] _\b\['i]
1750 .       char \[:i] _\b\[:i]
1751 .       char \[`o] _\b\[`o]
1752 .       char \[^o] _\b\[^o]
1753 .       char \['o] _\b\['o]
1754 .       char \[:o] _\b\[:o]
1755 .       char \[~o] _\b\[~o]
1756 .       char \[/o] _\b\[/o]
1757 .       char \[`u] _\b\[`u]
1758 .       char \[^u] _\b\[^u]
1759 .       char \['u] _\b\['u]
1760 .       char \[:u] _\b\[:u]
1761 .       char \[,c] _\b\[,c]
1762 .       char \[Sd] _\b\[Sd]
1763 .       char \[~n] _\b\[~n]
1764 .       char \[Tp] _\b\[Tp]
1765 .       char \['y] _\b\['y]
1766 .       char \[:y] _\b\[:y]
1767 .       char \[ss] _\b\[ss]
1768 .       char ' _\b'
1769 .       char 1 _\b1
1770 .       char 2 _\b2
1771 .       char 3 _\b3
1772 .       char 4 _\b4
1773 .       char 5 _\b5
1774 .       char 6 _\b6
1775 .       char 7 _\b7
1776 .       char 8 _\b8
1777 .       char 9 _\b9
1778 .       char 0 _\b0
1779 .END
1782 .MAC ULX END
1783 \c\R'#UNDERLINE_ON 0'
1784 .    rchar A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
1785      a b c d e f g h i j k l m n o p q r s t u v w x y z \
1786      \[`A] \[^A] \['A] \[:A] \[oA] \[~A] \[AE] \[`E] \[^E] \['E] \[:E] \
1787      \[`I] \[^I] \['I] \[:I] \[`O] \[^O] \['O] \[:O] \[~O] \[/O] \[`U] \
1788      \[^U] \['U] \[:U] \[,C] \[-D] \[~N] \[TP] \['Y] \[:Y] \
1789      \[`a] \[^a] \['a] \[:a] \[oa] \[~a] \[ae] \[`e] \[^e] \['e] \[:e] \[`i] \
1790      \[^i] \['i] \[:i] \[`o] \[^o] \['o] \[:o] \[~o] \[/o] \[`u] \[^u] \['u] \
1791      \[:u] \[,c] \[Sd] \[~n] \[Tp] \['y] \[:y] \[ss] \
1792      ' 1 2 3 4 5 6 7 8 9 0
1793 .END
1796 \# UNDERSCORE
1797 \# ----------
1798 \# *Arguments:
1799 \#   [points below baseline] "text"
1800 \# *Function:
1801 \#   Places an underscore 2 points under the string if no lead given,
1802 \#   otherwise places underscore under string by user specified amount.
1803 \# *Notes:
1804 \#   When using this macro, the string to be underscored must begin
1805 \#   with double-quotes ("), regardless of whether it's the sole
1806 \#   argument or the second.
1807 \#   E.g.:
1808 \#      .UNDERSCORE "Text to be underscored
1809 \#         or
1810 \#      .UNDERSCORE 2p "Text to be underscored
1812 \#   All text is underscored (including punctuation and spaces).
1813 \#   This is the primary difference between UNDERLINE and UNDERSCORE,
1814 \#   aside from the fact the UNDERLINE only works with Courier.
1816 \#   UNDERSCORE does not work across line breaks.  Each line of
1817 \#   text must be entered separately with UNDERSCORE.  If the
1818 \#   UNDERSCORE begins in the middle of a line and crosses over a
1819 \#   break, the portion before the break must be entered in its own
1820 \#   UNDERSCORE, as must the portion that comes after the break.
1822 .MAC UNDERSCORE END
1823 .    nr #RESTORE_PT_SIZE \\n[#PT_SIZE]
1824 .    ie \\n[#NUM_ARGS]=1 \{ \\$1\\s(12\\v'+2p'\\l'|0'\\v'-2p'\\s[\\n[#RESTORE_PT_SIZE]u] \}
1825 .    el                  \{ \\$2\\s(12\\v'+(\\$1)'\\l'|0'\\v'-(\\$1)'\\s[\\n[#RESTORE_PT_SIZE]u] \}
1826 .    rr #RESTORE_PT_SIZE
1827 .END
1830 \# DOUBLE UNDERSCORE
1831 \# -----------------
1832 \# *Arguments:
1833 \#   [points below baseline] [points distance between rules] "text"
1834 \# *Function:
1835 \#   Same as UNDERSCORE, except it produces a double underscore.  The default
1836 \#   distance between the rules is 2 points.
1837 \# *Notes:
1838 \#   The same double-quote requirement as UNDERSCORE.
1840 .MAC UNDERSCORE2 END
1841 .    nr #RESTORE_PT_SIZE \\n[#PT_SIZE]
1842 .    if \\n[#NUM_ARGS]=1 \{\
1843 .       PRINT \\$1\\s(12\\v'+2p'\\l'|0'\\v'+2p'\\l'|0'\\v'-4p'\\s[\\n[#RESTORE_PT_SIZE]u]
1844 .    \}
1845 .    if \\n[#NUM_ARGS]=2 \{\
1846 .       PRINT \\$2\\s(12\\v'+\\$1'\\l'|0'\\v'+2p'\\l'|0'\\v'-(2p+\\$1)'\\s[\\n[#RESTORE_PT_SIZE]u]
1847 .    \}
1848 .    if \\n[#NUM_ARGS]=3 \{\
1849 .       PRINT \\$3\\s(12\\v'+\\$1'\\l'|0'\\v'+\\$2'\\l'|0'\\v'-(\\$2+\\$1)'\\s[\\n[#RESTORE_PT_SIZE]u]
1850 .    \}
1851 .    rr #RESTORE_PT_SIZE
1852 .END
1855 \# SUPERSCRIPT INLINES
1856 \# -------------------
1857 \# *Function:
1858 \#   Prints everything after invocation as superscript.
1859 \# *Notes:
1860 \#   \*[SUP] and \*[SUPX] turn superscript on and off respectively.
1861 \#   If running type is pseudo-condensed/expanded, invoke the superscript
1862 \#   strings as \*[CONDSUP] or \*[EXTSUP] and turn off with \*[CONDSUPX]
1863 \#   and \*[EXTSUPX] respectively.
1865 .ds SUP \
1866 \R'#PT_SIZE_IN_UNITS \En[.ps]'\
1867 \R'#SUP_PT_SIZE \En[#PT_SIZE_IN_UNITS]u*6u/10u'\
1868 \s[\En[#PT_SIZE_IN_UNITS]u]\v'-.3m'\s[\En[#SUP_PT_SIZE]u]
1870 .ds SUPX \s[\En[#PT_SIZE_IN_UNITS]u]\v'.3m'
1872 .ds CONDSUP \
1873 \R'#PT_SIZE_IN_UNITS \En[.ps]'\
1874 \R'#SUP_PT_SIZE \En[#PT_SIZE_IN_UNITS]u*6u/10u'\
1875 \s[\En[#PT_SIZE_IN_UNITS]u]\v'-.3m'\s[\En[#SUP_PT_SIZE]u]\E*[COND_FOR_SUP]
1877 .ds CONDSUPX \s[\En[#PT_SIZE_IN_UNITS]u]\v'.3m'\E*[COND]
1879 .ds EXTSUP \
1880 \R'#PT_SIZE_IN_UNITS \En[.ps]'\
1881 \R'#SUP_PT_SIZE \En[#PT_SIZE_IN_UNITS]u*6u/10u'\
1882 \s[\En[#PT_SIZE_IN_UNITS]u]\v'-.3m'\s[\En[#SUP_PT_SIZE]u]\E*[EXT_FOR_SUP]
1884 .ds EXTSUPX \s[\En[#PT_SIZE_IN_UNITS]u]\v'.3m'\E*[EXT]
1887 \# SLANT
1888 \# -----
1890 \# SETSLANT
1891 \# --------
1892 \# *Arguments:
1893 \#   <number of degrees> | RESET
1894 \# *Function:
1895 \#   Modifies register #DEGREES for use with \*[SLANT], or resets
1896 \#   it to the default.  Defines string \*[SLANTX]
1897 \# *Notes:
1898 \#   \*[SLANT] permits pseudo-italicizing of a font in cases where
1899 \#   no italic font exists in a particular family.
1901 \#   Default # of degrees is 15.
1903 \#   Do not use unit of measure with arg to SETSLANT.
1905 \#   It may be necessary to adjust the spacing on either side of
1906 \#   [SLANT] and [SLANTX].
1908 \#   In docs, SLANT carries over from para to para.
1910 .nr #DEGREES 15
1911 .ds SLANT \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
1912 .ds SLANTX \ER'#SLANT_ON 0'\ES'0'
1914 .MAC SETSLANT END
1915 .    ie '\\$1'RESET' \{\
1916 .       nr #DEGREES 15
1917 .       if \\n[#PRINT_STYLE]=1 \{\
1918 .          if \\n[#UNDERLINE_SLANT] \{ .return \}
1919 .       \}
1920 .       ds SLANT \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
1921 .    \}
1922 .    el \{\
1923 .       nr #DEGREES \\$1
1924 .       if \\n[#PRINT_STYLE]=1 \{\
1925 .          if \\n[#UNDERLINE_SLANT] \{ .return \}
1926 .       \}
1927 .       ds SLANT \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
1928 .    \}
1929 .    ds SLANTX \ER'#SLANT_ON 0'\ES'0'
1930 .END
1933 \# BOLDER
1934 \# ------
1936 \# SETBOLDER
1937 \# ---------
1938 \# *Arguments:
1939 \#   <amount of emboldening> | RESET
1940 \# *Function:
1941 \#   Modifies register #BOLDER_UNITS for use with \*[BOLDER], or resets
1942 \#   it to the default 700 units.
1943 \# *Notes:
1944 \#   \*[BOLDER] allows pseudo-emboldening of a font where no bold
1945 \#   font exists in a particular family.
1947 \#   Default for SETBOLDER is 700 units.  Do not use unit of measure
1948 \#   with arg to SETBOLDER.
1950 .nr #BOLDER_UNITS 700
1952 .MAC SETBOLDER END
1953 .    if \\n[#IGNORE]=1 \{ .return \}
1954 .    ie '\\$1'RESET' \{ .nr #BOLDER_UNITS 700 \}
1955 .    el \{ .nr #BOLDER_UNITS \\$1 \}
1956 .END
1959 .MAC BOLDER END
1961 .bd \\n(.f \\n[#BOLDER_UNITS]
1962 .END
1965 .MAC BOLDERX END
1967 .bd \\n(.f
1968 .END
1970 \# +++CONDENSE/EXTEND+++
1972 \# CONDENSE/EXTEND
1973 \# ---------------
1974 \# *Arguments:
1975 \#   <percentage to condense/expand type size>
1976 \# *Function:
1977 \#   Stores current point size in z's in #PT_SIZE_IN_UNITS, figures out
1978 \#   new point size (for character width) from arg, and defines string
1979 \#   COND or EXT, which set the type size to the new character width,
1980 \#   and sets the height of type to the value stored in CURRENT_PT_SIZE
1981 \# *Notes:
1982 \#   CONDENSE_OR_EXTEND is invoked from the aliases
1983 \#   CONDENSE and EXTEND.  CONDENSE implies <100, EXTEND
1984 \#   implies >100.  Do not use a percent sign in the argument.
1986 \#   There is no default setting for CONDENSE or EXTEND.
1987 \#   80 is a good approximation of condensed type, 120 is okay
1988 \#   for extended.
1990 \#   The value set by CONDENSE or EXTEND applies to all
1991 \#   subsequent \*[COND] or \*[EXT] escapes until a new value is set.
1993 \#  \*[COND] or \*[EXT] must be turned off before all changes of point
1994 \#  size and reinvoked afterwards (if so desired).  This refers to
1995 \#  changes of point size via control lines AND with via inlines.
1997 .MAC CONDENSE_OR_EXTEND END
1998 .    if '\\$0'CONDENSE' \{\
1999 .       ds $COND_PERCENT \\$1
2000 .       if \\n[#PRINT_STYLE]=1 \{\
2001 .          rm $COND_PERCENT
2002 .          ds $COND_PERCENT 100
2003 .       \}
2004 .       ds COND \
2005 \R'#PT_SIZE_IN_UNITS \En[.ps]'\
2006 \R'#CONDENSE 1'\
2007 \R'#COND_WIDTH (\En[#PT_SIZE_IN_UNITS]u*\E*[$COND_PERCENT]u)/100'\
2008 \Es[\En[#COND_WIDTH]u]\EH'\En[#PT_SIZE_IN_UNITS]u'
2009 .       ds COND_FOR_SUP \
2010 \R'#COND_WIDTH (\En[#SUP_PT_SIZE]u*\E*[$COND_PERCENT]u)/100'\
2011 \Es[\En[#COND_WIDTH]u]\H'\En[#SUP_PT_SIZE]u'
2012 .    \}
2013 .    if '\\$0'EXTEND' \{\
2014 .       ds $EXT_PERCENT \\$1
2015 .       if \\n[#PRINT_STYLE]=1 \{\
2016 .          rm $EXT_PERCENT
2017 .          ds $EXT_PERCENT 100
2018 .       \}
2019 .       ds EXT \
2020 \R'#PT_SIZE_IN_UNITS \En[.ps]'\
2021 \R'#EXTEND 1'\
2022 \R'#EXT_WIDTH (\En[#PT_SIZE_IN_UNITS]u*\E*[$EXT_PERCENT]u)/100'\
2023 \Es[\En[#EXT_WIDTH]u]\EH'\En[#PT_SIZE_IN_UNITS]u'
2024 .       ds EXT_FOR_SUP \
2025 \R'#EXT_WIDTH (\En[#SUP_PT_SIZE]u*\E*[$EXT_PERCENT]u)/100'\
2026 \Es[\En[#EXT_WIDTH]u]\H'\En[#EXT_PT_SIZE]u'
2027 .    \}
2028 .END
2030 .ds CONDX \ER'#CONDENSE 0'\Es0\R'#PT_SIZE_IN_UNITS \En[.ps]'\H'\En[#PT_SIZE_IN_UNITS]u'
2031 .ds EXTX  \ER'#EXTEND   0'\Es0\R'#PT_SIZE_IN_UNITS \En[.ps]'\H'\En[#PT_SIZE_IN_UNITS]u'
2034 \# +++PAD LINES+++ (insert space)
2036 \# PAD MARKER
2037 \# ----------
2038 \# *Arguments:
2039 \#   <character to use for marking pad points>
2040 \# *Function:
2041 \#   Defines string $PAD_MARKER, used in PAD
2042 \# *Notes:
2043 \#   $PAD_MARKER is normally # (the pound sign).
2045 .MAC PAD_MARKER END
2046 .    ds $PAD_MARKER \\$1
2047 .END
2050 \# PAD
2051 \# ---
2052 \# *Argments:
2053 \#   "<string of text with padding markers inserted>"
2054 \# *Function:
2055 \#   Defines and redefines padding character (default=pound sign
2056 \#   unless padding character has been set with PAD_MARKER)
2057 \#   several times so that when the string is output at the end
2058 \#   of the macro, every # has been converted to an equal-sized
2059 \#   amount of padding (blank space) on a line. # is equivalent to
2060 \#   CompuGraphic's old <IS>.
2061 \# *Notes:
2062 \#   String tabs may be marked off during PAD.
2064 .MAC PAD END
2065 .    if \\n(.u=1 \{ .nr #FILL_MODE 1 \}
2066 .    nf
2067 .    if !d$PAD_MARKER \{ .ds $PAD_MARKER # \}
2068 .    char \\*[$PAD_MARKER] \R'#PAD_COUNT \En[#PAD_COUNT]+1'
2069 .    ds $FAMILY_FOR_PAD \\n[.fam]
2070 .    nr #FONT_FOR_PAD   \\n(.f
2071 .    nr #SIZE_FOR_PAD   \\n[.ps]
2072 .    ds $PAD_STRING \\$1
2073 .    as $PAD_STRING \Ekp
2074 .    di PAD_STRING
2075 .    fam \\*[$FAMILY_FOR_PAD]
2076 \\f\\n[#FONT_FOR_PAD]\\s[\\n[#SIZE_FOR_PAD]u]\\*[$PAD_STRING]
2077 .    br
2078 .    di
2079 .    char \\*[$PAD_MARKER] \R'#SPACE_TO_END \En(.l-\Enp'\R'#PAD_SPACE \En[#SPACE_TO_END]/\En[#PAD_COUNT]'
2080 .    di PAD_STRING
2081 .    fam \\*[$FAMILY_FOR_PAD]
2082 \\f\\n[#FONT_FOR_PAD]\\s[\\n[#SIZE_FOR_PAD]u]\\*[$PAD_STRING]
2083 .    br
2084 .    di
2085 .    char \\*[$PAD_MARKER] \h'\En[#PAD_SPACE]u'
2086 .    ie \\n[#SILENT] \{\
2087 .       SILENT
2088 .       fam \\*[$FAMILY_FOR_PAD]
2089 \\f\\n[#FONT_FOR_PAD]\\s[\\n[#SIZE_FOR_PAD]u]\\*[$PAD_STRING]
2090 .       br
2091 .       SILENT OFF
2092 .    \}
2093 .    el \{\
2094 .       fam \\*[$FAMILY_FOR_PAD]
2095 \\f\\n[#FONT_FOR_PAD]\\s[\\n[#SIZE_FOR_PAD]u]\\*[$PAD_STRING]
2096 .       br
2097 .    \}
2098 .    if \\n[#FILL_MODE]=1 \{\
2099 .       fi
2100 .       rr #FILL_MODE
2101 .    \}
2102 .    rr #PAD_COUNT
2103 .    rr #SPACE_TO_END
2104 .    rr #PAD_SPACE
2105 .    rm $PAD_STRING
2106 .    rm PAD_STRING
2107 .    rchar #
2108 .END
2111 \# +++LEADERS+++
2113 \#  The leader mechanism is primitive, but it works.  Basically,
2114 \#  every macro in this set that includes a line length also sets
2115 \#  a single groff tab stop at the right hand end of the line.
2116 \#  That way, whenever Ctrl-A is invoked (always at the end of
2117 \#  an input line), leader of the correct length gets deposited.
2118 \#  Ctrl-A is accessed by the string LEADER (i.e. inline, as
2119 \#  \*[LEADER]).  Leaders within tabs get their length from the
2120 \#  tab line length.
2122 \# SET LEADER CHARACTER
2123 \# --------------------
2124 \# *Arguments:
2125 \#   <character to use whenever \*[LEADER] is invoked>
2126 \# *Function:
2127 \#   Set leader character.
2129 .MAC LEADER_CHARACTER END
2130 .    lc \\$1
2131 .END
2133 .ds LEADER \x01
2135 \# +++DROP CAPS+++
2137 \# DROP CAP FAMILY
2138 \# ---------------
2139 \# *Argument:
2140 \#   <family of drop cap>
2141 \# *Function:
2142 \#   Creates or modifies string $DC_FAM.
2144 .MAC DROPCAP_FAMILY END
2145 .    ds $DC_FAM \\$1
2146 .END
2149 \# DROP CAP FONT
2150 \# -------------
2151 \# *Argument:
2152 \#   <font of drop cap>
2153 \# *Function:
2154 \#   Creates or modifies string $DC_FT.
2156 .MAC DROPCAP_FONT END
2157 .    ds $DC_FT \\$1
2158 .END
2161 \# DROP CAP GUTTER
2162 \# ---------------
2163 \# *Argument:
2164 \#   <width of gutter between drop cap and indented text>
2165 \# *Function:
2166 \#   Creates or modifies register #DC_GUT.
2167 \# *Notes:
2168 \#   Requires unit of measure.  Default is 3p.
2170 .MAC DROPCAP_GUTTER END
2171 .    nr #DC_GUT (\\$1)
2172 .END
2175 \# DROP CAP ADJUST
2176 \# ---------------
2177 \# *Argument:
2178 \#   <+|- # of points to in/decrease point size of drop cap letter>
2179 \# *Function:
2180 \#   Creates or modifies string $DC_ADJUST.
2181 \# *Notes:
2182 \#   Despite its best efforts, DROPCAP doesn't always get the point
2183 \#   size of the drop cap critically perfect.  DROPCAP_ADJUST lets
2184 \#   the user add or subtract points (or fractions of points) to
2185 \#   get the size right.
2187 \#   Requires the + or - sign.
2189 .MAC DROPCAP_ADJUST END
2190 .    ds $DC_ADJUST \\$1
2191 .END
2194 \# DROP CAP
2195 \# --------
2196 \# *Arguments:
2197 \#   <dropcap letter> <# of lines> [COND <% to condense> | EXT <% to extend>]
2198 \# *Function:
2199 \#   Calculates point size of dropcap based on # of lines passed as
2200 \#   arg 2.  Sets indent for text based on dropcap width+gutter.
2201 \#   Advances and prints dropcap; reverses and prints indented text
2202 \#   to bottom of dropcap, then resets indent to left margin (plus
2203 \#   any indent that was in effect prior to invoking DROPCAP).
2204 \# *Notes:
2205 \#   Drop caps put a strain on on resource-challenged systems.
2207 \#   Drop caps when using the doc processing macro PP only work with
2208 \#   initial paragraphs (i.e. at doc start, or after heads), only when
2209 \#   DROPCAPS comes immediately after PP, and only when the PRINTSTYLE
2210 \#   is TYPESET.  If these conditions aren't met, DROPCAPS is silently
2211 \#   ignored.
2213 \#   The COND or EXT argument are processed separately from all
2214 \#   other COND or EXT inlines or macros, hence passing COND or
2215 \#   EXT has no effect on running type.
2217 .MAC DROPCAP END
2218 .    if #IGNORE \{ .return \}
2219 .    br
2220 .    if \\n[#DOCS] \{\
2221 .       if \\n[#PRINT_STYLE]=1 \{ .return \}
2222 .       if \\n[#PRINT_STYLE]=2 \{\
2223 .          if \\n[#PP_STYLE]=2 \{ .return \}
2224 .          if \\n[#PP]>1 \{ .return \}
2225 .          ti 0
2226 .       \}
2227 .    \}
2228 .    ds $DROPCAP         \\$1
2229 .    nr #DC_LINES        \\$2-1
2230 .    ds $RESTORE_COND    \\*[$COND_PERCENT]
2231 .    ds $RESTORE_EXT     \\*[$EXT_PERCENT]
2232 .    if '\\$3'COND'      \{ .CONDENSE \\$4 \}
2233 .    if '\\$3'EXT'       \{ .EXTEND \\$4 \}
2234 .    if !r#DC_GUT        \{ .nr #DC_GUT (3p) \}
2235 .    ds $RESTORE_FAM     \\n[.fam]
2236 .    nr #RESTORE_FT      \\n(.f
2237 .    nr #RESTORE_PT_SIZE \\n[#PT_SIZE]
2238 .    nr #RESTORE_INDENT  \\n(.i
2239 .    SIZESPECS
2240 .    nr #DC_HEIGHT \\n[#DC_LINES]*\\n[#LEAD]+\\n[#CAP_HEIGHT]
2241 .    ie !d$DC_FAM \{ .FAM \\n[.fam] \}
2242 .    el \{ .FAM \\*[$DC_FAM] \}
2243 .    ie !d$DC_FT \{ .FT \\n(.f \}
2244 .    el \{ .FT \\*[$DC_FT] \}
2245 .    while \\n[#GET_DC_HEIGHT]<\\n[#DC_HEIGHT] \{\
2246 .       ps \\n[#PT_SIZE]u+100u
2247 .       SIZESPECS
2248 .       nr #GET_DC_HEIGHT \\n[#CAP_HEIGHT]
2249 .    \}
2250 .    if d$DC_ADJUST \{ .ps \\*[$DC_ADJUST]p \}
2251 .    mk x
2252 .    sp \\n[#DC_LINES]v
2253 .    ie '\\$3'COND' \{ .PRINT \\*[COND]\\*[$DROPCAP]\\*[CONDX] \}
2254 .    el \{ .PRINT \\*[$DROPCAP] \}
2255 .    if '\\$3'COND' \{ \E*[COND] \}
2256 .    if '\\$3'EXT'  \{ \E*[EXT]  \}
2257 .    ie \\n(.i \{ .in +\w'\\*[$DROPCAP]'u+\\n[#DC_GUT]u \}
2258 .    el \{ .in \w'\\*[$DROPCAP]'u+\\n[#DC_GUT]u \}
2259 .    if '\\$3'COND' \{ \E*[CONDX]\c \}
2260 .    if '\\$3'EXT'  \{ \E*[EXTX]\c \}
2261 .    rt \\nxu
2262 .    FAM \\*[$RESTORE_FAM]
2263 .    FT  \\n[#RESTORE_FT]
2264 .    ps \\n[#RESTORE_PT_SIZE]u
2265 .    CONDENSE \\*[$RESTORE_COND]
2266 .    EXTEND   \\*[$RESTORE_EXT]
2267 .    ie \\n(.u \{ .wh \\n(.du+\\n[#DC_HEIGHT]u-1v DROPCAP_OFF \}
2268 .    el \{ .wh \\n(.du+\\n[#DC_HEIGHT]u DROPCAP_OFF \}
2269 .    rm $DROPCAP
2270 .    rr #DC_LINES
2271 .    rm $RESTORE_COND
2272 .    rm $RESTORE_EXT
2273 .    rm $RESTORE_FAM
2274 .    rr #RESTORE_FT
2275 .    rr #RESTORE_PT_SIZE
2276 .    rr #RESTORE_INDENT
2277 .    rr #DC_HEIGHT
2278 .    rr #GET_DC_HEIGHT
2279 .    rr x
2280 .END
2282 .MAC DROPCAP_OFF END
2283 '    in \\n[#RESTORE_INDENT]u
2284 .END
2287 \# RULE
2288 \# ----
2289 \# *Argument:
2290 \#   <none>
2291 \# *Function:
2292 \#   Draws a rule the length of the current measure.
2293 \# *Notes:
2295 .MAC RULE END
2296 .    if \\n(.j=1 \{\
2297 .       ds $CURRENT_QUAD \\*[$QUAD_VALUE]
2298 .       nf
2299 .    \}
2300 .    ie \\n[#INDENT_ACTIVE] \{\
2301 .       nr #RESTORE_L_LENGTH \\n(.l
2302 .       if \\n[#INDENT_BOTH_ACTIVE] \{ .ll \\n(.lu-\\n[#BL_INDENT]u \}
2303 .       if \\n[#INDENT_LEFT_ACTIVE] \{ .ll \\n(.lu-\\n[#L_INDENT]u \}
2304 .       PRINT \El'\En(.lu'
2305 .       ll \\n[#RESTORE_L_LENGTH]u
2306 .       rr #RESTORE_L_LENGTH]u
2307 .    \}
2308 .    el \{\
2309 .       PRINT \El'\En(.lu'
2310 .    \}
2311 .    QUAD \\*[$CURRENT_QUAD]
2312 .    rm $CURRENT_QUAD
2313 .    EL
2314 .END
2316 \# =====================================================================
2318 \# +++WORD AND SENTENCE SPACING+++
2320 \# WORD SPACE CONTROL
2321 \# ------------------
2322 \# *Argument:
2323 \#   <+|->wordspace | DEFAULT
2324 \# *Function:
2325 \#   Increases or decreases interword space by user supplied amount.
2326 \#   If DEFAULT, value is set to 12 (groff default).
2327 \# *Notes:
2328 \#   $WS_CONSTANT is the groff default word space.
2329 \#   $WS_VAR is the user supplied amount by which to in/decrease word space.
2330 \#   $WS is a concatenation of WS_CONSTANT and WS_VAR.
2332 \#   Because the user supplied value requires a literal + or - sign,
2333 \#   the macro argument is stored in a string.
2335 \#   \n[.sss] holds the current sentence space value.
2337 .MAC WS END
2338 .    ds $WS_CONSTANT 12
2339 .    ds $WS_VAR \\$1
2340 .    ie '\\$1'DEFAULT' \{ .ds $WS_VAR +0 \}
2341 .    el                \{ .ds $WS (\\*[$WS_CONSTANT]\\*[$WS_VAR]) \}
2342 .    ie \\n[.sss]=12   \{ .ss \\*[$WS] 12 \}
2343 .    el \{\
2344 .       ss \\*[$WS] (\\*[$WS]\\*[$SS_VAR])
2345 .       SS \\*[$SS_VAR]
2346 .    \}
2347 .END
2350 \# SENTENCE SPACE CONTROL
2351 \# ----------------------
2352 \# *Argument:
2353 \#   <+-sentencespace> | 0 | DEFAULT
2354 \# *Function:
2355 \#   Increases or decreases sentence space by user supplied amount.
2356 \#   If 0, sentence spaces are ignored.  If DEFAULT, value is
2357 \#   set to 12 (groff default).
2358 \# *Notes:
2359 \#   Because the user supplied value requires a literal + or - sign,
2360 \#   the macro argument is stored in a string.
2362 \#   Sentence space applies only to input where sentences are separated
2363 \#   by two spaces (and/or, in fill mode [FLUSH L|R|C or JUSTIFY], an EOL).
2364 \#   Changing .SS when sentences are separated by only one space has
2365 \#   no effect on the space between sentences.
2367 \#   \n[.ss] holds the current wordspace value.
2368 \#   \n[.sss] holds the current sentence space value.
2370 .MAC SS END
2371 .    ie '\\$1'0' \{ .ss \\n[.ss] (\\n[.ss]-\\n[.ss]) \}
2372 .    el \{\
2373 .       ie '\\$1'DEFAULT' \{ .ss \\n[.ss] \}
2374 .       el \{\
2375 .          ds $SS_VAR \\$1
2376 .          ss \\n[.ss] (0\\*[$SS_VAR])
2377 .       \}
2378 .    \}
2379 .END
2382 \# =====================================================================
2384 \# +++INDENTS+++
2386 \# There are five styles of indents: left, right, both, temporary,
2387 \# and hanging.  Each is set/invoked with a different macro.
2388 \# Indent macros begin with the letter "I", hence .IL means "indent left,"
2389 \# .IR means "indent right," and so on.
2391 \# The first time any of the indent macros is used, it requires an
2392 \# argument--the size of the indent in ipPcm.  The size may also
2393 \# be entered using the \w'#' function--very useful for numbered
2394 \# lists using HI).  The unit of measure is required.  Subsequent
2395 \# invocations don't require the argument; the indent measure remains the
2396 \# same until it's changed by invoking the macro with an argument again.
2398 \# If no indents are in effect, the arguments passed to indent macros are
2399 \# measured from the left and right margins of the page.  If a left indent
2400 \# or a right indent is already in effect, the arguments passed to
2401 \# the indent macros are calculated from the current values; in other words,
2402 \# the arguments are additive.  If you quit an indent and later return
2403 \# to it, its value will be the value last in effect, unless you pass
2404 \# it an argument.  If you do pass an argument, it is added to the last
2405 \# value in effect, unless you cleared the indent with one of
2406 \# .I<LRB>X macros.
2408 \# Example
2409 \# -------
2411 \# .IL 2P
2412 \# ...some text...
2413 \# .IL 2P
2414 \# ...some text...
2415 \# .IQ
2416 \# ...some text...
2417 \# .IL
2418 \# ...some text...
2420 \# The first .IL 2P indents text 2P from the left margin.  The second
2421 \# .IL 2P indents text by an additional 2P, i.e. 4P from the left margin.
2422 \# .IQ turns the indent off.  The last .IL (which has no argument)
2423 \# takes its value from the total of all arguments passed to .IL (in
2424 \# this case, 2P and 2P), therefore it indents 2P+2P from the left
2425 \# margin, i.e. 4P.  If you wanted the last .IL to indent just 2P,
2426 \# you'd either have to reset the .IL prior to .IQ (.IL -2P), or pass
2427 \# the last .IL the argument 2P.
2429 \# To reverse the sense of an indent added to an indent, you may use
2430 \# negative values.
2432 \# Indents can be turned off individually with ILX, IRX, and IBX.
2433 \# LEFT and RIGHT indents may be combined and manipulated
2434 \# separately, (e.g. you can have an IL of 2P and an IR of 4P
2435 \# operative at the same time, and then change, say, the IL to
2436 \# 4P--thereby left indenting 6P--while the IR remains at 4P.
2438 \# IB automatically turns off IL and IR.  They have to be reinvoked
2439 \# again when needed. IL and IR automatically turn IB off; it, too,
2440 \# has to be reinvoked with needed.
2442 \# All indents can be turned off at once with IQ.  The ILX, IRX, IBX,
2443 \# and IQ macros simply turn the indents off; the values stored in
2444 \# the respective indent macros (IL, IR, IB) remain in effect.  If
2445 \# the user wishes to clear the values, the I<LRB>X macros should be
2446 \# invoked with the single argument CLEAR.  IQ CLEAR clears out
2447 \# the values stored for all indent styles.
2449 \# Indents *must* be turned off before settting string tabs
2450 \# inside PAD.  Generally, in order not to get confused, it's a
2451 \# good idea to turn all indents off before setting any tabs.
2453 \# TI and HI are special cases.  There's no need to turn them off,
2454 \# since they affect only one line--the first after their
2455 \# invocation.  Like the other indent styles, the first time
2456 \# they're invoked, they require a value in iPpcm; each subsequent
2457 \# invocation without an argument will use the same value.  To
2458 \# change the value, simply pass a new value.  Values for TI and HI
2459 \# are *not* additive.
2461 \# HI presupposes that you already have a left or both indent
2462 \# on.  HI will never hang a line outside the left margin of a
2463 \# document.  In other words, you must have IL or IB on before you
2464 \# can use HI.
2466 \# INDENT LEFT
2467 \# -----------
2469 .MAC IL END
2470 .    if \\n[#INDENT_STYLE_BOTH] \{ .IBX \}
2471 .    nr #INDENT_STYLE_LEFT  1
2472 .    nr #INDENT_ACTIVE      1
2473 .    nr #INDENT_LEFT_ACTIVE 1
2474 .    ie '\\$1'' \{\
2475 .       br
2476 .       in \\n[#L_INDENT]u
2477 .       ta \\n(.lu-\\n[#L_INDENT]u
2478 .    \}
2479 .    el \{\
2480 .       br
2481 .       nr #L_INDENT +(\\$1)
2482 .       in \\n[#L_INDENT]u
2483 .       ta \\n(.lu-\\n[#L_INDENT]u
2484 .    \}
2485 .END
2488 \# +++INDENT RIGHT+++
2490 .MAC IR END
2491 .    if \\n[#INDENT_STYLE_BOTH] \{ .IBX \}
2492 .    nr #INDENT_STYLE_RIGHT   1
2493 .    nr #INDENT_ACTIVE        1
2494 .    nr #INDENT_RIGHT_ACTIVE 1
2495 .    ie '\\$1'' \{\
2496 .       br
2497 .       ie \\n[#TAB_ACTIVE] \{\
2498 .          ll \\n(.lu-\\n[#R_INDENT]u
2499 .          ta \\n(.lu-\\n[#L_INDENT]u
2500 .       \}
2501 .       el \{\
2502 .          ll \\n[#L_LENGTH]u-\\n[#R_INDENT]u
2503 .          ta \\n(.lu-\\n[#L_INDENT]u
2504 .       \}
2505 .    \}
2506 .    el \{\
2507 .       br
2508 .       nr #R_INDENT +(\\$1)
2509 .       ie \\n[#TAB_ACTIVE] \{\
2510 .          ll \\n(.lu-\\n[#R_INDENT]u
2511 .          ta \\n(.lu-\\n[#L_INDENT]u
2512 .       \}
2513 .       el \{\
2514 .          ll \\n[#L_LENGTH]u-\\n[#R_INDENT]u
2515 .          ta \\n(.lu-\\n[#L_INDENT]u
2516 .       \}
2517 .    \}
2518 .END
2521 \# +++INDENT BOTH+++
2523 .MAC IB END
2524 .    if \\n[#INDENT_STYLE_LEFT]  \{ .ILX \}
2525 .    if \\n[#INDENT_STYLE_RIGHT] \{ .IRX \}
2526 .    nr #INDENT_STYLE_BOTH  1
2527 .    nr #INDENT_ACTIVE      1
2528 .    nr #INDENT_BOTH_ACTIVE 1
2529 .    ie '\\$1'' \{\
2530 .       br
2531 .       in \\n[#BL_INDENT]u
2532 .       ie \\n[#TAB_ACTIVE] \{\
2533 .          ll \\n(.lu-\\n[#BR_INDENT]u
2534 .          ta \\n(.lu-\\n[#BR_INDENT]u
2535 .       \}
2536 .       el \{\
2537 .          ll \\n[#L_LENGTH]u-\\n[#BR_INDENT]u
2538 .          ta \\n(.lu-\\n[#BR_INDENT]u
2539 .       \}
2540 .    \}
2541 .    el \{\
2542 .       br
2543 .       nr #BL_INDENT (\\n[#INDENT]+\\$1)
2544 .       ie \\n[#NUM_ARGS]=2 \{ .nr #BR_INDENT +(\\$2) \}
2545 .       el                  \{ .nr #BR_INDENT \\n[#BL_INDENT] \}
2546 .       ie \\n[#TAB_ACTIVE] \{\
2547 .          in \\n[#BL_INDENT]u
2548 .          ll \\n(.lu-\\n[#BR_INDENT]u
2549 .          ta \\n(.lu-\\n[#BL_INDENT]u
2550 .       \}
2551 .       el \{\
2552 .          in \\n[#BL_INDENT]u
2553 .          ll \\n[#L_LENGTH]u-\\n[#BR_INDENT]u
2554 .          ta \\n(.lu-\\n[#BR_INDENT]u
2555 .       \}
2556 .    \}
2557 .END
2560 \# +++TEMPORARY INDENT+++
2562 .MAC TI END
2563 .    br
2564 .    ie '\\$1'' \{\
2565 .       ti \\n[#T_INDENT]u
2566 .       if \\n[#INDENT_LEFT_ACTIVE] \{\
2567 .          ti \\n[#T_INDENT]u+\\n[#L_INDENT]u
2568 .       \}
2569 .       if \\n[#INDENT_BOTH_ACTIVE] \{\
2570 .          ti \\n[#T_INDENT]u+\\n[#BL_INDENT]u
2571 .       \}
2572 .    \}
2573 .    el \{\
2574 .       nr #T_INDENT (\\$1)
2575 .       ti \\n[#T_INDENT]u
2576 .    \}
2577 .END
2580 \# +++HANGING INDENT+++
2582 .MAC HI END
2583 .    ie '\\$1'' \{ .ti -\\n[#HL_INDENT]u \}
2584 .    el \{\
2585 .       nr #HL_INDENT (\\$1)
2586 .       ti -\\n[#HL_INDENT]u
2587 .    \}
2588 .END
2591 \# +++INDENTS OFF+++
2593 .MAC ILX END
2594 .    br
2595 .    in 0
2596 .    rr #INDENT_LEFT_ACTIVE
2597 .    if '\\$1'CLEAR' \{\
2598 .       rr #L_INDENT
2599 .       rr #INDENT_STYLE_LEFT
2600 .    \}
2601 .END
2604 .MAC IRX END
2605 .    br
2606 .    rr #INDENT_RIGHT_ACTIVE
2607 .    ie \\n[#TAB_ACTIVE] \{ .TAB\\n[#CURRENT_TAB] \}
2608 .    el \{\
2609 .       ie \\n[#COLUMNS] \{\
2610 .          ll \\n[#COL_L_LENGTH]u
2611 .          ta \\n(.lu
2612 .       \}
2613 .       el \{\
2614 .          ll \\n[#L_LENGTH]u
2615 .          ta \\n(.lu
2616 .       \}
2617 .    \}
2618 .    if '\\$1'CLEAR' \{\
2619 .       rr #R_INDENT
2620 .       rr #INDENT_STYLE_RIGHT
2621 .    \}
2622 .END
2625 .MAC IBX END
2626 .    br
2627 .    in 0
2628 .    rr #INDENT_BOTH_ACTIVE
2629 .    ie \\n[#TAB_ACTIVE] \{ .TAB\\n[#CURRENT_TAB] \}
2630 .    el \{\
2631 .       ie \\n[#COLUMNS] \{\
2632 .          ll \\n[#COL_L_LENGTH]u
2633 .          ta \\n(.lu
2634 .       \}
2635 .       el \{\
2636 .          ll \\n[#L_LENGTH]u
2637 .          ta \\n(.lu
2638 .       \}
2639 .    \}
2640 .    if '\\$1'CLEAR' \{\
2641 .       rr #BL_INDENT
2642 .       rr #BR_INDENT
2643 .       rr #INDENT_STYLE_BOTH
2644 .    \}
2645 .END
2648 .MAC IX END
2649 .    if '\\$0'IX' \{\
2650 .       if !\\n[#IX_WARN] \{\
2651 .          tm1 "[mom]: Use of .IX is now deprecated.  Use .IQ instead.
2652 .          tm1 "      .IX will continue to behave as before, but to
2653 .          tm1 "       avoid this message, please update your document.
2654 .          nr #IX_WARN 1
2655 .       \}
2656 .    \}
2657 .    br
2658 .    in 0
2659 .    rr #INDENT_LEFT_ACTIVE
2660 .    rr #INDENT_RIGHT_ACTIVE
2661 .    rr #INDENT_BOTH_ACTIVE
2662 .    if \\n[#INDENT_STYLE_RIGHT] \{\
2663 .       ie \\n[#TAB_ACTIVE] \{ .TAB\\n[#CURRENT_TAB] \}
2664 .       el \{\
2665 .          ie \\n[#COLUMNS] \{\
2666 .             ll \\n[#COL_L_LENGTH]u
2667 .             ta \\n(.lu
2668 .          \}
2669 .          el \{\
2670 .             ll \\n[#L_LENGTH]u
2671 .             ta \\n(.lu
2672 .          \}
2673 .       \}
2674 .    \}
2675 .    if \\n[#INDENT_STYLE_BOTH] \{\
2676 .       ie \\n[#TAB_ACTIVE] \{ .TAB\\n[#CURRENT_TAB] \}
2677 .       el \{\
2678 .          ie \\n[#COLUMNS] \{\
2679 .             ll \\n[#COL_L_LENGTH]u
2680 .             ta \\n(.lu
2681 .          \}
2682 .          el \{\
2683 .             ll \\n[#L_LENGTH]u
2684 .             ta \\n(.lu
2685 .          \}
2686 .       \}
2687 .    \}
2688 .    if '\\$1'CLEAR' \{\
2689 .       if \\n[#INDENT_STYLE_RIGHT] \{\
2690 .          ie \\n[#TAB_ACTIVE] \{ .TAB\\n[#CURRENT_TAB] \}
2691 .          el \{\
2692 .             ie \\n[#COLUMNS] \{\
2693 .                ll \\n[#COL_L_LENGTH]u
2694 .                ta \\n(.lu
2695 .             \}
2696 .             el \{\
2697 .                ll \\n[#L_LENGTH]u
2698 .                ta \\n(.lu
2699 .             \}
2700 .          \}
2701 .       \}
2702 .       if \\n[#INDENT_STYLE_BOTH] \{\
2703 .          ie \\n[#TAB_ACTIVE] \{ .TAB\\n[#CURRENT_TAB] \}
2704 .          el \{\
2705 .             ie \\n[#COLUMNS] \{\
2706 .                ll \\n[#COL_L_LENGTH]u
2707 .                ta \\n(.lu
2708 .             \}
2709 .             el \{\
2710 .                ll \\n[#L_LENGTH]u
2711 .                ta \\n(.lu
2712 .             \}
2713 .          \}
2714 .       \}
2715 .       rr #L_INDENT
2716 .       rr #R_INDENT
2717 .       rr #BL_INDENT
2718 .       rr #BR_INDENT
2719 .       rr #T_INDENT
2720 .       rr #H_INDENT
2721 .       rr #INDENT_STYLE_LEFT
2722 .       rr #INDENT_STYLE_RIGHT
2723 .       rr #INDENT_STYLE_BOTH
2724 .    \}
2725 .    rr #INDENT_ACTIVE
2726 .END
2728 \# =====================================================================
2730 \# +++MULTIPLE COLUMNS+++
2732 \# MULTIPLE COLUMNS ON
2733 \# -------------------
2734 \# *Arguments:
2735 \#   <none>
2736 \# *Function:
2737 \#   Marks the top of a column set
2739 .MAC MCO END
2740 .mk c
2741 .END
2743 \# MULTIPLE COLUMN RETURN
2744 \# ----------------------
2745 \# *Arguments:
2746 \#   <none>
2747 \# *Function:
2748 \#   Returns to the top of a column set
2750 .MAC MCR END
2751 .    sp |\\ncu
2752 .END
2754 \# MULTIPLE COLUMNS OFF
2755 \# --------------------
2756 \# *Arguments:
2757 \#   <none> | <lead to advance beneath bottom of deepest column>
2758 \# *Function:
2759 \#   Advances to the end of a column set
2760 \# *Notes:
2761 \#   With no argument, advances to the next baseline (at the current
2762 \#   leading value) beneath the longest column.  With an argument
2763 \#   (which requires a unit of measure), advances arg distance
2764 \#   beneath the baseline of the deepest column.  If the argument
2765 \#   is zero, advances to the baseline of the deepest column.
2767 .MAC MCX END
2768 .    ie '\\$1'' \{\
2769 .       TQ
2770 .       sp |\\n(.hu
2771 .    \}
2772 .    el \{\
2773 .       nr #MCX_ALD (\\$1)
2774 .       TQ
2775 .       ie \\n[#MCX_ALD]=0 \{ .sp |\\n(.hu-1v \}
2776 .       el \{ .sp |\\n(.hu+\\n[#MCX_ALD]u \}
2777 .       rr #MCX_ALD (\\$1)
2778 .    \}
2779 .END
2781 \# =====================================================================
2783 \# +++TYPESETTING SUPPORT MACROS+++
2785 \# TRAP
2786 \# ----
2787 \# *Arguments:
2788 \#   toggle
2789 \# *Function:
2790 \#   Enables/disables traps.
2791 \# *Notes:
2792 \#   EL and TN don't function as advertised on the last line before
2793 \#   a trap (when they break the preceding line, they spring the
2794 \#   trap, and groff won't back up to the line preceding the trap).
2795 \#   TRAP is a kludge to get EL and TN work properly on last lines.
2796 \#   The user simply enloses the offending lines in TRAP OFF/TRAP.
2798 .MAC TRAP END
2799 .    ie '\\$1'' \{ .vpt 1 \}
2800 .    el \{ .vpt 0 \}
2801 .END
2804 \# SILENT
2805 \# ------
2806 \# *Arguments:
2807 \#   <none> | <anything>
2808 \# *Function:
2809 \#   Diverts text so that it doesn't print, or turns the function off.
2810 \# *Notes:
2811 \#   Useful for setting up autotabs where you don't want the line with
2812 \#   the tab marks to print.
2814 \#   Also aliased as COMMENT, in case user wants to input a batch of
2815 \#   text that doesn't print.
2817 .MAC SILENT END
2818 .    nr #SILENT 1
2819 .    if \\n[#QUAD] \{ .br \}
2820 .    ie '\\$1'' \{ .di NO_FLASH \}
2821 .    el \{\
2822 .       br
2823 .       di
2824 .       rm NO_FLASH
2825 .       rr #SILENT
2826 .    \}
2827 .END
2830 \# PRINT
2831 \# -----
2832 \# *Arguments:
2833 \#   <anything>
2834 \# *Function:
2835 \#   Prints anything.  A macro that helps keep my code nicely indented.
2837 .MAC PRINT END
2838 \\$*
2839 .END
2842 \# CAPS
2843 \# ----
2844 \# *Arguments:
2845 \#   <none> | <anything>
2846 \# *Function:
2847 \#   Converts text to caps, or, if OFF, reverts to normal caps/lc.
2849 .MAC CAPS END
2850 .    ie '\\$1'' \{\
2851 .       tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
2852 .       tr Ã \[`A]
2853 .       tr Ã¢\[^A]
2854 .       tr Ã¡\['A]
2855 .       tr Ã¤\[:A]
2856 .       tr Ã¥\[oA]
2857 .       tr Ã£\[~A]
2858 .       tr Ã¦\[AE]
2859 .       tr Ã¨\[`E]
2860 .       tr Ãª\[^E]
2861 .       tr Ã©\['E]
2862 .       tr Ã«\[:E]
2863 .       tr Ã¬\[`I]
2864 .       tr Ã®\[^I]
2865 .       tr Ã­\['I]
2866 .       tr Ã¯\[:I]
2867 .       tr Ã²\[`O]
2868 .       tr Ã´\[^O]
2869 .       tr Ã³\['O]
2870 .       tr Ã¶\[:O]
2871 .       tr Ãµ\[~O]
2872 .       tr Ã¸\[/O]
2873 .       tr Ã¹\[`U]
2874 .       tr Ã»\[^U]
2875 .       tr Ãº\['U]
2876 .       tr Ã¼\[:U]
2877 .       tr Ã§\[,C]
2878 .       tr Ã°\[-D]
2879 .       tr Ã±\[~N]
2880 .       tr Ã¾\[TP]
2881 .       tr Ã½\['Y]
2882 .       tr Ã¿\[:Y]
2883 .       nr #CAPS_ON 1
2884 .    \}
2885 .    el \{\
2886 .       tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
2887 .       tr Ã \[`a]
2888 .       tr Ã¢\[^a]
2889 .       tr Ã¡\['a]
2890 .       tr Ã¤\[:a]
2891 .       tr Ã¥\[oa]
2892 .       tr Ã£\[~a]
2893 .       tr Ã¦\[ae]
2894 .       tr Ã¨\[`e]
2895 .       tr Ãª\[^e]
2896 .       tr Ã©\['e]
2897 .       tr Ã«\[:e]
2898 .       tr Ã¬\[`i]
2899 .       tr Ã®\[^i]
2900 .       tr Ã­\['i]
2901 .       tr Ã¯\[:i]
2902 .       tr Ã²\[`o]
2903 .       tr Ã´\[^o]
2904 .       tr Ã³\['o]
2905 .       tr Ã¶\[:o]
2906 .       tr Ãµ\[~o]
2907 .       tr Ã¸\[/o]
2908 .       tr Ã¹\[`u]
2909 .       tr Ã»\[^u]
2910 .       tr Ãº\['u]
2911 .       tr Ã¼\[:u]
2912 .       tr Ã§\[,c]
2913 .       tr Ã°\[Sd]
2914 .       tr Ã±\[~n]
2915 .       tr Ã¾\[Tp]
2916 .       tr Ã½\['y]
2917 .       tr Ã¿\[:y]
2918 .       rr #CAPS_ON
2919 .    \}
2920 .END
2922 \# SIZESPECS
2923 \# ---------
2924 \# Argument:
2925 \#   <none>
2926 \# Function:
2927 \#   Gets cap-height, x-height, and descender depth of the
2928 \#   current font at the current point size.
2929 \# *Notes:
2930 \#   The routine is diverted so it remains invisible to output.
2932 .MAC SIZESPECS END
2933 .    di TYPESIZE
2934 E\\R'#CAP_HEIGHT \\n[.cht]'
2935 e\\R'#X_HEIGHT \\n[.cht]'
2936 y\\R'#DESCENDER \\n[.cdp]'
2937 .    br
2938 .    di
2939 .END
2941 \# =====================================================================
2943 \# +++TYPESETTING ALIASES+++
2945 .ALIAS    CENTRE          CENTER
2946 .ALIAS    COMMENT         SILENT
2947 .ALIAS    CONDENSE        CONDENSE_OR_EXTEND
2948 .ALIAS    EXTEND          CONDENSE_OR_EXTEND
2949 .ALIAS    FAM             FAMILY
2950 .ALIAS    HYPHENATE       HY
2951 .ALIAS    HYPHENATION     HY
2952 .ALIAS    HYSET           HY_SET
2953 .ALIAS    LIG             LIGATURES
2954 .ALIAS    IBQ             IBX
2955 .ALIAS    ILQ             ILX
2956 .ALIAS    IQ              IX
2957 .ALIAS    IRQ             IRX
2958 .ALIAS    PADMARKER       PAD_MARKER
2959 .ALIAS    TABSET          TAB_SET
2960 .ALIAS    TB              TAB
2961 .ALIAS    UNDERSCORE_2    UNDERSCORE2
2964 \# ====================================================================
2966 \# DOCUMENT PROCESSING MACROS, STRINGS AND ALIASES
2967 \# ===============================================
2969 \# +++PAGE DIMENSIONS+++
2971 \# PAPER SIZE
2972 \# ----------
2973 \# *Arguments:
2974 \#   LETTER | LEGAL | STATEMENT | TABLOID | LEDGER | FOLIO | QUARTO | 10x14 | EXECUTIVE | A3 | A4 | A5 | B4 | B5
2975 \# *Function:
2976 \#   Sets up margins for different paper sizes.
2978 .MAC PAPER END
2979 .    ds $PAPER \\$1
2980 .    if '\\*[$PAPER]'LETTER' \{\
2981 .       PAGEWIDTH  8.5i
2982 .       PAGELENGTH 11i
2983 .    \}
2984 .    if '\\*[$PAPER]'LEGAL' \{\
2985 .       PAGEWIDTH  8.5i
2986 .       PAGELENGTH 14i
2987 .    \}
2988 .    if '\\*[$PAPER]'STATEMENT' \{\
2989 .       PAGEWIDTH  5.5i
2990 .       PAGELENGTH 8.5i
2991 .    \}
2992 .    if '\\*[$PAPER]'TABLOID' \{\
2993 .       PAGEWIDTH  11i
2994 .       PAGELENGTH 17i
2995 .    \}
2996 .    if '\\*[$PAPER]'LEDGER' \{\
2997 .       PAGEWIDTH  17i
2998 .       PAGELENGTH 11i
2999 .    \}
3000 .    if '\\*[$PAPER]'FOLIO' \{\
3001 .       PAGEWIDTH  8.5i
3002 .       PAGELENGTH 13i
3003 .    \}
3004 .    if '\\*[$PAPER]'QUARTO' \{\
3005 .       PAGEWIDTH  610p
3006 .       PAGELENGTH 780p
3007 .    \}
3008 .    if '\\*[$PAPER]'10x14' \{\
3009 .       PAGEWIDTH  10i
3010 .       PAGELENGTH 14i
3011 .    \}
3012 .    if '\\*[$PAPER]'EXECUTIVE' \{\
3013 .       PAGEWIDTH  7.25i
3014 .       PAGELENGTH 10.5i
3015 .    \}
3016 .    if '\\*[$PAPER]'A3' \{\
3017 .       PAGEWIDTH  842p
3018 .       PAGELENGTH 1190p
3019 .    \}
3020 .    if '\\*[$PAPER]'A4' \{\
3021 .       PAGEWIDTH  595p
3022 .       PAGELENGTH 842p
3023 .    \}
3024 .    if '\\*[$PAPER]'A5' \{\
3025 .       PAGEWIDTH  421p
3026 .       PAGELENGTH 595p
3027 .    \}
3028 .    if '\\*[$PAPER]'B4' \{\
3029 .       PAGEWIDTH  709p
3030 .       PAGELENGTH 1002p
3031 .    \}
3032 .    if '\\*[$PAPER]'B5' \{\
3033 .       PAGEWIDTH  501p
3034 .       PAGELENGTH 709p
3035 .    \}
3036 .    if !r#L_MARGIN \{ .L_MARGIN \\n(.o \}
3037 .    if !r#R_MARGIN \{ .R_MARGIN 1i \}
3038 .END
3041 \# ====================================================================
3043 \# +++PRINTSTYLE -- TYPEWRITE OR TYPESET+++
3045 \# PRINTSTYLE
3046 \# ----------
3047 \# *Arguments:
3048 \#   TYPESET | TYPEWRITE [SINGLESPACE]
3049 \# *Function:
3050 \#   Sets type specs for typewriter-style or typeset output.
3051 \# *Notes:
3052 \#   Number registers: TYPEWRITE=1, TYPESET=2.
3054 .MAC PRINTSTYLE END
3055 .    if !d$PAPER \{ .PAPER LETTER \}
3056 .    if '\\$1'TYPEWRITE' \{\
3057 .       nr #PRINT_STYLE 1
3058 .       if !\\n[#DOC_TYPE]=4 \{ .L_MARGIN 6P \}
3059 .       if !\\n[#DOC_TYPE]=4 \{ .R_MARGIN 6P \}
3060 .       fam  C
3061 .       ft   R
3062 .       ps   12
3063 .       ie '\\$2'SINGLESPACE' \{\
3064 .           nr #SINGLE_SPACE 1
3065 .           vs 12
3066 .       \}
3067 .       el \{ .vs 24 \}
3068 .       QUAD    L
3069 .       HY      OFF
3070 .       SMARTQUOTES OFF
3071 .       if !\\n[#PP_INDENT] \{\
3072 .          in 3P                 \"Set indent
3073 .          nr #PP_INDENT \\n(.i  \"Read into #PP_INDENT
3074 .          in 0                  \"Remove indent
3075 .       \}
3076 .       HDRFTR_RIGHT_CAPS
3077 .       nr #BOLDER_UNITS 0
3078 .       nr #CONDENSE 0
3079 .       nr #EXTEND 0
3080 .       rm IT
3081 .       rm BD
3082 .       rm BDI
3083 .       rm PREV
3084 .       UNDERLINE_SLANT
3085 .       UNDERLINE_ITALIC
3086 .       UNDERLINE_QUOTES
3087 .       nr #IGNORE_COLUMNS 1
3088 .       char \(em --
3089 .    \}
3090 .    if '\\$1'TYPESET' \{\
3091 .       nr #PRINT_STYLE 2
3092 .       if !\\n[#DOC_TYPE]=4 \{ .L_MARGIN 6P \}
3093 .       if !\\n[#DOC_TYPE]=4 \{ .R_MARGIN 6P \}
3094 .       FAMILY  T
3095 .       FT      R
3096 .       if !\\n[#DOC_TYPE]=4 \{ .PT_SIZE 12.5 \}
3097 .       if !\\n[#DOC_TYPE]=4 \{ .LS 16 \}
3098 .       JUSTIFY
3099 .       HY
3100 .       HY_SET 2 36p 1p
3101 .       KERN
3102 .       LIG
3103 .       SS 0
3104 .       SMARTQUOTES
3105 .       if !\\n[#PP_INDENT] \{\
3106 .          in 2m                 \"Set indent
3107 .          nr #PP_INDENT \\n(.i  \"Read into #PP_INDENT
3108 .          in 0                  \"Remove indent
3109 .       \}
3110 .       HDRFTR_RIGHT_CAPS
3111 .       rr #IGNORE_COLUMNS
3112 .    \}
3113 .END
3116 \# Macros to control behaviour of PRINTSTYLE TYPEWRITE
3118 \# ITALIC MEANS ITALIC
3119 \# -------------------
3120 \# *Argument:
3121 \#   <none>
3122 \# *Function:
3123 \#   Instructs TYPEWRITE to treat italics as italics, whether
3124 \#   invoked via control lines or inline.
3125 \# *Notes:
3126 \#   ITALIC_MEANS_ITALIC and UNDERLINE_ITALIC are mututally exclusive,
3127 \#   hence invoking the one automatically turns off the other.
3129 .MAC ITALIC_MEANS_ITALIC END
3130 .    if \\n[#PRINT_STYLE]=1 \{\
3131 .       nr #ITALIC_MEANS_ITALIC 1
3132 .       rr #UNDERLINE_ITALIC
3133 .       rm ROM
3134 .       rm IT
3135 .       rm PREV
3136 .       ds ROM  \EfR
3137 .       ds IT   \EfI
3138 .       ds PREV \EfR
3139 .    \}
3140 .END
3143 \# UNDERLINE ITALIC
3144 \# ----------------
3145 \# *Argument:
3146 \#   <none>
3147 \# *Function:
3148 \#   Instructs TYPEWRITE to underline italics, whether invoked
3149 \#   via control lines or inline.
3150 \# *Notes:
3151 \#   UNDERLINE_ITALIC and ITALIC_MEANS_ITALIC are mututally exclusive,
3152 \#   hence invoking the one automatically turns off the other.
3154 \#   UNDERLINE_ITALIC is the default for TYPEWRITE.
3156 .MAC UNDERLINE_ITALIC END
3157 .    if \\n[#PRINT_STYLE]=1 \{\
3158 .       nr #UNDERLINE_ITALIC 1
3159 .       rr #ITALIC_MEANS_ITALIC
3160 .       rm ROM
3161 .       rm IT
3162 .       rm PREV
3163 .       ds ROM  \E*[ULX]
3164 .       ds IT   \E*[UL]
3165 .       ds PREV \E*[ULX]
3166 .    \}
3167 .END
3170 \# UNDERLINE SLANT
3171 \# ---------------
3172 \# *Arguments:
3173 \#   <none> | <anything>
3174 \# *Function:
3175 \#   Instructs TYPEWRITE to underline occurences of \*[SLANT], or
3176 \#   turns feature off.
3177 \# *Notes:
3178 \#   Users may want \*[SLANT] to mean slant in TYPEWRITE, although
3179 \#   most of the time, \*[SLANT] most likely means the user wanted
3180 \#   italic but didn't have it, ergo the need to tell TYPEWRITE to
3181 \#   treat \*[SLANT] as italic (i.e. underlined).
3183 \#   UNDERLINE_SLANT and SLANT_MEANS_SLANT are mututally exclusive,
3184 \#   hence invoking the one automatically turns off the other.
3186 \#   UNDERLINE_SLANT is the default for TYPEWRITE.
3188 .MAC UNDERLINE_SLANT END
3189 .    if \\n[#PRINT_STYLE]=1 \{\
3190 .       rr #SLANT_MEANS_SLANT
3191 .       nr #UNDERLINE_SLANT 1
3192 .       rm SLANT
3193 .       rm SLANTX
3194 .       ds SLANT  \ER'#SLANT_ON 1'\E*[UL]
3195 .       ds SLANTX \ER'#SLANT_ON 0'\E*[ULX]
3196 .    \}
3197 .END
3200 .MAC SLANT_MEANS_SLANT END
3201 .    if \\n[#PRINT_STYLE]=1 \{\
3202 .       rr #UNDERLINE_SLANT
3203 .       nr #SLANT_MEANS_SLANT 1
3204 .       rm SLANT
3205 .       rm SLANTX
3206 .       ds SLANT  \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
3207 .       ds SLANTX \ER'#SLANT_ON 0'\ES'0'
3208 .    \}
3209 .END
3212 .MAC IGNORE_COLUMNS END
3213 .    if \\n[#PRINT_STYLE]=1 \{ .nr #NO_COLUMNS 1 \}
3214 .END
3217 \# ====================================================================
3219 \# +++COPY STYLE -- DRAFT OR FINAL+++
3221 \# COPY STYLE
3222 \# ----------
3223 \# *Arguments:
3224 \#   DRAFT | FINAL
3225 \# *Function:
3226 \#   Sets registers that are used to determine what to put
3227 \#   in the default header, and how to number pages.
3228 \# *Notes:
3229 \#   DOCTYPE must come before COPYSTYLE.
3231 .MAC COPYSTYLE END
3232 .    ds $COPY_STYLE \\$1
3233 .    if '\\*[$COPY_STYLE]'DRAFT' \{\
3234 .       nr #COPY_STYLE 1
3235 .       if !d$DRAFT \{ .DRAFT 1 \}
3236 .    \}
3237 .    if '\\*[$COPY_STYLE]'FINAL' \{ .nr #COPY_STYLE 2         \}
3238 .    if !d$CHAPTER_STRING        \{ .CHAPTER_STRING "Chapter" \}
3239 .    if !d$DRAFT_STRING          \{ .DRAFT_STRING "Draft"     \}
3240 .    if !d$REVISION_STRING       \{ .REVISION_STRING "Rev."   \}
3241 \# Default
3242 .    if \\n[#DOC_TYPE]=1 \{\
3243 .       ie \\n[#COPY_STYLE]=1 \{\
3244 .          ie \\n[#PAGENUM_STYLE_SET] \{ .PAGENUM_STYLE \\*[$PAGENUM_STYLE] \}
3245 .          el \{ .PAGENUM_STYLE roman \}
3246 .          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
3247 .             ie \\n[#DRAFT_WITH_PAGENUM] \{\
3248 .                ds $HDRFTR_CENTER
3249 .             \}
3250 .             el \{\
3251 .                ie '\\*[$REVISION]'' \{\
3252 .                   ds $HDRFTR_CENTER \
3253                     \\*[$DRAFT_STRING]\\*[$DRAFT]
3254 .                \}
3255 .                el \{\
3256 .                   ds $HDRFTR_CENTER \
3257                     \\*[$DRAFT_STRING]\\*[$DRAFT], \
3258                     \\*[$REVISION_STRING] \\*[$REVISION]
3259 .                \}
3260 .             \}
3261 .          \}
3262 .       \}
3263 .       el \{\
3264 .          ie \\n[#PAGENUM_STYLE_SET] \{ .PAGENUM_STYLE \\*[$PAGENUM_STYLE] \}
3265 .          el \{ .PAGENUM_STYLE DIGIT \}
3266 .          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
3267 .             ds $HDRFTR_CENTER
3268 .             rr #USER_DEF_HDRFTR_CENTER
3269 .          \}
3270 .       \}
3271 .    \}
3272 \# Chapter
3273 .    if \\n[#DOC_TYPE]=2 \{\
3274 \# Copystyle DRAFT
3275 .       ie \\n[#COPY_STYLE]=1 \{\
3276 .          ie \\n[#PAGENUM_STYLE_SET] \{ .PAGENUM_STYLE \\*[$PAGENUM_STYLE] \}
3277 .          el \{ .PAGENUM_STYLE roman \}
3278 .          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
3279 .             ie \\n[#DRAFT_WITH_PAGENUM] \{\
3280 .                ie '\\*[$CHAPTER]'' \{\
3281 .                   ie !'\\*[$CHAPTER_TITLE]'' \{\
3282 .                      ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
3283 .                   \}
3284 .                   el \{ .ds $HDRFTR_CENTER \\*[$CHAPTER_STRING] \}
3285 .                \}
3286 .                el \{\
3287 .                   ie !'\\*[$CHAPTER_TITLE]'' \{\
3288 .                      ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
3289 .                   \}
3290 .                   el \{ .ds $HDRFTR_CENTER \\*[$CHAPTER_STRING] \\*[$CHAPTER] \}
3291 .                \}
3292 .             \}
3293 .             el \{\
3294 .                ie '\\*[$REVISION]'' \{\
3295 .                   ie '\\*[$CHAPTER]'' \{\
3296 .                      ie !'\\*[$CHAPTER_TITLE]'' \{\
3297 .                         ie '\\*[$DRAFT]'' \{\
3298 .                            ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
3299 .                         \}
3300 .                         el \{\
3301 .                            ds $HDRFTR_CENTER \
3302                              \\*[$CHAPTER_TITLE], \
3303                              \\*[$DRAFT_STRING]\\*[$DRAFT]
3304 .                         \}
3305 .                      \}
3306 .                      el \{\
3307 .                         ie '\\*[$DRAFT]'' \{\
3308 .                            ds $HDRFTR_CENTER \
3309                              \\*[$CHAPTER_STRING]
3310 .                         \}
3311 .                         el \{\
3312 .                            ds $HDRFTR_CENTER \
3313                              \\*[$CHAPTER_STRING], \
3314                              \\*[$DRAFT_STRING]\\*[$DRAFT]
3315 .                         \}
3316 .                      \}
3317 .                   \}
3318 .                   el \{\
3319 .                      ie !'\\*[$CHAPTER_TITLE]'' \{\
3320 .                         ie '\\*[$DRAFT]'' \{\
3321 .                            ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
3322 .                         \}
3323 .                         el \{\
3324 .                            ds $HDRFTR_CENTER \
3325                              \\*[$CHAPTER_TITLE], \
3326                              \\*[$DRAFT_STRING]\\*[$DRAFT]
3327 .                         \}
3328 .                      \}
3329 .                      el \{\
3330 .                         ie '\\*[$DRAFT]'' \{\
3331 .                            ds $HDRFTR_CENTER \
3332                              \\*[$CHAPTER_STRING] \\*[$CHAPTER]
3333 .                         \}
3334 .                         el \{\
3335 .                            ds $HDRFTR_CENTER \
3336                              \\*[$CHAPTER_STRING] \\*[$CHAPTER], \
3337                              \\*[$DRAFT_STRING]\\*[$DRAFT]
3338 .                         \}
3339 .                      \}
3340 .                   \}
3341 .                \}
3342 .                el \{\
3343 .                   ie '\\*[$CHAPTER]'' \{\
3344 .                      ie !'\\*[$CHAPTER_TITLE]'' \{\
3345 .                         ie '\\*[$DRAFT]'' \{\
3346 .                            ds $HDRFTR_CENTER \
3347                              \\*[$CHAPTER_TITLE], \
3348                              \\*[$REVISION_STRING] \\*[$REVISION] 
3349 .                         \}
3350 .                         el \{\
3351 .                            ds $HDRFTR_CENTER \
3352                              \\*[$CHAPTER_TITLE], \
3353                              \\*[$DRAFT_STRING]\\*[$DRAFT], \
3354                              \\*[$REVISION_STRING] \\*[$REVISION] 
3355 .                         \}
3356 .                      \}
3357 .                      el \{\
3358 .                         ie '\\*[$DRAFT]'' \{\
3359 .                            ds $HDRFTR_CENTER \
3360                              \\*[$CHAPTER_STRING], \
3361                              \\*[$REVISION_STRING] \\*[$REVISION] 
3362 .                         \}
3363 .                         el \{\
3364 .                            ds $HDRFTR_CENTER \
3365                              \\*[$CHAPTER_STRING], \
3366                              \\*[$DRAFT_STRING]\\*[$DRAFT], \
3367                              \\*[$REVISION_STRING] \\*[$REVISION] 
3368 .                         \}
3369 .                      \}
3370 .                   \}
3371 .                   el \{\
3372 .                      ie !'\\*[$CHAPTER_TITLE]'' \{\
3373 .                         ie '\\*[$DRAFT]'' \{\
3374 .                            ds $HDRFTR_CENTER \
3375                              \\*[$CHAPTER_TITLE], \
3376                              \\*[$REVISION_STRING] \\*[$REVISION] 
3377 .                         \}
3378 .                         el \{\
3379 .                            ds $HDRFTR_CENTER \
3380                              \\*[$CHAPTER_TITLE], \
3381                              \\*[$DRAFT_STRING]\\*[$DRAFT], \
3382                              \\*[$REVISION_STRING] \\*[$REVISION] 
3383 .                         \}
3384 .                      \}
3385 .                      el \{\
3386 .                         ie '\\*[$DRAFT]'' \{\
3387 .                            ds $HDRFTR_CENTER \
3388                              \\*[$CHAPTER_STRING] \\*[$CHAPTER], \
3389                              \\*[$REVISION_STRING] \\*[$REVISION] 
3390 .                         \}
3391 .                         el \{
3392 .                            ds $HDRFTR_CENTER \
3393                              \\*[$CHAPTER_STRING] \\*[$CHAPTER], \
3394                              \\*[$DRAFT_STRING]\\*[$DRAFT], \
3395                              \\*[$REVISION_STRING] \\*[$REVISION] 
3396 .                         \}
3397 .                      \}
3398 .                   \}
3399 .                \}
3400 .             \}
3401 .          \}
3402 .       \}
3403 \# Copystyle FINAL
3404 .       el \{\
3405 .          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
3406 .             ie \\n[#PAGENUM_STYLE_SET] \{ .PAGENUM_STYLE \\*[$PAGENUM_STYLE] \}
3407 .             el \{ .PAGENUM_STYLE DIGIT \}
3408 .             ie '\\*[$CHAPTER]'' \{\
3409 .                ie !'\\*[$CHAPTER_TITLE]'' \{\
3410 .                   ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
3411 .                \}
3412 .                el \{\
3413 .                   ds $HDRFTR_CENTER \\*[$CHAPTER_STRING]
3414 .                \}
3415 .             \}
3416 .             el \{\
3417 .                ie !'\\*[$CHAPTER_TITLE]'' \{\
3418 .                   ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
3419 .                \}
3420 .                el \{\
3421 .                   ds $HDRFTR_CENTER \\*[$CHAPTER_STRING] \\*[$CHAPTER]
3422 .                \}
3423 .             \}
3424 .          \}
3425 .       \}
3426 .    \}
3427 \# Named
3428 .    if \\n[#DOC_TYPE]=3 \{\
3429 .       ie \\n[#COPY_STYLE]=1 \{\
3430 .          ie \\n[#PAGENUM_STYLE_SET] \{ .PAGENUM_STYLE \\*[$PAGENUM_STYLE] \}
3431 .          el \{ .PAGENUM_STYLE roman \}
3432 .          ie \\n[#DRAFT_WITH_PAGENUM] \{\
3433 .             ds $HDRFTR_CENTER \\*[$DOC_TYPE]
3434 .          \}
3435 .          el \{\
3436 .             if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
3437 .                ie '\\*[$REVISION]'' \{\
3438 .                   ie '\\*[$DRAFT]'' \{\
3439 .                      ds $HDRFTR_CENTER \\*[$DOC_TYPE]
3440 .                   \}
3441 .                   el \{\
3442 .                      ds $HDRFTR_CENTER \
3443                        \\*[$DOC_TYPE], \
3444                        \\*[$DRAFT_STRING]\\*[$DRAFT]
3445 .                   \}
3446 .                \}
3447 .                el \{\
3448 .                   ie '\\*[$DRAFT]'' \{\
3449 .                      ds $HDRFTR_CENTER \
3450                        \\*[$DOC_TYPE], \
3451                        \\*[$REVISION_STRING] \\*[$REVISION]
3452 .                   \}
3453 .                   el \{\
3454 .                      ds $HDRFTR_CENTER \
3455                        \\*[$DOC_TYPE], \
3456                        \\*[$DRAFT_STRING]\\*[$DRAFT], \
3457                        \\*[$REVISION_STRING] \\*[$REVISION]
3458 .                   \}
3459 .                \}
3460 .             \}
3461 .          \}
3462 .       \}
3463 .       el \{\
3464 .          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
3465 .             ie \\n[#PAGENUM_STYLE_SET] \{ .PAGENUM_STYLE \\*[$PAGENUM_STYLE] \}
3466 .             el \{ .PAGENUM_STYLE DIGIT \}
3467 .             ds $HDRFTR_CENTER \\*[$DOC_TYPE]
3468 .          \}
3469 .       \}
3470 .    \}
3471 .END
3473 \# ====================================================================
3475 \# +++COLLECT DOC INFO -- STRINGS AND NUMBER REGISTERS+++
3477 \# *Arguments:
3478 \#   various string/register arguments
3479 \# *Function:
3480 \#   Collect information about documents.
3483 .MAC DOC_TITLE END
3484 .    ds $DOC_TITLE \\$1
3485 .END
3487 .MAC TITLE END \"Document title
3488 .    ds $TITLE \\$1
3489 .END
3492 .MAC SUBTITLE END \"Document sub-title
3493 .    ds $SUBTITLE \\$1
3494 .END
3497 .MAC CHAPTER END \"If document is a chapter, the chapter number
3498 .    ds $CHAPTER \\$1
3499 .END
3502 .MAC CHAPTER_TITLE END \" This defines what comes after Chapter #
3503 .    ds $CHAPTER_TITLE \\$1
3504 .END
3507 .MAC DRAFT END \"Draft number
3508 .    ie '\\$1'' \{ .ds $DRAFT \}
3509 .    el         \{ .ds $DRAFT " \\$1\}
3510 .END
3513 .MAC REVISION END \"Revision number
3514 .    ds $REVISION \\$1
3515 .END
3518 .MAC DRAFT_WITH_PAGENUMBER END \"Attach draft/revision strings to page number
3519 .    nr #DRAFT_WITH_PAGENUM 1
3520 .END
3523 .MAC AUTHOR END \"Author.  Enclose all args fully in double quotes.
3524 .    nr #AUTHOR_NUM -1 1
3525 .    while \\n[#NUM_ARGS]>\\n[#AUTHOR_NUM] \{\
3526 .       ds $AUTHOR_\\n+[#AUTHOR_NUM] \\$\\n[#AUTHOR_NUM]
3527 .    \}
3528 .    nr #NUM_AUTHORS \\n[#NUM_ARGS]%2 \"Use mod 2 to test if odd or even # of authors
3529 .    ie \\n[#NUM_AUTHORS]=1 \{ .nr #AUTHOR_LINES 0  \}
3530 .    el \{ .nr #AUTHOR_LINES 1 \}
3531 .END
3534 .MAC PAGENUMBER END \"Page # that appears on page one.
3535 .    nr #n%_AT_PAGENUM_SET \\n%
3536 .    nr #PAGE_NUM_ADJ \\$1-\\n[#n%_AT_PAGENUM_SET]
3537 .    rr #n%_AT_PAGENUM_SET
3538 .    nr #PAGE_NUM_SET 1
3539 .END
3541 \# ====================================================================
3543 \# +++TYPE OF DOCUMENT+++
3545 \# DOCUMENT TYPE
3546 \# -------------
3547 \# *Argument:
3548 \#   DEFAULT | CHAPTER | NAMED "<whatever> | LETTER
3549 \# *Function:
3550 \#   Creates strings and sets registers for document types.
3551 \# *Notes:
3552 \#   Number registers: DEFAULT=1, CHAPTER=2, NAMED=3, LETTER=4
3554 .MAC DOCTYPE END
3555 .    if '\\$1'DEFAULT' \{\
3556 .       nr #DOC_TYPE 1
3557 .    \}
3558 .    if '\\$1'CHAPTER' \{\
3559 .       nr #DOC_TYPE 2
3560 .    \}
3561 .    if '\\$1'NAMED' \{\
3562 .       ds $DOC_TYPE \\$2
3563 .       nr #DOC_TYPE 3
3564 .    \}
3565 .    if '\\$1'LETTER' \{\
3566 .       nr #DOC_TYPE 4
3567 .       L_MARGIN 1.125i
3568 .       R_MARGIN 1.125i
3569 .       PT_SIZE 12
3570 .       LS 13.5
3571 .       DOCHEADER OFF
3572 .       PARA_INDENT 3m
3573 .       INDENT_FIRST_PARAS
3574 .       PARA_SPACE
3575 .       ds $SUITE \En[#SUITE]
3576 .       HEADER_MARGIN 3P+6p
3577 .       HEADER_GAP 3P
3578 .       FOOTERS
3579 .       FOOTER_RULE OFF
3580 .       FOOTER_LEFT ""
3581 .       FOOTER_CENTER ""
3582 .       FOOTER_RIGHT_SIZE +0
3583 .       FOOTER_RIGHT ".../\E*[$SUITE]
3584 .       FOOTER_ON_FIRST_PAGE
3585 .       em ALL_DONE
3586 .    \}
3587 .END
3589 \# +++LETTER MACROS+++
3591 \# DATE
3592 \# ----
3593 \# *Arguments:
3594 \#   <date string>
3595 \# *Function:
3596 \#   Stores date string in string $DATE.
3598 .MAC DATE END
3599 .    nr #DATE 1
3600 .    di DATE
3601 .    RIGHT
3602 .END
3605 \# TO
3606 \# --
3607 \# *Arguments:
3608 \#   <none>
3609 \# *Function:
3610 \#  Stores "to" info in diversion TO_ADDRESS.
3612 .MAC TO END
3613 .    if !'\\n(.z'' \{ .di \}
3614 .    nr #TO 1
3615 .    di TO_ADDRESS
3616 .    LEFT
3617 .END
3620 \# FROM
3621 \# ----
3622 \# *Arguments:
3623 \#   <none>
3624 \# *Function:
3625 \#  Stores "from" info in diversion FROM_ADDRESS.
3627 .MAC FROM END
3628 .    if !'\\n(.z'' \{ .di \}
3629 .    nr #FROM 1
3630 .    di FROM_ADDRESS
3631 .    LEFT
3632 .END
3635 \# GREETING
3636 \# --------
3637 \# *Arguments:
3638 \#   <greeting string>
3639 \# *Function:
3640 \#   Stores greeting in string $GREETING.
3642 .MAC GREETING END
3643 .    if !'\\n(.z'' \{ .di \}
3644 .    nr #GREETING 1
3645 .    di GREETING
3646 .    LEFT
3647 .END
3650 \# CLOSING
3651 \# -------
3652 \# *Arguments:
3653 \#   <closing string>
3654 \# *Function:
3655 \#   Stores greeting in string $CLOSING.
3657 .MAC CLOSING END
3658 .    br
3659 .    nr #CLOSING 1
3660 .    di CLOSING
3661 .    LEFT
3662 .END
3665 \# NO SUITE
3666 \# --------
3667 \# *Arguments:
3668 \#   <none>
3669 \# *Function:
3670 \#   Redefines $SUITE to blank so that a suite number doesn't
3671 \#   appear at the bottom of letter pages.
3673 .MAC NO_SUITE END
3674 .    FOOTER_RIGHT ""
3675 .END
3677 \# ====================================================================
3679 \# +++DEFAULTS+++
3681 \# DEFAULTS
3682 \# --------
3683 \# *Arguments:
3684 \#   <none>
3685 \# *Function:
3686 \#   Sets up defaults if no values are entered prior to START.
3687 \# *Notes:
3688 \#   The defaults for $CHAPTER_STRING, $DRAFT_STRING, and
3689 \#   $REVISION_STRING are in the COPYSTYLE macro.
3691 .MAC DEFAULTS END
3692 .    if !d$PAPER \{ .PAPER LETTER \}
3693 .    if !\\n[#DOC_TYPE]   \{ .DOCTYPE DEFAULT \}
3694 .    ie \\n[#PAGENUM_STYLE_SET] \{ .PAGENUM_STYLE \\*[$PAGENUM_STYLE] \}
3695 .    el \{\
3696 .       if !\\n[#COPY_STYLE]=1 \{ .PAGENUM_STYLE DIGIT \}
3697 .    \}
3698 .    if !\\n[#COPY_STYLE] \{ .COPYSTYLE FINAL \}
3699 .    if \\n[#DRAFT_WITH_PAGENUM] \{ .COPYSTYLE \\*[$COPY_STYLE] \}
3700 .    if \\n[#DOC_TYPE]=4 \{\
3701 .       if !\\n[#USER_SET_L_LENGTH] \{\
3702 .          R_MARGIN \\n[#R_MARGIN]u
3703 .          rr #USER_SET_L_LENGTH
3704 .       \}
3705 .       if \\n[#PRINT_STYLE]=1 \{ .PRINTSTYLE TYPEWRITE SINGLESPACE \}
3706 .    \}
3707 .    if \\n[#COPY_STYLE]=1 \{\
3708 .       COPYSTYLE DRAFT
3709 .       PAGENUMBER 1
3710 .    \}
3711 .    if !r#DOC_HEADER \{ .DOCHEADER  \}
3712 .    if !r#HEADERS_ON \{ .HEADERS    \}
3713 .    if !r#PAGINATE   \{ .PAGINATE   \}
3714 .    if \\n[#FOOTERS_ON] \{\
3715 .       HEADERS OFF
3716 .       if \\n[#PAGE_NUM_POS_SET]=0 \{ .PAGENUM_POS TOP CENTER \}
3717 .    \}
3718 .    if !r#HEADER_MARGIN \{ .HEADER_MARGIN 4P+6p \}
3719 .    if !r#HEADER_GAP    \{ .HEADER_GAP    3P    \}
3720 .    if \\n[#FOOTERS_ON] \{\
3721 .       if \\n[#PAGINATE]=0 \{\
3722 .          if !r#T_MARGIN \{ .T_MARGIN 6P \}
3723 .       \}
3724 .    \}
3725 .    if \\n[#HEADERS_ON]=0    \{\
3726 .       if \\n[#FOOTERS_ON]=0 \{\
3727 .          if !r#T_MARGIN \{ .T_MARGIN 6P \}
3728 .       \}
3729 .    \}
3730 .    if !r#T_MARGIN          \{ .T_MARGIN \\n[#HEADER_MARGIN]+\\n[#HEADER_GAP] \}
3731 .    if !r#DOCHEADER_ADVANCE \{ .DOCHEADER_ADVANCE \\n[#T_MARGIN] \}
3732 .    if !r#FOOTER_MARGIN     \{ .FOOTER_MARGIN 3P \}
3733 .    if !r#FOOTER_GAP        \{ .FOOTER_GAP    3P \}
3734 .    if !r#B_MARGIN          \{ .B_MARGIN \\n[#FOOTER_MARGIN]u+\\n[#FOOTER_GAP]u \}
3735 .    if (\\n[#FOOTER_MARGIN]+\\n(.v)>\\n[#B_MARGIN] \{\
3736 .       tm1 "[mom]: Your chosen bottom margin for running text is too close to the footer margin.
3737 .       tm1 "       No footers or bottom-of-page page numbers will be printed.
3738 .       tm1 "       Please reset B_MARGIN or FOOTER_MARGIN to allow enough space.
3739 .       tm1 "       If no footers or bottom-of-page page numbers are required,
3740 .       tm1 "       place .FOOTER_MARGIN 0 before .START
3741 .    \}
3742 .    if !r#HDRFTR_RULE_GAP   \{\
3743 .       if \\n[#HEADERS_ON]  \{ .HDRFTR_RULE_GAP 4p \}
3744 .       if \\n[#FOOTERS_ON]  \{ .HDRFTR_RULE_GAP 4p \}
3745 .    \}
3746 .    if !r#HDRFTR_RULE       \{ .HDRFTR_RULE        \}
3747 .    if !r#PAGE_NUM_SET      \{ .PAGENUMBER 1       \}
3748 .    ie r#ADJ_DOC_LEAD \{ . \}
3749 .    el \{ .DOC_LEAD_ADJUST \}
3750 \# Read in number registers and strings for type parameters
3751 .    nr #DOC_L_MARGIN \\n[#L_MARGIN]
3752 .    nr #DOC_L_LENGTH \\n[#L_LENGTH]
3753 .    nr #DOC_R_MARGIN \\n[#PAGE_WIDTH]-(\\n[#DOC_L_MARGIN]+\\n[#L_LENGTH])
3754 .    ds $DOC_FAM      \\*[$FAMILY]
3755 .    nr #DOC_PT_SIZE  \\n[#PT_SIZE]
3756 .    nr #DOC_LEAD     \\n[#LEAD]
3757 .    ds $DOC_QUAD     \\*[$QUAD_VALUE]
3758 .    ds $PP_FT        \\*[$FONT]
3759 \# Counters
3760 .    nr #PP 0
3761 .    nr #FN_NUMBER 0 1
3762 .    nr #EN_NUMBER 0 1
3763 .    nr #FN_COUNT_FOR_COLS 0 1
3764 .    RESET_HEAD_NUMBER
3765 .    RESET_SUBHEAD_NUMBER
3766 .    RESET_PARAHEAD_NUMBER
3767 \# General style defaults for both PRINTSTYLEs
3768 .    nr #PP_STYLE 1
3769 .    PARA_INDENT \\n[#PP_INDENT]u
3770 .    if !d$HDRFTR_FAM           \{ .HDRFTR_FAMILY  \\*[$DOC_FAM] \}
3771 .    if !d$HDRFTR_SIZE_CHANGE   \{ .HDRFTR_SIZE    +0            \}
3772 .    if !d$PAGE_NUM_FAM         \{ .PAGENUM_FAMILY \\*[$DOC_FAM] \}
3773 .    if !d$PAGE_NUM_FT          \{ .PAGENUM_FONT   R             \}
3774 .    if !d$PAGE_NUM_SIZE_CHANGE \{ .PAGENUM_SIZE   +0            \}
3775 .    if !r#PAGE_NUM_POS_SET     \{ .PAGENUM_POS BOTTOM CENTER    \}
3776 .    ie \\n[#PAGE_NUM_HYPHENS_SET] \{\
3777 .       if \\n[#PAGE_NUM_HYPHENS]=0  \{ .PAGENUM_HYPHENS OFF \}
3778 .       if \\n[#PAGE_NUM_HYPHENS]=1  \{ .PAGENUM_HYPHENS     \}
3779 .    \}
3780 .    el \{ .PAGENUM_HYPHENS \}
3781 .    if !d$HEAD_QUAD         \{ .HEAD_QUAD CENTER  \}
3782 .    if !r#HEAD_CAPS         \{ .HEAD_CAPS         \}
3783 .    if !r#HEAD_UNDERLINE    \{ .HEAD_UNDERLINE    \}
3784 .    if !d$SH_QUAD           \{ .SUBHEAD_QUAD LEFT \}
3785 .    if !r#HDRFTR_RIGHT_CAPS \{ .HDRFTR_RIGHT_CAPS \}
3786 .    if \\n[#HDRFTR_RIGHT_CAPS]=0 \{\
3787 .       if !d$HDRFTR_RIGHT_SIZE_CHANGE \{ .HDRFTR_RIGHT_SIZE +0 \}
3788 .    \}
3789 .    if !d$FN_FAM          \{ .FOOTNOTE_FAMILY \\*[$DOC_FAM] \}
3790 .    if !d$FN_FT           \{ .FOOTNOTE_FONT R               \}
3791 .    if !d$FN_QUAD         \{ .FOOTNOTE_QUAD \\*[$DOC_QUAD]  \}
3792 .    if !r#FN_RULE         \{ .FOOTNOTE_RULE                 \}
3793 .    if !r#FN_MARKERS      \{ .FOOTNOTE_MARKERS              \}
3794 .    if !r#FN_MARKER_STYLE \{ .FOOTNOTE_MARKER_STYLE STAR    \}
3795 .    if !d$EN_PN_STYLE          \{ .ENDNOTES_PAGENUM_STYLE digit        \}
3796 .    if !d$EN_FAM               \{ .ENDNOTE_FAMILY \\*[$DOC_FAM]        \}
3797 .    if !d$EN_FN                \{ .ENDNOTE_FONT R                      \}
3798 .    if !d$EN_QUAD              \{ .ENDNOTE_QUAD \\*[$DOC_QUAD]         \}
3799 .    if !d$EN_STRING            \{ .ENDNOTE_STRING "Endnotes"           \}
3800 .    if !d$EN_STRING_FAM        \{ .ENDNOTE_STRING_FAMILY \\*[$EN_FAM]  \}
3801 .    if !d$EN_STRING_QUAD       \{ .ENDNOTE_STRING_QUAD CENTER          \}
3802 .    if !r#EN_STRING_UNDERSCORE \{ .ENDNOTE_STRING_UNDERSCORE 2         \}
3803 .    if !r#EN_STRING_CAPS       \{ .ENDNOTE_STRING_CAPS                 \}
3804 .    if !d$EN_TITLE \{\
3805 .       ie \\n[#DOC_TYPE]=2 \{\
3806 .          ie '\\*[$CHAPTER]'' \{ .ENDNOTE_TITLE "\\*[$CHAPTER_STRING]" \}
3807 .          el \{ .ENDNOTE_TITLE "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"    \}
3808 .       \}
3809 .       el \{ .ENDNOTE_TITLE "\\*[$TITLE]" \}
3810 .    \}
3811 .    if !d$EN_TITLE_FAM          \{ .ENDNOTE_TITLE_FAMILY \\*[$EN_FAM]  \}
3812 .    if !d$EN_TITLE_QUAD         \{ .ENDNOTE_TITLE_QUAD LEFT            \}
3813 .    if !r#EN_TITLE_UNDERSCORE   \{ .ENDNOTE_TITLE_UNDERSCORE           \}
3814 .    if !d$EN_NUMBER_FAM         \{ .ENDNOTE_NUMBER_FAMILY \\*[$EN_FAM] \}
3815 .    if !r#EN_NUMBERS_ALIGN_LEFT  \{\
3816 .       if !r#EN_NUMBERS_ALIGN_RIGHT \{ .ENDNOTE_NUMBERS_ALIGN_RIGHT 2  \}
3817 .    \}
3818 .    if !d$TOC_HEADER_STRING         \{ .TOC_HEADER_STRING "Contents"  \}
3819 .    if !d$TOC_HEADER_QUAD           \{ .TOC_HEADER_QUAD LEFT          \}
3820 .    if !d$TOC_PN_STYLE              \{ .TOC_PAGENUM_STYLE roman       \}
3821 .    if !r#TOC_PN_PADDING            \{ .TOC_PADDING   3               \}
3822 .    if !r#TOC_TITLE_INDENT          \{ .TOC_TITLE_INDENT    0         \}
3823 .    if !r#TOC_HEAD_INDENT           \{ .TOC_HEAD_INDENT     18p       \}
3824 .    if !r#TOC_SH_INDENT             \{ .TOC_SUBHEAD_INDENT  30p       \}
3825 .    if !r#TOC_PH_INDENT             \{ .TOC_PARAHEAD_INDENT 42p       \}
3826 \# String defaults for both PRINTSTYLEs
3827 .    ie \\n[#DOC_TYPE]=1 \{\
3828 .       ie '\\*[$DOC_TITLE]'' \{\
3829 .          if \\n[#USER_DEF_HDRFTR_LEFT]=0   \{ .ds $HDRFTR_LEFT  \\*[$AUTHOR_1]  \}
3830 .          rr #USER_DEF_HDRFTR_LEFT
3831 .          if \\n[#USER_DEF_HDRFTR_RIGHT]=0  \{ .ds $HDRFTR_RIGHT \\*[$TITLE]     \}
3832 .          rr #USER_DEF_HDRFTR_RIGHT
3833 .       \}
3834 .       el \{\
3835 .          if \\n[#COPY_STYLE]=1 \{ .DRAFT_WITH_PAGENUMBER \}
3836 .          if \\n[#USER_DEF_HDRFTR_LEFT]=0   \{ .ds $HDRFTR_LEFT  \\*[$AUTHOR_1]  \}
3837 .          rr #USER_DEF_HDRFTR_LEFT
3838 .          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{ .ds $HDRFTR_CENTER \\*[$TITLE]    \}
3839 .          rr #USER_DEF_HDRFTR_CENTER
3840 .          if \\n[#USER_DEF_HDRFTR_RIGHT]=0  \{ .ds $HDRFTR_RIGHT \\*[$DOC_TITLE] \}
3841 .          rr #USER_DEF_HDRFTR_RIGHT
3842 .       \}
3843 .    \}
3844 .    el \{\
3845 .       if \\n[#USER_DEF_HDRFTR_LEFT]=0   \{ .ds $HDRFTR_LEFT  \\*[$AUTHOR_1]  \}
3846 .       rr #USER_DEF_HDRFTR_LEFT
3847 .       if \\n[#USER_DEF_HDRFTR_RIGHT]=0  \{ .ds $HDRFTR_RIGHT \\*[$TITLE]     \}
3848 .       rr #USER_DEF_HDRFTR_RIGHT
3849 .    \}
3850 .    if !d$ATTRIBUTE_STRING           \{ .ATTRIBUTE_STRING "by"            \}
3851 .    if !d$FINIS_STRING               \{ .FINIS_STRING "END"               \}
3852 \# Defaults for printstyle TYPEWRITE
3853 .    if \\n[#PRINT_STYLE]=1 \{\
3854 .       if \\n[#UNDERLINE_QUOTES]=1 \{ .UNDERLINE_QUOTES         \}
3855 .       if \\n[#UNDERLINE_QUOTES]=0 \{ .UNDERLINE_QUOTES OFF     \}
3856 .       if !r#Q_OFFSET_VALUE        \{ .QUOTE_INDENT      2      \}
3857 .       if !r#EPI_OFFSET_VALUE      \{ .EPIGRAPH_INDENT   2      \}
3858 .       if !d$LINEBREAK_CHAR        \{ .LINEBREAK_CHAR    * 3 2p \}
3859 .       if !d$FN_SIZE_CHANGE        \{ .FOOTNOTE_SIZE     +0     \}
3860 .       if !r#FN_RULE_LENGTH        \{ .FOOTNOTE_RULE_LENGTH 2i  \}
3861 .       if !r#FN_RULE_ADJ           \{ .FOOTNOTE_RULE_ADJ  6p    \}
3862 .       if !r#SLANT_MEANS_SLANT \{\
3863 .          ie \\n[#UNDERLINE_SLANT]=1 \{ .UNDERLINE_SLANT \}
3864 .          el \{ .UNDERLINE_SLANT OFF \}
3865 .       \}
3866 .       if !r#PH_INDENT    \{ .PARAHEAD_INDENT \\n[#PP_INDENT]u/2u \}
3867 .       if !r#EN_PP_INDENT \{ .ENDNOTE_PARA_INDENT \\n[#PP_INDENT] \}
3868 .    \}
3869 \# Defaults for printstyle TYPESET
3870 .    if \\n[#PRINT_STYLE]=2 \{\
3871 .       if !d$DOCHEADER_LEAD_ADJ \{\
3872 .          ie !'\\*[$CHAPTER_TITLE]'' \{\
3873 .             ie !'\\*[$CHAPTER_STRING]'' \{\
3874 .                DOCHEADER_LEAD +4
3875 .             \}
3876 .             el \{ .DOCHEADER_LEAD +0 \}
3877 .          \}
3878 .          el \{ .DOCHEADER_LEAD +0 \}
3879 .       \}
3880 .       if !d$TITLE_FAM     \{ .TITLE_FAMILY   \\*[$DOC_FAM] \}
3881 .       if !d$TITLE_FT      \{ .TITLE_FONT     B             \}
3882 .       if !d$TITLE_SIZE_CHANGE \{\
3883 .          ie \\n[#DOC_TYPE]=2 \{ .TITLE_SIZE +4 \}
3884 .          el \{ .TITLE_SIZE +3.5 \}
3885 .       \}
3886 .       if !d$CHAPTER_TITLE_FAM         \{ .CHAPTER_TITLE_FAMILY \\*[$DOC_FAM] \}
3887 .       if !d$CHAPTER_TITLE_FT          \{ .CHAPTER_TITLE_FONT   BI            \}
3888 .       if !d$CHAPTER_TITLE_SIZE_CHANGE \{ .CHAPTER_TITLE_SIZE  +4             \}
3889 .       if !d$SUBTITLE_FAM         \{ .SUBTITLE_FAMILY    \\*[$DOC_FAM] \}
3890 .       if !d$SUBTITLE_FT          \{ .SUBTITLE_FONT      R             \}
3891 .       if !d$SUBTITLE_SIZE_CHANGE \{ .SUBTITLE_SIZE      +0            \}
3892 .       if !d$AUTHOR_FAM           \{ .AUTHOR_FAMILY      \\*[$DOC_FAM] \}
3893 .       if !d$AUTHOR_FT            \{ .AUTHOR_FONT        I             \}
3894 .       if !d$AUTHOR_SIZE_CHANGE   \{ .AUTHOR_SIZE        +0            \}
3895 .       if !d$DOCTYPE_FAM          \{ .DOCTYPE_FAMILY     \\*[$DOC_FAM] \}
3896 .       if !d$DOCTYPE_FT           \{ .DOCTYPE_FONT       BI            \}
3897 .       if !d$DOCTYPE_SIZE_CHANGE  \{ .DOCTYPE_SIZE       +3            \}
3898 .       if !d$HDRFTR_LEFT_FAM      \{ .HDRFTR_LEFT_FAMILY \\*[$DOC_FAM] \}
3899 .       if !d$HDRFTR_LEFT_FT       \{ .HDRFTR_LEFT_FONT   R             \}
3900 .       if \\n[#HDRFTR_LEFT_CAPS]  \{\
3901 .          if !d$HDRFTR_LEFT_SIZE_CHANGE \{ .HDRFTR_LEFT_SIZE  -2 \}
3902 .       \}
3903 .       if !d$HDRFTR_LEFT_SIZE_CHANGE \{ .HDRFTR_LEFT_SIZE     -.5           \}
3904 .       if !d$HDRFTR_CENTER_FAM       \{ .HDRFTR_CENTER_FAMILY \\*[$DOC_FAM] \}
3905 .       if !d$HDRFTR_CENTER_FT        \{ .HDRFTR_CENTER_FONT   I             \}
3906 .       if \\n[#HDRFTR_CENTER_CAPS] \{\
3907 .          if !d$HDRFTR_CENTER_SIZE_CHANGE \{ .HDRFTR_CENTER_SIZE -2 \}
3908 .       \}
3909 .       if !d$HDRFTR_CENTER_SIZE_CHANGE \{ .HDRFTR_CENTER_SIZE -.5              \}
3910 .       if !d$HDRFTR_RIGHT_FAM          \{ .HDRFTR_RIGHT_FAMILY \\*[$DOC_FAM]   \}
3911 .       if !d$HDRFTR_RIGHT_FT           \{ .HDRFTR_RIGHT_FONT   R               \}
3912 .       if \\n[#HDRFTR_RIGHT_CAPS] \{\
3913 .          if !d$HDRFTR_RIGHT_SIZE_CHANGE \{ .HDRFTR_RIGHT_SIZE -2 \}
3914 .       \}
3915 .       if !d$HDRFTR_RIGHT_SIZE_CHANGE  \{ .HDRFTR_RIGHT_SIZE  -.5              \}
3916 .       if !d$HEAD_FAM                  \{ .HEAD_FAMILY        \\*[$DOC_FAM]    \}
3917 .       if !d$HEAD_FT                   \{ .HEAD_FONT          B                \}
3918 .       if !d$HEAD_SIZE_CHANGE          \{ .HEAD_SIZE          +1               \}
3919 .       if !r#HEAD_SPACE                \{ .HEAD_SPACE                          \}
3920 .       if !d$SH_FAM                    \{ .SUBHEAD_FAMILY     \\*[$DOC_FAM]    \}
3921 .       if !d$SH_FT                     \{ .SUBHEAD_FONT       B                \}
3922 .       if !d$SH_SIZE_CHANGE            \{ .SUBHEAD_SIZE       +.5              \}
3923 .       if !d$PH_FAM                    \{ .PARAHEAD_FAMILY    \\*[$DOC_FAM]    \}
3924 .       if !d$PH_FT                     \{ .PARAHEAD_FONT      BI               \}
3925 .       if !d$PH_SIZE_CHANGE            \{ .PARAHEAD_SIZE      -.25             \}
3926 .       if !r#PH_INDENT                 \{ .PARAHEAD_INDENT \\n[#PP_INDENT]u/2u \}
3927 .       if !d$QUOTE_FAM                 \{ .QUOTE_FAMILY       \\*[$DOC_FAM]    \}
3928 .       if !d$QUOTE_FT                  \{ .QUOTE_FONT         I                \}
3929 .       if !d$QUOTE_SIZE_CHANGE         \{ .QUOTE_SIZE         +0               \}
3930 .       if !r#Q_OFFSET_VALUE            \{ .QUOTE_INDENT       3                \}
3931 .       if !d$BQUOTE_FAM                \{ .BLOCKQUOTE_FAMILY  \\*[$DOC_FAM]    \}
3932 .       if !d$BQUOTE_FT                 \{ .BLOCKQUOTE_FONT    R                \}
3933 .       if !d$BQUOTE_SIZE_CHANGE        \{ .BLOCKQUOTE_SIZE    -1               \}
3934 .       if !d$BQUOTE_QUAD               \{ .BLOCKQUOTE_QUAD    LEFT             \}
3935 .       if !d$EPI_FAM                   \{ .EPIGRAPH_FAMILY    \\*[$DOC_FAM]    \}
3936 .       if !d$EPI_FT                    \{ .EPIGRAPH_FONT      R                \}
3937 .       if !d$EPI_SIZE_CHANGE           \{ .EPIGRAPH_SIZE      -1.5             \}
3938 .       if !r#EPI_AUTOLEAD              \{ .EPIGRAPH_AUTOLEAD  2                \}
3939 .       if !d$EPI_QUAD                  \{ .EPIGRAPH_QUAD      \\*[$DOC_QUAD]   \}
3940 .       if !r#EPI_OFFSET_VALUE          \{ .EPIGRAPH_INDENT    3                \}
3941 .       if !d$LINEBREAK_CHAR            \{ .LINEBREAK_CHAR     * 3 3p           \}
3942 .       if !r#FN_RULE_LENGTH            \{ .FOOTNOTE_RULE_LENGTH 4P             \}
3943 .       if !r#FN_RULE_ADJ               \{ .FOOTNOTE_RULE_ADJ  3p               \}
3944 .       if !d$FN_SIZE_CHANGE            \{ .FOOTNOTE_SIZE      -2               \}
3945 .       if !r#FN_AUTOLEAD               \{ .FOOTNOTE_AUTOLEAD  2                \}
3946 .       if !r#EN_PS                     \{ .ENDNOTE_PT_SIZE \\n[#DOC_PT_SIZE]u  \}
3947 .       if !d$EN_LEAD                   \{ .ENDNOTE_LEAD        14 ADJUST       \}
3948 .       if !d$EN_STRING_FT              \{ .ENDNOTE_STRING_FONT B               \}
3949 .       if !d$EN_STRING_SIZE_CHANGE     \{ .ENDNOTE_STRING_SIZE +1              \}
3950 .       if !d$EN_TITLE_FT               \{ .ENDNOTE_TITLE_FONT  B               \}
3951 .       if !d$EN_TITLE_SIZE_CHANGE      \{ .ENDNOTE_TITLE_SIZE  +0              \}
3952 .       if !d$EN_NUMBER_FT              \{ .ENDNOTE_NUMBER_FONT B               \}
3953 .       if !$EN_NUMBER_SIZE_CHANGE      \{ .ENDNOTE_NUMBER_SIZE +0              \}
3954 .       if !r#EN_PP_INDENT              \{ .ENDNOTE_PARA_INDENT 1.5m            \}
3955 .       if !d$TOC_FAM                   \{ .TOC_FAMILY  \\*[$DOC_FAM]           \}
3956 .       if !r#TOC_PS                    \{ .TOC_PT_SIZE \\n[#DOC_PT_SIZE]u      \}
3957 .       if !r#TOC_LEAD                  \{ .TOC_LEAD    \\n[#DOC_LEAD]u ADJUST  \}
3958 .       if !d$TOC_HEADER_FAM            \{ .TOC_HEADER_FAMILY \\*[$TOC_FAM]     \}
3959 .       if !d$TOC_HEADER_SIZE_CHANGE    \{ .TOC_HEADER_SIZE  +4                 \}
3960 .       if !d$TOC_HEADER_FT             \{ .TOC_HEADER_FONT   B                 \}
3961 .       if !d$TOC_TITLE_FAM             \{ .TOC_TITLE_FAMILY \\*[$TOC_FAM]      \}
3962 .       if !d$TOC_PN_FAM                \{ .TOC_PN_FAMILY \\*[$TOC_FAM]         \}
3963 .       if !d$TOC_HEAD_FAM              \{ .TOC_HEAD_FAMILY \\*[$TOC_FAM]       \}
3964 .       if !d$TOC_SH_FAM                \{ .TOC_SUBHEAD_FAMILY \\*[$TOC_FAM]    \}
3965 .       if !d$TOC_PH_FAM                \{ .TOC_PARAHEAD_FAMILY \\*[$TOC_FAM]   \}
3966 .       if !d$TOC_TITLE_FT              \{ .TOC_TITLE_FONT   BI                 \}
3967 .       if !d$TOC_PN_FT                 \{ .TOC_PN_FONT   R                     \}
3968 .       if !d$TOC_HEAD_FT               \{ .TOC_HEAD_FONT   B                   \}
3969 .       if !d$TOC_SH_FT                 \{ .TOC_SUBHEAD_FONT   R                \}
3970 .       if !d$TOC_PH_FT                 \{ .TOC_PARAHEAD_FONT   I               \}
3971 .       if !d$TOC_TITLE_SIZE_CHANGE     \{ .TOC_TITLE_SIZE   +.5                \}
3972 .       if !d$TOC_PN_SIZE_CHANGE        \{ .TOC_PN_SIZE  +0                     \}
3973 .       if !d$TOC_HEAD_SIZE_CHANGE      \{ .TOC_HEAD_SIZE  +.5                   \}
3974 .       if !d$TOC_SH_SIZE_CHANGE        \{ .TOC_SUBHEAD_SIZE  +0                \}
3975 .       if !d$TOC_PH_SIZE_CHANGE        \{ .TOC_PARAHEAD_SIZE  +0               \}
3976 .    \}
3977 .    if \\n[#PRINT_STYLE]=2 \{\
3978 .       ie \\n[#ADJ_DOC_LEAD]=1 \{ .DOC_LEAD_ADJUST \}
3979 .       el \{ . \}
3980 .    \}
3981 .    if !\\n[#COLLATE] \{\
3982 .       TRAPS
3983 \# Endnote and toc leading
3984 .       nr #OK_PROCESS_LEAD 1
3985 .       nr #RESTORE_DOC_LEAD \\n(.v
3986 .       if \\n[#PRINT_STYLE]=1 \{\
3987 .          ie \\n[#SINGLE_SPACE] \{\
3988 .             ENDNOTE_LEAD 12 ADJUST
3989 .          \}
3990 .          el \{\
3991 .             ie \\n[#EN_SINGLESPACE] \{ .ENDNOTE_LEAD 12 ADJUST \}
3992 .             el \{ .ENDNOTE_LEAD 24 ADJUST \}
3993 .          \}
3994 .       \}
3995 .       if \\n[#PRINT_STYLE]=2 \{\
3996 .          ie !d$EN_LEAD \{ .ENDNOTE_LEAD 14 ADJUST \}
3997 .          el \{ .ENDNOTE_LEAD \\*[$EN_LEAD] \\*[$ADJUST_EN_LEAD] \}
3998 .          ie !d$TOC_LEAD \{ .TOC_LEAD \\n[#RESTORE_DOC_LEAD]u \}
3999 .          el \{ .TOC_LEAD \\*[$TOC_LEAD] \\*[$ADJUST_TOC_LEAD] \}
4000 .          rm $ADJUST_EN_LEAD
4001 .          rm $ADJUST_TOC_LEAD
4002 .       \}
4003 .       DOC_LEAD \\n[#RESTORE_DOC_LEAD]u
4004 .    \}
4005 .    if \\n[#PRINT_STYLE]=1 \{ .nr #IGNORE 1 \}
4006 .END
4008 \# ====================================================================
4010 \# +++START THE DOCUMENT+++
4012 \# THE START MACRO
4013 \# ---------------
4014 \# *Arguments:
4015 \#   <none>
4016 \# *Function:
4017 \#   Reads in default document style parameters and any parameter
4018 \#   the user has changed before issuing START.
4019 \#   Using the information gathered in the opening macros,
4020 \#   prints appropriate title (or chapter #), subtitle, author
4021 \#   and document type (if appropriate).
4022 \# *Notes:
4023 \#   The .PRINT \& (zero-width character) is required to get the
4024 \#   subsequent .sp request to work as advertised.
4026 \#   The overall document line length, family, and point-size
4027 \#   are stored in #DOC_L_LENGTH, $DOC_FAM, and #DOC_PT_SIZE for
4028 \#   use in the HEADER and FOOTER macros.
4030 \#  First, define some strings for point sizes
4032 .ds $TITLE_PT_SIZE         \\n[#DOC_PT_SIZE]u\\*[$TITLE_SIZE_CHANGE]
4033 .ds $CHAPTER_TITLE_PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$CHAPTER_TITLE_SIZE_CHANGE]
4034 .ds $SUBTITLE_PT_SIZE      \\n[#DOC_PT_SIZE]u\\*[$SUBTITLE_SIZE_CHANGE]
4035 .ds $AUTHOR_PT_SIZE        \\n[#DOC_PT_SIZE]u\\*[$AUTHOR_SIZE_CHANGE]
4036 .ds $DOCTYPE_PT_SIZE       \\n[#DOC_PT_SIZE]u\\*[$DOCTYPE_SIZE_CHANGE]
4038 \# Next, some utility macros for various routines to prevent repetition
4040 .MAC PRINT_AUTHORS END
4041 .    nr #AUTHORS \\n[#AUTHOR_NUM]
4042 .    nr #NEXT_AUTHOR 0 1
4043 .    while \\n[#AUTHORS]>\\n[#NEXT_AUTHOR] \{\
4044 .       PRINT \\*[$AUTHOR_\\n+[#NEXT_AUTHOR]]
4045 .    \}
4046 .END
4048 .MAC DEFAULT_DOCHEADER END
4049 .    CENTER
4050 .    FAMILY  \\*[$TITLE_FAM]
4051 .    FT      \\*[$TITLE_FT]
4052 .    PT_SIZE \\*[$TITLE_PT_SIZE]
4053 .    LS      \\n[#DOCHEADER_LEAD]u
4054 .    PRINT   \\*[$TITLE]
4055 .    if !'\\*[$SUBTITLE]'' \{\
4056 .       FAMILY  \\*[$SUBTITLE_FAM]
4057 .       FT      \\*[$SUBTITLE_FT]
4058 .       PT_SIZE \\*[$SUBTITLE_PT_SIZE]
4059 .       PRINT   \\*[$SUBTITLE]
4060 .    \}
4061 .    if !'\\*[$AUTHOR_1]'' \{\
4062 .       FAMILY  \\*[$AUTHOR_FAM]
4063 .       FT      \\*[$AUTHOR_FT]
4064 .       PT_SIZE \\*[$AUTHOR_PT_SIZE]
4065 .       if !'\\*[$ATTRIBUTE_STRING]'' \{ .PRINT \\*[$ATTRIBUTE_STRING] \}
4066 .       PRINT_AUTHORS
4067 .    \}
4068 .END
4071 .MAC CHAPTER_DOCHEADER END
4072 .    CENTER
4073 .    FAMILY  \\*[$TITLE_FAM]
4074 .    FT      \\*[$TITLE_FT]
4075 .    PT_SIZE \\*[$TITLE_PT_SIZE]
4076 .    LS      \\n[#DOCHEADER_LEAD]u
4077 .    ie '\\*[$CHAPTER]'' \{\
4078 .       ie !'\\*[$CHAPTER_TITLE]'' \{\
4079 .          if \\n[#PRINT_STYLE]=2 \{\
4080 .             FAMILY  \\*[$CHAPTER_TITLE_FAM]
4081 .             FT      \\*[$CHAPTER_TITLE_FT]
4082 .             PT_SIZE \\*[$CHAPTER_TITLE_PT_SIZE]
4083 .             LS      \\n[#DOCHEADER_LEAD]u
4084 .          \}
4085 .          PRINT \\*[$CHAPTER_TITLE]
4086 .       \}
4087 .       el \{\
4088 .          PRINT \\*[$CHAPTER_STRING]
4089 .       \}
4090 .    \}
4091 .    el \{\
4092 .       PRINT \\*[$CHAPTER_STRING] \\*[$CHAPTER]
4093 .       if !'\\*[$CHAPTER_TITLE]'' \{\
4094 .       if \\n[#PRINT_STYLE]=1 \{ .PRINT   \\*[$CHAPTER_TITLE] \}
4095 .          if \\n[#PRINT_STYLE]=2 \{\
4096 .             FAMILY  \\*[$CHAPTER_TITLE_FAM]
4097 .             FT      \\*[$CHAPTER_TITLE_FT]
4098 .             PT_SIZE \\*[$CHAPTER_TITLE_PT_SIZE]
4099 .             LS      \\n[#DOCHEADER_LEAD]u
4100 .             PRINT   \\*[$CHAPTER_TITLE]
4101 .             RLD \\n[#DOC_LEAD]u \" Just looks better this way
4102 .          \}
4103 .       \}
4104 .    \}
4105 .END
4108 .MAC NAMED_DOCHEADER END
4109 .    CENTER
4110 .    FAMILY  \\*[$TITLE_FAM]
4111 .    FT      \\*[$TITLE_FT]
4112 .    PT_SIZE \\*[$TITLE_PT_SIZE]
4113 .    LS      \\n[#DOCHEADER_LEAD]u
4114 .    PRINT   \\*[$TITLE]
4115 .    if !'\\*[$SUBTITLE]'' \{\
4116 .       FAMILY  \\*[$SUBTITLE_FAM]
4117 .       FT      \\*[$SUBTITLE_FT]
4118 .       PT_SIZE \\*[$SUBTITLE_PT_SIZE]
4119 .       PRINT   \\*[$SUBTITLE]
4120 .    \}
4121 .    if !'\\*[$AUTHOR_1]'' \{\
4122 .       FAMILY  \\*[$AUTHOR_FAM]
4123 .       FT      \\*[$AUTHOR_FT]
4124 .       PT_SIZE \\*[$AUTHOR_PT_SIZE]
4125 .       if !'\\*[$ATTRIBUTE_STRING]'' \{ .PRINT \\*[$ATTRIBUTE_STRING] \}
4126 .       PRINT_AUTHORS
4127 .    \}
4128 .    FAMILY  \\*[$DOCTYPE_FAM]
4129 .    FT      \\*[$DOCTYPE_FT]
4130 .    PT_SIZE \\*[$DOCTYPE_PT_SIZE]
4131 .    LS      \\n[#DOCHEADER_LEAD]u
4132 .    ALD     \\n[#DOCHEADER_LEAD]u
4133 .    UNDERSCORE "\\*[$DOC_TYPE]
4134 .END
4137 .MAC START END
4138 .    if !\\n[#PRINT_STYLE] \{\
4139 .       PRINTSTYLE TYPEWRITE
4140 .       PRINT \&
4141 .       po 6P
4142 .       ll 39P
4143 .       ta \\n(.lu
4144 .       sp |1i-1v
4145 .       CENTER
4146 .       PRINT "You neglected to enter a PRINTSTYLE"
4147 .       fl
4148 .       ab PRINTSTYLE missing
4149 .    \}
4150 .    nr #DOCS 1
4151 .    if \\n[#COLLATE] \{\
4152 .       COPYSTYLE \\*[$COPY_STYLE]
4153 .       nr #HEADERS_ON \\n[#HEADER_STATE]
4154 .       if \\n[#PAGE_NUM_V_POS]=1 \{ .nr #PAGINATE \\n[#PAGINATION_STATE] \}
4155 .       sp |\\n[#HEADER_MARGIN]u
4156 .       PRINT \&
4157 .       if !'\\*[$RESTORE_PAGENUM_STYLE]'' \{\
4158 .          PAGENUM_STYLE \\*[$RESTORE_PAGENUM_STYLE]
4159 .          rm $RESTORE_PAGENUM_STYLE
4160 .       \}
4161 .    \}
4162 .    DEFAULTS
4163 \# Collate stuff
4164 .    ie \\n[#COLLATED_DOC]=1 \{\
4165 \# Collect TITLE for TOC.
4166 .       nr #TOC_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
4167 .       af #TOC_ENTRY_PN \\g[#PAGENUMBER]
4168 .       ie \\n[#USER_SET_TITLE_ITEM] \{\
4169 .          ds $TOC_TITLE_ITEM \\*[$USER_SET_TITLE_ITEM]\\|
4170 .          rr #USER_SET_TITLE_ITEM
4171 .          rm $USER_SET_TITLE_ITEM
4172 .       \}
4173 .       el \{\
4174 .          ie \\n[#DOC_TYPE]=2 \{\
4175 .             ie '\\*[$CHAPTER_TITLE]'' \{\
4176 .                ds $TOC_TITLE_ITEM \\*[$CHAPTER_STRING] \\*[$CHAPTER]\\|
4177 .             \}
4178 .             el \{\
4179 .                ie '\\*[$CHAPTER]'' \{\
4180 .                   ds $TOC_TITLE_ITEM \\*[$CHAPTER_TITLE]\\|
4181 .                \}
4182 .                el \{\
4183 .                   ds $TOC_TITLE_ITEM \\*[$CHAPTER_STRING] \\*[$CHAPTER]: \\*[$CHAPTER_TITLE]\\|
4184 .                \}
4185 .             \}
4186 .          \}
4187 .          el \{\
4188 .             ds $TOC_TITLE_ITEM \\*[$TITLE]\\|
4189 .          \}
4190 .       \}
4191 .       if \\n[#TOC_AUTHORS]=1 \{\
4192 .          ie '\\*[$TOC_AUTHORS]'' \{\
4193 .             as $TOC_TITLE_ITEM /\\|\\*[$AUTHOR_1]\\|
4194 .          \}
4195 .          el \{\
4196 .             as $TOC_TITLE_ITEM /\\|\\*[$TOC_AUTHORS]\\|
4197 .             rm $TOC_AUTHORS
4198 .          \}
4199 .       \}
4200 \# Note the use of \!, which transparently embeds the macros used
4201 \# in the TOC_ENTRIES diversion.  The elements they control must be
4202 \# processed literally when the diversion is output.
4203 .       ev TOC_EV
4204 .       da TOC_ENTRIES
4205 .       if \\n[#PRINT_STYLE]=1 \{\
4206 \!.        fam C
4207 \!.        ft  R
4208 \!.        ps  12
4209 .       \}
4210 .       if \\n[#PRINT_STYLE]=2 \{\
4211 \!.        FAMILY  \\*[$TOC_TITLE_FAM]
4212 \!.        FT      \\*[$TOC_TITLE_FT]
4213 \!.        PT_SIZE \\n[#TOC_PS]u\\*[$TOC_TITLE_SIZE_CHANGE]
4214 .       \}
4215 \!.     TRAP OFF
4216 .       ie \\n[#PRINT_STYLE]=1 \{\
4217 \!.        PAD "\\*[$TOC_TITLE_ITEM]\\*[$TOC_PN_TYPEWRITE]" 
4218 .       \}
4219 .       el \{\
4220 \!.        PAD "\\h'\\n[#TOC_TITLE_INDENT]u'\\*[$TOC_TITLE_ITEM]\\*[$TOC_PN]"
4221 .       \}
4222 \!.    EL
4223 \!.    ST 100 L
4224 \!.    ST 101 R
4225 .      if \\n[#PRINT_STYLE]=2 \{\
4226 \!.       FAMILY  \\*[$TOC_PN_FAM]
4227 \!.       FT      \\*[$TOC_PN_FT]
4228 \!.       PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PN_SIZE_CHANGE]
4229 .      \}
4230 \!.    TAB 100
4231 \!.    PRINT \\*[LEADER]
4232 \!.    TN
4233 \!.    TRAP
4234 \!.    PRINT \\n[#TOC_ENTRY_PN]
4235 \!.    TQ
4236 .      di       
4237 .      ev
4238 .    \}
4239 .    el \{\
4240 .       nr #FIRST_DOC_TITLE_PN \\n%+\\n[#PAGE_NUM_ADJ]
4241 .       af #FIRST_DOC_TITLE_PN \\g[#PAGENUMBER]
4242 .       nr #FIRST_DOC_TOC_PN_PADDING \\n[#TOC_PN_PADDING]
4243 .    \}
4244 \# End TITLE collection
4245 .    if \\n[#PRINT_PAGENUM_ON_PAGE_1] \{\
4246 .       sp |\\n[#HEADER_MARGIN]u
4247 .       PRINT_PAGE_NUMBER
4248 .    \}
4249 .    rr #COLLATE
4250 .    rr #PAGINATION_STATE
4251 \# End collate stuff
4252 .    ie \\n[#DOC_HEADER]=0 \{\
4253 .       PRINT \&
4254 .       if \\n[#DOC_TYPE]=4 \{\
4255 .          if !'\\n(.z'' \{ .di \}
4256 .       \}
4257 .       PP
4258 .       ie r#ADVANCE_FROM_TOP \{\
4259 .          sp |\\n[#ADVANCE_FROM_TOP]u-1v
4260 .          SHIM
4261 .       \}
4262 .       el \{ .sp |\\n[#T_MARGIN]u-1v \}
4263 .       if \\n[#COLUMNS] \{\
4264 .          mk dc
4265 .          nr #COL_NUM 0 1
4266 .          po \\n[#COL_\\n+[#COL_NUM]_L_MARGIN]u
4267 .          ll \\n[#COL_L_LENGTH]u
4268 .       \}
4269 .       nr #PP 0
4270 .       rr #DOC_HEADER
4271 .       if r#ADVANCE_FROM_TOP \{ .rr #ADVANCE_FROM_TOP \}
4272 .    \}
4273 .    el \{\
4274 .       if \\n[#PRINT_STYLE]=2 \{ .LS \\n[#DOC_LEAD]u\\*[$DOCHEADER_LEAD_ADJ] \}
4275 .       nr #DOCHEADER_LEAD \\n[#LEAD]
4276 \# Default
4277 .       if \\n[#DOC_TYPE]=1 \{\
4278 .          PRINT \&
4279 .          sp |\\n[#DOCHEADER_ADVANCE]u-1v
4280 .          ev TITLE
4281 .          L_MARGIN \\n[#DOC_L_MARGIN]u
4282 .          LL       \\n[#DOC_L_LENGTH]u
4283 .          ta \\n(.lu
4284 .          if \\n[#PRINT_STYLE]=1 \{\
4285 .             CENTER
4286 .             fam C
4287 .             ft  R
4288 .             ps  12
4289 .             ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u*2u \}
4290 .             el \{ .vs \\n[#DOC_LEAD]u \}
4291 .             CAPS
4292 .             if !'\\*[$TITLE]'' \{ .UNDERSCORE "\\*[$TITLE]\}
4293 .             CAPS OFF
4294 .             if !'\\*[$SUBTITLE]'' \{\
4295 .                ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u*2u \}
4296 .                el \{ .vs \\n[#DOC_LEAD]u \}
4297 .             PRINT \\*[$SUBTITLE]
4298 .             \}
4299 .             if '\\*[$SUBTITLE]'' \{\
4300 .                ALD \\n[#DOC_LEAD]u
4301 .             \}
4302 .             ie !'\\*[$AUTHOR_1]'' \{\
4303 .                ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u \}
4304 .                el \{ .vs \\n[#DOC_LEAD]u/2u \}
4305 .                if !d$SUBTITLE \{\
4306 .                   ie \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
4307 .                   el \{ .ALD \\n[#DOC_LEAD]u*2u \}
4308 .                \}
4309 .                PRINT \\*[$ATTRIBUTE_STRING]
4310 .                nr #AUTHORS \\n[#AUTHOR_NUM]
4311 .                nr #NEXT_AUTHOR 0 1
4312 .                while \\n[#AUTHORS]>\\n[#NEXT_AUTHOR] \{\
4313 .                   PRINT \\*[$AUTHOR_\\n+[#NEXT_AUTHOR]]
4314 .                \}
4315 .                if \\n[#AUTHOR_LINES]=1 \{\
4316 .                    ie \\n[#SINGLE_SPACE] \{ .RLD \\n[#DOC_LEAD]u \}
4317 .                    el \{ .ALD \\n[#DOC_LEAD]u/2u \}
4318 .                \}
4319 .             \}
4320 .             el \{\
4321 .                ie !d$SUBTITLE \{\
4322 .                   ie \\n[#SINGLE_SPACE] \{ .RLD \\n[#DOC_LEAD]u*2u \}
4323 .                   el \{ .RLD \\n[#DOC_LEAD]u \}
4324 .                \}
4325 .                el \{\
4326 .                   ie \\n[#SINGLE_SPACE] \{ .RLD \\n[#DOC_LEAD]u*2u \}
4327 .                   el \{ .ALD \\n[#DOC_LEAD]u \}
4328 .                \}
4329 .             \}
4330 .          \}
4331 .          if \\n[#PRINT_STYLE]=2 \{\
4332 .             DEFAULT_DOCHEADER
4333 .             di DOCHEADER_DIVERSION \" This diversion is only
4334 .             br                     \" necessary to find the depth of the
4335 .             DEFAULT_DOCHEADER      \" docheader
4336 .             br
4337 .             di
4338 .             nr #DOCHEADER_DEPTH \\n(dn-\\n[#DOCHEADER_LEAD] \"Storing the depth (height) of the diversion
4339 .                                                             \"in #DOCHEADER_DEPTH
4340 .             rm DOCHEADER_DIVERSION                          \" Removing the diversion macro
4341 .          \}
4342 .          ev
4343 .       \}
4344 \# Chapter
4345 .       if \\n[#DOC_TYPE]=2 \{\
4346 .          PRINT \&
4347 .          sp |\\n[#DOCHEADER_ADVANCE]u-1v
4348 .          ev TITLE
4349 .          L_MARGIN \\n[#DOC_L_MARGIN]u
4350 .          LL       \\n[#DOC_L_LENGTH]u
4351 .          ta \\n(.lu
4352 .          if \\n[#PRINT_STYLE]=1 \{\
4353 .             CENTER
4354 .             fam C
4355 .             ft  R
4356 .             ps  12
4357 .             vs \\n[#DOC_LEAD]u
4358 .             ie '\\*[$CHAPTER]'' \{\
4359 .                CAPS
4360 .                ie !'\\*[$CHAPTER_TITLE]'' \{\
4361 .                   PRINT \\*[$CHAPTER_TITLE]
4362 .                \}
4363 .                el \{\
4364 .                   CAPS
4365 .                   PRINT \\*[$CHAPTER_STRING]
4366 .                \}
4367 .                CAPS OFF
4368 .             \}
4369 .             el \{\
4370 .                CAPS
4371 .                PRINT \\*[$CHAPTER_STRING] \\*[$CHAPTER]
4372 .                CAPS OFF
4373 .                if !'\\*[$CHAPTER_TITLE]'' \{\
4374 .                   if \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
4375 .                   UNDERSCORE "\\*[$CHAPTER_TITLE]
4376 .                \}
4377 .             \}
4378 .             if \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
4379 .          \}
4380 .          if \\n[#PRINT_STYLE]=2 \{\
4381 .             CHAPTER_DOCHEADER
4382 .             di DOCHEADER_DIVERSION \" This diversion is only
4383 .             br                     \" necessary to find the depth of the
4384 .             CHAPTER_DOCHEADER      \" docheader
4385 .             br
4386 .             di
4387 .             nr #DOCHEADER_DEPTH \\n(dn-\\n[#DOCHEADER_LEAD] \" Storing the depth (height) of the diversion
4388 .                                                             \" in #DOCHEADER_DEPTH
4389 .             rm DOCHEADER_DIVERSION                          \" Removing the diversion macro
4390 .          \}
4391 .          ev
4392 .       \}
4393 \# Named
4394 .       if \\n[#DOC_TYPE]=3 \{\
4395 .          PRINT \&
4396 .          sp |\\n[#DOCHEADER_ADVANCE]u-1v
4397 .          ev NAMED
4398 .          L_MARGIN \\n[#DOC_L_MARGIN]u
4399 .          LL       \\n[#DOC_L_LENGTH]u
4400 .          ta \\n(.lu
4401 .          if \\n[#PRINT_STYLE]=1 \{\
4402 .             CENTER
4403 .             fam C
4404 .             ft  R
4405 .             ps  12
4406 .             ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u*2u \}
4407 .             el \{ .vs \\n[#DOC_LEAD]u \}
4408 .             CAPS
4409 .             if !'\\*[$TITLE]'' \{ .UNDERSCORE "\\*[$TITLE]\}
4410 .             CAPS OFF
4411 .             if !'\\*[$SUBTITLE]'' \{\
4412 .                ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u*2u \}
4413 .                el \{ .vs \\n[#DOC_LEAD]u \}
4414 .                PRINT \\*[$SUBTITLE]
4415 .             \}
4416 .             if '\\*[$SUBTITLE]'' \{\
4417 .                ALD \\n[#DOC_LEAD]u
4418 .             \}
4419 .             ie !'\\*[$AUTHOR_1]'' \{\
4420 .                ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u \}
4421 .                el \{ .vs \\n[#DOC_LEAD]u/2u \}
4422 .                if !d$SUBTITLE \{\
4423 .                   ie \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
4424 .                   el \{ .ALD \\n[#DOC_LEAD]u*2u \}
4425 .                \}
4426 .                PRINT \\*[$ATTRIBUTE_STRING]
4427 .                nr #AUTHORS \\n[#AUTHOR_NUM]
4428 .                nr #NEXT_AUTHOR 0 1
4429 .                while \\n[#AUTHORS]>\\n[#NEXT_AUTHOR] \{\
4430 .                   PRINT \\*[$AUTHOR_\\n+[#NEXT_AUTHOR]]
4431 .                \}
4432 .                if \\n[#AUTHOR_LINES]=1 \{\
4433 .                    ie \\n[#SINGLE_SPACE] \{ .RLD \\n[#DOC_LEAD]u \}
4434 .                    el \{ .ALD \\n[#DOC_LEAD]u/2u \}
4435 .                 \}
4436 .             \}
4437 .             vs  \\n[#DOC_LEAD]u
4438 .             el \{\
4439 .                ie !d$SUBTITLE \{\
4440 .                   ie \\n[#SINGLE_SPACE] \{ .RLD \\n[#DOC_LEAD]u*2u \}
4441 .                   el \{ .RLD \\n[#DOC_LEAD]u \}
4442 .                \}
4443 .                el \{\
4444 .                   ie \\n[#SINGLE_SPACE] \{ . \}
4445 .                   el \{ .RLD \\n[#DOC_LEAD]u \}
4446 .                \}
4447 .             \}
4448 .             ie \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u*2u \}
4449 .             el \{ .ALD \\n[#DOC_LEAD]u \}
4450 .             UNDERSCORE2 "\\*[$DOC_TYPE]
4451 .             if \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
4452 .          \}
4453 .          if \\n[#PRINT_STYLE]=2 \{\
4454 .             NAMED_DOCHEADER
4455 .             di DOCHEADER_DIVERSION \" This diversion is only
4456 .             br                     \" necessary to find the depth of the
4457 .             NAMED_DOCHEADER        \" docheader
4458 .             br
4459 .             di
4460 .             nr #DOCHEADER_DEPTH \\n(dn-\\n[#DOCHEADER_LEAD] \"Storing the depth (height) of the diversion
4461 .                                                             \"in #DOCHEADER_DEPTH
4462 .             rm DOCHEADER_DIVERSION                          \" Removing the diversion macro
4463 .          \}
4464 .          ev
4465 .       \}
4466 .       if !\\n[#DOC_TYPE]=4 \{\
4467 .          if \\n[#PRINT_STYLE]=1 \{ .ALD \\n[#DOC_LEAD]u \}
4468 .          nr #DOCHEADER_SPACE_ADJ \\n[#DOCHEADER_DEPTH]%\\n[#DOC_LEAD]
4469 .          ie !\\n[#DOCHEADER_SPACE_ADJ]=0 \{ .nr #DOCHEADER_EXTRA_SPACE \\n[#DOC_LEAD]-\\n[#DOCHEADER_SPACE_ADJ] \}
4470 .          el \{ .nr #DOCHEADER_EXTRA_SPACE 0 \}
4471 .          if \\n[#PRINT_STYLE]=2 \{ .ALD (\\n[#DOC_LEAD]u*2u)+\\n[#DOCHEADER_EXTRA_SPACE]u \}
4472 .          if \\n[#COLUMNS] \{\
4473 .             nr #COL_NUM 0 1
4474 .             nr #L_LENGTH_FOR_EPI \\n[#L_LENGTH]
4475 .             po \\n[#COL_\\n+[#COL_NUM]_L_MARGIN]u
4476 .             LL \\n[#COL_L_LENGTH]u
4477 .             ta \\n(.lu
4478 .             mk dc
4479 .          \}
4480 .       \}
4481 .    \}
4482 .    rr #DOCHEADER_LEAD
4483 .    rr #DOCHEADER_LEAD_ADJ
4484 .    rr #DEPTH_1
4485 .    rr #DEPTH_2
4486 .    rr #DOCHEADER_ADVANCE
4487 .    rr #ADVANCE_FROM_TOP
4488 .    rr #DOCHEADER_SPACE_ADJ
4489 .    rr #DOCHEADER_EXTRA_SPACE
4490 .    rr #AUTHORS
4491 .    rr #NEXT_AUTHOR
4492 .    rr #AUTHOR_NUM
4493 .    rr #NUM_AUTHORS
4494 .    rm $TOC_TITLE_ITEM
4495 .    nr #START 1
4496 .    nr #START_FOR_FOOTERS 1
4497 .END
4499 \# ====================================================================
4501 \# +++MACROS TO CHANGE SOME DEFAULTS+++
4503 \# DOCUMENT HEADER
4504 \# ---------------
4505 \# *Argument:
4506 \#   <none> | <anything> [distance to advance from top of page]
4507 \# *Function:
4508 \#   Turns printing of document header on or off.  If a second argument
4509 \#   in units of measure is given, advances that distance from the
4510 \#   top of the page without printing the document header.
4511 \# *Notes:
4512 \#   Default is on.  If the 1st argument is <anything> (which turns
4513 \#   document headers off), the optional 2nd argument may be given
4514 \#   (with a unit of measure).
4516 .MAC DOCHEADER END
4517 .    ie '\\$1'' \{ .nr #DOC_HEADER 1 \}
4518 .    el \{\
4519 .       if !'\\$2'' \{ .nr #ADVANCE_FROM_TOP (\\$2) \}
4520 .       nr #DOC_HEADER 0
4521 .    \}
4522 .END
4525 \# DOCUMENT HEADER LEADING
4526 \# -----------------------
4527 \# *Arguments:
4528 \#   <+|- amount by which to in/decrease leading of doc header>
4529 \# *Function:
4530 \#   Stores user supplied lead in/decrease in string $DOCHEADER_LEAD_ADJ.
4531 \# *Notes:
4532 \#   A unit of measure must be supplied.  Decimal fractions OK.
4533 \#   Default is +0, i.e. same as DOC_LEAD.
4535 .MAC DOCHEADER_LEAD END
4536 .    ds $DOCHEADER_LEAD_ADJ \\$1
4537 .END
4540 \# DOCHEADER ADVANCE
4541 \# -----------------
4542 \# *Arguments:
4543 \#   <docheader start position>
4544 \# *Function:
4545 \#   Creates register #DOCHEADER_ADVANCE, used in START.
4546 \# *Notes:
4547 \#   Unit of measure required.
4548 \#   Default is same as T_MARGIN.
4550 .MAC DOCHEADER_ADVANCE END
4551 .    nr #DOCHEADER_ADVANCE (\\$1)
4552 .END
4555 \# TITLE FAMILY
4556 \# ------------
4557 \# *Argument:
4558 \#   <family to use for the document header title>
4559 \# *Function:
4560 \#   Creates or modifies string $TITLE_FAM.
4561 \# *Notes:
4562 \#   Default is same as running text.
4564 .MAC TITLE_FAMILY END
4565 .    ds $TITLE_FAM \\$1
4566 .END
4569 \# TITLE FONT
4570 \# ----------
4571 \# *Argument:
4572 \#   <font to use for the document header title>
4573 \# *Function:
4574 \#   Creates or modifies string $TITLE_FT.
4575 \# *Notes:
4576 \#   Default is bold.
4578 .MAC TITLE_FONT END
4579 .    ds $TITLE_FT \\$1
4580 .END
4583 \# TITLE SIZE
4584 \# ----------
4585 \# *Argument:
4586 \#   <+|- number of points by which to in/decrease title at start
4587 \#   of the document (relative to running text)>
4588 \# *Function:
4589 \#   Creates string $TITLE_SIZE_CHANGE.
4590 \# *Notes:
4591 \#   Must be preceded by a +|- sign, with no space afterwards.
4592 \#   Fractional point sizes are allowed.
4593 \#   Default is +3.5 for printstyle TYPESET DEFAULT | STORY | NAMED;
4594 \#   4 for TYPESET CHAPTER; +0 for TYPEWRITE.
4596 .MAC TITLE_SIZE END
4597 .    ds $TITLE_SIZE_CHANGE \\$1
4598 .END
4601 \# CHAPTER TITLE FAMILY
4602 \# --------------------
4603 \# *Argument:
4604 \#   <family to use for the chapter title, if there is one>
4605 \# *Function:
4606 \#   Creates or modifies string $CHAPTER_TITLE_FAM.
4607 \# *Notes:
4608 \#   Default isame as running text.
4610 .MAC CHAPTER_TITLE_FAMILY END
4611 .    ds $CHAPTER_TITLE_FAM \\$1
4612 .END
4615 \# CHAPTER TITLE FONT
4616 \# ------------------
4617 \# *Argument:
4618 \#   <font to use for the chapter title, if there is one>
4619 \# *Function:
4620 \#   Creates or modifies string $CHAPTER_TITLE_FT.
4621 \# *Notes:
4622 \#   Default is bold italic for TYPESET; varies in TYPEWRITE between
4623 \#   caps and underscored, depending on whether chapter title stands
4624 \#   alone or has CHAPTER # above it.
4626 .MAC CHAPTER_TITLE_FONT END
4627 .    ds $CHAPTER_TITLE_FT \\$1
4628 .END
4631 \# CHAPTER TITLE SIZE
4632 \# ------------------
4633 \# *Argument:
4634 \#   <+|- number of points by which to in/decrease title at start
4635 \#   of the document (relative to running text)>
4636 \# *Function:
4637 \#   Creates string $CHAPTER_TITLE_SIZE_CHANGE.
4638 \# *Notes:
4639 \#   Must be preceded by a +|- sign, with no space afterwards.
4640 \#   Fractional point sizes are allowed.
4641 \#   Default is +4 for printstyle TYPESET
4643 .MAC CHAPTER_TITLE_SIZE END
4644 .    ds $CHAPTER_TITLE_SIZE_CHANGE \\$1
4645 .END
4648 \# SUBTITLE FAMILY
4649 \# ---------------
4650 \# *Argument:
4651 \#   <family to use for the document header title>
4652 \# *Function:
4653 \#   Creates or modifies string $SUBTITLE_FAM.
4654 \# *Notes:
4655 \#   Default is same as running text.
4657 .MAC SUBTITLE_FAMILY END
4658 .    ds $SUBTITLE_FAM \\$1
4659 .END
4662 \# SUBTITLE FONT
4663 \# -------------
4664 \# *Argument:
4665 \#   <font to use for the document header title>
4666 \# *Function:
4667 \#   Creates or modifies string $SUBTITLE_FT.
4668 \# *Notes:
4669 \#   Default is same as running text.
4671 .MAC SUBTITLE_FONT END
4672 .    ds $SUBTITLE_FT \\$1
4673 .END
4676 \# SUBTITLE SIZE
4677 \# -------------
4678 \# *Argument:
4679 \#   <+|- number of points by which to in/decrease subtitle at start
4680 \#   of the document (relative to running text)>
4681 \# *Function:
4682 \#   Creates or modifies string $SUBTITLE_SIZE_CHANGE.
4683 \# *Notes:
4684 \#   Must be preceded by a +|- sign with no space afterwards.
4685 \#   Fractional point sizes are allowed.
4686 \#   Default is +0.
4688 .MAC SUBTITLE_SIZE END
4689 .    ds $SUBTITLE_SIZE_CHANGE \\$1
4690 .END
4693 \# AUTHOR FAMILY
4694 \# -------------
4695 \# *Argument:
4696 \#   <family to use for author in document header>
4697 \# *Function:
4698 \#   Creates or modifies string $AUTHOR_FAM.
4699 \# *Notes:
4700 \#   Default is same as running text.
4702 .MAC AUTHOR_FAMILY END
4703 .    ds $AUTHOR_FAM \\$1
4704 .END
4707 \# AUTHOR FONT
4708 \# -----------
4709 \# *Argument:
4710 \#   <font to use for author in document header>
4711 \# *Function:
4712 \#   Creates or modifies string $AUTHOR_FT.
4713 \# *Notes:
4714 \#   Default is italic.
4716 .MAC AUTHOR_FONT END
4717 .    ds $AUTHOR_FT \\$1
4718 .END
4721 \# AUTHOR SIZE
4722 \# -----------
4723 \# *Argument:
4724 \#   <+|- number of points by which to in/decrease author at start
4725 \#   of the document>
4726 \# *Function:
4727 \#   Creates or modifies string $AUTHOR_SIZE_CHANGE.
4728 \# *Notes:
4729 \#   Must be preceded by a +|- sign with no space afterwards.
4730 \#   Fractional point sizes are allowed.
4731 \#   Default is same as running text.
4733 .MAC AUTHOR_SIZE END
4734 .    ds $AUTHOR_SIZE_CHANGE \\$1
4735 .END
4738 \# DOCTYPE FAMILY
4739 \# --------------
4740 \# *Argument:
4741 \#   <family to use for the document type string>
4742 \# *Function:
4743 \#   Creates or modifies string $DOCTYPE_FAM.
4744 \# *Notes:
4745 \#   Default is same as running text.
4747 .MAC DOCTYPE_FAMILY END
4748 .    ds $DOCTYPE_FAM \\$1
4749 .END
4752 \# DOCTYPE FONT
4753 \# ------------
4754 \# *Argument:
4755 \#   <font to use for the document type string>
4756 \# *Function:
4757 \#   Creates or modifies string $DOCTYPE_FT.
4758 \# *Notes:
4759 \#   Default is bold italic.
4761 .MAC DOCTYPE_FONT END
4762 .    ds $DOCTYPE_FT \\$1
4763 .END
4766 \# DOCTYPE SIZE
4767 \# -------------
4768 \# *Argument:
4769 \#   <+|- number of points by which to in/decrease the document
4770 \#   type string (relative to running text)>
4771 \# *Function:
4772 \#   Creates or modifies string $DOCTYPE_SIZE_CHANGE.
4773 \# *Notes:
4774 \#   Must be preceded by a +|- sign with no space afterwards.
4775 \#   Fractional point sizes are allowed.
4776 \#   Default is +3 for TYPESET; 0 for TYPEWRITE.
4778 .MAC DOCTYPE_SIZE END
4779 .    ds $DOCTYPE_SIZE_CHANGE \\$1
4780 .END
4783 \# DOCUMENT LEFT MARGIN
4784 \# --------------------
4785 \# *Argument:
4786 \#   <left margin of document>
4787 \# *Function:
4788 \#   Creates or modifies register #DOC_L_MARGIN.
4789 \# *Notes:
4790 \#   Affects EVERYTHING on the page.
4792 .MAC DOC_LEFT_MARGIN END
4793 .    br
4794 .    nr #DOC_L_MARGIN (\\$1)
4795 .    L_MARGIN \\n[#DOC_L_MARGIN]u
4796 .END
4799 \# DOCUMENT RIGHT MARGIN
4800 \# ---------------------
4801 \# *Argument:
4802 \#   <right margin of document>
4803 \# *Function:
4804 \#   Creates or modifies register #DOC_R_MARGIN.
4805 \# *Notes:
4806 \#   Affects EVERYTHING on the page.
4808 .MAC DOC_RIGHT_MARGIN END
4809 .    br
4810 .    nr #DOC_R_MARGIN (\\$1)
4811 .    R_MARGIN \\n[#DOC_R_MARGIN]
4812 .    nr #DOC_L_LENGTH \\n[#L_LENGTH]
4813 .END
4816 \# DOCUMENT LINE LENGTH
4817 \# --------------------
4818 \# *Argument:
4819 \#   <line length of document>
4820 \# *Function:
4821 \#   Creates or modifies string $DOC_L_LENGTH.
4822 \# *Notes:
4823 \#   Affects EVERYTHING on the page.
4825 .MAC DOC_LINE_LENGTH END
4826 .    br
4827 .    nr #DOC_L_LENGTH (\\$1)
4828 .    LL \\n[#DOC_L_LENGTH]u
4829 .    ta \\n(.lu
4830 .END
4833 \# DOCUMENT FAMILY
4834 \# ---------------
4835 \# *Argument:
4836 \#   <family of running text>
4837 \# *Function:
4838 \#   Creates or modifies string $DOC_FAM.
4839 \# *Notes:
4840 \#   Affects everything EXCEPT headers and footers.
4842 .MAC DOC_FAMILY END
4843 .    br
4844 .    ds $DOC_FAM \\$1
4845 .    FAMILY            \\*[$DOC_FAM]
4846 .    TITLE_FAMILY      \\*[$DOC_FAM]
4847 .    SUBTITLE_FAMILY   \\*[$DOC_FAM]
4848 .    AUTHOR_FAMILY     \\*[$DOC_FAM]
4849 .    DOCTYPE_FAMILY    \\*[$DOC_FAM]
4850 .    HEAD_FAMILY       \\*[$DOC_FAM]
4851 .    SUBHEAD_FAMILY    \\*[$DOC_FAM]
4852 .    QUOTE_FAMILY      \\*[$DOC_FAM]
4853 .    BLOCKQUOTE_FAMILY \\*[$DOC_FAM]
4854 .    EPIGRAPH_FAMILY   \\*[$DOC_FAM]
4855 .    HDRFTR_FAMILY     \\*[$DOC_FAM]
4856 .    PAGENUM_FAMILY    \\*[$DOC_FAM]
4857 .END
4860 \# DOCUMENT POINT SIZE
4861 \# -------------------
4862 \# *Argument:
4863 \#   <point size of running text>
4864 \# *Function:
4865 \#   Creates or modifies register #DOC_PT_SIZE.
4866 \# *Notes:
4867 \#   DOC_PT_SIZE is the basis for calculating all type sizes in
4868 \#   a document.
4870 .MAC DOC_PT_SIZE END
4871 .    if \\n[#IGNORE] \{ .return \}
4872 .    br
4873 .    PT_SIZE \\$1
4874 .    nr #DOC_PT_SIZE \\n[#PT_SIZE]
4875 .END
4878 \# DOCUMENT LEAD
4879 \# -------------
4880 \# *Argument:
4881 \#   <lead (".vs") of running text> [ADJUST]
4882 \# *Function:
4883 \#   Creates or modifies register #DOC_LEAD.  If the optional
4884 \#   ADJUST argument is given, adjusts leading so that the last
4885 \#   line of text falls exactly on #B_MARGIN.
4886 \# *Notes:
4887 \#   DOC_LEAD is the basis for calculating all leading changes in
4888 \#   a document.  Default for TYPESET is 16; 24 for TYPEWRITE.
4890 \#   Because the visible bottom or footer margin of a page depends
4891 \#   on the overall document lead supplied by the register #DOC_LEAD,
4892 \#   DOC_LEAD, in the body of a document, should always be associated
4893 \#   with the start of a new page (in other words, just before or
4894 \#   just after a manual NEWPAGE).
4896 .MAC DOC_LEAD END
4897 .    if \\n[#IGNORE] \{ .return \}
4898 .    br
4899 .    vs \\$1
4900 .    nr #DOC_LEAD \\n[#LEAD]
4901 .    if '\\$2'ADJUST' \{ .TRAPS \}
4902 .END
4904 \# ADJUST DOCUMENT LEAD
4905 \# --------------------
4906 \# *Arguments:
4907 \#   <none> | <anything>
4908 \# *Function:
4909 \#   Adjusts document lead so that the last line of text falls exactly
4910 \#   on #B_MARGIN.
4912 .MAC DOC_LEAD_ADJUST END
4913 .    ie '\\$1'' \{ .nr #ADJ_DOC_LEAD 1 \}
4914 .    el \{ .nr #ADJ_DOC_LEAD 0 \}
4915 .END
4918 \# SHIM
4919 \# ----
4920 \# *Argument:
4921 \#   None
4922 \# *Function:
4923 \#   Advances to the next "legal" baseline.
4924 \# *Notes:
4925 \#   If a user plays around with spacing in a doc (say, with ALD),
4926 \#   it isn't easy to get mom back on track so she can achieve
4927 \#   perfectly flush bottom margins.  Any time SHIM is used, it
4928 \#   ensures that the next output line falls on a legal baseline.
4930 .MAC SHIM END
4931 .    nr #CURRENT_V_POS \\n(.d
4932 .    nr #LEGAL_BASELINE \\n[#T_MARGIN] \\n[#DOC_LEAD]
4933 .    while \\n+[#LEGAL_BASELINE]<\\n[#CURRENT_V_POS] \{ . \}
4934 .    nr #SHIM \\n[#LEGAL_BASELINE]-\\n[#CURRENT_V_POS]
4935 .    ALD \\n[#SHIM]u
4936 .END
4939 \# DOCUMENT QUAD
4940 \# -------------
4941 \# *Arguments:
4942 \#   L | LEFT | R | RIGHT | C | CENTER | CENTRE | J | JUSTIFY
4943 \# *Function:
4944 \#   Creates or modifies string $DOC_QUAD.
4945 \# *Notes:
4946 \#   While QUAD (from the typesetting macros) can be used before START
4947 \#   to change  the default document quad, DOC_QUAD *must* be used after
4948 \#   the START macro has been invoked.
4950 \#   Default is LEFT for printstyle TYPEWRITE, JUSTIFY for printstyle
4951 \#   TYPESET.
4953 .MAC DOC_QUAD END
4954 .    ds $DOC_QUAD \\$1
4955 .    QUAD \\*[$DOC_QUAD]
4956 .END
4958 \# ====================================================================
4960 \# +++INTERNATIONALIZATION+++
4962 \# ATTRIBUTE STRING
4963 \# ----------------
4964 \# *Argument:
4965 \#   <what goes in the "by" slot before author in the document header>
4966 \# *Function:
4967 \#   Creates or modifies string $ATTRIBUTE_STRING.
4968 \# *Notes:
4969 \#   Default is "by".  A blank string ("") may be used if no
4970 \#   attribution is desired.
4972 .MAC ATTRIBUTE_STRING END
4973 .    ds $ATTRIBUTE_STRING \\$1
4974 .END
4977 \# CHAPTER STRING
4978 \# --------------
4979 \# *Argument:
4980 \#   <what to print any time the word "chapter" is required>
4981 \# *Function:
4982 \#   Creates or modifies string $CHAPTER_STRING.
4983 \# *Notes:
4984 \#   Default is "chapter".
4986 .MAC CHAPTER_STRING END
4987 .    ds $CHAPTER_STRING \\$1
4988 .END
4991 \# DRAFT STRING
4992 \# ------------
4993 \# *Argument:
4994 \#   <what to print any time the word "draft" is required>
4995 \# *Function:
4996 \#   Creates or modifies string $DRAFT_STRING.
4997 \# *Notes:
4998 \#   Default is "draft".
5000 .MAC DRAFT_STRING END
5001 .    ds $DRAFT_STRING \\$1
5002 .END
5005 \# REVISION STRING
5006 \# ---------------
5007 \# *Argument:
5008 \#   <what to print any time the word "revision" is required>
5009 \# *Function:
5010 \#   Creates or modifies string $REVISION_STRING.
5011 \# *Notes:
5012 \#   Default is "revision".
5014 .MAC REVISION_STRING END
5015 .    ds $REVISION_STRING \\$1
5016 .END
5019 \# FINIS STRING
5020 \# ------------
5021 \# *Argument:
5022 \#   <what to print with the finis macro>
5023 \# *Function:
5024 \#   Creates or modifies string $FINIS_STRING.
5025 \# *Notes:
5026 \#   Default is "END".
5028 .MAC FINIS_STRING END
5029 .    nr #FINIS 1
5030 .    CAPS
5031 .    ds $FINIS_STRING \\$1
5032 .    CAPS OFF
5033 .END
5035 \# ====================================================================
5037 \# +++RECTO/VERSO+++
5039 \# RECTO_VERSO
5040 \# -----------
5041 \# *Arguments:
5042 \#   <none> | <anything>
5043 \# *Function:
5044 \#   Switches HDRFTR_LEFT and HDRFTR_RIGHT on alternate pages.  Also
5045 \#   switches page numbers left and right if either is chosen rather
5046 \#   than the default centered page numbers.  Switches left and right
5047 \#   margins if differing values have been entered.
5048 \# *Notes:
5049 \#   Default is OFF.
5051 .MAC RECTO_VERSO END
5052 .    ie '\\$1'' \{ .nr #RECTO_VERSO 1 \}
5053 .    el \{ .nr #RECTO_VERSO 0 \}
5054 .END
5056 \# ====================================================================
5058 \# +++EPIGRAPHS+++
5060 \# EPIGRAPH FAMILY
5061 \# ---------------
5062 \# *Argument:
5063 \#   <family to use for epigraphs>
5064 \# *Function:
5065 \#   Creates or modifies string $EPI_FAM.
5066 \# *Notes:
5067 \#   Default is same as running text.
5069 .MAC EPIGRAPH_FAMILY END
5070 .    ds $EPI_FAM \\$1
5071 .END
5074 \# EPIGRAPH FONT
5075 \# -------------
5076 \# *Argument:
5077 \#   <font to use for epigraphs>
5078 \# *Function:
5079 \#   Creates or modifies string $EPI_FT.
5080 \# *Notes:
5081 \#   Default is same as running text.
5083 .MAC EPIGRAPH_FONT END
5084 .    ds $EPI_FT \\$1
5085 .END
5088 \# EPIGRAPH SIZE
5089 \# -------------
5090 \# *Argument:
5091 \#   <-|+ number of points by which to de/increase point size of epigraphs
5092 \#   (relative to running text)>
5093 \# *Function:
5094 \#   Creates or modifies string $EPI_SIZE_CHANGE.
5095 \# *Notes:
5096 \#   Must be preceded by a - or + sign with no space afterwards.
5097 \#   Fractional point sizes are allowed.  Default -1.5 for printstyle
5098 \#   TYPESET; +0 for TYPEWRITE.
5100 .MAC EPIGRAPH_SIZE END
5101 .    ds $EPI_SIZE_CHANGE \\$1
5102 .END
5105 \# EPIGRAPH QUAD
5106 \# -------------
5107 \# *Arguments:
5108 \#   L | LEFT | J | JUSTIFY
5109 \# *Function:
5110 \#   Creates or modifies string $EPI_QUAD.
5111 \# *Notes:
5112 \#   Default is $DOC_QUAD when BLOCK argument is passed to EPIGRAPH.
5114 .MAC EPIGRAPH_QUAD END
5115 .    ds $EPI_QUAD \\$1
5116 .END
5119 \# EPIGRAPH INDENT
5120 \# ---------------
5121 \# *Argument:
5122 \#   <value by which to multiply PP_INDENT for block epigraphs>
5123 \# *Function:
5124 \#   Creates or modifies register #EPI_OFFSET_VALUE.
5125 \# *Notes:
5126 \#   Default is 2 for TYPEWRITE, 3 for TYPESET.
5128 .MAC EPIGRAPH_INDENT END
5129 .    nr #EPI_OFFSET_VALUE \\$1
5130 .END
5133 \# EPIGRAPH AUTOLEAD
5134 \# -----------------
5135 \# *Argument:
5136 \#   <amount of lead to add to the epigraph ps for epigraph leading>
5137 \# *Function:
5138 \#   Creates or modifies register #EPI_AUTOLEAD.
5139 \# *Notes:
5140 \#   Default is 2 (for TYPESET; TYPEWRITE doesn't require this).
5142 .MAC EPIGRAPH_AUTOLEAD END
5143 .    nr #EPI_AUTOLEAD \\$1
5144 .END
5147 \# EPIGRAPH
5148 \# --------
5149 \# *Arguments:
5150 \#   BLOCK | <anything>
5151 \# *Function:
5152 \#   Places an epigraph before the document's text, after the
5153 \#   document header, or after a HEAD.
5154 \# *Notes:
5155 \#   #EPIGRAPH 1 = centered; 2 = block
5157 \#   By default, epigraphs are centered, allowing the user
5158 \#   to input them on a line per line basis.  To change this
5159 \#   behaviour, the user can supply the argument BLOCK, which
5160 \#   will produce indented, filled text similar to BLOCKQUOTE.
5162 \#   If a block epigraph contains more than one para, ALL paras of
5163 \#   the epigraph must be preceded by PP.  Otherwise, PP is optional.
5165 .MAC EPIGRAPH END
5166 .    nr #PP_STYLE 2
5167 .    nr #Q_PP     0
5168 .    if \\n[#START] \{\
5169 .       if \\n[#PRINT_STYLE]=1 \{\
5170 .          if \\n[#AUTHOR_LINES]=1 \{ .ALD \\n[#DOC_LEAD]u \}
5171 .       \}
5172 .    \}
5173 .    ie '\\$1'' \{\
5174 .       nr #EPIGRAPH 1
5175 .       ev EPIGRAPH
5176 .       ll \\n[#L_LENGTH]u
5177 .       ta \\n(.lu
5178 .       CHECK_INDENT
5179 .       if \\n[#COLUMNS] \{\
5180 .          ie \\n[#START] \{\
5181 .              ll \\n[#DOC_L_LENGTH]u
5182 .              ta \\n(.lu
5183 .          \}
5184 .          el \{\
5185 .             ll \\n[#COL_L_LENGTH]u
5186 .             ta \\n(.lu
5187 .          \}
5188 .       \}
5189 .       CENTER
5190 .       if \\n[#PRINT_STYLE]=1 \{\
5191 .          fam C
5192 .          ft  R
5193 .          if '\\*[$EPI_FT]'I' \{\
5194 .             FT I
5195 .          \}
5196 .          ps  12
5197 .          ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u \}
5198 .          el \{ .vs  \\n[#DOC_LEAD]u/2u \}
5199 .          nr #EPI_LEAD      \\n[#LEAD]
5200 .          nr #EPI_LEAD_DIFF \\n[#DOC_LEAD]-\\n[#EPI_LEAD]
5201 .       \}
5202 .       if \\n[#PRINT_STYLE]=2 \{\
5203 .          FAMILY   \\*[$EPI_FAM]
5204 .          FT       \\*[$EPI_FT]
5205 .          PT_SIZE  \\n[#DOC_PT_SIZE]u\\*[$EPI_SIZE_CHANGE]
5206 .          AUTOLEAD \\n[#EPI_AUTOLEAD]
5207 .          nr #EPI_LEAD      \\n[#LEAD]
5208 .          nr #EPI_LEAD_DIFF \\n[#DOC_LEAD]-\\n[#EPI_LEAD]
5209 .       \}
5210 .       di EPI_TEXT
5211 .       nr #EPI_ACTIVE 1
5212 .    \}
5213 .    el \{\
5214 .       ie '\\$1'BLOCK' \{\
5215 .          nr #EPIGRAPH 2
5216 .          ev EPIGRAPH
5217 .          ie \\n[#START] \{\
5218 .             ie \\n[#COLUMNS] \{\
5219 .                ll \\n[#L_LENGTH_FOR_EPI]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
5220 .                ta \\n(.lu
5221 .             \}
5222 .             el \{\
5223 .                ll \\n[#L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
5224 .                ta \\n(.lu
5225 .             \}
5226 .          \}
5227 .          el \{\
5228 .             ll \\n[#L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
5229 .             ta \\n(.lu
5230 .             if \\n[#COLUMNS] \{\
5231 .                ll \\n[#COL_L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
5232 .                ta \\n(.lu
5233 .             \}
5234 .             CHECK_INDENT
5235 .          \}
5236 .          if \\n[#PRINT_STYLE]=1 \{\
5237 .             fam C
5238 .             ft  R
5239 .             if '\\*[$EPI_FT]'I' \{\
5240 .                FT I
5241 .             \}
5242 .             ps  12
5243 .             ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u \}
5244 .             el \{ .vs  \\n[#DOC_LEAD]u/2u \}
5245 .             QUAD LEFT
5246 .             HY OFF
5247 .             nr #EPI_LEAD \\n[#LEAD]
5248 .             nr #EPI_LEAD_DIFF \\n[#DOC_LEAD]-\\n[#EPI_LEAD]
5249 .             di EPI_TEXT
5250 .             nr #EPI_ACTIVE 1
5251 .          \}
5252 .          if \\n[#PRINT_STYLE]=2 \{\
5253 .             FAMILY   \\*[$EPI_FAM]
5254 .             FT       \\*[$EPI_FT]
5255 .             PT_SIZE  \\n[#DOC_PT_SIZE]u\\*[$EPI_SIZE_CHANGE]
5256 .             AUTOLEAD \\n[#EPI_AUTOLEAD]
5257 .             QUAD     \\*[$EPI_QUAD]
5258 .             HY
5259 .             nr #EPI_LEAD \\n[#LEAD]
5260 .             nr #EPI_LEAD_DIFF \\n[#DOC_LEAD]-\\n[#EPI_LEAD]
5261 .             di EPI_TEXT
5262 .             nr #EPI_ACTIVE 1
5263 .          \}
5264 .       \}
5265 .       el \{\
5266 .          DO_EPIGRAPH
5267 .       \}
5268 .    \}
5269 .END
5272 \# DO EPIGRAPH
5273 \# -----------
5274 \# *Arguments:
5275 \#   <none>
5276 \# *Function:
5277 \#   Ends diversion started in EPIGRAPH.  Makes spacing
5278 \#   adjustments to compensate for the difference between epigraph
5279 \#   leading and overall document leading, so that the bottom of
5280 \#   the pages remain flush.
5281 \# *Notes:
5282 \#   In addition to its usual place at the beginning of a
5283 \#   document, EPIGRAPH may also be used after HEAD.
5285 .MAC DO_EPIGRAPH END
5286 .    br
5287 .    di
5288 .    REMOVE_INDENT
5289 .    ev
5290 .    nr #EPI_DEPTH \\n[#DIVER_DEPTH]-\\n[#EPI_LEAD]
5291 .    nr #EPI_LINES \\n[#EPI_DEPTH]/\\n[#EPI_LEAD]
5292 .    ie \\n[#START] \{\
5293 .       nr #EPI_WHITESPACE (\\n[#DOC_LEAD]*\\n[#EPI_LINES])-\\n[#EPI_DEPTH]
5294 .       while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{ .nr #EPI_WHITESPACE -\\n[#DOC_LEAD] \}
5295 .       if \\n[#PRINT_STYLE]=2 \{\
5296 .          RLD \\n[#DOC_LEAD]u
5297 .          if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \{\
5298 .             ALD \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)
5299 .          \}
5300 .          if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
5301 .             ALD \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)-\\n[#DOC_LEAD]u
5302 .          \}
5303 .       \}
5304 .    \}
5305 .    el \{\
5306 .       ie \\n[#EPI_DEPTH]<\\n[#TRAP_DISTANCE] \{\
5307 .          nr #EPI_FITS 1
5308 .          nr #EPI_WHITESPACE (\\n[#DOC_LEAD]*\\n[#EPI_LINES])-\\n[#EPI_DEPTH]
5309 .          while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{ .nr #EPI_WHITESPACE -\\n[#DOC_LEAD] \}
5310 .          ie \\n[#PRINT_STYLE]=1 \{\
5311 .             if \\n[#EPI_WHITESPACE]=\\n[#DOC_LEAD] \{ .ALD \\n[#EPI_WHITESPACE]u/2u \}
5312 .          \}
5313 .          el \{\
5314 .             if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \{\
5315 .                ALD \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)
5316 .             \}
5317 .             if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
5318 .                ALD \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)-\\n[#DOC_LEAD]u
5319 .             \}
5320 .          \}
5321 .       \}
5322 .       el \{\
5323 .          nr #EPI_LINES_TO_TRAP 0 1
5324 .          while \\n[#EPI_LEAD]*\\n+[#EPI_LINES_TO_TRAP]<\\n[#TRAP_DISTANCE] \{ .nr #LOOP 1 \}
5325 .          nr #EPI_LINES_TO_TRAP -1
5326 .          nr #EPI_WHITESPACE (\\n[#EPI_LINES_TO_TRAP]*\\n[#DOC_LEAD])-(\\n[#EPI_LINES_TO_TRAP]*\\n[#EPI_LEAD])
5327 .          while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{ .nr #EPI_WHITESPACE -\\n[#DOC_LEAD] \}
5328 .          if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \{ .ALD \\n[#EPI_WHITESPACE]u \}
5329 .          if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{ .ALD \\n[#EPI_WHITESPACE]u-\\n[#DOC_LEAD]u \}
5330 .      \}
5331 .    \}
5332 .    if \\n[#EPIGRAPH]=1 \{\
5333 .       po \\n[#L_MARGIN]u
5334 .       if \\n[#COLUMNS] \{ .po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u \}
5335 .    \}
5336 .    if \\n[#EPIGRAPH]=2 \{\
5337 .       nr #EPI_OFFSET \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
5338 .       if \\n[#COLUMNS] \{\
5339 .          nr #EPI_OFFSET \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
5340 .       \}
5341 .       po \\n[#EPI_OFFSET]u
5342 .    \}
5343 .    nf
5344 .    EPI_TEXT
5345 .    br
5346 .    ie \\n[#START] \{\
5347 .       if \\n[#PRINT_STYLE]=1 \{\
5348 .          ie \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
5349 .          el \{\
5350 .             ie \\n[#EPI_LINES]%2=1 \{ .ALD \\n[#DOC_LEAD]u \}
5351 .             el \{ .ALD \\n[#DOC_LEAD]u/2u \}
5352 .          \}
5353 .       \}
5354 .       if \\n[#PRINT_STYLE]=2 \{\
5355 .          if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \{\
5356 .             ALD \\n[#EPI_WHITESPACE]u/2u
5357 .          \}
5358 .          if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
5359 .             ALD (\\n[#EPI_WHITESPACE]u/2u)-\\n[#DOC_LEAD]u
5360 .          \}
5361 .       \}
5362 .    \}
5363 .    el \{\
5364 .       rr #EPI_ACTIVE
5365 .       ie \\n[#EPI_FITS] \{\
5366 .          ie \\n[#FN_FOR_EPI] \{\
5367 .             nr #EPI_LINES_TO_END 1
5368 .             nr #EPI_WHITESPACE (\\n[#EPI_LINES_TO_END]*\\n[#DOC_LEAD])-(\\n[#EPI_LINES_TO_END]*\\n[#EPI_LEAD])
5369 .             while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{ .nr #EPI_WHITESPACE -\\n[#DOC_LEAD] \}
5370 .             ALD \\n[#EPI_WHITESPACE]u-(\\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u)
5371 .          \}
5372 .          el \{\
5373 .             ie \\n[#PRINT_STYLE]=1 \{\
5374 .                if \\n[#EPI_WHITESPACE]=\\n[#DOC_LEAD] \{ .ALD \\n[#EPI_WHITESPACE]u \}
5375 .             \}
5376 .             el \{\
5377 .                if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \{\
5378 .                   ALD \\n[#EPI_WHITESPACE]u/2u
5379 .                \}
5380 .                if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
5381 .                   ALD (\\n[#EPI_WHITESPACE]u/2u)-\\n[#DOC_LEAD]u
5382 .                \}
5383 .             \}
5384 .          \}
5385 .       \}
5386 .       el \{\
5387 .          nr #EPI_LINES_TO_END \\n[#EPI_LINES]-\\n[#EPI_LINES_TO_TRAP]
5388 .          if \\n[#LOOP] \{. nr #EPI_LINES_TO_END +1 \}
5389 .          rr #LOOP
5390 .          nr #EPI_WHITESPACE (\\n[#EPI_LINES_TO_END]*\\n[#DOC_LEAD])-(\\n[#EPI_LINES_TO_END]*\\n[#EPI_LEAD])
5391 .          while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{ .nr #EPI_WHITESPACE -\\n[#DOC_LEAD] \}
5392 .          ALD \\n[#EPI_WHITESPACE]u-(\\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u)
5393 .          if \\n[#PRINT_STYLE]=1 \{\
5394 .             if !\\n[#SINGLE_SPACE] \{\
5395 .                nr #EPI_LINES_EVEN \\n[#EPI_LINES_TO_END]%2
5396 .                ie \\n[#EPI_LINES_EVEN] \{ .ALD .5v \}
5397 .                el \{ .RLD .5v \}
5398 .                rr #EPI_LINES_EVEN
5399 .             \}
5400 .          \}
5401 .       \}
5402 .    \}
5403 .    nr #PP_STYLE 1
5404 .    rr #EPI_FITS
5405 .    ALD \\n[#DOC_LEAD]u
5406 .    QUAD \\*[$DOC_QUAD]
5407 .    po \\n[#L_MARGIN]u
5408 .    if \\n[#COLUMNS] \{ .po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u \}
5409 .    if \\n[#START] \{\
5410 .       if \\n[#COLUMNS] \{\
5411 .          po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
5412 .          mk dc
5413 .       \}
5414 .    \}
5415 .END
5417 \# ====================================================================
5419 \# +++FINIS MACRO+++
5421 \# FINIS
5422 \# -----
5423 \# *Arguments:
5424 \#   <none>
5425 \# *Function:
5426 \#   Deposits --END-- at the end of a document.
5428 .MAC FINIS END
5429 .    nr #FINIS 1
5430 .    if \\n[#TAB_ACTIVE] \{ .TQ \}
5431 .    if \\n[#INDENT_ACTIVE] \{ .IQ CLEAR \}
5432 .    if \\n[#FOOTERS_ON] \{\
5433 .       nr #FOOTERS_WERE_ON 1
5434 .       FOOTERS OFF
5435 .    \}
5436 .    if \\n[#PAGINATE] \{\
5437 .       if \\n[#PAGE_NUM_V_POS]=2 \{\
5438 .          nr #PAGINATION_WAS_ON 1
5439 .          PAGINATION OFF
5440 .       \}
5441 .    \}
5442 .    nr #EM_ADJUST (1m/8)
5443 .    if \\n[#COLUMNS] \{ .po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u \}
5444 .    ALD \\n[#DOC_LEAD]u
5445 .    CENTER
5446 .    if \\n[#PRINT_STYLE]=1 \{ .PRINT "--\\*[$FINIS_STRING]--\}
5447 .    if \\n[#PRINT_STYLE]=2 \{\
5448 .       PRINT "\v'-\\n[#EM_ADJUST]u'\(em\v'+\\n[#EM_ADJUST]u'\\*[$FINIS_STRING]\v'-\\n[#EM_ADJUST]u'\*[FU1]\(em
5449 .    \}
5450 .END
5452 \# ====================================================================
5454 \# +++HEADERS/FOOTERS+++
5456 \# Define a string so that the current page number can be incorporated
5457 \# into the strings for hdrftr left, right, and center.  NOTE: This is
5458 \# not the same thing as using the shortform # in hdrftr strings.
5460 .ds PAGE# \En[#PAGENUMBER]
5463 \# HDRFTR FAMILY
5464 \# -------------
5465 \# *Argument:
5466 \#   <family to use in header/footers>
5467 \# *Function:
5468 \#   Creates or modifies string $HDRFTR_FAM.
5469 \# *Notes:
5470 \#   Default is same as running text.
5472 .MAC HDRFTR_FAMILY END
5473 .    ds $HDRFTR_FAM \\$1
5474 .END
5477 \# HDRFTR SIZE
5478 \# -----------
5479 \# *Argument:
5480 \#   <+|-number of points by which to in/decrease point size of
5481 \#   header/footers (relative to running text)>
5482 \# *Function:
5483 \#   Creates or modifies string $HDRFTR_SIZE_CHANGE.
5484 \# *Notes:
5485 \#   Must be preceded by a +|- sign.  No space afterwards.
5486 \#   Fractional point sizes are allowed.  Default is +0.
5488 \#   By default, header/footers print the author .5 points smaller
5489 \#   than the base point size of running text, center titles
5490 \#   (Chapter, Draft, Revision, etc.)  .5 points smaller
5491 \#   than running text (in italics), and the document title 2 full
5492 \#   points smaller than running text (in caps).  The HDRFTR_SIZE
5493 \#   macro changes the overall size for all three parts while
5494 \#   maintaining the internal size changes.
5496 \#   In other words, if the user likes the header/footers but wants
5497 \#   them a bit bigger or a bit smaller, s/he should use HDRFTR_SIZE.
5499 .MAC HDRFTR_SIZE END
5500 .    ds $HDRFTR_SIZE_CHANGE \\$1
5501 .END
5504 \# HDRFTR RULE GAP
5505 \# ---------------
5506 \# *Argument:
5507 \#   <amount of space between header/footer and header/footer rule>
5508 \# *Function:
5509 \#   Creates or modifies register #HDRFTR_RULE_GAP to hold amount
5510 \#   of space between header/footer and header/footer rule.
5511 \# *Notes:
5512 \#   Default is 4p.
5514 .MAC HDRFTR_RULE_GAP END
5515 .    nr #HDRFTR_RULE_GAP (\\$1)
5516 .END
5519 \# HDRFTR LEFT
5520 \# -----------
5521 \# *Argument:
5522 \#   <what to put in the left position of page header/footers>
5523 \# *Function:
5524 \#   Creates or modifies string $HDRFTR_LEFT.
5525 \#   Creates register #USER_DEF_HDRFTR_LEFT, which, if 1,
5526 \#   overrides the $HDRFTR_LEFT string created by default
5527 \#   in DEFAULTS.
5528 \# *Notes:
5529 \#   Especially useful if doc has more than one author, and a list
5530 \#   of authors by last name is desired in header/footers.
5531 \#   Default is author.
5533 \#   If the argument is the # character, simply prints the current
5534 \#   page number.
5536 \#   If the user wants to *incorporate* the page number into the string,
5537 \#   \*[PAGE#] must be used.  For example, if the user wants to put
5538 \#   an elipsis before the page number in the string, s/he should use
5539 \#   ...\*[PAGE#], not ...#
5541 .MAC HDRFTR_LEFT END
5542 .    nr #USER_DEF_HDRFTR_LEFT 1
5543 .    ds $HDRFTR_LEFT \\$1
5544 .END
5547 \# HDRFTR LEFT FAMILY
5548 \# ------------------
5549 \# *Argument:
5550 \#   <family of header/footer left string>
5551 \# *Function:
5552 \#   Creates or modifies string $HDRFTR_LEFT_FAM.
5554 .MAC HDRFTR_LEFT_FAMILY END
5555 .    ds $HDRFTR_LEFT_FAM \\$1
5556 .END
5559 \# HDRFTR LEFT FONT
5560 \# ----------------
5561 \# *Argument:
5562 \#   <font of header/footer left string>
5563 \# *Function:
5564 \#   Creates or modifies string $HDRFTR_LEFT_FT.
5566 .MAC HDRFTR_LEFT_FONT END
5567 .    ds $HDRFTR_LEFT_FT \\$1
5568 .END
5571 \# HDRFTR LEFT SIZE
5572 \# ----------------
5573 \# *Argument:
5574 \#   <+|- number of points to in/decrease size of left string in
5575 \#   header/footers (relative to running text)>
5576 \# *Function:
5577 \#   Creates or modifies string HDRFTR_LEFT_SIZE_CHANGE.
5578 \# *Notes:
5579 \#   Must be preceded by a +|- sign.  No space afterwards.
5580 \#   Fractional point sizes are allowed.
5581 \#   Default is -.5 for printstyle TYPESET; if all caps, -2
5582 \#   Has no effect in TYPEWRITE.
5584 .MAC HDRFTR_LEFT_SIZE END
5585 .    ds $HDRFTR_LEFT_SIZE_CHANGE \\$1
5586 .END
5589 \# HDRFTR LEFT CAPS
5590 \# ----------------
5591 \# *Argument:
5592 \#   <none> | <anything>
5593 \# *Function:
5594 \#   Turns capitalisation of $HDRFTR_LEFT (typically, the author of
5595 \#   the document) on or off.
5596 \# *Notes:
5597 \#   Default is on.
5599 .MAC HDRFTR_LEFT_CAPS END
5600 .    ie '\\$1'' \{\
5601 .        nr #HDRFTR_LEFT_CAPS 1
5602 .    \}
5603 .    el \{\
5604 .       nr #HDRFTR_LEFT_CAPS 0
5605 .       ds $HDRFTR_RIGHT_SIZE_CHANGE +0
5606 .    \}
5607 .END
5610 \# HDRFTR CENTER
5611 \# -------------
5612 \# *Argument:
5613 \#   <what to put in the centre position of page header/footers>
5614 \# *Function:
5615 \#   Creates or modifies string $HDRFTR_CENTER.
5616 \#   Creates register #USER_DEF_HDRFTR_CENTER, which, if 1,
5617 \#   overrides the $HDRFTR_CENTER string created by default
5618 \#   in COPYSTYLE.
5619 \# *Notes:
5620 \#   Default is document type if DOCTYPE NAMED, Chapter # if DOCTYPE
5621 \#   CHAPTER, draft and revision number if COPYSTYLE DRAFT.
5623 \#   If the argument is the # character, simply prints the current
5624 \#   page number.
5626 \#   If the user wants to *incorporate* the page number into the string,
5627 \#   \*[PAGE#] must be used.  For example, if the user wants to put
5628 \#   an elipsis before the page number in the string, s/he should use
5629 \#   ...\*[PAGE#], not ...#
5631 .MAC HDRFTR_CENTER END
5632 .    nr #USER_DEF_HDRFTR_CENTER 1
5633 .    if '\\$0'FOOTER_CENTER' \{\
5634 .       ds $HDRFTR_CENTER_OLD \\*[$HDRFTR_CENTER]
5635 .       ds $HDRFTR_CENTER_NEW \\$1
5636 .    \}
5637 .    if '\\$0'FOOTER_CENTRE' \{\
5638 .       ds $HDRFTR_CENTER_OLD \\*[$HDRFTR_CENTER]
5639 .       ds $HDRFTR_CENTER_NEW \\$1
5640 .    \}
5641 .    ds $HDRFTR_CENTER \\$1
5642 .END
5645 \# HDRFTR CENTER FAMILY
5646 \# --------------------
5647 \# *Argument:
5648 \#   <family of header/footer center string>
5649 \# *Function:
5650 \#   Creates or modifies string $HDRFTR_CENTER_FAM.
5652 .MAC HDRFTR_CENTER_FAMILY END
5653 .    ds $HDRFTR_CENTER_FAM \\$1
5654 .END
5657 \# HDRFTR CENTER FONT
5658 \# ------------------
5659 \# *Argument:
5660 \#   <font of header/footer center string>
5661 \# *Function:
5662 \#   Creates or modifies string $HDRFTR_CENTER_FT.
5664 .MAC HDRFTR_CENTER_FONT END
5665 .    ds $HDRFTR_CENTER_FT \\$1
5666 .END
5669 \# HDRFTR CENTER SIZE
5670 \# ------------------
5671 \# *Argument:
5672 \#   <+|- number of points to in/decrease size of centre string in
5673 \#   header/footers (relative to header/footer size)>
5674 \# *Function:
5675 \#   Creates string HDRFTR_CENTER_SIZE_CHANGE.
5676 \# *Notes:
5677 \#   Must be preceded by a +|- sign.  No space afterwards.
5678 \#   Fractional point sizes are allowed.
5679 \#   Default is -.5 for printstyle TYPESET; if all caps, -2
5680 \#   Has no effect in TYPEWRITE.
5682 .MAC HDRFTR_CENTER_SIZE END
5683 .    ds $HDRFTR_CENTER_SIZE_CHANGE \\$1
5684 .END
5687 \# HDRFTR CENTER CAPS
5688 \# ------------------
5689 \# *Argument:
5690 \#   <none> | <anything>
5691 \# *Function:
5692 \#   Turns capitalisation of $HDRFTR_CENTER (typically, doctype of
5693 \#   the document) on or off.
5694 \# *Notes:
5695 \#   Default is on.
5697 .MAC HDRFTR_CENTER_CAPS END
5698 .    ie '\\$1'' \{\
5699 .       nr #HDRFTR_CENTER_CAPS 1
5700 .    \}
5701 .    el \{\
5702 .       nr #HDRFTR_CENTER_CAPS 0
5703 .       ds $HDRFTR_CENTER_SIZE_CHANGE +0
5704 .    \}
5705 .END
5708 \# HDRFTR CENTER PADDING
5709 \# ---------------------
5710 \# *Argument:
5711 \#   LEFT | RIGHT <amount of padding to put left or right of hdrftr
5712 \#   center string>
5713 \# *Function:
5714 \#   Creates or modifies registers #HDRFTR_CTR_PAD_LEFT or
5715 \#   #HDRFTR_CTR_PAD_RIGHT.
5716 \# *Notes:
5717 \#   By default, the HDRFTR_CENTER string is centered on the doc
5718 \#   line length.  Long titles or long author names can screw up
5719 \#   visual centering, or create overprints.  This macro allows the
5720 \#   user to pad the center string by the specified amount of space
5721 \#   to fix these problems.  Use only one of LEFT or RIGHT.
5723 \#   A unit of measure is required.
5725 .MAC HDRFTR_CENTER_PAD END
5726 .    if '\\$1'LEFT' \{\
5727 .       nr #HDRFTR_CTR_PAD_LEFT (\\$2)
5728 .    \}
5729 .    if '\\$1'RIGHT' \{\
5730 .       nr #HDRFTR_CTR_PAD_RIGHT (\\$2)
5731 .    \}
5732 .END
5735 \# SWITCH HDRFTR CENTER PADDING SIDE - support macro
5736 \# --------------------------------
5737 \# *Argument:
5738 \#   <none>
5739 \# *Function:
5740 \#   Switches the padding side of hdrftr center padding.
5741 \# *Notes:
5742 \#   Required to keep spacing around hdrftr string constant
5743 \#   in recto/verso documents.
5745 .MAC SWITCH_HDRFTR_CENTER_PAD END
5746 .    nr #HDRFTR_CTR_PAD_TMP  \\n[#HDRFTR_CTR_PAD_LEFT]
5747 .    HDRFTR_CENTER_PAD LEFT  \\n[#HDRFTR_CTR_PAD_RIGHT]u
5748 .    HDRFTR_CENTER_PAD RIGHT \\n[#HDRFTR_CTR_PAD_TMP]u
5749 .END
5752 \# HDRFTR RIGHT
5753 \# ------------
5754 \# *Argument:
5755 \#   <what to put in the right position of page header/footers>
5756 \# *Function:
5757 \#   Creates or modifies string $HDRFTR_RIGHT.
5758 \#   Creates register #USER_DEF_HDRFTR_RIGHT, which, if 1,
5759 \#   overrides the $HDRFTR_RIGHT string created by default
5760 \#   in DEFAULTS.
5761 \# *Notes:
5762 \#   Default is document title.
5764 \#   If the argument is the # character, simply prints the current
5765 \#   page number.
5767 \#   If the user wants to *incorporate* the page number into the string,
5768 \#   \*[PAGE#] must be used.  For example, if the user wants to put
5769 \#   an elipsis before the page number in the string, s/he should use
5770 \#   ...\*[PAGE#], not ...#
5772 .MAC HDRFTR_RIGHT END
5773 .    nr #USER_DEF_HDRFTR_RIGHT 1
5774 .    ds $HDRFTR_RIGHT \\$1
5775 .END
5778 \# HDRFTR RIGHT FAMILY
5779 \# -------------------
5780 \# *Argument:
5781 \#   <family of header/footer right string>
5782 \# *Function:
5783 \#   Creates or modifies string $HDRFTR_RIGHT_FAM.
5785 .MAC HDRFTR_RIGHT_FAMILY END
5786 .    ds $HDRFTR_RIGHT_FAM \\$1
5787 .END
5790 \# HDRFTR RIGHT FONT
5791 \# -----------------
5792 \# *Argument:
5793 \#   <font of header/footer right string>
5794 \# *Function:
5795 \#   Creates or modifies string $HDRFTR_RIGHT_FT.
5797 .MAC HDRFTR_RIGHT_FONT END
5798 .    ds $HDRFTR_RIGHT_FT \\$1
5799 .END
5802 \# HDRFTR RIGHT SIZE
5803 \# -----------------
5804 \# *Argument:
5805 \#   <+|- number of points to in/decrease size of right string in
5806 \#   header/footers (relative to header/footer size)>
5807 \# *Function:
5808 \#   Creates or modifies string HDRFTR_RIGHT_SIZE_CHANGE.
5809 \# *Notes:
5810 \#   Must be preceded by a +|- sign.  No space afterwards.
5811 \#   Fractional point sizes are allowed.
5812 \#   Default is -2 for printstyle TYPESET if all caps; otherwise -.5
5813 \#   Has no effect in TYPEWRITE.
5815 .MAC HDRFTR_RIGHT_SIZE END
5816 .    ds $HDRFTR_RIGHT_SIZE_CHANGE \\$1
5817 .END
5820 \# HDRFTR RIGHT CAPS
5821 \# -----------------
5822 \# *Argument:
5823 \#   <none> | <anything>
5824 \# *Function:
5825 \#   Turns capitalisation of $HDRFTR_RIGHT (typically, the title of
5826 \#   the document) on or off.
5827 \# *Notes:
5828 \#   Default is on.
5830 .MAC HDRFTR_RIGHT_CAPS END
5831 .    ie '\\$1'' \{\
5832 .       nr #HDRFTR_RIGHT_CAPS 1
5833 .    \}
5834 .    el \{\
5835 .       nr #HDRFTR_RIGHT_CAPS 0
5836 .       ds $HDRFTR_RIGHT_SIZE_CHANGE +0
5837 .    \}
5838 .END
5840 \# HDRFTR RULE
5841 \# -----------
5842 \# *Arguments:
5843 \#   <none> | <anything>
5844 \# *Function:
5845 \#   If invoked via the alias HDRFTR_RULE_INTERNAL in HDRFTR, prints a rule
5846 \#   under the header/footer.  Otherwise, turns HDRFTR_RULE on or off.
5848 .MAC HDRFTR_RULE END   \"To print rule under header/over footer.
5849 .    ie '\\$0'HDRFTR_RULE_INTERNAL' \{\
5850 .       ie \\n[#USERDEF_HDRFTR] \{\
5851 .          nr #CAP_HEIGHT_ADJUST \\n[#HDRFTR_HEIGHT]
5852 .          PT_SIZE 12
5853 .          if \\n[#HEADERS_ON] \{ .ALD \\n[#HDRFTR_RULE_GAP]u \}
5854 .          if \\n[#FOOTERS_ON] \{\
5855 .              RLD \\n[#HDRFTR_RULE_GAP]u+\\n[#CAP_HEIGHT_ADJUST]u+1p
5856 .          \}
5857 .          PRINT \\l'\\n[#DOC_L_LENGTH]u'
5858 .          br
5859 .       \}
5860 .       el \{\
5861 .          if \\n[#PRINT_STYLE]=1 \{\
5862 .             nr #CAP_HEIGHT_ADJUST \\n[#CAP_HEIGHT]
5863 .          \}
5864 .          if \\n[#PRINT_STYLE]=2 \{\
5865 .             ie \\n[#LEFT_CAP_HEIGHT]>\\n[#CENTER_CAP_HEIGHT] \{\
5866 .                nr #CAP_HEIGHT_ADJUST \\n[#LEFT_CAP_HEIGHT]
5867 .             \}
5868 .             el \{ .nr #CAP_HEIGHT_ADJUST \\n[#CENTER_CAP_HEIGHT] \}
5869 .             ie \\n[#CAP_HEIGHT_ADJUST]>\\n[#RIGHT_CAP_HEIGHT] \{\
5870 .                nr #CAP_HEIGHT_ADJUST \\n[#CAP_HEIGHT_ADJUST]
5871 .             \}
5872 .             el \{ .nr #CAP_HEIGHT_ADJUST \\n[#RIGHT_CAP_HEIGHT] \}
5873 .          \}
5874 .          PT_SIZE 12
5875 .          if \\n[#HEADERS_ON] \{ .ALD \\n[#HDRFTR_RULE_GAP]u \}
5876 .          if \\n[#FOOTERS_ON] \{\
5877 .             RLD \\n[#LEAD]u*3u+\\n[#HDRFTR_RULE_GAP]u+\\n[#CAP_HEIGHT_ADJUST]u+1p
5878 .          \}
5879 .          PRINT \\l'\\n[#DOC_L_LENGTH]u'
5880 .          br
5881 .       \}
5882 .    \}
5883 .    el \{\
5884 .       ie '\\$1'' \{ .nr #HDRFTR_RULE 1 \}
5885 .       el \{ .nr #HDRFTR_RULE 0 \}
5886 .    \}
5887 .END
5890 .ALIAS HDRFTR_RULE_INTERNAL HDRFTR_RULE
5893 \# HDRFTR PLAIN
5894 \# ------------
5895 \# *Arguments:
5896 \#   <none>
5897 \# *Function:
5898 \#   Sets the family, font, and point size of all strings in
5899 \#   header/footers to the same family and point size as running
5900 \#   text.  Font for the header/footer becomes roman throughout.
5902 .MAC HDRFTR_PLAIN END
5903 .    HDRFTR_FAMILY        \\*[$DOC_FAM]
5904 .    HDRFTR_PT_SIZE       \\n[#DOC_PT_SIZE]
5905 .    HDRFTR_LEFT_FAMILY   \\*[$DOC_FAM]
5906 .    HDRFTR_LEFT_FONT     R
5907 .    HDRFTR_LEFT_SIZE     +0
5908 .    HDRFTR_LEFT_CAPS     OFF
5909 .    HDRFTR_CENTER_FAMILY \\*[$DOC_FAM]
5910 .    HDRFTR_CENTER_FONT   R
5911 .    HDRFTR_CENTER_SIZE   +0
5912 .    HDRFTR_CENTER_CAPS   OFF
5913 .    HDRFTR_RIGHT_FAMILY  \\*[$DOC_FAM]
5914 .    HDRFTR_RIGHT_FONT    R
5915 .    HDRFTR_RIGHT_SIZE    +0
5916 .    HDRFTR_RIGHT_CAPS    OFF
5917 .END
5920 \# SWITCH HDRFTR
5921 \# -------------
5922 \# *Arguments:
5923 \#   <none> | <anything>
5924 \# *Function:
5925 \#   Creates or modifies register #SWITCH_HDRFTR, used to switch
5926 \#   default location of HDRFTR_LEFT and HDRFTR_RIGHT.
5927 \# *Notes:
5928 \#   Typically, the author string appears at the left of header/footers,
5929 \#   and the title string appears at the right.  This switches the
5930 \#   location of the two.  Useful in conjuction with RECTO_VERSO to
5931 \#   tweak switches on alternate pages to come out as the user wishes.
5932 \#   The assumption of RECTO_VERSO is that the first page of the document
5933 \#   (recto) is odd, and even though it has no header/footer, if it did have one,
5934 \#   it would print as AUTHOR...CENTER...TITLE (or whatever strings
5935 \#   the user has supplied for HDRFTR_LEFT/RIGHT), meaning that the
5936 \#   next page, which does have a header/footer, will come out as
5937 \#   TITLE...CENTER...AUTHOR (or whatever strings the user has
5938 \#   supplied for HDRFTR_LEFT/RIGHT).  SWITCH_HDRFTRS allows the user
5939 \#   to get the desired string in the desired place on the desired
5940 \#   recto/verso page.
5942 \#   Default is OFF.
5944 .MAC SWITCH_HDRFTR END
5945 .    ie '\\$1'' \{ .nr #SWITCH_HDRFTR 1 \}
5946 .    el \{ .nr #SWITCH_HDRFTR 0 \}
5947 .END
5950 \# USER DEFINED HDRFTR RECTO
5951 \# -------------------------
5952 \# *Arguments:
5953 \#   L | LEFT | C | CENTER | CENTER | R | RIGHT <hdrftr_recto_string>
5954 \# *Function:
5955 \#   Toggles #USERDEF_HDRFTR on, stores quad as #USERDEF_HDRFTR_RECTO_QUAD,
5956 \#   stores string in $USERDEF_HDRFTR_RECTO.
5957 \# *Notes:
5958 \#   For use when users don't want 3-part headers/footers, but rather
5959 \#   want to design their own headers/footers and need different
5960 \#   headers/footers on recto and verso pages.  Using just
5961 \#   HEADER_RECTO, even when recto/verso is not on, allows users to
5962 \#   design their own headers/footers for doc pages.
5964 .MAC HDRFTR_RECTO END
5965 .    nr #USERDEF_HDRFTR 1
5966 .    if '\\$1'L'      \{ .nr #USERDEF_HDRFTR_RECTO_QUAD 1 \}
5967 .    if '\\$1'LEFT'   \{ .nr #USERDEF_HDRFTR_RECTO_QUAD 1 \}
5968 .    if '\\$1'C'      \{ .nr #USERDEF_HDRFTR_RECTO_QUAD 2 \}
5969 .    if '\\$1'CENTER' \{ .nr #USERDEF_HDRFTR_RECTO_QUAD 2 \}
5970 .    if '\\$1'CENTRE' \{ .nr #USERDEF_HDRFTR_RECTO_QUAD 2 \}
5971 .    if '\\$1'R'      \{ .nr #USERDEF_HDRFTR_RECTO_QUAD 3 \}
5972 .    if '\\$1'RIGHT'  \{ .nr #USERDEF_HDRFTR_RECTO_QUAD 3 \}
5973 .    ds $USERDEF_HDRFTR_RECTO \\$2
5974 .END
5977 \# USER DEFINED HDRFTR VERSO
5978 \# -------------------------
5979 \# *Arguments:
5980 \#   L | LEFT | C | CENTER | CENTER | R | RIGHT <hdrftr_verso_string>
5981 \# *Function:
5982 \#   Toggles #USERDEF_HDRFTR on, stores quad as #USERDEF_HDRFTR_VERSO_QUAD,
5983 \#   stores string in $USERDEF_HDRFTR_VERSO.
5984 \# *Notes:
5985 \#   For use when users don't want 3-part headers/footers, but rather
5986 \#   want to design their own headers/footers and need different
5987 \#   headers/footers on recto and verso pages.
5989 .MAC HDRFTR_VERSO END
5990 .    nr #USERDEF_HDRFTR 1
5991 .    if '\\$1'L'      \{ .nr #USERDEF_HDRFTR_VERSO_QUAD 1 \}
5992 .    if '\\$1'LEFT'   \{ .nr #USERDEF_HDRFTR_VERSO_QUAD 1 \}
5993 .    if '\\$1'C'      \{ .nr #USERDEF_HDRFTR_VERSO_QUAD 2 \}
5994 .    if '\\$1'CENTER' \{ .nr #USERDEF_HDRFTR_VERSO_QUAD 2 \}
5995 .    if '\\$1'CENTRE' \{ .nr #USERDEF_HDRFTR_VERSO_QUAD 2 \}
5996 .    if '\\$1'R'      \{ .nr #USERDEF_HDRFTR_VERSO_QUAD 3 \}
5997 .    if '\\$1'RIGHT'  \{ .nr #USERDEF_HDRFTR_VERSO_QUAD 3 \}
5998 .    ds $USERDEF_HDRFTR_VERSO \\$2
5999 .END
6002 \# PRINT FOOTER ON FIRST PAGE
6003 \# --------------------------
6004 \# *Arguments:
6005 \#   <none> | <anything>
6006 \# *Function:
6007 \#   Toggles register #PRINT_FOOTER_ON_PAGE_1
6008 \# *Notes:
6009 \#   Lets user choose whether to print footer on first
6010 \#   page of doc.
6012 .MAC FOOTER_ON_FIRST_PAGE END
6013 .    ie '\\$1'' \{ .nr #PRINT_FOOTER_ON_PAGE_1 1 \}
6014 .    el \{ .rr #PRINT_FOOTER_ON_PAGE_1 \}
6015 .END
6018 \# PRINT PAGE NUMBER ON FIRST PAGE
6019 \# -------------------------------
6020 \# *Arguments:
6021 \#   <none> | <anything>
6022 \# *Function:
6023 \#   Toggles register #PRINT_PAGENUM_ON_PAGE_1
6024 \# *Notes:
6025 \#   Lets user choose whether to print page number on first
6026 \#   page of doc and after collate when footers are on or page numbering
6027 \#   has been user set at top of page.
6029 .MAC PAGENUM_ON_FIRST_PAGE END
6030 .    ie '\\$1'' \{ .nr #PRINT_PAGENUM_ON_PAGE_1 1 \}
6031 .    el \{ .rr #PRINT_PAGENUM_ON_PAGE_1 \}
6032 .END
6035 \# PRINT HEADER/FOOTER
6036 \# -------------------
6037 \# *Arguments:
6038 \#   <none>
6039 \# *Function:
6040 \#   Based on defaults or values entered by user, prints a
6041 \#   three-part title at either the top or the bottom of the page.
6042 \# *Notes:
6043 \#   Called from within either HEADER or FOOTER.
6045 .MAC PRINT_HDRFTR END
6046 .    if \\n[#DOC_TYPE]=4 \{\
6047 .       nr #SUITE \En[.pn]
6048 .    \}
6049 .    if \\n[#FOOTERS_ON] \{\
6050 .       if \\n[#START_FOR_FOOTERS] \{\
6051 .          rr #START_FOR_FOOTERS
6052 .          if !\\n[#PRINT_FOOTER_ON_PAGE_1] \{ .return \}
6053 .       \}
6054 .    \}
6055 .    if \\n[#HEADERS_ON] \{ .vs 0 \}
6056 .    if \\n[#USERDEF_HDRFTR] \{\
6057 .       PRINT_USERDEF_HDRFTR
6058 .       return
6059 .    \}
6060 .    if \\n[#SWITCH_HDRFTR] \{\
6061 .       ds $HDRFTR_TMP_SWITCH             \\*[$HDRFTR_LEFT]
6062 .       ds $HDRFTR_LEFT                   \\*[$HDRFTR_RIGHT]
6063 .       ds $HDRFTR_RIGHT                  \\*[$HDRFTR_TMP_SWITCH]
6064 .       ds $HDRFTR_TMP_SIZE_CHANGE_SWITCH \\*[$HDRFTR_LEFT_SIZE_CHANGE]
6065 .       ds $HDRFTR_LEFT_SIZE_CHANGE       \\*[$HDRFTR_RIGHT_SIZE_CHANGE]
6066 .       ds $HDRFTR_RIGHT_SIZE_CHANGE      \\*[$HDRFTR_TMP_SIZE_CHANGE_SWITCH]
6067 .       nr #HDRFTR_TMP_CAPS_SWITCH        \\n[#HDRFTR_LEFT_CAPS]
6068 .       nr #HDRFTR_LEFT_CAPS              \\n[#HDRFTR_RIGHT_CAPS]
6069 .       nr #HDRFTR_RIGHT_CAPS             \\n[#HDRFTR_TMP_CAPS_SWITCH]
6070 .       rr #HDRFTR_TMP_CAPS_SWITCH
6071 .       rm $HDRFTR_TMP_SWITCH
6072 .       rm $HDRFTR_TMP_SIZE_CHANGE_SWITCH
6073 .       nr #SWITCH_HDRFTR 0
6074 .    \}
6075 .    nr #PAGENUMBER \\n%+\\n[#PAGE_NUM_ADJ]
6076 .    if \\n[#ENDNOTES] \{ .PAGENUM_STYLE \\*[$EN_PN_STYLE] \}
6077 .    if \\n[#PRINT_STYLE]=1 \{\
6078 .       if \\n[#FOOTERS_ON] \{\
6079 .          di NULL
6080 .          SIZESPECS
6081 .          nr #LEFT_CAP_HEIGHT \\n[#CAP_HEIGHT]
6082 .          di
6083 .       \}
6084 .       if o                        \{ .RIGHT \}
6085 .       if e                        \{ .LEFT  \}
6086 .       if \\n[#RECTO_VERSO]=0      \{ .LEFT  \}
6087 .       if \\n[#HDRFTR_LEFT_CAPS]   \{ .CAPS  \}
6088 .       ie '\\*[$HDRFTR_LEFT]'#' \{\
6089 .           PRINT \\n[#PAGENUMBER]
6090 .       \}
6091 .       el \{\
6092 .          ie !'\\*[$HDRFTR_LEFT]'' \{ . PRINT \\*[$HDRFTR_LEFT] \}
6093 .          el \{ .PRINT \& \}
6094 .       \}
6095 .       if \\n[#HDRFTR_LEFT_CAPS] \{ .CAPS OFF \}
6096 .       CENTER
6097 .       if \\n[#HDRFTR_CENTER_CAPS] \{ .CAPS \}
6098 .       ie '\\*[$HDRFTR_CENTER]'#' \{\
6099 .           PRINT \\v'-(\\n[#LEAD]u*1u)'\\h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\n[#PAGENUMBER]\\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'
6100 .       \}
6101 .       el \{\
6102 .          ie !'\\*[$HDRFTR_CENTER]'' \{ .PRINT \\v'-(\\n[#LEAD]u*1u)'\\h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\*[$HDRFTR_CENTER]\\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u' \}
6103 .          el \{ .PRINT \& \}
6104 .       \}
6105 .       if \\n[#HDRFTR_CENTER_CAPS] \{ .CAPS OFF \}
6106 .       if o                       \{ .LEFT  \}
6107 .       if e                       \{ .RIGHT \}
6108 .       if \\n[#RECTO_VERSO]=0     \{ .RIGHT \}
6109 .       if \\n[#HDRFTR_RIGHT_CAPS] \{ .CAPS  \}
6110 .       ie '\\*[$HDRFTR_RIGHT]'#' \{\
6111 .           PRINT \\v'-(\\n[#LEAD]u*2u)'\\n[#PAGENUMBER]
6112 .       \}
6113 .       el \{\
6114 .          ie !'\\*[$HDRFTR_RIGHT]'' \{ .PRINT \\v'-(\\n[#LEAD]u*2u)'\\*[$HDRFTR_RIGHT] \}
6115 .          el \{ .PRINT \& \}
6116 .       \}
6117 .       if \\n[#HDRFTR_RIGHT_CAPS] \{ .CAPS OFF \}
6118 .    \}
6119 .    if \\n[#PRINT_STYLE]=2 \{\
6120 .       FAMILY  \\*[$HDRFTR_LEFT_FAM]
6121 .       FT      \\*[$HDRFTR_LEFT_FT]
6122 .       PT_SIZE \\n[#HDRFTR_PT_SIZE]u\\*[$HDRFTR_LEFT_SIZE_CHANGE]
6123 .       if \\n[#FOOTERS_ON] \{\
6124 .          di NULL
6125 .          SIZESPECS
6126 .          nr #LEFT_CAP_HEIGHT \\n[#CAP_HEIGHT]
6127 .          di
6128 .       \}
6129 .       if o                      \{ .LEFT  \}
6130 .       if e                      \{ .RIGHT \}
6131 .       if \\n[#RECTO_VERSO]=0    \{ .LEFT  \}
6132 .       if \\n[#HDRFTR_LEFT_CAPS] \{ .CAPS  \}
6133 .       ie '\\*[$HDRFTR_LEFT]'#' \{ .PRINT \\n[#PAGENUMBER] \}
6134 .       el \{\
6135 .          ie !'\\*[$HDRFTR_LEFT]'' \{ . PRINT \\*[$HDRFTR_LEFT] \}
6136 .          el \{ .PRINT \& \}
6137 .       \}
6138 .       if \\n[#HDRFTR_LEFT_CAPS] \{ .CAPS OFF \}
6139 .       FAMILY  \\*[$HDRFTR_CENTER_FAM]
6140 .       FT      \\*[$HDRFTR_CENTER_FT]
6141 .       PT_SIZE \\n[#HDRFTR_PT_SIZE]u\\*[$HDRFTR_CENTER_SIZE_CHANGE]
6142 .       if \\n[#FOOTERS_ON] \{\
6143 .          di NULL
6144 .          SIZESPECS
6145 .          nr #CENTER_CAP_HEIGHT \\n[#CAP_HEIGHT]
6146 .          di
6147 .       \}
6148 .       CENTER
6149 .       if \\n[#HDRFTR_CENTER_CAPS] \{ .CAPS \}
6150 .       ie '\\*[$HDRFTR_CENTER]'#' \{\
6151 .           PRINT \\v'-(\\n[#LEAD]u*1u)'\\h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\n[#PAGENUMBER]\\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'
6152 .       \}
6153 .       el \{\
6154 .          ie !'\\*[$HDRFTR_CENTER]'' \{ .PRINT \\v'-(\\n[#LEAD]u*1u)'\\h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\*[$HDRFTR_CENTER]\\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u' \}
6155 .          el \{ .PRINT \& \}
6156 .       \}
6157 .       if \\n[#HDRFTR_CENTER_CAPS] \{ .CAPS OFF \}
6158 .       FAMILY  \\*[$HDRFTR_RIGHT_FAM]
6159 .       FT      \\*[$HDRFTR_RIGHT_FT]
6160 .       PT_SIZE \\n[#HDRFTR_PT_SIZE]u\\*[$HDRFTR_RIGHT_SIZE_CHANGE]
6161 .       if \\n[#FOOTERS_ON] \{\
6162 .          di NULL
6163 .          SIZESPECS
6164 .          nr #RIGHT_CAP_HEIGHT \\n[#CAP_HEIGHT]
6165 .          di
6166 .       \}
6167 .       if o                       \{ .RIGHT \}
6168 .       if e                       \{ .LEFT  \}
6169 .       if \\n[#RECTO_VERSO]=0     \{ .RIGHT \}
6170 .       if \\n[#HDRFTR_RIGHT_CAPS] \{ .CAPS  \}
6171 .       ie '\\*[$HDRFTR_RIGHT]'#' \{\
6172 .           PRINT \\v'-(\\n[#LEAD]u*2u)'\\n[#PAGENUMBER]
6173 .       \}
6174 .       el \{\
6175 .          ie !'\\*[$HDRFTR_RIGHT]'' \{ .PRINT \\v'-(\\n[#LEAD]u*2u)'\\*[$HDRFTR_RIGHT] \}
6176 .          el \{ .PRINT \& \}
6177 .       \}
6178 .       if \\n[#HDRFTR_RIGHT_CAPS] \{ .CAPS OFF \}
6179 .    \}
6180 .    if \\n[#HDRFTR_RULE] \{\
6181 .       HDRFTR_RULE_INTERNAL
6182 .    \}
6183 .END
6186 \# PRINT USER DEFINED HEADER/FOOTER
6187 \# --------------------------------
6188 \# *Arguments:
6189 \#   <none>
6190 \# *Function:
6191 \#   Based on defaults or values entered by user, prints a single part
6192 \#   (i.e. not 3-part) title at either the top or the bottom of the page.
6193 \# *Notes:
6194 \#   Called from within PRINT_HDRFTR.
6196 .MAC PRINT_USERDEF_HDRFTR END
6197 .    nr #PAGENUMBER \\n%+\\n[#PAGE_NUM_ADJ]
6198 .    fc ^ #
6199 .    if \\n[#PRINT_STYLE]=2 \{\
6200 .       FAMILY  \\*[$HDRFTR_FAM]
6201 .       FT      R
6202 .       PT_SIZE \\n[#HDRFTR_PT_SIZE]u
6203 .    \}
6204 .    ie \\n[#RECTO_VERSO] \{\
6205 .       if o \{\
6206 .          if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=1 \{ .LEFT   \}
6207 .          if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=2 \{ .CENTER \}
6208 .          if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=3 \{ .RIGHT  \}
6209 .          PRINT \\*[$USERDEF_HDRFTR_RECTO]
6210 .          EL
6211 .          if \\n[#FOOTERS_ON] \{\
6212 .             di NULL
6213 .             SIZESPECS
6214 .             nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
6215 .             di
6216 .          \}
6217 .       \}
6218 .       if e \{\
6219 .          ie !'\\*[$USERDEF_HDRFTR_VERSO]'' \{\
6220 .             if \\n[#USERDEF_HDRFTR_VERSO_QUAD]=1 \{ .LEFT   \}
6221 .             if \\n[#USERDEF_HDRFTR_VERSO_QUAD]=2 \{ .CENTER \}
6222 .             if \\n[#USERDEF_HDRFTR_VERSO_QUAD]=3 \{ .RIGHT  \}
6223 .          \}
6224 .          PRINT \\*[$USERDEF_HDRFTR_VERSO]
6225 .          EL
6226 .          if \\n[#FOOTERS_ON] \{\
6227 .             di NULL
6228 .             SIZESPECS
6229 .             nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
6230 .             di
6231 .          \}
6232 .          el \{\
6233 .             if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=1 \{ .LEFT   \}
6234 .             if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=2 \{ .CENTER \}
6235 .             if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=3 \{ .RIGHT  \}
6236 .             PRINT \\*[$USERDEF_HDRFTR_RECTO]
6237 .             EL
6238 .             if \\n[#FOOTERS_ON] \{\
6239 .                di NULL
6240 .                SIZESPECS
6241 .                nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
6242 .                di
6243 .             \}
6244 .          \}
6245 .       \}
6246 .    \}
6247 .    el \{\
6248 .       if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=1 \{ .LEFT   \}
6249 .       if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=2 \{ .CENTER \}
6250 .       if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=3 \{ .RIGHT  \}
6251 .       PRINT \\*[$USERDEF_HDRFTR_RECTO]
6252 .       EL
6253 .       if \\n[#FOOTERS_ON] \{\
6254 .          di NULL
6255 .          SIZESPECS
6256 .          nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
6257 .          di
6258 .       \}
6259 .    \}
6260 .    fc
6261 .    if \\n[#HDRFTR_RULE] \{\
6262 .       HDRFTR_RULE_INTERNAL
6263 .    \}
6264 .END
6267 \# +++HEADERS+++
6269 \# HEADERS (off or on)
6270 \# -------------------
6271 \# *Arguments:
6272 \#   <none> | <anything>
6273 \# *Function:
6274 \#   Turns headers at the top of the page off or on.
6275 \# *Notes:
6276 \#   Default is on.
6278 .MAC HEADERS END
6279 .    ie '\\$1'' \{ .nr #HEADERS_ON 1 \}
6280 .    el \{ .nr #HEADERS_ON 0 \}
6281 .END
6284 \# HEADER MARGIN
6285 \# -------------
6286 \# *Argument:
6287 \#   <amount of space between top of page and header>
6288 \# *Function:
6289 \#   Creates or modifies register #HEADER_MARGIN to hold amount
6290 \#   of space between top of page and header.
6291 \# *Notes:
6292 \#   Requires unit of measure.  Default is 4P+6p, measured top-of-page
6293 \#   to baseline.
6295 .MAC HEADER_MARGIN END
6296 .    nr #HEADER_MARGIN (\\$1)
6297 .END
6300 \# HEADER GAP
6301 \# ----------
6302 \# *Argument:
6303 \#   <amount of space between header and running text>
6304 \# *Function:
6305 \#   Creates or modifies register #HEADER_GAP to hold amount
6306 \#   of space between header and running text.
6307 \# *Notes:
6308 \#   Default is 1P+6p.
6310 .MAC HEADER_GAP END
6311 .    nr #HEADER_GAP (\\$1)
6312 .END
6315 \# HEADER
6316 \# ------
6317 \# *Arguments:
6318 \#   <none>
6319 \# *Function:
6320 \#   Prints header appropriate to DOC_TYPE, PRINTSTYLE, and COPYSTYLE.
6321 \# *Notes:
6322 \#   In order to convert the title string to caps in the header (in the
6323 \#   event that the user enters .TITLE in caps/lc), I've used
6324 \#   quad left, quad centre, and quad right to arrange the three bits
6325 \#   of the header, rather than .tl.  This allows the use of the CAPS macro.
6326 \#   The downside is that I have to add \\v'-(\\n[#LEAD]u*#) in order
6327 \#   for -Tlatin1 output to align the header/footer strings on the baseline.
6328 \#   The console output still isn't brilliant, but at least it's
6329 \#   comprehensible.
6331 .MAC HEADER END
6332 .    PROCESS_FN_LEFTOVER
6333 .    nr #FN_COUNT_FOR_COLS 0 1
6334 .    if \\n[#RESET_FN_NUMBER] \{ .nr #FN_NUMBER 0 1 \}
6335 .    po \\n[#DOC_L_MARGIN]u
6336 .    if \\n[#RECTO_VERSO] \{\
6337 .       if !\\n[#TOC_RV_SWITCH] \{\
6338 .          nr #DOC_LR_MARGIN_TMP \\n[#DOC_L_MARGIN]
6339 .          DOC_LEFT_MARGIN  \\n[#DOC_R_MARGIN]u
6340 .          DOC_RIGHT_MARGIN \\n[#DOC_LR_MARGIN_TMP]u
6341 .          SWITCH_HDRFTR_CENTER_PAD
6342 .       \}
6343 .       rr #TOC_RV_SWITCH
6344 .    \}
6345 .    ev HEADER
6346 .    if \\n[#PRINT_STYLE]=1 \{ .vs 0 \}
6347 .    if \\n[#PRINT_STYLE]=2 \{ .LS 0 \}
6348 .    sp |\\n[#HEADER_MARGIN]u-1v
6349 .    ll \\n[#DOC_L_LENGTH]u
6350 .    ta \\n(.lu
6351 .    if \\n[#PRINT_STYLE]=1 \{\
6352 .       fam C
6353 .       ft  R
6354 .       ps  12\\*[$HDRFTR_SIZE_CHANGE]
6355 .    \}
6356 .    if \\n[#PRINT_STYLE]=2 \{\
6357 .      FAMILY  \\*[$HDRFTR_FAM]
6358 .      FT      R
6359 .      PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$HDRFTR_SIZE_CHANGE]
6360 .    \}
6361 .    nr #HDRFTR_PT_SIZE \\n[#PT_SIZE]
6362 .    if \\n[#CAPS_ON] \{\
6363 .       nr #CAPS_WAS_ON 1
6364 .       CAPS OFF
6365 .    \}
6366 .    if \\n[#UNDERLINE_ON] \{\
6367 .       nr #UNDERLINE_WAS_ON 1
6368 .       UNDERLINE OFF
6369 .    \}
6370 .    if \\n[#PRINT_STYLE]=1 \{\
6371 .       if \\n[#ENDNOTES]=1 \{\
6372 .          if \\n[#EN_SINGLESPACE] \{\   \"Endnotes s-spaced have different lead
6373 .             nr #RESTORE_DOC_LEAD \\n[#DOC_LEAD]
6374 .             nr #DOC_LEAD \\n[#EN_LEAD]u
6375 .          \}
6376 .       \}
6377 .    \}
6378 .    ie \\n[#HEADERS_ON] \{\
6379 .       PRINT_HDRFTR
6380 .       sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
6381 .    \}
6382 .    el \{\
6383 .       ie \\n[#PAGE_NUM_V_POS]=1 \{\
6384 .          ie \\n[#PAGINATE] \{\
6385 .             PRINT_PAGE_NUMBER
6386 .             sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
6387 .          \}
6388 .          el \{ .sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u \}
6389 .       \}
6390 .       el \{ .sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u \}
6391 .    \}
6392 .    if \\n[#PRINT_STYLE]=1 \{\
6393 .       if \\n[#ENDNOTES]=1 \{\
6394 .          if \\n[#EN_SINGLESPACE] \{\
6395 .             nr #DOC_LEAD \\n[#RESTORE_DOC_LEAD]u
6396 .             rr #RESTORE_DOC_LEAD
6397 .          \}
6398 .       \}
6399 .    \}
6400 .    nr #PAGE_TOP \\n(nl
6401 .    ev
6402 .    po \\n[#L_MARGIN]u
6403 .    if \\n[#RECTO_VERSO] \{\
6404 .       nr #L_MARGIN +\\n[#L_MARGIN_DIFF]
6405 .    \}
6406 .    if \\n[#CAPS_WAS_ON] \{\
6407 .       CAPS
6408 .       rr #CAPS_WAS_ON
6409 .    \}
6410 .    if \\n[#UNDERLINE_WAS_ON] \{\
6411 .       UNDERLINE
6412 .       rr #UNDERLINE_WAS_ON
6413 .    \}
6414 .    if \\n[#TAB_ACTIVE] \{ .TAB \\n[#CURRENT_TAB] \}
6415 .    if \\n[#QUOTE] \{\
6416 .       ie \\n[#TAB_ACTIVE] \{ .TAB \\n[#CURRENT_TAB] \}
6417 .       el \{\
6418 .          nr #Q_OFFSET \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE])
6419 .          po \\n[#Q_OFFSET]u
6420 .       \}
6421 .    \}
6422 .    if \\n[#EPIGRAPH] \{\
6423 .       ie \\n[#TAB_ACTIVE] \{ .TAB \\n[#CURRENT_TAB] \}
6424 .       el \{\
6425 .          nr #EPI_OFFSET \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
6426 .          po \\n[#EPI_OFFSET]u
6427 .       \}
6428 .    \}
6429 .    ie \\n[#EPIGRAPH] \{\
6430 .       ie !\\n[#EPI_ACTIVE] \{\
6431 .          ns
6432 .          rr #EPI_ACTIVE
6433 .       \}
6434 .       el \{\
6435 .          ie \\n[#EPI_FITS] \{ .ns \}
6436 .          el \{ .ALD \\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u \}
6437 .          \}
6438 .    \}
6439 .    el \{ .ns \}
6440 .    ns
6441 .    if \\n[#COLUMNS] \{\
6442 .       if \\n[#RECTO_VERSO] \{ .COLUMNS \\n[#NUM_COLS] \\n[#GUTTER]u \}
6443 .       nr #COL_NUM 0 1
6444 .       mk dc
6445 .       po \\n[#COL_\\n+[#COL_NUM]_L_MARGIN]u
6446 .       ll \\n[#COL_L_LENGTH]u
6447 .       ta \\n(.lu
6448 .       if \\n[#QUOTE] \{\
6449 .          po +(\\n[#PP_INDENT]u*\\n[#Q_OFFSET_VALUE]u)
6450 .       \}
6451 .       if \\n[#EPIGRAPH] \{\
6452 .          if \\n[#EPI_ACTIVE] \{\
6453 .             ie \\n[#EPI_FITS] \{ . \}
6454 .             el \{ .nr dc -\\n[#EPI_LEAD_DIFF] \}
6455 .          \}
6456 .          po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u+(\\n[#PP_INDENT]u*\\n[#EPI_OFFSET_VALUE]u)
6457 .       \}
6458 .    \}
6459 .    if \\n[#PRINT_STYLE]=1 \{\
6460 .       if \\n[#SLANT_ON] \{\
6461 .          if \\n[#UNDERLINE_SLANT] \{ .UNDERLINE \}
6462 .       \}
6463 .    \}
6464 .END
6466 \# ====================================================================
6468 \# +++FOOTERS+++
6470 \# FOOTERS (off or on)
6471 \# -------------------
6472 \# *Arguments:
6473 \#   <none> | <anything>
6474 \# *Function:
6475 \#   Turns footers at the bottom of the page off or on.
6476 \# *Notes:
6477 \#   Default is off.  If on, page numbers automatically go at
6478 \#   the top, centered, unless pagination has been turned off,
6479 \#   or the pagenumber position has been changed to left or right.
6481 .MAC FOOTERS END
6482 .    ie '\\$1''   \{\
6483 .       nr #FOOTERS_ON 1
6484 .       PAGE_NUM_POS TOP CENTER
6485 .    \}
6486 .    el \{ .nr #FOOTERS_ON 0 \}
6487 .END
6490 \# FOOTER MARGIN
6491 \# -------------
6492 \# *Argument:
6493 \#   <footer margin>
6494 \# *Function:
6495 \#   Creates or modifies register #FOOTER_MARGIN which holds the
6496 \#   amount of space to leave between the page number and the bottom
6497 \#   of the page.
6498 \# *Notes:
6499 \#   Unit of measure required.  Default is 3P.
6501 .MAC FOOTER_MARGIN END
6502 .    ie \\n%>0 \{ .nr #FOOTER_MARGIN (\\$1) \}
6503 .    el \{ . \}
6504 .END
6507 \# FOOTER GAP
6508 \# ----------
6509 \# *Argument:
6510 \#   <distance from end of running text to page # or footer>
6511 \# *Function:
6512 \#   Creates or modifies register #FOOTER_GAP which holds the
6513 \#   amount of space to leave between running text and the page number.
6514 \# *Notes:
6515 \#   Requires unit of measure.  Default is 3P.  Measured baseline to
6516 \#   baseline.
6518 .MAC FOOTER_GAP END
6519 .    ie \\n%>0 \{ .nr #FOOTER_GAP (\\$1) \}
6520 .    el \{ . \}
6521 .END
6524 \# FOOTER
6525 \# ------
6526 \# *Arguments:
6527 \#   <none>
6528 \# *Function:
6529 \#   Places footer at bottom of page if #FOOTERS=1, otherwise
6530 \#   places page number at bottom of page (if #PAGINATE=1).
6531 \#   Page numbers are in arabic or roman according to COPYSTYLE.
6532 \#   DRAFT starts the document at page 1 regardless of PAGENUMBER.
6533 \#   FINAL respects PAGENUMBER.
6535 .MAC FOOTER END
6536 .    ev PAGE_BOTTOM
6537 .    if \\n[#START]=1 \{\
6538 .       bp
6539 .       ev
6540 .       return
6541 .    \}
6542 .    nr #L_MARGIN_DIFF \\n[#L_MARGIN]-\\n[#DOC_L_MARGIN]
6543 .    if !\\n[#FN_DEFER] \{\
6544 .       nr #DIVER_DEPTH 0
6545 .       if \\n[#FN_COUNT] \{\
6546 .          sp |\\n[#PAGE_LENGTH]u-(\\n[#B_MARGIN]u+\\n[#FN_DEPTH]u)
6547 .          po \\n[#DOC_L_MARGIN]u
6548 .          if \\n[#COLUMNS] \{ .po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u \}
6549 .          nf
6550 .          FOOTNOTES
6551 .          rm FOOTNOTES
6552 .          if '\\n(.z'FN_OVERFLOW' \{\
6553 .              di
6554 .              nr #FN_OVERFLOW_DEPTH \\n[#DIVER_DEPTH]
6555 .          \}
6556 .          nr #FN_COUNT 0
6557 .          if \\n[#COL_NEXT] \{ .nr #COL_NUM \\n-[#COL_NUM] \}
6558 .       \}
6559 .    \}
6560 .    ie \\n[#COLUMNS] \{\
6561 .       ie \\n[#COL_NUM]=\\n[#NUM_COLS] \{ .DO_FOOTER \}
6562 .       el \{\
6563 .          ie \\n[#ENDNOTES] \{ .sp |\\n(ecu-\\n[#EN_LEAD]u \}
6564 .          el \{ .sp |\\n(dcu \}
6565 .          po \\n[#COL_\\n+[#COL_NUM]_L_MARGIN]u
6566 .          PROCESS_FN_LEFTOVER
6567 .          if !\\n[#EPIGRAPH] \{ .rr #COL_NEXT \}
6568 .          if !\\n[#QUOTE]    \{ .rr #COL_NEXT \}
6569 .          if \\n[#QUOTE] \{\
6570 .             nr #Q_OFFSET \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE])
6571 .             if \\n[#COLUMNS] \{ .nr #Q_OFFSET \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE]) \}
6572 .             po \\n[#Q_OFFSET]u
6573 .          \}
6574 .          if \\n[#EPIGRAPH] \{\
6575 .             nr #EPI_OFFSET \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
6576 .             if \\n[#COLUMNS] \{ .nr #EPI_OFFSET \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE]) \}
6577 .             po \\n[#EPI_OFFSET]u
6578 .          \}
6579 .          ie \\n[#EPIGRAPH] \{\
6580 .             ie !\\n[#EPI_ACTIVE] \{\
6581 .                ns
6582 .                rr #EPI_ACTIVE
6583 .             \}
6584 .             el \{\
6585 .                sp |\\n(dcu+(\\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u)
6586 .                rr #EPI_ACTIVE
6587 .             \}
6588 .          \}
6589 .          el \{ .ns \}
6590 .          ev
6591 .       \}
6592 .       ns
6593 .    \}
6594 .    el \{ .DO_FOOTER \}
6595 .END
6598 \# PROCESS FOOTER
6599 \# --------------
6600 \# *Arguments:
6601 \#   <none>
6602 \# *Function:
6603 \#   Prints footer (page number, or 3-part footer).
6604 \#   Resets CAPS and UNDERLINE if they were on.
6606 .MAC DO_FOOTER END
6607 .    ie (\\n[#FOOTER_MARGIN]+\\n(.v)>\\n[#B_MARGIN] \{\
6608 .       nr #SKIP_FOOTER 1
6609 .    \}
6610 .    el \{\
6611 .       sp |\\n[#PAGE_LENGTH]u-\\n[#FOOTER_MARGIN]u-1v
6612 .    \}
6613 .    ev FOOTER
6614 .    po \\n[#DOC_L_MARGIN]u
6615 .    ll \\n[#DOC_L_LENGTH]u
6616 .    ta \\n(.lu
6617 .    FAMILY  \\*[$HDRFTR_FAM]
6618 .    FT      R
6619 .    PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$HDRFTR_SIZE_CHANGE]
6620 .    if \\n[#PRINT_STYLE]=1 \{\
6621 .       fam C
6622 .       ft  R
6623 .       ps  12
6624 .    \}
6625 .    nr #HDRFTR_PT_SIZE \\n[#PT_SIZE]
6626 .    if \\n[#CAPS_ON] \{\
6627 .       nr #CAPS_WAS_ON 1
6628 .       CAPS OFF
6629 .    \}
6630 .    if \\n[#UNDERLINE_ON] \{\
6631 .       nr #UNDERLINE_WAS_ON 1
6632 .       UNDERLINE OFF
6633 .    \}
6634 .    ie \\n[#FOOTERS_ON] \{\
6635 .       if !\\n[#SKIP_FOOTER]=1 \{ .PRINT_HDRFTR \}
6636 .    \}
6637 .    el \{\
6638 .       if \\n[#PAGINATE] \{\
6639 .          if \\n[#PAGE_NUM_V_POS]=2 \{\
6640 .             if !\\n[#SKIP_FOOTER]=1 \{ .PRINT_PAGE_NUMBER \}
6641 .          \}
6642 .       \}
6643 .    \}
6644 .    rr #SKIP_FOOTER
6645 .    if \\n[#CAPS_WAS_ON] \{\
6646 .       CAPS
6647 .       rr #CAPS_WAS_ON
6648 .    \}
6649 .    if \\n[#UNDERLINE_WAS_ON] \{\
6650 .       UNDERLINE
6651 .       rr #UNDERLINE_WAS_ON
6652 .    \}
6653 .    ev
6654 .    bp
6655 .    ev
6656 .END
6658 \# ====================================================================
6660 \# +++HEADS+++
6662 \# ---Head numbers---
6664 \# NUMBER HEADS
6665 \# ------------
6666 \# *Arguments:
6667 \#   <none> | <anything>
6668 \# *Function:
6669 \#   Toggles register #NUMBER_HEAD; sets incrementing register #HEAD_NUM.
6670 \# *Notes:
6671 \#   Default is OFF.
6673 .MAC NUMBER_HEADS END
6674 .    ie '\\$1'' \{\
6675 .       nr #NUMBER_HEAD 1
6676 .       if !\\n[#HEAD_NUM] \{ .nr #HEAD_NUM 0 1 \}
6677 .    \}
6678 .    el \{ .rr #NUMBER_HEAD \}
6679 .END
6682 \# RESET HEAD NUMBER
6683 \# -----------------
6684 \# *Arguments:
6685 \#   <none> | <desired head number>
6686 \# *Function:
6687 \#   Resets incrementing register #HEAD_NUM to 1 or, if there's
6688 \#   an argument, to user supplied number.
6689 \# *Notes:
6690 \#   Also resets subhead and parahead numbers.  If this is not
6691 \#   desired, subhead and parahead numbers may be reset individually.
6693 .MAC RESET_HEAD_NUMBER END
6694 .    ie '\\$1'' \{\
6695 .       nr #HEAD_NUM 0 1
6696 .       nr #SH_NUM   0 1
6697 .       nr #PH_NUM   0 1
6698 .    \}
6699 .    el \{\
6700 .       nr #HEAD_NUM \\$1-1 1
6701 .       nr #SH_NUM   0 1
6702 .       nr #PH_NUM   0 1
6703 .    \}
6704 .END
6707 \# NUMBER SUBHEADS
6708 \# ---------------
6709 \# *Arguments:
6710 \#   <none> | <anything>
6711 \# *Function:
6712 \#   Toggles register #NUMBER_SH; sets incrementing register #SH_NUM.
6713 \# *Notes:
6714 \#   Default is OFF.
6716 .MAC NUMBER_SUBHEADS END
6717 .    ie '\\$1'' \{\
6718 .       nr #NUMBER_SH 1
6719 .       if !\\n[#SH_NUM] \{ .nr #SH_NUM 0 1 \}
6720 .    \}
6721 .    el \{ .rr #NUMBER_SH \}
6722 .END
6725 \# RESET SUBHEAD NUMBER
6726 \# --------------------
6727 \# *Arguments:
6728 \#   <none> | <desired subhead number>
6729 \# *Function:
6730 \#   Resets incrementing register #SH_NUM to 1 or, if there's
6731 \#   an argument, to user supplied number.
6732 \# *Notes:
6733 \#   When the subhead number is reset, it resets the parahead number as
6734 \#   well.  If this behaviour is not what's wanted, RESET_SUBHEAD_NUMBER
6735 \#   allows the user to set the parahead number to whatever s/he desires.
6737 .MAC RESET_SUBHEAD_NUMBER END
6738 .    ie '\\$1'' \{ .nr #SH_NUM 0 1 \}
6739 .    el \{\
6740 .       nr #SH_NUM \\$1-1 1
6741 .       nr #PH_NUM 0 1
6742 .       \}
6743 .END
6746 \# NUMBER PARAHEADS
6747 \# ----------------
6748 \# *Arguments:
6749 \#   <none> | <anything>
6750 \# *Function:
6751 \#   Toggles register #NUMBER_PH; sets incrementing register #PH_NUM.
6752 \# *Notes:
6753 \#   Default is OFF.
6755 .MAC NUMBER_PARAHEADS END
6756 .    ie '\\$1'' \{\
6757 .       nr #NUMBER_PH 1
6758 .       if !\\n[#PH_NUM] \{ .nr #PH_NUM 0 1 \}
6759 .    \}
6760 .    el \{ .rr #NUMBER_PH \}
6761 .END
6764 \# RESET PARAHEAD NUMBER
6765 \# ---------------------
6766 \# *Arguments:
6767 \#   <none> | <desired parahead number>
6768 \# *Function:
6769 \#   Resets incrementing register #PH_NUM to 1 or, if there's
6770 \#   an argument, to user supplied number.
6771 \# *Notes:
6772 \#   Resetting the parahead number resets the parahead number
6773 \#   only.
6775 .MAC RESET_PARAHEAD_NUMBER END
6776 .    ie '\\$1'' \{ .nr #PH_NUM 0 1 \}
6777 .    el \{ nr #SH_NUM \\$1-1 1 \}
6778 .END
6781 \# ---Main heads---
6783 \# HEAD FAMILY
6784 \# -----------
6785 \# *Argument:
6786 \#   <family to use for section titles (main heads)>
6787 \# *Function:
6788 \#   Creates or modifies string $HEAD_FAM.
6789 \# *Notes:
6790 \#   Default is same as running text.
6792 .MAC HEAD_FAMILY END
6793 .    ds $HEAD_FAM \\$1
6794 .END
6797 \# HEAD FONT
6798 \# ---------
6799 \# *Argument:
6800 \#   <font to use for section titles (main heads)>
6801 \# *Function:
6802 \#   Creates or modifies string $HEAD_FT.
6803 \# *Notes:
6804 \#   Default is bold.
6806 .MAC HEAD_FONT END
6807 .    ds $HEAD_FT \\$1
6808 .END
6811 \# HEAD SIZE
6812 \# ---------
6813 \# *Argument:
6814 \#   <+|- number of points by which to in/decrease point size of
6815 \#   section titles (relative to running text)>
6816 \# *Function:
6817 \#   Creates or modifies string $HEAD_SIZE_CHANGE.
6818 \# *Notes:
6819 \#   Must be preceded by a - or + sign with no space afterwards.
6820 \#   Fractional point sizes are allowed.
6821 \#   Default +1 for printstyle TYPESET; +0 for TYPEWRITE.
6823 .MAC HEAD_SIZE END
6824 .    ds $HEAD_SIZE_CHANGE \\$1
6825 .END
6828 \# HEAD QUAD
6829 \# ---------
6830 \# *Arguments:
6831 \#   L | LEFT | R | RIGHT | C | CENTER | CENTRE
6832 \# *Function:
6833 \#   Creates or modifies string $HEAD_QUAD.
6834 \# *Notes:
6835 \#   Default is CENTER.
6837 .MAC HEAD_QUAD END
6838 .    ds $HEAD_QUAD \\$1
6839 .END
6842 \# HEAD CAPS
6843 \# ---------
6844 \# *Arguments:
6845 \#   <none> | <anything>
6846 \# *Function:
6847 \#   Creates or modifies register #HEAD_CAPS.
6848 \# *Notes:
6849 \#   Default is on.
6851 .MAC HEAD_CAPS END
6852 .    ie '\\$1'' \{ .nr #HEAD_CAPS 1 \}
6853 .    el \{ .nr #HEAD_CAPS 0 \}
6854 .END
6857 \# HEAD SPACE
6858 \# ----------
6859 \# *Arguments:
6860 \#   <none> | <anything>
6861 \# *Function:
6862 \#   Creates register #HEAD_SPACE, which toggles whether the space
6863 \#   before heads is 1 extra line space ("off") or 2 ("on").  Used only
6864 \#   in PRINTSTYLE TYPESET.
6865 \# *Notes:
6866 \#   Default is on.
6868 .MAC HEAD_SPACE END
6869 .    ie '\\$1'' \{ .nr #HEAD_SPACE 1 \}
6870 .    el \{ .nr #HEAD_SPACE 0 \}
6871 .END
6874 \# HEAD UNDERLINE
6875 \# --------------
6876 \# *Arguments:
6877 \#   <none> | <anything>
6878 \# *Function:
6879 \#   Creates or modifies register #HEAD_UNDERLINE.
6880 \# *Notes:
6881 \#   Default is on.
6883 .MAC HEAD_UNDERLINE END
6884 .    ie '\\$1'' \{ .nr #HEAD_UNDERLINE 1 \}
6885 .    el \{ .nr #HEAD_UNDERLINE 0 \}
6886 .END
6889 \# MAIN HEAD
6890 \# ---------
6891 \# *Arguments:
6892 \#   "text of main head" ["text of main head"] ...
6893 \# *Function:
6894 \#   In TYPEWRITE, prints main heads centered, all caps, underlined.
6895 \#   In TYPESET, prints bold main heads 1 point larger than running
6896 \#   text, all caps, underlined.
6897 \# *Notes:
6898 \#   The HEAD macro requires that double-quotes (") surround
6899 \#   each line of text.
6901 .MAC HEAD END
6902 .    br
6903 \# Collect head for TOC.
6904 .    nr #ARG_NUM 0 1
6905 .    nr #TOC_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
6906 .    af #TOC_ENTRY_PN \\g[#PAGENUMBER]
6907 .    while \\n[#ARG_NUM]<\\n[#NUM_ARGS] \{\
6908 .       ie \\n[#ARG_NUM]=\\n[#NUM_ARGS] \{\
6909 .          as $TOC_HEAD_ITEM \\$[\\n+[#ARG_NUM]]\\|
6910 .       \}
6911 .       el \{\
6912 \# Note that in the .as lines, below, \ at the end has a literal
6913 \# space after it.
6914 .          ie \\n[#NUMBER_HEAD] \{\
6915 .             ie \\n[#ARG_NUM]=0 \{\
6916 .                as $TOC_HEAD_ITEM \\n+[#HEAD_NUM].\0\\$[\\n+[#ARG_NUM]]\ 
6917 .                nr #HEAD_NUM \\n-[#HEAD_NUM]
6918 .             \}
6919 .             el \{\
6920 .                as $TOC_HEAD_ITEM \\$[\\n+[#ARG_NUM]]\ 
6921 .             \}
6922 .          \}
6923 .          el \{\
6924 .             as $TOC_HEAD_ITEM \\$[\\n+[#ARG_NUM]]\ 
6925 .          \}
6926 .       \}
6927 .    \}
6928 \# Note the use of \!, which transparently embeds the macros used
6929 \# in the TOC_ENTRIES diversion.  The elements they control must be
6930 \# processed literally when the diversion is output.
6931 .    ev TOC_EV
6932 .    da TOC_ENTRIES
6933 .    if \\n[#PRINT_STYLE]=1 \{\
6934 \!.     fam C
6935 \!.     ft  R
6936 \!.     ps  12
6937 .    \}
6938 .    if \\n[#PRINT_STYLE]=2 \{\
6939 \!.     FAMILY  \\*[$TOC_HEAD_FAM]
6940 \!.     FT      \\*[$TOC_HEAD_FT]
6941 \!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_HEAD_SIZE_CHANGE]
6942 .    \}
6943 \!.  TRAP OFF
6944 .    ie \\n[#PRINT_STYLE]=1 \{\
6945 \!.     PAD "\\h'2m'\\*[$TOC_HEAD_ITEM]\\*[$TOC_PN_TYPEWRITE]"
6946 .    \}
6947 .    el \{\
6948 \!.     PAD "\\h'\\n[#TOC_HEAD_INDENT]u'\\*[$TOC_HEAD_ITEM]\\*[$TOC_PN]"
6949 .    \}
6950 \!.  EL
6951 \!.  ST 100 L
6952 \!.  ST 101 R
6953 .    if \\n[#PRINT_STYLE]=2 \{\
6954 \!.     FAMILY  \\*[$TOC_PN_FAM]
6955 \!.     FT      \\*[$TOC_PN_FT]
6956 \!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PN_SIZE_CHANGE]
6957 .    \}
6958 \!.  TAB 100
6959 \!.  PRINT \\*[LEADER]
6960 \!.  TN
6961 \!.  TRAP
6962 \!.  PRINT \\n[#TOC_ENTRY_PN]
6963 \!.  TQ
6964 .    di       
6965 .    ev
6966 \# End collection of head for TOC
6967 \# Process head
6968 .    nr #HEAD 1
6969 .    ev HEAD
6970 .    ll \\n[#L_LENGTH]u
6971 .    ta \\n(.lu
6972 .    if \\n[#COLUMNS] \{\
6973 .       ll \\n[#COL_L_LENGTH]u
6974 .       ta \\n(.lu
6975 .    \}
6976 .    CHECK_INDENT
6977 .    QUAD \\*[$HEAD_QUAD]
6978 .    if \\n[#PRINT_STYLE]=1 \{\
6979 .       fam C
6980 .       ft  R
6981 .       ps  12
6982 .       vs  \\n[#DOC_LEAD]u
6983 .       UNDERLINE OFF
6984 .    \}
6985 .    if \\n[#PRINT_STYLE]=2 \{\
6986 .       FAMILY  \\*[$HEAD_FAM]
6987 .       FT      \\*[$HEAD_FT]
6988 .       PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$HEAD_SIZE_CHANGE]
6989 .       LS      \\n[#DOC_LEAD]u
6990 .    \}
6991 .    if r#QUOTE             \{ .rr #QUOTE \}
6992 .    if r#EPIGRAPH          \{ .rr #EPIGRAPH \}
6993 .    if \\n[#PRINT_STYLE]=1 \{ .ne 3 \}
6994 .    if \\n[#PRINT_STYLE]=2 \{\
6995 .       ie \\n[#HEAD_SPACE] \{ .ne 4 \}
6996 .       el \{ .ne 3 \}
6997 .    \}
6998 .    ie \\n[#START] \{\
6999 .       if \\n[#DOC_HEADER]=0 \{ . \}
7000 .    \}
7001 .    el \{\
7002 .       if \\n[#PRINT_STYLE]=1 \{\
7003 .          if !\\n[#LINEBREAK] \{\
7004 .             ALD \\n[#DOC_LEAD]u
7005 .             if \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
7006 .          \}
7007 .       \}
7008 .       if \\n[#PRINT_STYLE]=2 \{\
7009 .          ie \\n[#PP_SPACE] \{\
7010 .             ie \\n[#END_QUOTE] \{ . \}
7011 .             el \{\
7012 .                if !\\n[#LINEBREAK] \{\
7013 .                   if \\n[#HEAD_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
7014 .                \}
7015 .             \}
7016 .          \}
7017 .          el \{\
7018 .             ie \\n[#HEAD_SPACE] \{ .ALD \\n[#DOC_LEAD]u*2u \}
7019 .             el \{ .ALD \\n[#DOC_LEAD]u \}
7020 .          \}
7021 .          if \\n[#END_QUOTE] \{\
7022 .             if !\\n[#Q_FITS] \{\
7023 .                RLD \\n[#DOC_LEAD]u
7024 .                if \\n[#PP_ACTIVE] \{ .ALD \\n[#DOC_LEAD]u \}
7025 .             \}
7026 .             if \\n[#Q_AT_TOP] \{\
7027 .                RLD \\n[#DOC_LEAD]u
7028 .                if \\n[#Q_AT_TOP] \{ .ALD \\n[#DOC_LEAD]u \}
7029 .             \}
7030 .          \}
7031 .          if \\n[#LINEBREAK] \{\
7032 .             if \\n[#HEAD_SPACE] \{ .RLD \\n[#DOC_LEAD]u \}
7033 .          \}
7034 .       \}
7035 .    \}
7036 \# Print head
7037 .    nr #ARG_NUM 0 1
7038 .    if \\n[#HEAD_CAPS] \{ .CAPS \}
7039 .    while \\n[#ARG_NUM]<\\n[#NUM_ARGS] \{\
7040 .       ie \\n[#NUMBER_HEAD] \{\
7041 .          ie \\n[#ARG_NUM]=0 \{\
7042 .             br
7043 .             ie \\n[#HEAD_UNDERLINE]=0 \{ .PRINT "\\n+[#HEAD_NUM].\0\\$[\\n+[#ARG_NUM]]\}
7044 .             el \{ .UNDERSCORE "\\n+[#HEAD_NUM].\0\\$[\\n+[#ARG_NUM]]\}
7045 .             br
7046 .          \}
7047 .          el \{\
7048 .             br
7049 .             ie \\n[#HEAD_UNDERLINE]=0 \{ .PRINT "\\$[\\n+[#ARG_NUM]]\}
7050 .             el \{ .UNDERSCORE "\\$[\\n+[#ARG_NUM]]\}
7051 .             br
7052 .          \}
7053 .       \}
7054 .       el \{\
7055 .          br
7056 .          ie \\n[#HEAD_UNDERLINE]=0 \{ .PRINT "\\$[\\n+[#ARG_NUM]]\}
7057 .          el \{ .UNDERSCORE "\\$[\\n+[#ARG_NUM]]\}
7058 .          br
7059 .       \}
7060 .    \}
7061 .    REMOVE_INDENT
7062 .    CAPS OFF
7063 .    ev
7064 .    ALD \\n[#DOC_LEAD]u
7065 .    RESET_SUBHEAD_NUMBER
7066 .    RESET_PARAHEAD_NUMBER
7067 .    if r#START      \{ .rr #START     \}
7068 .    if r#EPIGRAPH   \{ .rr #EPIGRAPH  \}
7069 .    if r#QUOTE      \{ .rr #QUOTE     \}
7070 .    if r#Q_FITS     \{ .rr #Q_FITS    \}
7071 .    if r#END_QUOTE  \{ .rr #END_QUOTE \}
7072 .    if r#LINEBREAK  \{ .rr #LINEBREAK \}
7073 .    if r#Q_AT_TOP   \{ .rr #Q_AT_TOP  \}
7074 .    if r#PP_ACTIVE  \{ .rr #PP_ACTIVE \}
7075 .    rr #ARG_NUM
7076 .    rm $TOC_HEAD_ITEM
7077 .    nr #PP 0
7078 .END
7081 \# ---Subheads---
7083 \# SUBHEAD FAMILY
7084 \# --------------
7085 \# *Argument:
7086 \#   <family to use in subheads>
7087 \# *Function:
7088 \#   Creates or modifies string $SH_FAM.
7089 \# *Notes:
7090 \#   Default is same as running text.
7092 .MAC SUBHEAD_FAMILY END
7093 .    ds $SH_FAM \\$1
7094 .END
7097 \# SUBHEAD FONT
7098 \# --------------
7099 \# *Argument:
7100 \#   <font to use in subheads>
7101 \# *Function:
7102 \#   Creates or modifies string $SH_FT.
7103 \# *Notes:
7104 \#   Default is bold.
7106 .MAC SUBHEAD_FONT END
7107 .    ds $SH_FT \\$1
7108 .END
7111 \# SUBHEAD SIZE
7112 \# ------------
7113 \# *Argument:
7114 \#   <+|- number of points by which to in/decrease point size of subheads
7115 \#   (relative to running text)>
7116 \# *Function:
7117 \#   Creates or modifies string $SH_SIZE_CHANGE.
7118 \# *Notes:
7119 \#   Must be preceded by a +|- sign.  No space afterwards.
7120 \#   Fractional point sizes are allowed.
7121 \#   Default is +.5 for printstyle TYPESET; +0 for TYPEWRITE.
7123 .MAC SUBHEAD_SIZE END
7124 .    ds $SH_SIZE_CHANGE \\$1
7125 .END
7128 \# SUBHEAD QUAD
7129 \# ------------
7130 \# *Argument:
7131 \#   L | LEFT | R | RIGHT | C | CENTER | CENTRE
7132 \# *Function:
7133 \#   Creates or modifies string $SH_QUAD.
7134 \# *Notes:
7135 \#   Default is LEFT for both TYPESET and TYPEWRITE.
7137 .MAC SUBHEAD_QUAD END
7138 .    ds $SH_QUAD \\$1
7139 .END
7142 \# SUBHEAD
7143 \# -------
7144 \# *Arguments:
7145 \#   "text of subhead" ["text of subhead"] ...
7146 \# *Function:
7147 \#   In TYPEWRITE, prints subheads underlined.
7148 \#   In TYPESET, prints subheads bold, .5 points larger than running
7149 \#   text.
7150 \#   In both styles, a line space precedes the subhead, and a small
7151 \#   amount of lead comes after.
7152 \# *Notes:
7153 \#   As with the HEAD macro, double-quotes (") must surround
7154 \#   each line of text.
7156 .MAC SUBHEAD END
7157 .    br
7158 \# Collect subhead for TOC.
7159 .    nr #ARG_NUM 0 1
7160 .    nr #TOC_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
7161 .    while \\n[#ARG_NUM]<\\n[#NUM_ARGS] \{\
7162 .       ie \\n[#ARG_NUM]=\\n[#NUM_ARGS] \{\
7163 .          as $TOC_SH_ITEM \\$[\\n+[#ARG_NUM]]\\|
7164 .       \}
7165 .       el \{\
7166 \# Note that in the .as lines, below, \ at the end has a literal
7167 \# space after it.
7168 .          ie \\n[#NUMBER_SH] \{\
7169 .             ie \\n[#ARG_NUM]=0 \{\
7170 .                as $TOC_SH_ITEM \\n+[#SH_NUM].\0\\$[\\n+[#ARG_NUM]]\ 
7171 .                nr #SH_NUM \\n-[#SH_NUM]
7172 .             \}
7173 .             el \{\
7174 .                as $TOC_SH_ITEM \\$[\\n+[#ARG_NUM]]\ 
7175 .             \}
7176 .          \}
7177 .          el \{\
7178 .             as $TOC_SH_ITEM \\$[\\n+[#ARG_NUM]]\ 
7179 .          \}
7180 .       \}
7181 .    \}
7182 \# Note the use of \!, which transparently embeds the macros used
7183 \# in the TOC_ENTRIES diversion.  The elements they control must be
7184 \# processed literally when the diversion is output.
7185 .    ev TOC_EV
7186 .    da TOC_ENTRIES
7187 .    if \\n[#PRINT_STYLE]=1 \{\
7188 \!.     fam C
7189 \!.     ft  R
7190 \!.     ps  12
7191 .    \}
7192 .    if \\n[#PRINT_STYLE]=2 \{\
7193 \!.     FAMILY  \\*[$TOC_SH_FAM]
7194 \!.     FT      \\*[$TOC_SH_FT]
7195 \!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_SH_SIZE_CHANGE]
7196 .    \}
7197 \!.  TRAP OFF
7198 .    ie \\n[#PRINT_STYLE]=1 \{\
7199 \!.     PAD "\\h'4m'\\*[$TOC_SH_ITEM]\\*[$TOC_PN_TYPEWRITE]"
7200 .    \}
7201 .    el \{\
7202 \!.     PAD "\\h'\\n[#TOC_SH_INDENT]u'\\*[$TOC_SH_ITEM]\\*[$TOC_PN]"
7203 .    \}
7204 \!.  EL
7205 \!.  ST 100 L
7206 \!.  ST 101 R
7207 .    if \\n[#PRINT_STYLE]=2 \{\
7208 \!.     FAMILY  \\*[$TOC_PN_FAM]
7209 \!.     FT      \\*[$TOC_PN_FT]
7210 \!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PN_SIZE_CHANGE]
7211 .    \}
7212 \!.  TAB 100
7213 \!.  PRINT \\*[LEADER]
7214 \!.  TN
7215 \!.  TRAP
7216 \!.  PRINT \\n[#TOC_ENTRY_PN]
7217 \!.  TQ
7218 .    di       
7219 .    ev
7220 \# End collection of head for TOC
7221 \# Process subhead
7222 .    nr #ARG_NUM 0 1
7223 .    if r#QUOTE    \{ .rr #QUOTE    \}
7224 .    if r#Q_AT_TOP \{ .rr #Q_AT_TOP \}
7225 .    ev SUBHEAD
7226 .    ll \\n[#L_LENGTH]u
7227 .    ta \\n(.lu
7228 .    if \\n[#COLUMNS] \{\
7229 .       ll \\n[#COL_L_LENGTH]u
7230 .       ta \\n(.lu
7231 .    \}
7232 .    CHECK_INDENT
7233 .    if \\n[#PRINT_STYLE]=1 \{\
7234 .       fam C
7235 .       ft  R
7236 .       ps  12
7237 .       vs  \\n[#DOC_LEAD]u
7238 .       QUAD   \\*[$SH_QUAD]
7239 .       UNDERLINE OFF
7240 .    \}
7241 .    if \\n[#PRINT_STYLE]=2 \{\
7242 .       FAMILY  \\*[$SH_FAM]
7243 .       FT      \\*[$SH_FT]
7244 .       PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$SH_SIZE_CHANGE]
7245 .       LS      \\n[#DOC_LEAD]u
7246 .       QUAD    \\*[$SH_QUAD]
7247 .    \}
7248 .    if \\n[#PRINT_STYLE]=1 \{ .nr #SH_LEAD_ADJUST \\n[#LEAD]/5 \}
7249 .    if \\n[#PRINT_STYLE]=2 \{ .nr #SH_LEAD_ADJUST \\n[#LEAD]/8 \}
7250 .    ie \\n[#START] \{ . \}
7251 .    el \{\
7252 .       ie ( \\n[#TRAP_DISTANCE] < (\\n[#DOC_LEAD]u*2u) ) \{\
7253 .          ie \\n[#COLUMNS] \{ .COL_NEXT \}
7254 .          el \{ .bp \}
7255 .       \}
7256 .       el \{\
7257 .          ie \\n[#HEAD]=1 \{ . \}
7258 .          el \{\
7259 .             if \\n[#PRINT_STYLE]=1 \{\
7260 .                if !\\n[#LINEBREAK] \{ .ALD \\n[#DOC_LEAD]u \}
7261 .             \}
7262 .             if \\n[#PRINT_STYLE]=2 \{\
7263 .                ie \\n[#PP_SPACE]=1 \{\
7264 .                   ie !\\n[#LINEBREAK] \{ .ALD \\n[#DOC_LEAD]u \}
7265 .                   el \{ .RLD \\n[#DOC_LEAD]u \}
7266 .                \}
7267 .                el \{\
7268 .                   if !\\n[#LINEBREAK] \{ .ALD \\n[#DOC_LEAD]u \}
7269 .                \}
7270 .             \}
7271 .          \}
7272 .       \}
7273 .    \}
7274 \# Print subhead
7275 .    if \\n[#PRINT_STYLE]=1 \{\
7276 .       while \\n[#ARG_NUM]<\\n[#NUM_ARGS] \{\
7277 .          ie \\n[#NUMBER_SH] \{\
7278 .             ie \\n[#ARG_NUM]=0 \{\
7279 .                ie \\n[#NUMBER_HEAD] \{\
7280 .                   br
7281 .                   UNDERSCORE "\v'-\\n[#SH_LEAD_ADJUST]u'\\n[#HEAD_NUM].\\n+[#SH_NUM]\0\\$[\\n+[#ARG_NUM]]
7282 .                   br
7283 .                \}
7284 .                el \{\
7285 .                   br
7286 .                   UNDERSCORE "\v'-\\n[#SH_LEAD_ADJUST]u'\\n+[#SH_NUM].\0\\$[\\n+[#ARG_NUM]]
7287 .                   br
7288 .                \}
7289 .             \}
7290 .             el \{\
7291 .                br
7292 .                ie \\n[#HEAD_UNDERLINE]=0 \{ .PRINT "\v'-\\n[#SH_LEAD_ADJUST]u'\\$[\\n+[#ARG_NUM]]\}
7293 .                el \{ .UNDERSCORE "\v'-\\n[#SH_LEAD_ADJUST]u'\\$[\\n+[#ARG_NUM]]\}
7294 .                br
7295 .             \}
7296 .          \}
7297 .          el \{\
7298 .             br
7299 .             UNDERSCORE "\v'-\\n[#SH_LEAD_ADJUST]u'\\$[\\n+[#ARG_NUM]]
7300 .             br
7301 .          \}
7302 .       \}
7303 .    \}
7304 .    if \\n[#PRINT_STYLE]=1 \{\
7305 .       if \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
7306 .    \}
7307 .    if \\n[#PRINT_STYLE]=2 \{\
7308 .       ie \\n[#PP_SPACE]=0 \{\
7309 .          while \\n[#ARG_NUM]<\\n[#NUM_ARGS] \{\
7310 .             ie \\n[#NUMBER_SH] \{\
7311 .                ie \\n[#ARG_NUM]=0 \{\
7312 .                   ie \\n[#NUMBER_HEAD] \{\
7313 .                      br
7314 .                      PRINT "\v'-\\n[#SH_LEAD_ADJUST]u'\\n[#HEAD_NUM].\\n+[#SH_NUM]\0\\$[\\n+[#ARG_NUM]]
7315 .                      br
7316 .                   \}
7317 .                   el \{\
7318 .                      br
7319 .                      PRINT "\v'-\\n[#SH_LEAD_ADJUST]u'\\n+[#SH_NUM].\0\\$[\\n+[#ARG_NUM]]
7320 .                      br
7321 .                   \}
7322 .                \}
7323 .                el \{\
7324 .                   br
7325 .                   PRINT "\\v'-\\n[#SH_LEAD_ADJUST]u'\\$[\\n+[#ARG_NUM]]
7326 .                   br
7327 .                \}
7328 .             \}
7329 .             el \{\
7330 .                br
7331 .                PRINT "\\v'-\\n[#SH_LEAD_ADJUST]u'\\$[\\n+[#ARG_NUM]]
7332 .                br
7333 .             \}
7334 .          \}
7335 .       \}
7336 .       el \{\
7337 .          ALD \\n[#DOC_LEAD]u
7338 .          if \\n[#HEAD]=1      \{ .RLD \\n[#DOC_LEAD]u \}
7339 .          if \\n[#END_QUOTE]   \{ .RLD \\n[#DOC_LEAD]u \}
7340 .          if \\n[#EPIGRAPH]    \{ .RLD \\n[#DOC_LEAD]u \}
7341 .          while \\n[#ARG_NUM]<\\n[#NUM_ARGS] \{\
7342 .             PRINT "\\$[\\n+[#ARG_NUM]]
7343 .          \}
7344 .          ALD \\n[#DOC_LEAD]u
7345 .       \}
7346 .    \}
7347 .    REMOVE_INDENT
7348 .    ev
7349 .    RESET_PARAHEAD_NUMBER
7350 .    if r#START     \{ .rr #START     \}
7351 .    if r#EPIGRAPH  \{ .rr #EPIGRAPH  \}
7352 .    if r#Q_FITS    \{ .rr #Q_FITS    \}
7353 .    if r#END_QUOTE \{ .rr #END_QUOTE \}
7354 .    if r#LINEBREAK \{ .rr #LINEBREAK \}
7355 .    rm $TOC_SH_ITEM
7356 .    nr #PP 0
7357 .    nr #HEAD 2
7358 .END
7360 \# ---Paragraph heads---
7362 \# PARAHEAD FAMILY
7363 \# ---------------
7364 \# *Argument:
7365 \#   <family to use in paraheads>
7366 \# *Function:
7367 \#   Creates or modifies string $PH_FAM.
7368 \# *Notes:
7369 \#   Default is same as running text.
7371 .MAC PARAHEAD_FAMILY END
7372 .    ds $PH_FAM \\$1
7373 .END
7376 \# PARAHEAD FONT
7377 \# -------------
7378 \# *Argument:
7379 \#   <font to use in paraheads>
7380 \# *Function:
7381 \#   Creates or modifies string $PH_FT.
7382 \# *Notes:
7383 \#   Default is bold italic for TYPESET; underlined for TYPEWRITE.
7385 .MAC PARAHEAD_FONT END
7386 .    ds $PH_FT \\$1
7387 .END
7390 \# PARAHEAD SIZE
7391 \# -------------
7392 \# *Argument:
7393 \#   <+|- number of points by which to in/decrease point size of subheads
7394 \#   (relative to running text)>
7395 \# *Function:
7396 \#   Creates or modifies string $PH_SIZE_CHANGE.
7397 \# *Notes:
7398 \#   Must be preceded by a +|- sign.  No space afterwards.
7399 \#   Fractional point sizes are allowed.  No unit of measure, please.
7400 \#   Default is +.5 for printstyle TYPESET; +0 for TYPEWRITE.
7402 .MAC PARAHEAD_SIZE END
7403 .    ds $PH_SIZE_CHANGE \\$1
7404 .END
7407 \# PARAHEAD INDENT
7408 \# ---------------
7409 \# *Argument:
7410 \#   <size of indent>
7411 \# *Function:
7412 \#   Creates or modifies register #PH_INDENT.
7413 \# *Notes:
7414 \#   Default is 1/2 #PP_INDENT for TYPESET and TYPEWRITE.
7416 .MAC PARAHEAD_INDENT END
7417 .    nr #PH_INDENT (\\$1)
7418 .END
7421 \# PARAHEAD
7422 \# --------
7423 \# *Arguments:
7424 \#   "<para head>"
7425 \# *Function:
7426 \#   Deposits a paragraph head at the start and into the body of a
7427 \#   paragraph.
7428 \# *Notes:
7429 \#   PARAHEAD *must* come after PP.
7431 .MAC PARAHEAD END
7432 \# Collect parahead for TOC.
7433 .    nr #TOC_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
7434 .    ie \\n[#NUMBER_PH] \{\
7435 .       ds $TOC_PH_ITEM \\n+[#PH_NUM].\0\\$1\\|
7436 .       nr #PH_NUM \\n-[#PH_NUM]
7437 .    \}
7438 .    el \{\
7439 .       ds $TOC_PH_ITEM \\$1\\|
7440 .    \}
7441 .    ev TOC_EV
7442 .    da TOC_ENTRIES
7443 .    if \\n[#PRINT_STYLE]=1 \{\
7444 \!.       fam C
7445 \!.       ft  R
7446 \!.       ps  12
7447 .    \}
7448 .    if \\n[#PRINT_STYLE]=2 \{\
7449 \!.     FAMILY  \\*[$TOC_PH_FAM]
7450 \!.     FT      \\*[$TOC_PH_FT]
7451 \!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PH_SIZE_CHANGE]
7452 .    \}
7453 \!.  TRAP OFF
7454 .    ie \\n[#PRINT_STYLE]=1 \{\
7455 \!.     PAD "\\h'6m'\\*[$TOC_PH_ITEM]\\*[$TOC_PN_TYPEWRITE]" 
7456 .    \}
7457 .    el \{\
7458 \!.     PAD "\\h'\\n[#TOC_PH_INDENT]u'\\*[$TOC_PH_ITEM]\\*[$TOC_PN]"
7459 .    \}
7460 \!.  EL
7461 \!.  ST 100 L
7462 \!.  ST 101 R
7463 .    if \\n[#PRINT_STYLE]=2 \{\
7464 \!.     FAMILY  \\*[$TOC_PN_FAM]
7465 \!.     FT      \\*[$TOC_PN_FT]
7466 \!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PN_SIZE_CHANGE]
7467 .    \}
7468 \!.  TAB 100
7469 \!.  PRINT \\*[LEADER]
7470 \!.  TN
7471 \!.  TRAP
7472 \!.  PRINT \\n[#TOC_ENTRY_PN]
7473 \!.  TQ
7474 .    di       
7475 .    ev
7476 \# End collection of parahead for TOC
7477 \# Process parahead
7478 .    if \\n[#SLANT_ON] \{\
7479 .       nr #SLANT_WAS_ON 1
7480 \E*[SLANTX]
7481 .    \}
7482 .    ie \\n[#PP]=1 \{\
7483 .       if \\n[#INDENT_FIRST_PARAS] \{\
7484 .          ti \\n[#PH_INDENT]u
7485 .       \}
7486 .    \}
7487 .    el \{ .ti \\n[#PH_INDENT]u \}
7488 .    if \\n[#PRINT_STYLE]=1 \{\
7489 .       fam C
7490 .       ft  R
7491 .       ps  12
7492 .       UNDERLINE OFF
7493 .       ie \\n[#NUMBER_PH] \{\
7494 .          if \\n[#NUMBER_HEAD] \{\
7495 .             ie \\n[#NUMBER_SH] \{\
7496 .                UNDERSCORE "\R'#NUMBERED 1'\\n[#HEAD_NUM].\\n[#SH_NUM].\\n+[#PH_NUM].\\ \\$1"
7498 .             \}
7499 .             el \{\
7500 .                UNDERSCORE "\R'#NUMBERED 1'\\n[#HEAD_NUM].\\n+[#PH_NUM].\\ \\$1
7502 .             \}
7503 .          \}
7504 .          ie \\n[#NUMBER_SH] \{\
7505 .             if !\\n[#NUMBERED] \{\
7506 .                UNDERSCORE "\\n[#SH_NUM].\\n+[#PH_NUM].\\ \\$1
7508 .             \}
7509 .          \}
7510 .          el \{\
7511 .             if !\\n[#NUMBERED] \{\
7512 .                UNDERSCORE "\\n+[#PH_NUM].\\ \\$1
7514 .             \}
7515 .          \}
7516 .       \}
7517 .       el \{\
7518 .          UNDERSCORE "\\$1
7520 .       \}
7521 .       if \\n[#SLANT_WAS_ON] \{\
7522 .          if \\n[#UNDERLINE_SLANT] \{ .UNDERLINE \}
7523 .          if \\n[#SLANT_MEANS_SLANT] \{\
7524 \E*[SLANT]\c
7525 .          \}
7526 .          rr #SLANT_WAS_ON
7527 .       \}
7528 .    \}
7529 .    if \\n[#PRINT_STYLE]=2 \{\
7530 .       FAM     \\*[$PH_FAM]
7531 .       FT      \\*[$PH_FT]
7532 .       PT_SIZE \\*[$PH_SIZE_CHANGE]
7533 .       ie \\n[#NUMBER_PH] \{\
7534 .          if \\n[#NUMBER_HEAD] \{\
7535 .             ie \\n[#NUMBER_SH] \{\
7536 .                PRINT "\R'#NUMBERED 1'\\n[#HEAD_NUM].\\n[#SH_NUM].\\n+[#PH_NUM].\0\\$1\h'.6m'\c"
7537 .             \}
7538 .             el \{\
7539 .                PRINT "\R'#NUMBERED 1'\\n[#HEAD_NUM].\\n+[#PH_NUM].\0\\$1\h'.6m'\c"
7540 .             \}
7541 .          \}
7542 .          ie \\n[#NUMBER_SH] \{\
7543 .             if !\\n[#NUMBERED] \{\
7544 .                PRINT "\\n[#SH_NUM].\\n+[#PH_NUM].\0\\$1\h'.6m'\c"
7545 .             \}
7546 .          \}
7547 .          el \{\
7548 .             if !\\n[#NUMBERED] \{\
7549 .                PRINT "\\n+[#PH_NUM].\0\\$1\h'.6m'\c"
7550 .             \}
7551 .          \}
7552 .       \}
7553 .       el \{\
7554 .          PRINT "\\$1\h'.6m'\c"
7555 .       \}
7556 .       FAMILY  \\*[$DOC_FAM]
7557 .       FT      \\*[$PP_FT]
7558 .       PT_SIZE \\n[#DOC_PT_SIZE]u
7559 .       if \\n[#SLANT_WAS_ON] \{\
7560 .          rr #SLANT_WAS_ON 1
7561 \E*[SLANT]\c
7562 .       \}
7563 .    \}
7564 .    rr #NUMBERED
7565 .    rm $TOC_PH_ITEM
7566 .END
7569 \# ====================================================================
7571 \# +++LINE BREAKS+++
7573 \# LINEBREAK CHARACTER
7574 \# -------------------
7575 \# *Arguments:
7576 \#   [character] [iterations] [vertical adjustment]
7577 \# *Function:
7578 \#   Allows user to specify a line break character and the number
7579 \#   of times to repeat it horiontally.
7580 \# *Notes:
7581 \#   Without an argument, LINEBREAK_CHAR will deposit a blank line.
7583 \#   Vertical adjustment requires a unit of measure (most likely
7584 \#   "p"), and has to be preceded by +|-
7586 .MAC LINEBREAK_CHAR END
7587 .    nr #REPEAT 1
7588 .    ds $LINEBREAK_CHAR \\$1
7589 .    ds $LINEBREAK_CHAR_V_ADJ \\$3
7590 .    if '\\*[$LINEBREAK_CHAR_V_ADJ]'' \{\
7591 .       ds $LINEBREAK_CHAR_V_ADJ +0
7592 .    \}
7593 .    while \\$2>\\n[#REPEAT] \{\
7594 .       as $LINEBREAK_CHAR "\\ \\$1
7595 .       nr #REPEAT \\n[#REPEAT]+1
7596 .    \}
7597 .   rr #REPEAT
7598 .END
7601 \# LINE BREAK
7602 \# ----------
7603 \# *Arguments:
7604 \#   <none>
7605 \# *Function:
7606 \#   Deposits line break character.
7607 \# *Notes:
7608 \#   If $LINEBREAK_CHAR is blank, simply advances 2 line spaces.
7610 .MAC LINEBREAK END
7611 .    if r#Q_AT_TOP \{ .rr #Q_AT_TOP \}
7612 .    po \\n[#DOC_L_MARGIN]u
7613 .    ie  '\\*[$LINEBREAK_CHAR]'' \{ .ALD \\n[#DOC_LEAD]u*2 \}
7614 .    el \{\
7615 .       if \\n[#PRINT_STYLE]=1 \{\
7616 .          ie \\n[#END_QUOTE] \{ . \}
7617 .          el \{ .ALD \\n[#DOC_LEAD]u \}
7618 .       \}
7619 .       if \\n[#PRINT_STYLE]=2 \{\
7620 .          ie \\n[#END_QUOTE] \{ . \}
7621 .          el \{ .ALD \\n[#DOC_LEAD]u \}
7622 .       \}
7623 .       CENTER
7624 .       PRINT \\v'\\*[$LINEBREAK_CHAR_V_ADJ]'\\*[$LINEBREAK_CHAR]\\v'\\*[$LINEBREAK_CHAR_V_ADJ]'
7625 .       if \\n[#PRINT_STYLE]=1 \{ .ALD \\n[#DOC_LEAD]u \}
7626 .       if \\n[#PRINT_STYLE]=2 \{ .ALD \\n[#DOC_LEAD]u \}
7627 .       QUAD \\*[$DOC_QUAD]
7628 .    \}
7629 .    nr #LINEBREAK 1
7630 .    if r#QUOTE     \{ .rr #QUOTE     \}
7631 .    if r#END_QUOTE \{ .rr #END_QUOTE \}
7632 .    nr #PP 0
7633 .END
7635 \# ====================================================================
7637 \# +++PARAGRAPHS+++
7639 \# PARAGRAPH FONT
7640 \# --------------
7641 \# *Argument:
7642 \#   <font of running text>
7643 \# *Function:
7644 \#   Creates or modifies string $PP_FT.
7645 \# *Notes:
7646 \#   Affects all paragraphs.
7648 .MAC PP_FONT END
7649 .    if \\n[#IGNORE] \{ .return \}
7650 .    br
7651 .    ds $PP_FT \\$1
7652 .    FT \\*[$PP_FT]
7653 .END
7656 \# PARAGRAPH INDENT
7657 \# ----------------
7658 \# *Argument:
7659 \#   <amount to indent paragraphs in running text (ipPcm)>
7660 \# *Function:
7661 \#   Allows user to change the default para indent.  The change will
7662 \#   affect the indent of QUOTEs and BLOCKQUOTEs as well.
7663 \# *Notes:
7664 \#   Default for printstyle TYPEWRITE is 1/2-inch.  Default for
7665 \#   printstyle TYPESET is 2 ems.  The defaults are set in
7666 \#   PRINTSTYLE, not DEFAULTS.
7668 .MAC PARA_INDENT END
7669 .    nr #PP_INDENT (\\$1)
7670 .END
7673 \# INDENT FIRST PARAGRAPHS
7674 \# -----------------------
7675 \# *Arguments:
7676 \#   <none> | <anything>
7677 \# *Function:
7678 \#   By default, the first para of a document, as well as the first
7679 \#   paras of blockquotes and block-style epigraphs are not indented.
7680 \#   When invoked, this macro will indent all paras.
7681 \# *Notes:
7682 \#   Default is OFF.
7684 .MAC INDENT_FIRST_PARAS END
7685 .    ie '\\$1'' \{ .nr #INDENT_FIRST_PARAS 1 \}
7686 .    el \{ .rr #INDENT_FIRST_PARAS   \}
7687 .END
7690 \# INTER-PARAGRAPH SPACING
7691 \# -----------------------
7692 \# *Arguments:
7693 \#   <none> | <anything>
7694 \# *Function:
7695 \#   Adds a line space between paragraphs in body text.  Block quotes
7696 \#   are unaffected.
7697 \# *Notes:
7698 \#   Default is OFF.  PARA_SPACE ON is not recommended for use
7699 \#   with PRINTSTYLE TYPEWRITE.
7701 .MAC PARA_SPACE END
7702 .    ie '\\$1'' \{ .nr #PP_SPACE 1 \}
7703 .    el \{ .rr #PP_SPACE   \}
7704 .END
7707 \# PARAGRAPH
7708 \# ---------
7709 \# *Arguments:
7710 \#   <none>
7711 \# *Function:
7712 \#   Figures out what to do with paragraphs under differing conditions.
7713 \# *Notes:
7714 \#   For the time being, there's no automatic widow/orphan control.
7715 \#   Controlling them isn't just a matter of establishing an arbitrary
7716 \#   number of lines needed for a para, since groff doesn't then
7717 \#   handle single line paragraphs gracefully.  Usually, the whole
7718 \#   page needs to be tweaked.
7720 \#   Note the use of transparent line break (\!.br) to get
7721 \#   PP to work within blockquotes and epigraphs.
7723 \#   PP_STYLE 1 = regular paras; 2 = blockquotes, epigraphs
7725 .MAC PP END
7726 .    br
7727 .    if \\n[#DOC_TYPE]=4 \{\
7728 .       if !'\\n(.z'' \{ .di \}
7729 .       if \\n[#DATE] \{\
7730 .          nf
7731 .          DATE
7732 .          QUAD \\*[$DOC_QUAD]
7733 .          ALD \\n[#DOC_LEAD]u*2u
7734 .          rr #DATE
7735 .       \}
7736 .       if \\n[#TO] \{\
7737 .          nf
7738 .          TO_ADDRESS
7739 .          ALD \\n[#DOC_LEAD]u
7740 .          rr #TO
7741 .       \}
7742 .       if \\n[#FROM] \{\
7743 .          nf
7744 .          FROM_ADDRESS
7745 .          ALD \\n[#DOC_LEAD]u
7746 .          rr #FROM
7747 .       \}
7748 .       if \\n[#GREETING] \{\
7749 .          nf
7750 .          GREETING
7751 .          ALD \\n[#DOC_LEAD]u
7752 .          rr #GREETING
7753 .       \}
7754 .    \}
7755 .    rr #PP_ACTIVE
7756 .    if r#Q_AT_TOP \{ .rr #Q_AT_TOP \}
7757 .    if \\n[#PP_STYLE]=1 \{\
7758 .       if \\n[#ENDNOTE] \{\
7759 .          nr #RESET_PARA_SPACE \\n[#PP_SPACE]
7760 .          ie \\n[#EN_PP_SPACE] \{ .PARA_SPACE \}
7761 .          el \{ .PARA_SPACE OFF \}
7762 .       \}
7763 .       br
7764 .       if !\\n[#ENDNOTE] \{ .po \\n[#L_MARGIN]u \}
7765 .       if \\n[#COLUMNS] \{\
7766 .          if !\\n[#ENDNOTE] \{ .po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u \}
7767 .       \}
7768 .       if \\n[#TAB_ACTIVE] \{ .TAB \\n[#CURRENT_TAB] \}
7769 .       ie \\n[#PRINT_STYLE]=1 \{\
7770 .          fam C
7771 .          ft  R
7772 .          ps  12
7773 .          ie \\n[#ENDNOTE] \{ .vs \\n[#EN_LEAD]u \}
7774 .          el \{ .vs \\n[#DOC_LEAD]u \}
7775 .          QUAD \\*[$DOC_QUAD]
7776 .          UNDERLINE OFF
7777 .          if \\n[#SLANT_ON] \{\
7778 .             if \\n[#UNDERLINE_SLANT] \{ .UNDERLINE \}
7779 .          \}
7780 .       \}
7781 .       el \{\
7782 .          ie \\n[#ENDNOTE] \{\
7783 .             FAMILY  \\*[$EN_FAM]
7784 .             FT      \\*[$EN_FT]
7785 .             PT_SIZE \\n[#EN_PS]u
7786 .             vs      \\n[#EN_LEAD]u
7787 .             QUAD    \\*[$EN_QUAD]
7788 .          \}
7789 .          el \{\
7790 .             FAMILY  \\*[$DOC_FAM]
7791 .             FT      \\*[$PP_FT]
7792 .             PT_SIZE \\n[#DOC_PT_SIZE]u
7793 .             LS      \\n[#DOC_LEAD]u
7794 .             QUAD    \\*[$DOC_QUAD]
7795 .          \}
7796 .       \}
7797 .       ie \\n[#PP]=0 \{\
7798 .          if \\n[#INDENT_FIRST_PARAS] \{\
7799 .             ie \\n[#INDENT_ACTIVE] \{ .ti \\n[#INDENT]u+\\n[#PP_INDENT]u \}
7800 .             el \{ .ti \\n[#PP_INDENT]u \}
7801 .             if '\\n(.z'END_NOTES' \{\
7802 .                ti \\n[#EN_PP_INDENT]u+\\n[#EN_TEXT_INDENT]u
7803 .             \}
7804 .          \}
7805 .          if r#END_QUOTE \{\
7806 .             if \\n[#END_QUOTE] \{\
7807 .                if !\\n[#LINEBREAK] \{\
7808 .                   ie \\n[#INDENT_ACTIVE] \{ .ti \\n[#INDENT]u+\\n[#PP_INDENT]u \}
7809 .                   el \{ .ti \\n[#PP_INDENT]u \}
7810 .                   if '\\n(.z'END_NOTES' \{\
7811 .                      ti \\n[#EN_PP_INDENT]u+\\n[#EN_TEXT_INDENT]u
7812 .                   \}
7813 .                \}
7814 .             \}
7815 .          \}
7816 .       \}
7817 .       el \{\
7818 .          br
7819 .          if \\n[#PP_SPACE] \{\
7820 .             if \\n[#PRINT_STYLE]=2 \{\
7821 .                ie \\n[#END_QUOTE] \{\
7822 .                   rr #END_QUOTE
7823 .                \}
7824 .                el \{ .ALD \\n[#DOC_LEAD]u \}
7825 .             \}
7826 .          \}
7827 .          ie \\n[#INDENT_ACTIVE] \{ .ti \\n[#INDENT]u+\\n[#PP_INDENT]u \}
7828 .          el \{ .ti \\n[#PP_INDENT]u \}
7829 .          if '\\n(.z'END_NOTES' \{\
7830 .             ti \\n[#EN_PP_INDENT]u+\\n[#EN_TEXT_INDENT]u
7831 .          \}
7832 .       \}
7833 .       if r#START     \{ .rr #START     \}
7834 .       if r#QUOTE     \{ .rr #QUOTE     \}
7835 .       if r#END_QUOTE \{ .rr #END_QUOTE \}
7836 .       if r#HEAD      \{ .rr #HEAD      \}
7837 .       if r#EPIGRAPH  \{ .rr #EPIGRAPH  \}
7838 .       if r#Q_FITS    \{ .rr #Q_FITS    \}
7839 .       if r#LINEBREAK \{ .rr #LINEBREAK \}
7840 .       if \\n[#ENDNOTE] \{\
7841 .          ie \\n[#RESET_PARA_SPACE] \{ .PARA_SPACE \}
7842 .          el \{ .PARA_SPACE OFF \}
7843 .       \}
7844 .       if \\n[#CONDENSE] \{\
7845 \E*[COND]\c
7846 .       \}
7847 .       if \\n[#EXTEND]=1 \{\
7848 \E*[EXT]\c
7849 .       \}
7850 .       nr #PP +1
7851 .    \}
7852 .    if \\n[#PP_STYLE]=2 \{\
7853 \!.     br
7854 .       if \\n[#BROKEN_QUOTE] \{\
7855 .          ie \\n(nl=\\n[#PAGE_TOP] \{ .nr #Q_PP 1 \}
7856 .          el \{ .nr #Q_PP 0 \}
7857 .          rr #BROKEN_QUOTE
7858 .       \}
7859 .       ie \\n[#Q_PP]=0 \{\
7860 .          if \\n[#INDENT_FIRST_PARAS] \{\
7861 .             ti \\n[#PP_INDENT]u/2u
7862 .          \}
7863 .          if \\n[#ENDNOTE] \{\
7864 .             ie \\n[#INDENT_FIRSTS] \{ .ti \\n[#PP_INDENT]u/2u \}
7865 .             el \{ .ti 0 \}
7866 .          \}
7867 .       \}
7868 .       el \{\
7869 .          ti \\n[#PP_INDENT]u/2u
7870 .       \}
7871 .       if \\n[#CONDENSE] \{\
7872 \E*[COND]\c
7873 .       \}
7874 .       if \\n[#EXTEND]=1 \{\
7875 \E*[EXT]\c
7876 .       \}
7877 .    nr #Q_PP +1
7878 .    \}
7879 .    nr #PP_ACTIVE 1
7880 .END
7882 \# ====================================================================
7884 \# +++QUOTES+++
7886 \# ---Line for line (poetic) quotes---
7888 \# QUOTE FAMILY
7889 \# ------------
7890 \# *Argument:
7891 \#   <family to use in line for line quotes>
7892 \# *Function:
7893 \#   Creates or modifies string $QUOTE_FAM.
7894 \# *Notes:
7895 \#   Default is same as running text.
7897 .MAC QUOTE_FAMILY END
7898 .    ds $QUOTE_FAM \\$1
7899 .END
7902 \# QUOTE FONT
7903 \# ----------
7904 \# *Argument:
7905 \#   <font to use in line for line quotes>
7906 \# *Function:
7907 \#   Creates or modifies string $QUOTE_FT.
7908 \# *Notes:
7909 \#   Default is italic for TYPESET.
7911 .MAC QUOTE_FONT END
7912 .    ds $QUOTE_FT \\$1
7913 .END
7916 \# QUOTE SIZE
7917 \# ----------
7918 \# *Argument:
7919 \#   <-|+ number of points by which to de/increase point size of
7920 \#   line for line quotes (relative to running text)>
7921 \# *Function:
7922 \#   Creates or modifies string $QUOTE_SIZE_CHANGE.
7923 \# *Notes:
7924 \#   Must be preceded by a - or + sign with no space afterwards.
7925 \#   Fractional point sizes are allowed.
7926 \#   Default is +0.
7928 .MAC QUOTE_SIZE END
7929 .    ds $QUOTE_SIZE_CHANGE \\$1
7930 .END
7933 \# UNDERLINE QUOTES
7934 \# ----------------
7935 \# *Arguments:
7936 \#   <none> | <anything>
7937 \# *Function:
7938 \#   Creates or modifies register #UNDERLINE_QUOTES (toggle).
7939 \#   If on, line for line quotes are underlined when printstyle
7940 \#   is TYPEWRITE.
7941 \# *Notes:
7942 \#   Default is ON for printstyle TYPEWRITE.
7944 .MAC UNDERLINE_QUOTES END
7945 .    ie '\\$1'' \{ .nr #UNDERLINE_QUOTES 1 \}
7946 .    el \{ .rr #UNDERLINE_QUOTES   \}
7947 .END
7950 \# QUOTE INDENT
7951 \# ------------
7952 \# *Argument:
7953 \#   <value by which to multiply PP_INDENT for indented quoted text>
7954 \# *Function:
7955 \#   Creates or modifies register #Q_OFFSET_VALUE.
7956 \# *Notes:
7957 \#   Default is 3 for typeset; 2 for typewrite
7959 .MAC QUOTE_INDENT END
7960 .    nr #Q_OFFSET_VALUE \\$1
7961 .END
7964 \# ALWAYS FULLSPACE QUOTES
7965 \# -----------------------
7966 \# *Arguments:
7967 \#   <none> | <anything>
7968 \# *Function:
7969 \#   Toggles register #FULLSPACE_QUOTES.
7970 \# *Notes:
7971 \#   If user doesn't like the default 1/2 line space above and below
7972 \#   quotes, s/he can turn it off here.  Has no effect in TYPEWRITE.
7974 .MAC ALWAYS_FULLSPACE_QUOTES END
7975 .    if '\\$1'' \{ .nr #FULLSPACE_QUOTES 1 \}
7976 .    el \{ .rr #FULLSPACE_QUOTES \}
7977 .END
7980 \# QUOTE
7981 \# -----
7982 \# *Arguments:
7983 \#   <none> | <anything>
7984 \# *Function:
7985 \#   Indents quoted text on a line for line basis, or turns QUOTE off.
7986 \# *Notes:
7987 \#   Owing to the need to bottom align TYPESET pages, quoted text gets
7988 \#   diverted so its depth can be measured (in DO_QUOTE) for determining
7989 \#   how much space to put before and after.
7991 .MAC QUOTE END
7992 .    br
7993 \# **Uncomment the next line to prevent orphaned quote lines.
7994 \#.  ne 1
7995 .    ie '\\$1'' \{\
7996 .       ev QUOTE
7997 .       nr #QUOTE 1
7998 .       di P_QUOTE
7999 .       ll \\n[#L_LENGTH]u-(\\n[#PP_INDENT]u*\\n[#Q_OFFSET_VALUE]u)
8000 .       ta \\n(.lu
8001 .       if \\n[#COLUMNS] \{\
8002 .          ll \\n[#COL_L_LENGTH]u-(\\n[#PP_INDENT]u*\\n[#Q_OFFSET_VALUE]u)
8003 .          ta \\n(.lu
8004 .       \}
8005 .       if \\n[#PRINT_STYLE]=1 \{\
8006 .          fam C
8007 .          ft  R
8008 .          ps 12
8009 .          vs \\n[#DOC_LEAD]u
8010 .          LEFT
8011 .       \}
8012 .       if \\n[#PRINT_STYLE]=2 \{\
8013 .          FAMILY  \\*[$QUOTE_FAM]
8014 .          FT      \\*[$QUOTE_FT]
8015 .          PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$QUOTE_SIZE_CHANGE]
8016 .          LS      \\n[#DOC_LEAD]u
8017 .          LEFT
8018 .       \}
8019 .       nr #Q_TOP \\n(nl
8020 .       if \\n[#PRINT_STYLE]=1 \{\
8021 .          if \\n[#UNDERLINE_QUOTES] \{\
8022 .               FT I
8023 .          \}
8024 .       \}
8025 .    \}
8026 .    el \{ .DO_QUOTE \}
8027 .END
8030 \# ---Blockquotes---
8032 \# BLOCKQUOTE FAMILY
8033 \# -----------------
8034 \# *Argument:
8035 \#   <family to use in blockquotes>
8036 \# *Function:
8037 \#   Creates or modifies string $BQUOTE_FAM.
8038 \# *Notes:
8039 \#   Default is same as running text.
8041 .MAC BLOCKQUOTE_FAMILY END
8042 .    ds $BQUOTE_FAM \\$1
8043 .END
8046 \# BLOCKQUOTE FONT
8047 \# ---------------
8048 \# *Argument:
8049 \#   <font to use in blockquotes>
8050 \# *Function:
8051 \#   Creates or modifies string $BQUOTE_FT.
8052 \# *Notes:
8053 \#   Default is same as running text.
8055 .MAC BLOCKQUOTE_FONT END
8056 .    ds $BQUOTE_FT \\$1
8057 .END
8060 \# BLOCKQUOTE SIZE
8061 \# ---------------
8062 \# *Argument:
8063 \#   <-|+ number of points by which to de/increase point size of blockquotes
8064 \#   (relative to running text)>
8065 \# *Function:
8066 \#   Creates or modifies string $BQUOTE_SIZE_CHANGE.
8067 \# *Notes:
8068 \#   Must be preceded by a - or + sign with no space afterwards.
8069 \#   Fractional point sizes are allowed.
8070 \#   Default is -1 for printstyle TYPESET; +0 for TYPEWRITE.
8072 .MAC BLOCKQUOTE_SIZE END
8073 .    ds $BQUOTE_SIZE_CHANGE \\$1
8074 .END
8077 \# BLOCKQUOTE QUAD
8078 \# ---------------
8079 \# *Arguments:
8080 \#   <quad to use in blockquotes>
8081 \# *Function:
8082 \#   Creates or modifies string $BQUOTE_QUAD.
8083 \# *Notes:
8084 \#   Default is LEFT.
8086 .MAC BLOCKQUOTE_QUAD END
8087 .    ds $BQUOTE_QUAD \\$1
8088 .END
8091 \# BLOCKQUOTE
8092 \# ----------
8093 \# *Arguments:
8094 \#   <none> | <anything>
8095 \# *Function:
8096 \#   Indents quoted text in fill mode and shortens line length
8097 \#   accordingly, or turns BLOCKQUOTE off.
8098 \# *Notes:
8099 \#   Owing to the need to bottom align TYPESET pages, quoted text gets
8100 \#   diverted so its depth can be measured (in DO_QUOTE) for determining
8101 \#   how much space to put before and after.
8103 \#   .PP after blockquote is optional if there's only one para,
8104 \#   but REQUIRED if there's more than one.
8106 .MAC BLOCKQUOTE END
8107 .    br
8108 .    ie '\\$1'' \{\
8109 .       ev BLOCKQUOTE
8110 .       nr #QUOTE    2
8111 .       nr #PP_STYLE 2
8112 .       nr #Q_PP     0
8113 .       di B_QUOTE
8114 .       ll \\n[#L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#Q_OFFSET_VALUE]u*2u))
8115 .       if \\n[#ENDNOTE] \{\
8116 .          if \\n[#EN_NUMBERS_ALIGN_RIGHT] \{\
8117 .             ll \\n[#RESET_L_LENGTH]u-\\n[#EN_TEXT_INDENT]u-(\\n[#EN_PP_INDENT]u*(\\n[#Q_OFFSET_VALUE]u*2u))
8118 .          \}
8119 .          if \\n[#EN_NUMBERS_ALIGN_LEFT] \{\
8120 .             ll \\n[#L_LENGTH]u-(\\n[#EN_PP_INDENT]u*(\\n[#Q_OFFSET_VALUE]u*2u))
8121 .          \}
8122 .       \}
8123 .       ta \\n(.lu
8124 .       CHECK_INDENT
8125 .       if \\n[#COLUMNS] \{\
8126 .          ll \\n[#COL_L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#Q_OFFSET_VALUE]u*2u))
8127 .          if \\n[#ENDNOTE] \{\
8128 .             if \\n[#EN_NUMBERS_ALIGN_RIGHT] \{\
8129 .                ll \\n[#RESET_L_LENGTH]u-\\n[#EN_TEXT_INDENT]u-(\\n[#EN_PP_INDENT]u*(\\n[#Q_OFFSET_VALUE]u*2u))
8130 .             \}
8131 .             if \\n[#EN_NUMBERS_ALIGN_LEFT] \{\
8132 .                ll \\n[#COL_L_LENGTH]u-(\\n[#EN_PP_INDENT]u*(\\n[#Q_OFFSET_VALUE]u*2u))
8133 .             \}
8134 .          \}
8135 .          ta \\n(.lu
8136 .       \}
8137 .       if \\n[#PRINT_STYLE]=1 \{\
8138 .          fam C
8139 .          ft  R
8140 .          ps  12
8141 .          vs  \\n[#DOC_LEAD]u
8142 .          QUAD LEFT
8143 .          HY OFF
8144 .       \}
8145 .       if \\n[#PRINT_STYLE]=2 \{\
8146 .          FAMILY  \\*[$BQUOTE_FAM]
8147 .          FT      \\*[$BQUOTE_FT]
8148 .          PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$BQUOTE_SIZE_CHANGE]
8149 .          LS      \\n[#DOC_LEAD]u
8150 .          if \\n[#ENDNOTE] \{\
8151 .             PT_SIZE \\n[#EN_PS]u\\*[$BQUOTE_SIZE_CHANGE]
8152 .          \}
8153 .          QUAD    \\*[$BQUOTE_QUAD]
8154 .          HY
8155 .       \}
8156 .       nr #Q_TOP \\n(nl
8157 .       if \\n[#INDENT_FIRST_PARAS] \{\
8158 .          ie !\\n[#ENDNOTE] \{\
8159 .             if \\n[#PRINT_STYLE]=1 \{ .ti \\n[#PP_INDENT]u/2u \}
8160 .             if \\n[#PRINT_STYLE]=2 \{ .ti \\n[#PP_INDENT]u/2u \}
8161 .          \}
8162 .          el \{\
8163 .             if \\n[#INDENT_FIRSTS]=1 \{\
8164 .                if \\n[#PRINT_STYLE]=1 \{ .ti \\n[#EN_PP_INDENT]u/2u \}
8165 .                if \\n[#PRINT_STYLE]=2 \{ .ti \\n[#EN_PP_INDENT]u/2u \}
8166 .             \}
8167 .          \}
8168 .       \}
8169 .    \}
8170 .    el \{ .DO_QUOTE \}
8171 .END
8174 \# DO QUOTE
8175 \# --------
8176 \# *Arguments:
8177 \#   <none>
8178 \# *Function:
8179 \#   Ends the diversion P_QUOTE or B_QUOTE.  Spaces them according to
8180 \#   PRINT_STYLE, whether there's inter-paragraph spacing, and page
8181 \#   position.  TYPEWRITE treats spacing the same way in all circumstance
8182 \#   (viz. an extra line space).  TYPESET puts in only half
8183 \#   line spaces if the entire quote plus 1 line of body under the quote
8184 \#   fits on the the page; otherwise it puts in a full extra blank
8185 \#   line.  (This is to ensure the page remains bottom aligned).
8187 .MAC DO_QUOTE END
8188 .    di
8189 .    REMOVE_INDENT
8190 .    ev
8191 \#   **Change *1 to *2 in next line to prevent orphans after quotes
8192 .    if \\n[#ENDNOTE] \{\
8193 .       nr #RESET_QUOTE_SPACING \\n[#FULLSPACE_QUOTES]
8194 .       ALWAYS_FULLSPACE_QUOTES
8195 .    \}
8196 .    nr #Q_DEPTH \\n[#DIVER_DEPTH]+(\\n[#LEAD]*1)
8197 .    if \\n[#PRINT_STYLE]=1 \{\
8198 .       if \\n[#START]=1 \{ . \}
8199 .       if \\n[#START]=0 \{\
8200 .          if !\\n[#LINEBREAK] \{ .ALD \\n[#DOC_LEAD]u \}
8201 .       \}
8202 .       if \\n[#HEAD] \{\
8203 .          if \\n[#HEAD]=1 \{ .RLD \\n[#DOC_LEAD]u \}
8204 .       \}
8205 .    \}
8206 .    if \\n[#PRINT_STYLE]=2 \{\
8207 .       ie \\n[#PP_SPACE] \{\
8208 .          ie \\n[#HEAD]>0 \{ . \}
8209 .          el \{\
8210 .             ie \\n[#START] \{ . \}
8211 .             el \{ .ALD \\n[#DOC_LEAD]u \}
8212 .          \}
8213 .       \}
8214 .       el \{\
8215 .          ie \\n[#Q_DEPTH]<\\n[#TRAP_DISTANCE] \{\
8216 .             nr #Q_FITS 1
8217 .             ie \\n[#HEAD]=1 \{ . \}
8218 .             el \{\
8219 .                ie \\n[#START] \{ . \}
8220 .                el \{\
8221 .                   ie \\n[#FULLSPACE_QUOTES] \{\
8222 .                      ie \\n[#ENDNOTE] \{\
8223 .                         ALD \\n[#EN_LEAD]u
8224 .                      \}
8225 .                      el \{ .ALD \\n[#DOC_LEAD]u \}
8226 .                   \}
8227 .                   el \{\
8228 .                      ie \\n[#ENDNOTE] \{\
8229 .                         ALD \\n[#EN_LEAD]u/2u
8230 .                      \}
8231 .                      el \{ .ALD \\n[#DOC_LEAD]u/2u \}
8232 .                   \}
8233 .                \}
8234 .             \}
8235 .          \}
8236 .          el \{\
8237 .             rr #Q_FITS
8238 .             ie r#HEAD \{\
8239 .                if \\n[#HEAD]=1 \{ . \}
8240 .             \}
8241 .             el \{\
8242 .                ie \\n[#ENDNOTE] \{ .ALD \\n[#EN_LEAD]u \}
8243 .                el \{ .ALD \\n[#DOC_LEAD]u \}
8244 .             \}
8245 .          \}
8246 .       \}
8247 .    \}
8248 .    nr #Q_OFFSET \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE])
8249 .    if \\n[#COLUMNS] \{\
8250 .       nr #Q_OFFSET \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE])
8251 .    \}
8252 .    if !\\n[#ENDNOTE] \{ .po \\n[#Q_OFFSET]u \}
8253 .    if \\n[#ENDNOTE] \{\
8254 .       in +\\n[#EN_PP_INDENT]u*\\n[#Q_OFFSET_VALUE]u
8255 .    \}
8256 .    if \\n[#QUOTE]=1 \{\
8257 .       nf
8258 .       P_QUOTE
8259 .       if !\\n[#START] \{ .rr #QUOTE \}
8260 .    \}
8261 .    if \\n[#QUOTE]=2 \{\
8262 .       nf
8263 .       B_QUOTE
8264 .    \}
8265 .    if \\n[#PRINT_STYLE]=1 \{\
8266 .       ALD \\n[#DOC_LEAD]u
8267 .    \}
8268 .    if \\n[#PRINT_STYLE]=2 \{\
8269 .       ie \\n[#START] \{\
8270 .          ie \\n[#PP_SPACE] \{ . \}
8271 .          el \{ .ALD \\n[#DOC_LEAD]u \}
8272 .       \}
8273 .       el \{\
8274 .          ie \\n[#PP_SPACE] \{ . \}
8275 .          el \{\
8276 .             ie \\n[#HEAD]=1 \{ .ALD \\n[#DOC_LEAD]u \}
8277 .             el \{\
8278 .                ie \\n[#Q_FITS] \{\
8279 .                   ie \\n[#Q_TOP]=\\n[#PAGE_TOP] \{\
8280 .                      nr #Q_AT_TOP 1
8281 .                      ALD \\n[#DOC_LEAD]u
8282 .                   \}
8283 .                   el \{\
8284 .                      ie \\n[#FULLSPACE_QUOTES] \{ .ALD \\n[#DOC_LEAD]u \}
8285 .                      el \{ .ALD \\n[#DOC_LEAD]u/2u \}
8286 .                   \}
8287 .                \}
8288 .                el \{ .ALD \\n[#DOC_LEAD]u \}
8289 .             \}
8290 .          \}
8291 .       \}
8292 .    \}
8293 .    if \\n[#ENDNOTE] \{ .nr #FULLSPACE_QUOTES \\n[#RESET_QUOTE_SPACING] \}
8294 .    if r#HEAD     \{ .rr #HEAD     \}
8295 .    if r#EPIGRAPH \{ .rr #EPIGRAPH \}
8296 .    rr #Q_PP
8297 .    rr #LINEBREAK
8298 .    nr #PP_STYLE  1
8299 .    nr #END_QUOTE 1
8300 .    if !\\n[#ENDNOTE] \{ .po \\n[#L_MARGIN]u \}
8301 .    if \\n[#ENDNOTE] \{\
8302 .       in \\n[#EN_TEXT_INDENT]u
8303 .    \}
8304 .    if \\n[#COLUMNS] \{\
8305 .       if !\\n[#ENDNOTE] \{ .po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u \}
8306 .       if \\n[#ENDNOTE] \{\
8307 .          in \\n[#EN_TEXT_INDENT]u
8308 .       \}
8309 .    \}
8310 .    ie !\\n[#ENDNOTE] \{\
8311 .       nr #RESET_PP_INDENT \\n[#PP_INDENT]
8312 .       PARA_INDENT 0
8313 .       PP
8314 .       PARA_INDENT \\n[#RESET_PP_INDENT]u
8315 .       QUAD \\*[$DOC_QUAD]
8316 .    \}
8317 .    el \{\
8318 .       nr #RESET_EN_PP_INDENT \\n[#EN_PP_INDENT]
8319 .       ENDNOTE_PARA_INDENT 0
8320 .       PP
8321 .       ENDNOTE_PARA_INDENT \\n[#RESET_EN_PP_INDENT]u
8322 .       QUAD \\*[EN_QUAD]
8323 .    \}
8324 .END
8326 \# ====================================================================
8328 \# BREAK QUOTE
8329 \# -----------
8330 \# *Arguments:
8331 \#   <none>
8332 \# *Function:
8333 \#   Ends the diversion P_QUOTE or B_QUOTE, breaks to a new
8334 \#   page, and reinvokes BLOCKQUOTE.
8335 \# *Notes:
8336 \#   Because quotes go into a diversion before they're output,
8337 \#   footnotes in quotes that cross pages behave erratically.  The footnote
8338 \#   isn't processed until the diversion ends, hence the footnote
8339 \#   marker in the quote isn't always correct for the new page (it's
8340 \#   picked up from the old one).  BREAK_QUOTE is a workaround for
8341 \#   this problem.
8343 .MAC BREAK_QUOTE END
8344 .    br
8345 .    di
8346 .    nr #BROKEN_QUOTE 1
8347 .    REMOVE_INDENT
8348 .    ev
8349 .    nr #Q_DEPTH \\n[#DIVER_DEPTH]+(\\n[#LEAD]*1)
8350 .    if \\n[#PRINT_STYLE]=1 \{\
8351 .       if !\\n[#LINEBREAK] \{ .ALD \\n[#DOC_LEAD]u \}
8352 .       if \\n[#HEAD] \{\
8353 .          if \\n[#HEAD]=1 \{ .RLD \\n[#DOC_LEAD]u \}
8354 .       \}
8355 .    \}
8356 .    if \\n[#PRINT_STYLE]=2 \{\
8357 .       ie \\n[#PP_SPACE] \{\
8358 .          ie \\n[#HEAD]=1 \{ . \}
8359 .          el \{\
8360 .             if !\\n[#LINEBREAK] \{ .ALD \\n[#DOC_LEAD]u \}
8361 .          \}
8362 .       \}
8363 .       el \{\
8364 .          rr #Q_FITS
8365 .          ie r#HEAD \{\
8366 .             if \\n[#HEAD]=1 \{ . \}
8367 .          \}
8368 .          el \{ .ALD \\n[#DOC_LEAD]u \}
8369 .       \}
8370 .    \}
8371 .    nr #Q_OFFSET \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE])
8372 .    if \\n[#COLUMNS] \{ .nr #Q_OFFSET \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE]) \}
8373 .    po \\n[#Q_OFFSET]u
8374 .    if \\n[#QUOTE]=1 \{\
8375 .       nf
8376 .       P_QUOTE
8377 .       if !\\n[#START] \{ .rr #QUOTE \}
8378 .    \}
8379 .    if \\n[#QUOTE]=2 \{\
8380 .       nf
8381 .       B_QUOTE
8382 .    \}
8383 .    if r#HEAD     \{ .rr #HEAD     \}
8384 .    if r#EPIGRAPH \{ .rr #EPIGRAPH \}
8385 .    rr #Q_PP
8386 .    rr #LINEBREAK
8387 .    nr #PP_STYLE  1
8388 .    nr #END_QUOTE 1
8389 .    if \\n[#PRINT_STYLE]=1 \{\
8390 .       if \\n[#UNDERLINE_QUOTES] \{\
8391 .          UNDERLINE OFF
8392 .       \}
8393 .    \}
8394 .    po \\n[#L_MARGIN]u
8395 .    if \\n[#COLUMNS] \{ .po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u \}
8396 .    QUAD \\*[$DOC_QUAD]
8397 .    sp |\\n[#PAGE_LENGTH]u  \" To trip footer/header
8398 .    BLOCKQUOTE
8399 .END
8401 \# ====================================================================
8403 \# +++PAGINATION+++
8405 \# PAGINATE
8406 \# --------
8407 \# *Arguments:
8408 \#   <none> | <anything>
8409 \# *Function:
8410 \#   Turns page numbering off or on.
8411 \# *Notes:
8412 \#   Page numbering is on by default with .PAPER.
8413 \#   Default is on.
8415 .MAC PAGINATE END
8416 .    ie '\\$1'' \{ .nr #PAGINATE 1 \}
8417 .    el \{ .nr #PAGINATE 0 \}
8418 .END
8421 \# SUSPEND PAGINATION (before ENDNOTES)
8422 \# ------------------
8423 \# *Argument:
8424 \#   <none>
8425 \# *Function:
8426 \#   Creates register #SUSPEND_PAGINATION
8427 \# *Notes:
8428 \#   Useful only to suspend pagination before outputting endnotes.
8430 .MAC SUSPEND_PAGINATION END
8431 .    nr #SUSPEND_PAGINATION 1
8432 .END
8434 \# RESTORE PAGINATION (after ENDNOTES)
8435 \# ------------------
8436 \# *Argument:
8437 \#   <none>
8438 \# *Function:
8439 \#   Removes register #SUSPEND_PAGINATION.  Creates register
8440 \#   #DEFER_PAGINATION
8441 \# *Notes:
8442 \#   Useful only to restore pagination after outputting endnotes.
8444 .MAC RESTORE_PAGINATION END
8445 .    rr #SUSPEND_PAGINATION
8446 .    if \\n[#PAGE_NUM_V_POS]=1 \{ .PAGINATE \}
8447 .    if \\n[#PAGE_NUM_V_POS]=2 \{ .nr #DEFER_PAGINATION 1 \}
8448 .END
8451 \# PAGENUMBER FAMILY
8452 \# -----------------
8453 \# *Argument:
8454 \#   <family to use for page numbers>
8455 \# *Function:
8456 \#   Creates or modifies string $PAGE_NUM_FAM.
8457 \# *Notes:
8458 \#   Default is same as running text.
8460 .MAC PAGENUM_FAMILY END
8461 .    ds $PAGE_NUM_FAM \\$1
8462 .END
8465 \# PAGE NUMBER FONT
8466 \# ----------------
8467 \# *Arguments:
8468 \#   <font to use for page numbers>
8469 \# *Function:
8470 \#   Creates or modifies string $PAGE_NUM_FT.
8471 \# *Notes:
8472 \#   Default is same as running text.
8474 .MAC PAGENUM_FONT END
8475 .    ds $PAGE_NUM_FT \\$1
8476 .END
8479 \# PAGE NUMBER SIZE
8480 \# ----------------
8481 \# *Argument:
8482 \#   <+|- number of points by which to in/decrease point size of
8483 \#   page numbers (relative to running text)>
8484 \# *Function:
8485 \#   Creates or modifies string $PAGE_NUM_SIZE_CHANGE.
8486 \# *Notes:
8487 \#   Must be preceded by a +|- sign with no space afterward.
8488 \#   Fractional point sizes are allowed.
8489 \#   Default is +0.
8491 .MAC PAGENUM_SIZE END
8492 .    ds $PAGE_NUM_SIZE_CHANGE \\$1
8493 .END
8496 \# PAGE NUMBER FORMAT
8497 \# ------------------
8498 \# *Arguments:
8499 \#   DIGIT | ROMAN | roman | ALPHA | alpha
8500 \# *Function:
8501 \#   Assigns user entered format to #PAGENUMBER.
8503 .MAC PAGENUM_STYLE END
8504 .    nr #PAGENUM_STYLE_SET 1
8505 .    if '\\$1'DIGIT'  \{\
8506 .       ds $PAGENUM_STYLE \\$1
8507 .       af #PAGENUMBER 1
8508 .    \}
8509 .    if '\\$1'ROMAN'  \{\
8510 .       ds $PAGENUM_STYLE \\$1
8511 .       af #PAGENUMBER I
8512 .    \}
8513 .    if '\\$1'roman'  \{\
8514 .       ds $PAGENUM_STYLE \\$1
8515 .       af #PAGENUMBER i
8516 .    \}
8517 .    if '\\$1'ALPHA'  \{\
8518 .       ds $PAGENUM_STYLE \\$1
8519 .       af #PAGENUMBER A
8520 .    \}
8521 .    if '\\$1'alpha'  \{\
8522 .       ds $PAGENUM_STYLE \\$1
8523 .       af #PAGENUMBER a
8524 .    \}
8525 .END
8528 \# HYPHENS AROUND PAGE NUMBERS
8529 \# ---------------------------
8530 \# *Arguments:
8531 \#   <none> | <anything>
8532 \# *Function:
8533 \#   Creates or modifies register #PAGE_NUM_HYPHENS.
8534 \#   Used to dis/enable hyphens on either side of page numbers.
8535 \# *Notes:
8536 \#   Default is on.
8538 .MAC PAGENUM_HYPHENS END
8539 .    nr #PAGE_NUM_HYPHENS_SET 1
8540 .    ie '\\$1'' \{ .nr #PAGE_NUM_HYPHENS 1 \}
8541 .    el \{ .rr #PAGE_NUM_HYPHENS   \}
8542 .END
8545 \# PAGENUMBER POSITION
8546 \# -------------------
8547 \# *Arguments:
8548 \#   TOP | BOTTOM  LEFT | CENTER | RIGHT
8549 \# *Function:
8550 \#   Creates or modifies various PAGE_NUM_H | V_POS registers.
8551 \#   Used to position page numbers.
8552 \# *Notes:
8553 \#   Default is center/bottom.
8555 .MAC PAGENUM_POS END
8556 .    nr #PAGE_NUM_POS_SET 1
8557 .    if '\\$1'TOP'    \{ .nr #PAGE_NUM_V_POS 1 \}
8558 .    if '\\$1'BOTTOM' \{ .nr #PAGE_NUM_V_POS 2 \}
8559 .    if '\\$2'LEFT'   \{ .nr #PAGE_NUM_H_POS 1 \}
8560 .    if '\\$2'CENTER' \{ .nr #PAGE_NUM_H_POS 2 \}
8561 .    if '\\$2'CENTRE' \{ .nr #PAGE_NUM_H_POS 2 \}
8562 .    if '\\$2'RIGHT'  \{ .nr #PAGE_NUM_H_POS 3 \}
8563 .END
8566 \# PRINT PAGE NUMBER
8567 \# -----------------
8568 \# *Arguments:
8569 \#   <none>
8570 \# *Function:
8571 \#   Prints page number if PAGEINATE=1.
8573 .MAC PRINT_PAGE_NUMBER END
8574 .    ev PAGENUMBER
8575 .    po \\n[#DOC_L_MARGIN]u
8576 .    ll \\n[#DOC_L_LENGTH]u
8577 .    ta \\n(.lu
8578 .    FAMILY  \\*[$PAGE_NUM_FAM]
8579 .    FT      \\*[$PAGE_NUM_FT]
8580 .    PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$PAGE_NUM_SIZE_CHANGE]
8581 .    if \\n[#PRINT_STYLE]=1 \{\
8582 .       fam C
8583 .       ft  R
8584 .       ps 12
8585 .    \}
8586 .    if \\n[#PAGE_NUM_V_POS]=1 \{ .vs 0 \}
8587 .    if o \{\
8588 .       ie \\n[#PAGE_NUM_H_POS]=1 \{ .LEFT  \}
8589 .       el                        \{ .RIGHT \}
8590 .    \}
8591 .    if e \{\
8592 .       ie \\n[#PAGE_NUM_H_POS]=1 \{ .RIGHT \}
8593 .       el                        \{ .LEFT  \}
8594 .    \}
8595 .    if \\n[#PAGE_NUM_H_POS]=2    \{.CENTER \}
8596 .    if \\n[#RECTO_VERSO]=0 \{\
8597 .       if \\n[#PAGE_NUM_H_POS]=1 \{ .LEFT   \}
8598 .       if \\n[#PAGE_NUM_H_POS]=2 \{ .CENTER \}
8599 .       if \\n[#PAGE_NUM_H_POS]=3 \{ .RIGHT  \}
8600 .    \}
8601 .    nr #PAGENUMBER \\n%+\\n[#PAGE_NUM_ADJ]
8602 .    if \\n[#EN_FIRST_PAGE] \{\
8603 .       if \\n[#EN_FIRST_PN] \{ .PAGENUMBER \\n[#EN_FIRST_PN] \}
8604 .       rr #EN_FIRST_PAGE
8605 .    \}
8606 .    if \\n[#TOC_FIRST_PAGE] \{\
8607 .       PAGENUMBER 1
8608 .       rr #TOC_FIRST_PAGE
8609 .    \}
8610 .    ie \\n[#DRAFT_WITH_PAGENUM] \{\
8611 .       ie '\\*[$REVISION]'' \{\
8612 .          PRINT "\\*[$DRAFT_STRING]\\*[$DRAFT] / \\n[#PAGENUMBER]"
8613 .       \}
8614 .       el \{\
8615 .          ie '\\*[$DRAFT]'' \{\
8616 .             PRINT "\\*[$REVISION_STRING] \\*[$REVISION] / \\n[#PAGENUMBER]"
8617 .          \}
8618 .          el \{\
8619 .             PRINT "\\*[$DRAFT_STRING]\\*[$DRAFT], \\*[$REVISION_STRING] \\*[$REVISION] / \\n[#PAGENUMBER]"
8620 .          \}
8621 .       \}
8622 .    \}
8623 .    el \{\
8624 .       ie \\n[#PAGE_NUM_HYPHENS] \{ .PRINT "- \\n[#PAGENUMBER] -" \}
8625 .       el \{ .PRINT "\\n[#PAGENUMBER]" \}
8626 .    \}
8627 .    ev
8628 .END
8630 \# ====================================================================
8632 \# +++FOOTNOTES+++
8634 \# FOOTNOTE FAMILY
8635 \# --------------
8636 \# *Argument:
8637 \#   <family to use in footnotes>
8638 \# *Function:
8639 \#   Creates or modifies string $FN_FAM.
8640 \# *Notes:
8641 \#   Default is same as running text.
8643 .MAC FOOTNOTE_FAMILY END
8644 .    ds $FN_FAM \\$1
8645 .END
8648 \# FOOTNOTE FONT
8649 \# --------------
8650 \# *Argument:
8651 \#   <font to use in footnotes>
8652 \# *Function:
8653 \#   Creates or modifies string $FN_FT.
8654 \# *Notes:
8655 \#   Default is roman.
8657 .MAC FOOTNOTE_FONT END
8658 .    ds $FN_FT \\$1
8659 .END
8662 \# FOOTNOTE SIZE
8663 \# ------------
8664 \# *Argument:
8665 \#   <+|- number of points by which to in/decrease point size of footnotes
8666 \#   (relative to running text)>
8667 \# *Function:
8668 \#   Creates or modifies string $FN_SIZE_CHANGE.
8669 \# *Notes:
8670 \#   Must be preceded by a +|- sign.  No space afterwards.
8671 \#   Fractional point sizes are allowed.
8672 \#   Default is -2 for printstyle TYPESET; +0 for TYPEWRITE.
8674 .MAC FOOTNOTE_SIZE END
8675 .    ds $FN_SIZE_CHANGE \\$1
8676 .END
8679 \# FOOTNOTE AUTOLEAD
8680 \# -----------------
8681 \# *Arguments:
8682 \#   <autolead value for footnotes>
8683 \# *Function:
8684 \#   Creates or modifies register #FN_AUTOLEAD.
8685 \# *Notes:
8686 \#   Default is #DOC_LEAD/2 for TYPEWRITE; 2 for TYPESET
8688 .MAC FOOTNOTE_AUTOLEAD END
8689 .    nr #FN_AUTOLEAD \\$1
8690 .END
8693 \# FOOTNOTE QUAD
8694 \# -------------
8695 \# *Arguments:
8696 \#   <quad to use in footnotes>
8697 \# *Function:
8698 \#   Creates or modifies string $FN_QUAD.
8699 \# *Notes:
8700 \#   Default is same as running text.
8702 .MAC FOOTNOTE_QUAD END
8703 .    ds $FN_QUAD \\$1
8704 .END
8707 \# FOOTNOTE MARKERS
8708 \# ----------------
8709 \# *Arguments:
8710 \#   <none> | <anything>
8711 \# *Function:
8712 \#   Turns generation of footnote markers on or off.
8713 \# *Notes:
8714 \#   Default is on.
8716 .MAC FOOTNOTE_MARKERS END
8717 .    ie '\\$1'' \{ .nr #FN_MARKERS 1 \}
8718 .    el \{ .nr #FN_MARKERS 0 \}
8719 .END
8722 \# FOOTNOTE MARKER STYLE
8723 \# ---------------------
8724 \# *Arguments:
8725 \#   STAR | NUMBER
8726 \# *Function:
8727 \#   Sets register #FN_MARKER_STYLE, used in FOOTNOTE to determine
8728 \#   the style of footnote markers.
8729 \# *Notes:
8730 \#   1=STAR; 2=NUMBER.  Default is STAR.
8732 .MAC FOOTNOTE_MARKER_STYLE END
8733 .    if '\\$1'STAR' \{\
8734 .       nr #FN_MARKER_STYLE 1
8735 .    \}
8736 .    if '\\$1'NUMBER' \{\
8737 .       nr #FN_MARKER_STYLE 2
8738 .    \}
8739 .END
8742 \# RESET FOOTNOTE NUMBER
8743 \# ---------------------
8744 \# *Arguments:
8745 \#   <none> | PAGE
8746 \# *Function:
8747 \#   Resets register #FN_NUMBER to 1.  If argument is PAGE, creates
8748 \#   toggle #RESET_FN_NUMBER which is checked in HEADER.  If 1,
8749 \#   numbered footnotes on every page start at 1.
8751 .MAC RESET_FOOTNOTE_NUMBER END
8752 .    ie '\\$1'' \{ .nr #FN_NUMBER 0 1 \}
8753 .    el \{ .nr #RESET_FN_NUMBER 1 \}
8754 .END
8757 \# FOOTNOTE RULE LENGTH
8758 \# --------------------
8759 \# *Arguments:
8760 \#   <length of rule used to separate footnotes from running text>
8761 \# *Function:
8762 \#   Creates or modifies registers #FN_RULE_LENGTH.
8763 \# *Notes:
8764 \#   Requires unit of measure (iPpcm).
8765 \#   Default is 4P for both PRINTSTYLEs.
8767 .MAC FOOTNOTE_RULE_LENGTH END
8768 .    nr #FN_RULE_LENGTH (\\$1)
8769 .END
8772 \# FOOTNOTE_RULE_ADJ
8773 \# -----------------
8774 \# *Arguments:
8775 \#   <number of points to raise footnote rule from it's baseline position>
8776 \# *Function:
8777 \#   Creates or modifies register #FN_RULE_ADJ.
8778 \# *Notes:
8779 \#   Default is 3p for both TYPESTYLES.
8781 \#   Requires unit of measure.
8783 .MAC FOOTNOTE_RULE_ADJ END
8784 .    nr #FN_RULE_ADJ (\\$1)
8785 .END
8788 \# FOOTNOTE RULE
8789 \# -------------
8790 \# *Arguments:
8791 \#   <none> | <anything>
8792 \# *Function:
8793 \#   Turns printing of footnote separator rule on or off.  If invoked as
8794 \#   PRINT_FOOTNOTE_RULE, prints footnote separator rule.
8795 \# *Notes:
8796 \#   Default is on.
8798 \#   Invoked in FOOTNOTE (as PRINT_FOOTNOTE_RULE) as 1st line of a footnote
8799 \#   if the footnote number (#FN_COUNT) is 1.
8801 .MAC FOOTNOTE_RULE END
8802 .    ie '\\$0'PRINT_FOOTNOTE_RULE' \{\
8803 .       if \\n[#FN_RULE]=0 \{ .RLD 1v \}
8804 \!.     PT_SIZE 12  \"Not sure why these have to be transparently embedded, but they do.
8805 .       RLD 1v
8806 .       LEFT
8807 .       PRINT \\v'-\\n[#FN_RULE_ADJ]u'\\l'\\n[#FN_RULE_LENGTH]u'\\v'+\\n[#FN_RULE_ADJ]u'
8808 \!.     PT_SIZE \\n[#DOC_PT_SIZE]u\\*$[FN_SIZE_CHANGE]
8809 .       QUAD \\*[$FN_QUAD]
8810 .    \}
8811 .    el \{\
8812 .       ie '\\$1'' \{ .nr #FN_RULE 1 \}
8813 .       el \{ .nr #FN_RULE 0 \}
8814 .    \}
8815 .END
8818 \# FOOTNOTE
8819 \# --------
8820 \# *Arguments:
8821 \#   <none> | INDENT  L|LEFT|R|RIGHT|B|BOTH  <indent value> > | <anything>
8822 \# *Function:
8823 \#   Begins collecting and diverting footnote text if no argument
8824 \#   given.  Otherwise, ends diversion FOOTNOTES, measures footnote
8825 \#   depth, and sets footnote trap.
8826 \# *Notes:
8827 \#   The input line preceding a footnote call MUST terminate with \c
8828 \#   or the footnote marker will be spaced away from the word it
8829 \#   should be joined to.
8831 \#   If FOOTNOTES is invoked with INDENT, the footnote will
8832 \#   be indented.  An indent style and an indent value must be given.
8833 \#   Subsequent footnotes will NOT be indented; INDENT must be given
8834 \#   for each footnote the user wants indented.
8836 .MAC FOOTNOTE END
8837 .    ie '\\$1'' \{\
8838 .       if \\n[#FN_MARKERS] \{\
8839 .          if \\n[#CONDENSE] \{ \*[CONDX]\c \}
8840 .          if \\n[#EXTEND]   \{ \*[EXTX]\c  \}
8841 .          if \\n[#PRINT_STYLE]=1 \{\
8842 .             if \\n[#UNDERLINE_ON] \{\
8843 .                nr #UNDERLINE_WAS_ON 1
8844 .                UNDERLINE OFF
8845 .             \}
8846 .          \}
8847 .          if !\\n[#NO_FN_MARKER] \{\
8848 .             if \\n[#FN_MARKER_STYLE]=1 \{\
8849 .                ie \\n[#FN_COUNT_FOR_COLS] \{\
8850 .                   if \\n[#FN_COUNT_FOR_COLS]=0 \{ .PRINT \*[BU3]* \}
8851 .                   if \\n[#FN_COUNT_FOR_COLS]=1 \{ .PRINT \*[BU3]\(dg \}
8852 .                   if \\n[#FN_COUNT_FOR_COLS]=2 \{ .PRINT \*[BU3]** \}
8853 .                   if \\n[#FN_COUNT_FOR_COLS]=3 \{ .PRINT \*[BU3]\(dg\(dg \}
8854 .                   if \\n[#FN_COUNT_FOR_COLS]=4 \{ .PRINT \*[BU3]*** \}
8855 .                   if \\n[#FN_COUNT_FOR_COLS]=5 \{ .PRINT \*[BU3]\(dg\(dg\(dg \}
8856 .                   if \\n[#FN_COUNT_FOR_COLS]=6 \{ .PRINT \*[BU3]**** \}
8857 .                   if \\n[#FN_COUNT_FOR_COLS]=7 \{ .PRINT \*[BU3]\(dg\(dg\(dg\(dg \}
8858 .                   if \\n[#FN_COUNT_FOR_COLS]=8 \{ .PRINT \*[BU3]***** \}
8859 .                   if \\n[#FN_COUNT_FOR_COLS]=9 \{ .PRINT \*[BU3]\(dg\(dg\(dg\(dg\(dg \}
8860 .                \}
8861 .                el \{\
8862 .                   if \\n[#FN_COUNT]=0 \{ .PRINT \*[BU3]* \}
8863 .                   if \\n[#FN_COUNT]=1 \{ .PRINT \*[BU3]\(dg \}
8864 .                   if \\n[#FN_COUNT]=2 \{ .PRINT \*[BU3]** \}
8865 .                   if \\n[#FN_COUNT]=3 \{ .PRINT \*[BU3]\(dg\(dg \}
8866 .                   if \\n[#FN_COUNT]=4 \{ .PRINT \*[BU3]*** \}
8867 .                   if \\n[#FN_COUNT]=5 \{ .PRINT \*[BU3]\(dg\(dg\(dg \}
8868 .                   if \\n[#FN_COUNT]=6 \{ .PRINT \*[BU3]**** \}
8869 .                   if \\n[#FN_COUNT]=7 \{ .PRINT \*[BU3]\(dg\(dg\(dg\(dg \}
8870 .                   if \\n[#FN_COUNT]=8 \{ .PRINT \*[BU3]***** \}
8871 .                   if \\n[#FN_COUNT]=9 \{ .PRINT \*[BU3]\(dg\(dg\(dg\(dg\(dg\(dg \}
8872 .                \}
8873 .             \}
8874 .             if \\n[#FN_MARKER_STYLE]=2 \{\
8875 .                if \\n[#PRINT_STYLE]=1 \{ .PRINT "\s-2\v'-\\n[#DOC_LEAD]u/5u'\\n+[#FN_NUMBER]\v'+\\n[#DOC_LEAD]u/5u'\s+2" \}
8876 .                if \\n[#PRINT_STYLE]=2 \{ .PRINT "\*[SUP]\\n+[#FN_NUMBER]\*[SUPX]" \}
8877 .             \}
8878 .          \}
8879 .       \}
8880 .       nr #SPACE_REMAINING \\n[#PAGE_LENGTH]-\\n[#B_MARGIN]-(\\n(nl+1v)
8881 .       nr #PP_STYLE_PREV \\n[#PP_STYLE]
8882 .       nr #PP_STYLE 2
8883 .       if \\n[#INDENT_FIRST_PARAS] \{ .nr #INDENT_FIRSTS 1 \}
8884 .       INDENT_FIRST_PARAS
8885 .       ev FOOTNOTES
8886 .       ll \\n[#DOC_L_LENGTH]u
8887 .       ta \\n(.lu
8888 .       if \\n[#COLUMNS] \{\
8889 .          ll \\n[#COL_L_LENGTH]u
8890 .          ta \\n(.lu
8891 .       \}
8892 .       if \\n[#FN_R_INDENT]  \{\
8893 .          ll -\\n[#FN_R_INDENT]u
8894 .          ta \\n(.lu
8895 .       \}
8896 .       if \\n[#FN_BR_INDENT] \{\
8897 .          ll -\\n[#FN_BR_INDENT]u
8898 .          ta \\n(.lu
8899 .       \}
8900 .       FAMILY   \\*[$FN_FAM]
8901 .       FT       \\*[$FN_FT]
8902 .       PT_SIZE  \\n[#DOC_PT_SIZE]u\\*[$FN_SIZE_CHANGE]
8903 .       AUTOLEAD \\n[#FN_AUTOLEAD]
8904 .       QUAD     \\*[$FN_QUAD]
8905 .       if \\n[#PRINT_STYLE]=1 \{\
8906 .          fam C
8907 .          ft  R
8908 .          ps 12
8909 .          ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u \}
8910 .          el \{ .vs \\n[#DOC_LEAD]u/2u \}
8911 .          QUAD LEFT
8912 .          HY OFF
8913 .       \}
8914 .       nr #FN_LEAD \\n[#LEAD]
8915 .       da FOOTNOTES
8916 .       if \\n[#EPIGRAPH] \{ .nr #FN_FOR_EPI 1 \}
8917 .       if \\n[#FN_DEFER_SPACE] \{\
8918 .          if \\n[#FN_MARKER_STYLE]=1 \{ .ALD 1v \}
8919 .          if \\n[#RESET_FN_NUMBER] \{ .ALD 1v \}
8920 .          rr #FN_DEFER_SPACE
8921 .       \}
8922 .       if \\n+[#FN_COUNT]=1 \{\
8923 .          if !\\n[#FN_DEPTH] \{\
8924 .             if \\n[#PRINT_STYLE]=1 \{ .ALD \\n[#DOC_LEAD]u \}
8925 .             ie \\n[#FN_RULE] \{ .PRINT_FOOTNOTE_RULE \}
8926 .             el \{ .ALD 1v \}
8927 .          \}
8928 .       \}
8929 .       if \\n[#FN_MARKERS] \{\
8930 .          if !\\n[#NO_FN_MARKER] \{\
8931 .             if \\n[#FN_MARKER_STYLE]=1 \{\
8932 .                ie \\n+[#FN_COUNT_FOR_COLS] \{\
8933 .                   if \\n[#FN_COUNT_FOR_COLS]=1  \{ .PRINT *\c \}
8934 .                   if \\n[#FN_COUNT_FOR_COLS]=2  \{ .PRINT \(dg\c \}
8935 .                   if \\n[#FN_COUNT_FOR_COLS]=3  \{ .PRINT **\c \}
8936 .                   if \\n[#FN_COUNT_FOR_COLS]=4  \{ .PRINT \(dg\(dg\c \}
8937 .                   if \\n[#FN_COUNT_FOR_COLS]=5  \{ .PRINT ***\c \}
8938 .                   if \\n[#FN_COUNT_FOR_COLS]=6  \{ .PRINT \(dg\(dg\(dg\c \}
8939 .                   if \\n[#FN_COUNT_FOR_COLS]=7  \{ .PRINT ****\c \}
8940 .                   if \\n[#FN_COUNT_FOR_COLS]=8  \{ .PRINT \(dg\(dg\(dg\(dg\c \}
8941 .                   if \\n[#FN_COUNT_FOR_COLS]=9  \{ .PRINT *****\c \}
8942 .                   if \\n[#FN_COUNT_FOR_COLS]=10 \{ .PRINT \(dg\(dg\(dg\(dg\(dg\c \}
8943 .                \}
8944 .                el \{\
8945 .                   if \\n[#FN_COUNT]=1  \{ .PRINT *\c \}
8946 .                   if \\n[#FN_COUNT]=2  \{ .PRINT \(dg\c \}
8947 .                   if \\n[#FN_COUNT]=3  \{ .PRINT **\c \}
8948 .                   if \\n[#FN_COUNT]=4  \{ .PRINT \(dg\(dg\c \}
8949 .                   if \\n[#FN_COUNT]=5  \{ .PRINT ***\c \}
8950 .                   if \\n[#FN_COUNT]=6  \{ .PRINT \(dg\(dg\(dg\c \}
8951 .                   if \\n[#FN_COUNT]=7  \{ .PRINT ****\c \}
8952 .                   if \\n[#FN_COUNT]=8  \{ .PRINT \(dg\(dg\(dg\(dg\c \}
8953 .                   if \\n[#FN_COUNT]=9  \{ .PRINT *****\c \}
8954 .                   if \\n[#FN_COUNT]=10 \{ .PRINT \(dg\(dg\(dg\(dg\(dg\c \}
8955 .                \}
8956 .             \}
8957 .             if \\n[#FN_MARKER_STYLE]=2 \{\
8958 .                if \\n[#PRINT_STYLE]=1 \{ .PRINT "(\\n[#FN_NUMBER])\c" \}
8959 .                if \\n[#PRINT_STYLE]=2 \{ .PRINT "\*[SUP]\\n[#FN_NUMBER]\*[SUPX]\c" \}
8960 .             \}
8961 .         \}
8962 .      \}
8963 .    \}
8964 .    el \{\
8965 .       ie '\\$1'INDENT' \{\
8966 .          ev FOOTNOTES
8967 .          if '\\$2'L'     \{ .in (\\$3)  \}
8968 .          if '\\$2'LEFT'  \{ .in (\\$3)  \}
8969 .          if '\\$2'R'     \{ .nr #FN_R_INDENT (\\$3) \}
8970 .          if '\\$2'RIGHT' \{ .nr #FN_R_INDENT (\\$3) \}
8971 .          if '\\$2'B' \{\
8972 .             nr #FN_BL_INDENT (\\$3)
8973 .             ie '\\$4'' \{ .nr #FN_BR_INDENT \\n[#FN_BL_INDENT] \}
8974 .             el \{ .nr #FN_BR_INDENT (\\$4) \}
8975 .             in \\n[#FN_BL_INDENT]u
8976 .          \}
8977 .          if '\\$2'BOTH' \{\
8978 .             nr #FN_BL_INDENT (\\$3)
8979 .             ie '\\$4'' \{ .nr #FN_BR_INDENT \\n[#FN_BL_INDENT] \}
8980 .             el \{ .nr #FN_BR_INDENT (\\$4) \}
8981 .             in \\n[#FN_BL_INDENT]u
8982 .          \}
8983 .          ev
8984 .          FOOTNOTE
8985 .       \}
8986 .       el \{\
8987 .          br
8988 .          di
8989 .          in 0 \"Turn off indent possibly set by FOOTNOTE INDENT...
8990 .          if \\n[#PRINT_STYLE]=1 \{\
8991 .             if \\n[#UNDERLINE_WAS_ON] \{\
8992 .                UNDERLINE
8993 .                rr #UNDERLINE_WAS_ON
8994 .             \}
8995 .          \}
8996 .          ev
8997 .          rr #FN_R_INDENT
8998 .          rr #FN_BR_INDENT
8999 .          nr #PP_STYLE \\n[#PP_STYLE_PREV]
9000 .          if !\\n[#INDENT_FIRSTS] \{ .INDENT_FIRST_PARAS OFF \}
9001 .          rr #INDENT_FIRSTS
9002 .          nr #FN_DEPTH +\\n[#DIVER_DEPTH]
9003 .          if \\n[#FN_DEFER] \{\
9004 .             nr #FN_DEFER_SPACE 1
9005 .             rr #FN_DEFER
9006 .          \}
9007 .          if \\n[#FN_DEPTH]>\\n[#SPACE_REMAINING] \{\
9008 .             ie \\n[#SPACE_REMAINING]<(\\n[#LEAD]*2) \{ .nr #FN_DEFER 1 \}
9009 .             el \{\
9010 .                nr #FN_LINES 0 1
9011 .                while (\\n+[#FN_LINES]*\\n[#FN_LEAD])<\\n[#SPACE_REMAINING] \{\
9012 .                   nr #FN_DEPTH (\\n[#FN_LINES]*\\n[#FN_LEAD])
9013 .                \}
9014 .             \}
9015 .          \}
9016 .          nr #VARIABLE_FOOTER_POS -\\n[#DIVER_DEPTH]
9017 .          if \\n[#FN_COUNT]=1 \{ .nr #VARIABLE_FOOTER_POS -1v \}
9018 .          \}
9019 .          ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
9020 .          if (\\n(nl+1v)>(\\n[#PAGE_LENGTH]+\\n[#VARIABLE_FOOTER_POS]) \{\
9021 .             ch FOOTER \\n(nlu+1v
9022 .          \}
9023 .          if \\n[#FN_DEFER] \{\
9024 .             nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]u
9025 .             ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
9026 .          \}
9027 .       \}
9028 .    nr #NO_FN_MARKER 0
9029 .END
9032 .MAC FN_OVERFLOW_TRAP END
9033 .    if \\n[#FN_COUNT] \{\
9034 .       di FN_OVERFLOW
9035 .     \}
9036 .END
9039 .MAC DIVERT_FN_LEFTOVER END
9040 .    nr #NO_FN_MARKER 1
9041 .    nr #OVERFLOW 1
9042 .    FOOTNOTE
9043 .    nf
9044 .    FN_OVERFLOW
9045 .    FOOTNOTE OFF
9046 .    rr #FN_OVERFLOW_DEPTH
9047 .END
9050 .MAC PROCESS_FN_LEFTOVER END
9051 .    if !\\n[#FN_DEFER] \{\
9052 .       nr #FN_COUNT 0 1
9053 .       nr #FN_DEPTH 0
9054 .       nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]
9055 .    \}
9056 .    if \\n[#FN_DEFER] \{\
9057 .       nr #VARIABLE_FOOTER_POS -(\\n[#FN_DEPTH]+\\n[#DOC_LEAD])
9058 .    \}
9059 .    nr #SPACE_REMAINING 0
9060 .    ch FOOTER -\\n[#B_MARGIN]u
9061 .    if \\n[#FN_DEFER] \{\
9062 .       nr #NO_FN_MARKER 1
9063 .       da FOOTNOTES
9064 .       di
9065 .       FOOTNOTE
9066 .       nf
9067 .       FOOTNOTE OFF
9068 .    \}
9069 .    if !\\n[#FN_DEFER] \{\
9070 .       if \\n[#FN_OVERFLOW_DEPTH] \{\
9071 .           DIVERT_FN_LEFTOVER
9072 .       \}
9073 .    \}
9074 .    nr #FN_COUNT 0 1
9075 .END
9078 \# ====================================================================
9080 \# +++ENDNOTES+++
9082 \# When endnotes are output, the spacing between the notes is always 1
9083 \# extra linespace.  This can have bottom margin consequences.  If this
9084 \# doesn't bother you, don't worry about it.  If it does bother you, and
9085 \# you want to adjust the spacing between any two endnotes (as they're
9086 \# output), make the spacing adjustments (.ALD/.RLD) at the *end* of
9087 \# endnotes (i.e. just before .ENDNOTE OFF), not at the top.
9089 \# Endnotes must be output manually with .ENDNOTES.  This allows user
9090 \# the flexibility to output endnotes at the end of each collated
9091 \# document, or to output them at the end of the entire document.
9093 \# ENDNOTE FAMILY
9094 \# --------------
9095 \# *Argument:
9096 \#   <family to use in endnotes>
9097 \# *Function:
9098 \#   Creates or modifies string $EN_FAM.
9099 \# *Notes:
9100 \#   Default is same as running text in body of document.
9102 .MAC ENDNOTE_FAMILY END
9103 .    ds $EN_FAM \\$1
9104 .END
9107 \# ENDNOTE FONT
9108 \# ------------
9109 \# *Argument:
9110 \#   <font to use in endnotes>
9111 \# *Function:
9112 \#   Creates or modifies string $EN_FT.
9113 \# *Notes:
9114 \#   Default is roman.
9116 .MAC ENDNOTE_FONT END
9117 .    ds $EN_FT \\$1
9118 .END
9121 \# ENDNOTE POINT SIZE
9122 \# ------------------
9123 \# *Argument:
9124 \#   <base point size for endnotes>
9125 \# *Function:
9126 \#   Creates or modifies register #EN_PS.
9127 \# *Notes:
9128 \#   Default is same as running text in body of document.
9130 \#   This size control macro differs from other size control macros
9131 \#   in that it sets an absolute point size, not a relative one.  This
9132 \#   is because a) endnotes always appear separate from the body of
9133 \#   a document and therefore don't need to be relative to the body
9134 \#   of the document, and b) there are quite a few elements of the
9135 \#   endnotes page(s) that need to be relative to the base point size
9136 \#   of that page.  If the base endnote point size were relative to
9137 \#   the body of the document (i.e. a _SIZE macro taking a +|- value)
9138 \#   getting the rest of the endnote elements sized properly could
9139 \#   become very confusing.
9141 .MAC ENDNOTE_PT_SIZE END
9142 .    nr #EN_PS (p;\\$1)
9143 .END
9146 \# ENDNOTE LEAD
9147 \# ------------
9148 \# *Argument:
9149 \#   <base leading to use in endnotes> [ ADJUST ]
9150 \# *Function:
9151 \#   Creates or modifies register #EN_LEAD.  Creates or removes
9152 \#   register #ADJ_EN_LEAD.  Stores arguments in strings if ENDNOTE_LEAD
9153 \#   set before START.
9154 \# *Notes:
9155 \#   Default is 14 points for TYPESET, adjusted; 24 for TYPEWRITE.
9157 .MAC ENDNOTE_LEAD END
9158 .    if !\\n[#OK_PROCESS_LEAD] \{\
9159 .       ds $EN_LEAD \\$1
9160 .       if !'\\$2'' \{\
9161 .           ds $ADJUST_EN_LEAD \\$2
9162 .       \}
9163 .       return
9164 .    \}
9165 .    rr #ADJ_EN_LEAD
9166 .    nr #EN_LEAD (p;\\$1)
9167 .    if '\\$2'ADJUST' \{\
9168 .       nr #ORIG_DOC_LEAD \\n[#DOC_LEAD]
9169 .       nr #ADJ_DOC_LEAD 1
9170 .       nr #ADJ_EN_LEAD 1
9171 .       nr #NO_TRAP_RESET 1
9172 .       DOC_LEAD \\n[#EN_LEAD]u ADJUST
9173 .       nr #EN_LEAD \\n[#DOC_LEAD]
9174 .       DOC_LEAD \\n[#ORIG_DOC_LEAD]u
9175 .       rr #NO_TRAP_RESET
9176 .       rr #ADJ_DOC_LEAD
9177 .       rr #ORIG_DOC_LEAD
9178 .    \}
9179 .END
9182 \# ENDNOTE QUAD
9183 \# ------------
9184 \# *Argument:
9185 \#   LEFT | L | CENTER | C | RIGHT | R | JUSTIFY | J
9186 \# *Function:
9187 \#   Creates or modifies string $EN_QUAD.
9188 \# *Notes:
9189 \#   Default is justified for TYPESET, left for TYPEWRITE.
9191 .MAC ENDNOTE_QUAD END
9192 .    ds $EN_QUAD \\$1
9193 .END
9196 \# ENDNOTES_HDRFTR_CENTER
9197 \# ----------------------
9198 \# *Argument:
9199 \#   toggle
9200 \# *Function:
9201 \#   Creates or removes toggle register #EN_HDRFTR_CENTER, used to
9202 \#   determine whether mom should print a/the hdrftr center string
9203 \#   on the endnotes page.  Primarily to enable/disable printing of the
9204 \#   chapter name in hdrftrs when DOCTYPE CHAPTER.
9205 \# *Notes:
9206 \#   Default is OFF
9208 .MAC ENDNOTES_HDRFTR_CENTER END
9209 .    ie '\\$1'' \{ .nr #EN_HDRFTR_CENTER 1 \}
9210 .    el         \{ .rr #EN_HDRFTR_CENTER   \}
9211 .END
9214 \# ENDNOTE STRING 
9215 \# --------------
9216 \# *Argument:
9217 \#   <title for endnotes page>
9218 \# *Function:
9219 \#   Creates or modifies string $EN_STRING.
9220 \# *Notes:
9221 \#   Default is "Endnotes"
9223 .MAC ENDNOTE_STRING END
9224 .    ds $EN_STRING \\$1
9225 .END
9228 \# ENDNOTE STRING FAMILY
9229 \# ---------------------
9230 \# *Argument:
9231 \#   <family to use for endnote string>
9232 \# *Function:
9233 \#   Creates or modifies string $EN_STRING_FAM.
9234 \# *Notes:
9235 \#   Default is same as running text in body of document.
9237 .MAC ENDNOTE_STRING_FAMILY END
9238 .    ds $EN_STRING_FAM \\$1
9239 .END
9242 \# ENDNOTE STRING FONT
9243 \# -------------------
9244 \# *Argument:
9245 \#   <font to use for endnote string>
9246 \# *Function:
9247 \#   Creates or modifies string $EN_FT.
9248 \# *Notes:
9249 \#   Default is BOLD for TYPEWRITE; roman for TYPESET
9251 .MAC ENDNOTE_STRING_FONT END
9252 .    ds $EN_STRING_FT \\$1
9253 .END
9256 \# ENDNOTE STRING SIZE
9257 \# -------------------
9258 \# *Argument:
9259 \#   <+|- number of points by which to in/decrease endnote string
9260 \#    (relative to base endnote size)>
9261 \# *Function:
9262 \#   Creates or modifies string $EN_STRING_SIZE_CHANGE.
9263 \# *Notes:
9264 \#   Default is +1 for TYPESET.
9266 .MAC ENDNOTE_STRING_SIZE END \"Default for TYPESET is +1
9267 .    ds $EN_STRING_SIZE_CHANGE \\$1
9268 .END
9271 \# ENDNOTE STRING QUAD
9272 \# -------------------
9273 \# *Argument:
9274 \#   LEFT | L | CENTER | C | RIGHT | R
9275 \# *Function:
9276 \#   Creates or modifies string $EN_STRING_QUAD.
9277 \# *Notes:
9278 \#   Default is centered.
9280 .MAC ENDNOTE_STRING_QUAD END
9281 .    ds $EN_STRING_QUAD \\$1
9282 .END
9285 \# ENDNOTE STRING UNDERSCORE
9286 \# -------------------------
9287 \# *Arguments:
9288 \#   toggle | 2
9289 \# *Function:
9290 \#   Turns underscoring of endnote main title on or off.  If the argument
9291 \#   is the digit "2", turns on double-underscoring.
9292 \# *Notes:
9293 \#   Default is double-underscored.
9295 .MAC ENDNOTE_STRING_UNDERSCORE END
9296 .    ie '\\$1'' \{ .nr #EN_STRING_UNDERSCORE 1 \}
9297 .    el \{\
9298 .       ie '\\$1'2' \{ .nr #EN_STRING_UNDERSCORE 2 \}
9299 .       el \{ .nr #EN_STRING_UNDERSCORE 0 \}
9300 .    \}
9301 .END
9304 \# ENDNOTE STRING CAPS
9305 \# -------------------
9306 \# *Arguments:
9307 \#   <none> | <anything>
9308 \# *Function:
9309 \#   Turns capitalization of the endnotes pages title string
9310 \#   "Endnotes" on or off.
9311 \# *Notes:
9312 \#   Users may want the endnotes pages title string to be in caps,
9313 \#   but the toc entry for endnotes in lower case.  If the argument
9314 \#   to ENDNOTE_STRING is in lower case and ENDNOTE_STRING_CAPS is
9315 \#   turned on, this is exactly what will happen.
9317 \#   Default is on.
9319 .MAC ENDNOTE_STRING_CAPS END
9320 .   ie '\\$1'' \{ .nr #EN_STRING_CAPS 1 \}
9321 .   el \{ .rr #EN_STRING_CAPS \}
9322 .END
9325 \# ENDNOTE TITLE
9326 \# -------------
9327 \# *Argument:
9328 \#   <string that appears before the first endnote pertaining to any document>
9329 \# *Function:
9330 \#   Creates string $EN_TITLE_STRING.
9331 \# *Notes:
9332 \#   Default is the document title, or, if doc is a chapter, "Chapter #"
9334 .MAC ENDNOTE_TITLE END
9335 .    ds $EN_TITLE \\$1
9336 .END
9339 \# ENDNOTE TITLE FAMILY
9340 \# --------------------
9341 \# *Argument:
9342 \#   <family to use for endnote title>
9343 \# *Function:
9344 \#   Creates string $EN_TITLE_FAM.
9345 \# *Notes:
9346 \#   Default is same as running text of document.
9348 .MAC ENDNOTE_TITLE_FAMILY END
9349 .    ds $EN_TITLE_FAM \\$1
9350 .END
9353 \# ENDNOTE TITLE FONT
9354 \# ------------------
9355 \# *Argument:
9356 \#   <font to use for endnote title>
9357 \# *Function:
9358 \#   Creates string $EN_TITLE_FT.
9359 \# *Notes:
9360 \#   Default is bold for TYPESET; roman for TYPEWRITE.
9362 .MAC ENDNOTE_TITLE_FONT END
9363 .    ds $EN_TITLE_FT \\$1
9364 .END
9367 \# ENDNOTE TITLE SIZE
9368 \# ------------------
9369 \# *Argument:
9370 \#   <+|- number of points by which to in/decrease endnote title
9371 \#    (relative to base endnote size)>
9372 \# *Function:
9373 \#   Creates string $EN_TITLE_SIZE_CHANGE.
9374 \# *Notes:
9375 \#   Default is 0 (i.e. title same size as text of endnotes).
9377 .MAC ENDNOTE_TITLE_SIZE END
9378 .    ds $EN_TITLE_SIZE_CHANGE \\$1 
9379 .END
9382 \# ENDNOTE TITLE QUAD
9383 \# ------------------
9384 \# *Argument:
9385 \#   <quad direction of endnote title>
9386 \# *Function:
9387 \#   Creates string $EN_TITLE_QUAD.
9388 \# *Notes:
9389 \#   Default is left.
9391 .MAC ENDNOTE_TITLE_QUAD END
9392 .    ds $EN_TITLE_QUAD \\$1
9393 .END
9396 \# ENDNOTE TITLE UNDERSCORE
9397 \# ------------------------
9398 \# *Argument:
9399 \#   toggle
9400 \# *Function:
9401 \#   Creates or removes register #EN_TITLE_UNDERSCORE.
9402 \# *Notes:
9403 \#   Default is to underscore the endnote titles.
9405 .MAC ENDNOTE_TITLE_UNDERSCORE END
9406 .    ie '\\$1'' \{ .nr #EN_TITLE_UNDERSCORE 1 \}
9407 .    el \{ .rr #EN_TITLE_UNDERSCORE \}
9408 .END
9411 \# ENDNOTE NUMBER FAMILY
9412 \# ---------------------
9413 \# *Argument:
9414 \#   <family to use for endnote numbers on endnotes page>
9415 \# *Function:
9416 \#   Creates string $EN_NUMBER_FAM.
9417 \# *Notes:
9418 \#   Default is same as running text of document.
9420 \#   Family, font, and size of endnote numbers applies only to the
9421 \#   numbers as they appear on the endnotes page(s).  The superscript
9422 \#   numbers that appear in running text are unaffected.
9424 .MAC ENDNOTE_NUMBER_FAMILY END
9425 .    ds $EN_NUMBER_FAM \\$1
9426 .END
9429 \# ENDNOTE NUMBER FONT
9430 \# -------------------
9431 \# *Argument:
9432 \#   <font to use for endnote numbers on endnotes page>
9433 \# *Function:
9434 \#   Creates string $EN_NUMBER_FT.
9435 \# *Notes:
9436 \#   Default is bold for TYPESET; roman for TYPEWRITE.
9438 \#   Family, font, and size of endnote numbers applies only to the
9439 \#   numbers as they appear on the endnotes page(s).  The superscript
9440 \#   numbers that appear in running text are unaffected.
9442 .MAC ENDNOTE_NUMBER_FONT END \"Default for TYPESET is bold
9443 .    ds $EN_NUMBER_FT \\$1
9444 .END
9447 \# ENDNOTE NUMBER SIZE
9448 \# -------------------
9449 \# *Argument:
9450 \#   <+|- number of points by which to in/decrease endnote numbers
9451 \#    (relative to base endnote size)>
9452 \# *Function:
9453 \#   Creates string $EN_NUMBER_SIZE_CHANGE.
9454 \# *Notes:
9455 \#   Default is 0.
9457 \#   Family, font, and size of endnote numbers applies only to the
9458 \#   numbers as they appear on the endnotes page(s).  The superscript
9459 \#   numbers that appear in running text are unaffected.
9461 .MAC ENDNOTE_NUMBER_SIZE END
9462 .    ds $EN_NUMBER_SIZE_CHANGE \\$1
9463 .END
9466 \# ENDNOTE NUMBERS ALIGN RIGHT
9467 \# ---------------------------
9468 \# *Argument:
9469 \#   <max. number of digit placeholders that will appear in endnotes>
9470 \# *Function:
9471 \#   Toggles register #EN_NUMBERS_ALIGN_RIGHT on; creates register
9472 \#   #EN_NUMBER_PLACEHOLDERS.
9473 \# *Notes:
9474 \#   Default is for footnote numbers to be right aligned to 2 placeholders.
9476 .MAC ENDNOTE_NUMBERS_ALIGN_RIGHT END
9477 .    rr #EN_NUMBERS_ALIGN_LEFT
9478 .    nr #EN_NUMBERS_ALIGN_RIGHT 1
9479 .    nr #EN_NUMBER_PLACEHOLDERS \\$1
9480 .END
9483 \# ENDNOTE NUMBERS ALIGN LEFT
9484 \# --------------------------
9485 \# *Argument:
9486 \#   none
9487 \# *Function:
9488 \#   Toggles register #EN_NUMBERS_ALIGN_LEFT on.
9489 \# *Notes:
9490 \#   Default is for footnote numbers to be right aligned to 2 placeholders
9491 \#   (i.e. not left aligned).
9493 .MAC ENDNOTE_NUMBERS_ALIGN_LEFT END
9494 .    rr #EN_NUMBERS_ALIGN_RIGHT
9495 .    nr #EN_NUMBERS_ALIGN_LEFT 1
9496 .END
9499 \# ENDNOTE PARAGRAPH INDENT
9500 \# ------------------------
9501 \# *Argument:
9502 \#   <first line indent of paras subsequent to 1st in endnotes>
9503 \# *Function:
9504 \#   Creates register #EN_PP_INDENT for use in .PP.
9505 \# *Notes:
9506 \#   Requires a unit of measure.
9508 \#   Default is 1.5m for TYPESET; same indent as PARA_INDENT for TYPEWRITE.
9510 .MAC ENDNOTE_PARA_INDENT END
9511 .    nr #EN_PP_INDENT (\\$1)
9512 .END
9515 \# TURN OFF COLUMN MODE FOR ENDNOTES
9516 \# ---------------------------------
9517 \# *Argument:
9518 \#   <none> | <anything>
9519 \# *Function:
9520 \#   Creates or removes register #EN_NO_COLS
9521 \# *Notes:
9522 \#   Allows user to tell mom not to set endnotes in columnar
9523 \#   documents in columns.  Default is to set endnotes in columns.
9525 .MAC ENDNOTES_NO_COLUMNS END
9526 .    ie '\\$1'' \{ .nr #EN_NO_COLS 1 \}
9527 .    el \{ .rr #EN_NO_COLS \}
9528 .END
9531 \# NO FIRST PAGE NUMBER ON ENDNOTES FIRST PAGE
9532 \# -------------------------------------------
9533 \# *Argument:
9534 \#   <none> | <anything>
9535 \# *Function:
9536 \#   Creates or removes register #EN_NO_FIRST_PN
9537 \# *Notes:
9538 \#   For use if FOOTERS are on.  Tells ENDNOTES not to put a page
9539 \#   number on the first endnotes page.  Some users may want this.
9540 \#   Default is to print a page number at the top of the first
9541 \#   endnotes page when footers are on.
9543 .MAC ENDNOTES_NO_FIRST_PAGENUM END
9544 .    ie '\\$1'' \{ .nr #EN_NO_FIRST_PN 1 \}
9545 .    el \{ .rr #EN_NO_FIRST_PN \}
9546 .END
9549 \# PAGE HEADERS ON ENDNOTES PAGES
9550 \# ------------------------------
9551 \# *Argument:
9552 \#   <none> | ALL
9553 \# *Function:
9554 \#   Creates or removes register #EN_ALLOWS_HEADERS or
9555 \#   #EN_ALLOWS_HEADERS_ALL
9556 \# *Notes:
9557 \#   Whether ENDNOTES puts a page header at the top of endnotes
9558 \#   pages if page headers are used throughout the document.
9559 \#   Default is to insert the page headers, but not on the first
9560 \#   page.  If the optional argument ALL is given, ENDNOTES puts a
9561 \#   page header on the first page as well.
9563 .MAC ENDNOTES_ALLOWS_HEADERS END
9564 .    ie '\\$1'' \{ .nr #EN_ALLOWS_HEADERS 1 \}
9565 .    el \{\
9566 .       ie '\\$1'ALL' \{\
9567 .          nr #EN_ALLOWS_HEADERS 1
9568 .          nr #EN_ALLOWS_HEADERS_ALL 1
9569 .       \}
9570 .       el \{\
9571 .          rr #EN_ALLOWS_HEADERS
9572 .          rr #EN_ALLOWS_HEADERS_ALL
9573 .       \}
9574 .    \}
9575 .END
9578 \# ENDNOTES PAGES PAGE NUMBERING STYLE
9579 \# ----
9580 \# *Argument:
9581 \#   DIGIT | ROMAN | roman | ALPHA | alpha
9582 \# *Function:
9583 \#   Creates or modifies $EN_PN_STYLE.
9584 \# *Notes:
9585 \#   Allows user to define what style should be used for endnotes
9586 \#   pages page numbering.  Arguments are the same as for
9587 \#   PAGENUM_STYLE.
9589 \#   Default is DIGIT.
9591 .MAC ENDNOTES_PAGENUM_STYLE END
9592 .    ds $EN_PN_STYLE \\$1
9593 .END
9596 \# FIRST PAGE NUMBER FOR ENDNOTES
9597 \# ------------------------------
9598 \# *Argument:
9599 \#   <page number that appears on page 1 of endnotes pages>
9600 \# *Function:
9601 \#   Creates or modifies string $EN_FIRST_PN
9602 \# *Notes:
9603 \#   To be used with caution, only if all endnotes
9604 \#   are to be output at once, i.e. not at the end of the separate
9605 \#   docs of a collated doc
9607 .MAC ENDNOTES_FIRST_PAGENUMBER END
9608 .    nr #EN_FIRST_PN \\$1
9609 .END
9611 \# SINGLESPACE ENDNOTES
9612 \# --------------------
9613 \# *Argument:
9614 \#   <none> | <anything>
9615 \# *Function:
9616 \#   Sets lead of endnotes pages in TYPEWRITE to 12 points,
9617 \#   adjusted.
9618 \# *Notes:
9619 \#   Default is to double-space endnotes pages.
9621 .MAC SINGLESPACE_ENDNOTES END
9622 .    if \\n[#PRINT_STYLE]=1 \{\
9623 .       ie \\n[#SINGLE_SPACE] \{\
9624 .          nr #EN_SINGLESPACE 1
9625 .          rr #IGNORE
9626 .          if \\n[#OK_PROCESS_LEAD] \{\
9627 .             ENDNOTE_LEAD 12 ADJUST
9628 .             nr #IGNORE 1
9629 .          \}
9630 .       \}
9631 .       el \{\
9632 .          ie '\\$1'' \{\
9633 .             nr #EN_SINGLESPACE 1
9634 .             rr #IGNORE
9635 .             if \\n[#OK_PROCESS_LEAD] \{\
9636 .                ENDNOTE_LEAD 12 ADJUST
9637 .                nr #IGNORE 1
9638 .             \}
9639 .          \}
9640 .          el \{\
9641 .             rr #EN_SINGLESPACE
9642 .             rr #IGNORE
9643 .             if \\n[#OK_PROCESS_LEAD] \{\
9644 .                ENDNOTE_LEAD 24 ADJUST
9645 .                nr #IGNORE 1
9646 .             \}
9647 .          \}
9648 .       \}
9649 .    \}
9650 .END
9653 \# ENDNOTE PARAGRAPH SPACE
9654 \# -----------------------
9655 \# *Argument:
9656 \#   toggle
9657 \# *Function:
9658 \#   Creates toggle register #EN_PP_SPACE for use in .PP.
9659 \# *Notes:
9660 \#   Like PARA_SPACE.  Default is not to space endnote paras.
9662 .MAC ENDNOTE_PARA_SPACE END
9663 .    ie '\\$1'' \{ .nr #EN_PP_SPACE 1 \}
9664 .    el \{ .rr #EN_PP_SPACE \}
9665 .END
9668 \# ENDNOTE
9669 \# -------
9670 \# *Argument:
9671 \#   toggle
9672 \# *Function:
9673 \#   Places superscript endnote number in text, then collects and
9674 \#   processes endnote in diversion END_NOTES.
9675 \# *Notes:
9676 \#   \c must be appended to the word immediately preceding .ENDNOTE.
9678 .MAC ENDNOTE END
9679 .    ie '\\$1'' \{\
9680 .       nr #ENDNOTE 1
9681 .       if \\n[#CONDENSE] \{ \*[CONDX]\c \}
9682 .       if \\n[#EXTEND]   \{ \*[EXTX]\c  \}
9683 .       if \\n[#PRINT_STYLE]=1 \{\
9684 .          if \\n[#UNDERLINE_ON] \{\
9685 .             nr #UNDERLINE_WAS_ON 1
9686 .             UNDERLINE OFF
9687 .          \}
9688 .          if \\n[#SLANT_ON] \{\
9689 .              nr #SLANT_WAS_ON 1
9690 \*[SLANTX]\c
9691 .          \}
9692 .          PRINT "\s-2\v'-\\n[#DOC_LEAD]u/5u'\\n+[#EN_NUMBER]\v'+\\n[#DOC_LEAD]u/5u'\s+2"
9693 .       \}
9694 .       if \\n[#PRINT_STYLE]=2 \{ .PRINT "\*[SUP]\\n+[#EN_NUMBER]\*[SUPX]" \}
9695 .       nr #PP_STYLE_PREV \\n[#PP_STYLE]
9696 .       nr #PP_STYLE 1
9697 .       if \\n[#INDENT_FIRST_PARAS] \{ .nr #INDENT_FIRSTS 1 \}
9698 .       INDENT_FIRST_PARAS
9699 .       ev EN
9700 .       da END_NOTES
9701 .       LL \\n[#DOC_L_LENGTH]u
9702 .       ta \\n(.lu
9703 .       if \\n[#COLUMNS] \{\
9704 .          ie \\n[#EN_NO_COLS] \{ .LL \\n[#DOC_L_LENGTH]u \}
9705 .          el \{ .LL \\n[#COL_L_LENGTH]u \}
9706 .          ta \\n(.lu
9707 .       \}
9708 .       vs \\n[#EN_LEAD]u
9709 .       if \\n[#EN_NUMBER]=1 \{\
9710 \!.        ne 3
9711 .          if \\n[#PRINT_STYLE]=1 \{\
9712 .             fam C
9713 .             ft  R  
9714 .             ps  12
9715 .          \}
9716 .          if \\n[#PRINT_STYLE]=2 \{\
9717 .             FAMILY  \\*[$EN_TITLE_FAM]
9718 .             FT      \\*[$EN_TITLE_FT]
9719 .             PT_SIZE \\n[#EN_PS]u\\*[$EN_TITLE_SIZE_CHANGE]
9720 .          \}
9721 .          sp
9722 .          if !'\\*[$EN_TITLE]'' \{\
9723 .             if '\\*[$EN_TITLE_QUAD]'L'      \{ .LEFT   \}
9724 .             if '\\*[$EN_TITLE_QUAD]'LEFT'   \{ .LEFT   \}
9725 .             if '\\*[$EN_TITLE_QUAD]'C'      \{ .CENTER \}
9726 .             if '\\*[$EN_TITLE_QUAD]'CENTER' \{ .CENTER \}
9727 .             if '\\*[$EN_TITLE_QUAD]'CENTRE' \{ .CENTER \}
9728 .             if '\\*[$EN_TITLE_QUAD]'R'      \{ .RIGHT  \}
9729 .             if '\\*[$EN_TITLE_QUAD]'RIGHT'  \{ .RIGHT  \}
9730 .             ie \\n[#EN_TITLE_UNDERSCORE] \{\
9731 .                UNDERSCORE "\\*[$EN_TITLE]
9732 .             \}
9733 .             el \{\
9734 .                PRINT "\\*[$EN_TITLE]
9735 .             \}
9736 .          \}
9737 .       \}
9738 .       ie \\n[#EN_NUMBERS_ALIGN_RIGHT] \{\
9739 .          ie \\n[#EN_NUMBER]=1 \{\
9740 .             if !'\\*[$EN_TITLE]'' \{ .sp \}
9741 .          \}
9742 .          el \{ .sp \}
9743 \!.        TRAP OFF
9744 .          if \\n[#PRINT_STYLE]=1 \{\
9745 .             fam C
9746 .             ft  R
9747 .             ps  12
9748 .          \}
9749 .          if \\n[#PRINT_STYLE]=2 \{\
9750 .             FAMILY  \\*[$EN_NUMBER_FAM]
9751 .             FT      \\*[$EN_NUMBER_FT]
9752 .             PT_SIZE \\n[#EN_PS]u\\*[$EN_NUMBER_SIZE_CHANGE]
9753 .          \}
9754 .          nr #RESET_L_LENGTH \\n(.l
9755 .          nr #EN_NUMBER_L_LENGTH \w'\0'*\\n[#EN_NUMBER_PLACEHOLDERS]+\w'.'
9756 .          ll \\n[#EN_NUMBER_L_LENGTH]u
9757 .          RIGHT
9758 \En[#EN_NUMBER].
9759 .          if \\n[#PRINT_STYLE]=1 \{\
9760 .             fam C
9761 .             ft  R
9762 .             ps  12
9763 .          \}
9764 .          if \\n[#PRINT_STYLE]=2 \{\
9765 .             FAMILY  \\*[$EN_FAM]
9766 .             FT      \\*[$EN_FT]
9767 .             PT_SIZE \\n[#EN_PS]u
9768 .          \}
9769 .          EL
9770 .          ll \\n[#RESET_L_LENGTH]u
9771 .          in \\n[#EN_NUMBER_L_LENGTH]u+\w'.\0'u
9772 .          nr #EN_TEXT_INDENT \\n(.i
9773 .          QUAD \\*[$EN_QUAD]
9774 \!.        TRAP
9775 .       \}
9776 .       el \{\
9777 .          ie \\n[#EN_NUMBER]=1 \{\
9778 .             if !'\\*[$EN_TITLE]'' \{ .sp \}
9779 .          \}
9780 .          el \{ .sp \}
9781 .          if \\n[#PRINT_STYLE]=1 \{\
9782 .             fam C
9783 .             ft  R
9784 .             ps  12
9785 .          \}
9786 .          if \\n[#PRINT_STYLE]=2 \{\
9787 .             FAMILY  \\*[$EN_NUMBER_FAM]
9788 .             FT      \\*[$EN_NUMBER_FT]
9789 .             PT_SIZE \\n[#EN_PS]u\\*[$EN_NUMBER_SIZE_CHANGE]
9790 .          \}
9791 .          QUAD \\*[$EN_QUAD]
9792 \En[#EN_NUMBER].\0\c
9793 .          if \\n[#PRINT_STYLE]=2 \{\
9794 .             FAMILY  \\*[$EN_FAM]
9795 .             FT      \\*[$EN_FT]
9796 .             PT_SIZE \\n[#EN_PS]u
9797 .          \}
9798 .       \}
9799 .    \}
9800 .    el \{\
9801 .       br
9802 .       if \\n[#EN_NUMBERS_ALIGN_RIGHT] \{\
9803 .          in 0
9804 .       \}
9805 .       di
9806 .       ev
9807 .       nr #PP_STYLE \\n[#PP_STYLE_PREV]
9808 .       if !\\n[#INDENT_FIRSTS] \{ .INDENT_FIRST_PARAS OFF \}
9809 .       rr #INDENT_FIRSTS
9810 .       rr #ENDNOTE
9811 .       if \\n[#PRINT_STYLE]=1 \{\
9812 .          if \\n[#UNDERLINE_WAS_ON] \{\
9813 .             rr #UNDERLINE_WAS_ON
9814 .             UNDERLINE
9815 .          \}
9816 .       \}
9817 .       if \\n[#SLANT_WAS_ON] \{\
9818 .          rr #SLANT_WAS_ON
9819 \*[SLANT]\c
9820 .       \}
9821 .    \}
9822 .END
9825 \# ENDNOTES
9826 \# --------
9827 \# *Arguments:
9828 \#   none
9829 \# *Function:
9830 \#   Sets new document leading from #EN_LEAD, breaks to a new page,
9831 \#   sets up an endnotes page based on registers and strings associated
9832 \#   with endnotes, then outputs diversion END_NOTES.
9834 .MAC ENDNOTES END
9835 .    nr #ENDNOTES 1
9836 .    nr #PAGINATION_STATE \\n[#PAGINATE]
9837 .    nr #EN_FIRST_PAGE 1
9838 .    nr #HEADER_STATE \\n[#HEADERS_ON]
9839 .    ds $RESTORE_PAGENUM_STYLE \\*[$PAGENUM_STYLE]
9840 .    if \\n[#HEADERS_ON]=1 \{\
9841 .       if !\\n[#EN_ALLOWS_HEADERS_ALL] \{ .HEADERS OFF \}
9842 .    \}
9843 .    if \\n[#HEADER_STATE]=1 \{\
9844 .       ie \\n[#EN_HDRFTR_CENTER]=1 \{ . \}
9845 .       el \{ .rm $HDRFTR_CENTER  \}
9846 .    \}
9847 .    ie !\\n[#SUSPEND_PAGINATION] \{\
9848 .       if \\n[#PAGINATE]=1 \{\
9849 .          if \\n[#PAGE_NUM_V_POS]=1 \{\
9850 .             PAGENUM_STYLE \\*[$EN_PN_STYLE]
9851 .             if \\n[#EN_FIRST_PN] \{ .PAGENUMBER \\n[#EN_FIRST_PN]-1 \}
9852 .             if r#EN_NO_FIRST_PN \{ .nr #PAGINATE 0 \}
9853 .          \}
9854 .       \}
9855 .    \}
9856 .    el \{\
9857 .       ie \\n[#PAGE_NUM_V_POS]=2 \{ .nr #PAGINATE 1 \}
9858 .       el \{ .nr #PAGINATE 0 \}
9859 .    \}
9860 .    if \\n[#FOOTERS_ON]=1 \{\
9861 .       if !'\\*[$HDRFTR_CENTER_OLD]'' \{ .ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_OLD] \}
9862 .    \}
9863 .    NEWPAGE
9864 .    if \\n[#FINIS] \{\
9865 .       if \\n[#FOOTERS_WERE_ON] \{\
9866 .          FOOTERS
9867 .          rr #FOOTERS_WERE_ON
9868 .       \}
9869 .       if \\n[#PAGINATION_WAS_ON] \{\ \"This register only set in FINIS
9870 .          if \\n[#PAGINATION_STATE]=1 \{\
9871 .             PAGINATE
9872 .             rr #PAGINATION_WAS_ON
9873 .          \}
9874 .       \}
9875 .       rr #FINIS
9876 .    \}
9877 .    if \\n[#FOOTERS_WERE_ON] \{\
9878 .       FOOTERS
9879 .       rr #FOOTERS_WERE_ON
9880 .    \}
9881 .    if \\n[#PAGINATION_WAS_ON] \{\
9882 .       if \\n[#PAGINATION_STATE]=1 \{\
9883 .          PAGINATE
9884 .          rr #PAGINATION_WAS_ON
9885 .       \}
9886 .    \}
9887 .    if \\n[#FOOTERS_ON]=1 \{\
9888 .       ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_NEW]
9889 .       rm $HDRFTR_CENTER_OLD
9890 .       rm $HDRFTR_CENTER_NEW
9891 .    \}
9892 .    ie !\\n[#SUSPEND_PAGINATION] \{\
9893 .       if \\n[#PAGE_NUM_V_POS]=1 \{\
9894 .          if r#EN_NO_FIRST_PN \{\
9895 .             if \\n[#PAGINATION_STATE]=1 \{\
9896 .                nr #PAGINATE 1
9897 .             \}
9898 .          \}
9899 .       \}
9900 .    \}
9901 .    el \{\
9902 .       if \\n[#PAGE_NUM_V_POS]=2 \{ .nr #PAGINATE 0 \}
9903 .    \}
9904 .    rr #PAGINATION_STATE
9905 .    PAGENUM_STYLE \\*[$EN_PN_STYLE]
9906 .    if \\n[#EN_FIRST_PN] \{ .PAGENUMBER \\n[#EN_FIRST_PN] \}
9907 .    if \\n[#HEADER_STATE]=1 \{\
9908 .       if \\n[#EN_ALLOWS_HEADERS] \{ .HEADERS \}
9909 .    \}
9910 \# Collect endnote title string for TOC
9911 .    nr #TOC_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
9912 .    af #TOC_ENTRY_PN \\g[#PAGENUMBER]
9913 .    ds $TOC_TITLE_ITEM \\*[$EN_STRING]\\|
9914 .    ev TOC_EV
9915 .    da TOC_ENTRIES
9916 .    if \\n[#PRINT_STYLE]=1 \{\
9917 .       fam C
9918 .       ft  R
9919 .       ps  12
9920 .    \}
9921 .    if \\n[#PRINT_STYLE]=2 \{\
9922 \!.     FAMILY  \\*[$TOC_TITLE_FAM]
9923 \!.     FT      \\*[$TOC_TITLE_FT]
9924 \!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_TITLE_SIZE_CHANGE]
9925 .    \}
9926 \!.  TRAP OFF
9927 .    ie \\n[#PRINT_STYLE]=1 \{\
9928 \!.     PAD "\\*[$TOC_TITLE_ITEM]\\*[$TOC_PN_TYPEWRITE]" 
9929 .    \}
9930 .    el \{\
9931 \!.     PAD "\\h'\\n[#TOC_TITLE_INDENT]u'\\*[$TOC_TITLE_ITEM]\\*[$TOC_PN]"
9932 .    \}
9933 \!.  EL
9934 \!.  ST 100 L
9935 \!.  ST 101 R
9936 .    if \\n[#PRINT_STYLE]=2 \{\
9937 \!.     FAMILY  \\*[$TOC_PN_FAM]
9938 \!.     FT      \\*[$TOC_PN_FT]
9939 \!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PN_SIZE_CHANGE]
9940 .    \}
9941 \!.  TAB 100
9942 \!.  PRINT \\*[LEADER]
9943 \!.  TN
9944 \!.  TRAP
9945 \!.  PRINT \\n[#TOC_ENTRY_PN]
9946 \!.  TQ
9947 .    di       
9948 .    ev
9949 \# End collection of endnote title string for TOC
9950 \# Process endnote
9951 .    if \\n[#PRINT_STYLE]=1 \{ .vs \\n[#EN_LEAD]u \}
9952 .    if \\n[#PRINT_STYLE]=2 \{\
9953 .       if \\n[#EN_NO_COLS] \{\
9954 .          if \\n[#COLUMNS] \{ .nr #COLUMNS_WERE_ON 1 \}
9955 .          nr #COLUMNS 0
9956 .       \}
9957 .       nr #RESTORE_DOC_LEAD \\n[#DOC_LEAD]
9958 .       ie \\n[#ADJ_EN_LEAD] \{\
9959 .          nr #DOC_LEAD \\n[#EN_LEAD]
9960 .       \}
9961 .       el \{ .DOC_LEAD \\n[#EN_LEAD]u \}
9962 .    \}
9963 .    PRINT \&
9964 .    sp |\\n[#T_MARGIN]u
9965 .    mk ec
9966 .    if \\n[#SLANT_ON] \{\
9967 \*[SLANTX]\c
9968 .    \}
9969 .    ev ENDNOTES
9970 .    if !'\\*[$EN_STRING]'' \{\
9971 .       if \\n[#PRINT_STYLE]=1 \{\
9972 .          fam C
9973 .          ft  R
9974 .          ps  12
9975 .          vs \\n[#EN_LEAD]u
9976 .       \}
9977 .       if \\n[#PRINT_STYLE]=2 \{\
9978 .          LL \\n[#DOC_L_LENGTH]u
9979 .          ta \\n(.lu
9980 .          if \\n[#COLUMNS] \{\
9981 .             ie \\n[#EN_NO_COLS] \{ .LL \\n[#DOC_L_LENGTH]u \}
9982 .             el \{ .LL \\n[#COL_L_LENGTH]u \}
9983 .             ta \\n(.lu
9984 .          \}
9985 .          FAMILY  \\*[$EN_STRING_FAM]
9986 .          FT      \\*[$EN_STRING_FT]
9987 .          PT_SIZE \\n[#EN_PS]u\\*[$EN_STRING_SIZE_CHANGE]
9988 .          vs      \\n[#EN_LEAD]u
9989 .       \}
9990 .       if '\\*[$EN_STRING_QUAD]'L'      \{ .LEFT   \}
9991 .       if '\\*[$EN_STRING_QUAD]'LEFT'   \{ .LEFT   \}
9992 .       if '\\*[$EN_STRING_QUAD]'C'      \{ .CENTER \}
9993 .       if '\\*[$EN_STRING_QUAD]'CENTER' \{ .CENTER \}
9994 .       if '\\*[$EN_STRING_QUAD]'CENTRE' \{ .CENTER \}
9995 .       if '\\*[$EN_STRING_QUAD]'R'      \{ .RIGHT  \}
9996 .       if '\\*[$EN_STRING_QUAD]'RIGHT'  \{ .RIGHT  \}
9997 .       EL
9998 .       if \\n[#EN_STRING_CAPS] \{ .CAPS \}
9999 .       ie \\n[#EN_STRING_UNDERSCORE] \{\
10000 .          ie \\n[#EN_STRING_UNDERSCORE]=2 \{\
10001 .             UNDERSCORE2 "\\*[$EN_STRING]
10002 .          \}
10003 .          el \{\
10004 .             UNDERSCORE "\\*[$EN_STRING]
10005 .          \}
10006 .       \}
10007 .       el \{\
10008 .          PRINT "\\*[$EN_STRING]
10009 .       \}
10010 .    \}
10011 .    CAPS OFF
10012 .    ALD \\n[#EN_LEAD]u
10013 .    QUAD \\*[$EN_QUAD]
10014 .    nf
10015 .    END_NOTES
10016 .    br
10017 .    ev
10018 .    rm END_NOTES
10019 .    if \\n[#PRINT_STYLE]=1 \{ .vs \\n[#DOC_LEAD]u \}
10020 .    if \\n[#PRINT_STYLE]=2 \{\
10021 .       ie \\n[#ADJ_EN_LEAD] \{\
10022 .          nr #DOC_LEAD \\n[#RESTORE_DOC_LEAD]
10023 .       \}
10024 .       el \{ .DOC_LEAD \\n[#RESTORE_DOC_LEAD]u \}
10025 .       rr #RESTORE_DOC_LEAD
10026 .    \}
10027 .    if \\n[#COLUMNS_WERE_ON] \{ .nr #COLUMNS 1 \}
10028 .    if \\n[#HEADER_STATE]=1 \{ .HEADERS \}
10029 .    rr #ENDNOTES
10030 .END
10032 \# ====================================================================
10034 \# +++TABLE OF CONTENTS+++
10036 \# Strings to allocate space for leaders and entry page numbers
10038 .ds $TOC_PN \\*[ST100]\\F[\\*[$TOC_PN_FAM]]\\f[\\*[$TOC_PN_FT]]\\s[\\n[#TOC_PS]u]#\\*[ST100X]\\*[ST101]\\s[\\*[$TOC_PN_SIZE_CHANGE]]\\|\\h'\\w'0'u*\\n[#TOC_PN_PADDING]u'\*[ST101X]
10039 .ds $TOC_PN_TYPEWRITE \\*[ST100]#\\*[ST100X]\\*[ST101]\\|\\h'\\w'0'u*\\n[#TOC_PN_PADDING]u'\\*[ST101X]
10041 \# TOC ENTRIES PAGE NUMBERS PADDING
10042 \# --------------------------------
10043 \# *Argument:
10044 \#   <number of placeholders for toc entries page numbers>
10045 \# *Function:
10046 \#   Creates or modifies register #TOC_PN_PADDING.
10047 \# *Notes:
10048 \#   "Placeholders" is the maximum number of digits in a page
10049 \#   number numeral.
10051 \#   Default is 3.
10053 .MAC TOC_PADDING END
10054 .    nr #TOC_PN_PADDING \\$1
10055 .END
10058 \# PAGINATE TOC
10059 \# ------------
10060 \# *Argument:
10061 \#   <none> | <anything>
10062 \# *Function:
10063 \#   Creates or removes register #PAGINATE_TOC.
10064 \# *Notes:
10065 \#   Default is to paginate toc.
10067 .MAC PAGINATE_TOC END
10068 .    ie '\\$1'' \{ .nr #PAGINATE_TOC 1 \}
10069 .    el \{ .nr #PAGINATE_TOC 0 \}
10070 .END
10073 \# TOC FAMILY
10074 \# ----------
10075 \# *Argument:
10076 \#   <overall default family for toc pages>
10077 \# *Function:
10078 \#   Creates string $TOC_FAM.
10079 \# *Notes:
10080 \#   Default is same as document family. 
10082 .MAC TOC_FAMILY END
10083 .    ds $TOC_FAM \\$1
10084 .END
10087 \# TOC POINT SIZE
10088 \# --------------
10089 \# *Argument:
10090 \#   <base point size for toc pages>
10091 \# *Function:
10092 \#   Creates or modifies register #TOC_PS.
10093 \# *Notes:
10094 \#   This size control macro differs from other size control macros
10095 \#   in that it sets an absolute point size, not a relative one.
10096 \#   See notes for ENDNOTE_PT_SIZE for explanation.  No unit of
10097 \#   measure required.
10099 \#   No unit of measure required (points assumed).  Default is 11.5
10100 \#   for TYPESET.
10102 .MAC TOC_PT_SIZE END
10103 .    nr #TOC_PS (p;\\$1)
10104 .END
10107 \# TOC LEADING
10108 \# -----------
10109 \# *Argument:
10110 \#   <leading for toc pages> [ADJUST]
10111 \# *Function:
10112 \#   Creates or modifies register #TOC_LEAD. If optional ADJUST
10113 \#   given, adjusts lead to fill page.  If #OK_PROCESS_LEAD doesn't
10114 \#   exist, stores arguments for when it's okay to run the macro.
10115 \# *Notes:
10116 \#   No unit of measure required (points assumed).
10118 \#   Default is same as DOC_LEAD.
10120 .MAC TOC_LEAD END
10121 .    if !\\n[#OK_PROCESS_LEAD] \{\
10122 .       ds $TOC_LEAD \\$1
10123 .       if !'\\$2'' \{\
10124 .           ds $ADJUST_TOC_LEAD \\$2
10125 .       \}
10126 .       return
10127 .    \}
10128 .    rr #ADJ_TOC_LEAD
10129 .    nr #TOC_LEAD (p;\\$1)
10130 .    if '\\$2'ADJUST' \{\
10131 .       nr #ORIG_DOC_LEAD \\n[#DOC_LEAD]
10132 .       nr #ADJ_DOC_LEAD 1
10133 .       nr #ADJ_TOC_LEAD 1
10134 .       nr #NO_TRAP_RESET 1
10135 .       DOC_LEAD \\n[#TOC_LEAD]u ADJUST
10136 .       nr #TOC_LEAD \\n[#DOC_LEAD]
10137 .       DOC_LEAD \\n[#ORIG_DOC_LEAD]u
10138 .       rr #NO_TRAP_RESET
10139 .       rr #ADJ_DOC_LEAD
10140 .       rr #ORIG_DOC_LEAD
10141 .    \}
10142 .END
10145 \# TOC PAGES PAGE-NUMBERING STYLE
10146 \# ------------------------------
10147 \# *Argument:
10148 \#   DIGIT | ROMAN | roman | ALPHA | alpha
10149 \# *Function:
10150 \#   Creates or modifies string $TOC_PN_STYLE
10151 \# *Notes:
10152 \#   Page numbering style for page numbers that appear in the
10153 \#   headers/footers of toc pages.  See notes for PAGENUM_STYLE.  
10155 \#   Default is roman.
10157 .MAC TOC_PAGENUM_STYLE END
10158 .    ds $TOC_PN_STYLE \\$1
10159 .END
10162 \# TOC RECTO_VERSO SWITCH
10163 \# ----------------------
10164 \# *Argument:
10165 \#   <none> | <anything>
10166 \# *Function:
10167 \#   Creates or removes register #TOC_RV_SWITCH
10168 \# *Notes:
10169 \#   Allows switching of L/R margins if a doc is recto/verso and
10170 \#   the first toc page happens to fall the wrong way
10172 .MAC TOC_RV_SWITCH END
10173 .    ie '\\$1'' \{ .nr #TOC_RV_SWITCH 1 \}
10174 .    el \{ .rr #TOC_RV_SWITCH \}
10175 .END
10177 \# - for TOC "doc header" (i.e. "Contents")
10179 \# TOC HEADER FAMILY
10180 \# -----------------
10181 \# *Argument:
10182 \#   <family for toc header>
10183 \# *Function:
10184 \#   Creates or modifies string $TOC_HEADER_FAM
10185 \# *Notes:
10186 \#   Default is same as TOC_FAMILY.
10188 .MAC TOC_HEADER_FAMILY END
10189 .    ds $TOC_HEADER_FAM \\$1
10190 .END
10193 \# TOC HEADER FONT
10194 \# ---------------
10195 \# *Argument:
10196 \#   <font for toc header>
10197 \# *Function:
10198 \#   Creates or modified string $TOC_HEADER_FT
10199 \# *Notes:
10200 \#   Default is bold for TYPESET.
10202 .MAC TOC_HEADER_FONT END
10203 .    ds $TOC_HEADER_FT \\$1
10204 .END
10207 \# TOC HEADER SIZE
10208 \# --------------
10209 \# *Argument:
10210 \#   <+|- number of points by which to in/decrease toc header
10211 \#   (relative to overall toc point size)>
10212 \# *Function:
10213 \#   Creates or modifies string $TOC_HEADER_SIZE_CHANGE.
10214 \# *Notes:
10215 \#   Default is +4
10217 .MAC TOC_HEADER_SIZE END
10218 .    ds $TOC_HEADER_SIZE_CHANGE \\$1
10219 .END
10222 \# TOC HEADER QUAD
10223 \# ---------------
10224 \# *Argument:
10225 \#   L | LEFT | C | CENTER | CENTRE | R | RIGHT
10226 \# *Function:
10227 \#   Creates or modifies string $TOC_HEADER_QUAD.
10228 \# *Notes:
10229 \#   Default is LEFT.
10231 .MAC TOC_HEADER_QUAD END
10232 .    ds $TOC_HEADER_QUAD \\$1
10233 .END
10236 \# TOC HEADER STRING
10237 \# -----------------
10238 \# *Argument:
10239 \#   <string for "doc header" of first toc page>
10240 \# *Function:
10241 \#   Creates or modifies string $TOC_HEADER_STRING
10242 \# *Notes:
10243 \#   Default is "Contents".
10245 .MAC TOC_HEADER_STRING END
10246 .    ds $TOC_HEADER_STRING \\$1
10247 .END
10249 \# - for TOC entries page number numerals
10251 \# TOC ENTRIES PAGE NUMBER FAMILY
10252 \# ------------------------------
10253 \# *Argument:
10254 \#   <family to use for toc entries page number>
10255 \# *Function:
10256 \#   Creates or modifies string $TOC_PN_FAM.
10257 \# *Notes:
10258 \#   Default is same as $TOC_FAM.
10260 .MAC TOC_PN_FAMILY END
10261 .    ds $TOC_PN_FAM \\$1
10262 .END
10265 \# TOC ENTRIES PAGE NUMBER FONT
10266 \# ----------------------------
10267 \# *Argument:
10268 \#   <font to use for toc entries page number>
10269 \# *Function:
10270 \#   Creates or modifies string $TOC_PN_FT.
10271 \# *Notes:
10272 \#   Default is roman.
10274 .MAC TOC_PN_FONT END
10275 .    ds $TOC_PN_FT \\$1
10276 .END
10279 \# TOC ENTRIES PAGE NUMBER SIZE
10280 \# ----------------------------
10281 \# *Argument:
10282 \#   <+|- number of points by which to in/decrease toc
10283 \#   entries page numbers (relative to overall toc point size)>
10284 \# *Function:
10285 \#   Creates or modifies string $TOC_PN_SIZE_CHANGE.
10286 \# *Notes:
10287 \#   Default is +0.
10289 .MAC TOC_PN_SIZE END
10290 .    ds $TOC_PN_SIZE_CHANGE \\$1
10291 .END
10294 \# Control macros for toc doc titles, heads, subheads and paraheads 
10295 \# ----------------------------------------------------------------
10297 \# All these control macros behave the same way, setting the family,
10298 \# font, point size and indent from the left margin of the different
10299 \# kinds of entries that can appear in the toc.  The way they
10300 \# operate is identical to all other _FAMILY, _FONT and _SIZE
10301 \# control macros.  _INDENT takes an absolute value.
10302 \# TOC_APPENDS_AUTHORS is unique in this section.
10303 \# 
10304 \# - for title entries
10306 .MAC TOC_TITLE_FAMILY END
10307 .    ds $TOC_TITLE_FAM \\$1
10308 .END
10311 .MAC TOC_TITLE_FONT END
10312 .    ds $TOC_TITLE_FT \\$1
10313 .END
10316 .MAC TOC_TITLE_SIZE END
10317 .    ds $TOC_TITLE_SIZE_CHANGE \\$1
10318 .END
10321 .MAC TOC_TITLE_INDENT END
10322 .    nr #TOC_TITLE_INDENT (\\$1)
10323 .END
10326 .MAC TOC_TITLE_ENTRY END
10327 .    nr #USER_SET_TITLE_ITEM 1
10328 .    ds $USER_SET_TITLE_ITEM \\$1
10329 .END
10332 \# APPEND AUTHOR(S) TO TOC DOC TITLE ENTRIES
10333 \# -----------------------------------------
10334 \# *Argument:
10335 \#   <none> | <name(s) of author(s) as they should appear in toc doc title entries>
10336 \# *Function:
10337 \#   Creates register #TOC_AUTHORS (to tell TOC to append authors
10338 \#   to toc doc title entries).  Optionally creates string
10339 \#   $TOC_AUTHORS.
10340 \# *Notes:
10341 \#   Normally, TOC does not append the author(s) to a toc doc title
10342 \#   entry.  This special macro instructs TOC to do so.
10344 \#   If user has multiple authors for each doc when collating,
10345 \#   TOC_APPENDS_AUTHOR "<string>" must be inserted somewhere between
10346 \#   COLLATE and START in each doc.  Otherwise, mom prints only the
10347 \#   first author given to AUTHOR.
10349 .MAC TOC_APPENDS_AUTHOR END
10350 .    nr #TOC_AUTHORS 1
10351 .    if !'\\$1'' \{\
10352 .       ds $TOC_AUTHORS \\$1
10353 .    \}
10354 .END
10356 \# - for head entries
10358 .MAC TOC_HEAD_FAMILY END
10359 .    ds $TOC_HEAD_FAM \\$1
10360 .END
10363 .MAC TOC_HEAD_FONT END
10364 .    ds $TOC_HEAD_FT \\$1
10365 .END
10368 .MAC TOC_HEAD_SIZE END
10369 .    ds $TOC_HEAD_SIZE_CHANGE \\$1
10370 .END
10373 .MAC TOC_HEAD_INDENT END
10374 .    nr #TOC_HEAD_INDENT (\\$1)
10375 .END
10377 \# - for subhead entries
10379 .MAC TOC_SUBHEAD_FAMILY END
10380 .    ds $TOC_SH_FAM \\$1
10381 .END
10384 .MAC TOC_SUBHEAD_FONT END
10385 .    ds $TOC_SH_FT \\$1
10386 .END
10389 .MAC TOC_SUBHEAD_SIZE END
10390 .    ds $TOC_SH_SIZE_CHANGE \\$1
10391 .END
10394 .MAC TOC_SUBHEAD_INDENT END
10395 .    nr #TOC_SH_INDENT (\\$1)
10396 .END
10398 \# - for parahead entries
10400 .MAC TOC_PARAHEAD_FAMILY END
10401 .    ds $TOC_PH_FAM \\$1
10402 .END
10405 .MAC TOC_PARAHEAD_FONT END
10406 .    ds $TOC_PH_FT \\$1
10407 .END
10410 .MAC TOC_PARAHEAD_SIZE END
10411 .    ds $TOC_PH_SIZE_CHANGE \\$1
10412 .END
10415 .MAC TOC_PARAHEAD_INDENT END
10416 .    nr #TOC_PH_INDENT (\\$1)
10417 .END
10420 .MAC TOC END
10421 .    if !r#PAGINATE_TOC \{ .PAGINATE_TOC \}
10422 .    nr #TOC_FIRST_PAGE 1
10423 .    if \\n[#FINIS] \{\
10424 .       if \\n[#FOOTERS_WERE_ON] \{\
10425 .          FOOTERS \" Have to turn FOOTERS on for next bit to work, so we can't skip this step
10426 .       \}
10427 .    \}
10428 .    if \\n[#FOOTERS_ON]=1 \{\
10429 .       if !'\\*[$HDRFTR_CENTER_OLD]'' \{ .ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_OLD] \}
10430 .       ie \\n[#PAGINATE_TOC]=1 \{ .PAGINATE \}
10431 .       el \{ .PAGINATION OFF \}
10432 .    \}
10433 .    if \\n[#FOOTERS_WERE_ON] \{ .FOOTERS OFF \} \" But have to turn FOOTERS off again so they don't print when FINIS was called
10434 .    COLLATE
10435 .    if \\n[#FINIS] \{\
10436 .       if \\n[#FOOTERS_WERE_ON] \{ .FOOTERS \} \" Finally, turn footers on if they were on
10437 .       rr #FOOTERS_WERE_ON
10438 .       if \\n[#PAGINATION_WAS_ON] \{\
10439 .          nr #PAGINATE 1
10440 .          rr #PAGINATION_WAS_ON
10441 .       \}
10442 .       rr #FINIS
10443 .    \}
10444 .    ie \\n[#PAGINATE_TOC]=1 \{ .PAGINATE \}
10445 .    el \{ .PAGINATION OFF \}
10446 .    if \\n[#FOOTERS_ON]=1 \{\
10447 .       ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_NEW]
10448 .       rm $HDRFTR_CENTER_OLD
10449 .       rm $HDRFTR_CENTER_NEW
10450 .    \}
10451 .    rr #COLLATED_DOC
10452 .    DOCHEADER OFF
10453 .    PAGENUMBER 1
10454 .    if \\n[#PRINT_STYLE]=1 \{\
10455 .       rr #IGNORE
10456 .       DOC_LEAD 24 ADJUST
10457 .       nr #IGNORE 1
10458 .    \}
10459 .    START
10460 .    PP
10461 .    nr #COLUMNS 0
10462 .    if \\n[#PRINT_STYLE]=2 \{\
10463 .       ie r#ADJ_TOC_LEAD \{\
10464 .          nr #NO_TRAP_RESET 1
10465 .          DOC_LEAD \\n[#TOC_LEAD]u ADJUST
10466 .          rr #NO_TRAP_RESET
10467 .       \}
10468 .       el \{ .DOC_LEAD \\n[#TOC_LEAD]u \}
10469 .    \}
10470 .    sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
10471 .    if \\n[#SLANT_ON] \{\
10472 \*[SLANTX]\c
10473 .    \}
10474 .    DOC_LINE_LENGTH \\n[#DOC_L_LENGTH]u
10475 .    QUAD \\*[$TOC_HEADER_QUAD]
10476 .    PAGENUM_STYLE \\*[$TOC_PN_STYLE]
10477 .    if \\n[#PRINT_STYLE]=1 \{\
10478 .       fam C
10479 .       ft  R
10480 .       ps  12
10481 .    \}
10482 .    if \\n[#PRINT_STYLE]=2 \{\
10483 .       FAMILY  \\*[$TOC_HEADER_FAM]
10484 .       FT      \\*[$TOC_HEADER_FT]
10485 .       PT_SIZE \\n[#TOC_PS]u\\*[$TOC_HEADER_SIZE_CHANGE]
10486 .    \}
10487 .    ie \\n[#PRINT_STYLE]=1 \{\
10488 .       CAPS
10489 .       UNDERLINE
10490 .       PRINT "\\*[$TOC_HEADER_STRING]"
10491 .       UNDERLINE OFF
10492 .       CAPS      OFF
10493 .    \}
10494 .    el \{\
10495 .       PRINT "\\*[$TOC_HEADER_STRING]"
10496 .    \}
10497 .    LEFT
10498 .    SP
10499 \# In collated docs, this bit inserts the first doc's title
10500 \# underneath the TOC header, before the TOC_ENTRIES diversion
10501 \# gets output.
10502 .    nf
10503 .    if d$FIRST_DOC_TITLE \{\
10504 .    nr #RESTORE_TOC_PN_PADDING \\n[#TOC_PN_PADDING]
10505 .    TOC_PADDING \\n[#FIRST_DOC_TOC_PN_PADDING]
10506 .       if \\n[#PRINT_STYLE]=2 \{\
10507 .          FAMILY  \\*[$TOC_TITLE_FAM]
10508 .          FT      \\*[$TOC_TITLE_FT]
10509 .          PT_SIZE \\n[#TOC_PS]u\\*[$TOC_TITLE_SIZE_CHANGE]
10510 .       \}
10511 .       ie \\n[#PRINT_STYLE]=1 \{\
10512 .          PAD "\\*[$FIRST_DOC_TITLE]\\*[$TOC_PN_TYPEWRITE]" 
10513 .       \}
10514 .       el \{\
10515 .          PAD "\\h'\\n[#TOC_TITLE_INDENT]u'\\*[$FIRST_DOC_TITLE]\\*[$TOC_PN]"
10516 .       \}
10517 .       EL
10518 .       ST 100 L
10519 .       ST 101 R
10520 .       if \\n[#PRINT_STYLE]=2 \{\
10521 .          FAMILY  \\*[$TOC_PN_FAM]
10522 .          FT      \\*[$TOC_PN_FT]
10523 .          PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PN_SIZE_CHANGE]
10524 .       \}
10525 .       TAB 100
10526 .       PRINT \\*[LEADER]
10527 .       TN
10528 .       PRINT \\n[#FIRST_DOC_TITLE_PN]
10529 .       TQ
10530 .    \}
10531 .    TOC_PADDING \\n[#RESTORE_TOC_PN_PADDING]
10532 .    nf
10533 .    TOC_ENTRIES
10534 .    br
10535 .    rr #TOC
10536 .END
10537 \# ====================================================================
10539 \# +++COLUMNS+++
10541 \# COLUMNS
10542 \# -------
10543 \# *Arguments:
10544 \#   <number of columns>  <width of gutters>
10545 \# *Function:
10546 \#   Creates registers associated with setting docs in columns.
10547 \#   Calculates column line lengths and offsets
10548 \# *Notes:
10549 \#   COLUMNS, if used, s/b the last macro invoked before START.
10551 .MAC COLUMNS END
10552 .    if \\n[#IGNORE_COLUMNS]=1 \{ .return \}
10553 .    nr #COLUMNS 1
10554 .    nr #NUM_COLS \\$1
10555 .    nr #GUTTER (\\$2)
10556 .    nr #COL_L_LENGTH \\n[#L_LENGTH]-(\\n[#GUTTER]*(\\n[#NUM_COLS]-1))/\\n[#NUM_COLS]
10557 .    nr #COL_TOTAL 0 \\n[#COL_L_LENGTH]+\\n[#GUTTER]
10558 .    nr #COL_NUM 0 1
10559 .    while !\\n[#COL_NUM]=\\n[#NUM_COLS] \{\
10560 .       nr #COL_\\n+[#COL_NUM]_L_MARGIN \\n[#L_MARGIN]+\\n[#COL_TOTAL]
10561 .       nr #COL_TOTAL \\n+[#COL_TOTAL]
10562 .    \}
10563 .    rr #COL_TOTAL
10564 .    rr #COL_NUM
10565 .END
10568 \# NEXT COLUMN
10569 \# -----------
10570 \# *Arguments:
10571 \#   <none>
10572 \# *Function:
10573 \#   Breaks current column and moves to next column.
10574 \#   If current column is the last on the page, breaks
10575 \#   to a new page.
10577 .MAC COL_NEXT END
10578 .    if \\n[#COLUMNS] \{\
10579 .       nr #COL_NEXT 1
10580 .       ie '\\$0'COL_NEXT' \{ .br  \}
10581 .       el \{\
10582 .          brp
10583 .          RLD 1v
10584 .       \}
10585 .       ie \\n[#COL_NUM]=\\n[#NUM_COLS] \{\
10586 .          bp
10587 .       \}
10588 .       el \{ .FOOTER \}
10589 .    \}
10590 .END
10592 \# ====================================================================
10594 \# +++DOCUMENT PROCESSING MISC AND SUPPORT MACROS+++
10596 \# COLLATE
10597 \# -------
10598 \# *Arguments:
10599 \#   <none>
10600 \# *Function:
10601 \#   Turns headers off (if on) and saves header state, sets register
10602 \#   #COLLATE to 1 (toggle), and breaks to a new page.
10603 \# *Notes:
10604 \#   COLLATE exists primarily to allow putting multiple chapters in
10605 \#   a single file, although it can be used for any document type.  After
10606 \#   COLLATE, any of the macros that normally precede START may be
10607 \#   used, and should behave as expected.
10609 \#   N.B.--the START macro *must* be used after COLLATE (and any other
10610 \#   macros that alter mom's behaviour).
10612 .MAC COLLATE END
10613 .    nr #COLLATE 1
10614 .    nr #HEADER_STATE \\n[#HEADERS_ON]
10615 .    HEADERS OFF
10616 .    if \\n[#PAGE_NUM_V_POS]=1 \{\
10617 .       nr #PAGINATION_STATE \\n[#PAGINATE]
10618 .       PAGINATION OFF
10619 .    \}
10620 .    IQ CLEAR
10621 .    TQ
10622 \# Collect first doc's title for TOC
10623 .    if \\n[#COLLATED_DOC]=0 \{\
10624 .       ie \\n[#USER_SET_TITLE_ITEM] \{\
10625 .          ds $FIRST_DOC_TITLE \\*[$USER_SET_TITLE_ITEM]\\|
10626 .          rr #USER_SET_TITLE_ITEM
10627 .          rm $USER_SET_TITLE_ITEM
10628 .       \}
10629 .       el \{\
10630 .          ie \\n[#DOC_TYPE]=2 \{\
10631 .             ie '\\*[$CHAPTER_TITLE]'' \{\
10632 .                ds $FIRST_DOC_TITLE \\*[$CHAPTER_STRING] \\*[$CHAPTER]\\|
10633 .             \}
10634 .             el \{\
10635 .                ie '\\*[$CHAPTER]'' \{\
10636 .                   ds $FIRST_DOC_TITLE \\*[$CHAPTER_TITLE]\\|
10637 .                \}
10638 .                el \{\
10639 .                   ds $FIRST_DOC_TITLE \\*[$CHAPTER_STRING] \\*[$CHAPTER]: \\*[$CHAPTER_TITLE]\\|
10640 .                \}
10641 .             \}
10642 .          \}
10643 .          el \{\
10644 .             ds $FIRST_DOC_TITLE \\*[$TITLE]\\|
10645 .          \}
10646 .       \}
10647 .       if \\n[#TOC_AUTHORS]=1 \{\
10648 .          ie '\\*[$TOC_AUTHORS]'' \{\
10649 .             as $FIRST_DOC_TITLE /\\|\\*[$AUTHOR_1]\\|
10650 .          \}
10651 .          el \{\
10652 .             as $FIRST_DOC_TITLE /\\|\\*[$TOC_AUTHORS]\\|
10653 .             rm $TOC_AUTHORS
10654 .          \}
10655 .       \}
10656 .       nr #COLLATED_DOC 1
10657 .    \}
10658 \# End title collection for TOC
10659 .    LL \\n[#DOC_L_LENGTH]u
10660 .    QUAD $DOC_QUAD
10661 .    LS \\n[#DOC_LEAD]u
10662 \*[SLANTX]
10663 \*[CONDX]
10664 \*[EXTX]
10665 '    NEWPAGE
10666 .    if \\n[#DEFER_PAGINATION] \{ .PAGINATE \}
10667 .    if !'\\*[$RESTORE_PAGENUM_STYLE]'' \{\
10668 .       PAGENUM_STYLE \\*[$RESTORE_PAGENUM_STYLE]
10669 .       rm $RESTORE_PAGENUM_STYLE
10670 .    \}
10671 .    rm $EN_TITLE
10672 .END
10675 \# OUTPUT BLANK PAGES
10676 \# ------------------
10677 \# *Argument:
10678 \#   <number of blank pages to output>
10679 \# *Function:
10680 \#   Outputs blank pages.
10681 \# *Notes:
10682 \#   If recto/verso, each page is recto/verso, even if there's
10683 \#   nothing on it.
10685 .MAC BLANKPAGE END
10686 .    nr #HOW_MANY \\$1
10687 .    nr #PAGES 0 1
10688 .    while \\n+[#PAGES]<=\\n[#HOW_MANY] \{\
10689 .    if \\n[#HEADERS_ON]=1 \{\
10690 .       nr #HEADERS_WERE_ON 1
10691 .       HEADERS OFF
10692 .    \}
10693 .    if \\n[#PAGE_NUM_V_POS]=1 \{\
10694 .       if \\n[#PAGINATE]=1 \{ .nr #PAGINATE_WAS_ON 1 \}
10695 .       PAGINATION OFF
10696 .    \}
10697 .    NEWPAGE
10698 .    PRINT \&
10699 .    if \\n[#FOOTERS_ON]=1 \{\
10700 .       nr #FOOTERS_WERE_ON 1
10701 .       FOOTERS OFF
10702 .    \}
10703 .    if \\n[#PAGE_NUM_V_POS]=2 \{\
10704 .       if \\n[#PAGINATE]=1 \{ .nr #PAGINATE_WAS_ON 1 \}
10705 .       PAGINATION OFF
10706 .    \}
10707 .    if \\n[#HEADERS_WERE_ON] \{ .HEADERS \}
10708 .    if \\n[#PAGE_NUM_V_POS]=1 \{\
10709 .       if \\n[#PAGINATE_WAS_ON] \{ .PAGINATE \}
10710 .    \}
10711 .    \}
10712 .    NEWPAGE
10713 .    if \\n[#FOOTERS_WERE_ON] \{ .FOOTERS \}
10714 .    if \\n[#PAGE_NUM_V_POS]=2 \{\
10715 .       if \\n[#PAGINATE_WAS_ON] \{ .PAGINATE \}
10716 .     \}
10717 .    rr #HEADERS_WERE_ON
10718 .    rr #FOOTERS_WERE_ON
10719 .    rr #PAGINATE_WAS_ON
10720 .END
10723 \# SET TRAPS FOR HEADERS/FOOTERS/FOOTNOTES
10724 \# ---------------------------------------
10725 \# *Arguments:
10726 \#   <none>
10727 \# *Function:
10728 \#   Sets header/footer/footnotes/etc... traps.
10729 \#     Calculates the number of lines that actually fit on a
10730 \#   page based on #B_MARGIN and resets page bottom trap to coincide
10731 \#   with the depth of that number of lines , or, if #ADJ_DOC_LEAD=1,
10732 \#   adjusts #DOC_LEAD so that the last line of text on a page falls
10733 \#   exactly on #B_MARGIN.
10735 .MAC TRAPS END
10736 \#  *Remove all header/footer traps
10737 .    if !\\n[#NO_TRAP_RESET] \{\
10738 .       ch DO_T_MARGIN
10739 .       ch DO_B_MARGIN
10740 .       ch HEADER
10741 .       ch FOOTER
10742 \#  *Plant header trap
10743 .       wh 0 HEADER
10744 .    \}
10745 \#  *Adjust lead so last line of text falls on B_MARGIN,...
10746 .    ie \\n[#ADJ_DOC_LEAD]=1 \{\
10747 .       nr #LINES_PER_PAGE 0 1
10748 .       nr #DOC_LEAD_ADJ 0 1
10749 .       nr #DEPTH_TO_B_MARGIN \\n[#PAGE_LENGTH]-\\n[#B_MARGIN]-1v
10750 .       while \\n[#T_MARGIN]+(\\n[#DOC_LEAD]*\\n+[#LINES_PER_PAGE])<\\n[#DEPTH_TO_B_MARGIN] \{ . \}
10751 .       nr #LINES_PER_PAGE -1
10752 .       while \\n[#T_MARGIN]+(\\n[#DOC_LEAD]+\\n+[#DOC_LEAD_ADJ]*\\n[#LINES_PER_PAGE])<\\n[#DEPTH_TO_B_MARGIN] \{ . \}
10753 .       DOC_LEAD \\n[#DOC_LEAD]u+\\n[#DOC_LEAD_ADJ]u
10754 .    \}
10755 \#  *...or calculate new B_MARGIN based on # of lines (at #DOC_LEAD) that fit
10756 \#  *on the page.
10757 .    el \{\
10758 .       nr #LINES_PER_PAGE 0 1
10759 .       nr #DEPTH_TO_B_MARGIN \\n[#PAGE_LENGTH]-\\n[#B_MARGIN]-1v
10760 .       while \\n[#T_MARGIN]+(\\n[#DOC_LEAD]*\\n+[#LINES_PER_PAGE])<\\n[#DEPTH_TO_B_MARGIN] \{ . \}
10761 .       nr #B_MARGIN \\n[#PAGE_LENGTH]-(\\n[#T_MARGIN]+(\\n[#DOC_LEAD]*\\n[#LINES_PER_PAGE]))
10762 .    \}
10763 \#  *Set footer and footnote overflow traps
10764 .    if !\\n[#NO_TRAP_RESET] \{\
10765 .       nr #FN_COUNT 0 1
10766 .       nr #SPACE_REMAINING 0
10767 .       nr #FN_DEPTH 0
10768 .       nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]u
10769 .       wh 12i FOOTER
10770 .       wh -\\n[#B_MARGIN]u FN_OVERFLOW_TRAP
10771 .       ch FOOTER -\\n[#B_MARGIN]u
10772 .    \}
10773 .    rr #ADJ_DOC_LEAD
10774 .END
10777 \# CHECK INDENT
10778 \# ------------
10779 \# *Arguments:
10780 \#   <none>
10781 \# *Function:
10782 \#   Adds left, right, or both indent values to document elements
10783 \#   like heads and subheads that are processed in environments.
10785 .MAC CHECK_INDENT END
10786 .    if \\n[#INDENT_LEFT_ACTIVE] \{\
10787 .       in \\n[#L_INDENT]u
10788 .       if \\n[#QUOTE] \{\
10789 .          in -\\n[#L_INDENT]u \"Because you added an indent in 2nd line of macro
10790 .          ll -\\n[#L_INDENT]u
10791 .          ta \\n(.lu
10792 .       \}
10793 .       if \\n[#EPIGRAPH] \{\
10794 .          in -\\n[#L_INDENT]u
10795 .          ll -\\n[#L_INDENT]u
10796 .          ta \\n(.lu
10797 .       \}
10798 .    \}
10799 .    if \\n[#INDENT_RIGHT_ACTIVE] \{\
10800 .       ll -\\n[#R_INDENT]u
10801 .       ta \\n(.lu
10802 .    \}
10803 .    if \\n[#INDENT_BOTH_ACTIVE] \{\
10804 .       in \\n[#BL_INDENT]u
10805 .       ll -\\n[#BR_INDENT]u
10806 .       ta \\n(.lu
10807 .       if \\n[#QUOTE] \{\
10808 .          in -\\n[#BL_INDENT]u
10809 .          ie \\n[#BR_INDENT]=\\n[#BL_INDENT] \{\
10810 .             ll -\\n[#BR_INDENT]u
10811 .             ta \\n(.lu
10812 .          \}
10813 .          el \{\
10814 .             ll -(\\n[#BR_INDENT]u/2u)
10815 .             ta \\n(.lu
10816 .          \}
10817 .       \}
10818 .       if \\n[#EPIGRAPH] \{\
10819 .          in -\\n[#BL_INDENT]u
10820 .          ie \\n[#BR_INDENT]=\\n[#BL_INDENT] \{\
10821 .             ll -\\n[#BR_INDENT]u
10822 .             ta \\n(.lu
10823 .          \}
10824 .          el \{\
10825 .             ll -(\\n[#BR_INDENT]u/2u)
10826 .             ta \\n(.lu
10827 .          \}
10828 .       \}
10829 .    \}
10830 .END
10833 \# REMOVE INDENT
10834 \# -------------
10835 \# *Arguments:
10836 \#   <none>
10837 \# *Function:
10838 \#   Removes left, right, or both indent values from document elements
10839 \#   like heads and subheads that are processed in environments.
10841 .MAC REMOVE_INDENT END
10842 .    in 0
10843 .    ll \\n[#L_LENGTH]u
10844 .    ta \\n(.lu
10845 .END
10848 \# ====================================================================
10850 \# +++DOCUMENT PROCESSING ALIASES+++
10852 \# Aliases to make life easier for users: synonyms, short forms
10853 \# and alternate spellings.
10855 \# Macros
10856 \# ------
10857 .ALIAS   BREAK_BLOCKQUOTE                BREAK_QUOTE
10858 .ALIAS   BREAK_CITATION                  BREAK_QUOTE
10859 .ALIAS   BREAK_CITE                      BREAK_QUOTE
10860 .ALIAS   CITATION                        BLOCKQUOTE
10861 .ALIAS   CITE                            BLOCKQUOTE
10862 .ALIAS   DOC_R_MARGIN                    DOC_RIGHT_MARGIN
10863 .ALIAS   DOC_L_MARGIN                    DOC_LEFT_MARGIN
10864 .ALIAS   DOC_L_LENGTH                    DOC_LINE_LENGTH
10865 .ALIAS   DOC_RMARGIN                     DOC_RIGHT_MARGIN
10866 .ALIAS   DOC_LMARGIN                     DOC_LEFT_MARGIN
10867 .ALIAS   DOC_LLENGTH                     DOC_LINE_LENGTH
10868 .ALIAS   DOC_FAM                         DOC_FAMILY
10869 .ALIAS   FILL                            QUAD
10870 .ALIAS   PP_FT                           PP_FONT
10871 .ALIAS   DOC_PS                          DOC_PT_SIZE
10872 .ALIAS   DOC_LS                          DOC_LEAD
10873 .ALIAS   PAGENUM                         PAGENUMBER
10874 .ALIAS   PAGINATION                      PAGINATE
10875 .ALIAS   TOC_FAM                         TOC_FAM
10876 .ALIAS   TOC_PS                          TOC_PT_SIZE
10878 \# HEADER and FOOTER aliases for HDRFTR macros.
10880 .ALIAS   ENDNOTES_HEADER_CENTER          ENDNOTES_HDRFTR_CENTER
10881 .ALIAS   HEADER_FAMILY                   HDRFTR_FAMILY
10882 .ALIAS   HEADER_FAM                      HDRFTR_FAMILY
10883 .ALIAS   HEADER_SIZE                     HDRFTR_SIZE
10884 .ALIAS   HEADER_PLAIN                    HDRFTR_PLAIN
10885 .ALIAS   HEADER_RULE_GAP                 HDRFTR_RULE_GAP
10886 .ALIAS   HEADER_RULE                     HDRFTR_RULE
10887 .ALIAS   HEADER_LEFT                     HDRFTR_LEFT
10888 .ALIAS   HEADER_LEFT_FAMILY              HDRFTR_LEFT_FAMILY
10889 .ALIAS   HEADER_LEFT_FAM                 HDRFTR_LEFT_FAMILY
10890 .ALIAS   HEADER_LEFT_FONT                HDRFTR_LEFT_FONT
10891 .ALIAS   HEADER_LEFT_FT                  HDRFTR_LEFT_FONT
10892 .ALIAS   HEADER_LEFT_SIZE                HDRFTR_LEFT_SIZE
10893 .ALIAS   HEADER_LEFT_PS                  HDRFTR_LEFT_SIZE
10894 .ALIAS   HEADER_LEFT_CAPS                HDRFTR_LEFT_CAPS
10895 .ALIAS   HEADER_CENTER                   HDRFTR_CENTER
10896 .ALIAS   HEADER_CENTRE                   HDRFTR_CENTER
10897 .ALIAS   HEADER_CENTER_FAMILY            HDRFTR_CENTER_FAMILY
10898 .ALIAS   HEADER_CENTRE_FAMILY            HDRFTR_CENTER_FAMILY
10899 .ALIAS   HEADER_CENTER_FAM               HDRFTR_CENTER_FAMILY
10900 .ALIAS   HEADER_CENTRE_FAM               HDRFTR_CENTER_FAMILY
10901 .ALIAS   HEADER_CENTER_FONT              HDRFTR_CENTER_FONT
10902 .ALIAS   HEADER_CENTRE_FONT              HDRFTR_CENTER_FONT
10903 .ALIAS   HEADER_CENTER_FT                HDRFTR_CENTER_FONT
10904 .ALIAS   HEADER_CENTRE_FT                HDRFTR_CENTER_FONT
10905 .ALIAS   HEADER_CENTER_SIZE              HDRFTR_CENTER_SIZE
10906 .ALIAS   HEADER_CENTRE_SIZE              HDRFTR_CENTER_SIZE
10907 .ALIAS   HEADER_CENTER_PS                HDRFTR_CENTER_SIZE
10908 .ALIAS   HEADER_CENTRE_PS                HDRFTR_CENTER_SIZE
10909 .ALIAS   HEADER_CENTER_PAD               HDRFTR_CENTER_PAD
10910 .ALIAS   HEADER_CENTRE_PAD               HDRFTR_CENTER_PAD
10911 .ALIAS   HEADER_CENTER_CAPS              HDRFTR_CENTER_CAPS
10912 .ALIAS   HEADER_CENTRE_CAPS              HDRFTR_CENTER_CAPS
10913 .ALIAS   HEADER_RIGHT                    HDRFTR_RIGHT
10914 .ALIAS   HEADER_RIGHT_FAMILY             HDRFTR_RIGHT_FAMILY
10915 .ALIAS   HEADER_RIGHT_FAM                HDRFTR_RIGHT_FAMILY
10916 .ALIAS   HEADER_RIGHT_FONT               HDRFTR_RIGHT_FONT
10917 .ALIAS   HEADER_RIGHT_FT                 HDRFTR_RIGHT_FONT
10918 .ALIAS   HEADER_RIGHT_SIZE               HDRFTR_RIGHT_SIZE
10919 .ALIAS   HEADER_RIGHT_PS                 HDRFTR_RIGHT_SIZE
10920 .ALIAS   HEADER_RIGHT_CAPS               HDRFTR_RIGHT_CAPS
10921 .ALIAS   HEADER_RECTO                    HDRFTR_RECTO
10922 .ALIAS   HEADER_VERSO                    HDRFTR_VERSO
10923 .ALIAS   ENDNOTES_FOOTER_CENTER          ENDNOTES_HDRFTR_CENTER
10924 .ALIAS   FOOTER_FAMILY                   HDRFTR_FAMILY
10925 .ALIAS   FOOTER_FAM                      HDRFTR_FAMILY
10926 .ALIAS   FOOTER_SIZE                     HDRFTR_SIZE
10927 .ALIAS   FOOTER_PLAIN                    HDRFTR_PLAIN
10928 .ALIAS   FOOTER_RULE_GAP                 HDRFTR_RULE_GAP
10929 .ALIAS   FOOTER_RULE                     HDRFTR_RULE
10930 .ALIAS   FOOTER_LEFT                     HDRFTR_LEFT
10931 .ALIAS   FOOTER_LEFT_FAMILY              HDRFTR_LEFT_FAMILY
10932 .ALIAS   FOOTER_LEFT_FAM                 HDRFTR_LEFT_FAMILY
10933 .ALIAS   FOOTER_LEFT_FONT                HDRFTR_LEFT_FONT
10934 .ALIAS   FOOTER_LEFT_FT                  HDRFTR_LEFT_FONT
10935 .ALIAS   FOOTER_LEFT_SIZE                HDRFTR_LEFT_SIZE
10936 .ALIAS   FOOTER_LEFT_PS                  HDRFTR_LEFT_SIZE
10937 .ALIAS   FOOTER_LEFT_CAPS                HDRFTR_LEFT_CAPS
10938 .ALIAS   FOOTER_CENTER                   HDRFTR_CENTER
10939 .ALIAS   FOOTER_CENTRE                   HDRFTR_CENTER
10940 .ALIAS   FOOTER_CENTER_FAMILY            HDRFTR_CENTER_FAMILY
10941 .ALIAS   FOOTER_CENTRE_FAMILY            HDRFTR_CENTER_FAMILY
10942 .ALIAS   FOOTER_CENTER_FAM               HDRFTR_CENTER_FAMILY
10943 .ALIAS   FOOTER_CENTRE_FAM               HDRFTR_CENTER_FAMILY
10944 .ALIAS   FOOTER_CENTER_FONT              HDRFTR_CENTER_FONT
10945 .ALIAS   FOOTER_CENTRE_FONT              HDRFTR_CENTER_FONT
10946 .ALIAS   FOOTER_CENTER_FT                HDRFTR_CENTER_FONT
10947 .ALIAS   FOOTER_CENTRE_FT                HDRFTR_CENTER_FONT
10948 .ALIAS   FOOTER_CENTER_SIZE              HDRFTR_CENTER_SIZE
10949 .ALIAS   FOOTER_CENTRE_SIZE              HDRFTR_CENTER_SIZE
10950 .ALIAS   FOOTER_CENTER_PAD               HDRFTR_CENTER_PAD
10951 .ALIAS   FOOTER_CENTRE_PAD               HDRFTR_CENTER_PAD
10952 .ALIAS   FOOTER_CENTER_PS                HDRFTR_CENTER_SIZE
10953 .ALIAS   FOOTER_CENTRE_PS                HDRFTR_CENTER_SIZE
10954 .ALIAS   FOOTER_CENTER_CAPS              HDRFTR_CENTER_CAPS
10955 .ALIAS   FOOTER_CENTRE_CAPS              HDRFTR_CENTER_CAPS
10956 .ALIAS   FOOTER_RIGHT                    HDRFTR_RIGHT
10957 .ALIAS   FOOTER_RIGHT_FAMILY             HDRFTR_RIGHT_FAMILY
10958 .ALIAS   FOOTER_RIGHT_FAM                HDRFTR_RIGHT_FAMILY
10959 .ALIAS   FOOTER_RIGHT_FONT               HDRFTR_RIGHT_FONT
10960 .ALIAS   FOOTER_RIGHT_FT                 HDRFTR_RIGHT_FONT
10961 .ALIAS   FOOTER_RIGHT_SIZE               HDRFTR_RIGHT_SIZE
10962 .ALIAS   FOOTER_RIGHT_PS                 HDRFTR_RIGHT_SIZE
10963 .ALIAS   FOOTER_RIGHT_CAPS               HDRFTR_RIGHT_CAPS
10964 .ALIAS   FOOTER_RECTO                    HDRFTR_RECTO
10965 .ALIAS   FOOTER_VERSO                    HDRFTR_VERSO
10966 .ALIAS   SWITCH_HEADERS                  SWITCH_HDRFTR
10967 .ALIAS   SWITCH_FOOTERS                  SWITCH_HDRFTR
10969 \# Support aliases
10971 .ALIAS   COL_BREAK                       COL_NEXT
10972 .ALIAS   PRINT_FOOTNOTE_RULE             FOOTNOTE_RULE