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