Letters in roff

This commit is contained in:
Neale Pickett 2013-07-18 17:30:47 -05:00
parent d9d4ae456d
commit 5d0034d74c
3 changed files with 108 additions and 7 deletions

View File

@ -39,10 +39,5 @@ I'm happy playing booty
rap, teen pop, salsa, 50s rock, bluegrass, line dances, or whatever else
your crowd likes.
I have about a year's worth of training from Toastmasters, and am happy to
perform Master of Ceremonies duties at your event. I can also help you with
modest interior design: my focus is always on making a nice environment on
a tight budget.
To discuss availability and pricing, call the number on my card or [email
me](mailto:neale@woozle.org).
I am currently only doing events for the derby team and team members.
This does, however, include parties and weddings.

View File

@ -4,6 +4,7 @@ These are papers I have written. Most of them were written to explain a
concept to someone on woozle. Hopefully other people will find them
useful, too.
Roller Derby Stuff
------------------
@ -11,9 +12,11 @@ Roller Derby Stuff
* [Dirtbags DJ Setup](dj.html)
* [Copyright Advice for Small Leagues](derby-copyright.html)
Computer Nerd Stuff
-------------------
* [Writing formal letters with roff](roff-letters.html)
* [Runit on Arch Linux](arch-runit.html)
* [Reply-To Munging Still Considered Harmful](reply-to-still-harmful.html)
* [Runnning PHP as a CGI](php-cgi.html) in anything other than Apache
@ -22,6 +25,7 @@ Computer Nerd Stuff
* [3-Minute HTML Tutorial](html-tutorial.html)
* [How DNS Works](DNS.html)
Everything Else
---------------

102
papers/roff-letters.mdwn Normal file
View File

@ -0,0 +1,102 @@
Title: Writing formal letters with roff's "mm" package
I like using roff for quick things like letters and memos,
because it's already on every system,
works the same everywhere,
and lets me focus on content instead of presentation.
Because it uses plain text files for input,
I can use my favorite text editor to create roff documents.
LaTeX, for reasons unknown, encourages me to endlessly twiddle the formatting.
How to run roff
--------------------
If you have a file called "letter.mm",
this will create "letter.ps":
groff -k -mm < letter.mm > letter.ps
The `-k` option tells groff that your input is UTF-8.
Your computer probably knows how to display PostScript if you double-click the file.
I use the `gv` program from the command line.
The Document
-------------------
.IA "Theodore Geisel" "Director of Illustration"
Hat Cat Heavy Industries
800 NW Jiboo Rd
Springfield, MO 17528
.IE
.WA "Neale Pickett" "Head Snark"
12423 Worrin Ave
Tres Brazos, NM 87923
.WE
.LO SA
.LT
.P
I found your advertisement in "Obscure Sports Quarterly".
I am writing to request a copy of your pamphlet,
"50 Ways to Sink A Bat".
.P
Please, if possible,
wrap the pamphlet in a leaf of lettuce or cabbage.
If it is not too much to ask,
could you also kiss the envelope before it is mailed?
I have found that mail fairies prefer kissed envelopes
and want to make sure your pamphlet arrives
as quickly as possible.
.FC
.SG
You should copy and paste this into a file called `letter.mm`,
and run roff on it,
to see what the output looks like.
What This All Means
------------------------
In roff, any line beginning with a period is a command.
The file begins with `.IA`,
the command for "addressee".
It takes two arguments:
name (Theodore Geisel) and title (Director of Illustration).
This is followed by the address.
The end of the address is denoted by `.IE`.
Next up, the author's information.
This takes the same format as addressee,
using the `.WA` and `.WE` commands.
`.LO SA` tells roff that we'd like a salutation to open the letter.
The mm package uses "To whom it may concern:" by default,
but you can specify whatever you'd prefer as an argument:
.LO SA "Dear folks,"
`.LT` means this is a letter.
`.P` tells roff to start a new paragraph.
And then we have the actual text of the first paragraph.
Hopefully this part is self-explanatory!
`.FC` prints a closing.
This will be "Yours very truly," unless you specify an argument:
.FC "Sincerely,"
`.SG` leaves some space for a signature,
then prints your name and title.
More Information
---------------------
`man groff_mm` describes the entire macro package.
When I need more control over formatting,
I switch to Google Drive or LibreOffice.