Why `bm` uparrow gives extra white space while `bm` downarrow does not?

A bug in cmbsy7.tfm: the characters used are octal 42 (up arrow) and octal 43 (down arrow) and we see in the tfm file (converted to human readable form)

(FAMILY CMBSY V2.2)
(FACE O 360)
(CODINGSCHEME TEX MATH SYMBOLS)
(DESIGNSIZE R 7.0)
(COMMENT DESIGNSIZE IS IN POINTS)
[...]
(CHARACTER O 42
   (CHARWD R 0.65516)
   (CHARHT R 0.694445)
   (CHARDP R 0.194445)
   (CHARIC R 0.714683)
   )
(CHARACTER O 43
   (CHARWD R 0.65516)
   (CHARHT R 0.694445)
   (CHARDP R 0.194445)
   )
[...]

and the italic correction makes all the difference, because by rule TeX adds the italic correction when a symbol ends a math list. The italic correction ends up as 0.714683 times 7 points, a whopping 5pt!

Indeed, if I try $x_{\bm{\uparrow}}x_{\bm{\downarrow}}$ I get

....\OML/cmm/m/it/10 x
....\hbox(4.8611+1.3611)x10.08888, shifted 1.49998
.....\hbox(4.8611+1.3611)x9.58888
......\mathon
......\OMS/cmsy/b/n/7 "
......\kern5.00278
......\mathoff
....\OML/cmm/m/it/10 x
....\hbox(4.8611+1.3611)x5.0861, shifted 1.49998
.....\hbox(4.8611+1.3611)x4.5861
......\mathon
......\OMS/cmsy/b/n/7 #
......\mathoff

and you see the added kern.

\documentclass{article}
\usepackage{amsmath}
\usepackage{bm}

\newcommand\fixup{\kern-\fontcharic\scriptfont2`\"}

\begin{document}

$x_{\bm{\uparrow\fixup}x_{\bm{\downarrow}}x$

\end{document}

enter image description here

Another fix could be

\newcommand{\fixup}{_{\kern-\scriptspace}}

The first suggested hack doesn't work with superscripts to the arrow, the second one would; however in case you have a subscript to the arrow, it will remove the wrong italic correction by itself.

The problem starts with the METAFONT source code by Knuth himself. We see in sym.mf

iff known down_arrow: cmchar "Downward arrow";
beginchar(down_arrow,9u#,asc_height#,asc_depth#);
adjust_fit(0,0); pickup crisp.nib;
pos1(rule_thickness,0); pos2(rule_thickness,0);
pos3(rule_thickness,90); pos4(rule_thickness,90);
lft x1l=hround(.5w-.5rule_thickness); y1+.5rule_thickness=h;
x0=x1=x2; bot y0=-d; x0-x3=x4-x0=if monospace:3u else:4u fi+eps;
y3=y4=y0+if monospace:.24 else:.36 fi asc_height+eps;
pos5(rule_thickness,angle(z4-z0)); z5l=z0;
pos6(rule_thickness,angle(z3-z0)); z6l=z0;
z9=.2[.5[z3,z4],z0];
numeric t; path p; p=z4r{z9-z4}..z6r;
t=xpart(p intersectiontimes((x2r,-d)--(x2r,h))); y2=ypart point t of p;
filldraw z0..{z4-z9}z4l--subpath (0,t) of\\(z4r{z9-z4}..z6r)
 ---z1r..z1l---subpath (t,0) of\\(z3r{z9-z3}..z5r)
 --z3l{z9-z3}..z0 & cycle;  % arrowhead and stem
penlabels(0,1,2,3,4,5,6,9); endchar;

iff known up_arrow: cmchar "Upward arrow";
beginchar(up_arrow,9u#,asc_height#,asc_depth#);
italcorr .76asc_height#*slant+.5crisp#-u#;
adjust_fit(0,0); pickup crisp.nib;
pos1(rule_thickness,0); pos2(rule_thickness,0);
pos3(rule_thickness,90); pos4(rule_thickness,90);
lft x1l=hround(.5w-.5rule_thickness); y1-.5rule_thickness=-d;
x0=x1=x2; top y0=h; x0-x3=x4-x0=if monospace:3u else:4u fi+eps;
y3=y4=y0-if monospace:.24 else:.36 fi asc_height-eps;
pos5(rule_thickness,angle(z4-z0)); z5l=z0;
pos6(rule_thickness,angle(z3-z0)); z6l=z0;
z9=.2[.5[z3,z4],z0];
numeric t; path p; p=z4l{z9-z4}..z6r;
t=xpart(p intersectiontimes((x2r,-d)--(x2r,h))); y2=ypart point t of p;
filldraw z0..{z4-z9}z4r--subpath (0,t) of\\(z4l{z9-z4}..z6r)
 ---z1r..z1l---subpath (t,0) of\\(z3l{z9-z3}..z5r)
 --z3r{z9-z3}..z0 & cycle;  % arrowhead and stem
penlabels(0,1,2,3,4,5,6,9); endchar;

and there should be a reason for the italic correction in “up arrow” that isn't in “down arrow”. Anyway, this italic correction turns out to be negative, and so it is discarded, in cmsy5 to cmsy10.

The real bug is in cmbsy7.mf (in cmextra, provided by the AMS) which has

crisp#:=11pt#;    % diameter of serif corners

Similarly, cmbsy5.mf has 9pt, whereas cmsy7.mf has

crisp#:=7/36pt#;    % diameter of serif corners

That's the issue. Indeed, cmbsy10.mf has

crisp#:=13/36pt#;    % diameter of serif corners

Similar bugs affect cmbsy5.mf, cmbsy6.mf and cmbsy8.mf, but not cmbsy9.mf and cmbsy10.mf.


enter image description here

This appears to be a bug in the bold cm font at script size, the example can be reduced to

\documentclass[a4paper]{article}

\begin{document}

$\scriptstyle x\uparrow y \downarrow z$

\boldmath
$\scriptstyle x\uparrow y\downarrow z$

\end{document}

Tags:

Math Mode

Bm