TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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



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
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
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
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
up vote 101 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
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
@rbp Why should one use \arg\min when simply argmin does the same? – egreg Jul 8 '12 at 15:31
@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
And don't forget to load the "amsmath" package... \usepackage{amsmath} \DeclareMathOperator*{\argmin}{arg\,min} etc. – user24477 Jan 16 '13 at 15:49
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 '14 at 13:52
This yields "argmin". To get "arg min" (arguably the most usual notation), set it to {arg\,min}. – Waldir Leoncio Jan 21 at 16:38


In the sequel, LaTeX is assumed.

Preliminary questions

1. Should a thin space separate “arg” from “min”?

This is a matter of personal preference. The default definition for \limsup has a thin space, on the other hand “arcsin” is usually written without a space between the two components. Consistency is, as always, the keyword: using a macro definition will ensure it and also easiness in modifying the typesetting in the whole document, if switching from one option to another is needed.

2. Should limits go below the operator in display style?

Also this is debatable and conventions used in the field the document is written for should be followed.

3. Should the operator name be typeset upright?

Definitely, like all other operator/function names such as sine and cosine.

Available tools

1. amsmath

With amsmath one can do, in the preamble,

\DeclareMathOperator*{\argmin}{arg\,min} % thin space, limits underneath in displays
\DeclareMathOperator*{\argmin}{argmin} % no space, limits underneath in displays
\DeclareMathOperator{\argmin}{arg\,min} % thin space, limits on side in displays
\DeclareMathOperator{\argmin}{argmin} % no space, limits on side in displays

Of course, only one of these should be used. In the document it's sufficient to type \argmin and the spacing around the operator will be the right one according to the common rules of math typesetting.

The seemingly different


is not really so, because it's essentially the same as \DeclareMathOperator*{\argmin}{argmin}; moreover it uses a deprecated command, that should be \operatorname*.

2. No package

The following definitions are very similar to the ones above, in the same order


With \underset


This also was mentioned in the question and in one answer, but it is wrong, as the visual comparison will show.

3. Differences

The “no package” version is much more rigid than the amsmath version, because this package can receive the nonamelimits option that will automatically change all operators such as \lim, \max that usually have limits underneath (in displays) to have them on the side. The same option would of course act also on newly defined operators, provided \DeclareMathOperator* has been used.

Test document

In the following test document, the proposed definitions or constructions will be compared.


% limits underneath
\DeclareMathOperator*{\argminA}{arg\,min} % Jan Hlavacek
\DeclareMathOperator*{\argminB}{argmin}   % Jan Hlavacek
\DeclareMathOperator*{\argminC}{\arg\min}   % rbp

\newcommand{\argminD}{\arg\!\min} % AlfC

\newcommand{\argminE}{\mathop{\mathrm{argmin}}}          % ASdeL
\newcommand{\argminF}{\mathop{\mathrm{argmin}}\limits}   % ASdeL

% limits on side
\DeclareMathOperator{\argminG}{arg\,min} % Jan Hlavacek
\DeclareMathOperator{\argminH}{argmin}   % Jan Hlavacek
\newcommand{\argminI}{\mathop{\mathrm{argmin}}\nolimits} % ASdeL



&\cs{argminA}  & \argminA_x f(x) &= \{x \mid f(x) = \min_{x'} f(x')\} \\
&\cs{argminB}  & \argminB_x f(x) &= \{x \mid f(x) = \min_{x'} f(x')\} \\
&\cs{argminC}  & \argminC_x f(x) &= \{x \mid f(x) = \min_{x'} f(x')\} \\
&\cs{argminD}  & \argminD_x f(x) &= \{x \mid f(x) = \min_{x'} f(x')\} \\
&\cs{argminE}  & \argminE_x f(x) &= \{x \mid f(x) = \min_{x'} f(x')\} \\
&\cs{argminF}  & \argminF_x f(x) &= \{x \mid f(x) = \min_{x'} f(x')\} \\
&\cs{underset} & \underset{x}{\mathrm{argmin}} f(x) &= \{x \mid f(x) = \min_{x'} f(x')\}\\
&\cs{argminG}  & \argminG_x f(x) &= \{x \mid f(x) = \min_{x'} f(x')\} \\
&\cs{argminH}  & \argminH_x f(x) &= \{x \mid f(x) = \min_{x'} f(x')\} \\
&\cs{argminI}  & \argminI_x f(x) &= \{x \mid f(x) = \min_{x'} f(x')\}


enter image description here


As predicted, many lines typeset the same. However, the macros defined with \mathop will not obey the nonamelimits option. Also the result of \argminD is clearly wrong, as the limit is typeset below “max” and not below the whole operator name.

The construction with \underset is wrong because it will not use the correct spacing after the operator: a thin space follows all others and it is the right way to typeset. Compare \sin x and \mathrm{sin}x to see this thin space in a different context.

Note that \argminC and \argminA give the same result, as well as \argminD and \argminB. Explanation: \arg and \max are already defined as operators, so TeX inserts a thin space if one directly follows another one. Using \argminC or \argminD just makes TeX spin its wheels a little more, with no advantage over \argminA or \argminB.

share|improve this answer

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


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).


\[ \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 \]



share|improve this answer
This doesn't look like a good idea. \argmin_{x\in X\cap Y} f(x) will break it completely. – yo' Feb 2 '14 at 18:03
What is the \arg command for anyway? – Thomas Ahle Jun 3 '14 at 12:47
@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 '14 at 15:33

or you could use the underset command. For example:

    R = \underset{n} {\mathrm{argmax}} ~P(L_n|\mathbf{x})
share|improve this answer
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

I would use \mathop and \mathrm, and eventually \limits or \nolimits, depending on the desired behavior when combined with _ and ^. See below.






share|improve this answer

This works without any additional package. However it will create a new line.

$$\pi(s) = arg\max_\theta$$
share|improve this answer
$$...$$ is not recommended to use with LaTeX. Better use \[ ... \] for correct vertical spacing. – Stefan Kottwitz Dec 20 '15 at 20:17
This solution will not typeset argmax correctly. Here arg will be in italic (and with bad spacing), and max will be upright. – Håkon Marthinsen Dec 20 '15 at 20:17

Your Answer


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.