# Numbering alignat within subequations

I have one main equation and a few initial/boundary conditions I want to display. The first should have label 3.3 only and the conditions ideally have labels 3.3a, 3.3b, etc.

The first eq is also somewhat unique in that I want it displayed in a table-like format as it spans 3 lines and has a pattern to it. The align environment messes up the spacing so I opted for alignat:

\usepackage[tbtags]{amsmath}
\newcommand{\s}{\hspace{0.12cm}}

The 2D form of Equation \eqref{eq:pathenum1} is thus

\vspace{-0.4cm}
\begin{subequations}\label{eq:pathenum2}
\begin{alignat}{3}
\xi_2(x,y,t+1) \s &=\s \xi_2(x-1,y+1,t) \s &+& \s \xi_2(x,y+1,t) \s &+& \s \xi_2(x+1,y+1,t) \nonumber\\
&+\s \xi_2(x-1,y,t) \s &+& \s \xi_2(x,y,t) \s &+& \s \xi_2(x+1,y,t) \tag{\label{eq:pathenum2}}\\
&+\s \xi_2(x-1,y-1,t) \s &+& \s \xi_2(x,y-1,t) \s &+& \s \xi_2(x+1,y-1,t), \nonumber
\end{alignat}

and the 3D form is displayed in Appendix Equation \eqref{appeq:pathenum3}. Initial and boundary
conditions for the 2D (and for any $D$) case are also the same as in 1D as the theory behind them
still applies and is carried forward:

\vspace{-0.45cm}
\begin{align}
&\xi_2(0,0,1) = 1, \label{eq:pathenum2a}\\
&\xi_2(x,y,t) = 0 \quad \mathrm{for} \quad \forall t<0, \; \forall x,y, \label{eq:pathenum2b}\\
&\xi_2(x,y,t) = 0 \quad \mathrm{for} \quad \forall|x|,|y| > t. \label{eq:pathenum2c}
\end{align}
\end{subequations}


As you can see the numbering doesn't quite work for my main eq -- I've managed this for one-line equations elsewhere in my work but how do I fix it for this case?

## 2 Answers

Since you're using tbtags, the number should align to the bottom row.

You need \tag{\ref{<label>}}, not \label inside \tag.

Also the spacings you add can be removed by using the proper markup, namely &&+ instead of &+&.

Avoid blank lines before displays (which are the reasons for you to add negative spacing). A blank line can follow a display only if a new paragraph starts.

I also removed \mathrm{for} as the word is already implied in the “forall” symbols.

\documentclass{article}
\usepackage[tbtags]{amsmath}

\begin{document}
The 2D form of Equation \eqref{eq:pathenum1} is thus
\begin{subequations}\label{eq:pathenum2}
\begin{alignat*}{3}
\xi_2(x,y,t+1) &= \xi_2(x-1,y+1,t) &&+ \xi_2(x,y+1,t) &&+ \xi_2(x+1,y+1,t) \\
&+ \xi_2(x-1,y,t)   &&+ \xi_2(x,y,t)   &&+ \xi_2(x+1,y,t) \\
&+ \xi_2(x-1,y-1,t) &&+ \xi_2(x,y-1,t) &&+ \xi_2(x+1,y-1,t),
\tag{\ref{eq:pathenum2}}
\end{alignat*}
and the 3D form is displayed in Appendix Equation \eqref{appeq:pathenum3}. Initial and boundary
conditions for the 2D (and for any $D$) case are also the same as in 1D as the theory behind them
still applies and is carried forward:
\begin{align}
&\xi_2(0,0,1) = 1, \label{eq:pathenum2a}\\
&\xi_2(x,y,t) = 0 \qquad \forall t<0, \; \forall x,y, \label{eq:pathenum2b}\\
&\xi_2(x,y,t) = 0 \qquad \forall|x|,|y| > t. \label{eq:pathenum2c}
\end{align}
\end{subequations}

\end{document}


You can simply decrease the equation counter after the first equation:

\documentclass{article}

\usepackage[tbtags]{amsmath}
\newcommand{\s}{\hspace{0.12cm}}
\usepackage[noabbrev]{cleveref}

\begin{document}

The 2D form of Equation \eqref{eq:pathenum1} is thus

\vspace{-0.4cm}
\label{eq:pathenum2} \begin{alignedat}{3} \xi_2(x,y,t+1) \s &=\s \xi_2(x-1,y+1,t) \s &+& \s \xi_2(x,y+1,t) \s &+& \s \xi_2(x+1,y+1,t) \\ &+\s \xi_2(x-1,y,t) \s &+& \s \xi_2(x,y,t) \s &+& \s \xi_2(x+1,y,t) \\ &+\s \xi_2(x-1,y-1,t) \s &+& \s \xi_2(x,y-1,t) \s &+& \s \xi_2(x+1,y-1,t), \end{alignedat}
%
and the 3D form is displayed in Appendix Equation \eqref{appeq:pathenum3}. Initial and boundary
conditions for the 2D (and for any $D$) case are also the same as in 1D as the theory behind them
still applies and is carried forward in \cref{eq:pathenum2a,eq:pathenum2b,eq:pathenum2c}:

\vspace{-0.45cm}\addtocounter{equation}{-1}
\begin{subequations}
\begin{align}
&\xi_2(0,0,1) = 1, \label{eq:pathenum2a}\\
&\xi_2(x,y,t) = 0 \quad \mathrm{for} \quad \forall t<0, \; \forall x,y, \label{eq:pathenum2b}\\
&\xi_2(x,y,t) = 0 \quad \mathrm{for} \quad \forall|x|,|y| > t. \label{eq:pathenum2c}
\end{align}
\end{subequations}

\end{document}