newenvironment: error with \begin{align} and \end{align}
This is caused by the way LaTeX
environments are defined. The simplest way around is to use \env
...\endenv
construction instead of \begin{env}
...\end{env}
:
\documentclass{book}
\usepackage{amsmath}
\newenvironment{subalign}{\subequations\align}{\endalign\endsubequations}
\begin{document}
\begin{subalign}
a&=b\\
&=b
\end{subalign}
\end{document}
Define the environment using environ
:
\documentclass{article}
\usepackage{amsmath,environ}
\NewEnviron{subalign}{%
\begin{subequations}
\begin{align}
\BODY
\end{align}
\end{subequations}
}
\begin{document}
\begin{subalign}
a &= b \\
&= b
\end{subalign}
\end{document}
To provide different approaches under same question, this is a xparse
solution, using the b
-type argument specifier.
\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}
\NewDocumentEnvironment{subalign}{b}{%
\begin{subequations}
\begin{align}
#1
\end{align}
\end{subequations}
}{}
\begin{document}
\begin{subalign}
a &= b \\
&= b
\end{subalign}
\end{document}