summaryrefslogtreecommitdiff
path: root/contrib/mom/momdoc/inlines.html
blob: 8a19d308c861b3e7b70056b7163790d52e7463b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>Mom -- Inline escapes</title>
</head>
<body bgcolor="#dfdfdf">

<!====================================================================>

<a href="docprocessing.html#TOP">Next</a>&nbsp;&nbsp;
<a href="goodies.html#TOP">Prev</a>&nbsp;&nbsp;
<a href="toc.html">Back to Table of Contents</a>

<a name="TOP"></a>
<h2>
    <a name="INLINE_ESCAPES"><u>Inline escapes</u></a>
</h2>

<a href="#INLINE_ESCAPES_INTRO">Introduction to inline escapes</a>
<br>
<a href="#INDEX_INLINES">Index of inline escapes</a>
<br>

<a name="INLINE_ESCAPES_INTRO">
	<h2><u>Introduction to inline escapes</u></h2>
</a>

<a name="INTRO_INLINE_ESCAPES">
Inline escapes, as described in the
<a href="definitions.html#TERMS_INLINES">groff terms</a>
section of this manual, are typesetting commands that appear in
text
<a href="definitions.html#TERMS_INPUTLINE">input lines</a>,
as opposed to macros and other
<a href="definitions.html#TERMS_CONTROLLINES">control lines</a>
that must appear on lines by themselves.
<p>
Aside from altering type parameters within a line, inlines also
tell groff about special characters -- em-dashes, bullets,
<a href="definitions.html#TERMS_FIGURESPACE">figure/digit-width spaces</a>,
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
<a href="intro.html#CANONICAL">canonical reference materials</a>
should you need more information than is contained herein.
<p>
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 <strong>\e</strong> to print a literal
backslash.)
<p>
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.
<p>
<strong>Mom</strong> 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
<a href="#INLINES_MOM">Mom's personal inlines</a>.
<p>
Despite <strong>mom</strong>'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
<a href="intro.html#CANONICAL">canonical reference materials</a>
pertaining to groff.
<p>
<strong>HELPFUL BIT OF INFORMATION:</strong> Inline escapes can be used
in
<a href="docprocessing.html#DOCPROCESSING">document processing macros</a>
that take
<a href="definitions.html#TERMS_STRINGARGUMENT">string arguments</a>.
<p>
<a name="INDEX_INLINES"><h3><u>Inlines index</u></h3></a>
<ul>
	<li><a name="INLINES_MOM"><strong>Mom's personal inlines</strong></a>
	<ul>
		<li><a href="#INLINE_FONTS_MOM">Changing fonts</a>
		<li><a href="#INLINE_SIZE_MOM">Changing point size</a>
		<li><a href="#INLINE_KERNING_MOM">Pairwise kerning</a>
		<li><a href="#INLINE_HORIZONTAL_MOM">Horizontal movement</a>
		<li><a href="#INLINE_VERTICAL_MOM">Vertical movement</a>
	</ul>
	<li><a name="INLINES_GROFF"><strong>Groff inline escapes</strong></a>
	<ul>
		<li><a href="#INLINE_FONTS_GROFF">Font control</a> <strong>\f</strong>
		<li><a href="#INLINE_HORIZONTAL_GROFF">Inline horizontal motions</a> <strong>\h</strong>
		<li><a href="#INLINE_VERTICAL_GROFF">Inline vertical motions</a> <strong>\v</strong>
		<li><a href="#INLINE_STRINGWIDTH_GROFF">String width function</a> <strong>\w</strong>
		<li><a href="#INLINE_LINEDRAWING_GROFF">Horizontal line drawing function</a> <strong>\l</strong>
		<li><a href="#INLINE_CHARACTERS_GROFF">Special characters</a>
	</ul>
</ul>
<hr>

<!---INLINE_FONTS_MOM--->

<h2><u>Mom's personal inlines</u></h2>

<a name="INLINE_FONTS_MOM"><h3><u>Changing fonts</u></h3></a>

<p>
<strong>Mom</strong> provides five inlines to change fonts
inline.
<p>
<table valign="baseline" summary="inlinefonts">
<tr><td width="15"><td><strong>\*[ROM]</strong><td>Change font to roman
<tr><td><td><strong>\*[IT]</strong><td>Change font to italic
<tr><td><td><strong>\*[BD]</strong><td>Change font to bold 
<tr><td><td><strong>\*[BDI]</strong><td>Change font to bold italic
<tr><td><td><strong>\*[PREV]</strong><td>Revert to previous font</td></tr>
</table>
<p>
See also
<a href="#INLINE_FONTS_GROFF">font control with \f</a>
for other ways to change fonts inline.

<p>
<strong>NOTE:</strong> If you're using the
<a href="docprocessing.html#DOCPROCESSING">document processing macros</a>,
inline font changes remain in effect only for the duration of the
current macro.
<br>

<!---INLINE_SIZE_MOM--->

<hr width="66%" align="left">
<a name="INLINE_SIZE_MOM"><h3><u>Changing point size</u></h3></a>

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

where &quot;size&quot; is the new size you want.  For example, to
change the point size inline to 12 points, you'd enter
<p>
<pre>
	\*S[12]
</pre>

Notice that the new size does not require a
<a href="definitions.html#TERMS_UNITOFMEASURE">unit of measure</a>;
<a href="definitions.html#TERMS_PICASPOINTS">points</a>
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.
<p>
The size given to <strong>\*S</strong> may be expressed in plus
or minus terms, which can be very useful.  In the following
example, the word &quot;mom&quot; will be output 2 points larger
than the point size of the rest of the line.
<p>
<pre>
	While she isn't perfect, \*S[+2]mom\*S[-2] isn't half bad.
</pre>

<strong>NOTE:</strong> If you're accustomed to groff's usual way
of handling inline size requests (<kbd>\sN, \s±N, \s(NN, \s±(NN,
\s[NNN], \s±[NNN]</kbd>), feel free to continue with your old habits.
<strong>Mom</strong> doesn't care.
<br>

<!---INLINE_KERNING_MOM--->

<hr width="66%" align="left">
<a name="INLINE_KERNING_MOM"><h3><u>Pairwise kerning</u></h3></a>

<p>
Pairwise kerning means moving specific letter pairs closer
together or further apart (see
<a href="definitions.html#TERMS_KERN">Typesetting terms, kerning</a>
for more details).  <strong>Mom</strong> permits inline pairwise
kerning through the use of the inline escapes
<p>
<table valign="baseline" summary="inlinekerning">
<tr><td width="15"><td><strong>\*[BU1]...\*[BU36]</strong><td>
Move back 1...36
<a href="definitions.html#TERMS_KERNUNITS">kern units</a>
<tr><td><td><strong>\*[FU1]...\*[FU36]</strong><td>
Move forward 1...36
<a href="definitions.html#TERMS_KERNUNITS">kern units</a></td></tr>
</table>
<p>
For example,
<p>
<pre>
	THE HUMAN COST OF COMMODIFYING FRESH W\*[BU4]ATER
</pre>

moves the letter A in &quot;WATER&quot; four kern units closer
to the letter W.
<p>
<strong>NOTE:</strong> Using <strong>BU</strong> or <strong>FU</strong>
between characters pairs that are already automatically kerned
disables the automatic kerning and uses the value you give to
<strong>BU</strong> or <strong>FU</strong> instead.
<br>

<!---INLINE_HORIZONTAL_MOM--->

<hr width="66%" align="left">
<a name="INLINE_HORIZONTAL_MOM"><h3><u>Horizontal inline movement</u></h3></a>

<p>
If you need to move backward or forward on a line by a just few
points, use
<p>
<table valign="baseline" summary="inlinehorizontal">
<tr><td width="15"><td><strong>\*[BP1]...\*[BP12]</strong><td>
Move back 1...12 points
<tr><td><td><strong>\*[FP1]...\*[FP12]</strong><td>
Move forward 1...12 points</td></tr>
</table>
<p>
For example,
<p>
<pre>
	1.\*[FP12]The Free Trade Play-Offs: WalMart 100, Mexico 0
</pre>

puts 12 points of space between &quot;1.&quot; and
&quot;The&quot;.
<p>
Both <strong>\*[FP]</strong> and <strong>\*[BP]</strong> accept
quarter points as well.  Hence it's possible to do, for example,
<strong>\*[FP.5]</strong> or <strong>\*[BP1.25]</strong> or
<strong>\*[ALD3.75]</strong>.
<p>
<strong>NOTE:</strong> If you need to move forward or backward by
more than 12.75 points, or wish to use a
<a href="definitions.html#TERMS_UNITOFMEASURE">unit of measure</a>
other than points, use the groff inline
<a href="#INLINE_HORIZONTAL_GROFF">\h</a>.
<br>

<!---INLINE_VERTICAL_MOM--->

<hr width="66%" align="left">
<a name="INLINE_VERTICAL_MOM"><h3><u>Vertical inline movement</u></h3></a>

<p>
If you need to move up or down in a line by a just few
points, use
<p>
<table valign="baseline" summary="inlinevertical">
<tr><td width="15"><td><strong>\*[ALD1]...\*[ALD12]</strong><td>
Advance lead 1...12 points (move downward)
<tr><td><td><strong>\*[RLD1]...\*[RLD12]</strong><td>
Reverse lead 1...12 points (move upward)</td></tr>
</table>
<p>
For example,
<p>
<pre>
	Tel: 905\*[RLD1]-\*[ALD1]4072
</pre>

moves the hyphen in the telephone number up by 1 point, then
moves back down by the same amount.
<p>
Both <strong>\*[ALD]</strong> and <strong>\*[RLD]</strong> accept
quarter points as well.  Hence it's possible to do, for example,
<strong>\*[RLD3.25]</strong> or <strong>\*[ALD1.5]</strong> or
<strong>\*[ALD4.75]</strong>.
<p>
<strong>NOTE:</strong> If you need to move up or down by
more than 12.75 points, or wish to use a
<a href="definitions.html#TERMS_UNITOFMEASURE">unit of measure</a>
other than points, use the groff inline
<a href="#INLINE_VERTICAL_GROFF">\v</a>.
<br>
<hr>

<!---INLINE_FONT_GROFF--->

<h2><u>Groff inline escapes</u></h2>

<a name="INLINE_FONTS_GROFF"><h3><u>Font control with \f</u></h3></a>

<p>
Groff's basic mechanism for inline font control is the escape
<strong>\f</strong>. 
<p>
<table valign="baseline" summary="inlinefontsgroff">
<tr><td width="15"><td><strong>\fR</strong><td>Change font to roman
<tr><td><td><strong>\fI</strong><td>Change font to italic
<tr><td><td><strong>\fB</strong><td>Change font to bold 
<tr><td><td><strong>\f(BI</strong><td>Change font to bold italic
<tr><td><td><strong>\fP</strong><td>Revert to previous font</td></tr>
</table>
<p>
A special instance of <strong>\f</strong> is
<strong>\f[font]</strong>, where &quot;font&quot; 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:
<p>
<pre>
	.FAM T
	.FT  R
	The command \f[CBI]ls -l\fP gives a &quot;long&quot; directory listing.
</pre>

The Unix command &quot;ls -l&quot; will appear in Courier Bold Italic
in a line that is otherwise in Times Roman.
<br>

<!---INLINE_HORIZONTAL_GROFF--->

<hr width="66%" align="left">
<a name="INLINE_HORIZONTAL_GROFF"><h3><u>Inline horizontal motions with \h</u></h3></a>

<p>
Whenever you need to move forward or backward on a line, use the inline
<strong>\h'distance'</strong>.  In order to avoid unpleasant surprises,
always append a
<a href="definitions.html#TERMS_UNITOFMEASURE">unit of measure</a>
to &quot;distance&quot;.
<p>
<pre>
	\h'1.25i'
</pre>

moves you 1.25 inches to the right (forwards) of the horizontal
position on the current
<a href="definitions.html#TERMS_OUTPUTLINE">output line</a>.
<p>
<pre>
	\h'-1.25i'
</pre>

moves you 1.25 inches to the left (backwards).
<br>

<!---INLINE_VERTICAL_GROFF--->

<hr width="66%" align="left">
<a name="INLINE_VERTICAL_GROFF"><h3><u>Inline vertical motions with \v</u></h3></a>

<p>
If you need to raise or lower type on a line (say, for sub- or
superscripts, or any other special effect), use
<strong>\v'distance'</strong>.  In order to avoid unpleasant
surprises, always append a
<a href="definitions.html#TERMS_UNITOFMEASURE">unit of measure</a>
to &quot;distance&quot;.
<p>
<pre>
	\v'.6m'
</pre>

moves you (approx.) 2/3 of an
<a href="definitions.html#TERMS_EM">em</a>
downward on the current
<a href="definitions.html#TERMS_OUTPUTLINE">output line</a>.
<p>
<pre>
	\v'-.6m'
</pre>

moves you (approx.) 2/3 of an em upward.
<p>
<strong>IMPORTANT:</strong> The vertical motion of <strong>\v</strong>
affects ONLY type on the current
<a href="definitions.html#TERMS_OUTPUTLINE">output line</a>.
When groff breaks the output line, the effect of
<strong>\v</strong> is cancelled; the baseline of the next output line
is where it would be if you hadn't used <strong>\v</strong>.
<p>
<strong>TIP:</strong> When using <strong>\v</strong> 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 <strong>\v</strong> with the
minus sign) or too low (if you used <strong>\v</strong> without
the minus sign).
<br>

<!---INLINE_STRINGWIDTHL_GROFF--->

<hr width="66%" align="left">
<a name="INLINE_STRINGWIDTH_GROFF"><h3><u>String width function \w</u></h3></a>

<p>
In the context of <strong>mom</strong>, the string width inline
<strong>\w'string'</strong> 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 &quot;Examples:&quot; plus a
space, you can set it with the <strong>\w</strong> inline escape:
<p>
<pre>
	.IL "\w'Examples: '"
</pre>

<strong>NOTE:</strong> Whenever you pass <strong>\w'string'</strong>
to a macro that normally requires a
<a href="definitions.html#TERMS_UNITOFMEASURE">unit of measure</a>,
<em>do <strong>NOT</strong> add a unit of measure to the \w'string'
argument.</em>
<p>
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.
<br>

<!---INLINE_LINEDRAWING_GROFF--->

<hr width="66%" align="left">
<a name="INLINE_LINEDRAWING_GROFF"><h3><u>Horizontal line drawing function \l</u></h3></a>

<p>
The <strong>\l'distance'</strong> inline allows you to draw a
horizontal rule of the specified distance.  You must supply a
<a href="definitions.html#TERMS_UNITOFMEASURE">unit of measure</a>.
Therefore, to set a 3-pica rule into a line of text, you'd do
<p>
<pre>
	A line of text with a superfluous \l'3P' 3-pica rule in it.
</pre>

<strong>\l'3P'</strong> above not only draws the rule, but
advances 3 picas horizontally as well, just as you'd expect.
<p>
The weight (thickness) of rules varies according to the point size
in effect when you invoke <strong>\l</strong>, 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
<strong>mom</strong> for all macros and routines that create rules.
<p>
<strong>NOTE:</strong> There are, in addition to <strong>\l</strong>,
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.
<p>
Groff comes with a number of &quot;preprocessors&quot; 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 &quot;right tool for
the job,&quot; 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 <strong>.PSPIC</strong> (consult the <strong>grops</strong>
man page for information on this indispensible and easy-to-use macro).
<br>

<!---INLINE_CHARACTERS_GROFF--->

<hr width="66%" align="left">
<a name="INLINE_CHARACTERS_GROFF"><h3><u>Special characters and symbols</u></h3></a>

<p>
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
<a href="definitions.html#TERMS">Definitions of Terms</a>.
For a more complete list, consult the section <em>Special
Character Names</em> at the end of the <em>Tutorial Examples</em>
in <strong>cstr54</strong>, available
<a href="http://www.kohala.com/start/troff/">here</a>.

<p>
<pre>
    CHARACTER                   ESCAPE SEQUENCE
    ---------                   ---------------

    Comment line                \#
    Fixed-width space           \&lt;space&gt;  i.e. backslash followed by a space
    Unbreakable space           \~
    Digit-width (figure) space  \0
    Zero-width character        \&amp;
    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
</pre>

<hr>
<a href="docprocessing.html#TOP">Next</a>&nbsp;&nbsp;
<a href="goodies.html#TOP">Prev</a>&nbsp;&nbsp;
<a href="#TOP">Top</a>&nbsp;&nbsp;
<a href="toc.html">Back to Table of Contents</a>
</body>
</html>