22

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\}$$

example

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?

Caramdir
  • 89,023
  • 26
  • 255
  • 291
Dror
  • 22,613
  • @Dror with a minimal using amsmath it looks the same to me, can you post a minimal? – yannisl Jan 04 '11 at 06:55
  • 2
    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 04 '11 at 07:08
  • Of course, I meant to say it is not typeset at a different size. – TH. Jan 04 '11 at 07: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 04 '11 at 07: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 04 '11 at 07:59
  • @Dror: Because max, min, and inf don't have characters that descend below the baseline. As for a reason to keep the old version or not, it's up to you. Herbert says it looks ugly without it. I'm not sure I have an opinion on it. The difference is so slight, that I don't think I'd notice it. So it's up to you. – TH. Jan 04 '11 at 09:58

3 Answers3

19

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) \]

example

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).

Caramdir
  • 89,023
  • 26
  • 255
  • 291
6

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 04 '11 at 08:01
  • sure, it looks ugly when I use it without a preceeding \sup –  Jan 04 '11 at 09: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 04 '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. –  Jan 04 '11 at 10:09
2

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

Philipp
  • 17,641