Fwd: Re: [texhax] Correcting for math-mode kerning before commas and periods?

Alexander McCormmach alexander at tunicate.org
Sun Oct 16 18:06:18 CEST 2005


Hello everyone,

Wow, my little query has sparked quite a discussion! [continued below]

Uwe Lück wrote:
<snip/>
> OK, TeX first builds a math list from the "input stream"
> according to Chapters 24 and 26. When some \kern<wd>
> comes in, a kern of width <wd> is appended to the math list.
> When an \unkern follows immediately, that kern of width
> <wd> is removed again. When an \unkern comes in that
> has not been preceded by a \kern<wd> immediately, it is
> just ignored. Thus a math list can contain kerns, but not
> \unkern's. However, the kern (which is a kern indeed!)
> from the automatic italic correction according to
> Appendix G Rules 13, 17, 18f can come in only when the
> math list has been finished and is converted into a
> horizontal list, and there is no way for an \unkern to
> interfere here. Even $\unkern can't, because it is screened
> off by the final \mathoff.

Yes, this seems to be what is going on, and now I am at the point of
trying to find a practical solution. From my cross-post on comp.text.tex
[1], it was suggested that inserting a final subscript would prevent the
extra kerning, as follows:

  \newcommand\nok{_{\kern-\scriptspace}}
  Let $U$ be the union of sets $R$ and $S\nok$.

which works well for Computer Modern fonts. But just to add a little
spice to the mix, it seems this solution doesn't work for my preferred
font, the venerable Times Roman, via the txfonts package. It turns out
that txfonts has TeX putting some kind of space *in between* math-mode
letters and their subscripts. I used the following test input both as-is
and commenting out the \usepackage line:

  \nonstopmode
  \showboxdepth=1000
  \documentclass{article}
  \usepackage{txfonts}
  \begin{document}
  \setbox0=\hbox{$S_i$}
  \showbox0
  \box0
  \end{document}

Comparing the two you will notice a marked difference. I've attached a
small PNG image highlighting the discrepancy. And here is the relevant
portion of the log file, first for Computer Modern:

  \box0=
  \hbox(6.83331+1.49998)x9.46123
  .\mathon
  .\OML/cmm/m/it/10 S
  .\hbox(4.63193+0.0)x3.32928, shifted 1.49998
  ..\OML/cmm/m/it/7 i
  .\mathoff

and now for Times Roman:

  \box0=
  \hbox(6.53499+1.55247)x8.94598
  .\mathon
  .\OML/txmi/m/it/10 S
  .\hbox(4.5745+0.05249)x2.446, shifted 1.49998
  ..\OML/txmi/m/it/7 i
  .\mathoff

What puzzles me is that the logs don't look that different. In fact I
don't see any extra hskip or kern at all. But have a look at the
attached PNG -- there's definitely a huge space coming in from
somewhere! I'm at a loss even trying to start looking for this bug.

Any ideas?

Just doing my best to typeset beautiful documents,

Alexander

[1] http://tinyurl.com/93e22

(Please CC me with any reply because I am not subscribed to this list.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tx-cm-side-by-side.png
Type: image/png
Size: 1371 bytes
Desc: not available
Url : http://tug.org/pipermail/texhax/attachments/20051016/bb426166/tx-cm-side-by-side.png


More information about the texhax mailing list