Jan 26, 2010

Max/Min Problems in LaTeX

Suppose you want to write a maximization or minimization problem in LaTeX, and you want the variables that you are maximizing with respect to under the "max" keyword, kinda like this:

Unfortunately out of the box LaTeX can't do this, but there's a handy little trick. Right before the \begin{document} put:
\usepackage{amsmath}
\DeclareMathOperator*{\Max}{Max}
\begin{document}
Then to write the max problem above you can put:
V(p, y) = \Max_x U(x) : p \cdot x \le y

5 comments:

Anonymous said...

\max (lower case) works out of the box.

Rob Britton said...

The issue with \max is that it doesn't put subscripts underneath it. Suppose I put:

\max_{x,y}

This puts max with the x,y as a subscript to the right. That's not the behaviour I was looking for.

Anonymous said...

you could try adding
\displaystyle
to the math environment

Anonymous said...

$\max_x$ will put x to the right.
$$\max_x$$ will put x below.

Veronica said...

Just use \displaystyle inside $ $ and before min_ or max_.
For example:
$\displaystyle \min_x$ will produce the wanted result.