xref: /titanic_50/usr/src/man/man5/mandoc_roff.5 (revision 10d63b7db37a83b39c7f511cf9426c9d03ea0760)
1.\"
2.\" Permission to use, copy, modify, and distribute this software for any
3.\" purpose with or without fee is hereby granted, provided that the above
4.\" copyright notice and this permission notice appear in all copies.
5.\"
6.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
7.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
8.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
9.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
10.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
11.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
12.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
13.\"
14.\"
15.\" Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
16.\" Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
17.\" Copyright 2012 Nexenta Systems, Inc. All rights reserved.
18.\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
19.\"
20.Dd Jul 13, 2014
21.Dt MANDOC_ROFF 5
22.Os
23.Sh NAME
24.Nm mandoc_roff
25.Nd roff language reference for mandoc
26.Sh DESCRIPTION
27The
28.Nm roff
29language is a general purpose text formatting language.
30Since traditional implementations of the
31.Xr mdoc 5
32and
33.Xr man 5
34manual formatting languages are based on it,
35many real-world manuals use small numbers of
36.Nm
37requests intermixed with their
38.Xr mdoc 5
39or
40.Xr man 5
41code.
42To properly format such manuals, the
43.Xr mandoc 1
44utility supports a tiny subset of
45.Nm
46requests.
47Only these requests supported by
48.Xr mandoc 1
49are documented in the present manual,
50together with the basic language syntax shared by
51.Nm ,
52.Xr mdoc 5 ,
53and
54.Xr man 5 .
55For complete
56.Nm
57manuals, consult the
58.Sx SEE ALSO
59section.
60.Pp
61Input lines beginning with the control character
62.Sq \&.
63are parsed for requests and macros.
64Such lines are called
65.Dq request lines
66or
67.Dq macro lines ,
68respectively.
69Requests change the processing state and manipulate the formatting;
70some macros also define the document structure and produce formatted
71output.
72The single quote
73.Pq Qq \(aq
74is accepted as an alternative control character,
75treated by
76.Xr mandoc 1
77just like
78.Ql \&.
79.Pp
80Lines not beginning with control characters are called
81.Dq text lines .
82They provide free-form text to be printed; the formatting of the text
83depends on the respective processing context.
84.Sh LANGUAGE SYNTAX
85.Nm
86documents may contain only graphable 7-bit ASCII characters, the space
87character, and, in certain circumstances, the tab character.
88The back-space character
89.Sq \e
90indicates the start of an escape sequence for
91.Sx Comments ,
92.Sx Special Characters ,
93.Sx Predefined Strings ,
94and
95user-defined strings defined using the
96.Sx ds
97request.
98.Ss Comments
99Text following an escaped double-quote
100.Sq \e\(dq ,
101whether in a request, macro, or text line, is ignored to the end of the line.
102A request line beginning with a control character and comment escape
103.Sq \&.\e\(dq
104is also ignored.
105Furthermore, request lines with only a control character and optional
106trailing whitespace are stripped from input.
107.Pp
108Examples:
109.Bd -literal -offset indent -compact
110\&.\e\(dq This is a comment line.
111\&.\e\(dq The next line is ignored:
112\&.
113\&.Sh EXAMPLES \e\(dq This is a comment, too.
114\&example text \e\(dq And so is this.
115.Ed
116.Ss Special Characters
117Special characters are used to encode special glyphs and are rendered
118differently across output media.
119They may occur in request, macro, and text lines.
120Sequences begin with the escape character
121.Sq \e
122followed by either an open-parenthesis
123.Sq \&(
124for two-character sequences; an open-bracket
125.Sq \&[
126for n-character sequences (terminated at a close-bracket
127.Sq \&] ) ;
128or a single one character sequence.
129.Pp
130Examples:
131.Bl -tag -width Ds -offset indent -compact
132.It Li \e(em
133Two-letter em dash escape.
134.It Li \ee
135One-letter backslash escape.
136.El
137.Pp
138See
139.Xr mandoc_char 5
140for a complete list.
141.Ss Text Decoration
142Terms may be text-decorated using the
143.Sq \ef
144escape followed by an indicator: B (bold), I (italic), R (regular), or P
145(revert to previous mode).
146A numerical representation 3, 2, or 1 (bold, italic, and regular,
147respectively) may be used instead.
148The indicator or numerical representative may be preceded by C
149(constant-width), which is ignored.
150.Pp
151Examples:
152.Bl -tag -width Ds -offset indent -compact
153.It Li \efBbold\efR
154Write in bold, then switch to regular font mode.
155.It Li \efIitalic\efP
156Write in italic, then return to previous font mode.
157.El
158.Pp
159Text decoration is
160.Em not
161recommended for
162.Xr mdoc 5 ,
163which encourages semantic annotation.
164.Ss Predefined Strings
165Predefined strings, like
166.Sx Special Characters ,
167mark special output glyphs.
168Predefined strings are escaped with the slash-asterisk,
169.Sq \e* :
170single-character
171.Sq \e*X ,
172two-character
173.Sq \e*(XX ,
174and N-character
175.Sq \e*[N] .
176.Pp
177Examples:
178.Bl -tag -width Ds -offset indent -compact
179.It Li \e*(Am
180Two-letter ampersand predefined string.
181.It Li \e*q
182One-letter double-quote predefined string.
183.El
184.Pp
185Predefined strings are not recommended for use,
186as they differ across implementations.
187Those supported by
188.Xr mandoc 1
189are listed in
190.Xr mandoc_char 5 .
191Manuals using these predefined strings are almost certainly not portable.
192.Ss Whitespace
193Whitespace consists of the space character.
194In text lines, whitespace is preserved within a line.
195In request and macro lines, whitespace delimits arguments and is discarded.
196.Pp
197Unescaped trailing spaces are stripped from text line input unless in a
198literal context.
199In general, trailing whitespace on any input line is discouraged for
200reasons of portability.
201In the rare case that a blank character is needed at the end of an
202input line, it may be forced by
203.Sq \e\ \e& .
204.Pp
205Literal space characters can be produced in the output
206using escape sequences.
207In macro lines, they can also be included in arguments using quotation; see
208.Sx MACRO SYNTAX
209for details.
210.Pp
211Blank text lines, which may include whitespace, are only permitted
212within literal contexts.
213If the first character of a text line is a space, that line is printed
214with a leading newline.
215.Ss Scaling Widths
216Many requests and macros support scaled widths for their arguments.
217The syntax for a scaled width is
218.Sq Li [+-]?[0-9]*.[0-9]*[:unit:] ,
219where a decimal must be preceded or followed by at least one digit.
220Negative numbers, while accepted, are truncated to zero.
221.Pp
222The following scaling units are accepted:
223.Pp
224.Bl -tag -width Ds -offset indent -compact
225.It c
226centimetre
227.It i
228inch
229.It P
230pica (~1/6 inch)
231.It p
232point (~1/72 inch)
233.It f
234synonym for
235.Sq u
236.It v
237default vertical span
238.It m
239width of rendered
240.Sq m
241.Pq em
242character
243.It n
244width of rendered
245.Sq n
246.Pq en
247character
248.It u
249default horizontal span
250.It M
251mini-em (~1/100 em)
252.El
253.Pp
254Using anything other than
255.Sq m ,
256.Sq n ,
257.Sq u ,
258or
259.Sq v
260is necessarily non-portable across output media.
261See
262.Sx COMPATIBILITY .
263.Pp
264If a scaling unit is not provided, the numerical value is interpreted
265under the default rules of
266.Sq v
267for vertical spaces and
268.Sq u
269for horizontal ones.
270.Pp
271Examples:
272.Bl -tag -width ".Bl -tag -width 2i" -offset indent -compact
273.It Li \&.Bl -tag -width 2i
274two-inch tagged list indentation in
275.Xr mdoc 5
276.It Li \&.HP 2i
277two-inch tagged list indentation in
278.Xr man 5
279.It Li \&.sp 2v
280two vertical spaces
281.El
282.Ss Sentence Spacing
283Each sentence should terminate at the end of an input line.
284By doing this, a formatter will be able to apply the proper amount of
285spacing after the end of sentence (unescaped) period, exclamation mark,
286or question mark followed by zero or more non-sentence closing
287delimiters
288.Po
289.Sq \&) ,
290.Sq \&] ,
291.Sq \&' ,
292.Sq \&"
293.Pc .
294.Pp
295The proper spacing is also intelligently preserved if a sentence ends at
296the boundary of a macro line.
297.Pp
298Examples:
299.Bd -literal -offset indent -compact
300Do not end sentences mid-line like this.  Instead,
301end a sentence like this.
302A macro would end like this:
303\&.Xr mandoc 1 \&.
304.Ed
305.Sh REQUEST SYNTAX
306A request or macro line consists of:
307.Pp
308.Bl -enum -compact
309.It
310the control character
311.Sq \&.
312or
313.Sq \(aq
314at the beginning of the line,
315.It
316optionally an arbitrary amount of whitespace,
317.It
318the name of the request or the macro, which is one word of arbitrary
319length, terminated by whitespace,
320.It
321and zero or more arguments delimited by whitespace.
322.El
323.Pp
324Thus, the following request lines are all equivalent:
325.Bd -literal -offset indent
326\&.ig end
327\&.ig    end
328\&.   ig end
329.Ed
330.Sh MACRO SYNTAX
331Macros are provided by the
332.Xr mdoc 5
333and
334.Xr man 5
335languages and can be defined by the
336.Sx \&de
337request.
338When called, they follow the same syntax as requests, except that
339macro arguments may optionally be quoted by enclosing them
340in double quote characters
341.Pq Sq \(dq .
342Quoted text, even if it contains whitespace or would cause
343a macro invocation when unquoted, is always considered literal text.
344Inside quoted text, pairs of double quote characters
345.Pq Sq Qq
346resolve to single double quote characters.
347.Pp
348To be recognised as the beginning of a quoted argument, the opening
349quote character must be preceded by a space character.
350A quoted argument extends to the next double quote character that is not
351part of a pair, or to the end of the input line, whichever comes earlier.
352Leaving out the terminating double quote character at the end of the line
353is discouraged.
354For clarity, if more arguments follow on the same input line,
355it is recommended to follow the terminating double quote character
356by a space character; in case the next character after the terminating
357double quote character is anything else, it is regarded as the beginning
358of the next, unquoted argument.
359.Pp
360Both in quoted and unquoted arguments, pairs of backslashes
361.Pq Sq \e\e
362resolve to single backslashes.
363In unquoted arguments, space characters can alternatively be included
364by preceding them with a backslash
365.Pq Sq \e\~ ,
366but quoting is usually better for clarity.
367.Pp
368Examples:
369.Bl -tag -width Ds -offset indent -compact
370.It Li .Fn strlen \(dqconst char *s\(dq
371Group arguments
372.Qq const char *s
373into one function argument.
374If unspecified,
375.Qq const ,
376.Qq char ,
377and
378.Qq *s
379would be considered separate arguments.
380.It Li .Op \(dqFl a\(dq
381Consider
382.Qq \&Fl a
383as literal text instead of a flag macro.
384.El
385.Sh REQUEST REFERENCE
386The
387.Xr mandoc 1
388.Nm
389parser recognises the following requests.
390Note that the
391.Nm
392language defines many more requests not implemented in
393.Xr mandoc 1 .
394.Ss \&ad
395Set line adjustment mode.
396This line-scoped request is intended to have one argument to select
397normal, left, right, or centre adjustment for subsequent text.
398Currently, it is ignored including its arguments,
399and the number of arguments is not checked.
400.Ss \&am
401Append to a macro definition.
402The syntax of this request is the same as that of
403.Sx \&de .
404It is currently ignored by
405.Xr mandoc 1 ,
406as are its children.
407.Ss \&ami
408Append to a macro definition, specifying the macro name indirectly.
409The syntax of this request is the same as that of
410.Sx \&dei .
411It is currently ignored by
412.Xr mandoc 1 ,
413as are its children.
414.Ss \&am1
415Append to a macro definition, switching roff compatibility mode off
416during macro execution.
417The syntax of this request is the same as that of
418.Sx \&de1 .
419It is currently ignored by
420.Xr mandoc 1 ,
421as are its children.
422.Ss \&de
423Define a
424.Nm
425macro.
426Its syntax can be either
427.Bd -literal -offset indent
428.Pf . Cm \&de Ar name
429.Ar macro definition
430\&..
431.Ed
432.Pp
433or
434.Bd -literal -offset indent
435.Pf . Cm \&de Ar name Ar end
436.Ar macro definition
437.Pf . Ar end
438.Ed
439.Pp
440Both forms define or redefine the macro
441.Ar name
442to represent the
443.Ar macro definition ,
444which may consist of one or more input lines, including the newline
445characters terminating each line, optionally containing calls to
446.Nm
447requests,
448.Nm
449macros or high-level macros like
450.Xr man 5
451or
452.Xr mdoc 5
453macros, whichever applies to the document in question.
454.Pp
455Specifying a custom
456.Ar end
457macro works in the same way as for
458.Sx \&ig ;
459namely, the call to
460.Sq Pf . Ar end
461first ends the
462.Ar macro definition ,
463and after that, it is also evaluated as a
464.Nm
465request or
466.Nm
467macro, but not as a high-level macro.
468.Pp
469The macro can be invoked later using the syntax
470.Pp
471.D1 Pf . Ar name Op Ar argument Op Ar argument ...
472.Pp
473Regarding argument parsing, see
474.Sx MACRO SYNTAX
475above.
476.Pp
477The line invoking the macro will be replaced
478in the input stream by the
479.Ar macro definition ,
480replacing all occurrences of
481.No \e\e$ Ns Ar N ,
482where
483.Ar N
484is a digit, by the
485.Ar N Ns th Ar argument .
486For example,
487.Bd -literal -offset indent
488\&.de ZN
489\efI\e^\e\e$1\e^\efP\e\e$2
490\&..
491\&.ZN XtFree .
492.Ed
493.Pp
494produces
495.Pp
496.D1 \efI\e^XtFree\e^\efP.
497.Pp
498in the input stream, and thus in the output: \fI\^XtFree\^\fP.
499.Pp
500Since macros and user-defined strings share a common string table,
501defining a macro
502.Ar name
503clobbers the user-defined string
504.Ar name ,
505and the
506.Ar macro definition
507can also be printed using the
508.Sq \e*
509string interpolation syntax described below
510.Sx ds ,
511but this is rarely useful because every macro definition contains at least
512one explicit newline character.
513.Pp
514In order to prevent endless recursion, both groff and
515.Xr mandoc 1
516limit the stack depth for expanding macros and strings
517to a large, but finite number.
518Do not rely on the exact value of this limit.
519.Ss \&dei
520Define a
521.Nm
522macro, specifying the macro name indirectly.
523The syntax of this request is the same as that of
524.Sx \&de .
525It is currently ignored by
526.Xr mandoc 1 ,
527as are its children.
528.Ss \&de1
529Define a
530.Nm
531macro that will be executed with
532.Nm
533compatibility mode switched off during macro execution.
534This is a GNU extension not available in traditional
535.Nm
536implementations and not even in older versions of groff.
537Since
538.Xr mandoc 1
539does not implement
540.Nm
541compatibility mode at all, it handles this request as an alias for
542.Sx \&de .
543.Ss \&ds
544Define a user-defined string.
545Its syntax is as follows:
546.Pp
547.D1 Pf . Cm \&ds Ar name Oo \(dq Oc Ns Ar string
548.Pp
549The
550.Ar name
551and
552.Ar string
553arguments are space-separated.
554If the
555.Ar string
556begins with a double-quote character, that character will not be part
557of the string.
558All remaining characters on the input line form the
559.Ar string ,
560including whitespace and double-quote characters, even trailing ones.
561.Pp
562The
563.Ar string
564can be interpolated into subsequent text by using
565.No \e* Ns Bq Ar name
566for a
567.Ar name
568of arbitrary length, or \e*(NN or \e*N if the length of
569.Ar name
570is two or one characters, respectively.
571Interpolation can be prevented by escaping the leading backslash;
572that is, an asterisk preceded by an even number of backslashes
573does not trigger string interpolation.
574.Pp
575Since user-defined strings and macros share a common string table,
576defining a string
577.Ar name
578clobbers the macro
579.Ar name ,
580and the
581.Ar name
582used for defining a string can also be invoked as a macro,
583in which case the following input line will be appended to the
584.Ar string ,
585forming a new input line passed to the
586.Nm
587parser.
588For example,
589.Bd -literal -offset indent
590\&.ds badidea .S
591\&.badidea
592H SYNOPSIS
593.Ed
594.Pp
595invokes the
596.Cm SH
597macro when used in a
598.Xr man 5
599document.
600Such abuse is of course strongly discouraged.
601.Ss \&el
602The
603.Qq else
604half of an if/else conditional.
605Pops a result off the stack of conditional evaluations pushed by
606.Sx \&ie
607and uses it as its conditional.
608If no stack entries are present (e.g., due to no prior
609.Sx \&ie
610calls)
611then false is assumed.
612The syntax of this request is similar to
613.Sx \&if
614except that the conditional is missing.
615.Ss \&EN
616End an equation block.
617See
618.Sx \&EQ .
619.Ss \&EQ
620Begin an equation block.
621See
622.Xr eqn 5
623for a description of the equation language.
624.Ss \&hy
625Set automatic hyphenation mode.
626This line-scoped request is currently ignored.
627.Ss \&ie
628The
629.Qq if
630half of an if/else conditional.
631The result of the conditional is pushed into a stack used by subsequent
632invocations of
633.Sx \&el ,
634which may be separated by any intervening input (or not exist at all).
635Its syntax is equivalent to
636.Sx \&if .
637.Ss \&if
638Begins a conditional.
639Right now, the conditional evaluates to true
640if and only if it starts with the letter
641.Sy n ,
642indicating processing in nroff style as opposed to troff style.
643If a conditional is false, its children are not processed, but are
644syntactically interpreted to preserve the integrity of the input
645document.
646Thus,
647.Pp
648.D1 \&.if t .ig
649.Pp
650will discard the
651.Sq \&.ig ,
652which may lead to interesting results, but
653.Pp
654.D1 \&.if t .if t \e{\e
655.Pp
656will continue to syntactically interpret to the block close of the final
657conditional.
658Sub-conditionals, in this case, obviously inherit the truth value of
659the parent.
660This request has the following syntax:
661.Bd -literal -offset indent
662\&.if COND \e{\e
663BODY...
664\&.\e}
665.Ed
666.Bd -literal -offset indent
667\&.if COND \e{ BODY
668BODY... \e}
669.Ed
670.Bd -literal -offset indent
671\&.if COND \e{ BODY
672BODY...
673\&.\e}
674.Ed
675.Bd -literal -offset indent
676\&.if COND \e
677BODY
678.Ed
679.Pp
680COND is a conditional statement.
681roff allows for complicated conditionals; mandoc is much simpler.
682At this time, mandoc supports only
683.Sq n ,
684evaluating to true;
685and
686.Sq t ,
687.Sq e ,
688and
689.Sq o ,
690evaluating to false.
691All other invocations are read up to the next end of line or space and
692evaluate as false.
693.Pp
694If the BODY section is begun by an escaped brace
695.Sq \e{ ,
696scope continues until a closing-brace escape sequence
697.Sq \.\e} .
698If the BODY is not enclosed in braces, scope continues until
699the end of the line.
700If the COND is followed by a BODY on the same line, whether after a
701brace or not, then requests and macros
702.Em must
703begin with a control character.
704It is generally more intuitive, in this case, to write
705.Bd -literal -offset indent
706\&.if COND \e{\e
707\&.foo
708bar
709\&.\e}
710.Ed
711.Pp
712than having the request or macro follow as
713.Pp
714.D1 \&.if COND \e{ .foo
715.Pp
716The scope of a conditional is always parsed, but only executed if the
717conditional evaluates to true.
718.Pp
719Note that the
720.Sq \e}
721is converted into a zero-width escape sequence if not passed as a
722standalone macro
723.Sq \&.\e} .
724For example,
725.Pp
726.D1 \&.Fl a \e} b
727.Pp
728will result in
729.Sq \e}
730being considered an argument of the
731.Sq \&Fl
732macro.
733.Ss \&ig
734Ignore input.
735Its syntax can be either
736.Bd -literal -offset indent
737.Pf . Cm \&ig
738.Ar ignored text
739\&..
740.Ed
741.Pp
742or
743.Bd -literal -offset indent
744.Pf . Cm \&ig Ar end
745.Ar ignored text
746.Pf . Ar end
747.Ed
748.Pp
749In the first case, input is ignored until a
750.Sq \&..
751request is encountered on its own line.
752In the second case, input is ignored until the specified
753.Sq Pf . Ar end
754macro is encountered.
755Do not use the escape character
756.Sq \e
757anywhere in the definition of
758.Ar end ;
759it would cause very strange behaviour.
760.Pp
761When the
762.Ar end
763macro is a roff request or a roff macro, like in
764.Pp
765.D1 \&.ig if
766.Pp
767the subsequent invocation of
768.Sx \&if
769will first terminate the
770.Ar ignored text ,
771then be invoked as usual.
772Otherwise, it only terminates the
773.Ar ignored text ,
774and arguments following it or the
775.Sq \&..
776request are discarded.
777.Ss \&ne
778Declare the need for the specified minimum vertical space
779before the next trap or the bottom of the page.
780This line-scoped request is currently ignored.
781.Ss \&nh
782Turn off automatic hyphenation mode.
783This line-scoped request is currently ignored.
784.Ss \&rm
785Remove a request, macro or string.
786This request is intended to have one argument,
787the name of the request, macro or string to be undefined.
788Currently, it is ignored including its arguments,
789and the number of arguments is not checked.
790.Ss \&nr
791Define a register.
792A register is an arbitrary string value that defines some sort of state,
793which influences parsing and/or formatting.
794Its syntax is as follows:
795.Pp
796.D1 Pf \. Cm \&nr Ar name Ar value
797.Pp
798The
799.Ar value
800may, at the moment, only be an integer.
801So far, only the following register
802.Ar name
803is recognised:
804.Bl -tag -width Ds
805.It Cm nS
806If set to a positive integer value, certain
807.Xr mdoc 5
808macros will behave in the same way as in the
809.Em SYNOPSIS
810section.
811If set to 0, these macros will behave in the same way as outside the
812.Em SYNOPSIS
813section, even when called within the
814.Em SYNOPSIS
815section itself.
816Note that starting a new
817.Xr mdoc 5
818section with the
819.Cm \&Sh
820macro will reset this register.
821.El
822.Ss \&ns
823Turn on no-space mode.
824This line-scoped request is intended to take no arguments.
825Currently, it is ignored including its arguments,
826and the number of arguments is not checked.
827.Ss \&ps
828Change point size.
829This line-scoped request is intended to take one numerical argument.
830Currently, it is ignored including its arguments,
831and the number of arguments is not checked.
832.Ss \&so
833Include a source file.
834Its syntax is as follows:
835.Pp
836.D1 Pf \. Cm \&so Ar file
837.Pp
838The
839.Ar file
840will be read and its contents processed as input in place of the
841.Sq \&.so
842request line.
843To avoid inadvertent inclusion of unrelated files,
844.Xr mandoc 1
845only accepts relative paths not containing the strings
846.Qq ../
847and
848.Qq /.. .
849.Pp
850This request requires
851.Xr man 1
852to change to the right directory before calling
853.Xr mandoc 1 ,
854per convention to the root of the manual tree.
855Typical usage looks like:
856.Pp
857.Dl \&.so man3/Xcursor.3
858.Pp
859As the whole concept is rather fragile, the use of
860.Sx \&so
861is discouraged.
862Use
863.Xr ln 1
864instead.
865.Ss \&ta
866Set tab stops.
867This line-scoped request can take an arbitrary number of arguments.
868Currently, it is ignored including its arguments.
869.Ss \&tr
870Output character translation.
871Its syntax is as follows:
872.Pp
873.D1 Pf \. Cm \&tr Ar [ab]+
874.Pp
875Pairs of
876.Ar ab
877characters are replaced
878.Ar ( a
879for
880.Ar b ) .
881Replacement (or origin) characters may also be character escapes; thus,
882.Pp
883.Dl tr \e(xx\e(yy
884.Pp
885replaces all invocations of \e(xx with \e(yy.
886.Ss \&T&
887Re-start a table layout, retaining the options of the prior table
888invocation.
889See
890.Sx \&TS .
891.Ss \&TE
892End a table context.
893See
894.Sx \&TS .
895.Ss \&TS
896Begin a table, which formats input in aligned rows and columns.
897See
898.Xr tbl 5
899for a description of the tbl language.
900.Sh COMPATIBILITY
901This section documents compatibility between mandoc and other other
902.Nm
903implementations, at this time limited to GNU troff
904.Pq Qq groff .
905The term
906.Qq historic groff
907refers to groff version 1.15.
908.Pp
909.Bl -dash -compact
910.It
911In mandoc, the
912.Sx \&EQ ,
913.Sx \&TE ,
914.Sx \&TS ,
915and
916.Sx \&T& ,
917macros are considered regular macros.
918In all other
919.Nm
920implementations, these are special macros that must be specified without
921spacing between the control character (which must be a period) and the
922macro name.
923.It
924The
925.Cm nS
926register is only compatible with OpenBSD's groff-1.15.
927.It
928Historic groff did not accept white-space before a custom
929.Ar end
930macro for the
931.Sx \&ig
932request.
933.It
934The
935.Sx \&if
936and family would print funny white-spaces with historic groff when
937using the next-line syntax.
938.El
939.Sh SEE ALSO
940.Xr mandoc 1 ,
941.Xr eqn 5 ,
942.Xr man 5 ,
943.Xr mandoc_char 5 ,
944.Xr mdoc 5 ,
945.Xr tbl 5
946.Rs
947.%A Joseph F. Ossanna
948.%A Brian W. Kernighan
949.%I AT&T Bell Laboratories
950.%T Troff User's Manual
951.%R Computing Science Technical Report
952.%N 54
953.%C Murray Hill, New Jersey
954.%D 1976 and 1992
955.%U http://www.kohala.com/start/troff/cstr54.ps
956.Re
957.Rs
958.%A Joseph F. Ossanna
959.%A Brian W. Kernighan
960.%A Gunnar Ritter
961.%T Heirloom Documentation Tools Nroff/Troff User's Manual
962.%D September 17, 2007
963.%U http://heirloom.sourceforge.net/doctools/troff.pdf
964.Re
965.Sh HISTORY
966The RUNOFF typesetting system, whose input forms the basis for
967.Nm ,
968was written in MAD and FAP for the CTSS operating system by Jerome E.
969Saltzer in 1964.
970Doug McIlroy rewrote it in BCPL in 1969, renaming it
971.Nm .
972Dennis M. Ritchie rewrote McIlroy's
973.Nm
974in PDP-11 assembly for
975.At v1 ,
976Joseph F. Ossanna improved roff and renamed it nroff
977for
978.At v2 ,
979then ported nroff to C as troff, which Brian W. Kernighan released with
980.At v7 .
981In 1989, James Clarke re-implemented troff in C++, naming it groff.
982.Sh AUTHORS
983.An -nosplit
984This
985.Nm
986reference was written by
987.An Kristaps Dzonsons ,
988.Mt kristaps@bsd.lv ;
989and
990.An Ingo Schwarze ,
991.Mt schwarze@openbsd.org .
992