Article View: comp.text.tex
Article #10627Two questions
From: barr
Date: Fri, 22 Jan 1993 01:03
Date: Fri, 22 Jan 1993 01:03
36 lines
1998 bytes
1998 bytes
In response to the two questions I asked earlier, I got some answers to
the first that were helpful, and I was able to modify one of the answers
to the second. First, it appears that using the latex definition of
\raggedright, it will hyphenate, but not readily. It can be encouraged
by replacing the definition, which is equivalent to
\def\raggedright{\rightskip 0pt plus 1 fil \leftskip 0pt \leftskip 0pt}
with one in which the \rightskip stretchability is somewhat less than
infinity. In my case (which was an extreme one, since I was using a
20pt font in a column only 132pt wide), 100pt seemed to work well,
although perhaps less would have sufficed). Second, it is helpful to
reduce the \hyphenpenalty to 0 or even slightly negative.
The second question, that of formatting numbers to insert a comma every
third place, is somewhat more nuanced, as I knew, and neither of the two
solutions I received worked right for all numbers. Since all my numbers
had fewer than 6 digits, the following seems to work, as far as I have
tested it. It is a modification of one of the answers. One that will
work in general would take more work. The problem is to suppress
leading zeroes at the beginning of a number, while not suppressing them
beyond that point.
\def\The#1{%
\ifnum#1=0 000
\else \ifnum#1<10 00\the#1
\else \ifnum#1<100 0\the#1
\else\the#1
\fi
\fi
\fi}
\newcount\a \newcount\b
\def\fnumber#1{\a=#1 \b=\a \ifnum#1<1000 \$#1 \else \$%
\divide\a by 1000 \the\a,\multiply\a by 1000 \advance\b by -\a
\The\b\fi}
Michael Barr
Technical Details
Message-ID:
<9301220103.AA09581@triples.math.mcgill.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!news.service.uci.edu!unogate!mvb.saic.com!info-texShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!news.service.uci.edu!unogate!mvb.saic.com!info-tex From: <barr@triples.Math.McGill.CA> Newsgroups: comp.text.tex Subject: Two questions Message-ID: <9301220103.AA09581@triples.math.mcgill.ca> Date: Thu, 21 Jan 93 20:03:58 EST Organization: Info-Tex<==>Comp.Text.Tex Gateway X-Gateway-Source-Info: Mailing List Lines: 36