Handling Integral Signs

1 view
Skip to first unread message

Freddie Witherden

unread,
Jul 31, 2009, 8:17:52 AM7/31/09
to matht...@googlegroups.com
Hi all,

This morning I have been wracking my brain trying to solve the issue
of \int xdx. When rendered using mathtex there is no spacing between
the integral sign and the x -- producing unattractive output.

However, as soon as limits are added, everything renders correctly.
After looking through various packages it appears as TeX uses the
\nolimits macro to handle this.

In mathtex a 'hack' is to add dummy limits: \int^{}_{} xdx -- which
renders as expected.

I am hence interested to know what people think is the best way to go
about solving this. One possible solution would be to ensure that \int
and \oint always have limits, even if they are empty. Another option
would be to look into \nolimits and \limits, which would likely
require changes to the parser. Does anyone have any comments or
suggestions on this?

Regards, Freddie.

Michael Droettboom

unread,
Jul 31, 2009, 8:51:04 AM7/31/09
to matht...@googlegroups.com
Given that TeX handles $\int xdx$ fine without any need for \nolimits etc., I would say this is a bug in mathtex, and we shouldn't require extra syntax from the user to get it right.  (When in doubt, check against pure TeX -- mathtex is trying to be a fully-compatible subset).

The fundamental problem seems to be that the x-advance on the integral sign is too short.  When you do $\int xdx$, it just uses whatever the fonts x-advance (and kerning if any) between the integral and the x.  When you do $\int^{}_{} xdx$ the sub/superscripts prevent any kerning from happening, which is why it seems like a workaround.  I suppose one could special case the get_kerning for the integral symbol (which seems like an aggregious hack).  Or, more difficult but less hacky, change the parser to recognize \int (and friends) as non-kernable symbols, which I suspect is what TeX does.  Might be a good opportunity to get your hands dirty in the parser, though... ;)

Cheers,
Mike
--
Michael Droettboom
http://www.droettboom.com/

Sent from my MacBook Wheel

This message is confidential, intended only for the named recipient(s) and may contain information that is privileged or exempt from disclosure under applicable law. If you are not the intended recipient(s), you are notified that any dissemination, distribution, or copying of this message is strictly prohibited.

Freddie Witherden

unread,
Jul 31, 2009, 10:10:22 AM7/31/09
to matht...@googlegroups.com
Hi,

On 31 Jul 2009, at 13:51, Michael Droettboom wrote:
> The fundamental problem seems to be that the x-advance on the
> integral sign is too short. When you do $\int xdx$, it just uses
> whatever the fonts x-advance (and kerning if any) between the
> integral and the x. When you do $\int^{}_{} xdx$ the sub/
> superscripts prevent any kerning from happening, which is why it
> seems like a workaround. I suppose one could special case the
> get_kerning for the integral symbol (which seems like an aggregious
> hack). Or, more difficult but less hacky, change the parser to
> recognize \int (and friends) as non-kernable symbols, which I
> suspect is what TeX does. Might be a good opportunity to get your
> hands dirty in the parser, though... ;)

I don't think it is kerning; I tried short-circuiting the get_kern
function for the TrueType fonts class so that it always returned 0.
However, it did not seem to have any effect in the case of $\int xdx$.
I'll look over the sub/super script code some more to see if I can
work out exactly what is going on.

Regards, Freddie.

Reply all
Reply to author
Forward
0 new messages