aboutsummaryrefslogtreecommitdiff
path: root/g.tmac
diff options
context:
space:
mode:
Diffstat (limited to 'g.tmac')
-rw-r--r--g.tmac125
1 files changed, 68 insertions, 57 deletions
diff --git a/g.tmac b/g.tmac
index 8475988..48ecc6e 100644
--- a/g.tmac
+++ b/g.tmac
@@ -12,16 +12,16 @@
.\" When editing the source of mg, keep the "/.
.\" following rules in mind: "/.
.\" "/.
-.\" * Prefix temporary registers with _. "/.
-.\" * Prefix temporary strings with _. "/.
-.\" * Prefix internal environments with @. "/.
-.\" * Prefix internal registers with @. "/.
+.\" * Prefix temporary strings and registers "/.
+.\" with _. "/.
+.\" * Prefix internal registers and environ- "/.
+.\" ments with @. "/.
.\" * Prefix internal macros with @ (normal "/.
-.\" macros), * (variants of the same macro) "/.
-.\" or % (strings). "/.
+.\" macros), * (variants of the same "/.
+.\" macro) or % (strings). "/.
.\" * Place macros in alphabetical order. "/.
-.\" * Do not use .ev and .evc outside of "/.
-.\" wrapper macros like (e, @e and @c. "/.
+.\" * Do not use .ev and .evc directly; use "/.
+.\" (e, @e and @c instead. "/.
.\" "/.
.
.eo \" disable backslash escapes
@@ -31,15 +31,9 @@
.\" @a -- setup document
.de @a
.
-. \" configure initial options
-. @nr mt 1i \" top margin
-. @nr mb 1i \" bottom margin
-. @ds tt '''' \" text in top margin
-. @ds tb ''%'' \" text in bottom margin
-.
. \" initialize document
. wh 0 @th
-. wh -\n(mbu @tf
+. if \n(.t=\n(.p .wh -1i @tf
. sp 1u \" trigger header
.
. \" configure environments
@@ -96,6 +90,30 @@
. (e @m \" margins (header, footer)
. @c 0
. (e
+.
+. \" set date formats
+. af mo 00
+. af dy 00
+. ds %i \n[year]-\n(mo-\n(dy
+. af mo 1
+. af dy 1
+. ds %e \n(dy
+. ie \n(mo=1 .ds %e \*(%e January
+. el .ie \n(mo=2 .ds %e \*(%e February
+. el .ie \n(mo=3 .ds %e \*(%e March
+. el .ie \n(mo=4 .ds %e \*(%e April
+. el .ie \n(mo=5 .ds %e \*(%e May
+. el .ie \n(mo=6 .ds %e \*(%e June
+. el .ie \n(mo=7 .ds %e \*(%e July
+. el .ie \n(mo=8 .ds %e \*(%e August
+. el .ie \n(mo=9 .ds %e \*(%e September
+. el .ie \n(mo=10 .ds %e \*(%e October
+. el .ie \n(mo=11 .ds %e \*(%e November
+. el .ds %e \*(%e December
+. ds %e \*(%e \n[year]
+..
+.
+.
..
.
. \" @c -- copy environment
@@ -161,6 +179,21 @@
. \}
..
.
+.\" @f -- footer
+.de @f
+. sp |\n(.pu-48p
+. tl ''%''
+..
+.
+.\" @h -- header
+.de @h
+. sp |36p
+. tl ''''
+. sp |1i
+..
+.
+..
+.
.\" @nr -- set default numeric value
.de @nr
. if \n[\$1]=0 .nr \$1 \$2
@@ -169,11 +202,15 @@
.\" @tf -- footer trap
.de @tf
.
+. \" skip automatic trigger if manual mode active, unless forced
+. if \n(@m>0 .if !'\$1'f' \{\
+. nr @m -1
+. return
+. \}
+.
. \" print footer
. (e @m
-. rt \n(.pu-\n(mbu \" return to correct position if pushed down
-. sp \n(mbu-2v-24p
-. tl \*(tb
+. @f
' bp
..
.
@@ -181,10 +218,7 @@
.de @th
. (e @m
. rt 0
-. sp 24p
-. tl \*(tt
-. rt 0
-. sp \n(mtu
+. @h
. (e \*[%env]
. ns
..
@@ -192,9 +226,7 @@
.\" @tn -- footnote trap
.de @tn
.
-. \" override footer
-. ch @tf
-.
+. nr @m 1
. \" print collected footnotes
. (e @m
___________________
@@ -206,12 +238,10 @@ ___________________
.
. \" clear footnotes
. ch @tn
+. nr @.t 0
. nr @dn 0
. rm @n
-.
-. \" trigger and restore footer
-. @tf
-. wh -\n(mbu @tf
+. @tf f
..
.
.
@@ -283,34 +313,9 @@ ___________________
.de d
. br
. @e d
-.
-. \" international format
-. ie '\$1'i' \{\
-. af mo 00
-. af dy 00
-\n[year]-\n(mo-\n(dy
-. af mo 1
-. af dy 1
-. \}
-.
-. \" english format
-. el .if '\$1'e' \{\
-\n(dy
-. ie \n(mo=1 January
-. el .ie \n(mo=2 February
-. el .ie \n(mo=3 March
-. el .ie \n(mo=4 April
-. el .ie \n(mo=5 May
-. el .ie \n(mo=6 June
-. el .ie \n(mo=7 July
-. el .ie \n(mo=8 August
-. el .ie \n(mo=9 September
-. el .ie \n(mo=10 October
-. el .ie \n(mo=11 November
-. el December
-\n[year]
-. \}
+. if !'\$1'' \*(%\$1
..
+.
.\" h -- heading
.de h
. br
@@ -321,6 +326,7 @@ ___________________
.\" l -- literal display
.de l
. br
+. w ll
. @e l
..
.
@@ -371,10 +377,15 @@ ___________________
. ie !'\$1'' \&\$1
. el \&
.
+. \" get position of footer (or next trap)
+. if \n[@.t]=0 .nr @.t \n(nl+\n(.t
+.
+.
. \" print footnote at bottom of page
. ch @tn
. nr @dn +\n(dnu
-. if !'\n(dn'0' .wh -\n[@dn]u-\n(mbu-12p @tn
+. nr _tn \n[@.t]u-\n[@dn]u-12p
+. wh \n[_tn]u @tn
..
.
.\" w -- want space