> What's needed is a macro that can be called inline in arg > 3 to start underlining, and another macro in arg 4 to stop > underlining. Even if ul.tmac could be coerced into behaving > this way (I've tussled with it, without success), it seems > to me that the macros in ul.tmac are an awful lot of hoops > to jump through for something as basic as underlining. > > Hence wondering about .cu.
If you're satisfied with a solution that works *only* with the postscript device, then this can be achieved with device-control escapes. Here's something to play around with. It redefines[*] grops's basic text-printing functions to memorize the position at the start of a piece of text and once the text is printed draws a line to the remembered beginning position. [*] You can also write the modified definitions directly into the prologue file instead. .\" .\" ---------------------------------------------------------------- .de XX ps: def grops begin /strikethrough { grops begin /X { currentpoint currentfont /FontMatrix get 3 get 250 mul add /y0 exch def /x0 exch def } def /Y { currentpoint 0 currentfont /FontMatrix get 3 get dup 50 mul setlinewidth 250 mul rmoveto x0 y0 lineto stroke moveto } def end } def /underline { grops begin /X { currentpoint currentfont /FontMatrix get 3 get -60 mul add /y0 exch def /x0 exch def } def /Y { currentpoint 0 currentfont /FontMatrix get 3 get dup 50 mul setlinewidth -60 mul rmoveto x0 y0 lineto stroke moveto } def end } def /normal { grops begin /X { } def /Y { } def end } def normal /A { X show Y } def /B { 0 SC 3 -1 roll X widthshow Y } def /C { 0 exch X ashow Y } def /D { 0 exch 0 SC 5 2 roll X awidthshow Y } def /E { 0 rmoveto X show Y } def /F { 0 rmoveto 0 SC 3 -1 roll X widthshow Y } def /G { 0 rmoveto 0 exch X ashow Y } def /H { 0 rmoveto 0 exch 0 SC 5 2 roll X awidthshow Y } def /I { 0 exch rmoveto X show Y } def /J { 0 exch rmoveto 0 SC 3 -1 roll X widthshow Y } def /K { 0 exch rmoveto 0 exch X ashow Y } def /L { 0 exch rmoveto 0 exch 0 SC 5 2 roll X awidthshow Y } def /M { rmoveto X show Y } def /N { rmoveto 0 SC 3 -1 roll X widthshow Y } def /O { rmoveto 0 exch X ashow Y } def /P { rmoveto 0 exch 0 SC 5 2 roll X awidthshow Y } def /Q { moveto X show Y } def /R { moveto 0 SC 3 -1 roll X widthshow Y } def /S { moveto 0 exch X ashow Y } def /T { moveto 0 exch 0 SC 5 2 roll X awidthshow Y } def end .. .de underline \X'ps: exec underline'\c .. .de normal \X'ps: exec normal'\c .. .de strikethrough \X'ps: exec strikethrough'\c .. .\" ---------------------------------------------------------------- .sp 3c .ll 4c \Y[XX]\c .strikethrough The general syntax for writing groff documents is relatively easy, but writing extensions to the roff language can be a bit harder. .normal The roff language is line-oriented. .underline There are only two kinds of lines, control lines and text lines. .normal The control lines start with a control character, by default a period \(lq.\(rq or a single quote \(lq'\(rq; all other lines are text lines.