* doc/groff.texinfo: More info on conditionals.
[s-roff.git] / tmac / groff_mdoc.man
blob11446369b572b94f3ef77ce2b3a1855fb77918fa
1 .\" groff_mdoc.man
2 .\"
3 .\"   A complete reference of the mdoc macro package for GNU troff.
4 .\"
5 .\" Based on NetBSD's mdoc.samples.7, version 1.21.
6 .\"
7 .\"
8 .\"   Warning: You can't format this file with the old mdoc macros!
9 .\"
10 .\"
11 .\" Copyright (c) 1990, 1993
12 .\"     The Regents of the University of California.  All rights reserved.
13 .\"
14 .\" Redistribution and use in source and binary forms, with or without
15 .\" modification, are permitted provided that the following conditions
16 .\" are met:
17 .\" 1. Redistributions of source code must retain the above copyright
18 .\"    notice, this list of conditions and the following disclaimer.
19 .\" 2. Redistributions in binary form must reproduce the above copyright
20 .\"    notice, this list of conditions and the following disclaimer in the
21 .\"    documentation and/or other materials provided with the distribution.
22 .\" 3. All advertising materials mentioning features or use of this software
23 .\"    must display the following acknowledgement:
24 .\"      This product includes software developed by the University of
25 .\"      California, Berkeley and its contributors.
26 .\" 4. Neither the name of the University nor the names of its contributors
27 .\"    may be used to endorse or promote products derived from this software
28 .\"    without specific prior written permission.
29 .\"
30 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
31 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
34 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 .\" SUCH DAMAGE.
41 .\"
42 .\"     @(#)mdoc.samples.7 8.2 (Berkeley) 12/30/93
43 .\"
44 .\" This reference invokes every macro in the package several
45 .\" times and is guaranteed to give a worst case performance
46 .\" for an already extremely slow package.
47 .\"
49 .Dd April 10, 2001
50 .Os
51 .Dt GROFF_MDOC 7
54 .Sh NAME
56 .Nm groff_mdoc
57 .Nd reference for groff's mdoc implementation
60 .Sh SYNOPSIS
62 .Nm groff Fl m Ns Cm doc Ar
65 .Sh DESCRIPTION
67 A complete reference for writing
68 .Ux
69 manual pages with the
70 .Nm \-mdoc
71 macro package; a
72 .Em content Ns -based
73 and
74 .Em domain Ns -based
75 formatting package for
76 .Tn GNU
77 .Xr troff 1 .
78 Its predecessor, the
79 .Xr \-man 7
80 package, addressed page layout leaving the manipulation of fonts and other
81 typesetting details to the individual author.
83 .Nm \-mdoc ,
84 page layout macros make up the
85 .Em "page structure domain"
86 which consists of macros for titles, section headers, displays and lists
87 \- essentially items which affect the physical position of text on a
88 formatted page.
89 In addition to the page structure domain, there are two more domains, the
90 .Em manual
91 domain and the
92 .Em general
93 text domain.
94 The general text domain is defined as macros which perform tasks such as
95 quoting or emphasizing pieces of text.
96 The manual domain is defined as macros that are a subset of the day to day
97 informal language used to describe commands, routines and related
98 .Ux
99 files.
100 Macros in the manual domain handle command names, command line arguments and
101 options, function names, function parameters, pathnames, variables, cross
102 references to other manual pages, and so on.
103 These domain items have value for both the author and the future user of the
104 manual page.
105 It is hoped the consistency gained across the manual set will provide easier
106 translation to future documentation tools.
108 Throughout the
110 manual pages, a manual entry is simply referred to as a man page, regardless
111 of actual length and without sexist intention.
114 .Sh "GETTING STARTED"
116 The material presented in the remainder of this document is outlined
117 as follows:
119 .Bl -enum -width 3n -offset indent
120 .  It
121 .  Tn "TROFF IDIOSYNCRASIES"
123 .  Bl -tag -width 2n -compact
124 .    It "Macro Usage"
125 .    It "Passing Space Characters in an Argument"
126 .    It "Trailing Blank Space Characters"
127 .    It "Escaping Special Characters"
128 .    It "Other Possible Pitfalls"
129 .  El
131 .  It
132 .  Tn "A MANUAL PAGE TEMPLATE"
134 .  It
135 .  Tn "CONVENTIONS"
137 .  It
138 .  Tn "TITLE MACROS"
140 .  It
141 .  Tn "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS"
143 .  Bl -tag -width 2n -compact
144 .    It "What's in a Name" Ns ...
145 .    It "General Syntax"
146 .  El
148 .  It
149 .  Tn "MANUAL DOMAIN"
151 .  Bl -tag -width 2n -compact
152 .    It "Addresses"
153 .    It "Author Name"
154 .    It "Arguments"
155 .    It "Configuration Declarations (Section Four Only)"
156 .    It "Command Modifiers"
157 .    It "Defined Variables"
158 .    It "Errno's"
159 .    It "Environment Variables"
160 .    It "Flags"
161 .    It "Function Declarations"
162 .    It "Function Types"
163 .    It "Functions (Library Routines)"
164 .    It "Function Arguments"
165 .    It "Return Values"
166 .    \" .It "Header File (including source code)"
167 .    It "Interactive Commands"
168 .    It "Library Names"
169 .    It "Literals"
170 .    It "Names"
171 .    It "Options"
172 .    It "Pathnames"
173 .    It "Standards"
174 .    It "Variable Types"
175 .    It "Variables"
176 .    It "Manual Page Cross References"
177 .  El
179 .  It
180 .  Tn "GENERAL TEXT DOMAIN"
182 .  Bl -tag -width 2n -compact
183 .    It "AT&T Macro"
184 .    It "BSD Macro"
185 .    It "NetBSD Macro"
186 .    It "FreeBSD 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 .ne 7
241 .Sh "TROFF IDIOSYNCRASIES"
244 .Nm \-mdoc
245 package attempts to simplify the process of writing a man page.
246 Theoretically, one should not have to learn the dirty details of
247 .Tn GNU
248 .Xr troff 1
249 to use
250 .Nm \-mdoc ;
251 however, there are a few limitations which are unavoidable and best gotten
252 out of the way.
253 And, too, be forewarned, this package is
254 .Em not
255 fast.
257 .Ss "Macro Usage"
259 As in
260 .Tn GNU
261 .Xr troff 1 ,
262 a macro is called by placing a
263 .Ql .\&
264 (dot character) at the beginning of a line followed by the two-character
265 (or three-character) name for the macro.
266 There can be space characters between the dot and the macro name (but
267 .Em no
268 tabs).
269 Arguments may follow the macro separated by spaces (again, no tabs).
270 It is the dot character at the beginning of the line which causes
271 .Tn GNU
272 .Xr troff 1
273 to interpret the next two (or more) characters as a macro name.
274 A single starting dot followed by nothing is ignored.
275 To place a
276 .Ql .\&
277 (dot character) at the beginning of an input line in some context other than
278 a macro invocation, precede the
279 .Ql .\&
280 (dot) with the
281 .Ql \e&
282 escape sequence.
284 .Ql \e&
285 translates literally to a zero-width space, and is never displayed in
286 the output.
288 In general,
289 .Tn GNU
290 .Xr troff 1
291 macros accept an unlimited number of arguments (contrary to other versions
292 of troff which can't handle more than nine arguments).
293 In limited cases, arguments may be continued or extended on the next
294 line (See
295 .Sx Extended Arguments
296 below).
297 Almost all macros handle quoted arguments (see
298 .Sx Passing Space Characters in an Argument
299 below).
301 Most of the
302 .Nm \-mdoc
303 general text domain and manual domain macros are special in that their
304 argument lists are
305 .Em parsed
306 for callable macro names.
307 This means an argument on the argument list which matches a general text or
308 manual domain macro name and is determined to be callable will be executed
309 or called when it is processed.
310 In this case the argument, although the name of a macro, is not preceded by
312 .Ql .\&
313 (dot).
314 It is in this manner that many macros are nested; for example the
315 option macro,
316 .Ql .Op ,
318 .Em call
319 the flag and argument macros,
320 .Ql \&Fl
322 .Ql \&Ar ,
323 to specify an optional flag with an argument:
325 .Bl -tag -xwidth ".Op Fl s Ar bytes" -offset indent
326 .It Op Fl s Ar bytes
327 is produced by
328 .Ql ".Op Fl s Ar bytes"
332 To prevent a string from being interpreted as a macro name, precede the
333 string with the escape sequence
334 .Ql \e& :
336 .Bl -tag -xwidth ".Op \&Fl s \&Ar bytes" -offset indent
337 .It Op \&Fl s \&Ar bytes
338 is produced by
339 .Ql ".Op \e&Fl s \e&Ar bytes"
343 Here the strings
344 .Ql \&Fl
346 .Ql \&Ar
347 are not interpreted as macros.
348 Macros whose argument lists are parsed for callable arguments are referred
349 to as
350 .Em parsed
351 and macros which may be called from an argument list are referred to as
352 .Em callable
353 throughout this document.
354 This is a technical
355 .Em faux pas
356 as almost all of the macros in
357 .Nm \-mdoc
358 are parsed, but as it was cumbersome to constantly refer to macros as
359 being callable and being able to call other macros, the term parsed
360 has been used.
362 .Ss "Passing Space Characters in an Argument"
364 Sometimes it is desirable to give as an argument a string containing one or
365 more blank space characters.
366 This may be necessary to specify arguments to macros which expect particular
367 arrangement of items in the argument list.  Additionally, it makes
368 .Nm \-mdoc
369 working faster.
370 For example, the function macro
371 .Ql .Fn
372 expects the first argument to be the name of a function and any remaining
373 arguments to be function parameters.
375 .Tn ANSI\~C
376 stipulates the declaration of function parameters in the parenthesized
377 parameter list, each parameter is guaranteed to be at minimum a two word
378 string.
379 For example,
380 .Fa int foo .
382 There are two possible ways to pass an argument which contains
383 an embedded space.
384 One way of passing a string containing blank spaces is to use the hard or
385 unpaddable space character
386 .Ql \e\  ,
387 that is, a blank space preceded by the escape character
388 .Ql \e .
389 This method may be used with any macro but has the side effect of
390 interfering with the adjustment of text over the length of a line.
391 .Xr Troff
392 sees the hard space as if it were any other printable character and cannot
393 split the string into blank or newline separated pieces as one would expect.
394 This method is useful for strings which are not expected to overlap a line
395 boundary.
396 An alternative is to use
397 .Ql \e~ ,
398 a paddable (i.e.\& stretchable), unbreakable space (this is a
399 .Tn GNU
400 .Xr troff 1
401 extension).
402 The second method is to enclose the string with double quotes.
404 For example:
406 .Bl -tag -xwidth ".Fn fetch char\ *str" -offset indent
407 .It Fn fetch char\ *str
408 is created by
409 .Ql ".Fn fetch char\e *str"
410 .It Fn fetch "char *str"
411 can also be created by
412 .Ql ".Fn fetch \*[q]char *str\*[q]"
416 If the
417 .Ql \e
418 before the space resp.\& the double quotes were omitted,
419 .Ql .Fn
420 would see three arguments, and the result would be:
422 .Dl Fn fetch char *str
424 .\" For an example of what happens when the parameter list overlaps a newline
425 .\" boundary, see the
426 .\" .Sx BUGS
427 .\" section.
429 .Ss "Trailing Blank Space Characters"
431 .Xr Troff
432 can be confused by blank space characters at the end of a line.
433 It is a wise preventive measure to globally remove all blank spaces
434 from
435 .Ao blank-space Ac Ns Ao end-of-line Ac
436 character sequences.
437 Should the need arise to force a blank character at the end of a line, it
438 may be forced with an unpaddable space and the
439 .Ql \e&
440 escape character.
441 For example,
442 .Ql string\e\ \e& .
444 .Ss "Escaping Special Characters"
446 Special characters like the newline character
447 .Ql \en
448 are handled by replacing the
449 .Ql \e
450 with
451 .Ql \ee
452 (e.g.\&
453 .Ql \een )
454 to preserve the backslash.
456 .Ss "Other Possible Pitfalls"
458 A warning is emitted when an empty input line is found outside of displays
459 (see below).
461 .Ql .sp
462 instead.
463 (Well, it is even better to use
464 .Nm \-mdoc
465 macros to avoid the usage of low-level commands.)
467 Leading spaces will cause a break and are output directly.
468 Avoid this behaviour if possible.
469 Similarly, do not use more than one space character between words in an
470 ordinary text line; contrary to other text formatters, they are
471 .Em not
472 replaced with a single space.
474 You can't pass
475 .Ql \*[q]
476 directly as an argument.
478 .Ql \e*[q]
480 .Ql \e*q )
481 instead.
483 By default,
484 .Xr troff 1
485 inserts two space characters after a punctuation mark closing a sentence;
486 characters like
487 .Ql \&)
489 .Ql \&'
490 are treated transparently, not influencing the sentence-ending behaviour.
491 To change this, insert
492 .Ql \e&
493 before or after the dot:
495 .Bd -literal -offset indent
497 \&.Ql .
498 character.
499 \&.Pp
501 \&.Ql \e&.
502 character.
503 \&.Pp
504 \&.No test .
505 test
506 \&.Pp
507 \&.No test.
508 test
512 gives
514 .Bd -filled -offset indent
516 .Ql .
517 character
520 .Ql \&.
521 character.
523 .No test .
524 test
526 .No test.
527 test
531 As can be seen in the first and third line,
532 .Nm \-mdoc
533 handles punctuation characters specially in macro arguments.
534 This will be explained in section
535 .Sx General Syntax
536 below.
537 In the same way, you have to protect trailing full stops of abbreviations
538 with a trailing zero-width space:
539 .Ql e.g.\e& .
541 A comment in the source file of a man page can be either started with
542 .Ql .\e"
543 on a single line,
544 .Ql \e"
545 after some input, or
546 .Ql \e#
547 anywhere (the latter is a
548 .Tn GNU
549 .Xr troff 1
550 extension); the rest of such a line is ignored.
553 .Sh "A MANUAL PAGE TEMPLATE"
555 The body of a man page is easily constructed from a basic template:
557 .Bd -literal -offset indent
558 \&.\e" The following requests are required for all man pages.
559 \&.Dd Month day, year
560 \&.Os [OPERATING_SYSTEM] [version/release]
561 \&.Dt DOCUMENT_TITLE [section number] [architecture/volume]
562 \&.Sh NAME
563 \&.Nm name
564 \&.Nd one line description of name
565 \&.\e" This next request is for sections 2 and 3 only.
566 \&.\e" .Sh LIBRARY
567 \&.Sh SYNOPSIS
568 \&.Sh DESCRIPTION
569 \&.\e" The following requests should be uncommented and
570 \&.\e" used where appropriate.
571 \&.\e" .Sh IMPLEMENTATION NOTES
572 \&.\e" This next request is for sections 2, 3 and 9 function
573 \&.\e" return values only.
574 \&.\e" .Sh RETURN VALUES
575 \&.\e" This next request is for sections 1, 6, 7 and 8 only.
576 \&.\e" .Sh ENVIRONMENT
577 \&.\e" .Sh FILES
578 \&.\e" .Sh EXAMPLES
579 \&.\e" This next request is for sections 1, 6, 7, 8 and 9 only
580 \&.\e"     (command return values (to shell) and
581 \&.\e"     fprintf/stderr type diagnostics).
582 \&.\e" .Sh DIAGNOSTICS
583 \&.\e" .Sh COMPATIBILITY
584 \&.\e" This next request is for sections 2, 3 and 9 error
585 \&.\e"     and signal handling only.
586 \&.\e" .Sh ERRORS
587 \&.\e" .Sh SEE ALSO
588 \&.\e" .Sh STANDARDS
589 \&.\e" .Sh HISTORY
590 \&.\e" .Sh AUTHORS
591 \&.\e" .Sh BUGS
595 The first items in the template are the macros
596 .Ql .Dd ,
597 .Ql .Os ,
599 .Ql .Dt ;
600 the document date, the operating system the man page or subject source is
601 developed or modified for, and the man page title (in
602 .Em upper case )
603 along with the section of the manual the page belongs in.
604 These macros identify the page and are discussed below in
605 .Sx TITLE MACROS .
607 The remaining items in the template are section headers
608 .Pf ( Li .Sh ) ;
609 of which
610 .Sx NAME ,
611 .Sx SYNOPSIS ,
613 .Sx DESCRIPTION
614 are mandatory.
615 The headers are discussed in
616 .Sx "PAGE STRUCTURE DOMAIN" ,
617 after presentation of
618 .Sx "MANUAL DOMAIN" .
619 Several content macros are used to demonstrate page layout macros; reading
620 about content macros before page layout macros is recommended.
623 .Sh CONVENTIONS
625 In the description of all macros below, optional arguments are put into
626 brackets.
627 An ellipsis
628 .Pf ( Sq ... )
629 represents zero or more additional arguments.
630 Alternative values for a parameter are separated with
631 .Ql | .
632 If there are alternative values for a mandatory parameter, braces are used
633 (together with
634 .Ql | )
635 to enclose the value set.
636 Meta-variables are specified within angles.
638 Example:
640 .Bl -tag -width 6n -offset indent
641 .It Li .Xx Xo
642 .Aq foo 
643 .Brq bar1 | bar2
644 .Op \-test1 Op \-test2 | \-test3
645 .No ...
650 Except stated explicitly, all macros are parsed and callable.
652 Most macros have a default width value which can be used to specify a label
653 width
654 .Pf ( Fl width )
655 or offset
656 .Pf ( Fl offset )
657 for the
658 .Ql .Bl
660 .Ql .Bd
661 macros.
662 It is recommended not to use this rather obscure feature to avoid
663 dependencies on local modifications of the
664 .Nm \-mdoc
665 package.
668 .Sh "TITLE MACROS"
670 The title macros are part of the page structure domain but are presented
671 first and separately for someone who wishes to start writing a man page
672 yesterday.
673 Three header macros designate the document title or manual page title, the
674 operating system, and the date of authorship.
675 These macros are called once at the very beginning of the document and are
676 used to construct headers and footers only.
678 .Bl -tag -width 6n
679 .It Li .Dt Xo
680 .Op Aq document title
681 .Op Aq section number
682 .Op Aq volume
684 The document title is the subject of the man page and must be in
685 .Tn CAPITALS
686 due to troff limitations.
687 If omitted,
688 .Sq Tn UNTITLED
689 is used.
690 The section number may be a number in the range
691 .No 1,\~ Ns ... Ns ,\~9
693 .Ql unass ,
694 .Ql draft ,
696 .Ql paper .
697 If it is specified, and no volume name is given, a default volume name is
698 used.
701 Under
702 .Tn \*[operating-system] ,
703 the following sections are defined:
705 .Bl -column LOCAL -offset indent -compact
706 .It Li 1   Ta "\*[volume-ds-1]"
707 .It Li 2   Ta "\*[volume-ds-2]"
708 .It Li 3   Ta "\*[volume-ds-3]"
709 .It Li 4   Ta "\*[volume-ds-4]"
710 .It Li 5   Ta "\*[volume-ds-5]"
711 .It Li 6   Ta "\*[volume-ds-6]"
712 .It Li 7   Ta "\*[volume-ds-7]"
713 .It Li 8   Ta "\*[volume-ds-8]"
714 .It Li 9   Ta "\*[volume-ds-9]"
718 A volume name may be arbitrary or one of the following:
721 .Bl -column LOCAL -offset indent -compact
722 .It Li USD   Ta "\*[volume-ds-USD]"
723 .It Li PS1   Ta "\*[volume-ds-PS1]"
724 .It Li AMD   Ta "\*[volume-ds-AMD]"
725 .It Li SMM   Ta "\*[volume-ds-SMM]"
726 .It Li URM   Ta "\*[volume-ds-URM]"
727 .It Li PRM   Ta "\*[volume-ds-PRM]"
728 .It Li KM    Ta "\*[volume-ds-KM]"
729 .It Li IND   Ta "\*[volume-ds-IND]"
730 .It Li LOCAL Ta "\*[volume-ds-LOCAL]"
731 .It Li CON   Ta "\*[volume-ds-CON]"
735 For compatibility,
736 .Ql MMI
737 can be used for
738 .Ql IND ,
740 .Ql LOC
742 .Ql LOCAL .
743 Values from the previous table will specify a new volume name.
744 If the third parameter is a keyword designating a computer architecture,
745 its value is appended to the volume name as specified by the second
746 parameter.  By default, the following architecture keywords are defined:
748 \# we use `No' to avoid hyphenation
749 .Bd -ragged -offset indent
750 .No alpha , amiga , arc , arm26 , arm32 , atari , bebox , cobalt , evbsh3 ,
751 .No hp300 , hpcmips , i386 , luna68k , m68k , mac68k , macppc , mips ,
752 .No mmeye , mvme68k , news68k , newsmips , next68k , ofppc , pc532 , pmax ,
753 .No powerpc , prep , sgimips , sh3 , sparc , sparc64 , sun3 , tahoe , vax ,
754 .No x68k
758 In the following examples, the left (which is identical to the right) and
759 the middle part of the manual page header strings are shown.
761 .Bd -ragged
762 .Bl -tag -xwidth ".Li .Dt\ FOO\ 2\ mac68k" -compact -offset indent
763 .It Li ".Dt FOO 7"
764 .Ql FOO(7)
765 .Ql System Reference Manual
766 .It Li ".Dt FOO 2 mac68k"
767 .Ql FOO(2)
768 .Ql System Programmer's Manual (mac68k Architecture)
769 .It Li ".Dt FOO \*[q]\*[q] bar"
770 .Ql FOO
771 .Ql bar
776 Local, OS-specific additions might be found in the file
777 .Pa mdoc.local ;
778 look for strings named
779 .Ql volume-ds-XXX
780 (for the former type) and
781 .Ql volume-as-XXX
782 (for the latter type);
783 .Ql XXX
784 then denotes the keyword to be used with the
785 .Ql .Dt
786 macro.
788 This macro is neither callable nor parsed.
790 .It Li .Os Xo
791 .Op Aq operating system
792 .Op Aq release
794 If the first parameter is empty,
795 the default
796 .Sq Tn "\*[operating-system]"
797 is used.
798 This may be overridden in the local configuration file,
799 .Pa mdoc.local .
800 In general, the name of the operating system should be the common acronym,
801 e.g.\&
802 .Tn BSD
804 .Tn ATT .
805 The release should be the standard release nomenclature for the system
806 specified.
807 In the following table, the possible second arguments for some predefined
808 operating systems are listed.
809 Similar to
810 .Ql .Dt ,
811 local additions might be defined in
812 .Pa mdoc.local ;
813 look for strings named
814 .Ql operating-system-XXX-YYY ,
815 where
816 .Ql XXX
817 is the acronym for the operating system and
818 .Ql YYY
819 the release ID.
821 .Bd -ragged -compact
822 .Bl -tag -xwidth ".No FreeBSD" -offset indent
823 .It ATT
824 7th, 7, III, 3, V, V.2, V.3, V.4
825 .It BSD
826 3, 4, 4.1, 4.2, 4.3, 4.3t, 4.3T, 4.3r, 4.3R, 4.4
827 .It NetBSD
828 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,
829 1.3, 1.3a, 1.4, 1.5
830 .It FreeBSD
831 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,
832 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,
833 4.2, 5.0
839 .Tn ATT ,
840 an unknown second parameter will be replaced with the string
841 .Tn UNIX ;
842 for the other predefined acronyms it will be ignored and a warning message
843 emitted.
844 Unrecognized arguments are displayed as given in the page footer.
845 For instance, a typical footer might be:
847 .Dl .Os BSD 4.3
849 giving
850 .Ql 4.3\~Berkeley Distribution ,
851 or for a locally produced set
853 .Dl .Os CS Department
855 which will produce
856 .Ql CS\~Department .
858 If the
859 .Ql .Os
860 macro is not present, the bottom left corner of the manual page will be
861 ugly.
863 This macro is neither callable nor parsed.
865 .It Li .Dd Oo
866 .Aq month
867 .Aq day ,
868 .Aq year
871 .Ql Dd
872 has no arguments,
873 .Ql Epoch
874 is used for the date string.
875 If it has exactly three arguments, they are concatenated, separated with
876 unbreakable space:
878 .Dl .Dd January 25, 2001
880 Otherwise, the current date is used, ignoring the parameters.
882 This macro is neither callable nor parsed.
886 .Sh "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS"
888 .Ss "What's in a Name" Ns ...
890 The manual domain macro names are derived from the day to day informal
891 language used to describe commands, subroutines and related files.
892 Slightly different variations of this language are used to describe the
893 three different aspects of writing a man page.
894 First, there is the description of
895 .Nm \-mdoc
896 macro request usage.
897 Second is the description of a
899 command
900 .Em with
901 .Nm \-mdoc
902 macros, and third, the description of a command to a user in the verbal
903 sense; that is, discussion of a command in the text of a man page.
905 In the first case,
906 .Xr troff 1
907 macros are themselves a type of command; the general syntax for a troff
908 command is:
910 .Bd -filled -offset indent
911 .Li ".Xx argument1 argument2" ...
915 .Ql .Xx
916 is a macro command or request, and anything following it are arguments to
917 be processed.
918 In the second case, the description of a
920 command using the content macros is a bit more involved; a typical
921 .Sx SYNOPSIS
922 command line might be displayed as:
924 .Bd -filled -offset indent
925 .Nm filter
926 .Op Fl flag
927 .Ao Ar infile Ac Ao Ar outfile Ac
931 Here,
932 .Nm filter
933 is the command name and the
934 bracketed string
935 .Fl flag
936 is a
937 .Em flag
938 argument designated as optional by the option brackets.
940 .Nm \-mdoc
941 terms,
942 .Ao Ar infile Ac
944 .Ao Ar outfile Ac
945 are called
946 .Em meta arguments ;
947 in this example, the user has to replace the meta expressions given in angle
948 brackets with real file names.
949 Note that in this document meta arguments are used to describe
950 .Nm \-mdoc
951 commands; in most man pages, meta variables are not specifically written
952 with angle brackets.
953 The macros which formatted the above example:
955 .Bd -literal -offset indent
956 \&.Nm filter
957 \&.Op Fl flag
958 \&.Ao Ar infile Ac Ao Ar outfile Ac
962 In the third case, discussion of commands and command syntax includes both
963 examples above, but may add more detail.
964 The arguments
965 .Ao Ar infile Ac
967 .Ao Ar outfile Ac
968 from the example above might be referred to as
969 .Em operands
971 .Em file arguments .
972 Some command line argument lists are quite long:
974 .Bd -ragged
975 .Bl -tag -xwidth ".Nm make" -offset indent -compact
976 .It Nm make
977 .Op Fl eiknqrstv
978 .Op Fl D Ar variable
979 .Op Fl d Ar flags
980 .Op Fl f Ar makefile
981 .Op Fl I Ar directory
982 .Op Fl j Ar max_jobs
983 .Op Ar variable Ns = Ns Ar value
985 .Op Ar target ...
991 Here one might talk about the command
992 .Nm make
993 and qualify the argument,
994 .Ar makefile ,
995 as an argument to the flag,
996 .Fl f ,
997 or discuss the optional file operand
998 .Ar target .
999 In the verbal context, such detail can prevent confusion, however the
1000 .Nm \-mdoc
1001 package does not have a macro for an argument
1002 .Em to
1003 a flag.
1004 Instead the
1005 .Ql \&Ar
1006 argument macro is used for an operand or file argument like
1007 .Ar target
1008 as well as an argument to a flag like
1009 .Ar variable .
1010 The make command line was produced from:
1012 .Bd -literal -offset indent
1013 \&.Nm make
1014 \&.Op Fl eiknqrstv
1015 \&.Op Fl D Ar variable
1016 \&.Op Fl d Ar flags
1017 \&.Op Fl f Ar makefile
1018 \&.Op Fl I Ar directory
1019 \&.Op Fl j Ar max_jobs
1020 \&.Op Ar variable Ns = Ns Ar value
1021 \&.Bk
1022 \&.Op Ar target ...
1023 \&.Ek
1028 .Ql .Bk
1030 .Ql .Ek
1031 macros are explained in
1032 .Sx Keeps .
1034 .Ss "General Syntax"
1036 The manual domain and general text domain macros share a similar syntax with
1037 a few minor deviations; most notably,
1038 .Ql .Ar ,
1039 .Ql .Fl ,
1040 .Ql .Nm ,
1042 .Ql .Pa
1043 differ only when called without arguments; and
1044 .Ql .Fn
1046 .Ql .Xr
1047 impose an order on their argument lists.
1048 All content macros are capable of recognizing and properly handling
1049 punctuation, provided each punctuation character is separated by a leading
1050 space.
1051 If a request is given:
1053 .Dl \&.Ar sptr, ptr),
1055 The result is:
1057 .Dl Ar sptr, ptr),
1059 The punctuation is not recognized and all is output in the
1060 font used by
1061 .Ql .Ar .
1062 If the punctuation is separated by a leading white space:
1064 .Dl \&.Ar "sptr , ptr ) ,"
1066 The result is:
1068 .Dl Ar sptr , ptr ) ,
1070 The punctuation is now recognized and output in the default font
1071 distinguishing it from the argument strings.
1072 To remove the special meaning from a punctuation character escape it with
1073 .Ql \e& .
1075 .Xr Troff
1076 is limited as a macro language, and has difficulty when presented with a
1077 string containing a member of the mathematical, logical or quotation set:
1079 .Bd -literal -offset indent-two
1080 {+,\-,/,*,%,<,>,<=,>=,=,==,&,`,',"}
1084 The problem is that
1085 .Xr troff
1086 may assume it is supposed to actually perform the operation or evaluation
1087 suggested by the characters.
1088 To prevent the accidental evaluation of these characters, escape them with
1089 .Ql \e& .
1090 Typical syntax is shown in the first content macro displayed below,
1091 .Ql .Ad .
1094 .Sh "MANUAL DOMAIN"
1096 .Ss Addresses
1098 The address macro identifies an address construct.
1100 .Dl Usage: .Ad Ao address Ac ...
1102 .Bl -tag -xwidth ".Li .Ad\ f1\ ,\ f2\ ,\ f3\ :" -compact -offset 15n
1103 .It Li ".Ad addr1"
1104 .Ad addr1
1105 .It Li ".Ad addr1 ."
1106 .Ad addr1 .
1107 .It Li ".Ad addr1 , file2"
1108 .Ad addr1 , file2
1109 .It Li ".Ad f1 , f2 , f3 :"
1110 .Ad f1 , f2 , f3 :
1111 .It Li ".Ad addr ) ) ,"
1112 .Ad addr ) ) ,
1116 The default width is 12n.
1118 .Ss "Author Name"
1121 .Ql .An
1122 macro is used to specify the name of the author of the item being
1123 documented, or the name of the author of the actual manual page.
1125 .Dl Usage: .An Ao author name Ac ...
1127 .Bl -tag -xwidth ".Li .An\ \*[q]Joe\ Author\*[q]\ )\ )\ ," -offset 15n
1128 .It Li ".An \*[q]Joe Author\*[q]"
1129 .An "Joe Author"
1130 .It Li ".An \*[q]Joe Author\*[q] ,"
1131 .An "Joe Author" ,
1132 .It Li ".An \*[q]Joe Author\*[q] Aq nobody@FreeBSD.org"
1133 .An "Joe Author" Aq nobody@FreeBSD.org
1134 .It Li ".An \*[q]Joe Author\*[q] ) ) ,"
1135 .An "Joe Author" ) ) ,
1139 The default width is 12n.
1141 In the
1142 .Sx AUTHORS
1143 section, the
1144 .Ql .An
1145 request causes a line break allowing each new name to appear on its own
1146 line.
1147 If this is not desirable,
1149 .Bd -literal -offset indent
1150 \&.An -nosplit
1154 call will turn this off.
1155 To turn splitting back on, write
1157 .Bd -literal -offset indent
1158 \&.An -split
1161 .Ss "Arguments"
1164 .Li .Ar
1165 argument macro may be used whenever an argument is referenced.
1166 If called without arguments, the
1167 .Sq Ar
1168 string is output.
1170 .Dl Usage: .Ar Oo Ao argument Ac Oc ...
1172 .Bl -tag -xwidth ".Li .Ar\ file1\ file2" -compact -offset 15n
1173 .It Li .Ar
1175 .It Li ".Ar file1"
1176 .Ar file1
1177 .It Li ".Ar file1 ."
1178 .Ar file1 .
1179 .It Li ".Ar file1 file2"
1180 .Ar file1 file2
1181 .It Li ".Ar f1 f2 f3 :"
1182 .Ar f1 f2 f3 :
1183 .It Li ".Ar file ) ) ,"
1184 .Ar file ) ) ,
1188 The default width is 12n.
1190 .Ss "Configuration Declaration (Section Four Only)"
1193 .Ql .Cd
1194 macro is used to demonstrate a
1195 .Xr config 8
1196 declaration for a device interface in a section four manual.
1198 .Dl Usage: .Cd Ao argument Ac ...
1200 .Bl -tag -xwidth ".Li .Cd\ Xdevice\ le0\ at\ scode?X" -offset 15n
1201 .It Li ".Cd \*[q]device le0 at scode?\*[q]"
1202 .Cd "device le0 at scode?"
1205 In the
1206 .Sx SYNOPSIS
1207 section a
1208 .Ql .Cd
1209 request causes a line break before and after its arguments are printed.
1212 The default width is 12n.
1214 .Ss "Command Modifiers"
1216 The command modifier is identical to the
1217 .Ql .Fl
1218 (flag) command with the exception that the
1219 .Ql .Cm
1220 macro does not assert a dash in front of every argument.
1221 Traditionally flags are marked by the preceding dash, however, some commands
1222 or subsets of commands do not use them.
1223 Command modifiers may also be specified in conjunction with interactive
1224 commands such as editor commands.
1226 .Sx Flags .
1228 The default width is 10n.
1230 .Ss "Defined Variables"
1232 A variable (or constant) which is defined in an include file
1233 is specified by the macro
1234 .Ql .Dv .
1236 .Dl Usage: .Dv Ao defined variable Ac ...
1238 .Bl -tag -xwidth ".Li .Dv\ MAXHOSTNAMELEN" -compact -offset 15n
1239 .It Li ".Dv MAXHOSTNAMELEN"
1240 .Dv MAXHOSTNAMELEN
1241 .It Li ".Dv TIOCGPGRP )"
1242 .Dv TIOCGPGRP )
1246 The default width is 12n.
1248 .Ss Errno's
1251 .Ql .Er
1252 errno macro specifies the error return value for section 2, 3, and\~9 library
1253 routines.
1254 The second example below shows
1255 .Ql .Er
1256 used with the
1257 .Ql .Bq
1258 general text domain macro, as it would be used in a section two manual page.
1260 .Dl Usage: .Er Ao errno type Ac ...
1262 .Bl -tag -xwidth ".Li .Bq\ Er\ ENOTDIR" -compact -offset 15n
1263 .It Li ".Er ENOENT"
1264 .Er ENOENT
1265 .It Li ".Er ENOENT ) ;"
1266 .Er ENOENT ) ;
1267 .It Li ".Bq Er ENOTDIR"
1268 .Bq Er ENOTDIR
1272 The default width is 17n.
1274 .Ss "Environment Variables"
1277 .Ql .Ev
1278 macro specifies an environment variable.
1280 .Dl Usage: .Ev Ao argument Ac ...
1282 .Bl -tag -xwidth ".Li .Ev\ PRINTER\ )\ )\ ," -compact -offset 15n
1283 .It Li ".Ev DISPLAY"
1284 .Ev DISPLAY
1285 .It Li ".Ev PATH ."
1286 .Ev PATH .
1287 .It Li ".Ev PRINTER ) ) ,"
1288 .Ev PRINTER ) ) ,
1292 The default width is 15n.
1294 .Ss Flags
1297 .Ql .Fl
1298 macro handles command line flags.
1299 It prepends a dash,
1300 .Ql \- ,
1301 to the flag.
1302 For interactive command flags, which are not prepended with a dash, the
1303 .Ql .Cm
1304 (command modifier)
1305 macro is identical, but without the dash.
1307 .Dl Usage: .Fl Ao argument Ac ...
1309 .Bl -tag -xwidth ".Li .Fl\ xyz\ )\ ," -compact -offset 15n
1310 .It Li .Fl
1312 .It Li ".Fl cfv"
1313 .Fl cfv
1314 .It Li ".Fl cfv ."
1315 .Fl cfv .
1316 .It Li ".Cm cfv ."
1317 .Cm cfv .
1318 .It Li ".Fl s v t"
1319 .Fl s v t
1320 .It Li ".Fl \- ,"
1321 .Fl \- ,
1322 .It Li ".Fl xyz ) ,"
1323 .Fl xyz ) ,
1324 .It Li ".Fl |"
1325 .Fl |
1329 .Ql .Fl
1330 macro without any arguments results in a dash representing stdin/stdout.
1331 Note that giving
1332 .Ql .Fl
1333 a single dash will result in two dashes.
1335 The default width is 12n.
1337 .Ss "Function Declarations"
1340 .Ql .Fd
1341 macro is used in the
1342 .Sx SYNOPSIS
1343 section with section two or three functions.
1344 It is neither callable nor parsed.
1346 .Dl Usage: .Fd Ao argument Ac ...
1348 .Bl -tag -xwidth ".Li .Fd\ X#include\ <sys/types.h>X" -compact -offset 15n
1349 .It Li ".Fd \*[q]#include <sys/types.h>\*[q]"
1350 .Fd "#include <sys/types.h>"
1353 In the
1354 .Sx SYNOPSIS
1355 section a
1356 .Ql .Fd
1357 request causes a line break if a function has already been presented and a
1358 break has not occurred.
1359 This leaves a nice vertical space in between the previous function call and
1360 the declaration for the next function.
1364 .Ql .In
1365 .Li ( #include
1366 statement)
1367 macro is the short form of the above example.
1368 It specifies the C\~header file as being included in a C\~program.
1369 It also causes a line break, and is neither callable nor parsed.
1371 .Dl Usage: .In Ao header file Ac
1373 .Bl -tag -xwidth ".Li .In\ stdio.h" -compact -offset 15n
1374 .It Li ".In stdio.h"
1375 .In stdio.h
1378 .Ss "Function Types"
1380 This macro is intended for the
1381 .Sx SYNOPSIS
1382 section.
1383 It may be used anywhere else in the man page without problems, but its main
1384 purpose is to present the function type in kernel normal form for the
1385 .Sx SYNOPSIS
1386 of sections two and three (it causes a line break, allowing the function
1387 name to appear on the next line).
1389 .Dl Usage: .Ft Ao type Ac ...
1391 .Bl -tag -xwidth ".Li .Ft\ struct\ stat" -compact -offset 15n
1392 .It Li ".Ft struct stat"
1393 .Ft struct stat
1396 .Ss "Functions (Library Routines)"
1398 The 
1399 .Ql .Fn
1400 macro is modeled on
1401 .Tn ANSI\~C
1402 conventions.
1404 .Dl Usage: .Fn Ao function Ac Oo Ao parameter Ac Oc ...
1406 .Bl -tag -xwidth ".Li .Fn\ align\ Xchar\ *ptrX\ ," -compact -offset 15n
1407 .It Li ".Fn getchar"
1408 .Fn getchar
1409 .It Li ".Fn strlen ) ,"
1410 .Fn strlen ) ,
1411 .It Li ".Fn align \*[q]char *ptr\*[q] ,"
1412 .Fn align "char *ptr" ,
1415 Note that any call to another macro signals the end of the
1416 .Ql .Fn
1417 call (it will insert a closing parenthesis at that point).
1419 For functions with many parameters (which is rare), the macros
1420 .Ql .Fo
1421 (function open)
1423 .Ql .Fc
1424 (function close)
1425 may be used with
1426 .Ql .Fa
1427 (function argument).
1429 Example:
1431 .Bd -literal -offset indent
1432 \&.Ft int
1433 \&.Fo res_mkquery
1434 \&.Fa "int op"
1435 \&.Fa "char *dname"
1436 \&.Fa "int class"
1437 \&.Fa "int type"
1438 \&.Fa "char *data"
1439 \&.Fa "int datalen"
1440 \&.Fa "struct rrec *newrr"
1441 \&.Fa "char *buf"
1442 \&.Fa "int buflen"
1443 \&.Fc
1447 Produces:
1449 .Bd -ragged -offset indent
1450 .Ft int
1451 .Fo res_mkquery
1452 .Fa "int op"
1453 .Fa "char *dname"
1454 .Fa "int class"
1455 .Fa "int type"
1456 .Fa "char *data"
1457 .Fa "int datalen"
1458 .Fa "struct rrec *newrr"
1459 .Fa "char *buf"
1460 .Fa "int buflen"
1465 In the
1466 .Sx SYNOPSIS
1467 section, the function will always begin at the beginning of line.
1468 If there is more than one function presented in the
1469 .Sx SYNOPSIS
1470 section and a function type has not been given, a line break will occur,
1471 leaving a nice vertical space between the current function name and the one
1472 prior.
1474 The default width values of
1475 .Ql .Fn
1477 .Ql .Fo
1478 are 12n and 16n, respectively.
1480 .Ss "Function Arguments"
1483 .Ql .Fa
1484 macro is used to refer to function arguments (parameters) outside of the
1485 .Sx SYNOPSIS
1486 section of the manual or inside the
1487 .Sx SYNOPSIS
1488 section if the enclosure macros
1489 .Ql .Fo
1491 .Ql .Fc
1492 instead of
1493 .Ql .Fn
1494 are used.
1495 .Ql .Fa
1496 may also be used to refer to structure members.
1498 .Dl Usage: .Fa Ao function argument Ac ...
1500 .Bl -tag -xwidth ".Li .Fa\ d_namlen\ )\ )\ ," -compact -offset 15n
1501 .It Li ".Fa d_namlen ) ) ,"
1502 .Fa d_namlen ) ) ,
1503 .It Li ".Fa iov_len"
1504 .Fa iov_len
1508 The default width is 12n.
1510 .Ss "Return Values"
1513 .Ql .Rv
1514 macro generates text for use in the
1515 .Sx RETURN VALUES
1516 section.
1518 .Dl Usage: .Rv Oo -std Oc Ao function Ac ...
1520 For example,
1521 .Ql ".Rv -std atexit"
1522 produces:
1524 .Bd -ragged -offset -indent
1525 \# a small hack to suppress a warning message
1526 .ds section-old "\*[section]
1527 .ds section 2
1528 .Rv -std atexit
1529 .ds section "\*[section-old]
1534 .Fl std
1535 option is valid only for manual page sections\~2 and\~3.
1536 Currently, this macro does nothing if used without the
1537 .Fl std
1538 flag.
1540 .Ss "Interactive Commands"
1543 .Ql .Ic
1544 macro designates an interactive or internal command.
1546 .Dl Usage: .Ic Ao argument Ac ...
1548 .Bl -tag -xwidth ".Li .Ic\ setenv\ ,\ unsetenv" -compact -offset 15n
1549 .It Li ".Ic :wq"
1550 .Ic :wq
1551 .It Li ".Ic \*[q]do while {...}\*[q]"
1552 .Ic "do while {...}"
1553 .It Li ".Ic setenv , unsetenv"
1554 .Ic setenv , unsetenv
1558 The default width is 12n.
1560 .Ss "Library Names"
1563 .Ql .Lb
1564 macro is used to specify the library where a particular function is compiled
1567 .Dl Usage: .Lb Ao argument Ac ...
1569 Available arguments to
1570 .Ql .Lb 
1571 and their results are:
1574 .Bl -tag -xwidth ".Li libossaudio" -compact -offset indent
1575 .It Li libarm32
1576 .Lb libarm32
1577 .It Li libc
1578 .Lb libc
1579 .It Li libcompat
1580 .Lb libcompat
1581 .It Li libcrypt
1582 .Lb libcrypt
1583 .It Li libcurses
1584 .Lb libcurses
1585 .It Li libedit
1586 .Lb libedit
1587 .It Li libi386
1588 .Lb libi386
1589 .It Li libipsec
1590 .Lb libipsec
1591 .It Li libkvm
1592 .Lb libkvm
1593 .It Li libm
1594 .Lb libm
1595 .It Li libmenu
1596 .Lb libmenu
1597 .It Li libossaudio
1598 .Lb libossaudio
1599 .It Li libposix
1600 .Lb libposix
1601 .It Li libresolv
1602 .Lb libresolv
1603 .It Li libtermcap
1604 .Lb libtermcap
1605 .It Li libutil
1606 .Lb libutil
1607 .It Li libz
1608 .Lb libz
1612 Local, OS-specific additions might be found in the file
1613 .Pa mdoc.local ;
1614 look for strings named
1615 .Ql str-Lb-XXX .
1616 .Ql XXX
1617 then denotes the keyword to be used with the
1618 .Ql .Lb
1619 macro.
1621 .Ss Literals
1624 .Ql .Li
1625 literal macro may be used for special characters, variable constants, etc.\&
1626 -- anything which should be displayed as it would be typed.
1628 .Dl Usage: .Li Ao argument Ac ...
1630 .Bl -tag -xwidth ".Li .Li\ cntrl-D\ )\ ,"  -compact -offset 15n
1631 .It Li ".Li \een"
1632 .Li \en
1633 .It Li ".Li M1 M2 M3 ;"
1634 .Li M1 M2 M3 ;
1635 .It Li ".Li cntrl-D ) ,"
1636 .Li cntrl-D ) ,
1637 .It Li ".Li 1024 ..."
1638 .Li 1024 ...
1642 The default width is 16n.
1644 .Ss Names
1647 .Ql .Nm
1648 macro is used for the document title or subject name.
1649 It has the peculiarity of remembering the first argument it was called with,
1650 which should always be the subject name of the page.
1651 When called without arguments,
1652 .Ql .Nm
1653 regurgitates this initial name for the sole purpose of making less work for
1654 the author.
1655 Note: A section two or three document function name is addressed with the
1656 .Ql .Nm
1657 in the
1658 .Sx NAME
1659 section, and with
1660 .Ql .Fn
1661 in the
1662 .Sx SYNOPSIS
1663 and remaining sections.
1664 For interactive commands, such as the
1665 .Ql while
1666 command keyword in
1667 .Xr csh 1 ,
1669 .Ql .Ic
1670 macro should be used.
1671 While
1672 .Ql .Ic
1673 is nearly identical
1675 .Ql .Nm ,
1676 it can not recall the first argument it was invoked with.
1678 .Dl Usage: .Nm Oo Ao argument Ac Oc ...
1680 .Bl -tag -xwidth ".Li .Nm\ groff_mdoc" -compact -offset 15n
1681 .It Li ".Nm groff_mdoc"
1682 .Nm groff_mdoc
1683 .It Li ".Nm \e-mdoc"
1684 .Nm \-mdoc
1685 .It Li ".Nm foo ) ) ,"
1686 .Nm foo ) ) ,
1687 .It Li ".Nm :"
1688 .Nm :
1692 The default width is 10n.
1694 .Ss Options
1697 .Ql .Op
1698 macro places option brackets around any remaining arguments on the
1699 command line, and places any trailing punctuation outside the brackets.
1700 The macros
1701 .Ql .Oo
1703 .Ql .Oc
1704 (which produce an opening and a closing option bracket respectively) may be used
1705 across one or more lines or to specify the exact position of the closing
1706 parenthesis.
1708 .Dl Usage: .Op Oo Ao option Ac Oc ...
1710 .Bl -tag -xwidth ".Li .Op\ Fl\ c\ Ar\ objfil\ Op\ Ar\ corfil\ ," -compact -offset 15n
1711 .It Li .Op
1713 .It Li ".Op Fl k"
1714 .Op Fl k
1715 .It Li ".Op Fl k ) ."
1716 .Op Fl k ) .
1717 .It Li ".Op Fl k Ar kookfile"
1718 .Op Fl k Ar kookfile
1719 .It Li ".Op Fl k Ar kookfile ,"
1720 .Op Fl k Ar kookfile ,
1721 .It Li ".Op Ar objfil Op Ar corfil"
1722 .Op Ar objfil Op Ar corfil
1723 .It Li ".Op Fl c Ar objfil Op Ar corfil ,"
1724 .Op Fl c Ar objfil Op Ar corfil ,
1725 .It Li ".Op word1 word2"
1726 .Op word1 word2
1727 .It Li ".Li .Op Oo Ao option Ac Oc ..."
1728 .Li .Op Oo Ao options Ac Oc ...
1731 Here a typical example of the
1732 .Ql .Oo
1734 .Ql .Oc
1735 macros:
1737 .Bd -literal -offset indent
1738 \&.Oo
1739 \&.Op Fl k Ar kilobytes
1740 \&.Op Fl i Ar interval
1741 \&.Op Fl c Ar count
1742 \&.Oc
1746 Produces:
1748 .Bd -filled -offset indent
1750 .Op Fl k Ar kilobytes
1751 .Op Fl i Ar interval
1752 .Op Fl c Ar count
1757 The default width values of
1758 .Ql .Op
1760 .Ql .Oo
1761 are 14n and 10n, respectively.
1763 .Ss Pathnames
1766 .Ql .Pa
1767 macro formats path or file names.
1768 If called without arguments, the
1769 .Sq Pa
1770 string is output, which represents the current user's home directory.
1772 .Dl Usage: .Pa Oo Ao pathname Ac Oc ...
1774 .Bl -tag -xwidth ".Li .Pa\ /tmp/fooXXXXX\ )\ ." -compact -offset 15n
1775 .It Li .Pa
1777 .It Li ".Pa /usr/share"
1778 .Pa /usr/share
1779 .It Li ".Pa /tmp/fooXXXXX ) ."
1780 .Pa /tmp/fooXXXXX ) .
1784 The default width is 32n.
1786 .Ss Standards
1789 .Ql .St
1790 macro replaces standard abbreviations with their formal names.
1792 .Dl Usage: .St Ao abbreviation Ac ...
1794 Available pairs for
1795 .Dq Abbreviation/Formal Name
1796 are:
1799 .Tn ANSI/ISO C
1801 .Bl -tag -xwidth ".Li -iso9945-1-90" -compact -offset indent
1802 .It Li -ansiC
1803 .St -ansiC
1804 .It Li -ansiC-89
1805 .St -ansiC-89
1806 .It Li -isoC
1807 .St -isoC
1808 .It Li -isoC-99
1809 .St -isoC-99
1813 .Tn POSIX
1814 Part 1: System API
1816 .Bl -tag -xwidth ".Li -p1003.1g-2000" -compact -offset indent
1817 .It Li -iso9945-1-90
1818 .St -iso9945-1-90
1819 .It Li -iso9945-1-96
1820 .St -iso9945-1-96
1821 .It Li -p1003.1
1822 .St -p1003.1
1823 .It Li -p1003.1-88
1824 .St -p1003.1-88
1825 .It Li -p1003.1-90
1826 .St -p1003.1-90
1827 .It Li -p1003.1-96
1828 .St -p1003.1-96
1829 .It Li -p1003.1b-93
1830 .St -p1003.1b-93
1831 .It Li -p1003.1c-95
1832 .St -p1003.1c-95
1833 .It Li -p1003.1g-2000
1834 .St -p1003.1g-2000
1835 .It Li -p1003.1i-95
1836 .St -p1003.1i-95
1840 .Tn POSIX
1841 Part 2: Shell and Utilities
1843 .Bl -tag -xwidth ".Li -p1003.1g-2000" -compact -offset indent
1844 .It Li -iso9945-2-93
1845 .St -iso9945-2-93
1846 .It Li -p1003.2
1847 .St -p1003.2
1848 .It Li -p1003.2-92
1849 .St -p1003.2-92
1850 .It Li -p1003.2a-92
1851 .St -p1003.2a-92
1855 X/Open
1856 .Bl -tag -xwidth ".Li -p1003.1g-2000" -compact -offset indent
1858 .It Li -susv2
1859 .St -susv2
1860 .It Li -svid4
1861 .St -svid4
1862 .It Li -xbd5
1863 .St -xbd5
1864 .It Li -xcu5
1865 .St -xcu5
1866 .It Li -xcurses4.2
1867 .St -xcurses4.2
1868 .It Li -xns5
1869 .St -xns5
1870 .It Li -xns5.2
1871 .St -xns5.2
1872 .It Li -xpg3
1873 .St -xpg3
1874 .It Li -xpg4
1875 .St -xpg4
1876 .It Li -xpg4.2
1877 .St -xpg4.2
1878 .It Li -xsh5
1879 .St -xsh5
1883 Miscellaneous
1885 .Bl -tag -xwidth ".Li -p1003.1g-2000" -compact -offset indent
1886 .It Li -ieee754
1887 .St -ieee754
1888 .It Li -iso8802-3
1889 .St -iso8802-3
1892 .Ss "Variable Types"
1895 .Ql .Vt
1896 macro may be used whenever a type is referenced.
1897 In the
1898 .Sx SYNOPSIS
1899 section, it causes a line break (useful for old style variable declarations).
1901 .Dl Usage: .Vt Ao type Ac ...
1903 .Bl -tag -xwidth ".Li .Vt\ extern\ char\ *optarg\ ;" -compact -offset 15n
1904 .It Li ".Vt extern char *optarg ;"
1905 .Vt extern char *optarg ;
1906 .It Li ".Vt FILE *"
1907 .Vt FILE *
1910 .Ss Variables
1912 Generic variable reference.
1914 .Dl Usage: .Va Ao variable Ac ...
1916 .Bl -tag -xwidth ".Li .Va\ Xchar\ sX\ ]\ )\ )\ ," -compact -offset 15n
1917 .It Li ".Va count"
1918 .Va count
1919 .It Li ".Va settimer ,"
1920 .Va settimer ,
1921 .It Li ".Va \*[q]int *prt\*[q] ) :"
1922 .Va "int *prt" ) :
1923 .It Li ".Va \*[q]char s\*[q] ] ) ) ,"
1924 .Va "char s" ] ) ) ,
1928 The default width is 12n.
1930 .Ss "Manual Page Cross References"
1933 .Ql .Xr
1934 macro expects the first argument to be a manual page name.
1935 The optional second argument, if a string (defining the manual section), is
1936 put into parentheses.
1938 .Dl Usage: .Xr Ao man page name Ac Oo Ao section Ac Oc ...
1940 .Bl -tag -xwidth ".Li .Xr\ xinit\ 1x\ ;" -compact -offset 15n
1941 .It Li ".Xr mdoc"
1942 .Xr mdoc
1943 .It Li ".Xr mdoc ,"
1944 .Xr mdoc ,
1945 .It Li ".Xr mdoc 7"
1946 .Xr mdoc 7
1947 .It Li ".Xr xinit 1x ;"
1948 .Xr xinit 1x ;
1952 The default width is 10n.
1955 .Sh "GENERAL TEXT DOMAIN"
1957 .Ss "AT&T Macro"
1960 .Dl Usage: .At Oo Ao version Ac Oc ...
1962 .Bl -tag -xwidth ".Li .At\ v6\ ." -compact -offset 15n
1963 .It Li .At
1965 .It Li ".At v6 ."
1966 .At v6 .
1969 The following values for
1970 .Ao version Ac
1971 are possible:
1973 .Dl 32v, v1, v2, v3, v4, v5, v6, v7, V, V.1, V.2, V.3, V.4
1975 .Ss "BSD Macro"
1978 .Dl "Usage: .Bx" Bro -alpha | -beta | -devel Brc ...
1979 .Dl "       .Bx" Oo Ao version Ac Oo Ao release Ac Oc Oc ...
1981 .Bl -tag -xwidth ".Li .Bx\ -devel" -compact -offset 15n
1982 .It Li .Bx
1984 .It Li ".Bx 4.3 ."
1985 .Bx 4.3 .
1986 .It Li ".Bx \-devel"
1987 .Bx -devel
1990 .Ao version Ac
1991 will be prepended to the string
1992 .Sq Bx .
1993 The following values for
1994 .Ao release Ac
1995 are possible:
1997 .Dl Reno, reno, Tahoe, tahoe, Lite, lite, Lite2, lite2
1999 .Ss "NetBSD Macro"
2002 .Dl Usage: .Nx Oo Ao version Ac Oc ...
2004 .Bl -tag -xwidth ".Li .Nx\ 1.4\ ." -compact -offset 15n
2005 .It Li .Nx
2007 .It Li ".Nx 1.4 ."
2008 .Nx 1.4 .
2011 For possible values of
2012 .Ao version Ac
2013 see the description of the
2014 .Ql .Os
2015 request above in section
2016 .Sx "TITLE MACROS" .
2018 .Ss "FreeBSD Macro"
2021 .Dl Usage: .Fx Oo Ao version Ac Oc ...
2023 .Bl -tag -xwidth ".Li .Fx\ 2.2\ ." -compact -offset 15n
2024 .It Li .Fx
2026 .It Li ".Fx 2.2 ."
2027 .Fx 2.2 .
2030 For possible values of
2031 .Ao version Ac
2032 see the description of the
2033 .Ql .Os
2034 request above in section
2035 .Sx "TITLE MACROS" .
2037 .Ss "OpenBSD Macro"
2040 .Dl Usage: .Ox Oo Ao version Ac Oc ...
2042 .Bl -tag -xwidth ".Li .Ox\ 1.0" -compact -offset 15n
2043 .It Li ".Ox 1.0"
2044 .Ox 1.0
2047 .Ss "BSD/OS Macro"
2050 .Dl Usage: .Bsx Oo Ao version Ac Oc ...
2052 .Bl -tag -xwidth ".Li .Bsx\ 1.0" -compact -offset 15n
2053 .It Li ".Bsx 1.0"
2054 .Bsx 1.0
2057 .Ss "UNIX Macro"
2060 .Dl Usage: .Ux ...
2062 .Bl -tag -xwidth ".Li .Ux" -compact -offset 15n
2063 .It Li .Ux
2067 .Ss "Emphasis Macro"
2069 Text may be stressed or emphasized with the
2070 .Ql .Em
2071 macro.
2072 The usual font for emphasis is italic.
2074 .Dl Usage: .Em Ao argument Ac ...
2076 .Bl -tag -xwidth ".Li .Em\ vide\ infra\ )\ )\ ," -compact -offset 15n
2077 .It Li ".Em does not"
2078 .Em does not
2079 .It Li ".Em exceed 1024 ."
2080 .Em exceed 1024 .
2081 .It Li ".Em vide infra ) ) ,"
2082 .Em vide infra ) ) ,
2086 The default width is 10n.
2088 .Ss "Font Mode"
2091 .Ql .Bf
2092 font mode must be ended with the
2093 .Ql .Ef
2094 macro (the latter takes no arguments).
2095 Font modes may be nested within other font modes.
2097 .Ql .Bf
2098 has the following syntax:
2100 .Dl .Bf Ao font mode Ac
2102 .Ao font mode Ac
2103 must be one of the following three types:
2105 .Bl -tag -xwidth ".Sy \&Sy | Fl symbolic" -compact -offset indent
2106 .It Sy \&Em | Fl emphasis
2107 Same as if the 
2108 .Ql .Em
2109 macro was used for the entire block of text.
2110 .It Sy \&Li | Fl literal
2111 Same as if the
2112 .Ql .Li
2113 macro was used for the entire block of text.
2114 .It Sy \&Sy | Fl symbolic
2115 Same as if the
2116 .Ql .Sy
2117 macro was used for the entire block of text.
2120 Both macros are neither callable nor parsed.
2122 .Ss "Enclosure and Quoting Macros"
2124 The concept of enclosure is similar to quoting.
2125 The object being to enclose one or more strings between a pair of characters
2126 like quotes or parentheses.
2127 The terms quoting and enclosure are used interchangeably throughout this
2128 document.
2129 Most of the one-line enclosure macros end in small letter
2130 .Ql q
2131 to give a hint of quoting, but there are a few irregularities.
2132 For each enclosure macro there is also a pair of open and close macros which
2133 end in small letters
2134 .Ql o
2136 .Ql c
2137 respectively.
2139 \# XXX
2140 .if t \
2141 .  ne 10
2143 .Bd -filled -offset 4n
2144 .Bl -column "quote" "close" "open" "Angle Bracket Enclosure" "`string' or string"
2145 .Em Quote Ta Em Open Ta Em Close Ta Em Function               Ta Em Result
2146 .No .Aq   Ta    .Ao  Ta    .Ac   Ta "Angle Bracket Enclosure" Ta Ao string Ac
2147 .No .Bq   Ta    .Bo  Ta    .Bc   Ta "Bracket Enclosure"       Ta Bo string Bc
2148 .No .Brq  Ta    .Bro Ta    .Brc  Ta "Brace Enclosure"         Ta Bro string Brc
2149 .No .Dq   Ta    .Do  Ta    .Dc   Ta "Double Quote"            Ta Do string Dc
2150 .No .Eq   Ta    .Eo  Ta    .Ec   Ta "Enclose String (in XX)"  Ta XXstringXX
2151 .No .Pq   Ta    .Po  Ta    .Pc   Ta "Parenthesis Enclosure"   Ta Po string Pc
2152 .No .Ql   Ta         Ta          Ta "Quoted Literal"          Ta So string Sc or Li string
2153 .No .Qq   Ta    .Qo  Ta    .Qc   Ta "Straight Double Quote"   Ta Qo string Qc
2154 .No .Sq   Ta    .So  Ta    .Sc   Ta "Single Quote"            Ta So string Sc
2158 All macros ending with
2159 .Sq q
2161 .Sq o
2162 have a default width value of 12n.
2164 .Bl -tag -xwidth ".Li .Ec , .Eo"
2165 .It Li .Eo , .Ec
2166 These macros expect the first argument to be the opening and closing strings
2167 respectively.
2168 .It Li .Es , .En
2169 Due to the nine-argument limit in the original troff program two other
2170 macros have been implemented which are now rather obsolete:
2171 .Ql .Es
2172 takes the first and second parameter as the left and right enclosure string,
2173 which are then used to enclose the arguments of
2174 .Ql .En .
2175 The default width value is 12n for both macros.
2176 .It Li .Eq
2177 The first and second arguments of this macro are the opening and
2178 closing strings respectively, followed by the arguments to be enclosed.
2179 .It Li .Ql
2180 The quoted literal macro behaves differently in troff and nroff mode.
2181 If formatted with
2182 .Xr nroff ,
2183 a quoted literal is always quoted.
2184 If formatted with troff, an item is only quoted if the width of the item is
2185 less than three constant width characters.
2186 This is to make short strings more visible where the font change to literal
2187 (constant width) is less noticeable.
2189 The default width is 16n.
2190 .It Li .Pf
2191 The prefix macro suppresses the whitespace between its first and second
2192 argument:
2194 .Bl -tag -xwidth ".Li .Pf\ (\ Fa\ name2" -offset indent
2195 .It Li ".Pf ( Fa name2"
2196 .Pf ( Fa name2
2200 The default width is 12n.
2203 .Ql .Ns
2204 macro (see below) performs the analogous suffix function.
2205 .It Li .Ap
2207 .Ql .Ap
2208 macro inserts an apostrophe and exits any special text modes, continuing in
2209 .Ql .No
2210 mode.
2214 Examples of quoting:
2217 .Bl -tag -xwidth ".Li .Bq\ Em\ Greek\ ,\ French\ ." -compact -offset indent
2218 .It Li .Aq
2220 .It Li ".Aq Pa ctype.h ) ,"
2221 .Aq Pa ctype.h ) ,
2222 .It Li .Bq
2224 .It Li ".Bq Em Greek , French ."
2225 .Bq Em Greek , French .
2226 .It Li .Dq
2228 .It Li ".Dq string abc ."
2229 .Dq string abc .
2230 .It Li ".Dq \'^[A-Z]\'"
2231 .Dq \'^[A-Z]\'
2232 .It Li ".Ql man mdoc"
2233 .Ql man mdoc
2234 .It Li .Qq
2236 .It Li ".Qq string ) ,"
2237 .Qq string ) ,
2238 .It Li ".Qq string Ns ),"
2239 .Qq string Ns ),
2240 .It Li .Sq
2242 .It Li ".Sq string"
2243 .Sq string
2244 .It Li ".Em or Ap ing"
2245 .Em or Ap ing
2249 For a good example of nested enclosure macros, see the
2250 .Ql .Op
2251 option macro.
2252 It was created from the same underlying enclosure macros as those presented
2253 in the list above.
2255 .Ql .Xo
2257 .Ql .Xc
2258 extended argument list macros are discussed below.
2260 .Ss "No-Op or Normal Text Macro"
2263 .Ql .No
2264 macro can be used in a macro command line for parameters which should
2265 .Em not
2266 be formatted.
2267 Be careful to add
2268 .Ql \e&
2269 to the word
2270 .Ql \&No
2271 if you really want that English word (and not the macro) as a parameter.
2273 .Dl Usage: .No Ao argument Ac ...
2275 .Bl -tag -xwidth ".Li .No\ test\ Ta\ with\ Ta\ tabs" -compact -offset 15n
2276 .It Li ".No test Ta with Ta tabs"
2277 .No test Ta with Ta tabs
2281 The default width is 12n.
2283 .Ss "No-Space Macro"
2286 .Ql .Ns
2287 macro suppresses insertion of a space between the current position and its
2288 first parameter.
2289 For example, it is useful for old style argument lists where there is no
2290 space between the flag and argument:
2292 .Dl "Usage:" ... Ao argument Ac \&Ns Oo Ao argument Ac Oc ...
2293 .Dl "      " .Ns Ao argument Ac ...
2295 .Bl -tag -xwidth ".Li .Op\ Fl\ I\ Ns\ Ar\ directory" -compact -offset 15n
2296 .It Li ".Op Fl I Ns Ar directory"
2297 .Op Fl I Ns Ar directory
2300 Note: The
2301 .Ql .Ns
2302 macro always invokes the
2303 .Ql .No
2304 macro after eliminating the space unless another macro name follows it.
2305 If used as a request (i.e., the second form above in the
2306 .Sq Usage
2307 line,
2308 .Ql .Ns
2309 is identical to
2310 .Ql .No .
2312 .Ss "Section Cross References"
2315 .Ql .Sx
2316 macro designates a reference to a section header within the same document.
2318 .Dl Usage: .Sx Ao section reference Ac ...
2320 .Bl -tag -xwidth ".Li .Sx\ FILES" -offset 15n
2321 .It Li ".Sx FILES"
2322 .Sx FILES
2326 The default width is 16n.
2328 .Ss Symbolics
2330 The symbolic emphasis macro is generally a boldface macro in either the
2331 symbolic sense or the traditional English usage.
2333 .Dl Usage: .Sy Ao symbol Ac ...
2335 .Bl -tag -xwidth ".Li .Sy\ Important\ Notice" -compact -offset 15n
2336 .It Li ".Sy Important Notice"
2337 .Sy Important Notice
2341 The default width is 6n.
2343 .Ss Mathematical Symbols
2345 Use this macro for mathematical symbols and similar things.
2347 .Dl Usage: .Ms Ao math symbol Ac ...
2349 .Bl -tag -xwidth ".Li .Ms\ sigma" -compact -offset 15n
2350 .It Li ".Ms sigma"
2351 .Ms sigma
2355 The default width is 6n.
2357 .Ss "References and Citations"
2359 The following macros make a modest attempt to handle references.
2360 At best, the macros make it convenient to manually drop in a subset of
2361 .Xr refer 1
2362 style references.
2364 .Bl -tag -width 6n -offset indent -compact
2365 .It Li .Rs
2366 Reference start (does not take arguments).
2367 Causes a line break in the
2368 .Sx "SEE ALSO"
2369 section and begins collection of reference information until the reference
2370 end macro is read.
2371 .It Li .Re
2372 Reference end (does not take arguments).
2373 The reference is printed.
2374 .It Li .%A
2375 Reference author name; one name per invocation.
2376 .It Li .%B
2377 Book title.
2378 .It Li .%C
2379 City/place (not implemented yet).
2380 .It Li .%D
2381 Date.
2382 .It Li .%I
2383 Issuer/publisher name.
2384 .It Li .%J
2385 Journal name.
2386 .It Li .%N
2387 Issue number.
2388 .It Li .%O
2389 Optional information.
2390 .It Li .%P
2391 Page number.
2392 .It Li .%Q
2393 Corporate or foreign author.
2394 .It Li .%R
2395 Report name.
2396 .It Li .%T
2397 Title of article.
2398 .It Li .%V
2399 Volume.
2402 Macros beginning with
2403 .Ql %
2404 are not callable but accept multiple arguments in the usual way.
2405 Only the
2406 .Ql .Tn
2407 macro is handled properly as a parameter; other macros will cause strange
2408 output.
2409 .Ql .%B
2411 .Ql .%T
2412 can be used outside of the
2413 .Ql .Rs/.Re
2414 environment.
2416 Example:
2418 .Bd -literal -offset indent
2419 \&.Rs
2420 \&.%A "Matthew Bar"
2421 \&.%A "John Foo"
2422 \&.%T "Implementation Notes on foobar(1)"
2423 \&.%R "Technical Report ABC-DE-12-345"
2424 \&.%Q "Drofnats College, Nowhere"
2425 \&.%D "April 1991"
2426 \&.Re
2429 produces
2431 .Bd -ragged -offset indent
2433 .%A "Matthew Bar"
2434 .%A "John Foo"
2435 .%T "Implementation Notes on foobar(1)"
2436 .%R "Technical Report ABC-DE-12-345"
2437 .%Q "Drofnats College, Nowhere"
2438 .%D "April 1991"
2442 .Ss "Trade Names (or Acronyms and Type Names)"
2444 The trade name macro prints its arguments in a smaller font.
2445 Its intended use is to imitate a small caps fonts for uppercase acronyms.
2447 .Dl Usage: .Tn Ao symbol Ac ...
2449 .Bl -tag -xwidth ".Li .Tn\ ASCII" -compact -offset 15n
2450 .It Li ".Tn DEC"
2451 .Tn DEC
2452 .It Li ".Tn ASCII"
2453 .Tn ASCII
2457 The default width is 10n.
2459 .Ss "Extended Arguments"
2462 .Li .Xo
2464 .Li .Xc
2465 macros allow one to extend an argument list on a macro boundary for the
2466 .Ql .It
2467 macro (see below).
2468 Note that
2469 .Li .Xo
2471 .Li .Xc
2472 are implemented similarly to all other macros opening and closing an
2473 enclosure (without inserting characters, of course).
2474 This means that the following is true for those macros also.
2476 Here is an example of
2477 .Ql .Xo
2478 using the space mode macro to turn spacing off:
2480 .Bd -literal -offset indent
2481 \&.Sm off
2482 \&.It Xo Sy I Ar operation
2483 \&.No \een Ar count No \een
2484 \&.Xc
2485 \&.Sm on
2489 produces
2491 .Bd -filled -offset indent
2492 .Bl -tag -compact
2493 .Sm off
2494 .It Xo Sy I Ar operation
2495 .No \en Ar count No \en
2497 .Sm on
2502 Another one:
2504 .Bd -literal -offset indent
2505 \&.Sm off
2506 \&.It Cm S No / Ar old_pattern Xo
2507 \&.No / Ar new_pattern
2508 \&.No / Op Cm g
2509 \&.Xc
2510 \&.Sm on
2514 produces
2516 .Bd -filled -offset indent
2517 .Bl -tag -compact
2518 .Sm off
2519 .It Cm S No \&/ Ar old_pattern Xo
2520 .No \&/ Ar new_pattern
2521 .No \&/ Op Cm g
2523 .Sm on
2528 Another example of
2529 .Ql .Xo
2530 and enclosure macros: Test the value of a variable.
2532 .Bd -literal -offset indent
2533 \&.It Xo
2534 \&.Ic .ifndef
2535 \&.Oo \e&! Oc Ns Ar variable Oo
2536 \&.Ar operator variable ...
2537 \&.Oc Xc
2541 produces
2543 .Bd -filled -offset indent
2544 .Bl -tag -width flag -compact
2545 .It Xo
2546 .Ic .ifndef
2547 .Oo \&! Oc Ns Ar variable Oo
2548 .Ar operator variable ...
2549 .Oc Xc
2555 .Sh "PAGE STRUCTURE DOMAIN"
2557 .Ss "Section Headers"
2559 The following
2560 .Ql .Sh
2561 section header macros are required in every man page.
2562 The remaining section headers are recommended at the discretion of the
2563 author writing the manual page.
2565 .Ql .Sh
2566 macro is parsed but not generally callable.
2567 It can be used as an argument in a call to
2568 .Ql .Sh
2569 only; it then reactivates the default font for
2570 .Ql .Sh .
2572 The default width is 8n.
2574 .Bl -tag -xwidth ".Li .Sh\ RETURN\ VALUES"
2575 .It Li ".Sh NAME"
2577 .Ql ".Sh NAME"
2578 macro is mandatory.
2579 If not specified, headers, footers and page layout defaults will not be set
2580 and things will be rather unpleasant.
2582 .Sx NAME
2583 section consists of at least three items.
2584 The first is the
2585 .Ql .Nm
2586 name macro naming the subject of the man page.
2587 The second is the name description macro,
2588 .Ql .Nd ,
2589 which separates the subject name from the third item, which is the
2590 description.
2591 The description should be the most terse and lucid possible, as the space
2592 available is small.
2594 .Ql .Nd
2595 first prints
2596 .Ql - ,
2597 then all its arguments.
2599 .It Li ".Sh LIBRARY"
2600 This section is for section two and three function calls.
2601 It should consist of a single
2602 .Ql .Lb
2603 macro call;
2605 .Sx "Library Names" .
2607 .It Li ".Sh SYNOPSIS"
2609 .Sx SYNOPSIS
2610 section describes the typical usage of the subject of a man page.
2611 The macros required are either
2612 .Ql .Nm ,
2613 .Ql .Cd ,
2615 .Ql .Fn
2616 (and possibly
2617 .Ql .Fo ,
2618 .Ql .Fc ,
2619 .Ql .Fd ,
2621 .Ql .Ft ) .
2622 The function name macro
2623 .Ql .Fn
2624 is required for manual page sections\~2 and\~3; the command and general name
2625 macro
2626 .Ql .Nm
2627 is required for sections 1, 5, 6, 7, and\~8.
2628 Section\~4 manuals require a
2629 .Ql .Nm ,
2630 .Ql .Fd
2631 or a
2632 .Ql .Cd
2633 configuration device usage macro.
2634 Several other macros may be necessary to produce the synopsis line as shown
2635 below:
2637 .Bd -filled -offset indent
2638 .Nm cat
2639 .Op Fl benstuv
2640 .Op Fl
2645 The following macros were used:
2647 .Dl ".Nm cat"
2648 .Dl ".Op Fl benstuv"
2649 .Dl ".Op Fl"
2650 .Dl .Ar
2652 .It Li ".Sh DESCRIPTION"
2653 In most cases the first text in the
2654 .Sx DESCRIPTION
2655 section is a brief paragraph on the command, function or file, followed by a
2656 lexical list of options and respective explanations.
2657 To create such a list, the
2658 .Ql .Bl
2659 (begin list),
2660 .Ql .It
2661 (list item) and
2662 .Ql .El
2663 (end list)
2664 macros are used (see
2665 .Sx Lists and Columns
2666 below).
2668 .It Li ".Sh IMPLEMENTATION NOTES"
2669 Implementation specific information should be placed here.
2671 .It Li ".Sh RETURN VALUES"
2672 Sections 2, 3 and\~9 function return values should go here.
2674 .Ql .Rv
2675 macro may be used to generate text for use in the
2676 .Sx RETURN VALUES
2677 section for most section 2 and 3 library functions;
2679 .Sx "Return Values" .
2683 The following
2684 .Ql .Sh
2685 section headers are part of the preferred manual page layout and must be
2686 used appropriately to maintain consistency.
2687 They are listed in the order in which they would be used.
2689 .Bl -tag -xwidth ".Li .Sh\ COMPATIBILITY"
2690 .It Li ".Sh ENVIRONMENT"
2692 .Sx ENVIRONMENT
2693 section should reveal any related environment variables and clues to their
2694 behavior and/or usage.
2696 .It Li ".Sh FILES"
2697 Files which are used or created by the man page subject should be listed via
2699 .Ql .Pa
2700 macro in the
2701 .Sx FILES
2702 section.
2704 .It Li ".Sh EXAMPLES"
2705 There are several ways to create examples.
2706 See the
2707 .Sx EXAMPLES
2708 section below for details.
2710 .It Li ".Sh DIAGNOSTICS"
2711 Diagnostic messages from a command should be placed in this section.
2713 .It Li ".Sh COMPATIBILITY"
2714 Known compatibility issues (e.g. deprecated options or parameters)
2715 should be listed here.
2717 .It Li ".Sh ERRORS"
2718 Specific error handling, especially from library functions (man page
2719 sections 2, 3, and\~9) should go here.
2721 .Ql .Er
2722 macro is used to specify an error (errno).
2724 .It Li ".Sh SEE ALSO"
2725 References to other material on the man page topic and cross references to
2726 other relevant man pages should be placed in the
2727 .Sx "SEE ALSO"
2728 section.
2729 Cross references are specified using the
2730 .Ql .Xr
2731 macro.
2732 Currently
2733 .Xr refer 1
2734 style references are not accommodated.
2736 It is recommended that the cross references are sorted on the section
2737 number, then alphabetically on the names within a section, and placed
2738 in that order and comma separated.
2739 Example:
2741 .Xr ls 1 ,
2742 .Xr ps 1 ,
2743 .Xr group 5 ,
2744 .Xr passwd 5
2746 .It Li ".Sh STANDARDS"
2747 If the command, library function or file adheres to a specific
2748 implementation such as
2749 .St -p1003.2
2751 .St -ansiC
2752 this should be noted here.
2753 If the command does not adhere to any standard, its history should be noted
2754 in the
2755 .Sx HISTORY
2756 section.
2758 .It Li ".Sh HISTORY"
2759 Any command which does not adhere to any specific standards should be
2760 outlined historically in this section.
2762 .It Li ".Sh AUTHORS"
2763 Credits should be placed here.
2765 .Ql .An
2766 macro should be used to specify the name(s) of the person(s).
2768 .It Li ".Sh BUGS"
2769 Blatant problems with the topic go here.
2773 User-specified
2774 .Ql .Sh
2775 sections may be added; for example, this section was set with:
2777 .Bd -literal -offset 15n
2778 \&.Sh "PAGE STRUCTURE DOMAIN"
2781 .Ss "Subsection Headers"
2783 Subsection headers have exactly the same syntax as section headers:
2784 .Ql .Ss
2785 is parsed but not generally callable.
2786 It can be used as an argument in a call to
2787 .Ql .Ss
2788 only; it then reactivates the default font for
2789 .Ql .Ss .
2791 The default width is 8n.
2793 .Ss "Paragraphs and Line Spacing"
2795 .Bl -tag -xwidth ".Li .Pp"
2796 .It Li .Pp
2797 The 
2798 .Ql .Pp
2799 paragraph command may be used to specify a line space where necessary.
2800 The macro is not necessary after a
2801 .Ql .Sh
2803 .Ql .Ss
2804 macro or before a
2805 .Ql .Bl
2807 .Ql .Bd
2808 macro (which both assert a vertical distance unless the
2809 .Fl compact
2810 flag is given).
2812 The macro is neither callable nor parsed and takes no arguments; an
2813 alternative name is
2814 .Ql .Lp .
2817 .\" XXX
2819 .\" This worked with version one, need to redo for version three
2820 .\" .Pp
2821 .\" .Ds I
2822 .\" .Cw (ax+bx+c) \ is\ produced\ by\ \&
2823 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2824 .\" .Cl Cx \t\t
2825 .\" .Li \&.Cx\ (
2826 .\" .Cx
2827 .\" .Cl Cx \t\t
2828 .\" .Li \&.Va ax
2829 .\" .Cx
2830 .\" .Cl Cx \t\t
2831 .\" .Li \&.Sy \+
2832 .\" .Cx
2833 .\" .Cl Cx \&(\&
2834 .\" .Va ax
2835 .\" .Cx +
2836 .\" .Va by
2837 .\" .Cx +
2838 .\" .Va c )
2839 .\" .Cx \t
2840 .\" .Em is produced by
2841 .\" .Cx \t
2842 .\" .Li \&.Va by
2843 .\" .Cx
2844 .\" .Cl Cx \t\t
2845 .\" .Li \&.Sy \+
2846 .\" .Cx
2847 .\" .Cl Cx \t\t
2848 .\" .Li \&.Va c )
2849 .\" .Cx
2850 .\" .Cl Cx \t\t
2851 .\" .Li \&.Cx
2852 .\" .Cx
2853 .\" .Cw
2854 .\" .De
2855 .\" .Pp
2856 .\" This example shows the same equation in a different format.
2857 .\" The spaces
2858 .\" around the
2859 .\" .Li \&+
2860 .\" signs were forced with
2861 .\" .Li \e :
2862 .\" .Pp
2863 .\" .Ds I
2864 .\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&
2865 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2866 .\" .Cl Cx \t\t
2867 .\" .Li \&.Cx\ (
2868 .\" .Cx
2869 .\" .Cl Cx \t\t
2870 .\" .Li \&.Va a
2871 .\" .Cx
2872 .\" .Cl Cx \t\t
2873 .\" .Li \&.Sy x
2874 .\" .Cx
2875 .\" .Cl Cx \t\t
2876 .\" .Li \&.Cx \e\ +\e\ \e&
2877 .\" .Cx
2878 .\" .Cl Cx \&(\&
2879 .\" .Va a
2880 .\" .Sy x
2881 .\" .Cx \ +\ \&
2882 .\" .Va b
2883 .\" .Sy y
2884 .\" .Cx \ +\ \&
2885 .\" .Va c )
2886 .\" .Cx \t
2887 .\" .Em is produced by
2888 .\" .Cl Cx \t\t
2889 .\" .Li \&.Va b
2890 .\" .Cx
2891 .\" .Cl Cx \t\t
2892 .\" .Li \&.Sy y
2893 .\" .Cx
2894 .\" .Cl Cx \t\t
2895 .\" .Li \&.Cx \e\ +\e\ \e&
2896 .\" .Cx
2897 .\" .Cl Cx \t\t
2898 .\" .Li \&.Va c )
2899 .\" .Cx
2900 .\" .Cl Cx \t\t
2901 .\" .Li \&.Cx
2902 .\" .Cx
2903 .\" .Cw
2904 .\" .De
2905 .\" .Pp
2906 .\" The incantation below was
2907 .\" lifted from the
2908 .\" .Xr adb 1
2909 .\" manual page:
2910 .\" .Pp
2911 .\" .Ds I
2912 .\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by
2913 .\" .Cl Cx \t\t
2914 .\" .Li \&.Cx Op Sy ?/
2915 .\" .Cx
2916 .\" .Cl Cx \t\t
2917 .\" .Li \&.Nm m
2918 .\" .Cx
2919 .\" .Cl Cx Op Sy ?/
2920 .\" .Nm m
2921 .\" .Ad \ b1 e1 f1
2922 .\" .Op Sy ?/
2923 .\" .Cx \t
2924 .\" .Em is produced by
2925 .\" .Cx \t
2926 .\" .Li \&.Ar \e\ b1 e1 f1
2927 .\" .Cx
2928 .\" .Cl Cx \t\t
2929 .\" .Li \&.Op Sy ?/
2930 .\" .Cx
2931 .\" .Cl Cx \t\t
2932 .\" .Li \&.Cx
2933 .\" .Cx
2934 .\" .Cw
2935 .\" .De
2936 .\" .Pp
2938 .Ss Keeps
2940 The only keep that is implemented at this time is for words.
2941 The macros are
2942 .Ql .Bk
2943 (begin keep)
2945 .Ql .Ek
2946 (end keep).
2947 The only option that
2948 .Ql .Bk
2949 accepts currently is
2950 .Fl words
2951 (this is also the default if no option is given) which is useful for
2952 preventing line breaks in the middle of options.
2953 In the example for the make command line arguments (see
2954 .Sx What's in a Name ) ,
2955 the keep prevented
2956 .Xr nroff
2957 from placing up the flag and the argument on separate lines.
2959 Both macros are neither callable nor parsed.
2961 More work needs to be done with the keep macros; specifically, a
2962 .Fl line
2963 option should be added.
2965 .Ss "Examples and Displays"
2967 There are seven types of displays.
2969 .Bl -tag -xwidth ".Li .D1"
2970 .It Li .D1
2971 (This is D-one.)
2972 Display one line of indented text.
2973 This macro is parsed but not callable.
2975 .D1 Fl ldghfstru
2977 The above was produced by:
2978 .Li ".D1 Fl ldghfstru" .
2980 .It Li .Dl
2981 (This is D-ell.)
2982 Display one line of indented
2983 .Em literal
2984 text.
2986 .Ql .Dl
2987 example macro has been used throughout this file.
2988 It allows the indentation (display) of one line of text.
2989 Its default font is set to constant width (literal).
2990 .Ql .Dl
2991 is parsed but not callable.
2993 .Dl % ls -ldg /usr/local/bin
2995 The above was produced by:
2996 .Li ".Dl % ls -ldg /usr/local/bin" .
2998 .It Li .Bd
2999 Begin display.
3001 .Ql .Bd
3002 display must be ended with the
3003 .Ql .Ed
3004 macro.
3005 It has the following syntax:
3007 .Bl -tag -xwidth ".Li .Bd" -offset indent
3008 .It Li .Bd Xo
3009 .Bro \-literal | \-filled | \-unfilled | \-ragged | \-centered Brc
3010 .Oo \-offset Ao string Ac Oc Oo \-file Ao file name Ac Oc Oo \-compact Oc Xc
3014 .Bl -tag -xwidth ".Fl file Ao Ar file name Ac " -compact
3015 .It Fl ragged
3016 Fill, but do not adjust the right margin (only left-justify).
3017 .It Fl centered
3018 Center lines between the current left and right margin.
3019 Note that each single line is centered.
3020 .It Fl unfilled
3021 Do not fill; display a block of text as typed, using line breaks as
3022 specified by the user.
3023 This can produce overlong lines without warning messages.
3024 .It Fl filled
3025 Display a filled block.
3026 The block of text is formatted (i.e., the text is justified on both the left
3027 and right side).
3028 .It Fl literal
3029 Display block with literal font (usually fixed-width).
3030 Useful for source code or simple tabbed or spaced text.
3031 .It Fl file Ao Ar file name Ac
3032 The file whose name follows the
3033 .Fl file
3034 flag is read and displayed before any data enclosed with
3035 .Ql .Bd
3037 .Ql .Ed ,
3038 using the selected display type.
3040 .Xr troff/ Ns Nm \-mdoc
3041 commands in the file will be processed.
3042 .It Fl offset Ao Ar string Ac
3044 .Fl offset
3045 is specified with one of the following strings, the string is interpreted to
3046 indicate the level of indentation for the forthcoming block of text:
3049 .Bl -tag -xwidth ".Ar indent-two" -compact
3050 .It Ar left
3051 Align block on the current left margin; this is the default mode of
3052 .Ql .Bd .
3053 .It Ar center
3054 Supposedly center the block.
3055 At this time unfortunately, the block merely gets left aligned about an
3056 imaginary center margin.
3057 .It Ar indent
3058 Indent by one default indent value or tab.
3059 The default indent value is also used for the
3060 .Ql .D1
3061 and 
3062 .Ql .Dl
3063 macros, so one is guaranteed the two types of displays will line up.
3064 The indentation value is normally set to\~6n or about two thirds of an inch
3065 (six constant width characters).
3066 .It Ar indent-two
3067 Indent two times the default indent value.
3068 .It Ar right
3069 This
3070 .Em left
3071 aligns the block about two inches from the right side of the page.
3072 This macro needs work and perhaps may never do the right thing within
3073 .Xr troff .
3078 .Ao string Ac
3079 is a valid numeric expression instead
3080 .Pf ( Em with a scale indicator other than
3081 .Sq Em u ) ,
3082 use that value for indentation.
3083 The most useful scale indicators are
3084 .Sq m
3086 .Sq n ,
3087 specifying the so-called
3088 .Em \&Em
3090 .Em "En square" .
3091 This is approximately the width of the letter
3092 .Sq m
3093 resp.\& the letter
3094 .Sq n
3095 of the current font (for nroff output, both scale indicators give the same
3096 values).
3098 .Ao string Ac
3099 isn't a numeric expression, it is tested whether it is an
3100 .Nm \-mdoc
3101 macro name, and the default offset value associated with this macro is used.
3102 Finally, if all tests fail,
3103 the width of
3104 .Ao string Ac
3105 (typeset with a fixed-width font) is taken as the offset.
3106 .It Fl compact
3107 Suppress insertion of vertical space before begin of display.
3110 .It Li .Ed
3111 End display (takes no arguments).
3114 .Ss "Lists and Columns"
3116 There are several types of lists which may be initiated with the
3117 .Ql .Bl
3118 begin-list macro.
3119 Items within the list are specified with the
3120 .Ql .It
3121 item macro, and each list must end with the
3122 .Ql .El
3123 macro.
3124 Lists may be nested within themselves and within displays.
3125 The use of columns inside of lists or lists inside of columns is unproven.
3127 In addition, several list attributes may be specified such as the width of a
3128 tag, the list offset, and compactness (blank lines between items allowed or
3129 disallowed).
3130 Most of this document has been formatted with a tag style list
3131 .Pf ( Fl tag ) .
3133 It has the following syntax forms:
3136 .Bl -tag -xwidth ".Li .Bl" -offset indent -compact
3137 .It Li .Bl Xo
3138 .Bro \-hang | \-ohang | \-tag | \-diag | \-inset Brc
3139 .Oo \-width Ao string Ac Oc Oo \-xwidth Ao command Ac Oc
3140 .Oo \-offset Ao string Ac Oc Oo \-compact Oc Xc
3141 .It Li .Bl Xo
3142 .No \-column Oo \-offset Ao string Ac Oc
3143 .Ao string1 Ac Ao string2 Ac ... Xc
3144 .It Li .Bl Xo
3145 .Bro \-item | \-enum Oo \-nested Oc | \-bullet | \-hyphen | \-dash Brc
3146 .Oo \-offset Ao string Ac Oc Oo \-compact Oc Xc
3150 And now a detailed description of the list types.
3153 .Bl -tag -xwidth ".Fl column" -compact
3154 .It Fl bullet
3155 A bullet list.
3157 .Bd -literal -offset indent
3158 \&.Bl -bullet -offset indent -compact
3159 \&.It
3160 Bullet one goes here.
3161 \&.It
3162 Bullet two here.
3163 \&.El
3167 Produces:
3170 .Bl -bullet -offset indent -compact
3172 Bullet one goes here.
3174 Bullet two here.
3178 .It Fl dash No ( or Fl hyphen )
3179 A dash list.
3181 .Bd -literal -offset indent
3182 \&.Bl -dash -offset indent -compact
3183 \&.It
3184 Dash one goes here.
3185 \&.It
3186 Dash two here.
3187 \&.El
3191 Produces:
3194 .Bl -dash -offset indent -compact
3196 Dash one goes here.
3198 Dash two here.
3202 .It Fl enum
3203 An enumerated list.
3205 .Bd -literal -offset indent
3206 \&.Bl -enum -offset indent -compact
3207 \&.It
3208 Item one goes here.
3209 \&.It
3210 And item two here.
3211 \&.El
3215 The result:
3218 .Bl -enum -offset indent -compact
3220 Item one goes here.
3222 And item two here.
3226 If you want to nest enumerated lists, use the
3227 .Fl nested
3228 flag (starting with the second-level list):
3230 .Bd -literal -offset indent
3231 \&.Bl -enum -offset indent -compact
3232 \&.It
3233 Item one goes here
3234 \&.Bl -enum -nested -compact
3235 \&.It
3236 Item two goes here.
3237 \&.It
3238 And item three here.
3239 \&.El
3240 \&.It
3241 And item four here.
3242 \&.El
3246 Result:
3249 .Bl -enum -offset indent -compact
3251 Item one goes here.
3252 .Bl -enum -nested -compact
3254 Item two goes here.
3256 And item three here.
3259 And item four here.
3263 .It Fl item
3264 A list of type
3265 .Fl item
3266 without list markers.
3268 .Bd -literal -offset indent
3269 \&.Bl -item -offset indent
3270 \&.It
3271 Item one goes here.
3272 Item one goes here.
3273 Item one goes here.
3274 \&.It
3275 Item two here.
3276 Item two here.
3277 Item two here.
3278 \&.El
3282 Produces:
3285 .Bl -item -offset indent
3287 Item one goes here.
3288 Item one goes here.
3289 Item one goes here.
3291 Item two here.
3292 Item two here.
3293 Item two here.
3297 .It Fl tag
3298 A list with tags.
3300 .Fl width
3302 .Fl xwidth
3303 to specify the tag width.
3306 .Bl -tag -width "PPID" -compact -offset indent
3307 .It SL
3308 sleep time of the process (seconds blocked)
3309 .It PAGEIN
3310 number of disk
3311 .Tn I/O Ns 's
3312 resulting from references by the process
3313 to pages not loaded in core.
3314 .It UID
3315 numerical user-id of process owner
3316 .It PPID
3317 numerical id of parent of process priority
3318 (non-positive when in non-interruptible wait)
3322 The raw text:
3324 .Bd -literal -offset indent
3325 \&.Bl -tag -width "PPID" -compact -offset indent
3326 \&.It SL
3327 sleep time of the process (seconds blocked)
3328 \&.It PAGEIN
3329 number of disk
3330 \&.Tn I/O Ns 's
3331 resulting from references by the process
3332 to pages not loaded in core.
3333 \&.It UID
3334 numerical user-id of process owner
3335 \&.It PPID
3336 numerical id of parent of process priority
3337 (non-positive when in non-interruptible wait)
3338 \&.El
3342 .It Fl diag
3343 Diag lists create section four diagnostic lists and are similar to inset
3344 lists except callable macros are ignored.
3345 The flags
3346 .Fl width
3348 .Fl xwidth
3349 are not meaningful in this context.
3351 Example:
3353 .Bd -literal -offset indent
3354 \&.Bl -diag
3355 \&.It You can't use Sy here.
3356 The message says all.
3357 \&.El
3361 produces
3363 .Bl -diag
3364 .It You can't use Sy here.
3365 The message says all.
3369 .It Fl hang
3370 A list with hanging tags.
3372 .Bl -hang -offset indent
3373 .It Em Hanged
3374 labels appear similar to tagged lists when the
3375 label is smaller than the label width.
3376 .It Em Longer hanged list labels
3377 blend into the paragraph unlike
3378 tagged paragraph labels.
3381 And the unformatted text which created it:
3383 .Bd -literal -offset indent
3384 \&.Bl -hang -offset indent
3385 \&.It Em Hanged
3386 labels appear similar to tagged lists when the
3387 label is smaller than the label width.
3388 \&.It Em Longer hanged list labels
3389 blend into the paragraph unlike
3390 tagged paragraph labels.
3391 \&.El
3395 .It Fl ohang
3396 Lists with overhanging tags do not use indentation for the items; tags are
3397 written to a separate line.
3399 .Bl -ohang -offset indent
3400 .It Sy SL
3401 sleep time of the process (seconds blocked)
3402 .It Sy PAGEIN
3403 number of disk
3404 .Tn I/O Ns 's
3405 resulting from references by the process
3406 to pages not loaded in core.
3407 .It Sy UID
3408 numerical user-id of process owner
3409 .It Sy PPID
3410 numerical id of parent of process priority
3411 (non-positive when in non-interruptible wait)
3415 The raw text:
3417 .Bd -literal -offset indent
3418 \&.Bl -ohang -offset indent
3419 \&.It Sy SL
3420 sleep time of the process (seconds blocked)
3421 \&.It Sy PAGEIN
3422 number of disk
3423 \&.Tn I/O Ns 's
3424 resulting from references by the process
3425 to pages not loaded in core.
3426 \&.It Sy UID
3427 numerical user-id of process owner
3428 \&.It Sy PPID
3429 numerical id of parent of process priority
3430 (non-positive when in non-interruptible wait)
3431 \&.El
3435 .It Fl inset
3436 Here is an example of inset labels:
3437 .Bl -inset -offset indent
3438 .It Em Tag
3439 The tagged list (also called a tagged paragraph)
3440 is the most common type of list used in the
3441 Berkeley manuals.
3442 Use a
3443 .Fl width
3444 attribute as described below.
3445 .It Em Diag
3446 Diag lists create section four diagnostic lists
3447 and are similar to inset lists except callable
3448 macros are ignored.
3449 .It Em Hang
3450 Hanged labels are a matter of taste.
3451 .It Em Ohang
3452 Overhanging labels are nice when space is constrained.
3453 .It Em Inset
3454 Inset labels are useful for controlling blocks of
3455 paragraphs and are valuable for converting
3456 .Nm \-mdoc
3457 manuals to other formats.
3460 Here is the source text which produced the above example:
3462 .Bd -literal -offset indent
3463 \&.Bl -inset -offset indent
3464 \&.It Em Tag
3465 The tagged list (also called a tagged paragraph)
3466 is the most common type of list used in the
3467 Berkeley manuals.
3468 \&.It Em Diag
3469 Diag lists create section four diagnostic lists
3470 and are similar to inset lists except callable
3471 macros are ignored.
3472 \&.It Em Hang
3473 Hanged labels are a matter of taste.
3474 \&.It Em Ohang
3475 Overhanging labels are nice when space is constrained.
3476 \&.It Em Inset
3477 Inset labels are useful for controlling blocks of
3478 paragraphs and are valuable for converting
3479 \&.Nm \-mdoc
3480 manuals to other formats.
3481 \&.El
3485 .It Fl column
3486 This list type generates multiple columns.
3487 The number of columns and the width of each column is determined by the
3488 arguments to the
3489 .Fl column
3490 list.
3491 Each
3492 .Ql .It
3493 argument is parsed to make a row, each column within the row is a separate
3494 argument separated by a tab or the
3495 .Ql .Ta
3496 macro.
3498 The table:
3500 .Bl -column -offset indent String Nroff Troff
3501 .It Sy String Ta Sy Nroff Ta Sy Troff
3502 .It Li <= Ta <= Ta \*(<=
3503 .It Li >= Ta >= Ta \*(>=
3507 was produced by:
3509 .Bd -literal -offset indent
3510 \&.Bl -column -offset indent String Nroff Troff
3511 \&.It Sy String Ta Sy Nroff Ta Sy Troff
3512 \&.It Li <= Ta <= Ta \e*(<=
3513 \&.It Li >= Ta >= Ta \e*(>=
3514 \&.El
3519 Other keywords:
3521 .Bl -tag -xwidth ".Fl indent Ao Ar string Ac"
3522 .It Fl width Ao Ar string Ac
3524 .Ao string Ac
3525 is a valid numeric expression
3526 .Pf ( Em with a scale indicator other than
3527 .Sq Em u ) ,
3528 use that value for indentation.
3529 The most useful scale indicators are
3530 .Sq m
3532 .Sq n ,
3533 specifying the so-called
3534 .Em \&Em
3536 .Em "En square" .
3537 This is approximately the width of the letter
3538 .Sq m
3539 resp.\& the letter
3540 .Sq n
3541 of the current font (for nroff output, both scale indicators give the same
3542 values).
3544 .Ao string Ac
3545 isn't a numeric expression, it is tested whether it is an
3546 .Nm \-mdoc
3547 macro name, and the default offset value associated with this macro is used.
3548 Finally, if all tests fail,
3549 the width of
3550 .Ao string Ac
3551 (typeset with a fixed-width font) is taken as the offset.
3553 If a width is not specified for the tag list type, every time
3554 .Ql .It
3555 is invoked, an attempt is made to determine an appropriate width.
3556 If the first argument to
3557 .Ql .It
3558 is a callable macro, the default width for that macro will be used;
3559 otherwise, the default width of
3560 .Ql .No
3561 is used.
3562 .It Fl xwidth Ao Ar string Ac
3563 Interpret
3564 .Ao string Ac
3565 and use the width of the result.
3566 Almost all lists in this document use this option.
3568 Example:
3570 .Bd -literal -offset indent
3571 \&.Bl -tag -xwidth ".Fl test Ao Ar string Ac"
3572 \&.It Fl test Ao Ar string Ac
3573 This is a longer sentence to show how the
3574 \&.Fl xwidth
3575 flag works in combination with a tag list.
3576 \&.El
3580 gives:
3582 .Bl -tag -xwidth ".Fl test Ao Ar string Ac"
3583 .It Fl test Ao Ar string Ac
3584 This is a longer sentence to show how the
3585 .Fl xwidth
3586 flag works in combination with a tag list.
3590 Note that the current state of
3591 .Nm \-mdoc
3592 is saved before
3593 .Ao string Ac
3594 is interpreted; afterwards, all variables are restored again.
3595 However, boxes (used for enclosures) can't be saved in
3596 .Tn GNU
3597 .Xr troff 1 ;
3598 as a consequence, arguments must always be
3599 .Em balanced
3600 to avoid nasty errors.
3601 For example, do not write
3602 .Ql ".Ao string"
3604 .Ql ".Ao string Xc"
3605 instead if you really need only an opening angle bracket.
3606 .It Fl offset Ao Ar string Ac
3608 .Ao string Ac
3610 .Ar indent ,
3611 a default indent value (normally set to\~6n, similar to the value used in
3612 .Ql .Dl
3614 .Ql .Bd )
3615 is used.
3617 .Ao string Ac
3618 is a valid numeric expression instead
3619 .Pf ( Em with a scale indicator other than
3620 .Sq Em u ) ,
3621 use that value for indentation.
3622 The most useful scale indicators are
3623 .Sq m
3625 .Sq n ,
3626 specifying the so-called
3627 .Em \&Em
3629 .Em "En square" .
3630 This is approximately the width of the letter
3631 .Sq m
3632 resp.\& the letter
3633 .Sq n
3634 of the current font (for nroff output, both scale indicators give the same
3635 values).
3637 .Ao string Ac
3638 isn't a numeric expression, it is tested whether it is an
3639 .Nm \-mdoc
3640 macro name, and the default offset value associated with this macro is used.
3641 Finally, if all tests fail,
3642 the width of
3643 .Ao string Ac
3644 (typeset with a fixed-width font) is taken as the offset.
3645 .It Fl compact
3646 Suppress insertion of vertical space before the list and between list items.
3650 .Sh "MISCELLANEOUS MACROS"
3652 Here a list of the remaining macros which do not fit well into one of the
3653 above sections.
3654 We couldn't find real examples for the following macros:
3655 .Ql .Me
3657 .Ql .Ot .
3658 They are documented here for completeness \- if you know how to use them
3659 properly please send a mail to
3660 .Mt bug-groff@gnu.org
3661 (including an example).
3663 .Bl -tag -xwidth ".Li .Bt"
3664 .It Li .Bt
3665 prints
3667 .Bd -ragged -offset indent
3671 It is neither callable nor parsed and takes no arguments.
3673 .It Li .Fr
3675 .Dl Usage: .Fr Ao function return value Ac ...
3677 Don't use this macro.
3678 It allows a break right before the return value (usually a single digit)
3679 which is bad typographical behaviour.
3681 .Ql \e~
3682 to tie the return value to the previous word.
3684 .It Li .Hf
3685 Use this macro to include a (header) file literally.
3686 It first prints
3687 .Ql File:
3688 followed by the file name, then the contents of
3689 .Ao file Ac .
3691 .Dl Usage: .Hf Ao file Ac
3693 It is neither callable nor parsed.
3695 .It Li .Lk
3696 To be written.
3698 .It Li .Me
3699 Exact usage unknown.
3700 The documentation in the
3701 .Nm \-mdoc
3702 source file describes it as a macro for
3703 .Dq "menu entries" .
3705 Its default width is 6n.
3707 .It Li .Mt
3708 To be written.
3710 .It Li .Ot
3711 Exact usage unknown.
3712 The documentation in the
3713 .Nm \-mdoc
3714 source file describes it as
3715 .Dq old function type (fortran) .
3717 .It Li .Sm
3718 Activate (toggle) space mode.
3720 .Dl Usage: .Sm Oo on | off Oc ...
3722 If space mode is off, no spaces between macro arguments are inserted.
3723 If called without a parameter (or if the next parameter is neither
3724 .Ql on
3726 .Ql off ,
3727 .Ql .Sm
3728 toggles space mode.
3730 .It Li .Ud
3731 prints
3733 .Bd -ragged -offset indent
3737 It is neither callable nor parsed and takes no arguments.
3741 .Sh "PREDEFINED STRINGS"
3743 The following strings are predefined:
3745 .Bl -column String infinity "Troff " "straight double quote" -offset indent
3746 .It Sy String Ta Sy Nroff Ta Sy Troff Ta Sy Meaning
3747 .It Li <=     Ta <=       Ta \*[<=]   Ta "less equal"
3748 .It Li >=     Ta >=       Ta \*[>=]   Ta "greater equal"
3749 .It Li Rq     Ta ''       Ta \*[Rq]   Ta "right double quote"
3750 .It Li Lq     Ta ``       Ta \*[Lq]   Ta "left double quote"
3751 .It Li ua     Ta ^        Ta \*[ua]   Ta "upwards arrow"
3752 .It Li aa     Ta \'       Ta \*[aa]   Ta "acute accent"
3753 .It Li ga     Ta \`       Ta \*[ga]   Ta "grave accent"
3754 .It Li q      Ta \&"      Ta \*[q]    Ta "straight double quote"
3755 .It Li Pi     Ta pi       Ta \*[Pi]   Ta "greek pi"
3756 .It Li Ne     Ta !=       Ta \*[Ne]   Ta "not equal"
3757 .It Li Le     Ta <=       Ta \*[Le]   Ta "less equal"
3758 .It Li Ge     Ta >=       Ta \*[Ge]   Ta "greater equal"
3759 .It Li Lt     Ta <        Ta \*[Lt]   Ta "less than"
3760 .It Li Gt     Ta >        Ta \*[Gt]   Ta "greater than"
3761 .It Li Pm     Ta +\-      Ta \*[Pm]   Ta "plus minus"
3762 .It Li If     Ta infinity Ta \*[If]   Ta "infinity"
3763 .It Li Na     Ta \*[Na]   Ta \*[Na]   Ta "not a number"
3764 .It Li Ba     Ta \*[Ba]   Ta \*[Ba]   Ta "vertical bar"
3767 The names of the columns
3768 .Sy Nroff
3770 .Sy Troff
3771 are a bit misleading;
3772 .Sy Nroff
3773 shows the
3774 .Tn ASCII
3775 representation, while
3776 .Sy Troff
3777 gives the best glyph form available.
3778 For example, a Unicode enabled
3779 .Tn TTY Ns - Ns
3780 device will have proper glyph representations for all strings, whereas the
3781 enhancement for a Latin1
3782 .Tn TTY Ns - Ns
3783 device is only the plus-minus sign.
3785 String names which consist of two characters can be written as
3786 .Ql \e*(xx ;
3787 string names which consist of one character can be written as
3788 .Ql \e*x .
3789 A generic syntax for a string name of any length is
3790 .Ql \e*[xxx]
3791 (this is a
3792 .Tn GNU
3793 .Xr troff 1
3794 extension).
3798 \#=====================================================================
3800 .Sh DIAGNOSTICS
3802 The debugging macro
3803 .Ql .Db
3804 available in previous versions of
3805 .Nm \-mdoc
3806 has been removed since
3807 .Tn GNU
3808 .Xr troff 1
3809 provides better facilities to check parameters; additionally, many error and
3810 warning messages have been added to this macro package, making it both more
3811 robust and verbose.
3813 The only remaining debugging macro is
3814 .Ql .Rd
3815 which yields a register dump of all global registers and strings.
3816 A normal user will never need it.
3819 .Sh "FORMATTING WITH GROFF, TROFF, AND NROFF"
3821 By default, the package inhibits page breaks, headers, and footers if
3822 displayed with a
3823 .Tn TTY
3824 device like
3825 .Sq latin1
3827 .Sq unicode
3828 to make the manual more efficient for viewing on-line.
3829 This behaviour can be changed (e.g.\& to create a hardcopy of the
3830 .Tn TTY
3831 output) by setting the register
3832 .Ql cR
3833 to zero while calling
3834 .Xr groff :
3836 .Dl groff -Tlatin1 -rcR=0 -mdoc foo.man > foo.txt
3838 For double-sided printing, set register
3839 .Ql D
3840 to\~1:
3842 .Dl groff -Tps -rD1 -mdoc foo.man > foo.ps
3844 To change the document font size to 11pt or 12pt, set register
3845 .Ql S
3846 accordingly:
3848 .Dl groff -Tdvi -rS11 -mdoc foo.man > foo.dvi
3850 Register
3851 .Ql S
3852 is ignored for
3853 .Tn TTY
3854 devices.
3857 .Sh FILES
3859 .Bl -tag -width mdoc/doc-ditroff -compact
3860 .It Pa doc.tmac
3861 The main manual macro package.
3862 .It Pa mdoc.tmac
3863 A wrapper file to call
3864 .Pa doc.tmac .
3865 .It Pa mdoc/doc-common
3866 Common strings, definitions, stuff related typographic output.
3867 .It Pa mdoc/doc-nroff
3868 Definitions used for a
3869 .Tn TTY
3870 output device.
3871 .It Pa mdoc/doc-ditroff
3872 Definitions used for all other devices.
3873 .It Pa mdoc.local
3874 Local additions and customizations.
3875 .It Pa andoc.tmac
3876 This file checks whether the
3877 .Nm \-mdoc
3878 or the
3879 .Nm \-man
3880 package should be used.
3884 .Sh "SEE ALSO"
3886 .Xr groff 1 ,
3887 .Xr man 1 ,
3888 .Xr troff 1 ,
3889 .Xr groff_man 7
3892 .Sh BUGS
3894 Section 3f has not been added to the header routines.
3896 .Ql \&.Nm
3897 font should be changed in
3898 .Sx NAME
3899 section.
3901 .Ql \&.Fn
3902 needs to have a check to prevent splitting up
3903 if the line length is too short.
3904 Occasionally it
3905 separates the last parenthesis, and sometimes
3906 looks ridiculous if a line is in fill mode.
3908 The list and display macros do not do any keeps
3909 and certainly should be able to.
3910 .\" Note what happens if the parameter list overlaps a newline
3911 .\" boundary.
3912 .\" to make sure a line boundary is crossed:
3913 .\" .Bd -literal
3914 .\" \&.Fn struct\e\ dictionarytable\e\ *dictionarylookup struct\e\ dictionarytable\e\ *tab[]
3915 .\" .Ed
3916 .\" .Pp
3917 .\" produces, nudge nudge,
3918 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
3919 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
3920 .\" nudge
3921 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] .
3922 .\" .Pp
3923 .\" If double quotes are used, for example:
3924 .\" .Bd -literal
3925 .\" \&.Fn \*qstruct dictionarytable *dictionarylookup\*q \*qchar *h\*q \*qstruct dictionarytable *tab[]\*q
3926 .\" .Ed
3927 .\" .Pp
3928 .\" produces, nudge nudge,
3929 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
3930 .\" nudge
3931 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
3932 .\" nudge
3933 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" .
3934 .\" .Pp
3935 .\" Not a pretty sight...
3936 .\" In a paragraph, a long parameter containing unpaddable spaces as
3937 .\" in the former example will cause
3938 .\" .Xr troff
3939 .\" to break the line and spread
3940 .\" the remaining words out.
3941 .\" The latter example will adjust nicely to
3942 .\" justified margins, but may break in between an argument and its
3943 .\" declaration.
3944 .\" In
3945 .\" .Xr nroff
3946 .\" the right margin adjustment is normally ragged and the problem is
3947 .\" not as severe.