Underlining text in troff

Henry McGilton -- Software Products henry%angel at Sun.COM
Sat Jan 6 05:28:47 AEST 1990


In article <3037 at mcgp1.UUCP>, flak at 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 at sun.com   |
| 2550 Garcia       | typesetter, and you have | uucp: ...!sun!angel!henry |
| Mountain View, CA | the idea.                |                           |
+-------------------+--------------------------+---------------------------+



More information about the Comp.unix.questions mailing list