groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] digits in eqn


From: Ted Harding
Subject: Re: [Groff] digits in eqn
Date: Thu, 02 Aug 2007 09:26:39 +0100 (BST)

On 01-Aug-07 22:35:29, Ralph Corderoy wrote:
> 
> Hi Ted,
> 
>> What I'm referring to can be seen if you set the following in Times,
>> using a fairly large point size (say 15) (I'm using ms macros here):
>> 
>> .nr DD 0
>> .EQ I
>> 21 ~~=~~ 3 times 7
>> .EN
>> .EQ I
>> 22 ~~=~~ 2 times 11
>> .EN
>> 
>> You wil see that the "=" signs do not line up.
> 
> I can re-create this here.
> 
>> It seems that eqn uses the glyph-width of the digits in computing the
>> layout, as opposed to the normal metrics. In TR, digits have fixed
>> width, so, while one would expect the "=" signs in the above to line
>> up, they don't -- since the "1" glyph is narrower than the "2" glyph,
>> and eqn therefore packs it closer to the "2".
> 
> Hmm, don't know about that.  I did however have a look at eqn's output
> and I think it's the \, that's causing the effect.
> 
>     $ cat ted.tr
>     .nr DD 0
>     .EQ I
>     21 ~~=~~ 3 times 7
>     .EN
>     .br
>     .EQ I
>     22 ~~=~~ 2 times 11
>     .EN
>     $ groff -e -ms ted.tr >ted.ps     # Has fault.
>     $ eqn ted.tr | sed 's/\\,//g' | groff -ms >ted2.ps
> 
> ted2.ps looks OK.  It may be that the \/ that's also in eqn's output
> can cause problems too sometimes, I don't know and haven't the time
> to investigate further.
> 
> groff_diff(7) describes these escapes;  hopefully this email gives a
> clue.

Thanks, Ralph. It is indeed the \. (and not the \/) which is doing it.

In the sort of eqn context where italic sharacters (used in symbols)
switches automatically to roman (for digits), this is certainly a
feature at the point of the switch, since it makes for nice spacing
at that point.

However, eqn uses "\,\/" between digits in a multi-digit numbers, and
this has to be a bug. To get an extreme impression:

.EQ L
121131114111151111161111117111111181111111191111111110
.EN
121131114111151111161111117111111181111111191111111110

In other words, a long multi-digit number in an equation will
be much shorter than the same number in surrounding non-equation
text. That can only be bad style!

What eqn does is to separate each digit from its successor with
a "\,\/" ; it is the "\," which has this effect, not the "\/2.

At most, this only needs to be done at the very beginning of
the number, and possibly at its end. Doing it between all the
digits is simply wrong!

This does not happen if an alphabetical string is enclosed
in a single "roman":

.EQ L
roman {ABCDEFGHIJKLMNOPQRSTUVWXYZ}
.EN
ABCDEFGHIJKLMNOPQRSTUVWXYZ

so apparently arises because eqn sees each single digit as an
object where there is a transition *to* roman when the digit
is encountered, followed by a transition *from* roman back
to the "italic" font as soon as the digit has been emitted,
even in an unbroken string of digits (thus each digit is
separated from its successor by "\,\/").

This has to be wrong: a multi-digit number which occurrs in
an equation should look exactly the same as the same number
in non-eqn text. (Of course, for that precise usage, it is
straightforward to use roman{"12345..."}, as I usually do
anyway is there's a "." in the number; but the underlying
behaviour is inappropriate).

I'll try to look into this, to see if it's possible to stop
it from happening.

Thanks, Ralph1
ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 02-Aug-07                                       Time: 09:26:33
------------------------------ XFMail ------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]