方程组内的多重比对

方程组内的多重比对

我的 MWE:

\documentclass{report}
\usepackage{amsmath}

\begin{document}

The partial derivatives are given by:
\begin{subequations}
\begin{align}
\frac{\partial \beta_{2,1}}{\partial x_1} &= \gamma_2x_2 \cos(x_1), &&\frac{\partial \beta_{2,1}}{\partial x_2} = \gamma_2 \sin(x_1), &&&\frac{\partial \beta_{2,1}}{\partial u} = 0\\
\frac{\partial \beta_{2,2}}{\partial x_1} &= 0, &&\frac{\partial \beta_{2,2}}{\partial x_2} = \gamma_2 x_2, &&&\frac{\partial \beta_{2,2}}{\partial u} = 0\\
\frac{\partial \beta_{2,3}}{\partial x_1} &= 0, &&\frac{\partial \beta_{2,3}}{\partial x_2} = \gamma_2 u, &&&\frac{\partial \beta_{2,3}}{\partial u} = \gamma_2x_2
\end{align}
\end{subequations}

\end{document}

结果: 在此处输入图片描述

然而,我希望获得以下结果: 在此处输入图片描述

答案1

为了更全面地控制方程的间距,您可以使用环境alignat。此外,为了简化输入偏导数(仅限一阶),我引入了一个宏,\pder它有一个参数——实际上是两个,用逗号分隔,基于包esdiffxparse。下面是一个例子,其中方程组以 0.8em 分隔:

\documentclass{report}
\usepackage{amsmath}
\usepackage{esdiff}
\usepackage{xparse}

\NewDocumentCommand\pder{>{\SplitArgument{1}{,}}m}{\pderaux#1}
\NewDocumentCommand\pderaux{m m}{\diffp{{#1}}{{#2}}}

\begin{document}

The partial derivatives are given by:

\begin{subequations}
\begin{alignat}{5}
\pder{\beta_{2,1}, x_1} & = \gamma_2x_2 \cos(x_1), &\hspace{0.8em}   \pder{\beta_{2,1}, x_2} & = \gamma_2 \sin(x_1), &\hspace{0.8em}    \pder{\beta_{2,1}, u} &= 0\\
\pder{\beta_{2,2}, x_1} & = 0,& \pder{\beta_{2,2}, x_2}&= \gamma_2 x_2,&  \pder{\beta_{2,2}, u} &= 0 \\
\pder{\beta_{2,3}, x_1} & = 0, & \pder{\beta_{2,3}, x_2} & = \gamma_2 u, &  \pder{\beta_{2,3}, u} &  = \gamma_2x_2
\end{alignat}
\end{subequations}

\end{document} 

在此处输入图片描述

答案2

通过插入更多“与”符号,更准确地表达LaTeX您想要的间距。

在此处输入图片描述

请注意将 & 符号等号 ( =&) 会使等号和其后的字符之间的间距变小。将 & 符号(即&=)将产生稍微漂亮一点的间距。

\documentclass{report}
\usepackage{amsmath}

\begin{document}

The partial derivatives are given by:
\begin{subequations}
\begin{align}
\frac{\partial \beta_{2,1}}{\partial x_1} &= \gamma_2x_2 \cos(x_1),     &\frac{\partial \beta_{2,1}}{\partial x_2} &= \gamma_2 \sin(x_1),   &\frac{\partial \beta_{2,1}}{\partial u} &= 0\\
\frac{\partial \beta_{2,2}}{\partial x_1} &= 0,                 &\frac{\partial \beta_{2,2}}{\partial x_2} &= \gamma_2 x_2,     &\frac{\partial \beta_{2,2}}{\partial u} &= 0\\
\frac{\partial \beta_{2,3}}{\partial x_1} &= 0,                 &\frac{\partial \beta_{2,3}}{\partial x_2} &= \gamma_2 u,       &\frac{\partial \beta_{2,3}}{\partial u} &= \gamma_2x_2 
\end{align}
\end{subequations}

\end{document}

相关内容