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