troff underlining problem

bookmark wa263 at sdcc12.UUCP
Thu Jul 10 14:14:40 AEST 1986


In article <1997 at brl-smoke.ARPA>, 
harv%ksuvax1.BITNET at WISCVM.arpa (Harvard Townsend) writes:
> We are running the `troff' which comes with 4.2BSD on a VAX 11/780 (not
> `ditroff').  Has anyone fixed the way it does underlining?  The problem
> shows up in 2 places.  The first is when an underlined word is hyphenated
> and thus spread across 2 lines.  The underline is drawn on the second line,
> extending on into the left margin since it is expecting to underline the
> first part of the word which is on the line above.  This also happens when
> you are underlining a phrase which gets split across 2 lines.  The other
> problem shows up when underlining a phrase, even if it is not split across
> 2 lines.  If some white space is added between words in the phrase (in
> fill mode) to get justification of the right margin, the phrase then
> extends past the end of the underline.  The length of the underline is not
> adjusted to account for the extra space
> added between the words in the phrase.
> The horizontal motion apparently is calculated before the hyphenation and
> justification is done.
> I'm assuming it is a troff problem [...]
> 
> Harvard Townsend, Systems Administrator

	This is not a troff problem, really.  It's not clear what macro
package is being used, but any underlining command (like -ms's .UL) has
to use troff's movement and line drawing commands (\l) to put a line
under a word, because troff doesn't handle underlining itself (you're
supposed to use alternate fonts, like italic and boldface fonts).  The
-ms macros, for instance, work by asking troff for the width of the material
to be hyphenated (\w function) and then using movement and line-drawing
functions to underline the stuff (\h,\l commands).  Since troff calculates
the width without reference to any possible future hyphenation or
justification, the macro which draws the line can go wrong when these occur.

	Switching to ditroff will not help; it doesn't know any more about
underlining than troff.  (Though, perhaps, you could get an "underline"
font for ditroff use...)  The correct thing to do is:  underline single
words only, either with hyphenation off or with the macro modified to prepend
\% to the each word; or, stop trying to underline things, and use italics.
The second choice is better.


					bookmark at sdcsvax.ARPA
					bookmark at sdcsvax.UCSD.EDU



More information about the Comp.unix.wizards mailing list