I am using the following definition to generate the argmax operator:
\DeclareMathOperator*{\argmax}{\arg\!\max}
However the problem is when I use it in a part that some text exists because of the written argument under argmin the next line appears with a abnoraml distance in order to keep the distance from the argument under argmin. However when I use \frac for example, this time, the proportion adjusts itself to not to overlap with the next line. How can I change the above command to behave like the frac?
Examples:
\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator*{\argmax}{\arg\!\max}
\begin{document}
This is a test. This is a test. $\argmax\limits_{x}{x^2}$ This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
\end{document}
With output 
As opposed to:
\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator*{\argmax}{\arg\!\max}
\begin{document}
This is a test. This is a test. $\frac{x}{x^2}$ This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test.
\end{document}
With output

$\argmax_{x}{x^2}$instead of$\argmax\limits_{x}{x^2}$. – moewe Nov 03 '13 at 14:36argmaxin this format. – Naji Nov 03 '13 at 14:38\lim_{i=1}^nin displaystyle. – Sigur Nov 03 '13 at 14:44\smash{...}the whole thing, but that definitely does not look right. Is there no way you could accept the right subscript? (Note that the output of\fracin text style is not optimal either.) BTW: you can defineargmaxvia\DeclareMathOperator*{\argmax}{argmax}, no need for\arg\!\max. – moewe Nov 03 '13 at 14:44\DeclareMathOperator*{\argmax}{\smash{\text{argmax}}}, which removes the descender depth from the operator. – Werner Nov 03 '13 at 15:08\argmax. – egreg Nov 03 '13 at 15:35i.e. defining a
– Naji Nov 03 '13 at 15:42\genfracwith thickness zero?!