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
.\}
..
.nr mN 0
. sW \\$1
. if \\n(sW==2 \{\
. 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
. \}
.\}
..
.nr rZ 0
. sW \\$1
. if \\n(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
.\}
..