为了提高可读性,我有时想在下标或上标中恢复显示样式的间距。但是,添加\displaystyle
也会改变字体大小并切换\tfrac
到\frac
,如以下示例所示
\documentclass{scrartcl}
\usepackage{mathtools}
\begin{document}
\begin{align}
&e^{-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi - J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k}\\
&e^{\displaystyle-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi - J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k}
\end{align}
\end{document}
如何在不影响输出的任何其他部分的情况下增加诸如+
、之类的操作符周围的间距?-
\cdot
答案1
您可以在本地制作-
和+
mathop 而不是 mathbin,然后它们会得到薄(而不是中等)空间,即使在上标中也是如此
\documentclass{scrartcl}
\usepackage{mathtools}
\begin{document}
\begin{align}
&e^{-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi - J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k}\\
&e^{\textstyle -S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi - J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k}\\
&e^{
\mathcode`\+="102B
\mathcode`\-="1200
-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi - J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k}
\end{align}
\end{document}
尽管这也会失去前缀的自动间距损失,-
除非你使用{-}S
答案2
使用\exp
符号。
\documentclass{scrartcl}
\usepackage{mathtools}
\begin{document}
\begin{itemize}
\item Equation \eqref{A} is unreadable
\item Equation \eqref{B} is confusing
\item Equation \eqref{C} is right
\item Equation \eqref{D} is better: the dot is almost never used
\item Equation \eqref{E} is possibly better
\end{itemize}
\begin{align}
\label{A}
&e^{-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi
- J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k}\\
\label{B}
&e^{\textstyle-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi
- J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k}\\
\label{C}
&\exp\Bigl(-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi
- J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k\Bigr)\\
\label{D}
&\exp\Bigl(-S[\phi] + J\phi - \frac{1}{2} \phi R_k \phi - J \varphi_k
+ \frac{1}{2} \varphi_k R_k \varphi_k\Bigr)\\
\label{E}
&\exp\Bigl(-S[\phi] + J\phi - \tfrac{1}{2} \phi R_k \phi - J \varphi_k
+ \tfrac{1}{2} \varphi_k R_k \varphi_k\Bigr)
\end{align}
\end{document}
如果要保留运算符号周围的间距,可以使用\text
,但我不建议这样做。更喜欢\exp
。
\documentclass{scrartcl}
\usepackage{mathtools}
\begin{document}
\begin{equation}
e^{\text{$-S[\phi] + J \cdot \phi - \frac{1}{2} \phi \cdot R_k \cdot \phi
- J \cdot \varphi_k + \frac{1}{2} \varphi_k \cdot R_k \cdot \varphi_k$}}
\end{equation}