# Multiple alignments within set of equations

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


The result: However, I would like to obtain the following result: To have fuller control on the spacing of equations, you can use the alignat environment. In addition, to simplify typing partial derivatives (fist order only), I introduce a macro, \pder with one argument — actually two, separated by a comma, based on the esdiff package and on xparse. Here is an example, where the groups of equations are separated by 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} Tell LaTeX more accurately what spacing you want, by inserting more ampersands. Please note that putting the ampersand after the equals sign (=&) will produce less spacing between the equals sign and the character that follows. Putting the ampersand before (i.e. &=) will produce slightly prettier spacing.

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