[comp.unix.questions] Underlining text in troff

flak@mcgp1.UUCP (Dan Flak) (01/05/90)

Does anyone have a good macro for underlining text in troff. The
example in my book:

.de us
\\$1\l'|O\ul'
..

doesn't work. Neither does:

.de us
\\$1\l'|O\(ul'
..
-- 
       Dan Flak - McCaw Cellular Communications Inc., 201 Elliot Ave W.,
    Suite 105, Seattle, Wa 98119, 206-283-2658, (usenet: thebes!mcgp1!flak)

jaap+@andrew.cmu.edu (Jaap Akkerhuis) (01/06/90)

Excerpts from netnews.comp.unix.questions: 4-Jan-90 Underlining text in
troff Dan Flak@mcgp1.UUCP (318)

> Does anyone have a good macro for underlining text in troff. The
> example in my book:

> .de us
> \\$1\l'|O\ul'
> ..

doesn't work. 

It should be \\$1\l'|0\(ul'. That is a ZERO not an O. Now throw the book
away and read the manual.

	jaap

henry%angel@Sun.COM (Henry McGilton -- Software Products) (01/06/90)

In article <3037@mcgp1.UUCP>, flak@mcgp1.UUCP (Dan Flak) writes:

    *  Does anyone have a good macro for underlining text in
    *  troff. The example in my book:
	    .de us
	    \\$1\l'|O\ul'
	    ..
    *  doesn't work.

Don't know which book you're reading -- hope it's not the
Sun manuals.  No -- I just looked.  The Sun manuals are
wrong also, but in a different way.  Anyway, let me know
which book you took the example from.

Two things wrong with the above example:

	o   the upper case letter O after the | sign should be a
	    0 (zero).  That takes care of the first problem.
	
	o   Then the construct  \u  requests a half line upwards motion.
	    Anybody's guess why.  And the final  l  is just kind of
	    hanging there doing something.

When I `correct' that version to read:

	    .de us
	    \\$1\l'|0\ul'
	    ..

My version of troff croaks with an arithmetic exception.
So, on to your next example:

    *  Neither does:
	    .de us
	    \\$1\l'|O\(ul'
	    ..
This one has the same problem -- the upper case O should be
a 0 (zero).  Try this version:

	.de us
	\\$1\l'|0\(ul'
	..

Note that this macro is still not robust.  Sometimes words
very close to the right margin of the text can show strange
effects, but this should be enough to get you started.

By the way, did you try looking at the  .UL  macro in the
-ms  macro package and the  .u  macro in the  -me  macro package?

	.................. Henry
+-------------------+--------------------------+---------------------------+
| Henry McGilton    | Think of using TROFF as  |                           |
| Sun Microsystems  | writing microcode for a  | arpa: hmcgilton@sun.com   |
| 2550 Garcia       | typesetter, and you have | uucp: ...!sun!angel!henry |
| Mountain View, CA | the idea.                |                           |
+-------------------+--------------------------+---------------------------+

jimm@cbnewsi.ATT.COM (james.mumper) (01/09/90)

In article <129925@sun.Eng.Sun.COM> henry%angel@Sun.COM (Henry McGilton -- Software Products) writes:
>>
>>    *  Does anyone have a good macro for underlining text in
>>    *  troff. The example in my book:
>>	    .de us
>>	    \\$1\l'|O\ul'
>>	    ..
>>    *  doesn't work.
>>
Try this.  I have found that the macro's do not work very reliably when
used with tab settings (.ta).  Try the standard 'troff' underline and tab it.
example:

.ta .5i
	my text
	\l'.5i' (the underline, set to the length of 'my text')

This is very reliable but requires some measuring.  I use it exclusively since
I do not find the macro's at all reliable.

Jim Mumper