Modern troff with GNU groff
One developer's involvement in GNU groff, the small but powerful document preparation system.
GNU groff is the modern replacement for the Unix nroff and troff document preparation systems. James Clark began work on a GNU implementation of
ditroff in early 1989. Since then, groff has grown to provide extensions and additional functionality not possible in the original Unix troff, while providing backwards compatibility with original nroff and troff.
Recently, GNU released groff version 1.23.0. To celebrate the new release, I asked developer Deri James about his work on the groff system.
Who are you, and when did you first get involved in groff?
I'm Deri, the chap who wrote and maintains
gropdf, the PDF generating backend for groff. I was born in the UK with cerebral palsy and went to two special, residential schools for the disabled. It makes my speech difficult to understand and poor dexterity.
My first involvement with groff was in the mid 1990s when the stockbroker for whom I worked asked how we might improve client output. We were sending ASCII files to an external printer who used line printer emulation to print on custom stationery, which was different for each type of job.
I realized that if we sent Postscript to the printer, then the custom form "furniture" could be sent as part of the Postscript stream. And instead of using pre-printed stationery, we could use cheaper, blank A4 paper. We could also move away from fixed pitch fonts.
The client data was held in a Pick database so I wrote a Pick Basic library which the report programs could call. The library combined the data with a template file, which described the report layout (including the form furniture) and generated roff code which was passed to groff to produce Postscript output.
How did you get started as a groff developer?
When Werner Lemberg added color controls to groff, although specific Postscript commands had been around for a while, it seemed a good idea to provide the same reports as colored PDFs which could be accessed on a client portal. Printing was monochrome with barcodes controlling finishing, such as enveloping and leaflet insertion.
I did not know if I would be able to write a PDF driver for groff, so I did it all at home as a hobby. When completed, it was accepted for groff and I started using it to produce PDF reports at work.
What macro set do you use the most?
I don't produce many documents by hand. Most of my groff use is as a backend to programs I write which produce roff output. My typing speed is abysmal, and my writing is indecipherable - even by me. I do like the
-mom macros by Peter Schafter; they have the best integration for producing PDFs.
What cool or unexpected project have you done in groff?
My wife, who has hemiplegia cerebral palsy, loves crafting; she has an embroidery machine with hundreds of embroidery files. She asked me why the file manager didn't show a little preview of her embroidery files like it did for other files. So I wrote a program which converted various embroidery formats to SVGs. Then I thought I could also output troff commands as an alternative. I don't know if it is cool or just crazy.
Perhaps a little cooler is the "Using PDF boxes with groff and the ms macros" demonstration document, which integrates a new facility in
gropdf (1.23.0) with the
I did write a
busgrap pre-processor for groff (similar to
pic) for producing various graphs and charts, which is a bit in the doldrums because I find writing user documentation daunting - so many words to type.
I also have a CuBox/i4 which is a 1-inch SBC which serves up all man pages as linked PDFs. You can see its contents at PDF Man Page Index.
GNU groff just released version 1.23.0 in July. What new features are in the new version?
groff now provides a man page collection of all its man pages as a single PDF, with links to each page in the overview pane. The next release may go further and include intra-page links, so a reference within a man page to another page will also be clickable. The Linux kernel man pages project is already producing a PDF collection using the new code, with all the pages linked. The very latest code reduces the PDF file size by about 40%, but I am still testing.
And a fun question: How do you pronounce groff? Is it "gee-roff" or one word, as "groff"?
I'm more of a Grrrroff kinda guy. I'm unsure if this is Welsh heritage, too much testosterone, or whether it just feels better after a choice expletive - usually when results are not as expected!
Thanks to Deri for this insightful interview about working on groff. You can find more history about groff at Background (The GNU Troff Manual). An updated and more extensive history of *roffs is also in the roff(7) man page, available by typing
man 7 roff. If you don't have the system man pages, skip ahead to page 372 in the collected man pages document (PDF). Download the new groff 1.23.0 from the GNU roff (groff) website.