[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #24049] [mm] signature (SG) under MT 5 (external letter) puts spuri
From: |
G. Branden Robinson |
Subject: |
[bug #24049] [mm] signature (SG) under MT 5 (external letter) puts spurious hyphens in output |
Date: |
Sat, 17 Dec 2022 15:52:29 -0500 (EST) |
Update of bug #24049 (project groff):
Status: Confirmed => In Progress
Assigned to: None => gbranden
Planned Release: None => 1.23.0
Summary: [mm] signature (SG) under MT 5 (external letter) =>
[mm] signature (SG) under MT 5 (external letter) puts spurious hyphens in
output
_______________________________________________________
Follow-up Comment #2:
DWB 3.3 mm and Heirloom Doctools mm don't do this.
They also don't require a title for memorandum type 5 (external letter),
though this is clearly implied by the DWB 3.3 manual, which is worth quoting
for two reasons.
> In the external-letter style (`.MT 5`), only the title (without
> "subject") and the date are printed in the upper left and right
> corners, respectively, on the first page. It is expected that
> preprinted stationary [sic] will be used providing the author's
> company logo and address.
(The claim about the date being in the upper-right "corner" is either
approximate, or wrong. What all of these mm macro packages do with the date
more closely resembles a traditional U.S. business letter than a hyper-literal
interpretation of the quote above.)
Example input:
$ cat EXPERIMENTS/letter-with-signature.mm
.ND 2022-12-17
.TL
Our Automobile Requisition
.AU "S.\& Clown"
.MT 5
Dear Regional Manager,
.P 1
It's circuses all the way down.
.FC
.SG
DWB 3.3 mm output:
$ DWBHOME=. ./bin/nroff -mm
~/src/GIT/groff/EXPERIMENTS/letter-with-signature.mm | ul | cat -n
1
2
3
4
5 Our Automobile Requisition
6
7
8
9
10
11
12
13
14
15 2022-12-17
16
17
18 Dear Regional Manager,
19
20 It's circuses all the way down.
21
22 Yours very truly,
23
24
25
26 S. Clown
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
There is a minor difference in vertical spacing between DWB mm and Heirloom
Doctools mm.
--- /tmp/dwbmm.txt 2022-12-17 14:33:01.286672580 -0600
+++ /tmp/heirmm.txt 2022-12-17 14:33:28.854556501 -0600
@@ -10,20 +10,20 @@
10
11
12
- 13
+ 13 2022-12-17
14
- 15 2022-12-17
- 16
+ 15
+ 16 Dear Regional Manager,
17
- 18 Dear Regional Manager,
+ 18 It's circuses all the way down.
19
- 20 It's circuses all the way down.
+ 20 Yours very truly,
21
- 22 Yours very truly,
+ 22
23
- 24
+ 24 S. Clown
25
- 26 S. Clown
+ 26
27
28
29
And here is groff 1.22.4 output.
$ nroff -mm ~/src/GIT/groff/EXPERIMENTS/letter-with-signature.mm | cat -n
1
2
3
4
5 Our Automobile Requisition
6
7
8
9
2022‐12‐17
10
11
12
13 Dear Regional Manager,
14
15 It’s circuses all the way down.
16
17 Yours very truly,
18
19
20
21 ‐‐ S. Clown
22
23
[blank lines to 66]
There is a more substantial difference in vertical spacing here. My guess is
that this is because, as the DWB mm manual says, the user of preprinted
stationery is expected.
Backward compatibility _and_ reasonable accommodation of users who don't have
such stationery both seem reasonable, particularly since these days it is more
likely that users will employ Encapsulated PostScript or something like that
instead.
What we could do is add an extension option to reduce the space reserved for
preprinted stationery, decide on a reasonable default, and document this.
But that's an issue for another day.
The bigger problem here is line 21 in the last example.
This turned out to be easy. All one had to do was turn on GNU troff warnings
and one was led directly to the problems.
Jörgen Hägg interpolated strings that might be undefined. Specifically, if
the document author didn't lard `AU` calls with at least 4 parameters.
So here's a patch.
diff --git a/contrib/mm/m.tmac b/contrib/mm/m.tmac
index e31a8acb7..cf9d9da53 100644
--- a/contrib/mm/m.tmac
+++ b/contrib/mm/m.tmac
@@ -3333,11 +3333,16 @@ in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
.ne \\n[cov*au]u*4v
.ie \\n[.$]>1 .nr let*k 1
.el .nr let*k \\n[cov*au]
-.ds let*tmp \\*[cov*au!\\n[let*k]!3]-\\*[cov*au!\\n[let*k]!4]-
+.ds let*tmp \" empty
+.if d cov*au!\\n[let*k]!3 \{\
+. as let*tmp \\*[cov*au!\\n[let*k]!3]\"
+. if d cov*au!\\n[let*k]!4 \
+. as let*tmp -\\*[cov*au!\\n[let*k]!4]-\"
+.\}
.nr let*i 0 1
.while \\n+[let*i]<=\\n[cov*au] \{\
-. if \\n[let*i]>1 .as let*tmp /
-. as let*tmp \\*[cov*au!\\n[let*i]!2]
+. if \\n[let*i]>1 .as let*tmp /\"
+. if d cov*au!\\n[let*i]!2 .as let*tmp \\*[cov*au!\\n[let*i]!2]\"
.\}
.if !''\\$1' .as let*tmp -\\$1
.in (u;\\n[.l]/2)
The solution originally proposed does get rid of the excess hyphens (by using
the formatted output comparison operator to test strings derived from `AU`
arguments for emptiness), but it still _dereferences_ them, which correctly
produces warning diagnostics when enabled.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?24049>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #24049] [mm] signature (SG) under MT 5 (external letter) puts spurious hyphens in output,
G. Branden Robinson <=