Change default paper size in groff applications

Jul 26, '04 10:43:00AM

Contributed by: paco

If you use groff for any sort of printing, you will discover that Mac OS X ships with the default paper size set to A4. If you use A4 paper,this hint does not apply to you. If you don't, then you need to change your paper size. The paper size is set in a file that is associated with the particular output device you use. Most of the time, you use the ps output device (for PostScript). The following bit of perl magic will edit every file named DESC in your /usr/share/groff/1.18.1/font directories and set the papersize from A4 to 'letter.' Run it from a Terminal command prompt (one line, shown as two; the backslash should allow copy/paste to work):

% sudo perl -pi -e 's/^papersize a4/papersize letter/' \
/usr/share/groff/1.18.1/font/*/DESC
If you edit the /usr -> share -> groff -> 1.18.1 -> font -> devps -> DESC file, you can change the font family to "H" or "P". That will make Helvetica or Palatino, respectively, your default font. I like Palatino.

But why use groff?
The best use I have for groff is printing man pages. If I want to print, for example, the ls man page, I can run this from a Terminal window:
% groff -man /usr/share/man/man1/ls.1 | ps2pdf - ls.pdf
Then I can open and read or print the ls.pdf file. This beats the heck out of printing plain text.

But how do I know what file to print?
Type man -d ls and on the last line of output, you'll see what file it would have displayed. Then supply that file name as an argument to groff as shown above, and you can get a pretty man page out of it.

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20040722172553477