For some times I've faced the problem with an absence of an operator \argmax and one should use arg\max which is not nice. Usually in LaTeX one uses DeclareMathOperator. In MathJaX help on the right side of the page this operator is also described - but it doesn't work when you try to write the post on the site. Is it possible to fix it?


1 Answer 1


The \DeclareMathOperator macro makes the argument a math operator with limits above and below. This can be achieved on an ad-hoc basis by using the \mathop{...} command, which turns what is inside the declaration into a mathoperator, followed by the \limits command, which will place limits above and below (in essence, you are just typing out what the DeclareMathOperator does).

So, for example, you can do $\mathop{\arg\,\max}\limits_x$ to produce $\mathop{\arg\,\max}\limits_x$.

I know it's a chore and not necessarily a good solution, but at least you get a good outcome. (Also, I suspect that enabling macros like \DeclareMathOperator occurs at the Mathjax level, rather than the stackexchange level, but I could be wrong).

  • $\begingroup$ It seems to me that you're right and thanks anyway for the solution. On the other hand, Declare[...] is presented in MathJaX help (which indeed seems to be just a LaTeX howto) - that's why I thought that it's realized in MathJaX. $\endgroup$
    – SBF
    Apr 11, 2011 at 17:12
  • 3
    $\begingroup$ @Gortaur: Well, for me the \DeclareMathOperator environment works. You just have to make sure you put it inside a math environment (that is, between $ or $$ or \\[) so that it can be seen by the MathJax engine. $\endgroup$
    – t.b.
    Apr 11, 2011 at 17:21
  • 1
    $\begingroup$ @Theo: Oh, I never bothered to test it. There you go. $\endgroup$ Apr 11, 2011 at 17:23
  • 2
    $\begingroup$ @Gortaur: I use them sparingly because I'm not sure about the scope (it certainly affects the entire post, but it might be the entire page) and I don't want to mess with other posts. It produces some ugly spacing where insertet, so I usually put declarations at the end of a paragraph if I really need them. $\endgroup$
    – t.b.
    Apr 11, 2011 at 17:30
  • $\begingroup$ Ok, thank you . $\endgroup$
    – SBF
    Apr 11, 2011 at 17:39
  • $\begingroup$ Put a \! between the \arg and \max to get rid of that ugly space. $\endgroup$
    – JeremyKun
    Jan 16, 2014 at 16:29

You must log in to answer this question.

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