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: Sun, 19 Aug 2007 01:53:09 +0100 (BST)

On 19-Aug-07 00:12:43, Dean Allen Provins, P. Geoph. wrote:
> Ted:
> 
> On Wed, Aug 01, 2007 at 11:00:10PM +0100, Ted Harding wrote:
>> Hi Folks,
>> 
>> I'm trying to overcome an eqn "phenomenon" -- in some ways a
>> "feature", in others a "bug".
>> [...]
>> 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".
> [...]
> I'm a little late getting to this list, and you probably have an
> acceptable solution, but here's mine anyway.

Thanks, Dean! But, since you're late catching up, you may not yet
have noticed that Werner pointed out that for a period groff
came with erroneous font files installed in devps: the font files
for roman fonts had left and right italic correction entries.
In eqn, this had the effect that digits were no longer ocnstant
width.

So I solved it by copying over the font files from another version
of groff, and all was well!

> Use 'mark' and 'lineup' as per:
> 
> .NH
> Ted's Lineup Problem
> .LP
> .nr DD 0
> .EQ I
> 21 ~~=~~ 3 times 7
> .EN
> .EQ I
> 22 ~~=~~ 2 times 11
> .EN
> .NH
> Solution - Use 'mark' and 'lineup'
> .LP
> .nr DD 0
> .EQ I
> 21 ~~ mark =~~ 3 times 7
> .EN
> .EQ I
> 22 ~~ lineup =~~ 2 times 11
> .EN
> 
> The equal signs line up properly this way.
> 
> Dean

Yes, I use mark and lineup like that all the time!

Another trick I use is to define entities 'hphantom', 'vphantom'
and 'phantom', where hphantom{something} has the width of "something"
but no height, vphantom{something} has its height but no width,
and phantom{something} has both its width and its height.

You need to get into the eqnrc file, and first enter

.de phntmsrc
.ds 0s
.ds 0s \\&\h'\\n(0wu'
..
.de vphntmsrc
.ds 0s
.nr 0w 0
.nr 0skew 0
.nr 0skern 0
..
.de hphntmsrc
.nr 0h 0
.nr 0d 0
.nr 0skew 0
.nr 0skern 0
.ds 0s \\&\h'\\n(0wu'
..


Then, lower down, enter

define phantom 'special phntmsrc'
define vphantom 'special vphntmsrc'
define hphantom 'vcenter special hphntmsrc'

(though you could also just put them in an EQ/EN block in the
urrent document; but I have them there all the time).


This is useful in contexts like (using .nr DD 0 in ms macros
to make zero spacing between equation displays):


.nr DD 0
.PTS 15
.LP
.EQ I
define hpad %hphantom{X ~~=~~ U}%

X ~~ mark =~~ U ~+~ V ~+~ W
.EN
.EQ I
hpad ~+~ A ~+~ B
.EN
.sp 0.5m
.EQ I
lineup =~~ K ~+~ L ~+~ M
.EN


so that the "+~ V ~+~W" and the "+~ A ~+~B" line up on their
first "+" sign in the first two equations, and the "=" in the
first equation lines up with the "=" in the third.

vphantom is useful for giving an expression a vertical extent
greater than it would otherwise have, and phantom combines
both effects.

Thanks again,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 19-Aug-07                                       Time: 01:53:05
------------------------------ XFMail ------------------------------




reply via email to

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