15

I just noticed an annoying discrepancy involving the \times symbol's depth. Read the below code and then try to guess what it should look like:

\documentclass{article}
\begin{document}
\fbox{$A$} \fbox{$B$}

\fbox{$A \times A$} \fbox{$B$} \hrule
\end{document}

If you typeset this, you will see that the top line is perfectly level, while the \hrule is noticeably below the second B and the box around $A \times A$ is noticeably deep. Yet, I would consider both $A$ and $A \times A$ to be text-height and zero-depth expressions. Now replace \times by \smash\times and you will see the problem go away; unfortunately, you will also see the spacing break since \smash ruins the math-operatorness of \times.

Am I right? \times has a nearly invisible depth and this distorts the center of expressions, otherwise having no depth, in which it is written. How should I work around this?

Ryan Reich
  • 37,958
  • 4
    Note that this effect depends on the math typeface you use. A quick check of the following Type1 typefaces gives the following results -- Problematic \times: Computer Modern, AMS Fonts (CM), Arev Math, CM Bright, Euler VM, Math Design, Pazo (mathpazo). No problem: Adobe Minion Pro, Fourier, JAM Times (Belleek), Kepler Project, MT Pro2 (commercial), txfonts. – Geoffrey Jones Nov 23 '10 at 13:35
  • 1
    @Geoffrey Jones: Well, that's a valuable list. Thanks! Note: other operators may have this problem too. \otimes has a visible depth, for example (in CM). I haven't done any sort of testing, though. – Ryan Reich Nov 23 '10 at 13:43

2 Answers2

12

You can \smash the \times, being careful to add a \mathbin too keep the spacing right:

\documentclass{article}
\begin{document}
\fbox{$A$} \fbox{$B$}

\fbox{$A \times A$} \fbox{$B$} \hrule

\fbox{$A \mathbin{\smash\times} A$} \fbox{$B$} \hrule
\end{document}
6

Philippe gave you a good answer how to solve your problem. I'd like to explain why I think that the depth of \times is a feature and not a bug. As you observed, \otimes has a visible depth. Also +, \oplus and friends have a visible depth. Now the feature of the CM fonts is that all these symbols, including \times and even -(!!!) have the same depth. This can be very useful if, e.g., you have both A\times B and A\otimes B; it wouldn't look nice if there the spacing is different. This won't happen often, but think of A+B and A-B!

Hendrik Vogt
  • 37,935
  • 1
    It is most definitely a feature. Knuth talks about it in a Q&A session transcripted in http://www.ntg.nl/maps/16/15.pdf#page=9 (it's the question by Johannes in the right column of page 9 of the PDF; it can also be found in Knuth's Digital Typography book, page 645). – Philippe Goutet Nov 23 '10 at 18:39
  • This is an important point, I think. In fact, it suggests that my problem is a bug on my side rather than TeX's (or, in this case, tikz's), since if this visible depth actually causes misalignment it's probably because I have failed to align the symbols along their baselines. I think I'll go back and fix that now. – Ryan Reich Nov 23 '10 at 21:28