Feed on

to write argmax with respect to some variable (i.e. theta), code:


Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

22 Responses to “how to write argmax in latex”

  1. on 31 Jul 2006 at 12:11 pm Hirak

    Nice blog for LATEX stuff. Keep it up!
    The above works quite well though it leaves an extra space between the ARG and MAX. To avoid it use the negative space command:

    arg ! max_theta


  2. on 31 Jul 2006 at 12:12 pm Lawrence David

    cool tip! learned my new trick of the day :)

  3. on 10 Aug 2006 at 11:05 am Nacho Martin

    Nice tip!

    An very useful at this precise moment :)

  4. on 15 Sep 2006 at 4:14 pm Rafa

    you are #1 when one googles “argmax latex”
    you saved me from opening the stupid latex manual

  5. on 19 Sep 2006 at 9:55 am js

    with this solution the subscripted variable will appear centered beneath the word “max”, instead of centered beneath the whole word. i found a way to solve this on wikipedia:

    place the following command in the header of your latex document:


    now you can use it like this:


  6. on 19 Oct 2006 at 8:01 pm wannabecon

    just a correction, it should be


  7. on 23 May 2007 at 12:50 pm yur



  8. on 11 Oct 2007 at 8:36 pm Bill McNeill

    For the operatornamewithlimits trick to work you have to \usepackage{amsmath}.

  9. on 02 Oct 2008 at 10:26 am aster

    nice one

  10. on 29 Oct 2008 at 2:55 pm Ryan

    Yeah, I like the \DeclareMathOperator* solution much better. If you’re using LaTeX, you might as well get all the alignment correct, right?

  11. on 06 Nov 2008 at 1:42 pm ganesh

    Thanks for this tip. It was very useful

  12. on 12 Mar 2009 at 9:35 pm Luke

    Sweet. Thanks for the tip!
    Still helping in 2009

  13. on 22 Mar 2009 at 2:50 pm sth4nth


  14. on 27 Mar 2009 at 6:40 pm Sean

    Yeah,\newcommand{\argmax}{\operatornamewithlimits{argmax}} didn’t quite do the job for me, but when combined with the underset it works great ^_^

    Thanks to all!

  15. on 11 May 2009 at 4:18 pm Jake

    Awesome! Useful post and comments :) Thanks!

  16. on 03 Aug 2009 at 9:49 am brais


    \newcommand{\argmax}{\operatornamewithlimits{argmax}} combined with the use of package amsmath is fine for the environment “displaymath” and similar, but whenever used with $$ (for using it “inside” the text) is not working properly. \underset{x}{\operatorname{argmax}} solves this problem

    thanks a lot!! (never thought that would get so complicated!)

  17. on 02 Dec 2009 at 11:58 am hi


  18. on 29 Jan 2010 at 9:21 am gokhan

    Thanks a lot to everyone! the last one, i was able to get it worked correctly.

  19. on 10 Mar 2010 at 1:56 am palash

    Thanks all.

  20. on 25 Jun 2011 at 6:21 am xixi

    Sweet, work in LyX as well.

  21. on 09 Jul 2011 at 5:33 am ben

    the last one didn’t work for me using WinEdt 6.0, this worked instead:


  22. on 31 May 2012 at 4:46 pm andrew


Did I get this wrong? Let me know!

Trackback URI | Comments RSS