0
\hat{y} = \hat{f}(x) = \overset{C}{argmax}\underset{c=1}\> p(y = c|x, D)

produces this:

enter image description here

How can I use \underset to get c=1 under argmax?

Ben
  • 3

2 Answers2

3

I would suggest not using \underset and \overset but instead declaring argmax as an operator. In that way, argmax is also typeset correctly.

enter image description here

\documentclass{article}
\usepackage{amsmath}

\DeclareMathOperator*{\argmax}{argmax}

\begin{document} [ \hat{y} = \hat{f}(x) = \argmax_{c=1}^{C}> p(y = c|x, D) ] \end{document}

  • 1
    @kb9alpp This is the correct answer. In KaTeX and LaTeX you can do \operatorname*{argmax}_{c=1}^C that will do the right thing as well. Unfortunately KaTeX doesn't know \DeclareMathOperator. Anyway, KaTeX specific questions are off-topic on the site. – egreg May 05 '22 at 16:54
  • Perfect!! Thanks! The one line \hat{y} = \hat{f}(x) = \argmax_{c=1}^{C}\> p(y = c|x, D) works. – Ben May 05 '22 at 16:57
  • I didn't realize the katex tag, sorry. I can't provide a suitable answer for KaTeX. If anyone else can, feel free :) –  May 05 '22 at 16:57
0

Just put the \underset part inside the argument of the \overset:

\documentclass{article}
\usepackage{mathtools}

\begin{document}

[ \hat{y} = \hat{f}(x) = \overset{C}{\underset{c=1}{argmax}}> p(y = c|x, D) ]

\end{document}

Edit: also, argmax isn't typeset correctly, it's an operator and shouldn't be rendered with slanted letters.

Miyase
  • 2,544
  • 2
  • 12
  • 26