fix typo
[s-roff.git] / tmac / groff_mdoc.man
blob7af59146f513d89d23828c8dadb6164abc3ae891
1 .\" groff_mdoc.man
2 .\"
3 .\"   A complete reference of the mdoc macro package for GNU troff.
4 .\"
5 .\" Based on NetBSD's mdoc.samples.7, version 1.21.
6 .\"
7 .\"
8 .\"   Warning: You can't format this file with the old mdoc macros!
9 .\"
10 .\"
11 .\" Copyright (c) 1990, 1993
12 .\"     The Regents of the University of California.  All rights reserved.
13 .\"
14 .\" Redistribution and use in source and binary forms, with or without
15 .\" modification, are permitted provided that the following conditions
16 .\" are met:
17 .\" 1. Redistributions of source code must retain the above copyright
18 .\"    notice, this list of conditions and the following disclaimer.
19 .\" 2. Redistributions in binary form must reproduce the above copyright
20 .\"    notice, this list of conditions and the following disclaimer in the
21 .\"    documentation and/or other materials provided with the distribution.
22 .\" 3. All advertising materials mentioning features or use of this software
23 .\"    must display the following acknowledgement:
24 .\"      This product includes software developed by the University of
25 .\"      California, Berkeley and its contributors.
26 .\" 4. Neither the name of the University nor the names of its contributors
27 .\"    may be used to endorse or promote products derived from this software
28 .\"    without specific prior written permission.
29 .\"
30 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
31 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
34 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 .\" SUCH DAMAGE.
41 .\"
42 .\"     @(#)mdoc.samples.7 8.2 (Berkeley) 12/30/93
43 .\"
44 .\" This reference invokes every macro in the package several
45 .\" times and is guaranteed to give a worst case performance
46 .\" for an already extremely slow package.
47 .\"
49 .Dd February 27, 2003
50 .Os
51 .Dt GROFF_MDOC 7
54 .Sh NAME
56 .Nm groff_mdoc
57 .Nd reference for groff's mdoc implementation
60 .Sh SYNOPSIS
62 .Nm groff Fl m Ns Cm doc Ar
65 .Sh DESCRIPTION
67 A complete reference for writing
68 .Ux
69 manual pages with the
70 .Nm \-mdoc
71 macro package; a
72 .Em content Ns -based
73 and
74 .Em domain Ns -based
75 formatting package for
76 .Tn GNU
77 .Xr troff 1 .
78 Its predecessor, the
79 .Xr \-man 7
80 package, addressed page layout leaving the manipulation of fonts and other
81 typesetting details to the individual author.
83 .Nm \-mdoc ,
84 page layout macros make up the
85 .Em "page structure domain"
86 which consists of macros for titles, section headers, displays and lists
87 \- essentially items which affect the physical position of text on a
88 formatted page.
89 In addition to the page structure domain, there are two more domains, the
90 .Em manual
91 domain and the
92 .Em general
93 text domain.
94 The general text domain is defined as macros which perform tasks such as
95 quoting or emphasizing pieces of text.
96 The manual domain is defined as macros that are a subset of the day to day
97 informal language used to describe commands, routines and related
98 .Ux
99 files.
100 Macros in the manual domain handle command names, command line arguments and
101 options, function names, function parameters, pathnames, variables, cross
102 references to other manual pages, and so on.
103 These domain items have value for both the author and the future user of the
104 manual page.
105 Hopefully, the consistency gained across the manual set will provide easier
106 translation to future documentation tools.
108 Throughout the
110 manual pages, a manual entry is simply referred to as a man page, regardless
111 of actual length and without sexist intention.
114 .Sh "GETTING STARTED"
116 The material presented in the remainder of this document is outlined
117 as follows:
119 .Bl -enum -width 3n -offset indent
120 .  It
121 .  Tn "TROFF IDIOSYNCRASIES"
123 .  Bl -tag -width 2n -compact
124 .    It "Macro Usage"
125 .    It "Passing Space Characters in an Argument"
126 .    It "Trailing Blank Space Characters"
127 .    It "Escaping Special Characters"
128 .    It "Other Possible Pitfalls"
129 .  El
131 .  It
132 .  Tn "A MANUAL PAGE TEMPLATE"
134 .  It
135 .  Tn "CONVENTIONS"
137 .  It
138 .  Tn "TITLE MACROS"
140 .  It
141 .  Tn "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS"
143 .  Bl -tag -width 2n -compact
144 .    It "What's in a Name" Ns ...
145 .    It "General Syntax"
146 .  El
148 .  It
149 .  Tn "MANUAL DOMAIN"
151 .  Bl -tag -width 2n -compact
152 .    It "Addresses"
153 .    It "Author Name"
154 .    It "Arguments"
155 .    It "Configuration Declarations (Section Four Only)"
156 .    It "Command Modifiers"
157 .    It "Defined Variables"
158 .    It "Errno's"
159 .    It "Environment Variables"
160 .    It "Flags"
161 .    It "Function Declarations"
162 .    It "Function Types"
163 .    It "Functions (Library Routines)"
164 .    It "Function Arguments"
165 .    It "Return Values"
166 .    It "Exit Status"
167 .    \" .It "Header File (including source code)"
168 .    It "Interactive Commands"
169 .    It "Library Names"
170 .    It "Literals"
171 .    It "Names"
172 .    It "Options"
173 .    It "Pathnames"
174 .    It "Standards"
175 .    It "Variable Types"
176 .    It "Variables"
177 .    It "Manual Page Cross References"
178 .  El
180 .  It
181 .  Tn "GENERAL TEXT DOMAIN"
183 .  Bl -tag -width 2n -compact
184 .    It "AT&T Macro"
185 .    It "BSD Macro"
186 .    It "NetBSD Macro"
187 .    It "FreeBSD Macro"
188 .    It "OpenBSD Macro"
189 .    It "BSD/OS Macro"
190 .    It "UNIX Macro"
191 .    It "Emphasis Macro"
192 .    It "Font Mode"
193 .    It "Enclosure and Quoting Macros"
194 .    It "No-Op or Normal Text Macro"
195 .    It "No-Space Macro"
196 .    It "Section Cross References"
197 .    It "Symbolics"
198 .    It "Mathematical Symbols"
199 .    It "References and Citations"
200 .    It "Trade Names (or Acronyms and Type Names)"
201 .    It "Extended Arguments"
202 .  El
204 .  It
205 .  Tn "PAGE STRUCTURE DOMAIN"
207 .  Bl -tag -width 2n -compact
208 .    It "Section Headers"
209 .    It "Subsection Headers"
210 .    It "Paragraphs and Line Spacing"
211 .    It "Keeps"
212 .    It "Examples and Displays"
213 .    It "Lists and Columns"
214 .  El
216 .  It
217 .  Tn "MISCELLANEOUS MACROS"
219 .  It
220 .  Tn "PREDEFINED STRINGS"
222 .  It
223 .  Tn "DIAGNOSTICS"
225 .  It
226 .  Tn "FORMATTING WITH GROFF, TROFF, AND NROFF"
228 .  It
229 .  Tn "FILES"
231 .  It
232 .  Tn "SEE ALSO"
234 .  It
235 .  Tn "BUGS"
238 .\" XXX
239 .if t \
240 .  ne 7
243 .Sh "TROFF IDIOSYNCRASIES"
246 .Nm \-mdoc
247 package attempts to simplify the process of writing a man page.
248 Theoretically, one should not have to learn the tricky details of
249 .Tn GNU
250 .Xr troff 1
251 to use
252 .Nm \-mdoc ;
253 however, there are a few limitations which are unavoidable and best gotten
254 out of the way.
255 And, too, be forewarned, this package is
256 .Em not
257 fast.
259 .Ss "Macro Usage"
261 As in
262 .Tn GNU
263 .Xr troff 1 ,
264 a macro is called by placing a
265 .Ql .\&
266 (dot character) at the beginning of a line followed by the two-character
267 (or three-character) name for the macro.
268 There can be space or tab characters between the dot and the macro name.
269 Arguments may follow the macro separated by spaces (but
270 .Em no
271 tabs).
272 It is the dot character at the beginning of the line which causes
273 .Tn GNU
274 .Xr troff 1
275 to interpret the next two (or more) characters as a macro name.
276 A single starting dot followed by nothing is ignored.
277 To place a
278 .Ql .\&
279 (dot character) at the beginning of an input line in some context other than
280 a macro invocation, precede the
281 .Ql .\&
282 (dot) with the
283 .Ql \e&
284 escape sequence which translates literally to a zero-width space, and is
285 never displayed in the output.
287 In general,
288 .Tn GNU
289 .Xr troff 1
290 macros accept an unlimited number of arguments (contrary to other versions
291 of troff which can't handle more than nine arguments).
292 In limited cases, arguments may be continued or extended on the next
293 line (See
294 .Sx Extended Arguments
295 below).
296 Almost all macros handle quoted arguments (see
297 .Sx Passing Space Characters in an Argument
298 below).
300 Most of the
301 .Nm \-mdoc
302 general text domain and manual domain macros are special in that their
303 argument lists are
304 .Em parsed
305 for callable macro names.
306 This means an argument on the argument list which matches a general text or
307 manual domain macro name (and which is defined to be callable) will be
308 executed or called when it is processed.
309 In this case the argument, although the name of a macro, is not preceded by
311 .Ql .\&
312 (dot).
313 This makes it possible to nest macros; for example the option macro,
314 .Ql .Op ,
316 .Em call
317 the flag and argument macros,
318 .Ql \&Fl
320 .Ql \&Ar ,
321 to specify an optional flag with an argument:
323 .Bl -tag -width ".Op Fl s Ar bytes" -offset indent
324 .It Op Fl s Ar bytes
325 is produced by
326 .Ql ".Op Fl s Ar bytes"
330 To prevent a string from being interpreted as a macro name, precede the
331 string with the escape sequence
332 .Ql \e& :
334 .Bl -tag -width ".Op \&Fl s \&Ar bytes" -offset indent
335 .It Op \&Fl s \&Ar bytes
336 is produced by
337 .Ql ".Op \e&Fl s \e&Ar bytes"
341 Here the strings
342 .Ql \&Fl
344 .Ql \&Ar
345 are not interpreted as macros.
346 Macros whose argument lists are parsed for callable arguments are referred
347 to as
348 .Em parsed
349 and macros which may be called from an argument list are referred to as
350 .Em callable
351 throughout this document.
352 This is a technical
353 .Em faux pas
354 as almost all of the macros in
355 .Nm \-mdoc
356 are parsed, but as it was cumbersome to constantly refer to macros as
357 being callable and being able to call other macros, the term parsed
358 has been used.
361 In the following, we call an
362 .Nm \-mdoc
363 macro which starts a line (with a leading dot) a
364 .Em command
365 if this distinction is necessary.
367 .Ss "Passing Space Characters in an Argument"
369 Sometimes it is desirable to give as an argument a string containing one or
370 more blank space characters, say, to specify arguments to commands which
371 expect particular arrangement of items in the argument list.
372 Additionally, it makes
373 .Nm \-mdoc
374 working faster.
375 For example, the function command
376 .Ql .Fn
377 expects the first argument to be the name of a function and any remaining
378 arguments to be function parameters.
380 .Tn ANSI\~C
381 stipulates the declaration of function parameters in the parenthesized
382 parameter list, each parameter is guaranteed to be at minimum a two word
383 string.
384 For example,
385 .Fa int foo .
387 There are two possible ways to pass an argument which contains
388 an embedded space.
389 One way of passing a string containing blank spaces is to use the hard or
390 unpaddable space character
391 .Ql \e\  ,
392 that is, a blank space preceded by the escape character
393 .Ql \e .
394 This method may be used with any macro but has the side effect of
395 interfering with the adjustment of text over the length of a line.
396 .Xr Troff
397 sees the hard space as if it were any other printable character and cannot
398 split the string into blank or newline separated pieces as one would expect.
399 This method is useful for strings which are not expected to overlap a line
400 boundary.
401 An alternative is to use
402 .Ql \e~ ,
403 a paddable (i.e.\& stretchable), unbreakable space (this is a
404 .Tn GNU
405 .Xr troff 1
406 extension).
407 The second method is to enclose the string with double quotes.
409 For example:
411 .Bl -tag -width ".Fn fetch char\ *str" -offset indent
412 .It Fn fetch char\ *str
413 is created by
414 .Ql ".Fn fetch char\e *str"
415 .It Fn fetch "char *str"
416 can also be created by
417 .Ql ".Fn fetch \*[q]char *str\*[q]"
421 If the
422 .Ql \e
423 before the space in the first example
424 or double quotes in the second example
425 were omitted,
426 .Ql .Fn
427 would see three arguments, and the result would be:
429 .Dl Fn fetch char *str
431 .\" For an example of what happens when the parameter list overlaps a newline
432 .\" boundary, see the
433 .\" .Sx BUGS
434 .\" section.
436 .Ss "Trailing Blank Space Characters"
438 .Xr Troff
439 can be confused by blank space characters at the end of a line.
440 It is a wise preventive measure to globally remove all blank spaces
441 from
442 .Ao blank-space Ac Ns Ao end-of-line Ac
443 character sequences.
444 Should the need arise to use a blank character at the end of a line, it
445 may be forced with an unpaddable space and the
446 .Ql \e&
447 escape character.
448 For example,
449 .Ql string\e\ \e& .
451 .Ss "Escaping Special Characters"
453 Special characters like the newline character
454 .Ql \en
455 are handled by replacing the
456 .Ql \e
457 with
458 .Ql \ee
459 (e.g.\&
460 .Ql \een )
461 to preserve the backslash.
463 .Ss "Other Possible Pitfalls"
465 A warning is emitted when an empty input line is found outside of displays
466 (see below).
468 .Ql .sp
469 instead.
470 (Well, it is even better to use
471 .Nm \-mdoc
472 macros to avoid the usage of low-level commands.)
474 Leading spaces will cause a break and are output directly.
475 Avoid this behaviour if possible.
476 Similarly, do not use more than one space character between words in an
477 ordinary text line; contrary to other text formatters, they are
478 .Em not
479 replaced with a single space.
481 You can't pass
482 .Ql \*[q]
483 directly as an argument.
485 .Ql \e*[q]
487 .Ql \e*q )
488 instead.
490 By default,
491 .Xr troff 1
492 inserts two space characters after a punctuation mark closing a sentence;
493 characters like
494 .Ql \&)
496 .Ql \&'
497 are treated transparently, not influencing the sentence-ending behaviour.
498 To change this, insert
499 .Ql \e&
500 before or after the dot:
502 .Bd -literal -offset indent
504 \&.Ql .
505 character.
506 \&.Pp
508 \&.Ql \e&.
509 character.
510 \&.Pp
511 \&.No test .
512 test
513 \&.Pp
514 \&.No test.
515 test
519 gives
521 .Bd -filled -offset indent
523 .Ql .
524 character
527 .Ql \&.
528 character.
530 .No test .
531 test
533 .No test.
534 test
538 As can be seen in the first and third line,
539 .Nm \-mdoc
540 handles punctuation characters specially in macro arguments.
541 This will be explained in section
542 .Sx General Syntax
543 below.
544 In the same way, you have to protect trailing full stops of abbreviations
545 with a trailing zero-width space:
546 .Ql e.g.\e& .
548 A comment in the source file of a man page can be either started with
549 .Ql .\e"
550 on a single line,
551 .Ql \e"
552 after some input, or
553 .Ql \e#
554 anywhere (the latter is a
555 .Tn GNU
556 .Xr troff 1
557 extension); the rest of such a line is ignored.
560 .Sh "A MANUAL PAGE TEMPLATE"
562 The body of a man page is easily constructed from a basic template:
564 .Bd -literal -offset indent
565 \&.\e" The following commands are required for all man pages.
566 \&.Dd Month day, year
567 \&.Os [OPERATING_SYSTEM] [version/release]
568 \&.Dt DOCUMENT_TITLE [section number] [architecture/volume]
569 \&.Sh NAME
570 \&.Nm name
571 \&.Nd one line description of name
572 \&.\e" This next command is for sections 2 and 3 only.
573 \&.\e" .Sh LIBRARY
574 \&.Sh SYNOPSIS
575 \&.Sh DESCRIPTION
576 \&.\e" The following commands should be uncommented and
577 \&.\e" used where appropriate.
578 \&.\e" .Sh IMPLEMENTATION NOTES
579 \&.\e" This next command is for sections 2, 3 and 9 function
580 \&.\e" return values only.
581 \&.\e" .Sh RETURN VALUES
582 \&.\e" This next command is for sections 1, 6, 7 and 8 only.
583 \&.\e" .Sh ENVIRONMENT
584 \&.\e" .Sh FILES
585 \&.\e" .Sh EXAMPLES
586 \&.\e" This next command is for sections 1, 6, 7, 8 and 9 only
587 \&.\e"     (command return values (to shell) and
588 \&.\e"     fprintf/stderr type diagnostics).
589 \&.\e" .Sh DIAGNOSTICS
590 \&.\e" .Sh COMPATIBILITY
591 \&.\e" This next command is for sections 2, 3 and 9 error
592 \&.\e"     and signal handling only.
593 \&.\e" .Sh ERRORS
594 \&.\e" .Sh SEE ALSO
595 \&.\e" .Sh STANDARDS
596 \&.\e" .Sh HISTORY
597 \&.\e" .Sh AUTHORS
598 \&.\e" .Sh BUGS
602 The first items in the template are the commands
603 .Ql .Dd ,
604 .Ql .Os ,
606 .Ql .Dt ;
607 the document date, the operating system the man page or subject source is
608 developed or modified for, and the man page title (in
609 .Em upper case )
610 along with the section of the manual the page belongs in.
611 These commands identify the page and are discussed below in
612 .Sx TITLE MACROS .
614 The remaining items in the template are section headers
615 .Pf ( Li .Sh ) ;
616 of which
617 .Sx NAME ,
618 .Sx SYNOPSIS ,
620 .Sx DESCRIPTION
621 are mandatory.
622 The headers are discussed in
623 .Sx "PAGE STRUCTURE DOMAIN" ,
624 after presentation of
625 .Sx "MANUAL DOMAIN" .
626 Several content macros are used to demonstrate page layout macros; reading
627 about content macros before page layout macros is recommended.
630 .Sh CONVENTIONS
632 In the description of all macros below, optional arguments are put into
633 brackets.
634 An ellipsis
635 .Pf ( Sq ... )
636 represents zero or more additional arguments.
637 Alternative values for a parameter are separated with
638 .Ql | .
639 If there are alternative values for a mandatory parameter, braces are used
640 (together with
641 .Ql | )
642 to enclose the value set.
643 Meta-variables are specified within angles.
645 Example:
647 .Bl -tag -width 6n -offset indent
648 .It Li .Xx Xo
649 .Aq foo 
650 .Brq bar1 | bar2
651 .Op \-test1 Op \-test2 | \-test3
652 .No ...
657 Except stated explicitly, all macros are parsed and callable.
659 Note that a macro takes effect up to the next nested macro.
660 For example,
661 .Ql ".Ic foo Aq bar"
662 doesn't produce
663 .Sq Ic "foo <bar>"
665 .Sq Ic foo Aq bar .
666 Consequently, a warning message is emitted for most commands if the first
667 argument is a macro itself since it cancels the effect of the calling
668 command completely.
669 Another consequence is that quoting macros never insert literal quotes;
670 .Sq Ic "foo <bar>"
671 has been produced by
672 .Ql ".Ic \*[q]foo <bar>\*[q]" .
674 Most macros have a default width value which can be used to specify a label
675 width
676 .Pf ( Fl width )
677 or offset
678 .Pf ( Fl offset )
679 for the
680 .Ql .Bl
682 .Ql .Bd
683 macros.
684 It is recommended not to use this rather obscure feature to avoid
685 dependencies on local modifications of the
686 .Nm \-mdoc
687 package.
690 .Sh "TITLE MACROS"
692 The title macros are part of the page structure domain but are presented
693 first and separately for someone who wishes to start writing a man page
694 yesterday.
695 Three header macros designate the document title or manual page title, the
696 operating system, and the date of authorship.
697 These macros are called once at the very beginning of the document and are
698 used to construct headers and footers only.
700 .Bl -tag -width 6n
701 .It Li .Dt Xo
702 .Op Aq document title
703 .Op Aq section number
704 .Op Aq volume
706 The document title is the subject of the man page and must be in
707 .Tn CAPITALS
708 due to troff limitations.
709 If omitted,
710 .Sq Tn UNTITLED
711 is used.
712 The section number may be a number in the range
713 .No 1,\~ Ns ... Ns ,\~9
715 .Ql unass ,
716 .Ql draft ,
718 .Ql paper .
719 If it is specified, and no volume name is given, a default volume name is
720 used.
723 Under
724 .Tn \*[operating-system] ,
725 the following sections are defined:
727 .Bl -column LOCAL -offset indent -compact
728 .It Li 1   Ta "\*[volume-operating-system] \*[volume-ds-1]"
729 .It Li 2   Ta "\*[volume-operating-system] \*[volume-ds-2]"
730 .It Li 3   Ta "\*[volume-operating-system] \*[volume-ds-3]"
731 .It Li 4   Ta "\*[volume-operating-system] \*[volume-ds-4]"
732 .It Li 5   Ta "\*[volume-operating-system] \*[volume-ds-5]"
733 .It Li 6   Ta "\*[volume-operating-system] \*[volume-ds-6]"
734 .It Li 7   Ta "\*[volume-operating-system] \*[volume-ds-7]"
735 .It Li 8   Ta "\*[volume-operating-system] \*[volume-ds-8]"
736 .It Li 9   Ta "\*[volume-operating-system] \*[volume-ds-9]"
740 A volume name may be arbitrary or one of the following:
743 .Bl -column LOCAL -offset indent -compact
744 .It Li USD   Ta "\*[volume-ds-USD]"
745 .It Li PS1   Ta "\*[volume-ds-PS1]"
746 .It Li AMD   Ta "\*[volume-ds-AMD]"
747 .It Li SMM   Ta "\*[volume-ds-SMM]"
748 .It Li URM   Ta "\*[volume-ds-URM]"
749 .It Li PRM   Ta "\*[volume-ds-PRM]"
750 .It Li KM    Ta "\*[volume-ds-KM]"
751 .It Li IND   Ta "\*[volume-ds-IND]"
752 .It Li LOCAL Ta "\*[volume-ds-LOCAL]"
753 .It Li CON   Ta "\*[volume-ds-CON]"
757 For compatibility,
758 .Ql MMI
759 can be used for
760 .Ql IND ,
762 .Ql LOC
764 .Ql LOCAL .
765 Values from the previous table will specify a new volume name.
766 If the third parameter is a keyword designating a computer architecture,
767 its value is prepended to the default volume name as specified by the
768 second parameter.
769 By default, the following architecture keywords are defined:
771 \# we use `No' to avoid hyphenation
772 .Bd -ragged -offset indent
773 .No alpha , amiga , arc , arm26 , arm32 , atari , bebox , cobalt , evbsh3 ,
774 .No hp300 , hpcmips , i386 , luna68k , m68k , mac68k , macppc , mips ,
775 .No mmeye , mvme68k , news68k , newsmips , next68k , ofppc , pc532 , pmax ,
776 .No powerpc , prep , sgimips , sh3 , sparc , sparc64 , sun3 , tahoe , vax ,
777 .No x68k
781 If the section number is neither a numeric expression in the range 1 to\~9
782 nor one of the above described keywords, the third parameter is used
783 verbatim as the volume name.
785 In the following examples, the left (which is identical to the right) and
786 the middle part of the manual page header strings are shown.
787 Note how
788 .Ql \e&
789 prevents the digit\~7 from being a valid numeric expression.
791 .Bd -ragged
792 .Bl -tag -width ".Li .Dt\ FOO\ 2\ i386" -compact -offset indent
793 .It Li ".Dt FOO 7"
794 .Ql FOO(7)
795 .Ql \*[volume-operating-system] \*[volume-ds-7]
796 .It Li ".Dt FOO 7 bar"
797 .Ql FOO(7)
798 .Ql \*[volume-operating-system] \*[volume-ds-7]
799 .It Li ".Dt FOO \e&7 bar"
800 .Ql FOO(7)
801 .Ql bar
802 .It Li ".Dt FOO 2 i386"
803 .Ql FOO(2)
804 .Ql \*[volume-operating-system]/\*[volume-as-i386] \*[volume-ds-2]
805 .It Li ".Dt FOO \*[q]\*[q] bar"
806 .Ql FOO
807 .Ql bar
812 Local, OS-specific additions might be found in the file
813 .Pa mdoc.local ;
814 look for strings named
815 .Ql volume-ds-XXX
816 (for the former type) and
817 .Ql volume-as-XXX
818 (for the latter type);
819 .Ql XXX
820 then denotes the keyword to be used with the
821 .Ql .Dt
822 macro.
824 This macro is neither callable nor parsed.
826 .It Li .Os Xo
827 .Op Aq operating system
828 .Op Aq release
830 If the first parameter is empty,
831 the default
832 .Sq Tn "\*[operating-system]"
833 is used.
834 This may be overridden in the local configuration file,
835 .Pa mdoc.local .
836 In general, the name of the operating system should be the common acronym,
837 e.g.\&
838 .Tn BSD
840 .Tn ATT .
841 The release should be the standard release nomenclature for the system
842 specified.
843 In the following table, the possible second arguments for some predefined
844 operating systems are listed.
845 Similar to
846 .Ql .Dt ,
847 local additions might be defined in
848 .Pa mdoc.local ;
849 look for strings named
850 .Ql operating-system-XXX-YYY ,
851 where
852 .Ql XXX
853 is the acronym for the operating system and
854 .Ql YYY
855 the release ID.
857 .Bd -ragged -compact
858 .Bl -tag -width ".No FreeBSD" -offset indent
859 .It ATT
860 7th, 7, III, 3, V, V.2, V.3, V.4
861 .It BSD
862 3, 4, 4.1, 4.2, 4.3, 4.3t, 4.3T, 4.3r, 4.3R, 4.4
863 .It NetBSD
864 0.8, 0.8a, 0.9, 0.9a, 1.0, 1.0a, 1.1, 1.2, 1.2a, 1.2b, 1.2c, 1.2d, 1.2e,
865 1.3, 1.3a, 1.4, 1.5, 1.6
866 .It FreeBSD
867 1.0, 1.1, 1.1.5, 1.1.5.1, 2.0, 2.0.5, 2.1, 2.1.5, 2.1.6, 2.1.7, 2.2, 2.2.1,
868 2.2.2, 2.2.5, 2.2.6, 2.2.7, 2.2.8, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 4.0, 4.1,
869 4.2, 4.3, 4.4, 4.5, 5.0
875 .Tn ATT ,
876 an unknown second parameter will be replaced with the string
877 .Tn UNIX ;
878 for the other predefined acronyms it will be ignored and a warning message
879 emitted.
880 Unrecognized arguments are displayed as given in the page footer.
881 For instance, a typical footer might be:
883 .Dl .Os BSD 4.3
885 giving
886 .Ql 4.3\~Berkeley Distribution ,
887 or for a locally produced set
889 .Dl .Os CS Department
891 which will produce
892 .Ql CS\~Department .
894 If the
895 .Ql .Os
896 macro is not present, the bottom left corner of the manual page will be
897 ugly.
899 This macro is neither callable nor parsed.
901 .It Li .Dd Oo
902 .Aq month
903 .Aq day ,
904 .Aq year
907 .Ql Dd
908 has no arguments,
909 .Ql Epoch
910 is used for the date string.
911 If it has exactly three arguments, they are concatenated, separated with
912 unbreakable space:
914 .Dl .Dd January 25, 2001
916 Otherwise, the current date is used, ignoring the parameters.
918 This macro is neither callable nor parsed.
922 .Sh "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS"
924 .Ss "What's in a Name" Ns ...
926 The manual domain macro names are derived from the day to day informal
927 language used to describe commands, subroutines and related files.
928 Slightly different variations of this language are used to describe the
929 three different aspects of writing a man page.
930 First, there is the description of
931 .Nm \-mdoc
932 macro command usage.
933 Second is the description of a
935 command
936 .Em with
937 .Nm \-mdoc
938 macros, and third, the description of a command to a user in the verbal
939 sense; that is, discussion of a command in the text of a man page.
941 In the first case,
942 .Xr troff 1
943 macros are themselves a type of command; the general syntax for a troff
944 command is:
946 .Bd -filled -offset indent
947 .Li ".Xx argument1 argument2" ...
951 .Ql .Xx
952 is a macro command, and anything following it are arguments to
953 be processed.
954 In the second case, the description of a
956 command using the content macros is a bit more involved; a typical
957 .Sx SYNOPSIS
958 command line might be displayed as:
960 .Bd -filled -offset indent
961 .Nm filter
962 .Op Fl flag
963 .Ao Ar infile Ac Ao Ar outfile Ac
967 Here,
968 .Nm filter
969 is the command name and the
970 bracketed string
971 .Fl flag
972 is a
973 .Em flag
974 argument designated as optional by the option brackets.
976 .Nm \-mdoc
977 terms,
978 .Ao Ar infile Ac
980 .Ao Ar outfile Ac
981 are called
982 .Em meta arguments ;
983 in this example, the user has to replace the meta expressions given in angle
984 brackets with real file names.
985 Note that in this document meta arguments are used to describe
986 .Nm \-mdoc
987 commands; in most man pages, meta variables are not specifically written
988 with angle brackets.
989 The macros which formatted the above example:
991 .Bd -literal -offset indent
992 \&.Nm filter
993 \&.Op Fl flag
994 \&.Ao Ar infile Ac Ao Ar outfile Ac
998 In the third case, discussion of commands and command syntax includes both
999 examples above, but may add more detail.
1000 The arguments
1001 .Ao Ar infile Ac
1003 .Ao Ar outfile Ac
1004 from the example above might be referred to as
1005 .Em operands
1007 .Em file arguments .
1008 Some command line argument lists are quite long:
1010 .Bd -ragged
1011 .Bl -tag -width ".Nm make" -offset indent -compact
1012 .It Nm make
1013 .Op Fl eiknqrstv
1014 .Op Fl D Ar variable
1015 .Op Fl d Ar flags
1016 .Op Fl f Ar makefile
1017 .Op Fl I Ar directory
1018 .Op Fl j Ar max_jobs
1019 .Op Ar variable Ns = Ns Ar value
1021 .Op Ar target ...
1027 Here one might talk about the command
1028 .Nm make
1029 and qualify the argument,
1030 .Ar makefile ,
1031 as an argument to the flag,
1032 .Fl f ,
1033 or discuss the optional file operand
1034 .Ar target .
1035 In the verbal context, such detail can prevent confusion, however the
1036 .Nm \-mdoc
1037 package does not have a macro for an argument
1038 .Em to
1039 a flag.
1040 Instead the
1041 .Ql \&Ar
1042 argument macro is used for an operand or file argument like
1043 .Ar target
1044 as well as an argument to a flag like
1045 .Ar variable .
1046 The make command line was produced from:
1048 .Bd -literal -offset indent
1049 \&.Nm make
1050 \&.Op Fl eiknqrstv
1051 \&.Op Fl D Ar variable
1052 \&.Op Fl d Ar flags
1053 \&.Op Fl f Ar makefile
1054 \&.Op Fl I Ar directory
1055 \&.Op Fl j Ar max_jobs
1056 \&.Op Ar variable Ns = Ns Ar value
1057 \&.Bk
1058 \&.Op Ar target ...
1059 \&.Ek
1064 .Ql .Bk
1066 .Ql .Ek
1067 macros are explained in
1068 .Sx Keeps .
1070 .Ss "General Syntax"
1072 The manual domain and general text domain macros share a similar syntax with
1073 a few minor deviations; most notably,
1074 .Ql .Ar ,
1075 .Ql .Fl ,
1076 .Ql .Nm ,
1078 .Ql .Pa
1079 differ only when called without arguments; and
1080 .Ql .Fn
1082 .Ql .Xr
1083 impose an order on their argument lists.
1084 All content macros are capable of recognizing and properly handling
1085 punctuation, provided each punctuation character is separated by a leading
1086 space.
1087 If a command is given:
1089 .Dl \&.Ar sptr, ptr),
1091 The result is:
1093 .Dl Ar sptr, ptr),
1095 The punctuation is not recognized and all is output in the
1096 font used by
1097 .Ql .Ar .
1098 If the punctuation is separated by a leading white space:
1100 .Dl \&.Ar "sptr , ptr ) ,"
1102 The result is:
1104 .Dl Ar sptr , ptr ) ,
1106 The punctuation is now recognized and output in the default font
1107 distinguishing it from the argument strings.
1108 To remove the special meaning from a punctuation character escape it with
1109 .Ql \e& .
1111 The following punctuation characters are recognized by
1112 .Nm \-mdoc :
1114 .Bl -column -offset indent-two XXXXXX XXXXXX XXXXXX XXXXXX
1115 .It Li .\& Ta Li ,\& Ta Li :\& Ta Li ;\& Ta Li (\&
1116 .It Li )\& Ta Li [\& Ta Li ]\& Ta Li ?\& Ta Li !\&
1120 .Xr Troff
1121 is limited as a macro language, and has difficulty when presented with a
1122 string containing a member of the mathematical, logical or quotation set:
1124 .Bd -literal -offset indent-two
1125 {+,\-,/,*,%,<,>,<=,>=,=,==,&,`,',"}
1129 The problem is that
1130 .Xr troff
1131 may assume it is supposed to actually perform the operation or evaluation
1132 suggested by the characters.
1133 To prevent the accidental evaluation of these characters, escape them with
1134 .Ql \e& .
1135 Typical syntax is shown in the first content macro displayed below,
1136 .Ql .Ad .
1139 .Sh "MANUAL DOMAIN"
1141 .Ss Addresses
1143 The address macro identifies an address construct.
1145 .Dl Usage: .Ad Ao address Ac ...
1147 .Bl -tag -width ".Li .Ad\ f1\ ,\ f2\ ,\ f3\ :" -compact -offset 15n
1148 .It Li ".Ad addr1"
1149 .Ad addr1
1150 .It Li ".Ad addr1 ."
1151 .Ad addr1 .
1152 .It Li ".Ad addr1 , file2"
1153 .Ad addr1 , file2
1154 .It Li ".Ad f1 , f2 , f3 :"
1155 .Ad f1 , f2 , f3 :
1156 .It Li ".Ad addr ) ) ,"
1157 .Ad addr ) ) ,
1161 The default width is 12n.
1163 .Ss "Author Name"
1166 .Ql .An
1167 macro is used to specify the name of the author of the item being
1168 documented, or the name of the author of the actual manual page.
1170 .Dl Usage: .An Ao author name Ac ...
1172 .Bl -tag -width ".Li .An\ \*[q]Joe\ Author\*[q]\ )\ )\ ," -offset 15n
1173 .It Li ".An \*[q]Joe Author\*[q]"
1174 .An "Joe Author"
1175 .It Li ".An \*[q]Joe Author\*[q] ,"
1176 .An "Joe Author" ,
1177 .It Li ".An \*[q]Joe Author\*[q] Aq nobody@FreeBSD.org"
1178 .An "Joe Author" Aq nobody@FreeBSD.org
1179 .It Li ".An \*[q]Joe Author\*[q] ) ) ,"
1180 .An "Joe Author" ) ) ,
1184 The default width is 12n.
1186 In the
1187 .Sx AUTHORS
1188 section, the
1189 .Ql .An
1190 command causes a line break allowing each new name to appear on its own
1191 line.
1192 If this is not desirable,
1194 .Bd -literal -offset indent
1195 \&.An -nosplit
1199 call will turn this off.
1200 To turn splitting back on, write
1202 .Bd -literal -offset indent
1203 \&.An -split
1206 .Ss "Arguments"
1209 .Li .Ar
1210 argument macro may be used whenever an argument is referenced.
1211 If called without arguments, the
1212 .Sq Ar
1213 string is output.
1215 .Dl Usage: .Ar Oo Ao argument Ac Oc ...
1217 .Bl -tag -width ".Li .Ar\ file1\ file2" -compact -offset 15n
1218 .It Li .Ar
1220 .It Li ".Ar file1"
1221 .Ar file1
1222 .It Li ".Ar file1 ."
1223 .Ar file1 .
1224 .It Li ".Ar file1 file2"
1225 .Ar file1 file2
1226 .It Li ".Ar f1 f2 f3 :"
1227 .Ar f1 f2 f3 :
1228 .It Li ".Ar file ) ) ,"
1229 .Ar file ) ) ,
1233 The default width is 12n.
1235 .Ss "Configuration Declaration (Section Four Only)"
1238 .Ql .Cd
1239 macro is used to demonstrate a
1240 .Xr config 8
1241 declaration for a device interface in a section four manual.
1243 .Dl Usage: .Cd Ao argument Ac ...
1245 .Bl -tag -width ".Li .Cd\ Xdevice\ le0\ at\ scode?X" -offset 15n
1246 .It Li ".Cd \*[q]device le0 at scode?\*[q]"
1247 .Cd "device le0 at scode?"
1250 In the
1251 .Sx SYNOPSIS
1252 section a
1253 .Ql .Cd
1254 command causes a line break before and after its arguments are printed.
1257 The default width is 12n.
1259 .Ss "Command Modifiers"
1261 The command modifier is identical to the
1262 .Ql .Fl
1263 (flag) command with the exception that the
1264 .Ql .Cm
1265 macro does not assert a dash in front of every argument.
1266 Traditionally flags are marked by the preceding dash, however, some commands
1267 or subsets of commands do not use them.
1268 Command modifiers may also be specified in conjunction with interactive
1269 commands such as editor commands.
1271 .Sx Flags .
1273 The default width is 10n.
1275 .Ss "Defined Variables"
1277 A variable (or constant) which is defined in an include file
1278 is specified by the macro
1279 .Ql .Dv .
1281 .Dl Usage: .Dv Ao defined variable Ac ...
1283 .Bl -tag -width ".Li .Dv\ MAXHOSTNAMELEN" -compact -offset 15n
1284 .It Li ".Dv MAXHOSTNAMELEN"
1285 .Dv MAXHOSTNAMELEN
1286 .It Li ".Dv TIOCGPGRP )"
1287 .Dv TIOCGPGRP )
1291 The default width is 12n.
1293 .Ss Errno's
1296 .Ql .Er
1297 errno macro specifies the error return value for section 2, 3, and\~9 library
1298 routines.
1299 The second example below shows
1300 .Ql .Er
1301 used with the
1302 .Ql .Bq
1303 general text domain macro, as it would be used in a section two manual page.
1305 .Dl Usage: .Er Ao errno type Ac ...
1307 .Bl -tag -width ".Li .Bq\ Er\ ENOTDIR" -compact -offset 15n
1308 .It Li ".Er ENOENT"
1309 .Er ENOENT
1310 .It Li ".Er ENOENT ) ;"
1311 .Er ENOENT ) ;
1312 .It Li ".Bq Er ENOTDIR"
1313 .Bq Er ENOTDIR
1317 The default width is 17n.
1319 .Ss "Environment Variables"
1322 .Ql .Ev
1323 macro specifies an environment variable.
1325 .Dl Usage: .Ev Ao argument Ac ...
1327 .Bl -tag -width ".Li .Ev\ PRINTER\ )\ )\ ," -compact -offset 15n
1328 .It Li ".Ev DISPLAY"
1329 .Ev DISPLAY
1330 .It Li ".Ev PATH ."
1331 .Ev PATH .
1332 .It Li ".Ev PRINTER ) ) ,"
1333 .Ev PRINTER ) ) ,
1337 The default width is 15n.
1339 .Ss Flags
1342 .Ql .Fl
1343 macro handles command line flags.
1344 It prepends a dash,
1345 .Ql \- ,
1346 to the flag.
1347 For interactive command flags, which are not prepended with a dash, the
1348 .Ql .Cm
1349 (command modifier)
1350 macro is identical, but without the dash.
1352 .Dl Usage: .Fl Ao argument Ac ...
1354 .Bl -tag -width ".Li .Fl\ xyz\ )\ ," -compact -offset 15n
1355 .It Li .Fl
1357 .It Li ".Fl cfv"
1358 .Fl cfv
1359 .It Li ".Fl cfv ."
1360 .Fl cfv .
1361 .It Li ".Cm cfv ."
1362 .Cm cfv .
1363 .It Li ".Fl s v t"
1364 .Fl s v t
1365 .It Li ".Fl \- ,"
1366 .Fl \- ,
1367 .It Li ".Fl xyz ) ,"
1368 .Fl xyz ) ,
1369 .It Li ".Fl |"
1370 .Fl |
1374 .Ql .Fl
1375 macro without any arguments results in a dash representing stdin/stdout.
1376 Note that giving
1377 .Ql .Fl
1378 a single dash will result in two dashes.
1380 The default width is 12n.
1382 .Ss "Function Declarations"
1385 .Ql .Fd
1386 macro is used in the
1387 .Sx SYNOPSIS
1388 section with section two or three functions.
1389 It is neither callable nor parsed.
1391 .Dl Usage: .Fd Ao argument Ac ...
1393 .Bl -tag -width ".Li .Fd\ X#include\ <sys/types.h>X" -compact -offset 15n
1394 .It Li ".Fd \*[q]#include <sys/types.h>\*[q]"
1395 .Fd "#include <sys/types.h>"
1398 In the
1399 .Sx SYNOPSIS
1400 section a
1401 .Ql .Fd
1402 command causes a line break if a function has already been presented and a
1403 break has not occurred.
1404 This leaves a nice vertical space in between the previous function call and
1405 the declaration for the next function.
1409 .Ql .In
1410 macro, while in the
1411 .Sx SYNOPSIS
1412 section, represents the
1413 .Li #include
1414 statement, and is the short form of the above example.
1415 It specifies the C\~header file as being included in a C\~program.
1416 It also causes a line break.
1418 While not in the
1419 .Sx SYNOPSIS
1420 section, it represents the header file enclosed in angle brackets.
1422 .Dl Usage: .In Ao header file Ac
1424 .Bl -tag -width ".Li .In\ stdio.h" -compact -offset 15n
1425 .nr in-synopsis-section 1
1426 .It Li ".In stdio.h"
1427 .In stdio.h
1428 .nr in-synopsis-section 0
1429 .It Li ".In stdio.h"
1430 .In stdio.h
1433 .Ss "Function Types"
1435 This macro is intended for the
1436 .Sx SYNOPSIS
1437 section.
1438 It may be used anywhere else in the man page without problems, but its main
1439 purpose is to present the function type in kernel normal form for the
1440 .Sx SYNOPSIS
1441 of sections two and three (it causes a line break, allowing the function
1442 name to appear on the next line).
1444 .Dl Usage: .Ft Ao type Ac ...
1446 .Bl -tag -width ".Li .Ft\ struct\ stat" -compact -offset 15n
1447 .It Li ".Ft struct stat"
1448 .Ft struct stat
1451 .Ss "Functions (Library Routines)"
1453 The 
1454 .Ql .Fn
1455 macro is modeled on
1456 .Tn ANSI\~C
1457 conventions.
1459 .Dl Usage: .Fn Ao function Ac Oo Ao parameter Ac Oc ...
1461 .Bl -tag -width ".Li .Fn\ align\ Xchar\ *ptrX\ ," -compact -offset 15n
1462 .It Li ".Fn getchar"
1463 .Fn getchar
1464 .It Li ".Fn strlen ) ,"
1465 .Fn strlen ) ,
1466 .It Li ".Fn align \*[q]char *ptr\*[q] ,"
1467 .Fn align "char *ptr" ,
1470 Note that any call to another macro signals the end of the
1471 .Ql .Fn
1472 call (it will insert a closing parenthesis at that point).
1474 For functions with many parameters (which is rare), the macros
1475 .Ql .Fo
1476 (function open)
1478 .Ql .Fc
1479 (function close)
1480 may be used with
1481 .Ql .Fa
1482 (function argument).
1484 Example:
1486 .Bd -literal -offset indent
1487 \&.Ft int
1488 \&.Fo res_mkquery
1489 \&.Fa "int op"
1490 \&.Fa "char *dname"
1491 \&.Fa "int class"
1492 \&.Fa "int type"
1493 \&.Fa "char *data"
1494 \&.Fa "int datalen"
1495 \&.Fa "struct rrec *newrr"
1496 \&.Fa "char *buf"
1497 \&.Fa "int buflen"
1498 \&.Fc
1502 Produces:
1504 .Bd -ragged -offset indent
1505 .Ft int
1506 .Fo res_mkquery
1507 .Fa "int op"
1508 .Fa "char *dname"
1509 .Fa "int class"
1510 .Fa "int type"
1511 .Fa "char *data"
1512 .Fa "int datalen"
1513 .Fa "struct rrec *newrr"
1514 .Fa "char *buf"
1515 .Fa "int buflen"
1520 In the
1521 .Sx SYNOPSIS
1522 section, the function will always begin at the beginning of line.
1523 If there is more than one function presented in the
1524 .Sx SYNOPSIS
1525 section and a function type has not been given, a line break will occur,
1526 leaving a nice vertical space between the current function name and the one
1527 prior.
1529 The default width values of
1530 .Ql .Fn
1532 .Ql .Fo
1533 are 12n and 16n, respectively.
1535 .Ss "Function Arguments"
1538 .Ql .Fa
1539 macro is used to refer to function arguments (parameters) outside of the
1540 .Sx SYNOPSIS
1541 section of the manual or inside the
1542 .Sx SYNOPSIS
1543 section if the enclosure macros
1544 .Ql .Fo
1546 .Ql .Fc
1547 instead of
1548 .Ql .Fn
1549 are used.
1550 .Ql .Fa
1551 may also be used to refer to structure members.
1553 .Dl Usage: .Fa Ao function argument Ac ...
1555 .Bl -tag -width ".Li .Fa\ d_namlen\ )\ )\ ," -compact -offset 15n
1556 .It Li ".Fa d_namlen ) ) ,"
1557 .Fa d_namlen ) ) ,
1558 .It Li ".Fa iov_len"
1559 .Fa iov_len
1563 The default width is 12n.
1565 .Ss "Return Values"
1568 .Ql .Rv
1569 macro generates text for use in the
1570 .Sx RETURN VALUES
1571 section.
1573 .Dl Usage: .Rv Oo -std Oc Op Ao function Ac ...
1575 For example,
1576 .Ql ".Rv -std atexit"
1577 produces:
1579 .Bd -ragged -offset -indent
1580 \# a small hack to suppress a warning message
1581 .ds section-old "\*[section]
1582 .ds section 3
1583 .Rv -std atexit
1584 .ds section "\*[section-old]
1589 .Fl std
1590 option is valid only for manual page sections\~2 and\~3.
1591 Currently, this macro does nothing if used without the
1592 .Fl std
1593 flag.
1595 .Ss "Exit Status"
1598 .Ql .Ex
1599 macro generates text for use in the
1600 .Sx DIAGNOSTICS
1601 section.
1603 .Dl Usage: .Ex Oo -std Oc Op Ao utility Ac ...
1605 For example,
1606 .Ql ".Ex -std cat"
1607 produces:
1609 .Bd -ragged -offset -indent
1610 \# a small hack to suppress a warning message
1611 .ds section-old "\*[section]
1612 .ds section 1
1613 .Ex -std cat
1614 .ds section "\*[section-old]
1619 .Fl std
1620 option is valid only for manual page sections 1, 6 and\~8.
1621 Currently, this macro does nothing if used without the
1622 .Fl std
1623 flag.
1625 .Ss "Interactive Commands"
1628 .Ql .Ic
1629 macro designates an interactive or internal command.
1631 .Dl Usage: .Ic Ao argument Ac ...
1633 .Bl -tag -width ".Li .Ic\ setenv\ ,\ unsetenv" -compact -offset 15n
1634 .It Li ".Ic :wq"
1635 .Ic :wq
1636 .It Li ".Ic \*[q]do while {...}\*[q]"
1637 .Ic "do while {...}"
1638 .It Li ".Ic setenv , unsetenv"
1639 .Ic setenv , unsetenv
1643 The default width is 12n.
1645 .Ss "Library Names"
1648 .Ql .Lb
1649 macro is used to specify the library where a particular function is compiled
1652 .Dl Usage: .Lb Ao argument Ac ...
1654 Available arguments to
1655 .Ql .Lb 
1656 and their results are:
1659 .Bl -tag -width ".Li libossaudio" -compact -offset indent
1660 .It Li libarm32
1661 .Lb libarm32
1662 .It Li libc
1663 .Lb libc
1664 .It Li libcompat
1665 .Lb libcompat
1666 .It Li libcrypt
1667 .Lb libcrypt
1668 .It Li libcurses
1669 .Lb libcurses
1670 .It Li libedit
1671 .Lb libedit
1672 .It Li libi386
1673 .Lb libi386
1674 .It Li libipsec
1675 .Lb libipsec
1676 .It Li libkvm
1677 .Lb libkvm
1678 .It Li libm
1679 .Lb libm
1680 .It Li libmenu
1681 .Lb libmenu
1682 .It Li libossaudio
1683 .Lb libossaudio
1684 .It Li libposix
1685 .Lb libposix
1686 .It Li libresolv
1687 .Lb libresolv
1688 .It Li libtermcap
1689 .Lb libtermcap
1690 .It Li libutil
1691 .Lb libutil
1692 .It Li libz
1693 .Lb libz
1697 Local, OS-specific additions might be found in the file
1698 .Pa mdoc.local ;
1699 look for strings named
1700 .Ql str-Lb-XXX .
1701 .Ql XXX
1702 then denotes the keyword to be used with the
1703 .Ql .Lb
1704 macro.
1706 In the
1707 .Sx LIBRARY
1708 section an
1709 .Ql .Lb
1710 command causes a line break before and after its arguments are printed.
1713 .Ss Literals
1716 .Ql .Li
1717 literal macro may be used for special characters, variable constants, etc.\&
1718 -- anything which should be displayed as it would be typed.
1720 .Dl Usage: .Li Ao argument Ac ...
1722 .Bl -tag -width ".Li .Li\ cntrl-D\ )\ ,"  -compact -offset 15n
1723 .It Li ".Li \een"
1724 .Li \en
1725 .It Li ".Li M1 M2 M3 ;"
1726 .Li M1 M2 M3 ;
1727 .It Li ".Li cntrl-D ) ,"
1728 .Li cntrl-D ) ,
1729 .It Li ".Li 1024 ..."
1730 .Li 1024 ...
1734 The default width is 16n.
1736 .Ss Names
1739 .Ql .Nm
1740 macro is used for the document title or subject name.
1741 It has the peculiarity of remembering the first argument it was called with,
1742 which should always be the subject name of the page.
1743 When called without arguments,
1744 .Ql .Nm
1745 regurgitates this initial name for the sole purpose of making less work for
1746 the author.
1747 Note: A section two or three document function name is addressed with the
1748 .Ql .Nm
1749 in the
1750 .Sx NAME
1751 section, and with
1752 .Ql .Fn
1753 in the
1754 .Sx SYNOPSIS
1755 and remaining sections.
1756 For interactive commands, such as the
1757 .Ql while
1758 command keyword in
1759 .Xr csh 1 ,
1761 .Ql .Ic
1762 macro should be used.
1763 While
1764 .Ql .Ic
1765 is nearly identical
1767 .Ql .Nm ,
1768 it can not recall the first argument it was invoked with.
1770 .Dl Usage: .Nm Oo Ao argument Ac Oc ...
1772 .Bl -tag -width ".Li .Nm\ groff_mdoc" -compact -offset 15n
1773 .It Li ".Nm groff_mdoc"
1774 .Nm groff_mdoc
1775 .It Li ".Nm \e-mdoc"
1776 .Nm \-mdoc
1777 .It Li ".Nm foo ) ) ,"
1778 .Nm foo ) ) ,
1779 .It Li ".Nm :"
1780 .Nm :
1784 The default width is 10n.
1786 .Ss Options
1789 .Ql .Op
1790 macro places option brackets around any remaining arguments on the
1791 command line, and places any trailing punctuation outside the brackets.
1792 The macros
1793 .Ql .Oo
1795 .Ql .Oc
1796 (which produce an opening and a closing option bracket respectively) may be used
1797 across one or more lines or to specify the exact position of the closing
1798 parenthesis.
1800 .Dl Usage: .Op Oo Ao option Ac Oc ...
1802 .Bl -tag -width ".Li .Op\ Fl\ c\ Ar\ objfil\ Op\ Ar\ corfil\ ," -compact -offset 15n
1803 .It Li .Op
1805 .It Li ".Op Fl k"
1806 .Op Fl k
1807 .It Li ".Op Fl k ) ."
1808 .Op Fl k ) .
1809 .It Li ".Op Fl k Ar kookfile"
1810 .Op Fl k Ar kookfile
1811 .It Li ".Op Fl k Ar kookfile ,"
1812 .Op Fl k Ar kookfile ,
1813 .It Li ".Op Ar objfil Op Ar corfil"
1814 .Op Ar objfil Op Ar corfil
1815 .It Li ".Op Fl c Ar objfil Op Ar corfil ,"
1816 .Op Fl c Ar objfil Op Ar corfil ,
1817 .It Li ".Op word1 word2"
1818 .Op word1 word2
1819 .It Li ".Li .Op Oo Ao option Ac Oc ..."
1820 .Li .Op Oo Ao options Ac Oc ...
1823 Here a typical example of the
1824 .Ql .Oo
1826 .Ql .Oc
1827 macros:
1829 .Bd -literal -offset indent
1830 \&.Oo
1831 \&.Op Fl k Ar kilobytes
1832 \&.Op Fl i Ar interval
1833 \&.Op Fl c Ar count
1834 \&.Oc
1838 Produces:
1840 .Bd -filled -offset indent
1842 .Op Fl k Ar kilobytes
1843 .Op Fl i Ar interval
1844 .Op Fl c Ar count
1849 The default width values of
1850 .Ql .Op
1852 .Ql .Oo
1853 are 14n and 10n, respectively.
1855 .Ss Pathnames
1858 .Ql .Pa
1859 macro formats path or file names.
1860 If called without arguments, the
1861 .Sq Pa
1862 string is output, which represents the current user's home directory.
1864 .Dl Usage: .Pa Oo Ao pathname Ac Oc ...
1866 .Bl -tag -width ".Li .Pa\ /tmp/fooXXXXX\ )\ ." -compact -offset 15n
1867 .It Li .Pa
1869 .It Li ".Pa /usr/share"
1870 .Pa /usr/share
1871 .It Li ".Pa /tmp/fooXXXXX ) ."
1872 .Pa /tmp/fooXXXXX ) .
1876 The default width is 32n.
1878 .Ss Standards
1881 .Ql .St
1882 macro replaces standard abbreviations with their formal names.
1884 .Dl Usage: .St Ao abbreviation Ac ...
1886 Available pairs for
1887 .Dq Abbreviation/Formal Name
1888 are:
1891 .Tn ANSI/ISO C
1893 .Bl -tag -width ".Li -iso9945-1-90" -compact -offset indent
1894 .It Li -ansiC
1895 .St -ansiC
1896 .It Li -ansiC-89
1897 .St -ansiC-89
1898 .It Li -isoC
1899 .St -isoC
1900 .It Li -isoC-99
1901 .St -isoC-99
1905 .Tn POSIX
1906 Part 1: System API
1908 .Bl -tag -width ".Li -p1003.1g-2000" -compact -offset indent
1909 .It Li -iso9945-1-90
1910 .St -iso9945-1-90
1911 .It Li -iso9945-1-96
1912 .St -iso9945-1-96
1913 .It Li -p1003.1
1914 .St -p1003.1
1915 .It Li -p1003.1-88
1916 .St -p1003.1-88
1917 .It Li -p1003.1-90
1918 .St -p1003.1-90
1919 .It Li -p1003.1-96
1920 .St -p1003.1-96
1921 .It Li -p1003.1b-93
1922 .St -p1003.1b-93
1923 .It Li -p1003.1c-95
1924 .St -p1003.1c-95
1925 .It Li -p1003.1g-2000
1926 .St -p1003.1g-2000
1927 .It Li -p1003.1i-95
1928 .St -p1003.1i-95
1932 .Tn POSIX
1933 Part 2: Shell and Utilities
1935 .Bl -tag -width ".Li -p1003.1g-2000" -compact -offset indent
1936 .It Li -iso9945-2-93
1937 .St -iso9945-2-93
1938 .It Li -p1003.2
1939 .St -p1003.2
1940 .It Li -p1003.2-92
1941 .St -p1003.2-92
1942 .It Li -p1003.2a-92
1943 .St -p1003.2a-92
1947 X/Open
1948 .Bl -tag -width ".Li -p1003.1g-2000" -compact -offset indent
1950 .It Li -susv2
1951 .St -susv2
1952 .It Li -svid4
1953 .St -svid4
1954 .It Li -xbd5
1955 .St -xbd5
1956 .It Li -xcu5
1957 .St -xcu5
1958 .It Li -xcurses4.2
1959 .St -xcurses4.2
1960 .It Li -xns5
1961 .St -xns5
1962 .It Li -xns5.2
1963 .St -xns5.2
1964 .It Li -xpg3
1965 .St -xpg3
1966 .It Li -xpg4
1967 .St -xpg4
1968 .It Li -xpg4.2
1969 .St -xpg4.2
1970 .It Li -xsh5
1971 .St -xsh5
1975 Miscellaneous
1977 .Bl -tag -width ".Li -p1003.1g-2000" -compact -offset indent
1978 .It Li -ieee754
1979 .St -ieee754
1980 .It Li -iso8802-3
1981 .St -iso8802-3
1984 .Ss "Variable Types"
1987 .Ql .Vt
1988 macro may be used whenever a type is referenced.
1989 In the
1990 .Sx SYNOPSIS
1991 section, it causes a line break (useful for old style variable declarations).
1993 .Dl Usage: .Vt Ao type Ac ...
1995 .Bl -tag -width ".Li .Vt\ extern\ char\ *optarg\ ;" -compact -offset 15n
1996 .It Li ".Vt extern char *optarg ;"
1997 .Vt extern char *optarg ;
1998 .It Li ".Vt FILE *"
1999 .Vt FILE *
2002 .Ss Variables
2004 Generic variable reference.
2006 .Dl Usage: .Va Ao variable Ac ...
2008 .Bl -tag -width ".Li .Va\ Xchar\ sX\ ]\ )\ )\ ," -compact -offset 15n
2009 .It Li ".Va count"
2010 .Va count
2011 .It Li ".Va settimer ,"
2012 .Va settimer ,
2013 .It Li ".Va \*[q]int *prt\*[q] ) :"
2014 .Va "int *prt" ) :
2015 .It Li ".Va \*[q]char s\*[q] ] ) ) ,"
2016 .Va "char s" ] ) ) ,
2020 The default width is 12n.
2022 .Ss "Manual Page Cross References"
2025 .Ql .Xr
2026 macro expects the first argument to be a manual page name.
2027 The optional second argument, if a string (defining the manual section), is
2028 put into parentheses.
2030 .Dl Usage: .Xr Ao man page name Ac Oo Ao section Ac Oc ...
2032 .Bl -tag -width ".Li .Xr\ xinit\ 1x\ ;" -compact -offset 15n
2033 .It Li ".Xr mdoc"
2034 .Xr mdoc
2035 .It Li ".Xr mdoc ,"
2036 .Xr mdoc ,
2037 .It Li ".Xr mdoc 7"
2038 .Xr mdoc 7
2039 .It Li ".Xr xinit 1x ;"
2040 .Xr xinit 1x ;
2044 The default width is 10n.
2047 .Sh "GENERAL TEXT DOMAIN"
2049 .Ss "AT&T Macro"
2052 .Dl Usage: .At Oo Ao version Ac Oc ...
2054 .Bl -tag -width ".Li .At\ v6\ ." -compact -offset 15n
2055 .It Li .At
2057 .It Li ".At v6 ."
2058 .At v6 .
2061 The following values for
2062 .Ao version Ac
2063 are possible:
2065 .Dl 32v, v1, v2, v3, v4, v5, v6, v7, V, V.1, V.2, V.3, V.4
2067 .Ss "BSD Macro"
2070 .Dl "Usage: .Bx" Bro -alpha | -beta | -devel Brc ...
2071 .Dl "       .Bx" Oo Ao version Ac Oo Ao release Ac Oc Oc ...
2073 .Bl -tag -width ".Li .Bx\ -devel" -compact -offset 15n
2074 .It Li .Bx
2076 .It Li ".Bx 4.3 ."
2077 .Bx 4.3 .
2078 .It Li ".Bx \-devel"
2079 .Bx -devel
2082 .Ao version Ac
2083 will be prepended to the string
2084 .Sq Bx .
2085 The following values for
2086 .Ao release Ac
2087 are possible:
2089 .Dl Reno, reno, Tahoe, tahoe, Lite, lite, Lite2, lite2
2091 .Ss "NetBSD Macro"
2094 .Dl Usage: .Nx Oo Ao version Ac Oc ...
2096 .Bl -tag -width ".Li .Nx\ 1.4\ ." -compact -offset 15n
2097 .It Li .Nx
2099 .It Li ".Nx 1.4 ."
2100 .Nx 1.4 .
2103 For possible values of
2104 .Ao version Ac
2105 see the description of the
2106 .Ql .Os
2107 command above in section
2108 .Sx "TITLE MACROS" .
2110 .Ss "FreeBSD Macro"
2113 .Dl Usage: .Fx Oo Ao version Ac Oc ...
2115 .Bl -tag -width ".Li .Fx\ 2.2\ ." -compact -offset 15n
2116 .It Li .Fx
2118 .It Li ".Fx 2.2 ."
2119 .Fx 2.2 .
2122 For possible values of
2123 .Ao version Ac
2124 see the description of the
2125 .Ql .Os
2126 command above in section
2127 .Sx "TITLE MACROS" .
2129 .Ss "OpenBSD Macro"
2132 .Dl Usage: .Ox Oo Ao version Ac Oc ...
2134 .Bl -tag -width ".Li .Ox\ 1.0" -compact -offset 15n
2135 .It Li ".Ox 1.0"
2136 .Ox 1.0
2139 .Ss "BSD/OS Macro"
2142 .Dl Usage: .Bsx Oo Ao version Ac Oc ...
2144 .Bl -tag -width ".Li .Bsx\ 1.0" -compact -offset 15n
2145 .It Li ".Bsx 1.0"
2146 .Bsx 1.0
2149 .Ss "UNIX Macro"
2152 .Dl Usage: .Ux ...
2154 .Bl -tag -width ".Li .Ux" -compact -offset 15n
2155 .It Li .Ux
2159 .Ss "Emphasis Macro"
2161 Text may be stressed or emphasized with the
2162 .Ql .Em
2163 macro.
2164 The usual font for emphasis is italic.
2166 .Dl Usage: .Em Ao argument Ac ...
2168 .Bl -tag -width ".Li .Em\ vide\ infra\ )\ )\ ," -compact -offset 15n
2169 .It Li ".Em does not"
2170 .Em does not
2171 .It Li ".Em exceed 1024 ."
2172 .Em exceed 1024 .
2173 .It Li ".Em vide infra ) ) ,"
2174 .Em vide infra ) ) ,
2178 The default width is 10n.
2180 .Ss "Font Mode"
2183 .Ql .Bf
2184 font mode must be ended with the
2185 .Ql .Ef
2186 macro (the latter takes no arguments).
2187 Font modes may be nested within other font modes.
2189 .Ql .Bf
2190 has the following syntax:
2192 .Dl .Bf Ao font mode Ac
2194 .Ao font mode Ac
2195 must be one of the following three types:
2197 .Bl -tag -width ".Sy \&Sy | Fl symbolic" -compact -offset indent
2198 .It Sy \&Em | Fl emphasis
2199 Same as if the 
2200 .Ql .Em
2201 macro was used for the entire block of text.
2202 .It Sy \&Li | Fl literal
2203 Same as if the
2204 .Ql .Li
2205 macro was used for the entire block of text.
2206 .It Sy \&Sy | Fl symbolic
2207 Same as if the
2208 .Ql .Sy
2209 macro was used for the entire block of text.
2212 Both macros are neither callable nor parsed.
2214 .Ss "Enclosure and Quoting Macros"
2216 The concept of enclosure is similar to quoting.
2217 The object being to enclose one or more strings between a pair of characters
2218 like quotes or parentheses.
2219 The terms quoting and enclosure are used interchangeably throughout this
2220 document.
2221 Most of the one-line enclosure macros end in small letter
2222 .Ql q
2223 to give a hint of quoting, but there are a few irregularities.
2224 For each enclosure macro there is also a pair of open and close macros which
2225 end in small letters
2226 .Ql o
2228 .Ql c
2229 respectively.
2231 \# XXX
2232 .if t \
2233 .  ne 10
2235 .Bd -filled -offset 4n
2236 .Bl -column "quote" "close" "open" "Angle Bracket Enclosure" "`string' or string"
2237 .Em Quote Ta Em Open Ta Em Close Ta Em Function               Ta Em Result
2238 .No .Aq   Ta    .Ao  Ta    .Ac   Ta "Angle Bracket Enclosure" Ta Ao string Ac
2239 .No .Bq   Ta    .Bo  Ta    .Bc   Ta "Bracket Enclosure"       Ta Bo string Bc
2240 .No .Brq  Ta    .Bro Ta    .Brc  Ta "Brace Enclosure"         Ta Bro string Brc
2241 .No .Dq   Ta    .Do  Ta    .Dc   Ta "Double Quote"            Ta Do string Dc
2242 .No .Eq   Ta    .Eo  Ta    .Ec   Ta "Enclose String (in XX)"  Ta XXstringXX
2243 .No .Pq   Ta    .Po  Ta    .Pc   Ta "Parenthesis Enclosure"   Ta Po string Pc
2244 .No .Ql   Ta         Ta          Ta "Quoted Literal"          Ta So string Sc or Li string
2245 .No .Qq   Ta    .Qo  Ta    .Qc   Ta "Straight Double Quote"   Ta Qo string Qc
2246 .No .Sq   Ta    .So  Ta    .Sc   Ta "Single Quote"            Ta So string Sc
2250 All macros ending with
2251 .Sq q
2253 .Sq o
2254 have a default width value of 12n.
2256 .Bl -tag -width ".Li .Ec , .Eo"
2257 .It Li .Eo , .Ec
2258 These macros expect the first argument to be the opening and closing strings
2259 respectively.
2260 .It Li .Es , .En
2261 Due to the nine-argument limit in the original troff program two other
2262 macros have been implemented which are now rather obsolete:
2263 .Ql .Es
2264 takes the first and second parameter as the left and right enclosure string,
2265 which are then used to enclose the arguments of
2266 .Ql .En .
2267 The default width value is 12n for both macros.
2268 .It Li .Eq
2269 The first and second arguments of this macro are the opening and
2270 closing strings respectively, followed by the arguments to be enclosed.
2271 .It Li .Ql
2272 The quoted literal macro behaves differently in troff and nroff mode.
2273 If formatted with
2274 .Xr nroff ,
2275 a quoted literal is always quoted.
2276 If formatted with troff, an item is only quoted if the width of the item is
2277 less than three constant width characters.
2278 This is to make short strings more visible where the font change to literal
2279 (constant width) is less noticeable.
2281 The default width is 16n.
2282 .It Li .Pf
2283 The prefix macro suppresses the whitespace between its first and second
2284 argument:
2286 .Bl -tag -width ".Li .Pf\ (\ Fa\ name2" -offset indent
2287 .It Li ".Pf ( Fa name2"
2288 .Pf ( Fa name2
2292 The default width is 12n.
2295 .Ql .Ns
2296 macro (see below) performs the analogous suffix function.
2297 .It Li .Ap
2299 .Ql .Ap
2300 macro inserts an apostrophe and exits any special text modes, continuing in
2301 .Ql .No
2302 mode.
2306 Examples of quoting:
2309 .Bl -tag -width ".Li .Bq\ Em\ Greek\ ,\ French\ ." -compact -offset indent
2310 .It Li .Aq
2312 .It Li ".Aq Pa ctype.h ) ,"
2313 .Aq Pa ctype.h ) ,
2314 .It Li .Bq
2316 .It Li ".Bq Em Greek , French ."
2317 .Bq Em Greek , French .
2318 .It Li .Dq
2320 .It Li ".Dq string abc ."
2321 .Dq string abc .
2322 .It Li ".Dq \'^[A-Z]\'"
2323 .Dq \'^[A-Z]\'
2324 .It Li ".Ql man mdoc"
2325 .Ql man mdoc
2326 .It Li .Qq
2328 .It Li ".Qq string ) ,"
2329 .Qq string ) ,
2330 .It Li ".Qq string Ns ),"
2331 .Qq string Ns ),
2332 .It Li .Sq
2334 .It Li ".Sq string"
2335 .Sq string
2336 .It Li ".Em or Ap ing"
2337 .Em or Ap ing
2341 For a good example of nested enclosure macros, see the
2342 .Ql .Op
2343 option macro.
2344 It was created from the same underlying enclosure macros as those presented
2345 in the list above.
2347 .Ql .Xo
2349 .Ql .Xc
2350 extended argument list macros are discussed below.
2352 .Ss "No-Op or Normal Text Macro"
2355 .Ql .No
2356 macro can be used in a macro command line for parameters which should
2357 .Em not
2358 be formatted.
2359 Be careful to add
2360 .Ql \e&
2361 to the word
2362 .Ql \&No
2363 if you really want that English word (and not the macro) as a parameter.
2365 .Dl Usage: .No Ao argument Ac ...
2367 .Bl -tag -width ".Li .No\ test\ Ta\ with\ Ta\ tabs" -compact -offset 15n
2368 .It Li ".No test Ta with Ta tabs"
2369 .No test Ta with Ta tabs
2373 The default width is 12n.
2375 .Ss "No-Space Macro"
2378 .Ql .Ns
2379 macro suppresses insertion of a space between the current position and its
2380 first parameter.
2381 For example, it is useful for old style argument lists where there is no
2382 space between the flag and argument:
2384 .Dl "Usage:" ... Ao argument Ac \&Ns Oo Ao argument Ac Oc ...
2385 .Dl "      " .Ns Ao argument Ac ...
2387 .Bl -tag -width ".Li .Op\ Fl\ I\ Ns\ Ar\ directory" -compact -offset 15n
2388 .It Li ".Op Fl I Ns Ar directory"
2389 .Op Fl I Ns Ar directory
2392 Note: The
2393 .Ql .Ns
2394 macro always invokes the
2395 .Ql .No
2396 macro after eliminating the space unless another macro name follows it.
2397 If used as a command (i.e., the second form above in the
2398 .Sq Usage
2399 line),
2400 .Ql .Ns
2401 is identical to
2402 .Ql .No .
2404 .Ss "Section Cross References"
2407 .Ql .Sx
2408 macro designates a reference to a section header within the same document.
2410 .Dl Usage: .Sx Ao section reference Ac ...
2412 .Bl -tag -width ".Li .Sx\ FILES" -offset 15n
2413 .It Li ".Sx FILES"
2414 .Sx FILES
2418 The default width is 16n.
2420 .Ss Symbolics
2422 The symbolic emphasis macro is generally a boldface macro in either the
2423 symbolic sense or the traditional English usage.
2425 .Dl Usage: .Sy Ao symbol Ac ...
2427 .Bl -tag -width ".Li .Sy\ Important\ Notice" -compact -offset 15n
2428 .It Li ".Sy Important Notice"
2429 .Sy Important Notice
2433 The default width is 6n.
2435 .Ss Mathematical Symbols
2437 Use this macro for mathematical symbols and similar things.
2439 .Dl Usage: .Ms Ao math symbol Ac ...
2441 .Bl -tag -width ".Li .Ms\ sigma" -compact -offset 15n
2442 .It Li ".Ms sigma"
2443 .Ms sigma
2447 The default width is 6n.
2449 .Ss "References and Citations"
2451 The following macros make a modest attempt to handle references.
2452 At best, the macros make it convenient to manually drop in a subset of
2453 .Xr refer 1
2454 style references.
2456 .Bl -tag -width 6n -offset indent -compact
2457 .It Li .Rs
2458 Reference start (does not take arguments).
2459 Causes a line break in the
2460 .Sx "SEE ALSO"
2461 section and begins collection of reference information until the reference
2462 end macro is read.
2463 .It Li .Re
2464 Reference end (does not take arguments).
2465 The reference is printed.
2466 .It Li .%A
2467 Reference author name; one name per invocation.
2468 .It Li .%B
2469 Book title.
2470 .It Li .%C
2471 City/place (not implemented yet).
2472 .It Li .%D
2473 Date.
2474 .It Li .%I
2475 Issuer/publisher name.
2476 .It Li .%J
2477 Journal name.
2478 .It Li .%N
2479 Issue number.
2480 .It Li .%O
2481 Optional information.
2482 .It Li .%P
2483 Page number.
2484 .It Li .%Q
2485 Corporate or foreign author.
2486 .It Li .%R
2487 Report name.
2488 .It Li .%T
2489 Title of article.
2490 .It Li .%V
2491 Volume.
2494 Macros beginning with
2495 .Ql %
2496 are not callable but accept multiple arguments in the usual way.
2497 Only the
2498 .Ql .Tn
2499 macro is handled properly as a parameter; other macros will cause strange
2500 output.
2501 .Ql .%B
2503 .Ql .%T
2504 can be used outside of the
2505 .Ql .Rs/.Re
2506 environment.
2508 Example:
2510 .Bd -literal -offset indent
2511 \&.Rs
2512 \&.%A "Matthew Bar"
2513 \&.%A "John Foo"
2514 \&.%T "Implementation Notes on foobar(1)"
2515 \&.%R "Technical Report ABC-DE-12-345"
2516 \&.%Q "Drofnats College, Nowhere"
2517 \&.%D "April 1991"
2518 \&.Re
2521 produces
2523 .Bd -ragged -offset indent
2525 .%A "Matthew Bar"
2526 .%A "John Foo"
2527 .%T "Implementation Notes on foobar(1)"
2528 .%R "Technical Report ABC-DE-12-345"
2529 .%Q "Drofnats College, Nowhere"
2530 .%D "April 1991"
2534 .Ss "Trade Names (or Acronyms and Type Names)"
2536 The trade name macro prints its arguments in a smaller font.
2537 Its intended use is to imitate a small caps fonts for uppercase acronyms.
2539 .Dl Usage: .Tn Ao symbol Ac ...
2541 .Bl -tag -width ".Li .Tn\ ASCII" -compact -offset 15n
2542 .It Li ".Tn DEC"
2543 .Tn DEC
2544 .It Li ".Tn ASCII"
2545 .Tn ASCII
2549 The default width is 10n.
2551 .Ss "Extended Arguments"
2554 .Li .Xo
2556 .Li .Xc
2557 macros allow one to extend an argument list on a macro boundary for the
2558 .Ql .It
2559 macro (see below).
2560 Note that
2561 .Li .Xo
2563 .Li .Xc
2564 are implemented similarly to all other macros opening and closing an
2565 enclosure (without inserting characters, of course).
2566 This means that the following is true for those macros also.
2568 Here is an example of
2569 .Ql .Xo
2570 using the space mode macro to turn spacing off:
2572 .Bd -literal -offset indent
2573 \&.Sm off
2574 \&.It Xo Sy I Ar operation
2575 \&.No \een Ar count No \een
2576 \&.Xc
2577 \&.Sm on
2581 produces
2583 .Bd -filled -offset indent
2584 .Bl -tag -compact
2585 .Sm off
2586 .It Xo Sy I Ar operation
2587 .No \en Ar count No \en
2589 .Sm on
2594 Another one:
2596 .Bd -literal -offset indent
2597 \&.Sm off
2598 \&.It Cm S No / Ar old_pattern Xo
2599 \&.No / Ar new_pattern
2600 \&.No / Op Cm g
2601 \&.Xc
2602 \&.Sm on
2606 produces
2608 .Bd -filled -offset indent
2609 .Bl -tag -compact
2610 .Sm off
2611 .It Cm S No \&/ Ar old_pattern Xo
2612 .No \&/ Ar new_pattern
2613 .No \&/ Op Cm g
2615 .Sm on
2620 Another example of
2621 .Ql .Xo
2622 and enclosure macros: Test the value of a variable.
2624 .Bd -literal -offset indent
2625 \&.It Xo
2626 \&.Ic .ifndef
2627 \&.Oo \e&! Oc Ns Ar variable Oo
2628 \&.Ar operator variable ...
2629 \&.Oc Xc
2633 produces
2635 .Bd -filled -offset indent
2636 .Bl -tag -width flag -compact
2637 .It Xo
2638 .Ic .ifndef
2639 .Oo \&! Oc Ns Ar variable Oo
2640 .Ar operator variable ...
2641 .Oc Xc
2647 .Sh "PAGE STRUCTURE DOMAIN"
2649 .Ss "Section Headers"
2651 The following
2652 .Ql .Sh
2653 section header macros are required in every man page.
2654 The remaining section headers are recommended at the discretion of the
2655 author writing the manual page.
2657 .Ql .Sh
2658 macro is parsed but not generally callable.
2659 It can be used as an argument in a call to
2660 .Ql .Sh
2661 only; it then reactivates the default font for
2662 .Ql .Sh .
2664 The default width is 8n.
2666 .Bl -tag -width ".Li .Sh\ RETURN\ VALUES"
2667 .It Li ".Sh NAME"
2669 .Ql ".Sh NAME"
2670 macro is mandatory.
2671 If not specified, headers, footers and page layout defaults will not be set
2672 and things will be rather unpleasant.
2674 .Sx NAME
2675 section consists of at least three items.
2676 The first is the
2677 .Ql .Nm
2678 name macro naming the subject of the man page.
2679 The second is the name description macro,
2680 .Ql .Nd ,
2681 which separates the subject name from the third item, which is the
2682 description.
2683 The description should be the most terse and lucid possible, as the space
2684 available is small.
2686 .Ql .Nd
2687 first prints
2688 .Ql - ,
2689 then all its arguments.
2691 .It Li ".Sh LIBRARY"
2692 This section is for section two and three function calls.
2693 It should consist of a single
2694 .Ql .Lb
2695 macro call;
2697 .Sx "Library Names" .
2699 .It Li ".Sh SYNOPSIS"
2701 .Sx SYNOPSIS
2702 section describes the typical usage of the subject of a man page.
2703 The macros required are either
2704 .Ql .Nm ,
2705 .Ql .Cd ,
2707 .Ql .Fn
2708 (and possibly
2709 .Ql .Fo ,
2710 .Ql .Fc ,
2711 .Ql .Fd ,
2713 .Ql .Ft ) .
2714 The function name macro
2715 .Ql .Fn
2716 is required for manual page sections\~2 and\~3; the command and general name
2717 macro
2718 .Ql .Nm
2719 is required for sections 1, 5, 6, 7, and\~8.
2720 Section\~4 manuals require a
2721 .Ql .Nm ,
2722 .Ql .Fd
2723 or a
2724 .Ql .Cd
2725 configuration device usage macro.
2726 Several other macros may be necessary to produce the synopsis line as shown
2727 below:
2729 .Bd -filled -offset indent
2730 .Nm cat
2731 .Op Fl benstuv
2732 .Op Fl
2737 The following macros were used:
2739 .Dl ".Nm cat"
2740 .Dl ".Op Fl benstuv"
2741 .Dl ".Op Fl"
2742 .Dl .Ar
2744 .It Li ".Sh DESCRIPTION"
2745 In most cases the first text in the
2746 .Sx DESCRIPTION
2747 section is a brief paragraph on the command, function or file, followed by a
2748 lexical list of options and respective explanations.
2749 To create such a list, the
2750 .Ql .Bl
2751 (begin list),
2752 .Ql .It
2753 (list item) and
2754 .Ql .El
2755 (end list)
2756 macros are used (see
2757 .Sx Lists and Columns
2758 below).
2760 .It Li ".Sh IMPLEMENTATION NOTES"
2761 Implementation specific information should be placed here.
2763 .It Li ".Sh RETURN VALUES"
2764 Sections 2, 3 and\~9 function return values should go here.
2766 .Ql .Rv
2767 macro may be used to generate text for use in the
2768 .Sx RETURN VALUES
2769 section for most section 2 and 3 library functions;
2771 .Sx "Return Values" .
2775 The following
2776 .Ql .Sh
2777 section headers are part of the preferred manual page layout and must be
2778 used appropriately to maintain consistency.
2779 They are listed in the order in which they would be used.
2781 .Bl -tag -width ".Li .Sh\ COMPATIBILITY"
2782 .It Li ".Sh ENVIRONMENT"
2784 .Sx ENVIRONMENT
2785 section should reveal any related environment variables and clues to their
2786 behavior and/or usage.
2788 .It Li ".Sh FILES"
2789 Files which are used or created by the man page subject should be listed via
2791 .Ql .Pa
2792 macro in the
2793 .Sx FILES
2794 section.
2796 .It Li ".Sh EXAMPLES"
2797 There are several ways to create examples.
2798 See the
2799 .Sx EXAMPLES
2800 section below for details.
2802 .It Li ".Sh DIAGNOSTICS"
2803 Diagnostic messages from a command should be placed in this section.
2805 .Ql .Ex
2806 macro may be used to generate text for use in the
2807 .Sx DIAGNOSTICS
2808 section for most section 1, 6 and\~8 commands;
2810 .Sx "Exit Status" .
2812 .It Li ".Sh COMPATIBILITY"
2813 Known compatibility issues (e.g. deprecated options or parameters)
2814 should be listed here.
2816 .It Li ".Sh ERRORS"
2817 Specific error handling, especially from library functions (man page
2818 sections 2, 3, and\~9) should go here.
2820 .Ql .Er
2821 macro is used to specify an error (errno).
2823 .It Li ".Sh SEE ALSO"
2824 References to other material on the man page topic and cross references to
2825 other relevant man pages should be placed in the
2826 .Sx "SEE ALSO"
2827 section.
2828 Cross references are specified using the
2829 .Ql .Xr
2830 macro.
2831 Currently
2832 .Xr refer 1
2833 style references are not accommodated.
2835 It is recommended that the cross references are sorted on the section
2836 number, then alphabetically on the names within a section, and placed
2837 in that order and comma separated.
2838 Example:
2840 .Xr ls 1 ,
2841 .Xr ps 1 ,
2842 .Xr group 5 ,
2843 .Xr passwd 5
2845 .It Li ".Sh STANDARDS"
2846 If the command, library function or file adheres to a specific
2847 implementation such as
2848 .St -p1003.2
2850 .St -ansiC
2851 this should be noted here.
2852 If the command does not adhere to any standard, its history should be noted
2853 in the
2854 .Sx HISTORY
2855 section.
2857 .It Li ".Sh HISTORY"
2858 Any command which does not adhere to any specific standards should be
2859 outlined historically in this section.
2861 .It Li ".Sh AUTHORS"
2862 Credits should be placed here.
2864 .Ql .An
2865 macro should be used to specify the name(s) of the person(s).
2867 .It Li ".Sh BUGS"
2868 Blatant problems with the topic go here.
2872 User-specified
2873 .Ql .Sh
2874 sections may be added; for example, this section was set with:
2876 .Bd -literal -offset 15n
2877 \&.Sh "PAGE STRUCTURE DOMAIN"
2880 .Ss "Subsection Headers"
2882 Subsection headers have exactly the same syntax as section headers:
2883 .Ql .Ss
2884 is parsed but not generally callable.
2885 It can be used as an argument in a call to
2886 .Ql .Ss
2887 only; it then reactivates the default font for
2888 .Ql .Ss .
2890 The default width is 8n.
2892 .Ss "Paragraphs and Line Spacing"
2894 .Bl -tag -width ".Li .Pp"
2895 .It Li .Pp
2896 The 
2897 .Ql .Pp
2898 paragraph command may be used to specify a line space where necessary.
2899 The macro is not necessary after a
2900 .Ql .Sh
2902 .Ql .Ss
2903 macro or before a
2904 .Ql .Bl
2906 .Ql .Bd
2907 macro (which both assert a vertical distance unless the
2908 .Fl compact
2909 flag is given).
2911 The macro is neither callable nor parsed and takes no arguments; an
2912 alternative name is
2913 .Ql .Lp .
2916 .\" XXX
2918 .\" This worked with version one, need to redo for version three
2919 .\" .Pp
2920 .\" .Ds I
2921 .\" .Cw (ax+bx+c) \ is\ produced\ by\ \&
2922 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2923 .\" .Cl Cx \t\t
2924 .\" .Li \&.Cx\ (
2925 .\" .Cx
2926 .\" .Cl Cx \t\t
2927 .\" .Li \&.Va ax
2928 .\" .Cx
2929 .\" .Cl Cx \t\t
2930 .\" .Li \&.Sy \+
2931 .\" .Cx
2932 .\" .Cl Cx \&(\&
2933 .\" .Va ax
2934 .\" .Cx +
2935 .\" .Va by
2936 .\" .Cx +
2937 .\" .Va c )
2938 .\" .Cx \t
2939 .\" .Em is produced by
2940 .\" .Cx \t
2941 .\" .Li \&.Va by
2942 .\" .Cx
2943 .\" .Cl Cx \t\t
2944 .\" .Li \&.Sy \+
2945 .\" .Cx
2946 .\" .Cl Cx \t\t
2947 .\" .Li \&.Va c )
2948 .\" .Cx
2949 .\" .Cl Cx \t\t
2950 .\" .Li \&.Cx
2951 .\" .Cx
2952 .\" .Cw
2953 .\" .De
2954 .\" .Pp
2955 .\" This example shows the same equation in a different format.
2956 .\" The spaces
2957 .\" around the
2958 .\" .Li \&+
2959 .\" signs were forced with
2960 .\" .Li \e :
2961 .\" .Pp
2962 .\" .Ds I
2963 .\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&
2964 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2965 .\" .Cl Cx \t\t
2966 .\" .Li \&.Cx\ (
2967 .\" .Cx
2968 .\" .Cl Cx \t\t
2969 .\" .Li \&.Va a
2970 .\" .Cx
2971 .\" .Cl Cx \t\t
2972 .\" .Li \&.Sy x
2973 .\" .Cx
2974 .\" .Cl Cx \t\t
2975 .\" .Li \&.Cx \e\ +\e\ \e&
2976 .\" .Cx
2977 .\" .Cl Cx \&(\&
2978 .\" .Va a
2979 .\" .Sy x
2980 .\" .Cx \ +\ \&
2981 .\" .Va b
2982 .\" .Sy y
2983 .\" .Cx \ +\ \&
2984 .\" .Va c )
2985 .\" .Cx \t
2986 .\" .Em is produced by
2987 .\" .Cl Cx \t\t
2988 .\" .Li \&.Va b
2989 .\" .Cx
2990 .\" .Cl Cx \t\t
2991 .\" .Li \&.Sy y
2992 .\" .Cx
2993 .\" .Cl Cx \t\t
2994 .\" .Li \&.Cx \e\ +\e\ \e&
2995 .\" .Cx
2996 .\" .Cl Cx \t\t
2997 .\" .Li \&.Va c )
2998 .\" .Cx
2999 .\" .Cl Cx \t\t
3000 .\" .Li \&.Cx
3001 .\" .Cx
3002 .\" .Cw
3003 .\" .De
3004 .\" .Pp
3005 .\" The incantation below was
3006 .\" lifted from the
3007 .\" .Xr adb 1
3008 .\" manual page:
3009 .\" .Pp
3010 .\" .Ds I
3011 .\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by
3012 .\" .Cl Cx \t\t
3013 .\" .Li \&.Cx Op Sy ?/
3014 .\" .Cx
3015 .\" .Cl Cx \t\t
3016 .\" .Li \&.Nm m
3017 .\" .Cx
3018 .\" .Cl Cx Op Sy ?/
3019 .\" .Nm m
3020 .\" .Ad \ b1 e1 f1
3021 .\" .Op Sy ?/
3022 .\" .Cx \t
3023 .\" .Em is produced by
3024 .\" .Cx \t
3025 .\" .Li \&.Ar \e\ b1 e1 f1
3026 .\" .Cx
3027 .\" .Cl Cx \t\t
3028 .\" .Li \&.Op Sy ?/
3029 .\" .Cx
3030 .\" .Cl Cx \t\t
3031 .\" .Li \&.Cx
3032 .\" .Cx
3033 .\" .Cw
3034 .\" .De
3035 .\" .Pp
3037 .Ss Keeps
3039 The only keep that is implemented at this time is for words.
3040 The macros are
3041 .Ql .Bk
3042 (begin keep)
3044 .Ql .Ek
3045 (end keep).
3046 The only option that
3047 .Ql .Bk
3048 accepts currently is
3049 .Fl words
3050 (this is also the default if no option is given) which is useful for
3051 preventing line breaks in the middle of options.
3052 In the example for the make command line arguments (see
3053 .Sx What's in a Name ) ,
3054 the keep prevented
3055 .Xr nroff
3056 from placing up the flag and the argument on separate lines.
3058 Both macros are neither callable nor parsed.
3060 More work needs to be done with the keep macros; specifically, a
3061 .Fl line
3062 option should be added.
3064 .Ss "Examples and Displays"
3066 There are seven types of displays.
3068 .Bl -tag -width ".Li .D1"
3069 .It Li .D1
3070 (This is D-one.)
3071 Display one line of indented text.
3072 This macro is parsed but not callable.
3074 .D1 Fl ldghfstru
3076 The above was produced by:
3077 .Li ".D1 Fl ldghfstru" .
3079 .It Li .Dl
3080 (This is D-ell.)
3081 Display one line of indented
3082 .Em literal
3083 text.
3085 .Ql .Dl
3086 example macro has been used throughout this file.
3087 It allows the indentation (display) of one line of text.
3088 Its default font is set to constant width (literal).
3089 .Ql .Dl
3090 is parsed but not callable.
3092 .Dl % ls -ldg /usr/local/bin
3094 The above was produced by:
3095 .Li ".Dl % ls -ldg /usr/local/bin" .
3097 .It Li .Bd
3098 Begin display.
3100 .Ql .Bd
3101 display must be ended with the
3102 .Ql .Ed
3103 macro.
3104 It has the following syntax:
3106 .Bd -ragged -compact
3107 .Bl -tag -width ".Li .Bd" -offset indent
3108 .It Li .Bd Xo
3109 .Bro \-literal | \-filled | \-unfilled | \-ragged | \-centered Brc
3110 .Oo \-offset Ao string Ac Oc Oo \-file Ao file name Ac Oc Oo \-compact Oc Xc
3115 .Bl -tag -width ".Fl file Ao Ar file name Ac " -compact
3116 .It Fl ragged
3117 Fill, but do not adjust the right margin (only left-justify).
3118 .It Fl centered
3119 Center lines between the current left and right margin.
3120 Note that each single line is centered.
3121 .It Fl unfilled
3122 Do not fill; display a block of text as typed, using line breaks as
3123 specified by the user.
3124 This can produce overlong lines without warning messages.
3125 .It Fl filled
3126 Display a filled block.
3127 The block of text is formatted (i.e., the text is justified on both the left
3128 and right side).
3129 .It Fl literal
3130 Display block with literal font (usually fixed-width).
3131 Useful for source code or simple tabbed or spaced text.
3132 .It Fl file Ao Ar file name Ac
3133 The file whose name follows the
3134 .Fl file
3135 flag is read and displayed before any data enclosed with
3136 .Ql .Bd
3138 .Ql .Ed ,
3139 using the selected display type.
3141 .Xr troff/ Ns Nm \-mdoc
3142 commands in the file will be processed.
3143 .It Fl offset Ao Ar string Ac
3145 .Fl offset
3146 is specified with one of the following strings, the string is interpreted to
3147 indicate the level of indentation for the forthcoming block of text:
3150 .Bl -tag -width ".Ar indent-two" -compact
3151 .It Ar left
3152 Align block on the current left margin; this is the default mode of
3153 .Ql .Bd .
3154 .It Ar center
3155 Supposedly center the block.
3156 At this time unfortunately, the block merely gets left aligned about an
3157 imaginary center margin.
3158 .It Ar indent
3159 Indent by one default indent value or tab.
3160 The default indent value is also used for the
3161 .Ql .D1
3162 and 
3163 .Ql .Dl
3164 macros, so one is guaranteed the two types of displays will line up.
3165 The indentation value is normally set to\~6n or about two thirds of an inch
3166 (six constant width characters).
3167 .It Ar indent-two
3168 Indent two times the default indent value.
3169 .It Ar right
3170 This
3171 .Em left
3172 aligns the block about two inches from the right side of the page.
3173 This macro needs work and perhaps may never do the right thing within
3174 .Xr troff .
3179 .Ao string Ac
3180 is a valid numeric expression instead
3181 .Pf ( Em with a scale indicator other than
3182 .Sq Em u ) ,
3183 use that value for indentation.
3184 The most useful scale indicators are
3185 .Sq m
3187 .Sq n ,
3188 specifying the so-called
3189 .Em \&Em
3191 .Em "En square" .
3192 This is approximately the width of the letters
3193 .Sq m
3195 .Sq n
3196 respectively
3197 of the current font (for nroff output, both scale indicators give the same
3198 values).
3200 .Ao string Ac
3201 isn't a numeric expression, it is tested whether it is an
3202 .Nm \-mdoc
3203 macro name, and the default offset value associated with this macro is used.
3204 Finally, if all tests fail,
3205 the width of
3206 .Ao string Ac
3207 (typeset with a fixed-width font) is taken as the offset.
3208 .It Fl compact
3209 Suppress insertion of vertical space before begin of display.
3212 .It Li .Ed
3213 End display (takes no arguments).
3216 .Ss "Lists and Columns"
3218 There are several types of lists which may be initiated with the
3219 .Ql .Bl
3220 begin-list macro.
3221 Items within the list are specified with the
3222 .Ql .It
3223 item macro, and each list must end with the
3224 .Ql .El
3225 macro.
3226 Lists may be nested within themselves and within displays.
3227 The use of columns inside of lists or lists inside of columns is unproven.
3229 In addition, several list attributes may be specified such as the width of a
3230 tag, the list offset, and compactness (blank lines between items allowed or
3231 disallowed).
3232 Most of this document has been formatted with a tag style list
3233 .Pf ( Fl tag ) .
3235 It has the following syntax forms:
3238 .Bd -ragged -compact
3239 .Bl -tag -width ".Li .Bl" -offset indent -compact
3240 .It Li .Bl Xo
3241 .Bro \-hang | \-ohang | \-tag | \-diag | \-inset Brc
3242 .Oo \-width Ao string Ac Oc
3243 .Oo \-offset Ao string Ac Oc Oo \-compact Oc Xc
3244 .It Li .Bl Xo
3245 .No \-column Oo \-offset Ao string Ac Oc
3246 .Ao string1 Ac Ao string2 Ac ... Xc
3247 .It Li .Bl Xo
3248 .Bro \-item | \-enum Oo \-nested Oc | \-bullet | \-hyphen | \-dash Brc
3249 .Oo \-offset Ao string Ac Oc Oo \-compact Oc Xc
3254 And now a detailed description of the list types.
3257 .Bl -tag -width ".Fl column" -compact
3258 .It Fl bullet
3259 A bullet list.
3261 .Bd -literal -offset indent
3262 \&.Bl -bullet -offset indent -compact
3263 \&.It
3264 Bullet one goes here.
3265 \&.It
3266 Bullet two here.
3267 \&.El
3271 Produces:
3274 .Bl -bullet -offset indent -compact
3276 Bullet one goes here.
3278 Bullet two here.
3282 .It Fl dash No ( or Fl hyphen )
3283 A dash list.
3285 .Bd -literal -offset indent
3286 \&.Bl -dash -offset indent -compact
3287 \&.It
3288 Dash one goes here.
3289 \&.It
3290 Dash two here.
3291 \&.El
3295 Produces:
3298 .Bl -dash -offset indent -compact
3300 Dash one goes here.
3302 Dash two here.
3306 .It Fl enum
3307 An enumerated list.
3309 .Bd -literal -offset indent
3310 \&.Bl -enum -offset indent -compact
3311 \&.It
3312 Item one goes here.
3313 \&.It
3314 And item two here.
3315 \&.El
3319 The result:
3322 .Bl -enum -offset indent -compact
3324 Item one goes here.
3326 And item two here.
3330 If you want to nest enumerated lists, use the
3331 .Fl nested
3332 flag (starting with the second-level list):
3334 .Bd -literal -offset indent
3335 \&.Bl -enum -offset indent -compact
3336 \&.It
3337 Item one goes here
3338 \&.Bl -enum -nested -compact
3339 \&.It
3340 Item two goes here.
3341 \&.It
3342 And item three here.
3343 \&.El
3344 \&.It
3345 And item four here.
3346 \&.El
3350 Result:
3353 .Bl -enum -offset indent -compact
3355 Item one goes here.
3356 .Bl -enum -nested -compact
3358 Item two goes here.
3360 And item three here.
3363 And item four here.
3367 .It Fl item
3368 A list of type
3369 .Fl item
3370 without list markers.
3372 .Bd -literal -offset indent
3373 \&.Bl -item -offset indent
3374 \&.It
3375 Item one goes here.
3376 Item one goes here.
3377 Item one goes here.
3378 \&.It
3379 Item two here.
3380 Item two here.
3381 Item two here.
3382 \&.El
3386 Produces:
3389 .Bl -item -offset indent
3391 Item one goes here.
3392 Item one goes here.
3393 Item one goes here.
3395 Item two here.
3396 Item two here.
3397 Item two here.
3401 .It Fl tag
3402 A list with tags.
3404 .Fl width
3405 to specify the tag width.
3408 .Bl -tag -width "PPID" -compact -offset indent
3409 .It SL
3410 sleep time of the process (seconds blocked)
3411 .It PAGEIN
3412 number of disk
3413 .Tn I/O Ns 's
3414 resulting from references by the process
3415 to pages not loaded in core.
3416 .It UID
3417 numerical user-id of process owner
3418 .It PPID
3419 numerical id of parent of process priority
3420 (non-positive when in non-interruptible wait)
3424 The raw text:
3426 .Bd -literal -offset indent
3427 \&.Bl -tag -width "PPID" -compact -offset indent
3428 \&.It SL
3429 sleep time of the process (seconds blocked)
3430 \&.It PAGEIN
3431 number of disk
3432 \&.Tn I/O Ns 's
3433 resulting from references by the process
3434 to pages not loaded in core.
3435 \&.It UID
3436 numerical user-id of process owner
3437 \&.It PPID
3438 numerical id of parent of process priority
3439 (non-positive when in non-interruptible wait)
3440 \&.El
3444 .It Fl diag
3445 Diag lists create section four diagnostic lists and are similar to inset
3446 lists except callable macros are ignored.
3448 .Fl width
3449 flag is not meaningful in this context.
3451 Example:
3453 .Bd -literal -offset indent
3454 \&.Bl -diag
3455 \&.It You can't use Sy here.
3456 The message says all.
3457 \&.El
3461 produces
3463 .Bl -diag
3464 .It You can't use Sy here.
3465 The message says all.
3469 .It Fl hang
3470 A list with hanging tags.
3472 .Bl -hang -offset indent
3473 .It Em Hanged
3474 labels appear similar to tagged lists when the
3475 label is smaller than the label width.
3476 .It Em Longer hanged list labels
3477 blend into the paragraph unlike
3478 tagged paragraph labels.
3481 And the unformatted text which created it:
3483 .Bd -literal -offset indent
3484 \&.Bl -hang -offset indent
3485 \&.It Em Hanged
3486 labels appear similar to tagged lists when the
3487 label is smaller than the label width.
3488 \&.It Em Longer hanged list labels
3489 blend into the paragraph unlike
3490 tagged paragraph labels.
3491 \&.El
3495 .It Fl ohang
3496 Lists with overhanging tags do not use indentation for the items; tags are
3497 written to a separate line.
3499 .Bl -ohang -offset indent
3500 .It Sy SL
3501 sleep time of the process (seconds blocked)
3502 .It Sy PAGEIN
3503 number of disk
3504 .Tn I/O Ns 's
3505 resulting from references by the process
3506 to pages not loaded in core.
3507 .It Sy UID
3508 numerical user-id of process owner
3509 .It Sy PPID
3510 numerical id of parent of process priority
3511 (non-positive when in non-interruptible wait)
3515 The raw text:
3517 .Bd -literal -offset indent
3518 \&.Bl -ohang -offset indent
3519 \&.It Sy SL
3520 sleep time of the process (seconds blocked)
3521 \&.It Sy PAGEIN
3522 number of disk
3523 \&.Tn I/O Ns 's
3524 resulting from references by the process
3525 to pages not loaded in core.
3526 \&.It Sy UID
3527 numerical user-id of process owner
3528 \&.It Sy PPID
3529 numerical id of parent of process priority
3530 (non-positive when in non-interruptible wait)
3531 \&.El
3535 .It Fl inset
3536 Here is an example of inset labels:
3537 .Bl -inset -offset indent
3538 .It Em Tag
3539 The tagged list (also called a tagged paragraph)
3540 is the most common type of list used in the
3541 Berkeley manuals.
3542 Use a
3543 .Fl width
3544 attribute as described below.
3545 .It Em Diag
3546 Diag lists create section four diagnostic lists
3547 and are similar to inset lists except callable
3548 macros are ignored.
3549 .It Em Hang
3550 Hanged labels are a matter of taste.
3551 .It Em Ohang
3552 Overhanging labels are nice when space is constrained.
3553 .It Em Inset
3554 Inset labels are useful for controlling blocks of
3555 paragraphs and are valuable for converting
3556 .Nm \-mdoc
3557 manuals to other formats.
3560 Here is the source text which produced the above example:
3562 .Bd -literal -offset indent
3563 \&.Bl -inset -offset indent
3564 \&.It Em Tag
3565 The tagged list (also called a tagged paragraph)
3566 is the most common type of list used in the
3567 Berkeley manuals.
3568 \&.It Em Diag
3569 Diag lists create section four diagnostic lists
3570 and are similar to inset lists except callable
3571 macros are ignored.
3572 \&.It Em Hang
3573 Hanged labels are a matter of taste.
3574 \&.It Em Ohang
3575 Overhanging labels are nice when space is constrained.
3576 \&.It Em Inset
3577 Inset labels are useful for controlling blocks of
3578 paragraphs and are valuable for converting
3579 \&.Nm \-mdoc
3580 manuals to other formats.
3581 \&.El
3585 .It Fl column
3586 This list type generates multiple columns.
3587 The number of columns and the width of each column is determined by the
3588 arguments to the
3589 .Fl column
3590 list,
3591 .Aq Ar string1 ,
3592 .Aq Ar string2 ,
3593 etc.
3595 .Aq Ar stringN
3596 starts with a
3597 .Ql .\&
3598 (dot) immediately followed by a valid
3599 .Nm \-mdoc
3600 macro name, interpret
3601 .Aq Ar stringN
3602 and use the width of the result.
3603 Otherwise, the width of
3604 .Aq Ar stringN
3605 (typeset with a fixed-width font) is taken as the
3606 .Ar N Ns th
3607 column width.
3609 Each
3610 .Ql .It
3611 argument is parsed to make a row, each column within the row is a separate
3612 argument separated by a tab or the
3613 .Ql .Ta
3614 macro.
3616 The table:
3618 .Bl -column -offset indent ".Sy String" ".Sy Nroff" ".Sy Troff"
3619 .It Sy String Ta Sy Nroff Ta Sy Troff
3620 .It Li <= Ta <= Ta \*(<=
3621 .It Li >= Ta >= Ta \*(>=
3625 was produced by:
3627 .Bd -literal
3628 \&.Bl -column -offset indent ".Sy String" ".Sy Nroff" ".Sy Troff"
3629 \&.It Sy String Ta Sy Nroff Ta Sy Troff
3630 \&.It Li <= Ta <= Ta \e*(<=
3631 \&.It Li >= Ta >= Ta \e*(>=
3632 \&.El
3637 Other keywords:
3639 .Bl -tag -width ".Fl indent Ao Ar string Ac"
3640 .It Fl width Ao Ar string Ac
3642 .Aq Ar string
3643 starts with a
3644 .Ql .\&
3645 (dot) immediately followed by a valid
3646 .Nm \-mdoc
3647 macro name, interpret
3648 .Aq Ar string
3649 and use the width of the result.
3650 Almost all lists in this document use this option.
3652 Example:
3654 .Bd -literal -offset indent
3655 \&.Bl -tag -width ".Fl test Ao Ar string Ac"
3656 \&.It Fl test Ao Ar string Ac
3657 This is a longer sentence to show how the
3658 \&.Fl width
3659 flag works in combination with a tag list.
3660 \&.El
3664 gives:
3666 .Bl -tag -width ".Fl test Ao Ar string Ac"
3667 .It Fl test Ao Ar string Ac
3668 This is a longer sentence to show how the
3669 .Fl width
3670 flag works in combination with a tag list.
3674 (Note that the current state of
3675 .Nm \-mdoc
3676 is saved before
3677 .Aq Ar string
3678 is interpreted; afterwards, all variables are restored again.
3679 However, boxes (used for enclosures) can't be saved in
3680 .Tn GNU
3681 .Xr troff 1 ;
3682 as a consequence, arguments must always be
3683 .Em balanced
3684 to avoid nasty errors.
3685 For example, do not write
3686 .Ql ".Ao Ar string"
3688 .Ql ".Ao Ar string Xc"
3689 instead if you really need only an opening angle bracket.)
3691 Otherwise, if
3692 .Aq Ar string
3693 is a valid numeric expression
3694 .Em ( with a scale indicator other than
3695 .Sq Em u ) ,
3696 use that value for indentation.
3697 The most useful scale indicators are
3698 .Sq m
3700 .Sq n ,
3701 specifying the so-called
3702 .Em \&Em
3704 .Em "En square" .
3705 This is approximately the width of the letters
3706 .Sq m
3708 .Sq n
3709 respectively
3710 of the current font (for nroff output, both scale indicators give the same
3711 values).
3713 .Aq Ar string
3714 isn't a numeric expression, it is tested whether it is an
3715 .Nm \-mdoc
3716 macro name, and the default width value associated with this macro is used.
3717 Finally, if all tests fail,
3718 the width of
3719 .Aq Ar string
3720 (typeset with a fixed-width font) is taken as the width.
3722 If a width is not specified for the tag list type, every time
3723 .Ql .It
3724 is invoked, an attempt is made to determine an appropriate width.
3725 If the first argument to
3726 .Ql .It
3727 is a callable macro, the default width for that macro will be used;
3728 otherwise, the default width of
3729 .Ql .No
3730 is used.
3731 .It Fl offset Ao Ar string Ac
3733 .Aq Ar string
3735 .Ar indent ,
3736 a default indent value (normally set to\~6n, similar to the value used in
3737 .Ql .Dl
3739 .Ql .Bd )
3740 is used.
3742 .Aq Ar string
3743 is a valid numeric expression instead
3744 .Pf ( Em with a scale indicator other than
3745 .Sq Em u ) ,
3746 use that value for indentation.
3747 The most useful scale indicators are
3748 .Sq m
3750 .Sq n ,
3751 specifying the so-called
3752 .Em \&Em
3754 .Em "En square" .
3755 This is approximately the width of the letters
3756 .Sq m
3758 .Sq n
3759 respectively
3760 of the current font (for nroff output, both scale indicators give the same
3761 values).
3763 .Aq Ar string
3764 isn't a numeric expression, it is tested whether it is an
3765 .Nm \-mdoc
3766 macro name, and the default offset value associated with this macro is used.
3767 Finally, if all tests fail,
3768 the width of
3769 .Aq Ar string
3770 (typeset with a fixed-width font) is taken as the offset.
3771 .It Fl compact
3772 Suppress insertion of vertical space before the list and between list items.
3776 .Sh "MISCELLANEOUS MACROS"
3778 Here a list of the remaining macros which do not fit well into one of the
3779 above sections.
3780 We couldn't find real examples for the following macros:
3781 .Ql .Me
3783 .Ql .Ot .
3784 They are documented here for completeness \- if you know how to use them
3785 properly please send a mail to
3786 .Mt bug-groff@gnu.org
3787 (including an example).
3789 .Bl -tag -width ".Li .Bt"
3790 .It Li .Bt
3791 prints
3793 .Bd -ragged -offset indent
3797 It is neither callable nor parsed and takes no arguments.
3799 .It Li .Fr
3801 .Dl Usage: .Fr Ao function return value Ac ...
3803 Don't use this macro.
3804 It allows a break right before the return value (usually a single digit)
3805 which is bad typographical behaviour.
3807 .Ql \e~
3808 to tie the return value to the previous word.
3810 .It Li .Hf
3811 Use this macro to include a (header) file literally.
3812 It first prints
3813 .Ql File:
3814 followed by the file name, then the contents of
3815 .Ao file Ac .
3817 .Dl Usage: .Hf Ao file Ac
3819 It is neither callable nor parsed.
3821 .It Li .Lk
3822 To be written.
3824 .It Li .Me
3825 Exact usage unknown.
3826 The documentation in the
3827 .Nm \-mdoc
3828 source file describes it as a macro for
3829 .Dq "menu entries" .
3831 Its default width is 6n.
3833 .It Li .Mt
3834 To be written.
3836 .It Li .Ot
3837 Exact usage unknown.
3838 The documentation in the
3839 .Nm \-mdoc
3840 source file describes it as
3841 .Dq old function type (fortran) .
3843 .It Li .Sm
3844 Activate (toggle) space mode.
3846 .Dl Usage: .Sm Oo on | off Oc ...
3848 If space mode is off, no spaces between macro arguments are inserted.
3849 If called without a parameter (or if the next parameter is neither
3850 .Ql on
3852 .Ql off ,
3853 .Ql .Sm
3854 toggles space mode.
3856 .It Li .Ud
3857 prints
3859 .Bd -ragged -offset indent
3863 It is neither callable nor parsed and takes no arguments.
3867 .Sh "PREDEFINED STRINGS"
3869 The following strings are predefined:
3871 .Bl -column String infinity "Troff " "straight double quote" -offset indent
3872 .It Sy String Ta Sy Nroff Ta Sy Troff Ta Sy Meaning
3873 .It Li <=     Ta <=       Ta \*[<=]   Ta "less equal"
3874 .It Li >=     Ta >=       Ta \*[>=]   Ta "greater equal"
3875 .It Li Rq     Ta ''       Ta \*[Rq]   Ta "right double quote"
3876 .It Li Lq     Ta ``       Ta \*[Lq]   Ta "left double quote"
3877 .It Li ua     Ta ^        Ta \*[ua]   Ta "upwards arrow"
3878 .It Li aa     Ta \'       Ta \*[aa]   Ta "acute accent"
3879 .It Li ga     Ta \`       Ta \*[ga]   Ta "grave accent"
3880 .It Li q      Ta \&"      Ta \*[q]    Ta "straight double quote"
3881 .It Li Pi     Ta pi       Ta \*[Pi]   Ta "greek pi"
3882 .It Li Ne     Ta !=       Ta \*[Ne]   Ta "not equal"
3883 .It Li Le     Ta <=       Ta \*[Le]   Ta "less equal"
3884 .It Li Ge     Ta >=       Ta \*[Ge]   Ta "greater equal"
3885 .It Li Lt     Ta <        Ta \*[Lt]   Ta "less than"
3886 .It Li Gt     Ta >        Ta \*[Gt]   Ta "greater than"
3887 .It Li Pm     Ta +\-      Ta \*[Pm]   Ta "plus minus"
3888 .It Li If     Ta infinity Ta \*[If]   Ta "infinity"
3889 .It Li Am     Ta \*[Am]   Ta \*[Am]   Ta "ampersand"
3890 .It Li Na     Ta \*[Na]   Ta \*[Na]   Ta "not a number"
3891 .It Li Ba     Ta \*[Ba]   Ta \*[Ba]   Ta "vertical bar"
3894 The names of the columns
3895 .Sy Nroff
3897 .Sy Troff
3898 are a bit misleading;
3899 .Sy Nroff
3900 shows the
3901 .Tn ASCII
3902 representation, while
3903 .Sy Troff
3904 gives the best glyph form available.
3905 For example, a Unicode enabled
3906 .Tn TTY Ns - Ns
3907 device will have proper glyph representations for all strings, whereas the
3908 enhancement for a Latin1
3909 .Tn TTY Ns - Ns
3910 device is only the plus-minus sign.
3912 String names which consist of two characters can be written as
3913 .Ql \e*(xx ;
3914 string names which consist of one character can be written as
3915 .Ql \e*x .
3916 A generic syntax for a string name of any length is
3917 .Ql \e*[xxx]
3918 (this is a
3919 .Tn GNU
3920 .Xr troff 1
3921 extension).
3925 \#=====================================================================
3927 .Sh DIAGNOSTICS
3929 The debugging macro
3930 .Ql .Db
3931 available in previous versions of
3932 .Nm \-mdoc
3933 has been removed since
3934 .Tn GNU
3935 .Xr troff 1
3936 provides better facilities to check parameters; additionally, many error and
3937 warning messages have been added to this macro package, making it both more
3938 robust and verbose.
3940 The only remaining debugging macro is
3941 .Ql .Rd
3942 which yields a register dump of all global registers and strings.
3943 A normal user will never need it.
3946 .Sh "FORMATTING WITH GROFF, TROFF, AND NROFF"
3948 By default, the package inhibits page breaks, headers, and footers if
3949 displayed with a
3950 .Tn TTY
3951 device like
3952 .Sq latin1
3954 .Sq unicode ,
3955 to make the manual more efficient for viewing on-line.
3956 This behaviour can be changed (e.g.\& to create a hardcopy of the
3957 .Tn TTY
3958 output) by setting the register
3959 .Ql cR
3960 to zero while calling
3961 .Xr groff 1 ,
3962 resulting in multiple pages instead of a single, very long page:
3964 .Dl groff -Tlatin1 -rcR=0 -mdoc foo.man > foo.txt
3966 For double-sided printing, set register
3967 .Ql D
3968 to\~1:
3970 .Dl groff -Tps -rD1 -mdoc foo.man > foo.ps
3972 To change the document font size to 11pt or 12pt, set register
3973 .Ql S
3974 accordingly:
3976 .Dl groff -Tdvi -rS11 -mdoc foo.man > foo.dvi
3978 Register
3979 .Ql S
3980 is ignored for
3981 .Tn TTY
3982 devices.
3984 The line and title length can be changed by setting the registers
3985 .Ql LL
3987 .Ql LT ,
3988 respectively:
3990 .Dl groff -Tutf8 -rLL=100n -rLT=100n -mdoc foo.man | less
3992 If not set, both registers default to 78n for TTY devices and 6.5i
3993 otherwise.
3996 .Sh FILES
3998 .Bl -tag -width mdoc/doc-ditroff -compact
3999 .It Pa doc.tmac
4000 The main manual macro package.
4001 .It Pa mdoc.tmac
4002 A wrapper file to call
4003 .Pa doc.tmac .
4004 .It Pa mdoc/doc-common
4005 Common strings, definitions, stuff related typographic output.
4006 .It Pa mdoc/doc-nroff
4007 Definitions used for a
4008 .Tn TTY
4009 output device.
4010 .It Pa mdoc/doc-ditroff
4011 Definitions used for all other devices.
4012 .It Pa mdoc.local
4013 Local additions and customizations.
4014 .It Pa andoc.tmac
4015 This file checks whether the
4016 .Nm \-mdoc
4017 or the
4018 .Nm \-man
4019 package should be used.
4023 .Sh "SEE ALSO"
4025 .Xr groff 1 ,
4026 .Xr man 1 ,
4027 .Xr troff 1 ,
4028 .Xr groff_man 7
4031 .Sh BUGS
4033 Section 3f has not been added to the header routines.
4035 .Ql \&.Nm
4036 font should be changed in
4037 .Sx NAME
4038 section.
4040 .Ql \&.Fn
4041 needs to have a check to prevent splitting up
4042 if the line length is too short.
4043 Occasionally it
4044 separates the last parenthesis, and sometimes
4045 looks ridiculous if a line is in fill mode.
4047 The list and display macros do not do any keeps
4048 and certainly should be able to.
4049 .\" Note what happens if the parameter list overlaps a newline
4050 .\" boundary.
4051 .\" to make sure a line boundary is crossed:
4052 .\" .Bd -literal
4053 .\" \&.Fn struct\e\ dictionarytable\e\ *dictionarylookup struct\e\ dictionarytable\e\ *tab[]
4054 .\" .Ed
4055 .\" .Pp
4056 .\" produces, nudge nudge,
4057 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
4058 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
4059 .\" nudge
4060 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] .
4061 .\" .Pp
4062 .\" If double quotes are used, for example:
4063 .\" .Bd -literal
4064 .\" \&.Fn \*qstruct dictionarytable *dictionarylookup\*q \*qchar *h\*q \*qstruct dictionarytable *tab[]\*q
4065 .\" .Ed
4066 .\" .Pp
4067 .\" produces, nudge nudge,
4068 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
4069 .\" nudge
4070 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
4071 .\" nudge
4072 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" .
4073 .\" .Pp
4074 .\" Not a pretty sight...
4075 .\" In a paragraph, a long parameter containing unpaddable spaces as
4076 .\" in the former example will cause
4077 .\" .Xr troff
4078 .\" to break the line and spread
4079 .\" the remaining words out.
4080 .\" The latter example will adjust nicely to
4081 .\" justified margins, but may break in between an argument and its
4082 .\" declaration.
4083 .\" In
4084 .\" .Xr nroff
4085 .\" the right margin adjustment is normally ragged and the problem is
4086 .\" not as severe.
4088 .\" Local Variables:
4089 .\" mode: nroff
4090 .\" End: