Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can you get the argmin or argmax in Latex? Two solutions I found are:

\underset{x}{\operatorname{argmax}} 

\DeclareMathOperator*{\argmin}{arg\,min}

Any other ideas?

[1] http://www.breakthru.altervista.org/?p=27

[2] http://researchonsearch.blogspot.com/2007/05/enter-argmax-argmin-in-latex.html

share|improve this question
21  
How do these solutions (especially the second) feel not right? The \DeclareMathOperator is the way to go in this case. –  Pieter Nov 11 '10 at 17:57
5  
No, it does not use italics. Did you try it? –  Jukka Suomela Nov 11 '10 at 19:18
    
You are right. I tried before but forgot the \ in front of \argmin. Stupid me. –  Alejandro Nov 11 '10 at 21:24
4  
It would really help, when asking this kind of questions, to specify what is wrong with the solutions you found, and what features are you actually looking for. –  Jan Hlavacek Nov 12 '10 at 3:37

4 Answers 4

up vote 57 down vote accepted

As Pieter says in his comment, \DeclareMathOperator*{\argmin}{arg\,min} is indeed the correct LaTeX way to do that.

This requires \usepackage{amsmath} (actually amsopn would be sufficient, it's automatically loaded by amsmath which is recommended for math typesetting anyway).

Note: the * that follows \DeclareMathOperator sets the underscored option (the argument) underneath the operator like the \lim operator.

share|improve this answer
21  
If you use \DeclareMathOperator*{\argmin}{\arg\!\min} you get rid of the ugly space between arg and min. –  rbp Apr 6 '11 at 21:39
9  
@rbp Why should one use \arg\min when simply argmin does the same? –  egreg Jul 8 '12 at 15:31
1  
@egreg you're right. I arrived at this one from some experimentation with other options, and didn't look back :) –  rbp Jul 9 '12 at 11:56
1  
And don't forget to load the "amsmath" package... \usepackage{amsmath} \DeclareMathOperator*{\argmin}{arg\,min} etc. –  user24477 Jan 16 '13 at 15:49
3  
In ConTeXt that is: \definemathcommand [argmin] [limop] {\mfunction{arg\,min}} –  mb21 Jul 30 '13 at 11:49

I use \newcommand{\argmin}{\operatornamewithlimits{argmin}}.

share|improve this answer
    
+1 I like this - why overcomplicate things? This looks exactly the same as the \DeclareMathOperator* answer. –  zelanix Aug 13 at 13:52

or you could use the underset command. For example:

    R = \underset{n} {\mathrm{argmax}} ~P(L_n|\mathbf{x})
share|improve this answer
6  
Please don't use this. This makes argmin a mathord rather than a mathop and the spacing is incorrect. Moreover, this will not automatically adjust the limits in inline math mode. –  Aditya Sep 19 '13 at 15:19

Just another alternative (in some sense the poorer solution around), could be to define \argmin in terms of \min and \arg commands.

\newcommand{\argmin}{\arg\!\min}

In this way, 1) \argmin will behave always the same way as \min, 2) doesn't need amsmath or care about \operator... commands 3) yes, the variable in not centered (it is centered in the min part), but that may even be what you want (since it is centered in the same ways a \min, also the 'g' in \arg doesn't further lower the under-argument).

\documentclass[fleqn]{article}
\newcommand{\argmin}{\arg\!\min}
\begin{document}

\[ \argmin_x f(x) = \{x | f(x) = \min_{x'} f(x')\} \]
\[ \min_x f(x) = \{f(x) | f(x) < f(x_0) \forall x_0 \in R \]

\end{document}

argmin

share|improve this answer
1  
This doesn't look like a good idea. \argmin_{x\in X\cap Y} f(x) will break it completely. –  tohecz Feb 2 at 18:03
    
What is the \arg command for anyway? –  Thomas Ahle Jun 3 at 12:47
1  
@ThomasAhle, arg is for the argument function (angle in the complex plane, $z = |z| e^{i \arg z}$. tohecz is right by the way. –  alfC Jun 3 at 15:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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