]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man7/mdoc.samples.7
unfinished sblive driver, playback/mixer only for now - not enabled in
[FreeBSD/FreeBSD.git] / share / man / man7 / mdoc.samples.7
1 .\" Copyright (c) 1990, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
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.
19 .\"
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
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)mdoc.samples.7      8.2 (Berkeley) 12/30/93
33 .\" $FreeBSD$
34 .\"
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.
38 .\"
39 .Dd December 30, 1993
40 .Os
41 .Dt MDOC.SAMPLES 7
42 .Sh NAME
43 .Nm mdoc.samples
44 .Nd tutorial sampler for writing
45 .Bx
46 manuals with
47 .Nm \-mdoc
48 .Sh SYNOPSIS
49 .Nm man mdoc.samples
50 .Sh DESCRIPTION
51 A tutorial sampler for writing
52 .Bx
53 manual pages with the
54 .Nm \-mdoc
55 macro package, a
56 .Em content Ns \-based
57 and
58 .Em domain Ns \-based
59 formatting
60 package for
61 .Xr troff 1 .
62 Its predecessor, the
63 .Xr \-man 7
64 package,
65 addressed page layout leaving the
66 manipulation of fonts and other
67 typesetting details to the individual author.
68 In
69 .Nm \-mdoc ,
70 page layout macros
71 make up the
72 .Em "page structure domain"
73 which consists of macros for titles, section headers, displays
74 and lists.  Essentially items which affect the physical position
75 of text on a formatted page.
76 In addition to the page structure domain, there are two more domains,
77 the manual domain and the general text domain.
78 The general text domain is defined as macros which
79 perform tasks such as quoting or emphasizing pieces of text.
80 The manual domain is defined as macros that are a subset of the
81 day to day informal language used to describe commands, routines
82 and related
83 .Bx
84 files.
85 Macros in the manual domain handle
86 command names, command line arguments and options, function names,
87 function parameters, pathnames, variables, cross
88 references to other manual pages, and so on.
89 These domain
90 items have value
91 for both the author and the future user of the manual page.
92 It is hoped the consistency gained
93 across the manual set will provide easier
94 translation to future documentation tools.
95 .Pp
96 Throughout the
97 .Ux
98 manual pages, a manual entry
99 is simply referred
100 to as a man page, regardless of actual length and without
101 sexist intention.
102 .Sh GETTING STARTED
103 Since a tutorial document is normally read when a person
104 desires to use the material immediately, the assumption has
105 been made that the user of this document may be impatient.
106 The material presented in the remained of this document is
107 outlined as follows:
108 .Bl -enum -offset indent
109 .It
110 .Tn "TROFF IDIOSYNCRASIES"
111 .Bl -tag -width flag -compact -offset indent
112 .It "Macro Usage" .
113 .It "Passing Space Characters in an Argument" .
114 .It "Trailing Blank Space Characters (a warning)" .
115 .It "Escaping Special Characters" .
116 .El
117 .It
118 .Tn "THE ANATOMY OF A MAN PAGE"
119 .Bl -tag -width flag -compact -offset indent
120 .It "A manual page template" .
121 .El
122 .It
123 .Tn "TITLE MACROS" .
124 .It
125 .Tn "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS" .
126 .Bl -tag -width flag -compact -offset indent
127 .It "What's in a name..." .
128 .It "General Syntax" .
129 .El
130 .It
131 .Tn "MANUAL DOMAIN"
132 .Bl -tag -width flag -compact -offset indent
133 .It "Addresses" .
134 .It "Author name" .
135 .It "Arguments" .
136 .It "Configuration Declarations (section four only)" .
137 .It "Command Modifier" .
138 .It "Defined Variables" .
139 .It "Errno's (Section two only)" .
140 .It "Environment Variables" .
141 .It "Function Argument" .
142 .It "Function Declaration" .
143 .It "Flags" .
144 .It "Functions (library routines)" .
145 .It "Function Types" .
146 .\" .It "Header File (including source code)" .
147 .It "Interactive Commands" .
148 .It "Names" .
149 .It "Options" .
150 .It "Pathnames" .
151 .It "Standards" .
152 .It "Variables" .
153 .It "Cross References" .
154 .El
155 .It
156 .Tn "GENERAL TEXT DOMAIN"
157 .Bl -tag -width flag -compact -offset indent
158 .It "AT&T Macro" .
159 .It "BSD Macro" .
160 .It "FreeBSD/NetBSD/OpenBSD Macro" .
161 .It "UNIX Macro" .
162 .It "Enclosure/Quoting Macros"
163 .Bl -tag -width flag -compact -offset indent
164 .It "Angle Bracket Quote/Enclosure" .
165 .It "Bracket Quotes/Enclosure" .
166 .It "Double Quote macro/Enclosure" .
167 .It "Parenthesis Quote/Enclosure" .
168 .It "Single Quotes/Enclosure" .
169 .It "Prefix Macro" .
170 .El
171 .It "No\-Op or Normal Text Macro" .
172 .It "No Space Macro" .
173 .It "Section Cross References" .
174 .It "References and Citations" .
175 .It "Return Values (sections two and three only)"
176 .It "Trade Names (Acronyms and Type Names)" .
177 .It "Extended  Arguments" .
178 .El
179 .It
180 .Tn "PAGE STRUCTURE DOMAIN"
181 .Bl -tag -width flag -compact -offset indent
182 .It "Section Headers" .
183 .It "Paragraphs and Line Spacing" .
184 .It "Keeps" .
185 .It "Displays" .
186 .It "Font Modes (Emphasis, Literal, and Symbolic)" .
187 .It "Lists and Columns" .
188 .El
189 .It
190 .Tn "PREDEFINED STRINGS"
191 .It
192 .Tn "DIAGNOSTICS"
193 .It
194 .Tn "FORMATTING WITH GROFF, TROFF AND NROFF"
195 .It
196 .Tn "BUGS"
197 .El
198 .ne 7
199 .Sh TROFF IDIOSYNCRASIES
200 The
201 .Nm \-mdoc
202 package attempts to simplify the process of writing a man page.
203 Theoretically, one should not have to learn the dirty details of
204 .Xr troff 1
205 to use
206 .Nm \-mdoc ;
207 however, there are a few
208 limitations which are unavoidable and best gotten out
209 of the way.
210 And, too, be forewarned, this package is
211 .Em not
212 fast.
213 .Ss Macro Usage
214 As in
215 .Xr troff 1 ,
216 a macro is called by placing a
217 .Ql \&\.
218 (dot character)
219 at the beginning of
220 a line followed by the two character name for the macro.
221 Arguments may follow the macro separated by spaces.
222 It is the dot character at the beginning of the line which causes
223 .Xr troff 1
224 to interpret the next two characters as a macro name.
225 To place a
226 .Ql \&\.
227 (dot character)
228 at the beginning of a line in some context other than
229 a macro invocation, precede the
230 .Ql \&\.
231 (dot) with the
232 .Ql \e&
233 escape sequence.
234 The
235 .Ql \e&
236 translates literally to a zero width space, and is never displayed in the
237 output.
238 .Pp
239 In general,
240 .Xr troff 1
241 macros accept up to nine arguments, any
242 extra arguments are ignored.
243 Most macros in
244 .Nm \-mdoc
245 accept nine arguments and,
246 in limited cases, arguments may be continued or extended
247 on the
248 next line (See
249 .Sx Extensions ) .
250 A few macros handle quoted arguments (see
251 .Sx Passing Space Characters in an Argument
252 below).
253 .Pp
254 Most of the
255 .Nm \-mdoc
256 general text domain and manual domain macros are special
257 in that their argument lists are
258 .Em parsed
259 for callable macro names.
260 This means an argument on the argument list which matches
261 a general text or manual domain macro name and is determined
262 to be callable will be executed
263 or called when it is processed.
264 In this case
265 the argument, although the name of a macro,
266 is not preceded by a
267 .Ql \&\.
268 (dot).
269 It is in this manner that many macros are nested; for
270 example
271 the option macro,
272 .Ql \&.Op ,
273 may
274 .Em call
275 the flag and argument macros,
276 .Ql \&Fl
277 and
278 .Ql \&Ar ,
279 to specify an optional flag with an argument:
280 .Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
281 .It Op Fl s Ar bytes
282 is produced by
283 .Li \&.Op \&Fl s \&Ar bytes
284 .El
285 .Pp
286 To prevent a two character
287 string from being interpreted as a macro name, precede
288 the string with the
289 escape sequence
290 .Ql \e& :
291 .Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
292 .It Op \&Fl s \&Ar bytes
293 is produced by
294 .Li \&.Op \e&Fl s \e&Ar bytes
295 .El
296 .Pp
297 Here the strings
298 .Ql \&Fl
299 and
300 .Ql \&Ar
301 are not interpreted as macros.
302 Macros whose argument lists are parsed for callable arguments
303 are referred to
304 as parsed and macros which may be called from an argument
305 list are referred to as callable
306 throughout this document and in the companion quick reference
307 manual
308 .Xr mdoc 7 .
309 This is a technical
310 .Em faux pas
311 as almost all of the macros in 
312 .Nm \-mdoc
313 are parsed, but as it was cumbersome to constantly refer to macros
314 as being callable and being able to call other macros,
315 the term parsed has been used.
316 .Ss Passing Space Characters in an Argument
317 Sometimes it is desirable to give as one argument a string
318 containing one or more blank space characters.
319 This may be necessary
320 to defeat the nine argument limit or to specify arguments to macros
321 which expect particular arrangement of items in the argument list.
322 For example,
323 the function macro
324 .Ql \&.Fn
325 expects the first argument to be the name of a function and any
326 remaining arguments to be function parameters.
327 As
328 .Tn "ANSI C"
329 stipulates the declaration of function parameters in the
330 parenthesized parameter list, each parameter is guaranteed
331 to be at minimum a two word string.
332 For example,
333 .Fa int foo .
334 .Pp
335 There are two possible ways to pass an argument which contains
336 an embedded space.
337 .Em Implementation note :
338 Unfortunately, the most convenient way
339 of passing spaces in between quotes by reassigning individual
340 arguments before parsing was fairly expensive speed wise
341 and space wise to implement in all the macros for
342 .Tn AT&T
343 .Xr troff .
344 It is not expensive for
345 .Xr groff
346 but for the sake of portability, has been limited
347 to the following macros which need
348 it the most:
349 .Pp
350 .Bl -tag -width 4n -offset indent -compact
351 .It Li \&Cd
352 Configuration declaration (section 4
353 .Sx SYNOPSIS )
354 .It Li \&Bl
355 Begin list (for the width specifier).
356 .It Li \&Em
357 Emphasized text.
358 .It Li \&Fn
359 Functions (sections two and four).
360 .It Li \&It
361 List items.
362 .It Li \&Li
363 Literal text.
364 .It Li \&Sy
365 Symbolic text.
366 .It Li \&%B
367 Book titles.
368 .It Li \&%J
369 Journal names.
370 .It Li \&%O
371 Optional notes for a reference.
372 .It Li \&%R
373 Report title (in a reference).
374 .It Li \&%T
375 Title of article in a book or journal.
376 .El
377 .Pp
378 One way of passing a string
379 containing blank spaces is to use the hard or unpaddable space character
380 .Ql \e\  ,
381 that is, a blank space preceded by the escape character
382 .Ql \e .
383 This method may be used with any macro but has the side effect
384 of interfering with the adjustment of text
385 over the length of a line.
386 .Xr Troff
387 sees the hard space as if it were any other printable character and
388 cannot split the string into blank or newline separated pieces as one
389 would expect.
390 The method is useful for strings which are not expected
391 to overlap a line boundary.
392 For example:
393 .Bl -tag -width "fetch(char *str)" -offset indent
394 .It Fn fetch char\ *str
395 is created by
396 .Ql \&.Fn fetch char\e *str
397 .It Fn fetch "char *str"
398 can also be created by
399 .Ql \&.Fn fetch "\\*qchar *str\\*q"
400 .El
401 .Pp
402 If the
403 .Ql \e
404 or quotes
405 were omitted,
406 .Ql \&.Fn
407 would see three arguments and
408 the result would be:
409 .Pp
410 .Dl Fn fetch char *str
411 .Pp
412 For an example of what happens when the parameter list overlaps
413 a newline boundary, see the
414 .Sx BUGS
415 section.
416 .Ss Trailing Blank Space Characters
417 .Xr Troff
418 can be confused by blank space characters at the end of a line.
419 It
420 is a wise preventive measure to globally remove all blank spaces
421 from <blank-space><end-of-line> character sequences.
422 Should the need
423 arise to force a blank character at the end of a line,
424 it may be forced with an unpaddable space and the
425 .Ql \e&
426 escape character.
427 For example,
428 .Ql string\e\ \e& .
429 .Ss Escaping Special Characters
430 Special characters
431 like the newline character
432 .Ql \en ,
433 are handled by replacing the
434 .Ql \e
435 with
436 .Ql \ee
437 (e.g.
438 .Ql \een )
439 to preserve
440 the backslash.
441 .Sh THE ANATOMY OF A MAN PAGE
442 The body of a man page is easily constructed from a basic
443 template found in the file
444 .Pa /usr/share/misc/mdoc.template .
445 Several example man pages can also be found
446 in 
447 .Pa /usr/share/examples/mdoc .
448 .Pp
449 .Ss A manual page template
450 .Bd -literal -offset indent
451 \&.\e" The following requests are required for all man pages.
452 \&.Dd Month day, year
453 \&.Os OPERATING_SYSTEM [version/release]
454 \&.Dt DOCUMENT_TITLE [section number] [volume]
455 \&.Sh NAME
456 \&.Nm name
457 \&.Nd one line description of name
458 \&.Sh SYNOPSIS
459 \&.Sh DESCRIPTION
460 \&.\e" The following requests should be uncommented and
461 \&.\e" used where appropriate.
462 \&.\e" .Sh IMPLEMENTATION NOTES
463 \&.\e" This next request is for sections 2, 3 and 9 function return values only.
464 \&.\e" .Sh RETURN VALUES
465 \&.\e" This next request is for sections 1, 6, 7, 8 & 9 only
466 \&.\e" .Sh ENVIRONMENT
467 \&.\e" .Sh FILES
468 \&.\e" .Sh EXAMPLES
469 \&.\e" This next request is for sections 1, 6, 7, 8 & 9 only
470 \&.\e"     (command return values (to shell) and
471 \&.\e"    fprintf/stderr type diagnostics)
472 \&.\e" .Sh DIAGNOSTICS
473 \&.\e" .Sh COMPATIBILITY
474 \&.\e" The next request is for sections 2, 3 and 9 error
475 \&.\e" and signal handling only.
476 \&.\e" .Sh ERRORS
477 \&.\e" .Sh SEE ALSO
478 \&.\e" .Sh STANDARDS
479 \&.\e" .Sh HISTORY
480 \&.\e" .Sh AUTHORS
481 \&.\e" .Sh BUGS
482 .Ed
483 .Pp
484 The first items in the template are the macros
485 .Pq Li \&.Dd , \&.Os , \&.Dt ;
486 the document date,
487 the operating system the man page or subject source is developed
488 or modified for,
489 and the man page title
490 .Pq Em in upper case
491 along with the section of the manual the page
492 belongs in.
493 These macros identify the page,
494 and are discussed below in
495 .Sx TITLE MACROS .
496 .Pp
497 The remaining items in the template are section headers
498 .Pq Li \&.Sh ;
499 of which
500 .Sx NAME ,
501 .Sx SYNOPSIS
502 and
503 .Sx DESCRIPTION
504 are mandatory.
505 The
506 headers are
507 discussed in
508 .Sx PAGE STRUCTURE DOMAIN ,
509 after
510 presentation of
511 .Sx MANUAL DOMAIN .
512 Several content macros are used to demonstrate page layout macros;
513 reading about content macros before page layout macros is
514 recommended.
515 .Sh TITLE MACROS
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.
524 .Bl -tag -width 6n
525 .It Li \&.Dt DOCUMENT_TITLE section# [volume]
526 The document title is the
527 subject of the man page and must be in
528 .Tn CAPITALS
529 due to troff
530 limitations.
531 The section number may be 1,\ ...,\ 9,
532 and if it is specified,
533 the volume title may be omitted.
534 .Pp
535 Under
536 .Tn FreeBSD ,
537 the following section numbers and their descriptions are described below:
538 .Pp
539 .Bl -column SMM -offset indent -compact
540 .It Li 1        FreeBSD General Commands Manual
541 .It Li 2        FreeBSD System Calls Manaul
542 .It Li 3        FreeBSD Library Calls Manual
543 .It Li 4        FreeBSD Kernel Interfaces Manual
544 .It Li 5        FreeBSD File Formats Manual
545 .It Li 6        FreeBSD Games Manual
546 .It Li 7        FreeBSD Miscellaneous Information Manual
547 .It Li 8        FreeBSD System Manager's Manual
548 .It Li 9        FreeBSD Kernel Developers Guide
549 .El
550 .Pp
551 A volume title may be arbitrary or one of the following:
552 .\" .Cl
553 .\" USD UNIX User's Supplementary Documents
554 .\" .Cl
555 .\" PS1 UNIX Programmer's Supplementary Documents
556 .Pp
557 .Bl -column SMM -offset indent -compact
558 .It Li AMD      UNIX Ancestral Manual Documents
559 .It Li SMM      UNIX System Manager's Manual
560 .It Li URM      UNIX Reference Manual
561 .It Li PRM      UNIX Programmer's Manual
562 .El
563 .Pp
564 The default volume labeling is
565 .Li URM
566 for sections 1, 6, and 7;
567 .Li SMM
568 for section 8;
569 .Li PRM
570 for sections 2, 3, 4, and 5.
571 .\" .Cl
572 .\" MMI UNIX Manual Master Index
573 .\" .Cl
574 .\" CON UNIX Contributed Software Manual
575 .\" .Cl
576 .\" LOC UNIX Local Manual
577 .It Li \&.Os operating_system release#
578 The name of the operating system
579 should be the common acronym, e.g.
580 .Tn BSD
581 or
582 .Tn FreeBSD
583 or
584 .Tn ATT .
585 The release should be the standard release
586 nomenclature for the system specified, e.g. 4.3, 4.3+Tahoe, V.3,
587 V.4.
588 Unrecognized arguments are displayed as given in the page footer.
589 For instance, a typical footer might be:
590 .Pp
591 .Dl \&.Os BSD 4.3
592 .Pp
593 or
594 .Dl \&.Os FreeBSD 2.2
595 .Pp
596 or for a locally produced set
597 .Pp
598 .Dl \&.Os CS Department
599 .Pp
600 The Berkeley default,
601 .Ql \&.Os
602 without an argument, has been defined as
603 .Tn BSD
604 in the
605 site specific file
606 .Pa /usr/share/tmac/mdoc/doc-common .
607 It really should default to
608 .Tn LOCAL .
609 Note, if the
610 .Ql \&.Os
611 macro is not present, the bottom left corner of the page
612 will be ugly.
613 .It Li \&.Dd month day, year
614 The date should be written formally:
615 .Pp
616 .ne 5
617 .Dl January 25, 1989
618 .El
619 .Sh INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS
620 .Ss What's in a name...
621 The manual domain macro names are derived from the day to day
622 informal language used to describe commands, subroutines and related
623 files.
624 Slightly
625 different variations of this language are used to describe
626 the three different aspects of writing a man page.
627 First, there is the description of
628 .Nm \-mdoc
629 macro request usage.
630 Second is the description of a
631 .Ux
632 command
633 .Em with
634 .Nm \-mdoc
635 macros and third,
636 the
637 description of a command to a user in the verbal sense;
638 that is, discussion of a command in the text of a man page.
639 .Pp
640 In the first case,
641 .Xr troff 1
642 macros are themselves a type of command;
643 the general syntax for a troff command is:
644 .Bd -filled -offset indent
645 \&.Va argument1 argument2 ... argument9
646 .Ed
647 .Pp
648 The
649 .Ql \&.Va
650 is a macro command or request, and anything following it is an argument to
651 be processed.
652 In the second case,
653 the description of a
654 .Ux
655 command using the content macros is a
656 bit more involved;
657 a typical
658 .Sx SYNOPSIS
659 command line might be displayed as:
660 .Bd -filled -offset indent
661 .Nm filter
662 .Op Fl flag
663 .Ar infile outfile
664 .Ed
665 .Pp
666 Here,
667 .Nm filter
668 is the command name and the
669 bracketed string
670 .Fl flag
671 is a
672 .Em flag
673 argument designated as optional by the option brackets.
674 In
675 .Nm \-mdoc
676 terms,
677 .Ar infile
678 and
679 .Ar outfile
680 are
681 called
682 .Em arguments .
683 The macros which formatted the above example:
684 .Bd -literal -offset indent
685 \&.Nm filter
686 \&.Op \&Fl flag
687 \&.Ar infile outfile
688 .Ed
689 .Pp
690 In the third case, discussion of commands and command syntax
691 includes both examples above, but may add more detail.
692 The
693 arguments
694 .Ar infile
695 and
696 .Ar outfile
697 from the example above might be referred to as
698 .Em operands
699 or
700 .Em file arguments .
701 Some command line argument lists are quite long:
702 .Bl -tag -width make -offset indent
703 .It Nm make
704 .Op Fl eiknqrstv
705 .Op Fl D Ar variable
706 .Op Fl d Ar flags
707 .Op Fl f Ar makefile
708 .Bk -words
709 .Op Fl I Ar directory
710 .Ek
711 .Op Fl j Ar max_jobs
712 .Op Ar variable=value
713 .Bk -words
714 .Op Ar target ...
715 .Ek
716 .El
717 .Pp
718 Here one might talk about the command
719 .Nm make
720 and qualify the argument
721 .Ar makefile ,
722 as an argument to the flag,
723 .Fl f ,
724 or discuss the optional
725 file
726 operand
727 .Ar target .
728 In the verbal context, such detail can prevent confusion,
729 however the
730 .Nm \-mdoc
731 package
732 does not have a macro for an argument
733 .Em to
734 a flag.
735 Instead the
736 .Ql \&Ar
737 argument macro is used for an operand or file argument like
738 .Ar target
739 as well as an argument to a flag like
740 .Ar variable .
741 The make command line was produced from:
742 .Bd -literal -offset indent
743 \&.Nm make
744 \&.Op Fl eiknqrstv
745 \&.Op Fl D Ar variable
746 \&.Op Fl d Ar flags
747 \&.Op Fl f Ar makefile
748 \&.Op Fl I Ar directory
749 \&.Op Fl j Ar max_jobs
750 \&.Op Ar variable=value
751 \&.Bk -words
752 \&.Op Ar target ...
753 \&.Ek
754 .Ed
755 .Pp
756 The
757 .Ql \&.Bk
758 and
759 .Ql \&.Ek
760 macros are explained in
761 .Sx Keeps .
762 .Ss General Syntax
763 The manual domain and general text domain macros share a similar
764 syntax with a few minor deviations:
765 .Ql \&.Ar ,
766 .Ql \&.Fl ,
767 .Ql \&.Nm ,
768 and
769 .Ql \&.Pa
770 differ only when called without arguments;
771 .Ql \&.Fn
772 and
773 .Ql \&.Xr
774 impose an order on their argument lists
775 and the
776 .Ql \&.Op
777 and
778 .Ql \&.Fn
779 macros
780 have nesting limitations.
781 All content macros
782 are capable of recognizing and properly handling punctuation,
783 provided each punctuation character is separated by a leading space.
784 If an request is given:
785 .Pp
786 .Dl \&.Li sptr, ptr),
787 .Pp
788 The result is:
789 .Pp
790 .Dl Li sptr, ptr),
791 .Pp
792 The punctuation is not recognized and all is output in the
793 literal font.  If the punctuation is separated by a leading
794 white space:
795 .Pp
796 .Dl \&.Li "sptr , ptr ) ,"
797 .Pp
798 The result is:
799 .Pp
800 .Dl Li sptr , ptr ) ,
801 .Pp
802 The punctuation is now recognized and is output in the
803 default font distinguishing it from the strings in literal font.
804 .Pp
805 To remove the special meaning from a punctuation character
806 escape it with
807 .Ql \e& .
808 .Xr Troff
809 is limited as a macro language, and has difficulty
810 when presented with a string containing
811 a member of the mathematical, logical or
812 quotation set:
813 .Bd -literal -offset indent-two
814 \&{+,\-,/,*,\&%,<,>,<=,>=,=,==,&,`,',"}
815 .Ed
816 .Pp
817 The problem is that
818 .Xr troff
819 may assume it is supposed to actually perform the operation
820 or evaluation suggested by the characters.  To prevent
821 the accidental evaluation of these characters,
822 escape them with
823 .Ql \e& .
824 Typical syntax is shown in the first content macro displayed
825 below,
826 .Ql \&.Ad .
827 .Sh MANUAL DOMAIN
828 .Ss Address Macro
829 The address macro identifies an address construct
830 of the form addr1[,addr2[,addr3]].
831 .Pp
832 .Dl Usage: .Ad address ... \*(Pu
833 .Bl -tag -width ".Ad f1 , f2 , f3 :" -compact -offset 14n
834 .It Li \&.Ad addr1
835 .Ad addr1
836 .It Li \&.Ad addr1\ .
837 .Ad addr1 .
838 .It Li \&.Ad addr1\ , file2
839 .Ad addr1 , file2
840 .It Li \&.Ad f1\ , f2\ , f3\ :
841 .Ad f1 , f2 , f3 :
842 .It Li \&.Ad addr\ )\ )\ ,
843 .Ad addr ) ) ,
844 .El
845 .Pp
846 It is an error to call
847 .Ql \&.Ad
848 without arguments.
849 .Ql \&.Ad
850 is callable by other macros and is parsed.
851 .Ss Author Name
852 The
853 .Ql \&.An
854 macro is used to specify the name of the author of the item being
855 documented, or the name of the author of the actual manual page.
856 Any remaining arguments after the name information are assumed 
857 to be punctuation.
858 .Pp
859 .Dl Usage: .An author_name \*(Pu
860 .Bl -tag -width ".An Joe Author ) ) ," -compact -offset 14n
861 .It Li \&.An Joe\ Author
862 .An Joe Author
863 .It Li \&.An Joe\ Author\ ,
864 .An Joe\ Author ,
865 .It Li \&.An Joe\ Author\ \&Aq\ nobody@FreeBSD.ORG
866 .An Joe Author Aq nobody@FreeBSD.ORG
867 .It Li \&.An Joe\ Author\ )\ )\ ,
868 .An Joe Author ) ) ,
869 .El
870 .Pp
871 The
872 .Ql \&.An
873 macro is parsed and is callable.
874 It is an error to call
875 .Ql \&.An
876 without
877 any arguments.
878 .Ss Argument Macro
879 The
880 .Ql \&.Ar
881 argument macro may be used whenever
882 a command line argument is referenced.
883 .Pp
884 .Dl Usage: .Ar argument ... \*(Pu
885 .Bl -tag -width ".Ar file1 file2" -compact -offset 15n
886 .It Li \&.Ar
887 .Ar
888 .It Li \&.Ar file1
889 .Ar file1
890 .It Li \&.Ar file1\ .
891 .Ar file1 .
892 .It Li \&.Ar file1 file2
893 .Ar file1 file2
894 .It Li \&.Ar f1 f2 f3\ :
895 .Ar f1 f2 f3 :
896 .It Li \&.Ar file\ )\ )\ ,
897 .Ar file ) ) ,
898 .El
899 .Pp
900 If
901 .Ql \&.Ar
902 is called without arguments
903 .Ql Ar
904 is assumed.
905 The
906 .Ql \&.Ar
907 macro is parsed and is callable.
908 .Ss Configuration Declaration (section four only)
909 The
910 .Ql \&.Cd
911 macro is used to demonstrate a
912 .Xr config 8
913 declaration for a device interface in a section four manual.
914 This macro accepts quoted arguments (double quotes only).
915 .Pp
916 .Bl -tag -width "device le0 at scode?" -offset indent
917 .It Cd "device le0 at scode?"
918 produced by:
919 .Ql ".Cd device le0 at scode?" .
920 .El
921 .Ss Command Modifier
922 The command modifier is identical to the
923 .Ql \&.Fl
924 (flag) command with the exception
925 the
926 .Ql \&.Cm
927 macro does not assert a dash
928 in front of every argument.
929 Traditionally flags are marked by the
930 preceding dash, some commands or subsets of commands do not use them.
931 Command modifiers may also be specified in conjunction with interactive
932 commands such as editor commands.
933 See
934 .Sx Flags .
935 .Ss Defined Variables
936 A variable which is defined in an include file is specified
937 by the macro
938 .Ql \&.Dv .
939 .Pp
940 .Dl Usage: .Dv defined_variable ... \*(Pu
941 .Bl -tag -width ".Dv MAXHOSTNAMELEN" -compact -offset 14n
942 .It Li ".Dv MAXHOSTNAMELEN"
943 .Dv MAXHOSTNAMELEN
944 .It Li ".Dv TIOCGPGRP )"
945 .Dv TIOCGPGRP )
946 .El
947 .Pp
948 It is an error to call
949 .Ql \&.Dv
950 without arguments.
951 .Ql \&.Dv
952 is parsed and is callable.
953 .Ss Errno's (Section two only)
954 The
955 .Ql \&.Er
956 errno macro specifies the error return value
957 for section two library routines.
958 The second example
959 below shows
960 .Ql \&.Er
961 used with the
962 .Ql \&.Bq
963 general text domain macro, as it would be used in
964 a section two manual page.
965 .Pp
966 .Dl Usage: .Er ERRNOTYPE ... \*(Pu
967 .Bl -tag -width ".Bq Er ENOTDIR" -compact -offset 14n
968 .It Li \&.Er ENOENT
969 .Er ENOENT
970 .It Li \&.Er ENOENT\ )\ ;
971 .Er ENOENT ) ;
972 .It Li \&.Bq \&Er ENOTDIR
973 .Bq Er ENOTDIR
974 .El
975 .Pp
976 It is an error to call
977 .Ql \&.Er
978 without arguments.
979 The
980 .Ql \&.Er
981 macro is parsed and is callable.
982 .Ss Environment Variables
983 The
984 .Ql \&.Ev
985 macro specifies an environment variable.
986 .Pp
987 .Dl Usage: .Ev argument ... \*(Pu
988 .Bl -tag -width ".Ev PRINTER ) ) ," -compact -offset 14n
989 .It Li \&.Ev DISPLAY
990 .Ev  DISPLAY
991 .It Li \&.Ev PATH\ .
992 .Ev PATH .
993 .It Li \&.Ev PRINTER\ )\ )\ ,
994 .Ev PRINTER ) ) ,
995 .El
996 .Pp
997 It is an error to call
998 .Ql \&.Ev
999 without arguments.
1000 The
1001 .Ql \&.Ev
1002 macro is parsed and is callable.
1003 .Ss Function Argument
1004 The
1005 .Ql \&.Fa
1006 macro is used to refer to function arguments (parameters)
1007 outside of the
1008 .Sx SYNOPSIS
1009 section of the manual or inside
1010 the
1011 .Sx SYNOPSIS
1012 section should a parameter list be too
1013 long for the
1014 .Ql \&.Fn
1015 macro and the enclosure macros
1016 .Ql \&.Fo
1017 and
1018 .Ql \&.Fc
1019 must be used.
1020 .Ql \&.Fa
1021 may also be used to refer to structure members.
1022 .Pp
1023 .Dl Usage: .Fa function_argument ... \*(Pu
1024 .Bl -tag -width ".Fa d_namlen\ )\ )\ ," -compact -offset 14n
1025 .It Li \&.Fa d_namlen\ )\ )\ ,
1026 .Fa d_namlen ) ) ,
1027 .It Li \&.Fa iov_len
1028 .Fa iov_len
1029 .El
1030 .Pp
1031 It is an error to call
1032 .Ql \&.Fa
1033 without arguments.
1034 .Ql \&.Fa
1035 is parsed and is callable.
1036 .Ss Function Declaration
1037 The
1038 .Ql \&.Fd
1039 macro is used in the
1040 .Sx SYNOPSIS
1041 section with section two or three
1042 functions.
1043 The
1044 .Ql \&.Fd
1045 macro does not call other macros and is not callable by other
1046 macros.
1047 .Pp
1048 .Dl Usage: .Fd include_file (or defined variable)
1049 .Pp
1050 In the
1051 .Sx SYNOPSIS
1052 section a
1053 .Ql \&.Fd
1054 request causes a line break if a function has already been presented
1055 and a break has not occurred.
1056 This leaves a nice vertical space
1057 in between the previous function call and the declaration for the
1058 next function.
1059 .Ss Flags
1060 The
1061 .Ql \&.Fl
1062 macro handles command line flags.
1063 It prepends
1064 a dash,
1065 .Ql \- ,
1066 to the flag.
1067 For interactive command flags, which
1068 are not prepended with a dash, the
1069 .Ql \&.Cm
1070 (command modifier)
1071 macro is identical, but without the dash.
1072 .Pp
1073 .Dl Usage: .Fl argument ... \*(Pu
1074 .Bl -tag -width ".Fl \-s \-t \-v" -compact -offset 14n
1075 .It Li \&.Fl
1076 .Fl
1077 .It Li \&.Fl cfv
1078 .Fl cfv
1079 .It Li \&.Fl cfv\ .
1080 .Fl cfv .
1081 .It Li \&.Fl s v t
1082 .Fl s v t
1083 .It Li \&.Fl -\ ,
1084 .Fl - ,
1085 .It Li \&.Fl xyz\ )\ ,
1086 .Fl xyz ) ,
1087 .El
1088 .Pp
1089 The
1090 .Ql \&.Fl
1091 macro without any arguments results
1092 in a dash representing stdin/stdout.
1093 Note that giving
1094 .Ql \&.Fl
1095 a single dash, will result in two dashes.
1096 The
1097 .Ql \&.Fl
1098 macro is parsed and is callable.
1099 .Ss Functions (library routines)
1100 The .Fn macro is modeled on ANSI C conventions.
1101 .Bd -literal
1102 Usage: .Fn [type] function [[type] parameters ... \*(Pu]
1103 .Ed
1104 .Bl -tag -width ".Fn .int align. .const * char *sptrsxx" -compact
1105 .It Li "\&.Fn getchar"
1106 .Fn getchar
1107 .It Li "\&.Fn strlen ) ,"
1108 .Fn strlen ) ,
1109 .It Li \&.Fn "\\*qint align\\*q" "\\*qconst * char *sptrs\\*q" ,
1110 .Fn "int align" "const * char *sptrs" ,
1111 .El
1112 .Pp
1113 It is an error to call
1114 .Ql \&.Fn
1115 without any arguments.
1116 The
1117 .Ql \&.Fn
1118 macro
1119 is parsed and is callable,
1120 note that any call to another macro signals the end of
1121 the
1122 .Ql \&.Fn
1123 call (it will close-parenthesis at that point).
1124 .Pp
1125 For functions that have more than eight parameters (and this
1126 is rare), the
1127 macros
1128 .Ql \&.Fo
1129 (function open)
1130 and
1131 .Ql \&.Fc
1132 (function close)
1133 may be used with
1134 .Ql \&.Fa
1135 (function argument)
1136 to get around the limitation.  For example:
1137 .Bd -literal -offset indent
1138 \&.Fo "int res_mkquery"
1139 \&.Fa "int op"
1140 \&.Fa "char *dname"
1141 \&.Fa "int class"
1142 \&.Fa "int type"
1143 \&.Fa "char *data"
1144 \&.Fa "int datalen"
1145 \&.Fa "struct rrec *newrr"
1146 \&.Fa "char *buf"
1147 \&.Fa "int buflen"
1148 \&.Fc
1149 .Ed
1150 .Pp
1151 Produces:
1152 .Bd -filled -offset indent
1153 .Fo "int res_mkquery"
1154 .Fa "int op"
1155 .Fa "char *dname"
1156 .Fa "int class"
1157 .Fa "int type"
1158 .Fa "char *data"
1159 .Fa "int datalen"
1160 .Fa "struct rrec *newrr"
1161 .Fa "char *buf"
1162 .Fa "int buflen"
1163 .Fc
1164 .Ed
1165 .Pp
1166 The
1167 .Ql \&.Fo
1168 and
1169 .Ql \&.Fc
1170 macros are parsed and are callable.
1171 In the
1172 .Sx SYNOPSIS
1173 section, the function will always begin at
1174 the beginning of line.
1175 If there is more than one function
1176 presented in the
1177 .Sx SYNOPSIS
1178 section and a function type has not been
1179 given, a line break will occur, leaving a nice vertical space
1180 between the current function name and the one prior.
1181 At the moment,
1182 .Ql \&.Fn
1183 does not check its word boundaries
1184 against troff line lengths and may split across a newline
1185 ungracefully.
1186 This will be fixed in the near future.
1187 .Ss Function Type
1188 This macro is intended for the
1189 .Sx SYNOPSIS
1190 section.
1191 It may be used
1192 anywhere else in the man page without problems, but its main purpose
1193 is to present the function type in kernel normal form for the
1194 .Sx SYNOPSIS
1195 of sections two and three
1196 (it causes a line break allowing the function name to appear
1197 on the next line).
1198 .Pp
1199 .Dl Usage: .Ft type ... \*(Pu
1200 .Bl -tag -width "\&.Ft struct stat" -offset 14n -compact
1201 .It Li \&.Ft struct stat
1202 .Ft struct stat
1203 .El
1204 .Pp
1205 The
1206 .Ql \&.Ft
1207 request is not callable by other macros.
1208 .Ss Interactive Commands
1209 The
1210 .Ql \&.Ic
1211 macro designates an interactive or internal command.
1212 .Pp
1213 .Dl Usage: .Ic argument ... \*(Pu
1214 .Bl -tag -width ".Ic setenv , unsetenvxx" -compact -offset 14n
1215 .It Li \&.Ic :wq
1216 .Ic :wq
1217 .It Li \&.Ic do while {...}
1218 .Ic do while {...}
1219 .It Li \&.Ic setenv\ , unsetenv
1220 .Ic setenv , unsetenv
1221 .El
1222 .Pp
1223 It is an error to call
1224 .Ql \&.Ic
1225 without arguments.
1226 The
1227 .Ql \&.Ic
1228 macro is parsed and is callable.
1229 .Ss Name Macro
1230 The
1231 .Ql \&.Nm
1232 macro is used for the document title or subject name.
1233 It has the peculiarity of remembering the first
1234 argument it was called with, which should
1235 always be the subject name of the page.
1236 When called without
1237 arguments,
1238 .Ql \&.Nm
1239 regurgitates this initial name for the sole purpose
1240 of making less work for the author.
1241 Note:
1242 a section two
1243 or three document function name is addressed with the
1244 .Ql \&.Nm
1245 in the
1246 .Sx NAME
1247 section, and with
1248 .Ql \&.Fn
1249 in the
1250 .Sx SYNOPSIS
1251 and remaining sections.
1252 For interactive commands, such as the
1253 .Ql while
1254 command keyword in
1255 .Xr csh 1 ,
1256 the
1257 .Ql \&.Ic
1258 macro should be used.
1259 While the
1260 .Ql \&.Ic
1261 is nearly identical
1262 to
1263 .Ql \&.Nm ,
1264 it can not recall the first argument it was invoked with.
1265 .Pp
1266 .Dl Usage: .Nm argument ... \*(Pu
1267 .Bl -tag -width ".Nm mdoc.sample" -compact -offset 14n
1268 .It Li \&.Nm mdoc.sample
1269 .Nm  mdoc.sample
1270 .It Li \&.Nm \e-mdoc
1271 .Nm \-mdoc .
1272 .It Li \&.Nm foo\ )\ )\ ,
1273 .Nm foo ) ) ,
1274 .It Li \&.Nm
1275 .Nm
1276 .El
1277 .Pp
1278 The
1279 .Ql \&.Nm
1280 macro is parsed and is callable.
1281 .Ss Options
1282 The
1283 .Ql \&.Op
1284 macro
1285 places option brackets around any remaining arguments on the command
1286 line, and places any
1287 trailing punctuation outside the brackets.
1288 The macros
1289 .Ql \&.Oc
1290 and
1291 .Ql \&.Oo
1292 may be used across one or more lines.
1293 .Pp
1294 .Dl Usage: .Op options ... \*(Pu
1295 .Bl -tag -width ".Op Fl c Ar objfil Op Ar corfil ," -compact -offset indent
1296 .It Li \&.Op
1297 .Op
1298 .It Li ".Op Fl k"
1299 .Op Fl k
1300 .It Li ".Op Fl k ) ."
1301 .Op Fl k ) .
1302 .It Li ".Op Fl k Ar kookfile"
1303 .Op Fl k Ar kookfile
1304 .It Li ".Op Fl k Ar kookfile ,"
1305 .Op Fl k Ar kookfile ,
1306 .It Li ".Op Ar objfil Op Ar corfil"
1307 .Op Ar objfil Op Ar corfil
1308 .It Li ".Op Fl c Ar objfil Op Ar corfil ,"
1309 .Op Fl c Ar objfil Op Ar corfil ,
1310 .It Li \&.Op word1 word2
1311 .Op word1 word2
1312 .El
1313 .Pp
1314 The
1315 .Ql \&.Oc
1316 and
1317 .Ql \&.Oo
1318 macros:
1319 .Bd -literal -offset indent
1320 \&.Oo
1321 \&.Op \&Fl k \&Ar kilobytes
1322 \&.Op \&Fl i \&Ar interval
1323 \&.Op \&Fl c \&Ar count
1324 \&.Oc
1325 .Ed
1326 .Pp
1327 Produce:
1328 .Oo
1329 .Op Fl k Ar kilobytes
1330 .Op Fl i Ar interval
1331 .Op Fl c Ar count
1332 .Oc
1333 .Pp
1334 The macros
1335 .Ql \&.Op ,
1336 .Ql \&.Oc
1337 and
1338 .Ql \&.Oo
1339 are parsed and are callable.
1340 .Ss Pathnames
1341 The
1342 .Ql \&.Pa
1343 macro formats path or file names.
1344 .Pp
1345 .Dl Usage: .Pa pathname \*(Pu
1346 .Bl -tag -width ".Pa /tmp/fooXXXXX ) ." -compact -offset 14n
1347 .It Li \&.Pa /usr/share
1348 .Pa /usr/share
1349 .It Li \&.Pa /tmp/fooXXXXX\ )\ .
1350 .Pa /tmp/fooXXXXX ) .
1351 .El
1352 .Pp
1353 The
1354 .Ql \&.Pa
1355 macro is parsed and is callable.
1356 .Ss Standards
1357 The
1358 .Ql \&.St
1359 macro replaces standard abbreviature with its formal name.
1360 .Pp
1361 .Dl Usage: .St abbreviature
1362 .Pp
1363 Available pairs for
1364 .Dq Abbreviature/Formal Name
1365 are:
1366 .Bl -tag -width "-p1003.2-92XX." -compact -offset indent
1367 .It Li "-ansiC"
1368 .St -ansiC
1369 .It Li "-ansiC-89"
1370 .St -ansiC-89
1371 .It Li "-ieee754"
1372 .St -ieee754
1373 .It Li "-iso8802-3"
1374 .St -iso8802-3
1375 .It Li "-iso9899"
1376 .St -iso9899
1377 .It Li "-iso9945-1"
1378 .St -iso9945-1
1379 .It Li "-isoC"
1380 .St -isoC
1381 .It Li "-p1003.1"
1382 .St -p1003.1
1383 .It Li "-p1003.1-88"
1384 .St -p1003.1-88
1385 .It Li "-p1003.1-90"
1386 .St -p1003.1-90
1387 .It Li "-p1003.1b"
1388 .St -p1003.1b
1389 .It Li "-p1003.1b-93"
1390 .St -p1003.1b-93
1391 .It Li "-p1003.1g"
1392 .St -p1003.1g
1393 .It Li "-p1003.2"
1394 .St -p1003.2
1395 .It Li "-p1003.2-92"
1396 .St -p1003.2-92
1397 .It Li "-susv2"
1398 .St -susv2
1399 .It Li "-xpg3"
1400 .St -xpg3
1401 .It Li "-xpg4"
1402 .St -xpg4
1403 .It Li "-xpg4.2"
1404 .St -xpg4.2
1405 .El
1406 .Ss Variables
1407 Generic variable reference:
1408 .Pp
1409 .Dl Usage: .Va variable ... \*(Pu
1410 .Bl -tag -width ".Va char s ] ) ) ," -compact -offset 14n
1411 .It Li \&.Va count
1412 .Va count
1413 .It Li \&.Va settimer ,
1414 .Va settimer ,
1415 .It Li \&.Va int\ *prt\ )\ :
1416 .Va int\ *prt ) :
1417 .It Li \&.Va char\ s\ ]\ )\ )\ ,
1418 .Va char\ s ] ) ) ,
1419 .El
1420 .Pp
1421 It is an error to call
1422 .Ql \&.Va
1423 without any arguments.
1424 The
1425 .Ql \&.Va
1426 macro is parsed and is callable.
1427 .Ss Manual Page Cross References
1428 The
1429 .Ql \&.Xr
1430 macro expects the first argument to be
1431 a manual page name, and the second argument, if it exists,
1432 to be either a section page number or punctuation.
1433 Any
1434 remaining arguments are assumed to be punctuation.
1435 .Pp
1436 .Dl Usage: .Xr man_page [1,...,9] \*(Pu
1437 .Bl -tag -width ".Xr mdoc 7 ) ) ," -compact -offset 14n
1438 .It Li \&.Xr mdoc
1439 .Xr mdoc
1440 .It Li \&.Xr mdoc\ ,
1441 .Xr mdoc ,
1442 .It Li \&.Xr mdoc 7
1443 .Xr mdoc 7
1444 .It Li \&.Xr mdoc 7\ )\ )\ ,
1445 .Xr mdoc 7 ) ) ,
1446 .El
1447 .Pp
1448 The
1449 .Ql \&.Xr
1450 macro is parsed and is callable.
1451 It is an error to call
1452 .Ql \&.Xr
1453 without
1454 any arguments.
1455 .Sh GENERAL TEXT DOMAIN
1456 .Ss AT&T Macro
1457 .Bd -literal -offset indent -compact
1458 Usage: .At [v6 | v7 | 32v | V.1 | V.4] ... \*(Pu
1459 .Ed
1460 .Bl -tag -width ".At v6 ) ," -compact -offset 14n
1461 .It Li ".At"
1462 .At
1463 .It Li ".At v6 ."
1464 .At v6 .
1465 .El
1466 .Pp
1467 The
1468 .Ql \&.At
1469 macro is
1470 .Em not
1471 parsed and
1472 .Em not
1473 callable.  It accepts at most two arguments.
1474 .Ss BSD Macro
1475 .Dl Usage: .Bx [Version/release] ... \*(Pu
1476 .Bl -tag -width ".Bx 4.3 ) ," -compact -offset 14n
1477 .It Li ".Bx"
1478 .Bx
1479 .It Li ".Bx 4.3 ."
1480 .Bx 4.3 .
1481 .El
1482 .Pp
1483 The
1484 .Ql \&.Bx
1485 macro is parsed and is callable.
1486 .Ss FreeBSD/NetBSD/OpenBSD Macros
1487 .Bd -literal -offset indent -compact
1488 Usage: .Fx [ Version.release ] ... \*(Pu
1489 .Ed
1490 .Bl -tag -width ".Fx 2.2 ) ," -compact -offset 14n
1491 .It Li ".Fx 2.2 ."
1492 .Fx 2.2 .
1493 .El
1494 .Pp
1495 .Bd -literal -offset indent -compact
1496 Usage: .Nx [ Version.release ] ... \*(Pu
1497 .Ed
1498 .Bl -tag -width ".Nx 1.4 ) ," -compact -offset 14n
1499 .It Li ".Nx 1.4 ."
1500 .Nx 1.4 .
1501 .El
1502 .Pp
1503 .Bd -literal -offset indent -compact
1504 Usage: .Ox [ Version.release ] ... \*(Pu
1505 .Ed
1506 .Bl -tag -width ".Ox 2.5 ) ," -compact -offset 14n
1507 .It Li ".Ox 2.5 ."
1508 .Ox 2.5 .
1509 .El
1510 .Pp
1511 The
1512 .Ql \&.Fx ,
1513 .Ql \&.Nx ,
1514 .Ql \&.Ox
1515 macros are
1516 .Em not
1517 parsed and
1518 .Em not
1519 callable.  They accept at most two arguments.
1520 .Ss UNIX Macro
1521 .Dl Usage: .Ux ... \*(Pu
1522 .Bl -tag -width ".Ux 4.3 ) ," -compact -offset 14n
1523 .It Li ".Ux"
1524 .Ux
1525 .El
1526 .Pp
1527 The
1528 .Ql \&.Ux
1529 macro is parsed and is callable.
1530 .Ss Enclosure and Quoting Macros
1531 The concept of enclosure is similar to quoting.
1532 The object being to enclose one or more strings between
1533 a pair of characters like quotes or parentheses.
1534 The terms quoting and enclosure are used
1535 interchangeably throughout this document.
1536 Most of the
1537 one line enclosure macros end
1538 in small letter
1539 .Ql q
1540 to give a hint of quoting, but there are a few irregularities.
1541 For each enclosure macro
1542 there is also a pair of open and close macros which end
1543 in small letters
1544 .Ql o
1545 and
1546 .Ql c
1547 respectively.
1548 These can be used across one or more lines of text
1549 and while they have nesting limitations, the one line quote macros
1550 can be used inside
1551 of them.
1552 .Pp
1553 .ne 5
1554 .Bd -filled -offset indent
1555 .Bl -column "quote " "close " "open " "Enclose Stringx(in XX) " XXstringXX
1556 .Em " Quote      Close   Open   Function        Result"
1557 \&.Aq   .Ac     .Ao     Angle Bracket Enclosure <string>
1558 \&.Bq   .Bc     .Bo     Bracket Enclosure       [string]
1559 \&.Dq   .Dc     .Do     Double Quote    ``string''
1560         .Ec     .Eo     Enclose String (in XX)  XXstringXX
1561 \&.Pq   .Pc     .Po     Parenthesis Enclosure   (string)
1562 \&.Ql                   Quoted Literal  `st' or string
1563 \&.Qq   .Qc     .Qo     Straight Double Quote   "string"
1564 \&.Sq   .Sc     .So     Single Quote    `string'
1565 .El
1566 .Ed
1567 .Pp
1568 Except for the irregular macros noted below, all
1569 of the quoting macros are parsed and callable.
1570 All handle punctuation properly, as long as it
1571 is presented one character at a time and separated by spaces.
1572 The quoting macros examine opening and closing punctuation
1573 to determine whether it comes before or after the
1574 enclosing string.  This makes some nesting possible.
1575 .Bl -tag -width xxx,xxxx
1576 .It Li \&.Ec , \&.Eo
1577 These macros expect the first argument to be the
1578 opening and closing strings respectively.
1579 .It Li \&.Ql
1580 The quoted literal macro behaves differently for
1581 .Xr troff
1582 than
1583 .Xr nroff .
1584 If formatted with
1585 .Xr nroff ,
1586 a quoted literal is always quoted.
1587 If formatted with
1588 troff, an item is only quoted if the width
1589 of the item is less than three constant width characters.
1590 This is to make short strings more visible where the font change
1591 to literal (constant width) is less noticeable.
1592 .It Li \&.Pf
1593 The prefix macro is not callable, but it is parsed:
1594 .Bl -tag -width "(namexx" -offset indent
1595 .It Li ".Pf ( Fa name2"
1596 becomes
1597 .Pf ( Fa name2 .
1598 .El
1599 .Pp
1600 The
1601 .Ql \&.Ns
1602 (no space) macro performs the analogous suffix function.
1603 .El
1604 .Pp
1605 .ne 4
1606 Examples of quoting:
1607 .Bl -tag -width ".Aq Pa ctype.h ) ,xxxxxxxx" -compact -offset indent
1608 .It Li \&.Aq
1609 .Aq
1610 .It Li \&.Aq \&Ar ctype.h\ )\ ,
1611 .Aq Ar ctype.h ) ,
1612 .It Li \&.Bq
1613 .Bq
1614 .It Li \&.Bq \&Em Greek \&, French \&.
1615 .Bq Em Greek , French .
1616 .It Li \&.Dq
1617 .Dq
1618 .It Li ".Dq string abc ."
1619 .Dq string abc .
1620 .It Li ".Dq \'^[A-Z]\'"
1621 .Dq \'^[A-Z]\'
1622 .It Li "\&.Ql man mdoc"
1623 .Ql man mdoc
1624 .It Li \&.Qq
1625 .Qq
1626 .It Li "\&.Qq string ) ,"
1627 .Qq string ) ,
1628 .It Li "\&.Qq string Ns ),"
1629 .Qq string Ns ),
1630 .It Li \&.Sq
1631 .Sq
1632 .It Li "\&.Sq string
1633 .Sq string
1634 .El
1635 .Pp
1636 For a good example of nested enclosure macros, see the
1637 .Ql \&.Op
1638 option macro.
1639 It was created from the same
1640 underlying enclosure macros as those presented in the list
1641 above.
1642 The
1643 .Ql \&.Xo
1644 and
1645 .Ql \&.Xc
1646 extended argument list macros
1647 were also built from the same underlying routines and are a good
1648 example of
1649 .Nm \-mdoc
1650 macro usage at its worst.
1651 .Ss No\-Op or Normal Text Macro
1652 The macro
1653 .Ql \&.No
1654 is
1655 a hack for words in a macro command line which should
1656 .Em not
1657 be formatted and follows the conventional syntax
1658 for content macros.
1659 .Ss No Space Macro
1660 The
1661 .Ql \&.Ns
1662 macro eliminates unwanted spaces in between macro requests.
1663 It is useful for old style argument lists where there is no space
1664 between the flag and argument:
1665 .Bl -tag -width ".Op Fl I Ns Ar directoryxx" -offset indent
1666 .It Li ".Op Fl I Ns Ar directory"
1667 produces
1668 .Op Fl I Ns Ar directory
1669 .El
1670 .Pp
1671 Note: the
1672 .Ql \&.Ns
1673 macro always invokes the
1674 .Ql \&.No
1675 macro after eliminating the space unless another macro name
1676 follows it.
1677 The macro
1678 .Ql \&.Ns
1679 is parsed and is callable.
1680 .Ss Section Cross References
1681 The
1682 .Ql \&.Sx
1683 macro designates a reference to a section header
1684 within the same document.
1685 It is parsed and is callable.
1686 .Pp
1687 .Bl -tag -width "Li \&.Sx FILES" -offset 14n
1688 .It Li \&.Sx FILES
1689 .Sx FILES
1690 .El
1691 .Ss References and Citations
1692 The following macros make a modest attempt to handle references.
1693 At best, the macros make it convenient to manually drop in a subset of
1694 refer style references.
1695 .Pp
1696 .Bl -tag -width 6n -offset indent -compact
1697 .It Li ".Rs"
1698 Reference Start.
1699 Causes a line break and begins collection
1700 of reference information until the
1701 reference end macro is read.
1702 .It Li ".Re"
1703 Reference End.
1704 The reference is printed.
1705 .It Li ".%A"
1706 Reference author name, one name per invocation.
1707 .It Li ".%B"
1708 Book title.
1709 .It Li ".\&%C"
1710 City/place.
1711 .It Li ".\&%D"
1712 Date.
1713 .It Li ".%J"
1714 Journal name.
1715 .It Li ".%N"
1716 Issue number.
1717 .It Li ".%O"
1718 Optional information.
1719 .It Li ".%P"
1720 Page number.
1721 .It Li ".%R"
1722 Report name.
1723 .It Li ".%T"
1724 Title of article.
1725 .It Li ".%V"
1726 Volume(s).
1727 .El
1728 .Pp
1729 The macros beginning with
1730 .Ql %
1731 are not callable, and are parsed only for the trade name macro which
1732 returns to its caller.
1733 (And not very predictably at the moment either.)
1734 The purpose is to allow trade names
1735 to be pretty printed in
1736 .Xr troff Ns / Ns Xr ditroff
1737 output.
1738 .Ss Return Values
1739 The
1740 .Ql \&.Rv
1741 macro generates text for use in the
1742 .Sx RETURN VALUES
1743 section.
1744 .Pp
1745 .Dl Usage: .Rv [-std function]
1746 .Pp
1747 .Ql \&.Rv -std atexit
1748 will generate the following text:
1749 .Pp
1750 .Rv -std atexit
1751 .Pp
1752 The
1753 .Fl std
1754 option is valid only for manual page sections 2 and 3.
1755 .Ss Trade Names (or Acronyms and Type Names)
1756 The trade name macro is generally a small caps macro for
1757 all upper case words longer than two characters.
1758 .Pp
1759 .Dl Usage: .Tn symbol ... \*(Pu
1760 .Bl -tag -width ".Tn ASCII" -compact -offset 14n
1761 .It Li \&.Tn DEC
1762 .Tn DEC
1763 .It Li \&.Tn ASCII
1764 .Tn ASCII
1765 .El
1766 .Pp
1767 The
1768 .Ql \&.Tn
1769 macro
1770 is parsed and is callable by other macros.
1771 .Ss Extended  Arguments
1772 The
1773 .Ql \&.Xo
1774 and
1775 .Ql \&.Xc
1776 macros allow one to extend an argument list
1777 on a macro boundary.
1778 Argument lists cannot
1779 be extended within a macro
1780 which expects all of its arguments on one line such
1781 as
1782 .Ql \&.Op .
1783 .Pp
1784 Here is an example of
1785 .Ql \&.Xo
1786 using the space mode macro to turn spacing off:
1787 .Bd -literal -offset indent
1788 \&.Sm off
1789 \&.It Xo Sy I Ar operation
1790 \&.No \een Ar count No \een
1791 \&.Xc
1792 \&.Sm on
1793 .Ed
1794 .Pp
1795 Produces
1796 .Bd -filled -offset indent
1797 .Bl -tag -width flag -compact
1798 .Sm off
1799 .It Xo Sy I Ar operation
1800 .No \en Ar count No \en
1801 .Xc
1802 .Sm on
1803 .El
1804 .Ed
1805 .Pp
1806 Another one:
1807 .Bd -literal -offset indent
1808 \&.Sm off
1809 \&.It Cm S No \&/ Ar old_pattern Xo
1810 \&.No \&/ Ar new_pattern
1811 \&.No \&/ Op Cm g
1812 \&.Xc
1813 \&.Sm on
1814 .Ed
1815 .Pp
1816 Produces
1817 .Bd -filled -offset indent
1818 .Bl -tag -width flag -compact
1819 .Sm off
1820 .It Cm S No \&/ Ar old_pattern Xo
1821 .No \&/ Ar new_pattern
1822 .No \&/ Op Cm g
1823 .Xc
1824 .Sm on
1825 .El
1826 .Ed
1827 .Pp
1828 Another example of
1829 .Ql \&.Xo
1830 and using enclosure macros:
1831 Test the value of an variable.
1832 .Bd -literal -offset indent
1833 \&.It Xo
1834 \&.Ic .ifndef
1835 \&.Oo \e&! Oc Ns Ar variable
1836 \&.Op Ar operator variable ...
1837 \&.Xc
1838 .Ed
1839 .Pp
1840 Produces
1841 .Bd -filled -offset indent
1842 .Bl -tag -width flag -compact
1843 .It Xo
1844 .Ic .ifndef
1845 .Oo \&! Oc Ns Ar variable
1846 .Op Ar operator variable ...
1847 .Xc
1848 .El
1849 .Ed
1850 .Pp
1851 All of the above examples have used the
1852 .Ql \&.Xo
1853 macro on the argument list of the
1854 .Ql \&.It
1855 (list-item)
1856 macro.
1857 The extend macros are not used very often, and when they are
1858 it is usually to extend the list-item argument list.
1859 Unfortunately, this is also where the extend macros are the
1860 most finicky.
1861 In the first two examples, spacing was turned off;
1862 in the third, spacing was desired in part of the output but
1863 not all of it.
1864 To make these macros work in this situation make sure
1865 the
1866 .Ql \&.Xo
1867 and
1868 .Ql \&.Xc
1869 macros are placed as shown in the third example.
1870 If the
1871 .Ql \&.Xo
1872 macro is not alone on the
1873 .Ql \&.It
1874 argument list, spacing will be unpredictable.
1875 The
1876 .Ql \&.Ns
1877 (no space macro)
1878 must not occur as the first or last macro on a line
1879 in this situation.
1880 Out of 900 manual pages (about 1500 actual pages)
1881 currently released with
1882 .Bx
1883 only fifteen use the
1884 .Ql \&.Xo
1885 macro.
1886 .Sh PAGE STRUCTURE DOMAIN
1887 .Ss Section Headers
1888 The first three
1889 .Ql \&.Sh
1890 section header macros
1891 list below are required in every
1892 man page.
1893 The remaining section headers
1894 are recommended at the discretion of the author
1895 writing the manual page.
1896 The
1897 .Ql \&.Sh
1898 macro can take up to nine arguments.
1899 It is parsed and but is not callable.
1900 .Bl -tag -width ".Sh SYNOPSIS"
1901 .It \&.Sh NAME
1902 The
1903 .Ql \&.Sh NAME
1904 macro is mandatory.
1905 If not specified,
1906 the headers, footers and page layout defaults
1907 will not be set and things will be rather unpleasant.
1908 The
1909 .Sx NAME
1910 section consists of at least three items.
1911 The first is the
1912 .Ql \&.Nm
1913 name macro naming the subject of the man page.
1914 The second is the Name Description macro,
1915 .Ql \&.Nd ,
1916 which separates the subject
1917 name from the third item, which is the description.
1918 The
1919 description should be the most terse and lucid possible,
1920 as the space available is small.
1921 .It \&.Sh SYNOPSIS
1922 The
1923 .Sx SYNOPSIS
1924 section describes the typical usage of the
1925 subject of a man page.
1926 The  macros required
1927 are either
1928 .Ql ".Nm" ,
1929 .Ql ".Cd" ,
1930 .Ql ".Fn" ,
1931 (and possibly
1932 .Ql ".Fo" ,
1933 .Ql ".Fc" ,
1934 .Ql ".Fd" ,
1935 .Ql ".Ft"
1936 macros).
1937 The function name
1938 macro
1939 .Ql ".Fn"
1940 is required
1941 for manual page sections 2 and 3, the command and general
1942 name macro
1943 .Ql \&.Nm
1944 is required for sections 1, 5, 6, 7, 8.
1945 Section 4 manuals require a
1946 .Ql ".Nm" , 
1947 .Ql ".Fd"
1948 or a
1949 .Ql ".Cd"
1950 configuration device usage macro.
1951 Several other macros may be necessary to produce
1952 the synopsis line as shown below:
1953 .Pp
1954 .Bd -filled -offset indent
1955 .Nm cat
1956 .Op Fl benstuv
1957 .Op Fl
1958 .Ar
1959 .Ed
1960 .Pp
1961 The following macros were used:
1962 .Pp
1963 .Dl \&.Nm cat
1964 .Dl \&.Op \&Fl benstuv
1965 .Dl \&.Op \&Fl
1966 .Dl \&.Ar
1967 .Pp
1968 .Sy Note :
1969 The macros
1970 .Ql \&.Op ,
1971 .Ql \&.Fl ,
1972 and
1973 .Ql \&.Ar
1974 recognize the pipe bar character
1975 .Ql \*(Ba ,
1976 so a command line such as:
1977 .Pp
1978 .Dl ".Op Fl a | Fl b"
1979 .Pp
1980 will not go orbital.
1981 .Xr Troff
1982 normally interprets a \*(Ba as a special operator.
1983 See
1984 .Sx PREDEFINED STRINGS
1985 for a usable \*(Ba
1986 character in other situations.
1987 .It \&.Sh DESCRIPTION
1988 In most cases the first text in the
1989 .Sx DESCRIPTION
1990 section
1991 is a brief paragraph on the command, function or file,
1992 followed by a lexical list of options and respective
1993 explanations.
1994 To create such a list, the
1995 .Ql \&.Bl
1996 begin-list,
1997 .Ql \&.It
1998 list-item and
1999 .Ql \&.El
2000 end-list
2001 macros are used (see
2002 .Sx Lists and Columns
2003 below).
2004 .El
2005 .Pp
2006 The following
2007 .Ql \&.Sh
2008 section headers are part of the
2009 preferred manual page layout and must be used appropriately
2010 to maintain consistency.
2011 They are listed in the order
2012 in which they would be used.
2013 .Bl -tag -width SYNOPSIS
2014 .It \&.Sh ENVIRONMENT
2015 The
2016 .Sx ENVIRONMENT
2017 section should reveal any related
2018 environment
2019 variables and clues to their behavior and/or usage.
2020 .It \&.Sh EXAMPLES
2021 There are several ways to create examples.
2022 See
2023 the
2024 .Sx EXAMPLES
2025 section below
2026 for details.
2027 .It \&.Sh FILES
2028 Files which are used or created by the man page subject
2029 should be listed via the
2030 .Ql \&.Pa
2031 macro in the
2032 .Sx FILES
2033 section.
2034 .It \&.Sh SEE ALSO
2035 References to other material on the man page topic and
2036 cross references to other relevant man pages should
2037 be placed in the
2038 .Sx SEE ALSO
2039 section.
2040 Cross references
2041 are specified using the
2042 .Ql \&.Xr
2043 macro.
2044 Cross references in the
2045 .Sx SEE ALSO
2046 section should be sorted by section number, and then
2047 placed in alphabetical order and comma separated.  For example:
2048 .Pp
2049 .Xr ls 1 ,
2050 .Xr ps 1 ,
2051 .Xr group 5 ,
2052 .Xr passwd 5 .
2053 .Pp
2054 At this time
2055 .Xr refer 1
2056 style references are not accommodated.
2057 .It \&.Sh STANDARDS
2058 If the command, library function or file adheres to a
2059 specific implementation such as
2060 .St -p1003.2
2061 or
2062 .St -ansiC
2063 this should be noted here.
2064 If the
2065 command does not adhere to any standard, its history
2066 should be noted in the
2067 .Sx HISTORY
2068 section.
2069 .It \&.Sh HISTORY
2070 Any command which does not adhere to any specific standards
2071 should be outlined historically in this section.
2072 .It \&.Sh AUTHORS
2073 Credits, if need be, should be placed here.
2074 The
2075 .Ql \&.An
2076 macro should be used to specify the name of the person.
2077 .It \&.Sh DIAGNOSTICS
2078 Diagnostics from a command should be placed in this section.
2079 .It \&.Sh ERRORS
2080 Specific error handling, especially from library functions
2081 (man page sections 2, 3 and 9) should go here.
2082 The
2083 .Ql \&.Er
2084 macro is used to specify an errno.
2085 .It \&.Sh BUGS
2086 Blatant problems with the topic go here...
2087 .El
2088 .Pp
2089 User specified
2090 .Ql \&.Sh
2091 sections may be added,
2092 for example, this section was set with:
2093 .Bd -literal -offset 14n
2094 \&.Sh PAGE STRUCTURE DOMAIN
2095 .Ed
2096 .Ss Paragraphs and Line Spacing.
2097 .Bl -tag -width 6n
2098 .It \&.Pp
2099 The
2100 .Ql \&.Pp
2101 paragraph command may
2102 be used to specify a line space where necessary.
2103 The macro is not necessary after a
2104 .Ql \&.Sh
2105 or
2106 .Ql \&.Ss
2107 macro or before
2108 a
2109 .Ql \&.Bl
2110 macro.
2111 (The
2112 .Ql \&.Bl
2113 macro asserts a vertical distance unless the -compact flag is given).
2114 .El
2115 .\" This worked with version one, need to redo for version three
2116 .\" .Pp
2117 .\" .Ds I
2118 .\" .Cw (ax+bx+c) \ is\ produced\ by\ \&
2119 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2120 .\" .Cl Cx \t\t
2121 .\" .Li \&.Cx\ (
2122 .\" .Cx
2123 .\" .Cl Cx \t\t
2124 .\" .Li \&.Va ax
2125 .\" .Cx
2126 .\" .Cl Cx \t\t
2127 .\" .Li \&.Sy \+
2128 .\" .Cx
2129 .\" .Cl Cx \&(\&
2130 .\" .Va ax
2131 .\" .Cx +
2132 .\" .Va by
2133 .\" .Cx +
2134 .\" .Va c )
2135 .\" .Cx \t
2136 .\" .Em is produced by
2137 .\" .Cx \t
2138 .\" .Li \&.Va by
2139 .\" .Cx
2140 .\" .Cl Cx \t\t
2141 .\" .Li \&.Sy \+
2142 .\" .Cx
2143 .\" .Cl Cx \t\t
2144 .\" .Li \&.Va c )
2145 .\" .Cx
2146 .\" .Cl Cx \t\t
2147 .\" .Li \&.Cx
2148 .\" .Cx
2149 .\" .Cw
2150 .\" .De
2151 .\" .Pp
2152 .\" This example shows the same equation in a different format.
2153 .\" The spaces
2154 .\" around the
2155 .\" .Li \&+
2156 .\" signs were forced with
2157 .\" .Li \e :
2158 .\" .Pp
2159 .\" .Ds I
2160 .\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&
2161 .\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
2162 .\" .Cl Cx \t\t
2163 .\" .Li \&.Cx\ (
2164 .\" .Cx
2165 .\" .Cl Cx \t\t
2166 .\" .Li \&.Va a
2167 .\" .Cx
2168 .\" .Cl Cx \t\t
2169 .\" .Li \&.Sy x
2170 .\" .Cx
2171 .\" .Cl Cx \t\t
2172 .\" .Li \&.Cx \e\ +\e\ \e&
2173 .\" .Cx
2174 .\" .Cl Cx \&(\&
2175 .\" .Va a
2176 .\" .Sy x
2177 .\" .Cx \ +\ \&
2178 .\" .Va b
2179 .\" .Sy y
2180 .\" .Cx \ +\ \&
2181 .\" .Va c )
2182 .\" .Cx \t
2183 .\" .Em is produced by
2184 .\" .Cl Cx \t\t
2185 .\" .Li \&.Va b
2186 .\" .Cx
2187 .\" .Cl Cx \t\t
2188 .\" .Li \&.Sy y
2189 .\" .Cx
2190 .\" .Cl Cx \t\t
2191 .\" .Li \&.Cx \e\ +\e\ \e&
2192 .\" .Cx
2193 .\" .Cl Cx \t\t
2194 .\" .Li \&.Va c )
2195 .\" .Cx
2196 .\" .Cl Cx \t\t
2197 .\" .Li \&.Cx
2198 .\" .Cx
2199 .\" .Cw
2200 .\" .De
2201 .\" .Pp
2202 .\" The incantation below was
2203 .\" lifted from the
2204 .\" .Xr adb 1
2205 .\" manual page:
2206 .\" .Pp
2207 .\" .Ds I
2208 .\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by
2209 .\" .Cl Cx \t\t
2210 .\" .Li \&.Cx Op Sy ?/
2211 .\" .Cx
2212 .\" .Cl Cx \t\t
2213 .\" .Li \&.Nm m
2214 .\" .Cx
2215 .\" .Cl Cx Op Sy ?/
2216 .\" .Nm m
2217 .\" .Ad \ b1 e1 f1
2218 .\" .Op Sy ?/
2219 .\" .Cx \t
2220 .\" .Em is produced by
2221 .\" .Cx \t
2222 .\" .Li \&.Ar \e\ b1 e1 f1
2223 .\" .Cx
2224 .\" .Cl Cx \t\t
2225 .\" .Li \&.Op Sy ?/
2226 .\" .Cx
2227 .\" .Cl Cx \t\t
2228 .\" .Li \&.Cx
2229 .\" .Cx
2230 .\" .Cw
2231 .\" .De
2232 .\" .Pp
2233 .Ss Keeps
2234 The only keep that is implemented at this time is for words.
2235 The macros are
2236 .Ql \&.Bk
2237 (begin-keep)
2238 and
2239 .Ql \&.Ek
2240 (end-keep).
2241 The only option that
2242 .Ql \&.Bk
2243 accepts is
2244 .Fl words
2245 and is useful for preventing line breaks in the middle of options.
2246 In the example for the make command line arguments (see
2247 .Sx What's in a name ) ,
2248 the keep prevented
2249 .Xr nroff
2250 from placing up the
2251 flag and the argument
2252 on separate lines.
2253 (Actually, the option macro used to prevent this from occurring,
2254 but was dropped when the decision (religious) was made to force
2255 right justified margins in
2256 .Xr troff
2257 as options in general look atrocious when spread across a sparse
2258 line.
2259 More work needs to be done with the keep macros, a
2260 .Fl line
2261 option needs to be added.)
2262 .Ss Examples and Displays
2263 There are five types of displays, a quickie one line indented display
2264 .Ql \&.D1 ,
2265 a quickie one line literal display
2266 .Ql \&.Dl ,
2267 and a block literal, block filled and block ragged which use
2268 the
2269 .Ql \&.Bd
2270 begin-display
2271 and
2272 .Ql \&.Ed
2273 end-display macros.
2274 .Pp
2275 .Bl -tag -width \&.Dlxx
2276 .It Li \&.D1
2277 (D-one) Display one line of indented text.
2278 This macro is parsed, but it is not callable.
2279 .Pp
2280 .D1 Fl ldghfstru
2281 .Pp
2282 The above was produced by:
2283 .Li \&.D1 \&Fl ldghfstru .
2284 .It Li \&.Dl
2285 (D-ell)
2286 Display one line of indented
2287 .Em literal
2288 text.
2289 The
2290 .Ql \&.Dl
2291 example macro has been used throughout this
2292 file.
2293 It allows
2294 the indent (display) of one line of text.
2295 Its default font is set to
2296 constant width (literal) however
2297 it is parsed and will recognize other macros.
2298 It is not callable however.
2299 .Pp
2300 .Dl % ls -ldg /usr/local/bin
2301 .Pp
2302 The above was produced by
2303 .Li \&.Dl % ls -ldg /usr/local/bin .
2304 .It Li \&.Bd
2305 Begin-display.
2306 The
2307 .Ql \&.Bd
2308 display must be ended with the
2309 .Ql \&.Ed
2310 macro.
2311 Displays may be nested within displays and
2312 lists.
2313 .Ql \&.Bd
2314 has the following syntax:
2315 .Pp
2316 .Dl ".Bd display-type [-offset offset_value] [-compact]"
2317 .Pp
2318 The display-type must be one of the following four types and
2319 may have an offset specifier for indentation:
2320 .Ql \&.Bd .
2321 .Pp
2322 .Bl -tag -width "file file_name  " -compact
2323 .It Fl ragged
2324 Display a block of text as typed,
2325 right (and left) margin edges are left ragged.
2326 .It Fl filled
2327 Display a filled (formatted) block.
2328 The block of text is formatted (the edges are filled \-
2329 not left unjustified).
2330 .It Fl literal
2331 Display a literal block, useful for source code or
2332 simple tabbed or spaced text.
2333 .It Fl file Ar file_name
2334 The file name following the
2335 .Fl file
2336 flag is read and displayed.
2337 Literal mode is
2338 asserted and tabs are set at 8 constant width character
2339 intervals, however any
2340 .Xr troff/ Ns Nm \-mdoc
2341 commands in file will be processed.
2342 .It Fl offset Ar string
2343 If
2344 .Fl offset
2345 is specified with one of the following strings, the string
2346 is interpreted to indicate the level of indentation for the
2347 forthcoming block of text:
2348 .Pp
2349 .Bl -tag -width "indent-two" -compact
2350 .It Ar left
2351 Align block on the current left margin,
2352 this is the default mode of
2353 .Ql \&.Bd .
2354 .It Ar center
2355 Supposedly center the block.
2356 At this time
2357 unfortunately, the block merely gets
2358 left aligned about an imaginary center margin.
2359 .It Ar indent
2360 Indents by one default indent value or tab.
2361 The default
2362 indent value is also used for the
2363 .Ql \&.D1
2364 display so one is guaranteed the two types of displays
2365 will line up.
2366 This indent is normally set to 6n or about two
2367 thirds of an inch (six constant width characters).
2368 .It Ar indent-two
2369 Indents two times the default indent value.
2370 .It Ar right
2371 This
2372 .Em left
2373 aligns the block about two inches from
2374 the right side of the page.
2375 This macro needs
2376 work and perhaps may never do the right thing by
2377 .Xr troff .
2378 .El
2379 .El
2380 .It ".Ed"
2381 End-display.
2382 .El
2383 .Ss Font Modes
2384 There are five macros for changing the appearance of the manual page text:
2385 .Bl -tag -width \&.Emxx
2386 .It \&.Em
2387 Text may be stressed or emphasized with the
2388 .Ql \&.Em
2389 macro.
2390 The usual font for emphasis is italic.
2391 .Pp
2392 .Dl Usage: .Em argument ... \*(Pu
2393 .Bl -tag -width ".Em vide infra ) ) ," -compact -offset 14n
2394 .It Li ".Em does not"
2395 .Em does not
2396 .It Li ".Em exceed 1024 ."
2397 .Em exceed 1024 .
2398 .It Li ".Em vide infra ) ) ,"
2399 .Em vide infra ) ) ,
2400 .El
2401 .Pp
2402 The
2403 .Ql \&.Em
2404 macro is parsed and is callable.
2405 It is an error to call
2406 .Ql \&.Em
2407 without arguments.
2408 .It \&.Li
2409 The
2410 .Ql \&.Li
2411 literal macro may be used for special characters,
2412 variable constants, anything which should be displayed as it
2413 would be typed.
2414 .Pp
2415 .Dl Usage: .Li argument ... \*(Pu
2416 .Bl -tag -width ".Li cntrl-D ) ,"  -compact -offset 14n
2417 .It Li \&.Li \een
2418 .Li \en
2419 .It Li \&.Li M1 M2 M3\ ;
2420 .Li M1 M2 M3 ;
2421 .It Li \&.Li cntrl-D\ )\ ,
2422 .Li cntrl-D ) ,
2423 .It Li \&.Li 1024\ ...
2424 .Li 1024 ...
2425 .El
2426 .Pp
2427 The
2428 .Ql \&.Li
2429 macro is parsed and is callable.
2430 .It \&.Sy
2431 The symbolic emphasis macro is generally a boldface macro in
2432 either the symbolic sense or the traditional English usage.
2433 .Pp
2434 .Dl Usage: .Sy symbol ... \*(Pu
2435 .Bl -tag -width ".Sy Important Noticex" -compact -offset 14n
2436 .It Li \&.Sy Important Notice
2437 .Sy Important Notice
2438 .El
2439 .Pp
2440 The
2441 .Ql \&.Sy
2442 macro is parsed and is callable.
2443 Arguments to
2444 .Ql \&.Sy
2445 may be quoted.
2446 .It Li \&.Bf
2447 Begin font mode.
2448 The
2449 .Ql \&.Bf
2450 font mode must be ended with the
2451 .Ql \&.Ef
2452 macro.
2453 Font modes may be nested within other font modes.
2454 .Ql \&.Bf
2455 has the following syntax:
2456 .Pp
2457 .Dl ".Bf font-mode"
2458 .Pp
2459 The font-mode must be one of the following three types:
2460 .Ql \&.Bf .
2461 .Pp
2462 .Bl -tag -width "file file_name  " -compact
2463 .It Sy \&Em | Fl emphasis
2464 Same as if the 
2465 .Ql \&.Em
2466 macro was used for the entire block of text.
2467 .It Sy \&Li | Fl literal
2468 Same as if the
2469 .Ql \&.Li
2470 macro was used for the entire block of text.
2471 .It Sy \&Sy | Fl symbolic
2472 Same as if the
2473 .Ql \&.Sy
2474 macro was used for the entire block of text.
2475 .El
2476 .It ".Ef"
2477 End font mode.
2478 .El
2479 .Ss Tagged Lists and Columns
2480 There are several types of lists which may be initiated with the
2481 .Ql ".Bl"
2482 begin-list macro.
2483 Items within the list
2484 are specified with the
2485 .Ql ".It"
2486 item macro and
2487 each list must end with the
2488 .Ql ".El"
2489 macro.
2490 Lists may be nested within themselves and within displays.
2491 Columns may be used inside of lists, but lists are unproven
2492 inside of columns.
2493 .Pp
2494 In addition, several list attributes may be specified such as
2495 the width of a tag, the list offset, and compactness
2496 (blank lines between items allowed or disallowed).
2497 Most of this document has been formatted with a tag style list
2498 .Pq Fl tag .
2499 For a change of pace, the list-type used to present the list-types
2500 is an over-hanging list
2501 .Pq Fl ohang .
2502 This type of list is quite popular with
2503 .Tn TeX
2504 users, but might look a bit funny after having read many pages of
2505 tagged lists.
2506 The following list types are accepted by
2507 .Ql ".Bl" :
2508 .Pp
2509 .Bl -ohang -compact
2510 .It Fl bullet
2511 .It Fl item
2512 .It Fl enum
2513 These three are the simplest types of lists.
2514 Once the
2515 .Ql ".Bl"
2516 macro has been given, items in the list are merely
2517 indicated by a line consisting solely of the
2518 .Ql ".It"
2519 macro.
2520 For example, the source text for a simple enumerated list
2521 would look like:
2522 .Bd -literal -offset indent-two
2523 \&.Bl -enum -compact
2524 \&.It
2525 \&Item one goes here.
2526 \&.It
2527 \&And item two here.
2528 \&.It
2529 \&Lastly item three goes here.
2530 \&.El
2531 .Ed
2532 .Pp
2533 The results:
2534 .Pp
2535 .Bl -enum -offset indent-two -compact
2536 .It
2537 Item one goes here.
2538 .It
2539 And item two here.
2540 .It
2541 Lastly item three goes here.
2542 .El
2543 .Pp
2544 A simple bullet list construction:
2545 .Bd -literal -offset indent-two
2546 \&.Bl -bullet -compact
2547 \&.It
2548 \&Bullet one goes here.
2549 \&.It
2550 \&Bullet two here.
2551 \&.El
2552 .Ed
2553 .Pp
2554 Produces:
2555 .Bl -bullet -offset indent-two -compact
2556 .It
2557 Bullet one goes here.
2558 .It
2559 Bullet two here.
2560 .El
2561 .Pp
2562 .It Fl tag
2563 .It Fl diag
2564 .It Fl hang
2565 .It Fl ohang
2566 .It Fl inset
2567 These list-types collect arguments specified with the
2568 .Ql \&.It
2569 macro and create a label which may be
2570 .Em inset
2571 into the forthcoming text,
2572 .Em hanged
2573 from the forthcoming text,
2574 .Em overhanged
2575 from above and not indented or
2576 .Em tagged .
2577 This
2578 list was constructed with the
2579 .Ql Fl ohang
2580 list-type.
2581 The
2582 .Ql \&.It
2583 macro is parsed only for the inset, hang
2584 and tag list-types and is not callable.
2585 Here is an example of inset labels:
2586 .Bl -inset -offset indent
2587 .It Em Tag
2588 The tagged list (also called a tagged paragraph) is the
2589 most common type of list used in the Berkeley manuals.
2590 .It Em Diag
2591 Diag lists create section four diagnostic lists
2592 and are similar to inset lists except callable
2593 macros are ignored.
2594 .It Em Hang
2595 Hanged labels are a matter of taste.
2596 .It Em Ohang
2597 Overhanging labels are nice when space is constrained.
2598 .It Em Inset
2599 Inset labels are useful for controlling blocks of
2600 paragraphs and are valuable for converting
2601 .Nm \-mdoc
2602 manuals to other formats.
2603 .El
2604 .Pp
2605 Here is the source text which produced the above example:
2606 .Bd -literal -offset indent
2607 \&.Bl -inset -offset indent
2608 \&.It Em Tag
2609 \&The tagged list (also called a tagged paragraph) is the
2610 \&most common type of list used in the Berkeley manuals.
2611 \&.It Em Diag
2612 \&Diag lists create section four diagnostic lists
2613 \&and are similar to inset lists except callable
2614 \&macros are ignored.
2615 \&.It Em Hang
2616 \&Hanged labels are a matter of taste.
2617 \&.It Em Ohang
2618 \&Overhanging labels are nice when space is constrained.
2619 \&.It Em Inset
2620 \&Inset labels are useful for controlling blocks of
2621 \&paragraphs and are valuable for converting
2622 \&.Nm \-mdoc
2623 \&manuals to other formats.
2624 \&.El
2625 .Ed
2626 .Pp
2627 Here is a hanged list with two items:
2628 .Bl -hang -offset indent
2629 .It Em Hanged
2630 labels appear similar to tagged lists when the
2631 label is smaller than the label width.
2632 .It Em Longer hanged list labels
2633 blend in to the paragraph unlike
2634 tagged paragraph labels.
2635 .El
2636 .Pp
2637 And the unformatted text which created it:
2638 .Bd -literal -offset indent
2639 \&.Bl -hang -offset indent
2640 \&.It Em Hanged
2641 \&labels appear similar to tagged lists when the
2642 \&label is smaller than the label width.
2643 \&.It Em Longer hanged list labels
2644 \&blend in to the paragraph unlike
2645 \&tagged paragraph labels.
2646 \&.El
2647 .Ed
2648 .Pp
2649 The tagged list which follows uses an optional width specifier to control
2650 the width of the tag.
2651 .Pp
2652 .Bl -tag -width "PAGEIN" -compact -offset indent
2653 .It SL
2654 sleep time of the process (seconds blocked)
2655 .It PAGEIN
2656 number of disk
2657 .Tn I/O Ns 's
2658 resulting from references
2659 by the process to pages not loaded in core.
2660 .It UID
2661 numerical user-id of process owner
2662 .It PPID
2663 numerical id of parent of process process priority
2664 (non-positive when in non-interruptible wait)
2665 .El
2666 .Pp
2667 The raw text:
2668 .Bd -literal -offset indent
2669 \&.Bl -tag -width "PAGEIN" -compact -offset indent
2670 \&.It SL
2671 \&sleep time of the process (seconds blocked)
2672 \&.It PAGEIN
2673 \&number of disk
2674 \&.Tn I/O Ns 's
2675 \&resulting from references
2676 \&by the process to pages not loaded in core.
2677 \&.It UID
2678 \&numerical user-id of process owner
2679 \&.It PPID
2680 \&numerical id of parent of process process priority
2681 \&(non-positive when in non-interruptible wait)
2682 \&.El
2683 .Ed
2684 .Pp
2685 Acceptable width specifiers:
2686 .Bl -tag -width Ar -offset indent
2687 .It Fl width Ar "\&Fl"
2688 sets the width to the default width for a flag.
2689 All callable
2690 macros have a default width value.
2691 The
2692 .Ql \&.Fl ,
2693 value is presently
2694 set to ten constant width characters or about five sixth of
2695 an inch.
2696 .It Fl width Ar "24n"
2697 sets the width to 24 constant width characters or about two
2698 inches.
2699 The
2700 .Ql n
2701 is absolutely necessary for the scaling to work correctly.
2702 .It Fl width Ar "ENAMETOOLONG"
2703 sets width to the constant width length of the
2704 string given.
2705 .It Fl width  Ar "\\*qint mkfifo\\*q"
2706 again, the width is set to the constant width of the string
2707 given.
2708 .El
2709 .Pp
2710 If a width is not specified for the tag list type, the first
2711 time
2712 .Ql \&.It
2713 is invoked, an attempt is made to determine an appropriate
2714 width.
2715 If the first argument to
2716 .Ql ".It"
2717 is a callable macro, the default width for that macro will be used
2718 as if the macro name had been supplied as the width.
2719 However,
2720 if another item in the list is given with a different callable
2721 macro name, a new and nested list is assumed.
2722 .Sh PREDEFINED STRINGS
2723 The following strings are predefined and may be used by
2724 preceding with the troff string interpreting sequence
2725 .Ql \&\e*(xx
2726 where
2727 .Em xx
2728 is the name of the defined string or as
2729 .Ql \&\e*x
2730 where
2731 .Em x
2732 is the name of the string.
2733 The interpreting sequence may be used anywhere in the text.
2734 .Pp
2735 .Bl -column "String " "Nroff " "Troff " -offset indent
2736 .It Sy "String  Nroff   Troff"
2737 .It Li "<=" Ta \&<\&= Ta \*(<=
2738 .It Li ">=" Ta \&>\&= Ta \*(>=
2739 .It Li "Rq" Ta "''" Ta \*(Rq
2740 .It Li "Lq" Ta "``" Ta \*(Lq
2741 .It Li "ua" Ta ^ Ta \*(ua
2742 .It Li "aa" Ta ' Ta \*(aa
2743 .It Li "ga" Ta \` Ta \*(ga
2744 .\" .It Li "sL" Ta ` Ta \*(sL
2745 .\" .It Li "sR" Ta ' Ta \*(sR
2746 .It Li "q" Ta \&" Ta \*q
2747 .It Li "Pi" Ta pi Ta \*(Pi
2748 .It Li "Ne" Ta != Ta \*(Ne
2749 .It Li "Le" Ta <= Ta \*(Le
2750 .It Li "Ge" Ta >= Ta \*(Ge
2751 .It Li "Lt" Ta < Ta \*(Gt
2752 .It Li "Gt" Ta > Ta \*(Lt
2753 .It Li "Pm" Ta +- Ta \*(Pm
2754 .It Li "If" Ta infinity Ta \*(If
2755 .It Li "Na" Ta \fINaN\fP Ta \*(Na
2756 .It Li "Ba" Ta \fR\&|\fP Ta \*(Ba
2757 .El
2758 .Pp
2759 .Sy Note :
2760 The string named
2761 .Ql q
2762 should be written as
2763 .Ql \e*q
2764 since it is only one char.
2765 .Sh DIAGNOSTICS
2766 The debugging facilities for
2767 .Nm \-mdoc
2768 are limited, but can help detect subtle errors such
2769 as the collision of an argument name with an internal
2770 register or macro name.
2771 (A what?)
2772 A register is an arithmetic storage class for
2773 .Xr troff
2774 with a one or two character name.
2775 All registers internal to
2776 .Nm \-mdoc
2777 for
2778 .Xr troff
2779 and
2780 .Xr ditroff
2781 are two characters and
2782 of the form <upper_case><lower_case> such as
2783 .Ql \&Ar ,
2784 <lower_case><upper_case> as
2785 .Ql \&aR
2786 or
2787 <upper or lower letter><digit> as
2788 .Ql \&C\&1 .
2789 And adding to the muddle,
2790 .Xr troff
2791 has its own internal registers all of which are either
2792 two lower case characters or a dot plus a letter or meta-character
2793 character.
2794 In one of the introduction examples, it was shown how to
2795 prevent the interpretation of a macro name with the escape sequence
2796 .Ql \e& .
2797 This is sufficient for the internal register names also.
2798 .Pp
2799 .\" Every callable macro name has a corresponding register
2800 .\" of the same name (<upper_case><lower_case>).
2801 .\" There are also specific registers which have
2802 .\" been used for stacks and arrays and are listed in the
2803 .\" .Sx Appendix .
2804 .\" .Bd -ragged -offset 4n
2805 .\" [A-Z][a-z]  registers corresponding to macro names (example ``Ar'')
2806 .\" [a-z][A-Z]  registers corresponding to macro names (example ``aR'')
2807 .\" C[0-9]              argument types (example C1)
2808 .\" O[0-9]              offset stack (displays)
2809 .\" h[0-9]              horizontal spacing stack (lists)
2810 .\" o[0-9]              offset (stack) (lists)
2811 .\" t[0-9]              tag stack (lists)
2812 .\" v[0-9]              vertical spacing stack (lists)
2813 .\" w[0-9]              width tag/label stack
2814 .\" .Ed
2815 .\" .Pp
2816 If a non-escaped register name is given in the argument list of a request
2817 unpredictable behavior will occur.
2818 In general, any time huge portions
2819 of text do not appear where expected in the output, or small strings
2820 such as list tags disappear, chances are there is a misunderstanding
2821 about an argument type in the argument list.
2822 Your mother never intended for you to remember this evil stuff - so here
2823 is a way to find out whether or not your arguments are valid: The
2824 .Ql \&.Db
2825 (debug)
2826 macro displays the interpretation of the argument list for most
2827 macros.
2828 Macros such as the
2829 .Ql \&.Pp
2830 (paragraph)
2831 macro do not contain debugging information.
2832 All of the callable macros do,
2833 and it is strongly advised whenever in doubt,
2834 turn on the
2835 .Ql \&.Db
2836 macro.
2837 .Pp
2838 .Dl Usage: \&.Db [on | off]
2839 .Pp
2840 An example of a portion of text with
2841 the debug macro placed above and below an
2842 artificially created problem (a flag argument
2843 .Ql \&aC
2844 which should be
2845 .Ql \e&aC
2846 in order to work):
2847 .Bd -literal -offset indent
2848 \&.Db on
2849 \&.Op Fl aC Ar file )
2850 \&.Db off
2851 .Ed
2852 .Pp
2853 The resulting output:
2854 .Bd -literal -offset indent
2855 DEBUGGING ON
2856 DEBUG(argv) MACRO: `.Op'  Line #: 2
2857         Argc: 1  Argv: `Fl'  Length: 2
2858         Space: `'  Class: Executable
2859         Argc: 2  Argv: `aC'  Length: 2
2860         Space: `'  Class: Executable
2861         Argc: 3  Argv: `Ar'  Length: 2
2862         Space: `'  Class: Executable
2863         Argc: 4  Argv: `file'  Length: 4
2864         Space: ` '  Class: String
2865         Argc: 5  Argv: `)'  Length: 1
2866         Space: ` '  Class: Closing Punctuation or suffix
2867         MACRO REQUEST: .Op Fl aC Ar file )
2868 DEBUGGING OFF
2869 .Ed
2870 .Pp
2871 The first line of information tells the name of the calling
2872 macro, here
2873 .Ql \&.Op ,
2874 and the line number it appears on.
2875 If one or more files are involved
2876 (especially if text from another file is included) the line number
2877 may be bogus.
2878 If there is only one file, it should be accurate.
2879 The second line gives the argument count, the argument
2880 .Pq Ql \&Fl
2881 and its length.
2882 If the length of an argument is two characters, the
2883 argument is tested to see if it is executable (unfortunately, any
2884 register which contains a non-zero value appears executable).
2885 The third line gives the space allotted for a class, and the
2886 class type.
2887 The problem here is the argument aC should not be
2888 executable.
2889 The four types of classes are string, executable, closing
2890 punctuation and opening punctuation.
2891 The last line shows the entire
2892 argument list as it was read.
2893 In this next example, the offending
2894 .Ql \&aC
2895 is escaped:
2896 .Bd -literal -offset indent
2897 \&.Db on
2898 \&.Em An escaped \e&aC
2899 \&.Db off
2900 .Ed
2901 .Bd -literal -offset indent
2902 DEBUGGING ON
2903 DEBUG(fargv) MACRO: `.Em'  Line #: 2
2904         Argc: 1  Argv: `An'  Length: 2
2905         Space: ` '  Class: String
2906         Argc: 2  Argv: `escaped'  Length: 7
2907         Space: ` '  Class: String
2908         Argc: 3  Argv: `aC'  Length: 2
2909         Space: ` '  Class: String
2910         MACRO REQUEST: .Em An escaped &aC
2911 DEBUGGING OFF
2912 .Ed
2913 .Pp
2914 The argument
2915 .Ql \e&aC
2916 shows up with the same length of 2 as the
2917 .Ql \e&
2918 sequence produces a zero width, but a register
2919 named
2920 .Ql \e&aC
2921 was not found and the type classified as string.
2922 .Pp
2923 Other diagnostics consist of usage statements and are self explanatory.
2924 .Sh GROFF, TROFF AND NROFF
2925 The
2926 .Nm \-mdoc
2927 package does not need compatibility mode with
2928 .Xr groff .
2929 .Pp
2930 The package inhibits page breaks, and the headers and footers
2931 which normally occur at those breaks with
2932 .Xr nroff ,
2933 to make the manual more efficient for viewing on-line.
2934 At the moment,
2935 .Xr groff
2936 with
2937 .Fl T Ns Ar ascii
2938 does eject the imaginary remainder of the page at end of file.
2939 The inhibiting of the page breaks makes
2940 .Xr nroff Ns 'd
2941 files unsuitable for hardcopy.
2942 There is a register named
2943 .Ql \&cR
2944 which can be set to zero in the site dependent style file
2945 .Pa /usr/src/share/tmac/doc-nroff
2946 to restore the old style behavior.
2947 .Sh FILES
2948 .Bl -tag -width /usr/share/man0/template.doc -compact
2949 .It Pa /usr/share/tmac/tmac.doc
2950 manual macro package
2951 .It Pa /usr/share/misc/mdoc.template
2952 template for writing a man page
2953 .It Pa /usr/share/examples/mdoc/*
2954 several example man pages
2955 .El
2956 .Sh SEE ALSO
2957 .Xr man 1 ,
2958 .Xr troff 1 ,
2959 .Xr mdoc 7
2960 .Sh BUGS
2961 Undesirable hyphenation on the dash of a flag
2962 argument is not yet resolved, and causes
2963 occasional mishaps in the
2964 .Sx DESCRIPTION
2965 section.
2966 (line break on the hyphen).
2967 .Pp
2968 Predefined strings are not declared in documentation.
2969 .Pp
2970 Section 3f has not been added to the header routines.
2971 .Pp
2972 .Ql \&.Nm
2973 font should be changed in
2974 .Sx NAME
2975 section.
2976 .Pp
2977 .Ql \&.Fn
2978 needs to have a check to prevent splitting up
2979 if the line length is too short.
2980 Occasionally it
2981 separates the last parenthesis, and sometimes
2982 looks ridiculous if a line is in fill mode.
2983 .Pp
2984 The method used to prevent header and footer page
2985 breaks (other than the initial header and footer) when using
2986 nroff occasionally places an unsightly partially filled line (blank)
2987 at the would be bottom of the page.
2988 .Pp
2989 The list and display macros to not do any keeps
2990 and certainly should be able to.
2991 .\" Note what happens if the parameter list overlaps a newline
2992 .\" boundary.
2993 .\" to make sure a line boundary is crossed:
2994 .\" .Bd -literal
2995 .\" \&.Fn struct\e\ dictionarytable\e\ *dictionarylookup struct\e\ dictionarytable\e\ *tab[]
2996 .\" .Ed
2997 .\" .Pp
2998 .\" produces, nudge nudge,
2999 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
3000 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
3001 .\" nudge
3002 .\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] .
3003 .\" .Pp
3004 .\" If double quotes are used, for example:
3005 .\" .Bd -literal
3006 .\" \&.Fn \*qstruct dictionarytable *dictionarylookup\*q \*qchar *h\*q \*qstruct dictionarytable *tab[]\*q
3007 .\" .Ed
3008 .\" .Pp
3009 .\" produces, nudge nudge,
3010 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
3011 .\" nudge
3012 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
3013 .\" nudge
3014 .\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" .
3015 .\" .Pp
3016 .\" Not a pretty sight...
3017 .\" In a paragraph, a long parameter containing unpaddable spaces as
3018 .\" in the former example will cause
3019 .\" .Xr troff
3020 .\" to break the line and spread
3021 .\" the remaining words out.
3022 .\" The latter example will adjust nicely to
3023 .\" justified margins, but may break in between an argument and its
3024 .\" declaration.
3025 .\" In
3026 .\" .Xr nroff
3027 .\" the right margin adjustment is normally ragged and the problem is
3028 .\" not as severe.