5 reasons to love groff
Why I loved writing documents in groff.
I first discovered Unix systems in the 1990s when I was an undergraduate student. At first, I spent a lot of time in the Unix lab on campus. One thing I liked about Unix was the nroff
document preparation system. Using nroff
was a completely new way to write documents, such as my class papers.
Before then, I used desktop word processors on DOS—and these were certainly very powerful and provided fine-tuned customization. But I was fascinated with the concept of preparing a document using macros (the -me
macros were my favorite). After typing a few commands, my paper was ready to print on the lab printer.
Over time, I learned about a new thing called Linux which was an open source version of the Unix operating system. And I quickly discovered that Linux included nroff
via the groff
package—and groff
also supported high quality output that I could print on the lab’s laser printers. All I had to do was replace the nroff
command (which prepared documents suitable for printing on a standard dot matrix printer) with the groff
command (which could generate output in PostScript format, ready for laser printers).
While I don’t write many documents with groff
these days, I still remember the macros and commands to prepare documents. If you’re the same and you learned how to write with groff
or nroff
, you probably recognize these signs that you’re a groff
fan:
1. You have a favorite macro set
In groff
, you format a document by writing the content in plain text, interspersed with macros. A macro in groff
is a short command that starts with a period at the start of a line. For example, to insert two lines of space, you would add this statement in your document:
.sp 2
To make preparing documents easier with nroff
and groff
, other authors developed collections of commands, called macros. For example, you might define a macro called .P
to generate a new paragraph by adding a blank line with .sp 1
then setting a temporary indent for the next line with .ti 4
:
.de P
.sp 1
.ti 4
..
Several collection of these macros became popular, such as -ms
to prepare certain technical documents or -man
to format system manual pages. I was very fond of the -me
macro set to write class papers. If you wrote documents in nroff
and groff
, you probably have a favorite macro set you like to use.
2. You focus on content, not formatting
One great feature of writing with any markup system is that you can focus on the content of your document, and not worry too much about what it will look like. That’s a power feature for technical writers looking for a distraction free writing environment.
Once you get comfortable writing with the different macros, I find the macros tend to disappear. My mind subtracts them from the document, and I focus just on the text in front of me. When I’m done with my document, I prepare the file for printing by processing it through groff
, usually with the -T
option to specify an output type like Postscript, PDF, HTML, or plain text.
3. You like the old school feel
It might be easier to write a document using a modern word processor like Google Docs, Microsoft Word, or LibreOffice Writer. And for certain kinds of documents, a desktop word processor is the right tool for the job.
I may do a lot of my writing in LibreOffice Writer or Google Docs, but when I get that itch to do it “old school,” it’s hard to beat using a classic editor like vi
or ed
to format documents using groff
macros.
4. You use it anywhere
The roff
systems like nroff
and troff
(and later, GNU groff
) were developed on Unix or Unix-like systems. And the standard macro packages like -ms
and -me
don’t change; they should be the same on every system. The great thing about that is once you know how to write on one system, you can do the same on any other Unix system.
That was one reason I fell in love with groff
as an undergraduate student, all those years ago. I could access the Unix labs from any terminal across campus. (In the 1990s, our campus still had VT220 terminals in many of the buildings, with instant connectivity to the Unix labs.) That meant that I could use my “down time” between classes to keep working on a paper.
Today, WiFi networks are everywhere, which means we can open a laptop and be assured that we can get online. But in the 1990s, this work from anywhere concept was very new. I didn’t have to wait to get back to my dorm room or apartment to work on my paper; I could sit at any terminal and pick up where I left off.
5. You wrote this article in groff
When I decided to write this article, I decided the best way to celebrate groff
would be to write the article in groff
itself. I prepared the document using the -me
macro package, and processed it using the -T
option to generate HTML output. I was able to copy the output directly into the website’s content management system.
So even though you’re reading this on a website, the original article was written in groff
.