]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/mdocml/roff.7
Merge compiler-rt release_38 branch r258968.
[FreeBSD/FreeBSD.git] / contrib / mdocml / roff.7
1 .\"     $Id: roff.7,v 1.75 2015/09/24 18:41:22 schwarze Exp $
2 .\"
3 .\" Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
4 .\" Copyright (c) 2010, 2011, 2013-2015 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: September 24 2015 $
19 .Dt ROFF 7
20 .Os
21 .Sh NAME
22 .Nm roff
23 .Nd roff language reference for mandoc
24 .Sh DESCRIPTION
25 The
26 .Nm roff
27 language is a general purpose text formatting language.
28 Since traditional implementations of the
29 .Xr mdoc 7
30 and
31 .Xr man 7
32 manual formatting languages are based on it,
33 many real-world manuals use small numbers of
34 .Nm
35 requests and escape sequences intermixed with their
36 .Xr mdoc 7
37 or
38 .Xr man 7
39 code.
40 To properly format such manuals, the
41 .Xr mandoc 1
42 utility supports a tiny subset of
43 .Nm
44 requests and escapes.
45 Only these requests and escapes supported by
46 .Xr mandoc 1
47 are documented in the present manual,
48 together with the basic language syntax shared by
49 .Nm ,
50 .Xr mdoc 7 ,
51 and
52 .Xr man 7 .
53 For complete
54 .Nm
55 manuals, consult the
56 .Sx SEE ALSO
57 section.
58 .Pp
59 Input lines beginning with the control character
60 .Sq \&.
61 are parsed for requests and macros.
62 Such lines are called
63 .Dq request lines
64 or
65 .Dq macro lines ,
66 respectively.
67 Requests change the processing state and manipulate the formatting;
68 some macros also define the document structure and produce formatted
69 output.
70 The single quote
71 .Pq Qq \(aq
72 is accepted as an alternative control character,
73 treated by
74 .Xr mandoc 1
75 just like
76 .Ql \&.
77 .Pp
78 Lines not beginning with control characters are called
79 .Dq text lines .
80 They provide free-form text to be printed; the formatting of the text
81 depends on the respective processing context.
82 .Sh LANGUAGE SYNTAX
83 .Nm
84 documents may contain only graphable 7-bit ASCII characters, the space
85 character, and, in certain circumstances, the tab character.
86 The backslash character
87 .Sq \e
88 indicates the start of an escape sequence, used for example for
89 .Sx Comments ,
90 .Sx Special Characters ,
91 .Sx Predefined Strings ,
92 and
93 user-defined strings defined using the
94 .Sx ds
95 request.
96 For a listing of escape sequences, consult the
97 .Sx ESCAPE SEQUENCE REFERENCE
98 below.
99 .Ss Comments
100 Text following an escaped double-quote
101 .Sq \e\(dq ,
102 whether in a request, macro, or text line, is ignored to the end of the line.
103 A request line beginning with a control character and comment escape
104 .Sq \&.\e\(dq
105 is also ignored.
106 Furthermore, request lines with only a control character and optional
107 trailing whitespace are stripped from input.
108 .Pp
109 Examples:
110 .Bd -literal -offset indent -compact
111 \&.\e\(dq This is a comment line.
112 \&.\e\(dq The next line is ignored:
113 \&.
114 \&.Sh EXAMPLES \e\(dq This is a comment, too.
115 \&example text \e\(dq And so is this.
116 .Ed
117 .Ss Special Characters
118 Special characters are used to encode special glyphs and are rendered
119 differently across output media.
120 They may occur in request, macro, and text lines.
121 Sequences begin with the escape character
122 .Sq \e
123 followed by either an open-parenthesis
124 .Sq \&(
125 for two-character sequences; an open-bracket
126 .Sq \&[
127 for n-character sequences (terminated at a close-bracket
128 .Sq \&] ) ;
129 or a single one character sequence.
130 .Pp
131 Examples:
132 .Bl -tag -width Ds -offset indent -compact
133 .It Li \e(em
134 Two-letter em dash escape.
135 .It Li \ee
136 One-letter backslash escape.
137 .El
138 .Pp
139 See
140 .Xr mandoc_char 7
141 for a complete list.
142 .Ss Text Decoration
143 Terms may be text-decorated using the
144 .Sq \ef
145 escape followed by an indicator: B (bold), I (italic), R (regular), or P
146 (revert to previous mode).
147 A numerical representation 3, 2, or 1 (bold, italic, and regular,
148 respectively) may be used instead.
149 The indicator or numerical representative may be preceded by C
150 (constant-width), which is ignored.
151 .Pp
152 The two-character indicator
153 .Sq BI
154 requests a font that is both bold and italic.
155 It may not be portable to old roff implementations.
156 .Pp
157 Examples:
158 .Bl -tag -width Ds -offset indent -compact
159 .It Li \efBbold\efR
160 Write in \fBbold\fP, then switch to regular font mode.
161 .It Li \efIitalic\efP
162 Write in \fIitalic\fP, then return to previous font mode.
163 .It Li \ef(BIbold italic\efP
164 Write in \f(BIbold italic\fP, then return to previous font mode.
165 .El
166 .Pp
167 Text decoration is
168 .Em not
169 recommended for
170 .Xr mdoc 7 ,
171 which encourages semantic annotation.
172 .Ss Predefined Strings
173 Predefined strings, like
174 .Sx Special Characters ,
175 mark special output glyphs.
176 Predefined strings are escaped with the slash-asterisk,
177 .Sq \e* :
178 single-character
179 .Sq \e*X ,
180 two-character
181 .Sq \e*(XX ,
182 and N-character
183 .Sq \e*[N] .
184 .Pp
185 Examples:
186 .Bl -tag -width Ds -offset indent -compact
187 .It Li \e*(Am
188 Two-letter ampersand predefined string.
189 .It Li \e*q
190 One-letter double-quote predefined string.
191 .El
192 .Pp
193 Predefined strings are not recommended for use,
194 as they differ across implementations.
195 Those supported by
196 .Xr mandoc 1
197 are listed in
198 .Xr mandoc_char 7 .
199 Manuals using these predefined strings are almost certainly not portable.
200 .Ss Whitespace
201 Whitespace consists of the space character.
202 In text lines, whitespace is preserved within a line.
203 In request and macro lines, whitespace delimits arguments and is discarded.
204 .Pp
205 Unescaped trailing spaces are stripped from text line input unless in a
206 literal context.
207 In general, trailing whitespace on any input line is discouraged for
208 reasons of portability.
209 In the rare case that a blank character is needed at the end of an
210 input line, it may be forced by
211 .Sq \e\ \e& .
212 .Pp
213 Literal space characters can be produced in the output
214 using escape sequences.
215 In macro lines, they can also be included in arguments using quotation; see
216 .Sx MACRO SYNTAX
217 for details.
218 .Pp
219 Blank text lines, which may include whitespace, are only permitted
220 within literal contexts.
221 If the first character of a text line is a space, that line is printed
222 with a leading newline.
223 .Ss Scaling Widths
224 Many requests and macros support scaled widths for their arguments.
225 The syntax for a scaled width is
226 .Sq Li [+-]?[0-9]*.[0-9]*[:unit:] ,
227 where a decimal must be preceded or followed by at least one digit.
228 Negative numbers, while accepted, are truncated to zero.
229 .Pp
230 The following scaling units are accepted:
231 .Pp
232 .Bl -tag -width Ds -offset indent -compact
233 .It c
234 centimetre
235 .It i
236 inch
237 .It P
238 pica (~1/6 inch)
239 .It p
240 point (~1/72 inch)
241 .It f
242 scale
243 .Sq u
244 by 65536
245 .It v
246 default vertical span
247 .It m
248 width of rendered
249 .Sq m
250 .Pq em
251 character
252 .It n
253 width of rendered
254 .Sq n
255 .Pq en
256 character
257 .It u
258 default horizontal span for the terminal
259 .It M
260 mini-em (~1/100 em)
261 .El
262 .Pp
263 Using anything other than
264 .Sq m ,
265 .Sq n ,
266 or
267 .Sq v
268 is necessarily non-portable across output media.
269 See
270 .Sx COMPATIBILITY .
271 .Pp
272 If a scaling unit is not provided, the numerical value is interpreted
273 under the default rules of
274 .Sq v
275 for vertical spaces and
276 .Sq u
277 for horizontal ones.
278 .Pp
279 Examples:
280 .Bl -tag -width ".Bl -tag -width 2i" -offset indent -compact
281 .It Li \&.Bl -tag -width 2i
282 two-inch tagged list indentation in
283 .Xr mdoc 7
284 .It Li \&.HP 2i
285 two-inch tagged list indentation in
286 .Xr man 7
287 .It Li \&.sp 2v
288 two vertical spaces
289 .El
290 .Ss Sentence Spacing
291 Each sentence should terminate at the end of an input line.
292 By doing this, a formatter will be able to apply the proper amount of
293 spacing after the end of sentence (unescaped) period, exclamation mark,
294 or question mark followed by zero or more non-sentence closing
295 delimiters
296 .Po
297 .Sq \&) ,
298 .Sq \&] ,
299 .Sq \&' ,
300 .Sq \&"
301 .Pc .
302 .Pp
303 The proper spacing is also intelligently preserved if a sentence ends at
304 the boundary of a macro line.
305 .Pp
306 Examples:
307 .Bd -literal -offset indent -compact
308 Do not end sentences mid-line like this.  Instead,
309 end a sentence like this.
310 A macro would end like this:
311 \&.Xr mandoc 1 \&.
312 .Ed
313 .Sh REQUEST SYNTAX
314 A request or macro line consists of:
315 .Pp
316 .Bl -enum -compact
317 .It
318 the control character
319 .Sq \&.
320 or
321 .Sq \(aq
322 at the beginning of the line,
323 .It
324 optionally an arbitrary amount of whitespace,
325 .It
326 the name of the request or the macro, which is one word of arbitrary
327 length, terminated by whitespace,
328 .It
329 and zero or more arguments delimited by whitespace.
330 .El
331 .Pp
332 Thus, the following request lines are all equivalent:
333 .Bd -literal -offset indent
334 \&.ig end
335 \&.ig    end
336 \&.   ig end
337 .Ed
338 .Sh MACRO SYNTAX
339 Macros are provided by the
340 .Xr mdoc 7
341 and
342 .Xr man 7
343 languages and can be defined by the
344 .Sx \&de
345 request.
346 When called, they follow the same syntax as requests, except that
347 macro arguments may optionally be quoted by enclosing them
348 in double quote characters
349 .Pq Sq \(dq .
350 Quoted text, even if it contains whitespace or would cause
351 a macro invocation when unquoted, is always considered literal text.
352 Inside quoted text, pairs of double quote characters
353 .Pq Sq Qq
354 resolve to single double quote characters.
355 .Pp
356 To be recognised as the beginning of a quoted argument, the opening
357 quote character must be preceded by a space character.
358 A quoted argument extends to the next double quote character that is not
359 part of a pair, or to the end of the input line, whichever comes earlier.
360 Leaving out the terminating double quote character at the end of the line
361 is discouraged.
362 For clarity, if more arguments follow on the same input line,
363 it is recommended to follow the terminating double quote character
364 by a space character; in case the next character after the terminating
365 double quote character is anything else, it is regarded as the beginning
366 of the next, unquoted argument.
367 .Pp
368 Both in quoted and unquoted arguments, pairs of backslashes
369 .Pq Sq \e\e
370 resolve to single backslashes.
371 In unquoted arguments, space characters can alternatively be included
372 by preceding them with a backslash
373 .Pq Sq \e\~ ,
374 but quoting is usually better for clarity.
375 .Pp
376 Examples:
377 .Bl -tag -width Ds -offset indent -compact
378 .It Li .Fn strlen \(dqconst char *s\(dq
379 Group arguments
380 .Qq const char *s
381 into one function argument.
382 If unspecified,
383 .Qq const ,
384 .Qq char ,
385 and
386 .Qq *s
387 would be considered separate arguments.
388 .It Li .Op \(dqFl a\(dq
389 Consider
390 .Qq \&Fl a
391 as literal text instead of a flag macro.
392 .El
393 .Sh REQUEST REFERENCE
394 The
395 .Xr mandoc 1
396 .Nm
397 parser recognises the following requests.
398 For requests marked as "ignored" or "unsupported", any arguments are
399 ignored, and the number of arguments is not checked.
400 .Ss \&ab
401 Abort processing.
402 Currently unsupported.
403 .Ss \&ad
404 Set line adjustment mode.
405 It takes one argument to select normal, left, right,
406 or center adjustment for subsequent text.
407 Currently ignored.
408 .Ss \&af
409 Assign an output format to a number register.
410 Currently ignored.
411 .Ss \&aln
412 Create an alias for a number register.
413 Currently unsupported.
414 .Ss \&als
415 Create an alias for a request, string, macro, or diversion.
416 Currently unsupported.
417 .Ss \&am
418 Append to a macro definition.
419 The syntax of this request is the same as that of
420 .Sx \&de .
421 .Ss \&am1
422 Append to a macro definition, switching roff compatibility mode off
423 during macro execution (groff extension).
424 The syntax of this request is the same as that of
425 .Sx \&de1 .
426 Since
427 .Xr mandoc 1
428 does not implement
429 .Nm
430 compatibility mode at all, it handles this request as an alias for
431 .Sx \&am .
432 .Ss \&ami
433 Append to a macro definition, specifying the macro name indirectly
434 (groff extension).
435 The syntax of this request is the same as that of
436 .Sx \&dei .
437 .Ss \&ami1
438 Append to a macro definition, specifying the macro name indirectly
439 and switching roff compatibility mode off during macro execution
440 (groff extension).
441 The syntax of this request is the same as that of
442 .Sx \&dei1 .
443 Since
444 .Xr mandoc 1
445 does not implement
446 .Nm
447 compatibility mode at all, it handles this request as an alias for
448 .Sx \&ami .
449 .Ss \&as
450 Append to a user-defined string.
451 The syntax of this request is the same as that of
452 .Sx \&ds .
453 If a user-defined string with the specified name does not yet exist,
454 it is set to the empty string before appending.
455 .Ss \&as1
456 Append to a user-defined string, switching roff compatibility mode off
457 during macro execution (groff extension).
458 The syntax of this request is the same as that of
459 .Sx \&ds1 .
460 Since
461 .Xr mandoc 1
462 does not implement
463 .Nm
464 compatibility mode at all, it handles this request as an alias for
465 .Sx \&as .
466 .Ss \&asciify
467 Fully unformat a diversion.
468 Currently unsupported.
469 .Ss \&backtrace
470 Print a backtrace of the input stack.
471 This is a groff extension and currently ignored.
472 .Ss \&bd
473 Artificially embolden by repeated printing with small shifts.
474 Currently ignored.
475 .Ss \&bleedat
476 Set the BleedBox page parameter for PDF generation.
477 This is a Heirloom extension and currently ignored.
478 .Ss \&blm
479 Set a blank line trap.
480 Currently unsupported.
481 .Ss \&box
482 Begin a diversion without including a partially filled line.
483 Currently unsupported.
484 .Ss \&boxa
485 Add to a diversion without including a partially filled line.
486 Currently unsupported.
487 .Ss \&bp
488 Begin new page.
489 Currently ignored.
490 .Ss \&BP
491 Define a frame and place a picture in it.
492 This is a Heirloom extension and currently unsupported.
493 .Ss \&br
494 Break the output line.
495 See
496 .Xr man 7
497 and
498 .Xr mdoc 7 .
499 .Ss \&break
500 Break out of a
501 .Sx \&while
502 loop.
503 Currently unsupported.
504 .Ss \&breakchar
505 Optional line break characters.
506 This is a Heirloom extension and currently ignored.
507 .Ss \&brnl
508 Break output line after next N input lines.
509 This is a Heirloom extension and currently ignored.
510 .Ss \&brp
511 Break and spread output line.
512 Currently, this is implemented as an alias for
513 .Sx \&br .
514 .Ss \&brpnl
515 Break and spread output line after next N input lines.
516 This is a Heirloom extension and currently ignored.
517 .Ss \&c2
518 Change the no-break control character.
519 Currently unsupported.
520 .Ss \&cc
521 Change the control character.
522 Its syntax is as follows:
523 .Bd -literal -offset indent
524 .Pf . Cm \&cc Op Ar c
525 .Ed
526 .Pp
527 If
528 .Ar c
529 is not specified, the control character is reset to
530 .Sq \&. .
531 Trailing characters are ignored.
532 .Ss \&ce
533 Center some lines.
534 It takes one integer argument, specifying how many lines to center.
535 Currently ignored.
536 .Ss \&cf
537 Output the contents of a file.
538 Ignored because insecure.
539 .Ss \&cflags
540 Set character flags.
541 This is a groff extension and currently ignored.
542 .Ss \&ch
543 Change a trap location.
544 Currently ignored.
545 .Ss \&char
546 Define a new glyph.
547 Currently unsupported.
548 .Ss \&chop
549 Remove the last character from a macro, string, or diversion.
550 Currently unsupported.
551 .Ss \&class
552 Define a character class.
553 This is a groff extension and currently ignored.
554 .Ss \&close
555 Close an open file.
556 Ignored because insecure.
557 .Ss \&CL
558 Print text in color.
559 This is a Heirloom extension and currently unsupported.
560 .Ss \&color
561 Activate or deactivate colors.
562 This is a groff extension and currently ignored.
563 .Ss \&composite
564 Define a name component for composite glyph names.
565 This is a groff extension and currently unsupported.
566 .Ss \&continue
567 Immediately start the next iteration of a
568 .Sx \&while
569 loop.
570 Currently unsupported.
571 .Ss \&cp
572 Switch
573 .Nm
574 compatibility mode on or off.
575 Currently ignored.
576 .Ss \&cropat
577 Set the CropBox page parameter for PDF generation.
578 This is a Heirloom extension and currently ignored.
579 .Ss \&cs
580 Constant character spacing mode.
581 Currently ignored.
582 .Ss \&cu
583 Underline including whitespace.
584 Currently ignored.
585 .Ss \&da
586 Append to a diversion.
587 Currently unsupported.
588 .Ss \&dch
589 Change a trap location in the current diversion.
590 This is a Heirloom extension and currently unsupported.
591 .Ss \&de
592 Define a
593 .Nm
594 macro.
595 Its syntax can be either
596 .Bd -literal -offset indent
597 .Pf . Cm \&de Ar name
598 .Ar macro definition
599 \&..
600 .Ed
601 .Pp
602 or
603 .Bd -literal -offset indent
604 .Pf . Cm \&de Ar name Ar end
605 .Ar macro definition
606 .Pf . Ar end
607 .Ed
608 .Pp
609 Both forms define or redefine the macro
610 .Ar name
611 to represent the
612 .Ar macro definition ,
613 which may consist of one or more input lines, including the newline
614 characters terminating each line, optionally containing calls to
615 .Nm
616 requests,
617 .Nm
618 macros or high-level macros like
619 .Xr man 7
620 or
621 .Xr mdoc 7
622 macros, whichever applies to the document in question.
623 .Pp
624 Specifying a custom
625 .Ar end
626 macro works in the same way as for
627 .Sx \&ig ;
628 namely, the call to
629 .Sq Pf . Ar end
630 first ends the
631 .Ar macro definition ,
632 and after that, it is also evaluated as a
633 .Nm
634 request or
635 .Nm
636 macro, but not as a high-level macro.
637 .Pp
638 The macro can be invoked later using the syntax
639 .Pp
640 .D1 Pf . Ar name Op Ar argument Op Ar argument ...
641 .Pp
642 Regarding argument parsing, see
643 .Sx MACRO SYNTAX
644 above.
645 .Pp
646 The line invoking the macro will be replaced
647 in the input stream by the
648 .Ar macro definition ,
649 replacing all occurrences of
650 .No \e\e$ Ns Ar N ,
651 where
652 .Ar N
653 is a digit, by the
654 .Ar N Ns th Ar argument .
655 For example,
656 .Bd -literal -offset indent
657 \&.de ZN
658 \efI\e^\e\e$1\e^\efP\e\e$2
659 \&..
660 \&.ZN XtFree .
661 .Ed
662 .Pp
663 produces
664 .Pp
665 .D1 \efI\e^XtFree\e^\efP.
666 .Pp
667 in the input stream, and thus in the output: \fI\^XtFree\^\fP.
668 Each occurrence of \e\e$* is replaced with all the arguments,
669 joined together with single blank characters.
670 .Pp
671 Since macros and user-defined strings share a common string table,
672 defining a macro
673 .Ar name
674 clobbers the user-defined string
675 .Ar name ,
676 and the
677 .Ar macro definition
678 can also be printed using the
679 .Sq \e*
680 string interpolation syntax described below
681 .Sx ds ,
682 but this is rarely useful because every macro definition contains at least
683 one explicit newline character.
684 .Pp
685 In order to prevent endless recursion, both groff and
686 .Xr mandoc 1
687 limit the stack depth for expanding macros and strings
688 to a large, but finite number, and
689 .Xr mandoc 1
690 also limits the length of the expanded input line.
691 Do not rely on the exact values of these limits.
692 .Ss \&de1
693 Define a
694 .Nm
695 macro that will be executed with
696 .Nm
697 compatibility mode switched off during macro execution.
698 This is a groff extension.
699 Since
700 .Xr mandoc 1
701 does not implement
702 .Nm
703 compatibility mode at all, it handles this request as an alias for
704 .Sx \&de .
705 .Ss \&defcolor
706 Define a color name.
707 This is a groff extension and currently ignored.
708 .Ss \&dei
709 Define a
710 .Nm
711 macro, specifying the macro name indirectly (groff extension).
712 The syntax of this request is the same as that of
713 .Sx \&de .
714 The request
715 .Pp
716 .D1 Pf . Cm \&dei Ar name Op Ar end
717 .Pp
718 has the same effect as:
719 .Pp
720 .D1 Pf . Cm \&de No \e* Ns Bo Ar name Bc Op \e* Ns Bq Ar end
721 .Ss \&dei1
722 Define a
723 .Nm
724 macro that will be executed with
725 .Nm
726 compatibility mode switched off during macro execution,
727 specifying the macro name indirectly (groff extension).
728 Since
729 .Xr mandoc 1
730 does not implement
731 .Nm
732 compatibility mode at all, it handles this request as an alias for
733 .Sx \&dei .
734 .Ss \&device
735 This request only makes sense with the groff-specific intermediate
736 output format and is unsupported.
737 .Ss \&devicem
738 This request only makes sense with the groff-specific intermediate
739 output format and is unsupported.
740 .Ss \&di
741 Begin a diversion.
742 Currently unsupported.
743 .Ss \&do
744 Execute
745 .Nm
746 request or macro line with compatibility mode disabled.
747 Currently unsupported.
748 .Ss \&ds
749 Define a user-defined string.
750 Its syntax is as follows:
751 .Pp
752 .D1 Pf . Cm \&ds Ar name Oo \(dq Oc Ns Ar string
753 .Pp
754 The
755 .Ar name
756 and
757 .Ar string
758 arguments are space-separated.
759 If the
760 .Ar string
761 begins with a double-quote character, that character will not be part
762 of the string.
763 All remaining characters on the input line form the
764 .Ar string ,
765 including whitespace and double-quote characters, even trailing ones.
766 .Pp
767 The
768 .Ar string
769 can be interpolated into subsequent text by using
770 .No \e* Ns Bq Ar name
771 for a
772 .Ar name
773 of arbitrary length, or \e*(NN or \e*N if the length of
774 .Ar name
775 is two or one characters, respectively.
776 Interpolation can be prevented by escaping the leading backslash;
777 that is, an asterisk preceded by an even number of backslashes
778 does not trigger string interpolation.
779 .Pp
780 Since user-defined strings and macros share a common string table,
781 defining a string
782 .Ar name
783 clobbers the macro
784 .Ar name ,
785 and the
786 .Ar name
787 used for defining a string can also be invoked as a macro,
788 in which case the following input line will be appended to the
789 .Ar string ,
790 forming a new input line passed to the
791 .Nm
792 parser.
793 For example,
794 .Bd -literal -offset indent
795 \&.ds badidea .S
796 \&.badidea
797 H SYNOPSIS
798 .Ed
799 .Pp
800 invokes the
801 .Cm SH
802 macro when used in a
803 .Xr man 7
804 document.
805 Such abuse is of course strongly discouraged.
806 .Ss \&ds1
807 Define a user-defined string that will be expanded with
808 .Nm
809 compatibility mode switched off during string expansion.
810 This is a groff extension.
811 Since
812 .Xr mandoc 1
813 does not implement
814 .Nm
815 compatibility mode at all, it handles this request as an alias for
816 .Sx \&ds .
817 .Ss \&dwh
818 Set a location trap in the current diversion.
819 This is a Heirloom extension and currently unsupported.
820 .Ss \&dt
821 Set a trap within a diversion.
822 Currently unsupported.
823 .Ss \&ec
824 Change the escape character.
825 Currently unsupported.
826 .Ss \&ecs
827 Restore the escape character.
828 Currently unsupported.
829 .Ss \&ecr
830 Save the escape character.
831 Currently unsupported.
832 .Ss \&el
833 The
834 .Qq else
835 half of an if/else conditional.
836 Pops a result off the stack of conditional evaluations pushed by
837 .Sx \&ie
838 and uses it as its conditional.
839 If no stack entries are present (e.g., due to no prior
840 .Sx \&ie
841 calls)
842 then false is assumed.
843 The syntax of this request is similar to
844 .Sx \&if
845 except that the conditional is missing.
846 .Ss \&em
847 Set a trap at the end of input.
848 Currently unsupported.
849 .Ss \&EN
850 End an equation block.
851 See
852 .Sx \&EQ .
853 .Ss \&eo
854 Disable the escape mechanism completely.
855 Currently unsupported.
856 .Ss \&EP
857 End a picture started by
858 .Sx \&BP .
859 This is a Heirloom extension and currently unsupported.
860 .Ss \&EQ
861 Begin an equation block.
862 See
863 .Xr eqn 7
864 for a description of the equation language.
865 .Ss \&errprint
866 Print a string like an error message.
867 This is a Heirloom extension and currently ignored.
868 .Ss \&ev
869 Switch to another environment.
870 Currently unsupported.
871 .Ss \&evc
872 Copy an environment into the current environment.
873 Currently unsupported.
874 .Ss \&ex
875 Abort processing and exit.
876 Currently unsupported.
877 .Ss \&fallback
878 Select the fallback sequence for a font.
879 This is a Heirloom extension and currently ignored.
880 .Ss \&fam
881 Change the font family.
882 Takes one argument specifying the font family to be selected.
883 It is a groff extension and currently ignored.
884 .Ss \&fc
885 Define a delimiting and a padding character for fields.
886 Currently unsupported.
887 .Ss \&fchar
888 Define a fallback glyph.
889 Currently unsupported.
890 .Ss \&fcolor
891 Set the fill color for \eD objects.
892 This is a groff extension and currently ignored.
893 .Ss \&fdeferlig
894 Defer ligature building.
895 This is a Heirloom extension and currently ignored.
896 .Ss \&feature
897 Enable or disable an OpenType feature.
898 This is a Heirloom extension and currently ignored.
899 .Ss \&fi
900 Switch to fill mode.
901 See
902 .Xr man 7 .
903 Ignored in
904 .Xr mdoc 7 .
905 .Ss \&fkern
906 Control the use of kerning tables for a font.
907 This is a Heirloom extension and currently ignored.
908 .Ss \&fl
909 Flush output.
910 Currently ignored.
911 .Ss \&flig
912 Define ligatures.
913 This is a Heirloom extension and currently ignored.
914 .Ss \&fp
915 Assign font position.
916 Currently ignored.
917 .Ss \&fps
918 Mount a font with a special character map.
919 This is a Heirloom extension and currently ignored.
920 .Ss \&fschar
921 Define a font-specific fallback glyph.
922 This is a groff extension and currently unsupported.
923 .Ss \&fspacewidth
924 Set a font-specific width for the space character.
925 This is a Heirloom extension and currently ignored.
926 .Ss \&fspecial
927 Conditionally define a special font.
928 This is a groff extension and currently ignored.
929 .Ss \&ft
930 Change the font.
931 Its syntax is as follows:
932 .Pp
933 .D1 Pf . Cm \&ft Op Ar font
934 .Pp
935 The following
936 .Ar font
937 arguments are supported:
938 .Bl -tag -width 4n -offset indent
939 .It Cm B , BI , 3 , 4
940 switches to
941 .Sy bold
942 font
943 .It Cm I , 2
944 switches to
945 .Em underlined
946 font
947 .It Cm R , CW , 1
948 switches to normal font
949 .It Cm P No "or no argument"
950 switches back to the previous font
951 .El
952 .Pp
953 This request takes effect only locally, may be overridden by macros
954 and escape sequences, and is only supported in
955 .Xr man 7
956 for now.
957 .Ss \&ftr
958 Translate font name.
959 This is a groff extension and currently ignored.
960 .Ss \&fzoom
961 Zoom font size.
962 Currently ignored.
963 .Ss \&gcolor
964 Set glyph color.
965 This is a groff extension and currently ignored.
966 .Ss \&hc
967 Set the hyphenation character.
968 Currently ignored.
969 .Ss \&hcode
970 Set hyphenation codes of characters.
971 Currently ignored.
972 .Ss \&hidechar
973 Hide characters in a font.
974 This is a Heirloom extension and currently ignored.
975 .Ss \&hla
976 Set hyphenation language.
977 This is a groff extension and currently ignored.
978 .Ss \&hlm
979 Set maximum number of consecutive hyphenated lines.
980 Currently ignored.
981 .Ss \&hpf
982 Load hyphenation pattern file.
983 This is a groff extension and currently ignored.
984 .Ss \&hpfa
985 Load hyphenation pattern file, appending to the current patterns.
986 This is a groff extension and currently ignored.
987 .Ss \&hpfcode
988 Define mapping values for character codes in hyphenation patterns.
989 This is a groff extension and currently ignored.
990 .Ss \&hw
991 Specify hyphenation points in words.
992 Currently ignored.
993 .Ss \&hy
994 Set automatic hyphenation mode.
995 Currently ignored.
996 .Ss \&hylang
997 Set hyphenation language.
998 This is a Heirloom extension and currently ignored.
999 .Ss \&hylen
1000 Minimum word length for hyphenation.
1001 This is a Heirloom extension and currently ignored.
1002 .Ss \&hym
1003 Set hyphenation margin.
1004 This is a groff extension and currently ignored.
1005 .Ss \&hypp
1006 Define hyphenation penalties.
1007 This is a Heirloom extension and currently ignored.
1008 .Ss \&hys
1009 Set hyphenation space.
1010 This is a groff extension and currently ignored.
1011 .Ss \&ie
1012 The
1013 .Qq if
1014 half of an if/else conditional.
1015 The result of the conditional is pushed into a stack used by subsequent
1016 invocations of
1017 .Sx \&el ,
1018 which may be separated by any intervening input (or not exist at all).
1019 Its syntax is equivalent to
1020 .Sx \&if .
1021 .Ss \&if
1022 Begins a conditional.
1023 This request has the following syntax:
1024 .Bd -literal -offset indent
1025 \&.if COND BODY
1026 .Ed
1027 .Bd -literal -offset indent
1028 \&.if COND \e{BODY
1029 BODY...\e}
1030 .Ed
1031 .Bd -literal -offset indent
1032 \&.if COND \e{\e
1033 BODY...
1034 \&.\e}
1035 .Ed
1036 .Pp
1037 COND is a conditional statement.
1038 Currently,
1039 .Xr mandoc 1
1040 supports the following subset of roff conditionals:
1041 .Bl -bullet
1042 .It
1043 If
1044 .Sq \&!
1045 is prefixed to COND, the condition is logically inverted.
1046 .It
1047 If the first character of COND is
1048 .Sq n
1049 .Pq nroff mode
1050 or
1051 .Sq o
1052 .Pq odd page ,
1053 COND evaluates to true.
1054 .It
1055 If the first character of COND is
1056 .Sq c
1057 .Pq character available ,
1058 .Sq d
1059 .Pq string defined ,
1060 .Sq e
1061 .Pq even page ,
1062 .Sq t
1063 .Pq troff mode ,
1064 or
1065 .Sq v
1066 .Pq vroff mode ,
1067 COND evaluates to false.
1068 .It
1069 If the first character of COND is
1070 .Sq r ,
1071 it evaluates to true if the rest of COND is the name of an existing
1072 number register; otherwise, it evaluates to false.
1073 .It
1074 If COND starts with a parenthesis or with an optionally signed
1075 integer number, it is evaluated according to the rules of
1076 .Sx Numerical expressions
1077 explained below.
1078 It evaluates to true if the result is positive,
1079 or to false if the result is zero or negative.
1080 .It
1081 Otherwise, the first character of COND is regarded as a delimiter
1082 and COND evaluates to true if the string extending from its first
1083 to its second occurrence is equal to the string extending from its
1084 second to its third occurrence.
1085 .It
1086 If COND cannot be parsed, it evaluates to false.
1087 .El
1088 .Pp
1089 If a conditional is false, its children are not processed, but are
1090 syntactically interpreted to preserve the integrity of the input
1091 document.
1092 Thus,
1093 .Pp
1094 .D1 \&.if t .ig
1095 .Pp
1096 will discard the
1097 .Sq \&.ig ,
1098 which may lead to interesting results, but
1099 .Pp
1100 .D1 \&.if t .if t \e{\e
1101 .Pp
1102 will continue to syntactically interpret to the block close of the final
1103 conditional.
1104 Sub-conditionals, in this case, obviously inherit the truth value of
1105 the parent.
1106 .Pp
1107 If the BODY section is begun by an escaped brace
1108 .Sq \e{ ,
1109 scope continues until the end of the input line containing the
1110 matching closing-brace escape sequence
1111 .Sq \e} .
1112 If the BODY is not enclosed in braces, scope continues until
1113 the end of the line.
1114 If the COND is followed by a BODY on the same line, whether after a
1115 brace or not, then requests and macros
1116 .Em must
1117 begin with a control character.
1118 It is generally more intuitive, in this case, to write
1119 .Bd -literal -offset indent
1120 \&.if COND \e{\e
1121 \&.foo
1122 bar
1123 \&.\e}
1124 .Ed
1125 .Pp
1126 than having the request or macro follow as
1127 .Pp
1128 .D1 \&.if COND \e{ .foo
1129 .Pp
1130 The scope of a conditional is always parsed, but only executed if the
1131 conditional evaluates to true.
1132 .Pp
1133 Note that the
1134 .Sq \e}
1135 is converted into a zero-width escape sequence if not passed as a
1136 standalone macro
1137 .Sq \&.\e} .
1138 For example,
1139 .Pp
1140 .D1 \&.Fl a \e} b
1141 .Pp
1142 will result in
1143 .Sq \e}
1144 being considered an argument of the
1145 .Sq \&Fl
1146 macro.
1147 .Ss \&ig
1148 Ignore input.
1149 Its syntax can be either
1150 .Bd -literal -offset indent
1151 .Pf . Cm \&ig
1152 .Ar ignored text
1153 \&..
1154 .Ed
1155 .Pp
1156 or
1157 .Bd -literal -offset indent
1158 .Pf . Cm \&ig Ar end
1159 .Ar ignored text
1160 .Pf . Ar end
1161 .Ed
1162 .Pp
1163 In the first case, input is ignored until a
1164 .Sq \&..
1165 request is encountered on its own line.
1166 In the second case, input is ignored until the specified
1167 .Sq Pf . Ar end
1168 macro is encountered.
1169 Do not use the escape character
1170 .Sq \e
1171 anywhere in the definition of
1172 .Ar end ;
1173 it would cause very strange behaviour.
1174 .Pp
1175 When the
1176 .Ar end
1177 macro is a roff request or a roff macro, like in
1178 .Pp
1179 .D1 \&.ig if
1180 .Pp
1181 the subsequent invocation of
1182 .Sx \&if
1183 will first terminate the
1184 .Ar ignored text ,
1185 then be invoked as usual.
1186 Otherwise, it only terminates the
1187 .Ar ignored text ,
1188 and arguments following it or the
1189 .Sq \&..
1190 request are discarded.
1191 .Ss \&in
1192 Change indentation.
1193 See
1194 .Xr man 7 .
1195 Ignored in
1196 .Xr mdoc 7 .
1197 .Ss \&index
1198 Find a substring in a string.
1199 This is a Heirloom extension and currently unsupported.
1200 .Ss \&it
1201 Set an input line trap.
1202 Its syntax is as follows:
1203 .Pp
1204 .D1 Pf . Cm it Ar expression macro
1205 .Pp
1206 The named
1207 .Ar macro
1208 will be invoked after processing the number of input text lines
1209 specified by the numerical
1210 .Ar expression .
1211 While evaluating the
1212 .Ar expression ,
1213 the unit suffixes described below
1214 .Sx Scaling Widths
1215 are ignored.
1216 .Ss \&itc
1217 Set an input line trap, not counting lines ending with \ec.
1218 Currently unsupported.
1219 .Ss \&IX
1220 To support the generation of a table of contents,
1221 .Xr pod2man 1
1222 emits this user-defined macro, usually without defining it.
1223 To avoid reporting large numbers of spurious errors,
1224 .Xr mandoc 1
1225 ignores it.
1226 .Ss \&kern
1227 Switch kerning on or off.
1228 Currently ignored.
1229 .Ss \&kernafter
1230 Increase kerning after some characters.
1231 This is a Heirloom extension and currently ignored.
1232 .Ss \&kernbefore
1233 Increase kerning before some characters.
1234 This is a Heirloom extension and currently ignored.
1235 .Ss \&kernpair
1236 Add a kerning pair to the kerning table.
1237 This is a Heirloom extension and currently ignored.
1238 .Ss \&lc
1239 Define a leader repetition character.
1240 Currently unsupported.
1241 .Ss \&lc_ctype
1242 Set the
1243 .Dv LC_CTYPE
1244 locale.
1245 This is a Heirloom extension and currently unsupported.
1246 .Ss \&lds
1247 Define a local string.
1248 This is a Heirloom extension and currently unsupported.
1249 .Ss \&length
1250 Count the number of input characters in a user-defined string.
1251 Currently unsupported.
1252 .Ss \&letadj
1253 Dynamic letter spacing and reshaping.
1254 This is a Heirloom extension and currently ignored.
1255 .Ss \&lf
1256 Change the line number for error messages.
1257 Ignored because insecure.
1258 .Ss \&lg
1259 Switch the ligature mechanism on or off.
1260 Currently ignored.
1261 .Ss \&lhang
1262 Hang characters at left margin.
1263 This is a Heirloom extension and currently ignored.
1264 .Ss \&linetabs
1265 Enable or disable line-tabs mode.
1266 This is a groff extension and currently unsupported.
1267 .Ss \&ll
1268 Change the output line length.
1269 Its syntax is as follows:
1270 .Pp
1271 .D1 Pf . Cm \&ll Op Oo +|- Oc Ns Ar width
1272 .Pp
1273 If the
1274 .Ar width
1275 argument is omitted, the line length is reset to its previous value.
1276 The default setting for terminal output is 78n.
1277 If a sign is given, the line length is added to or subtracted from;
1278 otherwise, it is set to the provided value.
1279 Using this request in new manuals is discouraged for several reasons,
1280 among others because it overrides the
1281 .Xr mandoc 1
1282 .Fl O Cm width
1283 command line option.
1284 .Ss \&lnr
1285 Set local number register.
1286 This is a Heirloom extension and currently unsupported.
1287 .Ss \&lnrf
1288 Set local floating-point register.
1289 This is a Heirloom extension and currently unsupported.
1290 .Ss \&lpfx
1291 Set a line prefix.
1292 This is a Heirloom extension and currently unsupported.
1293 .Ss \&ls
1294 Set line spacing.
1295 It takes one integer argument specifying the vertical distance of
1296 subsequent output text lines measured in v units.
1297 Currently ignored.
1298 .Ss \&lsm
1299 Set a leading spaces trap.
1300 This is a groff extension and currently unsupported.
1301 .Ss \&lt
1302 Set title line length.
1303 Currently ignored.
1304 .Ss \&mc
1305 Print margin character in the right margin.
1306 Currently ignored.
1307 .Ss \&mediasize
1308 Set the device media size.
1309 This is a Heirloom extension and currently ignored.
1310 .Ss \&minss
1311 Set minimum word space.
1312 This is a Heirloom extension and currently ignored.
1313 .Ss \&mk
1314 Mark vertical position.
1315 Currently ignored.
1316 .Ss \&mso
1317 Load a macro file.
1318 Ignored because insecure.
1319 .Ss \&na
1320 Disable adjusting without changing the adjustment mode.
1321 Currently ignored.
1322 .Ss \&ne
1323 Declare the need for the specified minimum vertical space
1324 before the next trap or the bottom of the page.
1325 Currently ignored.
1326 .Ss \&nf
1327 Switch to no-fill mode.
1328 See
1329 .Xr man 7 .
1330 Ignored by
1331 .Xr mdoc 7 .
1332 .Ss \&nh
1333 Turn off automatic hyphenation mode.
1334 Currently ignored.
1335 .Ss \&nhychar
1336 Define hyphenation-inhibiting characters.
1337 This is a Heirloom extension and currently ignored.
1338 .Ss \&nm
1339 Print line numbers.
1340 Currently unsupported.
1341 .Ss \&nn
1342 Temporarily turn off line numbering.
1343 Currently unsupported.
1344 .Ss \&nop
1345 Execute the rest of the input line as a request or macro line.
1346 Currently unsupported.
1347 .Ss \&nr
1348 Define or change a register.
1349 A register is an arbitrary string value that defines some sort of state,
1350 which influences parsing and/or formatting.
1351 Its syntax is as follows:
1352 .Pp
1353 .D1 Pf \. Cm \&nr Ar name Oo +|- Oc Ns Ar expression
1354 .Pp
1355 For the syntax of
1356 .Ar expression ,
1357 see
1358 .Sx Numerical expressions
1359 below.
1360 If it is prefixed by a sign, the register will be
1361 incremented or decremented instead of assigned to.
1362 .Pp
1363 The following register
1364 .Ar name
1365 is handled specially:
1366 .Bl -tag -width Ds
1367 .It Cm nS
1368 If set to a positive integer value, certain
1369 .Xr mdoc 7
1370 macros will behave in the same way as in the
1371 .Em SYNOPSIS
1372 section.
1373 If set to 0, these macros will behave in the same way as outside the
1374 .Em SYNOPSIS
1375 section, even when called within the
1376 .Em SYNOPSIS
1377 section itself.
1378 Note that starting a new
1379 .Xr mdoc 7
1380 section with the
1381 .Cm \&Sh
1382 macro will reset this register.
1383 .El
1384 .Ss \&nrf
1385 Define or change a floating-point register.
1386 This is a Heirloom extension and currently unsupported.
1387 .Ss \&nroff
1388 Force nroff mode.
1389 This is a groff extension and currently ignored.
1390 .Ss \&ns
1391 Turn on no-space mode.
1392 Currently ignored.
1393 .Ss \&nx
1394 Abort processing of the current input file and process another one.
1395 Ignored because insecure.
1396 .Ss \&open
1397 Open a file for writing.
1398 Ignored because insecure.
1399 .Ss \&opena
1400 Open a file for appending.
1401 Ignored because insecure.
1402 .Ss \&os
1403 Output saved vertical space.
1404 Currently ignored.
1405 .Ss \&output
1406 Output directly to intermediate output.
1407 Not supported.
1408 .Ss \&padj
1409 Globally control paragraph-at-once adjustment.
1410 This is a Heirloom extension and currently ignored.
1411 .Ss \&papersize
1412 Set the paper size.
1413 This is a Heirloom extension and currently ignored.
1414 .Ss \&pc
1415 Change the page number character.
1416 Currently ignored.
1417 .Ss \&pev
1418 Print environments.
1419 This is a groff extension and currently ignored.
1420 .Ss \&pi
1421 Pipe output to a shell command.
1422 Ignored because insecure.
1423 .Ss \&PI
1424 Low-level request used by
1425 .Sx \&BP .
1426 This is a Heirloom extension and currently unsupported.
1427 .Ss \&pl
1428 Change page length.
1429 Takes one height argument.
1430 Currently ignored.
1431 .Ss \&pm
1432 Print names and sizes of macros, strings, and diversions.
1433 Currently ignored.
1434 .Ss \&pn
1435 Change page number of the next page.
1436 Currently ignored.
1437 .Ss \&pnr
1438 Print all number registers.
1439 Currently ignored.
1440 .Ss \&po
1441 Set horizontal page offset.
1442 Currently ignored.
1443 .Ss \&ps
1444 Change point size.
1445 Takes one numerical argument.
1446 Currently ignored.
1447 .Ss \&psbb
1448 Retrieve the bounding box of a PostScript file.
1449 Currently unsupported.
1450 .Ss \&pshape
1451 Set a special shape for the current paragraph.
1452 This is a Heirloom extension and currently unsupported.
1453 .Ss \&pso
1454 Include output of a shell command.
1455 Ignored because insecure.
1456 .Ss \&ptr
1457 Print the names and positions of all traps.
1458 This is a groff extension and currently ignored.
1459 .Ss \&pvs
1460 Change post-vertical spacing.
1461 This is a groff extension and currently ignored.
1462 .Ss \&rchar
1463 Remove glyph definitions.
1464 Currently unsupported.
1465 .Ss \&rd
1466 Read from standard input.
1467 Currently ignored.
1468 .Ss \&recursionlimit
1469 Set the maximum stack depth for recursive macros.
1470 This is a Heirloom extension and currently ignored.
1471 .Ss \&return
1472 Exit a macro and return to the caller.
1473 Currently unsupported.
1474 .Ss \&rfschar
1475 Remove font-specific fallback glyph definitions.
1476 Currently unsupported.
1477 .Ss \&rhang
1478 Hang characters at right margin.
1479 This is a Heirloom extension and currently ignored.
1480 .Ss \&rj
1481 Justify unfilled text to the right margin.
1482 Currently ignored.
1483 .Ss \&rm
1484 Remove a request, macro or string.
1485 Its syntax is as follows:
1486 .Pp
1487 .D1 Pf \. Cm \&rm Ar name
1488 .Ss \&rn
1489 Rename a request, macro, diversion, or string.
1490 Currently unsupported.
1491 .Ss \&rnn
1492 Rename a number register.
1493 Currently unsupported.
1494 .Ss \&rr
1495 Remove a register.
1496 Its syntax is as follows:
1497 .Pp
1498 .D1 Pf \. Cm \&rr Ar name
1499 .Ss \&rs
1500 End no-space mode.
1501 Currently ignored.
1502 .Ss \&rt
1503 Return to marked vertical position.
1504 Currently ignored.
1505 .Ss \&schar
1506 Define global fallback glyph.
1507 This is a groff extension and currently unsupported.
1508 .Ss \&sentchar
1509 Define sentence-ending characters.
1510 This is a Heirloom extension and currently ignored.
1511 .Ss \&shc
1512 Change the soft hyphen character.
1513 Currently ignored.
1514 .Ss \&shift
1515 Shift macro arguments.
1516 Currently unsupported.
1517 .Ss \&sizes
1518 Define permissible point sizes.
1519 This is a groff extension and currently ignored.
1520 .Ss \&so
1521 Include a source file.
1522 Its syntax is as follows:
1523 .Pp
1524 .D1 Pf \. Cm \&so Ar file
1525 .Pp
1526 The
1527 .Ar file
1528 will be read and its contents processed as input in place of the
1529 .Sq \&.so
1530 request line.
1531 To avoid inadvertent inclusion of unrelated files,
1532 .Xr mandoc 1
1533 only accepts relative paths not containing the strings
1534 .Qq ../
1535 and
1536 .Qq /.. .
1537 .Pp
1538 This request requires
1539 .Xr man 1
1540 to change to the right directory before calling
1541 .Xr mandoc 1 ,
1542 per convention to the root of the manual tree.
1543 Typical usage looks like:
1544 .Pp
1545 .Dl \&.so man3/Xcursor.3
1546 .Pp
1547 As the whole concept is rather fragile, the use of
1548 .Sx \&so
1549 is discouraged.
1550 Use
1551 .Xr ln 1
1552 instead.
1553 .Ss \&spacewidth
1554 Set the space width from the font metrics file.
1555 This is a Heirloom extension and currently ignored.
1556 .Ss \&special
1557 Define a special font.
1558 This is a groff extension and currently ignored.
1559 .Ss \&spreadwarn
1560 Warn about wide spacing between words.
1561 Currently ignored.
1562 .Ss \&ss
1563 Set space character size.
1564 Currently ignored.
1565 .Ss \&sty
1566 Associate style with a font position.
1567 This is a groff extension and currently ignored.
1568 .Ss \&substring
1569 Replace a user-defined string with a substring.
1570 Currently unsupported.
1571 .Ss \&sv
1572 Save vertical space.
1573 Currently ignored.
1574 .Ss \&sy
1575 Execute shell command.
1576 Ignored because insecure.
1577 .Ss \&T&
1578 Re-start a table layout, retaining the options of the prior table
1579 invocation.
1580 See
1581 .Sx \&TS .
1582 .Ss \&ta
1583 Set tab stops.
1584 Takes an arbitrary number of arguments.
1585 Currently unsupported.
1586 .Ss \&tc
1587 Change tab repetition character.
1588 Currently unsupported.
1589 .Ss \&TE
1590 End a table context.
1591 See
1592 .Sx \&TS .
1593 .Ss \&ti
1594 Temporary indent.
1595 Currently unsupported.
1596 .Ss \&tkf
1597 Enable track kerning for a font.
1598 Currently ignored.
1599 .Ss \&tl
1600 Print a title line.
1601 Currently unsupported.
1602 .Ss \&tm
1603 Print to standard error output.
1604 Currently ignored.
1605 .Ss \&tm1
1606 Print to standard error output, allowing leading blanks.
1607 This is a groff extension and currently ignored.
1608 .Ss \&tmc
1609 Print to standard error output without a trailing newline.
1610 This is a groff extension and currently ignored.
1611 .Ss \&tr
1612 Output character translation.
1613 Its syntax is as follows:
1614 .Pp
1615 .D1 Pf \. Cm \&tr Ar [ab]+
1616 .Pp
1617 Pairs of
1618 .Ar ab
1619 characters are replaced
1620 .Ar ( a
1621 for
1622 .Ar b ) .
1623 Replacement (or origin) characters may also be character escapes; thus,
1624 .Pp
1625 .Dl tr \e(xx\e(yy
1626 .Pp
1627 replaces all invocations of \e(xx with \e(yy.
1628 .Ss \&track
1629 Static letter space tracking.
1630 This is a Heirloom extension and currently ignored.
1631 .Ss \&transchar
1632 Define transparent characters for sentence-ending.
1633 This is a Heirloom extension and currently ignored.
1634 .Ss \&trf
1635 Output the contents of a file, disallowing invalid characters.
1636 This is a groff extension and ignored because insecure.
1637 .Ss \&trimat
1638 Set the TrimBox page parameter for PDF generation.
1639 This is a Heirloom extension and currently ignored.
1640 .Ss \&trin
1641 Output character translation, ignored by
1642 .Cm \&asciify .
1643 Currently unsupported.
1644 .Ss \&trnt
1645 Output character translation, ignored by \e!.
1646 Currently unsupported.
1647 .Ss \&troff
1648 Force troff mode.
1649 This is a groff extension and currently ignored.
1650 .Ss \&TS
1651 Begin a table, which formats input in aligned rows and columns.
1652 See
1653 .Xr tbl 7
1654 for a description of the tbl language.
1655 .Ss \&uf
1656 Globally set the underline font.
1657 Currently ignored.
1658 .Ss \&ul
1659 Underline.
1660 Currently ignored.
1661 .Ss \&unformat
1662 Unformat spaces and tabs in a diversion.
1663 Currently unsupported.
1664 .Ss \&unwatch
1665 Disable notification for string or macro.
1666 This is a Heirloom extension and currently ignored.
1667 .Ss \&unwatchn
1668 Disable notification for register.
1669 This is a Heirloom extension and currently ignored.
1670 .Ss \&vpt
1671 Enable or disable vertical position traps.
1672 This is a groff extension and currently ignored.
1673 .Ss \&vs
1674 Change vertical spacing.
1675 Currently ignored.
1676 .Ss \&warn
1677 Set warning level.
1678 Currently ignored.
1679 .Ss \&warnscale
1680 Set the scaling indicator used in warnings.
1681 This is a groff extension and currently ignored.
1682 .Ss \&watch
1683 Notify on change of string or macro.
1684 This is a Heirloom extension and currently ignored.
1685 .Ss \&watchlength
1686 On change, report the contents of macros and strings
1687 up to the specified length.
1688 This is a Heirloom extension and currently ignored.
1689 .Ss \&watchn
1690 Notify on change of register.
1691 This is a Heirloom extension and currently ignored.
1692 .Ss \&wh
1693 Set a page location trap.
1694 Currently unsupported.
1695 .Ss \&while
1696 Repeated execution while a condition is true.
1697 Currently unsupported.
1698 .Ss \&write
1699 Write to an open file.
1700 Ignored because insecure.
1701 .Ss \&writec
1702 Write to an open file without appending a newline.
1703 Ignored because insecure.
1704 .Ss \&writem
1705 Write macro or string to an open file.
1706 Ignored because insecure.
1707 .Ss \&xflag
1708 Set the extension level.
1709 This is a Heirloom extension and currently ignored.
1710 .Ss Numerical expressions
1711 The
1712 .Sx \&nr ,
1713 .Sx \&if ,
1714 and
1715 .Sx \&ie
1716 requests accept integer numerical expressions as arguments.
1717 These are always evaluated using the C
1718 .Vt int
1719 type; integer overflow works the same way as in the C language.
1720 Numbers consist of an arbitrary number of digits
1721 .Sq 0
1722 to
1723 .Sq 9
1724 prefixed by an optional sign
1725 .Sq +
1726 or
1727 .Sq - .
1728 Each number may be followed by one optional scaling unit described below
1729 .Sx Scaling Widths .
1730 The following equations hold:
1731 .Bd -literal -offset indent
1732 1i = 6v = 6P = 10m = 10n = 72p = 1000M = 240u = 240
1733 254c = 100i = 24000u = 24000
1734 1f = 65536u = 65536
1735 .Ed
1736 .Pp
1737 The following binary operators are implemented.
1738 Unless otherwise stated, they behave as in the C language:
1739 .Pp
1740 .Bl -tag -width 2n -compact
1741 .It Ic +
1742 addition
1743 .It Ic -
1744 subtraction
1745 .It Ic *
1746 multiplication
1747 .It Ic /
1748 division
1749 .It Ic %
1750 remainder of division
1751 .It Ic <
1752 less than
1753 .It Ic >
1754 greater than
1755 .It Ic ==
1756 equal to
1757 .It Ic =
1758 equal to, same effect as
1759 .Ic ==
1760 (this differs from C)
1761 .It Ic <=
1762 less than or equal to
1763 .It Ic >=
1764 greater than or equal to
1765 .It Ic <>
1766 not equal to (corresponds to C
1767 .Ic != ;
1768 this one is of limited portability, it is supported by Heirloom roff,
1769 but not by groff)
1770 .It Ic &
1771 logical and (corresponds to C
1772 .Ic && )
1773 .It Ic \&:
1774 logical or (corresponds to C
1775 .Ic \&|| )
1776 .It Ic <?
1777 minimum (not available in C)
1778 .It Ic >?
1779 maximum (not available in C)
1780 .El
1781 .Pp
1782 There is no concept of precedence; evaluation proceeds from left to right,
1783 except when subexpressions are enclosed in parantheses.
1784 Inside parentheses, whitespace is ignored.
1785 .Sh ESCAPE SEQUENCE REFERENCE
1786 The
1787 .Xr mandoc 1
1788 .Nm
1789 parser recognises the following escape sequences.
1790 Note that the
1791 .Nm
1792 language defines more escape sequences not implemented in
1793 .Xr mandoc 1 .
1794 In
1795 .Xr mdoc 7
1796 and
1797 .Xr man 7
1798 documents, using escape sequences is discouraged except for those
1799 described in the
1800 .Sx LANGUAGE SYNTAX
1801 section above.
1802 .Pp
1803 A backslash followed by any character not listed here
1804 simply prints that character itself.
1805 .Ss \e<newline>
1806 A backslash at the end of an input line can be used to continue the
1807 logical input line on the next physical input line, joining the text
1808 on both lines together as if it were on a single input line.
1809 .Ss \e<space>
1810 The escape sequence backslash-space
1811 .Pq Sq \e\ \&
1812 is an unpaddable space-sized non-breaking space character; see
1813 .Sx Whitespace .
1814 .Ss \e\(dq
1815 The rest of the input line is treated as
1816 .Sx Comments .
1817 .Ss \e%
1818 Hyphenation allowed at this point of the word; ignored by
1819 .Xr mandoc 1 .
1820 .Ss \e&
1821 Non-printing zero-width character; see
1822 .Sx Whitespace .
1823 .Ss \e\(aq
1824 Acute accent special character; use
1825 .Sq \e(aa
1826 instead.
1827 .Ss \e( Ns Ar cc
1828 .Sx Special Characters
1829 with two-letter names, see
1830 .Xr mandoc_char 7 .
1831 .Ss \e*[ Ns Ar name ]
1832 Interpolate the string with the
1833 .Ar name ;
1834 see
1835 .Sx Predefined Strings
1836 and
1837 .Sx ds .
1838 For short names, there are variants
1839 .No \e* Ns Ar c
1840 and
1841 .No \e*( Ns Ar cc .
1842 .Ss \e,
1843 Left italic correction (groff extension); ignored by
1844 .Xr mandoc 1 .
1845 .Ss \e-
1846 Special character
1847 .Dq mathematical minus sign .
1848 .Ss \e/
1849 Right italic correction (groff extension); ignored by
1850 .Xr mandoc 1 .
1851 .Ss \e[ Ns Ar name ]
1852 .Sx Special Characters
1853 with names of arbitrary length, see
1854 .Xr mandoc_char 7 .
1855 .Ss \e^
1856 One-twelfth em half-narrow space character, effectively zero-width in
1857 .Xr mandoc 1 .
1858 .Ss \e`
1859 Grave accent special character; use
1860 .Sq \e(ga
1861 instead.
1862 .Ss \e{
1863 Begin conditional input; see
1864 .Sx if .
1865 .Ss \e\(ba
1866 One-sixth em narrow space character, effectively zero-width in
1867 .Xr mandoc 1 .
1868 .Ss \e}
1869 End conditional input; see
1870 .Sx if .
1871 .Ss \e~
1872 Paddable non-breaking space character.
1873 .Ss \e0
1874 Digit width space character.
1875 .Ss \eA\(aq Ns Ar string Ns \(aq
1876 Anchor definition; ignored by
1877 .Xr mandoc 1 .
1878 .Ss \eB\(aq Ns Ar string Ns \(aq
1879 Interpolate
1880 .Sq 1
1881 if
1882 .Ar string
1883 conforms to the syntax of
1884 .Sx Numerical expressions
1885 explained above and
1886 .Sq 0
1887 otherwise.
1888 .Ss \eb\(aq Ns Ar string Ns \(aq
1889 Bracket building function; ignored by
1890 .Xr mandoc 1 .
1891 .Ss \eC\(aq Ns Ar name Ns \(aq
1892 .Sx Special Characters
1893 with names of arbitrary length.
1894 .Ss \ec
1895 When encountered at the end of an input text line,
1896 the next input text line is considered to continue that line,
1897 even if there are request or macro lines in between.
1898 No whitespace is inserted.
1899 .Ss \eD\(aq Ns Ar string Ns \(aq
1900 Draw graphics function; ignored by
1901 .Xr mandoc 1 .
1902 .Ss \ed
1903 Move down by half a line; ignored by
1904 .Xr mandoc 1 .
1905 .Ss \ee
1906 Backslash special character.
1907 .Ss \eF[ Ns Ar name ]
1908 Switch font family (groff extension); ignored by
1909 .Xr mandoc 1 .
1910 For short names, there are variants
1911 .No \eF Ns Ar c
1912 and
1913 .No \eF( Ns Ar cc .
1914 .Ss \ef[ Ns Ar name ]
1915 Switch to the font
1916 .Ar name ,
1917 see
1918 .Sx Text Decoration .
1919 For short names, there are variants
1920 .No \ef Ns Ar c
1921 and
1922 .No \ef( Ns Ar cc .
1923 .Ss \eg[ Ns Ar name ]
1924 Interpolate the format of a number register; ignored by
1925 .Xr mandoc 1 .
1926 For short names, there are variants
1927 .No \eg Ns Ar c
1928 and
1929 .No \eg( Ns Ar cc .
1930 .Ss \eH\(aq Ns Oo +|- Oc Ns Ar number Ns \(aq
1931 Set the height of the current font; ignored by
1932 .Xr mandoc 1 .
1933 .Ss \eh\(aq Ns Ar number Ns \(aq
1934 Horizontal motion; ignored by
1935 .Xr mandoc 1 .
1936 .Ss \ek[ Ns Ar name ]
1937 Mark horizontal input place in register; ignored by
1938 .Xr mandoc 1 .
1939 For short names, there are variants
1940 .No \ek Ns Ar c
1941 and
1942 .No \ek( Ns Ar cc .
1943 .Ss \eL\(aq Ns Ar number Ns Oo Ar c Oc Ns \(aq
1944 Vertical line drawing function; ignored by
1945 .Xr mandoc 1 .
1946 .Ss \el\(aq Ns Ar number Ns Oo Ar c Oc Ns \(aq
1947 Horizontal line drawing function; ignored by
1948 .Xr mandoc 1 .
1949 .Ss \eM[ Ns Ar name ]
1950 Set fill (background) color (groff extension); ignored by
1951 .Xr mandoc 1 .
1952 For short names, there are variants
1953 .No \eM Ns Ar c
1954 and
1955 .No \eM( Ns Ar cc .
1956 .Ss \em[ Ns Ar name ]
1957 Set glyph drawing color (groff extension); ignored by
1958 .Xr mandoc 1 .
1959 For short names, there are variants
1960 .No \em Ns Ar c
1961 and
1962 .No \em( Ns Ar cc .
1963 .Ss \eN\(aq Ns Ar number Ns \(aq
1964 Character
1965 .Ar number
1966 on the current font.
1967 .Ss \en[ Ns Ar name ]
1968 Interpolate the number register
1969 .Ar name .
1970 For short names, there are variants
1971 .No \en Ns Ar c
1972 and
1973 .No \en( Ns Ar cc .
1974 .Ss \eo\(aq Ns Ar string Ns \(aq
1975 Overstrike, writing all the characters contained in the
1976 .Ar string
1977 to the same output position.
1978 In terminal and HTML output modes,
1979 only the last one of the characters is visible.
1980 .Ss \eR\(aq Ns Ar name Oo +|- Oc Ns Ar number Ns \(aq
1981 Set number register; ignored by
1982 .Xr mandoc 1 .
1983 .Ss \eS\(aq Ns Ar number Ns \(aq
1984 Slant output; ignored by
1985 .Xr mandoc 1 .
1986 .Ss \es\(aq Ns Oo +|- Oc Ns Ar number Ns \(aq
1987 Change point size; ignored by
1988 .Xr mandoc 1 .
1989 Alternative forms
1990 .No \es Ns Oo +|- Oc Ns Ar n ,
1991 .No \es Ns Oo +|- Oc Ns \(aq Ns Ar number Ns \(aq ,
1992 .No \es Ns [ Oo +|- Oc Ns Ar number ] ,
1993 and
1994 .No \es Ns Oo +|- Oc Ns [ Ar number Ns ]
1995 are also parsed and ignored.
1996 .Ss \et
1997 Horizontal tab; ignored by
1998 .Xr mandoc 1 .
1999 .Ss \eu
2000 Move up by half a line; ignored by
2001 .Xr mandoc 1 .
2002 .Ss \eV[ Ns Ar name ]
2003 Interpolate an environment variable; ignored by
2004 .Xr mandoc 1 .
2005 For short names, there are variants
2006 .No \eV Ns Ar c
2007 and
2008 .No \eV( Ns Ar cc .
2009 .Ss \ev\(aq Ns Ar number Ns \(aq
2010 Vertical motion; ignored by
2011 .Xr mandoc 1 .
2012 .Ss \ew\(aq Ns Ar string Ns \(aq
2013 Interpolate the width of the
2014 .Ar string .
2015 The
2016 .Xr mandoc 1
2017 implementation assumes that after expansion of user-defined strings, the
2018 .Ar string
2019 only contains normal characters, no escape sequences, and that each
2020 character has a width of 24 basic units.
2021 .Ss \eX\(aq Ns Ar string Ns \(aq
2022 Output
2023 .Ar string
2024 as device control function; ignored in nroff mode and by
2025 .Xr mandoc 1 .
2026 .Ss \ex\(aq Ns Ar number Ns \(aq
2027 Extra line space function; ignored by
2028 .Xr mandoc 1 .
2029 .Ss \eY[ Ns Ar name ]
2030 Output a string as a device control function; ignored in nroff mode and by
2031 .Xr mandoc 1 .
2032 For short names, there are variants
2033 .No \eY Ns Ar c
2034 and
2035 .No \eY( Ns Ar cc .
2036 .Ss \eZ\(aq Ns Ar string Ns \(aq
2037 Print
2038 .Ar string
2039 with zero width and height; ignored by
2040 .Xr mandoc 1 .
2041 .Ss \ez
2042 Output the next character without advancing the cursor position.
2043 .Sh COMPATIBILITY
2044 The
2045 .Xr mandoc 1
2046 implementation of the
2047 .Nm
2048 language is intentionally incomplete.
2049 Unimplemented features include:
2050 .Pp
2051 .Bl -dash -compact
2052 .It
2053 For security reasons,
2054 .Xr mandoc 1
2055 never reads or writes external files except via
2056 .Sx \&so
2057 requests with safe relative paths.
2058 .It
2059 There is no automatic hyphenation, no adjustment to the right margin,
2060 and no centering; the output is always set flush-left.
2061 .It
2062 Support for setting tabulator positions
2063 and tabulator and leader characters is missing,
2064 and support for manually changing indentation is limited.
2065 .It
2066 The
2067 .Sq u
2068 scaling unit is the default terminal unit.
2069 In traditional troff systems, this unit changes depending on the
2070 output media.
2071 .It
2072 Width measurements are implemented in a crude way
2073 and often yield wrong results.
2074 Explicit movement requests and escapes are ignored.
2075 .It
2076 There is no concept of output pages, no support for floats,
2077 graphics drawing, and picture inclusion;
2078 terminal output is always continuous.
2079 .It
2080 Requests regarding color, font families, and glyph manipulation
2081 are ignored.
2082 Font support is very limited.
2083 Kerning is not implemented, and no ligatures are produced.
2084 .It
2085 The
2086 .Qq \(aq
2087 macro control character does not suppress output line breaks.
2088 .It
2089 Diversions are not implemented,
2090 and support for traps is very incomplete.
2091 .It
2092 While recursion is supported,
2093 .Sx \&while
2094 loops are not.
2095 .El
2096 .Pp
2097 The special semantics of the
2098 .Cm nS
2099 number register is an idiosyncracy of
2100 .Ox
2101 manuals and not supported by other
2102 .Xr mdoc 7
2103 implementations.
2104 .Sh SEE ALSO
2105 .Xr mandoc 1 ,
2106 .Xr eqn 7 ,
2107 .Xr man 7 ,
2108 .Xr mandoc_char 7 ,
2109 .Xr mdoc 7 ,
2110 .Xr tbl 7
2111 .Rs
2112 .%A Joseph F. Ossanna
2113 .%A Brian W. Kernighan
2114 .%I AT&T Bell Laboratories
2115 .%T Troff User's Manual
2116 .%R Computing Science Technical Report
2117 .%N 54
2118 .%C Murray Hill, New Jersey
2119 .%D 1976 and 1992
2120 .%U http://www.kohala.com/start/troff/cstr54.ps
2121 .Re
2122 .Rs
2123 .%A Joseph F. Ossanna
2124 .%A Brian W. Kernighan
2125 .%A Gunnar Ritter
2126 .%T Heirloom Documentation Tools Nroff/Troff User's Manual
2127 .%D September 17, 2007
2128 .%U http://heirloom.sourceforge.net/doctools/troff.pdf
2129 .Re
2130 .Sh HISTORY
2131 The RUNOFF typesetting system, whose input forms the basis for
2132 .Nm ,
2133 was written in MAD and FAP for the CTSS operating system by Jerome E.
2134 Saltzer in 1964.
2135 Doug McIlroy rewrote it in BCPL in 1969, renaming it
2136 .Nm .
2137 Dennis M. Ritchie rewrote McIlroy's
2138 .Nm
2139 in PDP-11 assembly for
2140 .At v1 ,
2141 Joseph F. Ossanna improved roff and renamed it nroff
2142 for
2143 .At v2 ,
2144 then ported nroff to C as troff, which Brian W. Kernighan released with
2145 .At v7 .
2146 In 1989, James Clarke re-implemented troff in C++, naming it groff.
2147 .Sh AUTHORS
2148 .An -nosplit
2149 This
2150 .Nm
2151 reference was written by
2152 .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
2153 and
2154 .An Ingo Schwarze Aq Mt schwarze@openbsd.org .