Next   Prev   Back to Table of Contents

Inline escapes

Introduction to inline escapes
Index of inline escapes

Introduction to inline escapes

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.)

Groff has a number of ways of recognising 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 recognises 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 inlines.

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.

Inlines index


Mom's personal inlines

Changing fonts

Mom provides five inlines to change fonts inline.

\*[ROM]Change font to roman
\*[IT]Change font to italic
\*[BD]Change font to bold
\*[BDI]Change font to bold italic
\*[PREV]Revert to previous font

See also font control with \f for other ways to change fonts inline.

NOTE: If you're using the document processing macros, inline font changes remain in effect only for the duration of the current macro.


Changing point size

Mom's inline escape for changing point size, sadly, does not observe her normal inline syntax \*[whatever]. It's the only exception, and there's no way around it. The escape for changing point size looks like this:

	\*S[size]
where "size" is the new size you want. For example, to change the point size inline to 12 points, you'd enter

	\*S[12]
Notice that 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 \*S may be expressed in plus or minus terms, which can be very useful. In the following example, 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.
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.

Pairwise kerning

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

\*[BU1]...\*[BU36] Move back 1...36 kern units
\*[FU1]...\*[FU36] Move forward 1...36 kern units

For example,

	THE HUMAN COST OF COMMODIFYING FRESH W\*[BU4]ATER
moves the letter A in "WATER" four kern units closer to the letter W.

NOTE: Using BU or FU between characters pairs that are already automatically kerned disables the automatic kerning and uses the value you give to BU or FU instead.


Horizontal inline movement

If you need to move backward or forward on a line by a just few points, use

\*[BP1]...\*[BP12] Move back 1...12 points
\*[FP1]...\*[FP12] Move forward 1...12 points

For example,

	1.\*[FP12]The Free Trade Play-Offs: WalMart 100, Mexico 0
puts 12 points of space between "1." and "The".

Both \*[FP] and \*[BP] accept quarter points as well. Hence it's possible to do, for example, \*[FP.5] or \*[BP1.25] or \*[ALD3.75].

NOTE: If you need to move forward or backward by more than 12.75 points, or wish to use a unit of measure other than points, use the groff inline \h.


Vertical inline movement

If you need to move up or down in a line by a just few points, use

\*[ALD1]...\*[ALD12] Advance lead 1...12 points (move downward)
\*[RLD1]...\*[RLD12] Reverse lead 1...12 points (move upward)

For example,

	Tel: 905\*[RLD1]-\*[ALD1]4072
moves the hyphen in the telephone number up by 1 point, then moves back down by the same amount.

Both \*[ALD] and \*[RLD] accept quarter points as well. Hence it's possible to do, for example, \*[RLD3.25] or \*[ALD1.5] or \*[ALD4.75].

NOTE: If you need to move up or down by more than 12.75 points, or wish to use a unit of measure other than points, use the groff inline \v.


Full measure rules

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.

See groff's Horizontal line drawing function for more information on drawing horizontal rules.


Groff inline escapes

Font control with \f

Groff's basic mechanism for inline font control is the escape \f.

\fRChange font to roman
\fIChange font to italic
\fBChange font to bold
\f(BIChange font to bold italic
\fPRevert to previous font

A special instance of \f is \f[font], where "font" can be a complete legal 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\fP 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.

Inline horizontal motions with \h

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".

	\h'1.25i'
moves you 1.25 inches to the right (forwards) of the horizontal position on the current output line.

	\h'-1.25i'
moves you 1.25 inches to the left (backwards).

Inline vertical motions with \v

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".

	\v'.6m'
moves you (approx.) 2/3 of an em downward on the current output line.

	\v'-.6m'
moves you (approx.) 2/3 of an em upward.

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 on 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).


String width function \w

In the context of mom, the string width inline \w'string' primarily serves to let you establish the horizontal measure of something (e.g. 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.


Horizontal line drawing function \l

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), and is the point size used by mom for all macros and routines that create rules.

NOTE: There are, in addition to \l, a number of other line-drawing escapes, but frankly, using them for typographically precise drawing is a bit like hammering in a nail with a screwdriver -- doable, but not recommended.

Groff comes with a number of "preprocessors" designed to ease creating rules, boxes, splines, and so on (tbl, pic, and friends), but I tend not to use them. A firm believer in the "right tool for the job," I prefer a vector drawing program (in my case, tgif) when I need to combine type with graphic elements (say, a complex ruled form). Inserting the results into a document is easy enough with .PSPIC (consult the grops man page for information on this indispensible and easy-to-use macro).


Special characters and symbols

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 more complete list, consult the section Special Character Names at the end of the Tutorial Examples in cstr54, available here.

    CHARACTER                   ESCAPE SEQUENCE
    ---------                   ---------------

    Comment line                \#
    Fixed-width space           \<space>  i.e. 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
    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

Next   Prev   Top   Back to Table of Contents