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