* tmac/www.tmac (TS, TE, EQ, EN): Don't use .als for setting up
[s-roff.git] / tmac / groff_mdoc.man
blob50ca686f7ef6cac6ce1723ab0776fb8cad521c1c
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 January 5, 2006
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 "DragonFly Macro"
187 .    It "OpenBSD Macro"
188 .    It "BSD/OS Macro"
189 .    It "UNIX Macro"
190 .    It "Emphasis Macro"
191 .    It "Font Mode"
192 .    It "Enclosure and Quoting Macros"
193 .    It "No-Op or Normal Text Macro"
194 .    It "No-Space Macro"
195 .    It "Section Cross References"
196 .    It "Symbolics"
197 .    It "Mathematical Symbols"
198 .    It "References and Citations"
199 .    It "Trade Names (or Acronyms and Type Names)"
200 .    It "Extended Arguments"
201 .  El
203 .  It
204 .  Tn "PAGE STRUCTURE DOMAIN"
206 .  Bl -tag -width 2n -compact
207 .    It "Section Headers"
208 .    It "Subsection Headers"
209 .    It "Paragraphs and Line Spacing"
210 .    It "Keeps"
211 .    It "Examples and Displays"
212 .    It "Lists and Columns"
213 .  El
215 .  It
216 .  Tn "MISCELLANEOUS MACROS"
218 .  It
219 .  Tn "PREDEFINED STRINGS"
221 .  It
222 .  Tn "DIAGNOSTICS"
224 .  It
225 .  Tn "FORMATTING WITH GROFF, TROFF, AND NROFF"
227 .  It
228 .  Tn "FILES"
230 .  It
231 .  Tn "SEE ALSO"
233 .  It
234 .  Tn "BUGS"
237 .\" XXX
238 .if t \
239 .  ne 7
242 .Sh "TROFF IDIOSYNCRASIES"
245 .Nm \-mdoc
246 package attempts to simplify the process of writing a man page.
247 Theoretically, one should not have to learn the tricky details of
248 .Tn GNU
249 .Xr troff 1
250 to use
251 .Nm \-mdoc ;
252 however, there are a few limitations which are unavoidable and best gotten
253 out of the way.
254 And, too, be forewarned, this package is
255 .Em not
256 fast.
258 .Ss "Macro Usage"
260 As in
261 .Tn GNU
262 .Xr troff 1 ,
263 a macro is called by placing a
264 .Ql .\&
265 (dot character) at the beginning of a line followed by the two-character
266 (or three-character) name for the macro.
267 There can be space or tab characters between the dot and the macro name.
268 Arguments may follow the macro separated by spaces (but
269 .Em no
270 tabs).
271 It is the dot character at the beginning of the line which causes
272 .Tn GNU
273 .Xr troff 1
274 to interpret the next two (or more) characters as a macro name.
275 A single starting dot followed by nothing is ignored.
276 To place a
277 .Ql .\&
278 (dot character) at the beginning of an input line in some context other than
279 a macro invocation, precede the
280 .Ql .\&
281 (dot) with the
282 .Ql \e&
283 escape sequence which translates literally to a zero-width space, and is
284 never displayed in the output.
286 In general,
287 .Tn GNU
288 .Xr troff 1
289 macros accept an unlimited number of arguments (contrary to other versions
290 of troff which can't handle more than nine arguments).
291 In limited cases, arguments may be continued or extended on the next
292 line (See
293 .Sx Extended Arguments
294 below).
295 Almost all macros handle quoted arguments (see
296 .Sx Passing Space Characters in an Argument
297 below).
299 Most of the
300 .Nm \-mdoc
301 general text domain and manual domain macros are special in that their
302 argument lists are
303 .Em parsed
304 for callable macro names.
305 This means an argument on the argument list which matches a general text or
306 manual domain macro name (and which is defined to be callable) will be
307 executed or called when it is processed.
308 In this case the argument, although the name of a macro, is not preceded by
310 .Ql .\&
311 (dot).
312 This makes it possible to nest macros; for example the option macro,
313 .Ql .Op ,
315 .Em call
316 the flag and argument macros,
317 .Ql \&Fl
319 .Ql \&Ar ,
320 to specify an optional flag with an argument:
322 .Bl -tag -width ".Op Fl s Ar bytes" -offset indent
323 .It Op Fl s Ar bytes
324 is produced by
325 .Ql ".Op Fl s Ar bytes"
329 To prevent a string from being interpreted as a macro name, precede the
330 string with the escape sequence
331 .Ql \e& :
333 .Bl -tag -width ".Op \&Fl s \&Ar bytes" -offset indent
334 .It Op \&Fl s \&Ar bytes
335 is produced by
336 .Ql ".Op \e&Fl s \e&Ar bytes"
340 Here the strings
341 .Ql \&Fl
343 .Ql \&Ar
344 are not interpreted as macros.
345 Macros whose argument lists are parsed for callable arguments are referred
346 to as
347 .Em parsed
348 and macros which may be called from an argument list are referred to as
349 .Em callable
350 throughout this document.
351 This is a technical
352 .Em faux pas
353 as almost all of the macros in
354 .Nm \-mdoc
355 are parsed, but as it was cumbersome to constantly refer to macros as
356 being callable and being able to call other macros, the term parsed
357 has been used.
360 In the following, we call an
361 .Nm \-mdoc
362 macro which starts a line (with a leading dot) a
363 .Em command
364 if this distinction is necessary.
366 .Ss "Passing Space Characters in an Argument"
368 Sometimes it is desirable to give as an argument a string containing one or
369 more blank space characters, say, to specify arguments to commands which
370 expect particular arrangement of items in the argument list.
371 Additionally, it makes
372 .Nm \-mdoc
373 working faster.
374 For example, the function command
375 .Ql .Fn
376 expects the first argument to be the name of a function and any remaining
377 arguments to be function parameters.
379 .Tn ANSI\~C
380 stipulates the declaration of function parameters in the parenthesized
381 parameter list, each parameter is guaranteed to be at minimum a two word
382 string.
383 For example,
384 .Fa int foo .
386 There are two possible ways to pass an argument which contains
387 an embedded space.
388 One way of passing a string containing blank spaces is to use the hard or
389 unpaddable space character
390 .Ql \e\  ,
391 that is, a blank space preceded by the escape character
392 .Ql \e .
393 This method may be used with any macro but has the side effect of
394 interfering with the adjustment of text over the length of a line.
395 .Xr Troff
396 sees the hard space as if it were any other printable character and cannot
397 split the string into blank or newline separated pieces as one would expect.
398 This method is useful for strings which are not expected to overlap a line
399 boundary.
400 An alternative is to use
401 .Ql \e~ ,
402 a paddable (i.e.\& stretchable), unbreakable space (this is a
403 .Tn GNU
404 .Xr troff 1
405 extension).
406 The second method is to enclose the string with double quotes.
408 For example:
410 .Bl -tag -width ".Fn fetch char\ *str" -offset indent
411 .It Fn fetch char\ *str
412 is created by
413 .Ql ".Fn fetch char\e *str"
414 .It Fn fetch "char *str"
415 can also be created by
416 .Ql ".Fn fetch \*[q]char *str\*[q]"
420 If the
421 .Ql \e
422 before the space in the first example
423 or double quotes in the second example
424 were omitted,
425 .Ql .Fn
426 would see three arguments, and the result would be:
428 .Dl Fn fetch char *str
430 .\" For an example of what happens when the parameter list overlaps a newline
431 .\" boundary, see the
432 .\" .Sx BUGS
433 .\" section.
435 .Ss "Trailing Blank Space Characters"
437 .Xr Troff
438 can be confused by blank space characters at the end of a line.
439 It is a wise preventive measure to globally remove all blank spaces
440 from
441 .Ao blank-space Ac Ns Ao end-of-line Ac
442 character sequences.
443 Should the need arise to use a blank character at the end of a line, it
444 may be forced with an unpaddable space and the
445 .Ql \e&
446 escape character.
447 For example,
448 .Ql string\e\ \e& .
450 .Ss "Escaping Special Characters"
452 Special characters like the newline character
453 .Ql \en
454 are handled by replacing the
455 .Ql \e
456 with
457 .Ql \ee
458 (e.g.\&
459 .Ql \een )
460 to preserve the backslash.
462 .Ss "Other Possible Pitfalls"
464 A warning is emitted when an empty input line is found outside of displays
465 (see below).
467 .Ql .sp
468 instead.
469 (Well, it is even better to use
470 .Nm \-mdoc
471 macros to avoid the usage of low-level commands.)
473 Leading spaces will cause a break and are output directly.
474 Avoid this behaviour if possible.
475 Similarly, do not use more than one space character between words in an
476 ordinary text line; contrary to other text formatters, they are
477 .Em not
478 replaced with a single space.
480 You can't pass
481 .Ql \*[q]
482 directly as an argument.
484 .Ql \e*[q]
486 .Ql \e*q )
487 instead.
489 By default,
490 .Xr troff 1
491 inserts two space characters after a punctuation mark closing a sentence;
492 characters like
493 .Ql \&)
495 .Ql \&'
496 are treated transparently, not influencing the sentence-ending behaviour.
497 To change this, insert
498 .Ql \e&
499 before or after the dot:
501 .Bd -literal -offset indent
503 \&.Ql .
504 character.
505 \&.Pp
507 \&.Ql \e&.
508 character.
509 \&.Pp
510 \&.No test .
511 test
512 \&.Pp
513 \&.No test.
514 test
518 gives
520 .Bd -filled -offset indent
522 .Ql .
523 character
526 .Ql \&.
527 character.
529 .No test .
530 test
532 .No test.
533 test
537 As can be seen in the first and third line,
538 .Nm \-mdoc
539 handles punctuation characters specially in macro arguments.
540 This will be explained in section
541 .Sx General Syntax
542 below.
543 In the same way, you have to protect trailing full stops of abbreviations
544 with a trailing zero-width space:
545 .Ql e.g.\e& .
547 A comment in the source file of a man page can be either started with
548 .Ql .\e"
549 on a single line,
550 .Ql \e"
551 after some input, or
552 .Ql \e#
553 anywhere (the latter is a
554 .Tn GNU
555 .Xr troff 1
556 extension); the rest of such a line is ignored.
559 .Sh "A MANUAL PAGE TEMPLATE"
561 The body of a man page is easily constructed from a basic template:
563 .Bd -literal -offset indent
564 \&.\e" The following commands are required for all man pages.
565 \&.Dd Month day, year
566 \&.Os [OPERATING_SYSTEM] [version/release]
567 \&.Dt DOCUMENT_TITLE [section number] [architecture/volume]
568 \&.Sh NAME
569 \&.Nm name
570 \&.Nd one line description of name
571 \&.\e" This next command is for sections 2 and 3 only.
572 \&.\e" .Sh LIBRARY
573 \&.Sh SYNOPSIS
574 \&.Sh DESCRIPTION
575 \&.\e" The following commands should be uncommented and
576 \&.\e" used where appropriate.
577 \&.\e" .Sh IMPLEMENTATION NOTES
578 \&.\e" This next command is for sections 2, 3 and 9 function
579 \&.\e" return values only.
580 \&.\e" .Sh RETURN VALUES
581 \&.\e" This next command is for sections 1, 6, 7 and 8 only.
582 \&.\e" .Sh ENVIRONMENT
583 \&.\e" .Sh FILES
584 \&.\e" .Sh EXAMPLES
585 \&.\e" This next command is for sections 1, 6, 7, 8 and 9 only
586 \&.\e"     (command return values (to shell) and
587 \&.\e"     fprintf/stderr type diagnostics).
588 \&.\e" .Sh DIAGNOSTICS
589 \&.\e" .Sh COMPATIBILITY
590 \&.\e" This next command is for sections 2, 3 and 9 error
591 \&.\e"     and signal handling only.
592 \&.\e" .Sh ERRORS
593 \&.\e" .Sh SEE ALSO
594 \&.\e" .Sh STANDARDS
595 \&.\e" .Sh HISTORY
596 \&.\e" .Sh AUTHORS
597 \&.\e" .Sh BUGS
601 The first items in the template are the commands
602 .Ql .Dd ,
603 .Ql .Os ,
605 .Ql .Dt ;
606 the document date, the operating system the man page or subject source is
607 developed or modified for, and the man page title (in
608 .Em upper case )
609 along with the section of the manual the page belongs in.
610 These commands identify the page and are discussed below in
611 .Sx TITLE MACROS .
613 The remaining items in the template are section headers
614 .Pf ( Li .Sh ) ;
615 of which
616 .Sx NAME ,
617 .Sx SYNOPSIS ,
619 .Sx DESCRIPTION
620 are mandatory.
621 The headers are discussed in
622 .Sx "PAGE STRUCTURE DOMAIN" ,
623 after presentation of
624 .Sx "MANUAL DOMAIN" .
625 Several content macros are used to demonstrate page layout macros; reading
626 about content macros before page layout macros is recommended.
629 .Sh CONVENTIONS
631 In the description of all macros below, optional arguments are put into
632 brackets.
633 An ellipsis
634 .Pf ( Sq ... )
635 represents zero or more additional arguments.
636 Alternative values for a parameter are separated with
637 .Ql | .
638 If there are alternative values for a mandatory parameter, braces are used
639 (together with
640 .Ql | )
641 to enclose the value set.
642 Meta-variables are specified within angles.
644 Example:
646 .Bl -tag -width 6n -offset indent
647 .It Li .Xx Xo
648 .Aq foo 
649 .Brq bar1 | bar2
650 .Op \-test1 Op \-test2 | \-test3
651 .No ...
656 Except stated explicitly, all macros are parsed and callable.
658 Note that a macro takes effect up to the next nested macro.
659 For example,
660 .Ql ".Ic foo Aq bar"
661 doesn't produce
662 .Sq Ic "foo <bar>"
664 .Sq Ic foo Aq bar .
665 Consequently, a warning message is emitted for most commands if the first
666 argument is a macro itself since it cancels the effect of the calling
667 command completely.
668 Another consequence is that quoting macros never insert literal quotes;
669 .Sq Ic "foo <bar>"
670 has been produced by
671 .Ql ".Ic \*[q]foo <bar>\*[q]" .
673 Most macros have a default width value which can be used to specify a label
674 width
675 .Pf ( Fl width )
676 or offset
677 .Pf ( Fl offset )
678 for the
679 .Ql .Bl
681 .Ql .Bd
682 macros.
683 It is recommended not to use this rather obscure feature to avoid
684 dependencies on local modifications of the
685 .Nm \-mdoc
686 package.
689 .Sh "TITLE MACROS"
691 The title macros are part of the page structure domain but are presented
692 first and separately for someone who wishes to start writing a man page
693 yesterday.
694 Three header macros designate the document title or manual page title, the
695 operating system, and the date of authorship.
696 These macros are called once at the very beginning of the document and are
697 used to construct headers and footers only.
699 .Bl -tag -width 6n
700 .It Li .Dt Xo
701 .Op Aq document title
702 .Op Aq section number
703 .Op Aq volume
705 The document title is the subject of the man page and must be in
706 .Tn CAPITALS
707 due to troff limitations.
708 If omitted,
709 .Sq Tn UNTITLED
710 is used.
711 The section number may be a number in the range
712 .No 1,\~ Ns ... Ns ,\~9
714 .Ql unass ,
715 .Ql draft ,
717 .Ql paper .
718 If it is specified, and no volume name is given, a default volume name is
719 used.
722 Under
723 .Tn \*[operating-system] ,
724 the following sections are defined:
726 .Bl -column LOCAL -offset indent -compact
727 .It Li 1   Ta "\*[volume-operating-system] \*[volume-ds-1]"
728 .It Li 2   Ta "\*[volume-operating-system] \*[volume-ds-2]"
729 .It Li 3   Ta "\*[volume-operating-system] \*[volume-ds-3]"
730 .It Li 4   Ta "\*[volume-operating-system] \*[volume-ds-4]"
731 .It Li 5   Ta "\*[volume-operating-system] \*[volume-ds-5]"
732 .It Li 6   Ta "\*[volume-operating-system] \*[volume-ds-6]"
733 .It Li 7   Ta "\*[volume-operating-system] \*[volume-ds-7]"
734 .It Li 8   Ta "\*[volume-operating-system] \*[volume-ds-8]"
735 .It Li 9   Ta "\*[volume-operating-system] \*[volume-ds-9]"
739 A volume name may be arbitrary or one of the following:
742 .Bl -column LOCAL -offset indent -compact
743 .It Li USD   Ta "\*[volume-ds-USD]"
744 .It Li PS1   Ta "\*[volume-ds-PS1]"
745 .It Li AMD   Ta "\*[volume-ds-AMD]"
746 .It Li SMM   Ta "\*[volume-ds-SMM]"
747 .It Li URM   Ta "\*[volume-ds-URM]"
748 .It Li PRM   Ta "\*[volume-ds-PRM]"
749 .It Li KM    Ta "\*[volume-ds-KM]"
750 .It Li IND   Ta "\*[volume-ds-IND]"
751 .It Li LOCAL Ta "\*[volume-ds-LOCAL]"
752 .It Li CON   Ta "\*[volume-ds-CON]"
756 For compatibility,
757 .Ql MMI
758 can be used for
759 .Ql IND ,
761 .Ql LOC
763 .Ql LOCAL .
764 Values from the previous table will specify a new volume name.
765 If the third parameter is a keyword designating a computer architecture,
766 its value is prepended to the default volume name as specified by the
767 second parameter.
768 By default, the following architecture keywords are defined:
770 \# we use `No' to avoid hyphenation
771 .Bd -ragged -offset indent
772 .No alpha , acorn26 , acorn32 , algor , amd64 , amiga , arc , arm26 ,
773 .No arm32 , atari , bebox , cats , cesfic , cobalt , dreamcast , evbarm ,
774 .No evbmips , evbppc , evbsh3 , hp300 , hp700 , hpcmips , i386 , luna68k ,
775 .No m68k , mac68k , macppc , mips , mmeye , mvme68k , mvmeppc , netwinder ,
776 .No news68k , newsmips , next68k , ofppc , pc532 , pmax , pmppc , powerpc ,
777 .No prep , sandpoint , sgimips , sh3 , shark , sparc , sparc64 , sun3 ,
778 .No tahoe , vax , x68k , x86_64
782 If the section number is neither a numeric expression in the range 1 to\~9
783 nor one of the above described keywords, the third parameter is used
784 verbatim as the volume name.
786 In the following examples, the left (which is identical to the right) and
787 the middle part of the manual page header strings are shown.
788 Note how
789 .Ql \e&
790 prevents the digit\~7 from being a valid numeric expression.
792 .Bd -ragged
793 .Bl -tag -width ".Li .Dt\ FOO\ 2\ i386" -compact -offset indent
794 .It Li ".Dt FOO 7"
795 .Ql FOO(7)
796 .Ql \*[volume-operating-system] \*[volume-ds-7]
797 .It Li ".Dt FOO 7 bar"
798 .Ql FOO(7)
799 .Ql \*[volume-operating-system] \*[volume-ds-7]
800 .It Li ".Dt FOO \e&7 bar"
801 .Ql FOO(7)
802 .Ql bar
803 .It Li ".Dt FOO 2 i386"
804 .Ql FOO(2)
805 .Ql \*[volume-operating-system]/\*[volume-as-i386] \*[volume-ds-2]
806 .It Li ".Dt FOO \*[q]\*[q] bar"
807 .Ql FOO
808 .Ql bar
813 Local, OS-specific additions might be found in the file
814 .Pa mdoc.local ;
815 look for strings named
816 .Ql volume\-ds\-XXX
817 (for the former type) and
818 .Ql volume\-as\-XXX
819 (for the latter type);
820 .Ql XXX
821 then denotes the keyword to be used with the
822 .Ql .Dt
823 macro.
825 This macro is neither callable nor parsed.
827 .It Li .Os Xo
828 .Op Aq operating system
829 .Op Aq release
831 If the first parameter is empty,
832 the default
833 .Sq Tn "\*[operating-system]"
834 is used.
835 This may be overridden in the local configuration file,
836 .Pa mdoc.local .
837 In general, the name of the operating system should be the common acronym,
838 e.g.\&
839 .Tn BSD
841 .Tn ATT .
842 The release should be the standard release nomenclature for the system
843 specified.
844 In the following table, the possible second arguments for some predefined
845 operating systems are listed.
846 Similar to
847 .Ql .Dt ,
848 local additions might be defined in
849 .Pa mdoc.local ;
850 look for strings named
851 .Ql operating\-system\-XXX\-YYY ,
852 where
853 .Ql XXX
854 is the acronym for the operating system and
855 .Ql YYY
856 the release ID.
858 .Bd -ragged -compact
859 .Bl -tag -width ".No FreeBSD" -offset indent
860 .It ATT
861 7th, 7, III, 3, V, V.2, V.3, V.4
862 .It BSD
863 3, 4, 4.1, 4.2, 4.3, 4.3t, 4.3T, 4.3r, 4.3R, 4.4
864 .It NetBSD
865 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,
866 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,
867 1.6.2, 2.0, 2.0.1, 2.0.2, 2.1, 3.0
868 .It FreeBSD
869 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,
870 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,
871 4.1.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.6.2, 4.7, 4.8, 4.9, 4.10, 4.11, 5.0, 5.1,
872 5.2, 5.2.1, 5.3, 5.4, 5.5, 6.0, 6.1, 6.2, 7.0
873 .It DragonFly
874 1.0, 1.1, 1.2, 1.3, 1.4, 1.5
875 .It Darwin
876 8.0.0, 8.1.0, 8.2.0, 8.3.0, 8.4.0, 8.5.0
882 .Tn ATT ,
883 an unknown second parameter will be replaced with the string
884 .Tn UNIX ;
885 for the other predefined acronyms it will be ignored and a warning message
886 emitted.
887 Unrecognized arguments are displayed as given in the page footer.
888 For instance, a typical footer might be:
890 .Dl .Os BSD 4.3
892 giving
893 .Ql 4.3\~Berkeley Distribution ,
894 or for a locally produced set
896 .Dl .Os CS Department
898 which will produce
899 .Ql CS\~Department .
901 If the
902 .Ql .Os
903 macro is not present, the bottom left corner of the manual page will be
904 ugly.
906 This macro is neither callable nor parsed.
908 .It Li .Dd Oo
909 .Aq month
910 .Aq day ,
911 .Aq year
914 .Ql Dd
915 has no arguments,
916 .Ql Epoch
917 is used for the date string.
918 If it has exactly three arguments, they are concatenated, separated with
919 unbreakable space:
921 .Dl .Dd January 25, 2001
923 The month's name shall not be abbreviated.
925 With any other number of arguments, the current date is used, ignoring
926 the parameters.
928 This macro is neither callable nor parsed.
932 .Sh "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS"
934 .Ss "What's in a Name" Ns ...
936 The manual domain macro names are derived from the day to day informal
937 language used to describe commands, subroutines and related files.
938 Slightly different variations of this language are used to describe the
939 three different aspects of writing a man page.
940 First, there is the description of
941 .Nm \-mdoc
942 macro command usage.
943 Second is the description of a
945 command
946 .Em with
947 .Nm \-mdoc
948 macros, and third, the description of a command to a user in the verbal
949 sense; that is, discussion of a command in the text of a man page.
951 In the first case,
952 .Xr troff 1
953 macros are themselves a type of command; the general syntax for a troff
954 command is:
956 .Bd -filled -offset indent
957 .Li ".Xx argument1 argument2" ...
961 .Ql .Xx
962 is a macro command, and anything following it are arguments to
963 be processed.
964 In the second case, the description of a
966 command using the content macros is a bit more involved; a typical
967 .Sx SYNOPSIS
968 command line might be displayed as:
970 .Bd -filled -offset indent
971 .Nm filter
972 .Op Fl flag
973 .Ao Ar infile Ac Ao Ar outfile Ac
977 Here,
978 .Nm filter
979 is the command name and the
980 bracketed string
981 .Fl flag
982 is a
983 .Em flag
984 argument designated as optional by the option brackets.
986 .Nm \-mdoc
987 terms,
988 .Ao Ar infile Ac
990 .Ao Ar outfile Ac
991 are called
992 .Em meta arguments ;
993 in this example, the user has to replace the meta expressions given in angle
994 brackets with real file names.
995 Note that in this document meta arguments are used to describe
996 .Nm \-mdoc
997 commands; in most man pages, meta variables are not specifically written
998 with angle brackets.
999 The macros which formatted the above example:
1001 .Bd -literal -offset indent
1002 \&.Nm filter
1003 \&.Op Fl flag
1004 \&.Ao Ar infile Ac Ao Ar outfile Ac
1008 In the third case, discussion of commands and command syntax includes both
1009 examples above, but may add more detail.
1010 The arguments
1011 .Ao Ar infile Ac
1013 .Ao Ar outfile Ac
1014 from the example above might be referred to as
1015 .Em operands
1017 .Em file arguments .
1018 Some command line argument lists are quite long:
1020 .Bd -ragged
1021 .Bl -tag -width ".Nm make" -offset indent -compact
1022 .It Nm make
1023 .Op Fl eiknqrstv
1024 .Op Fl D Ar variable
1025 .Op Fl d Ar flags
1026 .Op Fl f Ar makefile
1027 .Op Fl I Ar directory
1028 .Op Fl j Ar max_jobs
1029 .Op Ar variable Ns = Ns Ar value
1031 .Op Ar target ...
1037 Here one might talk about the command
1038 .Nm make
1039 and qualify the argument,
1040 .Ar makefile ,
1041 as an argument to the flag,
1042 .Fl f ,
1043 or discuss the optional file operand
1044 .Ar target .
1045 In the verbal context, such detail can prevent confusion, however the
1046 .Nm \-mdoc
1047 package does not have a macro for an argument
1048 .Em to
1049 a flag.
1050 Instead the
1051 .Ql \&Ar
1052 argument macro is used for an operand or file argument like
1053 .Ar target
1054 as well as an argument to a flag like
1055 .Ar variable .
1056 The make command line was produced from:
1058 .Bd -literal -offset indent
1059 \&.Nm make
1060 \&.Op Fl eiknqrstv
1061 \&.Op Fl D Ar variable
1062 \&.Op Fl d Ar flags
1063 \&.Op Fl f Ar makefile
1064 \&.Op Fl I Ar directory
1065 \&.Op Fl j Ar max_jobs
1066 \&.Op Ar variable Ns = Ns Ar value
1067 \&.Bk
1068 \&.Op Ar target ...
1069 \&.Ek
1074 .Ql .Bk
1076 .Ql .Ek
1077 macros are explained in
1078 .Sx Keeps .
1080 .Ss "General Syntax"
1082 The manual domain and general text domain macros share a similar syntax with
1083 a few minor deviations; most notably,
1084 .Ql .Ar ,
1085 .Ql .Fl ,
1086 .Ql .Nm ,
1088 .Ql .Pa
1089 differ only when called without arguments; and
1090 .Ql .Fn
1092 .Ql .Xr
1093 impose an order on their argument lists.
1094 All content macros are capable of recognizing and properly handling
1095 punctuation, provided each punctuation character is separated by a leading
1096 space.
1097 If a command is given:
1099 .Dl \&.Ar sptr, ptr),
1101 The result is:
1103 .Dl Ar sptr, ptr),
1105 The punctuation is not recognized and all is output in the
1106 font used by
1107 .Ql .Ar .
1108 If the punctuation is separated by a leading white space:
1110 .Dl \&.Ar "sptr , ptr ) ,"
1112 The result is:
1114 .Dl Ar sptr , ptr ) ,
1116 The punctuation is now recognized and output in the default font
1117 distinguishing it from the argument strings.
1118 To remove the special meaning from a punctuation character escape it with
1119 .Ql \e& .
1121 The following punctuation characters are recognized by
1122 .Nm \-mdoc :
1124 .Bl -column -offset indent-two XXXXXX XXXXXX XXXXXX XXXXXX
1125 .It Li .\& Ta Li ,\& Ta Li :\& Ta Li ;\& Ta Li (\&
1126 .It Li )\& Ta Li [\& Ta Li ]\& Ta Li ?\& Ta Li !\&
1130 .Xr Troff
1131 is limited as a macro language, and has difficulty when presented with a
1132 string containing a member of the mathematical, logical or quotation set:
1134 .Bd -literal -offset indent-two
1135 {+,\-,/,*,%,<,>,<=,>=,=,==,&,`,',"}
1139 The problem is that
1140 .Xr troff
1141 may assume it is supposed to actually perform the operation or evaluation
1142 suggested by the characters.
1143 To prevent the accidental evaluation of these characters, escape them with
1144 .Ql \e& .
1145 Typical syntax is shown in the first content macro displayed below,
1146 .Ql .Ad .
1149 .Sh "MANUAL DOMAIN"
1151 .Ss Addresses
1153 The address macro identifies an address construct.
1155 .Dl Usage: .Ad Ao address Ac ...
1157 .Bl -tag -width ".Li .Ad\ f1\ ,\ f2\ ,\ f3\ :" -compact -offset 15n
1158 .It Li ".Ad addr1"
1159 .Ad addr1
1160 .It Li ".Ad addr1 ."
1161 .Ad addr1 .
1162 .It Li ".Ad addr1 , file2"
1163 .Ad addr1 , file2
1164 .It Li ".Ad f1 , f2 , f3 :"
1165 .Ad f1 , f2 , f3 :
1166 .It Li ".Ad addr ) ) ,"
1167 .Ad addr ) ) ,
1171 The default width is 12n.
1173 .Ss "Author Name"
1176 .Ql .An
1177 macro is used to specify the name of the author of the item being
1178 documented, or the name of the author of the actual manual page.
1180 .Dl Usage: .An Ao author name Ac ...
1182 .Bl -tag -width ".Li .An\ \*[q]Joe\ Author\*[q]\ )\ )\ ," -offset 15n
1183 .It Li ".An \*[q]Joe Author\*[q]"
1184 .An "Joe Author"
1185 .It Li ".An \*[q]Joe Author\*[q] ,"
1186 .An "Joe Author" ,
1187 .It Li ".An \*[q]Joe Author\*[q] Aq nobody@FreeBSD.org"
1188 .An "Joe Author" Aq nobody@FreeBSD.org
1189 .It Li ".An \*[q]Joe Author\*[q] ) ) ,"
1190 .An "Joe Author" ) ) ,
1194 The default width is 12n.
1196 In the
1197 .Sx AUTHORS
1198 section, the
1199 .Ql .An
1200 command causes a line break allowing each new name to appear on its own
1201 line.
1202 If this is not desirable,
1204 .Bd -literal -offset indent
1205 \&.An \-nosplit
1209 call will turn this off.
1210 To turn splitting back on, write
1212 .Bd -literal -offset indent
1213 \&.An \-split
1216 .Ss "Arguments"
1219 .Li .Ar
1220 argument macro may be used whenever an argument is referenced.
1221 If called without arguments, the
1222 .Sq Ar
1223 string is output.
1225 .Dl Usage: .Ar Oo Ao argument Ac Oc ...
1227 .Bl -tag -width ".Li .Ar\ file1\ file2" -compact -offset 15n
1228 .It Li .Ar
1230 .It Li ".Ar file1"
1231 .Ar file1
1232 .It Li ".Ar file1 ."
1233 .Ar file1 .
1234 .It Li ".Ar file1 file2"
1235 .Ar file1 file2
1236 .It Li ".Ar f1 f2 f3 :"
1237 .Ar f1 f2 f3 :
1238 .It Li ".Ar file ) ) ,"
1239 .Ar file ) ) ,
1243 The default width is 12n.
1245 .Ss "Configuration Declaration (Section Four Only)"
1248 .Ql .Cd
1249 macro is used to demonstrate a
1250 .Xr config 8
1251 declaration for a device interface in a section four manual.
1253 .Dl Usage: .Cd Ao argument Ac ...
1255 .Bl -tag -width ".Li .Cd\ Xdevice\ le0\ at\ scode?X" -offset 15n
1256 .It Li ".Cd \*[q]device le0 at scode?\*[q]"
1257 .Cd "device le0 at scode?"
1260 In the
1261 .Sx SYNOPSIS
1262 section a
1263 .Ql .Cd
1264 command causes a line break before and after its arguments are printed.
1267 The default width is 12n.
1269 .Ss "Command Modifiers"
1271 The command modifier is identical to the
1272 .Ql .Fl
1273 (flag) command with the exception that the
1274 .Ql .Cm
1275 macro does not assert a dash in front of every argument.
1276 Traditionally flags are marked by the preceding dash, however, some commands
1277 or subsets of commands do not use them.
1278 Command modifiers may also be specified in conjunction with interactive
1279 commands such as editor commands.
1281 .Sx Flags .
1283 The default width is 10n.
1285 .Ss "Defined Variables"
1287 A variable (or constant) which is defined in an include file
1288 is specified by the macro
1289 .Ql .Dv .
1291 .Dl Usage: .Dv Ao defined variable Ac ...
1293 .Bl -tag -width ".Li .Dv\ MAXHOSTNAMELEN" -compact -offset 15n
1294 .It Li ".Dv MAXHOSTNAMELEN"
1295 .Dv MAXHOSTNAMELEN
1296 .It Li ".Dv TIOCGPGRP )"
1297 .Dv TIOCGPGRP )
1301 The default width is 12n.
1303 .Ss Errno's
1306 .Ql .Er
1307 errno macro specifies the error return value for section 2, 3, and\~9 library
1308 routines.
1309 The second example below shows
1310 .Ql .Er
1311 used with the
1312 .Ql .Bq
1313 general text domain macro, as it would be used in a section two manual page.
1315 .Dl Usage: .Er Ao errno type Ac ...
1317 .Bl -tag -width ".Li .Bq\ Er\ ENOTDIR" -compact -offset 15n
1318 .It Li ".Er ENOENT"
1319 .Er ENOENT
1320 .It Li ".Er ENOENT ) ;"
1321 .Er ENOENT ) ;
1322 .It Li ".Bq Er ENOTDIR"
1323 .Bq Er ENOTDIR
1327 The default width is 17n.
1329 .Ss "Environment Variables"
1332 .Ql .Ev
1333 macro specifies an environment variable.
1335 .Dl Usage: .Ev Ao argument Ac ...
1337 .Bl -tag -width ".Li .Ev\ PRINTER\ )\ )\ ," -compact -offset 15n
1338 .It Li ".Ev DISPLAY"
1339 .Ev DISPLAY
1340 .It Li ".Ev PATH ."
1341 .Ev PATH .
1342 .It Li ".Ev PRINTER ) ) ,"
1343 .Ev PRINTER ) ) ,
1347 The default width is 15n.
1349 .Ss Flags
1352 .Ql .Fl
1353 macro handles command line flags.
1354 It prepends a dash,
1355 .Ql \- ,
1356 to the flag.
1357 For interactive command flags, which are not prepended with a dash, the
1358 .Ql .Cm
1359 (command modifier)
1360 macro is identical, but without the dash.
1362 .Dl Usage: .Fl Ao argument Ac ...
1364 .Bl -tag -width ".Li .Fl\ xyz\ )\ ," -compact -offset 15n
1365 .It Li .Fl
1367 .It Li ".Fl cfv"
1368 .Fl cfv
1369 .It Li ".Fl cfv ."
1370 .Fl cfv .
1371 .It Li ".Cm cfv ."
1372 .Cm cfv .
1373 .It Li ".Fl s v t"
1374 .Fl s v t
1375 .It Li ".Fl \- ,"
1376 .Fl \- ,
1377 .It Li ".Fl xyz ) ,"
1378 .Fl xyz ) ,
1379 .It Li ".Fl |"
1380 .Fl |
1384 .Ql .Fl
1385 macro without any arguments results in a dash representing stdin/stdout.
1386 Note that giving
1387 .Ql .Fl
1388 a single dash will result in two dashes.
1390 The default width is 12n.
1392 .Ss "Function Declarations"
1395 .Ql .Fd
1396 macro is used in the
1397 .Sx SYNOPSIS
1398 section with section two or three functions.
1399 It is neither callable nor parsed.
1401 .Dl Usage: .Fd Ao argument Ac ...
1403 .Bl -tag -width ".Li .Fd\ X#include\ <sys/types.h>X" -compact -offset 15n
1404 .It Li ".Fd \*[q]#include <sys/types.h>\*[q]"
1405 .Fd "#include <sys/types.h>"
1408 In the
1409 .Sx SYNOPSIS
1410 section a
1411 .Ql .Fd
1412 command causes a line break if a function has already been presented and a
1413 break has not occurred.
1414 This leaves a nice vertical space in between the previous function call and
1415 the declaration for the next function.
1419 .Ql .In
1420 macro, while in the
1421 .Sx SYNOPSIS
1422 section, represents the
1423 .Li #include
1424 statement, and is the short form of the above example.
1425 It specifies the C\~header file as being included in a C\~program.
1426 It also causes a line break.
1428 While not in the
1429 .Sx SYNOPSIS
1430 section, it represents the header file enclosed in angle brackets.
1432 .Dl Usage: .In Ao header file Ac
1434 .Bl -tag -width ".Li .In\ stdio.h" -compact -offset 15n
1435 .nr in-synopsis-section 1
1436 .It Li ".In stdio.h"
1437 .In stdio.h
1438 .nr in-synopsis-section 0
1439 .It Li ".In stdio.h"
1440 .In stdio.h
1443 .Ss "Function Types"
1445 This macro is intended for the
1446 .Sx SYNOPSIS
1447 section.
1448 It may be used anywhere else in the man page without problems, but its main
1449 purpose is to present the function type in kernel normal form for the
1450 .Sx SYNOPSIS
1451 of sections two and three (it causes a line break, allowing the function
1452 name to appear on the next line).
1454 .Dl Usage: .Ft Ao type Ac ...
1456 .Bl -tag -width ".Li .Ft\ struct\ stat" -compact -offset 15n
1457 .It Li ".Ft struct stat"
1458 .Ft struct stat
1461 .Ss "Functions (Library Routines)"
1463 The 
1464 .Ql .Fn
1465 macro is modeled on
1466 .Tn ANSI\~C
1467 conventions.
1469 .Dl Usage: .Fn Ao function Ac Oo Ao parameter Ac Oc ...
1471 .Bl -tag -width ".Li .Fn\ align\ Xchar\ *ptrX\ ," -compact -offset 15n
1472 .It Li ".Fn getchar"
1473 .Fn getchar
1474 .It Li ".Fn strlen ) ,"
1475 .Fn strlen ) ,
1476 .It Li ".Fn align \*[q]char *ptr\*[q] ,"
1477 .Fn align "char *ptr" ,
1480 Note that any call to another macro signals the end of the
1481 .Ql .Fn
1482 call (it will insert a closing parenthesis at that point).
1484 For functions with many parameters (which is rare), the macros
1485 .Ql .Fo
1486 (function open)
1488 .Ql .Fc
1489 (function close)
1490 may be used with
1491 .Ql .Fa
1492 (function argument).
1494 Example:
1496 .Bd -literal -offset indent
1497 \&.Ft int
1498 \&.Fo res_mkquery
1499 \&.Fa "int op"
1500 \&.Fa "char *dname"
1501 \&.Fa "int class"
1502 \&.Fa "int type"
1503 \&.Fa "char *data"
1504 \&.Fa "int datalen"
1505 \&.Fa "struct rrec *newrr"
1506 \&.Fa "char *buf"
1507 \&.Fa "int buflen"
1508 \&.Fc
1512 Produces:
1514 .Bd -ragged -offset indent
1515 .Ft int
1516 .Fo res_mkquery
1517 .Fa "int op"
1518 .Fa "char *dname"
1519 .Fa "int class"
1520 .Fa "int type"
1521 .Fa "char *data"
1522 .Fa "int datalen"
1523 .Fa "struct rrec *newrr"
1524 .Fa "char *buf"
1525 .Fa "int buflen"
1530 In the
1531 .Sx SYNOPSIS
1532 section, the function will always begin at the beginning of line.
1533 If there is more than one function presented in the
1534 .Sx SYNOPSIS
1535 section and a function type has not been given, a line break will occur,
1536 leaving a nice vertical space between the current function name and the one
1537 prior.
1539 The default width values of
1540 .Ql .Fn
1542 .Ql .Fo
1543 are 12n and 16n, respectively.
1545 .Ss "Function Arguments"
1548 .Ql .Fa
1549 macro is used to refer to function arguments (parameters) outside of the
1550 .Sx SYNOPSIS
1551 section of the manual or inside the
1552 .Sx SYNOPSIS
1553 section if the enclosure macros
1554 .Ql .Fo
1556 .Ql .Fc
1557 instead of
1558 .Ql .Fn
1559 are used.
1560 .Ql .Fa
1561 may also be used to refer to structure members.
1563 .Dl Usage: .Fa Ao function argument Ac ...
1565 .Bl -tag -width ".Li .Fa\ d_namlen\ )\ )\ ," -compact -offset 15n
1566 .It Li ".Fa d_namlen ) ) ,"
1567 .Fa d_namlen ) ) ,
1568 .It Li ".Fa iov_len"
1569 .Fa iov_len
1573 The default width is 12n.
1575 .Ss "Return Values"
1578 .Ql .Rv
1579 macro generates text for use in the
1580 .Sx RETURN VALUES
1581 section.
1583 .Dl Usage: .Rv Oo \-std Oc Op Ao function Ac ...
1585 For example,
1586 .Ql ".Rv \-std atexit"
1587 produces:
1589 .Bd -ragged -offset -indent
1590 \# a small hack to suppress a warning message
1591 .ds section-old "\*[section]
1592 .ds section 3
1593 .Rv -std atexit
1594 .ds section "\*[section-old]
1599 .Fl std
1600 option is valid only for manual page sections\~2 and\~3.
1601 Currently, this macro does nothing if used without the
1602 .Fl std
1603 flag.
1605 .Ss "Exit Status"
1608 .Ql .Ex
1609 macro generates text for use in the
1610 .Sx DIAGNOSTICS
1611 section.
1613 .Dl Usage: .Ex Oo \-std Oc Op Ao utility Ac ...
1615 For example,
1616 .Ql ".Ex \-std cat"
1617 produces:
1619 .Bd -ragged -offset -indent
1620 \# a small hack to suppress a warning message
1621 .ds section-old "\*[section]
1622 .ds section 1
1623 .Ex -std cat
1624 .ds section "\*[section-old]
1629 .Fl std
1630 option is valid only for manual page sections 1, 6 and\~8.
1631 Currently, this macro does nothing if used without the
1632 .Fl std
1633 flag.
1635 .Ss "Interactive Commands"
1638 .Ql .Ic
1639 macro designates an interactive or internal command.
1641 .Dl Usage: .Ic Ao argument Ac ...
1643 .Bl -tag -width ".Li .Ic\ setenv\ ,\ unsetenv" -compact -offset 15n
1644 .It Li ".Ic :wq"
1645 .Ic :wq
1646 .It Li ".Ic \*[q]do while {...}\*[q]"
1647 .Ic "do while {...}"
1648 .It Li ".Ic setenv , unsetenv"
1649 .Ic setenv , unsetenv
1653 The default width is 12n.
1655 .Ss "Library Names"
1658 .Ql .Lb
1659 macro is used to specify the library where a particular function is compiled
1662 .Dl Usage: .Lb Ao argument Ac ...
1664 Available arguments to
1665 .Ql .Lb 
1666 and their results are:
1669 .Bl -tag -width ".Li libossaudio" -compact -offset indent
1670 .It Li libarm
1671 .Lb libarm
1672 .It Li libarm32
1673 .Lb libarm32
1674 .It Li libc
1675 .Lb libc
1676 .It Li libcdk
1677 .Lb libcdk
1678 .It Li libcompat
1679 .Lb libcompat
1680 .It Li libcrypt
1681 .Lb libcrypt
1682 .It Li libcurses
1683 .Lb libcurses
1684 .It Li libedit
1685 .Lb libedit
1686 .It Li libevent
1687 .Lb libevent
1688 .It Li libform
1689 .Lb libform
1690 .It Li libi386
1691 .Lb libi386
1692 .It Li libintl
1693 .Lb libintl
1694 .It Li libipsec
1695 .Lb libipsec
1696 .It Li libkvm
1697 .Lb libkvm
1698 .It Li libm
1699 .Lb libm
1700 .It Li libm68k
1701 .Lb libm68k
1702 .It Li libmagic
1703 .Lb libmagic
1704 .It Li libmenu
1705 .Lb libmenu
1706 .It Li libossaudio
1707 .Lb libossaudio
1708 .It Li libpam
1709 .Lb libpam
1710 .It Li libpcap
1711 .Lb libpcap
1712 .It Li libpci
1713 .Lb libpci
1714 .It Li libpmc
1715 .Lb libpmc
1716 .It Li libposix
1717 .Lb libposix
1718 .It Li libpthread
1719 .Lb libpthread
1720 .It Li libresolv
1721 .Lb libresolv
1722 .It Li librt
1723 .Lb librt
1724 .It Li libtermcap
1725 .Lb libtermcap
1726 .It Li libusbhid
1727 .Lb libusbhid
1728 .It Li libutil
1729 .Lb libutil
1730 .It Li libx86_64
1731 .Lb libx86_64
1732 .It Li libz
1733 .Lb libz
1737 Local, OS-specific additions might be found in the file
1738 .Pa mdoc.local ;
1739 look for strings named
1740 .Ql str\-Lb\-XXX .
1741 .Ql XXX
1742 then denotes the keyword to be used with the
1743 .Ql .Lb
1744 macro.
1746 In the
1747 .Sx LIBRARY
1748 section an
1749 .Ql .Lb
1750 command causes a line break before and after its arguments are printed.
1753 .Ss Literals
1756 .Ql .Li
1757 literal macro may be used for special characters, variable constants, etc.\&
1758 \- anything which should be displayed as it would be typed.
1760 .Dl Usage: .Li Ao argument Ac ...
1762 .Bl -tag -width ".Li .Li\ cntrl\-D\ )\ ,"  -compact -offset 15n
1763 .It Li ".Li \een"
1764 .Li \en
1765 .It Li ".Li M1 M2 M3 ;"
1766 .Li M1 M2 M3 ;
1767 .It Li ".Li cntrl\-D ) ,"
1768 .Li cntrl-D ) ,
1769 .It Li ".Li 1024 ..."
1770 .Li 1024 ...
1774 The default width is 16n.
1776 .Ss Names
1779 .Ql .Nm
1780 macro is used for the document title or subject name.
1781 It has the peculiarity of remembering the first argument it was called with,
1782 which should always be the subject name of the page.
1783 When called without arguments,
1784 .Ql .Nm
1785 regurgitates this initial name for the sole purpose of making less work for
1786 the author.
1787 Note: A section two or three document function name is addressed with the
1788 .Ql .Nm
1789 in the
1790 .Sx NAME
1791 section, and with
1792 .Ql .Fn
1793 in the
1794 .Sx SYNOPSIS
1795 and remaining sections.
1796 For interactive commands, such as the
1797 .Ql while
1798 command keyword in
1799 .Xr csh 1 ,
1801 .Ql .Ic
1802 macro should be used.
1803 While
1804 .Ql .Ic
1805 is nearly identical
1807 .Ql .Nm ,
1808 it can not recall the first argument it was invoked with.
1810 .Dl Usage: .Nm Oo Ao argument Ac Oc ...
1812 .Bl -tag -width ".Li .Nm\ groff_mdoc" -compact -offset 15n
1813 .It Li ".Nm groff_mdoc"
1814 .Nm groff_mdoc
1815 .It Li ".Nm \e\-mdoc"
1816 .Nm \-mdoc
1817 .It Li ".Nm foo ) ) ,"
1818 .Nm foo ) ) ,
1819 .It Li ".Nm :"
1820 .Nm :
1824 The default width is 10n.
1826 .Ss Options
1829 .Ql .Op
1830 macro places option brackets around any remaining arguments on the
1831 command line, and places any trailing punctuation outside the brackets.
1832 The macros
1833 .Ql .Oo
1835 .Ql .Oc
1836 (which produce an opening and a closing option bracket respectively) may be used
1837 across one or more lines or to specify the exact position of the closing
1838 parenthesis.
1840 .Dl Usage: .Op Oo Ao option Ac Oc ...
1842 .Bl -tag -width ".Li .Op\ Fl\ c\ Ar\ objfil\ Op\ Ar\ corfil\ ," -compact -offset 15n
1843 .It Li .Op
1845 .It Li ".Op Fl k"
1846 .Op Fl k
1847 .It Li ".Op Fl k ) ."
1848 .Op Fl k ) .
1849 .It Li ".Op Fl k Ar kookfile"
1850 .Op Fl k Ar kookfile
1851 .It Li ".Op Fl k Ar kookfile ,"
1852 .Op Fl k Ar kookfile ,
1853 .It Li ".Op Ar objfil Op Ar corfil"
1854 .Op Ar objfil Op Ar corfil
1855 .It Li ".Op Fl c Ar objfil Op Ar corfil ,"
1856 .Op Fl c Ar objfil Op Ar corfil ,
1857 .It Li ".Op word1 word2"
1858 .Op word1 word2
1859 .It Li ".Li .Op Oo Ao option Ac Oc ..."
1860 .Li .Op Oo Ao option Ac Oc ...
1863 Here a typical example of the
1864 .Ql .Oo
1866 .Ql .Oc
1867 macros:
1869 .Bd -literal -offset indent
1870 \&.Oo
1871 \&.Op Fl k Ar kilobytes
1872 \&.Op Fl i Ar interval
1873 \&.Op Fl c Ar count
1874 \&.Oc
1878 Produces:
1880 .Bd -filled -offset indent
1882 .Op Fl k Ar kilobytes
1883 .Op Fl i Ar interval
1884 .Op Fl c Ar count
1889 The default width values of
1890 .Ql .Op
1892 .Ql .Oo
1893 are 14n and 10n, respectively.
1895 .Ss Pathnames
1898 .Ql .Pa
1899 macro formats path or file names.
1900 If called without arguments, the
1901 .Sq Pa
1902 string is output, which represents the current user's home directory.
1904 .Dl Usage: .Pa Oo Ao pathname Ac Oc ...
1906 .Bl -tag -width ".Li .Pa\ /tmp/fooXXXXX\ )\ ." -compact -offset 15n
1907 .It Li .Pa
1909 .It Li ".Pa /usr/share"
1910 .Pa /usr/share
1911 .It Li ".Pa /tmp/fooXXXXX ) ."
1912 .Pa /tmp/fooXXXXX ) .
1916 The default width is 32n.
1918 .Ss Standards
1921 .Ql .St
1922 macro replaces standard abbreviations with their formal names.
1924 .Dl Usage: .St Ao abbreviation Ac ...
1926 Available pairs for
1927 .Dq Abbreviation/Formal Name
1928 are:
1931 .Tn ANSI/ISO C
1933 .Bl -tag -width ".Li \-p1003.1g\-2000" -compact -offset indent
1934 .It Li \-ansiC
1935 .St -ansiC
1936 .It Li \-ansiC\-89
1937 .St -ansiC-89
1938 .It Li \-isoC
1939 .St -isoC
1940 .It Li \-isoC\-90
1941 .St -isoC-90
1942 .It Li \-isoC\-99
1943 .St -isoC-99
1947 .Tn POSIX
1948 Part 1: System API
1950 .Bl -tag -width ".Li \-p1003.1g\-2000" -compact -offset indent
1951 .It Li \-iso9945\-1\-90
1952 .St -iso9945-1-90
1953 .It Li \-iso9945\-1\-96
1954 .St -iso9945-1-96
1955 .It Li \-p1003.1
1956 .St -p1003.1
1957 .It Li \-p1003.1\-88
1958 .St -p1003.1-88
1959 .It Li \-p1003.1\-90
1960 .St -p1003.1-90
1961 .It Li \-p1003.1\-96
1962 .St -p1003.1-96
1963 .It Li \-p1003.1b\-93
1964 .St -p1003.1b-93
1965 .It Li \-p1003.1c\-95
1966 .St -p1003.1c-95
1967 .It Li \-p1003.1g\-2000
1968 .St -p1003.1g-2000
1969 .It Li \-p1003.1i\-95
1970 .St -p1003.1i-95
1971 .It Li \-p1003.1\-2001
1972 .St -p1003.1-2001
1973 .It Li \-p1003.1\-2004
1974 .St -p1003.1-2004
1978 .Tn POSIX
1979 Part 2: Shell and Utilities
1981 .Bl -tag -width ".Li \-p1003.1g\-2000" -compact -offset indent
1982 .It Li \-iso9945\-2\-93
1983 .St -iso9945-2-93
1984 .It Li \-p1003.2
1985 .St -p1003.2
1986 .It Li \-p1003.2\-92
1987 .St -p1003.2-92
1988 .It Li \-p1003.2a\-92
1989 .St -p1003.2a-92
1993 X/Open
1994 .Bl -tag -width ".Li \-p1003.1g\-2000" -compact -offset indent
1996 .It Li \-susv2
1997 .St -susv2
1998 .It Li \-susv3
1999 .St -susv3
2000 .It Li \-svid4
2001 .St -svid4
2002 .It Li \-xbd5
2003 .St -xbd5
2004 .It Li \-xcu5
2005 .St -xcu5
2006 .It Li \-xcurses4.2
2007 .St -xcurses4.2
2008 .It Li \-xns5
2009 .St -xns5
2010 .It Li \-xns5.2
2011 .St -xns5.2
2012 .It Li \-xpg3
2013 .St -xpg3
2014 .It Li \-xpg4
2015 .St -xpg4
2016 .It Li \-xpg4.2
2017 .St -xpg4.2
2018 .It Li \-xsh5
2019 .St -xsh5
2023 Miscellaneous
2025 .Bl -tag -width ".Li \-p1003.1g\-2000" -compact -offset indent
2026 .It Li \-ieee754
2027 .St -ieee754
2028 .It Li \-iso8802\-3
2029 .St -iso8802-3
2032 .Ss "Variable Types"
2035 .Ql .Vt
2036 macro may be used whenever a type is referenced.
2037 In the
2038 .Sx SYNOPSIS
2039 section, it causes a line break (useful for old style variable declarations).
2041 .Dl Usage: .Vt Ao type Ac ...
2043 .Bl -tag -width ".Li .Vt\ extern\ char\ *optarg\ ;" -compact -offset 15n
2044 .It Li ".Vt extern char *optarg ;"
2045 .Vt extern char *optarg ;
2046 .It Li ".Vt FILE *"
2047 .Vt FILE *
2050 .Ss Variables
2052 Generic variable reference.
2054 .Dl Usage: .Va Ao variable Ac ...
2056 .Bl -tag -width ".Li .Va\ Xchar\ sX\ ]\ )\ )\ ," -compact -offset 15n
2057 .It Li ".Va count"
2058 .Va count
2059 .It Li ".Va settimer ,"
2060 .Va settimer ,
2061 .It Li ".Va \*[q]int *prt\*[q] ) :"
2062 .Va "int *prt" ) :
2063 .It Li ".Va \*[q]char s\*[q] ] ) ) ,"
2064 .Va "char s" ] ) ) ,
2068 The default width is 12n.
2070 .Ss "Manual Page Cross References"
2073 .Ql .Xr
2074 macro expects the first argument to be a manual page name.
2075 The optional second argument, if a string (defining the manual section), is
2076 put into parentheses.
2078 .Dl Usage: .Xr Ao man page name Ac Oo Ao section Ac Oc ...
2080 .Bl -tag -width ".Li .Xr\ xinit\ 1x\ ;" -compact -offset 15n
2081 .It Li ".Xr mdoc"
2082 .Xr mdoc
2083 .It Li ".Xr mdoc ,"
2084 .Xr mdoc ,
2085 .It Li ".Xr mdoc 7"
2086 .Xr mdoc 7
2087 .It Li ".Xr xinit 1x ;"
2088 .Xr xinit 1x ;
2092 The default width is 10n.
2095 .Sh "GENERAL TEXT DOMAIN"
2097 .Ss "AT&T Macro"
2100 .Dl Usage: .At Oo Ao version Ac Oc ...
2102 .Bl -tag -width ".Li .At\ v6\ ." -compact -offset 15n
2103 .It Li .At
2105 .It Li ".At v6 ."
2106 .At v6 .
2109 The following values for
2110 .Ao version Ac
2111 are possible:
2113 .Dl 32v, v1, v2, v3, v4, v5, v6, v7, V, V.1, V.2, V.3, V.4
2115 .Ss "BSD Macro"
2118 .Dl "Usage: .Bx" Bro \-alpha | \-beta | \-devel Brc ...
2119 .Dl "       .Bx" Oo Ao version Ac Oo Ao release Ac Oc Oc ...
2121 .Bl -tag -width ".Li .Bx\ -devel" -compact -offset 15n
2122 .It Li .Bx
2124 .It Li ".Bx 4.3 ."
2125 .Bx 4.3 .
2126 .It Li ".Bx \-devel"
2127 .Bx -devel
2130 .Ao version Ac
2131 will be prepended to the string
2132 .Sq Bx .
2133 The following values for
2134 .Ao release Ac
2135 are possible:
2137 .Dl Reno, reno, Tahoe, tahoe, Lite, lite, Lite2, lite2
2139 .Ss "NetBSD Macro"
2142 .Dl Usage: .Nx Oo Ao version Ac Oc ...
2144 .Bl -tag -width ".Li .Nx\ 1.4\ ." -compact -offset 15n
2145 .It Li .Nx
2147 .It Li ".Nx 1.4 ."
2148 .Nx 1.4 .
2151 For possible values of
2152 .Ao version Ac
2153 see the description of the
2154 .Ql .Os
2155 command above in section
2156 .Sx "TITLE MACROS" .
2158 .Ss "FreeBSD Macro"
2161 .Dl Usage: .Fx Oo Ao version Ac Oc ...
2163 .Bl -tag -width ".Li .Fx\ 2.2\ ." -compact -offset 15n
2164 .It Li .Fx
2166 .It Li ".Fx 2.2 ."
2167 .Fx 2.2 .
2170 For possible values of
2171 .Ao version Ac
2172 see the description of the
2173 .Ql .Os
2174 command above in section
2175 .Sx "TITLE MACROS" .
2177 .Ss "DragonFly Macro"
2180 .Dl Usage: .Dx Oo Ao version Ac Oc ...
2182 .Bl -tag -width ".Li .Dx\ 1.4\ ." -compact -offset 15n
2183 .It Li .Dx
2185 .It Li ".Dx 1.4 ."
2186 .Dx 1.4 .
2189 For possible values of
2190 .Ao version Ac
2191 see the description of the
2192 .Ql .Os
2193 command above in section
2194 .Sx "TITLE MACROS" .
2196 .Ss "OpenBSD Macro"
2199 .Dl Usage: .Ox Oo Ao version Ac Oc ...
2201 .Bl -tag -width ".Li .Ox\ 1.0" -compact -offset 15n
2202 .It Li ".Ox 1.0"
2203 .Ox 1.0
2206 .Ss "BSD/OS Macro"
2209 .Dl Usage: .Bsx Oo Ao version Ac Oc ...
2211 .Bl -tag -width ".Li .Bsx\ 1.0" -compact -offset 15n
2212 .It Li ".Bsx 1.0"
2213 .Bsx 1.0
2216 .Ss "UNIX Macro"
2219 .Dl Usage: .Ux ...
2221 .Bl -tag -width ".Li .Ux" -compact -offset 15n
2222 .It Li .Ux
2226 .Ss "Emphasis Macro"
2228 Text may be stressed or emphasized with the
2229 .Ql .Em
2230 macro.
2231 The usual font for emphasis is italic.
2233 .Dl Usage: .Em Ao argument Ac ...
2235 .Bl -tag -width ".Li .Em\ vide\ infra\ )\ )\ ," -compact -offset 15n
2236 .It Li ".Em does not"
2237 .Em does not
2238 .It Li ".Em exceed 1024 ."
2239 .Em exceed 1024 .
2240 .It Li ".Em vide infra ) ) ,"
2241 .Em vide infra ) ) ,
2245 The default width is 10n.
2247 .Ss "Font Mode"
2250 .Ql .Bf
2251 font mode must be ended with the
2252 .Ql .Ef
2253 macro (the latter takes no arguments).
2254 Font modes may be nested within other font modes.
2256 .Ql .Bf
2257 has the following syntax:
2259 .Dl .Bf Ao font mode Ac
2261 .Ao font mode Ac
2262 must be one of the following three types:
2264 .Bl -tag -width ".Sy \&Sy | Fl symbolic" -compact -offset indent
2265 .It Sy \&Em | Fl emphasis
2266 Same as if the 
2267 .Ql .Em
2268 macro was used for the entire block of text.
2269 .It Sy \&Li | Fl literal
2270 Same as if the
2271 .Ql .Li
2272 macro was used for the entire block of text.
2273 .It Sy \&Sy | Fl symbolic
2274 Same as if the
2275 .Ql .Sy
2276 macro was used for the entire block of text.
2279 Both macros are neither callable nor parsed.
2281 .Ss "Enclosure and Quoting Macros"
2283 The concept of enclosure is similar to quoting.
2284 The object being to enclose one or more strings between a pair of characters
2285 like quotes or parentheses.
2286 The terms quoting and enclosure are used interchangeably throughout this
2287 document.
2288 Most of the one-line enclosure macros end in small letter
2289 .Ql q
2290 to give a hint of quoting, but there are a few irregularities.
2291 For each enclosure macro there is also a pair of open and close macros which
2292 end in small letters
2293 .Ql o
2295 .Ql c
2296 respectively.
2298 \# XXX
2299 .if t \
2300 .  ne 10
2302 .Bd -filled -offset 4n
2303 .Bl -column "quote" "close" "open" "Angle Bracket Enclosure" "`string' or string"
2304 .Em Quote Ta Em Open Ta Em Close Ta Em Function               Ta Em Result
2305 .No .Aq   Ta    .Ao  Ta    .Ac   Ta "Angle Bracket Enclosure" Ta Ao string Ac
2306 .No .Bq   Ta    .Bo  Ta    .Bc   Ta "Bracket Enclosure"       Ta Bo string Bc
2307 .No .Brq  Ta    .Bro Ta    .Brc  Ta "Brace Enclosure"         Ta Bro string Brc
2308 .No .Dq   Ta    .Do  Ta    .Dc   Ta "Double Quote"            Ta Do string Dc
2309 .No .Eq   Ta    .Eo  Ta    .Ec   Ta "Enclose String (in XX)"  Ta XXstringXX
2310 .No .Pq   Ta    .Po  Ta    .Pc   Ta "Parenthesis Enclosure"   Ta Po string Pc
2311 .No .Ql   Ta         Ta          Ta "Quoted Literal"          Ta So string Sc or Li string
2312 .No .Qq   Ta    .Qo  Ta    .Qc   Ta "Straight Double Quote"   Ta Qo string Qc
2313 .No .Sq   Ta    .So  Ta    .Sc   Ta "Single Quote"            Ta So string Sc
2317 All macros ending with
2318 .Sq q
2320 .Sq o
2321 have a default width value of 12n.
2323 .Bl -tag -width ".Li .Ec , .Eo"
2324 .It Li .Eo , .Ec
2325 These macros expect the first argument to be the opening and closing strings
2326 respectively.
2327 .It Li .Es , .En
2328 Due to the nine-argument limit in the original troff program two other
2329 macros have been implemented which are now rather obsolete:
2330 .Ql .Es
2331 takes the first and second parameter as the left and right enclosure string,
2332 which are then used to enclose the arguments of
2333 .Ql .En .
2334 The default width value is 12n for both macros.
2335 .It Li .Eq
2336 The first and second arguments of this macro are the opening and
2337 closing strings respectively, followed by the arguments to be enclosed.
2338 .It Li .Ql
2339 The quoted literal macro behaves differently in troff and nroff mode.
2340 If formatted with
2341 .Xr nroff ,
2342 a quoted literal is always quoted.
2343 If formatted with troff, an item is only quoted if the width of the item is
2344 less than three constant width characters.
2345 This is to make short strings more visible where the font change to literal
2346 (constant width) is less noticeable.
2348 The default width is 16n.
2349 .It Li .Pf
2350 The prefix macro suppresses the whitespace between its first and second
2351 argument:
2353 .Bl -tag -width ".Li .Pf\ (\ Fa\ name2" -offset indent
2354 .It Li ".Pf ( Fa name2"
2355 .Pf ( Fa name2
2359 The default width is 12n.
2362 .Ql .Ns
2363 macro (see below) performs the analogous suffix function.
2364 .It Li .Ap
2366 .Ql .Ap
2367 macro inserts an apostrophe and exits any special text modes, continuing in
2368 .Ql .No
2369 mode.
2373 Examples of quoting:
2376 .Bl -tag -width ".Li .Bq\ Em\ Greek\ ,\ French\ ." -compact -offset indent
2377 .It Li .Aq
2379 .It Li ".Aq Pa ctype.h ) ,"
2380 .Aq Pa ctype.h ) ,
2381 .It Li .Bq
2383 .It Li ".Bq Em Greek , French ."
2384 .Bq Em Greek , French .
2385 .It Li .Dq
2387 .It Li ".Dq string abc ."
2388 .Dq string abc .
2389 .It Li ".Dq \'^[A\-Z]\'"
2390 .Dq \'^[A-Z]\'
2391 .It Li ".Ql man mdoc"
2392 .Ql man mdoc
2393 .It Li .Qq
2395 .It Li ".Qq string ) ,"
2396 .Qq string ) ,
2397 .It Li ".Qq string Ns ),"
2398 .Qq string Ns ),
2399 .It Li .Sq
2401 .It Li ".Sq string"
2402 .Sq string
2403 .It Li ".Em or Ap ing"
2404 .Em or Ap ing
2408 For a good example of nested enclosure macros, see the
2409 .Ql .Op
2410 option macro.
2411 It was created from the same underlying enclosure macros as those presented
2412 in the list above.
2414 .Ql .Xo
2416 .Ql .Xc
2417 extended argument list macros are discussed below.
2419 .Ss "No-Op or Normal Text Macro"
2422 .Ql .No
2423 macro can be used in a macro command line for parameters which should
2424 .Em not
2425 be formatted.
2426 Be careful to add
2427 .Ql \e&
2428 to the word
2429 .Ql \&No
2430 if you really want that English word (and not the macro) as a parameter.
2432 .Dl Usage: .No Ao argument Ac ...
2434 .Bl -tag -width ".Li .No\ test\ Ta\ with\ Ta\ tabs" -compact -offset 15n
2435 .It Li ".No test Ta with Ta tabs"
2436 .No test Ta with Ta tabs
2440 The default width is 12n.
2442 .Ss "No-Space Macro"
2445 .Ql .Ns
2446 macro suppresses insertion of a space between the current position and its
2447 first parameter.
2448 For example, it is useful for old style argument lists where there is no
2449 space between the flag and argument:
2451 .Dl "Usage:" ... Ao argument Ac \&Ns Oo Ao argument Ac Oc ...
2452 .Dl "      " .Ns Ao argument Ac ...
2454 .Bl -tag -width ".Li .Op\ Fl\ I\ Ns\ Ar\ directory" -compact -offset 15n
2455 .It Li ".Op Fl I Ns Ar directory"
2456 .Op Fl I Ns Ar directory
2459 Note: The
2460 .Ql .Ns
2461 macro always invokes the
2462 .Ql .No
2463 macro after eliminating the space unless another macro name follows it.
2464 If used as a command (i.e., the second form above in the
2465 .Sq Usage
2466 line),
2467 .Ql .Ns
2468 is identical to
2469 .Ql .No .
2471 .Ss "Section Cross References"
2474 .Ql .Sx
2475 macro designates a reference to a section header within the same document.
2477 .Dl Usage: .Sx Ao section reference Ac ...
2479 .Bl -tag -width ".Li .Sx\ FILES" -offset 15n
2480 .It Li ".Sx FILES"
2481 .Sx FILES
2485 The default width is 16n.
2487 .Ss Symbolics
2489 The symbolic emphasis macro is generally a boldface macro in either the
2490 symbolic sense or the traditional English usage.
2492 .Dl Usage: .Sy Ao symbol Ac ...
2494 .Bl -tag -width ".Li .Sy\ Important\ Notice" -compact -offset 15n
2495 .It Li ".Sy Important Notice"
2496 .Sy Important Notice
2500 The default width is 6n.
2502 .Ss Mathematical Symbols
2504 Use this macro for mathematical symbols and similar things.
2506 .Dl Usage: .Ms Ao math symbol Ac ...
2508 .Bl -tag -width ".Li .Ms\ sigma" -compact -offset 15n
2509 .It Li ".Ms sigma"
2510 .Ms sigma
2514 The default width is 6n.
2516 .Ss "References and Citations"
2518 The following macros make a modest attempt to handle references.
2519 At best, the macros make it convenient to manually drop in a subset of
2520 .Xr refer 1
2521 style references.
2523 .Bl -tag -width 6n -offset indent -compact
2524 .It Li .Rs
2525 Reference start (does not take arguments).
2526 Causes a line break in the
2527 .Sx "SEE ALSO"
2528 section and begins collection of reference information until the reference
2529 end macro is read.
2530 .It Li .Re
2531 Reference end (does not take arguments).
2532 The reference is printed.
2533 .It Li .%A
2534 Reference author name; one name per invocation.
2535 .It Li .%B
2536 Book title.
2537 .It Li .%C
2538 City/place (not implemented yet).
2539 .It Li .%D
2540 Date.
2541 .It Li .%I
2542 Issuer/publisher name.
2543 .It Li .%J
2544 Journal name.
2545 .It Li .%N
2546 Issue number.
2547 .It Li .%O
2548 Optional information.
2549 .It Li .%P
2550 Page number.
2551 .It Li .%Q
2552 Corporate or foreign author.
2553 .It Li .%R
2554 Report name.
2555 .It Li .%T
2556 Title of article.
2557 .It Li .%V
2558 Volume.
2561 Macros beginning with
2562 .Ql %
2563 are not callable but accept multiple arguments in the usual way.
2564 Only the
2565 .Ql .Tn
2566 macro is handled properly as a parameter; other macros will cause strange
2567 output.
2568 .Ql .%B
2570 .Ql .%T
2571 can be used outside of the
2572 .Ql .Rs/.Re
2573 environment.
2575 Example:
2577 .Bd -literal -offset indent
2578 \&.Rs
2579 \&.%A "Matthew Bar"
2580 \&.%A "John Foo"
2581 \&.%T "Implementation Notes on foobar(1)"
2582 \&.%R "Technical Report ABC\-DE\-12\-345"
2583 \&.%Q "Drofnats College, Nowhere"
2584 \&.%D "April 1991"
2585 \&.Re
2588 produces
2590 .Bd -ragged -offset indent
2592 .%A "Matthew Bar"
2593 .%A "John Foo"
2594 .%T "Implementation Notes on foobar(1)"
2595 .%R "Technical Report ABC-DE-12-345"
2596 .%Q "Drofnats College, Nowhere"
2597 .%D "April 1991"
2601 .Ss "Trade Names (or Acronyms and Type Names)"
2603 The trade name macro prints its arguments in a smaller font.
2604 Its intended use is to imitate a small caps fonts for uppercase acronyms.
2606 .Dl Usage: .Tn Ao symbol Ac ...
2608 .Bl -tag -width ".Li .Tn\ ASCII" -compact -offset 15n
2609 .It Li ".Tn DEC"
2610 .Tn DEC
2611 .It Li ".Tn ASCII"
2612 .Tn ASCII
2616 The default width is 10n.
2618 .Ss "Extended Arguments"
2621 .Li .Xo
2623 .Li .Xc
2624 macros allow one to extend an argument list on a macro boundary for the
2625 .Ql .It
2626 macro (see below).
2627 Note that
2628 .Li .Xo
2630 .Li .Xc
2631 are implemented similarly to all other macros opening and closing an
2632 enclosure (without inserting characters, of course).
2633 This means that the following is true for those macros also.
2635 Here is an example of
2636 .Ql .Xo
2637 using the space mode macro to turn spacing off:
2639 .Bd -literal -offset indent
2640 \&.Sm off
2641 \&.It Xo Sy I Ar operation
2642 \&.No \een Ar count No \een
2643 \&.Xc
2644 \&.Sm on
2648 produces
2650 .Bd -filled -offset indent
2651 .Bl -tag -compact
2652 .Sm off
2653 .It Xo Sy I Ar operation
2654 .No \en Ar count No \en
2656 .Sm on
2661 Another one:
2663 .Bd -literal -offset indent
2664 \&.Sm off
2665 \&.It Cm S No / Ar old_pattern Xo
2666 \&.No / Ar new_pattern
2667 \&.No / Op Cm g
2668 \&.Xc
2669 \&.Sm on
2673 produces
2675 .Bd -filled -offset indent
2676 .Bl -tag -compact
2677 .Sm off
2678 .It Cm S No \&/ Ar old_pattern Xo
2679 .No \&/ Ar new_pattern
2680 .No \&/ Op Cm g
2682 .Sm on
2687 Another example of
2688 .Ql .Xo
2689 and enclosure macros: Test the value of a variable.
2691 .Bd -literal -offset indent
2692 \&.It Xo
2693 \&.Ic .ifndef
2694 \&.Oo \e&! Oc Ns Ar variable Oo
2695 \&.Ar operator variable ...
2696 \&.Oc Xc
2700 produces
2702 .Bd -filled -offset indent
2703 .Bl -tag -width flag -compact
2704 .It Xo
2705 .Ic .ifndef
2706 .Oo \&! Oc Ns Ar variable Oo
2707 .Ar operator variable ...
2708 .Oc Xc
2714 .Sh "PAGE STRUCTURE DOMAIN"
2716 .Ss "Section Headers"
2718 The following
2719 .Ql .Sh
2720 section header macros are required in every man page.
2721 The remaining section headers are recommended at the discretion of the
2722 author writing the manual page.
2724 .Ql .Sh
2725 macro is parsed but not generally callable.
2726 It can be used as an argument in a call to
2727 .Ql .Sh
2728 only; it then reactivates the default font for
2729 .Ql .Sh .
2731 The default width is 8n.
2733 .Bl -tag -width ".Li .Sh\ RETURN\ VALUES"
2734 .It Li ".Sh NAME"
2736 .Ql ".Sh NAME"
2737 macro is mandatory.
2738 If not specified, headers, footers and page layout defaults will not be set
2739 and things will be rather unpleasant.
2741 .Sx NAME
2742 section consists of at least three items.
2743 The first is the
2744 .Ql .Nm
2745 name macro naming the subject of the man page.
2746 The second is the name description macro,
2747 .Ql .Nd ,
2748 which separates the subject name from the third item, which is the
2749 description.
2750 The description should be the most terse and lucid possible, as the space
2751 available is small.
2753 .Ql .Nd
2754 first prints
2755 .Ql \- ,
2756 then all its arguments.
2758 .It Li ".Sh LIBRARY"
2759 This section is for section two and three function calls.
2760 It should consist of a single
2761 .Ql .Lb
2762 macro call;
2764 .Sx "Library Names" .
2766 .It Li ".Sh SYNOPSIS"
2768 .Sx SYNOPSIS
2769 section describes the typical usage of the subject of a man page.
2770 The macros required are either
2771 .Ql .Nm ,
2772 .Ql .Cd ,
2774 .Ql .Fn
2775 (and possibly
2776 .Ql .Fo ,
2777 .Ql .Fc ,
2778 .Ql .Fd ,
2780 .Ql .Ft ) .
2781 The function name macro
2782 .Ql .Fn
2783 is required for manual page sections\~2 and\~3; the command and general name
2784 macro
2785 .Ql .Nm
2786 is required for sections 1, 5, 6, 7, and\~8.
2787 Section\~4 manuals require a
2788 .Ql .Nm ,
2789 .Ql .Fd
2790 or a
2791 .Ql .Cd
2792 configuration device usage macro.
2793 Several other macros may be necessary to produce the synopsis line as shown
2794 below:
2796 .Bd -filled -offset indent
2797 .Nm cat
2798 .Op Fl benstuv
2799 .Op Fl
2804 The following macros were used:
2806 .Dl ".Nm cat"
2807 .Dl ".Op Fl benstuv"
2808 .Dl ".Op Fl"
2809 .Dl .Ar
2811 .It Li ".Sh DESCRIPTION"
2812 In most cases the first text in the
2813 .Sx DESCRIPTION
2814 section is a brief paragraph on the command, function or file, followed by a
2815 lexical list of options and respective explanations.
2816 To create such a list, the
2817 .Ql .Bl
2818 (begin list),
2819 .Ql .It
2820 (list item) and
2821 .Ql .El
2822 (end list)
2823 macros are used (see
2824 .Sx Lists and Columns
2825 below).
2827 .It Li ".Sh IMPLEMENTATION NOTES"
2828 Implementation specific information should be placed here.
2830 .It Li ".Sh RETURN VALUES"
2831 Sections 2, 3 and\~9 function return values should go here.
2833 .Ql .Rv
2834 macro may be used to generate text for use in the
2835 .Sx RETURN VALUES
2836 section for most section 2 and 3 library functions;
2838 .Sx "Return Values" .
2842 The following
2843 .Ql .Sh
2844 section headers are part of the preferred manual page layout and must be
2845 used appropriately to maintain consistency.
2846 They are listed in the order in which they would be used.
2848 .Bl -tag -width ".Li .Sh\ COMPATIBILITY"
2849 .It Li ".Sh ENVIRONMENT"
2851 .Sx ENVIRONMENT
2852 section should reveal any related environment variables and clues to their
2853 behavior and/or usage.
2855 .It Li ".Sh FILES"
2856 Files which are used or created by the man page subject should be listed via
2858 .Ql .Pa
2859 macro in the
2860 .Sx FILES
2861 section.
2863 .It Li ".Sh EXAMPLES"
2864 There are several ways to create examples.
2865 See the
2866 .Sx EXAMPLES
2867 section below for details.
2869 .It Li ".Sh DIAGNOSTICS"
2870 Diagnostic messages from a command should be placed in this section.
2872 .Ql .Ex
2873 macro may be used to generate text for use in the
2874 .Sx DIAGNOSTICS
2875 section for most section 1, 6 and\~8 commands;
2877 .Sx "Exit Status" .
2879 .It Li ".Sh COMPATIBILITY"
2880 Known compatibility issues (e.g. deprecated options or parameters)
2881 should be listed here.
2883 .It Li ".Sh ERRORS"
2884 Specific error handling, especially from library functions (man page
2885 sections 2, 3, and\~9) should go here.
2887 .Ql .Er
2888 macro is used to specify an error (errno).
2890 .It Li ".Sh SEE ALSO"
2891 References to other material on the man page topic and cross references to
2892 other relevant man pages should be placed in the
2893 .Sx "SEE ALSO"
2894 section.
2895 Cross references are specified using the
2896 .Ql .Xr
2897 macro.
2898 Currently
2899 .Xr refer 1
2900 style references are not accommodated.
2902 It is recommended that the cross references are sorted on the section
2903 number, then alphabetically on the names within a section, and placed
2904 in that order and comma separated.
2905 Example:
2907 .Xr ls 1 ,
2908 .Xr ps 1 ,
2909 .Xr group 5 ,
2910 .Xr passwd 5
2912 .It Li ".Sh STANDARDS"
2913 If the command, library function or file adheres to a specific
2914 implementation such as
2915 .St -p1003.2
2917 .St -ansiC
2918 this should be noted here.
2919 If the command does not adhere to any standard, its history should be noted
2920 in the
2921 .Sx HISTORY
2922 section.
2924 .It Li ".Sh HISTORY"
2925 Any command which does not adhere to any specific standards should be
2926 outlined historically in this section.
2928 .It Li ".Sh AUTHORS"
2929 Credits should be placed here.
2930 Use the
2931 .Ql .An
2932 macro for names and the
2933 .Ql .Aq
2934 macro for e-mail addresses within optional contact information.
2935 Explicitly indicate whether the person authored the initial manual page
2936 or the software or whatever the person is being credited for.
2937 .It Li ".Sh BUGS"
2938 Blatant problems with the topic go here.
2942 User-specified
2943 .Ql .Sh
2944 sections may be added; for example, this section was set with:
2946 .Bd -literal -offset 15n
2947 \&.Sh "PAGE STRUCTURE DOMAIN"
2950 .Ss "Subsection Headers"
2952 Subsection headers have exactly the same syntax as section headers:
2953 .Ql .Ss
2954 is parsed but not generally callable.
2955 It can be used as an argument in a call to
2956 .Ql .Ss
2957 only; it then reactivates the default font for
2958 .Ql .Ss .
2960 The default width is 8n.
2962 .Ss "Paragraphs and Line Spacing"
2964 .Bl -tag -width ".Li .Pp"
2965 .It Li .Pp
2966 The 
2967 .Ql .Pp
2968 paragraph command may be used to specify a line space where necessary.
2969 The macro is not necessary after a
2970 .Ql .Sh
2972 .Ql .Ss
2973 macro or before a
2974 .Ql .Bl
2976 .Ql .Bd
2977 macro (which both assert a vertical distance unless the
2978 .Fl compact
2979 flag is given).
2981 The macro is neither callable nor parsed and takes no arguments; an
2982 alternative name is
2983 .Ql .Lp .
2986 .\" XXX
2988 .\" This worked with version one, need to redo for version three
2989 .\" .Pp
2990 .\" .Ds I
2991 .\" .Cw (ax+bx+c) \ is\ produced\ by\ \&
2992 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2993 .\" .Cl Cx \t\t
2994 .\" .Li \&.Cx\ (
2995 .\" .Cx
2996 .\" .Cl Cx \t\t
2997 .\" .Li \&.Va ax
2998 .\" .Cx
2999 .\" .Cl Cx \t\t
3000 .\" .Li \&.Sy \+
3001 .\" .Cx
3002 .\" .Cl Cx \&(\&
3003 .\" .Va ax
3004 .\" .Cx +
3005 .\" .Va by
3006 .\" .Cx +
3007 .\" .Va c )
3008 .\" .Cx \t
3009 .\" .Em is produced by
3010 .\" .Cx \t
3011 .\" .Li \&.Va by
3012 .\" .Cx
3013 .\" .Cl Cx \t\t
3014 .\" .Li \&.Sy \+
3015 .\" .Cx
3016 .\" .Cl Cx \t\t
3017 .\" .Li \&.Va c )
3018 .\" .Cx
3019 .\" .Cl Cx \t\t
3020 .\" .Li \&.Cx
3021 .\" .Cx
3022 .\" .Cw
3023 .\" .De
3024 .\" .Pp
3025 .\" This example shows the same equation in a different format.
3026 .\" The spaces
3027 .\" around the
3028 .\" .Li \&+
3029 .\" signs were forced with
3030 .\" .Li \e :
3031 .\" .Pp
3032 .\" .Ds I
3033 .\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&
3034 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
3035 .\" .Cl Cx \t\t
3036 .\" .Li \&.Cx\ (
3037 .\" .Cx
3038 .\" .Cl Cx \t\t
3039 .\" .Li \&.Va a
3040 .\" .Cx
3041 .\" .Cl Cx \t\t
3042 .\" .Li \&.Sy x
3043 .\" .Cx
3044 .\" .Cl Cx \t\t
3045 .\" .Li \&.Cx \e\ +\e\ \e&
3046 .\" .Cx
3047 .\" .Cl Cx \&(\&
3048 .\" .Va a
3049 .\" .Sy x
3050 .\" .Cx \ +\ \&
3051 .\" .Va b
3052 .\" .Sy y
3053 .\" .Cx \ +\ \&
3054 .\" .Va c )
3055 .\" .Cx \t
3056 .\" .Em is produced by
3057 .\" .Cl Cx \t\t
3058 .\" .Li \&.Va b
3059 .\" .Cx
3060 .\" .Cl Cx \t\t
3061 .\" .Li \&.Sy y
3062 .\" .Cx
3063 .\" .Cl Cx \t\t
3064 .\" .Li \&.Cx \e\ +\e\ \e&
3065 .\" .Cx
3066 .\" .Cl Cx \t\t
3067 .\" .Li \&.Va c )
3068 .\" .Cx
3069 .\" .Cl Cx \t\t
3070 .\" .Li \&.Cx
3071 .\" .Cx
3072 .\" .Cw
3073 .\" .De
3074 .\" .Pp
3075 .\" The incantation below was
3076 .\" lifted from the
3077 .\" .Xr adb 1
3078 .\" manual page:
3079 .\" .Pp
3080 .\" .Ds I
3081 .\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by
3082 .\" .Cl Cx \t\t
3083 .\" .Li \&.Cx Op Sy ?/
3084 .\" .Cx
3085 .\" .Cl Cx \t\t
3086 .\" .Li \&.Nm m
3087 .\" .Cx
3088 .\" .Cl Cx Op Sy ?/
3089 .\" .Nm m
3090 .\" .Ad \ b1 e1 f1
3091 .\" .Op Sy ?/
3092 .\" .Cx \t
3093 .\" .Em is produced by
3094 .\" .Cx \t
3095 .\" .Li \&.Ar \e\ b1 e1 f1
3096 .\" .Cx
3097 .\" .Cl Cx \t\t
3098 .\" .Li \&.Op Sy ?/
3099 .\" .Cx
3100 .\" .Cl Cx \t\t
3101 .\" .Li \&.Cx
3102 .\" .Cx
3103 .\" .Cw
3104 .\" .De
3105 .\" .Pp
3107 .Ss Keeps
3109 The only keep that is implemented at this time is for words.
3110 The macros are
3111 .Ql .Bk
3112 (begin keep)
3114 .Ql .Ek
3115 (end keep).
3116 The only option that
3117 .Ql .Bk
3118 accepts currently is
3119 .Fl words
3120 (this is also the default if no option is given) which is useful for
3121 preventing line breaks in the middle of options.
3122 In the example for the make command line arguments (see
3123 .Sx What's in a Name ) ,
3124 the keep prevented
3125 .Xr nroff
3126 from placing up the flag and the argument on separate lines.
3128 Both macros are neither callable nor parsed.
3130 More work needs to be done with the keep macros; specifically, a
3131 .Fl line
3132 option should be added.
3134 .Ss "Examples and Displays"
3136 There are seven types of displays.
3138 .Bl -tag -width ".Li .D1"
3139 .It Li .D1
3140 (This is D-one.)
3141 Display one line of indented text.
3142 This macro is parsed but not callable.
3144 .D1 Fl ldghfstru
3146 The above was produced by:
3147 .Li ".D1 Fl ldghfstru" .
3149 .It Li .Dl
3150 (This is D-ell.)
3151 Display one line of indented
3152 .Em literal
3153 text.
3155 .Ql .Dl
3156 example macro has been used throughout this file.
3157 It allows the indentation (display) of one line of text.
3158 Its default font is set to constant width (literal).
3159 .Ql .Dl
3160 is parsed but not callable.
3162 .Dl % ls \-ldg /usr/local/bin
3164 The above was produced by:
3165 .Li ".Dl % ls \e\-ldg /usr/local/bin" .
3167 .It Li .Bd
3168 Begin display.
3170 .Ql .Bd
3171 display must be ended with the
3172 .Ql .Ed
3173 macro.
3174 It has the following syntax:
3176 .Bd -ragged -compact
3177 .Bl -tag -width ".Li .Bd" -offset indent
3178 .It Li .Bd Xo
3179 .Bro \-literal | \-filled | \-unfilled | \-ragged | \-centered Brc
3180 .Oo \-offset Ao string Ac Oc Oo \-file Ao file name Ac Oc Oo \-compact Oc Xc
3185 .Bl -tag -width ".Fl file Ao Ar file name Ac " -compact
3186 .It Fl ragged
3187 Fill, but do not adjust the right margin (only left-justify).
3188 .It Fl centered
3189 Center lines between the current left and right margin.
3190 Note that each single line is centered.
3191 .It Fl unfilled
3192 Do not fill; display a block of text as typed, using line breaks as
3193 specified by the user.
3194 This can produce overlong lines without warning messages.
3195 .It Fl filled
3196 Display a filled block.
3197 The block of text is formatted (i.e., the text is justified on both the left
3198 and right side).
3199 .It Fl literal
3200 Display block with literal font (usually fixed-width).
3201 Useful for source code or simple tabbed or spaced text.
3202 .It Fl file Ao Ar file name Ac
3203 The file whose name follows the
3204 .Fl file
3205 flag is read and displayed before any data enclosed with
3206 .Ql .Bd
3208 .Ql .Ed ,
3209 using the selected display type.
3211 .Xr troff/ Ns Nm \-mdoc
3212 commands in the file will be processed.
3213 .It Fl offset Ao Ar string Ac
3215 .Fl offset
3216 is specified with one of the following strings, the string is interpreted to
3217 indicate the level of indentation for the forthcoming block of text:
3220 .Bl -tag -width ".Ar indent-two" -compact
3221 .It Ar left
3222 Align block on the current left margin; this is the default mode of
3223 .Ql .Bd .
3224 .It Ar center
3225 Supposedly center the block.
3226 At this time unfortunately, the block merely gets left aligned about an
3227 imaginary center margin.
3228 .It Ar indent
3229 Indent by one default indent value or tab.
3230 The default indent value is also used for the
3231 .Ql .D1
3232 and 
3233 .Ql .Dl
3234 macros, so one is guaranteed the two types of displays will line up.
3235 The indentation value is normally set to\~6n or about two thirds of an inch
3236 (six constant width characters).
3237 .It Ar indent\-two
3238 Indent two times the default indent value.
3239 .It Ar right
3240 This
3241 .Em left
3242 aligns the block about two inches from the right side of the page.
3243 This macro needs work and perhaps may never do the right thing within
3244 .Xr troff .
3249 .Ao string Ac
3250 is a valid numeric expression instead
3251 .Pf ( Em with a scale indicator other than
3252 .Sq Em u ) ,
3253 use that value for indentation.
3254 The most useful scale indicators are
3255 .Sq m
3257 .Sq n ,
3258 specifying the so-called
3259 .Em \&Em
3261 .Em "En square" .
3262 This is approximately the width of the letters
3263 .Sq m
3265 .Sq n
3266 respectively
3267 of the current font (for nroff output, both scale indicators give the same
3268 values).
3270 .Ao string Ac
3271 isn't a numeric expression, it is tested whether it is an
3272 .Nm \-mdoc
3273 macro name, and the default offset value associated with this macro is used.
3274 Finally, if all tests fail,
3275 the width of
3276 .Ao string Ac
3277 (typeset with a fixed-width font) is taken as the offset.
3278 .It Fl compact
3279 Suppress insertion of vertical space before begin of display.
3282 .It Li .Ed
3283 End display (takes no arguments).
3286 .Ss "Lists and Columns"
3288 There are several types of lists which may be initiated with the
3289 .Ql .Bl
3290 begin-list macro.
3291 Items within the list are specified with the
3292 .Ql .It
3293 item macro, and each list must end with the
3294 .Ql .El
3295 macro.
3296 Lists may be nested within themselves and within displays.
3297 The use of columns inside of lists or lists inside of columns is unproven.
3299 In addition, several list attributes may be specified such as the width of a
3300 tag, the list offset, and compactness (blank lines between items allowed or
3301 disallowed).
3302 Most of this document has been formatted with a tag style list
3303 .Pf ( Fl tag ) .
3305 It has the following syntax forms:
3308 .Bd -ragged -compact
3309 .Bl -tag -width ".Li .Bl" -offset indent -compact
3310 .It Li .Bl Xo
3311 .Bro \-hang | \-ohang | \-tag | \-diag | \-inset Brc
3312 .Oo \-width Ao string Ac Oc
3313 .Oo \-offset Ao string Ac Oc Oo \-compact Oc Xc
3314 .It Li .Bl Xo
3315 .No \-column Oo \-offset Ao string Ac Oc
3316 .Ao string1 Ac Ao string2 Ac ... Xc
3317 .It Li .Bl Xo
3318 .Bro \-item | \-enum Oo \-nested Oc | \-bullet | \-hyphen | \-dash Brc
3319 .Oo \-offset Ao string Ac Oc Oo \-compact Oc Xc
3324 And now a detailed description of the list types.
3327 .Bl -tag -width ".Fl column" -compact
3328 .It Fl bullet
3329 A bullet list.
3331 .Bd -literal -offset indent
3332 \&.Bl \-bullet \-offset indent \-compact
3333 \&.It
3334 Bullet one goes here.
3335 \&.It
3336 Bullet two here.
3337 \&.El
3341 Produces:
3344 .Bl -bullet -offset indent -compact
3346 Bullet one goes here.
3348 Bullet two here.
3352 .It Fl dash No ( or Fl hyphen )
3353 A dash list.
3355 .Bd -literal -offset indent
3356 \&.Bl \-dash \-offset indent \-compact
3357 \&.It
3358 Dash one goes here.
3359 \&.It
3360 Dash two here.
3361 \&.El
3365 Produces:
3368 .Bl -dash -offset indent -compact
3370 Dash one goes here.
3372 Dash two here.
3376 .It Fl enum
3377 An enumerated list.
3379 .Bd -literal -offset indent
3380 \&.Bl \-enum \-offset indent \-compact
3381 \&.It
3382 Item one goes here.
3383 \&.It
3384 And item two here.
3385 \&.El
3389 The result:
3392 .Bl -enum -offset indent -compact
3394 Item one goes here.
3396 And item two here.
3400 If you want to nest enumerated lists, use the
3401 .Fl nested
3402 flag (starting with the second-level list):
3404 .Bd -literal -offset indent
3405 \&.Bl \-enum \-offset indent \-compact
3406 \&.It
3407 Item one goes here
3408 \&.Bl \-enum \-nested \-compact
3409 \&.It
3410 Item two goes here.
3411 \&.It
3412 And item three here.
3413 \&.El
3414 \&.It
3415 And item four here.
3416 \&.El
3420 Result:
3423 .Bl -enum -offset indent -compact
3425 Item one goes here.
3426 .Bl -enum -nested -compact
3428 Item two goes here.
3430 And item three here.
3433 And item four here.
3437 .It Fl item
3438 A list of type
3439 .Fl item
3440 without list markers.
3442 .Bd -literal -offset indent
3443 \&.Bl \-item \-offset indent
3444 \&.It
3445 Item one goes here.
3446 Item one goes here.
3447 Item one goes here.
3448 \&.It
3449 Item two here.
3450 Item two here.
3451 Item two here.
3452 \&.El
3456 Produces:
3459 .Bl -item -offset indent
3461 Item one goes here.
3462 Item one goes here.
3463 Item one goes here.
3465 Item two here.
3466 Item two here.
3467 Item two here.
3471 .It Fl tag
3472 A list with tags.
3474 .Fl width
3475 to specify the tag width.
3478 .Bl -tag -width "PPID" -compact -offset indent
3479 .It SL
3480 sleep time of the process (seconds blocked)
3481 .It PAGEIN
3482 number of disk
3483 .Tn I/O Ns 's
3484 resulting from references by the process
3485 to pages not loaded in core.
3486 .It UID
3487 numerical user-id of process owner
3488 .It PPID
3489 numerical id of parent of process priority
3490 (non-positive when in non-interruptible wait)
3494 The raw text:
3496 .Bd -literal -offset indent
3497 \&.Bl \-tag \-width "PPID" \-compact \-offset indent
3498 \&.It SL
3499 sleep time of the process (seconds blocked)
3500 \&.It PAGEIN
3501 number of disk
3502 \&.Tn I/O Ns 's
3503 resulting from references by the process
3504 to pages not loaded in core.
3505 \&.It UID
3506 numerical user\-id of process owner
3507 \&.It PPID
3508 numerical id of parent of process priority
3509 (non\-positive when in non\-interruptible wait)
3510 \&.El
3514 .It Fl diag
3515 Diag lists create section four diagnostic lists and are similar to inset
3516 lists except callable macros are ignored.
3518 .Fl width
3519 flag is not meaningful in this context.
3521 Example:
3523 .Bd -literal -offset indent
3524 \&.Bl \-diag
3525 \&.It You can't use Sy here.
3526 The message says all.
3527 \&.El
3531 produces
3533 .Bl -diag
3534 .It You can't use Sy here.
3535 The message says all.
3539 .It Fl hang
3540 A list with hanging tags.
3542 .Bl -hang -offset indent
3543 .It Em Hanged
3544 labels appear similar to tagged lists when the
3545 label is smaller than the label width.
3546 .It Em Longer hanged list labels
3547 blend into the paragraph unlike
3548 tagged paragraph labels.
3551 And the unformatted text which created it:
3553 .Bd -literal -offset indent
3554 \&.Bl \-hang \-offset indent
3555 \&.It Em Hanged
3556 labels appear similar to tagged lists when the
3557 label is smaller than the label width.
3558 \&.It Em Longer hanged list labels
3559 blend into the paragraph unlike
3560 tagged paragraph labels.
3561 \&.El
3565 .It Fl ohang
3566 Lists with overhanging tags do not use indentation for the items; tags are
3567 written to a separate line.
3569 .Bl -ohang -offset indent
3570 .It Sy SL
3571 sleep time of the process (seconds blocked)
3572 .It Sy PAGEIN
3573 number of disk
3574 .Tn I/O Ns 's
3575 resulting from references by the process
3576 to pages not loaded in core.
3577 .It Sy UID
3578 numerical user-id of process owner
3579 .It Sy PPID
3580 numerical id of parent of process priority
3581 (non-positive when in non-interruptible wait)
3585 The raw text:
3587 .Bd -literal -offset indent
3588 \&.Bl \-ohang \-offset indent
3589 \&.It Sy SL
3590 sleep time of the process (seconds blocked)
3591 \&.It Sy PAGEIN
3592 number of disk
3593 \&.Tn I/O Ns 's
3594 resulting from references by the process
3595 to pages not loaded in core.
3596 \&.It Sy UID
3597 numerical user\-id of process owner
3598 \&.It Sy PPID
3599 numerical id of parent of process priority
3600 (non\-positive when in non\-interruptible wait)
3601 \&.El
3605 .It Fl inset
3606 Here is an example of inset labels:
3607 .Bl -inset -offset indent
3608 .It Em Tag
3609 The tagged list (also called a tagged paragraph)
3610 is the most common type of list used in the
3611 Berkeley manuals.
3612 Use a
3613 .Fl width
3614 attribute as described below.
3615 .It Em Diag
3616 Diag lists create section four diagnostic lists
3617 and are similar to inset lists except callable
3618 macros are ignored.
3619 .It Em Hang
3620 Hanged labels are a matter of taste.
3621 .It Em Ohang
3622 Overhanging labels are nice when space is constrained.
3623 .It Em Inset
3624 Inset labels are useful for controlling blocks of
3625 paragraphs and are valuable for converting
3626 .Nm \-mdoc
3627 manuals to other formats.
3630 Here is the source text which produced the above example:
3632 .Bd -literal -offset indent
3633 \&.Bl \-inset \-offset indent
3634 \&.It Em Tag
3635 The tagged list (also called a tagged paragraph)
3636 is the most common type of list used in the
3637 Berkeley manuals.
3638 \&.It Em Diag
3639 Diag lists create section four diagnostic lists
3640 and are similar to inset lists except callable
3641 macros are ignored.
3642 \&.It Em Hang
3643 Hanged labels are a matter of taste.
3644 \&.It Em Ohang
3645 Overhanging labels are nice when space is constrained.
3646 \&.It Em Inset
3647 Inset labels are useful for controlling blocks of
3648 paragraphs and are valuable for converting
3649 \&.Nm \-mdoc
3650 manuals to other formats.
3651 \&.El
3655 .It Fl column
3656 This list type generates multiple columns.
3657 The number of columns and the width of each column is determined by the
3658 arguments to the
3659 .Fl column
3660 list,
3661 .Aq Ar string1 ,
3662 .Aq Ar string2 ,
3663 etc.
3665 .Aq Ar stringN
3666 starts with a
3667 .Ql .\&
3668 (dot) immediately followed by a valid
3669 .Nm \-mdoc
3670 macro name, interpret
3671 .Aq Ar stringN
3672 and use the width of the result.
3673 Otherwise, the width of
3674 .Aq Ar stringN
3675 (typeset with a fixed-width font) is taken as the
3676 .Ar N Ns th
3677 column width.
3679 Each
3680 .Ql .It
3681 argument is parsed to make a row, each column within the row is a separate
3682 argument separated by a tab or the
3683 .Ql .Ta
3684 macro.
3686 The table:
3688 .Bl -column -offset indent ".Sy String" ".Sy Nroff" ".Sy Troff"
3689 .It Sy String Ta Sy Nroff Ta Sy Troff
3690 .It Li <= Ta <= Ta \*(<=
3691 .It Li >= Ta >= Ta \*(>=
3695 was produced by:
3697 .Bd -literal
3698 \&.Bl \-column \-offset indent ".Sy String" ".Sy Nroff" ".Sy Troff"
3699 \&.It Sy String Ta Sy Nroff Ta Sy Troff
3700 \&.It Li <= Ta <= Ta \e*(<=
3701 \&.It Li >= Ta >= Ta \e*(>=
3702 \&.El
3706 Don't abuse this list type!
3707 For more complicated cases it might be far better and easier to use
3708 .Xr tbl 1 ,
3709 the table preprocessor.
3713 Other keywords:
3715 .Bl -tag -width ".Fl indent Ao Ar string Ac"
3716 .It Fl width Ao Ar string Ac
3718 .Aq Ar string
3719 starts with a
3720 .Ql .\&
3721 (dot) immediately followed by a valid
3722 .Nm \-mdoc
3723 macro name, interpret
3724 .Aq Ar string
3725 and use the width of the result.
3726 Almost all lists in this document use this option.
3728 Example:
3730 .Bd -literal -offset indent
3731 \&.Bl \-tag \-width ".Fl test Ao Ar string Ac"
3732 \&.It Fl test Ao Ar string Ac
3733 This is a longer sentence to show how the
3734 \&.Fl width
3735 flag works in combination with a tag list.
3736 \&.El
3740 gives:
3742 .Bl -tag -width ".Fl test Ao Ar string Ac"
3743 .It Fl test Ao Ar string Ac
3744 This is a longer sentence to show how the
3745 .Fl width
3746 flag works in combination with a tag list.
3750 (Note that the current state of
3751 .Nm \-mdoc
3752 is saved before
3753 .Aq Ar string
3754 is interpreted; afterwards, all variables are restored again.
3755 However, boxes (used for enclosures) can't be saved in
3756 .Tn GNU
3757 .Xr troff 1 ;
3758 as a consequence, arguments must always be
3759 .Em balanced
3760 to avoid nasty errors.
3761 For example, do not write
3762 .Ql ".Ao Ar string"
3764 .Ql ".Ao Ar string Xc"
3765 instead if you really need only an opening angle bracket.)
3767 Otherwise, if
3768 .Aq Ar string
3769 is a valid numeric expression
3770 .Em ( with a scale indicator other than
3771 .Sq Em u ) ,
3772 use that value for indentation.
3773 The most useful scale indicators are
3774 .Sq m
3776 .Sq n ,
3777 specifying the so-called
3778 .Em \&Em
3780 .Em "En square" .
3781 This is approximately the width of the letters
3782 .Sq m
3784 .Sq n
3785 respectively
3786 of the current font (for nroff output, both scale indicators give the same
3787 values).
3789 .Aq Ar string
3790 isn't a numeric expression, it is tested whether it is an
3791 .Nm \-mdoc
3792 macro name, and the default width value associated with this macro is used.
3793 Finally, if all tests fail,
3794 the width of
3795 .Aq Ar string
3796 (typeset with a fixed-width font) is taken as the width.
3798 If a width is not specified for the tag list type, every time
3799 .Ql .It
3800 is invoked, an attempt is made to determine an appropriate width.
3801 If the first argument to
3802 .Ql .It
3803 is a callable macro, the default width for that macro will be used;
3804 otherwise, the default width of
3805 .Ql .No
3806 is used.
3807 .It Fl offset Ao Ar string Ac
3809 .Aq Ar string
3811 .Ar indent ,
3812 a default indent value (normally set to\~6n, similar to the value used in
3813 .Ql .Dl
3815 .Ql .Bd )
3816 is used.
3818 .Aq Ar string
3819 is a valid numeric expression instead
3820 .Pf ( Em with a scale indicator other than
3821 .Sq Em u ) ,
3822 use that value for indentation.
3823 The most useful scale indicators are
3824 .Sq m
3826 .Sq n ,
3827 specifying the so-called
3828 .Em \&Em
3830 .Em "En square" .
3831 This is approximately the width of the letters
3832 .Sq m
3834 .Sq n
3835 respectively
3836 of the current font (for nroff output, both scale indicators give the same
3837 values).
3839 .Aq Ar string
3840 isn't a numeric expression, it is tested whether it is an
3841 .Nm \-mdoc
3842 macro name, and the default offset value associated with this macro is used.
3843 Finally, if all tests fail,
3844 the width of
3845 .Aq Ar string
3846 (typeset with a fixed-width font) is taken as the offset.
3847 .It Fl compact
3848 Suppress insertion of vertical space before the list and between list items.
3852 .Sh "MISCELLANEOUS MACROS"
3854 Here a list of the remaining macros which do not fit well into one of the
3855 above sections.
3856 We couldn't find real examples for the following macros:
3857 .Ql .Me
3859 .Ql .Ot .
3860 They are documented here for completeness \- if you know how to use them
3861 properly please send a mail to
3862 .Mt bug-groff@gnu.org
3863 (including an example).
3865 .Bl -tag -width ".Li .Bt"
3866 .It Li .Bt
3867 prints
3869 .Bd -ragged -offset indent
3873 It is neither callable nor parsed and takes no arguments.
3875 .It Li .Fr
3877 .Dl Usage: .Fr Ao function return value Ac ...
3879 Don't use this macro.
3880 It allows a break right before the return value (usually a single digit)
3881 which is bad typographical behaviour.
3883 .Ql \e~
3884 to tie the return value to the previous word.
3886 .It Li .Hf
3887 Use this macro to include a (header) file literally.
3888 It first prints
3889 .Ql File:
3890 followed by the file name, then the contents of
3891 .Ao file Ac .
3893 .Dl Usage: .Hf Ao file Ac
3895 It is neither callable nor parsed.
3897 .It Li .Lk
3898 To be written.
3900 .It Li .Me
3901 Exact usage unknown.
3902 The documentation in the
3903 .Nm \-mdoc
3904 source file describes it as a macro for
3905 .Dq "menu entries" .
3907 Its default width is 6n.
3909 .It Li .Mt
3910 To be written.
3912 .It Li .Ot
3913 Exact usage unknown.
3914 The documentation in the
3915 .Nm \-mdoc
3916 source file describes it as
3917 .Dq old function type (fortran) .
3919 .It Li .Sm
3920 Activate (toggle) space mode.
3922 .Dl Usage: .Sm Oo on | off Oc ...
3924 If space mode is off, no spaces between macro arguments are inserted.
3925 If called without a parameter (or if the next parameter is neither
3926 .Ql on
3928 .Ql off ,
3929 .Ql .Sm
3930 toggles space mode.
3932 .It Li .Ud
3933 prints
3935 .Bd -ragged -offset indent
3939 It is neither callable nor parsed and takes no arguments.
3943 .Sh "PREDEFINED STRINGS"
3945 The following strings are predefined:
3947 .Bl -column String infinity "Troff " "straight double quote" -offset indent
3948 .It Sy String Ta Sy Nroff Ta Sy Troff Ta Sy Meaning
3949 .It Li <=     Ta <=       Ta \*[<=]   Ta "less equal"
3950 .It Li >=     Ta >=       Ta \*[>=]   Ta "greater equal"
3951 .It Li Rq     Ta ''       Ta \*[Rq]   Ta "right double quote"
3952 .It Li Lq     Ta ``       Ta \*[Lq]   Ta "left double quote"
3953 .It Li ua     Ta ^        Ta \*[ua]   Ta "upwards arrow"
3954 .It Li aa     Ta \'       Ta \*[aa]   Ta "acute accent"
3955 .It Li ga     Ta \`       Ta \*[ga]   Ta "grave accent"
3956 .It Li q      Ta \&"      Ta \*[q]    Ta "straight double quote"
3957 .It Li Pi     Ta pi       Ta \*[Pi]   Ta "greek pi"
3958 .It Li Ne     Ta !=       Ta \*[Ne]   Ta "not equal"
3959 .It Li Le     Ta <=       Ta \*[Le]   Ta "less equal"
3960 .It Li Ge     Ta >=       Ta \*[Ge]   Ta "greater equal"
3961 .It Li Lt     Ta <        Ta \*[Lt]   Ta "less than"
3962 .It Li Gt     Ta >        Ta \*[Gt]   Ta "greater than"
3963 .It Li Pm     Ta +\-      Ta \*[Pm]   Ta "plus minus"
3964 .It Li If     Ta infinity Ta \*[If]   Ta "infinity"
3965 .It Li Am     Ta \*[Am]   Ta \*[Am]   Ta "ampersand"
3966 .It Li Na     Ta \*[Na]   Ta \*[Na]   Ta "not a number"
3967 .It Li Ba     Ta \*[Ba]   Ta \*[Ba]   Ta "vertical bar"
3970 The names of the columns
3971 .Sy Nroff
3973 .Sy Troff
3974 are a bit misleading;
3975 .Sy Nroff
3976 shows the
3977 .Tn ASCII
3978 representation, while
3979 .Sy Troff
3980 gives the best glyph form available.
3981 For example, a Unicode enabled
3982 .Tn TTY Ns - Ns
3983 device will have proper glyph representations for all strings, whereas the
3984 enhancement for a Latin1
3985 .Tn TTY Ns - Ns
3986 device is only the plus-minus sign.
3988 String names which consist of two characters can be written as
3989 .Ql \e*(xx ;
3990 string names which consist of one character can be written as
3991 .Ql \e*x .
3992 A generic syntax for a string name of any length is
3993 .Ql \e*[xxx]
3994 (this is a
3995 .Tn GNU
3996 .Xr troff 1
3997 extension).
4001 \#=====================================================================
4003 .Sh DIAGNOSTICS
4005 The debugging macro
4006 .Ql .Db
4007 available in previous versions of
4008 .Nm \-mdoc
4009 has been removed since
4010 .Tn GNU
4011 .Xr troff 1
4012 provides better facilities to check parameters; additionally, many error and
4013 warning messages have been added to this macro package, making it both more
4014 robust and verbose.
4016 The only remaining debugging macro is
4017 .Ql .Rd
4018 which yields a register dump of all global registers and strings.
4019 A normal user will never need it.
4022 .Sh "FORMATTING WITH GROFF, TROFF, AND NROFF"
4024 By default, the package inhibits page breaks, headers, and footers if
4025 displayed with a
4026 .Tn TTY
4027 device like
4028 .Sq latin1
4030 .Sq unicode ,
4031 to make the manual more efficient for viewing on-line.
4032 This behaviour can be changed (e.g.\& to create a hardcopy of the
4033 .Tn TTY
4034 output) by setting the register
4035 .Ql cR
4036 to zero while calling
4037 .Xr groff 1 ,
4038 resulting in multiple pages instead of a single, very long page:
4040 .Dl groff \-Tlatin1 \-rcR=0 \-mdoc foo.man > foo.txt
4042 For double-sided printing, set register
4043 .Ql D
4044 to\~1:
4046 .Dl groff \-Tps \-rD1 \-mdoc foo.man > foo.ps
4048 To change the document font size to 11pt or 12pt, set register
4049 .Ql S
4050 accordingly:
4052 .Dl groff \-Tdvi \-rS11 \-mdoc foo.man > foo.dvi
4054 Register
4055 .Ql S
4056 is ignored for
4057 .Tn TTY
4058 devices.
4060 The line and title length can be changed by setting the registers
4061 .Ql LL
4063 .Ql LT ,
4064 respectively:
4066 .Dl groff \-Tutf8 \-rLL=100n \-rLT=100n \-mdoc foo.man | less
4068 If not set, both registers default to 78n for TTY devices and 6.5i
4069 otherwise.
4072 .Sh FILES
4074 .Bl -tag -width mdoc/doc-ditroff -compact
4075 .It Pa doc.tmac
4076 The main manual macro package.
4077 .It Pa mdoc.tmac
4078 A wrapper file to call
4079 .Pa doc.tmac .
4080 .It Pa mdoc/doc-common
4081 Common strings, definitions, stuff related typographic output.
4082 .It Pa mdoc/doc-nroff
4083 Definitions used for a
4084 .Tn TTY
4085 output device.
4086 .It Pa mdoc/doc-ditroff
4087 Definitions used for all other devices.
4088 .It Pa mdoc.local
4089 Local additions and customizations.
4090 .It Pa andoc.tmac
4091 This file checks whether the
4092 .Nm \-mdoc
4093 or the
4094 .Nm \-man
4095 package should be used.
4099 .Sh "SEE ALSO"
4101 .Xr groff 1 ,
4102 .Xr man 1 ,
4103 .Xr troff 1 ,
4104 .Xr groff_man 7
4107 .Sh BUGS
4109 Section 3f has not been added to the header routines.
4111 .Ql \&.Nm
4112 font should be changed in
4113 .Sx NAME
4114 section.
4116 .Ql \&.Fn
4117 needs to have a check to prevent splitting up
4118 if the line length is too short.
4119 Occasionally it
4120 separates the last parenthesis, and sometimes
4121 looks ridiculous if a line is in fill mode.
4123 The list and display macros do not do any keeps
4124 and certainly should be able to.
4125 .\" Note what happens if the parameter list overlaps a newline
4126 .\" boundary.
4127 .\" to make sure a line boundary is crossed:
4128 .\" .Bd -literal
4129 .\" \&.Fn struct\e\ dictionarytable\e\ *dictionarylookup struct\e\ dictionarytable\e\ *tab[]
4130 .\" .Ed
4131 .\" .Pp
4132 .\" produces, nudge nudge,
4133 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
4134 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
4135 .\" nudge
4136 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] .
4137 .\" .Pp
4138 .\" If double quotes are used, for example:
4139 .\" .Bd -literal
4140 .\" \&.Fn \*qstruct dictionarytable *dictionarylookup\*q \*qchar *h\*q \*qstruct dictionarytable *tab[]\*q
4141 .\" .Ed
4142 .\" .Pp
4143 .\" produces, nudge nudge,
4144 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
4145 .\" nudge
4146 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
4147 .\" nudge
4148 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" .
4149 .\" .Pp
4150 .\" Not a pretty sight...
4151 .\" In a paragraph, a long parameter containing unpaddable spaces as
4152 .\" in the former example will cause
4153 .\" .Xr troff
4154 .\" to break the line and spread
4155 .\" the remaining words out.
4156 .\" The latter example will adjust nicely to
4157 .\" justified margins, but may break in between an argument and its
4158 .\" declaration.
4159 .\" In
4160 .\" .Xr nroff
4161 .\" the right margin adjustment is normally ragged and the problem is
4162 .\" not as severe.
4164 .\" Local Variables:
4165 .\" mode: nroff
4166 .\" End: