0

I have two consecutive subequation environments with no text in between, I would like to align the four equations in the two environments.

Current code:

\documentclass{article}
\usepackage{amsmath, nccmath}

\newcommand{\average}[2][2]{{% \mspace{#1mu}\mspace{#1mu}\mspace{#1mu}% \overline{\mspace{-#1mu}#2\mspace{-#1mu}\mspace{-#1mu}\relax}\mspace{#1mu}% }}

\begin{document}

\begin{subequations} \begin{align} \epsilon_{11}' &= {\average{n'}}^2 - \average{n''}^2\ \epsilon_{11}'' &= 2 \average{n'} \average{n''} \end{align} \end{subequations} \useshortskip \begin{subequations} \begin{align} \epsilon_{12}' &= \average{n'} \Delta n'' + \average{n''} \Delta n'\ \epsilon_{12}'' &= \average{n''} \Delta n'' - \average{n'} \Delta n' \end{align} \end{subequations}

\end{document}

Which produces:

Code output

Aligning all of the equals signs would look better, but I want to maintain the numbering as it is now to demonstrate which quantities are grouped.

Update:

Using the solution from https://tex.stackexchange.com/a/701782/4427 does solve my alignment problem, but referring to the grouped equations collectively only works for the first set of subequations in the environment.

Updated code:

\documentclass{article}
\usepackage{amsmath, nccmath}

\newcommand{\average}[1]{{% \mspace{6mu}% \overline{\mspace{-2mu}#1\mspace{-4mu}\relax}\mspace{3mu}% }}

\makeatletter \newcommand{\stepsubequation}{% \ifmeasuring@\else \stepcounter{parentequation}% \protected@xdef\theparentequation{\arabic{parentequation}}% \ifdefined\theHparentequation \protected@xdef\theHparentequation{\arabic{parentequation}}% \fi \setcounter{equation}{0}% \fi } \makeatother

\begin{document}

\begin{subequations} \label{eq_eps11} \begin{align} \epsilon_{11}' &= {\average{n'}}^2 - \average{n''}^2\ \epsilon_{11}'' &= 2 \average{n'} \average{n''}\ \stepsubequation \label{eq_eps12} \epsilon_{12}' &= \average{n'} \Delta n'' + \average{n''} \Delta n'\ \epsilon_{12}'' &= \average{n''} \Delta n'' - \average{n'} \Delta n' \end{align} \end{subequations}

Collective reference to equations~\ref{eq_eps11} works correctly, to equations~\ref{eq_eps12} includes the subequation label.

\end{document}

Updated output:

Updated output

I tried the second solution from this question as well but this produces an undefined control sequence error pointing to the line with \begin{document}, I'm not well versed enough in TeX to understand what's going on unfortunately. The pdf output also seems to have some text from the preamble leaking into it somehow:

Output with second method from other question

s.jenga
  • 1
  • 2

0 Answers0