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