]> git.cameronkatri.com Git - mandoc.git/blob - man.7
Add example of comments in man.7 and mdoc.7.
[mandoc.git] / man.7
1 .\" $Id: man.7,v 1.104 2011/08/17 22:20:14 kristaps Exp $
2 .\"
3 .\" Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
4 .\"
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
8 .\"
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 .\"
17 .Dd $Mdocdate: August 17 2011 $
18 .Dt MAN 7
19 .Os
20 .Sh NAME
21 .Nm man
22 .Nd man language reference
23 .Sh DESCRIPTION
24 The
25 .Nm man
26 language was historically used to format
27 .Ux
28 manuals.
29 This reference document describes its syntax, structure, and usage.
30 .Pp
31 .Bf -emphasis
32 Do not use
33 .Nm
34 to write your manuals.
35 .Ef
36 Use the
37 .Xr mdoc 7
38 language, instead.
39 .Pp
40 A
41 .Nm
42 document follows simple rules: lines beginning with the control
43 character
44 .Sq \&.
45 are parsed for macros.
46 Other lines are interpreted within the scope of
47 prior macros:
48 .Bd -literal -offset indent
49 \&.SH Macro lines change control state.
50 Other lines are interpreted within the current state.
51 .Ed
52 .Sh LANGUAGE SYNTAX
53 .Nm
54 documents may contain only graphable 7-bit ASCII characters, the
55 space character, and the tab character.
56 The back-space character
57 .Sq \e
58 indicates the start of an escape sequence for
59 .Sx Comments ,
60 .Sx Predefined Strings ,
61 and
62 .Sx Special Characters .
63 .Ss Comments
64 Text following an escaped double-quote
65 .Sq \e\*q ,
66 whether in a macro or text line, is ignored to the end of
67 line.
68 A macro line beginning with a control character and comment escape
69 .Sq \&.\e\*q
70 is also ignored.
71 Furthermore,
72 macro lines with only a control character and optional trailing
73 whitespace are
74 stripped from input.
75 .Pp
76 Examples:
77 .Bd -literal -offset indent -compact
78 \&.\e\*q This is a comment line.
79 \&.\e\*q The next line is ignored:
80 \&.
81 \&.Em Emphasis \e\*q This is also a comment.
82 .Ed
83 .Ss Special Characters
84 Special characters are used to encode special glyphs and are rendered
85 differently across output media.
86 They may occur in both macro and text lines.
87 Sequences begin with the escape character
88 .Sq \e
89 followed by either an open-parenthesis
90 .Sq \&(
91 for two-character sequences; an open-bracket
92 .Sq \&[
93 for n-character sequences (terminated at a close-bracket
94 .Sq \&] ) ;
95 or a single one character sequence.
96 .Pp
97 Examples:
98 .Bl -tag -width Ds -offset indent -compact
99 .It \e(em
100 em dash
101 .It \ee
102 backslash
103 .El
104 .Pp
105 See
106 .Xr mandoc_char 7
107 for a complete list.
108 .Ss Text Decoration
109 Terms may be text-decorated using the
110 .Sq \ef
111 escape followed by an indicator: B (bold), I (italic), R (regular), or P
112 (revert to previous mode):
113 A numerical representation 3, 2, or 1 (bold, italic, and regular,
114 respectively) may be used instead.
115 A text decoration is only valid, if specified in free-form text, until
116 the next macro invocation; if specified within a macro, it's only valid
117 until the macro closes scope.
118 Note that macros like
119 .Sx \&BR
120 open and close a font scope with each argument.
121 .Pp
122 The
123 .Sq \ef
124 attribute is forgotten when entering or exiting a macro block.
125 .Pp
126 Examples:
127 .Bl -tag -width Ds -offset indent -compact
128 .It \efBbold\efR
129 write in bold, then switch to regular
130 .It \efIitalic\efP
131 write in italic, then return to previous
132 .El
133 .Ss Predefined Strings
134 Predefined strings, like
135 .Sx Special Characters ,
136 mark special output glyphs.
137 Predefined strings are escaped with the slash-asterisk,
138 .Sq \e* :
139 single-character
140 .Sq \e*X ,
141 two-character
142 .Sq \e*(XX ,
143 and N-character
144 .Sq \e*[N] .
145 .Pp
146 Examples:
147 .Bl -tag -width Ds -offset indent -compact
148 .It \e*(Am
149 ampersand
150 .It \e*(Ba
151 vertical bar
152 .El
153 .Pp
154 These strings are set using
155 .Xr roff 7 ,
156 although
157 .Nm
158 consists of several pre-set escapes listed in
159 .Xr mandoc_char 7 .
160 .Ss Whitespace
161 Whitespace consists of the space character.
162 In text lines, whitespace is preserved within a line.
163 In macro lines, whitespace delimits arguments and is discarded.
164 .Pp
165 Unescaped trailing spaces are stripped from text line input unless in a
166 literal context.
167 In general, trailing whitespace on any input line is discouraged for
168 reasons of portability.
169 In the rare case that a blank character is needed at the end of an
170 input line, it may be forced by
171 .Sq \e\ \e& .
172 .Pp
173 If the first character of a text line is a space, that line is printed
174 with a leading newline.
175 .Ss Quotation
176 Macro arguments may be quoted with double-quotes; in this case,
177 whitespace within the quotes is retained as part of the argument.
178 .Pp
179 A quoted argument begins with a double-quote preceded by whitespace.
180 The next double-quote not pairwise adjacent to another double-quote
181 terminates the literal, regardless of surrounding whitespace.
182 .Pp
183 In unquoted arguments, space characters can alternatively be included
184 by preceding them with a backslash
185 .Pq Sq \e\~ ,
186 but quoting is usually better for clarity.
187 .Pp
188 Note that any quoted text, even if it would cause a macro invocation
189 when unquoted, is considered literal text.
190 .Pp
191 In text lines, quotes are regarded as opaque text.
192 .Ss Scaling Widths
193 Many macros support scaled widths for their arguments.
194 The syntax for a scaled width is
195 .Sq Li [+-]?[0-9]*.[0-9]*[:unit:] ,
196 where a decimal must be preceded or proceeded by at least one digit.
197 Negative numbers, while accepted, are truncated to zero.
198 .Pp
199 The following scaling units are accepted:
200 .Pp
201 .Bl -tag -width Ds -offset indent -compact
202 .It c
203 centimetre
204 .It i
205 inch
206 .It P
207 pica (~1/6 inch)
208 .It p
209 point (~1/72 inch)
210 .It f
211 synonym for
212 .Sq u
213 .It v
214 default vertical span
215 .It m
216 width of rendered
217 .Sq m
218 .Pq em
219 character
220 .It n
221 width of rendered
222 .Sq n
223 .Pq en
224 character
225 .It u
226 default horizontal span
227 .It M
228 mini-em (~1/100 em)
229 .El
230 .Pp
231 Using anything other than
232 .Sq m ,
233 .Sq n ,
234 .Sq u ,
235 or
236 .Sq v
237 is necessarily non-portable across output media.
238 See
239 .Sx COMPATIBILITY .
240 .Pp
241 If a scaling unit is not provided, the numerical value is interpreted
242 under the default rules of
243 .Sq v
244 for vertical spaces and
245 .Sq u
246 for horizontal ones.
247 .Pp
248 Examples:
249 .Bl -tag -width Ds -offset indent -compact
250 .It \&.HP 2i
251 two-inch tagged list indentation
252 .Pq see Sx \&HP
253 .It \&.sp 2v
254 two vertical spaces
255 .Pq see Sx \&sp
256 .El
257 .Ss Sentence Spacing
258 Sentences should terminate at the end of an input line.
259 By doing this, a formatter will be able to apply the proper amount of
260 spacing after the end of sentence (unescaped) period, exclamation mark,
261 or question mark followed by zero or more non-sentence closing
262 delimiters
263 .Po
264 .Sq \&) ,
265 .Sq \&] ,
266 .Sq \&' ,
267 .Sq \&"
268 .Pc .
269 .Pp
270 Examples:
271 .Bd -literal -offset indent -compact
272 Do not end sentences mid-line like this. Instead,
273 end a sentence like this.
274 A new sentence gets a new line.
275 .Ed
276 .Sh MANUAL STRUCTURE
277 Each
278 .Nm
279 document must contain the
280 .Sx \&TH
281 macro describing the document's section and title.
282 It may occur anywhere in the document, although conventionally it
283 appears as the first macro.
284 .Pp
285 Beyond
286 .Sx \&TH ,
287 at least one macro or text node must appear in the document.
288 .Pp
289 The following is a well-formed skeleton
290 .Nm
291 file for a utility
292 .Qq progname :
293 .Bd -literal -offset indent
294 \&.TH PROGNAME 1 2009-10-10
295 \&.SH NAME
296 \efBprogname\efR \e(en a description goes here
297 \&.\e\*q .SH LIBRARY
298 \&.\e\*q For sections 2 & 3 only.
299 \&.\e\*q Not used in OpenBSD.
300 \&.SH SYNOPSIS
301 \efBprogname\efR [\efB\e-options\efR] arguments...
302 \&.SH DESCRIPTION
303 The \efBfoo\efR utility processes files...
304 \&.\e\*q .SH IMPLEMENTATION NOTES
305 \&.\e\*q Not used in OpenBSD.
306 \&.\e\*q .SH RETURN VALUES
307 \&.\e\*q For sections 2, 3, & 9 only.
308 \&.\e\*q .SH ENVIRONMENT
309 \&.\e\*q For sections 1, 6, 7, & 8 only.
310 \&.\e\*q .SH FILES
311 \&.\e\*q .SH EXIT STATUS
312 \&.\e\*q For sections 1, 6, & 8 only.
313 \&.\e\*q .SH EXAMPLES
314 \&.\e\*q .SH DIAGNOSTICS
315 \&.\e\*q For sections 1, 4, 6, 7, & 8 only.
316 \&.\e\*q .SH ERRORS
317 \&.\e\*q For sections 2, 3, & 9 only.
318 \&.\e\*q .SH SEE ALSO
319 \&.\e\*q .BR foo ( 1 )
320 \&.\e\*q .SH STANDARDS
321 \&.\e\*q .SH HISTORY
322 \&.\e\*q .SH AUTHORS
323 \&.\e\*q .SH CAVEATS
324 \&.\e\*q .SH BUGS
325 \&.\e\*q .SH SECURITY CONSIDERATIONS
326 \&.\e\*q Not used in OpenBSD.
327 .Ed
328 .Pp
329 The sections in a
330 .Nm
331 document are conventionally ordered as they appear above.
332 Sections should be composed as follows:
333 .Bl -ohang -offset indent
334 .It Em NAME
335 The name(s) and a short description of the documented material.
336 The syntax for this is generally as follows:
337 .Pp
338 .D1 \efBname\efR \e(en description
339 .It Em LIBRARY
340 The name of the library containing the documented material, which is
341 assumed to be a function in a section 2 or 3 manual.
342 For functions in the C library, this may be as follows:
343 .Pp
344 .D1 Standard C Library (libc, -lc)
345 .It Em SYNOPSIS
346 Documents the utility invocation syntax, function call syntax, or device
347 configuration.
348 .Pp
349 For the first, utilities (sections 1, 6, and 8), this is
350 generally structured as follows:
351 .Pp
352 .D1 \efBname\efR [-\efBab\efR] [-\efBc\efR\efIarg\efR] \efBpath\efR...
353 .Pp
354 For the second, function calls (sections 2, 3, 9):
355 .Pp
356 .D1 \&.B char *name(char *\efIarg\efR);
357 .Pp
358 And for the third, configurations (section 4):
359 .Pp
360 .D1 \&.B name* at cardbus ? function ?
361 .Pp
362 Manuals not in these sections generally don't need a
363 .Em SYNOPSIS .
364 .It Em DESCRIPTION
365 This expands upon the brief, one-line description in
366 .Em NAME .
367 It usually contains a break-down of the options (if documenting a
368 command).
369 .It Em IMPLEMENTATION NOTES
370 Implementation-specific notes should be kept here.
371 This is useful when implementing standard functions that may have side
372 effects or notable algorithmic implications.
373 .It Em RETURN VALUES
374 This section documents the return values of functions in sections 2, 3, and 9.
375 .It Em ENVIRONMENT
376 Documents any usages of environment variables, e.g.,
377 .Xr environ 7 .
378 .It Em FILES
379 Documents files used.
380 It's helpful to document both the file name and a short description of how
381 the file is used (created, modified, etc.).
382 .It Em EXIT STATUS
383 This section documents the command exit status for
384 section 1, 6, and 8 utilities.
385 Historically, this information was described in
386 .Em DIAGNOSTICS ,
387 a practise that is now discouraged.
388 .It Em EXAMPLES
389 Example usages.
390 This often contains snippets of well-formed,
391 well-tested invocations.
392 Make sure that examples work properly!
393 .It Em DIAGNOSTICS
394 Documents error conditions.
395 This is most useful in section 4 manuals.
396 Historically, this section was used in place of
397 .Em EXIT STATUS
398 for manuals in sections 1, 6, and 8; however, this practise is
399 discouraged.
400 .It Em ERRORS
401 Documents error handling in sections 2, 3, and 9.
402 .It Em SEE ALSO
403 References other manuals with related topics.
404 This section should exist for most manuals.
405 .Pp
406 .D1 \&.BR bar \&( 1 \&),
407 .Pp
408 Cross-references should conventionally be ordered
409 first by section, then alphabetically.
410 .It Em STANDARDS
411 References any standards implemented or used, such as
412 .Pp
413 .D1 IEEE Std 1003.2 (\e(lqPOSIX.2\e(rq)
414 .Pp
415 If not adhering to any standards, the
416 .Em HISTORY
417 section should be used.
418 .It Em HISTORY
419 A brief history of the subject, including where support first appeared.
420 .It Em AUTHORS
421 Credits to the person or persons who wrote the code and/or documentation.
422 Authors should generally be noted by both name and email address.
423 .It Em CAVEATS
424 Common misuses and misunderstandings should be explained
425 in this section.
426 .It Em BUGS
427 Known bugs, limitations, and work-arounds should be described
428 in this section.
429 .It Em SECURITY CONSIDERATIONS
430 Documents any security precautions that operators should consider.
431 .El
432 .Sh MACRO SYNTAX
433 Macros are one to three characters in length and begin with a
434 control character,
435 .Sq \&. ,
436 at the beginning of the line.
437 The
438 .Sq \(aq
439 macro control character is also accepted.
440 An arbitrary amount of whitespace (spaces or tabs) may sit between the
441 control character and the macro name.
442 Thus, the following are equivalent:
443 .Bd -literal -offset indent
444 \&.PP
445 \&.\ \ \ PP
446 .Ed
447 .Pp
448 To include space characters in macro arguments, arguments may be quoted;
449 see the
450 .Sq MACRO SYNTAX
451 section in the
452 .Xr roff 7
453 manual for details.
454 .Pp
455 The
456 .Nm
457 macros are classified by scope: line scope or block scope.
458 Line macros are only scoped to the current line (and, in some
459 situations, the subsequent line).
460 Block macros are scoped to the current line and subsequent lines until
461 closed by another block macro.
462 .Ss Line Macros
463 Line macros are generally scoped to the current line, with the body
464 consisting of zero or more arguments.
465 If a macro is scoped to the next line and the line arguments are empty,
466 the next line, which must be text, is used instead.
467 Thus:
468 .Bd -literal -offset indent
469 \&.I
470 foo
471 .Ed
472 .Pp
473 is equivalent to
474 .Sq \&.I foo .
475 If next-line macros are invoked consecutively, only the last is used.
476 If a next-line macro is followed by a non-next-line macro, an error is
477 raised, except for
478 .Sx \&br ,
479 .Sx \&sp ,
480 and
481 .Sx \&na .
482 .Pp
483 The syntax is as follows:
484 .Bd -literal -offset indent
485 \&.YO \(lBbody...\(rB
486 \(lBbody...\(rB
487 .Ed
488 .Pp
489 .Bl -column -compact -offset indent "MacroX" "ArgumentsX" "ScopeXXXXX" "CompatX"
490 .It Em Macro Ta Em Arguments Ta Em Scope Ta Em Notes
491 .It Sx \&AT Ta <=1 Ta current Ta \&
492 .It Sx \&B Ta n Ta next-line Ta \&
493 .It Sx \&BI Ta n Ta current Ta \&
494 .It Sx \&BR Ta n Ta current Ta \&
495 .It Sx \&DT Ta 0 Ta current Ta \&
496 .It Sx \&I Ta n Ta next-line Ta \&
497 .It Sx \&IB Ta n Ta current Ta \&
498 .It Sx \&IR Ta n Ta current Ta \&
499 .It Sx \&R Ta n Ta next-line Ta \&
500 .It Sx \&RB Ta n Ta current Ta \&
501 .It Sx \&RI Ta n Ta current Ta \&
502 .It Sx \&SB Ta n Ta next-line Ta \&
503 .It Sx \&SM Ta n Ta next-line Ta \&
504 .It Sx \&TH Ta >1, <6 Ta current Ta \&
505 .It Sx \&UC Ta <=1 Ta current Ta \&
506 .It Sx \&br Ta 0 Ta current Ta compat
507 .It Sx \&fi Ta 0 Ta current Ta compat
508 .It Sx \&ft Ta 1 Ta current Ta compat
509 .It Sx \&in Ta 1 Ta current Ta compat
510 .It Sx \&na Ta 0 Ta current Ta compat
511 .It Sx \&nf Ta 0 Ta current Ta compat
512 .It Sx \&sp Ta 1 Ta current Ta compat
513 .El
514 .Pp
515 Macros marked as
516 .Qq compat
517 are included for compatibility with the significant corpus of existing
518 manuals that mix dialects of roff.
519 These macros should not be used for portable
520 .Nm
521 manuals.
522 .Ss Block Macros
523 Block macros comprise a head and body.
524 As with in-line macros, the head is scoped to the current line and, in
525 one circumstance, the next line (the next-line stipulations as in
526 .Sx Line Macros
527 apply here as well).
528 .Pp
529 The syntax is as follows:
530 .Bd -literal -offset indent
531 \&.YO \(lBhead...\(rB
532 \(lBhead...\(rB
533 \(lBbody...\(rB
534 .Ed
535 .Pp
536 The closure of body scope may be to the section, where a macro is closed
537 by
538 .Sx \&SH ;
539 sub-section, closed by a section or
540 .Sx \&SS ;
541 part, closed by a section, sub-section, or
542 .Sx \&RE ;
543 or paragraph, closed by a section, sub-section, part,
544 .Sx \&HP ,
545 .Sx \&IP ,
546 .Sx \&LP ,
547 .Sx \&P ,
548 .Sx \&PP ,
549 or
550 .Sx \&TP .
551 No closure refers to an explicit block closing macro.
552 .Pp
553 As a rule, block macros may not be nested; thus, calling a block macro
554 while another block macro scope is open, and the open scope is not
555 implicitly closed, is syntactically incorrect.
556 .Pp
557 .Bl -column -compact -offset indent "MacroX" "ArgumentsX" "Head ScopeX" "sub-sectionX" "compatX"
558 .It Em Macro Ta Em Arguments Ta Em Head Scope Ta Em Body Scope Ta Em Notes
559 .It Sx \&HP Ta <2 Ta current Ta paragraph Ta \&
560 .It Sx \&IP Ta <3 Ta current Ta paragraph Ta \&
561 .It Sx \&LP Ta 0 Ta current Ta paragraph Ta \&
562 .It Sx \&P Ta 0 Ta current Ta paragraph Ta \&
563 .It Sx \&PP Ta 0 Ta current Ta paragraph Ta \&
564 .It Sx \&RE Ta 0 Ta current Ta none Ta compat
565 .It Sx \&RS Ta 1 Ta current Ta part Ta compat
566 .It Sx \&SH Ta >0 Ta next-line Ta section Ta \&
567 .It Sx \&SS Ta >0 Ta next-line Ta sub-section Ta \&
568 .It Sx \&TP Ta n Ta next-line Ta paragraph Ta \&
569 .El
570 .Pp
571 Macros marked
572 .Qq compat
573 are as mentioned in
574 .Sx Line Macros .
575 .Pp
576 If a block macro is next-line scoped, it may only be followed by in-line
577 macros for decorating text.
578 .Sh REFERENCE
579 This section is a canonical reference to all macros, arranged
580 alphabetically.
581 For the scoping of individual macros, see
582 .Sx MACRO SYNTAX .
583 .Ss \&AT
584 Sets the volume for the footer for compatibility with man pages from
585 .Tn AT&T UNIX
586 releases.
587 The optional arguments specify which release it is from.
588 .Ss \&B
589 Text is rendered in bold face.
590 .Pp
591 See also
592 .Sx \&I
593 and
594 .Sx \&R .
595 .Ss \&BI
596 Text is rendered alternately in bold face and italic.
597 Thus,
598 .Sq .BI this word and that
599 causes
600 .Sq this
601 and
602 .Sq and
603 to render in bold face, while
604 .Sq word
605 and
606 .Sq that
607 render in italics.
608 Whitespace between arguments is omitted in output.
609 .Pp
610 Examples:
611 .Pp
612 .Dl \&.BI bold italic bold italic
613 .Pp
614 The output of this example will be emboldened
615 .Dq bold
616 and italicised
617 .Dq italic ,
618 with spaces stripped between arguments.
619 .Pp
620 See also
621 .Sx \&IB ,
622 .Sx \&BR ,
623 .Sx \&RB ,
624 .Sx \&RI ,
625 and
626 .Sx \&IR .
627 .Ss \&BR
628 Text is rendered alternately in bold face and roman (the default font).
629 Whitespace between arguments is omitted in output.
630 .Pp
631 See
632 .Sx \&BI
633 for an equivalent example.
634 .Pp
635 See also
636 .Sx \&BI ,
637 .Sx \&IB ,
638 .Sx \&RB ,
639 .Sx \&RI ,
640 and
641 .Sx \&IR .
642 .Ss \&DT
643 Has no effect.
644 Included for compatibility.
645 .Ss \&HP
646 Begin a paragraph whose initial output line is left-justified, but
647 subsequent output lines are indented, with the following syntax:
648 .Bd -filled -offset indent
649 .Pf \. Sx \&HP
650 .Op Cm width
651 .Ed
652 .Pp
653 The
654 .Cm width
655 argument must conform to
656 .Sx Scaling Widths .
657 If specified, it's saved for later paragraph left-margins; if unspecified, the
658 saved or default width is used.
659 .Pp
660 See also
661 .Sx \&IP ,
662 .Sx \&LP ,
663 .Sx \&P ,
664 .Sx \&PP ,
665 and
666 .Sx \&TP .
667 .Ss \&I
668 Text is rendered in italics.
669 .Pp
670 See also
671 .Sx \&B
672 and
673 .Sx \&R .
674 .Ss \&IB
675 Text is rendered alternately in italics and bold face.
676 Whitespace between arguments is omitted in output.
677 .Pp
678 See
679 .Sx \&BI
680 for an equivalent example.
681 .Pp
682 See also
683 .Sx \&BI ,
684 .Sx \&BR ,
685 .Sx \&RB ,
686 .Sx \&RI ,
687 and
688 .Sx \&IR .
689 .Ss \&IP
690 Begin an indented paragraph with the following syntax:
691 .Bd -filled -offset indent
692 .Pf \. Sx \&IP
693 .Op Cm head Op Cm width
694 .Ed
695 .Pp
696 The
697 .Cm width
698 argument defines the width of the left margin and is defined by
699 .Sx Scaling Widths .
700 It's saved for later paragraph left-margins; if unspecified, the saved or
701 default width is used.
702 .Pp
703 The
704 .Cm head
705 argument is used as a leading term, flushed to the left margin.
706 This is useful for bulleted paragraphs and so on.
707 .Pp
708 See also
709 .Sx \&HP ,
710 .Sx \&LP ,
711 .Sx \&P ,
712 .Sx \&PP ,
713 and
714 .Sx \&TP .
715 .Ss \&IR
716 Text is rendered alternately in italics and roman (the default font).
717 Whitespace between arguments is omitted in output.
718 .Pp
719 See
720 .Sx \&BI
721 for an equivalent example.
722 .Pp
723 See also
724 .Sx \&BI ,
725 .Sx \&IB ,
726 .Sx \&BR ,
727 .Sx \&RB ,
728 and
729 .Sx \&RI .
730 .Ss \&LP
731 Begin an undecorated paragraph.
732 The scope of a paragraph is closed by a subsequent paragraph,
733 sub-section, section, or end of file.
734 The saved paragraph left-margin width is reset to the default.
735 .Pp
736 See also
737 .Sx \&HP ,
738 .Sx \&IP ,
739 .Sx \&P ,
740 .Sx \&PP ,
741 and
742 .Sx \&TP .
743 .Ss \&P
744 Synonym for
745 .Sx \&LP .
746 .Pp
747 See also
748 .Sx \&HP ,
749 .Sx \&IP ,
750 .Sx \&LP ,
751 .Sx \&PP ,
752 and
753 .Sx \&TP .
754 .Ss \&PP
755 Synonym for
756 .Sx \&LP .
757 .Pp
758 See also
759 .Sx \&HP ,
760 .Sx \&IP ,
761 .Sx \&LP ,
762 .Sx \&P ,
763 and
764 .Sx \&TP .
765 .Ss \&R
766 Text is rendered in roman (the default font).
767 .Pp
768 See also
769 .Sx \&I
770 and
771 .Sx \&B .
772 .Ss \&RB
773 Text is rendered alternately in roman (the default font) and bold face.
774 Whitespace between arguments is omitted in output.
775 .Pp
776 See
777 .Sx \&BI
778 for an equivalent example.
779 .Pp
780 See also
781 .Sx \&BI ,
782 .Sx \&IB ,
783 .Sx \&BR ,
784 .Sx \&RI ,
785 and
786 .Sx \&IR .
787 .Ss \&RE
788 Explicitly close out the scope of a prior
789 .Sx \&RS .
790 The default left margin is restored to the state of the original
791 .Sx \&RS
792 invocation.
793 .Ss \&RI
794 Text is rendered alternately in roman (the default font) and italics.
795 Whitespace between arguments is omitted in output.
796 .Pp
797 See
798 .Sx \&BI
799 for an equivalent example.
800 .Pp
801 See also
802 .Sx \&BI ,
803 .Sx \&IB ,
804 .Sx \&BR ,
805 .Sx \&RB ,
806 and
807 .Sx \&IR .
808 .Ss \&RS
809 Temporarily reset the default left margin.
810 This has the following syntax:
811 .Bd -filled -offset indent
812 .Pf \. Sx \&RS
813 .Op Cm width
814 .Ed
815 .Pp
816 The
817 .Cm width
818 argument must conform to
819 .Sx Scaling Widths .
820 If not specified, the saved or default width is used.
821 .Pp
822 See also
823 .Sx \&RE .
824 .Ss \&SB
825 Text is rendered in small size (one point smaller than the default font)
826 bold face.
827 .Ss \&SH
828 Begin a section.
829 The scope of a section is only closed by another section or the end of
830 file.
831 The paragraph left-margin width is reset to the default.
832 .Ss \&SM
833 Text is rendered in small size (one point smaller than the default
834 font).
835 .Ss \&SS
836 Begin a sub-section.
837 The scope of a sub-section is closed by a subsequent sub-section,
838 section, or end of file.
839 The paragraph left-margin width is reset to the default.
840 .Ss \&TH
841 Sets the title of the manual page with the following syntax:
842 .Bd -filled -offset indent
843 .Pf \. Sx \&TH
844 .Ar title section date
845 .Op Ar source Op Ar volume
846 .Ed
847 .Pp
848 Conventionally, the document
849 .Ar title
850 is given in all caps.
851 The recommended
852 .Ar date
853 format is
854 .Sy YYYY-MM-DD
855 as specified in the ISO-8601 standard;
856 if the argument does not conform, it is printed verbatim.
857 If the
858 .Ar date
859 is empty or not specified, the current date is used.
860 The optional
861 .Ar source
862 string specifies the organisation providing the utility.
863 The
864 .Ar volume
865 string replaces the default rendered volume, which is dictated by the
866 manual section.
867 .Pp
868 Examples:
869 .Pp
870 .Dl \&.TH CVS 5 "1992-02-12" GNU
871 .Ss \&TP
872 Begin a paragraph where the head, if exceeding the indentation width, is
873 followed by a newline; if not, the body follows on the same line after a
874 buffer to the indentation width.
875 Subsequent output lines are indented.
876 The syntax is as follows:
877 .Bd -filled -offset indent
878 .Pf \. Sx \&TP
879 .Op Cm width
880 .Ed
881 .Pp
882 The
883 .Cm width
884 argument must conform to
885 .Sx Scaling Widths .
886 If specified, it's saved for later paragraph left-margins; if
887 unspecified, the saved or default width is used.
888 .Pp
889 See also
890 .Sx \&HP ,
891 .Sx \&IP ,
892 .Sx \&LP ,
893 .Sx \&P ,
894 and
895 .Sx \&PP .
896 .Ss \&UC
897 Sets the volume for the footer for compatibility with man pages from
898 BSD releases.
899 The optional first argument specifies which release it is from.
900 .Ss \&br
901 Breaks the current line.
902 Consecutive invocations have no further effect.
903 .Pp
904 See also
905 .Sx \&sp .
906 .Ss \&fi
907 End literal mode begun by
908 .Sx \&nf .
909 .Ss \&ft
910 Change the current font mode.
911 See
912 .Sx Text Decoration
913 for a listing of available font modes.
914 .Ss \&in
915 Indent relative to the current indentation:
916 .Pp
917 .D1 Pf \. Sx \&in Op Cm width
918 .Pp
919 If
920 .Cm width
921 is signed, the new offset is relative.
922 Otherwise, it is absolute.
923 This value is reset upon the next paragraph, section, or sub-section.
924 .Ss \&na
925 Don't align to the right margin.
926 .Ss \&nf
927 Begin literal mode: all subsequent free-form lines have their end of
928 line boundaries preserved.
929 May be ended by
930 .Sx \&fi .
931 Literal mode is implicitly ended by
932 .Sx \&SH
933 or
934 .Sx \&SS .
935 .Ss \&sp
936 Insert vertical spaces into output with the following syntax:
937 .Bd -filled -offset indent
938 .Pf \. Sx \&sp
939 .Op Cm height
940 .Ed
941 .Pp
942 Insert
943 .Cm height
944 spaces, which must conform to
945 .Sx Scaling Widths .
946 If 0, this is equivalent to the
947 .Sx \&br
948 macro.
949 Defaults to 1, if unspecified.
950 .Pp
951 See also
952 .Sx \&br .
953 .Sh COMPATIBILITY
954 This section documents areas of questionable portability between
955 implementations of the
956 .Nm
957 language.
958 .Pp
959 .Bl -dash -compact
960 .It
961 In quoted literals, GNU troff allowed pair-wise double-quotes to produce
962 a standalone double-quote in formatted output.
963 It is not known whether this behaviour is exhibited by other formatters.
964 .It
965 troff suppresses a newline before
966 .Sq \(aq
967 macro output; in mandoc, it is an alias for the standard
968 .Sq \&.
969 control character.
970 .It
971 The
972 .Sq \eh
973 .Pq horizontal position ,
974 .Sq \ev
975 .Pq vertical position ,
976 .Sq \em
977 .Pq text colour ,
978 .Sq \eM
979 .Pq text filling colour ,
980 .Sq \ez
981 .Pq zero-length character ,
982 .Sq \ew
983 .Pq string length ,
984 .Sq \ek
985 .Pq horizontal position marker ,
986 .Sq \eo
987 .Pq text overstrike ,
988 and
989 .Sq \es
990 .Pq text size
991 escape sequences are all discarded in mandoc.
992 .It
993 The
994 .Sq \ef
995 scaling unit is accepted by mandoc, but rendered as the default unit.
996 .It
997 The
998 .Sx \&sp
999 macro does not accept negative values in mandoc.
1000 In GNU troff, this would result in strange behaviour.
1001 .El
1002 .Sh SEE ALSO
1003 .Xr man 1 ,
1004 .Xr mandoc 1 ,
1005 .Xr eqn 7 ,
1006 .Xr mandoc_char 7 ,
1007 .Xr mdoc 7 ,
1008 .Xr roff 7 ,
1009 .Xr tbl 7
1010 .Sh HISTORY
1011 The
1012 .Nm
1013 language first appeared as a macro package for the roff typesetting
1014 system in
1015 .At v7 .
1016 It was later rewritten by James Clark as a macro package for groff.
1017 The stand-alone implementation that is part of the
1018 .Xr mandoc 1
1019 utility written by Kristaps Dzonsons appeared in
1020 .Ox 4.6 .
1021 .Sh AUTHORS
1022 This
1023 .Nm
1024 reference was written by
1025 .An Kristaps Dzonsons Aq kristaps@bsd.lv .
1026 .Sh CAVEATS
1027 Do not use this language.
1028 Use
1029 .Xr mdoc 7 ,
1030 instead.