• Register
764 points
9 2 1

I first learned about Unix programs. I enjoyed it so much that I switched from MS-DOS to the Linux operating system on my home computer.

A word processor was one thing Linux lacked in the early to mid-1990s. On most desktop operating systems, a word processor is a typical office program that allows you to quickly edit text. To write my articles for university, I frequently used a DOS word processor. Until the late 1990s, I couldn't find a Linux-native word processor. Before then, word processing was one of the only reasons I kept my first machine dual-boot so I could periodically boot into DOS and write documents.

Then I learned Linux had a built-in word processor. GNU troff, also known as groff, is a new application of the troff (short for "typesetter roff") text processing system, which is an upgraded variant of the nroff system. And nroff was supposed to be a replacement for the original roff (which stood for "runoff," as in to "run-off" a document).

You edit the text in a plain text editor and incorporate formatting using macros or other processing commands for text processing. The text file is then run via a text-processing device like groff to produce formatted content that can be printed. LaTeX is another well-known text processing device, but groff was sufficient for my needs.

With a little practice, I discovered that I could write my class papers in groff almost as easily as I could with a Linux word processor. Although I no longer use groff to write documents, I recall the macros and commands that allowed me to produce printed documents with it. And if you're like me and learned to write with groff all those years ago, you'll most likely remember these five groff writer signals.

1. You have a favorite macro set

In groff, you format a document by writing plain text with macros interspersed. In groff, a macro is a short command that begins with a single cycle at the start of a line. For example, the.sp 2 macro command adds two blank lines to your output if you want to insert a few lines. Other specific macros for all sorts of formatting are supported by groff.

Groff also includes various macro sets, which are collections of macros that allow you to format documents in your own way, to make formatting a document simpler for the writer. The -me the macro set was the first macro set I studied. The macro set is actually called the macro setting, and you define it when processing a file with a theme option.

Other macro sets are also included in groff. The -man macro set, for example, used to be the standard macro set for formatting Unix systems' built-in manual pages, and the -ms macro set is often used to format other technical documents. You probably have a favorite macro sequence if you learned to compose with groff.

2. You should concentrate on the material rather than the formatting.

One of the best things about writing for groff is that you can concentrate on the material rather than worrying about how it looks. For technical authors, this is a useful function. For professional authors, groff is a perfect "distraction-free" place. At least, if you don't mind receiving your output in any of the formats supported by groff's -T command-line option, which include PDF, PostScript, HTML, and plain text. You can't explicitly build a LibreOffice ODT or a Word DOC file with groff.

3. You like a vintage vibe.

If you've gotten used to writing in groff, the macros tend to fade away. The formatting macros fade out into the background, leaving you free to concentrate solely on the text in front of you. I've done so much groff writing that I'm no longer aware of the macros. Perhaps it's similar to writing programming code, and the mind just shifts gears, causing you to act like a programmer and see the code as a series of instructions. Writing in groff is similar for me; I simply see my file, and my mind immediately converts the macros into formatting.

4. You appreciate how versatile it is.

On almost every Unix system, groff (and its relatives) are a regular package. The macros don't shift with groff. The -me macros, for example, should be consistent across systems. As a result, after you've mastered one system's macros, you can apply them to the next.

And since groff documents are only plain text, you can edit them with any text editor you like. To edit my groff papers, I prefer GNU Emacs, but you can also use GNOME Gedit, Vim, or your preferred text editor. Most editors have a "mode" that highlights groff macros in a different color than the rest of your text, making it easier to spot errors before processing the file.

5. This article was written in the -me style.

When I first wanted to write this post, I felt that using groff directly would be the safest option. I decided to show how adaptable groff was when it came to paper preparation. Despite the fact that you're reading this in a newspaper, the post was published in groff.

I hope this has piqued your curiosity in learning how to compose documents in groff. Refer to Eric Allman's Writing papers with groff using -me, which you can find on your machine as meintro.me in groff's manual, if you want to use more specialized functions in the -me macro package. It's a wonderful reference guide that shows how to use the -me macros to format papers in different ways.

I've even included a copy of my article's initial draft, which includes the -me macros. To open the file, save it to your computer as five-signs-groff.me and run it through groff. The -T alternative specifies the output format, such as -Tps for PostScript output or -Thtml for HTML output.For example:

groff -me -Thtml five-signs-groff.me > five-signs-groff.html

 

1 Comment

Thanks ! It was quite helpful . The language was simple and understandable