xref: /original-bsd/share/man/man7/mdoc.7 (revision deff14a8)
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.3 (Berkeley) 06/01/94
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.ne 1i
126.It Fl offset Ar string
127Offset display.
128Acceptable
129.Ar string
130values:
131.Bl -tag -width indent-two -compact
132.It Ar left
133Align block on left (default).
134.It Ar center
135Approximate center margin.
136.It Ar indent
137Six constant width spaces (a tab).
138.It Ar indent-two
139Two tabs.
140.It Ar right
141Left aligns block 2 inches from
142right.
143.It Ar xx Ns Cm n
144Where
145.Ar xx
146is a number from
147.No \&4 Ns Cm n
148to
149.No \&9\&9 Ns Cm n .
150.It Ar Aa
151Where
152.Ar Aa
153is a callable macro name.
154.It Ar string
155The width of
156.Ar string
157is used.
158.El
159.El
160.It Li \&.Ed
161End-display (matches \&.Bd).
162.It Li \&.Bl
163Begin-list.
164Create lists or columns. Options:
165.Bl -tag -width flag -compact
166.It Ar List-types
167.Bl -column xbullet -compact
168.It Fl bullet Ta "Bullet Item List"
169.It Fl item Ta "Unlabeled List"
170.It Fl enum Ta "Enumerated List"
171.It Fl tag Ta "Tag Labeled List"
172.It Fl diag Ta "Diagnostic List"
173.It Fl hang Ta "Hanging Labeled List"
174.It Fl ohang Ta "Overhanging Labeled List"
175.It Fl inset Ta "Inset or Run-on Labeled List"
176.El
177.It List-parameters
178.Bl -tag -width "xcompact " -compact
179.It Fl offset
180(All lists.) See
181.Ql \&.Bd
182begin-display above.
183.It Fl width
184.Pf ( Fl tag
185and
186.Fl hang
187lists only.)
188See
189.Ql \&.Bd .
190.It Fl compact
191(All lists.)
192Suppresses blank lines.
193.El
194.El
195.It Li \&.El
196End-list.
197.It Li \&.It
198List item.
199.El
200.Sh MANUAL AND GENERAL TEXT DOMAIN MACROS
201The manual and general text domain macros are special in that
202most of them are parsed for callable macros
203for example:
204.Bl -tag -width ".Op Fl s Ar filex" -offset indent
205.It Li "\&.Op Fl s Ar file"
206Produces
207.Op Fl s Ar file
208.El
209.Pp
210In this example, the option enclosure macro
211.Ql \&.Op
212is parsed, and calls the callable content macro
213.Ql \&Fl
214which operates on the argument
215.Ql s
216and then calls the callable content macro
217.Ql \&Ar
218which operates on the argument
219.Ql file .
220Some macros may be callable, but are not parsed and vice versa.
221These macros are indicated in the
222.Em parsed
223and
224.Em callable
225columns below.
226.Pp
227Unless stated, manual domain macros share a common syntax:
228.Pp
229.Dl \&.Va argument [\ .\ ,\ ;\ :\ (\ )\ [\ ]\ argument \...\ ]
230.Pp
231.Sy Note :
232Opening and closing
233punctuation characters are only recognized as such if they are presented
234one at a time.
235The string
236.Ql "),"
237is not recognized as punctuation and will be output with a leading white
238space and in what ever font the calling macro uses.
239The
240argument list
241.Ql "] ) ,"
242is recognized as three sequential closing punctuation characters
243and a leading white space is not output between the characters
244and the previous argument (if any).
245The special meaning of a punctuation character may be escaped
246with the string
247.Ql \e& .
248For example the following string,
249.Bl -tag -width "&.Ar file1\ , file2\ , file3\ )\ ." -offset indent
250.It Li "\&.Ar file1\ , file2\ , file3\ )\ ."
251Produces
252.Ar file1 , file2 , file3 ) .
253.El
254.ne 1i
255.Ss Manual Domain Macros
256.Bl -column "Name" "Parsed" Callable" -compact
257.It Em Name	Parsed	Callable	Description
258.It Li \&Ad Ta Yes Ta Yes Ta Address. "(This macro may be deprecated.)"
259.It Li \&Ar Ta Yes Ta Yes Ta "Command line argument."
260.It Li \&Cd Ta \&No Ta \&No Ta "Configuration declaration (section four only)."
261.It Li \&Cm Ta Yes Ta Yes Ta "Command line argument modifier."
262.It Li \&Dv Ta Yes Ta Yes Ta "Defined variable (source code)."
263.It Li \&Er Ta Yes Ta Yes Ta "Error number (source code)."
264.It Li \&Ev Ta Yes Ta Yes Ta "Environment variable."
265.It Li \&Fa Ta Yes Ta Yes Ta "Function argument."
266.It Li \&Fd Ta Yes Ta Yes Ta "Function declaration."
267.It Li \&Fn Ta Yes Ta Yes Ta "Function call (also .Fo and .Fc)."
268.It Li \&Ic Ta Yes Ta Yes Ta "Interactive command."
269.It Li \&Li Ta Yes Ta Yes Ta "Literal text."
270.It Li \&Nm Ta Yes Ta Yes Ta "Command name."
271.It Li \&Op Ta Yes Ta Yes Ta "Option (also .Oo and .Oc)."
272.It Li \&Ot Ta Yes Ta Yes Ta "Old style function type (Fortran only)."
273.It Li \&Pa Ta Yes Ta Yes Ta "Pathname or file name."
274.It Li \&St Ta Yes Ta Yes Ta "Standards (-p1003.2, -p1003.1 or -ansiC)"
275.It Li \&Va Ta Yes Ta Yes Ta "Variable name."
276.It Li \&Vt Ta Yes Ta Yes Ta "Variable type (Fortran only)."
277.It Li \&Xr Ta Yes Ta Yes Ta "Manual Page Cross Reference."
278.El
279.Ss General Text Domain Macros
280.Bl -column "Name" "Parsed" Callable" -compact
281.It Em "Name	Parsed	Callable	Description"
282.It Li \&%A Ta Yes Ta \&No Ta "Reference author."
283.It Li \&%B Ta Yes Ta Yes Ta "Reference book title."
284.It Li \&%\&C Ta \&No Ta \&No Ta "Reference place of publishing (city)."
285.It Li \&%\&D Ta \&No Ta \&No Ta "Reference date."
286.It Li \&%J Ta Yes Ta Yes Ta "Reference journal title."
287.It Li \&%N Ta \&No Ta \&No Ta "Reference issue number."
288.It Li \&%\&O Ta \&No Ta \&No Ta "Reference optional information."
289.It Li \&%P Ta \&No Ta \&No Ta "Reference page number(s)."
290.It Li \&%R Ta \&No Ta \&No Ta "Reference report Name."
291.It Li \&%T Ta Yes Ta Yes Ta "Reference article title."
292.It Li \&%V Ta \&No Ta \&No Ta "Reference volume."
293.It Li \&Ac Ta Yes Ta Yes Ta "Angle close quote."
294.It Li \&Ao Ta Yes Ta Yes Ta "Angle open quote."
295.It Li \&Aq Ta Yes Ta Yes Ta "Angle quote."
296.It Li \&At Ta \&No Ta \&No Ta Tn "AT&T UNIX"
297.It Li \&Bc Ta Yes Ta Yes Ta "Bracket close quote."
298.It Li \&Bf Ta \&No Ta \&No Ta "Begin font mode."
299.It Li \&Bo Ta Yes Ta Yes Ta "Bracket open quote."
300.It Li \&Bq Ta Yes Ta Yes Ta "Bracket quote."
301.It Li \&Bx Ta Yes Ta Yes Ta Bx .
302.It Li \&Db Ta \&No Ta \&No Ta "Debug (default is \\*qoff\\*q)"
303.It Li \&Dc Ta Yes Ta Yes Ta "Double close quote."
304.It Li \&Do Ta Yes Ta Yes Ta "Double open quote."
305.It Li \&Dq Ta Yes Ta Yes Ta "Double quote."
306.It Li \&Ec Ta Yes Ta Yes Ta "Enclose string close quote."
307.It Li \&Ef Ta \&No Ta \&No Ta "End font mode."
308.It Li \&Em Ta Yes Ta Yes Ta "Emphasis (traditional English)."
309.It Li \&Eo Ta Yes Ta Yes Ta "Enclose string open quote."
310.It Li \&No Ta Yes Ta Yes Ta "Normal text (no-op)."
311.It Li \&Ns Ta Yes Ta Yes Ta "No space."
312.It Li \&Pc Ta Yes Ta Yes Ta "Parenthesis close quote."
313.It Li \&Pf Ta Yes Ta \&No Ta "Prefix string."
314.It Li \&Po Ta Yes Ta Yes Ta "Parenthesis open quote."
315.It Li \&Pq Ta Yes Ta Yes Ta "Parentheses quote."
316.It Li \&Qc Ta Yes Ta Yes Ta "Strait Double close quote."
317.It Li \&Ql Ta Yes Ta Yes Ta "Quoted literal."
318.It Li \&Qo Ta Yes Ta Yes Ta "Strait Double open quote."
319.It Li \&Qq Ta Yes Ta Yes Ta "Strait Double quote."
320.It Li \&Re Ta \&No Ta \&No Ta "Reference start."
321.It Li \&Rs Ta \&No Ta \&No Ta "Reference start."
322.It Li \&Sc Ta Yes Ta Yes Ta "Single close quote."
323.It Li \&So Ta Yes Ta Yes Ta "Single open quote."
324.It Li \&Sq Ta Yes Ta Yes Ta "Single quote."
325.It Li \&Sm Ta \&No Ta \&No Ta "Space mode (default is \\*qon\\*q)"
326.It Li \&Sx Ta Yes Ta Yes Ta "Section Cross Reference."
327.It Li \&Sy Ta Yes Ta Yes Ta "Symbolic (traditional English)."
328.It Li \&Tn Ta Yes Ta Yes Ta "Trade or type name (small Caps)."
329.It Li \&Ux Ta Yes Ta Yes Ta Ux
330.It Li \&Xc Ta Yes Ta Yes Ta "Extend argument list close."
331.It Li \&Xo Ta Yes Ta Yes Ta "Extend argument list close."
332.El
333.\" .It Sy \&Hf Ta \&No Ta \&No Ta "Include file with header"
334.Pp
335Macro names ending in
336.Ql q
337quote remaining items on the argument list.
338Macro names ending in
339.Ql o
340begin a quote which may span more than one line of input and
341are close quoted with the matching macro name ending in
342.Ql c .
343Enclosure macros may be nested and are limited to
344eight arguments.
345.Pp
346Note: the extended argument list macros
347.Pf ( Ql \&.Xo ,
348.Ql \&.Xc )
349and the function enclosure macros
350.Pf ( Ql \&.Fo ,
351.Ql \&.Fc )
352are irregular.
353The extended list macros are used when the number of macro arguments
354would exceed the
355.Xr troff
356limitation of nine arguments.
357.Sh CONFIGURATION
358For site specific configuration of the macro package,
359see the file
360.Pa /usr/src/share/tmac/README .
361.Sh FILES
362.Bl -tag -width "tmac.doc-ditroff" -compact
363.It Pa tmac.doc
364Manual and general text domain macros.
365.It Pa tmac.doc-common
366Common structural macros and definitions.
367.It Pa tmac.doc-nroff
368Site dependent
369.Xr nroff
370style file.
371.It Pa tmac.doc-ditroff
372Site dependent
373.Xr troff
374style file.
375.It Pa tmac.doc-syms
376Special defines (such as the standards macro).
377.El
378.Sh SEE ALSO
379.Xr mdoc.samples 7
380