home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / text / tex / 15290 < prev    next >
Encoding:
Internet Message Format  |  1993-01-22  |  1.9 KB

  1. Path: sparky!uunet!usc!news.service.uci.edu!unogate!mvb.saic.com!info-tex
  2. From: <barr@triples.Math.McGill.CA>
  3. Newsgroups: comp.text.tex
  4. Subject: Two questions
  5. Message-ID: <9301220103.AA09581@triples.math.mcgill.ca>
  6. Date: Thu, 21 Jan 93 20:03:58 EST
  7. Organization: Info-Tex<==>Comp.Text.Tex Gateway
  8. X-Gateway-Source-Info: Mailing List
  9. Lines: 36
  10.  
  11.  
  12. In response to the two questions I asked earlier, I got some answers to
  13. the first that were helpful, and I was able to modify one of the answers
  14. to the second.  First, it appears that using the latex definition of
  15. \raggedright, it will hyphenate, but not readily.  It can be encouraged
  16. by replacing the definition, which is equivalent to
  17. \def\raggedright{\rightskip 0pt plus 1 fil \leftskip 0pt \leftskip 0pt}
  18. with one in which the \rightskip stretchability is somewhat less than
  19. infinity.  In my case (which was an extreme one, since I was using a
  20. 20pt font in a column only 132pt wide), 100pt seemed to work well,
  21. although perhaps less would have sufficed).  Second, it is helpful to
  22. reduce the \hyphenpenalty to 0 or even slightly negative.
  23.  
  24. The second question, that of formatting numbers to insert a comma every
  25. third place, is somewhat more nuanced, as I knew, and neither of the two
  26. solutions I received worked right for all numbers.  Since all my numbers
  27. had fewer than 6 digits, the following seems to work, as far as I have
  28. tested it.  It is a modification of one of the answers.  One that will
  29. work in general would take more work.  The problem is to suppress
  30. leading zeroes at the beginning of a number, while not suppressing them
  31. beyond that point.
  32.  
  33. \def\The#1{%
  34.     \ifnum#1=0 000
  35.     \else \ifnum#1<10 00\the#1
  36.           \else \ifnum#1<100 0\the#1
  37.                 \else\the#1
  38.                 \fi
  39.           \fi
  40.     \fi}
  41. \newcount\a \newcount\b
  42. \def\fnumber#1{\a=#1 \b=\a \ifnum#1<1000 \$#1 \else \$%
  43.      \divide\a by 1000 \the\a,\multiply\a by 1000 \advance\b by -\a
  44. \The\b\fi}
  45.  
  46. Michael Barr
  47.