-->
Previous | Table of Contents | Next |
The mm (memorandum macros) package is not really part of nroff or troff, although both can use it. The mm program reads a source file much as groff does and translates it to output. Many of the mm macros are used for man pages. Indeed, many users find the nroff and troff commands too awkward or complicated, whereas mm is fully able to meet all their basic formatting needs.
To add mm commands, use the period in the first column as with groff. The mm macros are usually quite simple and easy to work with. Lets look at the most important of them here.
Like groff, mm runs text together when reformatting, regardless of line breaks in the source file. To force a new paragraph, use the .P command. It forces a line break and adds a blank line to the output. Paragraphs are usually formatted so that they are flush left.
Headings are created with the .H command. For example, the command
.H This is a Heading
creates a break, outputs the heading text in bold, and leaves a bit of a space between the heading and the text that follows it.
There can be seven levels of headings; 1 is the highest and 7 is the lowest. To specify the heading level, add the number as the first argument after the .H command:
.H 2 This is a level 2 heading
The mm heading macro numbers the headings automatically, although you can suppress the numbering with the .HU (heading unnumbered) command. To reset the numbering (at a section break, for example), use the .nr (number register) command followed by the heading level and the number to use. For example, the command
.nr H2 1
restarts the numbering of second-level headings at 1.
Lists are easily created in mm with the .LI (list) command and the .LE (list end) command. This creates a bulleted list. For example, the command
.LI thing 1 .LI thing 2 .LE thing 3
creates a bulleted list of the three bits of text. You can create a list with dashes instead of bullets using the .DL (dash list) command. The mark list command, .ML, creates a list with the character of your choice.
If you want a numbered list, use the .AL (automatic list) command. Lists with no arguments are created with Arabic numbers. To create an alphabetical list (A, B, C, and so on), use the macro command .AL A. Roman numerals (i, ii, iii, iv, v, and so on) can be used with the .AL I command.
You can nest list types as necessary. For example, the command
.AL I .LI groff .AL .LI macros .LI mm .LE .LI gtbl .LI geqn .LE
creates output that looks like this:
I. groff 1. macros 2. mm II. gtbl III. geqn
Its important to be careful when terminating each list with an .LE command to ensure that you terminate the proper one. Experimentation and practice help you get the hang of this. You may have noticed that it takes a lot of commands to make a little list!
Changing fonts with mm is quite simple. When working from a period command, the command .B (bold) creates bold text until an .R (restore) command, while .I (italic) does the same until an .R command. If you want to bold or italicize only one word, you can do it after the period command, as this example shows:
This is normal text .B This is bold. So is this. .R This is normal. This is a single .Bbold word, though.
When you change only one word, you dont need an .R command.
Changes can be performed within text in the same manner as with groff:
This is an \fIitalics set of words\fR until here.
To create a footnote, use the .FS (footnote start) and .FE (footnote end) commands. Every footnote on a single page will be collected and printed at the bottom. Footnotes are automatically numbered unless you specify another character:
This is normal text. .FS This is a footnote with its proper number in front of it. .FE This is more normal text. .FS * But this is a footnote marked with an asterisk. .FE This is even more normal text. At the bottom of the page will be a numbered footnote and an asterisked footnote.
You can use any valid character for the optional footnote mark, including special characters supported by groff.
As you probably expect, there is a lot to both groff and mm that we havent looked at. Because groff is seldom used these days, we covered only the most important aspects. As mentioned earlier, if you want to learn more about groff or mm, find a good reference book on the subject. From here you can learn more about:
Previous | Table of Contents | Next |