9

In some places in my document I have used the following (and it works quite well):

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator*{\argmax}{argmax} % thin space, limits underneath in displays

\begin{document}

\[z = \argmax_x f(x)\]

\end{document}

enter image description here

However, when I try to use something like this:

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator*{\argmax}{argmax} % thin space, limits underneath in displays

\begin{document}

    \begin{tabular}{c l}
        $z = \argmax_x f(x)$ \\
        $z = \argmax_{x \in \mathcal{X}} f(x)$
    \end{tabular} 

\end{document}

It does not work anymore. It seems that tabular is somehow to blame here.

enter image description here

UPDATE2: Well, it was clearly because I was using inline math ($). Thanks David!

6
  • 1
    please always post a complete document that shows the problem. I made a complete document as in the answer below but it is not clear what the issue is? Commented May 18, 2017 at 11:10
  • 2
    well of course, you have used inline math there $ so get the inline form not the display layout. and it applies to both cases so the "works" "not works" in the original part of the question is misleading Commented May 18, 2017 at 11:20
  • if you want aligned display use an enviornment for that such as align not tabular Commented May 18, 2017 at 11:22
  • I will edit so it is clearer. Thanks! Could you update your answer with a short example using aligned? that would be awesome!
    – Juan Leni
    Commented May 18, 2017 at 11:25
  • see this answer for reasons why TeX sets limits to the side in inline math tex.stackexchange.com/questions/323367/… Commented May 18, 2017 at 11:32

2 Answers 2

12

enter image description here

It isn't clear what you mean by "not work" the output is as I expect.

\documentclass{article}

\usepackage{amsmath}
\DeclareMathOperator*{\argmax}{argmax} % thin space, limits underneath in displays

\begin{document}



a
\[z = \argmax_x f(x)\]

b
\[z = \argmax_{x \in \mathcal{X}} f(x)\]

\end{document}

Updated question shows it is just an issue of display or inline setting:

enter image description here

\documentclass{article}

\usepackage{amsmath}
\DeclareMathOperator*{\argmax}{argmax} % thin space, limits underneath in displays

\begin{document}



a
\[z = \argmax_x f(x)\]

b
\[z = \argmax_{x \in \mathcal{X}} f(x)\]

a2
$z = \argmax_x f(x)$

b2
$z = \argmax_{x \in \mathcal{X}} f(x)$


a3 (don't do this)
$z = \argmax\limits_x f(x)$

b3 (or this)
$z = \argmax\limits_{x \in \mathcal{X}} f(x)$


c
\begin{align*}
z &= \argmax_x f(x)\\
z &= \argmax_{x \in \mathcal{X}} f(x)
\end{align*}




\end{document}
2
  • Thanks david! I was expecting exactly that! There is likely something else going on in my document. I will try to reproduce the problem in a small doc.
    – Juan Leni
    Commented May 18, 2017 at 11:12
  • @purpleTentacle answer updated Commented May 18, 2017 at 11:27
11

Try using \underset{belowtext}{text}.

Note below that:

  • \mathrm is for using non-italics Roman font in math mode.
  • \, is for adding a thin space
z = \underset{x}{\mathrm{argmax}}\, f(x)

enter image description here

You must log in to answer this question.

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