From 9365fec1a278974b4cabc9192f0797fc5d1d1682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 18 Jun 2021 10:40:06 +0200 Subject: g.tmac: Add c (code) macro, rework margins --- g.tmac | 108 ++++++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 32 deletions(-) (limited to 'g.tmac') diff --git a/g.tmac b/g.tmac index 9f80429..d995c03 100644 --- a/g.tmac +++ b/g.tmac @@ -1,6 +1,6 @@ .eo .\" s -- setup document -.de s +.de _s . \" configure initial options . _nr mt 1i \" margin top . _nr mb 1i \" margin bottom @@ -11,23 +11,41 @@ . ns . \" configure environments . _e t \" title +. evc 0 . ps +4p . vs +2p . ft B . ad c . _e n \" name (of author) -. _nr n_mt 0.4v +. evc 0 +. nr sp 0.4v . ad c . _e d \" date -. _nr d_mt 0.4v +. evc 0 +. nr sp 0.4v . ad c -. _e p \" paragraph -. _nr p_mt 0.3v -. ad b . _e h \" heading -. _nr h_mt 0.6v +. evc 0 +. nr sp 0.6v . ps +1p . ft B +. _e s \" section heading +. evc 0 +. nr sp 0.6v +. ft B +. _e p \" paragraph +. evc 0 +. nr sp 0.3v +. nr ti 0.5c +. ad b +. _e c \" code listing +. evc 0 +. nr sp 0.3v +. nr in 0.5c +. nf +. in 0.5c +. fam C +. ps -1p . _e .. .\" _h -- page header @@ -46,11 +64,36 @@ .. .\" _e -- set environment .de _e +. if '\n(_s'0' \{\ +. nr _s 1 +. _s +. \} . br -. if !'\n[.ev]'0' .ev +. if !'\n[.ev]'0' \{\ +. nr \n[.ev]_sp \n(sp +. nr \n[.ev]_in \n(in +. nr \n[.ev]_ti \n(ti +. ev +. \} . ds penv \*[env] . ds env \$1 -. if !'\$1'' .ev \$1 +. if !'\$1'' \{\ +. ev \$1 +. nr sp \n[\n[.ev]_sp] +. nr in \n[\n[.ev]_in] +. nr ti \n[\n[.ev]_ti] +. sp \n(spu +. in \n(inu +. \} +. _mb +.. +.\" _mb -- margin bottom +.de _mb +. ie '\*[env]'n' .return +. el .if '\*[env]'d' .return +. ie '\*[penv]'t' .sp 1v +. el .ie '\*[penv]'n' .sp 1v +. el .if '\*[penv]'d' .sp 1v .. .\" i -- italic .de i @@ -60,44 +103,45 @@ .de x \$3\f(BI\$1\fP\$2 .. +.\" q -- quote +.de q +\$3\(lq\$1\(rq\$2 +.. .\" t -- title .de t . _e t .. .\" n -- name (of author) .de n -. br . _e n -. if '\*[penv]'t' .sp 0.2v -. sp \n[n_mt]u +. if '\*[penv]'t' .sp 0.2v .. .\" d -- date .de d -. br . _e d -. if '\*[penv]'t' .sp 0.2v -. sp \n[d_mt]u -. af mo 00 -. af dy 00 -. ie '\$1'' \n[year]-\n(mo-\n(dy -. el \$1 -. af mo 1 -. af dy 1 +. if '\*[penv]'t' .sp 0.2v +. af mo 00 +. af dy 00 +. ie '\$1'' \n[year]-\n(mo-\n(dy +. el \$1 +. af mo 1 +. af dy 1 +.. +.\" h -- heading +.de h +. _e h +.. +.\" s -- section heading +.de s +. _e s .. .\" p -- paragraph .de p -. br . _e p -. ie '\*[penv]'t' .sp 1v -. el .ie '\*[penv]'n' .sp 1v -. el .ie '\*[penv]'d' .sp 1v -. el .sp \n[p_mt]u -. if '\*[penv]'p' \h'0.5c' +. if '\*[penv]'p' .ti \n(tiu .. -.\" h -- heading -.de h -. br -. _e h -. sp \n[h_mt]u +.\" c -- code listing +.de c +. _e c .. .ec -- cgit v1.2.3