xref: /freebsd/contrib/mandoc/man.7 (revision c697fb7f)
1.\"	$Id: man.7,v 1.144 2019/07/09 03:46:59 schwarze Exp $
2.\"
3.\" Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
4.\" Copyright (c) 2011-2015,2017,2018,2019 Ingo Schwarze <schwarze@openbsd.org>
5.\" Copyright (c) 2017 Anthony Bentley <bentley@openbsd.org>
6.\" Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
7.\"
8.\" Permission to use, copy, modify, and distribute this software for any
9.\" purpose with or without fee is hereby granted, provided that the above
10.\" copyright notice and this permission notice appear in all copies.
11.\"
12.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19.\"
20.Dd $Mdocdate: July 9 2019 $
21.Dt MAN 7
22.Os
23.Sh NAME
24.Nm man
25.Nd legacy formatting language for manual pages
26.Sh DESCRIPTION
27The
28.Nm man
29language was the standard formatting language for
30.At
31manual pages from 1979 to 1989.
32Do not use it to write new manual pages: it is a purely presentational
33language and lacks support for semantic markup.
34Use the
35.Xr mdoc 7
36language, instead.
37.Pp
38In a
39.Nm
40document, lines beginning with the control character
41.Sq \&.
42are called
43.Dq macro lines .
44The first word is the macro name.
45It usually consists of two capital letters.
46For a list of portable macros, see
47.Sx MACRO OVERVIEW .
48The words following the macro name are arguments to the macro.
49.Pp
50Lines not beginning with the control character are called
51.Dq text lines .
52They provide free-form text to be printed; the formatting of the text
53depends on the respective processing context:
54.Bd -literal -offset indent
55\&.SH Macro lines change control state.
56Text lines are interpreted within the current state.
57.Ed
58.Pp
59Many aspects of the basic syntax of the
60.Nm
61language are based on the
62.Xr roff 7
63language; see the
64.Em LANGUAGE SYNTAX
65and
66.Em MACRO SYNTAX
67sections in the
68.Xr roff 7
69manual for details, in particular regarding
70comments, escape sequences, whitespace, and quoting.
71.Pp
72Each
73.Nm
74document starts with the
75.Ic TH
76macro specifying the document's name and section, followed by the
77.Sx NAME
78section formatted as follows:
79.Bd -literal -offset indent
80\&.TH PROGNAME 1 1979-01-10
81\&.SH NAME
82\efBprogname\efR \e(en one line about what it does
83.Ed
84.Sh MACRO OVERVIEW
85This overview is sorted such that macros of similar purpose are listed
86together.
87Deprecated and non-portable macros are not included in the overview,
88but can be found in the alphabetical reference below.
89.Ss Page header and footer meta-data
90.Bl -column "RS, RE" description
91.It Ic TH Ta set the title: Ar name section date Op Ar source Op Ar volume
92.It Ic AT Ta display AT&T UNIX version in the page footer (<= 1 argument)
93.It Ic UC Ta display BSD version in the page footer (<= 1 argument)
94.El
95.Ss Sections and paragraphs
96.Bl -column "RS, RE" description
97.It Ic SH Ta section header (one line)
98.It Ic SS Ta subsection header (one line)
99.It Ic PP Ta start an undecorated paragraph (no arguments)
100.It Ic RS , RE Ta reset the left margin: Op Ar width
101.It Ic IP Ta indented paragraph: Op Ar head Op Ar width
102.It Ic TP Ta tagged paragraph: Op Ar width
103.It Ic PD Ta set vertical paragraph distance: Op Ar height
104.It Ic in Ta additional indent: Op Ar width
105.El
106.Ss Physical markup
107.Bl -column "RS, RE" description
108.It Ic B Ta boldface font
109.It Ic I Ta italic font
110.It Ic SB Ta small boldface font
111.It Ic SM Ta small roman font
112.It Ic BI Ta alternate between boldface and italic fonts
113.It Ic BR Ta alternate between boldface and roman fonts
114.It Ic IB Ta alternate between italic and boldface fonts
115.It Ic IR Ta alternate between italic and roman fonts
116.It Ic RB Ta alternate between roman and boldface fonts
117.It Ic RI Ta alternate between roman and italic fonts
118.El
119.Sh MACRO REFERENCE
120This section is a canonical reference to all macros, arranged
121alphabetically.
122For the scoping of individual macros, see
123.Sx MACRO SYNTAX .
124.Bl -tag -width 3n
125.It Ic AT
126Sets the volume for the footer for compatibility with man pages from
127.At
128releases.
129The optional arguments specify which release it is from.
130.It Ic B
131Text is rendered in bold face.
132.It Ic BI
133Text is rendered alternately in bold face and italic.
134Thus,
135.Sq .BI this word and that
136causes
137.Sq this
138and
139.Sq and
140to render in bold face, while
141.Sq word
142and
143.Sq that
144render in italics.
145Whitespace between arguments is omitted in output.
146.Pp
147Example:
148.Pp
149.Dl \&.BI bold italic bold italic
150.It Ic BR
151Text is rendered alternately in bold face and roman (the default font).
152Whitespace between arguments is omitted in output.
153See also
154.Ic BI .
155.It Ic DT
156Restore the default tabulator positions.
157They are at intervals of 0.5 inches.
158This has no effect unless the tabulator positions were changed with the
159.Xr roff 7
160.Ic ta
161request.
162.It Ic EE
163This is a non-standard Version 9
164.At
165extension later adopted by GNU.
166In
167.Xr mandoc 1 ,
168it does the same as the
169.Xr roff 7
170.Ic fi
171request (switch to fill mode).
172.It Ic EX
173This is a non-standard Version 9
174.At
175extension later adopted by GNU.
176In
177.Xr mandoc 1 ,
178it does the same as the
179.Xr roff 7
180.Ic nf
181request (switch to no-fill mode).
182.It Ic HP
183Begin a paragraph whose initial output line is left-justified, but
184subsequent output lines are indented, with the following syntax:
185.Pp
186.D1 Pf . Ic HP Op Ar width
187.Pp
188The
189.Ar width
190argument is a
191.Xr roff 7
192scaling width.
193If specified, it's saved for later paragraph left margins;
194if unspecified, the saved or default width is used.
195.Pp
196This macro is portable, but deprecated
197because it has no good representation in HTML output,
198usually ending up indistinguishable from
199.Ic PP .
200.It Ic I
201Text is rendered in italics.
202.It Ic IB
203Text is rendered alternately in italics and bold face.
204Whitespace between arguments is omitted in output.
205See also
206.Ic BI .
207.It Ic IP
208Begin an indented paragraph with the following syntax:
209.Pp
210.D1 Pf . Ic IP Op Ar head Op Ar width
211.Pp
212The
213.Ar width
214argument is a
215.Xr roff 7
216scaling width defining the left margin.
217It's saved for later paragraph left-margins; if unspecified, the saved or
218default width is used.
219.Pp
220The
221.Ar head
222argument is used as a leading term, flushed to the left margin.
223This is useful for bulleted paragraphs and so on.
224.It Ic IR
225Text is rendered alternately in italics and roman (the default font).
226Whitespace between arguments is omitted in output.
227See also
228.Ic BI .
229.It Ic LP
230A synonym for
231.Ic PP .
232.It Ic ME
233End a mailto block started with
234.Ic MT .
235This is a non-standard GNU extension.
236.It Ic MT
237Begin a mailto block.
238This is a non-standard GNU extension.
239It has the following syntax:
240.Bd -unfilled -offset indent
241.Pf . Ic MT Ar address
242link description to be shown
243.Pf . Ic ME
244.Ed
245.It Ic OP
246Optional command-line argument.
247This is a non-standard GNU extension.
248It has the following syntax:
249.Pp
250.D1 Pf . Ic OP Ar key Op Ar value
251.Pp
252The
253.Ar key
254is usually a command-line flag and
255.Ar value
256its argument.
257.It Ic P
258A synonym for
259.Ic PP .
260.It Ic PD
261Specify the vertical space to be inserted before each new paragraph.
262.br
263The syntax is as follows:
264.Pp
265.D1 Pf . Ic PD Op Ar height
266.Pp
267The
268.Ar height
269argument is a
270.Xr roff 7
271scaling width.
272It defaults to
273.Cm 1v .
274If the unit is omitted,
275.Cm v
276is assumed.
277.Pp
278This macro affects the spacing before any subsequent instances of
279.Ic HP ,
280.Ic IP ,
281.Ic LP ,
282.Ic P ,
283.Ic PP ,
284.Ic SH ,
285.Ic SS ,
286.Ic SY ,
287and
288.Ic TP .
289.It Ic PP
290Begin an undecorated paragraph.
291The scope of a paragraph is closed by a subsequent paragraph,
292sub-section, section, or end of file.
293The saved paragraph left-margin width is reset to the default.
294.It Ic RB
295Text is rendered alternately in roman (the default font) and bold face.
296Whitespace between arguments is omitted in output.
297See also
298.Ic BI .
299.It Ic RE
300Explicitly close out the scope of a prior
301.Ic RS .
302The default left margin is restored to the state before that
303.Ic RS
304invocation.
305.Pp
306The syntax is as follows:
307.Pp
308.D1 Pf . Ic RE Op Ar level
309.Pp
310Without an argument, the most recent
311.Ic RS
312block is closed out.
313If
314.Ar level
315is 1, all open
316.Ic RS
317blocks are closed out.
318Otherwise,
319.Ar level No \(mi 1
320nested
321.Ic RS
322blocks remain open.
323.It Ic RI
324Text is rendered alternately in roman (the default font) and italics.
325Whitespace between arguments is omitted in output.
326See also
327.Ic BI .
328.It Ic RS
329Temporarily reset the default left margin.
330This has the following syntax:
331.Pp
332.D1 Pf . Ic RS Op Ar width
333.Pp
334The
335.Ar width
336argument is a
337.Xr roff 7
338scaling width.
339If not specified, the saved or default width is used.
340.Pp
341See also
342.Ic RE .
343.It Ic SB
344Text is rendered in small size (one point smaller than the default font)
345bold face.
346.It Ic SH
347Begin a section.
348The scope of a section is only closed by another section or the end of
349file.
350The paragraph left-margin width is reset to the default.
351.It Ic SM
352Text is rendered in small size (one point smaller than the default
353font).
354.It Ic SS
355Begin a sub-section.
356The scope of a sub-section is closed by a subsequent sub-section,
357section, or end of file.
358The paragraph left-margin width is reset to the default.
359.It Ic SY
360Begin a synopsis block with the following syntax:
361.Bd -unfilled -offset indent
362.Pf . Ic SY Ar command
363.Ar arguments
364.Pf . Ic YS
365.Ed
366.Pp
367This is a non-standard GNU extension
368and very rarely used even in GNU manual pages.
369Formatting is similar to
370.Ic IP .
371.It Ic TH
372Set the name of the manual page for use in the page header
373and footer with the following syntax:
374.Pp
375.D1 Pf . Ic TH Ar name section date Op Ar source Op Ar volume
376.Pp
377Conventionally, the document
378.Ar name
379is given in all caps.
380The
381.Ar section
382is usually a single digit, in a few cases followed by a letter.
383The recommended
384.Ar date
385format is
386.Sy YYYY-MM-DD
387as specified in the ISO-8601 standard;
388if the argument does not conform, it is printed verbatim.
389If the
390.Ar date
391is empty or not specified, the current date is used.
392The optional
393.Ar source
394string specifies the organisation providing the utility.
395When unspecified,
396.Xr mandoc 1
397uses its
398.Fl Ios
399argument.
400The
401.Ar volume
402string replaces the default volume title of the
403.Ar section .
404.Pp
405Examples:
406.Pp
407.Dl \&.TH CVS 5 "1992-02-12" GNU
408.It Ic TP
409Begin a paragraph where the head, if exceeding the indentation width, is
410followed by a newline; if not, the body follows on the same line after
411advancing to the indentation width.
412Subsequent output lines are indented.
413The syntax is as follows:
414.Bd -unfilled -offset indent
415.Pf . Ic TP Op Ar width
416.Ar head No \e" one line
417.Ar body
418.Ed
419.Pp
420The
421.Ar width
422argument is a
423.Xr roff 7
424scaling width.
425If specified, it's saved for later paragraph left-margins; if
426unspecified, the saved or default width is used.
427.It Ic TQ
428Like
429.Ic TP ,
430except that no vertical spacing is inserted before the paragraph.
431This is a non-standard GNU extension
432and very rarely used even in GNU manual pages.
433.It Ic UC
434Sets the volume for the footer for compatibility with man pages from
435.Bx
436releases.
437The optional first argument specifies which release it is from.
438.It Ic UE
439End a uniform resource identifier block started with
440.Ic UR .
441This is a non-standard GNU extension.
442.It Ic UR
443Begin a uniform resource identifier block.
444This is a non-standard GNU extension.
445It has the following syntax:
446.Bd -unfilled -offset indent
447.Pf . Ic UR Ar uri
448link description to be shown
449.Pf . Ic UE
450.Ed
451.It Ic YS
452End a synopsis block started with
453.Ic SY .
454This is a non-standard GNU extension.
455.It Ic in
456Indent relative to the current indentation:
457.Pp
458.D1 Pf . Ic in Op Ar width
459.Pp
460If
461.Ar width
462is signed, the new offset is relative.
463Otherwise, it is absolute.
464This value is reset upon the next paragraph, section, or sub-section.
465.El
466.Sh MACRO SYNTAX
467The
468.Nm
469macros are classified by scope: line scope or block scope.
470Line macros are only scoped to the current line (and, in some
471situations, the subsequent line).
472Block macros are scoped to the current line and subsequent lines until
473closed by another block macro.
474.Ss Line Macros
475Line macros are generally scoped to the current line, with the body
476consisting of zero or more arguments.
477If a macro is scoped to the next line and the line arguments are empty,
478the next line, which must be text, is used instead.
479Thus:
480.Bd -literal -offset indent
481\&.I
482foo
483.Ed
484.Pp
485is equivalent to
486.Sq .I foo .
487If next-line macros are invoked consecutively, only the last is used.
488If a next-line macro is followed by a non-next-line macro, an error is
489raised.
490.Pp
491The syntax is as follows:
492.Bd -literal -offset indent
493\&.YO \(lBbody...\(rB
494\(lBbody...\(rB
495.Ed
496.Bl -column "MacroX" "ArgumentsX" "ScopeXXXXX" "CompatX" -offset indent
497.It Em Macro Ta Em Arguments Ta Em Scope     Ta Em Notes
498.It Ic AT  Ta    <=1       Ta    current   Ta    \&
499.It Ic B   Ta    n         Ta    next-line Ta    \&
500.It Ic BI  Ta    n         Ta    current   Ta    \&
501.It Ic BR  Ta    n         Ta    current   Ta    \&
502.It Ic DT  Ta    0         Ta    current   Ta    \&
503.It Ic EE  Ta    0         Ta    current   Ta    Version 9 At
504.It Ic EX  Ta    0         Ta    current   Ta    Version 9 At
505.It Ic I   Ta    n         Ta    next-line Ta    \&
506.It Ic IB  Ta    n         Ta    current   Ta    \&
507.It Ic IR  Ta    n         Ta    current   Ta    \&
508.It Ic OP  Ta    >=1       Ta    current   Ta    GNU
509.It Ic PD  Ta    1         Ta    current   Ta    \&
510.It Ic RB  Ta    n         Ta    current   Ta    \&
511.It Ic RI  Ta    n         Ta    current   Ta    \&
512.It Ic SB  Ta    n         Ta    next-line Ta    \&
513.It Ic SM  Ta    n         Ta    next-line Ta    \&
514.It Ic TH  Ta    >1, <6    Ta    current   Ta    \&
515.It Ic UC  Ta    <=1       Ta    current   Ta    \&
516.It Ic in  Ta    1         Ta    current   Ta    Xr roff 7
517.El
518.Ss Block Macros
519Block macros comprise a head and body.
520As with in-line macros, the head is scoped to the current line and, in
521one circumstance, the next line (the next-line stipulations as in
522.Sx Line Macros
523apply here as well).
524.Pp
525The syntax is as follows:
526.Bd -literal -offset indent
527\&.YO \(lBhead...\(rB
528\(lBhead...\(rB
529\(lBbody...\(rB
530.Ed
531.Pp
532The closure of body scope may be to the section, where a macro is closed
533by
534.Ic SH ;
535sub-section, closed by a section or
536.Ic SS ;
537or paragraph, closed by a section, sub-section,
538.Ic HP ,
539.Ic IP ,
540.Ic LP ,
541.Ic P ,
542.Ic PP ,
543.Ic RE ,
544.Ic SY ,
545or
546.Ic TP .
547No closure refers to an explicit block closing macro.
548.Pp
549As a rule, block macros may not be nested; thus, calling a block macro
550while another block macro scope is open, and the open scope is not
551implicitly closed, is syntactically incorrect.
552.Bl -column "MacroX" "ArgumentsX" "Head ScopeX" "sub-sectionX" "compatX" -offset indent
553.It Em Macro Ta Em Arguments Ta Em Head Scope Ta Em Body Scope  Ta Em Notes
554.It Ic HP  Ta    <2        Ta    current    Ta    paragraph   Ta    \&
555.It Ic IP  Ta    <3        Ta    current    Ta    paragraph   Ta    \&
556.It Ic LP  Ta    0         Ta    current    Ta    paragraph   Ta    \&
557.It Ic ME  Ta    0         Ta    none       Ta    none        Ta    GNU
558.It Ic MT  Ta    1         Ta    current    Ta    to \&ME     Ta    GNU
559.It Ic P   Ta    0         Ta    current    Ta    paragraph   Ta    \&
560.It Ic PP  Ta    0         Ta    current    Ta    paragraph   Ta    \&
561.It Ic RE  Ta    <=1       Ta    current    Ta    none        Ta    \&
562.It Ic RS  Ta    1         Ta    current    Ta    to \&RE     Ta    \&
563.It Ic SH  Ta    >0        Ta    next-line  Ta    section     Ta    \&
564.It Ic SS  Ta    >0        Ta    next-line  Ta    sub-section Ta    \&
565.It Ic SY  Ta    1         Ta    current    Ta    to \&YS     Ta    GNU
566.It Ic TP  Ta    n         Ta    next-line  Ta    paragraph   Ta    \&
567.It Ic TQ  Ta    n         Ta    next-line  Ta    paragraph   Ta    GNU
568.It Ic UE  Ta    0         Ta    current    Ta    none        Ta    GNU
569.It Ic UR  Ta    1         Ta    current    Ta    part        Ta    GNU
570.It Ic YS  Ta    0         Ta    none       Ta    none        Ta    GNU
571.El
572.Pp
573If a block macro is next-line scoped, it may only be followed by in-line
574macros for decorating text.
575.Ss Font handling
576In
577.Nm
578documents, both
579.Sx Physical markup
580macros and
581.Xr roff 7
582.Ql \ef
583font escape sequences can be used to choose fonts.
584In text lines, the effect of manual font selection by escape sequences
585only lasts until the next macro invocation; in macro lines, it only lasts
586until the end of the macro scope.
587Note that macros like
588.Ic BR
589open and close a font scope for each argument.
590.Sh SEE ALSO
591.Xr man 1 ,
592.Xr mandoc 1 ,
593.Xr eqn 7 ,
594.Xr mandoc_char 7 ,
595.Xr mdoc 7 ,
596.Xr roff 7 ,
597.Xr tbl 7
598.Sh HISTORY
599The
600.Nm
601language first appeared as a macro package for the roff typesetting
602system in
603.At v7 .
604It was later rewritten by James Clark as a macro package for groff.
605Eric S. Raymond wrote the extended
606.Nm
607macros for groff in 2007.
608The stand-alone implementation that is part of the
609.Xr mandoc 1
610utility written by Kristaps Dzonsons appeared in
611.Ox 4.6 .
612.Sh AUTHORS
613This
614.Nm
615reference was written by
616.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
617