xref: /openbsd-src/share/man/man7/mdoc.7 (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1.\"	$OpenBSD: mdoc.7,v 1.21 2001/08/02 18:00:10 millert Exp $
2.\"
3.\" Copyright (c) 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"	@(#)mdoc.7	8.2 (Berkeley) 12/30/93
35.\"
36.Dd December 30, 1993
37.Dt MDOC 7
38.Os
39.Sh NAME
40.Nm mdoc
41.Nd quick reference guide for the
42.Nm \-mdoc
43macro package
44.Sh SYNOPSIS
45.Nm groff
46.Fl m Ns Ar doc
47.Ar files ...
48.Sh DESCRIPTION
49The
50.Nm \-mdoc
51package is a set of content-based and domain-based macros
52used to format the
53.Bx
54man pages.
55The macro names and their meanings are
56listed below for quick reference; for
57a detailed explanation on using the package,
58see the tutorial sampler
59.Xr mdoc.samples 7 .
60.Pp
61The macros are described in two groups.
62The first includes the structural and physical page layout macros.
63The second contains the manual and general text domain
64macros which differentiate the
65.Nm -\mdoc
66package from other
67.Xr troff
68formatting packages.
69.Sh PAGE STRUCTURE DOMAIN
70.Ss Title Macros
71To create a valid manual page, these three macros, in this order,
72are required:
73.Bl -tag -width "xxxx.Os OPERATINGxSYSTEM [version/release]" -compact
74.It Li "\&.Dd  " Ar "Month day, year"
75Document date.
76.It Li "\&.Dt  " Ar "DOCUMENT_TITLE [section] [volume]"
77Title, in upper case.
78.It Li "\&.Os  " Ar "OPERATING_SYSTEM [version/release]"
79Operating system
80.Pq Tn BSD .
81.El
82.Ss Page Layout Macros
83Section headers, paragraph breaks, lists and displays.
84.Bl -tag -width flag -compact
85.It Li \&.Sh
86Section Headers.
87Valid headers, in the order of presentation:
88.Bl -tag -width "RETURN VALUES" -compact
89.It Ar NAME
90Name section. Should include the
91.Ql \&.Nm
92or
93.Ql \&.Fn
94and the
95.Ql \&.Nd
96macros.
97.It Ar SYNOPSIS
98Usage.
99All
100.Ql \&.Nm
101macros must be given an argument.
102.It Ar DESCRIPTION
103General description, including any options, operands, or other parameters.
104.It Ar EXAMPLES
105Examples and suggestions.
106.It Ar RETURN VALUES
107Sections two and three function calls.
108.It Ar ERRORS
109Sections two and three error and signal handling.
110.It Ar DIAGNOSTICS
111Section four device interface diagnostics.
112.It Ar ENVIRONMENT
113Describe environment variables.
114.It Ar FILES
115Files associated with the subject, with short descriptions.
116.It Ar SEE ALSO
117Cross references and citations.
118.It Ar COMPATIBILITY
119Compatibility issues, i.e., deprecated options or parameters.
120.It Ar STANDARDS
121Conformance to standards if applicable.
122.It Ar AUTHORS
123Credit to the person or persons who wrote the code and/or documentation.
124.It Ar HISTORY
125A brief history of the subject, including where support first appeared.
126.It Ar BUGS
127Gotchas and caveats.
128.It Ar CAVEATS
129Explanations of common misuses, i.e., security considerations for certain
130library functions.
131.It Ar other
132Customized headers may be added at the author's discretion.
133.El
134.It Li \&.Ss
135Subsection Headers.
136.It Li \&.Pp
137Paragraph Break.
138Vertical space (one line).
139.It Li \&.D1
140(D-one) Display-one
141Indent and display one text line.
142.It Li \&.Dl
143(D-ell) Display-one literal.
144Indent and display one line of literal text.
145.It Li \&.Bd
146Begin-display block.
147Display options:
148.Bl -tag -width "xoffset string " -compact
149.It Fl ragged
150Unjustified (ragged edges).
151.It Fl unfilled
152Unfilled, unjustified.
153.It Fl filled
154Filled, and if
155.Xr troff 1 ,
156also justified.
157.It Fl literal
158Literal text or code.
159.It Fl file Ar name
160Read in named
161.Ar file
162and display.
163.It Fl offset Ar string
164Offset display.
165Acceptable
166.Ar string
167values:
168.Bl -tag -width indent-two -compact
169.It Ar left
170Align block on left (default).
171.It Ar center
172Approximate center margin.
173.It Ar indent
174Six constant width spaces (a tab).
175.It Ar indent-two
176Two tabs.
177.It Ar right
178Left aligns block 2 inches from
179right.
180.It Ar xx Ns Cm n
181Where
182.Ar xx
183is a number from
184.No \&4 Ns Cm n
185to
186.No \&9\&9 Ns Cm n .
187.It Ar Aa
188Where
189.Ar Aa
190is a callable macro name.
191.It Ar string
192The width of
193.Ar string
194is used.
195.El
196.El
197.It Li \&.Ed
198End-display (matches \&.Bd).
199.It Li \&.Bl
200Begin-list.
201Create lists or columns.
202Options:
203.Bl -tag -width flag -compact
204.It Em List-types
205.Bl -column "xbullet " -compact
206.It Fl bullet Ta "Bullet Item List"
207.It Fl dash Ta "Dash Item List"
208.It Fl hyphen Ta "(as per" Fl dash ")"
209.It Fl item Ta "Unlabeled List"
210.It Fl enum Ta "Enumerated List"
211.It Fl tag Ta "Tag Labeled List"
212.It Fl diag Ta "Diagnostic List"
213.It Fl hang Ta "Hanging Labeled List"
214.It Fl ohang Ta "Overhanging Labeled List"
215.It Fl inset Ta "Inset or Run-on Labeled List"
216.It Fl column Ta "Multiple Columns"
217.El
218.It Em List-parameters
219.Bl -tag -width "xcompact " -compact
220.It Fl offset
221(All lists.) See
222.Ql \&.Bd
223begin-display above.
224.It Fl width
225.Pf ( Fl tag
226and
227.Fl hang
228lists only.)
229This parameter is effectively required for
230.Fl tag
231lists.
232.It Fl compact
233(All lists.)
234Suppresses blank lines.
235.El
236.El
237.It Li \&.El
238End-list.
239.It Li \&.It
240List item.
241.El
242.Sh MANUAL AND GENERAL TEXT DOMAIN MACROS
243The manual and general text domain macros are special in that
244most of them are parsed for callable macros
245for example:
246.Bl -tag -width ".Op Fl s Ar filex" -offset indent
247.It Li "\&.Op Fl s Ar file"
248Produces
249.Op Fl s Ar file
250.El
251.Pp
252In this example, the option enclosure macro
253.Ql \&.Op
254is parsed, and calls the callable content macro
255.Ql \&Fl
256which operates on the argument
257.Ql s
258and then calls the callable content macro
259.Ql \&Ar
260which operates on the argument
261.Ql file .
262Some macros may be callable but are not parsed, or vice versa.
263These macros are indicated in the
264.Em parsed
265and
266.Em callable
267columns below.
268.Pp
269Unless stated, manual domain macros share a common syntax:
270.Pp
271.Dl \&.Va argument [\ .\ ,\ ;\ :\ (\ )\ [\ ]\ argument \...\ ]
272.Pp
273.Sy Note :
274Opening and closing
275punctuation characters are only recognized as such if they are presented
276one at a time.
277The string
278.Ql "),"
279is not recognized as punctuation and will be output with a leading whitespace
280and in whatever font the calling macro uses.
281The
282argument list
283.Ql "] ) ,"
284is recognized as three sequential closing punctuation characters
285and a leading white space is not output between the characters
286and the previous argument (if any).
287The special meaning of a punctuation character may be escaped
288with the string
289.Ql \e& .
290For example the following string,
291.Bl -tag -width "&.Ar file1\ , file2\ , file3\ )\ ." -offset indent
292.It Li "\&.Ar file1\ , file2\ , file3\ )\ ."
293Produces
294.Ar file1 , file2 , file3 ) .
295.El
296.Ss Manual Domain Macros
297.Bl -column "Name" "Parsed" "Callable" -compact
298.It Em Name	Parsed	Callable	Description
299.It Li \&Ad Ta Yes Ta Yes Ta Address. "(This macro may be deprecated.)"
300.It Li \&Ar Ta Yes Ta Yes Ta "Command line argument."
301.It Li \&Cd Ta \&No Ta \&No Ta "Configuration declaration (section four only)."
302.It Li \&Cm Ta Yes Ta Yes Ta "Command line argument modifier."
303.It Li \&Dv Ta Yes Ta Yes Ta "Defined variable (source code)."
304.It Li \&Er Ta Yes Ta Yes Ta "Error number (source code)."
305.It Li \&Ev Ta Yes Ta Yes Ta "Environment variable."
306.It Li \&Fa Ta Yes Ta Yes Ta "Function argument."
307.It Li \&Fd Ta \&No Ta \&No Ta "Function declaration."
308.It Li \&Ft Ta Yes Ta Yes Ta "Function type."
309.It Li \&Fn Ta Yes Ta Yes Ta "Function call (also .Fo and .Fc)."
310.It Li \&Ic Ta Yes Ta Yes Ta "Interactive command."
311.It Li \&Li Ta Yes Ta Yes Ta "Literal text."
312.It Li \&Nd Ta \&No Ta \&No Ta "Command description."
313.It Li \&Nm Ta Yes Ta Yes Ta "Command name."
314.It Li \&Op Ta Yes Ta Yes Ta "Option (also .Oo and .Oc)."
315.It Li \&Ot Ta Yes Ta Yes Ta "Old style function type (Fortran only)."
316.It Li \&Pa Ta Yes Ta Yes Ta "Pathname or file name."
317.It Li \&St Ta Yes Ta Yes Ta "Standards (-p1003.2, -p1003.1 or -ansiC)."
318.It Li \&Va Ta Yes Ta Yes Ta "Variable name."
319.It Li \&Vt Ta Yes Ta Yes Ta "Variable type (Fortran only)."
320.It Li \&Xr Ta Yes Ta Yes Ta "Manual Page Cross Reference."
321.El
322.Ss General Text Domain Macros
323.Bl -column "Name" "Parsed" "Callable" -compact
324.It Em "Name	Parsed	Callable	Description"
325.It Li \&%A Ta Yes Ta \&No Ta "Reference author."
326.It Li \&%B Ta Yes Ta Yes Ta "Reference book title."
327.It Li \&%\&C Ta \&No Ta \&No Ta "Reference place of publishing (city)."
328.It Li \&%\&D Ta \&No Ta \&No Ta "Reference date."
329.It Li \&%J Ta Yes Ta Yes Ta "Reference journal title."
330.It Li \&%N Ta \&No Ta \&No Ta "Reference issue number."
331.It Li \&%\&O Ta \&No Ta \&No Ta "Reference optional information."
332.It Li \&%P Ta \&No Ta \&No Ta "Reference page number(s)."
333.It Li \&%R Ta \&No Ta \&No Ta "Reference report Name."
334.It Li \&%T Ta Yes Ta Yes Ta "Reference article title."
335.It Li \&%V Ta \&No Ta \&No Ta "Reference volume."
336.It Li \&Ac Ta Yes Ta Yes Ta "Angle close quote."
337.It Li \&Ao Ta Yes Ta Yes Ta "Angle open quote."
338.It Li \&Aq Ta Yes Ta Yes Ta "Angle quote."
339.It Li \&At Ta \&No Ta \&No Ta Tn "AT&T UNIX."
340.It Li \&Bc Ta Yes Ta Yes Ta "Bracket close quote."
341.It Li \&Bf Ta \&No Ta \&No Ta "Begin font mode."
342.It Li \&Bo Ta Yes Ta Yes Ta "Bracket open quote."
343.It Li \&Bq Ta Yes Ta Yes Ta "Bracket quote."
344.It Li \&Bsx Ta Yes Ta Yes Ta "BSDI BSD/OS."
345.It Li \&Bx Ta Yes Ta Yes Ta BSD .
346.It Li \&Db Ta \&No Ta \&No Ta "Debug (default is \\*qoff\\*q)."
347.It Li \&Dc Ta Yes Ta Yes Ta "Double close quote."
348.It Li \&Do Ta Yes Ta Yes Ta "Double open quote."
349.It Li \&Dq Ta Yes Ta Yes Ta "Double quote."
350.It Li \&Ec Ta Yes Ta Yes Ta "Enclose string close quote."
351.It Li \&Ef Ta \&No Ta \&No Ta "End font mode."
352.It Li \&Em Ta Yes Ta Yes Ta "Emphasis (traditional English)."
353.It Li \&Eo Ta Yes Ta Yes Ta "Enclose string open quote."
354.It Li \&Fx Ta Yes Ta Yes Ta FreeBSD .
355.It Li \&No Ta Yes Ta Yes Ta "Normal text (no-op)."
356.It Li \&Ns Ta Yes Ta Yes Ta "No space."
357.It Li \&Nx Ta Yes Ta Yes Ta NetBSD .
358.It Li \&Ox Ta Yes Ta Yes Ta OpenBSD .
359.It Li \&Pc Ta Yes Ta Yes Ta "Parenthesis close quote."
360.It Li \&Pf Ta Yes Ta \&No Ta "Prefix string."
361.It Li \&Po Ta Yes Ta Yes Ta "Parenthesis open quote."
362.It Li \&Pq Ta Yes Ta Yes Ta "Parentheses quote."
363.It Li \&Qc Ta Yes Ta Yes Ta "Straight double close quote."
364.It Li \&Ql Ta Yes Ta Yes Ta "Quoted literal."
365.It Li \&Qo Ta Yes Ta Yes Ta "Straight double open quote."
366.It Li \&Qq Ta Yes Ta Yes Ta "Straight double quote."
367.It Li \&Re Ta \&No Ta \&No Ta "Reference end."
368.It Li \&Rs Ta \&No Ta \&No Ta "Reference start."
369.It Li \&Sc Ta Yes Ta Yes Ta "Single close quote."
370.It Li \&So Ta Yes Ta Yes Ta "Single open quote."
371.It Li \&Sq Ta Yes Ta Yes Ta "Single quote."
372.It Li \&Sm Ta \&No Ta \&No Ta "Space mode (default is \\*qon\\*q)."
373.It Li \&Sx Ta Yes Ta Yes Ta "Section Cross Reference."
374.It Li \&Sy Ta Yes Ta Yes Ta "Symbolic (traditional English)."
375.It Li \&Tn Ta Yes Ta Yes Ta "Trade or type name (small Caps)."
376.It Li \&Ux Ta Yes Ta Yes Ta UNIX .
377.It Li \&Xc Ta Yes Ta Yes Ta "Extend argument list close."
378.It Li \&Xo Ta Yes Ta Yes Ta "Extend argument list open."
379.El
380.\" .It Sy \&Hf Ta \&No Ta \&No Ta "Include file with header"
381.Pp
382Macro names ending in
383.Ql q
384quote remaining items on the argument list.
385Macro names ending in
386.Ql o
387begin a quote which may span more than one line of input and
388are close quoted with the matching macro name ending in
389.Ql c .
390Enclosure macros may be nested and are limited to
391eight arguments.
392.Pp
393Note: the extended argument list macros
394.Pf ( Ql \&.Xo ,
395.Ql \&.Xc )
396and the function enclosure macros
397.Pf ( Ql \&.Fo ,
398.Ql \&.Fc )
399are irregular.
400The extended list macros are used when the number of macro arguments
401would exceed the
402.Xr troff
403limitation of nine arguments.
404.Sh FILES
405.Bl -tag -width "tmac.doc-ditroff" -compact
406.It Pa tmac.doc
407manual and general text domain macros
408.It Pa tmac.doc-common
409common structural macros and definitions
410.It Pa tmac.doc-nroff
411site dependent
412.Xr nroff
413style file
414.It Pa tmac.doc-ditroff
415site dependent
416.Xr troff
417style file
418.It Pa tmac.doc-syms
419special defines (such as the standards macro)
420.El
421.Sh SEE ALSO
422.Xr mdoc.samples 7
423