
Writing nroff and troff Macros
The nroff and troff formatters include a powerful macro definition and substitution capability. As we suggested when macros were first discussed in Chapter 4, they are a good way to combine frequently used sequences of formatting requests into a single instruction. But after working with the ms and mm macro packages, you must know that macros are more than that.
Macros are an essential part of nroff and troff—you cannot escape them if you want to make serious use of the formatter. Precisely because macros are so essential, many users never learn to fully use them. The most obviously useful macros are already included in the existing macro packages, whose complex internal control structures make them difficult to understand and modify.
The purpose of this chapter is to introduce the fundamental nroff and troff requests that are used for creating macros. You’ll learn the basics in this chapter. Then, in later chapters we can examine how to write macros for specific purposes, without having to make continual asides to introduce a new request.
Chapter 15 describes additional requests for creating special effects (such as pictures) with your macros, and Chapters 16 through 18 discuss how to go beyond writing individual macros and how to develop or extend an entire macro package.
▪ Comments ▪
Before we start, we’ll introduce the syntax for inserting ...