I am trying to use the argmin
and the argmax
commands that I defined in an algorithm but I keep getting the argument not in the middle but on the right. Does anyone have an idea how to put the argument in the middle.
I declare the operators:
\DeclareMathOperator*{\argmin}{\arg\!\min}
\DeclareMathOperator*{\argmax}{\arg\!\max}
and I use the following packages to write algorithms:
\usepackage[chapter]{algorithm}
\usepackage{algorithmic}
Full algorithm code:
\begin{algorithm}
\begin{algorithmic}
\STATE some statement here
\WHILE{!stop}
\STATE $s_{i} = \argmin_{p} \| l_{j} - s_{p} \|$
\ENDWHILE
\end{algorithmic}
\end{algorithm}
Best Answer
$
introduces text style, you will need either\displaystyle
or\limits
.(
\sum
,\int
,\lim
, … behave in the same manner: Display-style formulas have their super- and subscripts above and below the sign, in text-style formulas they are typeset like normal super- and subscripts.)If you find both solutions unsatisfying you can define an additional command that has
\limits
built in:or with your original macro names having that feature:
But than you could just make it without
\DeclareMathOperator*
:I have also declared your operators with out the predefined operators
\arg
and\max
as operators are usually in upright font anyway, and then there's no need to re-adjust the space manually (the\!
).Code A (
\limits
)Code B (
\displaystyle
)Code C (built in
\limits
)Output