new copyright; att/bsd/shared
[unix-history] / usr / src / old / roff / USD.doc / troff / m3
CommitLineData
ff262511
KB
1.\" %sccs.include.proprietary.roff%
2.\"
3.\" @(#)m3 6.3 (Berkeley) %G%
c8ab9d78
KM
4.\"
5.tr |
6.rm mx
7.mh
8Tabs, Leaders, and Fields
9.sc
10Tabs and leaders.
11The \s-1ASCII\s+1 horizontal tab character and the \s-1ASCII\s+1
12\s-1SOH\s+1 (hereafter known as the \fIleader\fR character)
13can both be used to generate either horizontal motion or
14a string of repeated characters.
15The length of the generated entity is governed
16by internal \fItab stops\fR specifiable
17with \fBta\fR.
18The default difference is that tabs generate motion and leaders generate
19a string of periods;
20\fBtc\fR and \fBlc\fR
21offer the choice of repeated character or motion.
22There are three types of internal tab stops\(em\
23\fIleft\fR adjusting, \fIright\fR adjusting,
24and \fIcentering\fR.
25In the following table:
26\fID\fR is the distance from the current position on the \fIinput\fR line
27(where a tab or leader was found)
28to the next tab stop;
29\fInext-string\fR consists
30of the input characters following the tab (or leader) up to the next tab (or leader) or end of line;
31and
32\fIW\fR is the width of \fInext-string\fR.
33.TS
34center box;
35c2|c2|c
36c2|c2|c
37c2|c2|l.
38Tab Length of motion or Location of
39type repeated characters \fInext-string\fR
40_
41Left \fID\fR Following \fID\fR
42Right \fID\-W\fR Right adjusted within \fID\fR
43Centered \fID\-W\(sl\fR2 Centered on right end of \fID\fR
44.TE
45The length of generated motion is allowed to be negative, but
46that of a repeated character string cannot be.
47Repeated character strings contain an integer number of characters, and
48any residual distance is prepended as motion.
49Tabs or leaders found after the last tab stop are ignored, but may be used
50as \fInext-string\fR terminators.
51.pg
52Tabs and leaders are not interpreted in \fIcopy mode\fR.
53\fB\et\fR and \fB\ea\fR always generate a non-interpreted
54tab and leader respectively, and
55are equivalent to actual tabs and leaders in \fIcopy mode\fR.
56.sc
57Fields.
58A \fIfield\fR is contained between
59a \fIpair\fR of \fIfield delimiter\fR characters,
60and consists of sub-strings
61separated by \fIpadding\fR indicator characters.
62The field length is the distance on the
63\fIinput\fR line from the position where the field begins to the next tab stop.
64The difference between the total length of all the sub-strings
65and the field length is incorporated as horizontal
66padding space that is divided among the indicated
67padding places.
68The incorporated padding is allowed to be negative.
69For example,
70if the field delimiter is \fB#\fR and the padding indicator is \fB^\fR,
71\fB#^\fIxxx\fB^\fIright\|\fB#\fR
72specifies a right-adjusted string with the string \fIxxx\fR centered
73in the remaining space.
74.h1
75.bt
b91dffe8 76\fB&ta\fI|Nt|...\fR 8n;|0.5in none E,\fBm\fR \
c8ab9d78
KM
77Set tab stops and types.
78\fIt=\fBR\fR, right adjusting;
79\fIt=\fBC\fR, centering;
80\fIt\fR absent, left adjusting.
81\*(TR tab stops are preset every 0.5in.;
b91dffe8 82\*(NR every 8 character widths.
c8ab9d78
KM
83The stop values are separated by spaces, and
84a value preceded by \fB+\fR
85is treated as an increment to the previous stop value.
86.bt
87\fB&tc\fI|c\fR none none E \
88The tab repetition character becomes \fIc\fR,
89or is removed specifying motion.
90.bt
91\fB&lc\fI|c\fR \fB.\fR none E \
92The leader repetition character becomes \fIc\fR,
93or is removed specifying motion.
94.bt
95\fB&fc\fI|a|b\fR off off - \
96The field delimiter is set to \fIa\fR;
97the padding indicator is set to the \fIspace\fR character or to
98\fIb\fR, if given.
99In the absence of arguments the field mechanism is turned off.
100.mh
101Input and Output Conventions and Character Translations
102.sc
103Input character translations.
104Ways of inputting the graphic character set were
105discussed in \(sc2.1.
106The \s-1ASCII\s+1 control characters horizontal tab (\(sc9.1),
107\s-1SOH\s+1 (\(sc9.1), and backspace (\(sc10.3) are discussed elsewhere.
108The newline delimits input lines.
109In addition,
110\s-1STX\s+1, \s-1ETX\s+1, \s-1ENQ\s+1, \s-1ACK\s+1, and \s-1BEL\s+1
111are accepted,
112and may be used as delimiters or translated into a graphic with \fBtr\fR (\(sc10.5).
113\fIAll\fR others are ignored.
114.pg
115The \fIescape\fR character \fB\e\fR
116introduces \fIescape sequences\fR\(em\
117causes the following character to mean
118another character, or to indicate
119some function.
120A complete list of such sequences is given in the Summary and Index on page 6.
121\fB\e\fR
122should not be confused with the \s-1ASCII\s+1 control character \s-1ESC\s+1 of the
123same name.
124The escape character \fB\e\fR can be input with the sequence \fB\e\e\fR.
125The escape character can be changed with \fBec\fR,
126and all that has been said about the default \fB\e\fR becomes true
127for the new escape character.
128\fB\ee\fR can be used to print whatever the current escape character is.
129If necessary or convenient, the escape mechanism may be turned off with \fBeo\fR,
130and restored with \fBec\fR.
131.h1
132.bt
133\fB&ec\fI|c\fR \fB\e\fR \fB\e\fR - \
134Set escape character to \fB\e\fR, or to \fIc\fR, if given.
135.bt
136\fB&eo\fR on - - Turn escape mechanism off.
137.sc
138Ligatures.
139.lg0
140Five ligatures are available
141in the current \*(TR character set \(em
142\fB\(fi\fR, \fB\(fl\fR, \fB\(ff\fR, \fB\(Fi\fR, and \fB\(Fl\fR.
143They may be input (even in \*(NR) by
144\fB\e(fi\fR, \fB\e(fl\fR, \fB\e(ff\fR, \fB\e(Fi\fR, and \fB\e(Fl\fR respectively.
145.lg
146The ligature mode is normally on in \*(TR, and \fIautomatically\fR invokes
147ligatures during input.
148.h1
149.bt
150\fB&lg\fI|N\fR off;|on on - Ligature mode
151is turned on if \fIN\fR is absent or non-zero,
152and turned off if \fIN\(eq\^\fR0.
153If \fIN\fR\(eq\^2, only the two-character ligatures are automatically invoked.
154Ligature mode is inhibited for
155request, macro, string, register, or file names,
156and in \fIcopy mode\fR.
157No effect in \*(NR.
158.sc
159Backspacing, underlining, overstriking, etc.
160Unless in \fIcopy mode\fR, the \s-1ASCII\s+1 backspace character is replaced
161by a backward horizontal motion having the width of the
162space character.
163Underlining as a form of line-drawing is discussed in \(sc12.4.
164A generalized overstriking function is described in \(sc12.1.
165.pg
166\*(NR automatically underlines
167characters in the \fIunderline\fR font,
168specifiable with \fBuf\fR,
b91dffe8 169normally Times Italic on font position 2 (see \(sc2.2).
c8ab9d78
KM
170In addition to \fBft\fR and \fB\ef\fIF\fR,
171the underline font may be selected by \fBul\fR and \fBcu\fR.
172Underlining is restricted to an output-device-dependent
173subset of \fIreasonable\fR characters.
174.h1
175.bt
176\fB&ul\fI|N\fR off \fIN\(eq\fR1 E \
177Underline in \*(NR (italicize in \*(TR) the next \fIN\fR
178input text lines.
179Actually, switch to \fIunderline\fR font, saving the
180current font for later restoration;
181\fIother\fR font changes within the span of a \fBul\fR
182will take effect,
183but the restoration will undo the last change.
184Output generated by \fBtl\fR (\(sc14) \fIis\fR affected by the
185font change, but does \fInot\fR decrement \fIN\fR.
186If \fIN\fR\^>\^1, there is the risk that
187a trap interpolated macro may provide text
188lines within the span;
189environment switching can prevent this.
190.bt
191\fB&cu\fI|N\fR off \fIN\(eq\fR1 E \
192A variant of \fBul\fR that causes \fIevery\fR character to be underlined in \*(NR.
193Identical to \fBul\fR in \*(TR.
194.bt
195\fB&uf\fI|F\fR Italic Italic - \
196Underline font set to \fIF\fR.
197In \*(NR,
198\fIF\fR may \fInot\fR be on position 1 (initially Times Roman).
199.sc
200Control characters.
201Both the control character \fB.\fR and the \fIno-break\fR
202control character \fB\'\fR may be changed, if desired.
203Such a change must be compatible with the design
204of any macros used in the span of the change,
205and
206particularly of any trap-invoked macros.
207.h1
208.bt
209\fB&cc\fI|c\fR \fB.\fR \fB.\fR E \
210The basic control character is set to \fIc\fR,
211or reset to "\fB.\fR".
212.bt
213\fB&c2\fI|c\fR \fB\' \'\fR E The \fInobreak\fR control character is set
214to \fIc\fR, or reset to "\fB\'\fR".
215.sc
216Output translation.
217One character can be made a stand-in for another character using \fBtr\fR.
218All text processing (e. g. character comparisons) takes place
219with the input (stand-in) character which appears to have the width of the final
220character.
221The graphic translation occurs at the moment of output
222(including diversion).
223.h1
224.bt
225\fB&tr\fI|abcd....\fR none - O Translate \
226\fIa\fR into \fIb\fR, \fIc\fR into \fId\fR, etc.
227If an odd number of characters is given,
228the last one will be mapped into the space character.
229To be consistent, a particular translation
230must stay in effect from \fIinput\fR to \fIoutput\fR time.
231.sc
232Transparent throughput.
233An input line beginning with a \fB\e!\fR is read in \fIcopy mode\fR and \fItransparently\fR output
234(without the initial \fB\e!\fR);
235the text processor is otherwise unaware of the line's presence.
236This mechanism may be used to pass control information to a post-processor
237or to imbed control lines in a macro created by a diversion.
238.sc
239Comments and concealed newlines.
240An uncomfortably long input line that must stay
241one line (e. g. a string definition, or nofilled text)
242can be split into many physical lines by ending all but
243the last one with the escape \fB\e\fR.
244The sequence \fB\e\fR(newline) is \fIalways\fR ignored\(em\
245except in a comment.
246Comments may be imbedded at the \fIend\fR of any line by
247prefacing them with \fB\e"\fR.
248The newline at the end of a comment cannot be concealed.
249A line beginning with \fB\e"\fR will appear as a blank line and
250behave like \fB.sp|1\fR;
251a comment can be on a line by itself by beginning the line with \fB.\e"\fR.
252.mh
253Local Horizontal and Vertical Motions, and the Width Function
254.sc
255Local Motions.
256The functions \fB\ev\'\fIN\fB\|\'\fR and
257\fB\eh\'\fIN\fB\|\'\fR
258can be used for \fIlocal\fR vertical and horizontal motion respectively.
259The distance \fIN\fR may be negative; the \fIpositive\fR directions
260are \fIrightward\fR and \fIdownward\fR.
261A \fIlocal\fR motion is one contained \fIwithin\fR a line.
262To avoid unexpected vertical dislocations, it is necessary that
263the \fInet\fR vertical local motion within a word in filled text
264and otherwise within a line balance to zero.
265The above and certain other escape sequences providing local motion are
266summarized in the following table.
267.tr ||
268.ds X \0\0\0
269.TS
270center box;
271c2|cs2||c2|cs2
272c1|c2c2||c2|c2c2.
273Vertical Effect in Horizontal Effect in
274Local Motion \*(TR \*(NR Local Motion \*(TR \*(NR
275_
276.sp.4
277.TC
278l2|ls2||l2|ls2.
279\fB\*X\ev\'\fIN\|\^\fB\'\fR Move distance \fIN\fR \
280\fB\*X\eh\'\fIN\|\^\fB\'\fR Move distance \fIN\fR
281.TC
282_2|_2_2||l2|ls2.
c461bb7b 283 \fB\*X\e\fR(space) Unpaddable space-size space
c8ab9d78
KM
284.TC
285l2|l2|l2||l2|ls2.
286\fB\*X\eu\fR \(12 em up \(12 line up \fB\*X\e0\fR Digit-size space
287.TC
288l2|l2|l2||_2|_2_2.
c461bb7b 289\fB\*X\ed\fR \(12 em down \(12 line down
c8ab9d78
KM
290.TC
291l2|l2|l2||l2|l2|l2.
292\fB\*X\er\fR 1 em up 1 line up \fB\*X\e\||\fR 1\(sl6 em space ignored
293 \fB\*X\e^\fR 1\(sl12 em space ignored
294.sp.4
295.TE
296.rm X
297.tr |
298As an example,
299\fBE\s-2\v'-.4m'2\v'.4m'\s+2\fR
300could be generated by the sequence
301\fBE\es\-2\ev\'\-0.4m\'2\ev\'0.4m\'\es+2\fR;
302it should be noted in this example that
303the 0.4|em vertical motions are at the smaller size.
304.sc
305Width Function.
306The \fIwidth\fR function \fB\ew\'\fIstring\fB\|\'\fR
307generates the numerical width of \fIstring\fR (in basic units).
308Size and font changes may be safely imbedded in \fIstring\fR,
309and will not affect the current environment.
310For example,
311\&\fB.ti|\-\\w\'1.|\'u\fR could be used to
312temporarily indent leftward a distance equal to the
313size of the string "\fB1.|\fR".
314.pg
315The width function also sets three number registers.
316The registers \fBst\fR and \fBsb\fR are set respectively to the highest and
317lowest extent of \fIstring\fR relative to the baseline;
318then, for example,
319the total \fIheight\fR of the string is \fB\en(stu\-\en(sbu\fR.
320In \*(TR the number register \fBct\fR is set to a value
321between 0|and|3:
3220 means that all of the characters in \fIstring\fR were short lower
323case characters without descenders (like \fBe\fR);
3241 means that at least one character has a descender (like \fBy\fR);
3252 means that at least one character is tall (like \fBH\fR);
326and 3 means that both tall characters and characters with
327descenders are present.
328.sc
329Mark horizontal place.
330The escape sequence \fB\ek\fIx\fR will cause the \fIcurrent\fR horizontal
331position in the \fIinput line\fR to be stored in register \fIx\fR.
332As an example,
333the construction \fB\ekx\fIword\|\fB\eh\'\|~\|\enxu+2u\'\fIword\fB\fR
334will embolden \fIword\fR by backing up to almost its beginning and overprinting it,
335resulting in \kz\fIword\fR\h'|\nzu+2u'\fIword\fR.
336.mh
337Overstrike, Bracket, Line-drawing, and Zero-width Functions
338.sc
339Overstriking.
340Automatically centered overstriking of up to nine characters
341is provided by the \fIoverstrike\fR function
342\fB\eo\'\fIstring\fB\|\'\fR.
b91dffe8 343The characters in \fIstring\fR are overprinted with centers aligned; the total width
c8ab9d78
KM
344is that of the widest character.
345\fIstring\fR should \fInot\fR contain local vertical motion.
346As examples,
347\fB\eo\'e\e\'\'\fR produces \fB\o'e\''\fR, and
348\fB\eo\'\e(mo\e(sl\'\fR produces \fB\o'\(mo\(sl'\fR.
349.sc
350Zero-width characters.
351The function \fB\ez\fIc\fR will output \fIc\fR without spacing over
352it, and can be used to produce left-aligned overstruck
353combinations.
354As examples,
355\fB\ez\e(ci\e(pl\fR will produce \fB\z\(ci\(pl\fR, and
356\fB\e(br\ez\e(rn\e(ul\e(br\fR will produce the smallest possible
357constructed box \fB\(br\z\(rn\(ul\(br\fR\|.
358.sc
359Large Brackets.
360The Special Mathematical Font contains a number of bracket construction pieces
b91dffe8 361(\|\|\|\(lt\|\|\|\(lb\|\|\|\(rt\|\|\|\(rb\|\|\|\(lk\|\|\|\(rk\|\|\|\(bv\|\|\|\(lf\|\|\|\(rf\|\|\|\(lc\|\|\|\(rc\|\|)
c8ab9d78
KM
362that can be combined into various bracket styles.
363The function \fB\eb\'\fIstring\fB\|\'\fR may be used to pile
364up vertically the characters in \fIstring\fR
365(the first character on top and the last at the bottom);
366the characters are vertically separated by 1|em and the total
367pile is centered 1\(sl2\|em above the current baseline
368(\(12 line in \*(NR).
369For example,
370\fB\eb\'\|\e(lc\e(lf\|\'E\e\|~\|\eb\'\|\e(rc\e(rf\|\'\|\ex\'\|\-0.5m\'\|\ex\'0.5m\'\|\fR
371produces
372\x'-.5m'\x'.5m'\fB\b'\(lc\(lf'E\|\b'\(rc\(rf'\fR.
373.sc
374Line drawing.
375.tr &&
376The function \fB\e\|l\|\'\fINc\fB\|\'\fR will draw a string of repeated \fIc\fR\|'s towards the right for a distance \fIN\fR.
377(\|\fB\el\fR is \fB\e\fR(lower case L).
378If \fIc\fR looks like a continuation of
379an expression for \fIN\fR, it may insulated from \fIN\fR with a \fB\e&\fR.
380If \fIc\fR is not specified, the \fB\(ru\fR (baseline rule) is used
381(underline character in \*(NR).
382If \fIN\fR is negative, a backward horizontal motion
383of size \fIN\fR is made \fIbefore\fR drawing the string.
384Any space resulting from \fIN\fR\|\(sl(size of \fIc\fR) having a remainder is put at the beginning (left end)
385of the string.
386In the case of characters
387that are designed to be connected such as
388baseline-rule\ \fB\(ru\fR\|,
389underrule\ \fB\(ul\fR\|,
390and
391root-en\ \fB\(rn\fR\|,
392the remainder space is covered by over-lapping.
393If \fIN\fR is \fIless\fR than the width of \fIc\fR,
394a single \fIc\fR is centered on a distance \fIN\fR.
395As an example, a macro to underscore a string can be written
396.br
397.tr &.
398.x1
399.ftB
400.ne 2.1
401&de us
402\e\e$1\e\|l\|\'\|~\|0\e(ul\'
403&&
404.ftR
405.x2
406.ne2.1
407.de xu
408\\$1\l'|0\(ul'
409..
410or one to draw a box around a string
411.x1
412.ftB
413&de bx
414\e(br\e\|~\|\e\e$1\e\|~\|\e(br\e\|l\|\'\|~\|0\e(rn\'\e\|l\|\'\|~\|0\e(ul\'
415&&
416.ftR
417.x2
418.de bx
419\(br\|\\$1\|\(br\l'|0\(rn'\l'|0\(ul'
420..
421such that
422.x1
423.ftB
b91dffe8 424&us "underlined words"
c8ab9d78
KM
425.ftR
426.x2
427and
428.x1
429.ftB
430&bx "words in a box"
431.ftR
432.x2
433yield
434.xu "underlined words"
435and
436.bx "words in a box"
437\h'-\w'.'u'.
438.pg
439The function \fB\eL\'\|\fINc\fB\|\'\fR will draw a vertical line consisting
440of the (optional) character \fIc\fR stacked vertically apart 1\|em
441(1 line in \*(NR),
442with the first two characters overlapped,
443if necessary, to form a continuous line.
444The default character is the \fIbox rule\fR |\(br| (\fB\|\e(br\fR);
445the other suitable character is the \fIbold vertical\fR \|\(bv\| (\fB\|\e(bv\fR).
446The line is begun without any initial motion relative to the
447current base line.
448A positive \fIN\fR specifies a line drawn downward and
449a negative \fIN\fR specifies a line drawn upward.
450After the line is drawn \fIno\fR compensating
451motions are made;
452the instantaneous baseline is at the \fIend\fR of the line.
453.pg
454.de eb
455.sp -1
456.nf
457\h'-.5n'\L'|\\nzu-1'\l'\\n(.lu+1n\(ul'\L'-|\\nzu+1'\l'|0u-.5n\(ul'
458.fi
459..
460.ne 2i
461.mk z
462The horizontal and vertical line drawing functions may be used
463in combination to produce large boxes.
464The zero-width \fIbox-rule\fR and the \(12-em wide \fIunderrule\fR
465were \fIdesigned\fR to form corners when using 1-em vertical
466spacings.
467For example the macro
468.x1
469.ftB
470\&.de eb
471\&.sp \-1 \e"compensate for next automatic base-line spacing
472\&.nf \e"avoid possibly overflowing word buffer
473.tr ||
474\&\eh\'\-.5n\'\eL\'\||\|\e\enau\-1\'\el\'\e\en(.lu+1n\e(ul\'\eL\'\-\||\|\e\enau+1\'\el\'\||\|0u\-.5n\e(ul\' \e"draw box
475.tr |
476.lg0
477\&.fi
478.lg
479\&..
480.ftR
481.x2
482will draw a box around some text whose beginning vertical place was
483saved in number register \fIa\fR
484(e. g. using \fB.mk|a\fR)
485as done for this paragraph.
486.eb