[Tex/LaTex] Depth and height confusion

dimensionsequationsheightmath-mode

I create two equations:

  1. $x \notin \mathbb{N}$; and
  2. $x \in \mathbb{N}$.

As it turns out, both have the same depth value:

  1. Depth = 0.39098pt
    Height = 7.5pt

  2. Depth = 0.39098pt
    Height = 6.88889pt

Clearly the first equation should have a larger depth than the second one, because the \notin sign goes deeper.

How can this be?

This is the code that is used to generate the two:

\documentclass[10pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[usenames]{color}


\pagestyle{empty}
\newsavebox{\eqbox}
\newlength{\width}
\newlength{\height}
\newlength{\depth}

\begin{lrbox}{\eqbox}
{$ x \notin \mathbb{N} $}
\end{lrbox}

\settowidth {\width}  {\usebox{\eqbox}}
\settoheight{\height} {\usebox{\eqbox}}
\settodepth {\depth}  {\usebox{\eqbox}}
\newwrite\file
\immediate\openout\file=\jobname.bsl
\immediate\write\file{Depth = \the\depth}
\immediate\write\file{Height = \the\height}
\addtolength{\height} {\depth}
\immediate\write\file{TotalHeight = \the\height}
\immediate\write\file{Width = \the\width}
\closeout\file
\begin{document}
\usebox{\eqbox}
\end{document}

Could anyone tell me why that is?

Best Answer

Not always. The best way to look at this would be from a bounding-box perspective:

enter image description here

\documentclass[10pt]{article}
\usepackage{amssymb,xcolor}% http://ctan.org/pkg/{amslatex,xcolor}
\newcommand{\showbb}[1]{{\color{red!50}\leavevmode\rlap{\fbox{\phantom{#1}}}}#1}
\begin{document}

\setlength{\fboxsep}{-\fboxrule}
\showbb{$ x \notin \mathbb{N} $} \quad
\showbb{$ x \in \mathbb{N} $}
\end{document}

As mentioned, it's clear that the both have the same depth, but not height. Why? This is decided in the font specification for each of the symbols by the font designer. In some cases, the bounding box of a character/symbol depends on what follows it (like V followed by A, for example). In this case (or most likely) the depth of the symbol is set so that it doesn't influence the baseline skip.

One way to check this would be if you were to have two \notin symbols on two successive lines. If the symbol had any greater depth, the line separation would make the output look awkward... in just one location. To avoid this, and knowing that the "\not" part of the symbol is a single (thin) rule, it should not influence the reader if it stretches down further than expected.

Related Question