Supremum of the infimum

Consider the following snippet:

$$\text{d}_{H}(A,B) = \max\left\{ \sup_{a\in A} \inf_{b\in B} \text{d}(a,b),\sup_{b\in B} \inf_{a\in A}\text{d}(a,b)\right\}$$


In the output, the text under the inf's is significantly smaller then the one under the sup's. The same happens when I have it in an align environment.

You can see the same problem in the wiki definition of the Hausdorff distance. How can I have the typeset under the inf's and sup's in the same size?

-
@Dror with a minimal using amsmath it looks the same to me, can you post a minimal? – Yiannis Lazarides Jan 4 '11 at 6:55
It is not typeset any differently. As Herbert points out, there is a height difference because inf does not descend below the baseline. You can add \let\inf\relax \DeclareMathOperator*\inf{\vphantom{p}inf} in the preamble to have them be at the same height. You can do the same for \max and \min, if you want. – TH. Jan 4 '11 at 7:08
Of course, I meant to say it is not typeset at a different size. – TH. Jan 4 '11 at 7:11
@Yianis: I am using amsmath and it does look odd in my case (same oddness as you can see on the wiki link). – Dror Jan 4 '11 at 7:56
@TH: It's amazing how illusive it looks. Anyway, your solution worked for me. Is there a reason to keep the old \inf? Why this is the behavior for \max, \min and \inf but not for \sup? – Dror Jan 4 '11 at 7:59

To elaborate on @Philipp's answer: The mathtools package provides \adjustlimits, which corrects the spacing of the limits of two adjacent operators. In your example, you would use it like

$\adjustlimits\sup_{a\in A} \inf_{b\in B} \mathrm{d}(a,b)$


Btw, if you are using LaTeX, you should use $...$ instead of $$...$$ and \mathrm or \operatorname instead of \text for the d (so that it will not inherit properties (like italics) from the surrounding text).

-
As \def seems to be not recommended for regular usage, I believe this is the best solutions. Which also works for me. – Dror Jan 4 '11 at 16:52
Should there be a closing \] in there somewhere? – asmeurer Dec 8 '12 at 22:41
@asmeurer: yes, of course. – Caramdir Dec 9 '12 at 16:44

it is a problem with the depth of \inf which is zero. Use it this way:

\documentclass{article}
\usepackage{amsmath}

\def\Inf{\operatornamewithlimits{inf\vphantom{p}}}

\begin{document}

$\text{d}_{H}(A,B) = \max\left\{ \sup_{a\in A} \Inf_{b\in B} \text{d}(a,b),\sup_{b\in B} \Inf_{a\in A}\text{d}(a,b)\right\}$

\end{document}

-
Your solution also works, but then I have two different definitions for inf. This can cause confusions. Do you have a specific reason to keep the original \inf? – Dror Jan 4 '11 at 8:01
sure, it looks ugly when I use it without a preceeding \sup – Herbert Jan 4 '11 at 9:42
I see. So the whole problem is caused because of the combination of \sup and \inf and the p in the \sup, right? – Dror Jan 4 '11 at 10:06
@Dror: yes, that is always a problem when having two consecutive operators with limits and not the same depth of the characters. – Herbert Jan 4 '11 at 10:09

See section 3.1.4 of the mathtools package manual for a description and a generic solution.

-