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
33 .\" This tutorial sampler invokes every macro in the package several
34 .\" times and is guaranteed to give a worst case performance
35 .\" for an already extremely slow package.
42 .Nd tutorial sampler for writing
49 A tutorial sampler for writing
54 .Em content Ns \-based
63 addressed page layout leaving the
64 manipulation of fonts and other
65 typesetting details to the individual author.
70 .Em "page structure domain"
71 which consists of macros for titles, section headers, displays
72 and lists. Essentially items which affect the physical position
73 of text on a formatted page.
74 In addition to the page structure domain, there are two more domains,
75 the manual domain and the general text domain.
76 The general text domain is defined as macros which
77 perform tasks such as quoting or emphasizing pieces of text.
78 The manual domain is defined as macros that are a subset of the
79 day to day informal language used to describe commands, routines
83 Macros in the manual domain handle
84 command names, command line arguments and options, function names,
85 function parameters, pathnames, variables, cross
86 references to other manual pages, and so on.
89 for both the author and the future user of the manual page.
90 It is hoped the consistency gained
91 across the manual set will provide easier
92 translation to future documentation tools.
96 manual pages, a manual entry
98 to as a man page, regardless of actual length and without
101 Since a tutorial document is normally read when a person
102 desires to use the material immediately, the assumption has
103 been made that the user of this document may be impatient.
104 The material presented in the remained of this document is
106 .Bl -enum -offset indent
108 .Tn "TROFF IDIOSYNCRASIES"
109 .Bl -tag -width flag -compact -offset indent
111 .It "Passing Space Characters in an Argument" .
112 .It "Trailing Blank Space Characters (a warning)" .
113 .It "Escaping Special Characters" .
116 .Tn "THE ANATOMY OF A MAN PAGE"
117 .Bl -tag -width flag -compact -offset indent
118 .It "A manual page template" .
123 .Tn "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS" .
124 .Bl -tag -width flag -compact -offset indent
125 .It "What's in a name..." .
126 .It "General Syntax" .
130 .Bl -tag -width flag -compact -offset indent
134 .It "Configuration Declarations (section four only)" .
135 .It "Command Modifier" .
136 .It "Defined Variables" .
137 .It "Errno's (Section two only)" .
138 .It "Environment Variables" .
139 .It "Function Argument" .
140 .It "Function Declaration" .
142 .It "Functions (library routines)" .
143 .It "Function Types" .
144 .\" .It "Header File (including source code)" .
145 .It "Interactive Commands" .
150 .It "Cross References" .
153 .Tn "GENERAL TEXT DOMAIN"
154 .Bl -tag -width flag -compact -offset indent
157 .It "FreeBSD Macro" .
159 .It "Enclosure/Quoting Macros"
160 .Bl -tag -width flag -compact -offset indent
161 .It "Angle Bracket Quote/Enclosure" .
162 .It "Bracket Quotes/Enclosure" .
163 .It "Double Quote macro/Enclosure" .
164 .It "Parenthesis Quote/Enclosure" .
165 .It "Single Quotes/Enclosure" .
168 .It "No\-Op or Normal Text Macro" .
169 .It "No Space Macro" .
170 .It "Section Cross References" .
171 .It "References and Citations" .
172 .It "Return Values (sections two and three only)"
173 .It "Trade Names (Acronyms and Type Names)" .
174 .It "Extended Arguments" .
177 .Tn "PAGE STRUCTURE DOMAIN"
178 .Bl -tag -width flag -compact -offset indent
179 .It "Section Headers" .
180 .It "Paragraphs and Line Spacing" .
183 .It "Font Modes (Emphasis, Literal, and Symbolic)" .
184 .It "Lists and Columns" .
187 .Tn "PREDEFINED STRINGS"
191 .Tn "FORMATTING WITH GROFF, TROFF AND NROFF"
196 .Sh TROFF IDIOSYNCRASIES
199 package attempts to simplify the process of writing a man page.
200 Theoretically, one should not have to learn the dirty details of
204 however, there are a few
205 limitations which are unavoidable and best gotten out
207 And, too, be forewarned, this package is
213 a macro is called by placing a
217 a line followed by the two character name for the macro.
218 Arguments may follow the macro separated by spaces.
219 It is the dot character at the beginning of the line which causes
221 to interpret the next two characters as a macro name.
225 at the beginning of a line in some context other than
226 a macro invocation, precede the
233 translates literally to a zero width space, and is never displayed in the
238 macros accept up to nine arguments, any
239 extra arguments are ignored.
242 accept nine arguments and,
243 in limited cases, arguments may be continued or extended
247 A few macros handle quoted arguments (see
248 .Sx Passing Space Characters in an Argument
253 general text domain and manual domain macros are special
254 in that their argument lists are
256 for callable macro names.
257 This means an argument on the argument list which matches
258 a general text or manual domain macro name and is determined
259 to be callable will be executed
260 or called when it is processed.
262 the argument, although the name of a macro,
266 It is in this manner that many macros are nested; for
272 the flag and argument macros,
276 to specify an optional flag with an argument:
277 .Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
280 .Li \&.Op \&Fl s \&Ar bytes
283 To prevent a two character
284 string from being interpreted as a macro name, precede
288 .Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
289 .It Op \&Fl s \&Ar bytes
291 .Li \&.Op \e&Fl s \e&Ar bytes
298 are not interpreted as macros.
299 Macros whose argument lists are parsed for callable arguments
301 as parsed and macros which may be called from an argument
302 list are referred to as callable
303 throughout this document and in the companion quick reference
308 as almost all of the macros in
310 are parsed, but as it was cumbersome to constantly refer to macros
311 as being callable and being able to call other macros,
312 the term parsed has been used.
313 .Ss Passing Space Characters in an Argument
314 Sometimes it is desirable to give as one argument a string
315 containing one or more blank space characters.
316 This may be necessary
317 to defeat the nine argument limit or to specify arguments to macros
318 which expect particular arrangement of items in the argument list.
322 expects the first argument to be the name of a function and any
323 remaining arguments to be function parameters.
326 stipulates the declaration of function parameters in the
327 parenthesized parameter list, each parameter is guaranteed
328 to be at minimum a two word string.
332 There are two possible ways to pass an argument which contains
334 .Em Implementation note :
335 Unfortunately, the most convenient way
336 of passing spaces in between quotes by reassigning individual
337 arguments before parsing was fairly expensive speed wise
338 and space wise to implement in all the macros for
341 It is not expensive for
343 but for the sake of portability, has been limited
344 to the following macros which need
347 .Bl -tag -width 4n -offset indent -compact
349 Configuration declaration (section 4
352 Begin list (for the width specifier).
356 Functions (sections two and four).
368 Optional notes for a reference.
370 Report title (in a reference).
372 Title of article in a book or journal.
375 One way of passing a string
376 containing blank spaces is to use the hard or unpaddable space character
378 that is, a blank space preceded by the escape character
380 This method may be used with any macro but has the side effect
381 of interfering with the adjustment of text
382 over the length of a line.
384 sees the hard space as if it were any other printable character and
385 cannot split the string into blank or newline separated pieces as one
387 The method is useful for strings which are not expected
388 to overlap a line boundary.
390 .Bl -tag -width "fetch(char *str)" -offset indent
391 .It Fn fetch char\ *str
393 .Ql \&.Fn fetch char\e *str
394 .It Fn fetch "char *str"
395 can also be created by
396 .Ql \&.Fn fetch "\\*qchar *str\\*q"
404 would see three arguments and
407 .Dl Fn fetch char *str
409 For an example of what happens when the parameter list overlaps
410 a newline boundary, see the
413 .Ss Trailing Blank Space Characters
415 can be confused by blank space characters at the end of a line.
417 is a wise preventive measure to globally remove all blank spaces
418 from <blank-space><end-of-line> character sequences.
420 arise to force a blank character at the end of a line,
421 it may be forced with an unpaddable space and the
426 .Ss Escaping Special Characters
428 like the newline character
430 are handled by replacing the
438 .Sh THE ANATOMY OF A MAN PAGE
439 The body of a man page is easily constructed from a basic
440 template found in the file
441 .Pa /usr/share/misc/mdoc.template .
442 Several example man pages can also be found
444 .Pa /usr/share/examples/mdoc .
446 .Ss A manual page template
447 .Bd -literal -offset indent
448 \&.\e" The following requests are required for all man pages.
449 \&.Dd Month day, year
450 \&.Os OPERATING_SYSTEM [version/release]
451 \&.Dt DOCUMENT_TITLE [section number] [volume]
454 \&.Nd one line description of name
457 \&.\e" The following requests should be uncommented and
458 \&.\e" used where appropriate. This next request is
459 \&.\e" for sections 2 and 3 function return values only.
460 \&.\e" .Sh RETURN VALUES
461 \&.\e" This next request is for sections 1, 6, 7 & 8 only
462 \&.\e" .Sh ENVIRONMENT
465 \&.\e" This next request is for sections 1, 6, 7 & 8 only
466 \&.\e" (command return values (to shell) and
467 \&.\e" fprintf/stderr type diagnostics)
468 \&.\e" .Sh DIAGNOSTICS
469 \&.\e" The next request is for sections 2 and 3 error
470 \&.\e" and signal handling only.
473 \&.\e" .Sh CONFORMING TO
479 The first items in the template are the macros
480 .Pq Li \&.Dd , \&.Os , \&.Dt ;
482 the operating system the man page or subject source is developed
484 and the man page title
486 along with the section of the manual the page
488 These macros identify the page,
489 and are discussed below in
492 The remaining items in the template are section headers
503 .Sx PAGE STRUCTURE DOMAIN ,
507 Several content macros are used to demonstrate page layout macros;
508 reading about content macros before page layout macros is
511 The title macros are the first portion of the page structure
512 domain, but are presented first and separate for someone who
513 wishes to start writing a man page yesterday.
514 Three header macros designate the document title or manual page title,
515 the operating system,
516 and the date of authorship.
517 These macros are one called once at the very beginning of the document
518 and are used to construct the headers and footers only.
520 .It Li \&.Dt DOCUMENT_TITLE section# [volume]
521 The document title is the
522 subject of the man page and must be in
526 The section number may be 1,\ ...,\ 8,
527 and if it is specified,
528 the volume title may be omitted.
529 A volume title may be arbitrary or one of the following:
531 .\" USD UNIX User's Supplementary Documents
533 .\" PS1 UNIX Programmer's Supplementary Documents
535 .Bl -column SMM -offset indent -compact
536 .It Li AMD UNIX Ancestral Manual Documents
537 .It Li SMM UNIX System Manager's Manual
538 .It Li URM UNIX Reference Manual
539 .It Li PRM UNIX Programmer's Manual
542 The default volume labeling is
544 for sections 1, 6, and 7;
548 for sections 2, 3, 4, and 5.
550 .\" MMI UNIX Manual Master Index
552 .\" CON UNIX Contributed Software Manual
554 .\" LOC UNIX Local Manual
555 .It Li \&.Os operating_system release#
556 The name of the operating system
557 should be the common acronym, e.g.
563 The release should be the standard release
564 nomenclature for the system specified, e.g. 4.3, 4.3+Tahoe, V.3,
566 Unrecognized arguments are displayed as given in the page footer.
567 For instance, a typical footer might be:
572 .Dl \&.Os FreeBSD 2.2
574 or for a locally produced set
576 .Dl \&.Os CS Department
578 The Berkeley default,
580 without an argument, has been defined as
584 .Pa /usr/share/tmac/mdoc/doc-common .
585 It really should default to
589 macro is not present, the bottom left corner of the page
591 .It Li \&.Dd month day, year
592 The date should be written formally:
597 .Sh INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS
598 .Ss What's in a name...
599 The manual domain macro names are derived from the day to day
600 informal language used to describe commands, subroutines and related
602 Slightly different variations of this language are used to describe
603 the three different aspects of writing a man page.
604 First, there is the description of
607 Second is the description of a
613 the description of a command to a user in the verbal sense;
614 that is, discussion of a command in the text of a man page.
618 macros are themselves a type of command;
619 the general syntax for a troff command is:
620 .Bd -filled -offset indent
621 \&.Va argument1 argument2 ... argument9
626 is a macro command or request, and anything following it is an argument to
631 command using the content macros is a
635 command line might be displayed as:
636 .Bd -filled -offset indent
644 is the command name and the
649 argument designated as optional by the option brackets.
659 The macros which formatted the above example:
660 .Bd -literal -offset indent
666 In the third case, discussion of commands and command syntax
667 includes both examples above, but may add more detail.
673 from the example above might be referred to as
677 Some command line argument lists are quite long:
678 .Bl -tag -width make -offset indent
685 .Op Fl I Ar directory
688 .Op Ar variable=value
694 Here one might talk about the command
696 and qualify the argument
698 as an argument to the flag,
700 or discuss the optional
704 In the verbal context, such detail can prevent confusion,
708 does not have a macro for an argument
713 argument macro is used for an operand or file argument like
715 as well as an argument to a flag like
717 The make command line was produced from:
718 .Bd -literal -offset indent
721 \&.Op Fl D Ar variable
723 \&.Op Fl f Ar makefile
724 \&.Op Fl I Ar directory
725 \&.Op Fl j Ar max_jobs
726 \&.Op Ar variable=value
736 macros are explained in
739 The manual domain and general text domain macros share a similar
740 syntax with a few minor deviations:
746 differ only when called without arguments;
750 impose an order on their argument lists
756 have nesting limitations.
758 are capable of recognizing and properly handling punctuation,
759 provided each punctuation character is separated by a leading space.
760 If an request is given:
762 .Dl \&.Li sptr, ptr),
768 The punctuation is not recognized and all is output in the
769 literal font. If the punctuation is separated by a leading
772 .Dl \&.Li "sptr , ptr ) ,"
776 .Dl Li sptr , ptr ) ,
778 The punctuation is now recognized and is output in the
779 default font distinguishing it from the strings in literal font.
781 To remove the special meaning from a punctuation character
785 is limited as a macro language, and has difficulty
786 when presented with a string containing
787 a member of the mathematical, logical or
789 .Bd -literal -offset indent-two
790 \&{+,\-,/,*,\&%,<,>,<=,>=,=,==,&,`,',"}
795 may assume it is supposed to actually perform the operation
796 or evaluation suggested by the characters. To prevent
797 the accidental evaluation of these characters,
800 Typical syntax is shown in the first content macro displayed
805 The address macro identifies an address construct
806 of the form addr1[,addr2[,addr3]].
808 .Dl Usage: .Ad address ... \*(Pu
809 .Bl -tag -width ".Ad f1 , f2 , f3 :" -compact -offset 14n
812 .It Li \&.Ad addr1\ .
814 .It Li \&.Ad addr1\ , file2
816 .It Li \&.Ad f1\ , f2\ , f3\ :
818 .It Li \&.Ad addr\ )\ )\ ,
822 It is an error to call
826 is callable by other macros and is parsed.
830 macro is used to specify the name of the author of the item being
831 documented, or the name of the author of the actual manual page.
832 Any remaining arguments after the name information are assumed
835 .Dl Usage: .An author_name \*(Pu
836 .Bl -tag -width ".An Joe Author ) ) ," -compact -offset 14n
837 .It Li \&.An Joe\ Author
839 .It Li \&.An Joe\ Author\ ,
841 .It Li \&.An Joe\ Author\ \&Aq\ nobody@FreeBSD.ORG
842 .An Joe Author Aq nobody@FreeBSD.ORG
843 .It Li \&.An Joe\ Author\ )\ )\ ,
849 macro is parsed and is callable.
850 It is an error to call
857 argument macro may be used whenever
858 a command line argument is referenced.
860 .Dl Usage: .Ar argument ... \*(Pu
861 .Bl -tag -width ".Ar file1 file2" -compact -offset 15n
866 .It Li \&.Ar file1\ .
868 .It Li \&.Ar file1 file2
870 .It Li \&.Ar f1 f2 f3\ :
872 .It Li \&.Ar file\ )\ )\ ,
878 is called without arguments
883 macro is parsed and is callable.
884 .Ss Configuration Declaration (section four only)
887 macro is used to demonstrate a
889 declaration for a device interface in a section four manual.
890 This macro accepts quoted arguments (double quotes only).
892 .Bl -tag -width "device le0 at scode?" -offset indent
893 .It Cd "device le0 at scode?"
895 .Ql ".Cd device le0 at scode?" .
898 The command modifier is identical to the
900 (flag) command with the exception
903 macro does not assert a dash
904 in front of every argument.
905 Traditionally flags are marked by the
906 preceding dash, some commands or subsets of commands do not use them.
907 Command modifiers may also be specified in conjunction with interactive
908 commands such as editor commands.
911 .Ss Defined Variables
912 A variable which is defined in an include file is specified
916 .Dl Usage: .Dv defined_variable ... \*(Pu
917 .Bl -tag -width ".Dv MAXHOSTNAMELEN" -compact -offset 14n
918 .It Li ".Dv MAXHOSTNAMELEN"
920 .It Li ".Dv TIOCGPGRP )"
924 It is an error to call
928 is parsed and is callable.
929 .Ss Errno's (Section two only)
932 errno macro specifies the error return value
933 for section two library routines.
939 general text domain macro, as it would be used in
940 a section two manual page.
942 .Dl Usage: .Er ERRNOTYPE ... \*(Pu
943 .Bl -tag -width ".Bq Er ENOTDIR" -compact -offset 14n
946 .It Li \&.Er ENOENT\ )\ ;
948 .It Li \&.Bq \&Er ENOTDIR
952 It is an error to call
957 macro is parsed and is callable.
958 .Ss Environment Variables
961 macro specifies an environment variable.
963 .Dl Usage: .Ev argument ... \*(Pu
964 .Bl -tag -width ".Ev PRINTER ) ) ," -compact -offset 14n
969 .It Li \&.Ev PRINTER\ )\ )\ ,
973 It is an error to call
978 macro is parsed and is callable.
979 .Ss Function Argument
982 macro is used to refer to function arguments (parameters)
985 section of the manual or inside
988 section should a parameter list be too
991 macro and the enclosure macros
997 may also be used to refer to structure members.
999 .Dl Usage: .Fa function_argument ... \*(Pu
1000 .Bl -tag -width ".Fa d_namlen\ )\ )\ ," -compact -offset 14n
1001 .It Li \&.Fa d_namlen\ )\ )\ ,
1003 .It Li \&.Fa iov_len
1007 It is an error to call
1011 is parsed and is callable.
1012 .Ss Function Declaration
1015 macro is used in the
1017 section with section two or three
1021 macro does not call other macros and is not callable by other
1024 .Dl Usage: .Fd include_file (or defined variable)
1030 request causes a line break if a function has already been presented
1031 and a break has not occurred.
1032 This leaves a nice vertical space
1033 in between the previous function call and the declaration for the
1038 macro handles command line flags.
1043 For interactive command flags, which
1044 are not prepended with a dash, the
1047 macro is identical, but without the dash.
1049 .Dl Usage: .Fl argument ... \*(Pu
1050 .Bl -tag -width ".Fl \-s \-t \-v" -compact -offset 14n
1061 .It Li \&.Fl xyz\ )\ ,
1067 macro without any arguments results
1068 in a dash representing stdin/stdout.
1071 a single dash, will result in two dashes.
1074 macro is parsed and is callable.
1075 .Ss Functions (library routines)
1076 The .Fn macro is modeled on ANSI C conventions.
1078 Usage: .Fn [type] function [[type] parameters ... \*(Pu]
1080 .Bl -tag -width ".Fn .int align. .const * char *sptrsxx" -compact
1081 .It Li "\&.Fn getchar"
1083 .It Li "\&.Fn strlen ) ,"
1085 .It Li \&.Fn "\\*qint align\\*q" "\\*qconst * char *sptrs\\*q" ,
1086 .Fn "int align" "const * char *sptrs" ,
1089 It is an error to call
1091 without any arguments.
1095 is parsed and is callable,
1096 note that any call to another macro signals the end of
1099 call (it will close-parenthesis at that point).
1101 For functions that have more than eight parameters (and this
1112 to get around the limitation. For example:
1113 .Bd -literal -offset indent
1114 \&.Fo "int res_mkquery"
1121 \&.Fa "struct rrec *newrr"
1128 .Bd -filled -offset indent
1129 .Fo "int res_mkquery"
1136 .Fa "struct rrec *newrr"
1146 macros are parsed and are callable.
1149 section, the function will always begin at
1150 the beginning of line.
1151 If there is more than one function
1154 section and a function type has not been
1155 given, a line break will occur, leaving a nice vertical space
1156 between the current function name and the one prior.
1159 does not check its word boundaries
1160 against troff line lengths and may split across a newline
1162 This will be fixed in the near future.
1164 This macro is intended for the
1168 anywhere else in the man page without problems, but its main purpose
1169 is to present the function type in kernel normal form for the
1171 of sections two and three
1172 (it causes a line break allowing the function name to appear
1175 .Dl Usage: .Ft type ... \*(Pu
1176 .Bl -tag -width "\&.Ft struct stat" -offset 14n -compact
1177 .It Li \&.Ft struct stat
1183 request is not callable by other macros.
1184 .Ss Interactive Commands
1187 macro designates an interactive or internal command.
1189 .Dl Usage: .Ic argument ... \*(Pu
1190 .Bl -tag -width ".Ic setenv , unsetenvxx" -compact -offset 14n
1193 .It Li \&.Ic do while {...}
1195 .It Li \&.Ic setenv\ , unsetenv
1196 .Ic setenv , unsetenv
1199 It is an error to call
1204 macro is parsed and is callable.
1208 macro is used for the document title or subject name.
1209 It has the peculiarity of remembering the first
1210 argument it was called with, which should
1211 always be the subject name of the page.
1215 regurgitates this initial name for the sole purpose
1216 of making less work for the author.
1219 or three document function name is addressed with the
1227 and remaining sections.
1228 For interactive commands, such as the
1234 macro should be used.
1240 it can not recall the first argument it was invoked with.
1242 .Dl Usage: .Nm argument ... \*(Pu
1243 .Bl -tag -width ".Nm mdoc.sample" -compact -offset 14n
1244 .It Li \&.Nm mdoc.sample
1246 .It Li \&.Nm \e-mdoc
1248 .It Li \&.Nm foo\ )\ )\ ,
1256 macro is parsed and is callable.
1261 places option brackets around the any remaining arguments on the command
1262 line, and places any
1263 trailing punctuation outside the brackets.
1268 may be used across one or more lines.
1270 .Dl Usage: .Op options ... \*(Pu
1271 .Bl -tag -width ".Op Fl c Ar objfil Op Ar corfil ," -compact -offset indent
1276 .It Li ".Op Fl k ) ."
1278 .It Li ".Op Fl k Ar kookfile"
1279 .Op Fl k Ar kookfile
1280 .It Li ".Op Fl k Ar kookfile ,"
1281 .Op Fl k Ar kookfile ,
1282 .It Li ".Op Ar objfil Op Ar corfil"
1283 .Op Ar objfil Op Ar corfil
1284 .It Li ".Op Fl c Ar objfil Op Ar corfil ,"
1285 .Op Fl c Ar objfil Op Ar corfil ,
1286 .It Li \&.Op word1 word2
1295 .Bd -literal -offset indent
1297 \&.Op \&Fl k \&Ar kilobytes
1298 \&.Op \&Fl i \&Ar interval
1299 \&.Op \&Fl c \&Ar count
1305 .Op Fl k Ar kilobytes
1306 .Op Fl i Ar interval
1315 are parsed and are callable.
1319 macro formats path or file names.
1321 .Dl Usage: .Pa pathname \*(Pu
1322 .Bl -tag -width ".Pa /tmp/fooXXXXX ) ." -compact -offset 14n
1323 .It Li \&.Pa /usr/share
1325 .It Li \&.Pa /tmp/fooXXXXX\ )\ .
1326 .Pa /tmp/fooXXXXX ) .
1331 macro is parsed and is callable.
1333 Generic variable reference:
1335 .Dl Usage: .Va variable ... \*(Pu
1336 .Bl -tag -width ".Va char s ] ) ) ," -compact -offset 14n
1339 .It Li \&.Va settimer ,
1341 .It Li \&.Va int\ *prt\ )\ :
1343 .It Li \&.Va char\ s\ ]\ )\ )\ ,
1347 It is an error to call
1349 without any arguments.
1352 macro is parsed and is callable.
1353 .Ss Manual Page Cross References
1356 macro expects the first argument to be
1357 a manual page name, and the second argument, if it exists,
1358 to be either a section page number or punctuation.
1360 remaining arguments are assumed to be punctuation.
1362 .Dl Usage: .Xr man_page [1,...,8] \*(Pu
1363 .Bl -tag -width ".Xr mdoc 7 ) ) ," -compact -offset 14n
1366 .It Li \&.Xr mdoc\ ,
1370 .It Li \&.Xr mdoc 7\ )\ )\ ,
1376 macro is parsed and is callable.
1377 It is an error to call
1381 .Sh GENERAL TEXT DOMAIN
1383 .Bd -literal -offset indent -compact
1384 Usage: .At [v6 | v7 | 32v | V.1 | V.4] ... \*(Pu
1386 .Bl -tag -width ".At v6 ) ," -compact -offset 14n
1399 callable. It accepts at most two arguments.
1401 .Dl Usage: .Bx [Version/release] ... \*(Pu
1402 .Bl -tag -width ".Bx 4.3 ) ," -compact -offset 14n
1411 macro is parsed and is callable.
1413 .Bd -literal -offset indent -compact
1414 Usage: .Fx Version.release ... \*(Pu
1416 .Bl -tag -width ".Fx 2.2 ) ," -compact -offset 14n
1427 callable. It accepts at most two arguments.
1429 .Dl Usage: .Ux ... \*(Pu
1430 .Bl -tag -width ".Ux 4.3 ) ," -compact -offset 14n
1437 macro is parsed and is callable.
1438 .Ss Enclosure and Quoting Macros
1439 The concept of enclosure is similar to quoting.
1440 The object being to enclose one or more strings between
1441 a pair of characters like quotes or parentheses.
1442 The terms quoting and enclosure are used
1443 interchangeably throughout this document.
1445 one line enclosure macros end
1448 to give a hint of quoting, but there are a few irregularities.
1449 For each enclosure macro
1450 there is also a pair of open and close macros which end
1456 These can be used across one or more lines of text
1457 and while they have nesting limitations, the one line quote macros
1462 .Bd -filled -offset indent
1463 .Bl -column "quote " "close " "open " "Enclose Stringx(in XX) " XXstringXX
1464 .Em " Quote Close Open Function Result"
1465 \&.Aq .Ac .Ao Angle Bracket Enclosure <string>
1466 \&.Bq .Bc .Bo Bracket Enclosure [string]
1467 \&.Dq .Dc .Do Double Quote ``string''
1468 .Ec .Eo Enclose String (in XX) XXstringXX
1469 \&.Pq .Pc .Po Parenthesis Enclosure (string)
1470 \&.Ql Quoted Literal `st' or string
1471 \&.Qq .Qc .Qo Straight Double Quote "string"
1472 \&.Sq .Sc .So Single Quote `string'
1476 Except for the irregular macros noted below, all
1477 of the quoting macros are parsed and callable.
1478 All handle punctuation properly, as long as it
1479 is presented one character at a time and separated by spaces.
1480 The quoting macros examine opening and closing punctuation
1481 to determine whether it comes before or after the
1482 enclosing string. This makes some nesting possible.
1483 .Bl -tag -width xxx,xxxx
1484 .It Li \&.Ec , \&.Eo
1485 These macros expect the first argument to be the
1486 opening and closing strings respectively.
1488 The quoted literal macro behaves differently for
1494 a quoted literal is always quoted. If formatted with
1495 troff, an item is only quoted if the width
1496 of the item is less than three constant width characters.
1497 This is to make short strings more visible where the font change
1498 to literal (constant width) is less noticeable.
1500 The prefix macro is not callable, but it is parsed:
1501 .Bl -tag -width "(namexx" -offset indent
1502 .It Li ".Pf ( Fa name2"
1509 (no space) macro performs the analogous suffix function.
1513 Examples of quoting:
1514 .Bl -tag -width ".Aq Pa ctype.h ) ,xxxxxxxx" -compact -offset indent
1517 .It Li \&.Aq \&Ar ctype.h\ )\ ,
1521 .It Li \&.Bq \&Em Greek \&, French \&.
1522 .Bq Em Greek , French .
1525 .It Li ".Dq string abc ."
1527 .It Li ".Dq \'^[A-Z]\'"
1529 .It Li "\&.Ql man mdoc"
1533 .It Li "\&.Qq string ) ,"
1535 .It Li "\&.Qq string Ns ),"
1539 .It Li "\&.Sq string
1543 For a good example of nested enclosure macros, see the
1546 It was created from the same
1547 underlying enclosure macros as those presented in the list
1553 extended argument list macros
1554 were also built from the same underlying routines and are a good
1557 macro usage at its worst.
1558 .Ss No\-Op or Normal Text Macro
1562 a hack for words in a macro command line which should
1564 be formatted and follows the conventional syntax
1569 macro eliminates unwanted spaces in between macro requests.
1570 It is useful for old style argument lists where there is no space
1571 between the flag and argument:
1572 .Bl -tag -width ".Op Fl I Ns Ar directoryxx" -offset indent
1573 .It Li ".Op Fl I Ns Ar directory"
1575 .Op Fl I Ns Ar directory
1580 macro always invokes the
1582 macro after eliminating the space unless another macro name
1586 is parsed and is callable.
1587 .Ss Section Cross References
1590 macro designates a reference to a section header
1591 within the same document.
1592 It is parsed and is callable.
1594 .Bl -tag -width "Li \&.Sx FILES" -offset 14n
1598 .Ss References and Citations
1599 The following macros make a modest attempt to handle references.
1600 At best, the macros make it convenient to manually drop in a subset of
1601 refer style references.
1603 .Bl -tag -width 6n -offset indent -compact
1606 Causes a line break and begins collection
1607 of reference information until the
1608 reference end macro is read.
1611 The reference is printed.
1613 Reference author name, one name per invocation.
1625 Optional information.
1636 The macros beginning with
1638 are not callable, and are parsed only for the trade name macro which
1639 returns to its caller.
1640 (And not very predictably at the moment either.)
1641 The purpose is to allow trade names
1642 to be pretty printed in
1643 .Xr troff Ns / Ns Xr ditroff
1648 macro generates text for use in the
1652 .Dl Usage: .Rv [-std function]
1654 .Ql \&.Rv -std atexit
1655 will generate the following text:
1657 .\" fake chapter 3 to avoid error message from Rv
1660 .\" and back to 7 again
1665 option is valid only for manual page sections 2 and 3.
1666 .Ss Trade Names (or Acronyms and Type Names)
1667 The trade name macro is generally a small caps macro for
1668 all upper case words longer than two characters.
1670 .Dl Usage: .Tn symbol ... \*(Pu
1671 .Bl -tag -width ".Tn ASCII" -compact -offset 14n
1681 is parsed and is callable by other macros.
1682 .Ss Extended Arguments
1687 macros allow one to extend an argument list
1688 on a macro boundary.
1689 Argument lists cannot
1690 be extended within a macro
1691 which expects all of its arguments on one line such
1695 Here is an example of
1697 using the space mode macro to turn spacing off:
1698 .Bd -literal -offset indent
1700 \&.It Xo Sy I Ar operation
1701 \&.No \een Ar count No \een
1707 .Bd -filled -offset indent
1708 .Bl -tag -width flag -compact
1710 .It Xo Sy I Ar operation
1711 .No \en Ar count No \en
1718 .Bd -literal -offset indent
1720 \&.It Cm S No \&/ Ar old_pattern Xo
1721 \&.No \&/ Ar new_pattern
1728 .Bd -filled -offset indent
1729 .Bl -tag -width flag -compact
1731 .It Cm S No \&/ Ar old_pattern Xo
1732 .No \&/ Ar new_pattern
1741 and using enclosure macros:
1742 Test the value of an variable.
1743 .Bd -literal -offset indent
1746 \&.Oo \e&! Oc Ns Ar variable
1747 \&.Op Ar operator variable ...
1752 .Bd -filled -offset indent
1753 .Bl -tag -width flag -compact
1756 .Oo \&! Oc Ns Ar variable
1757 .Op Ar operator variable ...
1762 All of the above examples have used the
1764 macro on the argument list of the
1768 The extend macros are not used very often, and when they are
1769 it is usually to extend the list-item argument list.
1770 Unfortunately, this is also where the extend macros are the
1772 In the first two examples, spacing was turned off;
1773 in the third, spacing was desired in part of the output but
1775 To make these macros work in this situation make sure
1780 macros are placed as shown in the third example.
1783 macro is not alone on the
1785 argument list, spacing will be unpredictable.
1789 must not occur as the first or last macro on a line
1791 Out of 900 manual pages (about 1500 actual pages)
1792 currently released with
1794 only fifteen use the
1797 .Sh PAGE STRUCTURE DOMAIN
1801 section header macros
1802 list below are required in every
1804 The remaining section headers
1805 are recommended at the discretion of the author
1806 writing the manual page.
1809 macro can take up to nine arguments.
1810 It is parsed and but is not callable.
1811 .Bl -tag -width ".Sh SYNOPSIS"
1817 the headers, footers and page layout defaults
1818 will not be set and things will be rather unpleasant.
1821 section consists of at least three items.
1824 name macro naming the subject of the man page.
1825 The second is the Name Description macro,
1827 which separates the subject
1828 name from the third item, which is the description.
1830 description should be the most terse and lucid possible,
1831 as the space available is small.
1835 section describes the typical usage of the
1836 subject of a man page.
1852 for manual page sections 2 and 3, the command and general
1855 is required for sections 1, 5, 6, 7, 8.
1856 Section 4 manuals require a
1861 configuration device usage macro.
1862 Several other macros may be necessary to produce
1863 the synopsis line as shown below:
1865 .Bd -filled -offset indent
1872 The following macros were used:
1875 .Dl \&.Op \&Fl benstuv
1885 recognize the pipe bar character
1887 so a command line such as:
1889 .Dl ".Op Fl a | Fl b"
1891 will not go orbital.
1893 normally interprets a \*(Ba as a special operator.
1895 .Sx PREDEFINED STRINGS
1897 character in other situations.
1898 .It \&.Sh DESCRIPTION
1899 In most cases the first text in the
1902 is a brief paragraph on the command, function or file,
1903 followed by a lexical list of options and respective
1905 To create such a list, the
1912 macros are used (see
1913 .Sx Lists and Columns
1919 section headers are part of the
1920 preferred manual page layout and must be used appropriately
1921 to maintain consistency.
1922 They are listed in the order
1923 in which they would be used.
1924 .Bl -tag -width SYNOPSIS
1925 .It \&.Sh ENVIRONMENT
1928 section should reveal any related
1930 variables and clues to their behavior and/or usage.
1932 There are several ways to create examples.
1939 Files which are used or created by the man page subject
1940 should be listed via the
1946 References to other material on the man page topic and
1947 cross references to other relevant man pages should
1952 are specified using the
1955 Cross references in the
1957 section should be sorted by section number, and then
1958 placed in alphabetical order and comma separated. For example:
1967 style references are not accommodated.
1968 .It \&.Sh CONFORMING TO
1969 If the command, library function or file adheres to a
1970 specific implementation such as
1974 this should be noted here.
1976 command does not adhere to any standard, its history
1977 should be noted in the
1981 Any command which does not adhere to any specific standards
1982 should be outlined historically in this section.
1984 Credits, if need be, should be placed here.
1985 .It \&.Sh DIAGNOSTICS
1986 Diagnostics from a command should be placed in this section.
1988 Specific error handling, especially from library functions
1989 (man page sections 2 and 3) should go here.
1992 macro is used to specify an errno.
1994 Blatant problems with the topic go here...
1999 sections may be added,
2000 for example, this section was set with:
2001 .Bd -literal -offset 14n
2002 \&.Sh PAGE STRUCTURE DOMAIN
2004 .Ss Paragraphs and Line Spacing.
2009 paragraph command may
2010 be used to specify a line space where necessary.
2011 The macro is not necessary after a
2021 macro asserts a vertical distance unless the -compact flag is given).
2023 .\" This worked with version one, need to redo for version three
2026 .\" .Cw (ax+bx+c) \ is\ produced\ by\ \&
2027 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2044 .\" .Em is produced by
2060 .\" This example shows the same equation in a different format.
2064 .\" signs were forced with
2068 .\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&
2069 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2080 .\" .Li \&.Cx \e\ +\e\ \e&
2091 .\" .Em is produced by
2099 .\" .Li \&.Cx \e\ +\e\ \e&
2110 .\" The incantation below was
2116 .\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by
2118 .\" .Li \&.Cx Op Sy ?/
2128 .\" .Em is produced by
2130 .\" .Li \&.Ar \e\ b1 e1 f1
2142 The only keep that is implemented at this time is for words.
2149 The only option that
2153 and is useful for preventing line breaks in the middle of options.
2154 In the example for the make command line arguments (see
2155 .Sx What's in a name ) ,
2159 flag and the argument
2161 (Actually, the option macro used to prevent this from occurring,
2162 but was dropped when the decision (religious) was made to force
2163 right justified margins in
2165 as options in general look atrocious when spread across a sparse
2167 More work needs to be done with the keep macros, a
2169 option needs to be added.)
2170 .Ss Examples and Displays
2171 There are five types of displays, a quickie one line indented display
2173 a quickie one line literal display
2175 and a block literal, block filled and block ragged which use
2183 .Bl -tag -width \&.Dlxx
2185 (D-one) Display one line of indented text.
2186 This macro is parsed, but it is not callable.
2190 The above was produced by:
2191 .Li \&.Dl Fl ldghfstru .
2194 Display one line of indented
2199 example macro has been used throughout this
2202 the indent (display) of one line of text.
2203 Its default font is set to
2204 constant width (literal) however
2205 it is parsed and will recognized other macros.
2206 It is not callable however.
2208 .Dl % ls -ldg /usr/local/bin
2210 The above was produced by
2211 .Li \&.Dl % ls -ldg /usr/local/bin .
2216 display must be ended with the
2219 Displays may be nested within displays and
2222 has the following syntax:
2224 .Dl ".Bd display-type [-offset offset_value] [-compact]"
2226 The display-type must be one of the following four types and
2227 may have an offset specifier for indentation:
2230 .Bl -tag -width "file file_name " -compact
2232 Display a block of text as typed,
2233 right (and left) margin edges are left ragged.
2235 Display a filled (formatted) block.
2236 The block of text is formatted (the edges are filled \-
2237 not left unjustified).
2239 Display a literal block, useful for source code or
2240 simple tabbed or spaced text.
2241 .It Fl file Ar file_name
2242 The file name following the
2244 flag is read and displayed.
2246 asserted and tabs are set at 8 constant width character
2247 intervals, however any
2248 .Xr troff/ Ns Nm \-mdoc
2249 commands in file will be processed.
2250 .It Fl offset Ar string
2253 is specified with one of the following strings, the string
2254 is interpreted to indicate the level of indentation for the
2255 forthcoming block of text:
2257 .Bl -tag -width "indent-two" -compact
2259 Align block on the current left margin,
2260 this is the default mode of
2263 Supposedly center the block.
2265 unfortunately, the block merely gets
2266 left aligned about an imaginary center margin.
2268 Indents by one default indent value or tab.
2270 indent value is also used for the
2272 display so one is guaranteed the two types of displays
2274 This indent is normally set to 6n or about two
2275 thirds of an inch (six constant width characters).
2277 Indents two times the default indent value.
2281 aligns the block about two inches from
2282 the right side of the page.
2284 work and perhaps may never do the right thing by
2292 There are five macros for changing the appearance of the manual page text:
2293 .Bl -tag -width \&.Emxx
2295 Text may be stressed or emphasized with the
2298 The usual font for emphasis is italic.
2300 .Dl Usage: .Em argument ... \*(Pu
2301 .Bl -tag -width ".Em vide infra ) ) ," -compact -offset 14n
2302 .It Li ".Em does not"
2304 .It Li ".Em exceed 1024 ."
2306 .It Li ".Em vide infra ) ) ,"
2307 .Em vide infra ) ) ,
2312 macro is parsed and is callable.
2313 It is an error to call
2319 literal macro may be used for special characters,
2320 variable constants, anything which should be displayed as it
2323 .Dl Usage: .Li argument ... \*(Pu
2324 .Bl -tag -width ".Li cntrl-D ) ," -compact -offset 14n
2327 .It Li \&.Li M1 M2 M3\ ;
2329 .It Li \&.Li cntrl-D\ )\ ,
2331 .It Li \&.Li 1024\ ...
2337 macro is parsed and is callable.
2339 The symbolic emphasis macro is generally a boldface macro in
2340 either the symbolic sense or the traditional English usage.
2342 .Dl Usage: .Sy symbol ... \*(Pu
2343 .Bl -tag -width ".Sy Important Noticex" -compact -offset 14n
2344 .It Li \&.Sy Important Notice
2345 .Sy Important Notice
2350 macro is parsed and is callable.
2358 font mode must be ended with the
2361 Font modes may be nested within other font modes.
2363 has the following syntax:
2367 The font-mode must be one of the following three types:
2370 .Bl -tag -width "file file_name " -compact
2371 .It Sy \&Em | Fl emphasis
2374 macro was used for the entire block of text.
2375 .It Sy \&Li | Fl literal
2378 macro was used for the entire block of text.
2379 .It Sy \&Sy | Fl symbolic
2382 macro was used for the entire block of text.
2387 .Ss Tagged Lists and Columns
2388 There are several types of lists which may be initiated with the
2391 Items within the list
2392 are specified with the
2395 each list must end with the
2398 Lists may be nested within themselves and within displays.
2399 Columns may be used inside of lists, but lists are unproven
2402 In addition, several list attributes may be specified such as
2403 the width of a tag, the list offset, and compactness
2404 (blank lines between items allowed or disallowed).
2405 Most of this document has been formatted with a tag style list
2407 For a change of pace, the list-type used to present the list-types
2408 is an over-hanging list
2410 This type of list is quite popular with
2412 users, but might look a bit funny after having read many pages of
2414 The following list types are accepted by
2421 These three are the simplest types of lists.
2424 macro has been given, items in the list are merely
2425 indicated by a line consisting solely of the
2428 For example, the source text for a simple enumerated list
2430 .Bd -literal -offset indent-two
2431 \&.Bl -enum -compact
2433 \&Item one goes here.
2435 \&And item two here.
2437 \&Lastly item three goes here.
2443 .Bl -enum -offset indent-two -compact
2449 Lastly item three goes here.
2452 A simple bullet list construction:
2453 .Bd -literal -offset indent-two
2454 \&.Bl -bullet -compact
2456 \&Bullet one goes here.
2463 .Bl -bullet -offset indent-two -compact
2465 Bullet one goes here.
2475 These list-types collect arguments specified with the
2477 macro and create a label which may be
2479 into the forthcoming text,
2481 from the forthcoming text,
2483 from above and not indented or
2486 list was constructed with the
2491 macro is parsed only for the inset, hang
2492 and tag list-types and is not callable.
2493 Here is an example of inset labels:
2494 .Bl -inset -offset indent
2496 The tagged list (also called a tagged paragraph) is the
2497 most common type of list used in the Berkeley manuals.
2499 Diag lists create section four diagnostic lists
2500 and are similar to inset lists except callable
2503 Hanged labels are a matter of taste.
2505 Overhanging labels are nice when space is constrained.
2507 Inset labels are useful for controlling blocks of
2508 paragraphs and are valuable for converting
2510 manuals to other formats.
2513 Here is the source text which produced the above example:
2514 .Bd -literal -offset indent
2515 \&.Bl -inset -offset indent
2517 \&The tagged list (also called a tagged paragraph) is the
2518 \&most common type of list used in the Berkeley manuals.
2520 \&Diag lists create section four diagnostic lists
2521 \&and are similar to inset lists except callable
2522 \¯os are ignored.
2524 \&Hanged labels are a matter of taste.
2526 \&Overhanging labels are nice when space is constrained.
2528 \&Inset labels are useful for controlling blocks of
2529 \¶graphs and are valuable for converting
2531 \&manuals to other formats.
2535 Here is a hanged list with two items:
2536 .Bl -hang -offset indent
2538 labels appear similar to tagged lists when the
2539 label is smaller than the label width.
2540 .It Em Longer hanged list labels
2541 blend in to the paragraph unlike
2542 tagged paragraph labels.
2545 And the unformatted text which created it:
2546 .Bd -literal -offset indent
2547 \&.Bl -hang -offset indent
2549 \&labels appear similar to tagged lists when the
2550 \&label is smaller than the label width.
2551 \&.It Em Longer hanged list labels
2552 \&blend in to the paragraph unlike
2553 \&tagged paragraph labels.
2557 The tagged list which follows uses an optional width specifier to control
2558 the width of the tag.
2560 .Bl -tag -width "PAGEIN" -compact -offset indent
2562 sleep time of the process (seconds blocked)
2566 resulting from references
2567 by the process to pages not loaded in core.
2569 numerical user-id of process owner
2571 numerical id of parent of process process priority
2572 (non-positive when in non-interruptible wait)
2576 .Bd -literal -offset indent
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 \&(non-positive when in non-interruptible wait)
2593 Acceptable width specifiers:
2594 .Bl -tag -width Ar -offset indent
2595 .It Fl width Ar "\&Fl"
2596 sets the width to the default width for a flag.
2598 macros have a default width value.
2602 set to ten constant width characters or about five sixth of
2604 .It Fl width Ar "24n"
2605 sets the width to 24 constant width characters or about two
2609 is absolutely necessary for the scaling to work correctly.
2610 .It Fl width Ar "ENAMETOOLONG"
2611 sets width to the constant width length of the
2613 .It Fl width Ar "\\*qint mkfifo\\*q"
2614 again, the width is set to the constant width of the string
2618 If a width is not specified for the tag list type, the first
2621 is invoked, an attempt is made to determine an appropriate
2623 If the first argument to
2625 is a callable macro, the default width for that macro will be used
2626 as if the macro name had been supplied as the width.
2628 if another item in the list is given with a different callable
2629 macro name, a new and nested list is assumed.
2630 .Sh PREDEFINED STRINGS
2631 The following strings are predefined as may be used by
2632 preceding with the troff string interpreting sequence
2636 is the name of the defined string or as
2640 is the name of the string.
2641 The interpreting sequence may be used any where in the text.
2643 .Bl -column "String " "Nroff " "Troff " -offset indent
2644 .It Sy "String Nroff Troff"
2645 .It Li "<=" Ta \&<\&= Ta \*(<=
2646 .It Li ">=" Ta \&>\&= Ta \*(>=
2647 .It Li "Rq" Ta "''" Ta \*(Rq
2648 .It Li "Lq" Ta "``" Ta \*(Lq
2649 .It Li "ua" Ta ^ Ta \*(ua
2650 .It Li "aa" Ta ' Ta \*(aa
2651 .It Li "ga" Ta \` Ta \*(ga
2652 .\" .It Li "sL" Ta ` Ta \*(sL
2653 .\" .It Li "sR" Ta ' Ta \*(sR
2654 .It Li "q" Ta \&" Ta \*q
2655 .It Li "Pi" Ta pi Ta \*(Pi
2656 .It Li "Ne" Ta != Ta \*(Ne
2657 .It Li "Le" Ta <= Ta \*(Le
2658 .It Li "Ge" Ta >= Ta \*(Ge
2659 .It Li "Lt" Ta < Ta \*(Gt
2660 .It Li "Gt" Ta > Ta \*(Lt
2661 .It Li "Pm" Ta +- Ta \*(Pm
2662 .It Li "If" Ta infinity Ta \*(If
2663 .It Li "Na" Ta \fINaN\fP Ta \*(Na
2664 .It Li "Ba" Ta \fR\&|\fP Ta \*(Ba
2670 should be written as
2672 since it is only one char.
2674 The debugging facilities for
2676 are limited, but can help detect subtle errors such
2677 as the collision of an argument name with an internal
2678 register or macro name.
2680 A register is an arithmetic storage class for
2682 with a one or two character name.
2683 All registers internal to
2689 are two characters and
2690 of the form <upper_case><lower_case> such as
2692 <lower_case><upper_case> as
2695 <upper or lower letter><digit> as
2697 And adding to the muddle,
2699 has its own internal registers all of which are either
2700 two lower case characters or a dot plus a letter or meta-character
2702 In one of the introduction examples, it was shown how to
2703 prevent the interpretation of a macro name with the escape sequence
2705 This is sufficient for the internal register names also.
2707 .\" Every callable macro name has a corresponding register
2708 .\" of the same name (<upper_case><lower_case>).
2709 .\" There are also specific registers which have
2710 .\" been used for stacks and arrays and are listed in the
2712 .\" .Bd -ragged -offset 4n
2713 .\" [A-Z][a-z] registers corresponding to macro names (example ``Ar'')
2714 .\" [a-z][A-Z] registers corresponding to macro names (example ``aR'')
2715 .\" C[0-9] argument types (example C1)
2716 .\" O[0-9] offset stack (displays)
2717 .\" h[0-9] horizontal spacing stack (lists)
2718 .\" o[0-9] offset (stack) (lists)
2719 .\" t[0-9] tag stack (lists)
2720 .\" v[0-9] vertical spacing stack (lists)
2721 .\" w[0-9] width tag/label stack
2724 If a non-escaped register name is given in the argument list of a request
2725 unpredictable behavior will occur.
2726 In general, any time huge portions
2727 of text do not appear where expected in the output, or small strings
2728 such as list tags disappear, chances are there is a misunderstanding
2729 about an argument type in the argument list.
2730 Your mother never intended for you to remember this evil stuff - so here
2731 is a way to find out whether or not your arguments are valid: The
2734 macro displays the interpretation of the argument list for most
2739 macro do not contain debugging information.
2740 All of the callable macros do,
2741 and it is strongly advised whenever in doubt,
2746 .Dl Usage: \&.Db [on | off]
2748 An example of a portion of text with
2749 the debug macro placed above and below an
2750 artificially created problem (a flag argument
2755 .Bd -literal -offset indent
2757 \&.Op Fl aC Ar file )
2761 The resulting output:
2762 .Bd -literal -offset indent
2764 DEBUG(argv) MACRO: `.Op' Line #: 2
2765 Argc: 1 Argv: `Fl' Length: 2
2766 Space: `' Class: Executable
2767 Argc: 2 Argv: `aC' Length: 2
2768 Space: `' Class: Executable
2769 Argc: 3 Argv: `Ar' Length: 2
2770 Space: `' Class: Executable
2771 Argc: 4 Argv: `file' Length: 4
2772 Space: ` ' Class: String
2773 Argc: 5 Argv: `)' Length: 1
2774 Space: ` ' Class: Closing Punctuation or suffix
2775 MACRO REQUEST: .Op Fl aC Ar file )
2779 The first line of information tells the name of the calling
2782 and the line number it appears on.
2783 If one or more files are involved
2784 (especially if text from another file is included) the line number
2786 If there is only one file, it should be accurate.
2787 The second line gives the argument count, the argument
2790 If the length of an argument is two characters, the
2791 argument is tested to see if it is executable (unfortunately, any
2792 register which contains a non-zero value appears executable).
2793 The third line gives the space allotted for a class, and the
2795 The problem here is the argument aC should not be
2797 The four types of classes are string, executable, closing
2798 punctuation and opening punctuation.
2799 The last line shows the entire
2800 argument list as it was read.
2801 In this next example, the offending
2804 .Bd -literal -offset indent
2806 \&.Em An escaped \e&aC
2809 .Bd -literal -offset indent
2811 DEBUG(fargv) MACRO: `.Em' Line #: 2
2812 Argc: 1 Argv: `An' Length: 2
2813 Space: ` ' Class: String
2814 Argc: 2 Argv: `escaped' Length: 7
2815 Space: ` ' Class: String
2816 Argc: 3 Argv: `aC' Length: 2
2817 Space: ` ' Class: String
2818 MACRO REQUEST: .Em An escaped &aC
2824 shows up with the same length of 2 as the
2826 sequence produces a zero width, but a register
2829 was not found and the type classified as string.
2831 Other diagnostics consist of usage statements and are self explanatory.
2832 .Sh GROFF, TROFF AND NROFF
2835 package does not need compatibility mode with
2838 The package inhibits page breaks, and the headers and footers
2839 which normally occur at those breaks with
2841 to make the manual more efficient for viewing on-line.
2846 does eject the imaginary remainder of the page at end of file.
2847 The inhibiting of the page breaks makes
2849 files unsuitable for hardcopy.
2850 There is a register named
2852 which can be set to zero in the site dependent style file
2853 .Pa /usr/src/share/tmac/doc-nroff
2854 to restore the old style behavior.
2856 .Bl -tag -width /usr/share/man0/template.doc -compact
2857 .It Pa /usr/share/tmac/tmac.doc
2858 manual macro package
2859 .It Pa /usr/share/misc/mdoc.template
2860 template for writing a man page
2861 .It Pa /usr/share/examples/mdoc/*
2862 several example man pages
2869 Undesirable hyphenation on the dash of a flag
2870 argument is not yet resolved, and causes
2871 occasional mishaps in the
2874 (line break on the hyphen).
2876 Predefined strings are not declared in documentation.
2878 Section 3f has not been added to the header routines.
2881 font should be changed in
2886 needs to have a check to prevent splitting up
2887 if the line length is too short.
2889 separates the last parenthesis, and sometimes
2890 looks ridiculous if a line is in fill mode.
2892 The method used to prevent header and footer page
2893 breaks (other than the initial header and footer) when using
2894 nroff occasionally places an unsightly partially filled line (blank)
2895 at the would be bottom of the page.
2897 The list and display macros to not do any keeps
2898 and certainly should be able to.
2899 .\" Note what happens if the parameter list overlaps a newline
2901 .\" to make sure a line boundary is crossed:
2903 .\" \&.Fn struct\e\ dictionarytable\e\ *dictionarylookup struct\e\ dictionarytable\e\ *tab[]
2906 .\" produces, nudge nudge,
2907 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
2908 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
2910 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] .
2912 .\" If double quotes are used, for example:
2914 .\" \&.Fn \*qstruct dictionarytable *dictionarylookup\*q \*qchar *h\*q \*qstruct dictionarytable *tab[]\*q
2917 .\" produces, nudge nudge,
2918 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
2920 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
2922 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" .
2924 .\" Not a pretty sight...
2925 .\" In a paragraph, a long parameter containing unpaddable spaces as
2926 .\" in the former example will cause
2928 .\" to break the line and spread
2929 .\" the remaining words out.
2930 .\" The latter example will adjust nicely to
2931 .\" justified margins, but may break in between an argument and its
2935 .\" the right margin adjustment is normally ragged and the problem is