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