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