[texhax] Correcting for math-mode kerning before commas
and periods?
Uwe Lück
uwe.lueck at web.de
Sun Oct 16 13:00:16 CEST 2005
At 21:27 15.10.05, Oleg Katsitadze wrote:
>On Sat, Oct 15, 2005 at 07:57:09PM +0200, Uwe L?ck wrote:
> > According to TeXbook p. 280f., there is a primitive command \unkern,
> > such that \unkern$ should serve your desire -- since the italic correction
> > is a kern (TeXbook p. 287).
>
>\unkern does not seem to work here.
Indeed, I apologize. In horizontal mode, the italic correction can be
\unkern'ed
and measured through \lastkern, but not in math mode. With \showlists
you see that the italic correction appears as a \kern, but this seems to be
a lie, somewhat. \lastkern is 0pt. Indeed, TeXbook p. 441 rather tells that
the width of the box that a character forms includes the italic correction of
that character. This indicates that after forming the box, its \wd is
increased
by the dimension that \/ would use for its \kern (instead of executing that
\kern).
Now I have devised a macro \unkerned which seems to work at least with
characters (not with symbols etc.) -- see below. In order to avoid the
automatic pseudo-kerning, it measures the difference of the character
with vs. without the italic correction by using the _math_ font in
_non-math_ mode. (LaTeX is used for this implementation of the
algorithm.) In a first line, the macro is used; a second line shows that
the macro really makes a visible difference. The \showlists for the first
line shows \kern'ing values that add up to 0pt indeed.
Best,
Uwe L.
______________________________________________
\documentclass[12pt]{article}
\nofiles
\makeatletter
\newcommand\unkerned[1]{%
\edef\that at font{\the\textfont\@ne}%
\settowidth\dimen@{\that at font#1}%
#1\kern\dimen@
\settowidth\dimen@{\that at font#1\/}%
\kern-\dimen@
}
\makeatother
\begin{document}
\showboxbreadth=20 \showboxdepth=0
\tracingonline=1
$\unkerned{f}$.\showlists
% \itshape f\/\showthe\lastkern
$f$.
\end{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
More information about the texhax
mailing list