# Why does cmsy10.tfm give the minus sign a positive depth?

cmsy10.tfm gives a positive depth to the minus sign:

$tftopl /usr/local/texlive/2019/texmf-dist/fonts/tfm/public/cm/cmsy10.tfm | grep -A4 'CHARACTER O 0' (CHARACTER O 0 (CHARWD R 0.777781) (CHARHT R 0.583334) (CHARDP R 0.083334) # <- emphasis mine )  (the minus sign is at position zero, as confirmed by: $ grep 'C 0' /usr/local/texlive/2019/texmf-dist/fonts/afm/public/amsfonts/cm/cmsy10.afm
C 0 ; WX 777 ; N minus ; B 83 230 694 270 ;


)

Where is there this positive depth? The minus sign obviously has no descender.

This is problematic for the Python plotting library matplotlib, which needs to figure out the baseline of certain tex constructs to properly align tex-processed strings -- see https://github.com/matplotlib/matplotlib/issues/6323 for the issue, and https://github.com/matplotlib/matplotlib/pull/6333/files for a proposed fix which basically amounts to special casing this glyph to ignore the tfm data.

Here's one of the reasons why the minus sign has the same height and depth of the plus sign.

\def\nodepthminus{\mathbin{\setbox0=\hbox{$-$}\dp0=0pt\box0}}
\def\noheightminus{%
\mathbin{%
\setbox0=\hbox{$-$}%
\dimen0=\fontdimen22\textfont2
\ht0=\dimen0
\dp0=0pt
\box0
}%
}

\setbox0=\hbox{$\displaystyle\sqrt{a+b}$}
\def\guide#1{%
\setbox0=\hbox{$\displaystyle\sqrt{#1}$}
\hbox to0pt{\vrule width 2in height -\the\dp0 depth \the\dimen0 \hss}%
}

$$\guide{a+c}\sqrt{a+c}\sqrt{a-c} \sqrt{a\nodepthminus c}\sqrt{a+c}$$

$$\guide{+}\sqrt{+}\sqrt{-} \sqrt{\nodepthminus}\sqrt{+}$$

$$\guide{+}\sqrt{+}\sqrt{-} \sqrt{\noheightminus}\sqrt{+}$$

\bye


The difference is tiny, but noticeable.

• Very nice demonstration of the effect, thanks! – Antony Lee Jan 29 at 10:17

I have not checked, but AFAIR the bounding box for the minus sign is the same as for the plus sign. This makes sure that expressions like $x-z$ and $x+z$ are equally aligned.

• I can confirm this hypothesis. Alignment of plus and minus signs is extremely important in published math, and, after all, that's what TeX is designed for. A comment regarding this is almost certainly present in the .mf file where plus and minus are defined; I haven't checked, and my copy of volume E (The Computer Modern Fonts) isn't readily accessible. – barbara beeton Jan 29 at 1:32
• @barbarabeeton In cmbase.mf there is indeed a function beginarithchar with the comment "ensure consistent dimensions for $+$, $-$, etc.". – Ralf Stubner Jan 29 at 6:36