Making a new environment combining equation and split
The reason that \begin{split} ... \end{split}
doesn't work when the \begin ... \end
are invoked within the begin and end parts of another environment is related to the reason given in the "technical notes on the amsmath package" (texdoc technote) -- the parsing requires an exact match of the environment specified by \begin{...}
.
this isn't really obvious from the current documentation in technote, but it would be a good idea to add it, and I'll try to arrange for that to happen.
I wouldn't have expected this, but there's an easy answer; thanks to Stefan Kottwitz! (And thanks to Will Robertson for writing the package environ
that I had never heard of before. He should have given this answer; with his package it works like a charm.)
\documentclass{article}
\usepackage{amsmath,environ}
\NewEnviron{example}{%
\begin{equation}\begin{split}
\BODY
\end{split}\end{equation}
}
\begin{document}
\begin{example}
a &= b + c \\
&= d + e
\end{example}
\end{document}
Some explanations can be found in Stefan's post behind the above link.
The split
environment has to be used within a math displaying environment. I guess that what you are trying to do is to create a shortcut so that you don't have to write
\begin{equation}
\begin{split}
...
\end{split}
\end{equation}
every time.
Perhaps an alternative to split
would be the aligned
environment which also allows you align a sequence of formulas on the equal sign and, placing it inside an equation
environment, you also get a single equation number for the whole expression. Also luckily, aligned
doesn't have the parsing problems of split
and plays well with new environment definitions.
\usepackage{amsmath}
\newenvironment{equations}{\equation\aligned}{\endaligned\endequation}
\begin{equations}
a &= b + c \\
&= d + e
\end{equations}
Of course, you can always read the documentation from amsmath by typing
texdoc amsldoc
on a command line to find inspiration and browse for alternatives.