* tmac/doc-common (doc-operating-system-NetBSD-2.0.1,
[s-roff.git] / tmac / groff_mdoc.man
blob514da1263b9000fbbad9f7afe1e828e406a530f5
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. [Deleted.  See
23 .\"     ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change]
24 .\" 4. Neither the name of the University nor the names of its contributors
25 .\"    may be used to endorse or promote products derived from this software
26 .\"    without specific prior written permission.
27 .\"
28 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 .\" SUCH DAMAGE.
39 .\"
40 .\"     @(#)mdoc.samples.7 8.2 (Berkeley) 12/30/93
41 .\"
42 .\" This reference invokes every macro in the package several
43 .\" times and is guaranteed to give a worst case performance
44 .\" for an already extremely slow package.
45 .\"
47 .Dd Mar 18, 2005
48 .Os
49 .Dt GROFF_MDOC 7
52 .Sh NAME
54 .Nm groff_mdoc
55 .Nd reference for groff's mdoc implementation
58 .Sh SYNOPSIS
60 .Nm groff Fl m Ns Cm doc Ar
63 .Sh DESCRIPTION
65 A complete reference for writing
66 .Ux
67 manual pages with the
68 .Nm \-mdoc
69 macro package; a
70 .Em content Ns -based
71 and
72 .Em domain Ns -based
73 formatting package for
74 .Tn GNU
75 .Xr troff 1 .
76 Its predecessor, the
77 .Xr \-man 7
78 package, addressed page layout leaving the manipulation of fonts and other
79 typesetting details to the individual author.
81 .Nm \-mdoc ,
82 page layout macros make up the
83 .Em "page structure domain"
84 which consists of macros for titles, section headers, displays and lists
85 \- essentially items which affect the physical position of text on a
86 formatted page.
87 In addition to the page structure domain, there are two more domains, the
88 .Em manual
89 domain and the
90 .Em general
91 text domain.
92 The general text domain is defined as macros which perform tasks such as
93 quoting or emphasizing pieces of text.
94 The manual domain is defined as macros that are a subset of the day to day
95 informal language used to describe commands, routines and related
96 .Ux
97 files.
98 Macros in the manual domain handle command names, command line arguments and
99 options, function names, function parameters, pathnames, variables, cross
100 references to other manual pages, and so on.
101 These domain items have value for both the author and the future user of the
102 manual page.
103 Hopefully, the consistency gained across the manual set will provide easier
104 translation to future documentation tools.
106 Throughout the
108 manual pages, a manual entry is simply referred to as a man page, regardless
109 of actual length and without sexist intention.
112 .Sh "GETTING STARTED"
114 The material presented in the remainder of this document is outlined
115 as follows:
117 .Bl -enum -width 3n -offset indent
118 .  It
119 .  Tn "TROFF IDIOSYNCRASIES"
121 .  Bl -tag -width 2n -compact
122 .    It "Macro Usage"
123 .    It "Passing Space Characters in an Argument"
124 .    It "Trailing Blank Space Characters"
125 .    It "Escaping Special Characters"
126 .    It "Other Possible Pitfalls"
127 .  El
129 .  It
130 .  Tn "A MANUAL PAGE TEMPLATE"
132 .  It
133 .  Tn "CONVENTIONS"
135 .  It
136 .  Tn "TITLE MACROS"
138 .  It
139 .  Tn "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS"
141 .  Bl -tag -width 2n -compact
142 .    It "What's in a Name" Ns ...
143 .    It "General Syntax"
144 .  El
146 .  It
147 .  Tn "MANUAL DOMAIN"
149 .  Bl -tag -width 2n -compact
150 .    It "Addresses"
151 .    It "Author Name"
152 .    It "Arguments"
153 .    It "Configuration Declarations (Section Four Only)"
154 .    It "Command Modifiers"
155 .    It "Defined Variables"
156 .    It "Errno's"
157 .    It "Environment Variables"
158 .    It "Flags"
159 .    It "Function Declarations"
160 .    It "Function Types"
161 .    It "Functions (Library Routines)"
162 .    It "Function Arguments"
163 .    It "Return Values"
164 .    It "Exit Status"
165 .    \" .It "Header File (including source code)"
166 .    It "Interactive Commands"
167 .    It "Library Names"
168 .    It "Literals"
169 .    It "Names"
170 .    It "Options"
171 .    It "Pathnames"
172 .    It "Standards"
173 .    It "Variable Types"
174 .    It "Variables"
175 .    It "Manual Page Cross References"
176 .  El
178 .  It
179 .  Tn "GENERAL TEXT DOMAIN"
181 .  Bl -tag -width 2n -compact
182 .    It "AT&T Macro"
183 .    It "BSD Macro"
184 .    It "NetBSD Macro"
185 .    It "FreeBSD Macro"
186 .    It "OpenBSD Macro"
187 .    It "BSD/OS Macro"
188 .    It "UNIX Macro"
189 .    It "Emphasis Macro"
190 .    It "Font Mode"
191 .    It "Enclosure and Quoting Macros"
192 .    It "No-Op or Normal Text Macro"
193 .    It "No-Space Macro"
194 .    It "Section Cross References"
195 .    It "Symbolics"
196 .    It "Mathematical Symbols"
197 .    It "References and Citations"
198 .    It "Trade Names (or Acronyms and Type Names)"
199 .    It "Extended Arguments"
200 .  El
202 .  It
203 .  Tn "PAGE STRUCTURE DOMAIN"
205 .  Bl -tag -width 2n -compact
206 .    It "Section Headers"
207 .    It "Subsection Headers"
208 .    It "Paragraphs and Line Spacing"
209 .    It "Keeps"
210 .    It "Examples and Displays"
211 .    It "Lists and Columns"
212 .  El
214 .  It
215 .  Tn "MISCELLANEOUS MACROS"
217 .  It
218 .  Tn "PREDEFINED STRINGS"
220 .  It
221 .  Tn "DIAGNOSTICS"
223 .  It
224 .  Tn "FORMATTING WITH GROFF, TROFF, AND NROFF"
226 .  It
227 .  Tn "FILES"
229 .  It
230 .  Tn "SEE ALSO"
232 .  It
233 .  Tn "BUGS"
236 .\" XXX
237 .if t \
238 .  ne 7
241 .Sh "TROFF IDIOSYNCRASIES"
244 .Nm \-mdoc
245 package attempts to simplify the process of writing a man page.
246 Theoretically, one should not have to learn the tricky details of
247 .Tn GNU
248 .Xr troff 1
249 to use
250 .Nm \-mdoc ;
251 however, there are a few limitations which are unavoidable and best gotten
252 out of the way.
253 And, too, be forewarned, this package is
254 .Em not
255 fast.
257 .Ss "Macro Usage"
259 As in
260 .Tn GNU
261 .Xr troff 1 ,
262 a macro is called by placing a
263 .Ql .\&
264 (dot character) at the beginning of a line followed by the two-character
265 (or three-character) name for the macro.
266 There can be space or tab characters between the dot and the macro name.
267 Arguments may follow the macro separated by spaces (but
268 .Em no
269 tabs).
270 It is the dot character at the beginning of the line which causes
271 .Tn GNU
272 .Xr troff 1
273 to interpret the next two (or more) characters as a macro name.
274 A single starting dot followed by nothing is ignored.
275 To place a
276 .Ql .\&
277 (dot character) at the beginning of an input line in some context other than
278 a macro invocation, precede the
279 .Ql .\&
280 (dot) with the
281 .Ql \e&
282 escape sequence which translates literally to a zero-width space, and is
283 never displayed in the output.
285 In general,
286 .Tn GNU
287 .Xr troff 1
288 macros accept an unlimited number of arguments (contrary to other versions
289 of troff which can't handle more than nine arguments).
290 In limited cases, arguments may be continued or extended on the next
291 line (See
292 .Sx Extended Arguments
293 below).
294 Almost all macros handle quoted arguments (see
295 .Sx Passing Space Characters in an Argument
296 below).
298 Most of the
299 .Nm \-mdoc
300 general text domain and manual domain macros are special in that their
301 argument lists are
302 .Em parsed
303 for callable macro names.
304 This means an argument on the argument list which matches a general text or
305 manual domain macro name (and which is defined to be callable) will be
306 executed or called when it is processed.
307 In this case the argument, although the name of a macro, is not preceded by
309 .Ql .\&
310 (dot).
311 This makes it possible to nest macros; for example the option macro,
312 .Ql .Op ,
314 .Em call
315 the flag and argument macros,
316 .Ql \&Fl
318 .Ql \&Ar ,
319 to specify an optional flag with an argument:
321 .Bl -tag -width ".Op Fl s Ar bytes" -offset indent
322 .It Op Fl s Ar bytes
323 is produced by
324 .Ql ".Op Fl s Ar bytes"
328 To prevent a string from being interpreted as a macro name, precede the
329 string with the escape sequence
330 .Ql \e& :
332 .Bl -tag -width ".Op \&Fl s \&Ar bytes" -offset indent
333 .It Op \&Fl s \&Ar bytes
334 is produced by
335 .Ql ".Op \e&Fl s \e&Ar bytes"
339 Here the strings
340 .Ql \&Fl
342 .Ql \&Ar
343 are not interpreted as macros.
344 Macros whose argument lists are parsed for callable arguments are referred
345 to as
346 .Em parsed
347 and macros which may be called from an argument list are referred to as
348 .Em callable
349 throughout this document.
350 This is a technical
351 .Em faux pas
352 as almost all of the macros in
353 .Nm \-mdoc
354 are parsed, but as it was cumbersome to constantly refer to macros as
355 being callable and being able to call other macros, the term parsed
356 has been used.
359 In the following, we call an
360 .Nm \-mdoc
361 macro which starts a line (with a leading dot) a
362 .Em command
363 if this distinction is necessary.
365 .Ss "Passing Space Characters in an Argument"
367 Sometimes it is desirable to give as an argument a string containing one or
368 more blank space characters, say, to specify arguments to commands which
369 expect particular arrangement of items in the argument list.
370 Additionally, it makes
371 .Nm \-mdoc
372 working faster.
373 For example, the function command
374 .Ql .Fn
375 expects the first argument to be the name of a function and any remaining
376 arguments to be function parameters.
378 .Tn ANSI\~C
379 stipulates the declaration of function parameters in the parenthesized
380 parameter list, each parameter is guaranteed to be at minimum a two word
381 string.
382 For example,
383 .Fa int foo .
385 There are two possible ways to pass an argument which contains
386 an embedded space.
387 One way of passing a string containing blank spaces is to use the hard or
388 unpaddable space character
389 .Ql \e\  ,
390 that is, a blank space preceded by the escape character
391 .Ql \e .
392 This method may be used with any macro but has the side effect of
393 interfering with the adjustment of text over the length of a line.
394 .Xr Troff
395 sees the hard space as if it were any other printable character and cannot
396 split the string into blank or newline separated pieces as one would expect.
397 This method is useful for strings which are not expected to overlap a line
398 boundary.
399 An alternative is to use
400 .Ql \e~ ,
401 a paddable (i.e.\& stretchable), unbreakable space (this is a
402 .Tn GNU
403 .Xr troff 1
404 extension).
405 The second method is to enclose the string with double quotes.
407 For example:
409 .Bl -tag -width ".Fn fetch char\ *str" -offset indent
410 .It Fn fetch char\ *str
411 is created by
412 .Ql ".Fn fetch char\e *str"
413 .It Fn fetch "char *str"
414 can also be created by
415 .Ql ".Fn fetch \*[q]char *str\*[q]"
419 If the
420 .Ql \e
421 before the space in the first example
422 or double quotes in the second example
423 were omitted,
424 .Ql .Fn
425 would see three arguments, and the result would be:
427 .Dl Fn fetch char *str
429 .\" For an example of what happens when the parameter list overlaps a newline
430 .\" boundary, see the
431 .\" .Sx BUGS
432 .\" section.
434 .Ss "Trailing Blank Space Characters"
436 .Xr Troff
437 can be confused by blank space characters at the end of a line.
438 It is a wise preventive measure to globally remove all blank spaces
439 from
440 .Ao blank-space Ac Ns Ao end-of-line Ac
441 character sequences.
442 Should the need arise to use a blank character at the end of a line, it
443 may be forced with an unpaddable space and the
444 .Ql \e&
445 escape character.
446 For example,
447 .Ql string\e\ \e& .
449 .Ss "Escaping Special Characters"
451 Special characters like the newline character
452 .Ql \en
453 are handled by replacing the
454 .Ql \e
455 with
456 .Ql \ee
457 (e.g.\&
458 .Ql \een )
459 to preserve the backslash.
461 .Ss "Other Possible Pitfalls"
463 A warning is emitted when an empty input line is found outside of displays
464 (see below).
466 .Ql .sp
467 instead.
468 (Well, it is even better to use
469 .Nm \-mdoc
470 macros to avoid the usage of low-level commands.)
472 Leading spaces will cause a break and are output directly.
473 Avoid this behaviour if possible.
474 Similarly, do not use more than one space character between words in an
475 ordinary text line; contrary to other text formatters, they are
476 .Em not
477 replaced with a single space.
479 You can't pass
480 .Ql \*[q]
481 directly as an argument.
483 .Ql \e*[q]
485 .Ql \e*q )
486 instead.
488 By default,
489 .Xr troff 1
490 inserts two space characters after a punctuation mark closing a sentence;
491 characters like
492 .Ql \&)
494 .Ql \&'
495 are treated transparently, not influencing the sentence-ending behaviour.
496 To change this, insert
497 .Ql \e&
498 before or after the dot:
500 .Bd -literal -offset indent
502 \&.Ql .
503 character.
504 \&.Pp
506 \&.Ql \e&.
507 character.
508 \&.Pp
509 \&.No test .
510 test
511 \&.Pp
512 \&.No test.
513 test
517 gives
519 .Bd -filled -offset indent
521 .Ql .
522 character
525 .Ql \&.
526 character.
528 .No test .
529 test
531 .No test.
532 test
536 As can be seen in the first and third line,
537 .Nm \-mdoc
538 handles punctuation characters specially in macro arguments.
539 This will be explained in section
540 .Sx General Syntax
541 below.
542 In the same way, you have to protect trailing full stops of abbreviations
543 with a trailing zero-width space:
544 .Ql e.g.\e& .
546 A comment in the source file of a man page can be either started with
547 .Ql .\e"
548 on a single line,
549 .Ql \e"
550 after some input, or
551 .Ql \e#
552 anywhere (the latter is a
553 .Tn GNU
554 .Xr troff 1
555 extension); the rest of such a line is ignored.
558 .Sh "A MANUAL PAGE TEMPLATE"
560 The body of a man page is easily constructed from a basic template:
562 .Bd -literal -offset indent
563 \&.\e" The following commands are required for all man pages.
564 \&.Dd Month day, year
565 \&.Os [OPERATING_SYSTEM] [version/release]
566 \&.Dt DOCUMENT_TITLE [section number] [architecture/volume]
567 \&.Sh NAME
568 \&.Nm name
569 \&.Nd one line description of name
570 \&.\e" This next command is for sections 2 and 3 only.
571 \&.\e" .Sh LIBRARY
572 \&.Sh SYNOPSIS
573 \&.Sh DESCRIPTION
574 \&.\e" The following commands should be uncommented and
575 \&.\e" used where appropriate.
576 \&.\e" .Sh IMPLEMENTATION NOTES
577 \&.\e" This next command is for sections 2, 3 and 9 function
578 \&.\e" return values only.
579 \&.\e" .Sh RETURN VALUES
580 \&.\e" This next command is for sections 1, 6, 7 and 8 only.
581 \&.\e" .Sh ENVIRONMENT
582 \&.\e" .Sh FILES
583 \&.\e" .Sh EXAMPLES
584 \&.\e" This next command is for sections 1, 6, 7, 8 and 9 only
585 \&.\e"     (command return values (to shell) and
586 \&.\e"     fprintf/stderr type diagnostics).
587 \&.\e" .Sh DIAGNOSTICS
588 \&.\e" .Sh COMPATIBILITY
589 \&.\e" This next command is for sections 2, 3 and 9 error
590 \&.\e"     and signal handling only.
591 \&.\e" .Sh ERRORS
592 \&.\e" .Sh SEE ALSO
593 \&.\e" .Sh STANDARDS
594 \&.\e" .Sh HISTORY
595 \&.\e" .Sh AUTHORS
596 \&.\e" .Sh BUGS
600 The first items in the template are the commands
601 .Ql .Dd ,
602 .Ql .Os ,
604 .Ql .Dt ;
605 the document date, the operating system the man page or subject source is
606 developed or modified for, and the man page title (in
607 .Em upper case )
608 along with the section of the manual the page belongs in.
609 These commands identify the page and are discussed below in
610 .Sx TITLE MACROS .
612 The remaining items in the template are section headers
613 .Pf ( Li .Sh ) ;
614 of which
615 .Sx NAME ,
616 .Sx SYNOPSIS ,
618 .Sx DESCRIPTION
619 are mandatory.
620 The headers are discussed in
621 .Sx "PAGE STRUCTURE DOMAIN" ,
622 after presentation of
623 .Sx "MANUAL DOMAIN" .
624 Several content macros are used to demonstrate page layout macros; reading
625 about content macros before page layout macros is recommended.
628 .Sh CONVENTIONS
630 In the description of all macros below, optional arguments are put into
631 brackets.
632 An ellipsis
633 .Pf ( Sq ... )
634 represents zero or more additional arguments.
635 Alternative values for a parameter are separated with
636 .Ql | .
637 If there are alternative values for a mandatory parameter, braces are used
638 (together with
639 .Ql | )
640 to enclose the value set.
641 Meta-variables are specified within angles.
643 Example:
645 .Bl -tag -width 6n -offset indent
646 .It Li .Xx Xo
647 .Aq foo 
648 .Brq bar1 | bar2
649 .Op \-test1 Op \-test2 | \-test3
650 .No ...
655 Except stated explicitly, all macros are parsed and callable.
657 Note that a macro takes effect up to the next nested macro.
658 For example,
659 .Ql ".Ic foo Aq bar"
660 doesn't produce
661 .Sq Ic "foo <bar>"
663 .Sq Ic foo Aq bar .
664 Consequently, a warning message is emitted for most commands if the first
665 argument is a macro itself since it cancels the effect of the calling
666 command completely.
667 Another consequence is that quoting macros never insert literal quotes;
668 .Sq Ic "foo <bar>"
669 has been produced by
670 .Ql ".Ic \*[q]foo <bar>\*[q]" .
672 Most macros have a default width value which can be used to specify a label
673 width
674 .Pf ( Fl width )
675 or offset
676 .Pf ( Fl offset )
677 for the
678 .Ql .Bl
680 .Ql .Bd
681 macros.
682 It is recommended not to use this rather obscure feature to avoid
683 dependencies on local modifications of the
684 .Nm \-mdoc
685 package.
688 .Sh "TITLE MACROS"
690 The title macros are part of the page structure domain but are presented
691 first and separately for someone who wishes to start writing a man page
692 yesterday.
693 Three header macros designate the document title or manual page title, the
694 operating system, and the date of authorship.
695 These macros are called once at the very beginning of the document and are
696 used to construct headers and footers only.
698 .Bl -tag -width 6n
699 .It Li .Dt Xo
700 .Op Aq document title
701 .Op Aq section number
702 .Op Aq volume
704 The document title is the subject of the man page and must be in
705 .Tn CAPITALS
706 due to troff limitations.
707 If omitted,
708 .Sq Tn UNTITLED
709 is used.
710 The section number may be a number in the range
711 .No 1,\~ Ns ... Ns ,\~9
713 .Ql unass ,
714 .Ql draft ,
716 .Ql paper .
717 If it is specified, and no volume name is given, a default volume name is
718 used.
721 Under
722 .Tn \*[operating-system] ,
723 the following sections are defined:
725 .Bl -column LOCAL -offset indent -compact
726 .It Li 1   Ta "\*[volume-operating-system] \*[volume-ds-1]"
727 .It Li 2   Ta "\*[volume-operating-system] \*[volume-ds-2]"
728 .It Li 3   Ta "\*[volume-operating-system] \*[volume-ds-3]"
729 .It Li 4   Ta "\*[volume-operating-system] \*[volume-ds-4]"
730 .It Li 5   Ta "\*[volume-operating-system] \*[volume-ds-5]"
731 .It Li 6   Ta "\*[volume-operating-system] \*[volume-ds-6]"
732 .It Li 7   Ta "\*[volume-operating-system] \*[volume-ds-7]"
733 .It Li 8   Ta "\*[volume-operating-system] \*[volume-ds-8]"
734 .It Li 9   Ta "\*[volume-operating-system] \*[volume-ds-9]"
738 A volume name may be arbitrary or one of the following:
741 .Bl -column LOCAL -offset indent -compact
742 .It Li USD   Ta "\*[volume-ds-USD]"
743 .It Li PS1   Ta "\*[volume-ds-PS1]"
744 .It Li AMD   Ta "\*[volume-ds-AMD]"
745 .It Li SMM   Ta "\*[volume-ds-SMM]"
746 .It Li URM   Ta "\*[volume-ds-URM]"
747 .It Li PRM   Ta "\*[volume-ds-PRM]"
748 .It Li KM    Ta "\*[volume-ds-KM]"
749 .It Li IND   Ta "\*[volume-ds-IND]"
750 .It Li LOCAL Ta "\*[volume-ds-LOCAL]"
751 .It Li CON   Ta "\*[volume-ds-CON]"
755 For compatibility,
756 .Ql MMI
757 can be used for
758 .Ql IND ,
760 .Ql LOC
762 .Ql LOCAL .
763 Values from the previous table will specify a new volume name.
764 If the third parameter is a keyword designating a computer architecture,
765 its value is prepended to the default volume name as specified by the
766 second parameter.
767 By default, the following architecture keywords are defined:
769 \# we use `No' to avoid hyphenation
770 .Bd -ragged -offset indent
771 .No alpha , acorn26 , acorn32 , algor , amd64 , amiga , arc , arm26 ,
772 .No arm32 , atari , bebox , cats , cesfic , cobalt , dreamcast , evbarm ,
773 .No evbmips , evbppc , evbsh3 , hp300 , hp700 , hpcmips , i386 , luna68k ,
774 .No m68k , mac68k , macppc , mips , mmeye , mvme68k , mvmeppc , netwinder ,
775 .No news68k , newsmips , next68k , ofppc , pc532 , pmax , pmppc , powerpc ,
776 .No prep , sandpoint , sgimips , sh3 , shark , sparc , sparc64 , sun3 ,
777 .No tahoe , vax , x68k , x86_64
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.4.1, 1.4.2, 1.4.3, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.6, 1.6.1,
866 1.6.2, 2.0, 2.0.1, 2.0.2, 2.1
867 .It FreeBSD
868 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,
869 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,
870 4.1.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.6.2, 4.7, 4.8, 4.9, 4.10, 5.0, 5.1, 5.2,
871 5.2.1, 5.3
877 .Tn ATT ,
878 an unknown second parameter will be replaced with the string
879 .Tn UNIX ;
880 for the other predefined acronyms it will be ignored and a warning message
881 emitted.
882 Unrecognized arguments are displayed as given in the page footer.
883 For instance, a typical footer might be:
885 .Dl .Os BSD 4.3
887 giving
888 .Ql 4.3\~Berkeley Distribution ,
889 or for a locally produced set
891 .Dl .Os CS Department
893 which will produce
894 .Ql CS\~Department .
896 If the
897 .Ql .Os
898 macro is not present, the bottom left corner of the manual page will be
899 ugly.
901 This macro is neither callable nor parsed.
903 .It Li .Dd Oo
904 .Aq month
905 .Aq day ,
906 .Aq year
909 .Ql Dd
910 has no arguments,
911 .Ql Epoch
912 is used for the date string.
913 If it has exactly three arguments, they are concatenated, separated with
914 unbreakable space:
916 .Dl .Dd January 25, 2001
918 Otherwise, the current date is used, ignoring the parameters.
920 This macro is neither callable nor parsed.
924 .Sh "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS"
926 .Ss "What's in a Name" Ns ...
928 The manual domain macro names are derived from the day to day informal
929 language used to describe commands, subroutines and related files.
930 Slightly different variations of this language are used to describe the
931 three different aspects of writing a man page.
932 First, there is the description of
933 .Nm \-mdoc
934 macro command usage.
935 Second is the description of a
937 command
938 .Em with
939 .Nm \-mdoc
940 macros, and third, the description of a command to a user in the verbal
941 sense; that is, discussion of a command in the text of a man page.
943 In the first case,
944 .Xr troff 1
945 macros are themselves a type of command; the general syntax for a troff
946 command is:
948 .Bd -filled -offset indent
949 .Li ".Xx argument1 argument2" ...
953 .Ql .Xx
954 is a macro command, and anything following it are arguments to
955 be processed.
956 In the second case, the description of a
958 command using the content macros is a bit more involved; a typical
959 .Sx SYNOPSIS
960 command line might be displayed as:
962 .Bd -filled -offset indent
963 .Nm filter
964 .Op Fl flag
965 .Ao Ar infile Ac Ao Ar outfile Ac
969 Here,
970 .Nm filter
971 is the command name and the
972 bracketed string
973 .Fl flag
974 is a
975 .Em flag
976 argument designated as optional by the option brackets.
978 .Nm \-mdoc
979 terms,
980 .Ao Ar infile Ac
982 .Ao Ar outfile Ac
983 are called
984 .Em meta arguments ;
985 in this example, the user has to replace the meta expressions given in angle
986 brackets with real file names.
987 Note that in this document meta arguments are used to describe
988 .Nm \-mdoc
989 commands; in most man pages, meta variables are not specifically written
990 with angle brackets.
991 The macros which formatted the above example:
993 .Bd -literal -offset indent
994 \&.Nm filter
995 \&.Op Fl flag
996 \&.Ao Ar infile Ac Ao Ar outfile Ac
1000 In the third case, discussion of commands and command syntax includes both
1001 examples above, but may add more detail.
1002 The arguments
1003 .Ao Ar infile Ac
1005 .Ao Ar outfile Ac
1006 from the example above might be referred to as
1007 .Em operands
1009 .Em file arguments .
1010 Some command line argument lists are quite long:
1012 .Bd -ragged
1013 .Bl -tag -width ".Nm make" -offset indent -compact
1014 .It Nm make
1015 .Op Fl eiknqrstv
1016 .Op Fl D Ar variable
1017 .Op Fl d Ar flags
1018 .Op Fl f Ar makefile
1019 .Op Fl I Ar directory
1020 .Op Fl j Ar max_jobs
1021 .Op Ar variable Ns = Ns Ar value
1023 .Op Ar target ...
1029 Here one might talk about the command
1030 .Nm make
1031 and qualify the argument,
1032 .Ar makefile ,
1033 as an argument to the flag,
1034 .Fl f ,
1035 or discuss the optional file operand
1036 .Ar target .
1037 In the verbal context, such detail can prevent confusion, however the
1038 .Nm \-mdoc
1039 package does not have a macro for an argument
1040 .Em to
1041 a flag.
1042 Instead the
1043 .Ql \&Ar
1044 argument macro is used for an operand or file argument like
1045 .Ar target
1046 as well as an argument to a flag like
1047 .Ar variable .
1048 The make command line was produced from:
1050 .Bd -literal -offset indent
1051 \&.Nm make
1052 \&.Op Fl eiknqrstv
1053 \&.Op Fl D Ar variable
1054 \&.Op Fl d Ar flags
1055 \&.Op Fl f Ar makefile
1056 \&.Op Fl I Ar directory
1057 \&.Op Fl j Ar max_jobs
1058 \&.Op Ar variable Ns = Ns Ar value
1059 \&.Bk
1060 \&.Op Ar target ...
1061 \&.Ek
1066 .Ql .Bk
1068 .Ql .Ek
1069 macros are explained in
1070 .Sx Keeps .
1072 .Ss "General Syntax"
1074 The manual domain and general text domain macros share a similar syntax with
1075 a few minor deviations; most notably,
1076 .Ql .Ar ,
1077 .Ql .Fl ,
1078 .Ql .Nm ,
1080 .Ql .Pa
1081 differ only when called without arguments; and
1082 .Ql .Fn
1084 .Ql .Xr
1085 impose an order on their argument lists.
1086 All content macros are capable of recognizing and properly handling
1087 punctuation, provided each punctuation character is separated by a leading
1088 space.
1089 If a command is given:
1091 .Dl \&.Ar sptr, ptr),
1093 The result is:
1095 .Dl Ar sptr, ptr),
1097 The punctuation is not recognized and all is output in the
1098 font used by
1099 .Ql .Ar .
1100 If the punctuation is separated by a leading white space:
1102 .Dl \&.Ar "sptr , ptr ) ,"
1104 The result is:
1106 .Dl Ar sptr , ptr ) ,
1108 The punctuation is now recognized and output in the default font
1109 distinguishing it from the argument strings.
1110 To remove the special meaning from a punctuation character escape it with
1111 .Ql \e& .
1113 The following punctuation characters are recognized by
1114 .Nm \-mdoc :
1116 .Bl -column -offset indent-two XXXXXX XXXXXX XXXXXX XXXXXX
1117 .It Li .\& Ta Li ,\& Ta Li :\& Ta Li ;\& Ta Li (\&
1118 .It Li )\& Ta Li [\& Ta Li ]\& Ta Li ?\& Ta Li !\&
1122 .Xr Troff
1123 is limited as a macro language, and has difficulty when presented with a
1124 string containing a member of the mathematical, logical or quotation set:
1126 .Bd -literal -offset indent-two
1127 {+,\-,/,*,%,<,>,<=,>=,=,==,&,`,',"}
1131 The problem is that
1132 .Xr troff
1133 may assume it is supposed to actually perform the operation or evaluation
1134 suggested by the characters.
1135 To prevent the accidental evaluation of these characters, escape them with
1136 .Ql \e& .
1137 Typical syntax is shown in the first content macro displayed below,
1138 .Ql .Ad .
1141 .Sh "MANUAL DOMAIN"
1143 .Ss Addresses
1145 The address macro identifies an address construct.
1147 .Dl Usage: .Ad Ao address Ac ...
1149 .Bl -tag -width ".Li .Ad\ f1\ ,\ f2\ ,\ f3\ :" -compact -offset 15n
1150 .It Li ".Ad addr1"
1151 .Ad addr1
1152 .It Li ".Ad addr1 ."
1153 .Ad addr1 .
1154 .It Li ".Ad addr1 , file2"
1155 .Ad addr1 , file2
1156 .It Li ".Ad f1 , f2 , f3 :"
1157 .Ad f1 , f2 , f3 :
1158 .It Li ".Ad addr ) ) ,"
1159 .Ad addr ) ) ,
1163 The default width is 12n.
1165 .Ss "Author Name"
1168 .Ql .An
1169 macro is used to specify the name of the author of the item being
1170 documented, or the name of the author of the actual manual page.
1172 .Dl Usage: .An Ao author name Ac ...
1174 .Bl -tag -width ".Li .An\ \*[q]Joe\ Author\*[q]\ )\ )\ ," -offset 15n
1175 .It Li ".An \*[q]Joe Author\*[q]"
1176 .An "Joe Author"
1177 .It Li ".An \*[q]Joe Author\*[q] ,"
1178 .An "Joe Author" ,
1179 .It Li ".An \*[q]Joe Author\*[q] Aq nobody@FreeBSD.org"
1180 .An "Joe Author" Aq nobody@FreeBSD.org
1181 .It Li ".An \*[q]Joe Author\*[q] ) ) ,"
1182 .An "Joe Author" ) ) ,
1186 The default width is 12n.
1188 In the
1189 .Sx AUTHORS
1190 section, the
1191 .Ql .An
1192 command causes a line break allowing each new name to appear on its own
1193 line.
1194 If this is not desirable,
1196 .Bd -literal -offset indent
1197 \&.An -nosplit
1201 call will turn this off.
1202 To turn splitting back on, write
1204 .Bd -literal -offset indent
1205 \&.An -split
1208 .Ss "Arguments"
1211 .Li .Ar
1212 argument macro may be used whenever an argument is referenced.
1213 If called without arguments, the
1214 .Sq Ar
1215 string is output.
1217 .Dl Usage: .Ar Oo Ao argument Ac Oc ...
1219 .Bl -tag -width ".Li .Ar\ file1\ file2" -compact -offset 15n
1220 .It Li .Ar
1222 .It Li ".Ar file1"
1223 .Ar file1
1224 .It Li ".Ar file1 ."
1225 .Ar file1 .
1226 .It Li ".Ar file1 file2"
1227 .Ar file1 file2
1228 .It Li ".Ar f1 f2 f3 :"
1229 .Ar f1 f2 f3 :
1230 .It Li ".Ar file ) ) ,"
1231 .Ar file ) ) ,
1235 The default width is 12n.
1237 .Ss "Configuration Declaration (Section Four Only)"
1240 .Ql .Cd
1241 macro is used to demonstrate a
1242 .Xr config 8
1243 declaration for a device interface in a section four manual.
1245 .Dl Usage: .Cd Ao argument Ac ...
1247 .Bl -tag -width ".Li .Cd\ Xdevice\ le0\ at\ scode?X" -offset 15n
1248 .It Li ".Cd \*[q]device le0 at scode?\*[q]"
1249 .Cd "device le0 at scode?"
1252 In the
1253 .Sx SYNOPSIS
1254 section a
1255 .Ql .Cd
1256 command causes a line break before and after its arguments are printed.
1259 The default width is 12n.
1261 .Ss "Command Modifiers"
1263 The command modifier is identical to the
1264 .Ql .Fl
1265 (flag) command with the exception that the
1266 .Ql .Cm
1267 macro does not assert a dash in front of every argument.
1268 Traditionally flags are marked by the preceding dash, however, some commands
1269 or subsets of commands do not use them.
1270 Command modifiers may also be specified in conjunction with interactive
1271 commands such as editor commands.
1273 .Sx Flags .
1275 The default width is 10n.
1277 .Ss "Defined Variables"
1279 A variable (or constant) which is defined in an include file
1280 is specified by the macro
1281 .Ql .Dv .
1283 .Dl Usage: .Dv Ao defined variable Ac ...
1285 .Bl -tag -width ".Li .Dv\ MAXHOSTNAMELEN" -compact -offset 15n
1286 .It Li ".Dv MAXHOSTNAMELEN"
1287 .Dv MAXHOSTNAMELEN
1288 .It Li ".Dv TIOCGPGRP )"
1289 .Dv TIOCGPGRP )
1293 The default width is 12n.
1295 .Ss Errno's
1298 .Ql .Er
1299 errno macro specifies the error return value for section 2, 3, and\~9 library
1300 routines.
1301 The second example below shows
1302 .Ql .Er
1303 used with the
1304 .Ql .Bq
1305 general text domain macro, as it would be used in a section two manual page.
1307 .Dl Usage: .Er Ao errno type Ac ...
1309 .Bl -tag -width ".Li .Bq\ Er\ ENOTDIR" -compact -offset 15n
1310 .It Li ".Er ENOENT"
1311 .Er ENOENT
1312 .It Li ".Er ENOENT ) ;"
1313 .Er ENOENT ) ;
1314 .It Li ".Bq Er ENOTDIR"
1315 .Bq Er ENOTDIR
1319 The default width is 17n.
1321 .Ss "Environment Variables"
1324 .Ql .Ev
1325 macro specifies an environment variable.
1327 .Dl Usage: .Ev Ao argument Ac ...
1329 .Bl -tag -width ".Li .Ev\ PRINTER\ )\ )\ ," -compact -offset 15n
1330 .It Li ".Ev DISPLAY"
1331 .Ev DISPLAY
1332 .It Li ".Ev PATH ."
1333 .Ev PATH .
1334 .It Li ".Ev PRINTER ) ) ,"
1335 .Ev PRINTER ) ) ,
1339 The default width is 15n.
1341 .Ss Flags
1344 .Ql .Fl
1345 macro handles command line flags.
1346 It prepends a dash,
1347 .Ql \- ,
1348 to the flag.
1349 For interactive command flags, which are not prepended with a dash, the
1350 .Ql .Cm
1351 (command modifier)
1352 macro is identical, but without the dash.
1354 .Dl Usage: .Fl Ao argument Ac ...
1356 .Bl -tag -width ".Li .Fl\ xyz\ )\ ," -compact -offset 15n
1357 .It Li .Fl
1359 .It Li ".Fl cfv"
1360 .Fl cfv
1361 .It Li ".Fl cfv ."
1362 .Fl cfv .
1363 .It Li ".Cm cfv ."
1364 .Cm cfv .
1365 .It Li ".Fl s v t"
1366 .Fl s v t
1367 .It Li ".Fl \- ,"
1368 .Fl \- ,
1369 .It Li ".Fl xyz ) ,"
1370 .Fl xyz ) ,
1371 .It Li ".Fl |"
1372 .Fl |
1376 .Ql .Fl
1377 macro without any arguments results in a dash representing stdin/stdout.
1378 Note that giving
1379 .Ql .Fl
1380 a single dash will result in two dashes.
1382 The default width is 12n.
1384 .Ss "Function Declarations"
1387 .Ql .Fd
1388 macro is used in the
1389 .Sx SYNOPSIS
1390 section with section two or three functions.
1391 It is neither callable nor parsed.
1393 .Dl Usage: .Fd Ao argument Ac ...
1395 .Bl -tag -width ".Li .Fd\ X#include\ <sys/types.h>X" -compact -offset 15n
1396 .It Li ".Fd \*[q]#include <sys/types.h>\*[q]"
1397 .Fd "#include <sys/types.h>"
1400 In the
1401 .Sx SYNOPSIS
1402 section a
1403 .Ql .Fd
1404 command causes a line break if a function has already been presented and a
1405 break has not occurred.
1406 This leaves a nice vertical space in between the previous function call and
1407 the declaration for the next function.
1411 .Ql .In
1412 macro, while in the
1413 .Sx SYNOPSIS
1414 section, represents the
1415 .Li #include
1416 statement, and is the short form of the above example.
1417 It specifies the C\~header file as being included in a C\~program.
1418 It also causes a line break.
1420 While not in the
1421 .Sx SYNOPSIS
1422 section, it represents the header file enclosed in angle brackets.
1424 .Dl Usage: .In Ao header file Ac
1426 .Bl -tag -width ".Li .In\ stdio.h" -compact -offset 15n
1427 .nr in-synopsis-section 1
1428 .It Li ".In stdio.h"
1429 .In stdio.h
1430 .nr in-synopsis-section 0
1431 .It Li ".In stdio.h"
1432 .In stdio.h
1435 .Ss "Function Types"
1437 This macro is intended for the
1438 .Sx SYNOPSIS
1439 section.
1440 It may be used anywhere else in the man page without problems, but its main
1441 purpose is to present the function type in kernel normal form for the
1442 .Sx SYNOPSIS
1443 of sections two and three (it causes a line break, allowing the function
1444 name to appear on the next line).
1446 .Dl Usage: .Ft Ao type Ac ...
1448 .Bl -tag -width ".Li .Ft\ struct\ stat" -compact -offset 15n
1449 .It Li ".Ft struct stat"
1450 .Ft struct stat
1453 .Ss "Functions (Library Routines)"
1455 The 
1456 .Ql .Fn
1457 macro is modeled on
1458 .Tn ANSI\~C
1459 conventions.
1461 .Dl Usage: .Fn Ao function Ac Oo Ao parameter Ac Oc ...
1463 .Bl -tag -width ".Li .Fn\ align\ Xchar\ *ptrX\ ," -compact -offset 15n
1464 .It Li ".Fn getchar"
1465 .Fn getchar
1466 .It Li ".Fn strlen ) ,"
1467 .Fn strlen ) ,
1468 .It Li ".Fn align \*[q]char *ptr\*[q] ,"
1469 .Fn align "char *ptr" ,
1472 Note that any call to another macro signals the end of the
1473 .Ql .Fn
1474 call (it will insert a closing parenthesis at that point).
1476 For functions with many parameters (which is rare), the macros
1477 .Ql .Fo
1478 (function open)
1480 .Ql .Fc
1481 (function close)
1482 may be used with
1483 .Ql .Fa
1484 (function argument).
1486 Example:
1488 .Bd -literal -offset indent
1489 \&.Ft int
1490 \&.Fo res_mkquery
1491 \&.Fa "int op"
1492 \&.Fa "char *dname"
1493 \&.Fa "int class"
1494 \&.Fa "int type"
1495 \&.Fa "char *data"
1496 \&.Fa "int datalen"
1497 \&.Fa "struct rrec *newrr"
1498 \&.Fa "char *buf"
1499 \&.Fa "int buflen"
1500 \&.Fc
1504 Produces:
1506 .Bd -ragged -offset indent
1507 .Ft int
1508 .Fo res_mkquery
1509 .Fa "int op"
1510 .Fa "char *dname"
1511 .Fa "int class"
1512 .Fa "int type"
1513 .Fa "char *data"
1514 .Fa "int datalen"
1515 .Fa "struct rrec *newrr"
1516 .Fa "char *buf"
1517 .Fa "int buflen"
1522 In the
1523 .Sx SYNOPSIS
1524 section, the function will always begin at the beginning of line.
1525 If there is more than one function presented in the
1526 .Sx SYNOPSIS
1527 section and a function type has not been given, a line break will occur,
1528 leaving a nice vertical space between the current function name and the one
1529 prior.
1531 The default width values of
1532 .Ql .Fn
1534 .Ql .Fo
1535 are 12n and 16n, respectively.
1537 .Ss "Function Arguments"
1540 .Ql .Fa
1541 macro is used to refer to function arguments (parameters) outside of the
1542 .Sx SYNOPSIS
1543 section of the manual or inside the
1544 .Sx SYNOPSIS
1545 section if the enclosure macros
1546 .Ql .Fo
1548 .Ql .Fc
1549 instead of
1550 .Ql .Fn
1551 are used.
1552 .Ql .Fa
1553 may also be used to refer to structure members.
1555 .Dl Usage: .Fa Ao function argument Ac ...
1557 .Bl -tag -width ".Li .Fa\ d_namlen\ )\ )\ ," -compact -offset 15n
1558 .It Li ".Fa d_namlen ) ) ,"
1559 .Fa d_namlen ) ) ,
1560 .It Li ".Fa iov_len"
1561 .Fa iov_len
1565 The default width is 12n.
1567 .Ss "Return Values"
1570 .Ql .Rv
1571 macro generates text for use in the
1572 .Sx RETURN VALUES
1573 section.
1575 .Dl Usage: .Rv Oo -std Oc Op Ao function Ac ...
1577 For example,
1578 .Ql ".Rv -std atexit"
1579 produces:
1581 .Bd -ragged -offset -indent
1582 \# a small hack to suppress a warning message
1583 .ds section-old "\*[section]
1584 .ds section 3
1585 .Rv -std atexit
1586 .ds section "\*[section-old]
1591 .Fl std
1592 option is valid only for manual page sections\~2 and\~3.
1593 Currently, this macro does nothing if used without the
1594 .Fl std
1595 flag.
1597 .Ss "Exit Status"
1600 .Ql .Ex
1601 macro generates text for use in the
1602 .Sx DIAGNOSTICS
1603 section.
1605 .Dl Usage: .Ex Oo -std Oc Op Ao utility Ac ...
1607 For example,
1608 .Ql ".Ex -std cat"
1609 produces:
1611 .Bd -ragged -offset -indent
1612 \# a small hack to suppress a warning message
1613 .ds section-old "\*[section]
1614 .ds section 1
1615 .Ex -std cat
1616 .ds section "\*[section-old]
1621 .Fl std
1622 option is valid only for manual page sections 1, 6 and\~8.
1623 Currently, this macro does nothing if used without the
1624 .Fl std
1625 flag.
1627 .Ss "Interactive Commands"
1630 .Ql .Ic
1631 macro designates an interactive or internal command.
1633 .Dl Usage: .Ic Ao argument Ac ...
1635 .Bl -tag -width ".Li .Ic\ setenv\ ,\ unsetenv" -compact -offset 15n
1636 .It Li ".Ic :wq"
1637 .Ic :wq
1638 .It Li ".Ic \*[q]do while {...}\*[q]"
1639 .Ic "do while {...}"
1640 .It Li ".Ic setenv , unsetenv"
1641 .Ic setenv , unsetenv
1645 The default width is 12n.
1647 .Ss "Library Names"
1650 .Ql .Lb
1651 macro is used to specify the library where a particular function is compiled
1654 .Dl Usage: .Lb Ao argument Ac ...
1656 Available arguments to
1657 .Ql .Lb 
1658 and their results are:
1661 .Bl -tag -width ".Li libossaudio" -compact -offset indent
1662 .It Li libarm
1663 .Lb libarm
1664 .It Li libarm32
1665 .Lb libarm32
1666 .It Li libc
1667 .Lb libc
1668 .It Li libcdk
1669 .Lb libcdk
1670 .It Li libcompat
1671 .Lb libcompat
1672 .It Li libcrypt
1673 .Lb libcrypt
1674 .It Li libcurses
1675 .Lb libcurses
1676 .It Li libedit
1677 .Lb libedit
1678 .It Li libevent
1679 .Lb libevent
1680 .It Li libform
1681 .Lb libform
1682 .It Li libi386
1683 .Lb libi386
1684 .It Li libintl
1685 .Lb libintl
1686 .It Li libipsec
1687 .Lb libipsec
1688 .It Li libkvm
1689 .Lb libkvm
1690 .It Li libm
1691 .Lb libm
1692 .It Li libm68k
1693 .Lb libm68k
1694 .It Li libmagic
1695 .Lb libmagic
1696 .It Li libmenu
1697 .Lb libmenu
1698 .It Li libossaudio
1699 .Lb libossaudio
1700 .It Li libpam
1701 .Lb libpam
1702 .It Li libpcap
1703 .Lb libpcap
1704 .It Li libpci
1705 .Lb libpci
1706 .It Li libpmc
1707 .Lb libpmc
1708 .It Li libposix
1709 .Lb libposix
1710 .It Li libpthread
1711 .Lb libpthread
1712 .It Li libresolv
1713 .Lb libresolv
1714 .It Li librt
1715 .Lb librt
1716 .It Li libtermcap
1717 .Lb libtermcap
1718 .It Li libusbhid
1719 .Lb libusbhid
1720 .It Li libutil
1721 .Lb libutil
1722 .It Li libx86_64
1723 .Lb libx86_64
1724 .It Li libz
1725 .Lb libz
1729 Local, OS-specific additions might be found in the file
1730 .Pa mdoc.local ;
1731 look for strings named
1732 .Ql str-Lb-XXX .
1733 .Ql XXX
1734 then denotes the keyword to be used with the
1735 .Ql .Lb
1736 macro.
1738 In the
1739 .Sx LIBRARY
1740 section an
1741 .Ql .Lb
1742 command causes a line break before and after its arguments are printed.
1745 .Ss Literals
1748 .Ql .Li
1749 literal macro may be used for special characters, variable constants, etc.\&
1750 -- anything which should be displayed as it would be typed.
1752 .Dl Usage: .Li Ao argument Ac ...
1754 .Bl -tag -width ".Li .Li\ cntrl-D\ )\ ,"  -compact -offset 15n
1755 .It Li ".Li \een"
1756 .Li \en
1757 .It Li ".Li M1 M2 M3 ;"
1758 .Li M1 M2 M3 ;
1759 .It Li ".Li cntrl-D ) ,"
1760 .Li cntrl-D ) ,
1761 .It Li ".Li 1024 ..."
1762 .Li 1024 ...
1766 The default width is 16n.
1768 .Ss Names
1771 .Ql .Nm
1772 macro is used for the document title or subject name.
1773 It has the peculiarity of remembering the first argument it was called with,
1774 which should always be the subject name of the page.
1775 When called without arguments,
1776 .Ql .Nm
1777 regurgitates this initial name for the sole purpose of making less work for
1778 the author.
1779 Note: A section two or three document function name is addressed with the
1780 .Ql .Nm
1781 in the
1782 .Sx NAME
1783 section, and with
1784 .Ql .Fn
1785 in the
1786 .Sx SYNOPSIS
1787 and remaining sections.
1788 For interactive commands, such as the
1789 .Ql while
1790 command keyword in
1791 .Xr csh 1 ,
1793 .Ql .Ic
1794 macro should be used.
1795 While
1796 .Ql .Ic
1797 is nearly identical
1799 .Ql .Nm ,
1800 it can not recall the first argument it was invoked with.
1802 .Dl Usage: .Nm Oo Ao argument Ac Oc ...
1804 .Bl -tag -width ".Li .Nm\ groff_mdoc" -compact -offset 15n
1805 .It Li ".Nm groff_mdoc"
1806 .Nm groff_mdoc
1807 .It Li ".Nm \e-mdoc"
1808 .Nm \-mdoc
1809 .It Li ".Nm foo ) ) ,"
1810 .Nm foo ) ) ,
1811 .It Li ".Nm :"
1812 .Nm :
1816 The default width is 10n.
1818 .Ss Options
1821 .Ql .Op
1822 macro places option brackets around any remaining arguments on the
1823 command line, and places any trailing punctuation outside the brackets.
1824 The macros
1825 .Ql .Oo
1827 .Ql .Oc
1828 (which produce an opening and a closing option bracket respectively) may be used
1829 across one or more lines or to specify the exact position of the closing
1830 parenthesis.
1832 .Dl Usage: .Op Oo Ao option Ac Oc ...
1834 .Bl -tag -width ".Li .Op\ Fl\ c\ Ar\ objfil\ Op\ Ar\ corfil\ ," -compact -offset 15n
1835 .It Li .Op
1837 .It Li ".Op Fl k"
1838 .Op Fl k
1839 .It Li ".Op Fl k ) ."
1840 .Op Fl k ) .
1841 .It Li ".Op Fl k Ar kookfile"
1842 .Op Fl k Ar kookfile
1843 .It Li ".Op Fl k Ar kookfile ,"
1844 .Op Fl k Ar kookfile ,
1845 .It Li ".Op Ar objfil Op Ar corfil"
1846 .Op Ar objfil Op Ar corfil
1847 .It Li ".Op Fl c Ar objfil Op Ar corfil ,"
1848 .Op Fl c Ar objfil Op Ar corfil ,
1849 .It Li ".Op word1 word2"
1850 .Op word1 word2
1851 .It Li ".Li .Op Oo Ao option Ac Oc ..."
1852 .Li .Op Oo Ao options Ac Oc ...
1855 Here a typical example of the
1856 .Ql .Oo
1858 .Ql .Oc
1859 macros:
1861 .Bd -literal -offset indent
1862 \&.Oo
1863 \&.Op Fl k Ar kilobytes
1864 \&.Op Fl i Ar interval
1865 \&.Op Fl c Ar count
1866 \&.Oc
1870 Produces:
1872 .Bd -filled -offset indent
1874 .Op Fl k Ar kilobytes
1875 .Op Fl i Ar interval
1876 .Op Fl c Ar count
1881 The default width values of
1882 .Ql .Op
1884 .Ql .Oo
1885 are 14n and 10n, respectively.
1887 .Ss Pathnames
1890 .Ql .Pa
1891 macro formats path or file names.
1892 If called without arguments, the
1893 .Sq Pa
1894 string is output, which represents the current user's home directory.
1896 .Dl Usage: .Pa Oo Ao pathname Ac Oc ...
1898 .Bl -tag -width ".Li .Pa\ /tmp/fooXXXXX\ )\ ." -compact -offset 15n
1899 .It Li .Pa
1901 .It Li ".Pa /usr/share"
1902 .Pa /usr/share
1903 .It Li ".Pa /tmp/fooXXXXX ) ."
1904 .Pa /tmp/fooXXXXX ) .
1908 The default width is 32n.
1910 .Ss Standards
1913 .Ql .St
1914 macro replaces standard abbreviations with their formal names.
1916 .Dl Usage: .St Ao abbreviation Ac ...
1918 Available pairs for
1919 .Dq Abbreviation/Formal Name
1920 are:
1923 .Tn ANSI/ISO C
1925 .Bl -tag -width ".Li -iso9945-1-90" -compact -offset indent
1926 .It Li -ansiC
1927 .St -ansiC
1928 .It Li -ansiC-89
1929 .St -ansiC-89
1930 .It Li -isoC
1931 .St -isoC
1932 .It Li -isoC-90
1933 .St -isoC-90
1934 .It Li -isoC-99
1935 .St -isoC-99
1939 .Tn POSIX
1940 Part 1: System API
1942 .Bl -tag -width ".Li -p1003.1g-2000" -compact -offset indent
1943 .It Li -iso9945-1-90
1944 .St -iso9945-1-90
1945 .It Li -iso9945-1-96
1946 .St -iso9945-1-96
1947 .It Li -p1003.1
1948 .St -p1003.1
1949 .It Li -p1003.1-88
1950 .St -p1003.1-88
1951 .It Li -p1003.1-90
1952 .St -p1003.1-90
1953 .It Li -p1003.1-96
1954 .St -p1003.1-96
1955 .It Li -p1003.1b-93
1956 .St -p1003.1b-93
1957 .It Li -p1003.1c-95
1958 .St -p1003.1c-95
1959 .It Li -p1003.1g-2000
1960 .St -p1003.1g-2000
1961 .It Li -p1003.1i-95
1962 .St -p1003.1i-95
1963 .It Li -p1003.1-2001
1964 .St -p1003.1-2001
1965 .It Li -p1003.1-2004
1966 .St -p1003.1-2004
1970 .Tn POSIX
1971 Part 2: Shell and Utilities
1973 .Bl -tag -width ".Li -p1003.1g-2000" -compact -offset indent
1974 .It Li -iso9945-2-93
1975 .St -iso9945-2-93
1976 .It Li -p1003.2
1977 .St -p1003.2
1978 .It Li -p1003.2-92
1979 .St -p1003.2-92
1980 .It Li -p1003.2a-92
1981 .St -p1003.2a-92
1985 X/Open
1986 .Bl -tag -width ".Li -p1003.1g-2000" -compact -offset indent
1988 .It Li -susv2
1989 .St -susv2
1990 .It Li -svid4
1991 .St -svid4
1992 .It Li -xbd5
1993 .St -xbd5
1994 .It Li -xcu5
1995 .St -xcu5
1996 .It Li -xcurses4.2
1997 .St -xcurses4.2
1998 .It Li -xns5
1999 .St -xns5
2000 .It Li -xns5.2
2001 .St -xns5.2
2002 .It Li -xpg3
2003 .St -xpg3
2004 .It Li -xpg4
2005 .St -xpg4
2006 .It Li -xpg4.2
2007 .St -xpg4.2
2008 .It Li -xsh5
2009 .St -xsh5
2013 Miscellaneous
2015 .Bl -tag -width ".Li -p1003.1g-2000" -compact -offset indent
2016 .It Li -ieee754
2017 .St -ieee754
2018 .It Li -iso8802-3
2019 .St -iso8802-3
2022 .Ss "Variable Types"
2025 .Ql .Vt
2026 macro may be used whenever a type is referenced.
2027 In the
2028 .Sx SYNOPSIS
2029 section, it causes a line break (useful for old style variable declarations).
2031 .Dl Usage: .Vt Ao type Ac ...
2033 .Bl -tag -width ".Li .Vt\ extern\ char\ *optarg\ ;" -compact -offset 15n
2034 .It Li ".Vt extern char *optarg ;"
2035 .Vt extern char *optarg ;
2036 .It Li ".Vt FILE *"
2037 .Vt FILE *
2040 .Ss Variables
2042 Generic variable reference.
2044 .Dl Usage: .Va Ao variable Ac ...
2046 .Bl -tag -width ".Li .Va\ Xchar\ sX\ ]\ )\ )\ ," -compact -offset 15n
2047 .It Li ".Va count"
2048 .Va count
2049 .It Li ".Va settimer ,"
2050 .Va settimer ,
2051 .It Li ".Va \*[q]int *prt\*[q] ) :"
2052 .Va "int *prt" ) :
2053 .It Li ".Va \*[q]char s\*[q] ] ) ) ,"
2054 .Va "char s" ] ) ) ,
2058 The default width is 12n.
2060 .Ss "Manual Page Cross References"
2063 .Ql .Xr
2064 macro expects the first argument to be a manual page name.
2065 The optional second argument, if a string (defining the manual section), is
2066 put into parentheses.
2068 .Dl Usage: .Xr Ao man page name Ac Oo Ao section Ac Oc ...
2070 .Bl -tag -width ".Li .Xr\ xinit\ 1x\ ;" -compact -offset 15n
2071 .It Li ".Xr mdoc"
2072 .Xr mdoc
2073 .It Li ".Xr mdoc ,"
2074 .Xr mdoc ,
2075 .It Li ".Xr mdoc 7"
2076 .Xr mdoc 7
2077 .It Li ".Xr xinit 1x ;"
2078 .Xr xinit 1x ;
2082 The default width is 10n.
2085 .Sh "GENERAL TEXT DOMAIN"
2087 .Ss "AT&T Macro"
2090 .Dl Usage: .At Oo Ao version Ac Oc ...
2092 .Bl -tag -width ".Li .At\ v6\ ." -compact -offset 15n
2093 .It Li .At
2095 .It Li ".At v6 ."
2096 .At v6 .
2099 The following values for
2100 .Ao version Ac
2101 are possible:
2103 .Dl 32v, v1, v2, v3, v4, v5, v6, v7, V, V.1, V.2, V.3, V.4
2105 .Ss "BSD Macro"
2108 .Dl "Usage: .Bx" Bro -alpha | -beta | -devel Brc ...
2109 .Dl "       .Bx" Oo Ao version Ac Oo Ao release Ac Oc Oc ...
2111 .Bl -tag -width ".Li .Bx\ -devel" -compact -offset 15n
2112 .It Li .Bx
2114 .It Li ".Bx 4.3 ."
2115 .Bx 4.3 .
2116 .It Li ".Bx \-devel"
2117 .Bx -devel
2120 .Ao version Ac
2121 will be prepended to the string
2122 .Sq Bx .
2123 The following values for
2124 .Ao release Ac
2125 are possible:
2127 .Dl Reno, reno, Tahoe, tahoe, Lite, lite, Lite2, lite2
2129 .Ss "NetBSD Macro"
2132 .Dl Usage: .Nx Oo Ao version Ac Oc ...
2134 .Bl -tag -width ".Li .Nx\ 1.4\ ." -compact -offset 15n
2135 .It Li .Nx
2137 .It Li ".Nx 1.4 ."
2138 .Nx 1.4 .
2141 For possible values of
2142 .Ao version Ac
2143 see the description of the
2144 .Ql .Os
2145 command above in section
2146 .Sx "TITLE MACROS" .
2148 .Ss "FreeBSD Macro"
2151 .Dl Usage: .Fx Oo Ao version Ac Oc ...
2153 .Bl -tag -width ".Li .Fx\ 2.2\ ." -compact -offset 15n
2154 .It Li .Fx
2156 .It Li ".Fx 2.2 ."
2157 .Fx 2.2 .
2160 For possible values of
2161 .Ao version Ac
2162 see the description of the
2163 .Ql .Os
2164 command above in section
2165 .Sx "TITLE MACROS" .
2167 .Ss "OpenBSD Macro"
2170 .Dl Usage: .Ox Oo Ao version Ac Oc ...
2172 .Bl -tag -width ".Li .Ox\ 1.0" -compact -offset 15n
2173 .It Li ".Ox 1.0"
2174 .Ox 1.0
2177 .Ss "BSD/OS Macro"
2180 .Dl Usage: .Bsx Oo Ao version Ac Oc ...
2182 .Bl -tag -width ".Li .Bsx\ 1.0" -compact -offset 15n
2183 .It Li ".Bsx 1.0"
2184 .Bsx 1.0
2187 .Ss "UNIX Macro"
2190 .Dl Usage: .Ux ...
2192 .Bl -tag -width ".Li .Ux" -compact -offset 15n
2193 .It Li .Ux
2197 .Ss "Emphasis Macro"
2199 Text may be stressed or emphasized with the
2200 .Ql .Em
2201 macro.
2202 The usual font for emphasis is italic.
2204 .Dl Usage: .Em Ao argument Ac ...
2206 .Bl -tag -width ".Li .Em\ vide\ infra\ )\ )\ ," -compact -offset 15n
2207 .It Li ".Em does not"
2208 .Em does not
2209 .It Li ".Em exceed 1024 ."
2210 .Em exceed 1024 .
2211 .It Li ".Em vide infra ) ) ,"
2212 .Em vide infra ) ) ,
2216 The default width is 10n.
2218 .Ss "Font Mode"
2221 .Ql .Bf
2222 font mode must be ended with the
2223 .Ql .Ef
2224 macro (the latter takes no arguments).
2225 Font modes may be nested within other font modes.
2227 .Ql .Bf
2228 has the following syntax:
2230 .Dl .Bf Ao font mode Ac
2232 .Ao font mode Ac
2233 must be one of the following three types:
2235 .Bl -tag -width ".Sy \&Sy | Fl symbolic" -compact -offset indent
2236 .It Sy \&Em | Fl emphasis
2237 Same as if the 
2238 .Ql .Em
2239 macro was used for the entire block of text.
2240 .It Sy \&Li | Fl literal
2241 Same as if the
2242 .Ql .Li
2243 macro was used for the entire block of text.
2244 .It Sy \&Sy | Fl symbolic
2245 Same as if the
2246 .Ql .Sy
2247 macro was used for the entire block of text.
2250 Both macros are neither callable nor parsed.
2252 .Ss "Enclosure and Quoting Macros"
2254 The concept of enclosure is similar to quoting.
2255 The object being to enclose one or more strings between a pair of characters
2256 like quotes or parentheses.
2257 The terms quoting and enclosure are used interchangeably throughout this
2258 document.
2259 Most of the one-line enclosure macros end in small letter
2260 .Ql q
2261 to give a hint of quoting, but there are a few irregularities.
2262 For each enclosure macro there is also a pair of open and close macros which
2263 end in small letters
2264 .Ql o
2266 .Ql c
2267 respectively.
2269 \# XXX
2270 .if t \
2271 .  ne 10
2273 .Bd -filled -offset 4n
2274 .Bl -column "quote" "close" "open" "Angle Bracket Enclosure" "`string' or string"
2275 .Em Quote Ta Em Open Ta Em Close Ta Em Function               Ta Em Result
2276 .No .Aq   Ta    .Ao  Ta    .Ac   Ta "Angle Bracket Enclosure" Ta Ao string Ac
2277 .No .Bq   Ta    .Bo  Ta    .Bc   Ta "Bracket Enclosure"       Ta Bo string Bc
2278 .No .Brq  Ta    .Bro Ta    .Brc  Ta "Brace Enclosure"         Ta Bro string Brc
2279 .No .Dq   Ta    .Do  Ta    .Dc   Ta "Double Quote"            Ta Do string Dc
2280 .No .Eq   Ta    .Eo  Ta    .Ec   Ta "Enclose String (in XX)"  Ta XXstringXX
2281 .No .Pq   Ta    .Po  Ta    .Pc   Ta "Parenthesis Enclosure"   Ta Po string Pc
2282 .No .Ql   Ta         Ta          Ta "Quoted Literal"          Ta So string Sc or Li string
2283 .No .Qq   Ta    .Qo  Ta    .Qc   Ta "Straight Double Quote"   Ta Qo string Qc
2284 .No .Sq   Ta    .So  Ta    .Sc   Ta "Single Quote"            Ta So string Sc
2288 All macros ending with
2289 .Sq q
2291 .Sq o
2292 have a default width value of 12n.
2294 .Bl -tag -width ".Li .Ec , .Eo"
2295 .It Li .Eo , .Ec
2296 These macros expect the first argument to be the opening and closing strings
2297 respectively.
2298 .It Li .Es , .En
2299 Due to the nine-argument limit in the original troff program two other
2300 macros have been implemented which are now rather obsolete:
2301 .Ql .Es
2302 takes the first and second parameter as the left and right enclosure string,
2303 which are then used to enclose the arguments of
2304 .Ql .En .
2305 The default width value is 12n for both macros.
2306 .It Li .Eq
2307 The first and second arguments of this macro are the opening and
2308 closing strings respectively, followed by the arguments to be enclosed.
2309 .It Li .Ql
2310 The quoted literal macro behaves differently in troff and nroff mode.
2311 If formatted with
2312 .Xr nroff ,
2313 a quoted literal is always quoted.
2314 If formatted with troff, an item is only quoted if the width of the item is
2315 less than three constant width characters.
2316 This is to make short strings more visible where the font change to literal
2317 (constant width) is less noticeable.
2319 The default width is 16n.
2320 .It Li .Pf
2321 The prefix macro suppresses the whitespace between its first and second
2322 argument:
2324 .Bl -tag -width ".Li .Pf\ (\ Fa\ name2" -offset indent
2325 .It Li ".Pf ( Fa name2"
2326 .Pf ( Fa name2
2330 The default width is 12n.
2333 .Ql .Ns
2334 macro (see below) performs the analogous suffix function.
2335 .It Li .Ap
2337 .Ql .Ap
2338 macro inserts an apostrophe and exits any special text modes, continuing in
2339 .Ql .No
2340 mode.
2344 Examples of quoting:
2347 .Bl -tag -width ".Li .Bq\ Em\ Greek\ ,\ French\ ." -compact -offset indent
2348 .It Li .Aq
2350 .It Li ".Aq Pa ctype.h ) ,"
2351 .Aq Pa ctype.h ) ,
2352 .It Li .Bq
2354 .It Li ".Bq Em Greek , French ."
2355 .Bq Em Greek , French .
2356 .It Li .Dq
2358 .It Li ".Dq string abc ."
2359 .Dq string abc .
2360 .It Li ".Dq \'^[A-Z]\'"
2361 .Dq \'^[A-Z]\'
2362 .It Li ".Ql man mdoc"
2363 .Ql man mdoc
2364 .It Li .Qq
2366 .It Li ".Qq string ) ,"
2367 .Qq string ) ,
2368 .It Li ".Qq string Ns ),"
2369 .Qq string Ns ),
2370 .It Li .Sq
2372 .It Li ".Sq string"
2373 .Sq string
2374 .It Li ".Em or Ap ing"
2375 .Em or Ap ing
2379 For a good example of nested enclosure macros, see the
2380 .Ql .Op
2381 option macro.
2382 It was created from the same underlying enclosure macros as those presented
2383 in the list above.
2385 .Ql .Xo
2387 .Ql .Xc
2388 extended argument list macros are discussed below.
2390 .Ss "No-Op or Normal Text Macro"
2393 .Ql .No
2394 macro can be used in a macro command line for parameters which should
2395 .Em not
2396 be formatted.
2397 Be careful to add
2398 .Ql \e&
2399 to the word
2400 .Ql \&No
2401 if you really want that English word (and not the macro) as a parameter.
2403 .Dl Usage: .No Ao argument Ac ...
2405 .Bl -tag -width ".Li .No\ test\ Ta\ with\ Ta\ tabs" -compact -offset 15n
2406 .It Li ".No test Ta with Ta tabs"
2407 .No test Ta with Ta tabs
2411 The default width is 12n.
2413 .Ss "No-Space Macro"
2416 .Ql .Ns
2417 macro suppresses insertion of a space between the current position and its
2418 first parameter.
2419 For example, it is useful for old style argument lists where there is no
2420 space between the flag and argument:
2422 .Dl "Usage:" ... Ao argument Ac \&Ns Oo Ao argument Ac Oc ...
2423 .Dl "      " .Ns Ao argument Ac ...
2425 .Bl -tag -width ".Li .Op\ Fl\ I\ Ns\ Ar\ directory" -compact -offset 15n
2426 .It Li ".Op Fl I Ns Ar directory"
2427 .Op Fl I Ns Ar directory
2430 Note: The
2431 .Ql .Ns
2432 macro always invokes the
2433 .Ql .No
2434 macro after eliminating the space unless another macro name follows it.
2435 If used as a command (i.e., the second form above in the
2436 .Sq Usage
2437 line),
2438 .Ql .Ns
2439 is identical to
2440 .Ql .No .
2442 .Ss "Section Cross References"
2445 .Ql .Sx
2446 macro designates a reference to a section header within the same document.
2448 .Dl Usage: .Sx Ao section reference Ac ...
2450 .Bl -tag -width ".Li .Sx\ FILES" -offset 15n
2451 .It Li ".Sx FILES"
2452 .Sx FILES
2456 The default width is 16n.
2458 .Ss Symbolics
2460 The symbolic emphasis macro is generally a boldface macro in either the
2461 symbolic sense or the traditional English usage.
2463 .Dl Usage: .Sy Ao symbol Ac ...
2465 .Bl -tag -width ".Li .Sy\ Important\ Notice" -compact -offset 15n
2466 .It Li ".Sy Important Notice"
2467 .Sy Important Notice
2471 The default width is 6n.
2473 .Ss Mathematical Symbols
2475 Use this macro for mathematical symbols and similar things.
2477 .Dl Usage: .Ms Ao math symbol Ac ...
2479 .Bl -tag -width ".Li .Ms\ sigma" -compact -offset 15n
2480 .It Li ".Ms sigma"
2481 .Ms sigma
2485 The default width is 6n.
2487 .Ss "References and Citations"
2489 The following macros make a modest attempt to handle references.
2490 At best, the macros make it convenient to manually drop in a subset of
2491 .Xr refer 1
2492 style references.
2494 .Bl -tag -width 6n -offset indent -compact
2495 .It Li .Rs
2496 Reference start (does not take arguments).
2497 Causes a line break in the
2498 .Sx "SEE ALSO"
2499 section and begins collection of reference information until the reference
2500 end macro is read.
2501 .It Li .Re
2502 Reference end (does not take arguments).
2503 The reference is printed.
2504 .It Li .%A
2505 Reference author name; one name per invocation.
2506 .It Li .%B
2507 Book title.
2508 .It Li .%C
2509 City/place (not implemented yet).
2510 .It Li .%D
2511 Date.
2512 .It Li .%I
2513 Issuer/publisher name.
2514 .It Li .%J
2515 Journal name.
2516 .It Li .%N
2517 Issue number.
2518 .It Li .%O
2519 Optional information.
2520 .It Li .%P
2521 Page number.
2522 .It Li .%Q
2523 Corporate or foreign author.
2524 .It Li .%R
2525 Report name.
2526 .It Li .%T
2527 Title of article.
2528 .It Li .%V
2529 Volume.
2532 Macros beginning with
2533 .Ql %
2534 are not callable but accept multiple arguments in the usual way.
2535 Only the
2536 .Ql .Tn
2537 macro is handled properly as a parameter; other macros will cause strange
2538 output.
2539 .Ql .%B
2541 .Ql .%T
2542 can be used outside of the
2543 .Ql .Rs/.Re
2544 environment.
2546 Example:
2548 .Bd -literal -offset indent
2549 \&.Rs
2550 \&.%A "Matthew Bar"
2551 \&.%A "John Foo"
2552 \&.%T "Implementation Notes on foobar(1)"
2553 \&.%R "Technical Report ABC-DE-12-345"
2554 \&.%Q "Drofnats College, Nowhere"
2555 \&.%D "April 1991"
2556 \&.Re
2559 produces
2561 .Bd -ragged -offset indent
2563 .%A "Matthew Bar"
2564 .%A "John Foo"
2565 .%T "Implementation Notes on foobar(1)"
2566 .%R "Technical Report ABC-DE-12-345"
2567 .%Q "Drofnats College, Nowhere"
2568 .%D "April 1991"
2572 .Ss "Trade Names (or Acronyms and Type Names)"
2574 The trade name macro prints its arguments in a smaller font.
2575 Its intended use is to imitate a small caps fonts for uppercase acronyms.
2577 .Dl Usage: .Tn Ao symbol Ac ...
2579 .Bl -tag -width ".Li .Tn\ ASCII" -compact -offset 15n
2580 .It Li ".Tn DEC"
2581 .Tn DEC
2582 .It Li ".Tn ASCII"
2583 .Tn ASCII
2587 The default width is 10n.
2589 .Ss "Extended Arguments"
2592 .Li .Xo
2594 .Li .Xc
2595 macros allow one to extend an argument list on a macro boundary for the
2596 .Ql .It
2597 macro (see below).
2598 Note that
2599 .Li .Xo
2601 .Li .Xc
2602 are implemented similarly to all other macros opening and closing an
2603 enclosure (without inserting characters, of course).
2604 This means that the following is true for those macros also.
2606 Here is an example of
2607 .Ql .Xo
2608 using the space mode macro to turn spacing off:
2610 .Bd -literal -offset indent
2611 \&.Sm off
2612 \&.It Xo Sy I Ar operation
2613 \&.No \een Ar count No \een
2614 \&.Xc
2615 \&.Sm on
2619 produces
2621 .Bd -filled -offset indent
2622 .Bl -tag -compact
2623 .Sm off
2624 .It Xo Sy I Ar operation
2625 .No \en Ar count No \en
2627 .Sm on
2632 Another one:
2634 .Bd -literal -offset indent
2635 \&.Sm off
2636 \&.It Cm S No / Ar old_pattern Xo
2637 \&.No / Ar new_pattern
2638 \&.No / Op Cm g
2639 \&.Xc
2640 \&.Sm on
2644 produces
2646 .Bd -filled -offset indent
2647 .Bl -tag -compact
2648 .Sm off
2649 .It Cm S No \&/ Ar old_pattern Xo
2650 .No \&/ Ar new_pattern
2651 .No \&/ Op Cm g
2653 .Sm on
2658 Another example of
2659 .Ql .Xo
2660 and enclosure macros: Test the value of a variable.
2662 .Bd -literal -offset indent
2663 \&.It Xo
2664 \&.Ic .ifndef
2665 \&.Oo \e&! Oc Ns Ar variable Oo
2666 \&.Ar operator variable ...
2667 \&.Oc Xc
2671 produces
2673 .Bd -filled -offset indent
2674 .Bl -tag -width flag -compact
2675 .It Xo
2676 .Ic .ifndef
2677 .Oo \&! Oc Ns Ar variable Oo
2678 .Ar operator variable ...
2679 .Oc Xc
2685 .Sh "PAGE STRUCTURE DOMAIN"
2687 .Ss "Section Headers"
2689 The following
2690 .Ql .Sh
2691 section header macros are required in every man page.
2692 The remaining section headers are recommended at the discretion of the
2693 author writing the manual page.
2695 .Ql .Sh
2696 macro is parsed but not generally callable.
2697 It can be used as an argument in a call to
2698 .Ql .Sh
2699 only; it then reactivates the default font for
2700 .Ql .Sh .
2702 The default width is 8n.
2704 .Bl -tag -width ".Li .Sh\ RETURN\ VALUES"
2705 .It Li ".Sh NAME"
2707 .Ql ".Sh NAME"
2708 macro is mandatory.
2709 If not specified, headers, footers and page layout defaults will not be set
2710 and things will be rather unpleasant.
2712 .Sx NAME
2713 section consists of at least three items.
2714 The first is the
2715 .Ql .Nm
2716 name macro naming the subject of the man page.
2717 The second is the name description macro,
2718 .Ql .Nd ,
2719 which separates the subject name from the third item, which is the
2720 description.
2721 The description should be the most terse and lucid possible, as the space
2722 available is small.
2724 .Ql .Nd
2725 first prints
2726 .Ql - ,
2727 then all its arguments.
2729 .It Li ".Sh LIBRARY"
2730 This section is for section two and three function calls.
2731 It should consist of a single
2732 .Ql .Lb
2733 macro call;
2735 .Sx "Library Names" .
2737 .It Li ".Sh SYNOPSIS"
2739 .Sx SYNOPSIS
2740 section describes the typical usage of the subject of a man page.
2741 The macros required are either
2742 .Ql .Nm ,
2743 .Ql .Cd ,
2745 .Ql .Fn
2746 (and possibly
2747 .Ql .Fo ,
2748 .Ql .Fc ,
2749 .Ql .Fd ,
2751 .Ql .Ft ) .
2752 The function name macro
2753 .Ql .Fn
2754 is required for manual page sections\~2 and\~3; the command and general name
2755 macro
2756 .Ql .Nm
2757 is required for sections 1, 5, 6, 7, and\~8.
2758 Section\~4 manuals require a
2759 .Ql .Nm ,
2760 .Ql .Fd
2761 or a
2762 .Ql .Cd
2763 configuration device usage macro.
2764 Several other macros may be necessary to produce the synopsis line as shown
2765 below:
2767 .Bd -filled -offset indent
2768 .Nm cat
2769 .Op Fl benstuv
2770 .Op Fl
2775 The following macros were used:
2777 .Dl ".Nm cat"
2778 .Dl ".Op Fl benstuv"
2779 .Dl ".Op Fl"
2780 .Dl .Ar
2782 .It Li ".Sh DESCRIPTION"
2783 In most cases the first text in the
2784 .Sx DESCRIPTION
2785 section is a brief paragraph on the command, function or file, followed by a
2786 lexical list of options and respective explanations.
2787 To create such a list, the
2788 .Ql .Bl
2789 (begin list),
2790 .Ql .It
2791 (list item) and
2792 .Ql .El
2793 (end list)
2794 macros are used (see
2795 .Sx Lists and Columns
2796 below).
2798 .It Li ".Sh IMPLEMENTATION NOTES"
2799 Implementation specific information should be placed here.
2801 .It Li ".Sh RETURN VALUES"
2802 Sections 2, 3 and\~9 function return values should go here.
2804 .Ql .Rv
2805 macro may be used to generate text for use in the
2806 .Sx RETURN VALUES
2807 section for most section 2 and 3 library functions;
2809 .Sx "Return Values" .
2813 The following
2814 .Ql .Sh
2815 section headers are part of the preferred manual page layout and must be
2816 used appropriately to maintain consistency.
2817 They are listed in the order in which they would be used.
2819 .Bl -tag -width ".Li .Sh\ COMPATIBILITY"
2820 .It Li ".Sh ENVIRONMENT"
2822 .Sx ENVIRONMENT
2823 section should reveal any related environment variables and clues to their
2824 behavior and/or usage.
2826 .It Li ".Sh FILES"
2827 Files which are used or created by the man page subject should be listed via
2829 .Ql .Pa
2830 macro in the
2831 .Sx FILES
2832 section.
2834 .It Li ".Sh EXAMPLES"
2835 There are several ways to create examples.
2836 See the
2837 .Sx EXAMPLES
2838 section below for details.
2840 .It Li ".Sh DIAGNOSTICS"
2841 Diagnostic messages from a command should be placed in this section.
2843 .Ql .Ex
2844 macro may be used to generate text for use in the
2845 .Sx DIAGNOSTICS
2846 section for most section 1, 6 and\~8 commands;
2848 .Sx "Exit Status" .
2850 .It Li ".Sh COMPATIBILITY"
2851 Known compatibility issues (e.g. deprecated options or parameters)
2852 should be listed here.
2854 .It Li ".Sh ERRORS"
2855 Specific error handling, especially from library functions (man page
2856 sections 2, 3, and\~9) should go here.
2858 .Ql .Er
2859 macro is used to specify an error (errno).
2861 .It Li ".Sh SEE ALSO"
2862 References to other material on the man page topic and cross references to
2863 other relevant man pages should be placed in the
2864 .Sx "SEE ALSO"
2865 section.
2866 Cross references are specified using the
2867 .Ql .Xr
2868 macro.
2869 Currently
2870 .Xr refer 1
2871 style references are not accommodated.
2873 It is recommended that the cross references are sorted on the section
2874 number, then alphabetically on the names within a section, and placed
2875 in that order and comma separated.
2876 Example:
2878 .Xr ls 1 ,
2879 .Xr ps 1 ,
2880 .Xr group 5 ,
2881 .Xr passwd 5
2883 .It Li ".Sh STANDARDS"
2884 If the command, library function or file adheres to a specific
2885 implementation such as
2886 .St -p1003.2
2888 .St -ansiC
2889 this should be noted here.
2890 If the command does not adhere to any standard, its history should be noted
2891 in the
2892 .Sx HISTORY
2893 section.
2895 .It Li ".Sh HISTORY"
2896 Any command which does not adhere to any specific standards should be
2897 outlined historically in this section.
2899 .It Li ".Sh AUTHORS"
2900 Credits should be placed here.
2902 .Ql .An
2903 macro should be used to specify the name(s) of the person(s).
2905 .It Li ".Sh BUGS"
2906 Blatant problems with the topic go here.
2910 User-specified
2911 .Ql .Sh
2912 sections may be added; for example, this section was set with:
2914 .Bd -literal -offset 15n
2915 \&.Sh "PAGE STRUCTURE DOMAIN"
2918 .Ss "Subsection Headers"
2920 Subsection headers have exactly the same syntax as section headers:
2921 .Ql .Ss
2922 is parsed but not generally callable.
2923 It can be used as an argument in a call to
2924 .Ql .Ss
2925 only; it then reactivates the default font for
2926 .Ql .Ss .
2928 The default width is 8n.
2930 .Ss "Paragraphs and Line Spacing"
2932 .Bl -tag -width ".Li .Pp"
2933 .It Li .Pp
2934 The 
2935 .Ql .Pp
2936 paragraph command may be used to specify a line space where necessary.
2937 The macro is not necessary after a
2938 .Ql .Sh
2940 .Ql .Ss
2941 macro or before a
2942 .Ql .Bl
2944 .Ql .Bd
2945 macro (which both assert a vertical distance unless the
2946 .Fl compact
2947 flag is given).
2949 The macro is neither callable nor parsed and takes no arguments; an
2950 alternative name is
2951 .Ql .Lp .
2954 .\" XXX
2956 .\" This worked with version one, need to redo for version three
2957 .\" .Pp
2958 .\" .Ds I
2959 .\" .Cw (ax+bx+c) \ is\ produced\ by\ \&
2960 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2961 .\" .Cl Cx \t\t
2962 .\" .Li \&.Cx\ (
2963 .\" .Cx
2964 .\" .Cl Cx \t\t
2965 .\" .Li \&.Va ax
2966 .\" .Cx
2967 .\" .Cl Cx \t\t
2968 .\" .Li \&.Sy \+
2969 .\" .Cx
2970 .\" .Cl Cx \&(\&
2971 .\" .Va ax
2972 .\" .Cx +
2973 .\" .Va by
2974 .\" .Cx +
2975 .\" .Va c )
2976 .\" .Cx \t
2977 .\" .Em is produced by
2978 .\" .Cx \t
2979 .\" .Li \&.Va by
2980 .\" .Cx
2981 .\" .Cl Cx \t\t
2982 .\" .Li \&.Sy \+
2983 .\" .Cx
2984 .\" .Cl Cx \t\t
2985 .\" .Li \&.Va c )
2986 .\" .Cx
2987 .\" .Cl Cx \t\t
2988 .\" .Li \&.Cx
2989 .\" .Cx
2990 .\" .Cw
2991 .\" .De
2992 .\" .Pp
2993 .\" This example shows the same equation in a different format.
2994 .\" The spaces
2995 .\" around the
2996 .\" .Li \&+
2997 .\" signs were forced with
2998 .\" .Li \e :
2999 .\" .Pp
3000 .\" .Ds I
3001 .\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&
3002 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
3003 .\" .Cl Cx \t\t
3004 .\" .Li \&.Cx\ (
3005 .\" .Cx
3006 .\" .Cl Cx \t\t
3007 .\" .Li \&.Va a
3008 .\" .Cx
3009 .\" .Cl Cx \t\t
3010 .\" .Li \&.Sy x
3011 .\" .Cx
3012 .\" .Cl Cx \t\t
3013 .\" .Li \&.Cx \e\ +\e\ \e&
3014 .\" .Cx
3015 .\" .Cl Cx \&(\&
3016 .\" .Va a
3017 .\" .Sy x
3018 .\" .Cx \ +\ \&
3019 .\" .Va b
3020 .\" .Sy y
3021 .\" .Cx \ +\ \&
3022 .\" .Va c )
3023 .\" .Cx \t
3024 .\" .Em is produced by
3025 .\" .Cl Cx \t\t
3026 .\" .Li \&.Va b
3027 .\" .Cx
3028 .\" .Cl Cx \t\t
3029 .\" .Li \&.Sy y
3030 .\" .Cx
3031 .\" .Cl Cx \t\t
3032 .\" .Li \&.Cx \e\ +\e\ \e&
3033 .\" .Cx
3034 .\" .Cl Cx \t\t
3035 .\" .Li \&.Va c )
3036 .\" .Cx
3037 .\" .Cl Cx \t\t
3038 .\" .Li \&.Cx
3039 .\" .Cx
3040 .\" .Cw
3041 .\" .De
3042 .\" .Pp
3043 .\" The incantation below was
3044 .\" lifted from the
3045 .\" .Xr adb 1
3046 .\" manual page:
3047 .\" .Pp
3048 .\" .Ds I
3049 .\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by
3050 .\" .Cl Cx \t\t
3051 .\" .Li \&.Cx Op Sy ?/
3052 .\" .Cx
3053 .\" .Cl Cx \t\t
3054 .\" .Li \&.Nm m
3055 .\" .Cx
3056 .\" .Cl Cx Op Sy ?/
3057 .\" .Nm m
3058 .\" .Ad \ b1 e1 f1
3059 .\" .Op Sy ?/
3060 .\" .Cx \t
3061 .\" .Em is produced by
3062 .\" .Cx \t
3063 .\" .Li \&.Ar \e\ b1 e1 f1
3064 .\" .Cx
3065 .\" .Cl Cx \t\t
3066 .\" .Li \&.Op Sy ?/
3067 .\" .Cx
3068 .\" .Cl Cx \t\t
3069 .\" .Li \&.Cx
3070 .\" .Cx
3071 .\" .Cw
3072 .\" .De
3073 .\" .Pp
3075 .Ss Keeps
3077 The only keep that is implemented at this time is for words.
3078 The macros are
3079 .Ql .Bk
3080 (begin keep)
3082 .Ql .Ek
3083 (end keep).
3084 The only option that
3085 .Ql .Bk
3086 accepts currently is
3087 .Fl words
3088 (this is also the default if no option is given) which is useful for
3089 preventing line breaks in the middle of options.
3090 In the example for the make command line arguments (see
3091 .Sx What's in a Name ) ,
3092 the keep prevented
3093 .Xr nroff
3094 from placing up the flag and the argument on separate lines.
3096 Both macros are neither callable nor parsed.
3098 More work needs to be done with the keep macros; specifically, a
3099 .Fl line
3100 option should be added.
3102 .Ss "Examples and Displays"
3104 There are seven types of displays.
3106 .Bl -tag -width ".Li .D1"
3107 .It Li .D1
3108 (This is D-one.)
3109 Display one line of indented text.
3110 This macro is parsed but not callable.
3112 .D1 Fl ldghfstru
3114 The above was produced by:
3115 .Li ".D1 Fl ldghfstru" .
3117 .It Li .Dl
3118 (This is D-ell.)
3119 Display one line of indented
3120 .Em literal
3121 text.
3123 .Ql .Dl
3124 example macro has been used throughout this file.
3125 It allows the indentation (display) of one line of text.
3126 Its default font is set to constant width (literal).
3127 .Ql .Dl
3128 is parsed but not callable.
3130 .Dl % ls -ldg /usr/local/bin
3132 The above was produced by:
3133 .Li ".Dl % ls -ldg /usr/local/bin" .
3135 .It Li .Bd
3136 Begin display.
3138 .Ql .Bd
3139 display must be ended with the
3140 .Ql .Ed
3141 macro.
3142 It has the following syntax:
3144 .Bd -ragged -compact
3145 .Bl -tag -width ".Li .Bd" -offset indent
3146 .It Li .Bd Xo
3147 .Bro \-literal | \-filled | \-unfilled | \-ragged | \-centered Brc
3148 .Oo \-offset Ao string Ac Oc Oo \-file Ao file name Ac Oc Oo \-compact Oc Xc
3153 .Bl -tag -width ".Fl file Ao Ar file name Ac " -compact
3154 .It Fl ragged
3155 Fill, but do not adjust the right margin (only left-justify).
3156 .It Fl centered
3157 Center lines between the current left and right margin.
3158 Note that each single line is centered.
3159 .It Fl unfilled
3160 Do not fill; display a block of text as typed, using line breaks as
3161 specified by the user.
3162 This can produce overlong lines without warning messages.
3163 .It Fl filled
3164 Display a filled block.
3165 The block of text is formatted (i.e., the text is justified on both the left
3166 and right side).
3167 .It Fl literal
3168 Display block with literal font (usually fixed-width).
3169 Useful for source code or simple tabbed or spaced text.
3170 .It Fl file Ao Ar file name Ac
3171 The file whose name follows the
3172 .Fl file
3173 flag is read and displayed before any data enclosed with
3174 .Ql .Bd
3176 .Ql .Ed ,
3177 using the selected display type.
3179 .Xr troff/ Ns Nm \-mdoc
3180 commands in the file will be processed.
3181 .It Fl offset Ao Ar string Ac
3183 .Fl offset
3184 is specified with one of the following strings, the string is interpreted to
3185 indicate the level of indentation for the forthcoming block of text:
3188 .Bl -tag -width ".Ar indent-two" -compact
3189 .It Ar left
3190 Align block on the current left margin; this is the default mode of
3191 .Ql .Bd .
3192 .It Ar center
3193 Supposedly center the block.
3194 At this time unfortunately, the block merely gets left aligned about an
3195 imaginary center margin.
3196 .It Ar indent
3197 Indent by one default indent value or tab.
3198 The default indent value is also used for the
3199 .Ql .D1
3200 and 
3201 .Ql .Dl
3202 macros, so one is guaranteed the two types of displays will line up.
3203 The indentation value is normally set to\~6n or about two thirds of an inch
3204 (six constant width characters).
3205 .It Ar indent-two
3206 Indent two times the default indent value.
3207 .It Ar right
3208 This
3209 .Em left
3210 aligns the block about two inches from the right side of the page.
3211 This macro needs work and perhaps may never do the right thing within
3212 .Xr troff .
3217 .Ao string Ac
3218 is a valid numeric expression instead
3219 .Pf ( Em with a scale indicator other than
3220 .Sq Em u ) ,
3221 use that value for indentation.
3222 The most useful scale indicators are
3223 .Sq m
3225 .Sq n ,
3226 specifying the so-called
3227 .Em \&Em
3229 .Em "En square" .
3230 This is approximately the width of the letters
3231 .Sq m
3233 .Sq n
3234 respectively
3235 of the current font (for nroff output, both scale indicators give the same
3236 values).
3238 .Ao string Ac
3239 isn't a numeric expression, it is tested whether it is an
3240 .Nm \-mdoc
3241 macro name, and the default offset value associated with this macro is used.
3242 Finally, if all tests fail,
3243 the width of
3244 .Ao string Ac
3245 (typeset with a fixed-width font) is taken as the offset.
3246 .It Fl compact
3247 Suppress insertion of vertical space before begin of display.
3250 .It Li .Ed
3251 End display (takes no arguments).
3254 .Ss "Lists and Columns"
3256 There are several types of lists which may be initiated with the
3257 .Ql .Bl
3258 begin-list macro.
3259 Items within the list are specified with the
3260 .Ql .It
3261 item macro, and each list must end with the
3262 .Ql .El
3263 macro.
3264 Lists may be nested within themselves and within displays.
3265 The use of columns inside of lists or lists inside of columns is unproven.
3267 In addition, several list attributes may be specified such as the width of a
3268 tag, the list offset, and compactness (blank lines between items allowed or
3269 disallowed).
3270 Most of this document has been formatted with a tag style list
3271 .Pf ( Fl tag ) .
3273 It has the following syntax forms:
3276 .Bd -ragged -compact
3277 .Bl -tag -width ".Li .Bl" -offset indent -compact
3278 .It Li .Bl Xo
3279 .Bro \-hang | \-ohang | \-tag | \-diag | \-inset Brc
3280 .Oo \-width Ao string Ac Oc
3281 .Oo \-offset Ao string Ac Oc Oo \-compact Oc Xc
3282 .It Li .Bl Xo
3283 .No \-column Oo \-offset Ao string Ac Oc
3284 .Ao string1 Ac Ao string2 Ac ... Xc
3285 .It Li .Bl Xo
3286 .Bro \-item | \-enum Oo \-nested Oc | \-bullet | \-hyphen | \-dash Brc
3287 .Oo \-offset Ao string Ac Oc Oo \-compact Oc Xc
3292 And now a detailed description of the list types.
3295 .Bl -tag -width ".Fl column" -compact
3296 .It Fl bullet
3297 A bullet list.
3299 .Bd -literal -offset indent
3300 \&.Bl -bullet -offset indent -compact
3301 \&.It
3302 Bullet one goes here.
3303 \&.It
3304 Bullet two here.
3305 \&.El
3309 Produces:
3312 .Bl -bullet -offset indent -compact
3314 Bullet one goes here.
3316 Bullet two here.
3320 .It Fl dash No ( or Fl hyphen )
3321 A dash list.
3323 .Bd -literal -offset indent
3324 \&.Bl -dash -offset indent -compact
3325 \&.It
3326 Dash one goes here.
3327 \&.It
3328 Dash two here.
3329 \&.El
3333 Produces:
3336 .Bl -dash -offset indent -compact
3338 Dash one goes here.
3340 Dash two here.
3344 .It Fl enum
3345 An enumerated list.
3347 .Bd -literal -offset indent
3348 \&.Bl -enum -offset indent -compact
3349 \&.It
3350 Item one goes here.
3351 \&.It
3352 And item two here.
3353 \&.El
3357 The result:
3360 .Bl -enum -offset indent -compact
3362 Item one goes here.
3364 And item two here.
3368 If you want to nest enumerated lists, use the
3369 .Fl nested
3370 flag (starting with the second-level list):
3372 .Bd -literal -offset indent
3373 \&.Bl -enum -offset indent -compact
3374 \&.It
3375 Item one goes here
3376 \&.Bl -enum -nested -compact
3377 \&.It
3378 Item two goes here.
3379 \&.It
3380 And item three here.
3381 \&.El
3382 \&.It
3383 And item four here.
3384 \&.El
3388 Result:
3391 .Bl -enum -offset indent -compact
3393 Item one goes here.
3394 .Bl -enum -nested -compact
3396 Item two goes here.
3398 And item three here.
3401 And item four here.
3405 .It Fl item
3406 A list of type
3407 .Fl item
3408 without list markers.
3410 .Bd -literal -offset indent
3411 \&.Bl -item -offset indent
3412 \&.It
3413 Item one goes here.
3414 Item one goes here.
3415 Item one goes here.
3416 \&.It
3417 Item two here.
3418 Item two here.
3419 Item two here.
3420 \&.El
3424 Produces:
3427 .Bl -item -offset indent
3429 Item one goes here.
3430 Item one goes here.
3431 Item one goes here.
3433 Item two here.
3434 Item two here.
3435 Item two here.
3439 .It Fl tag
3440 A list with tags.
3442 .Fl width
3443 to specify the tag width.
3446 .Bl -tag -width "PPID" -compact -offset indent
3447 .It SL
3448 sleep time of the process (seconds blocked)
3449 .It PAGEIN
3450 number of disk
3451 .Tn I/O Ns 's
3452 resulting from references by the process
3453 to pages not loaded in core.
3454 .It UID
3455 numerical user-id of process owner
3456 .It PPID
3457 numerical id of parent of process priority
3458 (non-positive when in non-interruptible wait)
3462 The raw text:
3464 .Bd -literal -offset indent
3465 \&.Bl -tag -width "PPID" -compact -offset indent
3466 \&.It SL
3467 sleep time of the process (seconds blocked)
3468 \&.It PAGEIN
3469 number of disk
3470 \&.Tn I/O Ns 's
3471 resulting from references by the process
3472 to pages not loaded in core.
3473 \&.It UID
3474 numerical user-id of process owner
3475 \&.It PPID
3476 numerical id of parent of process priority
3477 (non-positive when in non-interruptible wait)
3478 \&.El
3482 .It Fl diag
3483 Diag lists create section four diagnostic lists and are similar to inset
3484 lists except callable macros are ignored.
3486 .Fl width
3487 flag is not meaningful in this context.
3489 Example:
3491 .Bd -literal -offset indent
3492 \&.Bl -diag
3493 \&.It You can't use Sy here.
3494 The message says all.
3495 \&.El
3499 produces
3501 .Bl -diag
3502 .It You can't use Sy here.
3503 The message says all.
3507 .It Fl hang
3508 A list with hanging tags.
3510 .Bl -hang -offset indent
3511 .It Em Hanged
3512 labels appear similar to tagged lists when the
3513 label is smaller than the label width.
3514 .It Em Longer hanged list labels
3515 blend into the paragraph unlike
3516 tagged paragraph labels.
3519 And the unformatted text which created it:
3521 .Bd -literal -offset indent
3522 \&.Bl -hang -offset indent
3523 \&.It Em Hanged
3524 labels appear similar to tagged lists when the
3525 label is smaller than the label width.
3526 \&.It Em Longer hanged list labels
3527 blend into the paragraph unlike
3528 tagged paragraph labels.
3529 \&.El
3533 .It Fl ohang
3534 Lists with overhanging tags do not use indentation for the items; tags are
3535 written to a separate line.
3537 .Bl -ohang -offset indent
3538 .It Sy SL
3539 sleep time of the process (seconds blocked)
3540 .It Sy PAGEIN
3541 number of disk
3542 .Tn I/O Ns 's
3543 resulting from references by the process
3544 to pages not loaded in core.
3545 .It Sy UID
3546 numerical user-id of process owner
3547 .It Sy PPID
3548 numerical id of parent of process priority
3549 (non-positive when in non-interruptible wait)
3553 The raw text:
3555 .Bd -literal -offset indent
3556 \&.Bl -ohang -offset indent
3557 \&.It Sy SL
3558 sleep time of the process (seconds blocked)
3559 \&.It Sy PAGEIN
3560 number of disk
3561 \&.Tn I/O Ns 's
3562 resulting from references by the process
3563 to pages not loaded in core.
3564 \&.It Sy UID
3565 numerical user-id of process owner
3566 \&.It Sy PPID
3567 numerical id of parent of process priority
3568 (non-positive when in non-interruptible wait)
3569 \&.El
3573 .It Fl inset
3574 Here is an example of inset labels:
3575 .Bl -inset -offset indent
3576 .It Em Tag
3577 The tagged list (also called a tagged paragraph)
3578 is the most common type of list used in the
3579 Berkeley manuals.
3580 Use a
3581 .Fl width
3582 attribute as described below.
3583 .It Em Diag
3584 Diag lists create section four diagnostic lists
3585 and are similar to inset lists except callable
3586 macros are ignored.
3587 .It Em Hang
3588 Hanged labels are a matter of taste.
3589 .It Em Ohang
3590 Overhanging labels are nice when space is constrained.
3591 .It Em Inset
3592 Inset labels are useful for controlling blocks of
3593 paragraphs and are valuable for converting
3594 .Nm \-mdoc
3595 manuals to other formats.
3598 Here is the source text which produced the above example:
3600 .Bd -literal -offset indent
3601 \&.Bl -inset -offset indent
3602 \&.It Em Tag
3603 The tagged list (also called a tagged paragraph)
3604 is the most common type of list used in the
3605 Berkeley manuals.
3606 \&.It Em Diag
3607 Diag lists create section four diagnostic lists
3608 and are similar to inset lists except callable
3609 macros are ignored.
3610 \&.It Em Hang
3611 Hanged labels are a matter of taste.
3612 \&.It Em Ohang
3613 Overhanging labels are nice when space is constrained.
3614 \&.It Em Inset
3615 Inset labels are useful for controlling blocks of
3616 paragraphs and are valuable for converting
3617 \&.Nm \-mdoc
3618 manuals to other formats.
3619 \&.El
3623 .It Fl column
3624 This list type generates multiple columns.
3625 The number of columns and the width of each column is determined by the
3626 arguments to the
3627 .Fl column
3628 list,
3629 .Aq Ar string1 ,
3630 .Aq Ar string2 ,
3631 etc.
3633 .Aq Ar stringN
3634 starts with a
3635 .Ql .\&
3636 (dot) immediately followed by a valid
3637 .Nm \-mdoc
3638 macro name, interpret
3639 .Aq Ar stringN
3640 and use the width of the result.
3641 Otherwise, the width of
3642 .Aq Ar stringN
3643 (typeset with a fixed-width font) is taken as the
3644 .Ar N Ns th
3645 column width.
3647 Each
3648 .Ql .It
3649 argument is parsed to make a row, each column within the row is a separate
3650 argument separated by a tab or the
3651 .Ql .Ta
3652 macro.
3654 The table:
3656 .Bl -column -offset indent ".Sy String" ".Sy Nroff" ".Sy Troff"
3657 .It Sy String Ta Sy Nroff Ta Sy Troff
3658 .It Li <= Ta <= Ta \*(<=
3659 .It Li >= Ta >= Ta \*(>=
3663 was produced by:
3665 .Bd -literal
3666 \&.Bl -column -offset indent ".Sy String" ".Sy Nroff" ".Sy Troff"
3667 \&.It Sy String Ta Sy Nroff Ta Sy Troff
3668 \&.It Li <= Ta <= Ta \e*(<=
3669 \&.It Li >= Ta >= Ta \e*(>=
3670 \&.El
3675 Other keywords:
3677 .Bl -tag -width ".Fl indent Ao Ar string Ac"
3678 .It Fl width Ao Ar string Ac
3680 .Aq Ar string
3681 starts with a
3682 .Ql .\&
3683 (dot) immediately followed by a valid
3684 .Nm \-mdoc
3685 macro name, interpret
3686 .Aq Ar string
3687 and use the width of the result.
3688 Almost all lists in this document use this option.
3690 Example:
3692 .Bd -literal -offset indent
3693 \&.Bl -tag -width ".Fl test Ao Ar string Ac"
3694 \&.It Fl test Ao Ar string Ac
3695 This is a longer sentence to show how the
3696 \&.Fl width
3697 flag works in combination with a tag list.
3698 \&.El
3702 gives:
3704 .Bl -tag -width ".Fl test Ao Ar string Ac"
3705 .It Fl test Ao Ar string Ac
3706 This is a longer sentence to show how the
3707 .Fl width
3708 flag works in combination with a tag list.
3712 (Note that the current state of
3713 .Nm \-mdoc
3714 is saved before
3715 .Aq Ar string
3716 is interpreted; afterwards, all variables are restored again.
3717 However, boxes (used for enclosures) can't be saved in
3718 .Tn GNU
3719 .Xr troff 1 ;
3720 as a consequence, arguments must always be
3721 .Em balanced
3722 to avoid nasty errors.
3723 For example, do not write
3724 .Ql ".Ao Ar string"
3726 .Ql ".Ao Ar string Xc"
3727 instead if you really need only an opening angle bracket.)
3729 Otherwise, if
3730 .Aq Ar string
3731 is a valid numeric expression
3732 .Em ( with a scale indicator other than
3733 .Sq Em u ) ,
3734 use that value for indentation.
3735 The most useful scale indicators are
3736 .Sq m
3738 .Sq n ,
3739 specifying the so-called
3740 .Em \&Em
3742 .Em "En square" .
3743 This is approximately the width of the letters
3744 .Sq m
3746 .Sq n
3747 respectively
3748 of the current font (for nroff output, both scale indicators give the same
3749 values).
3751 .Aq Ar string
3752 isn't a numeric expression, it is tested whether it is an
3753 .Nm \-mdoc
3754 macro name, and the default width value associated with this macro is used.
3755 Finally, if all tests fail,
3756 the width of
3757 .Aq Ar string
3758 (typeset with a fixed-width font) is taken as the width.
3760 If a width is not specified for the tag list type, every time
3761 .Ql .It
3762 is invoked, an attempt is made to determine an appropriate width.
3763 If the first argument to
3764 .Ql .It
3765 is a callable macro, the default width for that macro will be used;
3766 otherwise, the default width of
3767 .Ql .No
3768 is used.
3769 .It Fl offset Ao Ar string Ac
3771 .Aq Ar string
3773 .Ar indent ,
3774 a default indent value (normally set to\~6n, similar to the value used in
3775 .Ql .Dl
3777 .Ql .Bd )
3778 is used.
3780 .Aq Ar string
3781 is a valid numeric expression instead
3782 .Pf ( Em with a scale indicator other than
3783 .Sq Em u ) ,
3784 use that value for indentation.
3785 The most useful scale indicators are
3786 .Sq m
3788 .Sq n ,
3789 specifying the so-called
3790 .Em \&Em
3792 .Em "En square" .
3793 This is approximately the width of the letters
3794 .Sq m
3796 .Sq n
3797 respectively
3798 of the current font (for nroff output, both scale indicators give the same
3799 values).
3801 .Aq Ar string
3802 isn't a numeric expression, it is tested whether it is an
3803 .Nm \-mdoc
3804 macro name, and the default offset value associated with this macro is used.
3805 Finally, if all tests fail,
3806 the width of
3807 .Aq Ar string
3808 (typeset with a fixed-width font) is taken as the offset.
3809 .It Fl compact
3810 Suppress insertion of vertical space before the list and between list items.
3814 .Sh "MISCELLANEOUS MACROS"
3816 Here a list of the remaining macros which do not fit well into one of the
3817 above sections.
3818 We couldn't find real examples for the following macros:
3819 .Ql .Me
3821 .Ql .Ot .
3822 They are documented here for completeness \- if you know how to use them
3823 properly please send a mail to
3824 .Mt bug-groff@gnu.org
3825 (including an example).
3827 .Bl -tag -width ".Li .Bt"
3828 .It Li .Bt
3829 prints
3831 .Bd -ragged -offset indent
3835 It is neither callable nor parsed and takes no arguments.
3837 .It Li .Fr
3839 .Dl Usage: .Fr Ao function return value Ac ...
3841 Don't use this macro.
3842 It allows a break right before the return value (usually a single digit)
3843 which is bad typographical behaviour.
3845 .Ql \e~
3846 to tie the return value to the previous word.
3848 .It Li .Hf
3849 Use this macro to include a (header) file literally.
3850 It first prints
3851 .Ql File:
3852 followed by the file name, then the contents of
3853 .Ao file Ac .
3855 .Dl Usage: .Hf Ao file Ac
3857 It is neither callable nor parsed.
3859 .It Li .Lk
3860 To be written.
3862 .It Li .Me
3863 Exact usage unknown.
3864 The documentation in the
3865 .Nm \-mdoc
3866 source file describes it as a macro for
3867 .Dq "menu entries" .
3869 Its default width is 6n.
3871 .It Li .Mt
3872 To be written.
3874 .It Li .Ot
3875 Exact usage unknown.
3876 The documentation in the
3877 .Nm \-mdoc
3878 source file describes it as
3879 .Dq old function type (fortran) .
3881 .It Li .Sm
3882 Activate (toggle) space mode.
3884 .Dl Usage: .Sm Oo on | off Oc ...
3886 If space mode is off, no spaces between macro arguments are inserted.
3887 If called without a parameter (or if the next parameter is neither
3888 .Ql on
3890 .Ql off ,
3891 .Ql .Sm
3892 toggles space mode.
3894 .It Li .Ud
3895 prints
3897 .Bd -ragged -offset indent
3901 It is neither callable nor parsed and takes no arguments.
3905 .Sh "PREDEFINED STRINGS"
3907 The following strings are predefined:
3909 .Bl -column String infinity "Troff " "straight double quote" -offset indent
3910 .It Sy String Ta Sy Nroff Ta Sy Troff Ta Sy Meaning
3911 .It Li <=     Ta <=       Ta \*[<=]   Ta "less equal"
3912 .It Li >=     Ta >=       Ta \*[>=]   Ta "greater equal"
3913 .It Li Rq     Ta ''       Ta \*[Rq]   Ta "right double quote"
3914 .It Li Lq     Ta ``       Ta \*[Lq]   Ta "left double quote"
3915 .It Li ua     Ta ^        Ta \*[ua]   Ta "upwards arrow"
3916 .It Li aa     Ta \'       Ta \*[aa]   Ta "acute accent"
3917 .It Li ga     Ta \`       Ta \*[ga]   Ta "grave accent"
3918 .It Li q      Ta \&"      Ta \*[q]    Ta "straight double quote"
3919 .It Li Pi     Ta pi       Ta \*[Pi]   Ta "greek pi"
3920 .It Li Ne     Ta !=       Ta \*[Ne]   Ta "not equal"
3921 .It Li Le     Ta <=       Ta \*[Le]   Ta "less equal"
3922 .It Li Ge     Ta >=       Ta \*[Ge]   Ta "greater equal"
3923 .It Li Lt     Ta <        Ta \*[Lt]   Ta "less than"
3924 .It Li Gt     Ta >        Ta \*[Gt]   Ta "greater than"
3925 .It Li Pm     Ta +\-      Ta \*[Pm]   Ta "plus minus"
3926 .It Li If     Ta infinity Ta \*[If]   Ta "infinity"
3927 .It Li Am     Ta \*[Am]   Ta \*[Am]   Ta "ampersand"
3928 .It Li Na     Ta \*[Na]   Ta \*[Na]   Ta "not a number"
3929 .It Li Ba     Ta \*[Ba]   Ta \*[Ba]   Ta "vertical bar"
3932 The names of the columns
3933 .Sy Nroff
3935 .Sy Troff
3936 are a bit misleading;
3937 .Sy Nroff
3938 shows the
3939 .Tn ASCII
3940 representation, while
3941 .Sy Troff
3942 gives the best glyph form available.
3943 For example, a Unicode enabled
3944 .Tn TTY Ns - Ns
3945 device will have proper glyph representations for all strings, whereas the
3946 enhancement for a Latin1
3947 .Tn TTY Ns - Ns
3948 device is only the plus-minus sign.
3950 String names which consist of two characters can be written as
3951 .Ql \e*(xx ;
3952 string names which consist of one character can be written as
3953 .Ql \e*x .
3954 A generic syntax for a string name of any length is
3955 .Ql \e*[xxx]
3956 (this is a
3957 .Tn GNU
3958 .Xr troff 1
3959 extension).
3963 \#=====================================================================
3965 .Sh DIAGNOSTICS
3967 The debugging macro
3968 .Ql .Db
3969 available in previous versions of
3970 .Nm \-mdoc
3971 has been removed since
3972 .Tn GNU
3973 .Xr troff 1
3974 provides better facilities to check parameters; additionally, many error and
3975 warning messages have been added to this macro package, making it both more
3976 robust and verbose.
3978 The only remaining debugging macro is
3979 .Ql .Rd
3980 which yields a register dump of all global registers and strings.
3981 A normal user will never need it.
3984 .Sh "FORMATTING WITH GROFF, TROFF, AND NROFF"
3986 By default, the package inhibits page breaks, headers, and footers if
3987 displayed with a
3988 .Tn TTY
3989 device like
3990 .Sq latin1
3992 .Sq unicode ,
3993 to make the manual more efficient for viewing on-line.
3994 This behaviour can be changed (e.g.\& to create a hardcopy of the
3995 .Tn TTY
3996 output) by setting the register
3997 .Ql cR
3998 to zero while calling
3999 .Xr groff 1 ,
4000 resulting in multiple pages instead of a single, very long page:
4002 .Dl groff -Tlatin1 -rcR=0 -mdoc foo.man > foo.txt
4004 For double-sided printing, set register
4005 .Ql D
4006 to\~1:
4008 .Dl groff -Tps -rD1 -mdoc foo.man > foo.ps
4010 To change the document font size to 11pt or 12pt, set register
4011 .Ql S
4012 accordingly:
4014 .Dl groff -Tdvi -rS11 -mdoc foo.man > foo.dvi
4016 Register
4017 .Ql S
4018 is ignored for
4019 .Tn TTY
4020 devices.
4022 The line and title length can be changed by setting the registers
4023 .Ql LL
4025 .Ql LT ,
4026 respectively:
4028 .Dl groff -Tutf8 -rLL=100n -rLT=100n -mdoc foo.man | less
4030 If not set, both registers default to 78n for TTY devices and 6.5i
4031 otherwise.
4034 .Sh FILES
4036 .Bl -tag -width mdoc/doc-ditroff -compact
4037 .It Pa doc.tmac
4038 The main manual macro package.
4039 .It Pa mdoc.tmac
4040 A wrapper file to call
4041 .Pa doc.tmac .
4042 .It Pa mdoc/doc-common
4043 Common strings, definitions, stuff related typographic output.
4044 .It Pa mdoc/doc-nroff
4045 Definitions used for a
4046 .Tn TTY
4047 output device.
4048 .It Pa mdoc/doc-ditroff
4049 Definitions used for all other devices.
4050 .It Pa mdoc.local
4051 Local additions and customizations.
4052 .It Pa andoc.tmac
4053 This file checks whether the
4054 .Nm \-mdoc
4055 or the
4056 .Nm \-man
4057 package should be used.
4061 .Sh "SEE ALSO"
4063 .Xr groff 1 ,
4064 .Xr man 1 ,
4065 .Xr troff 1 ,
4066 .Xr groff_man 7
4069 .Sh BUGS
4071 Section 3f has not been added to the header routines.
4073 .Ql \&.Nm
4074 font should be changed in
4075 .Sx NAME
4076 section.
4078 .Ql \&.Fn
4079 needs to have a check to prevent splitting up
4080 if the line length is too short.
4081 Occasionally it
4082 separates the last parenthesis, and sometimes
4083 looks ridiculous if a line is in fill mode.
4085 The list and display macros do not do any keeps
4086 and certainly should be able to.
4087 .\" Note what happens if the parameter list overlaps a newline
4088 .\" boundary.
4089 .\" to make sure a line boundary is crossed:
4090 .\" .Bd -literal
4091 .\" \&.Fn struct\e\ dictionarytable\e\ *dictionarylookup struct\e\ dictionarytable\e\ *tab[]
4092 .\" .Ed
4093 .\" .Pp
4094 .\" produces, nudge nudge,
4095 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
4096 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
4097 .\" nudge
4098 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] .
4099 .\" .Pp
4100 .\" If double quotes are used, for example:
4101 .\" .Bd -literal
4102 .\" \&.Fn \*qstruct dictionarytable *dictionarylookup\*q \*qchar *h\*q \*qstruct dictionarytable *tab[]\*q
4103 .\" .Ed
4104 .\" .Pp
4105 .\" produces, nudge nudge,
4106 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
4107 .\" nudge
4108 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
4109 .\" nudge
4110 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" .
4111 .\" .Pp
4112 .\" Not a pretty sight...
4113 .\" In a paragraph, a long parameter containing unpaddable spaces as
4114 .\" in the former example will cause
4115 .\" .Xr troff
4116 .\" to break the line and spread
4117 .\" the remaining words out.
4118 .\" The latter example will adjust nicely to
4119 .\" justified margins, but may break in between an argument and its
4120 .\" declaration.
4121 .\" In
4122 .\" .Xr nroff
4123 .\" the right margin adjustment is normally ragged and the problem is
4124 .\" not as severe.
4126 .\" Local Variables:
4127 .\" mode: nroff
4128 .\" End: