groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with mm macros


From: G. Branden Robinson
Subject: Re: problem with mm macros
Date: Sat, 12 Aug 2023 03:22:40 -0500

Hi Andreas,

At 2021-02-25T15:43:50+0100, Andreas Eder wrote:
> I'm a newcomer to roff and have just begun reading the book 'UNIX
> Document Processing and Typesetting'. There is an example of a letter
> in there thay I enclose here, necause it shows the poblem:
[...]
> Now the problem is that groff doesn't show the author's title below
> the author's name. Both heirloom and neatroff do, so it is maybe a bug
> in groff? Also both heirloom and neatroff show name and tile in bold,
> whereas groff only shows the name an does not do so in bold.
> 
> Maybe someone with more experience in roff can explain what goes
> wrong.

There were some errors in your input, and groff 1.22.4 mm was not very
helpful about identifying them, nor did its groff_mm(7) man page make
terribly clear what you should be doing.

When I try your input with groff 1.23.0, released last month, I get the
following error.

$ ~/groff-stable/bin/groff -ww -b -mm -Tutf8 ATTIC/eder-letter.mm |cat -s
m.tmac:.../groff-stable/share/groff/1.23.0/tmac/mm/5.MT:48: error: title not 
defined; call TL and AU before MT

A problem is that, as noticed in the original thread from 2½ years ago,
is that you should have been using either:

1.  The `AU` and `TL` macros _both_ with `MT`, or

2.  The `WA` and `WE` macros with `LT`.

Another problem was that you gave 2 arguments to the `FC` macro when it
accepts only one.

The man page has some new language about these matters.

   Document styles
     groff mm offers three different frameworks for document
     organization.  COVER/COVEND is a flexible means of preparing any
     document requiring a cover page.  LT/LO aids preparation of typical
     Anglophone correspondence (business letters, for example).  The MT
     memorandum type mechanism implements a group of formal styles
     historically used by AT&T Bell Laboratories.  Your document can
     select at most one of these approaches; when used, each disables
     the others.
[...]
Macros
[...]
     AU [name [initials [loc [dept [ext [room [arg1 [arg2 [arg3]]]]]]]]]
             Specify author.  AU terminates a document title started
             with TL, and can be called without arguments for that
             purpose.  Author information is used by cover sheets, MT
             memoranda, and SG.  Further arguments comprise initials,
             location, department, telephone extension, room number or
             name, and up to three additional items.  Repeat AU to
             identify multiple authors.

             Use WA/WE instead to identify the author for documents
             employing LT.
[...]
     FC [closing‐text]
             Output the string Letfc, or the specified closing‐text, as
             the formal closing of a letter.
[...]
     LT [style]
             Format a letter in the designated style, defaulting to BL
             (see below).  A letter begins with the writer’s address
             (WA/WE), followed by the date (ND), the inside address
             (IA/IE), the body of the letter (P and other general‐
             purpose mm macros), the formal closing (FC), the signature
             (SG), and notations (NS/NE).  Any of these may be omitted.
             Letter options specified with LO add further annotations,
             which are extensible; see section “Internals” below.

             style   Description
             BL      Blocked: the writer’s address, date, formal
                     closing, and signature are indented to the center
                     of the line.  Everything else is left‐aligned.
             SB      Semi‐blocked: as BL, but the first line of each
                     paragraph is indented by 5m.
             FB      Fully blocked: everything begins at the left
                     margin.
             SP      Simplified: as FB, but a formal closing is omitted,
                     and the signature is set in full capitals.

I used DWB 3.3 mm as my basis for comparison.  It requires as well the
`IA`/`IE` macros for an inside address to be called for `LT` letters,
but they need not have any content.  groff mm doesn't demand them.

DWB 3.3 mm also does not put anything in boldface or italics in `LT`
letters.  The examples in its manual also do not exhibit such style
changes.

groff mm (in 1.23.0) uses only one blank line of vertical spacing at
most between segments of the letter.  I judged this to be the best
approach since there is no standard defining how large these gaps should
be--one vee seemed a reasonable minimum that people could alter within a
letter with `SP` calls, as you did, and anything not covered by that
technique, we can add registers for, probably in the `Letxxx` name
space.

I had problems with Heirloom Doctools mm.  It appears to believe that no
authors are defined.  It also throws some garbage on the output.  But it
also doesn't do any font style changes as you seemed to be expecting.
This at least is consistent with DWB 3.3 (Heirloom's predecessor).

~/heirloom$ ./bin/nroff -mm ./eder-letter-revised.mm | ul
********************
ERROR:(./eder-letter-revised.mm)input line 37:SG:no authors
********************
\&



                                  - 1 -



       Our Reference: prog/001
       Your Reference: xyz/100

[snip]

       Hope to hear from you soon.

                                     Sincerely yours,
       ********************
       ERROR:(./eder-letter-revised.mm)input line 37:SG:no authors

This seems to be a bug in Heirloom mm.

Possibly the style changes you were expecting were those in memorandum
type 5.

I prepared two revised versions of your input, one using `LT` (the
default, "blocked" letter type), and one using `MT 5`.

Here are the diffs from your original.

$ diff -U1 eder-letter.mm eder-letter-lt-version.mm
--- eder-letter.mm      2023-08-12 02:02:49.611122635 -0500
+++ eder-letter-lt-version.mm   2023-08-12 03:14:14.414583984 -0500
@@ -1,5 +1,5 @@
 .ND "January 1, 1999"
-.AU "Dr. Gray Hound"
-.AT "Project Leader"
-.MT 5
+.WA "Dr. Gray Hound" "Project Leader"
+.WE
+.LT
 .DS
@@ -15,3 +15,3 @@
 .SP 3
-Dear Mr. Smith
+Dear Mr. Smith:
 .SP 2
@@ -35,3 +35,3 @@
 Hope to hear from you soon.
-.FC Sincerely yours
+.FC "Sincerely yours,"
 .SG

$ diff -U1 eder-letter.mm eder-letter-mt-5-version.mm
--- eder-letter.mm      2023-08-12 02:02:49.611122635 -0500
+++ eder-letter-mt-5-version.mm 2023-08-12 03:14:00.642607549 -0500
@@ -1,2 +1,4 @@
 .ND "January 1, 1999"
+.TL
+Recruitment of a Programmer
 .AU "Dr. Gray Hound"
@@ -15,7 +17,3 @@
 .SP 3
-Dear Mr. Smith
-.SP 2
-.ce
-Recruitment of a Programmer
-.fi
+Dear Mr. Smith:
 .SP 2
@@ -35,3 +33,3 @@
 Hope to hear from you soon.
-.FC Sincerely yours
+.FC "Sincerely yours,"
 .SG

I hope you find the mm in groff 1.23.0 to be of higher quality.
Please advise regarding any further problems you have with it.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]