/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Document/groff/rhl17.htm

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<HTML>
 
2
 
 
3
<HEAD>
 
4
 
 
5
<TITLE>Red Hat Linux Unleashed rhl17.htm </TITLE>
 
6
 
 
7
<LINK REL="ToC" HREF="index.html">
 
8
 
 
9
<LINK REL="Index" HREF="htindex.html">
 
10
 
 
11
<LINK REL="Next" HREF="rhl18.htm">
 
12
 
 
13
<LINK REL="Previous" HREF="rhl16.htm"></HEAD>
 
14
 
 
15
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080">
 
16
 
 
17
<A NAME="I0"></A>
 
18
 
 
19
<H2>Red Hat Linux Unleashed rhl17.htm</H2>
 
20
 
 
21
<P ALIGN=LEFT>
 
22
 
 
23
<A HREF="rhl16.htm" TARGET="_self"><IMG SRC="purprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>
 
24
 
 
25
<A HREF="index.html" TARGET="_self"><IMG SRC="purtoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>
 
26
 
 
27
<A HREF="rhl18.htm" TARGET="_self"><IMG SRC="purnext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>
 
28
 
 
29
 
 
30
<HR ALIGN=CENTER>
 
31
 
 
32
<P>
 
33
 
 
34
<UL>
 
35
 
 
36
<UL>
 
37
 
 
38
<UL>
 
39
 
 
40
<LI>
 
41
 
 
42
<A HREF="#E68E119" >Embedding Commands</A>
 
43
 
 
44
<LI>
 
45
 
 
46
<A HREF="#E68E120" >Controlling Character Appearance</A>
 
47
 
 
48
<UL>
 
49
 
 
50
<LI>
 
51
 
 
52
<A HREF="#E69E235" >Sizes and Line Spacing</A>
 
53
 
 
54
<LI>
 
55
 
 
56
<A HREF="#E69E236" >Fonts</A>
 
57
 
 
58
<LI>
 
59
 
 
60
<A HREF="#E69E237" >Indenting and Line Length</A>
 
61
 
 
62
<LI>
 
63
 
 
64
<A HREF="#E69E238" >Other Character Controls</A></UL>
 
65
 
 
66
<LI>
 
67
 
 
68
<A HREF="#E68E121" >Macros</A>
 
69
 
 
70
<LI>
 
71
 
 
72
<A HREF="#E68E122" >Using mm</A>
 
73
 
 
74
<UL>
 
75
 
 
76
<LI>
 
77
 
 
78
<A HREF="#E69E239" >Lists</A>
 
79
 
 
80
<LI>
 
81
 
 
82
<A HREF="#E69E240" >Font Changes</A>
 
83
 
 
84
<LI>
 
85
 
 
86
<A HREF="#E69E241" >Footnotes</A></UL>
 
87
 
 
88
<LI>
 
89
 
 
90
<A HREF="#E68E123" >Summary</A></UL></UL></UL>
 
91
 
 
92
<HR ALIGN=CENTER>
 
93
 
 
94
<A NAME="E66E17"></A>
 
95
 
 
96
<H1 ALIGN=CENTER>
 
97
 
 
98
<CENTER>
 
99
 
 
100
<FONT SIZE=6 COLOR="#FF0000"><B>17</B></FONT></CENTER></H1>
 
101
 
 
102
<BR>
 
103
 
 
104
<A NAME="E67E17"></A>
 
105
 
 
106
<H2 ALIGN=CENTER>
 
107
 
 
108
<CENTER>
 
109
 
 
110
<FONT SIZE=6 COLOR="#FF0000"><B>groff</B></FONT></CENTER></H2>
 
111
 
 
112
<BR>
 
113
 
 
114
<P>This chapter looks at the groff text-formatting utility. Specifically, you will learn the following:
 
115
 
 
116
<BR>
 
117
 
 
118
<UL>
 
119
 
 
120
<LI>What groff is
 
121
 
 
122
<BR>
 
123
 
 
124
<BR>
 
125
 
 
126
<LI>How to do basic text formatting
 
127
 
 
128
<BR>
 
129
 
 
130
<BR>
 
131
 
 
132
<LI>How to create macros
 
133
 
 
134
<BR>
 
135
 
 
136
<BR>
 
137
 
 
138
<LI>What the mm macro package is
 
139
 
 
140
<BR>
 
141
 
 
142
<BR>
 
143
 
 
144
</UL>
 
145
 
 
146
<P>The groff program is the GNU version of nroff and troff, text-formatting languages that have been used in UNIX for many years. The groff system includes versions of troff, nroff, eqn, tbl, and other UNIX text-formatting utilities. The groff language is 
 
147
used primarily to compile man pages written and stored in groff/nroff format into a form that can be printed or displayed on-screen.
 
148
 
 
149
<BR>
 
150
 
 
151
<P>The nroff language was designed to provide text formatting in lineprinters, whereas troff was developed for phototypesetters. The commands in the two languages are identical, although some commands that cannot be processed by a lineprinter are ignored 
 
152
by nroff. In most cases, you don't use nroff or troff directly, but use a macro package to access them.
 
153
 
 
154
<BR>
 
155
 
 
156
<P>For the most part, nroff and troff have fallen into disuse with the development of powerful word processors and desktop-publishing packages. Their sole remaining use is for formatting man pages, which continue to be used widely.
 
157
 
 
158
<BR>
 
159
 
 
160
<P>Both nroff and troff have many commands that you will never require. Therefore, in this chapter we will look at the basic command set necessary for you to use the groff version of the two languages, and how they can be used for man page-specific 
 
161
applications. If you really want to use groff for advanced text formatting, you should pick up a dedicated book on the subject.
 
162
 
 
163
<BR>
 
164
 
 
165
<BR>
 
166
 
 
167
<A NAME="E68E119"></A>
 
168
 
 
169
<H3 ALIGN=CENTER>
 
170
 
 
171
<CENTER>
 
172
 
 
173
<FONT SIZE=5 COLOR="#FF0000"><B>Embedding Commands</B></FONT></CENTER></H3>
 
174
 
 
175
<BR>
 
176
 
 
177
<P>One aspect of groff that may take a little getting used to is that the way you type lines in the file isn't necessarily the way they will be displayed in the finished output. The groff system runs text lines together as much as possible. For example, 
 
178
the source file
 
179
 
 
180
<BR>
 
181
 
 
182
<PRE>
 
183
 
 
184
<FONT COLOR="#000080">This is fine stuff.
 
185
 
 
186
It is really interesting and
 
187
 
 
188
could keep me busy for hours.</FONT></PRE>
 
189
 
 
190
<P>covers three lines in the source, but when formatted, it's run together by groff to look like this:
 
191
 
 
192
<BR>
 
193
 
 
194
<BR>
 
195
 
 
196
<PRE>
 
197
 
 
198
<FONT COLOR="#000080">This is fine stuff. It is really interesting and could keep me busy for hours.</FONT></PRE>
 
199
 
 
200
<P>with line breaks wherever necessary because of the page layout. This has an advantage in that you don't have to worry about making everything look properly formatted within the source. However, the disadvantage is that you might not have any idea what 
 
201
the output will look like until you see it!
 
202
 
 
203
<BR>
 
204
 
 
205
<P>A look at a groff source file shows that it is all ASCII characters that contain the usual text of the displayed output and a set of commands starting with a period, like this:
 
206
 
 
207
<BR>
 
208
 
 
209
<PRE>
 
210
 
 
211
<FONT COLOR="#000080">This is a bunch of text that will be displayed.
 
212
 
 
213
Here is even more text.
 
214
 
 
215
.ps 14
 
216
 
 
217
The line above is a groff command, identified by the
 
218
 
 
219
period in the first column of the line.</FONT></PRE>
 
220
 
 
221
<P>Most groff commands are on a line by themselves, although a few can be embedded anywhere on a line. These commands are usually prefaced by a backslash, much as the shell uses the backslash as an escape character. An example of a line with embedded 
 
222
commands is
 
223
 
 
224
<BR>
 
225
 
 
226
<BR>
 
227
 
 
228
<PRE>
 
229
 
 
230
<FONT COLOR="#000080">This \fBline\fR has two embedded \fIgroff\fR commands.</FONT></PRE>
 
231
 
 
232
<P>Although there will be times when you want to use embedded commands, the majority are the commands on a single line, starting with a period.
 
233
 
 
234
<BR>
 
235
 
 
236
<BR>
 
237
 
 
238
<A NAME="E68E120"></A>
 
239
 
 
240
<H3 ALIGN=CENTER>
 
241
 
 
242
<CENTER>
 
243
 
 
244
<FONT SIZE=5 COLOR="#FF0000"><B>Controlling Character Appearance</B></FONT></CENTER></H3>
 
245
 
 
246
<BR>
 
247
 
 
248
<P>The groff language has a few commands for controlling the way characters look when printed or displayed. These include changing the size and line spacing of characters, as well as controlling fonts.
 
249
 
 
250
<BR>
 
251
 
 
252
<BR>
 
253
 
 
254
<A NAME="E69E235"></A>
 
255
 
 
256
<H4 ALIGN=CENTER>
 
257
 
 
258
<CENTER>
 
259
 
 
260
<FONT SIZE=4 COLOR="#FF0000"><B>Sizes and Line Spacing</B></FONT></CENTER></H4>
 
261
 
 
262
<BR>
 
263
 
 
264
<P>Character size and line spacing are not usually useful when displaying text on-screen, unless you are using a bitmapped terminal. They are used for printed documents, though. You can change the size of text with the .ps (point size) command:
 
265
 
 
266
<BR>
 
267
 
 
268
<PRE>
 
269
 
 
270
<FONT COLOR="#000080">This is the default 10-point size.
 
271
 
 
272
.ps 14
 
273
 
 
274
This is now in 14-point size.
 
275
 
 
276
.ps 20
 
277
 
 
278
This is a point size of 20.
 
279
 
 
280
.ps 6
 
281
 
 
282
And this is a really small point size of six.</FONT></PRE>
 
283
 
 
284
<BLOCKQUOTE>
 
285
 
 
286
<BLOCKQUOTE>
 
287
 
 
288
<HR ALIGN=CENTER>
 
289
 
 
290
<BR>
 
291
 
 
292
<NOTE>A point is 1/72 of an inch, so a 36-point character size is half an inch high. The 12-point size used most commonly is 1/6-inch high. Different versions of groff support different point sizes, but most versions support 6, 7, 8, 9, 10, 11, 12, 14, 16, 
 
293
20, 24, 28, and 36 points. If you set a value that is not supported, it is rounded up to the next highest value (to a maximum of 36). The default point size is 10. If you use the .ps command without a value, groff reverts to the previous value.</NOTE>
 
294
 
 
295
<BR>
 
296
 
 
297
<HR ALIGN=CENTER>
 
298
 
 
299
</BLOCKQUOTE></BLOCKQUOTE>
 
300
 
 
301
<P>Within a sentence, the point size can be changed with the line-embedded command \s followed by the point size. For example:
 
302
 
 
303
<BR>
 
304
 
 
305
<BR>
 
306
 
 
307
<PRE>
 
308
 
 
309
<FONT COLOR="#000080">This is in 10-point, while \s20this is in 20,\s10 and back to 10 again.</FONT></PRE>
 
310
 
 
311
<P>The \s command should be followed by a legal point size. The special command \s0 causes groff to revert to its previous value. Relative changes are also supported, so you could embed commands such as \s+2 and \s-2, although only a single digit can be 
 
312
specified (so you can't change by more than nine points).
 
313
 
 
314
<BR>
 
315
 
 
316
<P>Line spacing is the vertical spacing between lines. Vertical spacing is not tied to point size, so it should be adjusted manually. As a general rule, use a vertical spacing about 20 percent larger than the point size. The default vertical spacing is 11.
 
317
 
 
318
 
 
319
<BR>
 
320
 
 
321
<P>Line spacing is controlled by the .vs (vertical space) command. In the next example, we change the point size and the vertical spacing to permit the characters to be printed clearly without overlap:
 
322
 
 
323
<BR>
 
324
 
 
325
<PRE>
 
326
 
 
327
<FONT COLOR="#000080">This is in normal 10-point, 11 vertical space size.
 
328
 
 
329
.ps 12
 
330
 
 
331
.vs 14
 
332
 
 
333
This is in 12-point with 14 vertical spacing.</FONT></PRE>
 
334
 
 
335
<P>If you use the .vs command without a value, groff reverts to the previous value.
 
336
 
 
337
<BR>
 
338
 
 
339
<P>If you want to force spacing for some reason, such as to separate sections of text, you can use the .sp (space) command. Used with no argument, .sp gives one blank line. It can also take arguments of i for inches and p for points:
 
340
 
 
341
<BR>
 
342
 
 
343
<PRE>
 
344
 
 
345
<FONT COLOR="#000080">This is default 10-point 11 vertical spaced text.
 
346
 
 
347
.sp
 
348
 
 
349
We have a blank line above this because of the command.
 
350
 
 
351
.sp 3.5i
 
352
 
 
353
This is three and a half inches below the previous line.</FONT></PRE>
 
354
 
 
355
<P>You can use fractions in most groff commands, as this example shows.
 
356
 
 
357
<BR>
 
358
 
 
359
<BR>
 
360
 
 
361
<A NAME="E69E236"></A>
 
362
 
 
363
<H4 ALIGN=CENTER>
 
364
 
 
365
<CENTER>
 
366
 
 
367
<FONT SIZE=4 COLOR="#FF0000"><B>Fonts</B></FONT></CENTER></H4>
 
368
 
 
369
<BR>
 
370
 
 
371
<P>Changing fonts requires the command .ft (font type). In the early days of troff, only four fonts were supported: Roman, Roman bold, Roman italic, and a set of special characters. Other fonts had to be specially loaded in the phototypesetter. For this 
 
372
reason, groff defaults to Roman.
 
373
 
 
374
<BR>
 
375
 
 
376
<P>To switch to Roman bold, you use the command .ft B, while .ft I switches, not surprisingly, to Roman italic. To return to the normal Roman font, the command .ft R is used, although on most systems, .ft by itself will suffice:
 
377
 
 
378
<BR>
 
379
 
 
380
<PRE>
 
381
 
 
382
<FONT COLOR="#000080">This is in normal Roman font.
 
383
 
 
384
.ft B
 
385
 
 
386
This is bold.
 
387
 
 
388
.ft I
 
389
 
 
390
This is italics.
 
391
 
 
392
.ft
 
393
 
 
394
This is back to normal Roman font.</FONT></PRE>
 
395
 
 
396
<P>You can switch fonts with a line-embedded command, too, using \f followed by either I or B, switching back with R to the normal font:
 
397
 
 
398
<BR>
 
399
 
 
400
<P>This is normal, \fBbold\fR and \fIitalics\fR.
 
401
 
 
402
<BR>
 
403
 
 
404
<P>Because underline wasn't supported on most system printers, underlined text was converted to italic. The underline command .ux would italicize the next x lines of text.
 
405
 
 
406
<BR>
 
407
 
 
408
<P>Because we now have many thousands more fonts to work with than Roman, we must be able to change fonts within groff. The command to change fonts is .fp (font physically mounted), which also requires a number to indicate what position the font was 
 
409
mounted in the phototypesetter (old stuff, isn't it?). For example, if Helvetica were mounted in font position three and we referred to it by the font letter H, the command
 
410
 
 
411
<BR>
 
412
 
 
413
<BR>
 
414
 
 
415
<PRE>
 
416
 
 
417
<FONT COLOR="#000080">.fp 3 H</FONT></PRE>
 
418
 
 
419
<P>would instruct the phototypesetter to switch to Helvetica in font position three. groff still retains these old-style commands.
 
420
 
 
421
<BR>
 
422
 
 
423
<BR>
 
424
 
 
425
<A NAME="E69E237"></A>
 
426
 
 
427
<H4 ALIGN=CENTER>
 
428
 
 
429
<CENTER>
 
430
 
 
431
<FONT SIZE=4 COLOR="#FF0000"><B>Indenting and Line Length</B></FONT></CENTER></H4>
 
432
 
 
433
<BR>
 
434
 
 
435
<P>The line length is set to default to 6.5 inches within groff. To override this value, the .ll (line length) command is used with an argument indicating the units. For example, the command
 
436
 
 
437
<BR>
 
438
 
 
439
<BR>
 
440
 
 
441
<PRE>
 
442
 
 
443
<FONT COLOR="#000080">.ll 7i</FONT></PRE>
 
444
 
 
445
<P>switches groff to use a seven-inch line length. The maximum length accepted is usually about 7.5 inches, so to use paper wider than that you have to move the left margin over to compensate with the .po (page offset) command. The value .po 0 sets the 
 
446
left margin as far over as is possible.
 
447
 
 
448
<BR>
 
449
 
 
450
<P>To indent text, you use the .in (indent) command. It takes a number and an indicator of the units as arguments, as the following example shows:
 
451
 
 
452
<BR>
 
453
 
 
454
<P>This is normal stuff.
 
455
 
 
456
<BR>
 
457
 
 
458
<BR>
 
459
 
 
460
<PRE>
 
461
 
 
462
<FONT COLOR="#000080">.in 0.75I</FONT></PRE>
 
463
 
 
464
<P>This is indented three-quarters of an inch.
 
465
 
 
466
<BR>
 
467
 
 
468
<P>To move the right margin to the left so that you can make a distinctive block of text within a normal chunk, you use the .ll (line length) command you saw earlier:
 
469
 
 
470
<BR>
 
471
 
 
472
<P>This is normal text, and goes on and on.Even more text that continues the tradition.
 
473
 
 
474
<BR>
 
475
 
 
476
<PRE>
 
477
 
 
478
<FONT COLOR="#000080">.in 1i
 
479
 
 
480
.ll -1i</FONT></PRE>
 
481
 
 
482
<P>This is now indented one inch to the left, and the right margin is indented one inch from the normal right margin. This makes the text stand out a little.
 
483
 
 
484
<BR>
 
485
 
 
486
<PRE>
 
487
 
 
488
<FONT COLOR="#000080">.in -1i
 
489
 
 
490
.ll +1i</FONT></PRE>
 
491
 
 
492
<P>And this is back to normal. The block will stand out nicely amongst all this normal text.
 
493
 
 
494
<BR>
 
495
 
 
496
<P>You will notice that we used relative movements of plus and minus a value in this example to make it easier. This way, we don't have to measure the page. You can revert to original values with the command .in and .ll with no arguments, as well.
 
497
 
 
498
<BR>
 
499
 
 
500
<P>An indent and line-length change is effective until the next command changes it. Sometimes you want to affect only a single line, though. If you want to indent only a single line, use the .ti (temporary indent) command:
 
501
 
 
502
<BR>
 
503
 
 
504
<P>This is really fine stuff. You can tell, 'cause I'm still awake.
 
505
 
 
506
<BR>
 
507
 
 
508
<PRE>
 
509
 
 
510
<FONT COLOR="#000080">.ti 3i</FONT></PRE>
 
511
 
 
512
<P>This line is temporarily indented by three inches, but the next line will be back to normal.
 
513
 
 
514
<BR>
 
515
 
 
516
<P>Tabs are used to set column output. Usually, tabs are used with groff only for unfilled text, which means material you would display in columns. Tab stops are set, by default, every half inch. To override these values, you use the .ta (tab) command. The 
 
517
command
 
518
 
 
519
<BR>
 
520
 
 
521
<BR>
 
522
 
 
523
<PRE>
 
524
 
 
525
<FONT COLOR="#000080">.ta 1i 2i 3i 4i 5i 6i</FONT></PRE>
 
526
 
 
527
<P>sets the tabs at every inch instead. You can think of the setting of tabs within groff much as they are done on a typewriter, from left to right. Tabs are usually set for columns of numbers or tables, but the groff macro gtbl is much better at this. 
 
528
(You get a look at gtbl in the next chapter.)
 
529
 
 
530
<BR>
 
531
 
 
532
<BR>
 
533
 
 
534
<A NAME="E69E238"></A>
 
535
 
 
536
<H4 ALIGN=CENTER>
 
537
 
 
538
<CENTER>
 
539
 
 
540
<FONT SIZE=4 COLOR="#FF0000"><B>Other Character Controls</B></FONT></CENTER></H4>
 
541
 
 
542
<BR>
 
543
 
 
544
<P>The groff system has special instructions for controlling the size of individual letters, as well as formulas and special characters such as Greek letters. However, because it is unlikely that groff is used for this type of output these days, we'll 
 
545
ignore the capabilities. If you want more information on how to provide these special features, check the groff man pages or consult a good troff book.
 
546
 
 
547
<BR>
 
548
 
 
549
<BR>
 
550
 
 
551
<A NAME="E68E121"></A>
 
552
 
 
553
<H3 ALIGN=CENTER>
 
554
 
 
555
<CENTER>
 
556
 
 
557
<FONT SIZE=5 COLOR="#FF0000"><B>Macros</B></FONT></CENTER></H3>
 
558
 
 
559
<BR>
 
560
 
 
561
<P>A macro is a shorthand notation for a set of commands or strings. Many commands used to write man pages are macros. To give a practical example of a groff macro, suppose we want every paragraph to start with a blank line and a temporary indent of half 
 
562
an inch. The groff commands to do this are
 
563
 
 
564
<BR>
 
565
 
 
566
<PRE>
 
567
 
 
568
<FONT COLOR="#000080">.sp
 
569
 
 
570
.ti +.5i</FONT></PRE>
 
571
 
 
572
<P>Instead of typing these two lines every paragraph, we can define a macro of one character (or more) that does it for us.
 
573
 
 
574
<BR>
 
575
 
 
576
<P>To define the macro, we use the .de (define) command followed by the name of the macro and the commands. It would look like this, placed somewhere at the top of the source code:
 
577
 
 
578
<BR>
 
579
 
 
580
<PRE>
 
581
 
 
582
<FONT COLOR="#000080">.de PP
 
583
 
 
584
.sp
 
585
 
 
586
.ti +.5I
 
587
 
 
588
..</FONT></PRE>
 
589
 
 
590
<P>The last line with two periods indicates the end of the definition. Now, whenever we use the command .PP it will be executed as the lines in the macro.
 
591
 
 
592
<BR>
 
593
 
 
594
<BLOCKQUOTE>
 
595
 
 
596
<BLOCKQUOTE>
 
597
 
 
598
<HR ALIGN=CENTER>
 
599
 
 
600
<BR>
 
601
 
 
602
<NOTE>Make sure that you don't define a macro with the name of a reserved groff command, or the macro will not be executed.</NOTE>
 
603
 
 
604
<BR>
 
605
 
 
606
<HR ALIGN=CENTER>
 
607
 
 
608
</BLOCKQUOTE></BLOCKQUOTE>
 
609
 
 
610
<BR>
 
611
 
 
612
<A NAME="E68E122"></A>
 
613
 
 
614
<H3 ALIGN=CENTER>
 
615
 
 
616
<CENTER>
 
617
 
 
618
<FONT SIZE=5 COLOR="#FF0000"><B>Using mm</B></FONT></CENTER></H3>
 
619
 
 
620
<BR>
 
621
 
 
622
<P>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 
 
623
the nroff and troff commands too awkward or complicated, whereas mm is fully able to meet all their basic formatting needs.
 
624
 
 
625
<BR>
 
626
 
 
627
<P>To add mm commands, you use the period in the first column as with groff. The mm macros are usually quite simple, and easy to work with and use. We can look at the most important of them here.
 
628
 
 
629
<BR>
 
630
 
 
631
<P>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 
 
632
are flush left.
 
633
 
 
634
<BR>
 
635
 
 
636
<P>Headings are created with the .H command. For example, the command
 
637
 
 
638
<BR>
 
639
 
 
640
<P>.H This is a Heading
 
641
 
 
642
<BR>
 
643
 
 
644
<P>will create a break, output the heading text in bold, and leave a bit of a space between the heading and the text that follows it.
 
645
 
 
646
<BR>
 
647
 
 
648
<P>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:
 
649
 
 
650
<BR>
 
651
 
 
652
<P>.H 2 This is a level 2 heading
 
653
 
 
654
<BR>
 
655
 
 
656
<P>The mm heading macro will number 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 
 
657
the heading level and the number to use. For example, the command
 
658
 
 
659
<BR>
 
660
 
 
661
<BR>
 
662
 
 
663
<PRE>
 
664
 
 
665
<FONT COLOR="#000080">.nr H2 1</FONT></PRE>
 
666
 
 
667
<P>will restart the numbering of second-level headings at 1.
 
668
 
 
669
<BR>
 
670
 
 
671
<BR>
 
672
 
 
673
<A NAME="E69E239"></A>
 
674
 
 
675
<H4 ALIGN=CENTER>
 
676
 
 
677
<CENTER>
 
678
 
 
679
<FONT SIZE=4 COLOR="#FF0000"><B>Lists</B></FONT></CENTER></H4>
 
680
 
 
681
<BR>
 
682
 
 
683
<P>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
 
684
 
 
685
<BR>
 
686
 
 
687
<PRE>
 
688
 
 
689
<FONT COLOR="#000080">.LI
 
690
 
 
691
thing 1
 
692
 
 
693
.LI
 
694
 
 
695
thing 2
 
696
 
 
697
.LE
 
698
 
 
699
thing 3</FONT></PRE>
 
700
 
 
701
<P>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.
 
702
 
 
703
<BR>
 
704
 
 
705
<P>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) 
 
706
can be used with the .AL I command.
 
707
 
 
708
<BR>
 
709
 
 
710
<P>You can nest list types as necessary. For example, the command
 
711
 
 
712
<BR>
 
713
 
 
714
<PRE>
 
715
 
 
716
<FONT COLOR="#000080">.AL I
 
717
 
 
718
.LI
 
719
 
 
720
groff
 
721
 
 
722
.AL
 
723
 
 
724
.LI
 
725
 
 
726
macros
 
727
 
 
728
.LI
 
729
 
 
730
mm
 
731
 
 
732
.LE
 
733
 
 
734
.LI
 
735
 
 
736
gtbl
 
737
 
 
738
.LI
 
739
 
 
740
geqn
 
741
 
 
742
.LE</FONT></PRE>
 
743
 
 
744
<P>will create output that looks like this:
 
745
 
 
746
<BR>
 
747
 
 
748
<PRE>
 
749
 
 
750
<FONT COLOR="#000080">I. groff
 
751
 
 
752
1. macros
 
753
 
 
754
2. mm
 
755
 
 
756
II. gtbl
 
757
 
 
758
III. geqn</FONT></PRE>
 
759
 
 
760
<P>You have 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!
 
761
 
 
762
<BR>
 
763
 
 
764
<BR>
 
765
 
 
766
<A NAME="E69E240"></A>
 
767
 
 
768
<H4 ALIGN=CENTER>
 
769
 
 
770
<CENTER>
 
771
 
 
772
<FONT SIZE=4 COLOR="#FF0000"><B>Font Changes</B></FONT></CENTER></H4>
 
773
 
 
774
<BR>
 
775
 
 
776
<P>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 
 
777
can do it after the period command, as this example shows:
 
778
 
 
779
<BR>
 
780
 
 
781
<P>This is normal text
 
782
 
 
783
<BR>
 
784
 
 
785
<BR>
 
786
 
 
787
<PRE>
 
788
 
 
789
<FONT COLOR="#000080">.B</FONT></PRE>
 
790
 
 
791
<P>This is bold.
 
792
 
 
793
<BR>
 
794
 
 
795
<P>So is this.
 
796
 
 
797
<BR>
 
798
 
 
799
<BR>
 
800
 
 
801
<PRE>
 
802
 
 
803
<FONT COLOR="#000080">.R</FONT></PRE>
 
804
 
 
805
<P>This is normal.
 
806
 
 
807
<BR>
 
808
 
 
809
<P>This is a single
 
810
 
 
811
<BR>
 
812
 
 
813
<PRE>
 
814
 
 
815
<FONT COLOR="#000080">.Bbold</FONT></PRE>
 
816
 
 
817
<P>word, though.
 
818
 
 
819
<BR>
 
820
 
 
821
<P>When you change only one word, you don't need a .R command.
 
822
 
 
823
<BR>
 
824
 
 
825
<P>Changes can be performed within text in the same manner as with groff:
 
826
 
 
827
<BR>
 
828
 
 
829
<BR>
 
830
 
 
831
<PRE>
 
832
 
 
833
<FONT COLOR="#000080">This is an \fIitalics set of words\fR until here.</FONT></PRE>
 
834
 
 
835
<BR>
 
836
 
 
837
<A NAME="E69E241"></A>
 
838
 
 
839
<H4 ALIGN=CENTER>
 
840
 
 
841
<CENTER>
 
842
 
 
843
<FONT SIZE=4 COLOR="#FF0000"><B>Footnotes</B></FONT></CENTER></H4>
 
844
 
 
845
<BR>
 
846
 
 
847
<P>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:
 
848
 
 
849
<BR>
 
850
 
 
851
<PRE>
 
852
 
 
853
<FONT COLOR="#000080">This is normal text.
 
854
 
 
855
.FS</FONT></PRE>
 
856
 
 
857
<P>This is a footnote with its proper number in front of it.
 
858
 
 
859
<BR>
 
860
 
 
861
<PRE>
 
862
 
 
863
<FONT COLOR="#000080">.FE
 
864
 
 
865
This is more normal text.
 
866
 
 
867
.FS *</FONT></PRE>
 
868
 
 
869
<P>But this is a footnote marked with an asterisk.
 
870
 
 
871
<BR>
 
872
 
 
873
<BR>
 
874
 
 
875
<PRE>
 
876
 
 
877
<FONT COLOR="#000080">.FE</FONT></PRE>
 
878
 
 
879
<P>This is even more normal text. At the bottom of the page
 
880
 
 
881
<BR>
 
882
 
 
883
<P>will be a numbered footnote and an asterisked footnote.
 
884
 
 
885
<BR>
 
886
 
 
887
<P>You can use any valid character for the optional footnote mark, including special characters supported by groff.
 
888
 
 
889
<BR>
 
890
 
 
891
<BR>
 
892
 
 
893
<A NAME="E68E123"></A>
 
894
 
 
895
<H3 ALIGN=CENTER>
 
896
 
 
897
<CENTER>
 
898
 
 
899
<FONT SIZE=5 COLOR="#FF0000"><B>Summary</B></FONT></CENTER></H3>
 
900
 
 
901
<BR>
 
902
 
 
903
<P>As you might expect, there is a lot to both groff and mm that we haven't looked at. Because groff is seldom used these days, we covered only the most important aspects. As I said earlier, if you want to learn more about groff or mm, find a good 
 
904
reference book on the subject.
 
905
 
 
906
<P ALIGN=LEFT>
 
907
 
 
908
<A HREF="rhl16.htm" TARGET="_self"><IMG SRC="purprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>
 
909
 
 
910
<A HREF="#I0" TARGET="_self"><IMG SRC="purtop.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Page Top"></A>
 
911
 
 
912
<A HREF="index.html" TARGET="_self"><IMG SRC="purtoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>
 
913
 
 
914
<A HREF="rhl18.htm" TARGET="_self"><IMG SRC="purnext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>
 
915
 
 
916
 
 
917
</BODY></HTML>
 
918
 
 
919
 
 
920