[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 01/01: [mom]: Add CC to letter macros
From: |
Peter Schaffter |
Subject: |
[groff] 01/01: [mom]: Add CC to letter macros |
Date: |
Sun, 17 Nov 2024 15:43:34 -0500 (EST) |
PTPi pushed a commit to branch master
in repository groff.
commit ec01d40eec1c67235e53d84984800d0d3c24a642
Author: Peter Schaffter <peter@schaffter.ca>
AuthorDate: Sun Nov 17 15:36:20 2024 -0500
[mom]: Add CC to letter macros
[om.tmac]: Add CC to letter macros
[TODO]: Update TODO
[examples]: Update examples/letter.html, amend READMEs
[docs]: Document CC macro, update macrolist.html
---
contrib/mom/TODO | 3 +-
contrib/mom/examples/README-fr.txt | 4 +-
contrib/mom/examples/README.txt | 8 +--
contrib/mom/examples/letter.mom | 8 ++-
contrib/mom/momdoc/letters.html | 108 +++++++++++++++++++++++++-------
contrib/mom/momdoc/macrolist.html | 14 +++--
contrib/mom/om.tmac | 123 ++++++++++++++++++++++++-------------
7 files changed, 188 insertions(+), 80 deletions(-)
diff --git a/contrib/mom/TODO b/contrib/mom/TODO
index d9bb25738..f06a8e3e7 100644
--- a/contrib/mom/TODO
+++ b/contrib/mom/TODO
@@ -1,10 +1,9 @@
-*- txt -*-
- Copyright 2004-2020 Free Software Foundation, Inc.
+ Copyright 2004-2024 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
- cutarounds
-- clickable footnote and endnote markers
- indexing
diff --git a/contrib/mom/examples/README-fr.txt
b/contrib/mom/examples/README-fr.txt
index 84a98629d..876d394da 100644
--- a/contrib/mom/examples/README-fr.txt
+++ b/contrib/mom/examples/README-fr.txt
@@ -21,7 +21,7 @@ avec pdfmom(1).
pdfmom mom-pdf.mom > mom-pdf.pdf
pdfmom sample_docs.mom > sample_docs.pdf
- pdfmom slide-demo.mom > slide-demo.pdf
+ pdfmom -t -p -e slide-demo.mom > slide-demo.pdf
pdfmom -K utf8 letter.mom > letter.pdf
pdfmom -K utf8 mon_premier_doc.mom > mon_premier_doc.pdf
pdfmom -K utf8 typesetting.mom > typesetting.pdf
@@ -32,7 +32,7 @@ Les fichiers
Tous les fichiers sont configurés pour le format lettre US, exceptés
mom-pdf.mom et mon_premier_doc.mom, qui utilisent le format A4.
-***typesetting.mom**
+***typesetting.mom***
Le fichier typesetting.mom montre l'utilisation d'éléments de
composition typographique: tabulations, tabulations intégrées dans des
diff --git a/contrib/mom/examples/README.txt b/contrib/mom/examples/README.txt
index 4e4115702..4d3f8096b 100644
--- a/contrib/mom/examples/README.txt
+++ b/contrib/mom/examples/README.txt
@@ -20,7 +20,7 @@ files with pdfmom(1).
pdfmom mom-pdf.mom > mom-pdf.pdf
pdfmom sample_docs.mom > sample_docs.pdf
- pdfmom slide-demo.mom > slide-demo.pdf
+ pdfmom -t -p -e slide-demo.mom > slide-demo.pdf
pdfmom -K utf8 letter.mom > letter.pdf
pdfmom -K utf8 mon_premier_doc.mom > mon_premier_doc.pdf
pdfmom -K utf8 typesetting.mom > typesetting.pdf
@@ -29,9 +29,9 @@ The files themselves
--------------------
All are set up for US letter papersize except mom-pdf.mom and
-mon_premier_doc.mom, which uses A4.
+mon_premier_doc.mom, which use A4.
-***typesetting.mom**
+***typesetting.mom***
The file, typesetting.mom, demonstrates the use of typesetting tabs,
string tabs, line padding, multi-columns and various indent styles,
@@ -39,7 +39,7 @@ as well as some of the refinements and fine-tuning available
via
macros and inline escapes.
Because the file also demonstrates a cutaround using a small picture
-of everybody's favourite mascot, Tux, the PDF file, penguin.pdf has
+of everybody's favourite mascot, Tux, the PDF file 'penguin.pdf' has
been included in the directory.
***sample_docs.mom***
diff --git a/contrib/mom/examples/letter.mom b/contrib/mom/examples/letter.mom
index 6e1a0c0a9..8577aad9e 100644
--- a/contrib/mom/examples/letter.mom
+++ b/contrib/mom/examples/letter.mom
@@ -1,6 +1,6 @@
.\" -*- mode: text; coding: utf-8; -*-
\#
-\# Copyright (C) 2004-2020 Free Software Foundation, Inc.
+\# Copyright (C) 2004-2024 Free Software Foundation, Inc.
\#
\# Copying and distribution of this file, with or without modification,
\# are permitted in any medium without royalty provided the copyright
@@ -12,12 +12,18 @@
.START
.DATE
August 25, 2013
+\# Or enter the current date symbolically using date(1).
+\#.pso date "+%B %-e, %Y%n" \" Pass pdfmom the -U flag when using .pso
.TO
GUILLAUME BARRIÈRES
Minidoux Corporation
5000 Pannes Drive
Redmond, Virginia
USA
+.CC
+John Doe
+Jane Deere
+Joe Blow
.FROM
Y.P. GUIQUE
022 Umask Road
diff --git a/contrib/mom/momdoc/letters.html b/contrib/mom/momdoc/letters.html
index 3021eb2ab..be97f8d64 100644
--- a/contrib/mom/momdoc/letters.html
+++ b/contrib/mom/momdoc/letters.html
@@ -2,7 +2,7 @@
<!--
This file is part of groff, the GNU roff type-setting system.
-Copyright (C) 2004-2020 Free Software Foundation, Inc.
+Copyright (C) 2004-2024 Free Software Foundation, Inc.
Written by Peter Schaffter (peter@schaffter.ca).
Permission is granted to copy, distribute and/or modify this document
@@ -120,6 +120,7 @@ The macros for entering the headers are simple
(they’re not even
<span class="pre-in-pp">
.DATE
.TO
+ .CC
.FROM
.GREETING
</span>
@@ -139,15 +140,18 @@ macro.
</p>
<p>
-At the end of the letter, should you wish a closing (“Yours
+Letters are concluded with the
+<a href="#closing">CLOSING</a>
+macro. If you want a complimentary closing (“Yours
truly,” “Sincerely,” “Hugs and
-kisses”), invoke the macro <kbd>.CLOSING</kbd> on a line
-by itself, and follow it with the text of the closing. <b>N.B.</b>
-Don’t put your name here; mom supplies it automatically from
+kisses”), invoke CLOSING on a line by itself and follow
+it with the text of the closing. <b>N.B.</b> Don’t
+add your name; mom supplies it automatically (from
<a href="docprocessing.html#author">AUTHOR</a>),
-with enough space to leave room for your signature. If you omit the
-closing, mom simply adds your name (from AUTHOR), again with enough
-space for your signature.
+leaving room above it for your signature. If you'd prefer not to have a
+complimentary closing, place <kbd>\&</kbd> immediately underneath
+<kbd>.CLOSING</kbd>. Mom then just adds your name (from AUTHOR),
+again leaving room for your signature.
</p>
<p>
@@ -166,6 +170,10 @@ here’s what the complete letter looks like.
Minidoux Corporation
5000 Pannes Drive
Redmond, Virginia
+ .CC
+ John Doe
+ Jane Deere
+ Joe Blough
.FROM
Y.P. GUIQUE
022 Umask Road
@@ -209,9 +217,13 @@ letter like this:
Minidoux Corporation
5000 Pannes Drive
Redmond, Virginia
+ .CC
+ John Doe
+ Jane Deere
+ Joe Blough
.DATE
.RIGHT
- August 25, 2004
+ August 25, 2010
.GREETING
Dear Mr. Barrières,
</span>
@@ -233,7 +245,7 @@ In letters, if the order of header macros is
<li><kbd>.GREETING</kbd> (“Dear Whoever,” “To
Whom It May Concern,” etc.)</li>
</ol>
<p style="margin-top: -.5em;">
-mom sets
+Mom sets
</p>
<ul style="margin-top: -.5em;">
<li>the date flush right, page right, at the top of page one,
@@ -251,6 +263,8 @@ mom sets
</ul>
<p style="margin-top: -.5em;">
which is the standard for North American business correspondence.
+The <kbd>.CC</kbd> macro, followed by a list of carbon copy
+recipients, may go anywhere before <kbd>.GREETING</kbd>
</p>
<p>
@@ -332,6 +346,7 @@ and before
<ul class="macro-list" style="margin-top: -.75em;">
<li><a href="#date">DATE</a></li>
<li><a href="#to">TO</a></li>
+ <li><a href="#cc">CC</a></li>
<li><a href="#from">FROM</a></li>
<li><a href="#greeting">GREETING</a></li>
<li><a href="#closing">CLOSING</a>
@@ -355,17 +370,31 @@ underneath, like this:
<br/>
<span class="pre-in-pp">
.DATE
- October 31, 2012
+ October 31, 2024
+</span>
+You may also enter the date symbolically using groff’s
+<b>.pso</b> request and the system <b>date</b> command, like
+this:
+<br/>
+<span class="pre-in-pp">
+ .DATE
+ .pso date "+%B %-e, %Y%n"
</span>
+Consult the date(1) manpage for details of date formatting. Note
+that you must pass <b>pdfmom</b> or <b>groff</b> the <b>-U</b> flag
+when you use the <b>.pso</b> request.
+</p>
+
+<p>
If you wish to change the default quad direction for the date,
enter <kbd>.LEFT</kbd> or <kbd>.RIGHT</kbd>, on a line by itself,
immediately after <kbd>.DATE</kbd>.
</p>
<p>
-If you wish to insert additional space between the date and any
-letter header that comes after it, do so after inputting the date,
-not at the top of the next header macro, like this:
+If you want additional space between the date and any letter header
+that comes after it, do so after inputting the date, not at the top
+of the next header macro, like this:
<br/>
<span class="pre-in-pp">
.DATE
@@ -402,9 +431,9 @@ immediately after <kbd>.TO</kbd>.
</p>
<p>
-If you wish to insert additional space between the address and
-any letter header that comes after it, do so after inputting the
-address, not at the top of the next header macro, like this:
+If you want additional space between the address and any letter
+header that comes after it, do so after inputting the address, not
+at the top of the next header macro, like this:
<br/>
<span class="pre-in-pp">
.TO
@@ -421,6 +450,34 @@ If you wish to remove the default space,
will do the trick.
</p>
+<!-- -CC- -->
+
+<div id="cc" class="box-macro-args">
+Macro: <b>CC</b>
+</div>
+
+<p>
+The <kbd>.CC</kbd> macro, invoked on a line by itself and followed
+by the names of carbon copy recipients, one to a line, creates a CC
+list that is set at the bottom of letters, underneath the signature
+line. If the list runs deep, mom shifts it to the next page.
+</p>
+
+<p>
+Mom’s default is to introduce the list of CC recipients with
+<kbd>CC:</kbd>. The default can be changed with the CC_STRING
+macro, e.g.
+<br/>
+<span class="pre-in-pp">
+ .CC_STRING "Copies to:"
+</span>
+
+</p>
+<p>
+When setting up letter headers, the CC macro may go anywhere before
+<a href="#greeting">GREETING</a>.
+</p>
+
<!-- -FROM- -->
<div id="from" class="box-macro-args">
@@ -443,9 +500,9 @@ immediately after <kbd>.FROM</kbd>.
</p>
<p>
-If you wish to insert additional space between the address and
-any letter header that comes after it, do so after inputting the
-address, not at the top of the next header macro, like this:
+If you want additional space between the address and any letter
+header that comes after it, do so after inputting the address, not
+at the top of the next header macro, like this:
<br/>
<span class="pre-in-pp">
.FROM
@@ -485,14 +542,19 @@ Macro: <b>CLOSING</b>
</div>
<p>
-Invoke <kbd>.CLOSING</kbd> on a line by itself after the body of
-the letter, with the closing you’d like (e.g. “Yours
-truly,”) underneath, like this:
+Mom-formatted letters must end with <kbd>.CLOSING</kbd>. Follow
+it on the next line with your preferred complimentary closing
+(e.g. “Yours truly,”), like this:
<br/>
<span class="pre-in-pp">
.CLOSING
Yours truly,
</span>
+If you’d rather not have a complimentary closing, follow
+<kbd>.CLOSING</kbd> with <kbd>\&</kbd> on a line by itself. Mom
+will still automatically supply the signature line, whose position
+you may want to adjust with
+<a href="signature-space">SIGNATURE_SPACE</a>.
</p>
<div class="box-tip" style="background-color: #E3D2B1;">
diff --git a/contrib/mom/momdoc/macrolist.html
b/contrib/mom/momdoc/macrolist.html
index 8da5b7621..a78054351 100644
--- a/contrib/mom/momdoc/macrolist.html
+++ b/contrib/mom/momdoc/macrolist.html
@@ -77,15 +77,16 @@ elsewhere in the documentation.
<ul style="margin-top: .5em; margin-left: 0; padding-left: 0; list-style-type:
none;">
<li><a href="#qr-19">Reference macros (metadata)</a></li>
<li><a href="#qr-20">Document type and initial defaults</a></li>
- <li><a href="#qr-59"> – Slides</a></li>
+ <li><a href="#qr-59"> – Slide presentations</a></li>
+ <li><a href="#qr-41"> – Letters
(correspondence)</a></li>
<li><a href="#qr-23">TYPEWRITE control macros</a></li>
<li><a href="#qr-57">Vertical whitespace management</a></li>
<li><a href="#qr-47">Document and section cover (title) pages</a></li>
<li><a href="#qr-22">Set documents in columns</a></li>
- <li><a href="#qr-21">Line numbering</a></li>
</ul>
</div>
<ul style="margin-top: 1.75em; margin-left: 0; padding-left: 0;
list-style-type: none;">
+ <li><a href="#qr-21">Line numbering</a></li>
<li><a href="#qr-24">Initiate document processing</a></li>
<li><a href="#qr-42">Global print style changes after START</a></li>
<li><a href="#qr-43">Managing the docheader</a></li>
@@ -111,7 +112,6 @@ elsewhere in the documentation.
<li><a href="#qr-39">Bibliographic references</a></li>
<li><a href="#qr-40">Tables of contents</a></li>
<li><a href="#qr-55">Lists of Figures, Tables, and Equations</a></li>
- <li><a href="#qr-41">Letter (correspondence) macros</a></li>
<li><a href="#qr-44">Managing page headers and footers</a></li>
<li><a href="#qr-45">Recto/verso page headers and footers</a></li>
<li><a href="#qr-46">Pagination</a></li>
@@ -708,7 +708,10 @@ elsewhere in the documentation.
<td><a href="docprocessing.html#doctype">DOCTYPE</a></td><td>-- general
document type</td>
</tr>
<tr>
-<td id="qr-59"><a href="docprocessing.html#slides">DOCTYPE
SLIDES</a></td><td>-- create slide presentation</td>
+<td id="qr-62"><a href="letters.html"> LETTERS</a></td><td>-- write
correspondence</td>
+</tr>
+<tr>
+<td id="qr-59"><a href="docprocessing.html#slides"> SLIDES</a></td><td>--
create a slide presentation</td>
</tr>
<tr>
<td><a href="docprocessing.html#copystyle">COPYSTYLE</a></td><td>-- draft or
final copy</td>
@@ -1288,6 +1291,9 @@ elsewhere in the documentation.
<td><a href="letters.html#to">TO</a></td><td>-- letter’s addressee</td>
</tr>
<tr>
+<td><a href="letters.html#cc">CC</a></td><td>-- carbon copy list</td>
+</tr>
+<tr>
<td><a href="letters.html#greeting">GREETING</a></td><td>-- letter’s
salutation</td>
</tr>
<tr>
diff --git a/contrib/mom/om.tmac b/contrib/mom/om.tmac
index b0b5d4c88..7ecd3f160 100644
--- a/contrib/mom/om.tmac
+++ b/contrib/mom/om.tmac
@@ -5024,7 +5024,7 @@ y\R'#DESCENDER \\n[.cdp]'
. FOOTER_RIGHT_SIZE +0
. FOOTER_RIGHT "\&.../\E*[$SUITE]
. FOOTER_ON_FIRST_PAGE
-. em ALL_DONE
+. ds $CC_STRING CC:
. \}
. if '\\$1'SLIDES' \{\
. shift
@@ -5143,7 +5143,12 @@ y\R'#DESCENDER \\n[.cdp]'
\# LETTERHEAD<n>
\#
.MAC DATE END
-. if !'\\n[.z]'' .di
+. if !'\\n[.z]'' \{\
+\!. vpt
+. di
+. if \\n[#GET_CC_DEPTH] .nr #CC_DEPTH \\n[dn]
+. rm #GET_CC_DEPTH
+. \}
. di LETTERHEAD\\n+[#FIELD]
. ie \\n[#FIELD]=1 \{\
. nr #DATE_FIRST 1
@@ -5161,11 +5166,40 @@ y\R'#DESCENDER \\n[.cdp]'
\# diversion LETTERHEAD<n>
\#
.MAC TO END
-. if !'\\n[.z]'' .di
+. if !'\\n[.z]'' \{\
+\!. vpt
+. di
+. if \\n[#GET_CC_DEPTH] .nr #CC_DEPTH \\n[dn]
+. rm #GET_CC_DEPTH
+. \}
. di LETTERHEAD\\n+[#FIELD]
. LEFT
.END
\#
+\# CC
+\# --
+\# *Arguments:
+\# <none>
+\# *Function:
+\# Stores CC list in diversion CC_LIST, output after closing and
+\# signature. Default $CC_STRING is CC: but can be user set with
+\# CC_STRING.
+\#
+.MAC CC END
+. if !'\\n[.z]'' .di
+. nr #GET_CC_DEPTH 1
+. di CC_LIST
+\!. vpt 0
+\!. IQ CLEAR
+. nop \\*[$CC_STRING]\c
+. EL
+\!. in \w'\\\\*[$CC_STRING]\ \ 'u
+.END
+\#
+.MAC CC_STRING END
+. ds $CC_STRING \\$1
+.END
+\#
\# FROM
\# ----
\# *Arguments:
@@ -5175,7 +5209,12 @@ y\R'#DESCENDER \\n[.cdp]'
\# diversion LETTERHEAD<n>
\#
.MAC FROM END
-. if !'\\n[.z]'' .di
+. if !'\\n[.z]'' \{\
+\!. vpt
+. di
+. if \\n[#GET_CC_DEPTH] .nr #CC_DEPTH \\n[dn]
+. rm #GET_CC_DEPTH
+. \}
. di LETTERHEAD\\n+[#FIELD]
. LEFT
.END
@@ -5197,9 +5236,10 @@ y\R'#DESCENDER \\n[.cdp]'
\# CLOSING
\# -------
\# *Arguments:
-\# <closing string>
+\# <none>
\# *Function:
-\# Stores greeting in diversion CLOSING.
+\# Stores complimentary closing (entered on the next line) in
+\# diversion CLOSING.
\#
.MAC CLOSING END
. if '\\*[$SIG_SPACE]'' .ds $SIG_SPACE 3v
@@ -5215,7 +5255,35 @@ y\R'#DESCENDER \\n[.cdp]'
. \}
. el .br
. nr #CLOSING 1
+. sp
+. it 1 END_LETTER
. di CLOSING_TEXT
+. LEFT
+.END
+\#
+\# Prints complimentary closing, signature line, and CC list.
+\#
+.MAC END_LETTER END
+. di
+. ie !'\\*[$CLOSE_INDENT]'' .IL \\*[$CLOSE_INDENT]
+. el .IL \\n[#DOC_L_LENGTH]u/2u
+. nf
+. CLOSING_TEXT
+. sp \\*[$SIG_SPACE]
+. PRINT \\*[$AUTHOR_1]
+. sp
+. if d CC_LIST \{\
+. if !\\n[@TOP] \{\
+. if \\n[#CC_DEPTH]>\\n[.t] \{\
+. tm1 "[mom]: Insufficient room for CC list.
+. tm1 " Shifting to next page.
+. NEWPAGE
+. FOOTERS off
+. \}
+. CC_LIST
+. \}
+. \}
+. FOOTERS off
.END
\#
\# CLOSING INDENT
@@ -5223,7 +5291,7 @@ y\R'#DESCENDER \\n[.cdp]'
\# *Argument:
\# <amount to indent closing from left margin>
\# *Function:
-\# Defines string $CLOSE_INDENT for use in macro, ALL_DONE.
+\# Defines string $CLOSE_INDENT for use in macro END_LETTER.
\#
.MAC CLOSING_INDENT END
. ds $CLOSE_INDENT \\$1
@@ -5234,7 +5302,7 @@ y\R'#DESCENDER \\n[.cdp]'
\# *Argument:
\# <amount of space to leave for signature>
\# *Function:
-\# Defines string $SIG_SPACE for use in macro, ALL_DONE.
+\# Defines string $SIG_SPACE for use in macro END_LETTER.
\#
.MAC SIGNATURE_SPACE END
. ds $SIG_SPACE \\$1
@@ -18385,9 +18453,9 @@ EN-\\n[#CH_NUM]\\n[#EN_NUMBER]-body
\s-2\v'-\\n[#DOC_LEAD]u/7u'\\n[#EN_NUMBER]\|
. ta \\n[.l]u
.END
\#
-\# This .em (for all DOC_TYPEs, except 4 [LETTER]) ensures that
-\# deferred footnotes and floats that happen on the 2nd to last page
-\# get output, and the last page/col isn't flexed.
+\# This .em for all DOC_TYPEs ensures that deferred footnotes and
+\# floats that happen on the 2nd to last page get output, and the
+\# last page/col isn't flexed.
\#
.MAC TERMINATE END
. if dPDF.EXPORT .tm .ds last-page \\n%@\\n[#COL_NUM]
@@ -18414,39 +18482,6 @@ EN-\\n[#CH_NUM]\\n[#EN_NUMBER]-body
\s-2\v'-\\n[#DOC_LEAD]u/7u'\\n[#EN_NUMBER]\|
' bp
.END
\#
-\# END MACRO FOR LETTERS
-\# ---------------------
-\# *Arguments:
-\# none
-\# *Function:
-\# The .em macro executed at the end of letters. Turns footers
-\# and pagination off, terminates and outputs diversion CLOSING
-\# (indented with the author's name underneath).
-\#
-.MAC ALL_DONE END
-. ch FOOTER
-. ch HEADER
-. br
-. if \\n[#DOC_TYPE]=4 \{\
-. if !'\\n[.z]'' \{\
-. br
-. ALD \\*[$SIG_SPACE]
-. di
-. \}
-. IQ CLEAR
-. TQ
-. LEFT
-. ie !'\\*[$CLOSE_INDENT]'' .IL \\*[$CLOSE_INDENT]
-. el .IL \\n[#DOC_L_LENGTH]u/2u
-. sp
-. if \\n[#CLOSING] \{\
-. CLOSING_TEXT
-. br
-. \}
-. PRINT \\*[$AUTHOR_1]
-. \}
-.END
-\#
\# Set up a default papersize of US letter
\#
.PAGEWIDTH 8.5i
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 01/01: [mom]: Add CC to letter macros,
Peter Schaffter <=