gbranden pushed a commit to branch master
in repository groff.
commit ace17af9469d6ee0f91f857801633c22854e305f
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Jun 14 10:10:42 2024 -0500
[mm]: Heavily revise `MT` output cosmetics.
* contrib/mm/mm/0.MT: Revise to more closely approximate DWB 3.3 troff
output.
(cov@print-title): Use `SP` macro instead of `MOVE`. Honor argument
instead of ignoring it. Save and restore the adjustment mode, and
left-align text instead of turning off filling. The latter (1) lost
track of whether filling was enabled in the document already (though
it _probably_ was) and more importantly (2) permitted lengthy charging
or filing case numbers to overprint author information. Use `nop` to
maintain logical indentation when formatting output. Use `br`
requests to separate title/subject and the charging and filing case
numbers. Favor font selection requests over escape sequences.
(cov@print-authors): Use `rt` request instead of `MOVE` macro, to
return to the vertical position marked at the end of the
`cov@print-date` macro (which could format more than one line of
output). Suspend and restore hyphenation since the context is
crowded, not all names follow English hyphenation patterns, and
arguments after the first to `AU` are often codes or abbreviations.
Avoid disabling filling using same technique as above. Arrange `AU`
arguments 3-6 as DWB 3.3 does. Stop formatting a literal `TM` in the
output; DWB 3.3 didn't do this. (Worse, we were putting it there even
if no technical memorandum numbers were defined.) Drop unnecessary
`PGFORM` call.
(cov@print-au1, cov@print-au2): Internally document what these macros
are for (formatting `AU` arguments, some of which get special
treatment), and align with DWB 3.3 output.
(cov@print-date): Use `sp` request instead of `MOVE` macro; we can't
call `SP` because this motion is negative (upward). Avoid disabling
filling using same technique as above. Drop unnecessary `PGFORM`
call. Use `mk` to mark the bottom of the date output.
(cov@print-firm): Return early if no firm name defined. Use `sp`
request instead of `MOVE` macro; we can't call `SP` because this
motion is negative (upward). Align firm name left instead of right.
Set firm name in Helvetica roman if Helvetica family is available; in
nroff mode, use bold. Use `nop` to maintain logical indentation when
formatting output.
(cov@print-abstract): Favor font selection requests over escape
sequences.
(initialization): Define several registers to vertically and
horizontally arrange the document metadata. Adjust verical spacing
around abstract and its caption. Favor font selection requests over
escape sequences.
* contrib/mm/m.tmac (let*mt-sign): Set signatures, except for the
secretarial annotation, using the metadata font.
* contrib/mm/tests/cover-page-info-is-present.sh: Update test
expectations.
---
contrib/mm/ChangeLog | 51 +++++++
contrib/mm/m.tmac | 5 +-
contrib/mm/mm/0.MT | 178 +++++++++++++++++--------
contrib/mm/tests/cover-page-info-is-present.sh | 2 +-
4 files changed, 180 insertions(+), 56 deletions(-)
diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index f89062b66..7f2300ab1 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,54 @@
+2024-06-14 G. Branden Robinson <[email protected]>
+
+ * mm/0.MT: Revise to more closely approximate DWB 3.3 troff
+ output.
+ (cov@print-title): Use `SP` macro instead of `MOVE`. Honor
+ argument instead of ignoring it. Save and restore the
+ adjustment mode, and left-align text instead of turning off
+ filling. The latter (1) lost track of whether filling was
+ enabled in the document already (though it _probably_ was) and
+ more importantly (2) permitted lengthy charging or filing case
+ numbers to overprint author information. Use `nop` to maintain
+ logical indentation when formatting output. Use `br` requests
+ to separate title/subject and the charging and filing case
+ numbers. Favor font selection requests over escape sequences.
+ (cov@print-authors): Use `rt` request instead of `MOVE` macro,
+ to return to the vertical position marked at the end of the
+ `cov@print-date` macro (which could format more than one line of
+ output). Suspend and restore hyphenation since the context is
+ crowded, not all names follow English hyphenation patterns, and
+ arguments after the first to `AU` are often codes or
+ abbreviations. Avoid disabling filling using same technique as
+ above. Arrange `AU` arguments 3-6 as DWB 3.3 does. Stop
+ formatting a literal `TM` in the output; DWB 3.3 didn't do this.
+ {Worse, we were putting it there even if no technical memorandum
+ numbers were defined.} Drop unnecessary `PGFORM` call.
+ (cov@print-au1, cov@print-au2): Internally document what these
+ macros are for (formatting `AU` arguments, some of which get
+ special treatment), and align with DWB 3.3 output.
+ (cov@print-date): Use `sp` request instead of `MOVE` macro; we
+ can't call `SP` because this motion is negative (upward). Avoid
+ disabling filling using same technique as above. Drop
+ unnecessary `PGFORM` call. Use `mk` to mark the bottom of the
+ date output.
+ (cov@print-firm): Return early if no firm name defined. Use
+ `sp` request instead of `MOVE` macro; we can't call `SP` because
+ this motion is negative (upward). Align firm name left instead
+ of right. Set firm name in Helvetica roman if Helvetica family
+ is available; in nroff mode, use bold. Use `nop` to maintain
+ logical indentation when formatting output.
+ (cov@print-abstract): Favor font selection requests over escape
+ sequences.
+ (initialization): Define several registers to vertically and
+ horizontally arrange the document metadata. Adjust vertical
+ spacing around abstract and its caption. Favor font selection
+ requests over escape sequences.
+
+ * m.tmac (let*mt-sign): Set signatures, except for the
+ secretarial annotation, using the metadata font.
+
+ * tests/cover-page-info-is-present.sh: Update test expectations.
+
2024-06-14 G. Branden Robinson <[email protected]>
* m.tmac (SP): Validate argument. It must be numeric and can't
diff --git a/contrib/mm/m.tmac b/contrib/mm/m.tmac
index 13cf64878..3d889568b 100644
--- a/contrib/mm/m.tmac
+++ b/contrib/mm/m.tmac
@@ -3521,6 +3521,7 @@ undefined
.if !''\\$1' .as let*anno -\\$1
.in (u;\\n[.l]/2)
.nf
+.ft \*[@metadata-font]
.nr let*i 0 1
.while \\n+[let*i]<=\\n[cov*au] \{\
. ne 3v+\\n[cov*at!\\n[let*i]]v
@@ -3528,7 +3529,8 @@ undefined
. if \\n[let*i]=\\n[let*k] \{\
. if !\\n[let*sg-suppress-annotation] \{\
. \" Set annotation to left of last author's name.
-. nop \Z'\h'-(u;\\n[.l]/2)'\\*[let*anno]'\c
+. \" It does _not_ get the metadata font.
+. nop \Z'\h'-(u;\\n[.l]/2)'\f[R]\\*[let*anno]\f[]'\c
. \}
. \}
. nop \\*[cov*au!\\n[let*i]!1]
@@ -3538,6 +3540,7 @@ undefined
. nop \\*[cov*at!\\n[let*i]!\\n[let*j]]
. \}
.\}
+.ft
.fi
.in
..
diff --git a/contrib/mm/mm/0.MT b/contrib/mm/mm/0.MT
index ef4d8a86a..0fd3b676e 100644
--- a/contrib/mm/mm/0.MT
+++ b/contrib/mm/mm/0.MT
@@ -1,8 +1,12 @@
.ig
-Copyright (C) 1991-2020 Free Software Foundation, Inc.
+Copyright (C) 1991-2024 Free Software Foundation, Inc.
mm is written by J�rgen H�gg <[email protected]>
+Modified by G. Branden Robinson <[email protected]> to more
+closely approximate DWB 3.3 troff output, and to make nroff output
+flexible.
+
mm is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation, either version 3 of the License, or
@@ -21,115 +25,180 @@ http://savannah.gnu.org/bugs/?group=groff.
..
.
.\"------------
-.\" Cover sheet. Memorandum type 0-3 and "string".
+.\" cover sheet for memorandum types 0-3 and 6 ("string")
.\"------------
.if !r Au .nr Au 1
+.\" TODO: We might compute these from the page dimensions (L, W, O).
+.\" For historical reconstructions, these suffice because the AT&T mm
+.\" product anticipated only U.S. letter paper.
+.nr cov*top1 1.1i \" horizontal rule above firm name
+.nr cov*top2 1.8i \" cover sheet field data
+.ie t \{\
+. nr cov*column2-hpos 0.4i \" title, charging case, filing case
+. nr cov*column2-limit 4i
+. nr cov*column3-hpos 4.3i \" "date", "from"
+. nr cov*column4-hpos 4.65i \" date, author names, TM number
+. nr cov*column4-limit 6i
+.\}
+.el \{\
+. nr cov*column2-hpos 9n
+. nr cov*column2-limit 37n
+. nr cov*column3-hpos 39n
+. nr cov*column4-hpos 45n
+. nr cov*column4-limit 60n
+.\}
+.\"------------
.de cov@print-title
+.\" "subject:" is indented flush left; the title and any charging or
+.\" file numbers share another indentation.
.if !d cov*title .@error title not defined; call TL and AU before MT
-.MOVE 4.8c 1.5c
+.SP |\\n[cov*top2]u
.S 8
-subject:
-.sp -1.1
+.nop \\$1:
.S
-.PGFORM
.ft \\*[@metadata-font]
-.ll 9c
-.fi
+.nr cov*saved-adjustment \\n[.j]
+.ad l
+.\" Cause break to force the indentation to "take", then back up.
+.in \\n[cov*column2-hpos]u
+.ll \\n[cov*column2-limit]u
+.sp -1
.cov*title
.ft
-.ll
-.nf
+.br
.if d cov*title-charge-case \{\
-. ft B
+. B
. nop Work Project No.\& \\*[cov*title-charge-case]
-. ft
+. R
.\}
+.br
.if d cov*title-file-case \{\
-. ft B
+. B
. nop File Case \\*[cov*title-file-case]
-. ft
+. R
.\}
-.fi
+.ad \\n[cov*saved-adjustment]
+.rr cov*saved-adjustment
+.ll
+.in
..
.\"------------
.de cov@print-authors
.\" The following diagnostic might be unreachable.
.if !r cov*au .@error no authors defined; call AU before MT
-.MOVE 5.7c 13.3c
-.nf
+.rt \\n[cov*authors-vpos]
+.\" The authors always start 2 vees below the date and have 1 vee
+.\" between them in DWB 3.3.
+.SP
+.\" The material formatted here consists of proper names that could be
+.\" from any linguistic background, and character sequences that may
+.\" already be abbreviations, so suspend automatic hyphenation.
+.nr cov*saved-hyphenation-mode \n[.hy]
+.nh
+.nr cov*saved-indentation \\n[.i]
+'in \\n[cov*column3-hpos]u
.S 8
\\$1:
-.br
.S
+.\" Cause break to force the indentation to "take", then back up.
+.in \\n[cov*column4-hpos]u
+.ll \\n[cov*column4-limit]u
.sp -1
-.in 0.8c
.ft \\*[@metadata-font]
.nr cov*i 0 1
+.\" DWB 3.3 mm turned off filling, but that runs a big risk of
+.\" oversetting the line in nroff mode.
+.nr cov*saved-adjustment \\n[.j]
+.ad l
.while \\n+[cov*i]<=\\n[cov*au] \{\
. cov@print-au1 \\n[cov*i] 1
. if \\n[Au] \{\
-. cov@print-au2 \\n[cov*i] 3 4
-. cov@print-au2 \\n[cov*i] 6 5
+. cov@print-au1 \\n[cov*i] 4
+. cov@print-au2 \\n[cov*i] 3 6
+. cov@print-au1 \\n[cov*i] 5
. cov@print-au1 \\n[cov*i] 7
. cov@print-au1 \\n[cov*i] 8
. cov@print-au1 \\n[cov*i] 9
. \}
. if \\n[cov*i]<\\n[cov*au] .SP 1
.\}
+.rr cov*i
.ft
.if r cov*mt-tm-max \{\
. SP 1
. nr cov*i 0 1
. ft \\*[@metadata-font]
-TM
-. in 1.5c
-. sp -1
. while \\n+[cov*i]<=\\n[cov*mt-tm-max] \\*[cov*mt-tm!\\n[cov*i]]
-. in
. ft
.\}
-.fi
-.PGFORM
+.ad \\n[cov*saved-adjustment]
+.rr cov*saved-adjustment
+.in \\n[cov*saved-indentation]
+.rr cov*saved-indentation
+.ll
+.hy \\n[cov*saved-hyphenation-mode]
+.rr cov*saved-hyphenation-mode
..
.\"------------
-.\" index arg1
+.\" cov@print-au1 m n
+.\" Format nth argument to `AU` call of mth author.
.de cov@print-au1
-.if d cov*au!\\$1!\\$2 \\*[cov*au!\\$1!\\$2]
+.if d cov*au!\\$1!\\$2 \{\
+. ds cov*prefix \" empty
+. if '\\$2'4' .as cov*prefix Org.\& \"
+. if '\\$2'5' .as cov*prefix x\"
+. nop \\*[cov*prefix]\\*[cov*au!\\$1!\\$2]
+. rm cov*prefix
+.\}
+.br
..
.\"------------
+.\" cov@print-au2 m n q
+.\" Format nth and qth arguments to `AU` call of mth author.
.de cov@print-au2
-.\" index arg1 arg2
.if d cov*au!\\$1!\\$2 \\*[cov*au!\\$1!\\$2] \c
-.if \\$3=5 .if d cov*au!\\$1!\\$3 x\c
-.if d cov*au!\\$1!\\$3 \\*[cov*au!\\$1!\\$3]\c
+.if d cov*au!\\$1!\\$3 \\*[cov*au!\\$1!\\$3]
.br
..
.\"------------
.de cov@print-date
-.MOVE 4.8c 13.3c
+.\" We must use `sp` instead of `SP` because this motion is negative.
+.sp |\\n[cov*top2]u
+.nr cov*saved-indentation \\n[.i]
+'in \\n[cov*column3-hpos]u
.S 8
-.nf
\\$1:
-.br
.S
+.\" Cause break to force the indentation to "take", then back up.
+.in \\n[cov*column4-hpos]u
+.ll \\n[cov*column4-limit]u
.sp -1
-.in 0.8c
.ft \\*[@metadata-font]
.nop \\*[cov*new-date]
.ft
.fi
-.PGFORM
+.ll
+.mk cov*authors-vpos
+.in \\n[cov*saved-indentation]
+.rr cov*saved-indentation
..
.\"------------
.de cov@print-firm
-.if d cov*firm \{\
-. MOVE 2.8c 0 17.7c
-. S 18
-. rj 1
-\fB\\*[cov*firm]\fP
-. S
-. PGFORM
-.\}
+.if !d cov*firm .return
+.\" We must use `sp` instead of `SP` because this motion is negative.
+.sp |\\n[cov*top1]u
+.nr cov*saved-adjustment \\n[.j]
+.ad l
+.nop \l'\\n[.l]u\[em]'
+.\" DWB 3.3 mm set the firm name in bold on nroff devices, and
+.\" Helvetica roman on troff devices. Register `E` had no effect on it.
+.ie t .if F HR .fam H
+.el .B
+.nop \\*[cov*firm]
+.ie t .if F HR .fam
+.el .R
+.ad \\n[cov*saved-adjustment]
+.rr cov*saved-adjustment
..
.\"------------
.de cov@print-abstract
@@ -141,9 +210,9 @@ TM
. ll -\\n[cov*abstract-indent]u
. \}
. ce
-. ft I
+. I
. nop \\$1
-. ft
+. R
. SP 1.5
. fi
. cov*abstract
@@ -161,7 +230,9 @@ TM
.\" Note: The firm name (if any) is formatted _above_ the title and
.\" other data, but the `AF` macro call defining it might be stuffed
.\" inside the `TL` macro content, so its string won't be visible until
-.\" we format the title. This is weird but DWB-compatible.
+.\" we format the title. That in turn means that we _must_ call
+.\" `cov@print-title` before `cov@print-firm`. This is weird but
+.\" DWB-compatible.
.\"
.\" (Technical details: DWB mm stores the title in a diversion. groff
.\" mm stores it in a macro, and only calling `AU` ends the macro
@@ -175,18 +246,17 @@ TM
. SP 3
. if (\*[cov*mt-type]>=1)&(\*[cov*mt-type]<=3) \{\
. ce
-. SP 1.5
-. ft I
+. I
. nop \*[cov*mt0-txt!\*[cov*mt-type]]
-. ft
+. R
. \}
. if \*[cov*mt-type]=6 \{\
. ce
-. SP 1.5
-. ft I
+. I
. nop \*[cov*mt-type-text]
-. ft
+. R
. \}
+. SP 3
. pg@enable-top-trap
. pg@enable-trap
. ds cov*mt-printed
diff --git a/contrib/mm/tests/cover-page-info-is-present.sh
b/contrib/mm/tests/cover-page-info-is-present.sh
index b5bc9de03..1b7f58be9 100755
--- a/contrib/mm/tests/cover-page-info-is-present.sh
+++ b/contrib/mm/tests/cover-page-info-is-present.sh
@@ -62,7 +62,7 @@ echo "checking for first author" >&2
echo "$output" | grep -q 'Art Vandelay' || wail
echo "checking for second author" >&2
-echo "$output" | grep -Fq 'H. E. Pennypacker' || wail
+echo "$output" | grep -Fq 'Pennypacker' || wail
echo "checking for first technical memorandum number" >&2
echo "$output" | grep -q '78-9-ABC' || wail
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit