[Tex/LaTex] Vertical align \underset

alignequationsvertical alignment

I have this equation:

\lim_{d \rightarrow \infty} \left [ \underset{a\leq x\leq b}{\mathrm{max}_p} \left | f(x) - m(x) \right | \right ] = 0

which produces this:

equation

As you can see the max part is not vertically aligned inside the brackets. The lim is also not aligned with the brackets. I want it to look something like this:

equation2

As you can see, the lim and max part is now properly aligned. The absolute | | height should also be adjusted to fit the height of the \underset part of max.

Anyone know how to do this?

Best Answer

The names ‘lim’ and ‘max’ should be at the same level as ‘f’; also the absolute value bars should be as high as necessary to cover the material inside them; what's before the opening bar is irrelevant as far as the absolute value is concerned.

This is a case where \left and \right are plainly wrong, because they produce too large delimiters. I don't think the square brackets are necessary, because ‘maxp’ has obvious precedence over ‘lim’.

Here are two realizations, with and without the brackets; note the definition of the \maxp operator. In the first realization, a thin space \, has been added in order for the bracket not to clash with the subscript.

\documentclass{article}
\usepackage{amsmath}

\DeclareMathOperator*{\maxp}{max_{\mathnormal{p}}}

\begin{document}
\[
\lim_{p\to\infty}
  \Bigl[
    \,\maxp_{a\le x\le b} \lvert f(x)-m(x)\rvert
  \Bigr]
\]
\[
\lim_{p\to\infty} \maxp_{a\le x\le b} \lvert f(x)-m(x)\rvert
\]
\end{document}

enter image description here

You may want to look at \adjustlimits from the mathtools package:

\documentclass{article}
\usepackage{amsmath,mathtools}

\DeclareMathOperator*{\maxp}{max_{\mathnormal{p}}}

\begin{document}
\[
\adjustlimits\lim_{p\to\infty} \maxp_{a\le x\le b} \lvert f(x)-m(x)\rvert
\]
\end{document}

but I'd prefer the former realization.

enter image description here