xref: /original-bsd/share/tmac/tmac.doc.old (revision c3e32dec)

Copyright (c) 1990, 1993
The Regents of the University of California. All rights reserved.

%sccs.include.redist.man%

@(#)tmac.doc.old 8.1 (Berkeley) 06/08/93

Assume nroff on crt's only if cR==1
STRING CONSTANTS
DITROFF
Address Style
Argument Reference Style
Interactive Comand Modifier (flag)
Emphasis (in the English sense - usually italics)
Errno Style
Environment Variable Style
Command Line Flag Style
Header String Style
Interactive Command Style
Literal Style
Left Parenthesis Style
Right Parenthesis Style
Options Open Bracket Style
Options Open Bracket Style
Name (subject of manpage) Style
Pathname Style
Accepted punctuation string for -mdoc syntax
Section Header Style
.ds sT \s-2
Symbolic Emphasis (boldface)
Generic Variable Style
Volume Title Style
Cross Reference STyle (man page only)
Math *
.tr *\(** .\} NROFF
Address Style
Argument Reference Style
Interactive Command Modifier (flag)
Emphasis (in the English sense - usually italics)
Errno Style
Environment Variable Style
Command Line Flag Style
Header String Style
Interactive Command Style
Literal Style
Left Parenthesis Style
Right Parenthesis Style
Options Open Bracket Style
Options Open Bracket Style
Name (subject of manpage) Style
Pathname Style
Accepted punctuation string for -mdoc syntax
Section Header Style
.ds sT \s-2
.ds sT \s-2
Symbol, Mode or Mask Style
Generic Variable Style
Volume Title Style
Cross Reference Style (man page only)
.\} INDENTS - Subheaders(sI), Text(Ti) between Section Headers and Subsects
. nr sI \w','u*5 . nr Ti \n(sIu .\} . nr sI .5i . nr Ti .5i .\} Flags for macros names which are used only for .Ds
.nr dI 6n .nr dC 1 .nr dL 1 .nr dR 1 INDENT WIDTHS (for Lists)
Width Needed for Address Tag (indented amount)
.nr Ad 12n Angle Quote Width
.nr Aq 12n Width Needed for Argument
.nr Ar 12n Width Needed for Column offset
.nr Cl 15n Width neeeded for Interactive Command Modifier
.nr Cm 10n Width Needed for Complex Expressions
.nr Cx 20n Indent Width Needed for Display (right and left margins)
.nr Ds 6n Double Quote Width
.nr Dq 12n tI is dependent on Ds and used by .Dp
.nr tI \n(Dsu Width Needed for Display
.nr Em 10n Width Needed for Errno Types
.nr Er 15n Width Needed for Environment Variables
.nr Ev 15n Width Needed for Example Indent
.nr Ex 10n Width Needed for Flag
.nr Fl 10n Width Needed for Function
.nr Fn 16n Width neeeded for Interactive Command Name
.nr Ic 10n Width Needed for Constant
.nr Li 16n Width Needed for Math Symbol ? not sure if needed
.nr Ms 6n Width Needed for Name
.nr Nm 10n Width Needed for Option Begin
.nr Ob 14n Width Needed for Option End
.nr Oe 14n Width Needed for Option (one line)
.nr Op 14n Width Needed for Pathname
.nr Pa 32n Parenthesis Quote Width
.nr Pq 12n Single Quote Width
.nr Sq 12n Width Needed for Symbols, Modes or Masks
.nr Sy 6n Width needed for default or unknown text width
.nr Tx 22n Width Needed for Generic Variable
.nr Va 12n Width Needed for Cross Reference, should the cross ref be annotated.
.nr Xr 10n PARAGRAPH SPACE
. nr Pp .5v .\} . nr Pp 1v .\} PAGE LAYOUT
.Li Tagged Paragraph Style - zero if break on oversized tag
one if add em space and continue filling line.
.nr tP 0 Page Layout Macro
DITROFF
Header Margin
. nr Hm .5i Footer Margin
. nr Fm .5i Line length
. nr ll 5.5i Line length
. ll 5.5i Title length
. nr lt 5.5i Title length
. lt 5.5i Page offset
. nr po 1.56i Page offset
. po 1.56i Vertical space distance (from Section headers/Lists/Subsections)
. nr vV .5v em space
. ds tP \|\|\|\|\|\| .\} Line length
. nr ll 78n . ll 78n Title length
. nr lt 78n Title length
. lt 78n Page offset
. nr po 0i Page offset
. po 0i Vertical space distance (from Section headers/Lists/Subsections)
. nr vV 1v em space
. ds tP \0\0 Test for crt
. ie \\n(cR .nr Hm 0 . el .nr Hm .5i Footer Margin
. nr Fm .5i .\} .. Adjustment mode
.. .\} PREDEFINED STRINGS
. ds <= \(<= . ds >= \(>= . ds Lq `` . ds Rq '' . ds ua \(ua . ds aa \(aa . ds ga \(ga . ds sR \(aa . ds sL \(ga .\} . ds <= <= . ds >= >= . ds Rq '' . ds Lq `` . ds ua ^ . ds aa ' . ds ga ` . ds sL ` . ds sR ' .\} Note: The distances from the bottom or top of the page are set
in headers (macro .hK): to -1.25 for troff, and -1.167 for nroff
bottoms, and top is 0.

.Dt Document/manpage_title section/chapter volume
The \{ and \} is necessary as roff doesn't nest if-elses
properly, especially with .ds.
TODO: separate Dt into Dt, Ch and Vt for supp docs.
Volume and Section Number or Chapter Number
. ds cH \\$2 . if "\\$3"" \{\ . \" Volume Title if none given . if \\$2>=1 .if \\$2<=8 \{\ . ds vT UNIX Reference Manual . if \\$2>1 .if \\$2<6 .ds vT UNIX Programmer's Manual . if "\\$2"8" .ds vT UNIX System Manager's Manual . \} . if "\\$2"unass" .ds vT DRAFT . if "\\$2"draft" .ds vT DRAFT . if "\\$2"paper" .ds vT Null . \} .\} . \" Volume Title if given . if "\\$3"USD" .ds vT UNIX User's Supplementary Documents . if "\\$3"PS1" .ds vT UNIX Programmers's Supplementary Documents . if "\\$3"AMD" .ds vT UNIX Ancestral Manual Documents . if "\\$3"SMM" .ds vT UNIX System Manager's Manual . if "\\$3"URM" .ds vT UNIX Reference Manual . if "\\$3"PRM" .ds vT UNIX Programmers's Manual . if "\\$3"IND" .ds vT UNIX Manual Master Index . if "\\$3"CON" .ds vT UNIX Contributed Software Manual . if "\\$3"IMP" .ds vT UNIX Implementation Notes . if "\\$3"HOW" .ds vT UNIX How Pocket Manual . if "\\$3"LOCAL" .ds vT UNIX Local Manual . if "\\*(vT"Local" .ds vT \\$3 .\} ..
.Os Operating System/Standard and Release or Version Number

. ds oS BSD Experimental . ds oS (Bag o' Bits)
.\} . ds o1 Non-Null .\} . ds oS AT&T . if "\\$2"" .as oS \0UNIX . if "\\$2"7th" .as oS \07th Edition . if "\\$2"7" .as oS \07th Edition . if "\\$2"III" .as oS \0System III . if "\\$2"3" .as oS \0System III . if "\\$2"V" .as oS \0System V . if "\\$2"V.2" .as oS \0System V Release 2 . if "\\$2"V.3" .as oS \0System V Release 3 . if "\\$2"V.4" .as oS \0System V Release 4 .\} . if "\\$2"3" .ds oS 3rd Berkeley Distribution . if "\\$2"4" .ds oS 4th Berkeley Distribution . if "\\$2"4.1" .ds oS 4.1 Berkeley Distribution . if "\\$2"4.2" .ds oS 4.2 Berkeley Distribution . if "\\$2"4.3" .ds oS 4.3 Berkeley Distribution . if "\\$2"4.3+" .ds oS 4.3+tahoe Berkeley Distribution .\} ..
Standards

.de St
.ds sT Null
.if "\\$1"POSIX" \{\
. ds sT IEEE Standard POSIX
. if \\$2 .as sT \0\\$2
.\}
.if "\\$1"ANSI" \{\
. ds sT ANSI Standard
. if \\$2 .as sT \0\\$2
.\}
.if "\\$1"ISO" \{\
. ds sT ISO Standard
. if \\$2 .as sT \0\\$2
.\}
.if "\\*(sT"Null" .ds sR \\$3
..

.de Gp
.ie !"\\$1"" .ds gP \\$1 \\$2 \\$3 \\$4 \\$5
.el .ds gP Null
..


.nr aa 0 . ie \\n(.$<4 \{\ . ds dD \\$1 \\$2 \\$3 . \} . el .tm Usage: .Dd Month Day, Year (e.g July 4, 1977). .\} . ds dD Epoch .\} ..
House Keeping Macro - Make sense of dT, cH, vT, sT, gP and dS
TODO: Try to get else's for efficiency
TODO: GET RID OF .wh -1.167i (its in v7)


.nr % 1 . ie !"\\*(gP"Null" .as hT \|(\|\\*(cH\\*(gP\|) . el .as hT \\|(\\|\\*(cH\\|) .\} . wh 0 hM . wh -1.25i fM .\} . ie \\n(cR \{\ . hM . wh -0v fM . \} . el \{\ . wh 0 hM . wh -1.167i fM . \} .\} . if \\n(nl==0:\\n(nl==-1 'bp .\} .em lM .. Header Macro

.ev 1 .pL .tl @\\*(Hs\\*(hT
@\\*(Vs\\*(vT@\\*(Hs\\*(hT@ 'sp \\n(Hmu .ev ..
.ev 1 .pL ' sp \\n(Fmu . tl @\\*(Hs\\*(oS@\\*(Vs\\*(dD@%@ ' bp .\} . tl @\\*(Hs\\*(oS@\\*(Vs\\*(dD@%@
' bp
.\} .ev .. .fl . fM . pl \\n(nlu .\} .. .ns ..

p .. .tm Not a -mdoc command: .LP .. .tm Not a -mdoc command: .PP .. .tm Not a -mdoc command: .pp .. .tm Not a -mdoc command: .Co .. .nr z. 1 .nr z, 1 .nr z: 1 .nr z; 1 .nr z) 1 .nr z( 1 .nr z[ 1 .nr z] 1 This is disgusting, troff not parse if stmt properly
.nr z1 0 .nr z2 0 .nr z3 0 .nr z4 0 .nr z5 0 .nr z6 0 .nr z7 0 .nr z8 0 .nr z9 0 .nr z0 0 .nr z# 0
. tm Usage: .Ad address [...] \\*(Pu .\} . ds sV \\*(aD . nr cF \\n(.f . ie "\\*(iM"" .ds f1 \\*(sV . el .as f1 \\*(sV . nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF .\} ..
Command Line Argument Macro

. ie !"\\*(iM"" .as f1 [\|\\*(aRfile ...\|] . el [\|\\*(aRfile ...\|] .\} . ds sV \\*(aR . nr cF \\n(.f . ie "\\*(iM"" .ds f1 \\*(sV . el .as f1 \\*(sV . nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF .\} ..
. tm Usage: .Em text ... \\*(Pu .\} . ds sV \\*(eM . nr cF \\n(.f . ie "\\*(iM"" .ds f1 \\*(sV . el .as f1 \\*(sV . nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF .\} ..
. tm Usage: .Er ERRNOTYPE ... \\*(Pu . \} . ds sV \\*(eR . nr cF \\n(.f . ie "\\*(iM"" .ds f1 \\*(sV . el .as f1 \\*(sV . nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF .\} ..
. tm Usage: .Ev ENVIRONMENT_VARIABLE(s) ... \\*(Pu . \} . ds sV \\*(eV . nr cF \\n(.f . ie "\\*(iM"" .ds f1 \\*(sV . el .as f1 \\*(sV . nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF .\} ..
Flag Name Macro

. ie !"\\*(iM"" .as f1 \\*(fL- . el \\*(fL- .\} . nr rZ 0 . sW \\$1 . if (\\n(sW==1&\\n(.$==1) .rZ \\$1 . ds sV \\*(fL . nr cF \\n(.f . ie \\n(rZ \{\ . ie "\\*(iM"" .ds f1 \\*(sV-\f\\n(cF\\$1 . el \\*(sV-\f\\n(cF\\$1 . \} . el \{\ . ie "\\*(iM"" .ds f1 \\*(sV . el .as f1 \\*(sV . fB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF . \} .\} .. Interactive Commands Macro

. tm Usage: .Ic Interactive Commands(s) ... \\*(Pu .\} . ds sV \\*(iC . nr cF \\n(.f . ie "\\*(iM"" .ds f1 \\*(sV . el .as f1 \\*(sV . nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF .\} ..
Interactive Command Modifiers (flags)

. tm Usage: .Cm Interactive Command Modifier(s) ... \\*(Pu .\} . ds sV \\*(cM . nr cF \\n(.f . ie "\\*(iM"" .ds f1 \\*(sV . el .as f1 \\*(sV . nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF .\} ..
. tm Usage: .Li literal ... \\*(Pu . \} . ds sV \\*(lI . nr cF \\n(.f . ie "\\*(iM"" .ds f1 \\*(sV . el .as f1 \\*(sV . nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF .\} .. If in nroff or any other case where the default font
is constant width, and literal means zilch, single quote instead.
. ie \\n(.$==0 \{\ . tm Usage: .Ql literal ... \\*(Pu . \} . el \{\ . Sq \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . \} .. .\} . ie \\n(.$==0 \{\ . tm Usage: .Ql literal ... \\*(Pu . \} . el \{\ . Li \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . \} .. .\}
. if "\\*(n1"" .tm Usage: .Nm Name(s) ... \\*(Pu . ie !"\\*(iM"" .as f1 \\*(nM\\*(n1\\$1 . el \\*(nM\\*(n1\\$1 .\} . ds sV \\*(nM . nr cF \\n(.f . if \\n(nS \{\ . rs . in -\\n(iSu . ie \\n(nS>1 .br . el \{\ . sW \\$1 . nr iS ((\\n(sW+1)*\\n(fW)u . \} . in +\\n(iSu . ti -\\n(iSu . nr nS \\n(nS+1 . \} . if "\\*(n1"" .ds n1 \\$1 . ie "\\*(iM"" .ds f1 \\*(sV . el .as f1 \\*(sV . nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF .\} ..
\\*(pA~ .\} . ds sV \\*(pA . nr cF \\n(.f . ie "\\*(iM"" .ds f1 \\*(sV . el .as f1 \\*(sV . nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF .\} ..
. tm Usage: .Sy Symbolic Text ... \\*(Pu . \} . ds sV \\*(sY . nr cF \\n(.f . ie "\\*(iM"" .ds f1 \\*(sV . el .as f1 \\*(sV . nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF .\} ..
. tm Usage: .Ms Math Symbol ... \\*(Pu . \} . ds sV \\*(sY . nr cF \\n(.f . ie "\\*(iM"" .ds f1 \\*(sV . el .as f1 \\*(sV . nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF .\} ..
. tm Usage: .Va variable_name(s) ... \\*(Pu .\} . ds sV \\*(vA . nr cF \\n(.f . ie "\\*(iM"" .ds f1 \\*(sV . el .as f1 \\*(sV . nB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF .\} ..
. rZ \\$1 . ie \\n(rZ .as f1 \f\\n(cF\\$1 . el .as f1 \\$1 . rZ \\$2 . if !\\n(rZ \{\ . ie !"\\*(iM""\{\ I surrender
. if "\\*(iM"Tp" .as f1 \ \& . if "\\*(iM"Dp" .as f1 \ \& . if "\\*(iM"Op" .as f1 \ \& . if "\\*(iM"Cx" .as f1 \ \& . if "\\*(iM"Dq" .as f1 \& . if "\\*(iM"Sq" .as f1 \& . if "\\*(iM"Pq" .as f1 \& . if "\\*(iM"Aq" .as f1 \& . \} . el .as f1 \& . \} . nB \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 .\} . rZ \\$1 . ie \\n(rZ .as f1 \f\\n(cF\\$1 . el .as f1 \\$1\f\\n(cF . if "\\*(iM"" \{\\*(f1 . ds f1 . \} . hy .\} .. . rZ \\$1 . ie \\n(rZ .as f1 \f\\n(cF\\$1 . el \{\ . ie "\\$1"-" .as f1 \-- . el .as f1 \-\\$1 . \} . rZ \\$2 . if !\\n(rZ \{\ . ie !"\\*(iM""\{\ I surrender
. if "\\*(iM"Tp" .as f1 \ \& . if "\\*(iM"Dp" .as f1 \ \& . if "\\*(iM"Op" .as f1 \ \& . if "\\*(iM"Cx" .as f1 \ \& . if "\\*(iM"Dq" .as f1 \& . if "\\*(iM"Sq" .as f1 \& . if "\\*(iM"Pq" .as f1 \& . if "\\*(iM"Aq" .as f1 \& . \} . el .as f1 \& . \} . fB \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 .\} . rZ \\$1 . ie \\n(rZ .as f1 \f\\n(cF\\$1 . el \{\ . ie "\\$1"-" .as f1 \--\f\\n(cF . el .as f1 \-\\$1\f\\n(cF . \} . if "\\*(iM"" \{\\*(f1 . ds f1 . \} . hy .\} ..
Single quoted Items
eF, sB g[0-9] and f2
.nr eF 0 . ie "\\*(iM"" \\*(sL\\*sR . el .as f1 \\*(sL\\*(sR .\} . ie "\\*(iM"" \{\ . ds f1 \\*(sL . ds iM Sq . \} . el .as f1 \\*(sL . sB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ie \\n(eF>0 .\\*(g1 \\*(g2 \\*(g3 \\*(g4 \\*(g5 \\*(g6 \\*(g7 \\*(g8 . el .as f1 \\*(g0 . as f1 \\*(sR . if !"\\*(f2"" .as f1 \\*(f2 . if "\\*(iM"Sq" \{\ \\*(f1 . ds f1 . ds iM . \} . ds f2 . rm g0 g1 g2 g3 g4 g5 g6 g7 g8 g9 . nr eF 0 .\} ..
Double quoted Items
.nr Ef 0 . ie "\\*(iM"" \\*(Lq\\*(Rq . el .as f1 \\*(Lq\\*(Rq .\} . ie "\\*(iM"" \{\ . ds f1 \\*(Lq . ds iM Dq . \} . el .as f1 \\*(Lq . Sb \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ie \\n(Ef>0 .\\*(k1 \\*(k2 \\*(k3 \\*(k4 \\*(k5 \\*(k6 \\*(k7 \\*(k8 . el .as f1 \\*(k0 . as f1 \\*(Rq . if !"\\*(f4"" .as f1 \\*(f4 . if "\\*(iM"Dq" \{\ \\*(f1 . ds f1 . ds iM . \} . ds f4 . rm k0 k1 k2 k3 k4 k5 k6 k7 k8 k9 . nr Ef 0 .\} ..
Parenthesis quoted Items
.nr pQ 0 . ie "\\*(iM"" () . el .as f1 () .\} . ie "\\*(iM"" \{\ . ds f1 ( . ds iM Pq . \} . el .as f1 ( . pB \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ie \\n(pQ>0 .\\*(y1 \\*(y2 \\*(y3 \\*(y4 \\*(y5 \\*(y6 \\*(y7 \\*(y8 . el .as f1 \\*(y0 . as f1 ) . if !"\\*(f3"" .as f1 \\*(f3 . if "\\*(iM"Pq" \{\ \\*(f1 . ds f1 . ds iM . \} . ds f3 . rm y0 y1 y2 y3 y4 y5 y6 y7 y8 y9 . nr pQ 0 .\} .. eF, sB g[0-9] and f2
. ie \\n(eF>=1 .nr eF \\n(eF+1 . el \{\ . mN \\$1 . if \\n(mN .nr eF \\n(eF+1 . \} . rZ \\$1 . ie \\n(rZ .as f2 \\$1 . el \{\ . ie \\n(eF<1 .as g\\n(eF \\$1 . el .as g\\n(eF \\$1 . \} . if \\n(.$>1 \{\ . rZ \\$2 . if \\n(rZ==0 \{\ . if \\n(eF<1 \{\ . as g\\n(eF \& . \} . \} . sB \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . \} .\} .. . ie \\n(Ef>=1 .nr Ef \\n(Ef+1 . el \{\ . mN \\$1 . if \\n(mN .nr Ef \\n(Ef+1 . \} . rZ \\$1 . ie \\n(rZ .as f4 \\$1 . el \{\ . ie \\n(Ef<1 .as k\\n(Ef \\$1 . el .as k\\n(Ef \\$1 . \} . if \\n(.$>1 \{\ . rZ \\$2 . if \\n(rZ==0 \{\ . if \\n(Ef<1 \{\ . as k\\n(Ef \& . \} . \} . Sb \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . \} .\} .. . ie \\n(pQ>=1 .nr pQ \\n(pQ+1 . el \{\ . mN \\$1 . if \\n(mN .nr pQ \\n(pQ+1 . \} . rZ \\$1 . ie \\n(rZ .as f3 \\$1 . el \{\ . ie \\n(pQ<1 .as y\\n(pQ \\$1 . el .as y\\n(pQ \\$1 . \} . if \\n(.$>1 \{\ . rZ \\$2 . if \\n(rZ==0 \{\ . if \\n(pQ<1 \{\ . as y\\n(pQ \& . \} . \} . pB \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . \} .\} .. . ie \\n(aQ>=1 .nr aQ \\n(aQ+1 . el \{\ . mN \\$1 . if \\n(mN .nr aQ \\n(aQ+1 . \} . rZ \\$1 . ie \\n(rZ .as aZ \\$1 . el \{\ . ie \\n(aQ<1 .as a\\n(aQ \\$1 . el .as a\\n(aQ \\$1 . \} . if \\n(.$>1 \{\ . rZ \\$2 . if \\n(rZ==0 \{\ . if \\n(aQ<1 \{\ . as a\\n(aQ \& . \} . \} . aQ \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . \} .\} .. Angle Bracket Quoted Items
.nr aQ 0 . ie "\\*(iM"" <> . el .as f1 <> .\} . ie "\\*(iM"" \{\ . ds f1 < . ds iM Aq . \} . el .as f1 < . aQ \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 . ie \\n(aQ>0 .\\*(a1 \\*(a2 \\*(a3 \\*(a4 \\*(a5 \\*(a6 \\*(a7 \\*(a8 . el .as f1 \\*(a0 . as f1 > . if !"\\*(aZ"" .as f1 \\*(aZ . if "\\*(iM"Aq" \{\ \\*(f1 . ds f1 . ds iM . \} . ds aZ . rm a0 a1 a2 a3 a4 a5 a6 a7 a8 . nr aQ 0 .\} .. macro Name test, return macro register value if true
.nr mN 0 .sW \\$1 . if \\n(\\$1 .nr mN \\n(\\$1 .\} .. Punctuation test (using z registers), return 1 if true
.nr rZ 0 .sW \\$1 . if \\n(z\\$1==1 \{\ . nr rZ 1 . \} .\} ..
sW returns number of characters in a string
.nr fW \w',' .nr sW \w'\\$1' .\} .nr fW \w'0' .nr sW \w'\\$1' .\} . ie \\n(sW%\\n(fW .nr sW (\\n(sW/\\n(fW)+1 . el .nr sW \\n(sW/\\n(fW .\} .. Option Expression -
TODO - add line overflow check (right!)
.nr eP 0 .nr oE 0 .nr hP 0 .nr Ep 0 . ds iM Op . ds f1 \& .\} .as f1 \\*(lB .tm Op: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
.dO \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 ..
just for mike, with every bite of garlic in mind (oops, i mean burp).
dO: go dOwn an argument vector and test each argument to see if
a macro name or punctuation. stash in respective place along
with its arguments.
.nr oO 0 .nr oP 0 .nr aO 0 .mN \\$1 . if \\n(oP \{\ . if \\n(hP \{\ . nr oZ 1 . oZ . Oz . \} . if \\n(e1==1 \{\ .\\*(e1 \\*(e2 \\*(e3 \\*(e4 \\*(e5 \\*(e6 \\*(e7 \\*(e8 \\*(e9 . \} . uO . if !(\\n(oO:\\n(aO) .as f1 \& . \} . ie "\\$1"Op" \{\ . as f1 \\*(lB . nr aO \\n(aO+1 . \} . el \{\ . nr eP \\n(eP+1 . ds e\\n(eP \\$1 . nr e\\n(eP 1 . \} .\} .tm dO: $1: \\$1: eP \\n(eP e[\\n(eP]: \\*(e\\n(ePEE
. rZ \\$1 . ie \\n(rZ \{\ .tm dO:rZ: $1: \\$1: eP \\n(eP e[\\n(eP]: \\*(e\\n(eP
. nr hP \\n(hP+1 . ds h\\n(hP \\$1 . \} . el \{\ .tm dO:word $1: \\$1: eP \\n(eP e[\\n(eP]: \\*(e\\n(ePEE
. if \\n(eP==0:\\n(e\\n(eP==1 .nr eP \\n(eP+1 . if \\n(eZ .as e\\n(eP \& . as e\\n(eP \\$1 . ds e\\n(eP \\$1
. nr eZ \\n(eZ+1 . \} .\} .nr oP 1 . dO \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 .\} . ie \\n(e1 \{\ .\\*(e1 \\*(e2 \\*(e3 \\*(e4 \\*(e5 \\*(e6 \\*(e7 \\*(e8 \\*(e9 . \} . el \{\ . as f1 \\*(e1 . \} .\} .. handle old style arguments such as the arg -Idir
in adb, .Oo is a toggle.
.. stash punctuation
. nr eP \\n(eP+1 . ds e\\n(eP \\*(h\\n(oZ . nr oZ \\n(oZ+1 . oZ .\} .. clean up punctuation vector
. rm h\\n(hP . nr hP \\n(hP-1 . Oz .\} .. uO: go back up created vector cleaning it up along the way
. rm e\\n(eP . rr e\\n(eP . nr eP \\n(eP-1 . nr oP 0 . nr eZ 0 . uO .\} .. option end
.uO . as f1 \\*(rB\\*(h1\\*(h2\\*(h3 . Oz . nr oZ 0 .\} . as f1 \\*(rB .\} . if \\n(aO .aO . if (\\n(.lu-\\n(.ku-\\n(.ou-(2*\\n(fWu))<\w'\\*(f1'u .br .\} . nr aa \w'\\*(f1'u . nr qq \\n(.lu-\\n(.ku-\\n(.ou
aa == \\n(aa, f1==\\*(f1, qq==\\n(qq
. if (\\n(.lu-\\n(.ku-\\n(.ou-\\n(aau)<=(8*\\n(fWu) .br .\} \\*(f1 . ds iM . ds f1 . hy .\} .. .as f1 \\*(rB .nr aO \\n(aO-1 ..
. ie \\n(.$==1 \{\ . if !"\\*(iM"" .as f1 \\*(xR\\$1
. if "\\*(iM"" \\*(xR\\$1
. \} . el .tm Xr Usage: .Xr manpage_name [section#] \\*(Pu .\} . rZ \\$2 . ie "\\*(iM"" \{\ . ie \\n(rZ \\*(xR\\$1
\\$2 . el \\*(xR\\$1(\\$2) . \} . el \{\ . ie \\n(rZ .as f1 \\*(xR\\$1\\$2 . el .as f1 \\*(xR\\$1(\\$2) . \} .\} . rZ \\$2 . ie \\n(rZ \{\ . ie !"\\*(iM"" .as f1 \\*(xR\\$1\\$2\\$3\\$4\\$5\\$6\\$7\\$8 . el \\*(xR\\$1\\$2\\$3\\$4\\$5\\$6\\$7\\$8 . \} . el \{\ . rZ \\$3 . ie \\n(rZ \{\ . if !"\\*(iM"" \{\ . as f1 \\*(xR\\$1(\\$2)\\$3\\$4\\$5\\$6\\$7\\$8 . \} . if "\\*(iM"" \{\ \\*(xR\\$1(\\$2)\\$3\\$4\\$5\\$6\\$7\\$8 . \} . \} . el \{\ . tm rZ = \\n(rZ the arg is \\$3 . tm Xr-XX Usage: .Xr manpage_name [section#] \\*(Pu . \} . \} .\} ..

.tm Ex defunct, Use .Dl: \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 .. Display (one) Line of text.
' ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i . in \\n(.iu+\\n(Dsu . mN \\$1 . ie \\n(mN .\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . el \{\ . nr cF \\n(.f Literal font is none specified
\\*(lI\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . ft \\n(cF . \} . in \\n(.iu-\\n(Dsu .\} . mN \\$1 . ie \\n(mN .\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 . el \{\ . nr cF \\n(.f . ds f1 \\*(lI\\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 . as f1 \f\\n(cF . \} .\} ..

user set Tagged Paragraph Width (used in both Dp and Tp)
. nr aa 0 .\} . mN \\$1 . ie \\n(sW>2 \{\ . nr tW (\\n(sW+3)*\\n(fWu) . \} . el \{\ . ie \\n(mN .nr tW \\n(mN . el .nr tW \\$1 . \} . nr tF 1 .\} ..
.Tw \\$1 ..
. nr tI \\n(Dsu .\} . sW \\$1 . if \\n(sW>=2 \{\ . nr tI \\$1u . \} . if \\n(sW<2 \{\ . if "\\$1"L" \{\ . nr tI 0 . \} . \} .\} .. tagged paragraph
initialize baby stack variables
.nr np 0 .nr p1 0
. ds iM Tp . mN \\$1 . ie \\n(tF \{\ . ds tC Tw . nr tC 1 . nr tF 0 . \} . el \{\ . if !"Tw"\\*(s\\n(np" \{\ . ie \\n(mN \{\ . ds tC \\$1 . nr tW \\n(mN . \} . el \{\ . ds tC Tx . nr tW \\n(Tx . \} . if !"\\*(tC"\\*(s\\n(np" .nr tC 1 . \} . \} . sp \\n(vVu . if !\\n(cR .ne 2 . if \\n(tC \{\ . nr np \\n(np+1 . nr p\\n(np \\n(tW . ds s\\n(np \\*(tC . nr tC 0 . ds tC . in \\n(.iu+\\n(p\\n(npu . \} . ie \\n(mN \{\ . ds f1 . \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . if !"\\$1"Cx" .pT st p np . \} . el \{\ . br . ev 1 . fi . di Td \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . br . di . ev . na . ds tD \\*(Td\\ . pT di p np . \} .\} ..

Complex Expression Macro

TODO: add length across line boundary check (like Li)
. if "\\*(iM"Cx" \{\ . ds iM . if \\n(oE .oE \\*(f1 . ds f1 . \} . if "\\*(iM"Tp" .pT st p np . if "\\*(iM"Dp" .pT st q mp .\} . if "\\*(iM"" \{\ . ds iM Cx . ds f1 \& . \} . mN \\$1 Here are the args: `\\$1' `\\$2' `\\$3' `\\$4'
. ie \\n(mN .\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . el \{\ . as f1 \\$1 . if \\n(.$>1 .Cx \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . \} .\} .. Prefix string in default font to content specified string
.Cx \\$1 .\\$2 \\$3 \\$4 \\$5 .Cx .. Suffix string in default font to content specified string
.Cx \\$1 \\$2 .Cx \\$3 .Cx .. Simple Option Begin
. ev 2 . fi . di oB .\} .tm shouldn't be here . as f1 [ . mN \\$1 . ie \\n(mN .\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . el \{\ . as f1 \\$1 . if \\n(.$>1 .Oc \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . \} .\} .. .as f1 \\$1 .. . br . di . ev . ds bO \\*(oB\\ [\\*(bO] .\} . as f1 ] .\} .. White space for Cx
.Cx \ \& .. tagged paragraph
initialize baby stack variables
.nr mp 0 .nr q1 0
Complex Dp tag
.Dp Cx \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 .. Complex Tp tag
.Tp Cx \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 .. Tag with a flag and an argument with a space
. Tp Fl \\$1 .\} . Tp Fl \\$1 . Cx \ \& . Ar \\$2 \\$3 . Cx .\} .. .Dp Cx Fl \\$1 .Ws .Ar \\$2 \\$3 .Cx .. .Tp Cx Fl \\$1 .Ar \\$2 \\$3 .Cx .. .Dp Cx Fl \\$1 .Ar \\$2 \\$3 .Cx .. Blended tag toggle
.. Bullet paragraph
.Tp Sy \(bu .. Display tagged paragraph
. pE q r mp . sp \\n(vVu .\} . ds iM Dp . mN \\$1 . ie \\n(tF \{\ . ds tC Tw . nr tC 1 . nr tF 0 . \} . el \{\ . if !"Tw"\\*(r\\n(mp" \{\ . ie \\n(mN \{\ . ds tC \\$1 . nr tW \\n(mN . \} . el \{\ . ds tC Tx . nr tW \\n(Tx . \} . if !"\\*(tC"\\*(r\\n(mp" .nr tC 1 . \} . \} . if !\\n(cR .ne 2 . if \\n(tC \{\ . nr mp \\n(mp+1 . nr q\\n(mp \\n(tW . ds r\\n(mp \\*(tC . nr tC 0 . ds tC . ie \\n(tIu==\\n(Dsu .nr i\\n(mp \\n(Dsu . el \{\ . nr i\\n(mp \\n(tIu . nr tI \\n(Dsu . \} . in \\n(.iu+\\n(i\\n(mpu . sp \\n(vVu . in \\n(.iu+\\n(\\q\\n(mpu . \} . ie \\n(mN \{\ . \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . if !"\\$1"Cx" .pT st q mp . \} . el \{\ . br . ev 1 . fi . di Td \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . br . di . ev . na . ds tD \\*(Td\\ . pT di q mp . \} .\} ..
.pE number_stack string_stack counter
. in \\n(.iu-(\\n(\\$1\\n(\\$3u)-(\\n(i\\n(mpu) . rr i\\n(mp .\} .in \\n(.iu-\\n(\\$1\\n(\\$3u
.rr \\$1\\n(\\$3 .nr \\$3 \\n(\\$3-1 ..
.pT [st or di] number_stack counter
. nr bb \\n(\\$2\\n(\\$3u . ti -\\n(bbu . ie (\\n(\\$2\\n(\\$3u-2n)<=\w'\\*(f1'u \{\\*(f1\\*(tP . if \\n(tP==0 .br . \} . el \\*(f1\h'|\\n(\\$2\\n(\\$3u'\c .\} . ti -\\n(\\$2\\n(\\$3u . ie (\\n(\\$2\\n(\\$3u-2n)<=\\n(dlu \{\\*(tD\\*(tP . if !\\n(tP .br . \} . el \\*(tD\h'|\\n(\\$2\\n(\\$3u-'\c . if t 'ad .\} . ds iM . ds f1 'fi ..
The new SH

set Sh state off, check for list state before calling indent (.In)
.nr nS 0 .nr sE 0 name state on, housekeep (headers & footers)
. hK ' in 0 .\} . if "\\$1"SYNOPSIS" .nr nS 1 . in 0 .\} .pL 'sp .ns 'fi \fB\\$1 \|\\$2 \|\\$3 \|\\$4 \|\\$5 \|\\$6 \|\\$7 \|\\$8 \|\\$9 \fP\& .ns ..
Nd minus sign for an en dash used in .Sh Name
\- \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 .. \fB\\$1 \|\\$2 \|\\$3 \|\\$4 \|\\$5 \|\\$6 \|\\$7 \|\\$8 \|\\$9 \fP\&

.. .if "\\$1"Ss" .in \\n(.iu+\\n(sIu
..


Column Macro

. br . in \\n(.iu-\\n(eWu . ta .5i 1i 1.5i 2i 2.5i 3i 3.5i 4i 4.5i 5i 5.5i 6i 6.5i .\} . Pp . if \\n(.$==1 \{\ . ta \w'\\$1 'u . nr eW \w'\\$1 'u ' in \\n(.iu+\\n(eWu . \} . if \\n(.$==2 \{\ . ta \w'\\$1 'u +\w'\\$2 'u . nr eW \w'\\$1 'u+\w'\\$2 'u ' in \\n(.iu+\\n(eWu . \} . if \\n(.$==3 \{\ . ta \w'\\$1 'u +\w'\\$2 'u +\w'\\$3 'u . nr eW \w'\\$1 'u+\w'\\$2 'u+\w'\\$3 'u ' in \\n(.iu+\\n(eWu . \} . if \\n(.$==4 \{\ . ta \w'\\$1 'u +\w'\\$2 'u +\w'\\$3 'u +\w'\\$4 'u . nr eW \w'\\$1 'u+\w'\\$2 'u+\w'\\$3 'u +\w'\\$4 'u ' in \\n(.iu+\\n(eWu . \} . if \\n(.$==5 \{\ .nr eW \w'\\$1 'u +\w'\\$2 'u +\w'\\$3 'u +\w'\\$4 'u +\w'\\$5 'u ' in \\n(.iu+\\n(eWu . \} .\} .. .mN \\$1 .. .nr dQ 0 . mN d\\$1 . if \\n(mN \{\ . nr dQ \\n(dQ+1 . d\\$1 . \} .\}

..
. mN d\\$1
. if \\n(mN \{\
. nr dQ \\n(dQ+1
. d\\$1
. \}
.\}
..
\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
..
.nr d\\n(dQ \\n(dIu
..
.nr d\\n(dQ (\\n(.l-\\n(.i)/4u
..
.nr d\\n(dQ (\\n(.l/3)u
..
.nr aa 0
..

. in \\n(.iu-\\n(d\\n(dQu . rr d\\n(dQ . nr dQ \\n(dQ-1 .\}

..
. tm Usage: .Fn function_name function_arg(s) ... \\*(Pu .\} . nr cF \\n(.f . ie \\n(.$==1 .ds f1 \\*(nM\\$1\\*(lP\\*(rP . el \{\ . ds f1 \\*(nM\\$1\\*(lP . nr aa 0 . rC \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9 . \} . if "\\*(iM"" \{\\\*(f1 . ds f1 . \} .\} ..
.rZ \\$1 . as f1 \f\\n(cF\\*(rP\f\\n(cF\\$1\\$2\\$3\\$4\\$5\\$6\\$7 .\} . ie \\n(aa .as f1 , \\*(aR\\$1 . el .as f1 \\*(aR\\$1 . nr aa 1 . ie \\n(.$>1 .rC \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 . el .as f1 \\*(rP .\} ..