October 14, 2009 at 5:16 PM by Dr. Drang
Instead of using templates, as a normal person would, I use scripts to print address labels, file folder labels, and envelopes. The scripts invoke groff, the GNU version of troff, the original Unix typesetting program1. Today I printed an envelope and found the formatting all screwed up. I’ve seen this before and knew immediately what had happened: an Apple software update had overwritten a groff configuration file and changed my default paper size from Letter to A4.
Fixing the format is, as I outlined in this post from a year ago, easy: edit one line of the configuration file, changing
The problem is that this fix isn’t permanent. Apple can, and clearly will, overwrite that file whenever it sees fit. I think I have a better solution.
/usr/share/groff/ directory has three subdirectories:
1.19.2 directory—which has
tmac2 subdirectories—is for files in the standard groff distribution. The
site-tmac directories are for local changes. The configuration file of interest is a couple of subdirectories down in the
1.19.2 directory; the full pathname is
/usr/share/groff/1.19.2/font/devps/DESC. This is the file I’ve changed in the past to get formatting for letter-sized paper and is the file that Apple has clobbered.
Today I decided to create a new configuration file down the
/usr/share/groff/site-font/devps/DESC. It looks like this:
res 72000 hor 1 vert 1 sizescale 1000 unitwidth 1000 sizes 1000-10000000 0 styles R I B BI family T fonts 9 0 0 0 0 0 SS S ZD ZDR tcommand postpro grops broken 0 papersize letter print lpr
It’s exactly the same as
/usr/share/groff/1.19.2/font/devps/DESC except for the
papersize line. When this file is present, groff uses it for configuring PostScript output, not the one in the
1.19.2 tree. I’m hoping that because this directory is site-specific, Apple will leave it alone in future updates, but I realize there are no guarantees.
That Apple would use an A4 paper size for its US users is still a mystery to me. As I said in last year’s post:
Groff’s lead developers are based in Europe, so it’s natural for groff to ship with a default paper size of A4. You’d think, though, that Apple would customize the configuration file for its US users.
It is, after all, just one line.
You might think troff/groff would be dead by now, overtaken by word processors, desktop publishing programs, and, for those who still prefer command-driven typesetting, LaTeX. But t/groff can’t be excised from Unix. It has job security because it’s the program that formats man pages. ↩︎
In case you’re wondering,
tmacstands for “troff macros.” It has nothing to do with the Macintosh. ↩︎