Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!apple!agate!usenet.ins.cwru.edu!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery KB8JRR) Newsgroups: comp.text.tex Subject: Re: Underlining a whole paragraph Message-ID: <1991Mar14.021701.16014@NCoast.ORG> Date: 14 Mar 91 02:17:01 GMT References: <1991Mar5.065740.27490@leland.Stanford.EDU> <4239@gmdzi.gmd.de> Reply-To: allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) Followup-To: comp.text.tex Organization: North Coast Public Access Un*x (ncoast) Lines: 59 As quoted from <4239@gmdzi.gmd.de> by wittig@gmdzi.gmd.de (Georg Wittig): +--------------- | rsingh@elaine17.stanford.edu (Rajesh Kumar Singh) writes: | | >I know that underlining sucks :-) but this advisor of mine | >absolutely wants to underline almost a paragraph of text in | >article style. | | This one was in comp.text.tex some time ago. +--------------- I was notified by mail that the advisor got a clue and went with italics. However, this is still likely to be of use to somebody. The proper way to do underlining in TeX is to use an underlined font. Keeping that in mind (and since I've been trying to learn MetaFont anyway, without benefit of a manual [ )-: ]) I came up with the following. These are a good indication of how well the CM fonts are designed in MetaFont. I have two clippings of MetaFont code which can be added to any font individually or together to produce underlined, reversed, or reverse underlined fonts. (I needed these for a screen dumper which produces LaTeX environments for inclusion in user documentation. The dumper itself is contingent on my figuring out how to use ptys on an Altos 1000 --- they seem to be Streams-based, there is a /dev/pty and nothing else, with the clone major device and pty major as its minor device.) % place this before the "generate" line to create an underlined font extra_endchar:=extra_endchar&"sd_underline_rule;"; def sd_underline_rule = pickup rule.nib; top y50=top y51=-desc_depth-.5rule_thickness; rt x51=w; lft x50=0; filldraw stroke z50--z51; enddef; % place this before the "generate" line to create a reverse font % code modified from the MFbook extra_endchar:=extra_endchar&"sd_reverse_char;"; def sd_reverse_char = picture sd_rev_tmp; sd_rev_tmp := currentpicture; clearit; fill (0,-desc_depth-2)--(w,-desc_depth-2)-- (w,body_height+1)--(0,body_height+1)--cycle; currentpicture:=currentpicture-sd_rev_tmp; enddef; % you can place both to get a reverse underlined font; in that case, the % reverse area will extend one pixel below the underline. % Both reverse spaces and underlined spaces can be generated by generating % an actual space character (see tset.mf) and using some TeX code to make % a space on input generate a space character on output. I have tested these, but not together. I can't see why they wouldn't work together. ++Brandon -- Me: Brandon S. Allbery Ham: KB8JRR on 40m, 10m when time Internet: allbery@NCoast.ORG permits; also 2m, 220, 440, 1200 America OnLine: KB8JRR // Delphi: ALLBERY AMPR: kb8jrr.AmPR.ORG [44.70.4.88] uunet!usenet.ins.cwru.edu!ncoast!allbery KB8JRR @ WA8BXN.OH