如何调整文本部分中数学表达式的对齐方式?例如 argmax

如何调整文本部分中数学表达式的对齐方式?例如 argmax

我使用以下定义来生成argmax运算符:

\DeclareMathOperator*{\argmax}{\arg\!\max}

但是问题是当我在某个部分使用它时,由于argmin下一行下方的书面参数以异常距离出现,因此存在某些文本,以保持与 argmin 下的参数的距离。但是当我使用\frac例如这次时,比例会自行调整以不与下一行重叠。我如何更改上述命令以使其表现得像frac

例子:

\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}

带输出在此处输入图片描述

相反的是:

\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}

带输出在此处输入图片描述

答案1

据我了解,您想手动校正垂直间距,使其更接近此值,而无需操作员。恐怕结果不会很漂亮。此类解决方案的一个例子如下(手动选择垂直间距):

\documentclass{article}
\usepackage{amsmath}

%\DeclareMathOperator*{\argmax}{\arg\!\max}
\DeclareMathOperator*{\argmax}{argmax}



\begin{document}


  This is a test. This is a test. $\argmax\limits_{\raise3pt\hbox{$\scriptstyle x$}}{x^2}$ \vspace{-5pt}
 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}

在此处输入图片描述

相关内容