1 .\" Copyright (c) 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)mdoc.samples.7 8.2 (Berkeley) 12/30/93
33 .\" $Id: mdoc.samples.7,v 1.17 1998/12/03 03:38:45 jkoshy Exp $
35 .\" This tutorial sampler invokes every macro in the package several
36 .\" times and is guaranteed to give a worst case performance
37 .\" for an already extremely slow package.
44 .Nd tutorial sampler for writing
51 A tutorial sampler for writing
56 .Em content Ns \-based
65 addressed page layout leaving the
66 manipulation of fonts and other
67 typesetting details to the individual author.
72 .Em "page structure domain"
73 which consists of macros for titles, section headers, displays
74 and lists. Essentially items which affect the physical position
75 of text on a formatted page.
76 In addition to the page structure domain, there are two more domains,
77 the manual domain and the general text domain.
78 The general text domain is defined as macros which
79 perform tasks such as quoting or emphasizing pieces of text.
80 The manual domain is defined as macros that are a subset of the
81 day to day informal language used to describe commands, routines
85 Macros in the manual domain handle
86 command names, command-line arguments and options, function names,
87 function parameters, pathnames, variables, cross
88 references to other manual pages, and so on.
91 for both the author and the future user of the manual page.
92 It is hoped the consistency gained
93 across the manual set will provide easier
94 translation to future documentation tools.
98 manual pages, a manual entry
100 to as a man page, regardless of actual length and without
103 Since a tutorial document is normally read when a person
104 desires to use the material immediately, the assumption has
105 been made that the user of this document may be impatient.
106 The material presented in the remained of this document is
108 .Bl -enum -offset indent
110 .Tn "TROFF IDIOSYNCRASIES"
111 .Bl -tag -width flag -compact -offset indent
113 .It "Passing Space Characters in an Argument" .
114 .It "Trailing Blank Space Characters (a warning)" .
115 .It "Escaping Special Characters" .
118 .Tn "THE ANATOMY OF A MAN PAGE"
119 .Bl -tag -width flag -compact -offset indent
120 .It "A manual page template" .
125 .Tn "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS" .
126 .Bl -tag -width flag -compact -offset indent
127 .It "What's in a name..." .
128 .It "General Syntax" .
132 .Bl -tag -width flag -compact -offset indent
136 .It "Configuration Declarations (section four only)" .
137 .It "Command Modifier" .
138 .It "Defined Variables" .
139 .It "Errno's (Section two only)" .
140 .It "Environment Variables" .
141 .It "Function Argument" .
142 .It "Function Declaration" .
144 .It "Functions (library routines)" .
145 .It "Function Types" .
146 .\" .It "Header File (including source code)" .
147 .It "Interactive Commands" .
152 .It "Cross References" .
155 .Tn "GENERAL TEXT DOMAIN"
156 .Bl -tag -width flag -compact -offset indent
159 .It "FreeBSD Macro" .
161 .It "Enclosure/Quoting Macros"
162 .Bl -tag -width flag -compact -offset indent
163 .It "Angle Bracket Quote/Enclosure" .
164 .It "Bracket Quotes/Enclosure" .
165 .It "Double Quote macro/Enclosure" .
166 .It "Parenthesis Quote/Enclosure" .
167 .It "Single Quotes/Enclosure" .
170 .It "No\-Op or Normal Text Macro" .
171 .It "No Space Macro" .
172 .It "Section Cross References" .
173 .It "References and Citations" .
174 .It "Return Values (sections two and three only)"
175 .It "Trade Names (Acronyms and Type Names)" .
176 .It "Extended Arguments" .
179 .Tn "PAGE STRUCTURE DOMAIN"
180 .Bl -tag -width flag -compact -offset indent
181 .It "Section Headers" .
182 .It "Paragraphs and Line Spacing" .
185 .It "Font Modes (Emphasis, Literal, and Symbolic)" .
186 .It "Lists and Columns" .
189 .Tn "PREDEFINED STRINGS"
193 .Tn "FORMATTING WITH GROFF, TROFF AND NROFF"
198 .Sh TROFF IDIOSYNCRASIES
201 package attempts to simplify the process of writing a man page.
202 Theoretically, one should not have to learn the dirty details of
206 however, there are a few
207 limitations which are unavoidable and best gotten out
209 And, too, be forewarned, this package is
215 a macro is called by placing a
219 a line followed by the two character name for the macro.
220 Arguments may follow the macro separated by spaces.
221 It is the dot character at the beginning of the line which causes
223 to interpret the next two characters as a macro name.
227 at the beginning of a line in some context other than
228 a macro invocation, precede the
235 translates literally to a zero width space, and is never displayed in the
240 macros accept up to nine arguments, any
241 extra arguments are ignored.
244 accept nine arguments and,
245 in limited cases, arguments may be continued or extended
249 A few macros handle quoted arguments (see
250 .Sx Passing Space Characters in an Argument
255 general text domain and manual domain macros are special
256 in that their argument lists are
258 for callable macro names.
259 This means an argument on the argument list which matches
260 a general text or manual domain macro name and is determined
261 to be callable will be executed
262 or called when it is processed.
264 the argument, although the name of a macro,
268 It is in this manner that many macros are nested; for
274 the flag and argument macros,
278 to specify an optional flag with an argument:
279 .Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
282 .Li \&.Op \&Fl s \&Ar bytes
285 To prevent a two character
286 string from being interpreted as a macro name, precede
290 .Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
291 .It Op \&Fl s \&Ar bytes
293 .Li \&.Op \e&Fl s \e&Ar bytes
300 are not interpreted as macros.
301 Macros whose argument lists are parsed for callable arguments
303 as parsed and macros which may be called from an argument
304 list are referred to as callable
305 throughout this document and in the companion quick reference
310 as almost all of the macros in
312 are parsed, but as it was cumbersome to constantly refer to macros
313 as being callable and being able to call other macros,
314 the term parsed has been used.
315 .Ss Passing Space Characters in an Argument
316 Sometimes it is desirable to give as one argument a string
317 containing one or more blank space characters.
318 This may be necessary
319 to defeat the nine argument limit or to specify arguments to macros
320 which expect particular arrangement of items in the argument list.
324 expects the first argument to be the name of a function and any
325 remaining arguments to be function parameters.
328 stipulates the declaration of function parameters in the
329 parenthesized parameter list, each parameter is guaranteed
330 to be at minimum a two word string.
334 There are two possible ways to pass an argument which contains
336 .Em Implementation note :
337 Unfortunately, the most convenient way
338 of passing spaces in between quotes by reassigning individual
339 arguments before parsing was fairly expensive speed wise
340 and space wise to implement in all the macros for
343 It is not expensive for
345 but for the sake of portability, has been limited
346 to the following macros which need
349 .Bl -tag -width 4n -offset indent -compact
351 Configuration declaration (section 4
354 Begin list (for the width specifier).
358 Functions (sections two and four).
370 Optional notes for a reference.
372 Report title (in a reference).
374 Title of article in a book or journal.
377 One way of passing a string
378 containing blank spaces is to use the hard or unpaddable space character
380 that is, a blank space preceded by the escape character
382 This method may be used with any macro but has the side effect
383 of interfering with the adjustment of text
384 over the length of a line.
386 sees the hard space as if it were any other printable character and
387 cannot split the string into blank or newline separated pieces as one
389 The method is useful for strings which are not expected
390 to overlap a line boundary.
392 .Bl -tag -width "fetch(char *str)" -offset indent
393 .It Fn fetch char\ *str
395 .Ql \&.Fn fetch char\e *str
396 .It Fn fetch "char *str"
397 can also be created by
398 .Ql \&.Fn fetch "\\*qchar *str\\*q"
406 would see three arguments and
409 .Dl Fn fetch char *str
411 For an example of what happens when the parameter list overlaps
412 a newline boundary, see the
415 .Ss Trailing Blank Space Characters
417 can be confused by blank space characters at the end of a line.
419 is a wise preventive measure to globally remove all blank spaces
420 from <blank-space><end-of-line> character sequences.
422 arise to force a blank character at the end of a line,
423 it may be forced with an unpaddable space and the
428 .Ss Escaping Special Characters
430 like the newline character
432 are handled by replacing the
440 .Sh THE ANATOMY OF A MAN PAGE
441 The body of a man page is easily constructed from a basic
442 template found in the file
443 .Pa /usr/share/misc/mdoc.template .
444 Several example man pages can also be found
446 .Pa /usr/share/examples/mdoc .
448 .Ss A manual page template
449 .Bd -literal -offset indent
450 \&.\e" The following requests are required for all man pages.
451 \&.Dd Month day, year
452 \&.Os OPERATING_SYSTEM [version/release]
453 \&.Dt DOCUMENT_TITLE [section number] [volume]
456 \&.Nd one line description of name
459 \&.\e" The following requests should be uncommented and
460 \&.\e" used where appropriate. This next request is
461 \&.\e" for sections 2 and 3 function return values only.
462 \&.\e" .Sh RETURN VALUE
463 \&.\e" This next request is for sections 1, 6, 7 & 8 only
464 \&.\e" .Sh ENVIRONMENT
467 \&.\e" This next request is for sections 1, 6, 7 & 8 only
468 \&.\e" (command return values (to shell) and
469 \&.\e" fprintf/stderr type diagnostics)
470 \&.\e" .Sh DIAGNOSTICS
471 \&.\e" The next request is for sections 2 and 3 error
472 \&.\e" and signal handling only.
475 \&.\e" .Sh CONFORMING TO
481 The first items in the template are the macros
482 .Pq Li \&.Dd , \&.Os , \&.Dt ;
484 the operating system the man page or subject source is developed
486 and the man page title
488 along with the section of the manual the page
490 These macros identify the page,
491 and are discussed below in
494 The remaining items in the template are section headers
505 .Sx PAGE STRUCTURE DOMAIN ,
509 Several content macros are used to demonstrate page layout macros;
510 reading about content macros before page layout macros is
513 The title macros are the first portion of the page structure
514 domain, but are presented first and separate for someone who
515 wishes to start writing a man page yesterday.
516 Three header macros designate the document title or manual page title,
517 the operating system,
518 and the date of authorship.
519 These macros are one called once at the very beginning of the document
520 and are used to construct the headers and footers only.
522 .It Li \&.Dt DOCUMENT_TITLE section# [volume]
523 The document title is the
524 subject of the man page and must be in
528 The section number may be 1,\ ...,\ 8,
529 and if it is specified,
530 the volume title may be omitted.
531 A volume title may be arbitrary or one of the following:
533 .\" USD UNIX User's Supplementary Documents
535 .\" PS1 UNIX Programmer's Supplementary Documents
537 .Bl -column SMM -offset indent -compact
538 .It Li AMD UNIX Ancestral Manual Documents
539 .It Li SMM UNIX System Manager's Manual
540 .It Li URM UNIX Reference Manual
541 .It Li PRM UNIX Programmer's Manual
544 The default volume labeling is
546 for sections 1, 6, and 7;
550 for sections 2, 3, 4, and 5.
552 .\" MMI UNIX Manual Master Index
554 .\" CON UNIX Contributed Software Manual
556 .\" LOC UNIX Local Manual
557 .It Li \&.Os operating_system release#
558 The name of the operating system
559 should be the common acronym, for example,
565 The release should be the standard release
566 nomenclature for the system specified, for example, 4.3, 4.3+Tahoe, V.3,
568 Unrecognized arguments are displayed as given in the page footer.
569 For instance, a typical footer might be:
574 .Dl \&.Os FreeBSD 2.2
576 or for a locally produced set
578 .Dl \&.Os CS Department
580 The Berkeley default,
582 without an argument, has been defined as
586 .Pa /usr/share/tmac/mdoc/doc-common .
587 It really should default to
591 macro is not present, the bottom left corner of the page
593 .It Li \&.Dd month day, year
594 The date should be written formally:
599 .Sh INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS
600 .Ss What's in a name...
601 The manual domain macro names are derived from the day to day
602 informal language used to describe commands, subroutines and related
604 Slightly different variations of this language are used to describe
605 the three different aspects of writing a man page.
606 First, there is the description of
609 Second is the description of a
615 the description of a command to a user in the verbal sense;
616 that is, discussion of a command in the text of a man page.
620 macros are themselves a type of command;
621 the general syntax for a troff command is:
622 .Bd -filled -offset indent
623 \&.Va argument1 argument2 ... argument9
628 is a macro command or request, and anything following it is an argument to
633 command using the content macros is a
637 command line might be displayed as:
638 .Bd -filled -offset indent
646 is the command name and the
651 argument designated as optional by the option brackets.
661 The macros which formatted the above example:
662 .Bd -literal -offset indent
668 In the third case, discussion of commands and command syntax
669 includes both examples above, but may add more detail.
675 from the example above might be referred to as
679 Some command-line argument lists are quite long:
680 .Bl -tag -width make -offset indent
687 .Op Fl I Ar directory
690 .Op Ar variable=value
696 Here one might talk about the command
698 and qualify the argument
700 as an argument to the flag,
702 or discuss the optional
706 In the verbal context, such detail can prevent confusion,
710 does not have a macro for an argument
715 argument macro is used for an operand or file argument like
717 as well as an argument to a flag like
719 The make command line was produced from:
720 .Bd -literal -offset indent
723 \&.Op Fl D Ar variable
725 \&.Op Fl f Ar makefile
726 \&.Op Fl I Ar directory
727 \&.Op Fl j Ar max_jobs
728 \&.Op Ar variable=value
738 macros are explained in
741 The manual domain and general text domain macros share a similar
742 syntax with a few minor deviations:
748 differ only when called without arguments;
752 impose an order on their argument lists
758 have nesting limitations.
760 are capable of recognizing and properly handling punctuation,
761 provided each punctuation character is separated by a leading space.
762 If a request is given:
764 .Dl \&.Li sptr, ptr),
770 The punctuation is not recognized and all is output in the
771 literal font. If the punctuation is separated by a leading
774 .Dl \&.Li "sptr , ptr ) ,"
778 .Dl Li sptr , ptr ) ,
780 The punctuation is now recognized and is output in the
781 default font distinguishing it from the strings in literal font.
783 To remove the special meaning from a punctuation character
787 is limited as a macro language, and has difficulty
788 when presented with a string containing
789 a member of the mathematical, logical or
791 .Bd -literal -offset indent-two
792 \&{+,\-,/,*,\&%,<,>,<=,>=,=,==,&,`,',"}
797 may assume it is supposed to actually perform the operation
798 or evaluation suggested by the characters. To prevent
799 the accidental evaluation of these characters,
802 Typical syntax is shown in the first content macro displayed
807 The address macro identifies an address construct
808 of the form addr1[,addr2[,addr3]].
810 .Dl Usage: .Ad address ... \*(Pu
811 .Bl -tag -width ".Ad f1 , f2 , f3 :" -compact -offset 14n
814 .It Li \&.Ad addr1\ .
816 .It Li \&.Ad addr1\ , file2
818 .It Li \&.Ad f1\ , f2\ , f3\ :
820 .It Li \&.Ad addr\ )\ )\ ,
824 It is an error to call
828 is callable by other macros and is parsed.
832 macro is used to specify the name of the author of the item being
833 documented, or the name of the author of the actual manual page.
834 Any remaining arguments after the name information are assumed
837 .Dl Usage: .An author_name \*(Pu
838 .Bl -tag -width ".An Joe Author ) ) ," -compact -offset 14n
839 .It Li \&.An Joe\ Author
841 .It Li \&.An Joe\ Author\ ,
843 .It Li \&.An Joe\ Author\ \&Aq\ nobody@FreeBSD.ORG
844 .An Joe Author Aq nobody@FreeBSD.ORG
845 .It Li \&.An Joe\ Author\ )\ )\ ,
851 macro is parsed and is callable.
852 It is an error to call
859 argument macro may be used whenever
860 a command-line argument is referenced.
862 .Dl Usage: .Ar argument ... \*(Pu
863 .Bl -tag -width ".Ar file1 file2" -compact -offset 15n
868 .It Li \&.Ar file1\ .
870 .It Li \&.Ar file1 file2
872 .It Li \&.Ar f1 f2 f3\ :
874 .It Li \&.Ar file\ )\ )\ ,
880 is called without arguments
885 macro is parsed and is callable.
886 .Ss Configuration Declaration (section four only)
889 macro is used to demonstrate a
891 declaration for a device interface in a section four manual.
892 This macro accepts quoted arguments (double quotes only).
894 .Bl -tag -width "device le0 at scode?" -offset indent
895 .It Cd "device le0 at scode?"
897 .Ql ".Cd device le0 at scode?" .
900 The command modifier is identical to the
902 (flag) command with the exception
905 macro does not assert a dash
906 in front of every argument.
907 Traditionally flags are marked by the
908 preceding dash, some commands or subsets of commands do not use them.
909 Command modifiers may also be specified in conjunction with interactive
910 commands such as editor commands.
913 .Ss Defined Variables
914 A variable which is defined in an include file is specified
918 .Dl Usage: .Dv defined_variable ... \*(Pu
919 .Bl -tag -width ".Dv MAXHOSTNAMELEN" -compact -offset 14n
920 .It Li ".Dv MAXHOSTNAMELEN"
922 .It Li ".Dv TIOCGPGRP )"
926 It is an error to call
930 is parsed and is callable.
931 .Ss Errno's (Section two only)
934 errno macro specifies the error return value
935 for section two library routines.
941 general text domain macro, as it would be used in
942 a section two manual page.
944 .Dl Usage: .Er ERRNOTYPE ... \*(Pu
945 .Bl -tag -width ".Bq Er ENOTDIR" -compact -offset 14n
948 .It Li \&.Er ENOENT\ )\ ;
950 .It Li \&.Bq \&Er ENOTDIR
954 It is an error to call
959 macro is parsed and is callable.
960 .Ss Environment Variables
963 macro specifies an environment variable.
965 .Dl Usage: .Ev argument ... \*(Pu
966 .Bl -tag -width ".Ev PRINTER ) ) ," -compact -offset 14n
971 .It Li \&.Ev PRINTER\ )\ )\ ,
975 It is an error to call
980 macro is parsed and is callable.
981 .Ss Function Argument
984 macro is used to refer to function arguments (parameters)
987 section of the manual or inside
990 section should a parameter list be too
993 macro and the enclosure macros
999 may also be used to refer to structure members.
1001 .Dl Usage: .Fa function_argument ... \*(Pu
1002 .Bl -tag -width ".Fa d_namlen\ )\ )\ ," -compact -offset 14n
1003 .It Li \&.Fa d_namlen\ )\ )\ ,
1005 .It Li \&.Fa iov_len
1009 It is an error to call
1013 is parsed and is callable.
1014 .Ss Function Declaration
1017 macro is used in the
1019 section with section two or three
1023 macro does not call other macros and is not callable by other
1026 .Dl Usage: .Fd include_file (or defined variable)
1032 request causes a line break if a function has already been presented
1033 and a break has not occurred.
1034 This leaves a nice vertical space
1035 in between the previous function call and the declaration for the
1040 macro handles command-line flags.
1045 For interactive command flags, which
1046 are not prepended with a dash, the
1049 macro is identical, but without the dash.
1051 .Dl Usage: .Fl argument ... \*(Pu
1052 .Bl -tag -width ".Fl \-s \-t \-v" -compact -offset 14n
1063 .It Li \&.Fl xyz\ )\ ,
1069 macro without any arguments results
1070 in a dash representing \fIstdin\fP/\fIstdout\fP.
1073 a single dash, will result in two dashes.
1076 macro is parsed and is callable.
1077 .Ss Functions (library routines)
1078 The .Fn macro is modeled on ANSI C conventions.
1080 Usage: .Fn [type] function [[type] parameters ... \*(Pu]
1082 .Bl -tag -width ".Fn _int align_ _const * char *sptrsxx" -compact
1083 .It Li "\&.Fn getchar"
1085 .It Li "\&.Fn strlen ) ,"
1087 .It Li \&.Fn "\\*qint align\\*q" "\\*qconst * char *sptrs\\*q" ,
1088 .Fn "int align" "const * char *sptrs" ,
1091 It is an error to call
1093 without any arguments.
1097 is parsed and is callable,
1098 note that any call to another macro signals the end of
1101 call (it will close-parenthesis at that point).
1103 For functions that have more than eight parameters (and this
1114 to get around the limitation.
1116 .Bd -literal -offset indent
1117 \&.Fo "int res_mkquery"
1124 \&.Fa "struct rrec *newrr"
1131 .Bd -filled -offset indent
1132 .Fo "int res_mkquery"
1139 .Fa "struct rrec *newrr"
1149 macros are parsed and are callable.
1152 section, the function will always begin at
1153 the beginning of line.
1154 If there is more than one function
1157 section and a function type has not been
1158 given, a line break will occur, leaving a nice vertical space
1159 between the current function name and the one prior.
1162 does not check its word boundaries
1163 against troff line lengths and may split across a newline
1165 This will be fixed in the near future.
1167 This macro is intended for the
1171 anywhere else in the man page without problems, but its main purpose
1172 is to present the function type in kernel normal form for the
1174 of sections two and three
1175 (it causes a line break allowing the function name to appear
1178 .Dl Usage: .Ft type ... \*(Pu
1179 .Bl -tag -width "\&.Ft struct stat" -offset 14n -compact
1180 .It Li \&.Ft struct stat
1186 request is not callable by other macros.
1187 .Ss Interactive Commands
1190 macro designates an interactive or internal command.
1192 .Dl Usage: .Ic argument ... \*(Pu
1193 .Bl -tag -width ".Ic setenv , unsetenvxx" -compact -offset 14n
1196 .It Li \&.Ic do while {...}
1198 .It Li \&.Ic setenv\ , unsetenv
1199 .Ic setenv , unsetenv
1202 It is an error to call
1207 macro is parsed and is callable.
1211 macro is used for the document title or subject name.
1212 It has the peculiarity of remembering the first
1213 argument it was called with, which should
1214 always be the subject name of the page.
1218 regurgitates this initial name for the sole purpose
1219 of making less work for the author.
1222 or three document function name is addressed with the
1230 and remaining sections.
1231 For interactive commands, such as the
1237 macro should be used.
1243 it can not recall the first argument it was invoked with.
1245 .Dl Usage: .Nm argument ... \*(Pu
1246 .Bl -tag -width ".Nm mdoc.sample" -compact -offset 14n
1247 .It Li \&.Nm mdoc.sample
1249 .It Li \&.Nm \e-mdoc
1251 .It Li \&.Nm foo\ )\ )\ ,
1259 macro is parsed and is callable.
1264 places option brackets around the any remaining arguments on the command
1265 line, and places any
1266 trailing punctuation outside the brackets.
1271 may be used across one or more lines.
1273 .Dl Usage: .Op options ... \*(Pu
1274 .Bl -tag -width ".Op Fl c Ar objfil Op Ar corfil ," -compact -offset indent
1279 .It Li ".Op Fl k ) ."
1281 .It Li ".Op Fl k Ar kookfile"
1282 .Op Fl k Ar kookfile
1283 .It Li ".Op Fl k Ar kookfile ,"
1284 .Op Fl k Ar kookfile ,
1285 .It Li ".Op Ar objfil Op Ar corfil"
1286 .Op Ar objfil Op Ar corfil
1287 .It Li ".Op Fl c Ar objfil Op Ar corfil ,"
1288 .Op Fl c Ar objfil Op Ar corfil ,
1289 .It Li \&.Op word1 word2
1298 .Bd -literal -offset indent
1300 \&.Op \&Fl k \&Ar kilobytes
1301 \&.Op \&Fl i \&Ar interval
1302 \&.Op \&Fl c \&Ar count
1308 .Op Fl k Ar kilobytes
1309 .Op Fl i Ar interval
1318 are parsed and are callable.
1322 macro formats pathnames or filenames.
1324 .Dl Usage: .Pa pathname \*(Pu
1325 .Bl -tag -width ".Pa /tmp/fooXXXXX ) ." -compact -offset 14n
1326 .It Li \&.Pa /usr/share
1328 .It Li \&.Pa /tmp/fooXXXXX\ )\ .
1329 .Pa /tmp/fooXXXXX ) .
1334 macro is parsed and is callable.
1336 Generic variable reference:
1338 .Dl Usage: .Va variable ... \*(Pu
1339 .Bl -tag -width ".Va char s ] ) ) ," -compact -offset 14n
1342 .It Li \&.Va settimer ,
1344 .It Li \&.Va int\ *prt\ )\ :
1346 .It Li \&.Va char\ s\ ]\ )\ )\ ,
1350 It is an error to call
1352 without any arguments.
1355 macro is parsed and is callable.
1356 .Ss Manual Page Cross References
1359 macro expects the first argument to be
1360 a manual page name, and the second argument, if it exists,
1361 to be either a section page number or punctuation.
1363 remaining arguments are assumed to be punctuation.
1365 .Dl Usage: .Xr man_page [1,...,8] \*(Pu
1366 .Bl -tag -width ".Xr mdoc 7 ) ) ," -compact -offset 14n
1369 .It Li \&.Xr mdoc\ ,
1373 .It Li \&.Xr mdoc 7\ )\ )\ ,
1379 macro is parsed and is callable.
1380 It is an error to call
1384 .Sh GENERAL TEXT DOMAIN
1386 .Bd -literal -offset indent -compact
1387 Usage: .At [v6 | v7 | 32v | V.1 | V.4] ... \*(Pu
1389 .Bl -tag -width ".At v6 ) ," -compact -offset 14n
1403 It accepts at most two arguments.
1405 .Dl Usage: .Bx [Version/release] ... \*(Pu
1406 .Bl -tag -width ".Bx 4.3 ) ," -compact -offset 14n
1415 macro is parsed and is callable.
1417 .Bd -literal -offset indent -compact
1418 Usage: .Fx Version.release ... \*(Pu
1420 .Bl -tag -width ".Fx 2.2 ) ," -compact -offset 14n
1432 It accepts at most two arguments.
1434 .Dl Usage: .Ux ... \*(Pu
1435 .Bl -tag -width ".Ux 4.3 ) ," -compact -offset 14n
1442 macro is parsed and is callable.
1443 .Ss Enclosure and Quoting Macros
1444 The concept of enclosure is similar to quoting.
1445 The object being to enclose one or more strings between
1446 a pair of characters like quotes or parentheses.
1447 The terms quoting and enclosure are used
1448 interchangeably throughout this document.
1450 one line enclosure macros end
1453 to give a hint of quoting, but there are a few irregularities.
1454 For each enclosure macro
1455 there is also a pair of open and close macros which end
1461 These can be used across one or more lines of text
1462 and while they have nesting limitations, the one line quote macros
1467 .Bd -filled -offset indent
1468 .Bl -column "quote " "close " "open " "Enclose Stringx(in XX) " XXstringXX
1469 .Em " Quote Close Open Function Result"
1470 \&.Aq .Ac .Ao Angle Bracket Enclosure <string>
1471 \&.Bq .Bc .Bo Bracket Enclosure [string]
1472 \&.Dq .Dc .Do Double Quote ``string''
1473 .Ec .Eo Enclose String (in XX) XXstringXX
1474 \&.Pq .Pc .Po Parenthesis Enclosure (string)
1475 \&.Ql Quoted Literal `st' or string
1476 \&.Qq .Qc .Qo Straight Double Quote "string"
1477 \&.Sq .Sc .So Single Quote `string'
1481 Except for the irregular macros noted below, all
1482 of the quoting macros are parsed and callable.
1483 All handle punctuation properly, as long as it
1484 is presented one character at a time and separated by spaces.
1485 The quoting macros examine opening and closing punctuation
1486 to determine whether it comes before or after the
1488 This makes some nesting possible.
1489 .Bl -tag -width xxx,xxxx
1490 .It Li \&.Ec , \&.Eo
1491 These macros expect the first argument to be the
1492 opening and closing strings respectively.
1494 The quoted literal macro behaves differently for
1500 a quoted literal is always quoted.
1502 troff, an item is only quoted if the width
1503 of the item is less than three constant width characters.
1504 This is to make short strings more visible where the font change
1505 to literal (constant width) is less noticeable.
1507 The prefix macro is not callable, but it is parsed:
1508 .Bl -tag -width "(namexx" -offset indent
1509 .It Li ".Pf ( Fa name2"
1516 (no space) macro performs the analogous suffix function.
1520 Examples of quoting:
1521 .Bl -tag -width ".Aq Pa ctype.h ) ,xxxxxxxx" -compact -offset indent
1524 .It Li \&.Aq \&Ar ctype.h\ )\ ,
1528 .It Li \&.Bq \&Em Greek \&, French \&.
1529 .Bq Em Greek , French .
1532 .It Li ".Dq string abc ."
1534 .It Li ".Dq \'^[A-Z]\'"
1536 .It Li "\&.Ql man mdoc"
1540 .It Li "\&.Qq string ) ,"
1542 .It Li "\&.Qq string Ns ),"
1546 .It Li "\&.Sq string
1550 For a good example of nested enclosure macros, see the
1553 It was created from the same
1554 underlying enclosure macros as those presented in the list
1560 extended argument list macros
1561 were also built from the same underlying routines and are a good
1564 macro usage at its worst.
1565 .Ss No\-Op or Normal Text Macro
1569 a hack for words in a macro command line which should
1571 be formatted and follows the conventional syntax
1576 macro eliminates unwanted spaces in between macro requests.
1577 It is useful for old style argument lists where there is no space
1578 between the flag and argument:
1579 .Bl -tag -width ".Op Fl I Ns Ar directoryxx" -offset indent
1580 .It Li ".Op Fl I Ns Ar directory"
1582 .Op Fl I Ns Ar directory
1587 macro always invokes the
1589 macro after eliminating the space unless another macro name
1593 is parsed and is callable.
1594 .Ss Section Cross References
1597 macro designates a reference to a section header
1598 within the same document.
1599 It is parsed and is callable.
1601 .Bl -tag -width "Li \&.Sx FILES" -offset 14n
1605 .Ss References and Citations
1606 The following macros make a modest attempt to handle references.
1607 At best, the macros make it convenient to manually drop in a subset of
1608 refer style references.
1610 .Bl -tag -width 6n -offset indent -compact
1613 Causes a line break and begins collection
1614 of reference information until the
1615 reference end macro is read.
1618 The reference is printed.
1620 Reference author name, one name per invocation.
1632 Optional information.
1643 The macros beginning with
1645 are not callable, and are parsed only for the trade name macro which
1646 returns to its caller.
1647 (And not very predictably at the moment either.)
1648 The purpose is to allow trade names
1649 to be pretty printed in
1650 .Xr troff Ns / Ns Xr ditroff
1655 macro generates text for use in the
1659 .Dl Usage: .Rv [-std function]
1661 .Ql \&.Rv -std atexit
1662 will generate the following text:
1664 .\" fake chapter 3 to avoid error message from Rv
1667 .\" and back to 7 again
1672 option is valid only for manual page sections 2 and 3.
1673 .Ss Trade Names (or Acronyms and Type Names)
1674 The trade name macro is generally a small caps macro for
1675 all upper case words longer than two characters.
1677 .Dl Usage: .Tn symbol ... \*(Pu
1678 .Bl -tag -width ".Tn ASCII" -compact -offset 14n
1688 is parsed and is callable by other macros.
1689 .Ss Extended Arguments
1694 macros allow one to extend an argument list
1695 on a macro boundary.
1696 Argument lists cannot
1697 be extended within a macro
1698 which expects all of its arguments on one line such
1702 Here is an example of
1704 using the space mode macro to turn spacing off:
1705 .Bd -literal -offset indent
1707 \&.It Xo Sy I Ar operation
1708 \&.No \een Ar count No \een
1714 .Bd -filled -offset indent
1715 .Bl -tag -width flag -compact
1717 .It Xo Sy I Ar operation
1718 .No \en Ar count No \en
1725 .Bd -literal -offset indent
1727 \&.It Cm S No \&/ Ar old_pattern Xo
1728 \&.No \&/ Ar new_pattern
1735 .Bd -filled -offset indent
1736 .Bl -tag -width flag -compact
1738 .It Cm S No \&/ Ar old_pattern Xo
1739 .No \&/ Ar new_pattern
1748 and using enclosure macros:
1749 Test the value of a variable.
1750 .Bd -literal -offset indent
1753 \&.Oo \e&! Oc Ns Ar variable
1754 \&.Op Ar operator variable ...
1759 .Bd -filled -offset indent
1760 .Bl -tag -width flag -compact
1763 .Oo \&! Oc Ns Ar variable
1764 .Op Ar operator variable ...
1769 All of the above examples have used the
1771 macro on the argument list of the
1775 The extend macros are not used very often, and when they are
1776 it is usually to extend the list-item argument list.
1777 Unfortunately, this is also where the extend macros are the
1779 In the first two examples, spacing was turned off;
1780 in the third, spacing was desired in part of the output but
1782 To make these macros work in this situation make sure
1787 macros are placed as shown in the third example.
1790 macro is not alone on the
1792 argument list, spacing will be unpredictable.
1796 must not occur as the first or last macro on a line
1798 Out of 900 manual pages (about 1500 actual pages)
1799 currently released with
1801 only fifteen use the
1804 .Sh PAGE STRUCTURE DOMAIN
1808 section header macros
1809 list below are required in every
1811 The remaining section headers
1812 are recommended at the discretion of the author
1813 writing the manual page.
1816 macro can take up to nine arguments.
1817 It is parsed and but is not callable.
1818 .Bl -tag -width ".Sh SYNOPSIS"
1824 the headers, footers and page layout defaults
1825 will not be set and things will be rather unpleasant.
1828 section consists of at least three items.
1831 name macro naming the subject of the man page.
1832 The second is the Name Description macro,
1834 which separates the subject
1835 name from the third item, which is the description.
1837 description should be the most terse and lucid possible,
1838 as the space available is small.
1842 section describes the typical usage of the
1843 subject of a man page.
1859 for manual page sections 2 and 3, the command and general
1862 is required for sections 1, 5, 6, 7, 8.
1863 Section 4 manuals require a
1868 configuration device usage macro.
1869 Several other macros may be necessary to produce
1870 the synopsis line as shown below:
1872 .Bd -filled -offset indent
1879 The following macros were used:
1882 .Dl \&.Op \&Fl benstuv
1892 recognize the pipe bar character
1894 so a command line such as:
1896 .Dl ".Op Fl a | Fl b"
1898 will not go orbital.
1900 normally interprets a \*(Ba as a special operator.
1902 .Sx PREDEFINED STRINGS
1904 character in other situations.
1905 .It \&.Sh DESCRIPTION
1906 In most cases the first text in the
1909 is a brief paragraph on the command, function or file,
1910 followed by a lexical list of options and respective
1912 To create such a list, the
1919 macros are used (see
1920 .Sx Lists and Columns
1926 section headers are part of the
1927 preferred manual page layout and must be used appropriately
1928 to maintain consistency.
1929 They are listed in the order
1930 in which they would be used.
1931 .Bl -tag -width SYNOPSIS
1932 .It \&.Sh ENVIRONMENT
1935 section should reveal any related
1937 variables and clues to their behavior and/or usage.
1939 There are several ways to create examples.
1946 Files which are used or created by the man page subject
1947 should be listed via the
1953 References to other material on the man page topic and
1954 cross references to other relevant man pages should
1959 are specified using the
1962 Cross references in the
1964 section should be sorted by section number, and then
1965 placed in alphabetical order and comma separated. For example:
1974 style references are not accommodated.
1975 .It \&.Sh CONFORMING TO
1976 If the command, library function or file adheres to a
1977 specific implementation such as
1981 this should be noted here.
1983 command does not adhere to any standard, its history
1984 should be noted in the
1988 Any command which does not adhere to any specific standards
1989 should be outlined historically in this section.
1991 Credits, if need be, should be placed here.
1992 .It \&.Sh DIAGNOSTICS
1993 Diagnostics from a command should be placed in this section.
1995 Specific error handling, especially from library functions
1996 (man page sections 2 and 3) should go here.
1999 macro is used to specify an errno.
2001 Blatant problems with the topic go here...
2006 sections may be added,
2007 for example, this section was set with:
2008 .Bd -literal -offset 14n
2009 \&.Sh PAGE STRUCTURE DOMAIN
2011 .Ss Paragraphs and Line Spacing.
2016 paragraph command may
2017 be used to specify a line space where necessary.
2018 The macro is not necessary after a
2028 macro asserts a vertical distance unless the -compact flag is given).
2030 .\" This worked with version one, need to redo for version three
2033 .\" .Cw (ax+bx+c) \ is\ produced\ by\ \&
2034 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2051 .\" .Em is produced by
2067 .\" This example shows the same equation in a different format.
2071 .\" signs were forced with
2075 .\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&
2076 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2087 .\" .Li \&.Cx \e\ +\e\ \e&
2098 .\" .Em is produced by
2106 .\" .Li \&.Cx \e\ +\e\ \e&
2117 .\" The incantation below was
2123 .\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by
2125 .\" .Li \&.Cx Op Sy ?/
2135 .\" .Em is produced by
2137 .\" .Li \&.Ar \e\ b1 e1 f1
2149 The only keep that is implemented at this time is for words.
2156 The only option that
2160 and is useful for preventing line breaks in the middle of options.
2161 In the example for the make command-line arguments (see
2162 .Sx What's in a name ) ,
2166 flag and the argument
2168 (Actually, the option macro used to prevent this from occurring,
2169 but was dropped when the decision (religious) was made to force
2170 right justified margins in
2172 as options in general look atrocious when spread across a sparse
2174 More work needs to be done with the keep macros, a
2176 option needs to be added.)
2177 .Ss Examples and Displays
2178 There are five types of displays, a quickie one line indented display
2180 a quickie one line literal display
2182 and a block literal, block filled and block ragged which use
2190 .Bl -tag -width \&.Dlxx
2192 (D-one) Display one line of indented text.
2193 This macro is parsed, but it is not callable.
2197 The above was produced by:
2198 .Li \&.Dl Fl ldghfstru .
2201 Display one line of indented
2206 example macro has been used throughout this
2209 the indent (display) of one line of text.
2210 Its default font is set to
2211 constant width (literal) however
2212 it is parsed and will recognized other macros.
2213 It is not callable however.
2215 .Dl % ls -ldg /usr/local/bin
2217 The above was produced by
2218 .Li \&.Dl % ls -ldg /usr/local/bin .
2223 display must be ended with the
2226 Displays may be nested within displays and
2229 has the following syntax:
2231 .Dl ".Bd display-type [-offset offset_value] [-compact]"
2233 The display-type must be one of the following four types and
2234 may have an offset specifier for indentation:
2237 .Bl -tag -width "file file_name " -compact
2239 Display a block of text as typed,
2240 right (and left) margin edges are left ragged.
2242 Display a filled (formatted) block.
2243 The block of text is formatted (the edges are filled \-
2244 not left unjustified).
2246 Display a literal block, useful for source code or
2247 simple tabbed or spaced text.
2248 .It Fl file Ar file_name
2249 The filename following the
2251 flag is read and displayed.
2253 asserted and tabs are set at 8 constant width character
2254 intervals, however any
2255 .Xr troff/ Ns Nm \-mdoc
2256 commands in file will be processed.
2257 .It Fl offset Ar string
2260 is specified with one of the following strings, the string
2261 is interpreted to indicate the level of indentation for the
2262 forthcoming block of text:
2264 .Bl -tag -width "indent-two" -compact
2266 Align block on the current left margin,
2267 this is the default mode of
2270 Supposedly center the block.
2272 unfortunately, the block merely gets
2273 left aligned about an imaginary center margin.
2275 Indents by one default indent value or tab.
2277 indent value is also used for the
2279 display so one is guaranteed the two types of displays
2281 This indent is normally set to 6n or about two
2282 thirds of an inch (six constant width characters).
2284 Indents two times the default indent value.
2288 aligns the block about two inches from
2289 the right side of the page.
2291 work and perhaps may never do the right thing by
2299 There are five macros for changing the appearance of the manual page text:
2300 .Bl -tag -width \&.Emxx
2302 Text may be stressed or emphasized with the
2305 The usual font for emphasis is italic.
2307 .Dl Usage: .Em argument ... \*(Pu
2308 .Bl -tag -width ".Em vide infra ) ) ," -compact -offset 14n
2309 .It Li ".Em does not"
2311 .It Li ".Em exceed 1024 ."
2313 .It Li ".Em vide infra ) ) ,"
2314 .Em vide infra ) ) ,
2319 macro is parsed and is callable.
2320 It is an error to call
2326 literal macro may be used for special characters,
2327 variable constants, anything which should be displayed as it
2330 .Dl Usage: .Li argument ... \*(Pu
2331 .Bl -tag -width ".Li cntrl-D ) ," -compact -offset 14n
2334 .It Li \&.Li M1 M2 M3\ ;
2336 .It Li \&.Li cntrl-D\ )\ ,
2338 .It Li \&.Li 1024\ ...
2344 macro is parsed and is callable.
2346 The symbolic emphasis macro is generally a boldface macro in
2347 either the symbolic sense or the traditional English usage.
2349 .Dl Usage: .Sy symbol ... \*(Pu
2350 .Bl -tag -width ".Sy Important Noticex" -compact -offset 14n
2351 .It Li \&.Sy Important Notice
2352 .Sy Important Notice
2357 macro is parsed and is callable.
2365 font mode must be ended with the
2368 Font modes may be nested within other font modes.
2370 has the following syntax:
2374 The font-mode must be one of the following three types:
2377 .Bl -tag -width "file file_name " -compact
2378 .It Sy \&Em | Fl emphasis
2381 macro was used for the entire block of text.
2382 .It Sy \&Li | Fl literal
2385 macro was used for the entire block of text.
2386 .It Sy \&Sy | Fl symbolic
2389 macro was used for the entire block of text.
2394 .Ss Tagged Lists and Columns
2395 There are several types of lists which may be initiated with the
2398 Items within the list
2399 are specified with the
2402 each list must end with the
2405 Lists may be nested within themselves and within displays.
2406 Columns may be used inside of lists, but lists are unproven
2409 In addition, several list attributes may be specified such as
2410 the width of a tag, the list offset, and compactness
2411 (blank lines between items allowed or disallowed).
2412 Most of this document has been formatted with a tag style list
2414 For a change of pace, the list-type used to present the list-types
2415 is an over-hanging list
2417 This type of list is quite popular with
2419 users, but might look a bit funny after having read many pages of
2421 The following list types are accepted by
2428 These three are the simplest types of lists.
2431 macro has been given, items in the list are merely
2432 indicated by a line consisting solely of the
2435 For example, the source text for a simple enumerated list
2437 .Bd -literal -offset indent-two
2438 \&.Bl -enum -compact
2440 \&Item one goes here.
2442 \&And item two here.
2444 \&Lastly item three goes here.
2450 .Bl -enum -offset indent-two -compact
2456 Lastly item three goes here.
2459 A simple bullet list construction:
2460 .Bd -literal -offset indent-two
2461 \&.Bl -bullet -compact
2463 \&Bullet one goes here.
2470 .Bl -bullet -offset indent-two -compact
2472 Bullet one goes here.
2482 These list-types collect arguments specified with the
2484 macro and create a label which may be
2486 into the forthcoming text,
2488 from the forthcoming text,
2490 from above and not indented or
2493 list was constructed with the
2498 macro is parsed only for the inset, hang
2499 and tag list-types and is not callable.
2500 Here is an example of inset labels:
2501 .Bl -inset -offset indent
2503 The tagged list (also called a tagged paragraph) is the
2504 most common type of list used in the Berkeley manuals.
2506 Diag lists create section four diagnostic lists
2507 and are similar to inset lists except callable
2510 Hanged labels are a matter of taste.
2512 Overhanging labels are nice when space is constrained.
2514 Inset labels are useful for controlling blocks of
2515 paragraphs and are valuable for converting
2517 manuals to other formats.
2520 Here is the source text which produced the above example:
2521 .Bd -literal -offset indent
2522 \&.Bl -inset -offset indent
2524 \&The tagged list (also called a tagged paragraph) is the
2525 \&most common type of list used in the Berkeley manuals.
2527 \&Diag lists create section four diagnostic lists
2528 \&and are similar to inset lists except callable
2529 \¯os are ignored.
2531 \&Hanged labels are a matter of taste.
2533 \&Overhanging labels are nice when space is constrained.
2535 \&Inset labels are useful for controlling blocks of
2536 \¶graphs and are valuable for converting
2538 \&manuals to other formats.
2542 Here is a hanged list with two items:
2543 .Bl -hang -offset indent
2545 labels appear similar to tagged lists when the
2546 label is smaller than the label width.
2547 .It Em Longer hanged list labels
2548 blend in to the paragraph unlike
2549 tagged paragraph labels.
2552 And the unformatted text which created it:
2553 .Bd -literal -offset indent
2554 \&.Bl -hang -offset indent
2556 \&labels appear similar to tagged lists when the
2557 \&label is smaller than the label width.
2558 \&.It Em Longer hanged list labels
2559 \&blend in to the paragraph unlike
2560 \&tagged paragraph labels.
2564 The tagged list which follows uses an optional width specifier to control
2565 the width of the tag.
2567 .Bl -tag -width "PAGEIN" -compact -offset indent
2569 sleep time of the process (seconds blocked)
2573 resulting from references
2574 by the process to pages not loaded in core.
2576 numerical user-id of process owner
2578 numerical ID of parent of process process priority
2579 (nonpositive when in noninterruptible wait)
2583 .Bd -literal -offset indent
2584 \&.Bl -tag -width "PAGEIN" -compact -offset indent
2586 \&sleep time of the process (seconds blocked)
2590 \&resulting from references
2591 \&by the process to pages not loaded in core.
2593 \&numerical user ID of process owner
2595 \&numerical ID of parent of process process priority
2596 \&(nonpositive when in noninterruptible wait)
2600 Acceptable width specifiers:
2601 .Bl -tag -width Ar -offset indent
2602 .It Fl width Ar "\&Fl"
2603 sets the width to the default width for a flag.
2605 macros have a default width value.
2609 set to ten constant width characters or about five sixth of
2611 .It Fl width Ar "24n"
2612 sets the width to 24 constant width characters or about two
2616 is absolutely necessary for the scaling to work correctly.
2617 .It Fl width Ar "ENAMETOOLONG"
2618 sets width to the constant width length of the
2620 .It Fl width Ar "\\*qint mkfifo\\*q"
2621 again, the width is set to the constant width of the string
2626 If a width is not specified for the tag list type, the first
2629 is invoked, an attempt is made to determine an appropriate
2631 If the first argument to
2633 is a callable macro, the default width for that macro will be used
2634 as if the macro name had been supplied as the width.
2636 if another item in the list is given with a different callable
2637 macro name, a new and nested list is assumed.
2638 .Sh PREDEFINED STRINGS
2639 The following strings are predefined as may be used by
2640 preceding with the troff string interpreting sequence
2644 is the name of the defined string or as
2648 is the name of the string.
2649 The interpreting sequence may be used any where in the text.
2651 .Bl -column "String " "Nroff " "Troff " -offset indent
2652 .It Sy "String Nroff Troff"
2653 .It Li "<=" Ta \&<\&= Ta \*(<=
2654 .It Li ">=" Ta \&>\&= Ta \*(>=
2655 .It Li "Rq" Ta "''" Ta \*(Rq
2656 .It Li "Lq" Ta "``" Ta \*(Lq
2657 .It Li "ua" Ta ^ Ta \*(ua
2658 .It Li "aa" Ta ' Ta \*(aa
2659 .It Li "ga" Ta \` Ta \*(ga
2660 .\" .It Li "sL" Ta ` Ta \*(sL
2661 .\" .It Li "sR" Ta ' Ta \*(sR
2662 .It Li "q" Ta \&" Ta \*q
2663 .It Li "Pi" Ta pi Ta \*(Pi
2664 .It Li "Ne" Ta != Ta \*(Ne
2665 .It Li "Le" Ta <= Ta \*(Le
2666 .It Li "Ge" Ta >= Ta \*(Ge
2667 .It Li "Lt" Ta < Ta \*(Gt
2668 .It Li "Gt" Ta > Ta \*(Lt
2669 .It Li "Pm" Ta +- Ta \*(Pm
2670 .It Li "If" Ta infinity Ta \*(If
2671 .It Li "Na" Ta \fINaN\fP Ta \*(Na
2672 .It Li "Ba" Ta \fR\&|\fP Ta \*(Ba
2678 should be written as
2680 since it is only one char.
2682 The debugging facilities for
2684 are limited, but can help detect subtle errors such
2685 as the collision of an argument name with an internal
2686 register or macro name.
2688 A register is an arithmetic storage class for
2690 with a one or two character name.
2691 All registers internal to
2697 are two characters and
2698 of the form <upper_case><lower_case> such as
2700 <lower_case><upper_case> as
2703 <upper or lower letter><digit> as
2705 And adding to the muddle,
2707 has its own internal registers all of which are either
2708 two lower case characters or a dot plus a letter or metacharacter
2710 In one of the introduction examples, it was shown how to
2711 prevent the interpretation of a macro name with the escape sequence
2713 This is sufficient for the internal register names also.
2715 .\" Every callable macro name has a corresponding register
2716 .\" of the same name (<upper_case><lower_case>).
2717 .\" There are also specific registers which have
2718 .\" been used for stacks and arrays and are listed in the
2720 .\" .Bd -ragged -offset 4n
2721 .\" [A-Z][a-z] registers corresponding to macro names (example ``Ar'')
2722 .\" [a-z][A-Z] registers corresponding to macro names (example ``aR'')
2723 .\" C[0-9] argument types (example C1)
2724 .\" O[0-9] offset stack (displays)
2725 .\" h[0-9] horizontal spacing stack (lists)
2726 .\" o[0-9] offset (stack) (lists)
2727 .\" t[0-9] tag stack (lists)
2728 .\" v[0-9] vertical spacing stack (lists)
2729 .\" w[0-9] width tag/label stack
2732 If a nonescaped register name is given in the argument list of a request
2733 unpredictable behavior will occur.
2734 In general, any time huge portions
2735 of text do not appear where expected in the output, or small strings
2736 such as list tags disappear, chances are there is a misunderstanding
2737 about an argument type in the argument list.
2738 Your mother never intended for you to remember this evil stuff - so here
2739 is a way to find out whether or not your arguments are valid: The
2742 macro displays the interpretation of the argument list for most
2747 macro do not contain debugging information.
2748 All of the callable macros do,
2749 and it is strongly advised whenever in doubt,
2754 .Dl Usage: \&.Db [on | off]
2756 An example of a portion of text with
2757 the debug macro placed above and below an
2758 artificially created problem (a flag argument
2763 .Bd -literal -offset indent
2765 \&.Op Fl aC Ar file )
2769 The resulting output:
2770 .Bd -literal -offset indent
2772 DEBUG(argv) MACRO: `.Op' Line #: 2
2773 Argc: 1 Argv: `Fl' Length: 2
2774 Space: `' Class: Executable
2775 Argc: 2 Argv: `aC' Length: 2
2776 Space: `' Class: Executable
2777 Argc: 3 Argv: `Ar' Length: 2
2778 Space: `' Class: Executable
2779 Argc: 4 Argv: `file' Length: 4
2780 Space: ` ' Class: String
2781 Argc: 5 Argv: `)' Length: 1
2782 Space: ` ' Class: Closing Punctuation or suffix
2783 MACRO REQUEST: .Op Fl aC Ar file )
2787 The first line of information tells the name of the calling
2790 and the line number it appears on.
2791 If one or more files are involved
2792 (especially if text from another file is included) the line number
2794 If there is only one file, it should be accurate.
2795 The second line gives the argument count, the argument
2798 If the length of an argument is two characters, the
2799 argument is tested to see if it is executable (unfortunately, any
2800 register which contains a nonzero value appears executable).
2801 The third line gives the space allotted for a class, and the
2803 The problem here is the argument aC should not be
2805 The four types of classes are string, executable, closing
2806 punctuation and opening punctuation.
2807 The last line shows the entire
2808 argument list as it was read.
2809 In this next example, the offending
2812 .Bd -literal -offset indent
2814 \&.Em An escaped \e&aC
2817 .Bd -literal -offset indent
2819 DEBUG(fargv) MACRO: `.Em' Line #: 2
2820 Argc: 1 Argv: `An' Length: 2
2821 Space: ` ' Class: String
2822 Argc: 2 Argv: `escaped' Length: 7
2823 Space: ` ' Class: String
2824 Argc: 3 Argv: `aC' Length: 2
2825 Space: ` ' Class: String
2826 MACRO REQUEST: .Em An escaped &aC
2832 shows up with the same length of 2 as the
2834 sequence produces a zero width, but a register
2837 was not found and the type classified as string.
2839 Other diagnostics consist of usage statements and are self explanatory.
2840 .Sh GROFF, TROFF AND NROFF
2843 package does not need compatibility mode with
2846 The package inhibits page breaks, and the headers and footers
2847 which normally occur at those breaks with
2849 to make the manual more efficient for viewing on-line.
2854 does eject the imaginary remainder of the page at end of file.
2855 The inhibiting of the page breaks makes
2857 files unsuitable for hardcopy.
2858 There is a register named
2860 which can be set to zero in the site dependent style file
2861 .Pa /usr/src/share/tmac/doc-nroff
2862 to restore the old style behavior.
2864 .Bl -tag -width /usr/share/man0/template.doc -compact
2865 .It Pa /usr/share/tmac/doc.tmac
2866 manual macro package
2867 .It Pa /usr/share/misc/mdoc.template
2868 template for writing a man page
2869 .It Pa /usr/share/examples/mdoc/*
2870 several example man pages
2873 Undesirable hyphenation on the dash of a flag
2874 argument is not yet resolved, and causes
2875 occasional mishaps in the
2878 (line break on the hyphen).
2880 Predefined strings are not declared in documentation.
2882 Section 3f has not been added to the header routines.
2885 font should be changed in
2890 needs to have a check to prevent splitting up
2891 if the line length is too short.
2893 separates the last parenthesis, and sometimes
2894 looks ridiculous if a line is in fill mode.
2896 The method used to prevent header and footer page
2897 breaks (other than the initial header and footer) when using
2898 nroff occasionally places an unsightly partially filled line (blank)
2899 at the would be bottom of the page.
2901 The list and display macros to not do any keeps
2902 and certainly should be able to.
2903 .\" Note what happens if the parameter list overlaps a newline
2905 .\" to make sure a line boundary is crossed:
2907 .\" \&.Fn struct\e\ dictionarytable\e\ *dictionarylookup struct\e\ dictionarytable\e\ *tab[]
2910 .\" produces, nudge nudge,
2911 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
2912 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
2914 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] .
2916 .\" If double quotes are used, for example:
2918 .\" \&.Fn \*qstruct dictionarytable *dictionarylookup\*q \*qchar *h\*q \*qstruct dictionarytable *tab[]\*q
2921 .\" produces, nudge nudge,
2922 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
2924 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
2926 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" .
2928 .\" Not a pretty sight...
2929 .\" In a paragraph, a long parameter containing unpaddable spaces as
2930 .\" in the former example will cause
2932 .\" to break the line and spread
2933 .\" the remaining words out.
2934 .\" The latter example will adjust nicely to
2935 .\" justified margins, but may break in between an argument and its
2939 .\" the right margin adjustment is normally ragged and the problem is
2947 This page is part of release 3.32 of the Linux
2950 A description of the project,
2951 and information about reporting bugs,
2953 http://www.kernel.org/doc/man-pages/.