I'm trying to define a new environment that consists of a split
environment inside an equation
environment. But I'm getting an error. Here's what I'm doing:
\documentclass[a4paper,12pt]{article}
\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\newenvironment{example}{\begin{equation}\begin{split}}{\end{split}\end{equation}}
\begin{document}
\begin{example}oi\end{example}
\end{document}
And the error message I'm getting is:
ERROR: LaTeX Error: \begin{split} on input line 8 ended by \end{example}.
I then tried a few other cases. If I remove the split
s and define example
to be just equation
, it runs fine. If I remove the equation
s and define example
to be just split
, I get the exact same error message.
In other words: I only get this error when split
is involved. Is there a way to make this work?
EDIT: The reason I'm doing this, is because I want a convenient way to create split
-equations. I know it's similar to align
. I prefer split
-equations because the entire line of equations gets a single number for referencing (it's even placed in the middle line). align
, however, will force me to \notag
each line, otherwise I get a number for each line in the equation (which tends to get messy when equations are long and numerous). It's not the end of the world, but the split
-equation
combination is just quicker and easier (if I can manage to define a command for it).
Alternatively, the multline
environment is not appropriate either, because it doesn't let you manually align each line (like aligning the equal signs). Instead it only lets you push everything left or right.
EDIT2: I just tried this:
\newenvironment{example}{ \begin{equation}\split}{\endsplit \end{equation}}
and got this error
ERROR: LaTeX Error: \begin{equation} on input line 8 ended by \end{example}.
Which is weird, because removing \split
and \endsplit
entirely doesn't return any errors (so it's not equation
's fault).
\begin{split}
by\split
and the\end{split}
by\endsplit
in your environment definition?