xref: /openbsd/share/man/man7/mdoc.7 (revision 3cab2bb3)
1.\"	$OpenBSD: mdoc.7,v 1.172 2020/06/30 14:48:18 schwarze Exp $
2.\"
3.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4.\" Copyright (c) 2010, 2011, 2013-2020 Ingo Schwarze <schwarze@openbsd.org>
5.\"
6.\" Permission to use, copy, modify, and distribute this software for any
7.\" purpose with or without fee is hereby granted, provided that the above
8.\" copyright notice and this permission notice appear in all copies.
9.\"
10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\"
18.Dd $Mdocdate: June 30 2020 $
19.Dt MDOC 7
20.Os
21.Sh NAME
22.Nm mdoc
23.Nd semantic markup language for formatting manual pages
24.Sh DESCRIPTION
25The
26.Nm mdoc
27language supports authoring of manual pages for the
28.Xr man 1
29utility by allowing semantic annotations of words, phrases,
30page sections and complete manual pages.
31Such annotations are used by formatting tools to achieve a uniform
32presentation across all manuals written in
33.Nm ,
34and to support hyperlinking if supported by the output medium.
35.Pp
36This reference document describes the structure of manual pages
37and the syntax and usage of the
38.Nm
39language.
40The reference implementation of a parsing and formatting tool is
41.Xr mandoc 1 ;
42the
43.Sx COMPATIBILITY
44section describes compatibility with other implementations.
45.Pp
46In an
47.Nm
48document, lines beginning with the control character
49.Sq \&.
50are called
51.Dq macro lines .
52The first word is the macro name.
53It consists of two or three letters.
54Most macro names begin with a capital letter.
55For a list of available macros, see
56.Sx MACRO OVERVIEW .
57The words following the macro name are arguments to the macro, optionally
58including the names of other, callable macros; see
59.Sx MACRO SYNTAX
60for details.
61.Pp
62Lines not beginning with the control character are called
63.Dq text lines .
64They provide free-form text to be printed; the formatting of the text
65depends on the respective processing context:
66.Bd -literal -offset indent
67\&.Sh Macro lines change control state.
68Text lines are interpreted within the current state.
69.Ed
70.Pp
71Many aspects of the basic syntax of the
72.Nm
73language are based on the
74.Xr roff 7
75language; see the
76.Em LANGUAGE SYNTAX
77and
78.Em MACRO SYNTAX
79sections in the
80.Xr roff 7
81manual for details, in particular regarding
82comments, escape sequences, whitespace, and quoting.
83However, using
84.Xr roff 7
85requests in
86.Nm
87documents is discouraged;
88.Xr mandoc 1
89supports some of them merely for backward compatibility.
90.Sh MANUAL STRUCTURE
91A well-formed
92.Nm
93document consists of a document prologue followed by one or more
94sections.
95.Pp
96The prologue, which consists of the
97.Ic \&Dd ,
98.Ic \&Dt ,
99and
100.Ic \&Os
101macros in that order, is required for every document.
102.Pp
103The first section (sections are denoted by
104.Ic \&Sh )
105must be the NAME section, consisting of at least one
106.Ic \&Nm
107followed by
108.Ic \&Nd .
109.Pp
110Following that, convention dictates specifying at least the
111.Em SYNOPSIS
112and
113.Em DESCRIPTION
114sections, although this varies between manual sections.
115.Pp
116The following is a well-formed skeleton
117.Nm
118file for a utility
119.Qq progname :
120.Bd -literal -offset indent
121\&.Dd $\&Mdocdate$
122\&.Dt PROGNAME section
123\&.Os
124\&.Sh NAME
125\&.Nm progname
126\&.Nd one line about what it does
127\&.\e\(dq .Sh LIBRARY
128\&.\e\(dq For sections 2, 3, and 9 only.
129\&.\e\(dq Not used in OpenBSD.
130\&.Sh SYNOPSIS
131\&.Nm progname
132\&.Op Fl options
133\&.Ar
134\&.Sh DESCRIPTION
135The
136\&.Nm
137utility processes files ...
138\&.\e\(dq .Sh CONTEXT
139\&.\e\(dq For section 9 functions only.
140\&.\e\(dq .Sh IMPLEMENTATION NOTES
141\&.\e\(dq Not used in OpenBSD.
142\&.\e\(dq .Sh RETURN VALUES
143\&.\e\(dq For sections 2, 3, and 9 function return values only.
144\&.\e\(dq .Sh ENVIRONMENT
145\&.\e\(dq For sections 1, 6, 7, and 8 only.
146\&.\e\(dq .Sh FILES
147\&.\e\(dq .Sh EXIT STATUS
148\&.\e\(dq For sections 1, 6, and 8 only.
149\&.\e\(dq .Sh EXAMPLES
150\&.\e\(dq .Sh DIAGNOSTICS
151\&.\e\(dq For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only.
152\&.\e\(dq .Sh ERRORS
153\&.\e\(dq For sections 2, 3, 4, and 9 errno settings only.
154\&.\e\(dq .Sh SEE ALSO
155\&.\e\(dq .Xr foobar 1
156\&.\e\(dq .Sh STANDARDS
157\&.\e\(dq .Sh HISTORY
158\&.\e\(dq .Sh AUTHORS
159\&.\e\(dq .Sh CAVEATS
160\&.\e\(dq .Sh BUGS
161\&.\e\(dq .Sh SECURITY CONSIDERATIONS
162\&.\e\(dq Not used in OpenBSD.
163.Ed
164.Pp
165The sections in an
166.Nm
167document are conventionally ordered as they appear above.
168Sections should be composed as follows:
169.Bl -ohang -offset Ds
170.It Em NAME
171The name(s) and a one line description of the documented material.
172The syntax for this as follows:
173.Bd -literal -offset indent
174\&.Nm name0 ,
175\&.Nm name1 ,
176\&.Nm name2
177\&.Nd a one line description
178.Ed
179.Pp
180Multiple
181.Sq \&Nm
182names should be separated by commas.
183.Pp
184The
185.Ic \&Nm
186macro(s) must precede the
187.Ic \&Nd
188macro.
189.Pp
190See
191.Ic \&Nm
192and
193.Ic \&Nd .
194.It Em LIBRARY
195The name of the library containing the documented material, which is
196assumed to be a function in a section 2, 3, or 9 manual.
197The syntax for this is as follows:
198.Bd -literal -offset indent
199\&.Lb libarm
200.Ed
201.Pp
202See
203.Ic \&Lb .
204.It Em SYNOPSIS
205Documents the utility invocation syntax, function call syntax, or device
206configuration.
207.Pp
208For the first, utilities (sections 1, 6, and 8), this is
209generally structured as follows:
210.Bd -literal -offset indent
211\&.Nm bar
212\&.Op Fl v
213\&.Op Fl o Ar file
214\&.Op Ar
215\&.Nm foo
216\&.Op Fl v
217\&.Op Fl o Ar file
218\&.Op Ar
219.Ed
220.Pp
221Commands should be ordered alphabetically.
222.Pp
223For the second, function calls (sections 2, 3, 9):
224.Bd -literal -offset indent
225\&.In header.h
226\&.Vt extern const char *global;
227\&.Ft "char *"
228\&.Fn foo "const char *src"
229\&.Ft "char *"
230\&.Fn bar "const char *src"
231.Ed
232.Pp
233Ordering of
234.Ic \&In ,
235.Ic \&Vt ,
236.Ic \&Fn ,
237and
238.Ic \&Fo
239macros should follow C header-file conventions.
240.Pp
241And for the third, configurations (section 4):
242.Bd -literal -offset indent
243\&.Cd \(dqit* at isa? port 0x2e\(dq
244\&.Cd \(dqit* at isa? port 0x4e\(dq
245.Ed
246.Pp
247Manuals not in these sections generally don't need a
248.Em SYNOPSIS .
249.Pp
250Some macros are displayed differently in the
251.Em SYNOPSIS
252section, particularly
253.Ic \&Nm ,
254.Ic \&Cd ,
255.Ic \&Fd ,
256.Ic \&Fn ,
257.Ic \&Fo ,
258.Ic \&In ,
259.Ic \&Vt ,
260and
261.Ic \&Ft .
262All of these macros are output on their own line.
263If two such dissimilar macros are pairwise invoked (except for
264.Ic \&Ft
265before
266.Ic \&Fo
267or
268.Ic \&Fn ) ,
269they are separated by a vertical space, unless in the case of
270.Ic \&Fo ,
271.Ic \&Fn ,
272and
273.Ic \&Ft ,
274which are always separated by vertical space.
275.Pp
276When text and macros following an
277.Ic \&Nm
278macro starting an input line span multiple output lines,
279all output lines but the first will be indented to align
280with the text immediately following the
281.Ic \&Nm
282macro, up to the next
283.Ic \&Nm ,
284.Ic \&Sh ,
285or
286.Ic \&Ss
287macro or the end of an enclosing block, whichever comes first.
288.It Em DESCRIPTION
289This begins with an expansion of the brief, one line description in
290.Em NAME :
291.Bd -literal -offset indent
292The
293\&.Nm
294utility does this, that, and the other.
295.Ed
296.Pp
297It usually follows with a breakdown of the options (if documenting a
298command), such as:
299.Bd -literal -offset indent
300The arguments are as follows:
301\&.Bl \-tag \-width Ds
302\&.It Fl v
303Print verbose information.
304\&.El
305.Ed
306.Pp
307List the options in alphabetical order,
308uppercase before lowercase for each letter and
309with no regard to whether an option takes an argument.
310Put digits in ascending order before all letter options.
311.Pp
312Manuals not documenting a command won't include the above fragment.
313.Pp
314Since the
315.Em DESCRIPTION
316section usually contains most of the text of a manual, longer manuals
317often use the
318.Ic \&Ss
319macro to form subsections.
320In very long manuals, the
321.Em DESCRIPTION
322may be split into multiple sections, each started by an
323.Ic \&Sh
324macro followed by a non-standard section name, and each having
325several subsections, like in the present
326.Nm
327manual.
328.It Em CONTEXT
329This section lists the contexts in which functions can be called in section 9.
330The contexts are autoconf, process, or interrupt.
331.It Em IMPLEMENTATION NOTES
332Implementation-specific notes should be kept here.
333This is useful when implementing standard functions that may have side
334effects or notable algorithmic implications.
335.It Em RETURN VALUES
336This section documents the
337return values of functions in sections 2, 3, and 9.
338.Pp
339See
340.Ic \&Rv .
341.It Em ENVIRONMENT
342Lists the environment variables used by the utility,
343and explains the syntax and semantics of their values.
344The
345.Xr environ 7
346manual provides examples of typical content and formatting.
347.Pp
348See
349.Ic \&Ev .
350.It Em FILES
351Documents files used.
352It's helpful to document both the file name and a short description of how
353the file is used (created, modified, etc.).
354.Pp
355See
356.Ic \&Pa .
357.It Em EXIT STATUS
358This section documents the
359command exit status for section 1, 6, and 8 utilities.
360Historically, this information was described in
361.Em DIAGNOSTICS ,
362a practise that is now discouraged.
363.Pp
364See
365.Ic \&Ex .
366.It Em EXAMPLES
367Example usages.
368This often contains snippets of well-formed, well-tested invocations.
369Make sure that examples work properly!
370.It Em DIAGNOSTICS
371Documents error messages.
372In section 4 and 9 manuals, these are usually messages printed by the
373kernel to the console and to the kernel log.
374In section 1, 6, 7, and 8, these are usually messages printed by
375userland programs to the standard error output.
376.Pp
377Historically, this section was used in place of
378.Em EXIT STATUS
379for manuals in sections 1, 6, and 8; however, this practise is
380discouraged.
381.Pp
382See
383.Ic \&Bl
384.Fl diag .
385.It Em ERRORS
386Documents
387.Xr errno 2
388settings in sections 2, 3, 4, and 9.
389.Pp
390See
391.Ic \&Er .
392.It Em SEE ALSO
393References other manuals with related topics.
394This section should exist for most manuals.
395Cross-references should conventionally be ordered first by section, then
396alphabetically (ignoring case).
397.Pp
398References to other documentation concerning the topic of the manual page,
399for example authoritative books or journal articles, may also be
400provided in this section.
401.Pp
402See
403.Ic \&Rs
404and
405.Ic \&Xr .
406.It Em STANDARDS
407References any standards implemented or used.
408If not adhering to any standards, the
409.Em HISTORY
410section should be used instead.
411.Pp
412See
413.Ic \&St .
414.It Em HISTORY
415A brief history of the subject, including where it was first implemented,
416and when it was ported to or reimplemented for the operating system at hand.
417.It Em AUTHORS
418Credits to the person or persons who wrote the code and/or documentation.
419Authors should generally be noted by both name and email address.
420.Pp
421See
422.Ic \&An .
423.It Em CAVEATS
424Common misuses and misunderstandings should be explained
425in this section.
426.It Em BUGS
427Known bugs, limitations, and work-arounds should be described
428in this section.
429.It Em SECURITY CONSIDERATIONS
430Documents any security precautions that operators should consider.
431.El
432.Sh MACRO OVERVIEW
433This overview is sorted such that macros of similar purpose are listed
434together, to help find the best macro for any given purpose.
435Deprecated macros are not included in the overview, but can be found below
436in the alphabetical
437.Sx MACRO REFERENCE .
438.Ss Document preamble and NAME section macros
439.Bl -column "Brq, Bro, Brc" description
440.It Ic \&Dd Ta document date: Cm $\&Mdocdate$ | Ar month day , year
441.It Ic \&Dt Ta document title: Ar TITLE section Op Ar arch
442.It Ic \&Os Ta operating system version: Op Ar system Op Ar version
443.It Ic \&Nm Ta document name (one argument)
444.It Ic \&Nd Ta document description (one line)
445.El
446.Ss Sections and cross references
447.Bl -column "Brq, Bro, Brc" description
448.It Ic \&Sh Ta section header (one line)
449.It Ic \&Ss Ta subsection header (one line)
450.It Ic \&Sx Ta internal cross reference to a section or subsection
451.It Ic \&Xr Ta cross reference to another manual page: Ar name section
452.It Ic \&Tg Ta tag the definition of a Ar term Pq <= 1 arguments
453.It Ic \&Pp Ta start a text paragraph (no arguments)
454.El
455.Ss Displays and lists
456.Bl -column "Brq, Bro, Brc" description
457.It Ic \&Bd , \&Ed Ta display block:
458.Fl Ar type
459.Op Fl offset Ar width
460.Op Fl compact
461.It Ic \&D1 Ta indented display (one line)
462.It Ic \&Dl Ta indented literal display (one line)
463.It Ic \&Ql Ta in-line literal display: Ql text
464.It Ic \&Bl , \&El Ta list block:
465.Fl Ar type
466.Op Fl width Ar val
467.Op Fl offset Ar val
468.Op Fl compact
469.It Ic \&It Ta list item (syntax depends on Fl Ar type )
470.It Ic \&Ta Ta table cell separator in Ic \&Bl Fl column No lists
471.It Ic \&Rs , \&%* , \&Re Ta bibliographic block (references)
472.El
473.Ss Spacing control
474.Bl -column "Brq, Bro, Brc" description
475.It Ic \&Pf Ta prefix, no following horizontal space (one argument)
476.It Ic \&Ns Ta roman font, no preceding horizontal space (no arguments)
477.It Ic \&Ap Ta apostrophe without surrounding whitespace (no arguments)
478.It Ic \&Sm Ta switch horizontal spacing mode: Op Cm on | off
479.It Ic \&Bk , \&Ek Ta keep block: Fl words
480.El
481.Ss Semantic markup for command line utilities
482.Bl -column "Brq, Bro, Brc" description
483.It Ic \&Nm Ta start a SYNOPSIS block with the name of a utility
484.It Ic \&Fl Ta command line options (flags) (>=0 arguments)
485.It Ic \&Cm Ta command modifier (>0 arguments)
486.It Ic \&Ar Ta command arguments (>=0 arguments)
487.It Ic \&Op , \&Oo , \&Oc Ta optional syntax elements (enclosure)
488.It Ic \&Ic Ta internal or interactive command (>0 arguments)
489.It Ic \&Ev Ta environmental variable (>0 arguments)
490.It Ic \&Pa Ta file system path (>=0 arguments)
491.El
492.Ss Semantic markup for function libraries
493.Bl -column "Brq, Bro, Brc" description
494.It Ic \&Lb Ta function library (one argument)
495.It Ic \&In Ta include file (one argument)
496.It Ic \&Fd Ta other preprocessor directive (>0 arguments)
497.It Ic \&Ft Ta function type (>0 arguments)
498.It Ic \&Fo , \&Fc Ta function block: Ar funcname
499.It Ic \&Fn Ta function name: Ar funcname Op Ar argument ...
500.It Ic \&Fa Ta function argument (>0 arguments)
501.It Ic \&Vt Ta variable type (>0 arguments)
502.It Ic \&Va Ta variable name (>0 arguments)
503.It Ic \&Dv Ta defined variable or preprocessor constant (>0 arguments)
504.It Ic \&Er Ta error constant (>0 arguments)
505.It Ic \&Ev Ta environmental variable (>0 arguments)
506.El
507.Ss Various semantic markup
508.Bl -column "Brq, Bro, Brc" description
509.It Ic \&An Ta author name (>0 arguments)
510.It Ic \&Lk Ta hyperlink: Ar uri Op Ar display_name
511.It Ic \&Mt Ta Do mailto Dc hyperlink: Ar localpart Ns @ Ns Ar domain
512.It Ic \&Cd Ta kernel configuration declaration (>0 arguments)
513.It Ic \&Ad Ta memory address (>0 arguments)
514.It Ic \&Ms Ta mathematical symbol (>0 arguments)
515.El
516.Ss Physical markup
517.Bl -column "Brq, Bro, Brc" description
518.It Ic \&Em Ta italic font or underline (emphasis) (>0 arguments)
519.It Ic \&Sy Ta boldface font (symbolic) (>0 arguments)
520.It Ic \&No Ta return to roman font (normal) (>0 arguments)
521.It Ic \&Bf , \&Ef Ta font block: Fl Ar type | Cm \&Em | \&Li | \&Sy
522.El
523.Ss Physical enclosures
524.Bl -column "Brq, Bro, Brc" description
525.It Ic \&Dq , \&Do , \&Dc Ta enclose in typographic double quotes: Dq text
526.It Ic \&Qq , \&Qo , \&Qc Ta enclose in typewriter double quotes: Qq text
527.It Ic \&Sq , \&So , \&Sc Ta enclose in single quotes: Sq text
528.It Ic \&Pq , \&Po , \&Pc Ta enclose in parentheses: Pq text
529.It Ic \&Bq , \&Bo , \&Bc Ta enclose in square brackets: Bq text
530.It Ic \&Brq , \&Bro , \&Brc Ta enclose in curly braces: Brq text
531.It Ic \&Aq , \&Ao , \&Ac Ta enclose in angle brackets: Aq text
532.It Ic \&Eo , \&Ec Ta generic enclosure
533.El
534.Ss Text production
535.Bl -column "Brq, Bro, Brc" description
536.It Ic \&Ex Fl std Ta standard command exit values: Op Ar utility ...
537.It Ic \&Rv Fl std Ta standard function return values: Op Ar function ...
538.It Ic \&St Ta reference to a standards document (one argument)
539.It Ic \&At Ta At
540.It Ic \&Bx Ta Bx
541.It Ic \&Bsx Ta Bsx
542.It Ic \&Nx Ta Nx
543.It Ic \&Fx Ta Fx
544.It Ic \&Ox Ta Ox
545.It Ic \&Dx Ta Dx
546.El
547.Sh MACRO REFERENCE
548This section is a canonical reference of all macros, arranged
549alphabetically.
550For the scoping of individual macros, see
551.Sx MACRO SYNTAX .
552.Bl -tag -width 3n
553.It Ic \&%A Ar first_name ... last_name
554Author name of an
555.Ic \&Rs
556block.
557Multiple authors should each be accorded their own
558.Ic \%%A
559line.
560Author names should be ordered with full or abbreviated forename(s)
561first, then full surname.
562.It Ic \&%B Ar title
563Book title of an
564.Ic \&Rs
565block.
566This macro may also be used in a non-bibliographic context when
567referring to book titles.
568.It Ic \&%C Ar location
569Publication city or location of an
570.Ic \&Rs
571block.
572.It Ic \&%D Oo Ar month day , Oc Ar year
573Publication date of an
574.Ic \&Rs
575block.
576Provide the full English name of the
577.Ar month
578and all four digits of the
579.Ar year .
580.It Ic \&%I Ar name
581Publisher or issuer name of an
582.Ic \&Rs
583block.
584.It Ic \&%J Ar name
585Journal name of an
586.Ic \&Rs
587block.
588.It Ic \&%N Ar number
589Issue number (usually for journals) of an
590.Ic \&Rs
591block.
592.It Ic \&%O Ar line
593Optional information of an
594.Ic \&Rs
595block.
596.It Ic \&%P Ar number
597Book or journal page number of an
598.Ic \&Rs
599block.
600Conventionally, the argument starts with
601.Ql p.\&
602for a single page or
603.Ql pp.\&
604for a range of pages, for example:
605.Pp
606.Dl .%P pp. 42\e(en47
607.It Ic \&%Q Ar name
608Institutional author (school, government, etc.) of an
609.Ic \&Rs
610block.
611Multiple institutional authors should each be accorded their own
612.Ic \&%Q
613line.
614.It Ic \&%R Ar name
615Technical report name of an
616.Ic \&Rs
617block.
618.It Ic \&%T Ar title
619Article title of an
620.Ic \&Rs
621block.
622This macro may also be used in a non-bibliographical context when
623referring to article titles.
624.It Ic \&%U Ar protocol Ns :// Ns Ar path
625URI of reference document.
626.It Ic \&%V Ar number
627Volume number of an
628.Ic \&Rs
629block.
630.It Ic \&Ac
631Close an
632.Ic \&Ao
633block.
634Does not have any tail arguments.
635.It Ic \&Ad Ar address
636Memory address.
637Do not use this for postal addresses.
638.Pp
639Examples:
640.Dl \&.Ad [0,$]
641.Dl \&.Ad 0x00000000
642.It Ic \&An Fl split | nosplit | Ar first_name ... last_name
643Author name.
644Can be used both for the authors of the program, function, or driver
645documented in the manual, or for the authors of the manual itself.
646Requires either the name of an author or one of the following arguments:
647.Pp
648.Bl -tag -width "-nosplitX" -offset indent -compact
649.It Fl split
650Start a new output line before each subsequent invocation of
651.Ic \&An .
652.It Fl nosplit
653The opposite of
654.Fl split .
655.El
656.Pp
657The default is
658.Fl nosplit .
659The effect of selecting either of the
660.Fl split
661modes ends at the beginning of the
662.Em AUTHORS
663section.
664In the
665.Em AUTHORS
666section, the default is
667.Fl nosplit
668for the first author listing and
669.Fl split
670for all other author listings.
671.Pp
672Examples:
673.Dl \&.An -nosplit
674.Dl \&.An Kristaps Dzonsons \&Aq \&Mt kristaps@bsd.lv
675.It Ic \&Ao Ar block
676Begin a block enclosed by angle brackets.
677Does not have any head arguments.
678This macro is almost never useful.
679See
680.Ic \&Aq
681for more details.
682.It Ic \&Ap
683Inserts an apostrophe without any surrounding whitespace.
684This is generally used as a grammatical device when referring to the verb
685form of a function.
686.Pp
687Examples:
688.Dl \&.Fn execve \&Ap d
689.It Ic \&Aq Ar line
690Enclose the rest of the input line in angle brackets.
691The only important use case is for email addresses.
692See
693.Ic \&Mt
694for an example.
695.Pp
696Occasionally, it is used for names of characters and keys, for example:
697.Bd -literal -offset indent
698Press the
699\&.Aq escape
700key to ...
701.Ed
702.Pp
703For URIs, use
704.Ic \&Lk
705instead, and
706.Ic \&In
707for
708.Dq #include
709directives.
710Never wrap
711.Ic \&Ar
712in
713.Ic \&Aq .
714.Pp
715Since
716.Ic \&Aq
717usually renders with non-ASCII characters in non-ASCII output modes,
718do not use it where the ASCII characters
719.Sq <
720and
721.Sq >
722are required as syntax elements.
723Instead, use these characters directly in such cases, combining them
724with the macros
725.Ic \&Pf ,
726.Ic \&Ns ,
727or
728.Ic \&Eo
729as needed.
730.Pp
731See also
732.Ic \&Ao .
733.It Ic \&Ar Op Ar placeholder ...
734Command arguments.
735If an argument is not provided, the string
736.Dq file ...\&
737is used as a default.
738.Pp
739Examples:
740.Dl ".Fl o Ar file"
741.Dl ".Ar"
742.Dl ".Ar arg1 , arg2 ."
743.Pp
744The arguments to the
745.Ic \&Ar
746macro are names and placeholders for command arguments;
747for fixed strings to be passed verbatim as arguments, use
748.Ic \&Fl
749or
750.Ic \&Cm .
751.It Ic \&At Op Ar version
752Formats an
753.At
754version.
755Accepts one optional argument:
756.Pp
757.Bl -tag -width "v[1-7] | 32vX" -offset indent -compact
758.It Cm v[1-7] | 32v
759A version of
760.At .
761.It Cm III
762.At III .
763.It Cm V | V.[1-4]
764A version of
765.At V .
766.El
767.Pp
768Note that these arguments do not begin with a hyphen.
769.Pp
770Examples:
771.Dl \&.At
772.Dl \&.At III
773.Dl \&.At V.1
774.Pp
775See also
776.Ic \&Bsx ,
777.Ic \&Bx ,
778.Ic \&Dx ,
779.Ic \&Fx ,
780.Ic \&Nx ,
781and
782.Ic \&Ox .
783.It Ic \&Bc
784Close a
785.Ic \&Bo
786block.
787Does not have any tail arguments.
788.It Ic \&Bd Fl Ns Ar type Oo Fl offset Ar width Oc Op Fl compact
789Begin a display block.
790Display blocks are used to select a different indentation and
791justification than the one used by the surrounding text.
792They may contain both macro lines and text lines.
793By default, a display block is preceded by a vertical space.
794.Pp
795The
796.Ar type
797must be one of the following:
798.Bl -tag -width 13n -offset indent
799.It Fl centered
800Produce one output line from each input line, and center-justify each line.
801Using this display type is not recommended; many
802.Nm
803implementations render it poorly.
804.It Fl filled
805Change the positions of line breaks to fill each line, and left- and
806right-justify the resulting block.
807.It Fl literal
808Produce one output line from each input line,
809and do not justify the block at all.
810Preserve white space as it appears in the input.
811Always use a constant-width font.
812Use this for displaying source code.
813.It Fl ragged
814Change the positions of line breaks to fill each line, and left-justify
815the resulting block.
816.It Fl unfilled
817The same as
818.Fl literal ,
819but using the same font as for normal text, which is a variable width font
820if supported by the output device.
821.El
822.Pp
823The
824.Ar type
825must be provided first.
826Additional arguments may follow:
827.Bl -tag -width 13n -offset indent
828.It Fl offset Ar width
829Indent the display by the
830.Ar width ,
831which may be one of the following:
832.Bl -item
833.It
834One of the pre-defined strings
835.Cm indent ,
836the width of a standard indentation (six constant width characters);
837.Cm indent-two ,
838twice
839.Cm indent ;
840.Cm left ,
841which has no effect;
842.Cm right ,
843which justifies to the right margin; or
844.Cm center ,
845which aligns around an imagined center axis.
846.It
847A macro invocation, which selects a predefined width
848associated with that macro.
849The most popular is the imaginary macro
850.Ar \&Ds ,
851which resolves to
852.Sy 6n .
853.It
854A scaling width as described in
855.Xr roff 7 .
856.It
857An arbitrary string, which indents by the length of this string.
858.El
859.Pp
860When the argument is missing,
861.Fl offset
862is ignored.
863.It Fl compact
864Do not assert vertical space before the display.
865.El
866.Pp
867Examples:
868.Bd -literal -offset indent
869\&.Bd \-literal \-offset indent \-compact
870   Hello       world.
871\&.Ed
872.Ed
873.Pp
874See also
875.Ic \&D1
876and
877.Ic \&Dl .
878.It Ic \&Bf Fl emphasis | literal | symbolic | Cm \&Em | \&Li | \&Sy
879Change the font mode for a scoped block of text.
880The
881.Fl emphasis
882and
883.Cm \&Em
884argument are equivalent, as are
885.Fl symbolic
886and
887.Cm \&Sy ,
888and
889.Fl literal
890and
891.Cm \&Li .
892Without an argument, this macro does nothing.
893The font mode continues until broken by a new font mode in a nested
894scope or
895.Ic \&Ef
896is encountered.
897.Pp
898See also
899.Ic \&Li ,
900.Ic \&Ef ,
901.Ic \&Em ,
902and
903.Ic \&Sy .
904.It Ic \&Bk Fl words
905For each macro, keep its output together on the same output line,
906until the end of the macro or the end of the input line is reached,
907whichever comes first.
908Line breaks in text lines are unaffected.
909.Pp
910The
911.Fl words
912argument is required; additional arguments are ignored.
913.Pp
914The following example will not break within each
915.Ic \&Op
916macro line:
917.Bd -literal -offset indent
918\&.Bk \-words
919\&.Op Fl f Ar flags
920\&.Op Fl o Ar output
921\&.Ek
922.Ed
923.Pp
924Be careful in using over-long lines within a keep block!
925Doing so will clobber the right margin.
926.It Xo
927.Ic \&Bl
928.Fl Ns Ar type
929.Op Fl width Ar val
930.Op Fl offset Ar val
931.Op Fl compact
932.Op Ar col ...
933.Xc
934Begin a list.
935Lists consist of items specified using the
936.Ic \&It
937macro, containing a head or a body or both.
938.Pp
939The list
940.Ar type
941is mandatory and must be specified first.
942The
943.Fl width
944and
945.Fl offset
946arguments accept macro names as described for
947.Ic \&Bd
948.Fl offset ,
949scaling widths as described in
950.Xr roff 7 ,
951or use the length of the given string.
952The
953.Fl offset
954is a global indentation for the whole list, affecting both item heads
955and bodies.
956For those list types supporting it, the
957.Fl width
958argument requests an additional indentation of item bodies,
959to be added to the
960.Fl offset .
961Unless the
962.Fl compact
963argument is specified, list entries are separated by vertical space.
964.Pp
965A list must specify one of the following list types:
966.Bl -tag -width 12n -offset indent
967.It Fl bullet
968No item heads can be specified, but a bullet will be printed at the head
969of each item.
970Item bodies start on the same output line as the bullet
971and are indented according to the
972.Fl width
973argument.
974.It Fl column
975A columnated list.
976The
977.Fl width
978argument has no effect; instead, the string length of each argument
979specifies the width of one column.
980If the first line of the body of a
981.Fl column
982list is not an
983.Ic \&It
984macro line,
985.Ic \&It
986contexts spanning one input line each are implied until an
987.Ic \&It
988macro line is encountered, at which point items start being interpreted as
989described in the
990.Ic \&It
991documentation.
992.It Fl dash
993Like
994.Fl bullet ,
995except that dashes are used in place of bullets.
996.It Fl diag
997Like
998.Fl inset ,
999except that item heads are not parsed for macro invocations.
1000Most often used in the
1001.Em DIAGNOSTICS
1002section with error constants in the item heads.
1003.It Fl enum
1004A numbered list.
1005No item heads can be specified.
1006Formatted like
1007.Fl bullet ,
1008except that cardinal numbers are used in place of bullets,
1009starting at 1.
1010.It Fl hang
1011Like
1012.Fl tag ,
1013except that the first lines of item bodies are not indented, but follow
1014the item heads like in
1015.Fl inset
1016lists.
1017.It Fl hyphen
1018Synonym for
1019.Fl dash .
1020.It Fl inset
1021Item bodies follow items heads on the same line, using normal inter-word
1022spacing.
1023Bodies are not indented, and the
1024.Fl width
1025argument is ignored.
1026.It Fl item
1027No item heads can be specified, and none are printed.
1028Bodies are not indented, and the
1029.Fl width
1030argument is ignored.
1031.It Fl ohang
1032Item bodies start on the line following item heads and are not indented.
1033The
1034.Fl width
1035argument is ignored.
1036.It Fl tag
1037Item bodies are indented according to the
1038.Fl width
1039argument.
1040When an item head fits inside the indentation, the item body follows
1041this head on the same output line.
1042Otherwise, the body starts on the output line following the head.
1043.El
1044.Pp
1045Lists may be nested within lists and displays.
1046Nesting of
1047.Fl column
1048and
1049.Fl enum
1050lists may not be portable.
1051.Pp
1052See also
1053.Ic \&El
1054and
1055.Ic \&It .
1056.It Ic \&Bo Ar block
1057Begin a block enclosed by square brackets.
1058Does not have any head arguments.
1059.Pp
1060Examples:
1061.Bd -literal -offset indent -compact
1062\&.Bo 1 ,
1063\&.Dv BUFSIZ \&Bc
1064.Ed
1065.Pp
1066See also
1067.Ic \&Bq .
1068.It Ic \&Bq Ar line
1069Encloses its arguments in square brackets.
1070.Pp
1071Examples:
1072.Dl \&.Bq 1 , \&Dv BUFSIZ
1073.Pp
1074.Em Remarks :
1075this macro is sometimes abused to emulate optional arguments for
1076commands; the correct macros to use for this purpose are
1077.Ic \&Op ,
1078.Ic \&Oo ,
1079and
1080.Ic \&Oc .
1081.Pp
1082See also
1083.Ic \&Bo .
1084.It Ic \&Brc
1085Close a
1086.Ic \&Bro
1087block.
1088Does not have any tail arguments.
1089.It Ic \&Bro Ar block
1090Begin a block enclosed by curly braces.
1091Does not have any head arguments.
1092.Pp
1093Examples:
1094.Bd -literal -offset indent -compact
1095\&.Bro 1 , ... ,
1096\&.Va n \&Brc
1097.Ed
1098.Pp
1099See also
1100.Ic \&Brq .
1101.It Ic \&Brq Ar line
1102Encloses its arguments in curly braces.
1103.Pp
1104Examples:
1105.Dl \&.Brq 1 , ... , \&Va n
1106.Pp
1107See also
1108.Ic \&Bro .
1109.It Ic \&Bsx Op Ar version
1110Format the
1111.Bsx
1112version provided as an argument, or a default value if
1113no argument is provided.
1114.Pp
1115Examples:
1116.Dl \&.Bsx 1.0
1117.Dl \&.Bsx
1118.Pp
1119See also
1120.Ic \&At ,
1121.Ic \&Bx ,
1122.Ic \&Dx ,
1123.Ic \&Fx ,
1124.Ic \&Nx ,
1125and
1126.Ic \&Ox .
1127.It Ic \&Bt
1128Supported only for compatibility, do not use this in new manuals.
1129Prints
1130.Dq is currently in beta test.
1131.It Ic \&Bx Op Ar version Op Ar variant
1132Format the
1133.Bx
1134version provided as an argument, or a default value if no
1135argument is provided.
1136.Pp
1137Examples:
1138.Dl \&.Bx 4.3 Tahoe
1139.Dl \&.Bx 4.4
1140.Dl \&.Bx
1141.Pp
1142See also
1143.Ic \&At ,
1144.Ic \&Bsx ,
1145.Ic \&Dx ,
1146.Ic \&Fx ,
1147.Ic \&Nx ,
1148and
1149.Ic \&Ox .
1150.It Ic \&Cd Ar line
1151Kernel configuration declaration.
1152This denotes strings accepted by
1153.Xr config 8 .
1154It is most often used in section 4 manual pages.
1155.Pp
1156Examples:
1157.Dl \&.Cd device le0 at scode?
1158.Pp
1159.Em Remarks :
1160this macro is commonly abused by using quoted literals to retain
1161whitespace and align consecutive
1162.Ic \&Cd
1163declarations.
1164This practise is discouraged.
1165.It Ic \&Cm Ar keyword ...
1166Command modifiers.
1167Typically used for fixed strings passed as arguments to interactive
1168commands, to commands in interpreted scripts, or to configuration
1169file directives, unless
1170.Ic \&Fl
1171is more appropriate.
1172.Pp
1173Examples:
1174.Dl ".Nm mt Fl f Ar device Cm rewind"
1175.Dl ".Nm ps Fl o Cm pid , Ns Cm command"
1176.Dl ".Nm dd Cm if= Ns Ar file1 Cm of= Ns Ar file2"
1177.Dl ".Ic set Fl o Cm vi"
1178.Dl ".Ic lookup Cm file bind"
1179.Dl ".Ic permit Ar identity Op Cm as Ar target"
1180.It Ic \&D1 Ar line
1181One-line indented display.
1182This is formatted by the default rules and is useful for simple indented
1183statements.
1184It is followed by a newline.
1185.Pp
1186Examples:
1187.Dl \&.D1 \&Fl abcdefgh
1188.Pp
1189See also
1190.Ic \&Bd
1191and
1192.Ic \&Dl .
1193.It Ic \&Db
1194This macro is obsolete.
1195No replacement is needed.
1196It is ignored by
1197.Xr mandoc 1
1198and groff including its arguments.
1199It was formerly used to toggle a debugging mode.
1200.It Ic \&Dc
1201Close a
1202.Ic \&Do
1203block.
1204Does not have any tail arguments.
1205.It Ic \&Dd Cm $\&Mdocdate$ | Ar month day , year
1206Document date for display in the page footer,
1207by convention the date of the last change.
1208This is the mandatory first macro of any
1209.Nm
1210manual.
1211.Pp
1212The
1213.Ar month
1214is the full English month name, the
1215.Ar day
1216is an integer number, and the
1217.Ar year
1218is the full four-digit year.
1219.Pp
1220Other arguments are not portable; the
1221.Xr mandoc 1
1222utility handles them as follows:
1223.Bl -dash -offset 3n -compact
1224.It
1225To have the date automatically filled in by the
1226.Ox
1227version of
1228.Xr cvs 1 ,
1229the special string
1230.Dq $\&Mdocdate$
1231can be given as an argument.
1232.It
1233The traditional, purely numeric
1234.Xr man 7
1235format
1236.Ar year Ns \(en Ns Ar month Ns \(en Ns Ar day
1237is accepted, too.
1238.It
1239If a date string cannot be parsed, it is used verbatim.
1240.It
1241If no date string is given, the current date is used.
1242.El
1243.Pp
1244Examples:
1245.Dl \&.Dd $\&Mdocdate$
1246.Dl \&.Dd $\&Mdocdate: July 2 2018$
1247.Dl \&.Dd July 2, 2018
1248.Pp
1249See also
1250.Ic \&Dt
1251and
1252.Ic \&Os .
1253.It Ic \&Dl Ar line
1254One-line indented display.
1255This is formatted as literal text and is useful for commands and
1256invocations.
1257It is followed by a newline.
1258.Pp
1259Examples:
1260.Dl \&.Dl % mandoc mdoc.7 \e(ba less
1261.Pp
1262See also
1263.Ic \&Ql ,
1264.Ic \&Bd Fl literal ,
1265and
1266.Ic \&D1 .
1267.It Ic \&Do Ar block
1268Begin a block enclosed by double quotes.
1269Does not have any head arguments.
1270.Pp
1271Examples:
1272.Bd -literal -offset indent -compact
1273\&.Do
1274April is the cruellest month
1275\&.Dc
1276\e(em T.S. Eliot
1277.Ed
1278.Pp
1279See also
1280.Ic \&Dq .
1281.It Ic \&Dq Ar line
1282Encloses its arguments in
1283.Dq typographic
1284double-quotes.
1285.Pp
1286Examples:
1287.Bd -literal -offset indent -compact
1288\&.Dq April is the cruellest month
1289\e(em T.S. Eliot
1290.Ed
1291.Pp
1292See also
1293.Ic \&Qq ,
1294.Ic \&Sq ,
1295and
1296.Ic \&Do .
1297.It Ic \&Dt Ar TITLE section Op Ar arch
1298Document title for display in the page header.
1299This is the mandatory second macro of any
1300.Nm
1301file.
1302.Pp
1303Its arguments are as follows:
1304.Bl -tag -width section -offset 2n
1305.It Ar TITLE
1306The document's title (name), defaulting to
1307.Dq UNTITLED
1308if unspecified.
1309To achieve a uniform appearance of page header lines,
1310it should by convention be all caps.
1311.It Ar section
1312The manual section.
1313This may be one of
1314.Cm 1
1315.Pq General Commands ,
1316.Cm 2
1317.Pq System Calls ,
1318.Cm 3
1319.Pq Library Functions ,
1320.Cm 3p
1321.Pq Perl Library ,
1322.Cm 4
1323.Pq Device Drivers ,
1324.Cm 5
1325.Pq File Formats ,
1326.Cm 6
1327.Pq Games ,
1328.Cm 7
1329.Pq Miscellaneous Information ,
1330.Cm 8
1331.Pq System Manager's Manual ,
1332or
1333.Cm 9
1334.Pq Kernel Developer's Manual .
1335It should correspond to the manual's filename suffix and defaults to
1336the empty string if unspecified.
1337.It Ar arch
1338This specifies the machine architecture a manual page applies to,
1339where relevant.
1340For
1341.Ox ,
1342the following are valid architectures:
1343.Cm alpha ,
1344.Cm amd64 ,
1345.Cm armv7 ,
1346.Cm arm64 ,
1347.Cm hppa ,
1348.Cm i386 ,
1349.Cm landisk ,
1350.Cm loongson ,
1351.Cm luna88k ,
1352.Cm macppc ,
1353.Cm mips64 ,
1354.Cm octeon ,
1355.Cm powerpc64 ,
1356.Cm sgi ,
1357and
1358.Cm sparc64 .
1359.El
1360.Pp
1361Examples:
1362.Dl \&.Dt FOO 1
1363.Dl \&.Dt FOO 9 i386
1364.Pp
1365See also
1366.Ic \&Dd
1367and
1368.Ic \&Os .
1369.It Ic \&Dv Ar identifier ...
1370Defined variables such as preprocessor constants, constant symbols,
1371enumeration values, and so on.
1372.Pp
1373Examples:
1374.Dl \&.Dv NULL
1375.Dl \&.Dv BUFSIZ
1376.Dl \&.Dv STDOUT_FILENO
1377.Pp
1378See also
1379.Ic \&Er
1380and
1381.Ic \&Ev
1382for special-purpose constants,
1383.Ic \&Va
1384for variable symbols, and
1385.Ic \&Fd
1386for listing preprocessor variable definitions in the
1387.Em SYNOPSIS .
1388.It Ic \&Dx Op Ar version
1389Format the
1390.Dx
1391version provided as an argument, or a default
1392value if no argument is provided.
1393.Pp
1394Examples:
1395.Dl \&.Dx 2.4.1
1396.Dl \&.Dx
1397.Pp
1398See also
1399.Ic \&At ,
1400.Ic \&Bsx ,
1401.Ic \&Bx ,
1402.Ic \&Fx ,
1403.Ic \&Nx ,
1404and
1405.Ic \&Ox .
1406.It Ic \&Ec Op Ar closing_delimiter
1407Close a scope started by
1408.Ic \&Eo .
1409.Pp
1410The
1411.Ar closing_delimiter
1412argument is used as the enclosure tail, for example, specifying \e(rq
1413will emulate
1414.Ic \&Dc .
1415.It Ic \&Ed
1416End a display context started by
1417.Ic \&Bd .
1418.It Ic \&Ef
1419End a font mode context started by
1420.Ic \&Bf .
1421.It Ic \&Ek
1422End a keep context started by
1423.Ic \&Bk .
1424.It Ic \&El
1425End a list context started by
1426.Ic \&Bl .
1427See also
1428.Ic \&It .
1429.It Ic \&Em Ar word ...
1430Request an italic font.
1431If the output device does not provide that, underline.
1432.Pp
1433This is most often used for stress emphasis (not to be confused with
1434importance, see
1435.Ic \&Sy ) .
1436In the rare cases where none of the semantic markup macros fit,
1437it can also be used for technical terms and placeholders, except
1438that for syntax elements,
1439.Ic \&Sy
1440and
1441.Ic \&Ar
1442are preferred, respectively.
1443.Pp
1444Examples:
1445.Bd -literal -compact -offset indent
1446Selected lines are those
1447\&.Em not
1448matching any of the specified patterns.
1449Some of the functions use a
1450\&.Em hold space
1451to save the pattern space for subsequent retrieval.
1452.Ed
1453.Pp
1454See also
1455.Ic \&No ,
1456.Ic \&Ql ,
1457and
1458.Ic \&Sy .
1459.It Ic \&En Ar word ...
1460This macro is obsolete.
1461Use
1462.Ic \&Eo
1463or any of the other enclosure macros.
1464.Pp
1465It encloses its argument in the delimiters specified by the last
1466.Ic \&Es
1467macro.
1468.It Ic \&Eo Op Ar opening_delimiter
1469An arbitrary enclosure.
1470The
1471.Ar opening_delimiter
1472argument is used as the enclosure head, for example, specifying \e(lq
1473will emulate
1474.Ic \&Do .
1475.It Ic \&Er Ar identifier ...
1476Error constants for definitions of the
1477.Va errno
1478libc global variable.
1479This is most often used in section 2 and 3 manual pages.
1480.Pp
1481Examples:
1482.Dl \&.Er EPERM
1483.Dl \&.Er ENOENT
1484.Pp
1485See also
1486.Ic \&Dv
1487for general constants.
1488.It Ic \&Es Ar opening_delimiter closing_delimiter
1489This macro is obsolete.
1490Use
1491.Ic \&Eo
1492or any of the other enclosure macros.
1493.Pp
1494It takes two arguments, defining the delimiters to be used by subsequent
1495.Ic \&En
1496macros.
1497.It Ic \&Ev Ar identifier ...
1498Environmental variables such as those specified in
1499.Xr environ 7 .
1500.Pp
1501Examples:
1502.Dl \&.Ev DISPLAY
1503.Dl \&.Ev PATH
1504.Pp
1505See also
1506.Ic \&Dv
1507for general constants.
1508.It Ic \&Ex Fl std Op Ar utility ...
1509Insert a standard sentence regarding command exit values of 0 on success
1510and >0 on failure.
1511This is most often used in section 1, 6, and 8 manual pages.
1512.Pp
1513If
1514.Ar utility
1515is not specified, the document's name set by
1516.Ic \&Nm
1517is used.
1518Multiple
1519.Ar utility
1520arguments are treated as separate utilities.
1521.Pp
1522See also
1523.Ic \&Rv .
1524.It Ic \&Fa Ar argument ...
1525Function argument or parameter.
1526Each argument may be a name and a type (recommended for the
1527.Em SYNOPSIS
1528section), a name alone (for function invocations),
1529or a type alone (for function prototypes).
1530If both a type and a name are given or if the type consists of multiple
1531words, all words belonging to the same function argument have to be
1532given in a single argument to the
1533.Ic \&Fa
1534macro.
1535.Pp
1536This macro is also used to specify the field name of a structure.
1537.Pp
1538Most often, the
1539.Ic \&Fa
1540macro is used in the
1541.Em SYNOPSIS
1542within
1543.Ic \&Fo
1544blocks when documenting multi-line function prototypes.
1545If invoked with multiple arguments, the arguments are separated by a
1546comma.
1547Furthermore, if the following macro is another
1548.Ic \&Fa ,
1549the last argument will also have a trailing comma.
1550.Pp
1551Examples:
1552.Dl \&.Fa \(dqconst char *p\(dq
1553.Dl \&.Fa \(dqint a\(dq \(dqint b\(dq \(dqint c\(dq
1554.Dl \&.Fa \(dqchar *\(dq size_t
1555.Pp
1556See also
1557.Ic \&Fo .
1558.It Ic \&Fc
1559End a function context started by
1560.Ic \&Fo .
1561.It Ic \&Fd Pf # Ar directive Op Ar argument ...
1562Preprocessor directive, in particular for listing it in the
1563.Em SYNOPSIS .
1564Historically, it was also used to document include files.
1565The latter usage has been deprecated in favour of
1566.Ic \&In .
1567.Pp
1568Examples:
1569.Dl \&.Fd #define sa_handler __sigaction_u.__sa_handler
1570.Dl \&.Fd #define SIO_MAXNFDS
1571.Dl \&.Fd #ifdef FS_DEBUG
1572.Dl \&.Ft void
1573.Dl \&.Fn dbg_open \(dqconst char *\(dq
1574.Dl \&.Fd #endif
1575.Pp
1576See also
1577.Sx MANUAL STRUCTURE ,
1578.Ic \&In ,
1579and
1580.Ic \&Dv .
1581.It Ic \&Fl Op Ar word ...
1582Command-line flag or option.
1583Used when listing arguments to command-line utilities.
1584Prints a fixed-width hyphen
1585.Sq \-
1586directly followed by each argument.
1587If no arguments are provided, a hyphen is printed followed by a space.
1588If the argument is a macro, a hyphen is prefixed to the subsequent macro
1589output.
1590.Pp
1591Examples:
1592.Dl ".Fl R Op Fl H | L | P"
1593.Dl ".Op Fl 1AaCcdFfgHhikLlmnopqRrSsTtux"
1594.Dl ".Fl type Cm d Fl name Pa CVS"
1595.Dl ".Fl Ar signal_number"
1596.Dl ".Fl o Fl"
1597.Pp
1598See also
1599.Ic \&Cm .
1600.It Ic \&Fn Ar funcname Op Ar argument ...
1601A function name.
1602.Pp
1603Function arguments are surrounded in parenthesis and
1604are delimited by commas.
1605If no arguments are specified, blank parenthesis are output.
1606In the
1607.Em SYNOPSIS
1608section, this macro starts a new output line,
1609and a blank line is automatically inserted between function definitions.
1610.Pp
1611Examples:
1612.Dl \&.Fn \(dqint funcname\(dq \(dqint arg0\(dq \(dqint arg1\(dq
1613.Dl \&.Fn funcname \(dqint arg0\(dq
1614.Dl \&.Fn funcname arg0
1615.Bd -literal -offset indent
1616\&.Ft functype
1617\&.Fn funcname
1618.Ed
1619.Pp
1620When referring to a function documented in another manual page, use
1621.Ic \&Xr
1622instead.
1623See also
1624.Sx MANUAL STRUCTURE ,
1625.Ic \&Fo ,
1626and
1627.Ic \&Ft .
1628.It Ic \&Fo Ar funcname
1629Begin a function block.
1630This is a multi-line version of
1631.Ic \&Fn .
1632.Pp
1633Invocations usually occur in the following context:
1634.Bd -ragged -offset indent
1635.Pf \. Ic \&Ft Ar functype
1636.br
1637.Pf \. Ic \&Fo Ar funcname
1638.br
1639.Pf \. Ic \&Fa Qq Ar argtype Ar argname
1640.br
1641\&.\.\.
1642.br
1643.Pf \. Ic \&Fc
1644.Ed
1645.Pp
1646A
1647.Ic \&Fo
1648scope is closed by
1649.Ic \&Fc .
1650.Pp
1651See also
1652.Sx MANUAL STRUCTURE ,
1653.Ic \&Fa ,
1654.Ic \&Fc ,
1655and
1656.Ic \&Ft .
1657.It Ic \&Fr Ar number
1658This macro is obsolete.
1659No replacement markup is needed.
1660.Pp
1661It was used to show numerical function return values in an italic font.
1662.It Ic \&Ft Ar functype
1663A function type.
1664.Pp
1665In the
1666.Em SYNOPSIS
1667section, a new output line is started after this macro.
1668.Pp
1669Examples:
1670.Dl \&.Ft int
1671.Bd -literal -offset indent -compact
1672\&.Ft functype
1673\&.Fn funcname
1674.Ed
1675.Pp
1676See also
1677.Sx MANUAL STRUCTURE ,
1678.Ic \&Fn ,
1679and
1680.Ic \&Fo .
1681.It Ic \&Fx Op Ar version
1682Format the
1683.Fx
1684version provided as an argument, or a default value
1685if no argument is provided.
1686.Pp
1687Examples:
1688.Dl \&.Fx 7.1
1689.Dl \&.Fx
1690.Pp
1691See also
1692.Ic \&At ,
1693.Ic \&Bsx ,
1694.Ic \&Bx ,
1695.Ic \&Dx ,
1696.Ic \&Nx ,
1697and
1698.Ic \&Ox .
1699.It Ic \&Hf Ar filename
1700This macro is not implemented in
1701.Xr mandoc 1 .
1702It was used to include the contents of a (header) file literally.
1703.It Ic \&Ic Ar keyword ...
1704Internal or interactive command, or configuration instruction
1705in a configuration file.
1706See also
1707.Ic \&Cm .
1708.Pp
1709Examples:
1710.Dl \&.Ic :wq
1711.Dl \&.Ic hash
1712.Dl \&.Ic alias
1713.Pp
1714Note that using
1715.Ic \&Ql ,
1716.Ic \&Dl ,
1717or
1718.Ic \&Bd Fl literal
1719is preferred for displaying code samples; the
1720.Ic \&Ic
1721macro is used when referring to an individual command name.
1722.It Ic \&In Ar filename
1723The name of an include file.
1724This macro is most often used in section 2, 3, and 9 manual pages.
1725.Pp
1726When invoked as the first macro on an input line in the
1727.Em SYNOPSIS
1728section, the argument is displayed in angle brackets
1729and preceded by
1730.Qq #include ,
1731and a blank line is inserted in front if there is a preceding
1732function declaration.
1733In other sections, it only encloses its argument in angle brackets
1734and causes no line break.
1735.Pp
1736Examples:
1737.Dl \&.In sys/types.h
1738.Pp
1739See also
1740.Sx MANUAL STRUCTURE .
1741.It Ic \&It Op Ar head
1742A list item.
1743The syntax of this macro depends on the list type.
1744.Pp
1745Lists
1746of type
1747.Fl hang ,
1748.Fl ohang ,
1749.Fl inset ,
1750and
1751.Fl diag
1752have the following syntax:
1753.Pp
1754.D1 Pf \. Ic \&It Ar args
1755.Pp
1756Lists of type
1757.Fl bullet ,
1758.Fl dash ,
1759.Fl enum ,
1760.Fl hyphen
1761and
1762.Fl item
1763have the following syntax:
1764.Pp
1765.D1 Pf \. Ic \&It
1766.Pp
1767with subsequent lines interpreted within the scope of the
1768.Ic \&It
1769until either a closing
1770.Ic \&El
1771or another
1772.Ic \&It .
1773.Pp
1774The
1775.Fl tag
1776list has the following syntax:
1777.Pp
1778.D1 Pf \. Ic \&It Op Cm args
1779.Pp
1780Subsequent lines are interpreted as with
1781.Fl bullet
1782and family.
1783The line arguments correspond to the list's left-hand side; body
1784arguments correspond to the list's contents.
1785.Pp
1786The
1787.Fl column
1788list is the most complicated.
1789Its syntax is as follows:
1790.Pp
1791.D1 Pf \. Ic \&It Ar cell Op Ic \&Ta Ar cell ...
1792.D1 Pf \. Ic \&It Ar cell Op <TAB> Ar cell ...
1793.Pp
1794The arguments consist of one or more lines of text and macros
1795representing a complete table line.
1796Cells within the line are delimited by the special
1797.Ic \&Ta
1798block macro or by literal tab characters.
1799.Pp
1800Using literal tabs is strongly discouraged because they are very
1801hard to use correctly and
1802.Nm
1803code using them is very hard to read.
1804In particular, a blank character is syntactically significant
1805before and after the literal tab character.
1806If a word precedes or follows the tab without an intervening blank,
1807that word is never interpreted as a macro call, but always output
1808literally.
1809.Pp
1810The tab cell delimiter may only be used within the
1811.Ic \&It
1812line itself; on following lines, only the
1813.Ic \&Ta
1814macro can be used to delimit cells, and portability requires that
1815.Ic \&Ta
1816is called by other macros: some parsers do not recognize it when
1817it appears as the first macro on a line.
1818.Pp
1819Note that quoted strings may span tab-delimited cells on an
1820.Ic \&It
1821line.
1822For example,
1823.Pp
1824.Dl .It \(dqcol1 ,\& <TAB> col2 ,\(dq \&;
1825.Pp
1826will preserve the whitespace before both commas,
1827but not the whitespace before the semicolon.
1828.Pp
1829See also
1830.Ic \&Bl .
1831.It Ic \&Lb Cm lib Ns Ar name
1832Specify a library.
1833.Pp
1834The
1835.Ar name
1836parameter may be a system library, such as
1837.Cm z
1838or
1839.Cm pam ,
1840in which case a small library description is printed next to the linker
1841invocation; or a custom library, in which case the library name is
1842printed in quotes.
1843This is most commonly used in the
1844.Em SYNOPSIS
1845section as described in
1846.Sx MANUAL STRUCTURE .
1847.Pp
1848Examples:
1849.Dl \&.Lb libz
1850.Dl \&.Lb libmandoc
1851.It Ic \&Li Ar word ...
1852Request a typewriter (literal) font.
1853Deprecated because on terminal output devices, this is usually
1854indistinguishable from normal text.
1855For literal displays, use
1856.Ic \&Ql Pq in-line ,
1857.Ic \&Dl Pq single line ,
1858or
1859.Ic \&Bd Fl literal Pq multi-line
1860instead.
1861.It Ic \&Lk Ar uri Op Ar display_name
1862Format a hyperlink.
1863.Pp
1864Examples:
1865.Dl \&.Lk https://bsd.lv \(dqThe BSD.lv Project\(dq
1866.Dl \&.Lk https://bsd.lv
1867.Pp
1868See also
1869.Ic \&Mt .
1870.It Ic \&Lp
1871Deprecated synonym for
1872.Ic \&Pp .
1873.It Ic \&Ms Ar name
1874Display a mathematical symbol.
1875.Pp
1876Examples:
1877.Dl \&.Ms sigma
1878.Dl \&.Ms aleph
1879.It Ic \&Mt Ar localpart Ns @ Ns Ar domain
1880Format a
1881.Dq mailto:
1882hyperlink.
1883.Pp
1884Examples:
1885.Dl \&.Mt discuss@manpages.bsd.lv
1886.Dl \&.An Kristaps Dzonsons \&Aq \&Mt kristaps@bsd.lv
1887.It Ic \&Nd Ar line
1888A one line description of the manual's content.
1889This is the mandatory last macro of the
1890.Em NAME
1891section and not appropriate for other sections.
1892.Pp
1893Examples:
1894.Dl Pf . Ic \&Nd mdoc language reference
1895.Dl Pf . Ic \&Nd format and display UNIX manuals
1896.Pp
1897The
1898.Ic \&Nd
1899macro technically accepts child macros and terminates with a subsequent
1900.Ic \&Sh
1901invocation.
1902Do not assume this behaviour: some
1903.Xr whatis 1
1904database generators are not smart enough to parse more than the line
1905arguments and will display macros verbatim.
1906.Pp
1907See also
1908.Ic \&Nm .
1909.It Ic \&Nm Op Ar name
1910The name of the manual page, or \(em in particular in section 1, 6,
1911and 8 pages \(em of an additional command or feature documented in
1912the manual page.
1913When first invoked, the
1914.Ic \&Nm
1915macro expects a single argument, the name of the manual page.
1916Usually, the first invocation happens in the
1917.Em NAME
1918section of the page.
1919The specified name will be remembered and used whenever the macro is
1920called again without arguments later in the page.
1921The
1922.Ic \&Nm
1923macro uses
1924.Sx Block full-implicit
1925semantics when invoked as the first macro on an input line in the
1926.Em SYNOPSIS
1927section; otherwise, it uses ordinary
1928.Sx In-line
1929semantics.
1930.Pp
1931Examples:
1932.Bd -literal -offset indent
1933\&.Sh SYNOPSIS
1934\&.Nm cat
1935\&.Op Fl benstuv
1936\&.Op Ar
1937.Ed
1938.Pp
1939In the
1940.Em SYNOPSIS
1941of section 2, 3 and 9 manual pages, use the
1942.Ic \&Fn
1943macro rather than
1944.Ic \&Nm
1945to mark up the name of the manual page.
1946.It Ic \&No Ar word ...
1947Normal text.
1948Closes the scope of any preceding in-line macro.
1949When used after physical formatting macros like
1950.Ic \&Em
1951or
1952.Ic \&Sy ,
1953switches back to the standard font face and weight.
1954Can also be used to embed plain text strings in macro lines
1955using semantic annotation macros.
1956.Pp
1957Examples:
1958.Dl ".Em italic , Sy bold , No and roman"
1959.Bd -literal -offset indent
1960\&.Sm off
1961\&.Cm :C No / Ar pattern No / Ar replacement No /
1962\&.Sm on
1963.Ed
1964.Pp
1965See also
1966.Ic \&Em ,
1967.Ic \&Ql ,
1968and
1969.Ic \&Sy .
1970.It Ic \&Ns
1971Suppress a space between the output of the preceding macro
1972and the following text or macro.
1973Following invocation, input is interpreted as normal text
1974just like after an
1975.Ic \&No
1976macro.
1977.Pp
1978This has no effect when invoked at the start of a macro line.
1979.Pp
1980Examples:
1981.Dl ".Ar name Ns = Ns Ar value"
1982.Dl ".Cm :M Ns Ar pattern"
1983.Dl ".Fl o Ns Ar output"
1984.Pp
1985See also
1986.Ic \&No
1987and
1988.Ic \&Sm .
1989.It Ic \&Nx Op Ar version
1990Format the
1991.Nx
1992version provided as an argument, or a default value if
1993no argument is provided.
1994.Pp
1995Examples:
1996.Dl \&.Nx 5.01
1997.Dl \&.Nx
1998.Pp
1999See also
2000.Ic \&At ,
2001.Ic \&Bsx ,
2002.Ic \&Bx ,
2003.Ic \&Dx ,
2004.Ic \&Fx ,
2005and
2006.Ic \&Ox .
2007.It Ic \&Oc
2008Close multi-line
2009.Ic \&Oo
2010context.
2011.It Ic \&Oo Ar block
2012Multi-line version of
2013.Ic \&Op .
2014.Pp
2015Examples:
2016.Bd -literal -offset indent -compact
2017\&.Oo
2018\&.Op Fl flag Ns Ar value
2019\&.Oc
2020.Ed
2021.It Ic \&Op Ar line
2022Optional part of a command line.
2023Prints the argument(s) in brackets.
2024This is most often used in the
2025.Em SYNOPSIS
2026section of section 1 and 8 manual pages.
2027.Pp
2028Examples:
2029.Dl \&.Op \&Fl a \&Ar b
2030.Dl \&.Op \&Ar a | b
2031.Pp
2032See also
2033.Ic \&Oo .
2034.It Ic \&Os Op Ar system Op Ar version
2035Operating system version for display in the page footer.
2036This is the mandatory third macro of
2037any
2038.Nm
2039file.
2040.Pp
2041The optional
2042.Ar system
2043parameter specifies the relevant operating system or environment.
2044It is suggested to leave it unspecified, in which case
2045.Xr mandoc 1
2046uses its
2047.Fl Ios
2048argument or, if that isn't specified either,
2049.Fa sysname
2050and
2051.Fa release
2052as returned by
2053.Xr uname 3 .
2054.Pp
2055Examples:
2056.Dl \&.Os
2057.Dl \&.Os KTH/CSC/TCS
2058.Dl \&.Os BSD 4.3
2059.Pp
2060See also
2061.Ic \&Dd
2062and
2063.Ic \&Dt .
2064.It Ic \&Ot Ar functype
2065This macro is obsolete.
2066Use
2067.Ic \&Ft
2068instead; with
2069.Xr mandoc 1 ,
2070both have the same effect.
2071.Pp
2072Historical
2073.Nm
2074packages described it as
2075.Dq "old function type (FORTRAN)" .
2076.It Ic \&Ox Op Ar version
2077Format the
2078.Ox
2079version provided as an argument, or a default value
2080if no argument is provided.
2081.Pp
2082Examples:
2083.Dl \&.Ox 4.5
2084.Dl \&.Ox
2085.Pp
2086See also
2087.Ic \&At ,
2088.Ic \&Bsx ,
2089.Ic \&Bx ,
2090.Ic \&Dx ,
2091.Ic \&Fx ,
2092and
2093.Ic \&Nx .
2094.It Ic \&Pa Ar name ...
2095An absolute or relative file system path, or a file or directory name.
2096If an argument is not provided, the character
2097.Sq \(ti
2098is used as a default.
2099.Pp
2100Examples:
2101.Dl \&.Pa /usr/bin/mandoc
2102.Dl \&.Pa /usr/share/man/man7/mdoc.7
2103.Pp
2104See also
2105.Ic \&Lk .
2106.It Ic \&Pc
2107Close parenthesised context opened by
2108.Ic \&Po .
2109.It Ic \&Pf Ar prefix macro Op Ar argument ...
2110Removes the space between its argument and the following macro.
2111It is equivalent to:
2112.Pp
2113.D1 Ic \&No Pf \e& Ar prefix Ic \&Ns Ar macro Op Ar argument ...
2114.Pp
2115The
2116.Ar prefix
2117argument is not parsed for macro names or delimiters,
2118but used verbatim as if it were escaped.
2119.Pp
2120Examples:
2121.Dl ".Pf $ Ar variable_name"
2122.Dl ".Pf . Ar macro_name"
2123.Dl ".Pf 0x Ar hex_digits"
2124.Pp
2125See also
2126.Ic \&Ns
2127and
2128.Ic \&Sm .
2129.It Ic \&Po Ar block
2130Multi-line version of
2131.Ic \&Pq .
2132.It Ic \&Pp
2133Break a paragraph.
2134This will assert vertical space between prior and subsequent macros
2135and/or text.
2136.Pp
2137Paragraph breaks are not needed before or after
2138.Ic \&Sh
2139or
2140.Ic \&Ss
2141macros or before displays
2142.Pq Ic \&Bd Ar line
2143or lists
2144.Pq Ic \&Bl
2145unless the
2146.Fl compact
2147flag is given.
2148.It Ic \&Pq Ar line
2149Parenthesised enclosure.
2150.Pp
2151See also
2152.Ic \&Po .
2153.It Ic \&Qc
2154Close quoted context opened by
2155.Ic \&Qo .
2156.It Ic \&Ql Ar line
2157In-line literal display.
2158This can be used for complete command invocations and for multi-word
2159code examples when an indented display is not desired.
2160.Pp
2161See also
2162.Ic \&Dl
2163and
2164.Ic \&Bd
2165.Fl literal .
2166.It Ic \&Qo Ar block
2167Multi-line version of
2168.Ic \&Qq .
2169.It Ic \&Qq Ar line
2170Encloses its arguments in
2171.Qq typewriter
2172double-quotes.
2173Consider using
2174.Ic \&Dq .
2175.Pp
2176See also
2177.Ic \&Dq ,
2178.Ic \&Sq ,
2179and
2180.Ic \&Qo .
2181.It Ic \&Re
2182Close an
2183.Ic \&Rs
2184block.
2185Does not have any tail arguments.
2186.It Ic \&Rs
2187Begin a bibliographic
2188.Pq Dq reference
2189block.
2190Does not have any head arguments.
2191The block macro may only contain
2192.Ic \&%A ,
2193.Ic \&%B ,
2194.Ic \&%C ,
2195.Ic \&%D ,
2196.Ic \&%I ,
2197.Ic \&%J ,
2198.Ic \&%N ,
2199.Ic \&%O ,
2200.Ic \&%P ,
2201.Ic \&%Q ,
2202.Ic \&%R ,
2203.Ic \&%T ,
2204.Ic \&%U ,
2205and
2206.Ic \&%V
2207child macros (at least one must be specified).
2208.Pp
2209Examples:
2210.Bd -literal -offset indent -compact
2211\&.Rs
2212\&.%A J. E. Hopcroft
2213\&.%A J. D. Ullman
2214\&.%B Introduction to Automata Theory, Languages, and Computation
2215\&.%I Addison-Wesley
2216\&.%C Reading, Massachusetts
2217\&.%D 1979
2218\&.Re
2219.Ed
2220.Pp
2221If an
2222.Ic \&Rs
2223block is used within a SEE ALSO section, a vertical space is asserted
2224before the rendered output, else the block continues on the current
2225line.
2226.It Ic \&Rv Fl std Op Ar function ...
2227Insert a standard sentence regarding a function call's return value of 0
2228on success and \-1 on error, with the
2229.Va errno
2230libc global variable set on error.
2231.Pp
2232If
2233.Ar function
2234is not specified, the document's name set by
2235.Ic \&Nm
2236is used.
2237Multiple
2238.Ar function
2239arguments are treated as separate functions.
2240.Pp
2241See also
2242.Ic \&Ex .
2243.It Ic \&Sc
2244Close single-quoted context opened by
2245.Ic \&So .
2246.It Ic \&Sh Ar TITLE LINE
2247Begin a new section.
2248For a list of conventional manual sections, see
2249.Sx MANUAL STRUCTURE .
2250These sections should be used unless it's absolutely necessary that
2251custom sections be used.
2252.Pp
2253Section names should be unique so that they may be keyed by
2254.Ic \&Sx .
2255Although this macro is parsed, it should not consist of child node or it
2256may not be linked with
2257.Ic \&Sx .
2258.Pp
2259See also
2260.Ic \&Pp ,
2261.Ic \&Ss ,
2262and
2263.Ic \&Sx .
2264.It Ic \&Sm Op Cm on | off
2265Switches the spacing mode for output generated from macros.
2266.Pp
2267By default, spacing is
2268.Cm on .
2269When switched
2270.Cm off ,
2271no white space is inserted between macro arguments and between the
2272output generated from adjacent macros, but text lines
2273still get normal spacing between words and sentences.
2274.Pp
2275When called without an argument, the
2276.Ic \&Sm
2277macro toggles the spacing mode.
2278Using this is not recommended because it makes the code harder to read.
2279.It Ic \&So Ar block
2280Multi-line version of
2281.Ic \&Sq .
2282.It Ic \&Sq Ar line
2283Encloses its arguments in
2284.Sq typewriter
2285single-quotes.
2286.Pp
2287See also
2288.Ic \&Dq ,
2289.Ic \&Qq ,
2290and
2291.Ic \&So .
2292.It Ic \&Ss Ar Title line
2293Begin a new subsection.
2294Unlike with
2295.Ic \&Sh ,
2296there is no convention for the naming of subsections.
2297Except
2298.Em DESCRIPTION ,
2299the conventional sections described in
2300.Sx MANUAL STRUCTURE
2301rarely have subsections.
2302.Pp
2303Sub-section names should be unique so that they may be keyed by
2304.Ic \&Sx .
2305Although this macro is parsed, it should not consist of child node or it
2306may not be linked with
2307.Ic \&Sx .
2308.Pp
2309See also
2310.Ic \&Pp ,
2311.Ic \&Sh ,
2312and
2313.Ic \&Sx .
2314.It Ic \&St Fl Ns Ar abbreviation
2315Replace an abbreviation for a standard with the full form.
2316The following standards are recognised.
2317Where multiple lines are given without a blank line in between,
2318they all refer to the same standard, and using the first form
2319is recommended.
2320.Bl -tag -width 1n
2321.It C language standards
2322.Pp
2323.Bl -tag -width "-p1003.1g-2000" -compact
2324.It \-ansiC
2325.St -ansiC
2326.It \-ansiC-89
2327.St -ansiC-89
2328.It \-isoC
2329.St -isoC
2330.It \-isoC-90
2331.St -isoC-90
2332.br
2333The original C standard.
2334.Pp
2335.It \-isoC-amd1
2336.St -isoC-amd1
2337.Pp
2338.It \-isoC-tcor1
2339.St -isoC-tcor1
2340.Pp
2341.It \-isoC-tcor2
2342.St -isoC-tcor2
2343.Pp
2344.It \-isoC-99
2345.St -isoC-99
2346.br
2347The second major version of the C language standard.
2348.Pp
2349.It \-isoC-2011
2350.St -isoC-2011
2351.br
2352The third major version of the C language standard.
2353.El
2354.It POSIX.1 before the Single UNIX Specification
2355.Pp
2356.Bl -tag -width "-p1003.1g-2000" -compact
2357.It \-p1003.1-88
2358.St -p1003.1-88
2359.It \-p1003.1
2360.St -p1003.1
2361.br
2362The original POSIX standard, based on ANSI C.
2363.Pp
2364.It \-p1003.1-90
2365.St -p1003.1-90
2366.It \-iso9945-1-90
2367.St -iso9945-1-90
2368.br
2369The first update of POSIX.1.
2370.Pp
2371.It \-p1003.1b-93
2372.St -p1003.1b-93
2373.It \-p1003.1b
2374.St -p1003.1b
2375.br
2376Real-time extensions.
2377.Pp
2378.It \-p1003.1c-95
2379.St -p1003.1c-95
2380.br
2381POSIX thread interfaces.
2382.Pp
2383.It \-p1003.1i-95
2384.St -p1003.1i-95
2385.br
2386Technical Corrigendum.
2387.Pp
2388.It \-p1003.1-96
2389.St -p1003.1-96
2390.It \-iso9945-1-96
2391.St -iso9945-1-96
2392.br
2393Includes POSIX.1-1990, 1b, 1c, and 1i.
2394.El
2395.It X/Open Portability Guide version 4 and related standards
2396.Pp
2397.Bl -tag -width "-p1003.1g-2000" -compact
2398.It \-xpg3
2399.St -xpg3
2400.br
2401An XPG4 precursor, published in 1989.
2402.Pp
2403.It \-p1003.2
2404.St -p1003.2
2405.It \-p1003.2-92
2406.St -p1003.2-92
2407.It \-iso9945-2-93
2408.St -iso9945-2-93
2409.br
2410An XCU4 precursor.
2411.Pp
2412.It \-p1003.2a-92
2413.St -p1003.2a-92
2414.br
2415Updates to POSIX.2.
2416.Pp
2417.It \-xpg4
2418.St -xpg4
2419.br
2420Based on POSIX.1 and POSIX.2, published in 1992.
2421.El
2422.It Single UNIX Specification version 1 and related standards
2423.Pp
2424.Bl -tag -width "-p1003.1g-2000" -compact
2425.It \-susv1
2426.St -susv1
2427.It \-xpg4.2
2428.St -xpg4.2
2429.br
2430This standard was published in 1994.
2431It was used as the basis for UNIX 95 certification.
2432The following three refer to parts of it.
2433.Pp
2434.It \-xsh4.2
2435.St -xsh4.2
2436.Pp
2437.It \-xcurses4.2
2438.St -xcurses4.2
2439.Pp
2440.It \-p1003.1g-2000
2441.St -p1003.1g-2000
2442.br
2443Networking APIs, including sockets.
2444.Pp
2445.It \-svid4
2446.St -svid4 ,
2447.br
2448Published in 1995.
2449.El
2450.It Single UNIX Specification version 2 and related standards
2451.Pp
2452.Bl -tag -width "-p1003.1g-2000" -compact
2453.It \-susv2
2454.St -susv2
2455This Standard was published in 1997
2456and is also called X/Open Portability Guide version 5.
2457It was used as the basis for UNIX 98 certification.
2458The following refer to parts of it.
2459.Pp
2460.It \-xbd5
2461.St -xbd5
2462.Pp
2463.It \-xsh5
2464.St -xsh5
2465.Pp
2466.It \-xcu5
2467.St -xcu5
2468.Pp
2469.It \-xns5
2470.St -xns5
2471.It \-xns5.2
2472.St -xns5.2
2473.El
2474.It Single UNIX Specification version 3
2475.Pp
2476.Bl -tag -width "-p1003.1-2001" -compact
2477.It \-p1003.1-2001
2478.St -p1003.1-2001
2479.It \-susv3
2480.St -susv3
2481.br
2482This standard is based on C99, SUSv2, POSIX.1-1996, 1d, and 1j.
2483It is also called X/Open Portability Guide version 6.
2484It is used as the basis for UNIX 03 certification.
2485.Pp
2486.It \-p1003.1-2004
2487.St -p1003.1-2004
2488.br
2489The second and last Technical Corrigendum.
2490.El
2491.It Single UNIX Specification version 4
2492.Pp
2493.Bl -tag -width "-p1003.1g-2000" -compact
2494.It \-p1003.1-2008
2495.St -p1003.1-2008
2496.It \-susv4
2497.St -susv4
2498.br
2499This standard is also called
2500X/Open Portability Guide version 7.
2501.El
2502.It Other standards
2503.Pp
2504.Bl -tag -width "-p1003.1g-2000" -compact
2505.It \-ieee754
2506.St -ieee754
2507.br
2508Floating-point arithmetic.
2509.Pp
2510.It \-iso8601
2511.St -iso8601
2512.br
2513Representation of dates and times, published in 1988.
2514.Pp
2515.It \-iso8802-3
2516.St -iso8802-3
2517.br
2518Ethernet local area networks.
2519.Pp
2520.It \-ieee1275-94
2521.St -ieee1275-94
2522.El
2523.El
2524.It Ic \&Sx Ar Title line
2525Reference a section or subsection in the same manual page.
2526The referenced section or subsection name must be identical to the
2527enclosed argument, including whitespace.
2528.Pp
2529Examples:
2530.Dl \&.Sx MANUAL STRUCTURE
2531.Pp
2532See also
2533.Ic \&Sh
2534and
2535.Ic \&Ss .
2536.It Ic \&Sy Ar word ...
2537Request a boldface font.
2538.Pp
2539This is most often used to indicate importance or seriousness (not to be
2540confused with stress emphasis, see
2541.Ic \&Em ) .
2542When none of the semantic macros fit, it is also adequate for syntax
2543elements that have to be given or that appear verbatim.
2544.Pp
2545Examples:
2546.Bd -literal -compact -offset indent
2547\&.Sy Warning :
2548If
2549\&.Sy s
2550appears in the owner permissions, set-user-ID mode is set.
2551This utility replaces the former
2552\&.Sy dumpdir
2553program.
2554.Ed
2555.Pp
2556See also
2557.Ic \&Em ,
2558.Ic \&No ,
2559and
2560.Ic \&Ql .
2561.It Ic \&Ta
2562Table cell separator in
2563.Ic \&Bl Fl column
2564lists; can only be used below
2565.Ic \&It .
2566.It Ic \&Tg Op Ar term
2567Announce that the next input line starts a definition of the
2568.Ar term .
2569This macro must appear alone on its own input line.
2570The argument defaults to the first argument of the first macro
2571on the next line.
2572The argument may not contain whitespace characters, not even when it is quoted.
2573This macro is a
2574.Xr mandoc 1
2575extension and is typically ignored by other formatters.
2576.Pp
2577When viewing terminal output with
2578.Xr less 1 ,
2579the interactive
2580.Ic :t
2581command can be used to go to the definition of the
2582.Ar term
2583as described for the
2584.Ev MANPAGER
2585variable in
2586.Xr man 1 ;
2587when producing HTML output, a fragment identifier
2588.Pq Ic id No attribute
2589is generated, to be used for deep linking to this place of the document.
2590.Pp
2591In most cases, adding a
2592.Ic \&Tg
2593macro would be redundant because
2594.Xr mandoc 1
2595is able to automatically tag most definitions.
2596This macro is intended for cases where automatic tagging of a
2597.Ar term
2598is unsatisfactory, for example if a definition is not tagged
2599automatically (false negative) or if places are tagged that do
2600not define the
2601.Ar term
2602(false positives).
2603When there is at least one
2604.Ic \&Tg
2605macro for a
2606.Ar term ,
2607no other places are automatically marked as definitions of that
2608.Ar term .
2609.It Ic \&Tn Ar word ...
2610Supported only for compatibility, do not use this in new manuals.
2611Even though the macro name
2612.Pq Dq tradename
2613suggests a semantic function, historic usage is inconsistent, mostly
2614using it as a presentation-level macro to request a small caps font.
2615.It Ic \&Ud
2616Supported only for compatibility, do not use this in new manuals.
2617Prints out
2618.Dq currently under development.
2619.It Ic \&Ux
2620Supported only for compatibility, do not use this in new manuals.
2621Prints out
2622.Dq Ux .
2623.It Ic \&Va Oo Ar type Oc Ar identifier ...
2624A variable name.
2625.Pp
2626Examples:
2627.Dl \&.Va foo
2628.Dl \&.Va const char *bar ;
2629.Pp
2630For function arguments and parameters, use
2631.Ic \&Fa
2632instead.
2633For declarations of global variables in the
2634.Em SYNOPSIS
2635section, use
2636.Ic \&Vt .
2637.It Ic \&Vt Ar type Op Ar identifier
2638A variable type.
2639.Pp
2640This is also used for indicating global variables in the
2641.Em SYNOPSIS
2642section, in which case a variable name is also specified.
2643Note that it accepts
2644.Sx Block partial-implicit
2645syntax when invoked as the first macro on an input line in the
2646.Em SYNOPSIS
2647section, else it accepts ordinary
2648.Sx In-line
2649syntax.
2650In the former case, this macro starts a new output line,
2651and a blank line is inserted in front if there is a preceding
2652function definition or include directive.
2653.Pp
2654Examples:
2655.Dl \&.Vt unsigned char
2656.Dl \&.Vt extern const char * const sys_signame[] \&;
2657.Pp
2658For parameters in function prototypes, use
2659.Ic \&Fa
2660instead, for function return types
2661.Ic \&Ft ,
2662and for variable names outside the
2663.Em SYNOPSIS
2664section
2665.Ic \&Va ,
2666even when including a type with the name.
2667See also
2668.Sx MANUAL STRUCTURE .
2669.It Ic \&Xc
2670Close a scope opened by
2671.Ic \&Xo .
2672.It Ic \&Xo Ar block
2673Extend the header of an
2674.Ic \&It
2675macro or the body of a partial-implicit block macro
2676beyond the end of the input line.
2677This macro originally existed to work around the 9-argument limit
2678of historic
2679.Xr roff 7 .
2680.It Ic \&Xr Ar name section
2681Link to another manual
2682.Pq Qq cross-reference .
2683.Pp
2684Cross reference the
2685.Ar name
2686and
2687.Ar section
2688number of another man page.
2689.Pp
2690Examples:
2691.Dl \&.Xr mandoc 1
2692.Dl \&.Xr mandoc 1 \&;
2693.Dl \&.Xr mandoc 1 \&Ns s behaviour
2694.El
2695.Sh MACRO SYNTAX
2696The syntax of a macro depends on its classification.
2697In this section,
2698.Sq \-arg
2699refers to macro arguments, which may be followed by zero or more
2700.Sq parm
2701parameters;
2702.Sq \&Yo
2703opens the scope of a macro; and if specified,
2704.Sq \&Yc
2705closes it out.
2706.Pp
2707The
2708.Em Callable
2709column indicates that the macro may also be called by passing its name
2710as an argument to another macro.
2711For example,
2712.Sq \&.Op \&Fl O \&Ar file
2713produces
2714.Sq Op Fl O Ar file .
2715To prevent a macro call and render the macro name literally,
2716escape it by prepending a zero-width space,
2717.Sq \e& .
2718For example,
2719.Sq \&Op \e&Fl O
2720produces
2721.Sq Op \&Fl O .
2722If a macro is not callable but its name appears as an argument
2723to another macro, it is interpreted as opaque text.
2724For example,
2725.Sq \&.Fl \&Sh
2726produces
2727.Sq Fl \&Sh .
2728.Pp
2729The
2730.Em Parsed
2731column indicates whether the macro may call other macros by receiving
2732their names as arguments.
2733If a macro is not parsed but the name of another macro appears
2734as an argument, it is interpreted as opaque text.
2735.Pp
2736The
2737.Em Scope
2738column, if applicable, describes closure rules.
2739.Ss Block full-explicit
2740Multi-line scope closed by an explicit closing macro.
2741All macros contains bodies; only
2742.Ic \s&Bf
2743and
2744.Pq optionally
2745.Ic \&Bl
2746contain a head.
2747.Bd -literal -offset indent
2748\&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
2749\(lBbody...\(rB
2750\&.Yc
2751.Ed
2752.Bl -column "MacroX" "CallableX" "ParsedX" "closed by XXX" -offset indent
2753.It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
2754.It Ic \&Bd  Ta    \&No     Ta    \&No     Ta    closed by Ic \&Ed
2755.It Ic \&Bf  Ta    \&No     Ta    \&No     Ta    closed by Ic \&Ef
2756.It Ic \&Bk  Ta    \&No     Ta    \&No     Ta    closed by Ic \&Ek
2757.It Ic \&Bl  Ta    \&No     Ta    \&No     Ta    closed by Ic \&El
2758.It Ic \&Ed  Ta    \&No     Ta    \&No     Ta    opened by Ic \&Bd
2759.It Ic \&Ef  Ta    \&No     Ta    \&No     Ta    opened by Ic \&Bf
2760.It Ic \&Ek  Ta    \&No     Ta    \&No     Ta    opened by Ic \&Bk
2761.It Ic \&El  Ta    \&No     Ta    \&No     Ta    opened by Ic \&Bl
2762.El
2763.Ss Block full-implicit
2764Multi-line scope closed by end-of-file or implicitly by another macro.
2765All macros have bodies; some
2766.Po
2767.Ic \&It Fl bullet ,
2768.Fl hyphen ,
2769.Fl dash ,
2770.Fl enum ,
2771.Fl item
2772.Pc
2773don't have heads; only one
2774.Po
2775.Ic \&It
2776in
2777.Ic \&Bl Fl column
2778.Pc
2779has multiple heads.
2780.Bd -literal -offset indent
2781\&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead... \(lBTa head...\(rB\(rB
2782\(lBbody...\(rB
2783.Ed
2784.Bl -column "MacroX" "CallableX" "ParsedX" "closed by XXXXXXXXXXX" -offset indent
2785.It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
2786.It Ic \&It Ta \&No Ta Yes  Ta closed by Ic \&It , Ic \&El
2787.It Ic \&Nd Ta \&No Ta \&No Ta closed by Ic \&Sh
2788.It Ic \&Nm Ta \&No Ta Yes  Ta closed by Ic \&Nm , Ic \&Sh , Ic \&Ss
2789.It Ic \&Sh Ta \&No Ta Yes  Ta closed by Ic \&Sh
2790.It Ic \&Ss Ta \&No Ta Yes  Ta closed by Ic \&Sh , Ic \&Ss
2791.El
2792.Pp
2793Note that the
2794.Ic \&Nm
2795macro is a
2796.Sx Block full-implicit
2797macro only when invoked as the first macro
2798in a
2799.Em SYNOPSIS
2800section line, else it is
2801.Sx In-line .
2802.Ss Block partial-explicit
2803Like block full-explicit, but also with single-line scope.
2804Each has at least a body and, in limited circumstances, a head
2805.Po
2806.Ic \&Fo ,
2807.Ic \&Eo
2808.Pc
2809and/or tail
2810.Pq Ic \&Ec .
2811.Bd -literal -offset indent
2812\&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB
2813\(lBbody...\(rB
2814\&.Yc \(lBtail...\(rB
2815
2816\&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB \
2817\(lBbody...\(rB \&Yc \(lBtail...\(rB
2818.Ed
2819.Bl -column "MacroX" "CallableX" "ParsedX" "closed by XXXX" -offset indent
2820.It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
2821.It Ic \&Ac  Ta    Yes      Ta    Yes      Ta    opened by Ic \&Ao
2822.It Ic \&Ao  Ta    Yes      Ta    Yes      Ta    closed by Ic \&Ac
2823.It Ic \&Bc  Ta    Yes      Ta    Yes      Ta    closed by Ic \&Bo
2824.It Ic \&Bo  Ta    Yes      Ta    Yes      Ta    opened by Ic \&Bc
2825.It Ic \&Brc Ta    Yes      Ta    Yes      Ta    opened by Ic \&Bro
2826.It Ic \&Bro Ta    Yes      Ta    Yes      Ta    closed by Ic \&Brc
2827.It Ic \&Dc  Ta    Yes      Ta    Yes      Ta    opened by Ic \&Do
2828.It Ic \&Do  Ta    Yes      Ta    Yes      Ta    closed by Ic \&Dc
2829.It Ic \&Ec  Ta    Yes      Ta    Yes      Ta    opened by Ic \&Eo
2830.It Ic \&Eo  Ta    Yes      Ta    Yes      Ta    closed by Ic \&Ec
2831.It Ic \&Fc  Ta    Yes      Ta    Yes      Ta    opened by Ic \&Fo
2832.It Ic \&Fo  Ta    \&No     Ta    \&No     Ta    closed by Ic \&Fc
2833.It Ic \&Oc  Ta    Yes      Ta    Yes      Ta    closed by Ic \&Oo
2834.It Ic \&Oo  Ta    Yes      Ta    Yes      Ta    opened by Ic \&Oc
2835.It Ic \&Pc  Ta    Yes      Ta    Yes      Ta    closed by Ic \&Po
2836.It Ic \&Po  Ta    Yes      Ta    Yes      Ta    opened by Ic \&Pc
2837.It Ic \&Qc  Ta    Yes      Ta    Yes      Ta    opened by Ic \&Oo
2838.It Ic \&Qo  Ta    Yes      Ta    Yes      Ta    closed by Ic \&Oc
2839.It Ic \&Re  Ta    \&No     Ta    \&No     Ta    opened by Ic \&Rs
2840.It Ic \&Rs  Ta    \&No     Ta    \&No     Ta    closed by Ic \&Re
2841.It Ic \&Sc  Ta    Yes      Ta    Yes      Ta    opened by Ic \&So
2842.It Ic \&So  Ta    Yes      Ta    Yes      Ta    closed by Ic \&Sc
2843.It Ic \&Xc  Ta    Yes      Ta    Yes      Ta    opened by Ic \&Xo
2844.It Ic \&Xo  Ta    Yes      Ta    Yes      Ta    closed by Ic \&Xc
2845.El
2846.Ss Block partial-implicit
2847Like block full-implicit, but with single-line scope closed by the
2848end of the line.
2849.Bd -literal -offset indent
2850\&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBbody...\(rB \(lBres...\(rB
2851.Ed
2852.Bl -column "MacroX" "CallableX" "ParsedX" -offset indent
2853.It Em Macro Ta Em Callable Ta Em Parsed
2854.It Ic \&Aq  Ta    Yes      Ta    Yes
2855.It Ic \&Bq  Ta    Yes      Ta    Yes
2856.It Ic \&Brq Ta    Yes      Ta    Yes
2857.It Ic \&D1  Ta    \&No     Ta    \&Yes
2858.It Ic \&Dl  Ta    \&No     Ta    Yes
2859.It Ic \&Dq  Ta    Yes      Ta    Yes
2860.It Ic \&En  Ta    Yes      Ta    Yes
2861.It Ic \&Op  Ta    Yes      Ta    Yes
2862.It Ic \&Pq  Ta    Yes      Ta    Yes
2863.It Ic \&Ql  Ta    Yes      Ta    Yes
2864.It Ic \&Qq  Ta    Yes      Ta    Yes
2865.It Ic \&Sq  Ta    Yes      Ta    Yes
2866.It Ic \&Vt  Ta    Yes      Ta    Yes
2867.El
2868.Pp
2869Note that the
2870.Ic \&Vt
2871macro is a
2872.Sx Block partial-implicit
2873only when invoked as the first macro
2874in a
2875.Em SYNOPSIS
2876section line, else it is
2877.Sx In-line .
2878.Ss Special block macro
2879The
2880.Ic \&Ta
2881macro can only be used below
2882.Ic \&It
2883in
2884.Ic \&Bl Fl column
2885lists.
2886It delimits blocks representing table cells;
2887these blocks have bodies, but no heads.
2888.Bl -column "MacroX" "CallableX" "ParsedX" "closed by XXXX" -offset indent
2889.It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope
2890.It Ic \&Ta  Ta    Yes      Ta    Yes    Ta closed by Ic \&Ta , Ic \&It
2891.El
2892.Ss In-line
2893Closed by the end of the line, fixed argument lengths,
2894and/or subsequent macros.
2895In-line macros have only text children.
2896If a number (or inequality) of arguments is
2897.Pq n ,
2898then the macro accepts an arbitrary number of arguments.
2899.Bd -literal -offset indent
2900\&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB \(lBres...\(rB
2901
2902\&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB Yc...
2903
2904\&.Yo \(lB\-arg \(lBval...\(rB\(rB arg0 arg1 argN
2905.Ed
2906.Bl -column "MacroX" "CallableX" "ParsedX" "Arguments" -offset indent
2907.It Em Macro Ta Em Callable Ta Em Parsed Ta Em Arguments
2908.It Ic \&%A  Ta    \&No     Ta    \&No     Ta    >0
2909.It Ic \&%B  Ta    \&No     Ta    \&No     Ta    >0
2910.It Ic \&%C  Ta    \&No     Ta    \&No     Ta    >0
2911.It Ic \&%D  Ta    \&No     Ta    \&No     Ta    >0
2912.It Ic \&%I  Ta    \&No     Ta    \&No     Ta    >0
2913.It Ic \&%J  Ta    \&No     Ta    \&No     Ta    >0
2914.It Ic \&%N  Ta    \&No     Ta    \&No     Ta    >0
2915.It Ic \&%O  Ta    \&No     Ta    \&No     Ta    >0
2916.It Ic \&%P  Ta    \&No     Ta    \&No     Ta    >0
2917.It Ic \&%Q  Ta    \&No     Ta    \&No     Ta    >0
2918.It Ic \&%R  Ta    \&No     Ta    \&No     Ta    >0
2919.It Ic \&%T  Ta    \&No     Ta    \&No     Ta    >0
2920.It Ic \&%U  Ta    \&No     Ta    \&No     Ta    >0
2921.It Ic \&%V  Ta    \&No     Ta    \&No     Ta    >0
2922.It Ic \&Ad  Ta    Yes      Ta    Yes      Ta    >0
2923.It Ic \&An  Ta    Yes      Ta    Yes      Ta    >0
2924.It Ic \&Ap  Ta    Yes      Ta    Yes      Ta    0
2925.It Ic \&Ar  Ta    Yes      Ta    Yes      Ta    n
2926.It Ic \&At  Ta    Yes      Ta    Yes      Ta    1
2927.It Ic \&Bsx Ta    Yes      Ta    Yes      Ta    n
2928.It Ic \&Bt  Ta    \&No     Ta    \&No     Ta    0
2929.It Ic \&Bx  Ta    Yes      Ta    Yes      Ta    n
2930.It Ic \&Cd  Ta    Yes      Ta    Yes      Ta    >0
2931.It Ic \&Cm  Ta    Yes      Ta    Yes      Ta    >0
2932.It Ic \&Db  Ta    \&No     Ta    \&No     Ta    1
2933.It Ic \&Dd  Ta    \&No     Ta    \&No     Ta    n
2934.It Ic \&Dt  Ta    \&No     Ta    \&No     Ta    n
2935.It Ic \&Dv  Ta    Yes      Ta    Yes      Ta    >0
2936.It Ic \&Dx  Ta    Yes      Ta    Yes      Ta    n
2937.It Ic \&Em  Ta    Yes      Ta    Yes      Ta    >0
2938.It Ic \&Er  Ta    Yes      Ta    Yes      Ta    >0
2939.It Ic \&Es  Ta    Yes      Ta    Yes      Ta    2
2940.It Ic \&Ev  Ta    Yes      Ta    Yes      Ta    >0
2941.It Ic \&Ex  Ta    \&No     Ta    \&No     Ta    n
2942.It Ic \&Fa  Ta    Yes      Ta    Yes      Ta    >0
2943.It Ic \&Fd  Ta    \&No     Ta    \&No     Ta    >0
2944.It Ic \&Fl  Ta    Yes      Ta    Yes      Ta    n
2945.It Ic \&Fn  Ta    Yes      Ta    Yes      Ta    >0
2946.It Ic \&Fr  Ta    Yes      Ta    Yes      Ta    >0
2947.It Ic \&Ft  Ta    Yes      Ta    Yes      Ta    >0
2948.It Ic \&Fx  Ta    Yes      Ta    Yes      Ta    n
2949.It Ic \&Hf  Ta    \&No     Ta    \&No     Ta    n
2950.It Ic \&Ic  Ta    Yes      Ta    Yes      Ta    >0
2951.It Ic \&In  Ta    \&No     Ta    \&No     Ta    1
2952.It Ic \&Lb  Ta    \&No     Ta    \&No     Ta    1
2953.It Ic \&Li  Ta    Yes      Ta    Yes      Ta    >0
2954.It Ic \&Lk  Ta    Yes      Ta    Yes      Ta    >0
2955.It Ic \&Lp  Ta    \&No     Ta    \&No     Ta    0
2956.It Ic \&Ms  Ta    Yes      Ta    Yes      Ta    >0
2957.It Ic \&Mt  Ta    Yes      Ta    Yes      Ta    >0
2958.It Ic \&Nm  Ta    Yes      Ta    Yes      Ta    n
2959.It Ic \&No  Ta    Yes      Ta    Yes      Ta    >0
2960.It Ic \&Ns  Ta    Yes      Ta    Yes      Ta    0
2961.It Ic \&Nx  Ta    Yes      Ta    Yes      Ta    n
2962.It Ic \&Os  Ta    \&No     Ta    \&No     Ta    n
2963.It Ic \&Ot  Ta    Yes      Ta    Yes      Ta    >0
2964.It Ic \&Ox  Ta    Yes      Ta    Yes      Ta    n
2965.It Ic \&Pa  Ta    Yes      Ta    Yes      Ta    n
2966.It Ic \&Pf  Ta    Yes      Ta    Yes      Ta    1
2967.It Ic \&Pp  Ta    \&No     Ta    \&No     Ta    0
2968.It Ic \&Rv  Ta    \&No     Ta    \&No     Ta    n
2969.It Ic \&Sm  Ta    \&No     Ta    \&No     Ta    <2
2970.It Ic \&St  Ta    \&No     Ta    Yes      Ta    1
2971.It Ic \&Sx  Ta    Yes      Ta    Yes      Ta    >0
2972.It Ic \&Sy  Ta    Yes      Ta    Yes      Ta    >0
2973.It Ic \&Tg  Ta    \&No     Ta    \&No     Ta    <2
2974.It Ic \&Tn  Ta    Yes      Ta    Yes      Ta    >0
2975.It Ic \&Ud  Ta    \&No     Ta    \&No     Ta    0
2976.It Ic \&Ux  Ta    Yes      Ta    Yes      Ta    n
2977.It Ic \&Va  Ta    Yes      Ta    Yes      Ta    n
2978.It Ic \&Vt  Ta    Yes      Ta    Yes      Ta    >0
2979.It Ic \&Xr  Ta    Yes      Ta    Yes      Ta    2
2980.El
2981.Ss Delimiters
2982When a macro argument consists of one single input character
2983considered as a delimiter, the argument gets special handling.
2984This does not apply when delimiters appear in arguments containing
2985more than one character.
2986Consequently, to prevent special handling and just handle it
2987like any other argument, a delimiter can be escaped by prepending
2988a zero-width space
2989.Pq Sq \e& .
2990In text lines, delimiters never need escaping, but may be used
2991as normal punctuation.
2992.Pp
2993For many macros, when the leading arguments are opening delimiters,
2994these delimiters are put before the macro scope,
2995and when the trailing arguments are closing delimiters,
2996these delimiters are put after the macro scope.
2997Spacing is suppressed after opening delimiters
2998and before closing delimiters.
2999For example,
3000.Pp
3001.D1 Pf \. \&Aq "( [ word ] ) ."
3002.Pp
3003renders as:
3004.Pp
3005.D1 Aq ( [ word ] ) .
3006.Pp
3007Opening delimiters are:
3008.Pp
3009.Bl -tag -width Ds -offset indent -compact
3010.It \&(
3011left parenthesis
3012.It \&[
3013left bracket
3014.El
3015.Pp
3016Closing delimiters are:
3017.Pp
3018.Bl -tag -width Ds -offset indent -compact
3019.It \&.
3020period
3021.It \&,
3022comma
3023.It \&:
3024colon
3025.It \&;
3026semicolon
3027.It \&)
3028right parenthesis
3029.It \&]
3030right bracket
3031.It \&?
3032question mark
3033.It \&!
3034exclamation mark
3035.El
3036.Pp
3037Note that even a period preceded by a backslash
3038.Pq Sq \e.\&
3039gets this special handling; use
3040.Sq \e&.\&
3041to prevent that.
3042.Pp
3043Many in-line macros interrupt their scope when they encounter
3044delimiters, and resume their scope when more arguments follow that
3045are not delimiters.
3046For example,
3047.Pp
3048.D1 Pf \. \&Fl "a ( b | c \e*(Ba d ) e"
3049.Pp
3050renders as:
3051.Pp
3052.D1 Fl a ( b | c \*(Ba d ) e
3053.Pp
3054This applies to both opening and closing delimiters,
3055and also to the middle delimiter, which does not suppress spacing:
3056.Pp
3057.Bl -tag -width Ds -offset indent -compact
3058.It \&|
3059vertical bar
3060.El
3061.Pp
3062As a special case, the predefined string \e*(Ba is handled and rendered
3063in the same way as a plain
3064.Sq \&|
3065character.
3066Using this predefined string is not recommended in new manuals.
3067.Pp
3068Appending a zero-width space
3069.Pq Sq \e&
3070to the end of an input line is also useful to prevent the interpretation
3071of a trailing period, exclamation or question mark as the end of a
3072sentence, for example when an abbreviation happens to occur
3073at the end of a text or macro input line.
3074.Ss Font handling
3075In
3076.Nm
3077documents, usage of semantic markup is recommended in order to have
3078proper fonts automatically selected; only when no fitting semantic markup
3079is available, consider falling back to
3080.Sx Physical markup
3081macros.
3082Whenever any
3083.Nm
3084macro switches the
3085.Xr roff 7
3086font mode, it will automatically restore the previous font when exiting
3087its scope.
3088Manually switching the font using the
3089.Xr roff 7
3090.Ql \ef
3091font escape sequences is never required.
3092.Sh COMPATIBILITY
3093This section provides an incomplete list of compatibility issues
3094between mandoc and GNU troff
3095.Pq Qq groff .
3096.Pp
3097The following problematic behaviour is found in groff:
3098.Pp
3099.Bl -dash -compact
3100.It
3101.Ic \&Pa
3102does not format its arguments when used in the FILES section under
3103certain list types.
3104.It
3105.Ic \&Ta
3106can only be called by other macros, but not at the beginning of a line.
3107.It
3108.Sq \ef
3109.Pq font face
3110and
3111.Sq \eF
3112.Pq font family face
3113.Sx Text Decoration
3114escapes behave irregularly when specified within line-macro scopes.
3115.It
3116Negative scaling units return to prior lines.
3117Instead, mandoc truncates them to zero.
3118.El
3119.Pp
3120The following features are unimplemented in mandoc:
3121.Pp
3122.Bl -dash -compact
3123.It
3124.Ic \&Bd Fl file Ar file
3125is unsupported for security reasons.
3126.It
3127.Ic \&Bd
3128.Fl filled
3129does not adjust the right margin, but is an alias for
3130.Ic \&Bd
3131.Fl ragged .
3132.It
3133.Ic \&Bd
3134.Fl literal
3135does not use a literal font, but is an alias for
3136.Ic \&Bd
3137.Fl unfilled .
3138.It
3139.Ic \&Bd
3140.Fl offset Cm center
3141and
3142.Fl offset Cm right
3143don't work.
3144Groff does not implement centered and flush-right rendering either,
3145but produces large indentations.
3146.El
3147.Sh SEE ALSO
3148.Xr man 1 ,
3149.Xr mandoc 1 ,
3150.Xr eqn 7 ,
3151.Xr man 7 ,
3152.Xr mandoc_char 7 ,
3153.Xr roff 7 ,
3154.Xr tbl 7
3155.Pp
3156The web page
3157.Lk https://mandoc.bsd.lv/mdoc/ "extended documentation for the mdoc language"
3158provides a few tutorial-style pages for beginners, an extensive style
3159guide for advanced authors, and an alphabetic index helping to choose
3160the best macros for various kinds of content.
3161.Pp
3162The manual page
3163.Lk https://man.voidlinux.org/groff_mdoc "groff_mdoc(7)"
3164contained in the
3165.Dq groff
3166package documents exactly the same language in a somehwat different style.
3167.Sh HISTORY
3168The
3169.Nm
3170language first appeared as a troff macro package in
3171.Bx 4.4 .
3172It was later significantly updated by Werner Lemberg and Ruslan Ermilov
3173in groff-1.17.
3174The standalone implementation that is part of the
3175.Xr mandoc 1
3176utility written by Kristaps Dzonsons appeared in
3177.Ox 4.6 .
3178.Sh AUTHORS
3179The
3180.Nm
3181reference was written by
3182.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
3183