From 195edc5e418fa7383bd7882a3b53fe76811e288a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sun, 20 Jun 2021 22:57:57 +0200 Subject: Add w (want space) macro It takes, as its arguments, a specification describing the amount of space desired. .w s p requests space for a subheading and a paragraphs line. .w s pp requests space for a subheading and TWO paragraph lines. --- g.tmac | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/g.tmac b/g.tmac index 3739c8d..3fda230 100644 --- a/g.tmac +++ b/g.tmac @@ -286,7 +286,7 @@ ___________________ .\" h -- heading .de h . br -. ne 3 \" may need to be adjusted +. w h p . _e h . .. @@ -306,7 +306,7 @@ ___________________ .\" s -- subheading .de s . br -. ne 3 \" may need to be adjusted +. w s p . _e s .. . @@ -349,4 +349,32 @@ ___________________ . if !'\n(dn'0' .wh -\n[_dn]u-\n(mbu-12p _tn .. . +. \" w -- want space +.de w +. br +. *w 0 \$@ +.. +.de *w +. nr s \$1 \" accumulated space +. length n \$2 \" number of lines in environment +. ds __e \$2 \" environment +. nr n -1 +. substring __e 0 0 +. +. \" add environment sp/sq +. nr s +\n[\*[__e]_sp] +. nr s +\n[\*[__e]_sq] +. +. \" add environment vs +. _E \*[__e] +. nr _v \n(.v +. _E +. nr s +(\nn*\n(_v) +. shift 2 +. +. \" request space or recurse +. ie \n(.$=0 .ne \nsu +. el .*w \ns \$@ +.. +. .ec \" re-enable backslash escapes -- cgit v1.2.3