xref: /original-bsd/share/man/man7/mdoc.7 (revision 3705696b)
1.\" Copyright (c) 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.roff%
5.\"
6.\"	@(#)mdoc.7	8.1 (Berkeley) 06/09/93
7.\"
8.Dd
9.Os
10.Dt MDOC 7
11.Sh NAME
12.Nm mdoc
13.Nd quick reference guide for the
14.Nm \-mdoc
15macro package
16.Sh SYNOPSIS
17.Nm groff
18.Fl m Ns Ar doc
19.Ar files ...
20.Sh DESCRIPTION
21The
22.Nm \-mdoc
23package is a set of content-based and domain-based macros
24used to format the
25.Bx
26man pages.
27The macro names and their meanings are
28listed below for quick reference; for
29a detailed explanation on using the package,
30see the tutorial sampler
31.Xr mdoc.samples 7 .
32.Pp
33The macros are described in two groups, the first
34includes the structural and physical page layout macros.
35The second contains the manual and general text domain
36macros which differentiate the
37.Nm -\mdoc
38package from other
39.Xr troff
40formatting packages.
41.Sh PAGE STRUCTURE DOMAIN
42.Ss Title Macros
43To create a valid manual page, these three macros, in this order,
44are required:
45.Bl -tag -width "xxxx.Os OPERATINGxSYSTEM [version/release]" -compact
46.It Li "\&.Dd  " Ar "Month day, year"
47Document date.
48.It Li "\&.Dt  " Ar "DOCUMENT_TITLE [section] [volume]"
49Title, in upper case.
50.It Li "\&.Os  " Ar "OPERATING_SYSTEM [version/release]"
51Operating system
52.Pq Tn BSD .
53.El
54.Ss Page Layout Macros
55Section headers, paragraph breaks, lists and displays.
56.Bl -tag -width flag -compact
57.It Li \&.Sh
58Section Headers.
59Valid headers, in the order of presentation:
60.Bl -tag -width "RETURN VALUES" -compact
61.It Ar NAME
62Name section, should include the
63.Ql \&.Nm
64or
65.Ql \&.Fn
66and the
67.Ql \&.Nd
68macros.
69.It Ar SYNOPSIS
70Usage.
71.It Ar DESCRIPTION
72General description, should include
73options and parameters.
74.It Ar RETURN VALUES
75Sections two and three function calls.
76.It Ar ENVIRONMENT
77Describe environment variables.
78.It Ar FILES
79Files associated with the subject.
80.It Ar EXAMPLES
81Examples and suggestions.
82.It Ar DIAGNOSTICS
83Normally used for section four device interface diagnostics.
84.It Ar ERRORS
85Sections two and three error and signal
86handling.
87.It Ar SEE ALSO
88Cross references and citations.
89.It Ar STANDARDS
90Conformance to standards if applicable.
91.It Ar HISTORY
92If a standard is not applicable, the history
93of the subject should be given.
94.It Ar BUGS
95Gotchas and caveats.
96.It Ar other
97Customized headers may be added at
98the authors discretion.
99.El
100.It Li \&.Ss
101Subsection Headers.
102.It Li \&.Pp
103Paragraph Break.
104Vertical space (one line).
105.It Li \&.D1
106(D-one) Display-one
107Indent and display one text line.
108.It Li \&.Dl
109(D-ell) Display-one literal.
110Indent and display one line of literal text.
111.It Li \&.Bd
112Begin-display block.
113Display options:
114.Bl -tag -width "xoffset string " -compact
115.It Fl ragged
116Unjustified (ragged edges).
117.It Fl filled
118Justified.
119.It Fl literal
120Literal text or code.
121.It Fl file Ar name
122Read in named
123.Ar file
124and display.
125.It Fl offset Ar string
126Offset display.
127Acceptable
128.Ar string
129values:
130.Bl -tag -width indent-two -compact
131.It Ar left
132Align block on left (default).
133.It Ar center
134Approximate center margin.
135.It Ar indent
136Six constant width spaces (a tab).
137.It Ar indent-two
138Two tabs.
139.It Ar right
140Left aligns block 2 inches from
141right.
142.It Ar xx Ns Cm n
143Where
144.Ar xx
145is a number from
146.No \&4 Ns Cm n
147to
148.No \&9\&9 Ns Cm n .
149.It Ar Aa
150Where
151.Ar Aa
152is a callable macro name.
153.It Ar string
154The width of
155.Ar string
156is used.
157.El
158.El
159.It Li \&.Ed
160End-display (matches \&.Bd).
161.It Li \&.Bl
162Begin-list.
163Create lists or columns. Options:
164.Bl -tag -width flag -compact
165.It Ar List-types
166.Bl -column xbullet -compact
167.It Fl bullet Ta "Bullet Item List"
168.It Fl item Ta "Unlabeled List"
169.It Fl enum Ta "Enumerated List"
170.It Fl tag Ta "Tag Labeled List"
171.It Fl diag Ta "Diagnostic List"
172.It Fl hang Ta "Hanging Labeled List"
173.It Fl ohang Ta "Overhanging Labeled List"
174.It Fl inset Ta "Inset or Run-on Labeled List"
175.El
176.It List-parameters
177.Bl -tag -width "xcompact " -compact
178.It Fl offset
179(All lists.) See
180.Ql \&.Bd
181begin-display above.
182.It Fl width
183.Pf ( Fl tag
184and
185.Fl hang
186lists only.)
187See
188.Ql \&.Bd .
189.It Fl compact
190(All lists.)
191Suppresses blank lines.
192.El
193.El
194.It Li \&.El
195End-list.
196.It Li \&.It
197List item.
198.El
199.Sh MANUAL AND GENERAL TEXT DOMAIN MACROS
200The manual and general text domain macros are special in that
201most of them are parsed for callable macros
202for example:
203.Bl -tag -width ".Op Fl s Ar filex" -offset indent
204.It Li "\&.Op Fl s Ar file"
205Produces
206.Op Fl s Ar file
207.El
208.Pp
209In this example, the option enclosure macro
210.Ql \&.Op
211is parsed, and calls the callable content macro
212.Ql \&Fl
213which operates on the argument
214.Ql s
215and then calls the callable content macro
216.Ql \&Ar
217which operates on the argument
218.Ql file .
219Some macros may be callable, but are not parsed and vice versa.
220These macros are indicated in the
221.Em parsed
222and
223.Em callable
224columns below.
225.Pp
226Unless stated, manual domain macros share a common syntax:
227.Pp
228.Dl \&.Va argument [\ .\ ,\ ;\ :\ (\ )\ [\ ]\ argument \...\ ]
229.Pp
230.Sy Note :
231Opening and closing
232punctuation characters are only recognized as such if they are presented
233one at a time.
234The string
235.Ql "),"
236is not recognized as punctuation and will be output with a leading white
237space and in what ever font the calling macro uses.
238The
239the argument list
240.Ql "] ) ,"
241is recognized as three sequential closing punctuation characters
242and a leading white space is not output between the characters
243and the previous argument (if any).
244The special meaning of a punctuation character may be escaped
245with the string
246.Ql \e& .
247For example the following string,
248.Bl -tag -width "&.Ar file1\ , file2\ , file3\ )\ ." -offset indent
249.It Li "\&.Ar file1\ , file2\ , file3\ )\ ."
250Produces
251.Ar file1 , file2 , file3 ) .
252.El
253.ne 1i
254.Ss Manual Domain Macros
255.Bl -column "Name" "Parsed" Callable" -compact
256.It Em Name	Parsed	Callable	Description
257.It Li \&Ad Ta Yes Ta Yes Ta Address. "(This macro may be deprecated.)"
258.It Li \&Ar Ta Yes Ta Yes Ta "Command line argument."
259.It Li \&Cd Ta \&No Ta \&No Ta "Configuration declaration (section four only)."
260.It Li \&Cm Ta Yes Ta Yes Ta "Command line argument modifier."
261.It Li \&Dv Ta Yes Ta Yes Ta "Defined variable (source code)."
262.It Li \&Er Ta Yes Ta Yes Ta "Error number (source code)."
263.It Li \&Ev Ta Yes Ta Yes Ta "Environment variable."
264.It Li \&Fa Ta Yes Ta Yes Ta "Function argument."
265.It Li \&Fd Ta Yes Ta Yes Ta "Function declaration."
266.It Li \&Fn Ta Yes Ta Yes Ta "Function call (also .Fo and .Fc)."
267.It Li \&Ic Ta Yes Ta Yes Ta "Interactive command."
268.It Li \&Li Ta Yes Ta Yes Ta "Literal text."
269.It Li \&Nm Ta Yes Ta Yes Ta "Command name."
270.It Li \&Op Ta Yes Ta Yes Ta "Option (also .Oo and .Oc)."
271.It Li \&Ot Ta Yes Ta Yes Ta "Old style function type (Fortran only)."
272.It Li \&Pa Ta Yes Ta Yes Ta "Pathname or file name."
273.It Li \&St Ta Yes Ta Yes Ta "Standards (-p1003.2, -p1003.1 or -ansiC)"
274.It Li \&Va Ta Yes Ta Yes Ta "Variable name."
275.It Li \&Vt Ta Yes Ta Yes Ta "Variable type (Fortran only)."
276.It Li \&Xr Ta Yes Ta Yes Ta "Manual Page Cross Reference."
277.El
278.Ss General Text Domain Macros
279.Bl -column "Name" "Parsed" Callable" -compact
280.It Em "Name	Parsed	Callable	Description"
281.It Li \&%A Ta Yes Ta \&No Ta "Reference author."
282.It Li \&%B Ta Yes Ta Yes Ta "Reference book title."
283.It Li \&%\&C Ta \&No Ta \&No Ta "Reference place of publishing (city)."
284.It Li \&%\&D Ta \&No Ta \&No Ta "Reference date."
285.It Li \&%J Ta Yes Ta Yes Ta "Reference journal title."
286.It Li \&%N Ta \&No Ta \&No Ta "Reference issue number."
287.It Li \&%\&O Ta \&No Ta \&No Ta "Reference optional information."
288.It Li \&%P Ta \&No Ta \&No Ta "Reference page number(s)."
289.It Li \&%R Ta \&No Ta \&No Ta "Reference report Name."
290.It Li \&%T Ta Yes Ta Yes Ta "Reference article title."
291.It Li \&%V Ta \&No Ta \&No Ta "Reference volume."
292.It Li \&Ac Ta Yes Ta Yes Ta "Angle close quote."
293.It Li \&Ao Ta Yes Ta Yes Ta "Angle open quote."
294.It Li \&Aq Ta Yes Ta Yes Ta "Angle quote."
295.It Li \&At Ta \&No Ta \&No Ta Tn "AT&T UNIX"
296.It Li \&Bc Ta Yes Ta Yes Ta "Bracket close quote."
297.It Li \&Bf Ta \&No Ta \&No Ta "Begin font mode."
298.It Li \&Bo Ta Yes Ta Yes Ta "Bracket open quote."
299.It Li \&Bq Ta Yes Ta Yes Ta "Bracket quote."
300.It Li \&Bx Ta Yes Ta Yes Ta Bx .
301.It Li \&Db Ta \&No Ta \&No Ta "Debug (default is \\*qoff\\*q)"
302.It Li \&Dc Ta Yes Ta Yes Ta "Double close quote."
303.It Li \&Do Ta Yes Ta Yes Ta "Double open quote."
304.It Li \&Dq Ta Yes Ta Yes Ta "Double quote."
305.It Li \&Ec Ta Yes Ta Yes Ta "Enclose string close quote."
306.It Li \&Ef Ta \&No Ta \&No Ta "End font mode."
307.It Li \&Em Ta Yes Ta Yes Ta "Emphasis (traditional English)."
308.It Li \&Eo Ta Yes Ta Yes Ta "Enclose string open quote."
309.It Li \&No Ta Yes Ta Yes Ta "Normal text (no-op)."
310.It Li \&Ns Ta Yes Ta Yes Ta "No space."
311.It Li \&Pc Ta Yes Ta Yes Ta "Parenthesis close quote."
312.It Li \&Pf Ta Yes Ta \&No Ta "Prefix string."
313.It Li \&Po Ta Yes Ta Yes Ta "Parenthesis open quote."
314.It Li \&Pq Ta Yes Ta Yes Ta "Parentheses quote."
315.It Li \&Qc Ta Yes Ta Yes Ta "Strait Double close quote."
316.It Li \&Ql Ta Yes Ta Yes Ta "Quoted literal."
317.It Li \&Qo Ta Yes Ta Yes Ta "Strait Double open quote."
318.It Li \&Qq Ta Yes Ta Yes Ta "Strait Double quote."
319.It Li \&Re Ta \&No Ta \&No Ta "Reference start."
320.It Li \&Rs Ta \&No Ta \&No Ta "Reference start."
321.It Li \&Sc Ta Yes Ta Yes Ta "Single close quote."
322.It Li \&So Ta Yes Ta Yes Ta "Single open quote."
323.It Li \&Sq Ta Yes Ta Yes Ta "Single quote."
324.It Li \&Sm Ta \&No Ta \&No Ta "Space mode (default is \\*qon\\*q)"
325.It Li \&Sx Ta Yes Ta Yes Ta "Section Cross Reference."
326.It Li \&Sy Ta Yes Ta Yes Ta "Symbolic (traditional English)."
327.It Li \&Tn Ta Yes Ta Yes Ta "Trade or type name (small Caps)."
328.It Li \&Ux Ta Yes Ta Yes Ta Ux
329.It Li \&Xc Ta Yes Ta Yes Ta "Extend argument list close."
330.It Li \&Xo Ta Yes Ta Yes Ta "Extend argument list close."
331.El
332.\" .It Sy \&Hf Ta \&No Ta \&No Ta "Include file with header"
333.Pp
334Macro names ending in
335.Ql q
336quote remaining items on the argument list.
337Macro names ending in
338.Ql o
339begin a quote which may span more than one line of input and
340are close quoted with the matching macro name ending in
341.Ql c .
342Enclosure macros may be nested and are limited to
343eight arguments.
344.Pp
345Note: the extended argument list macros
346.Pf ( Ql \&.Xo ,
347.Ql \&.Xc )
348and the function enclosure macros
349.Pf ( Ql \&.Fo ,
350.Ql \&.Fc )
351are irregular.
352The extended list macros are used when the number of macro arguments
353would exceed the
354.Xr troff
355limitation of nine arguments.
356.Sh CONFIGURATION
357For site specific configuration of the macro package,
358see the file
359.Pa /usr/src/share/tmac/README .
360.Sh FILES
361.Bl -tag -width "tmac.doc-ditroff" -compact
362.It Pa tmac.doc
363Manual and general text domain macros.
364.It Pa tmac.doc-common
365Common structural macros and definitions.
366.It Pa tmac.doc-nroff
367Site dependent
368.Xr nroff
369style file.
370.It Pa tmac.doc-ditroff
371Site dependent
372.Xr troff
373style file.
374.It Pa tmac.doc-syms
375Special defines (such as the standards macro).
376.El
377.Sh SEE ALSO
378.Xr mdoc.samples 7
379