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?

6
  • @Dror with a minimal using amsmath it looks the same to me, can you post a minimal?
    – yannisl
    Commented Jan 4, 2011 at 6: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.
    Commented Jan 4, 2011 at 7:08
  • Of course, I meant to say it is not typeset at a different size.
    – TH.
    Commented Jan 4, 2011 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
    Commented Jan 4, 2011 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
    Commented Jan 4, 2011 at 7:59

3 Answers 3

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

3
  • As \def seems to be not recommended for regular usage, I believe this is the best solutions. Which also works for me.
    – Dror
    Commented Jan 4, 2011 at 16:52
  • Should there be a closing \] in there somewhere?
    – asmeurer
    Commented Dec 8, 2012 at 22:41
  • @asmeurer: yes, of course.
    – Caramdir
    Commented Dec 9, 2012 at 16:44
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}
4
  • 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
    Commented Jan 4, 2011 at 8:01
  • sure, it looks ugly when I use it without a preceeding \sup
    – user2478
    Commented Jan 4, 2011 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
    Commented Jan 4, 2011 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.
    – user2478
    Commented Jan 4, 2011 at 10:09
2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .