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 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 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
  - Changing point size
  - Pairwise kerning
  - Horizontal movement
  - Vertical movement
  - Terminate a line without advancing on the page
  - Call the next sequential tab without advancing on the page
  - Full measure rules
- Groff inline escapes
  - Font control \f
  - Inline horizontal motions \h
  - Inline vertical motions \v
  - String width function \w
  - Horizontal line drawing function \l
  - Special characters

## Mom's personal inlines

### Changing fonts

Mom provides five escapes for changing fonts inline:

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

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.

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

### Changing point size

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]

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.

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

    \*[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" 1 kern unit away from the letter F, and the letter A in "WATER" 4 kern units closer to the letter W. Additionally, the letter T in "WATER" is moved 5 kern units closer to the letter A.

For backward compatibility, the forms

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

also exist (i.e. with no space before the number of kern units desired, up to a limit of 36).

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

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

    \*[FWD n<unit>]
| Move forward inline the specified number of units of measure; decimal fractions are allowed.
    \*[BCK n<unit>]
| Move backward 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 back .25...12.75 points
    \*[FP.25]...\*[FP12.75]
| Move forward .25...12.75 points

also exist (i.e. 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.

### Vertical inline movement

If you need to move portions of type up or down on a line, mom provides the following inline escapes:

    \*[UP n<unit>]
| Move up inline the specified number of units of measure
    \*[DOWN n<unit>]
| Move down 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 with the inline escape, \*[RULE]. See here for details.

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 .5...12.75 points (move upward)

Both \*[ALD] and \*[RLD] work in points, hence you mustn't use a unit of measure.

### Terminate a line without advancing on the page

Sometimes, you want mom to break a line but not advance on the page. See here for an example of when you might want to do this.

In versions of mom prior to 1.2-f, this was accomplished through the use of EL. As of 1.2-f, you can, if you prefer, accomplish the same thing by using the inline escape, \*[B]. Simply attach the escape to the end of any 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.

### Call the next sequential tab without advancing on the page

Sometimes, you want mom to move to the next tab in sequence (e.g. from TAB 1 to TAB 2, or TAB 8 to TAB 9) without mom advancing on the page. (See the example in here if you're not clear how mom manages tabs and linebreaks.)

In versions of mom prior to 1.2-f, this was accomplished through the use of TN. As of 1.2-f, you can, if you prefer, accomplish the same thing by using the inline escape, \*[TB+]. Simply attach the escape to the end of any line in a tab, like this:

    	.TAB 1
    	Some text\*[TB+]    \" This line is in tab 1
    	Some more text      \" This line is in tab 2, on the same baseline as tab 1

\*[TB+] works reliably regardless of the current fill mode.

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

\*[RULE] should appear on a line by itself. In fill modes, (i.e. QUAD or JUSTIFY), it requires a .BR on the line immediately before it; otherwise, the rule will be drawn on the same baseline occupied by any type preceding it. In nofill modes (i.e LEFT, RIGHT or CENTER), the .BR is not required.

Please note that \*[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]

This does:

    	.ALD 2p
    	\*[RULE]
    	.RLD 2p

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[<font>].

\f[R] | Change font to medium roman (equivalent to mom's \*[ROM])
\f[I] | Change font to medium italic (equivalent to mom's \*[IT])
\f[B] | Change font to bold roman (equivalent to mom's \*[BD])
\f[BI] | Change font to bold italic (equivalent to mom's \*[BDI])
\f[P] | Revert to previous font (equivalent to mom's \*[PREV])

\f[<font>] can be used with any legal 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 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\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.

### 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'<distance>' is exactly equivalent to \*[FWD n<unit>].

    	\h'-1.25i'

moves you 1.25 inches to the left (backwards). \h'-<distance>' is exactly equivalent to \*[BCK n<unit>].

### 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'<distance>' is exactly equivalent to \*[DOWN n<unit>].

    	\v'-.6m'

moves you (approx.) 2/3 of an em upward. \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 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 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 groff_tmac man page for information on this indispensable 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 complete list of special characters and glyphs (i.e. 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                \#
        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