GROFF
NAME
DESCRIPTION
GROFF ELEMENTS
CONTROL CHARACTERS
NUMERICAL EXPRESSIONS
CONDITIONS
REQUESTS
ESCAPE SEQUENCES
REGISTERS
HYPHENATION
UNDERLINING
COMPATIBILITY
AUTHORS
SEE ALSO
NAME
groff − a short reference for the GNU roff language
DESCRIPTION
The name groff stands for GNU roff and is the free implementation of the roff type-setting system. See roff(7) for a survey and the background of the groff system.
This document provides only short descriptions of roff language elements. Groff: The GNU Implementation of troff, by Trent A. Fisher and Werner Lemberg, is the primary groff manual, and is written in Texinfo. You can browse it interactively with “info groff”.
Historically, the roff language was called troff. groff is compatible with the classical system and provides proper extensions. So in GNU, the terms roff, troff, and groff language could be used as synonyms. However troff slightly tends to refer more to the classical aspects, whereas groff emphasizes the GNU extensions, and roff is the general term for the language.
The general syntax for writing groff documents is relatively easy, but writing extensions to the roff language can be a bit harder.
The roff language is line-oriented. There are only two kinds of lines, control lines and text lines. The control lines start with a control character, by default a period “.” or a single quote “‘”; all other lines are text lines.
Control lines represent commands, optionally with arguments. They have the following syntax. The leading control character can be followed by a command name; arguments, if any, are separated by spaces (but not tab characters) from the command name and among themselves, for example,
.command_name arg1 arg2
For indentation, any number of space or tab characters can be inserted between the leading control character and the command name, but the control character must be on the first position of the line.
Text lines represent the parts that is printed. They can be modified by escape sequences, which are recognized by a leading backslash ‘’. These are in-line or even in-word formatting elements or functions. Some of these take arguments separated by single quotes “‘”, others are regulated by a length encoding introduced by an open parenthesis ‘(’ or enclosed in brackets ‘[’ and ‘]’.
The roff language provides flexible instruments for writing language extension, such as macros. When interpreting macro definitions, the roff system enters a special operating mode, called the copy mode.
The copy mode behaviour can be quite tricky, but there are some rules that ensure a safe usage.
1. |
Printable backslashes must be denoted as e. To be more precise, e represents the current escape character. To get a backslash glyph, use (rs or [rs]. |
||
2. |
Double all backslashes. |
||
3. |
Begin all text lines with the special non-spacing character &. |
This does not produce the most efficient code, but it should work as a first measure. For better strategies, see the groff Texinfo manual and groff_tmac(5).
Reading roff source files is easier, just reduce all double backslashes to a single one in all macro definitions.
GROFF ELEMENTS
The roff language elements add formatting information to a text file. The fundamental elements are predefined commands and variables that make roff a full-blown programming language.
There are two kinds of roff commands, possibly with arguments. Requests are written on a line of their own starting with a dot ‘.’ or a “‘”, whereas Escape sequences are in-line functions and in-word formatting elements starting with a backslash ‘’.
The user can define her own formatting commands using the de request. These commands are called macros, but they are used exactly like requests. Macro packages are pre-defined sets of macros written in the groff language. A user’s possibilities to create escape sequences herself is very limited, only special characters can be mapped.
The groff language provides several kinds of variables with different interfaces. There are pre-defined variables, but the user can define her own variables as well.
String variables store character sequences. They are set with the ds request and retrieved by the * escape sequences. Strings can have variables.
Register variables can store numerical values, numbers with a scale unit, and occasionally string-like objects. They are set with the nr request and retrieved by the n escape sequences.
Environments allow the user to temporarily store global formatting parameters like line length, font size, etc. for later reuse. This is done by the ev request.
Fonts are identified either by a name or by an internal number. The current font is chosen by the ft request or by the f escape sequences. Each device has special fonts, but the following fonts are available for all devices. R is the standard font Roman. B is its bold counterpart. The italic font is called I and is available everywhere, but on text devices it is displayed as an underlined Roman font. For the graphical output devices, there exist constant-width pendants of these fonts, CR, CI, and CB. On text devices, all glyphs have a constant width anyway.
Glyphs are visual representation forms of characters. In groff, the distinction between those two elements is not always obvious (and a full discussion is beyond the scope of this man page). A first approximation is that glyphs have a specific size and colour and are taken from a specific font; they can’t be modified any more – characters are the input, and glyphs are the output. As soon as an output line has been generated, it no longer contains characters but glyphs. In this man page, we use either ‘glyph’ or ‘character’, whatever is more appropriate.
Moreover, there are some advanced roff elements. A diversion stores (formatted) information into a macro for later usage. See groff_tmac(5) for more details. A trap is a positional condition like a certain number of lines from page top or in a diversion or in the input. Some action can be prescribed to be run automatically when the condition is met.
More detailed information and examples can be found in the groff Texinfo manual.
CONTROL CHARACTERS
There is a small set of characters that have a special controlling task in certain conditions.
. |
A dot is only special at the beginning of a line or after the condition in the requests if, ie, el, and while. There it is the control character that introduces a request (or macro). By using the cc request, the control character can be set to a different character, making the dot ‘.’ a non-special character. |
||
In all other positions, it just means a dot character. In text paragraphs, it is advantageous to start each sentence at a line of its own. |
|||
‘ |
The single quote has two controlling tasks. At the beginning of a line and in the conditional requests it is the non-breaking control character. That means that it introduces a request like the dot, but with the additional property that this request doesn’t cause a linebreak. By using the c2 request, the non-break control character can be set to a different character. |
||
As a second task, it is the most commonly used argument separator in some functional escape sequences (but any pair of characters not part of the argument do work). In all other positions, it denotes the single quote or apostrophe character. Groff provides a printable representation with the (cq escape sequence. |
|||
“ |
The double quote is used to enclose arguments in macros (but not in requests and strings). In the ds and as requests, a leading double quote in the argument is stripped off, making everything else afterwards the string to be defined (enabling leading whitespace). The escaped double quote “ introduces a comment. Otherwise, it is not special. Groff provides a printable representation with the (dq escape sequence. |
||
|
The backslash usually introduces an escape sequence (this can be changed with the ec request). A printed version of the escape character is the e escape; a backslash glyph can be obtained by (rs. |
||
( |
The open parenthesis is only special in escape sequences when introducing an escape name or argument consisting of exactly two characters. In groff, this behaviour can be replaced by the [] construct. |
||
[ |
The opening bracket is only special in groff escape sequences; there it is used to introduce a long escape name or long escape argument. Otherwise, it is non-special, e.g. in macro calls. |
||
] |
The closing bracket is only special in groff escape sequences; there it terminates a long escape name or long escape argument. Otherwise, it is non-special. |
||
space |
Space characters are only functional characters. They separate the arguments in requests, macros, and strings, and the words in text lines. They are subject to groff’s horizontal spacing calculations. To get a defined space width, escape sequences like ‘ ’ (this is the escape character followed by a space), |, ^, or h should be used. |
newline
In text paragraphs, newlines mostly behave like space characters. Continuation lines can be specified by an escaped newline, i.e., by specifying a backslash ‘’ as the last character of a line.
tab |
If a tab character occurs during text the interpreter makes a horizontal jump to the next pre-defined tab position. There is a sophisticated interface for handling tab positions. |
NUMERICAL EXPRESSIONS
A numerical value is a signed or unsigned integer or float with or without an appended scaling indicator. A scaling indicator is a one-character abbreviation for a unit of measurement. A number followed by a scaling indicator signifies a size value. By default, numerical values do not have a scaling indicator, i.e., they are normal numbers.
The roff language defines the following scaling indicators.
c |
centimeter |
||
i |
inch |
||
P |
pica = 1/6 inch |
||
p |
point = 1/72 inch |
||
m |
em = the font size in points (approx. width of letter ‘m’) |
||
M |
100th of an em |
||
n |
en = em/2 |
||
u |
Basic unit for actual output device |
||
v |
Vertical line space in basic units |
||
s |
scaled point = 1/sizescale of a point (defined in font DESC file) |
||
f |
Scale by 65536. |
Numerical expressions are combinations of the numerical values defined above with the following arithmetical operators already defined in classical troff.
+ |
Addition |
|||
− |
Subtraction |
|||
* |
Multiplication |
|||
/ |
Division |
|||
% |
Modulo |
|||
= |
Equals |
|||
== |
Equals |
|||
< |
Less than |
|||
> |
Greater than |
|||
<= |
Less or equal |
|||
>= |
Greater or equal |
|||
& |
Logical and |
|||
: |
Logical or |
|||
! |
Logical not |
|||
( |
Grouping of expressions |
|||
) |
Close current grouping |
Moreover, groff added the following operators for numerical expressions:
e1>?e2 |
The maximum of e1 and e2. |
||
e1e2 |
The minimum of e1 and e2. |
||
(c;e) |
Evaluate e using c as the default scaling indicator. |
For details see the groff Texinfo manual.
CONDITIONS
Conditions occur in tests raised by the if, ie, and the while requests. The following table characterizes the different types of conditions.
N |
A numerical expression N yields true if its value is greater than 0. |
||
!N |
True if the value of N is 0 (see below). |
||
‘s1‘s2‘ |
True if string s1 is identical to string s2. |
||
!’s1‘s2‘ |
True if string s1 is not identical to string s2 (see below). |
||
cch |
True if there is a glyph ch available. |
||
dname |
True if there is a string, macro, diversion, or request called name. |
||
e |
Current page number is even. |
||
o |
Current page number is odd. |
||
mname |
True if there is a color called name. |
||
n |
Formatter is nroff. |
||
rreg |
True if there is a register named reg. |
||
t |
Formatter is troff. |
||
Ffont |
True if there exists a font named font. |
||
Sstyle |
True if a style named style has been registered. |
Note that the ! operator may only appear at the beginning of an expression, and negates the entire expression. This maintains bug-compatibility with AT&T troff.
REQUESTS
This section provides a short reference for the predefined requests. In groff, request, macro, and string names can be arbitrarily long. No bracketing or marking of long names is needed.
Most requests take one or more arguments. The arguments are separated by space characters (no tabs!); there is no inherent limit for their length or number.
Some requests have optional arguments with a different behaviour. Not all of these details are outlined here. Refer to the groff Texinfo manual and groff_diff(7) for all details.
In the following request specifications, most argument names were chosen to be descriptive. Only the following denotations need clarification.
c |
denotes a single character. |
||
font |
a font either specified as a font name or a font number. |
||
anything |
all characters up to the end of the line or within { and }. |
||
n |
is a numerical expression that evaluates to an integer value. |
||
N |
is an arbitrary numerical expression, signed or unsigned. |
||
±N |
has three meanings depending on its sign, described below. |
If an expression defined as ±N starts with a ‘+’ sign the resulting value of the expression is added to an already existing value inherent to the related request, e.g. adding to a number register. If the expression starts with a ‘–’ the value of the expression is subtracted from the request value.
Without a sign, N replaces the existing value directly. To assign a negative number either prepend 0 or enclose the negative number in parentheses.
Request Short Reference
. |
Empty line, ignored. Useful for structuring documents. |
.” anything
Complete line is a comment.
.ab string
Print string on standard error, exit program.
.ad |
Begin line adjustment for output lines in current adjust mode. |
||
.ad c |
Start line adjustment in mode c (c=l,r,c,b,n). |
.af register c
Assign format c to register (c=l,i,I,a,A).
.aln alias register
Create alias name for register.
.als alias object
Create alias name for request, string, macro, or diversion object.
.am macro |
Append to macro until .. is encountered. |
.am macro end
Append to macro until .end is called.
.am1 macro
Same as .am but with compatibility mode switched off during macro expansion.
.am1 macro end
Same as .am but with compatibility mode switched off during macro expansion.
.ami macro
Append to a macro whose name is contained in the string register macro until .. is encountered.
.ami macro end
Append to a macro indirectly. macro and end are string registers whose contents are interpolated for the macro name and the end macro, respectively.
.ami1 macro
Same as .ami but with compatibility mode switched off during macro expansion.
.ami1 macro end
Same as .ami but with compatibility mode switched off during macro expansion.
.as stringvar anything
Append anything to stringvar.
.as1 stringvar anything
Same as .as but with compatibility mode switched off during string expansion.
.asciify diversion
Unformat ASCII characters, spaces, and some escape sequences in diversion.
.backtrace
Print a backtrace of the input on stderr.
.bd font N
Embolden font by N−1 units.
.bd S font N
Embolden Special Font S when current font is font.
.blm |
Unset the blank line macro. |
.blm macro
Set the blank line macro to macro.
.box |
End current diversion. |
.box macro
Divert to macro, omitting a partially filled line.
.boxa |
End current diversion. |
.boxa macro
Divert and append to macro, omitting a partially filled line.
.bp |
Eject current page and begin new page. |
|||
.bp ±N |
Eject current page; next page number ±N. |
|||
.br |
Line break. |
|||
.brp |
Break output line; adjust if applicable. |
|||
.break |
Break out of a while loop. |
|||
.c2 |
Reset no-break control character to “‘”. |
|||
.c2 c |
Set no-break control character to c. |
|||
.cc |
Reset control character to ‘.’. |
|||
.cc c |
Set control character to c. |
|||
.ce |
Center the next input line. |
|||
.ce N |
Center following N input lines. |
.cf filename
Copy contents of file filename unprocessed to stdout or to the diversion.
.cflags mode c1 c2 …
Treat characters c1, c2, … according to mode number.
.ch trap N
Change trap location to N.
.char c anything
Define entity c as string anything.
.chop object
Chop the last character off macro, string, or diversion object.
.class name c1 c2 …
Assign a set of characters, character ranges, or classes c1, c2, … to name.
.close stream
Close the stream.
.color |
Enable colors. |
||
.color N |
If N is zero disable colors, otherwise enable them. |
.composite from to
Map glyph name from to glyph name to while constructing a composite glyph name.
.continue |
Finish the current iteration of a while loop. |
||
.cp |
Enable compatibility mode. |
||
.cp N |
If N is zero disable compatibility mode, otherwise enable it. |
.cs font N M
Set constant character width mode for font to N/36 ems with em M.
.cu N |
Continuous underline in nroff, like .ul in troff. |
||
.da |
End current diversion. |
||
.da macro |
Divert and append to macro. |
||
.de macro |
Define or redefine macro until .. is encountered. |
.de macro end
Define or redefine macro until .end is called.
.de1 macro
Same as .de but with compatibility mode switched off during macro expansion.
.de1 macro end
Same as .de but with compatibility mode switched off during macro expansion.
.defcolor color scheme component
Define or redefine a color with name color. scheme can be rgb, cym, cymk, gray, or grey. component can be single components specified as fractions in the range 0 to 1 (default scaling indicator f), as a string of two-digit hexadecimal color components with a leading #, or as a string of four-digit hexadecimal components with two leading #. The color default can’t be redefined.
.dei macro
Define or redefine a macro whose name is contained in the string register macro until .. is encountered.
.dei macro end
Define or redefine a macro indirectly. macro and end are string registers whose contents are interpolated for the macro name and the end macro, respectively.
.dei1 macro
Same as .dei but with compatibility mode switched off during macro expansion.
.dei1 macro end
Same as .dei but with compatibility mode switched off during macro expansion.
.device anything
Write anything to the intermediate output as a device control function.
.devicem name
Write contents of macro or string name uninterpreted to the intermediate output as a device control function.
.di |
End current diversion. |
||
.di macro |
Divert to macro. See groff_tmac(5) for more details. |
||
.do name |
Interpret .name with compatibility mode disabled. |
.ds stringvar anything
Set stringvar to anything.
.ds1 stringvar anything
Same as .ds but with compatibility mode switched off during string expansion.
.dt N trap
Set diversion trap to position N (default scaling indicator v).
.ec |
Reset escape character to ‘’. |
|||
.ec c |
Set escape character to c. |
|||
.ecr |
Restore escape character saved with .ecs. |
|||
.ecs |
Save current escape character. |
.el anything
Else part for if-else (.ie) request.
.em macro |
The macro is run after the end of input. |
||
.eo |
Turn off escape character mechanism. |
||
.ev |
Switch to previous environment and pop it off the stack. |
||
.ev env |
Push down environment number or name env to the stack and switch to it. |
||
.evc env |
Copy the contents of environment env to the current environment. No pushing or popping. |
||
.ex |
Exit from roff processing. |
||
.fam |
Return to previous font family. |
||
.fam name |
Set the current font family to name. |
||
.fc |
Disable field mechanism. |
||
.fc a |
Set field delimiter to a and pad glyph to space. |
||
.fc a b |
Set field delimiter to a and pad glyph to b. |
.fchar c anything
Define fallback character (or glyph) c as string anything.
.fcolor |
Set fill color to previous fill color. |
|||
.fcolor c |
Set fill color to c. |
|||
.fi |
Fill output lines. |
|||
.fl |
Flush output buffer. |
.fp n font
Mount font on position n.
.fp n internal external
Mount font with long external name to short internal name on position n.
.fschar f c anything
Define fallback character (or glyph) c for font f as string anything.
.fspecial font
Reset list of special fonts for font to be empty.
.fspecial font s1 s2 …
When the current font is font, then the fonts s1, s2, … are special.
.ft |
Return to previous font. Same as or . |
||
.ft font |
Change to font name or number font; same as f[font] escape sequence. |
.ftr font1 font2
Translate font1 to font2.
.fzoom font
Don’t magnify font.
.fzoom font zoom
Set zoom factor for font (in multiples of 1/1000th).
.gcolor |
Set glyph color to previous glyph color. |
||
.gcolor c |
Set glyph color to c. |
||
.hc |
Remove additional hyphenation indicator character. |
||
.hc c |
Set up additional hyphenation indicator character c. |
.hcode c1 code1 [c2 code2] …
Set the hyphenation code of character c1 to code1, that of c2 to code2, etc.
.hla lang |
Set the current hyphenation language to lang. |
||
.hlm n |
Set the maximum number of consecutive hyphenated lines to n. |
||
.hpf file |
Read hyphenation patterns from file. |
.hpfa file
Append hyphenation patterns from file.
.hpfcode a b c d …
Set input mapping for .hpf.
.hw words |
List of words with exceptional hyphenation. |
||
.hy N |
Switch to hyphenation mode N. |
||
.hym n |
Set the hyphenation margin to n (default scaling indicator m). |
||
.hys n |
Set the hyphenation space to n. |
.ie cond anything
If cond then anything else goto .el.
.if cond anything
If cond then anything; otherwise do nothing.
.ig |
Ignore text until .. is encountered. |
||
.ig end |
Ignore text until .end is called. |
||
.in |
Change to previous indentation value. |
||
.in ±N |
Change indentation according to ±N (default scaling indicator m). |
.it N trap
Set an input-line count trap for the next N lines.
.itc N trap
Same as .it but don’t count lines interrupted with c.
.kern |
Enable pairwise kerning. |
||
.kern n |
If n is zero, disable pairwise kerning, otherwise enable it. |
||
.lc |
Remove leader repetition glyph. |
||
.lc c |
Set leader repetition glyph to c. |
.length register anything
Write the length of the string anything to register.
.linetabs |
Enable line-tabs mode (i.e., calculate tab positions relative to output line). |
.linetabs n
If n is zero, disable line-tabs mode, otherwise enable it.
.lf N |
Set input line number to N. |
.lf N file
Set input line number to N and filename to file.
.lg N |
Ligature mode on if N>0. |
||
.ll |
Change to previous line length. |
||
.ll ±N |
Set line length according to ±N (default length 6.5i, default scaling indicator m). |
||
.lsm |
Unset the leading spaces macro. |
.lsm macro
Set the leading spaces macro to macro.
.ls |
Change to the previous value of additional intra-line skip. |
||
.ls N |
Set additional intra-line skip value to N, i.e., N−1 blank lines are inserted after each text output line. |
||
.lt ±N |
Length of title (default scaling indicator m). |
||
.mc |
Margin glyph off. |
||
.mc c |
Print glyph c after each text line at actual distance from right margin. |
||
.mc c N |
Set margin glyph to c and distance to N from right margin (default scaling indicator m). |
.mk [register]
Mark current vertical position in register, or in an internal register used by .rt if no argument.
.mso file |
The same as .so except that file is searched in the tmac directories. |
||
.na |
No output-line adjusting. |
||
.ne |
Need a one-line vertical space. |
||
.ne N |
Need N vertical space (default scaling indicator v). |
||
.nf |
No filling or adjusting of output lines. |
||
.nh |
No hyphenation. |
||
.nm |
Number mode off. |
.nm ±N [M [S [I]]]
In line number mode, set number, multiple, spacing, and indentation.
.nn |
Do not number next line. |
|||
.nn N |
Do not number next N lines. |
.nop anything
Always process anything.
.nr register ±N [M]
Define or modify register using ±N with auto-increment M.
.nroff |
Make the built-in conditions n true and t false. |
||
.ns |
Turn on no-space mode. |
||
.nx |
Immediately jump to end of current file. |
.nx filename
Immediately continue processing with file file.
.open stream filename
Open filename for writing and associate the stream named stream with it.
.opena stream filename
Like .open but append to it.
.os |
Output vertical distance that was saved by the sv request. |
.output string
Emit string directly to intermediate output, allowing leading whitespace if string starts with “ (which is stripped off).
.pc |
Reset page number character to ‘%’. |
||
.pc c |
Page number character. |
||
.pev |
Print the current environment and each defined environment state to stderr. |
.pi program
Pipe output to program (nroff only).
.pl |
Set page length to default 11i. The current page length is stored in register .p. |
||
.pl ±N |
Change page length to ±N (default scaling indicator v). |
||
.pm |
Print macro names and sizes (number of blocks of 128 bytes). |
||
.pm t |
Print only total of sizes of macros (number of 128 bytes blocks). |
||
.pn ±N |
Next page number N. |
||
.pnr |
Print the names and contents of all currently defined number registers on stderr. |
||
.po |
Change to previous page offset. The current page offset is available in register .o. |
||
.po ±N |
Page offset N. |
||
.ps |
Return to previous point size. |
||
.ps ±N |
Point size; same as s[±N]. |
.psbb filename
Get the bounding box of a PostScript image filename.
.pso command
This behaves like the so request except that input comes from the standard output of command.
.ptr |
Print the names and positions of all traps (not including input line traps and diversion traps) on stderr. |
||
.pvs |
Change to previous post-vertical line spacing. |
||
.pvs ±N |
Change post-vertical line spacing according to ±N (default scaling indicator p). |
.rchar c1 c2 …
Remove the definitions of entities c1, c2, …
.rd prompt
Read insertion.
.return |
Return from a macro. |
.return anything
Return twice, namely from the macro at the current level and from the macro one level higher.
.rfschar f c1 c2 …
Remove the definitions of entities c1, c2, … for font f.
.rj n |
Right justify the next n input lines. |
||
.rm name |
Remove request, macro, diversion, or string name. |
.rn old new
Rename request, macro, diversion, or string old to new.
.rnn reg1 reg2
Rename register reg1 to reg2.
.rr register
Remove register.
.rs |
Restore spacing; turn no-space mode off. |
||
.rt |
Return (upward only) to vertical position marked by .mk on the current page. |
||
.rt ±N |
Return (upward only) to specified distance from the top of the page (default scaling indicator v). |
.schar c anything
Define global fallback character (or glyph) c as string anything.
.shc |
Reset soft hyphen glyph to (hy. |
|||
.shc c |
Set the soft hyphen glyph to c. |
|||
.shift n |
In a macro, shift the arguments by n positions. |
.sizes s1 s2 … sn [0]
Set available font sizes similar to the sizes command in a DESC file.
.so filename
Include source file.
.sp |
Skip one line vertically. |
||
.sp N |
Space vertical distance N up or down according to sign of N (default scaling indicator v). |
||
.special |
Reset global list of special fonts to be empty. |
.special s1 s2 …
Fonts s1, s2, etc. are special and are searched for glyphs not in the current font.
.spreadwarn
Toggle the spread warning on and off without changing its value.
.spreadwarn limit
Emit a warning if each space in an output line is widened by limit or more (default scaling indicator m).
.ss N |
Set space glyph size to N/12 of the space width in the current font. |
||
.ss N M |
Set space glyph size to N/12 and sentence space size set to M/12 of the space width in the current font. |
.sty n style
Associate style with font position n.
.substring xx n1 n2
Replace the string named xx with the substring defined by the indices n1 and n2.
.sv |
Save 1 v of vertical space. |
||
.sv N |
Save the vertical distance N for later output with os request (default scaling indicator v). |
.sy command-line
Execute program command-line.
.ta T N |
Set tabs after every position that is a multiple of N (default scaling indicator m). |
.ta n1 n2 … nn T r1 r2 … rn
Set tabs at positions n1, n2, …, nn, then set tabs at nn+m×rn+r1 through nn+m×rn+rn, where m increments from 0, 1, 2, … to infinity.
.tc |
Remove tab repetition glyph. |
||
.tc c |
Set tab repetition glyph to c. |
||
.ti ±N |
Temporary indent next line (default scaling indicator m). |
.tkf font s1 n1 s2 n2
Enable track kerning for font.
.tl ’left’center’right’
Three-part title.
.tm anything
Print anything on stderr.
.tm1 anything
Print anything on stderr, allowing leading whitespace if anything starts with “ (which is stripped off).
.tmc anything
Similar to .tm1 without emitting a final newline.
.tr abcd…
Translate a to b, c to d, etc. on output.
.trf filename
Transparently output the contents of file filename.
.trin abcd…
This is the same as the tr request except that the asciify request uses the character code (if any) before the character translation.
.trnt abcd…
This is the same as the tr request except that the translations do not apply to text that is transparently throughput into a diversion with !.
.troff |
Make the built-in conditions t true and n false. |
||
.uf font |
Set underline font to font (to be switched to by .ul). |
||
.ul N |
Underline (italicize in troff) N input lines. |
.unformat diversion
Unformat space characters and tabs in diversion, preserving font information.
.vpt n |
Enable vertical position traps if n is non-zero, disable them otherwise. |
||
.vs |
Change to previous vertical base line spacing. |
||
.vs ±N |
Set vertical base line spacing to ±N (default scaling indicator p). |
||
.warn n |
Set warnings code to n. |
.warnscale si
Set scaling indicator used in warnings to si.
.wh N |
Remove (first) trap at position N. |
.wh N trap
Set location trap; negative means from page bottom.
.while cond anything
While condition cond is true, accept anything as input.
.write stream anything
Write anything to the stream named stream.
.writec stream anything
Similar to .write without emitting a final newline.
.writem stream xx
Write contents of macro or string xx to the stream named stream.
Besides these standard groff requests, there might be further macro calls. They can originate from a macro package (see roff(7) for an overview) or from a preprocessor.
Preprocessor macros are easy to recognize. They enclose their code between a pair of characteristic macros.
Note that the ‘ideal’ preprocessor is not available in groff yet.
ESCAPE SEQUENCES
Escape sequences are in-line language elements usually introduced by a backslash ‘’ and followed by an escape name and sometimes by a required argument. Input processing is continued directly after the escaped character or the argument (without an intervening separation character). So there must be a way to determine the end of the escape name and the end of the argument.
This is done by enclosing names (escape name and arguments consisting of a variable name) by a pair of brackets [name] and constant arguments (number expressions and characters) by apostrophes (ASCII 0x27) like ’constant’.
There are abbreviations for short names. Two-character escape names can be specified by an opening parenthesis like (xy or *(xy without a closing counterpart. And all one-character names different from the special characters ‘[’ and ‘(’ can even be specified without a marker, for example nc or $c.
Constant arguments of length 1 can omit the marker apostrophes, too, but there is no two-character analogue.
While one-character escape sequences are mainly used for in-line functions and system-related tasks, the two-letter names following the ( construct are glyphs predefined by the roff system; these are called ‘Special Characters’ in the classical documentation. Escapes sequences of the form [name] denote glyphs too.
Single-Character Escapes
“ |
Start of a comment. Everything up to the end of the line is ignored. |
||
# |
Everything up to and including the next newline is ignored. This is interpreted in copy mode. This is like “ except that the terminating newline is ignored as well. |
||
*s |
The string stored in the string variable with one-character name s. |
||
*(st |
The string stored in the string variable with two-character name st. |
*[string]
The string stored in the string variable with name string (with arbitrary length).
*[stringvar arg1 arg2 …]
The string stored in the string variable with arbitrarily long name stringvar, taking arg1, arg2, … as arguments.
$0 |
The name by which the current macro was invoked. The als request can make a macro have more than one name. |
||
$x |
Macro or string argument with one-digit number x in the range 1 to 9. |
||
$(xy |
Macro or string argument with two-digit number xy (larger than zero). |
$[nexp]
Macro or string argument with number nexp, where nexp is a numerical expression evaluating to an integer ≥1.
$* |
In a macro or string, the concatenation of all the arguments separated by spaces. |
||
$@ |
In a macro or string, the concatenation of all the arguments with each surrounded by double quotes, and separated by spaces. |
||
$^ |
In a macro, the representation of all parameters as if they were an argument to the ds request. |
||
\ |
reduces to a single backslash; useful to delay its interpretation as escape character in copy mode. For a printable backslash, use e, or even better [rs], to be independent from the current escape character. |
||
´ |
The acute accent ´; same as (aa. Unescaped: apostrophe, right quotation mark, single quote (ASCII 0x27). |
||
` |
The grave accent `; same as (ga. Unescaped: left quote, backquote (ASCII 0x60). |
||
− |
The − (minus) sign in the current font. |
||
_ |
The same as (ul, the underline character. |
||
. |
The same as a dot (‘.’). Necessary in nested macro definitions so that ‘\..’ expands to ‘..’. |
||
% |
Default optional hyphenation character. |
||
! |
Transparent line indicator. |
?anything?
In a diversion, this transparently embeds anything in the diversion. anything is read in copy mode. See also the escape sequences ! and ?.
space |
Unpaddable space size space glyph (no line break). |
||
|