1 .\" Copyright (c) 1990, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\" must display the following acknowledgement:
15 .\" This product includes software developed by the University of
16 .\" California, Berkeley and its contributors.
17 .\" 4. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .\" @(#)mdoc.samples.7 8.2 (Berkeley) 12/30/93
35 .\" $Id: mdoc.samples.7,v 1.17 1998/12/03 03:38:45 jkoshy Exp $
37 .\" This tutorial sampler invokes every macro in the package several
38 .\" times and is guaranteed to give a worst case performance
39 .\" for an already extremely slow package.
41 .\" String \*(Pu was not defined, probably means punctuation
42 .ds Pu "[ .,:;()[]?! ]
48 .Nd tutorial sampler for writing
55 A tutorial sampler for writing
60 .Em content Ns \-based
69 addressed page layout leaving the
70 manipulation of fonts and other
71 typesetting details to the individual author.
76 .Em "page structure domain"
77 which consists of macros for titles, section headers, displays
79 Essentially items which affect the physical position
80 of text on a formatted page.
81 In addition to the page structure domain, there are two more domains,
82 the manual domain and the general text domain.
83 The general text domain is defined as macros which
84 perform tasks such as quoting or emphasizing pieces of text.
85 The manual domain is defined as macros that are a subset of the
86 day to day informal language used to describe commands, routines
90 Macros in the manual domain handle
91 command names, command-line arguments and options, function names,
92 function parameters, pathnames, variables, cross
93 references to other manual pages, and so on.
96 for both the author and the future user of the manual page.
97 It is hoped the consistency gained
98 across the manual set will provide easier
99 translation to future documentation tools.
103 manual pages, a manual entry
105 to as a man page, regardless of actual length and without
108 Since a tutorial document is normally read when a person
109 desires to use the material immediately, the assumption has
110 been made that the user of this document may be impatient.
111 The material presented in the remained of this document is
113 .Bl -enum -offset indent
115 .Tn "TROFF IDIOSYNCRASIES"
116 .Bl -tag -width flag -compact -offset indent
118 .It "Passing Space Characters in an Argument" .
119 .It "Trailing Blank Space Characters (a warning)" .
120 .It "Escaping Special Characters" .
123 .Tn "THE ANATOMY OF A MAN PAGE"
124 .Bl -tag -width flag -compact -offset indent
125 .It "A manual page template" .
130 .Tn "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS" .
131 .Bl -tag -width flag -compact -offset indent
132 .It "What's in a name..." .
133 .It "General Syntax" .
137 .Bl -tag -width flag -compact -offset indent
141 .It "Configuration Declarations (section four only)" .
142 .It "Command Modifier" .
143 .It "Defined Variables" .
144 .It "Errno's (Section two only)" .
145 .It "Environment Variables" .
146 .It "Function Argument" .
147 .It "Function Declaration" .
149 .It "Functions (library routines)" .
150 .It "Function Types" .
151 .\" .It "Header File (including source code)" .
152 .It "Interactive Commands" .
157 .It "Cross References" .
160 .Tn "GENERAL TEXT DOMAIN"
161 .Bl -tag -width flag -compact -offset indent
164 .It "FreeBSD Macro" .
166 .It "Enclosure/Quoting Macros"
167 .Bl -tag -width flag -compact -offset indent
168 .It "Angle Bracket Quote/Enclosure" .
169 .It "Bracket Quotes/Enclosure" .
170 .It "Double Quote macro/Enclosure" .
171 .It "Parenthesis Quote/Enclosure" .
172 .It "Single Quotes/Enclosure" .
175 .It "No\-Op or Normal Text Macro" .
176 .It "No Space Macro" .
177 .It "Section Cross References" .
178 .It "References and Citations" .
179 .It "Return Values (sections two and three only)"
180 .It "Trade Names (Acronyms and Type Names)" .
181 .It "Extended Arguments" .
184 .Tn "PAGE STRUCTURE DOMAIN"
185 .Bl -tag -width flag -compact -offset indent
186 .It "Section Headers" .
187 .It "Paragraphs and Line Spacing" .
190 .It "Font Modes (Emphasis, Literal, and Symbolic)" .
191 .It "Lists and Columns" .
194 .Tn "PREDEFINED STRINGS"
198 .Tn "FORMATTING WITH GROFF, TROFF AND NROFF"
203 .Sh TROFF IDIOSYNCRASIES
206 package attempts to simplify the process of writing a man page.
207 Theoretically, one should not have to learn the dirty details of
211 however, there are a few
212 limitations which are unavoidable and best gotten out
214 And, too, be forewarned, this package is
220 a macro is called by placing a
224 a line followed by the two character name for the macro.
225 Arguments may follow the macro separated by spaces.
226 It is the dot character at the beginning of the line which causes
228 to interpret the next two characters as a macro name.
232 at the beginning of a line in some context other than
233 a macro invocation, precede the
240 translates literally to a zero width space, and is never displayed in the
245 macros accept up to nine arguments, any
246 extra arguments are ignored.
249 accept nine arguments and,
250 in limited cases, arguments may be continued or extended
254 A few macros handle quoted arguments (see
255 .Sx Passing Space Characters in an Argument
260 general text domain and manual domain macros are special
261 in that their argument lists are
263 for callable macro names.
264 This means an argument on the argument list which matches
265 a general text or manual domain macro name and is determined
266 to be callable will be executed
267 or called when it is processed.
269 the argument, although the name of a macro,
273 It is in this manner that many macros are nested; for
279 the flag and argument macros,
283 to specify an optional flag with an argument:
284 .Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
287 .Li \&.Op \&Fl s \&Ar bytes
290 To prevent a two character
291 string from being interpreted as a macro name, precede
295 .Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
296 .It Op \&Fl s \&Ar bytes
298 .Li \&.Op \e&Fl s \e&Ar bytes
305 are not interpreted as macros.
306 Macros whose argument lists are parsed for callable arguments
308 as parsed and macros which may be called from an argument
309 list are referred to as callable
310 throughout this document and in the companion quick reference
315 as almost all of the macros in
317 are parsed, but as it was cumbersome to constantly refer to macros
318 as being callable and being able to call other macros,
319 the term parsed has been used.
320 .Ss Passing Space Characters in an Argument
321 Sometimes it is desirable to give as one argument a string
322 containing one or more blank space characters.
323 This may be necessary
324 to defeat the nine argument limit or to specify arguments to macros
325 which expect particular arrangement of items in the argument list.
329 expects the first argument to be the name of a function and any
330 remaining arguments to be function parameters.
333 stipulates the declaration of function parameters in the
334 parenthesized parameter list, each parameter is guaranteed
335 to be at minimum a two word string.
339 There are two possible ways to pass an argument which contains
341 .Em Implementation note :
342 Unfortunately, the most convenient way
343 of passing spaces in between quotes by reassigning individual
344 arguments before parsing was fairly expensive speed wise
345 and space wise to implement in all the macros for
348 It is not expensive for
350 but for the sake of portability, has been limited
351 to the following macros which need
354 .Bl -tag -width 4n -offset indent -compact
356 Configuration declaration (section 4
359 Begin list (for the width specifier).
363 Functions (sections two and four).
375 Optional notes for a reference.
377 Report title (in a reference).
379 Title of article in a book or journal.
382 One way of passing a string
383 containing blank spaces is to use the hard or unpaddable space character
385 that is, a blank space preceded by the escape character
387 This method may be used with any macro but has the side effect
388 of interfering with the adjustment of text
389 over the length of a line.
391 sees the hard space as if it were any other printable character and
392 cannot split the string into blank or newline separated pieces as one
394 The method is useful for strings which are not expected
395 to overlap a line boundary.
397 .Bl -tag -width "fetch(char *str)" -offset indent
398 .It Fn fetch char\ *str
400 .Ql \&.Fn fetch char\e *str
401 .It Fn fetch "char *str"
402 can also be created by
403 .Ql \&.Fn fetch "\\*qchar *str\\*q"
411 would see three arguments and
414 .Dl Fn fetch char *str
416 For an example of what happens when the parameter list overlaps
417 a newline boundary, see the
420 .Ss Trailing Blank Space Characters
422 can be confused by blank space characters at the end of a line.
424 is a wise preventive measure to globally remove all blank spaces
425 from <blank-space><end-of-line> character sequences.
427 arise to force a blank character at the end of a line,
428 it may be forced with an unpaddable space and the
433 .Ss Escaping Special Characters
435 like the newline character
437 are handled by replacing the
445 .Sh THE ANATOMY OF A MAN PAGE
446 The body of a man page is easily constructed from a basic
447 template found in the file
448 .Pa /usr/share/misc/mdoc.template .
449 Several example man pages can also be found
451 .Pa /usr/share/examples/mdoc .
453 .Ss A manual page template
454 .Bd -literal -offset indent
455 \&.\e" The following requests are required for all man pages.
456 \&.Dd Month day, year
457 \&.Os OPERATING_SYSTEM [version/release]
458 \&.Dt DOCUMENT_TITLE [section number] [volume]
461 \&.Nd one line description of name
464 \&.\e" The following requests should be uncommented and
465 \&.\e" used where appropriate. This next request is
466 \&.\e" for sections 2 and 3 function return values only.
467 \&.\e" .Sh RETURN VALUE
468 \&.\e" This next request is for sections 1, 6, 7 & 8 only
469 \&.\e" .Sh ENVIRONMENT
472 \&.\e" This next request is for sections 1, 6, 7 & 8 only
473 \&.\e" (command return values (to shell) and
474 \&.\e" fprintf/stderr type diagnostics)
475 \&.\e" .Sh DIAGNOSTICS
476 \&.\e" The next request is for sections 2 and 3 error
477 \&.\e" and signal handling only.
480 \&.\e" .Sh CONFORMING TO
486 The first items in the template are the macros
487 .Pq Li \&.Dd , \&.Os , \&.Dt ;
489 the operating system the man page or subject source is developed
491 and the man page title
493 along with the section of the manual the page
495 These macros identify the page,
496 and are discussed below in
499 The remaining items in the template are section headers
510 .Sx PAGE STRUCTURE DOMAIN ,
514 Several content macros are used to demonstrate page layout macros;
515 reading about content macros before page layout macros is
518 The title macros are the first portion of the page structure
519 domain, but are presented first and separate for someone who
520 wishes to start writing a man page yesterday.
521 Three header macros designate the document title or manual page title,
522 the operating system,
523 and the date of authorship.
524 These macros are one called once at the very beginning of the document
525 and are used to construct the headers and footers only.
527 .It Li \&.Dt DOCUMENT_TITLE section# [volume]
528 The document title is the
529 subject of the man page and must be in
533 The section number may be 1,\ ...,\ 8,
534 and if it is specified,
535 the volume title may be omitted.
536 A volume title may be arbitrary or one of the following:
538 .\" USD UNIX User's Supplementary Documents
540 .\" PS1 UNIX Programmer's Supplementary Documents
542 .Bl -column SMM -offset indent -compact
543 .It Li "AMD UNIX Ancestral Manual Documents"
544 .It Li "SMM UNIX System Manager's Manual"
545 .It Li "URM UNIX Reference Manual"
546 .It Li "PRM UNIX Programmer's Manual"
549 The default volume labeling is
551 for sections 1, 6, and 7;
555 for sections 2, 3, 4, and 5.
557 .\" MMI UNIX Manual Master Index
559 .\" CON UNIX Contributed Software Manual
561 .\" LOC UNIX Local Manual
562 .It Li \&.Os operating_system release#
563 The name of the operating system
564 should be the common acronym, for example,
570 The release should be the standard release
571 nomenclature for the system specified, for example, 4.3, 4.3+Tahoe, V.3,
573 Unrecognized arguments are displayed as given in the page footer.
574 For instance, a typical footer might be:
579 .Dl \&.Os FreeBSD 2.2
581 or for a locally produced set
583 .Dl \&.Os CS Department
585 The Berkeley default,
587 without an argument, has been defined as
591 .Pa /usr/share/tmac/mdoc/doc-common .
592 It really should default to
596 macro is not present, the bottom left corner of the page
598 .It Li \&.Dd month day, year
599 The date should be written formally:
604 .Sh INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS
605 .Ss What's in a name...
606 The manual domain macro names are derived from the day to day
607 informal language used to describe commands, subroutines and related
609 Slightly different variations of this language are used to describe
610 the three different aspects of writing a man page.
611 First, there is the description of
614 Second is the description of a
620 the description of a command to a user in the verbal sense;
621 that is, discussion of a command in the text of a man page.
625 macros are themselves a type of command;
626 the general syntax for a troff command is:
627 .Bd -filled -offset indent
628 \&.Va argument1 argument2 ... argument9
633 is a macro command or request, and anything following it is an argument to
638 command using the content macros is a
642 command line might be displayed as:
643 .Bd -filled -offset indent
651 is the command name and the
656 argument designated as optional by the option brackets.
666 The macros which formatted the above example:
667 .Bd -literal -offset indent
673 In the third case, discussion of commands and command syntax
674 includes both examples above, but may add more detail.
680 from the example above might be referred to as
684 Some command-line argument lists are quite long:
685 .Bl -tag -width make -offset indent
692 .Op Fl I Ar directory
695 .Op Ar variable=value
701 Here one might talk about the command
703 and qualify the argument
705 as an argument to the flag,
707 or discuss the optional
711 In the verbal context, such detail can prevent confusion,
715 does not have a macro for an argument
720 argument macro is used for an operand or file argument like
722 as well as an argument to a flag like
724 The make command line was produced from:
725 .Bd -literal -offset indent
728 \&.Op Fl D Ar variable
730 \&.Op Fl f Ar makefile
731 \&.Op Fl I Ar directory
732 \&.Op Fl j Ar max_jobs
733 \&.Op Ar variable=value
743 macros are explained in
746 The manual domain and general text domain macros share a similar
747 syntax with a few minor deviations:
753 differ only when called without arguments;
757 impose an order on their argument lists
763 have nesting limitations.
765 are capable of recognizing and properly handling punctuation,
766 provided each punctuation character is separated by a leading space.
767 If a request is given:
769 .Dl \&.Li sptr, ptr),
775 The punctuation is not recognized and all is output in the
776 literal font. If the punctuation is separated by a leading
779 .Dl \&.Li "sptr , ptr ) ,"
783 .Dl Li sptr , ptr ) ,
785 The punctuation is now recognized and is output in the
786 default font distinguishing it from the strings in literal font.
788 To remove the special meaning from a punctuation character
792 is limited as a macro language, and has difficulty
793 when presented with a string containing
794 a member of the mathematical, logical or
796 .Bd -literal -offset indent-two
797 \&{+,\-,/,*,\&%,<,>,<=,>=,=,==,&,`,',"}
802 may assume it is supposed to actually perform the operation
803 or evaluation suggested by the characters.
804 To prevent the accidental evaluation of these characters,
807 Typical syntax is shown in the first content macro displayed
812 The address macro identifies an address construct
813 of the form addr1[,addr2[,addr3]].
815 .Dl Usage: .Ad address ... \*(Pu
816 .Bl -tag -width "\&.Ad f1 , f2 , f3 :" -compact -offset 14n
819 .It Li \&.Ad addr1\ .
821 .It Li \&.Ad addr1\ , file2
823 .It Li \&.Ad f1\ , f2\ , f3\ :
825 .It Li \&.Ad addr\ )\ )\ ,
829 It is an error to call
833 is callable by other macros and is parsed.
837 macro is used to specify the name of the author of the item being
838 documented, or the name of the author of the actual manual page.
839 Any remaining arguments after the name information are assumed
842 .Dl Usage: .An author_name \*(Pu
843 .Bl -tag -width "\&.An Joe Author ) ) ," -compact -offset 14n
844 .It Li \&.An Joe\ Author
846 .It Li \&.An Joe\ Author\ ,
848 .It Li \&.An Joe\ Author\ \&Aq\ nobody@FreeBSD.ORG
849 .An Joe Author Aq nobody@FreeBSD.ORG
850 .It Li \&.An Joe\ Author\ )\ )\ ,
856 macro is parsed and is callable.
857 It is an error to call
864 argument macro may be used whenever
865 a command-line argument is referenced.
867 .Dl Usage: .Ar argument ... \*(Pu
868 .Bl -tag -width "\&.Ar file1 file2" -compact -offset 15n
873 .It Li \&.Ar file1\ .
875 .It Li \&.Ar file1 file2
877 .It Li \&.Ar f1 f2 f3\ :
879 .It Li \&.Ar file\ )\ )\ ,
885 is called without arguments,
890 macro is parsed and is callable.
891 .Ss Configuration Declaration (section four only)
894 macro is used to demonstrate a
896 declaration for a device interface in a section four manual.
897 This macro accepts quoted arguments (double quotes only).
899 .Bl -tag -width "device le0 at scode?" -offset indent
900 .It Cd "device le0 at scode?"
902 .Ql ".Cd device le0 at scode?" .
905 The command modifier is identical to the
907 (flag) command with the exception
910 macro does not assert a dash
911 in front of every argument.
912 Traditionally flags are marked by the
913 preceding dash, some commands or subsets of commands do not use them.
914 Command modifiers may also be specified in conjunction with interactive
915 commands such as editor commands.
918 .Ss Defined Variables
919 A variable which is defined in an include file is specified
923 .Dl Usage: .Dv defined_variable ... \*(Pu
924 .Bl -tag -width "\&.Dv MAXHOSTNAMELEN" -compact -offset 14n
925 .It Li ".Dv MAXHOSTNAMELEN"
927 .It Li ".Dv TIOCGPGRP )"
931 It is an error to call
935 is parsed and is callable.
936 .Ss Errno's (Section two only)
939 errno macro specifies the error return value
940 for section two library routines.
946 general text domain macro, as it would be used in
947 a section two manual page.
949 .Dl Usage: .Er ERRNOTYPE ... \*(Pu
950 .Bl -tag -width "\&.Bq Er ENOTDIR" -compact -offset 14n
953 .It Li \&.Er ENOENT\ )\ ;
955 .It Li \&.Bq \&Er ENOTDIR
959 It is an error to call
964 macro is parsed and is callable.
965 .Ss Environment Variables
968 macro specifies an environment variable.
970 .Dl Usage: .Ev argument ... \*(Pu
971 .Bl -tag -width "\&.Ev PRINTER ) ) ," -compact -offset 14n
976 .It Li \&.Ev PRINTER\ )\ )\ ,
980 It is an error to call
985 macro is parsed and is callable.
986 .Ss Function Argument
989 macro is used to refer to function arguments (parameters)
992 section of the manual or inside
995 section should a parameter list be too
998 macro and the enclosure macros
1004 may also be used to refer to structure members.
1006 .Dl Usage: .Fa function_argument ... \*(Pu
1007 .Bl -tag -width "\&.Fa d_namlen\ )\ )\ ," -compact -offset 14n
1008 .It Li \&.Fa d_namlen\ )\ )\ ,
1010 .It Li \&.Fa iov_len
1014 It is an error to call
1018 is parsed and is callable.
1019 .Ss Function Declaration
1022 macro is used in the
1024 section with section two or three
1028 macro does not call other macros and is not callable by other
1031 .Dl Usage: .Fd include_file (or defined variable)
1037 request causes a line break if a function has already been presented
1038 and a break has not occurred.
1039 This leaves a nice vertical space
1040 in between the previous function call and the declaration for the
1045 macro handles command-line flags.
1050 For interactive command flags, which
1051 are not prepended with a dash, the
1054 macro is identical, but without the dash.
1056 .Dl Usage: .Fl argument ... \*(Pu
1057 .Bl -tag -width "\&.Fl \-s \-t \-v" -compact -offset 14n
1068 .It Li \&.Fl xyz\ )\ ,
1074 macro without any arguments results
1075 in a dash representing \fIstdin\fP/\fIstdout\fP.
1078 a single dash, will result in two dashes.
1081 macro is parsed and is callable.
1082 .Ss Functions (library routines)
1083 The .Fn macro is modeled on ANSI C conventions.
1085 Usage: .Fn [type] function [[type] parameters ... \*(Pu]
1087 .Bl -tag -width "\&.Fn _int align_ _const * char *sptrsxx" -compact
1088 .It Li "\&.Fn getchar"
1090 .It Li "\&.Fn strlen ) ,"
1092 .It Li \&.Fn "\\*qint align\\*q" "\\*qconst * char *sptrs\\*q" ,
1093 .Fn "int align" "const * char *sptrs" ,
1096 It is an error to call
1098 without any arguments.
1102 is parsed and is callable,
1103 note that any call to another macro signals the end of
1106 call (it will close-parenthesis at that point).
1108 For functions that have more than eight parameters (and this
1119 to get around the limitation.
1121 .Bd -literal -offset indent
1122 \&.Fo "int res_mkquery"
1129 \&.Fa "struct rrec *newrr"
1136 .Bd -filled -offset indent
1137 .Fo "int res_mkquery"
1144 .Fa "struct rrec *newrr"
1154 macros are parsed and are callable.
1157 section, the function will always begin at
1158 the beginning of line.
1159 If there is more than one function
1162 section and a function type has not been
1163 given, a line break will occur, leaving a nice vertical space
1164 between the current function name and the one prior.
1167 does not check its word boundaries
1168 against troff line lengths and may split across a newline
1170 This will be fixed in the near future.
1172 This macro is intended for the
1176 anywhere else in the man page without problems, but its main purpose
1177 is to present the function type in kernel normal form for the
1179 of sections two and three
1180 (it causes a line break allowing the function name to appear
1183 .Dl Usage: .Ft type ... \*(Pu
1184 .Bl -tag -width "\&.Ft struct stat" -offset 14n -compact
1185 .It Li \&.Ft struct stat
1191 request is not callable by other macros.
1192 .Ss Interactive Commands
1195 macro designates an interactive or internal command.
1197 .Dl Usage: .Ic argument ... \*(Pu
1198 .Bl -tag -width "\&.Ic setenv , unsetenvxx" -compact -offset 14n
1201 .It Li \&.Ic do while {...}
1203 .It Li \&.Ic setenv\ , unsetenv
1204 .Ic setenv , unsetenv
1207 It is an error to call
1212 macro is parsed and is callable.
1216 macro is used for the document title or subject name.
1217 It has the peculiarity of remembering the first
1218 argument it was called with, which should
1219 always be the subject name of the page.
1223 regurgitates this initial name for the sole purpose
1224 of making less work for the author.
1227 or three document function name is addressed with the
1235 and remaining sections.
1236 For interactive commands, such as the
1242 macro should be used.
1248 it can not recall the first argument it was invoked with.
1250 .Dl Usage: .Nm argument ... \*(Pu
1251 .Bl -tag -width "\&.Nm mdoc.sample" -compact -offset 14n
1252 .It Li \&.Nm mdoc.sample
1254 .It Li \&.Nm \e-mdoc
1256 .It Li \&.Nm foo\ )\ )\ ,
1264 macro is parsed and is callable.
1269 places option brackets around the any remaining arguments on the command
1270 line, and places any
1271 trailing punctuation outside the brackets.
1276 may be used across one or more lines.
1278 .Dl Usage: .Op options ... \*(Pu
1279 .Bl -tag -width "\&.Op Fl c Ar objfil Op Ar corfil ," -compact -offset indent
1284 .It Li ".Op Fl k ) ."
1286 .It Li ".Op Fl k Ar kookfile"
1287 .Op Fl k Ar kookfile
1288 .It Li ".Op Fl k Ar kookfile ,"
1289 .Op Fl k Ar kookfile ,
1290 .It Li ".Op Ar objfil Op Ar corfil"
1291 .Op Ar objfil Op Ar corfil
1292 .It Li ".Op Fl c Ar objfil Op Ar corfil ,"
1293 .Op Fl c Ar objfil Op Ar corfil ,
1294 .It Li \&.Op word1 word2
1303 .Bd -literal -offset indent
1305 \&.Op \&Fl k \&Ar kilobytes
1306 \&.Op \&Fl i \&Ar interval
1307 \&.Op \&Fl c \&Ar count
1313 .Op Fl k Ar kilobytes
1314 .Op Fl i Ar interval
1323 are parsed and are callable.
1327 macro formats pathnames or filenames.
1329 .Dl Usage: .Pa pathname \*(Pu
1330 .Bl -tag -width "\&.Pa /tmp/fooXXXXX ) ." -compact -offset 14n
1331 .It Li \&.Pa /usr/share
1333 .It Li \&.Pa /tmp/fooXXXXX\ )\ .
1334 .Pa /tmp/fooXXXXX ) .
1339 macro is parsed and is callable.
1341 Generic variable reference:
1343 .Dl Usage: .Va variable ... \*(Pu
1344 .Bl -tag -width "\&.Va char s ] ) ) ," -compact -offset 14n
1347 .It Li \&.Va settimer ,
1349 .It Li \&.Va int\ *prt\ )\ :
1351 .It Li \&.Va char\ s\ ]\ )\ )\ ,
1355 It is an error to call
1357 without any arguments.
1360 macro is parsed and is callable.
1361 .Ss Manual Page Cross References
1364 macro expects the first argument to be
1365 a manual page name, and the second argument, if it exists,
1366 to be either a section page number or punctuation.
1368 remaining arguments are assumed to be punctuation.
1370 .Dl Usage: .Xr man_page [1,...,8] \*(Pu
1371 .Bl -tag -width "\&.Xr mdoc 7 ) ) ," -compact -offset 14n
1374 .It Li \&.Xr mdoc\ ,
1378 .It Li \&.Xr mdoc 7\ )\ )\ ,
1384 macro is parsed and is callable.
1385 It is an error to call
1389 .Sh GENERAL TEXT DOMAIN
1391 .Bd -literal -offset indent -compact
1392 Usage: .At [v6 | v7 | 32v | V.1 | V.4] ... \*(Pu
1394 .Bl -tag -width "\&.At v6 ) ," -compact -offset 14n
1408 It accepts at most two arguments.
1410 .Dl Usage: .Bx [Version/release] ... \*(Pu
1411 .Bl -tag -width "\&.Bx 4.3 ) ," -compact -offset 14n
1420 macro is parsed and is callable.
1422 .Bd -literal -offset indent -compact
1423 Usage: .Fx Version.release ... \*(Pu
1425 .Bl -tag -width "\&.Fx 2.2 ) ," -compact -offset 14n
1437 It accepts at most two arguments.
1439 .Dl Usage: .Ux ... \*(Pu
1440 .Bl -tag -width "\&.Ux 4.3 ) ," -compact -offset 14n
1447 macro is parsed and is callable.
1448 .Ss Enclosure and Quoting Macros
1449 The concept of enclosure is similar to quoting.
1450 The object being to enclose one or more strings between
1451 a pair of characters like quotes or parentheses.
1452 The terms quoting and enclosure are used
1453 interchangeably throughout this document.
1455 one line enclosure macros end
1458 to give a hint of quoting, but there are a few irregularities.
1459 For each enclosure macro
1460 there is also a pair of open and close macros which end
1466 These can be used across one or more lines of text
1467 and while they have nesting limitations, the one line quote macros
1472 .Bd -filled -offset indent
1473 .Bl -column "quote " "close " "open " "Enclose Stringx(in XX) " XXstringXX
1474 .Em " Quote Close Open Function Result"
1475 \&.Aq .Ac .Ao Angle Bracket Enclosure <string>
1476 \&.Bq .Bc .Bo Bracket Enclosure [string]
1477 \&.Dq .Dc .Do Double Quote ``string''
1478 .Ec .Eo Enclose String (in XX) XXstringXX
1479 \&.Pq .Pc .Po Parenthesis Enclosure (string)
1480 \&.Ql Quoted Literal `st' or string
1481 \&.Qq .Qc .Qo Straight Double Quote "string"
1482 \&.Sq .Sc .So Single Quote `string'
1486 Except for the irregular macros noted below, all
1487 of the quoting macros are parsed and callable.
1488 All handle punctuation properly, as long as it
1489 is presented one character at a time and separated by spaces.
1490 The quoting macros examine opening and closing punctuation
1491 to determine whether it comes before or after the
1493 This makes some nesting possible.
1494 .Bl -tag -width xxx,xxxx
1495 .It Li \&.Ec , \&.Eo
1496 These macros expect the first argument to be the
1497 opening and closing strings respectively.
1499 The quoted literal macro behaves differently for
1505 a quoted literal is always quoted.
1507 troff, an item is quoted only if the width
1508 of the item is less than three constant width characters.
1509 This is to make short strings more visible where the font change
1510 to literal (constant width) is less noticeable.
1512 The prefix macro is not callable, but it is parsed:
1513 .Bl -tag -width "(namexx" -offset indent
1514 .It Li ".Pf ( Fa name2"
1521 (no space) macro performs the analogous suffix function.
1525 Examples of quoting:
1526 .Bl -tag -width "\&.Aq Pa ctype.h ) ,xxxxxxxx" -compact -offset indent
1529 .It Li \&.Aq \&Ar ctype.h\ )\ ,
1533 .It Li \&.Bq \&Em Greek \&, French \&.
1534 .Bq Em Greek , French .
1537 .It Li ".Dq string abc ."
1539 .It Li ".Dq \'^[A-Z]\'"
1541 .It Li "\&.Ql man mdoc"
1545 .It Li "\&.Qq string ) ,"
1547 .It Li "\&.Qq string Ns ),"
1551 .It Li "\&.Sq string
1555 For a good example of nested enclosure macros, see the
1558 It was created from the same
1559 underlying enclosure macros as those presented in the list
1565 extended argument list macros
1566 were also built from the same underlying routines and are a good
1569 macro usage at its worst.
1570 .Ss No\-Op or Normal Text Macro
1574 a hack for words in a macro command line which should
1576 be formatted and follows the conventional syntax
1581 macro eliminates unwanted spaces in between macro requests.
1582 It is useful for old style argument lists where there is no space
1583 between the flag and argument:
1584 .Bl -tag -width "\&.Op Fl I Ns Ar directoryxx" -offset indent
1585 .It Li ".Op Fl I Ns Ar directory"
1587 .Op Fl I Ns Ar directory
1592 macro always invokes the
1594 macro after eliminating the space unless another macro name
1598 is parsed and is callable.
1599 .Ss Section Cross References
1602 macro designates a reference to a section header
1603 within the same document.
1604 It is parsed and is callable.
1606 .Bl -tag -width "Li \&.Sx FILES" -offset 14n
1610 .Ss References and Citations
1611 The following macros make a modest attempt to handle references.
1612 At best, the macros make it convenient to manually drop in a subset of
1613 refer style references.
1615 .Bl -tag -width 6n -offset indent -compact
1618 Causes a line break and begins collection
1619 of reference information until the
1620 reference end macro is read.
1623 The reference is printed.
1625 Reference author name, one name per invocation.
1637 Optional information.
1648 The macros beginning with
1650 are not callable, and are parsed only for the trade name macro which
1651 returns to its caller.
1652 (And not very predictably at the moment either.)
1653 The purpose is to allow trade names
1654 to be pretty printed in
1655 .Xr troff Ns / Ns Xr ditroff
1660 macro generates text for use in the
1664 .Dl Usage: .Rv [-std function]
1666 .Ql \&.Rv -std atexit
1667 will generate the following text:
1669 .\" fake section 3 to avoid error message from Rv
1673 .\" and back to 7 again
1679 option is valid only for manual page sections 2 and 3.
1680 .Ss Trade Names (or Acronyms and Type Names)
1681 The trade name macro is generally a small caps macro for
1682 all uppercase words longer than two characters.
1684 .Dl Usage: .Tn symbol ... \*(Pu
1685 .Bl -tag -width "\&.Tn ASCII" -compact -offset 14n
1695 is parsed and is callable by other macros.
1696 .Ss Extended Arguments
1701 macros allow one to extend an argument list
1702 on a macro boundary.
1703 Argument lists cannot
1704 be extended within a macro
1705 which expects all of its arguments on one line such
1709 Here is an example of
1711 using the space mode macro to turn spacing off:
1712 .Bd -literal -offset indent
1714 \&.It Xo Sy I Ar operation
1715 \&.No \een Ar count No \een
1721 .Bd -filled -offset indent
1722 .Bl -tag -width flag -compact
1724 .It Xo Sy I Ar operation
1725 .No \en Ar count No \en
1732 .Bd -literal -offset indent
1734 \&.It Cm S No \&/ Ar old_pattern Xo
1735 \&.No \&/ Ar new_pattern
1742 .Bd -filled -offset indent
1743 .Bl -tag -width flag -compact
1745 .It Cm S No \&/ Ar old_pattern Xo
1746 .No \&/ Ar new_pattern
1755 and using enclosure macros:
1756 Test the value of a variable.
1757 .Bd -literal -offset indent
1760 \&.Oo \e&! Oc Ns Ar variable
1761 \&.Op Ar operator variable ...
1766 .Bd -filled -offset indent
1767 .Bl -tag -width flag -compact
1770 .Oo \&! Oc Ns Ar variable
1771 .Op Ar operator variable ...
1776 All of the above examples have used the
1778 macro on the argument list of the
1782 The extend macros are not used very often, and when they are
1783 it is usually to extend the list-item argument list.
1784 Unfortunately, this is also where the extend macros are the
1786 In the first two examples, spacing was turned off;
1787 in the third, spacing was desired in part of the output but
1789 To make these macros work in this situation make sure
1794 macros are placed as shown in the third example.
1797 macro is not alone on the
1799 argument list, spacing will be unpredictable.
1803 must not occur as the first or last macro on a line
1805 Out of 900 manual pages (about 1500 actual pages)
1806 currently released with
1808 only fifteen use the
1811 .Sh PAGE STRUCTURE DOMAIN
1815 section header macros
1816 list below are required in every
1818 The remaining section headers
1819 are recommended at the discretion of the author
1820 writing the manual page.
1823 macro can take up to nine arguments.
1824 It is parsed and but is not callable.
1825 .Bl -tag -width "\&.Sh SYNOPSIS"
1831 the headers, footers and page layout defaults
1832 will not be set and things will be rather unpleasant.
1835 section consists of at least three items.
1838 name macro naming the subject of the man page.
1839 The second is the Name Description macro,
1841 which separates the subject
1842 name from the third item, which is the description.
1844 description should be the most terse and lucid possible,
1845 as the space available is small.
1849 section describes the typical usage of the
1850 subject of a man page.
1866 for manual page sections 2 and 3, the command and general
1869 is required for sections 1, 5, 6, 7, 8.
1870 Section 4 manuals require a
1875 configuration device usage macro.
1876 Several other macros may be necessary to produce
1877 the synopsis line as shown below:
1880 .Bd -filled -offset indent
1887 The following macros were used:
1890 .Dl \&.Op \&Fl benstuv
1900 recognize the pipe bar character
1902 so a command line such as:
1904 .Dl ".Op Fl a | Fl b"
1906 will not go orbital.
1908 normally interprets a \*(Ba as a special operator.
1910 .Sx PREDEFINED STRINGS
1912 character in other situations.
1914 .It \&.Sh DESCRIPTION
1915 In most cases the first text in the
1918 is a brief paragraph on the command, function or file,
1919 followed by a lexical list of options and respective
1921 To create such a list, the
1928 macros are used (see
1929 .Sx Lists and Columns
1935 section headers are part of the
1936 preferred manual page layout and must be used appropriately
1937 to maintain consistency.
1938 They are listed in the order
1939 in which they would be used.
1940 .Bl -tag -width SYNOPSIS
1941 .It \&.Sh ENVIRONMENT
1944 section should reveal any related
1946 variables and clues to their behavior and/or usage.
1948 There are several ways to create examples.
1955 Files which are used or created by the man page subject
1956 should be listed via the
1962 References to other material on the man page topic and
1963 cross references to other relevant man pages should
1968 are specified using the
1971 Cross references in the
1973 section should be sorted by section number, and then
1974 placed in alphabetical order and comma separated. For example:
1983 style references are not accommodated.
1984 .It \&.Sh CONFORMING TO
1985 If the command, library function or file adheres to a
1986 specific implementation such as
1990 this should be noted here.
1992 command does not adhere to any standard, its history
1993 should be noted in the
1997 Any command which does not adhere to any specific standards
1998 should be outlined historically in this section.
2000 Credits, if need be, should be placed here.
2001 .It \&.Sh DIAGNOSTICS
2002 Diagnostics from a command should be placed in this section.
2004 Specific error handling, especially from library functions
2005 (man page sections 2 and 3) should go here.
2008 macro is used to specify an errno.
2010 Blatant problems with the topic go here...
2015 sections may be added,
2016 for example, this section was set with:
2017 .Bd -literal -offset 14n
2018 \&.Sh PAGE STRUCTURE DOMAIN
2020 .Ss Paragraphs and Line Spacing.
2025 paragraph command may
2026 be used to specify a line space where necessary.
2027 The macro is not necessary after a
2037 macro asserts a vertical distance unless the -compact flag is given).
2039 .\" This worked with version one, need to redo for version three
2042 .\" .Cw (ax+bx+c) \ is\ produced\ by\ \&
2043 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2060 .\" .Em is produced by
2076 .\" This example shows the same equation in a different format.
2080 .\" signs were forced with
2084 .\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&
2085 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2096 .\" .Li \&.Cx \e\ +\e\ \e&
2107 .\" .Em is produced by
2115 .\" .Li \&.Cx \e\ +\e\ \e&
2126 .\" The incantation below was
2132 .\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by
2134 .\" .Li \&.Cx Op Sy ?/
2144 .\" .Em is produced by
2146 .\" .Li \&.Ar \e\ b1 e1 f1
2158 The only keep that is implemented at this time is for words.
2165 The only option that
2169 and is useful for preventing line breaks in the middle of options.
2170 In the example for the make command-line arguments (see
2171 .Sx What's in a name ) ,
2175 flag and the argument
2177 (Actually, the option macro used to prevent this from occurring,
2178 but was dropped when the decision (religious) was made to force
2179 right justified margins in
2181 as options in general look atrocious when spread across a sparse
2183 More work needs to be done with the keep macros, a
2185 option needs to be added.)
2186 .Ss Examples and Displays
2187 There are five types of displays, a quickie one line indented display
2189 a quickie one line literal display
2191 and a block literal, block filled and block ragged which use
2199 .Bl -tag -width \&.Dlxx
2201 (D-one) Display one line of indented text.
2202 This macro is parsed, but it is not callable.
2206 The above was produced by:
2207 .Li \&.Dl Fl ldghfstru .
2210 Display one line of indented
2215 example macro has been used throughout this
2218 the indent (display) of one line of text.
2219 Its default font is set to
2220 constant width (literal) however
2221 it is parsed and will recognized other macros.
2222 It is not callable however.
2224 .Dl % ls -ldg /usr/local/bin
2226 The above was produced by
2227 .Li \&.Dl % ls -ldg /usr/local/bin .
2232 display must be ended with the
2235 Displays may be nested within displays and
2238 has the following syntax:
2240 .Dl ".Bd display-type [-offset offset_value] [-compact]"
2242 The display-type must be one of the following four types and
2243 may have an offset specifier for indentation:
2247 .Bl -tag -width "file file_name " -compact
2249 Display a block of text as typed,
2250 right (and left) margin edges are left ragged.
2252 Display a filled (formatted) block.
2253 The block of text is formatted (the edges are filled \-
2254 not left unjustified).
2256 Display a literal block, useful for source code or
2257 simple tabbed or spaced text.
2258 .It Fl file Ar file_name
2259 The filename following the
2261 flag is read and displayed.
2263 asserted and tabs are set at 8 constant width character
2264 intervals, however any
2265 .Xr troff/ Ns Nm \-mdoc
2266 commands in file will be processed.
2267 .It Fl offset Ar string
2270 is specified with one of the following strings, the string
2271 is interpreted to indicate the level of indentation for the
2272 forthcoming block of text:
2274 .Bl -tag -width "indent-two" -compact
2276 Align block on the current left margin,
2277 this is the default mode of
2280 Supposedly center the block.
2282 unfortunately, the block merely gets
2283 left aligned about an imaginary center margin.
2285 Indents by one default indent value or tab.
2287 indent value is also used for the
2289 display so one is guaranteed the two types of displays
2291 This indent is normally set to 6n or about two
2292 thirds of an inch (six constant width characters).
2294 Indents two times the default indent value.
2298 aligns the block about two inches from
2299 the right side of the page.
2301 work and perhaps may never do the right thing by
2308 There are five macros for changing the appearance of the manual page text:
2309 .Bl -tag -width \&.Emxx
2311 Text may be stressed or emphasized with the
2314 The usual font for emphasis is italic.
2316 .Dl Usage: .Em argument ... \*(Pu
2317 .Bl -tag -width "\&.Em vide infra ) ) ," -compact -offset 14n
2318 .It Li ".Em does not"
2320 .It Li ".Em exceed 1024 ."
2322 .It Li ".Em vide infra ) ) ,"
2323 .Em vide infra ) ) ,
2328 macro is parsed and is callable.
2329 It is an error to call
2335 literal macro may be used for special characters,
2336 variable constants, anything which should be displayed as it
2339 .Dl Usage: .Li argument ... \*(Pu
2340 .Bl -tag -width "\&.Li cntrl-D ) ," -compact -offset 14n
2343 .It Li \&.Li M1 M2 M3\ ;
2345 .It Li \&.Li cntrl-D\ )\ ,
2347 .It Li \&.Li 1024\ ...
2353 macro is parsed and is callable.
2355 The symbolic emphasis macro is generally a boldface macro in
2356 either the symbolic sense or the traditional English usage.
2358 .Dl Usage: .Sy symbol ... \*(Pu
2359 .Bl -tag -width "\&.Sy Important Noticex" -compact -offset 14n
2360 .It Li \&.Sy Important Notice
2361 .Sy Important Notice
2365 macro is parsed and is callable.
2374 font mode must be ended with the
2377 Font modes may be nested within other font modes.
2379 has the following syntax:
2383 The font-mode must be one of the following three types:
2386 .Bl -tag -width "file file_name " -compact
2387 .It Sy \&Em | Fl emphasis
2390 macro was used for the entire block of text.
2391 .It Sy \&Li | Fl literal
2394 macro was used for the entire block of text.
2395 .It Sy \&Sy | Fl symbolic
2398 macro was used for the entire block of text.
2403 .Ss Tagged Lists and Columns
2404 There are several types of lists which may be initiated with the
2407 Items within the list
2408 are specified with the
2411 each list must end with the
2414 Lists may be nested within themselves and within displays.
2415 Columns may be used inside of lists, but lists are unproven
2418 In addition, several list attributes may be specified such as
2419 the width of a tag, the list offset, and compactness
2420 (blank lines between items allowed or disallowed).
2421 Most of this document has been formatted with a tag style list
2423 For a change of pace, the list-type used to present the list-types
2424 is an over-hanging list
2426 This type of list is quite popular with
2428 users, but might look a bit funny after having read many pages of
2430 The following list types are accepted by
2437 These three are the simplest types of lists.
2440 macro has been given, items in the list are merely
2441 indicated by a line consisting solely of the
2444 For example, the source text for a simple enumerated list
2446 .Bd -literal -offset indent-two
2447 \&.Bl -enum -compact
2449 \&Item one goes here.
2451 \&And item two here.
2453 \&Lastly item three goes here.
2460 .Bl -enum -offset indent-two -compact
2466 Lastly item three goes here.
2469 A simple bullet list construction:
2470 .Bd -literal -offset indent-two
2471 \&.Bl -bullet -compact
2473 \&Bullet one goes here.
2480 .Bl -bullet -offset indent-two -compact
2482 Bullet one goes here.
2493 These list-types collect arguments specified with the
2495 macro and create a label which may be
2497 into the forthcoming text,
2499 from the forthcoming text,
2501 from above and not indented or
2504 list was constructed with the
2509 macro is parsed only for the inset, hang
2510 and tag list-types and is not callable.
2511 Here is an example of inset labels:
2513 .Bl -inset -offset indent
2515 The tagged list (also called a tagged paragraph) is the
2516 most common type of list used in the Berkeley manuals.
2518 Diag lists create section four diagnostic lists
2519 and are similar to inset lists except callable
2522 Hanged labels are a matter of taste.
2524 Overhanging labels are nice when space is constrained.
2526 Inset labels are useful for controlling blocks of
2527 paragraphs and are valuable for converting
2529 manuals to other formats.
2532 Here is the source text which produced the above example:
2533 .Bd -literal -offset indent
2534 \&.Bl -inset -offset indent
2536 \&The tagged list (also called a tagged paragraph) is the
2537 \&most common type of list used in the Berkeley manuals.
2539 \&Diag lists create section four diagnostic lists
2540 \&and are similar to inset lists except callable
2541 \¯os are ignored.
2543 \&Hanged labels are a matter of taste.
2545 \&Overhanging labels are nice when space is constrained.
2547 \&Inset labels are useful for controlling blocks of
2548 \¶graphs and are valuable for converting
2550 \&manuals to other formats.
2554 Here is a hanged list with two items:
2555 .Bl -hang -offset indent
2557 labels appear similar to tagged lists when the
2558 label is smaller than the label width.
2559 .It Em Longer hanged list labels
2560 blend in to the paragraph unlike
2561 tagged paragraph labels.
2564 And the unformatted text which created it:
2565 .Bd -literal -offset indent
2566 \&.Bl -hang -offset indent
2568 \&labels appear similar to tagged lists when the
2569 \&label is smaller than the label width.
2570 \&.It Em Longer hanged list labels
2571 \&blend in to the paragraph unlike
2572 \&tagged paragraph labels.
2576 The tagged list which follows uses an optional width specifier to control
2577 the width of the tag.
2579 .Bl -tag -width "PAGEIN" -compact -offset indent
2581 sleep time of the process (seconds blocked)
2585 resulting from references
2586 by the process to pages not loaded in core.
2588 numerical user-id of process owner
2590 numerical ID of parent of process process priority
2591 (nonpositive when in noninterruptible wait)
2595 .Bd -literal -offset indent
2596 \&.Bl -tag -width "PAGEIN" -compact -offset indent
2598 \&sleep time of the process (seconds blocked)
2602 \&resulting from references
2603 \&by the process to pages not loaded in core.
2605 \&numerical user ID of process owner
2607 \&numerical ID of parent of process process priority
2608 \&(nonpositive when in noninterruptible wait)
2612 Acceptable width specifiers:
2613 .Bl -tag -width Ar -offset indent
2614 .It Fl width Ar "\&Fl"
2615 sets the width to the default width for a flag.
2617 macros have a default width value.
2621 set to ten constant width characters or about five sixth of
2623 .It Fl width Ar "24n"
2624 sets the width to 24 constant width characters or about two
2628 is absolutely necessary for the scaling to work correctly.
2629 .It Fl width Ar "ENAMETOOLONG"
2630 sets width to the constant width length of the
2632 .It Fl width Ar "\\*qint mkfifo\\*q"
2633 again, the width is set to the constant width of the string
2637 If a width is not specified for the tag list type, the first
2640 is invoked, an attempt is made to determine an appropriate
2642 If the first argument to
2644 is a callable macro, the default width for that macro will be used
2645 as if the macro name had been supplied as the width.
2647 if another item in the list is given with a different callable
2648 macro name, a new and nested list is assumed.
2649 .Sh PREDEFINED STRINGS
2650 The following strings are predefined as may be used by
2651 preceding with the troff string interpreting sequence
2655 is the name of the defined string or as
2659 is the name of the string.
2660 The interpreting sequence may be used any where in the text.
2662 .Bl -column "String " "Nroff " "Troff " -offset indent
2663 .It Sy "String Nroff Troff"
2664 .It Li "<=" Ta \&<\&= Ta \*(<=
2665 .It Li ">=" Ta \&>\&= Ta \*(>=
2666 .It Li "Rq" Ta "''" Ta \*(Rq
2667 .It Li "Lq" Ta "``" Ta \*(Lq
2668 .It Li "ua" Ta ^ Ta \*(ua
2669 .It Li "aa" Ta ' Ta \*(aa
2670 .It Li "ga" Ta \` Ta \*(ga
2671 .\" .It Li "sL" Ta ` Ta \*(sL
2672 .\" .It Li "sR" Ta ' Ta \*(sR
2673 .It Li "q" Ta \&" Ta \*q
2674 .It Li "Pi" Ta pi Ta \*(Pi
2675 .It Li "Ne" Ta != Ta \*(Ne
2676 .It Li "Le" Ta <= Ta \*(Le
2677 .It Li "Ge" Ta >= Ta \*(Ge
2678 .It Li "Lt" Ta < Ta \*(Gt
2679 .It Li "Gt" Ta > Ta \*(Lt
2680 .It Li "Pm" Ta +- Ta \*(Pm
2681 .It Li "If" Ta infinity Ta \*(If
2682 .It Li "Na" Ta \fINaN\fP Ta \*(Na
2683 .It Li "Ba" Ta \fR\&|\fP Ta \*(Ba
2689 should be written as
2691 since it is only one char.
2693 The debugging facilities for
2695 are limited, but can help detect subtle errors such
2696 as the collision of an argument name with an internal
2697 register or macro name.
2699 A register is an arithmetic storage class for
2701 with a one or two character name.
2702 All registers internal to
2708 are two characters and
2709 of the form <upper_case><lower_case> such as
2711 <lower_case><upper_case> as
2714 <upper or lower letter><digit> as
2716 And adding to the muddle,
2718 has its own internal registers all of which are either
2719 two lowercase characters or a dot plus a letter or metacharacter
2721 In one of the introduction examples, it was shown how to
2722 prevent the interpretation of a macro name with the escape sequence
2724 This is sufficient for the internal register names also.
2726 .\" Every callable macro name has a corresponding register
2727 .\" of the same name (<upper_case><lower_case>).
2728 .\" There are also specific registers which have
2729 .\" been used for stacks and arrays and are listed in the
2731 .\" .Bd -ragged -offset 4n
2732 .\" [A-Z][a-z] registers corresponding to macro names (example ``Ar'')
2733 .\" [a-z][A-Z] registers corresponding to macro names (example ``aR'')
2734 .\" C[0-9] argument types (example C1)
2735 .\" O[0-9] offset stack (displays)
2736 .\" h[0-9] horizontal spacing stack (lists)
2737 .\" o[0-9] offset (stack) (lists)
2738 .\" t[0-9] tag stack (lists)
2739 .\" v[0-9] vertical spacing stack (lists)
2740 .\" w[0-9] width tag/label stack
2743 If a nonescaped register name is given in the argument list of a request,
2744 unpredictable behavior will occur.
2745 In general, any time huge portions
2746 of text do not appear where expected in the output, or small strings
2747 such as list tags disappear, chances are there is a misunderstanding
2748 about an argument type in the argument list.
2749 Your mother never intended for you to remember this evil stuff - so here
2750 is a way to find out whether or not your arguments are valid: The
2753 macro displays the interpretation of the argument list for most
2758 macro do not contain debugging information.
2759 All of the callable macros do,
2760 and it is strongly advised whenever in doubt,
2765 .Dl Usage: \&.Db [on | off]
2767 An example of a portion of text with
2768 the debug macro placed above and below an
2769 artificially created problem (a flag argument
2774 .Bd -literal -offset indent
2776 \&.Op Fl aC Ar file )
2780 The resulting output:
2781 .Bd -literal -offset indent
2783 DEBUG(argv) MACRO: `.Op' Line #: 2
2784 Argc: 1 Argv: `Fl' Length: 2
2785 Space: `' Class: Executable
2786 Argc: 2 Argv: `aC' Length: 2
2787 Space: `' Class: Executable
2788 Argc: 3 Argv: `Ar' Length: 2
2789 Space: `' Class: Executable
2790 Argc: 4 Argv: `file' Length: 4
2791 Space: ` ' Class: String
2792 Argc: 5 Argv: `)' Length: 1
2793 Space: ` ' Class: Closing Punctuation or suffix
2794 MACRO REQUEST: .Op Fl aC Ar file )
2798 The first line of information tells the name of the calling
2801 and the line number it appears on.
2802 If one or more files are involved
2803 (especially if text from another file is included), the line number
2805 If there is only one file, it should be accurate.
2806 The second line gives the argument count, the argument
2809 If the length of an argument is two characters, the
2810 argument is tested to see if it is executable (unfortunately, any
2811 register which contains a nonzero value appears executable).
2812 The third line gives the space allotted for a class, and the
2814 The problem here is the argument aC should not be
2816 The four types of classes are string, executable, closing
2817 punctuation and opening punctuation.
2818 The last line shows the entire
2819 argument list as it was read.
2820 In this next example, the offending
2823 .Bd -literal -offset indent
2825 \&.Em An escaped \e&aC
2828 .Bd -literal -offset indent
2830 DEBUG(fargv) MACRO: `.Em' Line #: 2
2831 Argc: 1 Argv: `An' Length: 2
2832 Space: ` ' Class: String
2833 Argc: 2 Argv: `escaped' Length: 7
2834 Space: ` ' Class: String
2835 Argc: 3 Argv: `aC' Length: 2
2836 Space: ` ' Class: String
2837 MACRO REQUEST: .Em An escaped &aC
2843 shows up with the same length of 2 as the
2845 sequence produces a zero width, but a register
2848 was not found and the type classified as string.
2850 Other diagnostics consist of usage statements and are self explanatory.
2851 .Sh GROFF, TROFF AND NROFF
2854 package does not need compatibility mode with
2857 The package inhibits page breaks, and the headers and footers
2858 which normally occur at those breaks with
2860 to make the manual more efficient for viewing on-line.
2865 does eject the imaginary remainder of the page at end of file.
2866 The inhibiting of the page breaks makes
2868 files unsuitable for hardcopy.
2869 There is a register named
2871 which can be set to zero in the site dependent style file
2872 .Pa /usr/src/share/tmac/doc-nroff
2873 to restore the old style behavior.
2875 .Bl -tag -width /usr/share/man0/template.doc -compact
2876 .It Pa /usr/share/tmac/doc.tmac
2877 manual macro package
2878 .It Pa /usr/share/misc/mdoc.template
2879 template for writing a man page
2880 .It Pa /usr/share/examples/mdoc/*
2881 several example man pages
2884 Undesirable hyphenation on the dash of a flag
2885 argument is not yet resolved, and causes
2886 occasional mishaps in the
2889 (line break on the hyphen).
2891 Predefined strings are not declared in documentation.
2893 Section 3f has not been added to the header routines.
2896 font should be changed in
2901 needs to have a check to prevent splitting up
2902 if the line length is too short.
2904 separates the last parenthesis, and sometimes
2905 looks ridiculous if a line is in fill mode.
2907 The method used to prevent header and footer page
2908 breaks (other than the initial header and footer) when using
2909 nroff occasionally places an unsightly partially filled line (blank)
2910 at the would be bottom of the page.
2912 The list and display macros to not do any keeps
2913 and certainly should be able to.
2914 .\" Note what happens if the parameter list overlaps a newline
2916 .\" to make sure a line boundary is crossed:
2918 .\" \&.Fn struct\e\ dictionarytable\e\ *dictionarylookup struct\e\ dictionarytable\e\ *tab[]
2921 .\" produces, nudge nudge,
2922 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
2923 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
2925 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] .
2927 .\" If double quotes are used, for example:
2929 .\" \&.Fn \*qstruct dictionarytable *dictionarylookup\*q \*qchar *h\*q \*qstruct dictionarytable *tab[]\*q
2932 .\" produces, nudge nudge,
2933 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
2935 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
2937 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" .
2939 .\" Not a pretty sight...
2940 .\" In a paragraph, a long parameter containing unpaddable spaces as
2941 .\" in the former example will cause
2943 .\" to break the line and spread
2944 .\" the remaining words out.
2945 .\" The latter example will adjust nicely to
2946 .\" justified margins, but may break in between an argument and its
2950 .\" the right margin adjustment is normally ragged and the problem is