nroff was originally designed for terminals and line printers, which are devices with fixed width characters. troff was designed for the Wang CAT photo-typsetter, which could have up to four different fonts available, in many different point sizes.
Around 1980, Brian Kernighan revamped troff to create ditroff, the device-independent troff. This version accepted an enhanced language, and generated ASCII output that described the motions the output device should make around the page, the size and placement of characters, and so on. Then, to add a new output device (laser printer, photo-typesetter, or whatever), you would write a post-processor for the device independent output that would correctly drive your device. Recent version of troff are the device-independent version, usually with support for PostScript(TM) output.
The ditroff saga can be found in Bell Labs Computing Science Technical Report #97. You can get PostScript for this report via anonymous ftp to netlib.att.com. Change to /netlib/att/cs/cstr, use binary mode, and retrieve 97.ps.Z.
Now that you know what troff is, we'll discuss the specifics of the GNU version, groff. groff is written in C++. This is somewhat unusual; most GNU programs are written in C. To compile it, you need a C++ compiler. The GNU C++ compiler, g++, will usually do it with little problem. You will need both g++ and the GNU C++ library, libg++ to compile the groff suite of programs.
The programs in the suite are:
gtroff - the actual troff clone gtbl - the tbl clone geqn - the eqn clone gpic - the pic clone groff - the driver for the other programs
There is no grap clone. Anyone who wishes to write one should contact email@example.com.
groff has a large number of extensions over Unix troff. It particular, groff supports long names for commands, strings, and registers, and has many additional commands. It also has a compatibility mode, where all the extensions are turned off. This is occasionally necessary when using macro packages meant for original troff.
The groff pre-processors described above cannot be used with original troff; they take advantage of groff's extensions.
groff uses the ditroff model of post-processors for different devices, with the same intermediate format. By default, groff generates PostScript output. The other most useful output format is plain ASCII. This is in fact how nroff is provided; by a shell script that calls groff -Tascii (i.e., the output type [-T] is ASCII). An interesting output type is TeX DVI, which can be used on many older laser printers that do not support PostScript. groff comes with two previewers for X windows, using different density fonts (75 and 100 dots per inch).
groff comes with a number of macro packages. It has its own version of the -man macros. The -mgs package is the GNU version of -ms, and -mgm is the GNU version of -mm. These should be used in preference to the original packages, since they can also take advantage of the groff extensions. The Berkeley -me, -mdoc, and -mandoc packages are themselves freely distributable, and are included with the groff distribution.
What is really nice about groff is that it is like lint for your troff documents. The programs check *everything*. Many things that Unix troff silently ignores, groff will warn you about. Often there are subtle errors in your files, and groff will help you catch the problems. Although every once in a while, there really is no problem, and you need to use compatibility mode instead.
Unfortunately, the one major lack in the groff distribution is that there is no comprehensive manual. The Tenth Edition Research Unix Programmer's Manual describes troff and its friends in detail. groff is based on this specification. Additional information can be found in the man pages that come with groff.
Information about pic can be obtained via anonymous ftp from the same site and directory mentioned above, in the file 116.ps.Z. A description of grap can be found in 114.ps.Z.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- July 2016 Issue of Linux Journal
- Tibbo Technology's Tibbo Project System
- Client-Side Performance
- Sony Settles in Linux Battle
- Libarchive Security Flaw Discovered
- Peppermint 7 Released
- Profiles and RC Files
- Git 2.9 Released
- Snappy Moves to New Platforms
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide