[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Typesetting arbitrary fractions?
From: |
Ted Harding |
Subject: |
Re: [Groff] Typesetting arbitrary fractions? |
Date: |
Sat, 05 Nov 2005 09:04:30 -0000 (GMT) |
On 05-Nov-05 Robert Goulding wrote:
> On Nov 4, 2005, at 10:46 PM, T. Kurt Bond wrote:
>
>> What's a good way to typeset arbitrary fractions like 1/100 and 1/1000
>> after the styel of \(12?
>>
> Preprocess with eqn (i.e., groff -e -ms):
>
> .EQ
> delim $$
> .EN
> .LP
> We can write one-thousandth as $1 smallover 1000$.
That's a bit off the original question!
\(12, like \(14 and \(34, is a glyph in its own right (indeed with
its own iso-8859-1 code, so you should be able to see ¼ ½ ¾) and
I presume this is the style which Kurt wants to emulate.
So you see a small raised "1", a sloping bar which goes well under
it (almost to the left of the "1", and then a small "2" on the baseline,
well tucked under the sloping bar.
The ordinary AScII "/" does not have the slope to make this look
right, and it's better to use the similar character in the Symbol
character set (PostScropt name "fraction") whose groff name is "\(f/"
In fact, when I set \(12 and \(f/ side by side in TR and view at hign
magnification, the two sloping bars seem to be identical (which is
what you would expect in a properly designed font family).
However, this would not necessarily transfer to other fonts, since the
\(f/ in standard PostScript occurs only in the Symbol font and so there
is only one version of it. None the less, I have made the comparison
in some standard Adobe font families (Times, Bookman, Palatino,
Helvetica) and the bar in \(12 in all seems to be identical to \(f/
in Symbol.
So, with that settled, we can address Kurt's question. The following
is only a version which I judge by eye to be about right, in that
it seems to give the same results for the composed fraction when
applied to "1/2" for which there is a single glyph.
.de frac
.nr n0 \\n[.s]
.nr n1 \\n[n0]*6/10
.nr dn (\\n[n0]-\\n[n1])*8/10
\v'-\\n[dn]p'\s[\\n[n1]]\\$1\s0\v'\\n[dn]p'\[f/]\s[\\n[n1]]\\$2\s0
..
Test it:
\f[HR]\s[40]\(12
.frac 1 2
.frac 999 1000
.sp
\f[TR]\s[30]\(12
.frac 1 2
.frac 999 1000
.sp
\s[30]\(12\f[TB]
.frac 1 2
.frac 999 1000
Note that it seems fine in HR (first test), but in TR the "1"
and "2" in ".frac 1 2" are in TR while in "\(12" these figures
seem to be heavier (though not quite bold), as confirmed in the
third test.
So that's the basics of doing it, but clearly you have to watch
out for detail depending on the environment.
Best wishes to all,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 05-Nov-05 Time: 09:04:27
------------------------------ XFMail ------------------------------