aboutsummaryrefslogtreecommitdiff
path: root/g.tmac
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-06-18 08:45:15 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-06-18 08:45:15 +0200
commit782815777b64d40b71a1d8109fd1779ec71a23ef (patch)
tree13a4a34682095d8fad32ac02c428d8e00abd99dd /g.tmac
parentfed6c0da38983ac985b5fbac59edde8e9517623f (diff)
downloadmk-782815777b64d40b71a1d8109fd1779ec71a23ef.tar.gz
g.tmac: Re-organize code, implement h (heading) macro
Diffstat (limited to 'g.tmac')
-rw-r--r--g.tmac52
1 files changed, 36 insertions, 16 deletions
diff --git a/g.tmac b/g.tmac
index 2873fb8..9f80429 100644
--- a/g.tmac
+++ b/g.tmac
@@ -1,29 +1,38 @@
.eo
-.\" _s -- setup document (configurable)
-.de _s
+.\" s -- setup document
+.de s
+. \" configure initial options
+. _nr mt 1i \" margin top
+. _nr mb 1i \" margin bottom
+. \" initialize document
. wh 0 _h
-. wh -1i _f
-. sp 1u \" trigger _h
+. wh -\n(mbu _f
+. sp 1u \" trigger header
. ns
+. \" configure environments
. _e t \" title
. ps +4p
. vs +2p
. ft B
. ad c
. _e n \" name (of author)
-. nr n_mt 0.9v
+. _nr n_mt 0.4v
. ad c
. _e d \" date
-. nr d_mt 0.4v
+. _nr d_mt 0.4v
. ad c
. _e p \" paragraph
-. nr p_mt 0.3v
+. _nr p_mt 0.3v
. ad b
+. _e h \" heading
+. _nr h_mt 0.6v
+. ps +1p
+. ft B
. _e
..
.\" _h -- page header
.de _h
-' sp 1i
+' sp \n(mtu
..
.\" _f -- page footer
.de _f
@@ -31,6 +40,10 @@
. tl ''%''
' bp
..
+.\" _nr -- set default value
+.de _nr
+. if \n[\$1]=0 .nr \$1 \$2
+..
.\" _e -- set environment
.de _e
. br
@@ -39,6 +52,14 @@
. ds env \$1
. if !'\$1'' .ev \$1
..
+.\" i -- italic
+.de i
+\$3\fI\$1\fP\$2
+..
+.\" x -- bold italic
+.de x
+\$3\f(BI\$1\fP\$2
+..
.\" t -- title
.de t
. _e t
@@ -47,12 +68,14 @@
.de n
. br
. _e n
+. if '\*[penv]'t' .sp 0.2v
. sp \n[n_mt]u
..
.\" d -- date
.de d
. br
. _e d
+. if '\*[penv]'t' .sp 0.2v
. sp \n[d_mt]u
. af mo 00
. af dy 00
@@ -71,13 +94,10 @@
. el .sp \n[p_mt]u
. if '\*[penv]'p' \h'0.5c'
..
-.\" i -- italic
-.de i
-\$3\fI\$1\fP\$2
-..
-.\" x -- bold italic
-.de x
-\$3\f(BI\$1\fP\$2
+.\" h -- heading
+.de h
+. br
+. _e h
+. sp \n[h_mt]u
..
.ec
-._s