# Vertical align \underset

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:

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:

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?

-
Welcome to TeX.SX! Why would you do such thing? The functions lim and max are perfectly center-aligned. I would not touch that. The absolute-lines can be done by \bigl| f(x) - m(x) \bigr| –  LaRiFaRi Jul 15 at 11:35
Sorry, but the limit and max functions are not perfectly aligned in the second picture: they surely are wrongly aligned, according to every math book I've seen. The absolute value bars should be as high as to delimit their contents, what's below max is irrelevant. Your main error is to use \left[ and \right], where \Bigl[ and \Bigr] would probably look much better. –  egreg Jul 15 at 11:43
Is it meant to be max or max_p? –  Andrew Swann Jul 15 at 12:13

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}

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.

-
\documentclass{article}
\usepackage{amsmath}
\begin{document}

You have:

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

You say, that it is produced:

$\lim_{d \rightarrow \infty} \left [ \max_{a\leq x\leq b} \left | f(x) - m(x) \right | \right ] = 0$

You want:

$\lim_{d \rightarrow \infty} \left [ \max_{a\leq x\leq b} \left |\vphantom{ \max_{a\leq x\leq b}} f(x) - m(x) \right | \,\right ] = 0$

\end{document}

However, as it has been already mentioned, this behaviour is nonstandard and not recommended.

-

As egreg mentioned in comment, it does look wrong what you are trying to do (refering to the raised functions). The functions should stay vertically centered.

But here is, how it is done:

% arara: pdflatex

\documentclass{article}
\usepackage{mathtools}

\begin{document}
$\raisebox{.25\baselineskip}{\displaystyle\lim_{d \rightarrow \infty}} \Biggl[ \raisebox{.25\baselineskip}{\underset{a\leq x\leq b}{\mathrm{max}_p}} \bigl| f(x) - m(x) \bigr| \Biggr] = 0$
\end{document}

You can play around with the vertical measure. Maybe something like \raisebox{.8ex}{... could look good, too. Just try it until you are pleased.

Update:

A compromise could be that you try to get the subscripts/undersets on the same hight. This could look like below. If you need bigger absolute lines (I don't think you do), you could get one level up to \biggl| and \bigr|

% arara: pdflatex

\documentclass{article}
\usepackage{mathtools}

\begin{document}
$\textstyle\underset{d \rightarrow \infty}{\lim_{\vphantom{p}}} \Biggl[ \underset{a\leq x\leq b}{\max_p} \bigl| f(x) - m(x) \bigr| \Biggr] = 0$
\end{document}

-