# Undefined control sequence. [$$\underset] \documentclass{article} \begin{document}$$\underset {{x}_1,{h}_1,{m}_2,{b}_2}{max} {u}_1(x)_1-{h}_1+{\beta}_1{W}_2({m}_2,{b}_2)$$\end{document}  This is the problem I met, sublime text can display the equation but when I run this code, a warning "Undefined control sequence. [$$\underset]" showed.

Welcome! You should not use \underset here but the \max operator. Nor should you use $$...$$ but $...$ instead. (I am also wondering why you wrap so many symbols in {...}.)

\documentclass{article}
\begin{document}
$\max_{x_1,h_1,m_2,b_2} u_1(x)_1-h_1+\beta_1W_2(m_2,b_2)$
\end{document}


The \underset command requires amsmath.

\documentclass{article}
\usepackage{amsmath}    % <----- don't forget

\begin{document}

$\underset{x+y+z}{a+b+c+d+e+f+g}$

\end{document}


On the other hand, you don't need \underset for your case, as already suggested. The “max” operator is obtained with the command \max and

$\max_{1\le k\le n} x_k$


will yield the expected output.

I keep seeing code plagued with \underset{x\rightarrow 0}{lim}, where the simpler

\lim_{x\rightarrow 0}


would suffice, besides producing a better output.

\documentclass[12pt]{article}
\usepackage{mathtools}
\begin{document}

$$\underset {{x}_1,{h}_1,{m}_2,{b}_2}{max} {u}_1(x)_1-{h}_1+{\beta}_1{W}_2({m}_2,{b}_2)$$
\end{document}

• Please write \max, not max.
– Mico
May 6 '20 at 4:46
• Sorry, but this is bad advice. May 6 '20 at 9:39