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