📄 tt06
字号:
.NHLocal Motions: Drawing lines and characters.PPRemember `Area = \(*pr\u2\d' and the big `P'in the Paternoster.How are they done?.UL troffprovides a host of commands for placing characters of any sizeat any place.You can use them to draw special characters or to tune your output for a particular appearance.Most of these commands are straightforward, but messy to readand tough to type correctly..PPIf you won't use .UL eqn ,subscripts and superscripts are most easily done withthe half-line local motions.BD \euand.BD \ed .To go back up the page half a point-size, insert a.BD \euat the desired place;to go down, insert a.BD \ed ..BD \eu \& (and.BD \edshould alwaysbe used in pairs, as explained below.)Thus.P1Area = \e(*pr\eu2\ed.P2produces.P1Area = \(*pr\u2\d.P2To make the `2' smaller, bracket it with.BD \es\-2...\es0 .Since.BD \euand.BD \edrefer to the current point size,be sure to put them either both inside or both outsidethe size changes,or you will get an unbalanced vertical motion..PPSometimes the space given by.BD \euand.BD \edisn't the right amount.The .BD \evcommand can be used to request an arbitrary amount of vertical motion.The in-line command.P1\ev'(amount)'.P2causes motion up or down the page by the amount specified in`(amount)'.For example, to move the `P' down, we used.P1 2.ta 1i^in +0.6i (move paragraph in)^ll \-0.3i (shorten lines)^ti \-0.3i (move P back)\ev'2'\es36P\es0\ev'\-2'ater noster qui estin caelis ....P2A minus sign causes upward motion, whileno sign or a plus sign means down the page.Thus.BD \ev\(fm\-2\(fmcauses an upward vertical motion of two line spaces..PPThere are many other ways to specify the amount of motion _.P1\ev'0.1i'\ev'3p'\ev'\-0.5m'.P2and so on are all legal.Notice that the scale specifier.BD ior.BD por.BD mgoes inside the quotes.Any character can be used in place of the quotes;this is also true of all other.UL troffcommands described in this section..PPSince.UL troffdoes not take within-the-line vertical motions into accountwhen figuring out where it is on the page,output lines can have unexpected positionsif the left and right ends aren't at the samevertical position.Thus.BD \ev ,like.BD \euand.BD \ed ,should always balance upward vertical motion in a line withthe same amount in the downward direction..PPArbitrary horizontal motions are also available _.BD \ehis quite analogous to.BD \ev ,except that the default scale factor is ems instead of line spaces.As an example,.P1\eh'\-0.1i'.P2causes a backwards motion of a tenth of an inch.As a practical matter, consider printing the mathematical symbol`>>'.The default spacing is too wide, so.UL eqnreplaces this by.P1>\eh'\-0.3m'>.P2to produce >\h'-.3m'>..PPFrequently.BD \ehis used with the `width function'.BD \ewto generate motions equal to the widthof some character string.The construction.P1\ew'thing'.P2is a number equal to the width of `thing' in machine units(1/432 inch).All.UL troffcomputations are ultimately done in these units.To move horizontally the width of an `x',we can say.P1\eh'\ew'x'u'.P2As we mentioned above,the default scale factor forall horizontal dimensions is.BD m ,ems, so here we must have the.BD ufor machine units,or the motion produced will be far too large..UL troffis quite happy with the nested quotes, by the way,so long as you don't leave any out..PPAs a live example of this kind of construction,all of the command names in the text, like.BD .sp ,were done by overstriking with a slight offset.The commands for.BD .spare.P1^sp\eh'\-\ew'.sp'u'\eh'1u'.sp.P2That is, put out `.sp', move left by the width of `.sp',move right 1 unit, and print`.sp' again.(Of course there is a way to avoid typing that much inputfor each command name, which we will discuss in Section 11.).WS.PPThere are also several special-purpose.UL troffcommands for local motion.We have already seen.BD \e0 ,which is an unpaddable white spaceof the same width as a digit.`Unpaddable' means that it will never be widenedor split across a line by line justification and filling.There is also.BD \e (blank),.tr ^^which is an unpaddable character the width of a space,.BD \e| ,which is half that width,.BD \e^ ,which is one quarter of the width of a space,and.BD \e& ,which has zero width..tr ^.(This last one is useful, for example, in enteringa text line which would otherwise begin with a `.'.).PPThe command.BD \eo ,used like.P1\eo'set of characters'.P2causes (up to 9)characters to be overstruck,centered on the widest.This is nice for accents, as in.P1 2syst\eo"e\e(ga"me t\eo"e\e(aa"l\eo"e\e(aa"phonique.P2which makes.P1syst\o"e\(ga"me t\o"e\(aa"l\o"e\(aa"phonique.P2The accents are.BD \e(gaand.BD \e(aa ,or.BD \e\` and.BD \e\' ;remember that each is just one character to.UL troff ..PPYou can make your own overstrikes with another special convention,.BD \ez ,the zero-motion command..BD \ezxsuppresses the normal horizontal motionafter printing the single character.BD x ,so another character can be laid on top of it.Although sizes can be changed within.BD \eo ,it centers the characters on the widest,andthere can be no horizontal or vertical motions,so.BD \ezmay be the only way to get what you want:.P1.sp 2\s8\z\(sq\s14\z\(sq\s22\z\(sq\s36\(sq.P2is produced by.P1^sp 2\es8\ez\e(sq\es14\ez\e(sq\es22\ez\e(sq\es36\e(sq.P2The.BD .spis needed to leave room for the result..PPAs another example, an extra-heavy semicolonthat looks like.P1\s+6\z,\v'-0.25m'.\v'0.25m'\s0 instead of ; or \s+6;\s0.P2can be constructed with a big comma and a big period above it:.P1\es+6\ez,\ev'\(mi0.25m'.\ev'0.25m'\es0 .P2`0.25m' is an empirical constant..PPA more ornate overstrike is given by the bracketing function.BD \eb ,which piles up characters vertically,centered on the current baseline.Thus we can get big brackets,constructing them with piled-up smaller pieces:.P1.sp.ne 3\b'\(lt\(lk\(lb' \b'\(lc\(lf' x \b'\(rc\(rf' \b'\(rt\(rk\(rb'.sp.P2by typing in only this:.P1 0\&^sp\eb\(fm\e(lt\e(lk\e(lb\(fm \eb\(fm\e(lc\e(lf\(fm x \eb\(fm\e(rc\e(rf\(fm \eb\(fm\e(rt\e(rk\e(rb\(fm.P2.PP.UL troffalso provides a convenient facility for drawing horizontal and verticallines of arbitrary length with arbitrary characters..BD \el\(fm1i\(fmdraws a line one inch long, like this:\l'1i'\|.The length can be followed bythe character to use if the \(ru isn't appropriate;.BD \el\(fm0.5i.\(fmdraws a half-inch line of dots: \l'.5i.'.The construction.BD \eLis entirely analogous,except that it draws a vertical line instead of horizontal.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -