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.
39 .\" String \*(Pu was not defined, probably means punctuation
40 .ds Pu "[ .,:;()[]?! ]
46 .Nd tutorial sampler for writing
53 A tutorial sampler for writing
58 .Em content Ns \-based
67 addressed page layout leaving the
68 manipulation of fonts and other
69 typesetting details to the individual author.
74 .Em "page structure domain"
75 which consists of macros for titles, section headers, displays
77 Essentially items which affect the physical position
78 of text on a formatted page.
79 In addition to the page structure domain, there are two more domains,
80 the manual domain and the general text domain.
81 The general text domain is defined as macros which
82 perform tasks such as quoting or emphasizing pieces of text.
83 The manual domain is defined as macros that are a subset of the
84 day to day informal language used to describe commands, routines
88 Macros in the manual domain handle
89 command names, command-line arguments and options, function names,
90 function parameters, pathnames, variables, cross
91 references to other manual pages, and so on.
94 for both the author and the future user of the manual page.
95 It is hoped the consistency gained
96 across the manual set will provide easier
97 translation to future documentation tools.
101 manual pages, a manual entry
103 to as a man page, regardless of actual length and without
106 Since a tutorial document is normally read when a person
107 desires to use the material immediately, the assumption has
108 been made that the user of this document may be impatient.
109 The material presented in the remained of this document is
111 .Bl -enum -offset indent
113 .Tn "TROFF IDIOSYNCRASIES"
114 .Bl -tag -width flag -compact -offset indent
116 .It "Passing Space Characters in an Argument" .
117 .It "Trailing Blank Space Characters (a warning)" .
118 .It "Escaping Special Characters" .
121 .Tn "THE ANATOMY OF A MAN PAGE"
122 .Bl -tag -width flag -compact -offset indent
123 .It "A manual page template" .
128 .Tn "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS" .
129 .Bl -tag -width flag -compact -offset indent
130 .It "What's in a name..." .
131 .It "General Syntax" .
135 .Bl -tag -width flag -compact -offset indent
139 .It "Configuration Declarations (section four only)" .
140 .It "Command Modifier" .
141 .It "Defined Variables" .
142 .It "Errno's (Section two only)" .
143 .It "Environment Variables" .
144 .It "Function Argument" .
145 .It "Function Declaration" .
147 .It "Functions (library routines)" .
148 .It "Function Types" .
149 .\" .It "Header File (including source code)" .
150 .It "Interactive Commands" .
155 .It "Cross References" .
158 .Tn "GENERAL TEXT DOMAIN"
159 .Bl -tag -width flag -compact -offset indent
162 .It "FreeBSD Macro" .
164 .It "Enclosure/Quoting Macros"
165 .Bl -tag -width flag -compact -offset indent
166 .It "Angle Bracket Quote/Enclosure" .
167 .It "Bracket Quotes/Enclosure" .
168 .It "Double Quote macro/Enclosure" .
169 .It "Parenthesis Quote/Enclosure" .
170 .It "Single Quotes/Enclosure" .
173 .It "No\-Op or Normal Text Macro" .
174 .It "No Space Macro" .
175 .It "Section Cross References" .
176 .It "References and Citations" .
177 .It "Return Values (sections two and three only)"
178 .It "Trade Names (Acronyms and Type Names)" .
179 .It "Extended Arguments" .
182 .Tn "PAGE STRUCTURE DOMAIN"
183 .Bl -tag -width flag -compact -offset indent
184 .It "Section Headers" .
185 .It "Paragraphs and Line Spacing" .
188 .It "Font Modes (Emphasis, Literal, and Symbolic)" .
189 .It "Lists and Columns" .
192 .Tn "PREDEFINED STRINGS"
196 .Tn "FORMATTING WITH GROFF, TROFF AND NROFF"
201 .Sh TROFF IDIOSYNCRASIES
204 package attempts to simplify the process of writing a man page.
205 Theoretically, one should not have to learn the dirty details of
209 however, there are a few
210 limitations which are unavoidable and best gotten out
212 And, too, be forewarned, this package is
218 a macro is called by placing a
222 a line followed by the two character name for the macro.
223 Arguments may follow the macro separated by spaces.
224 It is the dot character at the beginning of the line which causes
226 to interpret the next two characters as a macro name.
230 at the beginning of a line in some context other than
231 a macro invocation, precede the
238 translates literally to a zero width space, and is never displayed in the
243 macros accept up to nine arguments, any
244 extra arguments are ignored.
247 accept nine arguments and,
248 in limited cases, arguments may be continued or extended
252 A few macros handle quoted arguments (see
253 .Sx Passing Space Characters in an Argument
258 general text domain and manual domain macros are special
259 in that their argument lists are
261 for callable macro names.
262 This means an argument on the argument list which matches
263 a general text or manual domain macro name and is determined
264 to be callable will be executed
265 or called when it is processed.
267 the argument, although the name of a macro,
271 It is in this manner that many macros are nested; for
277 the flag and argument macros,
281 to specify an optional flag with an argument:
282 .Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
285 .Li \&.Op \&Fl s \&Ar bytes
288 To prevent a two character
289 string from being interpreted as a macro name, precede
293 .Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
294 .It Op \&Fl s \&Ar bytes
296 .Li \&.Op \\&Fl s \\&Ar bytes
303 are not interpreted as macros.
304 Macros whose argument lists are parsed for callable arguments
306 as parsed and macros which may be called from an argument
307 list are referred to as callable
308 throughout this document and in the companion quick reference
313 as almost all of the macros in
315 are parsed, but as it was cumbersome to constantly refer to macros
316 as being callable and being able to call other macros,
317 the term parsed has been used.
318 .Ss Passing Space Characters in an Argument
319 Sometimes it is desirable to give as one argument a string
320 containing one or more blank space characters.
321 This may be necessary
322 to defeat the nine argument limit or to specify arguments to macros
323 which expect particular arrangement of items in the argument list.
327 expects the first argument to be the name of a function and any
328 remaining arguments to be function parameters.
331 stipulates the declaration of function parameters in the
332 parenthesized parameter list, each parameter is guaranteed
333 to be at minimum a two word string.
337 There are two possible ways to pass an argument which contains
339 .Em Implementation note :
340 Unfortunately, the most convenient way
341 of passing spaces in between quotes by reassigning individual
342 arguments before parsing was fairly expensive speed wise
343 and space wise to implement in all the macros for
346 It is not expensive for
348 but for the sake of portability, has been limited
349 to the following macros which need
352 .Bl -tag -width 4n -offset indent -compact
354 Configuration declaration (section 4
357 Begin list (for the width specifier).
361 Functions (sections two and four).
373 Optional notes for a reference.
375 Report title (in a reference).
377 Title of article in a book or journal.
380 One way of passing a string
381 containing blank spaces is to use the hard or unpaddable space character
383 that is, a blank space preceded by the escape character
385 This method may be used with any macro but has the side effect
386 of interfering with the adjustment of text
387 over the length of a line.
389 sees the hard space as if it were any other printable character and
390 cannot split the string into blank or newline separated pieces as one
392 The method is useful for strings which are not expected
393 to overlap a line boundary.
395 .Bl -tag -width "fetch(char *str)" -offset indent
396 .It Fn fetch char\ *str
398 .Ql \&.Fn fetch char\\ *str
399 .It Fn fetch "char *str"
400 can also be created by
401 .Ql \&.Fn fetch "\\*qchar *str\\*q"
409 would see three arguments and
412 .Dl Fn fetch char *str
414 For an example of what happens when the parameter list overlaps
415 a newline boundary, see the
418 .Ss Trailing Blank Space Characters
420 can be confused by blank space characters at the end of a line.
422 is a wise preventive measure to globally remove all blank spaces
423 from <blank-space><end-of-line> character sequences.
425 arise to force a blank character at the end of a line,
426 it may be forced with an unpaddable space and the
431 .Ss Escaping Special Characters
433 like the newline character
435 are handled by replacing the
443 .Sh THE ANATOMY OF A MAN PAGE
444 The body of a man page is easily constructed from a basic
445 template found in the file
446 .Pa /usr/share/misc/mdoc.template .
447 Several example man pages can also be found
449 .Pa /usr/share/examples/mdoc .
451 .Ss A manual page template
452 .Bd -literal -offset indent
453 \&.\\" The following requests are required for all man pages.
454 \&.Dd Month day, year
455 \&.Os OPERATING_SYSTEM [version/release]
456 \&.Dt DOCUMENT_TITLE [section number] [volume]
459 \&.Nd one line description of name
462 \&.\\" The following requests should be uncommented and
463 \&.\\" used where appropriate. This next request is
464 \&.\\" for sections 2 and 3 function return values only.
465 \&.\\" .Sh RETURN VALUE
466 \&.\\" This next request is for sections 1, 6, 7 & 8 only
467 \&.\\" .Sh ENVIRONMENT
470 \&.\\" This next request is for sections 1, 6, 7 & 8 only
471 \&.\\" (command return values (to shell) and
472 \&.\\" fprintf/stderr type diagnostics)
473 \&.\\" .Sh DIAGNOSTICS
474 \&.\\" The next request is for sections 2 and 3 error
475 \&.\\" and signal handling only.
478 \&.\\" .Sh CONFORMING TO
484 The first items in the template are the macros
485 .Pq Li \&.Dd , \&.Os , \&.Dt ;
487 the operating system the man page or subject source is developed
489 and the man page title
491 along with the section of the manual the page
493 These macros identify the page,
494 and are discussed below in
497 The remaining items in the template are section headers
508 .Sx PAGE STRUCTURE DOMAIN ,
512 Several content macros are used to demonstrate page layout macros;
513 reading about content macros before page layout macros is
516 The title macros are the first portion of the page structure
517 domain, but are presented first and separate for someone who
518 wishes to start writing a man page yesterday.
519 Three header macros designate the document title or manual page title,
520 the operating system,
521 and the date of authorship.
522 These macros are one called once at the very beginning of the document
523 and are used to construct the headers and footers only.
525 .It Li \&.Dt DOCUMENT_TITLE section# [volume]
526 The document title is the
527 subject of the man page and must be in
531 The section number may be 1,\ ...,\ 8,
532 and if it is specified,
533 the volume title may be omitted.
534 A volume title may be arbitrary or one of the following:
536 .\" USD UNIX User's Supplementary Documents
538 .\" PS1 UNIX Programmer's Supplementary Documents
540 .Bl -column SMM -offset indent -compact
541 .It Li "AMD UNIX Ancestral Manual Documents"
542 .It Li "SMM UNIX System Manager's Manual"
543 .It Li "URM UNIX Reference Manual"
544 .It Li "PRM UNIX Programmer's Manual"
547 The default volume labeling is
549 for sections 1, 6, and 7;
553 for sections 2, 3, 4, and 5.
555 .\" MMI UNIX Manual Master Index
557 .\" CON UNIX Contributed Software Manual
559 .\" LOC UNIX Local Manual
560 .It Li \&.Os operating_system release#
561 The name of the operating system
562 should be the common acronym, for example,
568 The release should be the standard release
569 nomenclature for the system specified, for example, 4.3, 4.3+Tahoe, V.3,
571 Unrecognized arguments are displayed as given in the page footer.
572 For instance, a typical footer might be:
577 .Dl \&.Os FreeBSD 2.2
579 or for a locally produced set
581 .Dl \&.Os CS Department
583 The Berkeley default,
585 without an argument, has been defined as
589 .Pa /usr/share/tmac/mdoc/doc-common .
590 It really should default to
594 macro is not present, the bottom left corner of the page
596 .It Li \&.Dd month day, year
597 The date should be written formally:
602 .Sh INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS
603 .Ss What's in a name...
604 The manual domain macro names are derived from the day to day
605 informal language used to describe commands, subroutines and related
607 Slightly different variations of this language are used to describe
608 the three different aspects of writing a man page.
609 First, there is the description of
612 Second is the description of a
618 the description of a command to a user in the verbal sense;
619 that is, discussion of a command in the text of a man page.
623 macros are themselves a type of command;
624 the general syntax for a troff command is:
625 .Bd -filled -offset indent
626 \&.Va argument1 argument2 ... argument9
631 is a macro command or request, and anything following it is an argument to
636 command using the content macros is a
640 command line might be displayed as:
641 .Bd -filled -offset indent
649 is the command name and the
654 argument designated as optional by the option brackets.
664 The macros which formatted the above example:
665 .Bd -literal -offset indent
671 In the third case, discussion of commands and command syntax
672 includes both examples above, but may add more detail.
678 from the example above might be referred to as
682 Some command-line argument lists are quite long:
683 .Bl -tag -width make -offset indent
690 .Op Fl I Ar directory
693 .Op Ar variable=value
699 Here one might talk about the command
701 and qualify the argument
703 as an argument to the flag,
705 or discuss the optional
709 In the verbal context, such detail can prevent confusion,
713 does not have a macro for an argument
718 argument macro is used for an operand or file argument like
720 as well as an argument to a flag like
722 The make command line was produced from:
723 .Bd -literal -offset indent
726 \&.Op Fl D Ar variable
728 \&.Op Fl f Ar makefile
729 \&.Op Fl I Ar directory
730 \&.Op Fl j Ar max_jobs
731 \&.Op Ar variable=value
741 macros are explained in
744 The manual domain and general text domain macros share a similar
745 syntax with a few minor deviations:
751 differ only when called without arguments;
755 impose an order on their argument lists
761 have nesting limitations.
763 are capable of recognizing and properly handling punctuation,
764 provided each punctuation character is separated by a leading space.
765 If a request is given:
767 .Dl \&.Li sptr, ptr),
773 The punctuation is not recognized and all is output in the
774 literal font. If the punctuation is separated by a leading
777 .Dl \&.Li "sptr , ptr ) ,"
781 .Dl Li sptr , ptr ) ,
783 The punctuation is now recognized and is output in the
784 default font distinguishing it from the strings in literal font.
786 To remove the special meaning from a punctuation character
790 is limited as a macro language, and has difficulty
791 when presented with a string containing
792 a member of the mathematical, logical or
794 .Bd -literal -offset indent-two
795 \&{+,\-,/,*,\&%,<,>,<=,>=,=,==,&,`,',"}
800 may assume it is supposed to actually perform the operation
801 or evaluation suggested by the characters. To prevent
802 the accidental evaluation of these characters,
805 Typical syntax is shown in the first content macro displayed
810 The address macro identifies an address construct
811 of the form addr1[,addr2[,addr3]].
813 .Dl Usage: .Ad address ... \*(Pu
814 .Bl -tag -width "\&.Ad f1 , f2 , f3 :" -compact -offset 14n
817 .It Li \&.Ad addr1\ .
819 .It Li \&.Ad addr1\ , file2
821 .It Li \&.Ad f1\ , f2\ , f3\ :
823 .It Li \&.Ad addr\ )\ )\ ,
827 It is an error to call
831 is callable by other macros and is parsed.
835 macro is used to specify the name of the author of the item being
836 documented, or the name of the author of the actual manual page.
837 Any remaining arguments after the name information are assumed
840 .Dl Usage: .An author_name \*(Pu
841 .Bl -tag -width "\&.An Joe Author ) ) ," -compact -offset 14n
842 .It Li \&.An Joe\ Author
844 .It Li \&.An Joe\ Author\ ,
846 .It Li \&.An Joe\ Author\ \&Aq\ nobody@FreeBSD.ORG
847 .An Joe Author Aq nobody@FreeBSD.ORG
848 .It Li \&.An Joe\ Author\ )\ )\ ,
854 macro is parsed and is callable.
855 It is an error to call
862 argument macro may be used whenever
863 a command-line argument is referenced.
865 .Dl Usage: .Ar argument ... \*(Pu
866 .Bl -tag -width "\&.Ar file1 file2" -compact -offset 15n
871 .It Li \&.Ar file1\ .
873 .It Li \&.Ar file1 file2
875 .It Li \&.Ar f1 f2 f3\ :
877 .It Li \&.Ar file\ )\ )\ ,
883 is called without arguments
888 macro is parsed and is callable.
889 .Ss Configuration Declaration (section four only)
892 macro is used to demonstrate a
894 declaration for a device interface in a section four manual.
895 This macro accepts quoted arguments (double quotes only).
897 .Bl -tag -width "device le0 at scode?" -offset indent
898 .It Cd "device le0 at scode?"
900 .Ql ".Cd device le0 at scode?" .
903 The command modifier is identical to the
905 (flag) command with the exception
908 macro does not assert a dash
909 in front of every argument.
910 Traditionally flags are marked by the
911 preceding dash, some commands or subsets of commands do not use them.
912 Command modifiers may also be specified in conjunction with interactive
913 commands such as editor commands.
916 .Ss Defined Variables
917 A variable which is defined in an include file is specified
921 .Dl Usage: .Dv defined_variable ... \*(Pu
922 .Bl -tag -width "\&.Dv MAXHOSTNAMELEN" -compact -offset 14n
923 .It Li ".Dv MAXHOSTNAMELEN"
925 .It Li ".Dv TIOCGPGRP )"
929 It is an error to call
933 is parsed and is callable.
934 .Ss Errno's (Section two only)
937 errno macro specifies the error return value
938 for section two library routines.
944 general text domain macro, as it would be used in
945 a section two manual page.
947 .Dl Usage: .Er ERRNOTYPE ... \*(Pu
948 .Bl -tag -width "\&.Bq Er ENOTDIR" -compact -offset 14n
951 .It Li \&.Er ENOENT\ )\ ;
953 .It Li \&.Bq \&Er ENOTDIR
957 It is an error to call
962 macro is parsed and is callable.
963 .Ss Environment Variables
966 macro specifies an environment variable.
968 .Dl Usage: .Ev argument ... \*(Pu
969 .Bl -tag -width "\&.Ev PRINTER ) ) ," -compact -offset 14n
974 .It Li \&.Ev PRINTER\ )\ )\ ,
978 It is an error to call
983 macro is parsed and is callable.
984 .Ss Function Argument
987 macro is used to refer to function arguments (parameters)
990 section of the manual or inside
993 section should a parameter list be too
996 macro and the enclosure macros
1002 may also be used to refer to structure members.
1004 .Dl Usage: .Fa function_argument ... \*(Pu
1005 .Bl -tag -width "\&.Fa d_namlen\ )\ )\ ," -compact -offset 14n
1006 .It Li \&.Fa d_namlen\ )\ )\ ,
1008 .It Li \&.Fa iov_len
1012 It is an error to call
1016 is parsed and is callable.
1017 .Ss Function Declaration
1020 macro is used in the
1022 section with section two or three
1026 macro does not call other macros and is not callable by other
1029 .Dl Usage: .Fd include_file (or defined variable)
1035 request causes a line break if a function has already been presented
1036 and a break has not occurred.
1037 This leaves a nice vertical space
1038 in between the previous function call and the declaration for the
1043 macro handles command-line flags.
1048 For interactive command flags, which
1049 are not prepended with a dash, the
1052 macro is identical, but without the dash.
1054 .Dl Usage: .Fl argument ... \*(Pu
1055 .Bl -tag -width "\&.Fl \-s \-t \-v" -compact -offset 14n
1066 .It Li \&.Fl xyz\ )\ ,
1072 macro without any arguments results
1073 in a dash representing \fIstdin\fP/\fIstdout\fP.
1076 a single dash, will result in two dashes.
1079 macro is parsed and is callable.
1080 .Ss Functions (library routines)
1081 The .Fn macro is modeled on ANSI C conventions.
1083 Usage: .Fn [type] function [[type] parameters ... \*(Pu]
1085 .Bl -tag -width "\&.Fn _int align_ _const * char *sptrsxx" -compact
1086 .It Li "\&.Fn getchar"
1088 .It Li "\&.Fn strlen ) ,"
1090 .It Li \&.Fn "\\*qint align\\*q" "\\*qconst * char *sptrs\\*q" ,
1091 .Fn "int align" "const * char *sptrs" ,
1094 It is an error to call
1096 without any arguments.
1100 is parsed and is callable,
1101 note that any call to another macro signals the end of
1104 call (it will close-parenthesis at that point).
1106 For functions that have more than eight parameters (and this
1117 to get around the limitation.
1119 .Bd -literal -offset indent
1120 \&.Fo "int res_mkquery"
1127 \&.Fa "struct rrec *newrr"
1134 .Bd -filled -offset indent
1135 .Fo "int res_mkquery"
1142 .Fa "struct rrec *newrr"
1152 macros are parsed and are callable.
1155 section, the function will always begin at
1156 the beginning of line.
1157 If there is more than one function
1160 section and a function type has not been
1161 given, a line break will occur, leaving a nice vertical space
1162 between the current function name and the one prior.
1165 does not check its word boundaries
1166 against troff line lengths and may split across a newline
1168 This will be fixed in the near future.
1170 This macro is intended for the
1174 anywhere else in the man page without problems, but its main purpose
1175 is to present the function type in kernel normal form for the
1177 of sections two and three
1178 (it causes a line break allowing the function name to appear
1181 .Dl Usage: .Ft type ... \*(Pu
1182 .Bl -tag -width "\&.Ft struct stat" -offset 14n -compact
1183 .It Li \&.Ft struct stat
1189 request is not callable by other macros.
1190 .Ss Interactive Commands
1193 macro designates an interactive or internal command.
1195 .Dl Usage: .Ic argument ... \*(Pu
1196 .Bl -tag -width "\&.Ic setenv , unsetenvxx" -compact -offset 14n
1199 .It Li \&.Ic do while {...}
1201 .It Li \&.Ic setenv\ , unsetenv
1202 .Ic setenv , unsetenv
1205 It is an error to call
1210 macro is parsed and is callable.
1214 macro is used for the document title or subject name.
1215 It has the peculiarity of remembering the first
1216 argument it was called with, which should
1217 always be the subject name of the page.
1221 regurgitates this initial name for the sole purpose
1222 of making less work for the author.
1225 or three document function name is addressed with the
1233 and remaining sections.
1234 For interactive commands, such as the
1240 macro should be used.
1246 it can not recall the first argument it was invoked with.
1248 .Dl Usage: .Nm argument ... \*(Pu
1249 .Bl -tag -width "\&.Nm mdoc.sample" -compact -offset 14n
1250 .It Li \&.Nm mdoc.sample
1252 .It Li \&.Nm \\-mdoc
1254 .It Li \&.Nm foo\ )\ )\ ,
1262 macro is parsed and is callable.
1267 places option brackets around the any remaining arguments on the command
1268 line, and places any
1269 trailing punctuation outside the brackets.
1274 may be used across one or more lines.
1276 .Dl Usage: .Op options ... \*(Pu
1277 .Bl -tag -width "\&.Op Fl c Ar objfil Op Ar corfil ," -compact -offset indent
1282 .It Li ".Op Fl k ) ."
1284 .It Li ".Op Fl k Ar kookfile"
1285 .Op Fl k Ar kookfile
1286 .It Li ".Op Fl k Ar kookfile ,"
1287 .Op Fl k Ar kookfile ,
1288 .It Li ".Op Ar objfil Op Ar corfil"
1289 .Op Ar objfil Op Ar corfil
1290 .It Li ".Op Fl c Ar objfil Op Ar corfil ,"
1291 .Op Fl c Ar objfil Op Ar corfil ,
1292 .It Li \&.Op word1 word2
1301 .Bd -literal -offset indent
1303 \&.Op \&Fl k \&Ar kilobytes
1304 \&.Op \&Fl i \&Ar interval
1305 \&.Op \&Fl c \&Ar count
1311 .Op Fl k Ar kilobytes
1312 .Op Fl i Ar interval
1321 are parsed and are callable.
1325 macro formats pathnames or filenames.
1327 .Dl Usage: .Pa pathname \*(Pu
1328 .Bl -tag -width "\&.Pa /tmp/fooXXXXX ) ." -compact -offset 14n
1329 .It Li \&.Pa /usr/share
1331 .It Li \&.Pa /tmp/fooXXXXX\ )\ .
1332 .Pa /tmp/fooXXXXX ) .
1337 macro is parsed and is callable.
1339 Generic variable reference:
1341 .Dl Usage: .Va variable ... \*(Pu
1342 .Bl -tag -width "\&.Va char s ] ) ) ," -compact -offset 14n
1345 .It Li \&.Va settimer ,
1347 .It Li \&.Va int\ *prt\ )\ :
1349 .It Li \&.Va char\ s\ ]\ )\ )\ ,
1353 It is an error to call
1355 without any arguments.
1358 macro is parsed and is callable.
1359 .Ss Manual Page Cross References
1362 macro expects the first argument to be
1363 a manual page name, and the second argument, if it exists,
1364 to be either a section page number or punctuation.
1366 remaining arguments are assumed to be punctuation.
1368 .Dl Usage: .Xr man_page [1,...,8] \*(Pu
1369 .Bl -tag -width "\&.Xr mdoc 7 ) ) ," -compact -offset 14n
1372 .It Li \&.Xr mdoc\ ,
1376 .It Li \&.Xr mdoc 7\ )\ )\ ,
1382 macro is parsed and is callable.
1383 It is an error to call
1387 .Sh GENERAL TEXT DOMAIN
1389 .Bd -literal -offset indent -compact
1390 Usage: .At [v6 | v7 | 32v | V.1 | V.4] ... \*(Pu
1392 .Bl -tag -width "\&.At v6 ) ," -compact -offset 14n
1406 It accepts at most two arguments.
1408 .Dl Usage: .Bx [Version/release] ... \*(Pu
1409 .Bl -tag -width "\&.Bx 4.3 ) ," -compact -offset 14n
1418 macro is parsed and is callable.
1420 .Bd -literal -offset indent -compact
1421 Usage: .Fx Version.release ... \*(Pu
1423 .Bl -tag -width "\&.Fx 2.2 ) ," -compact -offset 14n
1435 It accepts at most two arguments.
1437 .Dl Usage: .Ux ... \*(Pu
1438 .Bl -tag -width "\&.Ux 4.3 ) ," -compact -offset 14n
1445 macro is parsed and is callable.
1446 .Ss Enclosure and Quoting Macros
1447 The concept of enclosure is similar to quoting.
1448 The object being to enclose one or more strings between
1449 a pair of characters like quotes or parentheses.
1450 The terms quoting and enclosure are used
1451 interchangeably throughout this document.
1453 one line enclosure macros end
1456 to give a hint of quoting, but there are a few irregularities.
1457 For each enclosure macro
1458 there is also a pair of open and close macros which end
1464 These can be used across one or more lines of text
1465 and while they have nesting limitations, the one line quote macros
1470 .Bd -filled -offset indent
1471 .Bl -column "quote " "close " "open " "Enclose Stringx(in XX) " XXstringXX
1472 .Em " Quote Close Open Function Result"
1473 \&.Aq .Ac .Ao Angle Bracket Enclosure <string>
1474 \&.Bq .Bc .Bo Bracket Enclosure [string]
1475 \&.Dq .Dc .Do Double Quote ``string''
1476 .Ec .Eo Enclose String (in XX) XXstringXX
1477 \&.Pq .Pc .Po Parenthesis Enclosure (string)
1478 \&.Ql Quoted Literal `st' or string
1479 \&.Qq .Qc .Qo Straight Double Quote "string"
1480 \&.Sq .Sc .So Single Quote `string'
1484 Except for the irregular macros noted below, all
1485 of the quoting macros are parsed and callable.
1486 All handle punctuation properly, as long as it
1487 is presented one character at a time and separated by spaces.
1488 The quoting macros examine opening and closing punctuation
1489 to determine whether it comes before or after the
1491 This makes some nesting possible.
1492 .Bl -tag -width xxx,xxxx
1493 .It Li \&.Ec , \&.Eo
1494 These macros expect the first argument to be the
1495 opening and closing strings respectively.
1497 The quoted literal macro behaves differently for
1503 a quoted literal is always quoted.
1505 troff, an item is only quoted if the width
1506 of the item is less than three constant width characters.
1507 This is to make short strings more visible where the font change
1508 to literal (constant width) is less noticeable.
1510 The prefix macro is not callable, but it is parsed:
1511 .Bl -tag -width "(namexx" -offset indent
1512 .It Li ".Pf ( Fa name2"
1519 (no space) macro performs the analogous suffix function.
1523 Examples of quoting:
1524 .Bl -tag -width "\&.Aq Pa ctype.h ) ,xxxxxxxx" -compact -offset indent
1527 .It Li \&.Aq \&Ar ctype.h\ )\ ,
1531 .It Li \&.Bq \&Em Greek \&, French \&.
1532 .Bq Em Greek , French .
1535 .It Li ".Dq string abc ."
1537 .It Li ".Dq \'^[A-Z]\'"
1539 .It Li "\&.Ql man mdoc"
1543 .It Li "\&.Qq string ) ,"
1545 .It Li "\&.Qq string Ns ),"
1549 .It Li "\&.Sq string
1553 For a good example of nested enclosure macros, see the
1556 It was created from the same
1557 underlying enclosure macros as those presented in the list
1563 extended argument list macros
1564 were also built from the same underlying routines and are a good
1567 macro usage at its worst.
1568 .Ss No\-Op or Normal Text Macro
1572 a hack for words in a macro command line which should
1574 be formatted and follows the conventional syntax
1579 macro eliminates unwanted spaces in between macro requests.
1580 It is useful for old style argument lists where there is no space
1581 between the flag and argument:
1582 .Bl -tag -width "\&.Op Fl I Ns Ar directoryxx" -offset indent
1583 .It Li ".Op Fl I Ns Ar directory"
1585 .Op Fl I Ns Ar directory
1590 macro always invokes the
1592 macro after eliminating the space unless another macro name
1596 is parsed and is callable.
1597 .Ss Section Cross References
1600 macro designates a reference to a section header
1601 within the same document.
1602 It is parsed and is callable.
1604 .Bl -tag -width "Li \&.Sx FILES" -offset 14n
1608 .Ss References and Citations
1609 The following macros make a modest attempt to handle references.
1610 At best, the macros make it convenient to manually drop in a subset of
1611 refer style references.
1613 .Bl -tag -width 6n -offset indent -compact
1616 Causes a line break and begins collection
1617 of reference information until the
1618 reference end macro is read.
1621 The reference is printed.
1623 Reference author name, one name per invocation.
1635 Optional information.
1646 The macros beginning with
1648 are not callable, and are parsed only for the trade name macro which
1649 returns to its caller.
1650 (And not very predictably at the moment either.)
1651 The purpose is to allow trade names
1652 to be pretty printed in
1653 .Xr troff Ns / Ns Xr ditroff
1658 macro generates text for use in the
1662 .Dl Usage: .Rv [-std function]
1664 .Ql \&.Rv -std atexit
1665 will generate the following text:
1667 .\" fake section 3 to avoid error message from Rv
1671 .\" and back to 7 again
1677 option is valid only for manual page sections 2 and 3.
1678 .Ss Trade Names (or Acronyms and Type Names)
1679 The trade name macro is generally a small caps macro for
1680 all upper case words longer than two characters.
1682 .Dl Usage: .Tn symbol ... \*(Pu
1683 .Bl -tag -width "\&.Tn ASCII" -compact -offset 14n
1693 is parsed and is callable by other macros.
1694 .Ss Extended Arguments
1699 macros allow one to extend an argument list
1700 on a macro boundary.
1701 Argument lists cannot
1702 be extended within a macro
1703 which expects all of its arguments on one line such
1707 Here is an example of
1709 using the space mode macro to turn spacing off:
1710 .Bd -literal -offset indent
1712 \&.It Xo Sy I Ar operation
1713 \&.No \\en Ar count No \\en
1719 .Bd -filled -offset indent
1720 .Bl -tag -width flag -compact
1722 .It Xo Sy I Ar operation
1723 .No \\n Ar count No \\n
1730 .Bd -literal -offset indent
1732 \&.It Cm S No \&/ Ar old_pattern Xo
1733 \&.No \&/ Ar new_pattern
1740 .Bd -filled -offset indent
1741 .Bl -tag -width flag -compact
1743 .It Cm S No \&/ Ar old_pattern Xo
1744 .No \&/ Ar new_pattern
1753 and using enclosure macros:
1754 Test the value of a variable.
1755 .Bd -literal -offset indent
1758 \&.Oo \\&! Oc Ns Ar variable
1759 \&.Op Ar operator variable ...
1764 .Bd -filled -offset indent
1765 .Bl -tag -width flag -compact
1768 .Oo \&! Oc Ns Ar variable
1769 .Op Ar operator variable ...
1774 All of the above examples have used the
1776 macro on the argument list of the
1780 The extend macros are not used very often, and when they are
1781 it is usually to extend the list-item argument list.
1782 Unfortunately, this is also where the extend macros are the
1784 In the first two examples, spacing was turned off;
1785 in the third, spacing was desired in part of the output but
1787 To make these macros work in this situation make sure
1792 macros are placed as shown in the third example.
1795 macro is not alone on the
1797 argument list, spacing will be unpredictable.
1801 must not occur as the first or last macro on a line
1803 Out of 900 manual pages (about 1500 actual pages)
1804 currently released with
1806 only fifteen use the
1809 .Sh PAGE STRUCTURE DOMAIN
1813 section header macros
1814 list below are required in every
1816 The remaining section headers
1817 are recommended at the discretion of the author
1818 writing the manual page.
1821 macro can take up to nine arguments.
1822 It is parsed and but is not callable.
1823 .Bl -tag -width "\&.Sh SYNOPSIS"
1829 the headers, footers and page layout defaults
1830 will not be set and things will be rather unpleasant.
1833 section consists of at least three items.
1836 name macro naming the subject of the man page.
1837 The second is the Name Description macro,
1839 which separates the subject
1840 name from the third item, which is the description.
1842 description should be the most terse and lucid possible,
1843 as the space available is small.
1847 section describes the typical usage of the
1848 subject of a man page.
1864 for manual page sections 2 and 3, the command and general
1867 is required for sections 1, 5, 6, 7, 8.
1868 Section 4 manuals require a
1873 configuration device usage macro.
1874 Several other macros may be necessary to produce
1875 the synopsis line as shown below:
1878 .Bd -filled -offset indent
1885 The following macros were used:
1888 .Dl \&.Op \&Fl benstuv
1898 recognize the pipe bar character
1900 so a command line such as:
1902 .Dl ".Op Fl a | Fl b"
1904 will not go orbital.
1906 normally interprets a \*(Ba as a special operator.
1908 .Sx PREDEFINED STRINGS
1910 character in other situations.
1912 .It \&.Sh DESCRIPTION
1913 In most cases the first text in the
1916 is a brief paragraph on the command, function or file,
1917 followed by a lexical list of options and respective
1919 To create such a list, the
1926 macros are used (see
1927 .Sx Lists and Columns
1933 section headers are part of the
1934 preferred manual page layout and must be used appropriately
1935 to maintain consistency.
1936 They are listed in the order
1937 in which they would be used.
1938 .Bl -tag -width SYNOPSIS
1939 .It \&.Sh ENVIRONMENT
1942 section should reveal any related
1944 variables and clues to their behavior and/or usage.
1946 There are several ways to create examples.
1953 Files which are used or created by the man page subject
1954 should be listed via the
1960 References to other material on the man page topic and
1961 cross references to other relevant man pages should
1966 are specified using the
1969 Cross references in the
1971 section should be sorted by section number, and then
1972 placed in alphabetical order and comma separated. For example:
1981 style references are not accommodated.
1982 .It \&.Sh CONFORMING TO
1983 If the command, library function or file adheres to a
1984 specific implementation such as
1988 this should be noted here.
1990 command does not adhere to any standard, its history
1991 should be noted in the
1995 Any command which does not adhere to any specific standards
1996 should be outlined historically in this section.
1998 Credits, if need be, should be placed here.
1999 .It \&.Sh DIAGNOSTICS
2000 Diagnostics from a command should be placed in this section.
2002 Specific error handling, especially from library functions
2003 (man page sections 2 and 3) should go here.
2006 macro is used to specify an errno.
2008 Blatant problems with the topic go here...
2013 sections may be added,
2014 for example, this section was set with:
2015 .Bd -literal -offset 14n
2016 \&.Sh PAGE STRUCTURE DOMAIN
2018 .Ss Paragraphs and Line Spacing.
2023 paragraph command may
2024 be used to specify a line space where necessary.
2025 The macro is not necessary after a
2035 macro asserts a vertical distance unless the -compact flag is given).
2037 .\" This worked with version one, need to redo for version three
2040 .\" .Cw (ax+bx+c) \ is\ produced\ by\ \&
2041 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2058 .\" .Em is produced by
2074 .\" This example shows the same equation in a different format.
2078 .\" signs were forced with
2082 .\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&
2083 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2094 .\" .Li \&.Cx \\\ +\\\ \\&
2105 .\" .Em is produced by
2113 .\" .Li \&.Cx \\\ +\\\ \\&
2124 .\" The incantation below was
2130 .\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by
2132 .\" .Li \&.Cx Op Sy ?/
2142 .\" .Em is produced by
2144 .\" .Li \&.Ar \\\ b1 e1 f1
2156 The only keep that is implemented at this time is for words.
2163 The only option that
2167 and is useful for preventing line breaks in the middle of options.
2168 In the example for the make command-line arguments (see
2169 .Sx What's in a name ) ,
2173 flag and the argument
2175 (Actually, the option macro used to prevent this from occurring,
2176 but was dropped when the decision (religious) was made to force
2177 right justified margins in
2179 as options in general look atrocious when spread across a sparse
2181 More work needs to be done with the keep macros, a
2183 option needs to be added.)
2184 .Ss Examples and Displays
2185 There are five types of displays, a quickie one line indented display
2187 a quickie one line literal display
2189 and a block literal, block filled and block ragged which use
2197 .Bl -tag -width \&.Dlxx
2199 (D-one) Display one line of indented text.
2200 This macro is parsed, but it is not callable.
2204 The above was produced by:
2205 .Li \&.Dl Fl ldghfstru .
2208 Display one line of indented
2213 example macro has been used throughout this
2216 the indent (display) of one line of text.
2217 Its default font is set to
2218 constant width (literal) however
2219 it is parsed and will recognized other macros.
2220 It is not callable however.
2222 .Dl % ls -ldg /usr/local/bin
2224 The above was produced by
2225 .Li \&.Dl % ls -ldg /usr/local/bin .
2230 display must be ended with the
2233 Displays may be nested within displays and
2236 has the following syntax:
2238 .Dl ".Bd display-type [-offset offset_value] [-compact]"
2240 The display-type must be one of the following four types and
2241 may have an offset specifier for indentation:
2245 .Bl -tag -width "file file_name " -compact
2247 Display a block of text as typed,
2248 right (and left) margin edges are left ragged.
2250 Display a filled (formatted) block.
2251 The block of text is formatted (the edges are filled \-
2252 not left unjustified).
2254 Display a literal block, useful for source code or
2255 simple tabbed or spaced text.
2256 .It Fl file Ar file_name
2257 The filename following the
2259 flag is read and displayed.
2261 asserted and tabs are set at 8 constant width character
2262 intervals, however any
2263 .Xr troff/ Ns Nm \-mdoc
2264 commands in file will be processed.
2265 .It Fl offset Ar string
2268 is specified with one of the following strings, the string
2269 is interpreted to indicate the level of indentation for the
2270 forthcoming block of text:
2272 .Bl -tag -width "indent-two" -compact
2274 Align block on the current left margin,
2275 this is the default mode of
2278 Supposedly center the block.
2280 unfortunately, the block merely gets
2281 left aligned about an imaginary center margin.
2283 Indents by one default indent value or tab.
2285 indent value is also used for the
2287 display so one is guaranteed the two types of displays
2289 This indent is normally set to 6n or about two
2290 thirds of an inch (six constant width characters).
2292 Indents two times the default indent value.
2296 aligns the block about two inches from
2297 the right side of the page.
2299 work and perhaps may never do the right thing by
2306 There are five macros for changing the appearance of the manual page text:
2307 .Bl -tag -width \&.Emxx
2309 Text may be stressed or emphasized with the
2312 The usual font for emphasis is italic.
2314 .Dl Usage: .Em argument ... \*(Pu
2315 .Bl -tag -width "\&.Em vide infra ) ) ," -compact -offset 14n
2316 .It Li ".Em does not"
2318 .It Li ".Em exceed 1024 ."
2320 .It Li ".Em vide infra ) ) ,"
2321 .Em vide infra ) ) ,
2326 macro is parsed and is callable.
2327 It is an error to call
2333 literal macro may be used for special characters,
2334 variable constants, anything which should be displayed as it
2337 .Dl Usage: .Li argument ... \*(Pu
2338 .Bl -tag -width "\&.Li cntrl-D ) ," -compact -offset 14n
2341 .It Li \&.Li M1 M2 M3\ ;
2343 .It Li \&.Li cntrl-D\ )\ ,
2345 .It Li \&.Li 1024\ ...
2351 macro is parsed and is callable.
2353 The symbolic emphasis macro is generally a boldface macro in
2354 either the symbolic sense or the traditional English usage.
2356 .Dl Usage: .Sy symbol ... \*(Pu
2357 .Bl -tag -width "\&.Sy Important Noticex" -compact -offset 14n
2358 .It Li \&.Sy Important Notice
2359 .Sy Important Notice
2363 macro is parsed and is callable.
2372 font mode must be ended with the
2375 Font modes may be nested within other font modes.
2377 has the following syntax:
2381 The font-mode must be one of the following three types:
2384 .Bl -tag -width "file file_name " -compact
2385 .It Sy \&Em | Fl emphasis
2388 macro was used for the entire block of text.
2389 .It Sy \&Li | Fl literal
2392 macro was used for the entire block of text.
2393 .It Sy \&Sy | Fl symbolic
2396 macro was used for the entire block of text.
2401 .Ss Tagged Lists and Columns
2402 There are several types of lists which may be initiated with the
2405 Items within the list
2406 are specified with the
2409 each list must end with the
2412 Lists may be nested within themselves and within displays.
2413 Columns may be used inside of lists, but lists are unproven
2416 In addition, several list attributes may be specified such as
2417 the width of a tag, the list offset, and compactness
2418 (blank lines between items allowed or disallowed).
2419 Most of this document has been formatted with a tag style list
2421 For a change of pace, the list-type used to present the list-types
2422 is an over-hanging list
2424 This type of list is quite popular with
2426 users, but might look a bit funny after having read many pages of
2428 The following list types are accepted by
2435 These three are the simplest types of lists.
2438 macro has been given, items in the list are merely
2439 indicated by a line consisting solely of the
2442 For example, the source text for a simple enumerated list
2444 .Bd -literal -offset indent-two
2445 \&.Bl -enum -compact
2447 \&Item one goes here.
2449 \&And item two here.
2451 \&Lastly item three goes here.
2458 .Bl -enum -offset indent-two -compact
2464 Lastly item three goes here.
2467 A simple bullet list construction:
2468 .Bd -literal -offset indent-two
2469 \&.Bl -bullet -compact
2471 \&Bullet one goes here.
2478 .Bl -bullet -offset indent-two -compact
2480 Bullet one goes here.
2491 These list-types collect arguments specified with the
2493 macro and create a label which may be
2495 into the forthcoming text,
2497 from the forthcoming text,
2499 from above and not indented or
2502 list was constructed with the
2507 macro is parsed only for the inset, hang
2508 and tag list-types and is not callable.
2509 Here is an example of inset labels:
2511 .Bl -inset -offset indent
2513 The tagged list (also called a tagged paragraph) is the
2514 most common type of list used in the Berkeley manuals.
2516 Diag lists create section four diagnostic lists
2517 and are similar to inset lists except callable
2520 Hanged labels are a matter of taste.
2522 Overhanging labels are nice when space is constrained.
2524 Inset labels are useful for controlling blocks of
2525 paragraphs and are valuable for converting
2527 manuals to other formats.
2530 Here is the source text which produced the above example:
2531 .Bd -literal -offset indent
2532 \&.Bl -inset -offset indent
2534 \&The tagged list (also called a tagged paragraph) is the
2535 \&most common type of list used in the Berkeley manuals.
2537 \&Diag lists create section four diagnostic lists
2538 \&and are similar to inset lists except callable
2539 \¯os are ignored.
2541 \&Hanged labels are a matter of taste.
2543 \&Overhanging labels are nice when space is constrained.
2545 \&Inset labels are useful for controlling blocks of
2546 \¶graphs and are valuable for converting
2548 \&manuals to other formats.
2552 Here is a hanged list with two items:
2553 .Bl -hang -offset indent
2555 labels appear similar to tagged lists when the
2556 label is smaller than the label width.
2557 .It Em Longer hanged list labels
2558 blend in to the paragraph unlike
2559 tagged paragraph labels.
2562 And the unformatted text which created it:
2563 .Bd -literal -offset indent
2564 \&.Bl -hang -offset indent
2566 \&labels appear similar to tagged lists when the
2567 \&label is smaller than the label width.
2568 \&.It Em Longer hanged list labels
2569 \&blend in to the paragraph unlike
2570 \&tagged paragraph labels.
2574 The tagged list which follows uses an optional width specifier to control
2575 the width of the tag.
2577 .Bl -tag -width "PAGEIN" -compact -offset indent
2579 sleep time of the process (seconds blocked)
2583 resulting from references
2584 by the process to pages not loaded in core.
2586 numerical user-id of process owner
2588 numerical ID of parent of process process priority
2589 (nonpositive when in noninterruptible wait)
2593 .Bd -literal -offset indent
2594 \&.Bl -tag -width "PAGEIN" -compact -offset indent
2596 \&sleep time of the process (seconds blocked)
2600 \&resulting from references
2601 \&by the process to pages not loaded in core.
2603 \&numerical user ID of process owner
2605 \&numerical ID of parent of process process priority
2606 \&(nonpositive when in noninterruptible wait)
2610 Acceptable width specifiers:
2611 .Bl -tag -width Ar -offset indent
2612 .It Fl width Ar "\&Fl"
2613 sets the width to the default width for a flag.
2615 macros have a default width value.
2619 set to ten constant width characters or about five sixth of
2621 .It Fl width Ar "24n"
2622 sets the width to 24 constant width characters or about two
2626 is absolutely necessary for the scaling to work correctly.
2627 .It Fl width Ar "ENAMETOOLONG"
2628 sets width to the constant width length of the
2630 .It Fl width Ar "\\*qint mkfifo\\*q"
2631 again, the width is set to the constant width of the string
2635 If a width is not specified for the tag list type, the first
2638 is invoked, an attempt is made to determine an appropriate
2640 If the first argument to
2642 is a callable macro, the default width for that macro will be used
2643 as if the macro name had been supplied as the width.
2645 if another item in the list is given with a different callable
2646 macro name, a new and nested list is assumed.
2647 .Sh PREDEFINED STRINGS
2648 The following strings are predefined as may be used by
2649 preceding with the troff string interpreting sequence
2653 is the name of the defined string or as
2657 is the name of the string.
2658 The interpreting sequence may be used any where in the text.
2660 .Bl -column "String " "Nroff " "Troff " -offset indent
2661 .It Sy "String Nroff Troff"
2662 .It Li "<=" Ta \&<\&= Ta \*(<=
2663 .It Li ">=" Ta \&>\&= Ta \*(>=
2664 .It Li "Rq" Ta "''" Ta \*(Rq
2665 .It Li "Lq" Ta "``" Ta \*(Lq
2666 .It Li "ua" Ta ^ Ta \*(ua
2667 .It Li "aa" Ta ' Ta \*(aa
2668 .It Li "ga" Ta \` Ta \*(ga
2669 .\" .It Li "sL" Ta ` Ta \*(sL
2670 .\" .It Li "sR" Ta ' Ta \*(sR
2671 .It Li "q" Ta \&" Ta \*q
2672 .It Li "Pi" Ta pi Ta \*(Pi
2673 .It Li "Ne" Ta != Ta \*(Ne
2674 .It Li "Le" Ta <= Ta \*(Le
2675 .It Li "Ge" Ta >= Ta \*(Ge
2676 .It Li "Lt" Ta < Ta \*(Gt
2677 .It Li "Gt" Ta > Ta \*(Lt
2678 .It Li "Pm" Ta +- Ta \*(Pm
2679 .It Li "If" Ta infinity Ta \*(If
2680 .It Li "Na" Ta \fINaN\fP Ta \*(Na
2681 .It Li "Ba" Ta \fR\&|\fP Ta \*(Ba
2687 should be written as
2689 since it is only one char.
2691 The debugging facilities for
2693 are limited, but can help detect subtle errors such
2694 as the collision of an argument name with an internal
2695 register or macro name.
2697 A register is an arithmetic storage class for
2699 with a one or two character name.
2700 All registers internal to
2706 are two characters and
2707 of the form <upper_case><lower_case> such as
2709 <lower_case><upper_case> as
2712 <upper or lower letter><digit> as
2714 And adding to the muddle,
2716 has its own internal registers all of which are either
2717 two lower case characters or a dot plus a letter or metacharacter
2719 In one of the introduction examples, it was shown how to
2720 prevent the interpretation of a macro name with the escape sequence
2722 This is sufficient for the internal register names also.
2724 .\" Every callable macro name has a corresponding register
2725 .\" of the same name (<upper_case><lower_case>).
2726 .\" There are also specific registers which have
2727 .\" been used for stacks and arrays and are listed in the
2729 .\" .Bd -ragged -offset 4n
2730 .\" [A-Z][a-z] registers corresponding to macro names (example ``Ar'')
2731 .\" [a-z][A-Z] registers corresponding to macro names (example ``aR'')
2732 .\" C[0-9] argument types (example C1)
2733 .\" O[0-9] offset stack (displays)
2734 .\" h[0-9] horizontal spacing stack (lists)
2735 .\" o[0-9] offset (stack) (lists)
2736 .\" t[0-9] tag stack (lists)
2737 .\" v[0-9] vertical spacing stack (lists)
2738 .\" w[0-9] width tag/label stack
2741 If a nonescaped register name is given in the argument list of a request
2742 unpredictable behavior will occur.
2743 In general, any time huge portions
2744 of text do not appear where expected in the output, or small strings
2745 such as list tags disappear, chances are there is a misunderstanding
2746 about an argument type in the argument list.
2747 Your mother never intended for you to remember this evil stuff - so here
2748 is a way to find out whether or not your arguments are valid: The
2751 macro displays the interpretation of the argument list for most
2756 macro do not contain debugging information.
2757 All of the callable macros do,
2758 and it is strongly advised whenever in doubt,
2763 .Dl Usage: \&.Db [on | off]
2765 An example of a portion of text with
2766 the debug macro placed above and below an
2767 artificially created problem (a flag argument
2772 .Bd -literal -offset indent
2774 \&.Op Fl aC Ar file )
2778 The resulting output:
2779 .Bd -literal -offset indent
2781 DEBUG(argv) MACRO: `.Op' Line #: 2
2782 Argc: 1 Argv: `Fl' Length: 2
2783 Space: `' Class: Executable
2784 Argc: 2 Argv: `aC' Length: 2
2785 Space: `' Class: Executable
2786 Argc: 3 Argv: `Ar' Length: 2
2787 Space: `' Class: Executable
2788 Argc: 4 Argv: `file' Length: 4
2789 Space: ` ' Class: String
2790 Argc: 5 Argv: `)' Length: 1
2791 Space: ` ' Class: Closing Punctuation or suffix
2792 MACRO REQUEST: .Op Fl aC Ar file )
2796 The first line of information tells the name of the calling
2799 and the line number it appears on.
2800 If one or more files are involved
2801 (especially if text from another file is included) the line number
2803 If there is only one file, it should be accurate.
2804 The second line gives the argument count, the argument
2807 If the length of an argument is two characters, the
2808 argument is tested to see if it is executable (unfortunately, any
2809 register which contains a nonzero value appears executable).
2810 The third line gives the space allotted for a class, and the
2812 The problem here is the argument aC should not be
2814 The four types of classes are string, executable, closing
2815 punctuation and opening punctuation.
2816 The last line shows the entire
2817 argument list as it was read.
2818 In this next example, the offending
2821 .Bd -literal -offset indent
2823 \&.Em An escaped \\&aC
2826 .Bd -literal -offset indent
2828 DEBUG(fargv) MACRO: `.Em' Line #: 2
2829 Argc: 1 Argv: `An' Length: 2
2830 Space: ` ' Class: String
2831 Argc: 2 Argv: `escaped' Length: 7
2832 Space: ` ' Class: String
2833 Argc: 3 Argv: `aC' Length: 2
2834 Space: ` ' Class: String
2835 MACRO REQUEST: .Em An escaped &aC
2841 shows up with the same length of 2 as the
2843 sequence produces a zero width, but a register
2846 was not found and the type classified as string.
2848 Other diagnostics consist of usage statements and are self explanatory.
2849 .Sh GROFF, TROFF AND NROFF
2852 package does not need compatibility mode with
2855 The package inhibits page breaks, and the headers and footers
2856 which normally occur at those breaks with
2858 to make the manual more efficient for viewing on-line.
2863 does eject the imaginary remainder of the page at end of file.
2864 The inhibiting of the page breaks makes
2866 files unsuitable for hardcopy.
2867 There is a register named
2869 which can be set to zero in the site dependent style file
2870 .Pa /usr/src/share/tmac/doc-nroff
2871 to restore the old style behavior.
2873 .Bl -tag -width /usr/share/man0/template.doc -compact
2874 .It Pa /usr/share/tmac/doc.tmac
2875 manual macro package
2876 .It Pa /usr/share/misc/mdoc.template
2877 template for writing a man page
2878 .It Pa /usr/share/examples/mdoc/*
2879 several example man pages
2882 Undesirable hyphenation on the dash of a flag
2883 argument is not yet resolved, and causes
2884 occasional mishaps in the
2887 (line break on the hyphen).
2889 Predefined strings are not declared in documentation.
2891 Section 3f has not been added to the header routines.
2894 font should be changed in
2899 needs to have a check to prevent splitting up
2900 if the line length is too short.
2902 separates the last parenthesis, and sometimes
2903 looks ridiculous if a line is in fill mode.
2905 The method used to prevent header and footer page
2906 breaks (other than the initial header and footer) when using
2907 nroff occasionally places an unsightly partially filled line (blank)
2908 at the would be bottom of the page.
2910 The list and display macros to not do any keeps
2911 and certainly should be able to.
2912 .\" Note what happens if the parameter list overlaps a newline
2914 .\" to make sure a line boundary is crossed:
2916 .\" \&.Fn struct\\\ dictionarytable\\\ *dictionarylookup struct\\\ dictionarytable\\\ *tab[]
2919 .\" produces, nudge nudge,
2920 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
2921 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
2923 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] .
2925 .\" If double quotes are used, for example:
2927 .\" \&.Fn \*qstruct dictionarytable *dictionarylookup\*q \*qchar *h\*q \*qstruct dictionarytable *tab[]\*q
2930 .\" produces, nudge nudge,
2931 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
2933 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
2935 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" .
2937 .\" Not a pretty sight...
2938 .\" In a paragraph, a long parameter containing unpaddable spaces as
2939 .\" in the former example will cause
2941 .\" to break the line and spread
2942 .\" the remaining words out.
2943 .\" The latter example will adjust nicely to
2944 .\" justified margins, but may break in between an argument and its
2948 .\" the right margin adjustment is normally ragged and the problem is