xref: /csrg-svn/share/man/man7/mdoc.7 (revision 50773)
1*50773Scael.\" Copyright (c) 1991 The Regents of the University of California.
2*50773Scael.\" All rights reserved.
3*50773Scael.\"
4*50773Scael.\" %sccs.include.redist.roff%
5*50773Scael.\"
6*50773Scael.\"	@(#)mdoc.7	1.1 (Berkeley) 08/05/91
7*50773Scael.\"
8*50773Scael.Dd
9*50773Scael.Os
10*50773Scael.Dt MDOC 7
11*50773Scael.Sh NAME
12*50773Scael.Nm mdoc
13*50773Scael.Nd Quick reference guide for the
14*50773Scael.Nm \-mdoc
15*50773Scaelmacro package
16*50773Scael.Sh SYNOPSIS
17*50773Scael.Nm groff
18*50773Scael.Fl m Ns Ar doc
19*50773Scael.Ar files ...
20*50773Scael.Sh DESCRIPTION
21*50773ScaelThe
22*50773Scael.Nm \-mdoc
23*50773Scaelpackage is a set of manual page domain content-based macros
24*50773Scaelused to format the
25*50773Scael.Bx
26*50773Scaelman pages.
27*50773ScaelThe macro names and their meanings are
28*50773Scaellisted below for quick reference; for
29*50773Scaela detailed explanation on using the package,
30*50773Scaelsee the tutorial sampler
31*50773Scael.Xr mdoc.samples 7 .
32*50773Scael.Pp
33*50773ScaelThe macros are described in three domain groups, the first
34*50773Scaeldomain includes the structural and the physical page layout macros.
35*50773ScaelThe second group contains the manual domain
36*50773Scaelcontent macros which differentiate the
37*50773Scael.Nm -\mdoc
38*50773Scaelpackage from other
39*50773Scael.Xr troff
40*50773Scaelformatting packages.
41*50773ScaelThe manual page domain specific content macros
42*50773Scaelare a subset of the day to day language
43*50773Scaelused to describe
44*50773Scael.Bx
45*50773Scaelcommands, functions, devices and files.
46*50773ScaelThe third group consists of general text
47*50773Scaeldomain macros which apply to other types of documentation
48*50773Scaelas well as manual pages.
49*50773Scael.Sh PAGE STRUCTURAL DOMAIN
50*50773Scael.Ss Title Macros
51*50773ScaelTo create a valid manual page, these three macros
52*50773Scaelrequired in the order they are presented:
53*50773Scael.Bl -tag -width ".Os OPERATING_SYSTEM [version/release]" -compact
54*50773Scael.It Sy \&.Dd Ar "Month day, year"
55*50773ScaelDocument date.
56*50773Scael.It Sy \&.Dt Ar "DOCUMENT_TITLE [section] [volume]"
57*50773ScaelTitle, in upper case.
58*50773Scael.It Sy \&.Os Ar "OPERATING_SYSTEM [version/release]"
59*50773ScaelOperating system
60*50773Scael.Pq Tn BSD .
61*50773Scael.El
62*50773Scael.Ss Page Layout Macros
63*50773ScaelSection eaders, paragraph breaks, lists and displays.
64*50773Scael.Bl -tag -width flag -compact
65*50773Scael.It Sy \&.Sh Ar HEADER
66*50773ScaelSection Header Macro.
67*50773ScaelValid headers, in the order of presentation:
68*50773Scael.Bl -tag -width "RETURN VALUES" -compact
69*50773Scael.It Ar NAME
70*50773ScaelName section, should include the
71*50773Scael.Ql \&.Nm
72*50773Scaelor
73*50773Scael.Ql \&.Fn
74*50773Scaeland the
75*50773Scael.Ql \&.Nd
76*50773Scaelmacros.
77*50773Scael.It Ar SYNOPSIS
78*50773ScaelUsage.
79*50773Scael.It Ar DESCRIPTION
80*50773ScaelGeneral description, should include
81*50773Scaeloptions and parameters.
82*50773Scael.It Ar RETURN VALUES
83*50773ScaelSections two and three function calls.
84*50773Scael.It Ar ENVIRONMENT
85*50773ScaelDescribe environment variables.
86*50773Scael.It Ar FILES
87*50773ScaelFiles associated with the subject.
88*50773Scael.It Ar EXAMPLES
89*50773ScaelExamples and suggestions.
90*50773Scael.It Ar DIAGNOSTICS
91*50773ScaelNormally used for section four device interface diagnostics.
92*50773Scael.It Ar ERRORS
93*50773ScaelSections two and three error and signal
94*50773Scaelhandling.
95*50773Scael.It Ar SEE ALSO
96*50773ScaelCross references and citations.
97*50773Scael.It Ar STANDARDS
98*50773ScaelConformance to standards if applicable.
99*50773Scael.It Ar HISTORY
100*50773ScaelIf a standard is not applicable, the history
101*50773Scaelof the subject should be given.
102*50773Scael.It Ar BUGS
103*50773ScaelGotchas and caveats.
104*50773Scael.It Ar other
105*50773ScaelCustomized headers may be added at
106*50773Scaelthe authors discretion.
107*50773Scael.El
108*50773Scael.It Sy \&.Ss
109*50773ScaelSubsection Headers.
110*50773Scael.It Sy \&.Pp
111*50773ScaelParagraph Break.
112*50773ScaelVertical space (one line).
113*50773Scael.It Sy \&.D1
114*50773Scael(D-one) Display-one
115*50773ScaelIndent and display one text line.
116*50773Scael.It Sy \&.Dl
117*50773Scael(D-ell) Display-one literal.
118*50773ScaelIndent and display one line of literal text.
119*50773Scael.It Sy \&.Bd
120*50773ScaelBegin-display of text across one or more lines.
121*50773ScaelRequires the end-display macro
122*50773Scael.Ql \&.Ed .
123*50773Scael.Pp
124*50773ScaelDisplay options:
125*50773Scael.Bl -tag -width "xoffset string" -compact
126*50773Scael.It Fl ragged
127*50773ScaelUnjustified (ragged edges).
128*50773Scael.It Fl filled
129*50773ScaelJustified.
130*50773Scael.It Fl literal
131*50773ScaelLiteral text or code.
132*50773Scael.It Fl file Ar name
133*50773ScaelRead in named
134*50773Scael.Ar file
135*50773Scaeland display.
136*50773Scael.It Fl offset Ar string
137*50773ScaelOffset (indent) display by the
138*50773Scaelwidth of
139*50773Scael.Ar string
140*50773Scael(or value of register name).
141*50773ScaelKnown values:
142*50773Scael.Pp
143*50773Scael.Bl -tag -width indent-two -compact
144*50773Scael.It Ar left
145*50773ScaelAlign block on current left margin (default).
146*50773Scael.It Ar center
147*50773ScaelApproximate center margin.
148*50773Scael.It Ar indent
149*50773ScaelSix constant width spaces (a tab).
150*50773Scael.It Ar indent-two
151*50773ScaelTwelve constant width spaces (two tabs).
152*50773Scael.It Ar right
153*50773ScaelLeft aligns block about 2 inches from
154*50773Scaelright side of page.
155*50773Scael.El
156*50773Scael.El
157*50773Scael.It Sy \&.Ed
158*50773ScaelEnd-display (matches \&.Bd).
159*50773Scael.It Sy \&.Bl
160*50773ScaelBegin-list.
161*50773ScaelCreate lists or columns.
162*50773Scael.Pp
163*50773Scael.Bl -tag -width flag -compact
164*50773Scael.It Ar List-types
165*50773Scael.Bl -column xbullet -compact
166*50773Scael.It Fl bullet Ta "Bullet Item List"
167*50773Scael.It Fl item Ta "Unlabled List"
168*50773Scael.It Fl enum Ta "Enumerated List"
169*50773Scael.It Fl tag Ta "Tag Labeled List"
170*50773Scael.It Fl diag Ta "Diagnostic List"
171*50773Scael.It Fl hang Ta "Hanging Labeled List"
172*50773Scael.It Fl ohang Ta "Overhanging Labeled List"
173*50773Scael.It Fl inset Ta "Inset or Run-on Labeled List"
174*50773Scael.El
175*50773Scael.It List-parameters
176*50773Scael.Bl -tag -width xcompact -compact
177*50773Scael.It Fl offset Ar indent
178*50773Scael(All lists.)
179*50773ScaelOffset or indent by
180*50773Scael.Ar indent .
181*50773ScaelThe
182*50773Scael.Ar indent
183*50773Scaelmay be expressed as a scaled number
184*50773Scael(12n), a string, a register name or
185*50773Scaelthe string
186*50773Scael.Li indent
187*50773Scaelwhich represents a tab.
188*50773Scael.It Fl width Ar string
189*50773Scael.Pf ( Fl tag
190*50773Scaeland
191*50773Scael.Fl hang
192*50773Scaellists only.)
193*50773ScaelThe label width is set to the constant width of
194*50773Scael.Ar string .
195*50773ScaelThe
196*50773Scael.Fl width
197*50773Scaeloption may be a scaled number
198*50773Scael(20n), a string,
199*50773Scaela register name or the
200*50773Scaelstring
201*50773Scael.Li indent
202*50773Scaelwhich represents a tab.
203*50773Scael.It Fl compact
204*50773Scael(All lists.)
205*50773ScaelSuppresses the insertion of a blank line at the beginning
206*50773Scaelof a display and in between each item.
207*50773Scael.It Sy \&.El
208*50773ScaelEnd-list.
209*50773Scael.It Sy \&.It
210*50773ScaelList item.
211*50773Scael.El
212*50773Scael.El
213*50773Scael.Sh MANUAL AND GENERAL TEXT DOMAIN MACROS
214*50773ScaelThe manual and general text domain macros are special in that
215*50773Scaelmost of them are parsed for callable macros
216*50773Scaelfor example:
217*50773Scael.Bd -literal -offset indent
218*50773Scael\&.Op Fl s Ar file
219*50773Scael.Ed
220*50773Scael.Pp
221*50773ScaelIn this example, the option enclosure macro
222*50773Scael.Ql \&.Op
223*50773Scaelis parsed, and calls the callable content macro
224*50773Scael.Ql \&Fl
225*50773Scaelwhich operates on the argument
226*50773Scael.Ql s
227*50773Scaeland then calls the callable content macro
228*50773Scael.Ql \&Ar
229*50773Scaelwhich operates on the argument
230*50773Scael.Ql file .
231*50773ScaelThe result is:
232*50773Scael.Pp
233*50773Scael.Dl Op Fl s Ar file
234*50773Scael.Pp
235*50773ScaelSome macros may be callable, but are not parsed and vice versa.
236*50773ScaelThese macros are indicated in the
237*50773Scael.Em parsed
238*50773Scaeland
239*50773Scael.Em callable columns below.
240*50773Scael.Pp
241*50773ScaelUnless stated, manual page domain macros share a common syntax:
242*50773Scael.Pp
243*50773Scael.Dl \&.Va argument [\ .\ ,\ ;\ :\ (\ )\ [\ ]\ argument \...\ ]
244*50773Scael.Pp
245*50773ScaelMacros may be given up to nine arguments.
246*50773Scael.Sy Note :
247*50773ScaelOpening and closing
248*50773Scaelpunctuation characters are only recognized as such if they are presented
249*50773Scaelone at a time.
250*50773ScaelThe string
251*50773Scael.Ql "),"
252*50773Scaelis not recognized as punctuation and will be output with a leading white
253*50773Scaelspace and in what ever font the calling macro uses.
254*50773ScaelThe
255*50773Scaelthe argument list
256*50773Scael.Ql "] ) ,"
257*50773Scaelis recognized as three sequential closing punctuation characters
258*50773Scaeland a leading white space is not output between the characters
259*50773Scaeland the previous argument (if any).
260*50773ScaelThe special meaning of a punctuation character may be escaped
261*50773Scaelwith the string
262*50773Scael.Ql \e& .
263*50773ScaelFor example the following string,
264*50773Scael.Pp
265*50773Scael.Dl \&.Ar file1\ , file2\ , file3\ )\ .
266*50773Scael.Pp
267*50773ScaelProduces
268*50773Scael.Pp
269*50773Scael.D1 .Ar file1 , file2 , file3 ) .
270*50773Scael.Ss Manual Domain Macros
271*50773Scael.Bl -column "Name" "Parsed" Callable"
272*50773Scael.It Em Name	Parsed	Callable	Description
273*50773Scael.It Sy \&Ad Ta Yes Ta Yes Ta Address. "(This macro may be deprecated.)"
274*50773Scael.It Sy \&Ar Ta Yes Ta Yes Ta "Command line argument."
275*50773Scael.It Sy \&Cd Ta \&No Ta \&No Ta "Configuration declaration (section four only)."
276*50773Scael.It Sy \&Cm Ta Yes Ta Yes Ta "Command line argument modifier."
277*50773Scael.It Sy \&Dv Ta Yes Ta Yes Ta "Defined variable (source code)."
278*50773Scael.It Sy \&Er Ta Yes Ta Yes Ta "Error number (source code)."
279*50773Scael.It Sy \&Ev Ta Yes Ta Yes Ta "Environment variable."
280*50773Scael.It Sy \&Fa Ta Yes Ta Yes Ta "Function argument."
281*50773Scael.It Sy \&Fd Ta Yes Ta Yes Ta "Function declaration."
282*50773Scael.It Sy \&Fn Ta Yes Ta Yes Ta "Function call (also .Fo and .Fc)."
283*50773Scael.It Sy \&Ic Ta Yes Ta Yes Ta "Interactive command."
284*50773Scael.It Sy \&Li Ta Yes Ta Yes Ta "Literal text."
285*50773Scael.It Sy \&Nm Ta Yes Ta Yes Ta "Command name."
286*50773Scael.It Sy \&Op Ta Yes Ta Yes Ta "Option (also .Oo and .Oc)."
287*50773Scael.It Sy \&Ot Ta Yes Ta Yes Ta "Old style function type (Fortran only)."
288*50773Scael.It Sy \&Pa Ta Yes Ta Yes Ta "Pathname or file name."
289*50773Scael.It Sy \&St Ta Yes Ta Yes Ta "Standards (-p1003.2, -p1003.1 or -ansiC)"
290*50773Scael.It Sy \&Va Ta Yes Ta Yes Ta "Variable name."
291*50773Scael.It Sy \&Vt Ta Yes Ta Yes Ta "Variable type (Fortran only)."
292*50773Scael.It Sy \&Xr Ta Yes Ta Yes Ta "Manual Page Cross Reference."
293*50773Scael.El
294*50773Scael.Ss General Text Domain Macros
295*50773Scael.Bl -column "Name" "Parsed" Callable"
296*50773Scael.It Em "Name	Parsed	Callable	Description"
297*50773Scael.It Sy \&%A Ta Yes Ta \&No Ta "Reference author."
298*50773Scael.It Sy \&%B Ta Yes Ta Yes Ta "Reference book title."
299*50773Scael.It Sy \&%\&C Ta \&No Ta \&No Ta "Reference place of publishing (city)."
300*50773Scael.It Sy \&%\&D Ta \&No Ta \&No Ta "Reference date."
301*50773Scael.It Sy \&%J Ta Yes Ta Yes Ta "Reference journal title."
302*50773Scael.It Sy \&%N Ta \&No Ta \&No Ta "Reference issue number."
303*50773Scael.It Sy \&%\&O Ta \&No Ta \&No Ta "Reference optional information."
304*50773Scael.It Sy \&%P Ta \&No Ta \&No Ta "Reference page number(s)."
305*50773Scael.It Sy \&%R Ta \&No Ta \&No Ta "Reference report Name."
306*50773Scael.It Sy \&%T Ta Yes Ta Yes Ta "Reference article title."
307*50773Scael.It Sy \&%V Ta \&No Ta \&No Ta "Reference volume."
308*50773Scael.It Sy \&Ac Ta Yes Ta Yes Ta "Angle close quote."
309*50773Scael.It Sy \&Ao Ta Yes Ta Yes Ta "Angle open quote."
310*50773Scael.It Sy \&Aq Ta Yes Ta Yes Ta "Angle quote."
311*50773Scael.It Sy \&At Ta \&No Ta \&No Ta Tn "AT&T UNIX"
312*50773Scael.It Sy \&Bc Ta Yes Ta Yes Ta "Bracket close quote."
313*50773Scael.It Sy \&Bf Ta \&No Ta \&No Ta "Begin font mode."
314*50773Scael.It Sy \&Bo Ta Yes Ta Yes Ta "Bracket open quote."
315*50773Scael.It Sy \&Bq Ta Yes Ta Yes Ta "Bracket quote."
316*50773Scael.It Sy \&Bx Ta Yes Ta Yes Ta Bx .
317*50773Scael.It Sy \&Db Ta \&No Ta \&No Ta "Debug (default is off)"
318*50773Scael.It Sy \&Dc Ta Yes Ta Yes Ta "Double close quote."
319*50773Scael.It Sy \&Do Ta Yes Ta Yes Ta "Double open quote."
320*50773Scael.It Sy \&Dq Ta Yes Ta Yes Ta "Double quote."
321*50773Scael.It Sy \&Ec Ta Yes Ta Yes Ta "Enclose string close quote."
322*50773Scael.It Sy \&Ef Ta \&No Ta \&No Ta "End font mode."
323*50773Scael.It Sy \&Em Ta Yes Ta Yes Ta "Emphasis (traditional English)."
324*50773Scael.It Sy \&Eo Ta Yes Ta Yes Ta "Enclose string open quote."
325*50773Scael.It Sy \&No Ta Yes Ta Yes Ta "Normal text (no-op)."
326*50773Scael.It Sy \&Ns Ta Yes Ta Yes Ta "No space."
327*50773Scael.It Sy \&Pc Ta Yes Ta Yes Ta "Parenthesis close quote."
328*50773Scael.It Sy \&Pf Ta Yes Ta \&No Ta "Prefix string."
329*50773Scael.It Sy \&Po Ta Yes Ta Yes Ta "Parenthesis open quote."
330*50773Scael.It Sy \&Pq Ta Yes Ta Yes Ta "Parentheses quote."
331*50773Scael.It Sy \&Qc Ta Yes Ta Yes Ta "Strait Double close quote."
332*50773Scael.It Sy \&Ql Ta Yes Ta Yes Ta "Quoted literal."
333*50773Scael.It Sy \&Qo Ta Yes Ta Yes Ta "Strait Double open quote."
334*50773Scael.It Sy \&Qq Ta Yes Ta Yes Ta "Strait Double quote."
335*50773Scael.It Sy \&Re Ta \&No Ta \&No Ta "Reference start."
336*50773Scael.It Sy \&Rs Ta \&No Ta \&No Ta "Reference start."
337*50773Scael.It Sy \&Sc Ta Yes Ta Yes Ta "Single close quote."
338*50773Scael.It Sy \&So Ta Yes Ta Yes Ta "Single open quote."
339*50773Scael.It Sy \&Sq Ta Yes Ta Yes Ta "Single quote."
340*50773Scael.It Sy \&Sm Ta \&No Ta \&No Ta "Space mode (default is \\*qon\\*q)"
341*50773Scael.It Sy \&Sx Ta Yes Ta Yes Ta "Section Cross Reference."
342*50773Scael.It Sy \&Sy Ta Yes Ta Yes Ta "Symbolic (traditional English)."
343*50773Scael.It Sy \&Tn Ta Yes Ta Yes Ta "Trade or type name (small Caps)."
344*50773Scael.It Sy \&Ux Ta Yes Ta Yes Ta Ux
345*50773Scael.It Sy \&Xc Ta Yes Ta Yes Ta "Extend argument list close."
346*50773Scael.It Sy \&Xo Ta Yes Ta Yes Ta "Extend argument list close."
347*50773Scael.El
348*50773Scael.\" .It Sy \&Hf Ta \&No Ta \&No Ta "Include file with header"
349*50773Scael.Pp
350*50773ScaelMacro names ending in
351*50773Scael.Ql q
352*50773Scaelquote remaining items on the argument list.
353*50773ScaelMacro names ending in
354*50773Scael.Ql o
355*50773Scaelbegin a quote which may span more than one line of input and
356*50773Scaelare close quoted with the matching macro name ending in
357*50773Scael.Ql c .
358*50773ScaelEnclosure macros may be nested.
359*50773Scael.Pp
360*50773ScaelNote: the extended argument list macros
361*50773Scael.Pf ( Ql \&.Xo ,
362*50773Scael.Ql \&.Xc )
363*50773Scaeland the function enclosure macros
364*50773Scael.Pf ( Ql \&.Fo ,
365*50773Scael.Ql \&.Fc )
366*50773Scaelare irregular.
367*50773ScaelThe extended list macros are used when the number of macro arguments
368*50773Scaelwould exceed the
369*50773Scael.Xr troff
370*50773Scaellimitation of nine arguments.
371*50773Scael.Sh CONFIGURATION
372*50773ScaelFor site specific configuration of the macro package,
373*50773Scaelsee the file
374*50773Scael.Pa /usr/src/share/tmac/README .
375*50773Scael.Sh FILES
376*50773Scael.Bl -tag -width "tmac.doc-ditroff" -compact
377*50773Scael.It Pa tmac.doc
378*50773ScaelManual and general text domain macros.
379*50773Scael.It Pa tmac.doc-common
380*50773ScaelShared structural macros (between nroff/troff/groff).
381*50773Scael.It Pa tmac.doc-nroff
382*50773ScaelSite dependent nroff style file.
383*50773Scael.It Pa tmac.doc-ditroff
384*50773ScaelSite dependent groff/troff/ditroff style file.
385*50773Scael.It Pa tmac.doc-syms
386*50773ScaelSpecial defines (such as the standards macro).
387*50773Scael.El
388*50773Scael.Sh SEE ALSO
389*50773Scael.Xr mdoc.samples 7
390*50773Scael.Sh HISTORY
391*50773ScaelThe
392*50773Scael.Nm \-mdoc
393*50773Scaelmacro package is
394*50773Scael.Ud .
395