1

I am trying to define a new align-like environment that, in the spirit of this answer, displays only one single equation number for the entire multi-line equation. As for nesting the align and split environments I consulted this question but I can't get it to work:

\documentclass{article}
\usepackage{amsmath}

\newenvironment{alignOne}{\align\split}{\endsplit\endalign}

\begin{document}

\begin{alignOne}
  a &= b \\
  &=c \\
  &=d \\
  &=e
\end{alignOne}

\end{document}

The error message is

Missing } inserted. [    \end{alignOne}]

and a similar error message shows up when I replace \split with \begin{split} and \endsplit with \end{split}.

How do I get this to work? What is the general way to nest environments in \newenvironment definitions?

1 Answer 1

3

The following works as expected:

enter image description here

\documentclass{article}

\usepackage{amsmath}

\newenvironment{alignOne}
  {\begin{equation}\begin{aligned}}
  {\end{aligned}\end{equation}}

\begin{document}

\begin{alignOne}
  a &= b \\
    &= c \\
    &= d \\
    &= e
\end{alignOne}

\end{document}
2
  • Thanks so much! May I ask why my approach did not work and whether there is a general way to nest environments within \newenvironment?
    – balu
    Jan 15, 2020 at 18:55
  • @balu: At this point I'm not exactly sure. In some instances one can try using the command-form of an environment, but in other instances one should/can use the full environment form. align-like environment capture the entire contents of the environment in order to read it more than once. This capturing is over predicated on the existence of an explicit \end{<env>}.
    – Werner
    Jan 19, 2020 at 7:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .