2

I wanted to get theta below argmax in the middle

I wanted to get theta below argmax in the middle . I used the following code:

\usepackage{amsmath,amssymb,graphicx,enumerate,algorithm}
\begin{document}
$\theta_i$ = $argmax_{\theta} Q(\theta, \theta_i)$
\end{document}
  • (1) welcome, (2) the limit only goes under the argmax when it is used in display math context, you are using $...$ which is inline math mode, there the limit is not shown below argmax as it will disturb the line spacing. – daleif Aug 10 '16 at 7:02
  • BTW: next time please provide a full example, you are missing the document class. Besides in your formula, the two middle $ are not needed, the = should also be math mode – daleif Aug 10 '16 at 7:03
  • You can highlight code in your post using back-ticks. For code-blocks indent them by four spaces or use the {} on the gui. – user30471 Aug 10 '16 at 7:07
2

I think you are looking for an operator \argmax which can be defined in the following way (needs amsmath)

\DeclareMathOperator*{\argmax}{arg\,max}

To have "theta below argmax in the middle" in inline math, you have to specify \limits when using it.

MWE:

\documentclass{article}

\usepackage{amsmath}

\DeclareMathOperator*{\argmax}{arg\,max}

\begin{document}

\noindent Inline math: $\theta_i = \argmax\limits_{\theta} Q(\theta, \theta_i)$

\bigskip\bigskip

\noindent Displayed math

\[\theta_i = \argmax_{\theta} Q(\theta, \theta_i)\]

\end{document} 

Output

enter image description here

| improve this answer | |
  • @egreg I could get the format of code for answers and questions by using the back-quote but same didn't work for writing a code snippet in the comment section. Could you please explain? – MSKantulu Aug 10 '16 at 10:22
  • @MSKantulu Comments obey slightly different rules; for instance, in order to print \\ you need double back quotes. – egreg Aug 10 '16 at 10:25
  • @egreg can you give any helping link for these formatting stuffs in comments? The double back quotes didn't get me on the next line – MSKantulu Aug 10 '16 at 10:33
  • @MSKantulu Look at posts under meta.tex.stackexchange.com/search?q=code+comment – egreg Aug 10 '16 at 10:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.