.\"	MACROES FOR FOOTNOTES (file tmac.q4)
.\"
.\"		Th.A. Zoethout
.\"
.de FN			\" NUMBERED FOOTNOTE START
.\"	.FN [ [$1] $2 ]
.			\" $1 = prefix
.			\" $2 = suffix
.ie \\n(FS=0 \{\
.ie n \{\
.if \\n(.$=0 .FS (\\n(FN)
.if \\n(.$=1 .FS (\\n(FN) \\$1
.if \\n(.$=2 .FS \\$1 (\\n(FN) \\$2\}
.el \{\
.if \\n(.$=0 .FS \\n(FN
.if \\n(.$=1 .FS \\n(FN \\$1
.if \\n(.$=2 .FS \\$1 \\n(FN \\$2\}\}
.el \{\
.	Er W ".FN: nested footnotes are not allowed
\&\\$1\\n(FN\\$2\}
.nr FN +1
..
.de FS			\" FOOTNOTE START
.\"	.FS [ [$1] ) $2 ( $3 ]
.			\" $1 = prefix
.			\" $2 = indicator
.			\" $3 = suffix
.if \\n(.$>0 \{.ie n \&\\$1\\$2\\$3
.el \v'-0.4m'\s-2\\$1\\$2\\$3\s+2\v'0.4m'\}
.ie \\n(FS=1 .Er W ".FS: nested footnotes are not allowed
.el \{\
.nr FS 1
.ev 1
.nr Fp \\n(.s
.ps \\n(Sf
.ll \\n(Lfu
.nr FE \\n(.i
.in 1
.da Fx
.if \\n(.$>2 \&\\$2
.if \\n(.$=1:(\\n(.$=2) \&\\$1\}
..
.de FE			\" FOOTNOTE END
.\"	.FE $1
.			\" $1 = succeeding vertical spacing { 0 }
.ie \\n(FS=0 .Er W ".FE: no matching .FS or .FN
.el \{\
.br
.if !\&\\$1\&\& .sp \\$1v
.di
.ll \\n(LLu
.in \\n(FEu
.ps \\n(Fp
.rr FE
.rr Fp
.nr Fx +\\n(dn
.ev
.Fp
.nr FS 0\}
..
.de Fo			\" catch footnote overflow trap macro
.if \\n(Fl=2 .di Fl
..
.de Fp			\" place footnote trap macro
.nr Fl 0
.if \\n(Fx>0 \{\
.nr Fl 1
.nr Fo \\n(nl+1v
.if \\n(Fo<(\\n(Tmu+\\n(NDv+1v) .nr Fo \\n(Tmu+\\n(NDv+1v
.if \\n(Fo>(\\n(.pu-\\n(Bmu-\\n(Fxu-\\n(Fmu) .nr Fl 2
.if \\n(Fo>=(\\n(.pu-\\n(Bmu-\\n(Fmu) .nr Fl 3 \}
.if \\n(Fl=0 .ch Bm \\n(.pu-\\n(Bmu
.if \\n(Fl=1 .ch Bm \\n(.pu-\\n(Bmu-\\n(Fxu-\\n(Fmu
.if \\n(Fl=2 .ch Bm \\n(Fou
.if \\n(Fl=3 .ch Bm \\n(.pu-\\n(Bmu
.rr Fo
..
.de Ft			\" footnote processing at top of page
.ev 1
.if \\n(Fl=2 \{\
.nr dn 0
.nf
.di Fx
.Fl
.br
.di
.fi
.rm Fl
.nr Fx \\n(dn \}
.ev
.Fp
..
.de Fb			\" footnote processing at bottom of page
.if (\\n(Fl=1):(\\n(Fl=2) \{\
.ev 1
.nr Fx 0
.nr Fb \\n(.i
.in 0
\\*(Ncnf		\" Nc is no-break control character
.Fm
.Fx
\\*(Ncfi		\" Nc is no-break control character
.in \\n(Fbu
.ev
.rm Fx \}
.if \\n(Fl=2 .if "\\n(.z"Fl" .di
..
.de Fm 			\" footnote marker
\l#150p\(ul#
\\*(Ncsp		\" Nc is no-break control character
..
.			\" FOOTNOTE INITIALIZATION
.nr FN 1
.nr Fx 0
.nr Fl 0
.ev 1
.nr Fm 2v
.ev
.ch Bm \n(.pu+1v
.wh \n(.pu-\n(Bmu Fo
.ch Bm \n(.pu-\n(Bmu
.\*($0
.rm $0 ]R
