Back to Table of Contents | Next: Coloured text |
Inline escapes, as described in the groff terms section of this manual, are typesetting commands that appear in text input lines, as opposed to macros and other control lines that must appear on lines by themselves.
Aside from altering type parameters within a line, inlines also tell groff about special characters—em-dashes, bullets, figure/digit-width spaces, and so on. It is beyond the scope of this manual to provide a complete list of groff’s inline functions and special characters. I recommend having a look at the canonical reference materials should you need more information than is contained herein.
In groff, the escape character is the backslash (\). Groff interprets everything following the backslash as instructions, not literal text, until the escape sequence is complete. Should you need the actual backslash character as part of a line of text, simply enter it twice (\\). Groff understands that this means "please print a backslash character."
You can also use \e to print a literal backslash, or use ESC_CHAR to change the escape character to something other than the backslash, which lets you use a single backslash as a literal backslash.
Groff has a number of ways of recognizing what constitutes a complete escape sequence. This is both a boon and a curse; some escape sequences have no terminating delimiter and consequently become difficult to distinguish from real input text. Others require the use of an opening parenthesis with no corresponding closing parenthesis. Still others need to be enclosed in square brackets.
Mom recognizes that certain escapes get used more often than others. For these, she has a consistent input style that takes the form \*[...], which makes them stand out well from the text of your documents. These escapes are the ones listed under Mom’s personal inline escapes.
Despite mom’s best intentions, there are still a number of typesetting functions that can only be accomplished with groff’s native inline escapes. I've listed the ones that strike me as essential, but there are many others. If you want to know what they are, please read the canonical reference materials pertaining to groff.
Helpful bit of information: Inline escapes can be used in document processing macros that take string arguments.
Mom provides five escapes for changing fonts inline:
\*[ROM] Change to the medium roman font
\*[IT] Change to the medium italic font
\*[BD] Change to the bold roman font
\*[BDI] Change to the bold italic font
\*[PREV] Revert to the previous font (once only)*
Note: \*[PREV] does not operate "stack style". It returns to the previous font once only, and afterwards has no effect. In other words, in the case of \*[PREV]\*[PREV], only the first \*[PREV] is respected; the second one is silently ignored.
These escapes are provided for merely for convenience, legibility, and consistency when typesetting with mom. For more complete and flexible inline font control, please see font control with \f.
If you’re using the document processing macros, inline font changes remain in effect only for the duration of the current document element tag.
Additionally, if you’re designing your own HEADERS or FOOTERS and want to use mom’s inline escapes for changing fonts as part of the the left, centre and/or right strings, or in the strings for recto and/or verso HEADERS or FOOTERS, or in the strings passed to HEADERS_AND_FOOTERS, you must enter the inlines beginning with \E* rather than just \*, eg \E*[BD].
Mom has two inline escapes for changing point size:
\*[SIZE <size>]
and
\*S[<size>]
where “size” is the new size you want. You can use
either; they behave exactly the same way. For example, to change
the point size of type inline to 12 points, you could enter either
\*[SIZE 12]
or
\*S[12]
Entering either \*[SIZE] or \*S[] with no
argument reverts to the former point size.
The advantage of the first form is that it’s easy to remember, and follows mom’s usual inline syntax. The advantage of the second is that it’s more concise.
Notice that in both cases, the new size does not require a unit of measure; points is assumed. However, a unit of measure may be appended to the size if that’s what you wish. Fractional sizes are, of course, allowed.
The size given to \*[SIZE <size>] or
\*S[<size>] may be expressed in plus or minus
terms, which can be very useful. In the following examples, the
word “mom” will be output 2 points larger than the point
size of the rest of the line.
While she isn't perfect, \*S[+2]mom\*S[-2] isn't half bad.
While she isn't perfect, \*[SIZE +2]mom\*[SIZE -2] isn't half bad.
Please note that inline size changes do not update the leading if
AUTOLEAD
is enabled.
If you’re using the document processing macros and wish to design your own HEADERS or FOOTERS using mom’s inline escape for changing point size as part of the left, centre and/or right strings, or in the strings for recto and/or verso HEADERS or FOOTERS, or in the strings passed to HEADERS_AND_FOOTERS, you must use the form \*S[<n>] and enter the inline beginning with \E*, like this: \E*S[<+|-><n>].
Additional note: If you’re accustomed to groff’s usual way of handling inline size requests (\sN, \s±N, \s(NN, \s±(NN, \s[NNN], \s±[NNN]), feel free to continue with your old habits. Mom doesn’t care.
If you need to capitalise a region of type inline, bracket the
region of type with the inline escapes, \*[UC] (Upper Case)
and \*[LC] (Lower Case), like this:
All work \*[UC]and\*[LC] no play makes Jack a dull boy.
The above produces, on output
All work AND no play makes Jack a dull boy.
Note: \*[UC] and \*[LC] must not be used inside the string arguments passed to the HEADER_<POSITION> macro. Instead, use the control macro HEADER_<POSITION>_CAPS. For HEADER_RECTO (or _VERSO) or FOOTER_RECTO (or _VERSO), supply the CAPS option to the appropriate macro.
Pairwise kerning means moving specific letter pairs closer together or further apart (see Typesetting terms, kerning for more details).
Mom permits inline pairwise kerning through the use of the inline
escapes
\*[BU <n>] Closes the space between letters (Back Units).
\*[FU <n>] Opens the space between letters (Forward Units).
<n> is the number of
kern units
by which to close or open the space between letters.
For example,
THE HUMAN COST OF COMMODIF\*[FU 1]YING FRESH W\*[BU 4]A\*[BU 5]TER
moves the letter Y in “COMMODIFYING” one kern unit away
from the letter F, and the letter A in “WATER” four
kern units closer to the letter W. Additionally, the letter T in
“WATER” is moved five kern units closer to the letter A.
For backward compatibility, the forms
\*[BU1]...\*[BU36] Move backward 1...36 kern units
\*[FU1]...\*[FU36] Move forward 1...36 kern units
also exist (ie with no space before the number of kern units desired,
up to a limit of 36).
The default size of a kern unit is 1/36 of the current point size;
this may be changed by invoking the macro, .KERN_UNIT,
with the desired value, which represents a fraction of the current
point size. For example, to change the kern unit to 1/54 of the
current point size,
.KERN_UNIT 54
To restore the kern unit to its default, invoke
.KERN_UNIT with an argument of DEFAULT.
If you’re using the document processing macros and wish to design your own HEADERS or FOOTERS using mom’s inline escapes for kerning as part of the left, centre and/or right strings, or in the strings for recto and/or verso HEADERS or FOOTERS, or in the strings passed to HEADERS_AND_FOOTERS, you must use the forms \E*[BU<n>] and \E*[FU<n>] (ie with no space), and enter the inline beginning with \E* rather than just \*, eg \E*[BU4].
Additional note: Using the BU or FU escapes between characters pairs that are already automatically kerned (see KERN) disables the automatic kerning and uses the value you give to BU or FU instead.
Sometimes, you may need to insert a specified amount amount of white space into an output line, or—occasionally—back up to a previous position on an output line in order to create special typographic effects.
Mom’s inline escapes for these horizontal movements are
\*[BCK <n unit>] Move backward inline the specified number of
units of measure; decimal fractions are allowed.
and
\*[FWD <n unit>] Move forward inline the specified number of
units of measure; decimal fractions are allowed.
For example,
1.\*[FWD 12p]The Free Trade Play-Offs: WalMart 100, Mexico 0
puts 12 points of space between 1. and
The.
Note:
For backward compatibility, the forms
\*[BP.25]...\*[BP12.75] Move backward .25...12.75 points
\*[FP.25]...\*[FP12.75] Move forward .25...12.75 points
also exist (ie with no space before the digit and points being
the unit of measure, hence no unit of measure required). Both
accept quarter points, so it’s possible to do, for example,
\*[FP.5] or \*[BP1.25] up to a limit
of 12.75 points.
If you’re using the document processing macros and wish to design your own HEADERS or FOOTERS using mom’s inline escapes for horizontal movements as part of the left, centre and/or right strings, or in the strings for recto and/or verso HEADERS or FOOTERS, or in the strings passed to HEADERS_AND_FOOTERS, you must use the forms \E*[BP<n>] and \E*[FP<n>] (ie with no space), and enter the inline beginning with \E* rather than just \*, eg \E*[BP.755].
If you need to move portions of type up or down on a line, mom
provides the following inline escapes:
\*[DOWN <n unit>] Move down inline the specified number of
units of measure
\*[UP <n unit>] Move up inline the specified number of
units of measure
For example,
Tel: 905\*[UP 1p]-\*[DOWN 1p]4072
moves the hyphen in the telephone number up by 1 point, then
moves back down by the same amount.
Note: \*[UP] and \*[DOWN] do not work in conjunction with the inline escape, \*[RULE].
Additional note:
For backward compatibility, the following are also available:
\*[ALD.25]...\*[ALD12.75] Advance lead .25...12.75 points (move downward)
\*[RLD.25]...\*[RLD12.75] Reverse lead .25...12.75 points (move upward)
Both \*[ALD] and \*[RLD] work in points, hence you mustn’t use a unit of measure.
If you’re using the document processing macros and wish to design your own HEADERS or FOOTERS using mom’s inline escapes for vertical movements as part of the left, centre and/or right strings, or in the strings for recto and/or verso HEADERS or FOOTERS, or in the strings passed to HEADERS_AND_FOOTERS, you must use the forms \E*[ALD<n>] and \E*[RLD<n>] (ie with no space), and enter the inline beginning with \E* rather than just \*, eg \E*[ALD.5].
Sometimes, you want mom to break a line but not advance on the page.
This can be accomplished with the macro,
EL
or with the escape, \*[B]. Simply attach \*[B]
to the end of any input line. Using the example given in the
document entry for EL, you'd use \*[B] like this:
.LEFT
.LS 12.5
A line of text.\*[B]
.ALD 24p
The next line of text.
\*[B] works reliably regardless of the current
fill mode.
Sometimes, you want mom to move to the next tab in sequence (eg
from TAB 1 to TAB 2, or TAB 8 to TAB 9) without mom advancing on the
page. (See the NOTE
here
if you’re not clear how mom manages tabs and linebreaks.)
To do so, simply attach the escape \*[TB+] to the end of
the input line in previous tab, like this:
.TAB 1
Some text\*[TB+] \" In tab 1
Some more text \" In tab 2, same baseline.
\*[TB+] works reliably regardless of the current
fill mode.
I find I often need rules drawn to the full measure of the current line
or tab length. The official way to do this is \l'\n[.lu]',
which is annoying to type, and doesn’t mean a whole heck of a lot if
you’re new to groff. The inline, \*[RULE], is a simple
replacement for \l'\n[.lu]'. Use it whenever you need
a rule drawn to the full measure of the current line or tab length, for
example:
.LL 6P
\*[RULE]
The above draws a rule the full measure of the 6-pica line length.
For another way to draw full measure rules, see the macro,
DRH.
\*[RULE] must appear on an input line by itself, and always causes a break when entered after a normal input line of text. It does not, however, deposit a break when used immediately after a macro.
The weight of the rule drawn with \*[RULE] is controlled with the macro RULE_WEIGHT. Mom’s default is 1/2 point.
Note:
\*[RULE] draws the rule to the full measure, hence it
cannot be used to fill the remainder of a partial line with a rule
in this way:
Signature__________________________________________
If you wish to accomplish this effect, you have to use
\*[RULE] in conjunction with the
PAD
macro and
string tabs.
(See the
example
provided with PAD.)
Please also note that the inline escapes \*[UP] and \*[DOWN] cannot be used in conjunction with \*[RULE].
This doesn’t work:
\*[DOWN 2p]\*[RULE]\*[UP 2p]
whereas this does:
.ALD 2p
\*[RULE]
.RLD 2p
See groff’s Horizontal line drawing function for more information on drawing horizontal rules.
• Must not have a
unit of measure
appended.
Argument must be greater than 0 and less than 100; decimal
fractions are allowed.
RULE_WEIGHT allows you to tell mom how heavy (in other words, how
“thick”) you want the rules drawn with the inline
escape,
\*[RULE].
It takes a single argument: the weight of the rule in
points
but without the
unit of measure
p attached. Thus, to set the weight of rules
drawn with \*[RULE] to 1-1/4 points, you'd do
.RULE_WEIGHT 1.25
RULE_WEIGHT also sets the weight of rules drawn with .DRH when DRH is not given any arguments.
Groff’s basic mechanism for inline font control is the escape
\f[<font>].
\f[R] Change to the medium roman font (equivalent to mom's \*[ROM])
\f[I] Change to the medium italic font (equivalent to mom's \*[IT])
\f[B] Change to the bold roman font (equivalent to mom's \*[BD])
\f[BI] Change to the bold italic font (equivalent to mom's \*[BDI])
\f[P] Revert to the previous font (equivalent to mom's \*[PREV])
\f[<font>] can be used with any valid font style registered with groff. (See here for a list of pre-registered font styles provided by mom).
\f[<font>] can also take a complete valid
family+font name combo. This is especially useful should you
need to change both family and font inline. For example, if your
prevailing family and font are Times Roman and you want a few words
in Courier Bold Italic, you could do this:
.FAM T
.FT R
The command \f[CBI]ls -l\f[P] gives a "long" directory listing.
The Unix command ls -l will appear in Courier Bold Italic
in a line that is otherwise in Times Roman.
Whenever you need to move forward or backward on a line, use the
inline
\h'<distance>'
In order to avoid unpleasant surprises, always append a
unit of measure
to <distance>. For example,
\h'1.25i'
moves you 1.25 inches to the right (forward) of the horizontal
position on the current
output line.
Note: \h'<distance>' is exactly equivalent to \*[FWD n<unit>].
To move backwards by the same amount, do
\h'-1.25i'
Note: \h'-<distance>' is exactly equivalent to \*[BCK n<unit>].
If you need to raise or lower type on a line (say, for sub- or
superscripts, or any other special effect), use
\v'<distance>'
In order to avoid unpleasant surprises, always append a
unit of measure
to <distance>. For example,
\v'.6m'
moves you (approx.) 2/3 of an
em
downward on the current
output line.
Note: \v'<distance>' is exactly equivalent to \*[DOWN n<unit>].
To move upward an equivalent amount, do
\v'-.6m'
Note: \v'<-distance>' is exactly equivalent to \*[UP n<unit>].
Important: The vertical motion of \v affects ONLY type on the current output line. When groff breaks the output line, the effect of \v is cancelled; the baseline of the next output line is where it would be if you hadn’t used \v.
Tip: When using \v for occasional effects in a line, don’t forget to reverse it when you've done what you want to do. Otherwise, the remaining type will be set too high (if you used \v with the minus sign) or too low (if you used \v without the minus sign).
In the context of mom, the string width inline
\w'<string>' primarily serves to let you establish the
horizontal measure of something (eg indents) based on the length
of a bit of text. For example, if you want a left indent the length
of the word “Examples:” plus a space, you can set it with
the \w inline escape:
.IL "\w'Examples: '"
Note: Whenever you pass \w'string' to a macro that normally requires a unit of measure, do NOT add a unit of measure to the \w'string' argument.
Furthermore, if the string is composed of several words separated by spaces, you MUST surround the whole escape with double quotes, as in the example above.
The \l'distance' inline allows you to draw a horizontal
rule of the specified distance. You must supply a
unit of measure.
Therefore, to set a 3-pica rule into a line of text, you'd do
A line of text with a superfluous \l'3P' 3-pica rule in it.
\l'3P', above, not only draws the rule, but advances 3
picas horizontally as well, just as you'd expect.
For an easy way of drawing rules to the full measure of the current line or tab length, see Full measure rules.
The weight (thickness) of rules varies according to the point size in effect when you invoke \l, but you can’t fix the weight with any real precision. A point size of 12 produces a tastefully moderate rule weight of between one-half and one point (depending on your printer).
Note:
Besides \l, groff provides a number of more
sophisticated “drawing” escapes. It is well beyond
the scope of this documentation to demonstrate their usage; see
info groff => Escape index => \D
for directions concerning their use. The drawing escapes can be a
bit unwieldy, so mom provides “user-friendly” macros for
the
graphical objects
most commonly enountered in typesetting: horizontal and vertical
rules, boxes, and circles (ellipses).
Additionally, groff comes with two “preprocessors” that
let you create ruled tables and vector diagrams (line drawings):
tbl and pic. The documentation for tbl can be
downloaded from
http://cm.bell-labs.com/cm/cs/doc/76/tbl.ps.gz
and pic from
http://www.kohala.com/start/troff/gpic.raymond.ps
Both are powerful tools, but they can be nasty to learn—at
first, anyway. You may prefer to use a vector drawing program
to create diagrams and tables; inserting the results into a
document is easy enough with
PDF_IMAGE
or
PSPIC.
Here follows a short list of commonly-used special characters available via inline escapes. If you’re not sure of the meaning of some of these characters, consult the Definitions of Terms.
For a complete list of special characters and glyphs (ie just about anything you'd ever want to appear on the printed page, including mathematical symbols, accented characters, unusual ligatures and letters unique to various European languages), consult man groff-char.
CHARACTER ESCAPE SEQUENCE --------- --------------- Comment line \# or .\" Fixed-width space \<space> (ie backslash followed by a space) Unbreakable space \~ Digit-width (figure) space \0 Zero-width character \& Discretionary hyphen \% Backslash \\ or \e Plus/minus (arithmetic) \[+-] Subtract (arithmetic) \[mi] Multiply (arithmetic) \[mu] Divide (arithmetic) \[di] Em-dash \[em] En-dash \[en] Left double-quote \[lq] Right double-quote \[rq] Open (left) single-quote \[oq] Close (right) single-quote \[oq] Bullet \[bu] Ballot box \[sq] One-quarter \[14] One-half \[12] Three-quarters \[34] Degree sign \[de] Dagger \[dg] Foot mark \[fm] Cent sign \[ct] Registered trademark \[rg] Copyright \[co] Section symbol \[se]Back to Table of Contents | Top | Next: Coloured text |