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