davidson@intvax.UUCP (William M. Davidson) (08/31/88)
I noticed an example in the Troff Reference Manual that looks strange and I have no idea how it works. In chapter 11, the following macro example was given to draw a line under a string: .de us \\$1\l'|0\\(ul' .. I understand everything except the "|0". I assume it is the N argument for the line drawing function, \l'Nc'. It does work so it is not a typo in the manual. I would appreciate any help on this strange syntax. Please email a reply since I do not read this newsgroup. Thanks. -- Forking is Fun! William [i aM not a dweeb] Davidson Sandia National Laboratories (505) 846-1868 ...ucbvax!unmvax!intvax!davidson
wnp@dcs.UUCP (Wolf N. Paul) (09/02/88)
In article <597@intvax.UUCP> davidson@intvax.UUCP (William M. Davidson) writes: >I noticed an example in the Troff Reference Manual that looks strange >and I have no idea how it works. > >In chapter 11, the following macro example was given to draw a line under >a string: > >.de us >\\$1\l'|0\\(ul' >.. > >I understand everything except the "|0". I assume it is the >N argument for the line drawing function, \l'Nc'. > >It does work so it is not a typo in the manual. As far as I can tell, this assumes that you are at the beginning of an output line. It prints the argument ( $1 ), then draws a line from the current print position (i.e. immediately after the argument) to absolute horizontal position 0 (i.e., back to the beginning of the line. It also leaves the current print position to be at the beginning of the line -- thus it makes a good example, but is of little practical value. The syntax is explained in section 3.1.3 of the Nroff/Troff Users Manual, entitled "Numerical Parameter Input": The absolut position indicator (|) may be prepended to a numer N to generate the distance to the vertical or horizontal place N. Thus, |0 is the absolute zero position; since the line drawing function takes a horizontal measurement, it is here the absolute horizontal zero. -- Wolf N. Paul * 3387 Sam Rayburn Run * Carrollton TX 75007 * (214) 306-9101 UUCP: killer!dcs!wnp ESL: 62832882 DOMAIN: dcs!wnp@killer.dallas.tx.us TLX: 910-380-0585 EES PLANO UD
bturner@hpcvlx.HP.COM (Bill Turner) (09/03/88)
> I understand everything except the "|0". I assume it is the > N argument for the line drawing function, \l'Nc'. Yes, it is the N part of Nc. The prefix '|' means relative to the current position, horizontally or vertically. (This I pulled from the HP Nroff/Troff manual, page 12) --Bill Turner
kjk@pbhyf.PacBell.COM (Ken Keirnan) (09/03/88)
>>In chapter 11, the following macro example was given to draw a line under >>a string: >> >>.de us >>\\$1\l'|0\\(ul' >>.. >> >>I understand everything except the "|0". I assume it is the >>N argument for the line drawing function, \l'Nc'. [stuff deleted] >As far as I can tell, this assumes that you are at the beginning of >an output line. It prints the argument ( $1 ), then draws a line from the >current print position (i.e. immediately after the argument) to absolute >horizontal position 0 (i.e., back to the beginning of the line. It also >leaves the current print position to be at the beginning of the line -- >thus it makes a good example, but is of little practical value. The absolute position indicator, "|" is relative to the "input" line not the "output" line for horizontal motion. That is why the above macro will work as expected and only underline the argument $1, which, in this case, is the "input" line. Ken Keirnan x x x x x x dumb space so rn will send the message x x x x x x x -- Ken Keirnan - Pacific Bell - {att,bellcore,sun,ames,pyramid}!pacbell!pbhyf!kjk San Ramon, California kjk@pbhyf.PacBell.COM
pls@sortac.UUCP (Pat Sullivan) (09/03/88)
+In article <597@intvax.UUCP+ davidson@intvax.UUCP (William M. Davidson) writes: ++In chapter 11, the following macro example was given to draw a line under ++a string: ++.de us ++\\$1\l'|0\\(ul' ++.. ++I understand everything except the "|0". In article <191@dcs.UUCP+ wnp@dcs.UUCP (Wolf N. Paul) writes: +As far as I can tell, this assumes that you are at the beginning of +an output line ... This would appear to be true, but the underlining and boxing (see below) works anywhere on the line, very much like the mm ``.B'' and ``.I'' macros. +Thus, |0 is the absolute zero position; since the line drawing function +takes a horizontal measurement, it is here the absolute horizontal zero. It is not necessarily intuitive exactly where ``absolute'' zero is here ... The "|N" is explained briefly at the end of section 1.3 of the same document (DWB 2 *roff Reference Manual). What makes this somewhat magic is the apparently undocumented feature that the absolute 0 position is the current position when the macro is entered, not the left edge of the paper. An even more interesting (and perhaps useful) example of this magic is a little later in the same chapter; it draws a box around its argument: .de bx \(br\|\\$1\|\(br\l'|0\(rn'\l'|0\(ul' .. We have used one similar to this to represent function keys. ================================================================= Pat Sullivan - {att|gatech|akgua}!sortac!pls - voice 404-573-7382
morrell@hpsal2.HP.COM (Michael Morrell) (09/03/88)
/ hpsal2:comp.text / wnp@dcs.UUCP (Wolf N. Paul) / 10:01 pm Sep 1, 1988 / As far as I can tell, this assumes that you are at the beginning of an output line. It prints the argument ( $1 ), then draws a line from the current print position (i.e. immediately after the argument) to absolute horizontal position 0 (i.e., back to the beginning of the line. It also leaves the current print position to be at the beginning of the line -- thus it makes a good example, but is of little practical value. The syntax is explained in section 3.1.3 of the Nroff/Troff Users Manual, entitled "Numerical Parameter Input": The absolut position indicator (|) may be prepended to a numer N to generate the distance to the vertical or horizontal place N. Thus, |0 is the absolute zero position; since the line drawing function takes a horizontal measurement, it is here the absolute horizontal zero. -- Wolf N. Paul * 3387 Sam Rayburn Run * Carrollton TX 75007 * (214) 306-9101 UUCP: killer!dcs!wnp ESL: 62832882 DOMAIN: dcs!wnp@killer.dallas.tx.us TLX: 910-380-0585 EES PLANO UD ---------- Try reading later in the same paragraph: For all other requests and functions [including \l], |N becomes the distance from the current horizontal place on the INPUT line to the horizontal place N. This macro always works since the argument is at the beginning of its input line. Michael
wnp@dcs.UUCP (Wolf N. Paul) (09/03/88)
In article <3888@pbhyf.PacBell.COM> kjk@pbhyf.PacBell.COM (Ken Keirnan) writes: >>As far as I can tell, this assumes that you are at the beginning of >>an output line. It prints the argument ( $1 ), then draws a line from the >>current print position (i.e. immediately after the argument) to absolute >>horizontal position 0 (i.e., back to the beginning of the line. It also >>leaves the current print position to be at the beginning of the line -- >>thus it makes a good example, but is of little practical value. > >The absolute position indicator, "|" is relative to the "input" line >not the "output" line for horizontal motion. That is why the above >macro will work as expected and only underline the argument $1, which, >in this case, is the "input" line. Thanks for this clarification -- I hadn't realized this. -- Wolf N. Paul * 3387 Sam Rayburn Run * Carrollton TX 75007 * (214) 306-9101 UUCP: killer!dcs!wnp ESL: 62832882 DOMAIN: dcs!wnp@killer.dallas.tx.us TLX: 910-380-0585 EES PLANO UD