xref: /titanic_52/usr/src/man/man5/mandoc_roff.5 (revision 4a5d661a82b942b6538acd26209d959ce98b593a)
1.\"	$Id: roff.7,v 1.70 2015/02/17 17:16:52 schwarze Exp $
2.\"
3.\" Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
4.\" Copyright (c) 2010, 2011, 2013, 2014 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: February 17 2015 $
19.Dt MANDOC_ROFF 5
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 5
30and
31.Xr man 5
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 5
37or
38.Xr man 5
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 5 ,
51and
52.Xr man 5 .
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 roff
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 5
141for a complete list.
142.Ss Text Decoration
143Terms may be text-decorated using the
144.Sq \ef
145escape followed by an indicator: B (bold), I (italic), R (regular), or P
146(revert to previous mode).
147A numerical representation 3, 2, or 1 (bold, italic, and regular,
148respectively) may be used instead.
149The indicator or numerical representative may be preceded by C
150(constant-width), which is ignored.
151.Pp
152The two-character indicator
153.Sq BI
154requests a font that is both bold and italic.
155It may not be portable to old roff implementations.
156.Pp
157Examples:
158.Bl -tag -width Ds -offset indent -compact
159.It Li \efBbold\efR
160Write in \fBbold\fP, then switch to regular font mode.
161.It Li \efIitalic\efP
162Write in \fIitalic\fP, then return to previous font mode.
163.It Li \ef(BIbold italic\efP
164Write in \f(BIbold italic\fP, then return to previous font mode.
165.El
166.Pp
167Text decoration is
168.Em not
169recommended for
170.Xr mdoc 5 ,
171which encourages semantic annotation.
172.Ss Predefined Strings
173Predefined strings, like
174.Sx Special Characters ,
175mark special output glyphs.
176Predefined strings are escaped with the slash-asterisk,
177.Sq \e* :
178single-character
179.Sq \e*X ,
180two-character
181.Sq \e*(XX ,
182and N-character
183.Sq \e*[N] .
184.Pp
185Examples:
186.Bl -tag -width Ds -offset indent -compact
187.It Li \e*(Am
188Two-letter ampersand predefined string.
189.It Li \e*q
190One-letter double-quote predefined string.
191.El
192.Pp
193Predefined strings are not recommended for use,
194as they differ across implementations.
195Those supported by
196.Xr mandoc 1
197are listed in
198.Xr mandoc_char 5 .
199Manuals using these predefined strings are almost certainly not portable.
200.Ss Whitespace
201Whitespace consists of the space character.
202In text lines, whitespace is preserved within a line.
203In request and macro lines, whitespace delimits arguments and is discarded.
204.Pp
205Unescaped trailing spaces are stripped from text line input unless in a
206literal context.
207In general, trailing whitespace on any input line is discouraged for
208reasons of portability.
209In the rare case that a blank character is needed at the end of an
210input line, it may be forced by
211.Sq \e\ \e& .
212.Pp
213Literal space characters can be produced in the output
214using escape sequences.
215In macro lines, they can also be included in arguments using quotation; see
216.Sx MACRO SYNTAX
217for details.
218.Pp
219Blank text lines, which may include whitespace, are only permitted
220within literal contexts.
221If the first character of a text line is a space, that line is printed
222with a leading newline.
223.Ss Scaling Widths
224Many requests and macros support scaled widths for their arguments.
225The syntax for a scaled width is
226.Sq Li [+-]?[0-9]*.[0-9]*[:unit:] ,
227where a decimal must be preceded or followed by at least one digit.
228Negative numbers, while accepted, are truncated to zero.
229.Pp
230The following scaling units are accepted:
231.Pp
232.Bl -tag -width Ds -offset indent -compact
233.It c
234centimetre
235.It i
236inch
237.It P
238pica (~1/6 inch)
239.It p
240point (~1/72 inch)
241.It f
242scale
243.Sq u
244by 65536
245.It v
246default vertical span
247.It m
248width of rendered
249.Sq m
250.Pq em
251character
252.It n
253width of rendered
254.Sq n
255.Pq en
256character
257.It u
258default horizontal span for the terminal
259.It M
260mini-em (~1/100 em)
261.El
262.Pp
263Using anything other than
264.Sq m ,
265.Sq n ,
266or
267.Sq v
268is necessarily non-portable across output media.
269See
270.Sx COMPATIBILITY .
271.Pp
272If a scaling unit is not provided, the numerical value is interpreted
273under the default rules of
274.Sq v
275for vertical spaces and
276.Sq u
277for horizontal ones.
278.Pp
279Examples:
280.Bl -tag -width ".Bl -tag -width 2i" -offset indent -compact
281.It Li \&.Bl -tag -width 2i
282two-inch tagged list indentation in
283.Xr mdoc 5
284.It Li \&.HP 2i
285two-inch tagged list indentation in
286.Xr man 5
287.It Li \&.sp 2v
288two vertical spaces
289.El
290.Ss Sentence Spacing
291Each sentence should terminate at the end of an input line.
292By doing this, a formatter will be able to apply the proper amount of
293spacing after the end of sentence (unescaped) period, exclamation mark,
294or question mark followed by zero or more non-sentence closing
295delimiters
296.Po
297.Sq \&) ,
298.Sq \&] ,
299.Sq \&' ,
300.Sq \&"
301.Pc .
302.Pp
303The proper spacing is also intelligently preserved if a sentence ends at
304the boundary of a macro line.
305.Pp
306Examples:
307.Bd -literal -offset indent -compact
308Do not end sentences mid-line like this.  Instead,
309end a sentence like this.
310A macro would end like this:
311\&.Xr mandoc 1 \&.
312.Ed
313.Sh REQUEST SYNTAX
314A request or macro line consists of:
315.Pp
316.Bl -enum -compact
317.It
318the control character
319.Sq \&.
320or
321.Sq \(aq
322at the beginning of the line,
323.It
324optionally an arbitrary amount of whitespace,
325.It
326the name of the request or the macro, which is one word of arbitrary
327length, terminated by whitespace,
328.It
329and zero or more arguments delimited by whitespace.
330.El
331.Pp
332Thus, the following request lines are all equivalent:
333.Bd -literal -offset indent
334\&.ig end
335\&.ig    end
336\&.   ig end
337.Ed
338.Sh MACRO SYNTAX
339Macros are provided by the
340.Xr mdoc 5
341and
342.Xr man 5
343languages and can be defined by the
344.Sx \&de
345request.
346When called, they follow the same syntax as requests, except that
347macro arguments may optionally be quoted by enclosing them
348in double quote characters
349.Pq Sq \(dq .
350Quoted text, even if it contains whitespace or would cause
351a macro invocation when unquoted, is always considered literal text.
352Inside quoted text, pairs of double quote characters
353.Pq Sq Qq
354resolve to single double quote characters.
355.Pp
356To be recognised as the beginning of a quoted argument, the opening
357quote character must be preceded by a space character.
358A quoted argument extends to the next double quote character that is not
359part of a pair, or to the end of the input line, whichever comes earlier.
360Leaving out the terminating double quote character at the end of the line
361is discouraged.
362For clarity, if more arguments follow on the same input line,
363it is recommended to follow the terminating double quote character
364by a space character; in case the next character after the terminating
365double quote character is anything else, it is regarded as the beginning
366of the next, unquoted argument.
367.Pp
368Both in quoted and unquoted arguments, pairs of backslashes
369.Pq Sq \e\e
370resolve to single backslashes.
371In unquoted arguments, space characters can alternatively be included
372by preceding them with a backslash
373.Pq Sq \e\~ ,
374but quoting is usually better for clarity.
375.Pp
376Examples:
377.Bl -tag -width Ds -offset indent -compact
378.It Li .Fn strlen \(dqconst char *s\(dq
379Group arguments
380.Qq const char *s
381into one function argument.
382If unspecified,
383.Qq const ,
384.Qq char ,
385and
386.Qq *s
387would be considered separate arguments.
388.It Li .Op \(dqFl a\(dq
389Consider
390.Qq \&Fl a
391as literal text instead of a flag macro.
392.El
393.Sh REQUEST REFERENCE
394The
395.Xr mandoc 1
396.Nm
397parser recognises the following requests.
398For requests marked as "ignored" or "unsupported", any arguments are
399ignored, and the number of arguments is not checked.
400.Ss \&ab
401Abort processing.
402Currently unsupported.
403.Ss \&ad
404Set line adjustment mode.
405It takes one argument to select normal, left, right,
406or center adjustment for subsequent text.
407Currently ignored.
408.Ss \&af
409Assign an output format to a number register.
410Currently ignored.
411.Ss \&aln
412Create an alias for a number register.
413Currently unsupported.
414.Ss \&als
415Create an alias for a request, string, macro, or diversion.
416Currently unsupported.
417.Ss \&am
418Append to a macro definition.
419The syntax of this request is the same as that of
420.Sx \&de .
421.Ss \&am1
422Append to a macro definition, switching roff compatibility mode off
423during macro execution (groff extension).
424The syntax of this request is the same as that of
425.Sx \&de1 .
426Since
427.Xr mandoc 1
428does not implement
429.Nm
430compatibility mode at all, it handles this request as an alias for
431.Sx \&am .
432.Ss \&ami
433Append to a macro definition, specifying the macro name indirectly
434(groff extension).
435The syntax of this request is the same as that of
436.Sx \&dei .
437.Ss \&ami1
438Append to a macro definition, specifying the macro name indirectly
439and switching roff compatibility mode off during macro execution
440(groff extension).
441The syntax of this request is the same as that of
442.Sx \&dei1 .
443Since
444.Xr mandoc 1
445does not implement
446.Nm
447compatibility mode at all, it handles this request as an alias for
448.Sx \&ami .
449.Ss \&as
450Append to a user-defined string.
451The syntax of this request is the same as that of
452.Sx \&ds .
453If a user-defined string with the specified name does not yet exist,
454it is set to the empty string before appending.
455.Ss \&as1
456Append to a user-defined string, switching roff compatibility mode off
457during macro execution (groff extension).
458The syntax of this request is the same as that of
459.Sx \&ds1 .
460Since
461.Xr mandoc 1
462does not implement
463.Nm
464compatibility mode at all, it handles this request as an alias for
465.Sx \&as .
466.Ss \&asciify
467Fully unformat a diversion.
468Currently unsupported.
469.Ss \&backtrace
470Print a backtrace of the input stack.
471This is a groff extension and currently ignored.
472.Ss \&bd
473Artificially embolden by repeated printing with small shifts.
474Currently ignored.
475.Ss \&bleedat
476Set the BleedBox page parameter for PDF generation.
477This is a Heirloom extension and currently ignored.
478.Ss \&blm
479Set a blank line trap.
480Currently unsupported.
481.Ss \&box
482Begin a diversion without including a partially filled line.
483Currently unsupported.
484.Ss \&boxa
485Add to a diversion without including a partially filled line.
486Currently unsupported.
487.Ss \&bp
488Begin new page.
489Currently ignored.
490.Ss \&BP
491Define a frame and place a picture in it.
492This is a Heirloom extension and currently unsupported.
493.Ss \&br
494Break the output line.
495See
496.Xr man 5
497and
498.Xr mdoc 5 .
499.Ss \&break
500Break out of a
501.Sx \&while
502loop.
503Currently unsupported.
504.Ss \&breakchar
505Optional line break characters.
506This is a Heirloom extension and currently ignored.
507.Ss \&brnl
508Break output line after next N input lines.
509This is a Heirloom extension and currently ignored.
510.Ss \&brp
511Break and spread output line.
512Currently, this is implemented as an alias for
513.Sx \&br .
514.Ss \&brpnl
515Break and spread output line after next N input lines.
516This is a Heirloom extension and currently ignored.
517.Ss \&c2
518Change the no-break control character.
519Currently unsupported.
520.Ss \&cc
521Change the control character.
522Its syntax is as follows:
523.Bd -literal -offset indent
524.Pf . Cm \&cc Op Ar c
525.Ed
526.Pp
527If
528.Ar c
529is not specified, the control character is reset to
530.Sq \&. .
531Trailing characters are ignored.
532.Ss \&ce
533Center some lines.
534It takes one integer argument, specifying how many lines to center.
535Currently ignored.
536.Ss \&cf
537Output the contents of a file.
538Ignored because insecure.
539.Ss \&cflags
540Set character flags.
541This is a groff extension and currently ignored.
542.Ss \&ch
543Change a trap location.
544Currently ignored.
545.Ss \&char
546Define a new glyph.
547Currently unsupported.
548.Ss \&chop
549Remove the last character from a macro, string, or diversion.
550Currently unsupported.
551.Ss \&class
552Define a character class.
553This is a groff extension and currently ignored.
554.Ss \&close
555Close an open file.
556Ignored because insecure.
557.Ss \&CL
558Print text in color.
559This is a Heirloom extension and currently unsupported.
560.Ss \&color
561Activate or deactivate colors.
562This is a groff extension and currently ignored.
563.Ss \&composite
564Define a name component for composite glyph names.
565This is a groff extension and currently unsupported.
566.Ss \&continue
567Immediately start the next iteration of a
568.Sx \&while
569loop.
570Currently unsupported.
571.Ss \&cp
572Switch
573.Nm
574compatibility mode on or off.
575Currently ignored.
576.Ss \&cropat
577Set the CropBox page parameter for PDF generation.
578This is a Heirloom extension and currently ignored.
579.Ss \&cs
580Constant character spacing mode.
581Currently ignored.
582.Ss \&cu
583Underline including whitespace.
584Currently ignored.
585.Ss \&da
586Append to a diversion.
587Currently unsupported.
588.Ss \&dch
589Change a trap location in the current diversion.
590This is a Heirloom extension and currently unsupported.
591.Ss \&de
592Define a
593.Nm
594macro.
595Its syntax can be either
596.Bd -literal -offset indent
597.Pf . Cm \&de Ar name
598.Ar macro definition
599\&..
600.Ed
601.Pp
602or
603.Bd -literal -offset indent
604.Pf . Cm \&de Ar name Ar end
605.Ar macro definition
606.Pf . Ar end
607.Ed
608.Pp
609Both forms define or redefine the macro
610.Ar name
611to represent the
612.Ar macro definition ,
613which may consist of one or more input lines, including the newline
614characters terminating each line, optionally containing calls to
615.Nm
616requests,
617.Nm
618macros or high-level macros like
619.Xr man 5
620or
621.Xr mdoc 5
622macros, whichever applies to the document in question.
623.Pp
624Specifying a custom
625.Ar end
626macro works in the same way as for
627.Sx \&ig ;
628namely, the call to
629.Sq Pf . Ar end
630first ends the
631.Ar macro definition ,
632and after that, it is also evaluated as a
633.Nm
634request or
635.Nm
636macro, but not as a high-level macro.
637.Pp
638The macro can be invoked later using the syntax
639.Pp
640.D1 Pf . Ar name Op Ar argument Op Ar argument ...
641.Pp
642Regarding argument parsing, see
643.Sx MACRO SYNTAX
644above.
645.Pp
646The line invoking the macro will be replaced
647in the input stream by the
648.Ar macro definition ,
649replacing all occurrences of
650.No \e\e$ Ns Ar N ,
651where
652.Ar N
653is a digit, by the
654.Ar N Ns th Ar argument .
655For example,
656.Bd -literal -offset indent
657\&.de ZN
658\efI\e^\e\e$1\e^\efP\e\e$2
659\&..
660\&.ZN XtFree .
661.Ed
662.Pp
663produces
664.Pp
665.D1 \efI\e^XtFree\e^\efP.
666.Pp
667in the input stream, and thus in the output: \fI\^XtFree\^\fP.
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 5
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 5
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 5 .
901Ignored in
902.Xr mdoc 5 .
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 5
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 r
1061.Pq register accessed ,
1062.Sq t
1063.Pq troff mode ,
1064or
1065.Sq v
1066.Pq vroff mode ,
1067COND evaluates to false.
1068.It
1069If COND starts with a parenthesis or with an optionally signed
1070integer number, it is evaluated according to the rules of
1071.Sx Numerical expressions
1072explained below.
1073It evaluates to true if the result is positive,
1074or to false if the result is zero or negative.
1075.It
1076Otherwise, the first character of COND is regarded as a delimiter
1077and COND evaluates to true if the string extending from its first
1078to its second occurrence is equal to the string extending from its
1079second to its third occurrence.
1080.It
1081If COND cannot be parsed, it evaluates to false.
1082.El
1083.Pp
1084If a conditional is false, its children are not processed, but are
1085syntactically interpreted to preserve the integrity of the input
1086document.
1087Thus,
1088.Pp
1089.D1 \&.if t .ig
1090.Pp
1091will discard the
1092.Sq \&.ig ,
1093which may lead to interesting results, but
1094.Pp
1095.D1 \&.if t .if t \e{\e
1096.Pp
1097will continue to syntactically interpret to the block close of the final
1098conditional.
1099Sub-conditionals, in this case, obviously inherit the truth value of
1100the parent.
1101.Pp
1102If the BODY section is begun by an escaped brace
1103.Sq \e{ ,
1104scope continues until the end of the input line containing the
1105matching closing-brace escape sequence
1106.Sq \e} .
1107If the BODY is not enclosed in braces, scope continues until
1108the end of the line.
1109If the COND is followed by a BODY on the same line, whether after a
1110brace or not, then requests and macros
1111.Em must
1112begin with a control character.
1113It is generally more intuitive, in this case, to write
1114.Bd -literal -offset indent
1115\&.if COND \e{\e
1116\&.foo
1117bar
1118\&.\e}
1119.Ed
1120.Pp
1121than having the request or macro follow as
1122.Pp
1123.D1 \&.if COND \e{ .foo
1124.Pp
1125The scope of a conditional is always parsed, but only executed if the
1126conditional evaluates to true.
1127.Pp
1128Note that the
1129.Sq \e}
1130is converted into a zero-width escape sequence if not passed as a
1131standalone macro
1132.Sq \&.\e} .
1133For example,
1134.Pp
1135.D1 \&.Fl a \e} b
1136.Pp
1137will result in
1138.Sq \e}
1139being considered an argument of the
1140.Sq \&Fl
1141macro.
1142.Ss \&ig
1143Ignore input.
1144Its syntax can be either
1145.Bd -literal -offset indent
1146.Pf . Cm \&ig
1147.Ar ignored text
1148\&..
1149.Ed
1150.Pp
1151or
1152.Bd -literal -offset indent
1153.Pf . Cm \&ig Ar end
1154.Ar ignored text
1155.Pf . Ar end
1156.Ed
1157.Pp
1158In the first case, input is ignored until a
1159.Sq \&..
1160request is encountered on its own line.
1161In the second case, input is ignored until the specified
1162.Sq Pf . Ar end
1163macro is encountered.
1164Do not use the escape character
1165.Sq \e
1166anywhere in the definition of
1167.Ar end ;
1168it would cause very strange behaviour.
1169.Pp
1170When the
1171.Ar end
1172macro is a roff request or a roff macro, like in
1173.Pp
1174.D1 \&.ig if
1175.Pp
1176the subsequent invocation of
1177.Sx \&if
1178will first terminate the
1179.Ar ignored text ,
1180then be invoked as usual.
1181Otherwise, it only terminates the
1182.Ar ignored text ,
1183and arguments following it or the
1184.Sq \&..
1185request are discarded.
1186.Ss \&in
1187Change indentation.
1188See
1189.Xr man 5 .
1190Ignored in
1191.Xr mdoc 5 .
1192.Ss \&index
1193Find a substring in a string.
1194This is a Heirloom extension and currently unsupported.
1195.Ss \&it
1196Set an input line trap.
1197Its syntax is as follows:
1198.Pp
1199.D1 Pf . Cm it Ar expression macro
1200.Pp
1201The named
1202.Ar macro
1203will be invoked after processing the number of input text lines
1204specified by the numerical
1205.Ar expression .
1206While evaluating the
1207.Ar expression ,
1208the unit suffixes described below
1209.Sx Scaling Widths
1210are ignored.
1211.Ss \&itc
1212Set an input line trap, not counting lines ending with \ec.
1213Currently unsupported.
1214.Ss \&IX
1215To support the generation of a table of contents,
1216.Xr pod2man 1
1217emits this user-defined macro, usually without defining it.
1218To avoid reporting large numbers of spurious errors,
1219.Xr mandoc 1
1220ignores it.
1221.Ss \&kern
1222Switch kerning on or off.
1223Currently ignored.
1224.Ss \&kernafter
1225Increase kerning after some characters.
1226This is a Heirloom extension and currently ignored.
1227.Ss \&kernbefore
1228Increase kerning before some characters.
1229This is a Heirloom extension and currently ignored.
1230.Ss \&kernpair
1231Add a kerning pair to the kerning table.
1232This is a Heirloom extension and currently ignored.
1233.Ss \&lc
1234Define a leader repetition character.
1235Currently unsupported.
1236.Ss \&lc_ctype
1237Set the
1238.Dv LC_CTYPE
1239locale.
1240This is a Heirloom extension and currently unsupported.
1241.Ss \&lds
1242Define a local string.
1243This is a Heirloom extension and currently unsupported.
1244.Ss \&length
1245Count the number of input characters in a user-defined string.
1246Currently unsupported.
1247.Ss \&letadj
1248Dynamic letter spacing and reshaping.
1249This is a Heirloom extension and currently ignored.
1250.Ss \&lf
1251Change the line number for error messages.
1252Ignored because insecure.
1253.Ss \&lg
1254Switch the ligature mechanism on or off.
1255Currently ignored.
1256.Ss \&lhang
1257Hang characters at left margin.
1258This is a Heirloom extension and currently ignored.
1259.Ss \&linetabs
1260Enable or disable line-tabs mode.
1261This is a groff extension and currently unsupported.
1262.Ss \&ll
1263Change the output line length.
1264Its syntax is as follows:
1265.Pp
1266.D1 Pf . Cm \&ll Op Oo +|- Oc Ns Ar width
1267.Pp
1268If the
1269.Ar width
1270argument is omitted, the line length is reset to its previous value.
1271The default setting for terminal output is 58n.
1272If a sign is given, the line length is added to or subtracted from;
1273otherwise, it is set to the provided value.
1274Using this request in new manuals is discouraged for several reasons,
1275among others because it overrides the
1276.Xr mandoc 1
1277.Fl O Cm width
1278command line option.
1279.Ss \&lnr
1280Set local number register.
1281This is a Heirloom extension and currently unsupported.
1282.Ss \&lnrf
1283Set local floating-point register.
1284This is a Heirloom extension and currently unsupported.
1285.Ss \&lpfx
1286Set a line prefix.
1287This is a Heirloom extension and currently unsupported.
1288.Ss \&ls
1289Set line spacing.
1290It takes one integer argument specifying the vertical distance of
1291subsequent output text lines measured in v units.
1292Currently ignored.
1293.Ss \&lsm
1294Set a leading spaces trap.
1295This is a groff extension and currently unsupported.
1296.Ss \&lt
1297Set title line length.
1298Currently ignored.
1299.Ss \&mc
1300Print margin character in the right margin.
1301Currently ignored.
1302.Ss \&mediasize
1303Set the device media size.
1304This is a Heirloom extension and currently ignored.
1305.Ss \&minss
1306Set minimum word space.
1307This is a Heirloom extension and currently ignored.
1308.Ss \&mk
1309Mark vertical position.
1310Currently ignored.
1311.Ss \&mso
1312Load a macro file.
1313Ignored because insecure.
1314.Ss \&na
1315Disable adjusting without changing the adjustment mode.
1316Currently ignored.
1317.Ss \&ne
1318Declare the need for the specified minimum vertical space
1319before the next trap or the bottom of the page.
1320Currently ignored.
1321.Ss \&nf
1322Switch to no-fill mode.
1323See
1324.Xr man 5 .
1325Ignored by
1326.Xr mdoc 5 .
1327.Ss \&nh
1328Turn off automatic hyphenation mode.
1329Currently ignored.
1330.Ss \&nhychar
1331Define hyphenation-inhibiting characters.
1332This is a Heirloom extension and currently ignored.
1333.Ss \&nm
1334Print line numbers.
1335Currently unsupported.
1336.Ss \&nn
1337Temporarily turn off line numbering.
1338Currently unsupported.
1339.Ss \&nop
1340Exexute the rest of the input line as a request or macro line.
1341Currently unsupported.
1342.Ss \&nr
1343Define or change a register.
1344A register is an arbitrary string value that defines some sort of state,
1345which influences parsing and/or formatting.
1346Its syntax is as follows:
1347.Pp
1348.D1 Pf \. Cm \&nr Ar name Oo +|- Oc Ns Ar expression
1349.Pp
1350For the syntax of
1351.Ar expression ,
1352see
1353.Sx Numerical expressions
1354below.
1355If it is prefixed by a sign, the register will be
1356incremented or decremented instead of assigned to.
1357.Pp
1358The following register
1359.Ar name
1360is handled specially:
1361.Bl -tag -width Ds
1362.It Cm nS
1363If set to a positive integer value, certain
1364.Xr mdoc 5
1365macros will behave in the same way as in the
1366.Em SYNOPSIS
1367section.
1368If set to 0, these macros will behave in the same way as outside the
1369.Em SYNOPSIS
1370section, even when called within the
1371.Em SYNOPSIS
1372section itself.
1373Note that starting a new
1374.Xr mdoc 5
1375section with the
1376.Cm \&Sh
1377macro will reset this register.
1378.El
1379.Ss \&nrf
1380Define or change a floating-point register.
1381This is a Heirloom extension and currently unsupported.
1382.Ss \&nroff
1383Force nroff mode.
1384This is a groff extension and currently ignored.
1385.Ss \&ns
1386Turn on no-space mode.
1387Currently ignored.
1388.Ss \&nx
1389Abort processing of the current input file and process another one.
1390Ignored because insecure.
1391.Ss \&open
1392Open a file for writing.
1393Ignored because insecure.
1394.Ss \&opena
1395Open a file for appending.
1396Ignored because insecure.
1397.Ss \&os
1398Output saved vertical space.
1399Currently ignored.
1400.Ss \&output
1401Output directly to intermediate output.
1402Not supported.
1403.Ss \&padj
1404Globally control paragraph-at-once adjustment.
1405This is a Heirloom extension and currently ignored.
1406.Ss \&papersize
1407Set the paper size.
1408This is a Heirloom extension and currently ignored.
1409.Ss \&pc
1410Change the page number character.
1411Currently ignored.
1412.Ss \&pev
1413Print environments.
1414This is a groff extension and currently ignored.
1415.Ss \&pi
1416Pipe output to a shell command.
1417Ignored because insecure.
1418.Ss \&PI
1419Low-level request used by
1420.Sx \&BP .
1421This is a Heirloom extension and currently unsupported.
1422.Ss \&pl
1423Change page length.
1424Takes one height argument.
1425Currently ignored.
1426.Ss \&pm
1427Print names and sizes of macros, strings, and diversions.
1428Currently ignored.
1429.Ss \&pn
1430Change page number of the next page.
1431Currently ignored.
1432.Ss \&pnr
1433Print all number registers.
1434Currently ignored.
1435.Ss \&po
1436Set horizontal page offset.
1437Currently ignored.
1438.Ss \&ps
1439Change point size.
1440Takes one numerical argument.
1441Currently ignored.
1442.Ss \&psbb
1443Retrieve the bounding box of a PostScript file.
1444Currently unsupported.
1445.Ss \&pshape
1446Set a special shape for the current paragraph.
1447This is a Heirloom extension and currently unsupported.
1448.Ss \&pso
1449Include output of a shell command.
1450Ignored because insecure.
1451.Ss \&ptr
1452Print the names and positions of all traps.
1453This is a groff extension and currently ignored.
1454.Ss \&pvs
1455Change post-vertical spacing.
1456This is a groff extension and currently ignored.
1457.Ss \&rchar
1458Remove glyph definitions.
1459Currently unsupported.
1460.Ss \&rd
1461Read from standard input.
1462Currently ignored.
1463.Ss \&recursionlimit
1464Set the maximum stack depth for recursive macros.
1465This is a Heirloom extension and currently ignored.
1466.Ss \&return
1467Exit a macro and return to the caller.
1468Currently unsupported.
1469.Ss \&rfschar
1470Remove font-specific fallback glyph definitions.
1471Currently unsupported.
1472.Ss \&rhang
1473Hang characters at right margin.
1474This is a Heirloom extension and currently ignored.
1475.Ss \&rj
1476Justify unfilled text to the right margin.
1477Currently ignored.
1478.Ss \&rm
1479Remove a request, macro or string.
1480Its syntax is as follows:
1481.Pp
1482.D1 Pf \. Cm \&rm Ar name
1483.Ss \&rn
1484Rename a request, macro, diversion, or string.
1485Currently unsupported.
1486.Ss \&rnn
1487Rename a number register.
1488Currently unsupported.
1489.Ss \&rr
1490Remove a register.
1491Its syntax is as follows:
1492.Pp
1493.D1 Pf \. Cm \&rr Ar name
1494.Ss \&rs
1495End no-space mode.
1496Currently ignored.
1497.Ss \&rt
1498Return to marked vertical position.
1499Currently ignored.
1500.Ss \&schar
1501Define global fallback glyph.
1502This is a groff extension and currently unsupported.
1503.Ss \&sentchar
1504Define sentence-ending characters.
1505This is a Heirloom extension and currently ignored.
1506.Ss \&shc
1507Change the soft hyphen character.
1508Currently ignored.
1509.Ss \&shift
1510Shift macro arguments.
1511Currently unsupported.
1512.Ss \&sizes
1513Define permissible point sizes.
1514This is a groff extension and currently ignored.
1515.Ss \&so
1516Include a source file.
1517Its syntax is as follows:
1518.Pp
1519.D1 Pf \. Cm \&so Ar file
1520.Pp
1521The
1522.Ar file
1523will be read and its contents processed as input in place of the
1524.Sq \&.so
1525request line.
1526To avoid inadvertent inclusion of unrelated files,
1527.Xr mandoc 1
1528only accepts relative paths not containing the strings
1529.Qq ../
1530and
1531.Qq /.. .
1532.Pp
1533This request requires
1534.Xr man 1
1535to change to the right directory before calling
1536.Xr mandoc 1 ,
1537per convention to the root of the manual tree.
1538Typical usage looks like:
1539.Pp
1540.Dl \&.so man3/Xcursor.3
1541.Pp
1542As the whole concept is rather fragile, the use of
1543.Sx \&so
1544is discouraged.
1545Use
1546.Xr ln 1
1547instead.
1548.Ss \&spacewidth
1549Set the space width from the font metrics file.
1550This is a Heirloom extension and currently ignored.
1551.Ss \&special
1552Define a special font.
1553This is a groff extension and currently ignored.
1554.Ss \&spreadwarn
1555Warn about wide spacing between words.
1556Currently ignored.
1557.Ss \&ss
1558Set space character size.
1559Currently ignored.
1560.Ss \&sty
1561Associate style with a font position.
1562This is a groff extension and currently ignored.
1563.Ss \&substring
1564Replace a user-defined string with a substring.
1565Currently unsupported.
1566.Ss \&sv
1567Save vertical space.
1568Currently ignored.
1569.Ss \&sy
1570Execute shell command.
1571Ignored because insecure.
1572.Ss \&T&
1573Re-start a table layout, retaining the options of the prior table
1574invocation.
1575See
1576.Sx \&TS .
1577.Ss \&ta
1578Set tab stops.
1579Takes an arbitrary number of arguments.
1580Currently unsupported.
1581.Ss \&tc
1582Change tab repetion character.
1583Currently unsupported.
1584.Ss \&TE
1585End a table context.
1586See
1587.Sx \&TS .
1588.Ss \&ti
1589Temporary indent.
1590Currently unsupported.
1591.Ss \&tkf
1592Enable track kerning for a font.
1593Currently ignored.
1594.Ss \&tl
1595Print a title line.
1596Currently unsupported.
1597.Ss \&tm
1598Print to standard error output.
1599Currently ignored.
1600.Ss \&tm1
1601Print to standard error output, allowing leading blanks.
1602This is a groff extension and currently ignored.
1603.Ss \&tmc
1604Print to standard error output without a trailing newline.
1605This is a groff extension and currently ignored.
1606.Ss \&tr
1607Output character translation.
1608Its syntax is as follows:
1609.Pp
1610.D1 Pf \. Cm \&tr Ar [ab]+
1611.Pp
1612Pairs of
1613.Ar ab
1614characters are replaced
1615.Ar ( a
1616for
1617.Ar b ) .
1618Replacement (or origin) characters may also be character escapes; thus,
1619.Pp
1620.Dl tr \e(xx\e(yy
1621.Pp
1622replaces all invocations of \e(xx with \e(yy.
1623.Ss \&track
1624Static letter space tracking.
1625This is a Heirloom extension and currently ignored.
1626.Ss \&transchar
1627Define transparent characters for sentence-ending.
1628This is a Heirloom extension and currently ignored.
1629.Ss \&trf
1630Output the contents of a file, disallowing invalid characters.
1631This is a groff extension and ignored because insecure.
1632.Ss \&trimat
1633Set the TrimBox page parameter for PDF generation.
1634This is a Heirloom extension and currently ignored.
1635.Ss \&trin
1636Output character translation, ignored by
1637.Cm \&asciify .
1638Currently unsupported.
1639.Ss \&trnt
1640Output character translation, ignored by \e!.
1641Currently unsupported.
1642.Ss \&troff
1643Force troff mode.
1644This is a groff extension and currently ignored.
1645.Ss \&TS
1646Begin a table, which formats input in aligned rows and columns.
1647See
1648.Xr tbl 5
1649for a description of the tbl language.
1650.Ss \&uf
1651Globally set the underline font.
1652Currently ignored.
1653.Ss \&ul
1654Underline.
1655Currently ignored.
1656.Ss \&unformat
1657Unformat spaces and tabs in a diversion.
1658Currently unsupported.
1659.Ss \&unwatch
1660Disable notification for string or macro.
1661This is a Heirloom extension and currently ignored.
1662.Ss \&unwatchn
1663Disable notification for register.
1664This is a Heirloom extension and currently ignored.
1665.Ss \&vpt
1666Enable or disable vertical position traps.
1667This is a groff extension and currently ignored.
1668.Ss \&vs
1669Change vertical spacing.
1670Currently ignored.
1671.Ss \&warn
1672Set warning level.
1673Currently ignored.
1674.Ss \&warnscale
1675Set the scaling indicator used in warnings.
1676This is a groff extension and currently ignored.
1677.Ss \&watch
1678Notify on change of string or macro.
1679This is a Heirloom extension and currently ignored.
1680.Ss \&watchlength
1681On change, report the contents of macros and strings
1682up to the sepcified length.
1683This is a Heirloom extension and currently ignored.
1684.Ss \&watchn
1685Notify on change of register.
1686This is a Heirloom extension and currently ignored.
1687.Ss \&wh
1688Set a page location trap.
1689Currently unsupported.
1690.Ss \&while
1691Repeated execution while a condition is true.
1692Currently unsupported.
1693.Ss \&write
1694Write to an open file.
1695Ignored because insecure.
1696.Ss \&writec
1697Write to an open file without appending a newline.
1698Ignored because insecure.
1699.Ss \&writem
1700Write macro or string to an open file.
1701Ignored because insecure.
1702.Ss \&xflag
1703Set the extension level.
1704This is a Heirloom extension and currently ignored.
1705.Ss Numerical expressions
1706The
1707.Sx \&nr ,
1708.Sx \&if ,
1709and
1710.Sx \&ie
1711requests accept integer numerical expressions as arguments.
1712These are always evaluated using the C
1713.Vt int
1714type; integer overflow works the same way as in the C language.
1715Numbers consist of an arbitrary number of digits
1716.Sq 0
1717to
1718.Sq 9
1719prefixed by an optional sign
1720.Sq +
1721or
1722.Sq - .
1723Each number may be followed by one optional scaling unit described below
1724.Sx Scaling Widths .
1725The following equations hold:
1726.Bd -literal -offset indent
17271i = 6v = 6P = 10m = 10n = 52p = 1000M = 240u = 240
1728254c = 100i = 24000u = 24000
17291f = 65536u = 65536
1730.Ed
1731.Pp
1732The following binary operators are implemented.
1733Unless otherwise stated, they behave as in the C language:
1734.Pp
1735.Bl -tag -width 2n -compact
1736.It Ic +
1737addition
1738.It Ic -
1739subtraction
1740.It Ic *
1741multiplication
1742.It Ic /
1743division
1744.It Ic %
1745remainder of division
1746.It Ic <
1747less than
1748.It Ic >
1749greater than
1750.It Ic ==
1751equal to
1752.It Ic =
1753equal to, same effect as
1754.Ic ==
1755(this differs from C)
1756.It Ic <=
1757less than or equal to
1758.It Ic >=
1759greater than or equal to
1760.It Ic <>
1761not equal to (corresponds to C
1762.Ic != ;
1763this one is of limited portability, it is supported by Heirloom roff,
1764but not by groff)
1765.It Ic &
1766logical and (corresponds to C
1767.Ic && )
1768.It Ic \&:
1769logical or (corresponds to C
1770.Ic \&|| )
1771.It Ic <?
1772minimum (not available in C)
1773.It Ic >?
1774maximum (not available in C)
1775.El
1776.Pp
1777There is no concept of precendence; evaluation proceeds from left to right,
1778except when subexpressions are enclosed in parantheses.
1779Inside parentheses, whitespace is ignored.
1780.Sh ESCAPE SEQUENCE REFERENCE
1781The
1782.Xr mandoc 1
1783.Nm
1784parser recognises the following escape sequences.
1785Note that the
1786.Nm
1787language defines more escape sequences not implemented in
1788.Xr mandoc 1 .
1789In
1790.Xr mdoc 5
1791and
1792.Xr man 5
1793documents, using escape sequences is discouraged except for those
1794described in the
1795.Sx LANGUAGE SYNTAX
1796section above.
1797.Pp
1798A backslash followed by any character not listed here
1799simply prints that character itself.
1800.Ss \e<newline>
1801A backslash at the end of an input line can be used to continue the
1802logical input line on the next physical input line, joining the text
1803on both lines together as if it were on a single input line.
1804.Ss \e<space>
1805The escape sequence backslash-space
1806.Pq Sq \e\ \&
1807is an unpaddable space-sized non-breaking space character; see
1808.Sx Whitespace .
1809.Ss \e\(dq
1810The rest of the input line is treated as
1811.Sx Comments .
1812.Ss \e%
1813Hyphenation allowed at this point of the word; ignored by
1814.Xr mandoc 1 .
1815.Ss \e&
1816Non-printing zero-width character; see
1817.Sx Whitespace .
1818.Ss \e\(aq
1819Acute accent special character; use
1820.Sq \e(aa
1821instead.
1822.Ss \e( Ns Ar cc
1823.Sx Special Characters
1824with two-letter names, see
1825.Xr mandoc_char 5 .
1826.Ss \e*[ Ns Ar name ]
1827Interpolate the string with the
1828.Ar name ;
1829see
1830.Sx Predefined Strings
1831and
1832.Sx ds .
1833For short names, there are variants
1834.No \e* Ns Ar c
1835and
1836.No \e*( Ns Ar cc .
1837.Ss \e-
1838Special character
1839.Dq mathematical minus sign .
1840.Ss \e[ Ns Ar name ]
1841.Sx Special Characters
1842with names of arbitrary length, see
1843.Xr mandoc_char 5 .
1844.Ss \e^
1845One-twelfth em half-narrow space character, effectively zero-width in
1846.Xr mandoc 1 .
1847.Ss \e`
1848Grave accent special character; use
1849.Sq \e(ga
1850instead.
1851.Ss \e{
1852Begin conditional input; see
1853.Sx if .
1854.Ss \e\(ba
1855One-sixth em narrow space character, effectively zero-width in
1856.Xr mandoc 1 .
1857.Ss \e}
1858End conditional input; see
1859.Sx if .
1860.Ss \e~
1861Paddable non-breaking space character.
1862.Ss \e0
1863Digit width space character.
1864.Ss \eA\(aq Ns Ar string Ns \(aq
1865Anchor definition; ignored by
1866.Xr mandoc 1 .
1867.Ss \eB\(aq Ns Ar string Ns \(aq
1868Interpolate
1869.Sq 1
1870if
1871.Ar string
1872conforms to the syntax of
1873.Sx Numerical expressions
1874explained above and
1875.Sq 0
1876otherwise.
1877.Ss \eb\(aq Ns Ar string Ns \(aq
1878Bracket building function; ignored by
1879.Xr mandoc 1 .
1880.Ss \eC\(aq Ns Ar name Ns \(aq
1881.Sx Special Characters
1882with names of arbitrary length.
1883.Ss \ec
1884When encountered at the end of an input text line,
1885the next input text line is considered to continue that line,
1886even if there are request or macro lines in between.
1887No whitespace is inserted.
1888.Ss \eD\(aq Ns Ar string Ns \(aq
1889Draw graphics function; ignored by
1890.Xr mandoc 1 .
1891.Ss \ed
1892Move down by half a line; ignored by
1893.Xr mandoc 1 .
1894.Ss \ee
1895Backslash special character.
1896.Ss \eF[ Ns Ar name ]
1897Switch font family (groff extension); ignored by
1898.Xr mandoc 1 .
1899For short names, there are variants
1900.No \eF Ns Ar c
1901and
1902.No \eF( Ns Ar cc .
1903.Ss \ef[ Ns Ar name ]
1904Switch to the font
1905.Ar name ,
1906see
1907.Sx Text Decoration .
1908For short names, there are variants
1909.No \ef Ns Ar c
1910and
1911.No \ef( Ns Ar cc .
1912.Ss \eg[ Ns Ar name ]
1913Interpolate the format of a number register; ignored by
1914.Xr mandoc 1 .
1915For short names, there are variants
1916.No \eg Ns Ar c
1917and
1918.No \eg( Ns Ar cc .
1919.Ss \eH\(aq Ns Oo +|- Oc Ns Ar number Ns \(aq
1920Set the height of the current font; ignored by
1921.Xr mandoc 1 .
1922.Ss \eh\(aq Ns Ar number Ns \(aq
1923Horizontal motion; ignored by
1924.Xr mandoc 1 .
1925.Ss \ek[ Ns Ar name ]
1926Mark horizontal input place in register; ignored by
1927.Xr mandoc 1 .
1928For short names, there are variants
1929.No \ek Ns Ar c
1930and
1931.No \ek( Ns Ar cc .
1932.Ss \eL\(aq Ns Ar number Ns Oo Ar c Oc Ns \(aq
1933Vertical line drawing function; ignored by
1934.Xr mandoc 1 .
1935.Ss \el\(aq Ns Ar number Ns Oo Ar c Oc Ns \(aq
1936Horizontal line drawing function; ignored by
1937.Xr mandoc 1 .
1938.Ss \eM[ Ns Ar name ]
1939Set fill (background) color (groff extension); ignored by
1940.Xr mandoc 1 .
1941For short names, there are variants
1942.No \eM Ns Ar c
1943and
1944.No \eM( Ns Ar cc .
1945.Ss \em[ Ns Ar name ]
1946Set glyph drawing color (groff extension); ignored by
1947.Xr mandoc 1 .
1948For short names, there are variants
1949.No \em Ns Ar c
1950and
1951.No \em( Ns Ar cc .
1952.Ss \eN\(aq Ns Ar number Ns \(aq
1953Character
1954.Ar number
1955on the current font.
1956.Ss \en[ Ns Ar name ]
1957Interpolate the number register
1958.Ar name .
1959For short names, there are variants
1960.No \en Ns Ar c
1961and
1962.No \en( Ns Ar cc .
1963.Ss \eo\(aq Ns Ar string Ns \(aq
1964Overstrike, writing all the characters contained in the
1965.Ar string
1966to the same output position.
1967In terminal and HTML output modes,
1968only the last one of the characters is visible.
1969.Ss \eR\(aq Ns Ar name Oo +|- Oc Ns Ar number Ns \(aq
1970Set number register; ignored by
1971.Xr mandoc 1 .
1972.Ss \eS\(aq Ns Ar number Ns \(aq
1973Slant output; ignored by
1974.Xr mandoc 1 .
1975.Ss \es\(aq Ns Oo +|- Oc Ns Ar number Ns \(aq
1976Change point size; ignored by
1977.Xr mandoc 1 .
1978Alternative forms
1979.No \es Ns Oo +|- Oc Ns Ar n ,
1980.No \es Ns Oo +|- Oc Ns \(aq Ns Ar number Ns \(aq ,
1981.No \es Ns [ Oo +|- Oc Ns Ar number ] ,
1982and
1983.No \es Ns Oo +|- Oc Ns [ Ar number Ns ]
1984are also parsed and ignored.
1985.Ss \et
1986Horizontal tab; ignored by
1987.Xr mandoc 1 .
1988.Ss \eu
1989Move up by half a line; ignored by
1990.Xr mandoc 1 .
1991.Ss \eV[ Ns Ar name ]
1992Interpolate an environment variable; ignored by
1993.Xr mandoc 1 .
1994For short names, there are variants
1995.No \eV Ns Ar c
1996and
1997.No \eV( Ns Ar cc .
1998.Ss \ev\(aq Ns Ar number Ns \(aq
1999Vertical motion; ignored by
2000.Xr mandoc 1 .
2001.Ss \ew\(aq Ns Ar string Ns \(aq
2002Interpolate the width of the
2003.Ar string .
2004The
2005.Xr mandoc 1
2006implementation assumes that after expansion of user-defined strings, the
2007.Ar string
2008only contains normal characters, no escape sequences, and that each
2009character has a width of 24 basic units.
2010.Ss \eX\(aq Ns Ar string Ns \(aq
2011Output
2012.Ar string
2013as device control function; ignored in nroff mode and by
2014.Xr mandoc 1 .
2015.Ss \ex\(aq Ns Ar number Ns \(aq
2016Extra line space function; ignored by
2017.Xr mandoc 1 .
2018.Ss \eY[ Ns Ar name ]
2019Output a string as a device control function; ignored in nroff mode and by
2020.Xr mandoc 1 .
2021For short names, there are variants
2022.No \eY Ns Ar c
2023and
2024.No \eY( Ns Ar cc .
2025.Ss \eZ\(aq Ns Ar string Ns \(aq
2026Print
2027.Ar string
2028with zero width and height; ignored by
2029.Xr mandoc 1 .
2030.Ss \ez
2031Output the next character without advancing the cursor position;
2032approximated in
2033.Xr mandoc 1
2034by simply skipping the next character.
2035.Sh COMPATIBILITY
2036The
2037.Xr mandoc 1
2038implementation of the
2039.Nm
2040language is intentionally incomplete.
2041Unimplemented features include:
2042.Pp
2043.Bl -dash -compact
2044.It
2045For security reasons,
2046.Xr mandoc 1
2047never reads or writes external files except via
2048.Sx \&so
2049requests with safe relative paths.
2050.It
2051There is no automatic hyphenation, no adjustment to the right margin,
2052and no centering; the output is always set flush-left.
2053.It
2054Support for setting tabulator positions
2055and tabulator and leader characters is missing,
2056and support for manually changing indentation is limited.
2057.It
2058The
2059.Sq u
2060scaling unit is the default terminal unit.
2061In traditional troff systems, this unit changes depending on the
2062output media.
2063.It
2064Width measurements are implemented in a crude way
2065and often yield wrong results.
2066Explicit movement requests and escapes are ignored.
2067.It
2068There is no concept of output pages, no support for floats,
2069graphics drawing, and picture inclusion;
2070terminal output is always continuous.
2071.It
2072Requests regarding color, font families, and glyph manipulation
2073are ignored.
2074Font support is very limited.
2075Kerning is not implemented, and no ligatures are produced.
2076.It
2077The
2078.Qq \(aq
2079macro control character does not suppress output line breaks.
2080.It
2081Diversions are not implemented,
2082and support for traps is very incomplete.
2083.It
2084While recursion is supported,
2085.Sx \&while
2086loops are not.
2087.El
2088.Pp
2089The special semantics of the
2090.Cm nS
2091number register is an idiosyncracy of
2092.Ox
2093manuals and not supported by other
2094.Xr mdoc 5
2095implementations.
2096.Sh SEE ALSO
2097.Xr mandoc 1 ,
2098.Xr eqn 5 ,
2099.Xr man 5 ,
2100.Xr mandoc_char 5 ,
2101.Xr mdoc 5 ,
2102.Xr tbl 5
2103.Rs
2104.%A Joseph F. Ossanna
2105.%A Brian W. Kernighan
2106.%I AT&T Bell Laboratories
2107.%T Troff User's Manual
2108.%R Computing Science Technical Report
2109.%N 54
2110.%C Murray Hill, New Jersey
2111.%D 1976 and 1992
2112.%U http://www.kohala.com/start/troff/cstr54.ps
2113.Re
2114.Rs
2115.%A Joseph F. Ossanna
2116.%A Brian W. Kernighan
2117.%A Gunnar Ritter
2118.%T Heirloom Documentation Tools Nroff/Troff User's Manual
2119.%D September 17, 2007
2120.%U http://heirloom.sourceforge.net/doctools/troff.pdf
2121.Re
2122.Sh HISTORY
2123The RUNOFF typesetting system, whose input forms the basis for
2124.Nm ,
2125was written in MAD and FAP for the CTSS operating system by Jerome E.
2126Saltzer in 1964.
2127Doug McIlroy rewrote it in BCPL in 1969, renaming it
2128.Nm .
2129Dennis M. Ritchie rewrote McIlroy's
2130.Nm
2131in PDP-11 assembly for
2132.At v1 ,
2133Joseph F. Ossanna improved roff and renamed it nroff
2134for
2135.At v2 ,
2136then ported nroff to C as troff, which Brian W. Kernighan released with
2137.At v7 .
2138In 1989, James Clarke re-implemented troff in C++, naming it groff.
2139.Sh AUTHORS
2140.An -nosplit
2141This
2142.Nm
2143reference was written by
2144.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
2145and
2146.An Ingo Schwarze Aq Mt schwarze@openbsd.org .
2147