Math & ScienceNew Command or Environment for split Equations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
thorpn
Posts: 53
Joined: Mon Jul 30, 2012 7:30 pm

New Command or Environment for split Equations

Post by thorpn »

I like having shortcuts for the commands I use the most when taking notes, I already have a command for \begin{\equation} and \end{\equation}. However I find that I often have to use the \split command to make the math understandable and so I need a shortcut for this, however as split requires the equation environment I have to use two shortcuts :( can it be done in one command? Something like:

Code: Select all

\newcommand{\bes}{\begin{equation}\begin{split}}
P.S.: No minimum working example included since I figure one won't be needed!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

New Command or Environment for split Equations

Post by Stefan Kottwitz »

You could define an environment for both, such as

Code: Select all

\usepackage{environ}
\NewEnviron{es}{%
  \begin{equation}\begin{split}
    \BODY
  \end{split}\end{equation}
}

Stefan
LaTeX.org admin
thorpn
Posts: 53
Joined: Mon Jul 30, 2012 7:30 pm

New Command or Environment for split Equations

Post by thorpn »

Thx Stefan, almost there I think. When I use the \begin{} command for the environment directly it works fine, however i want to use shortcuts so I have done this:

Code: Select all

%Laver et environment til equation split (der er 2 kommandoer så lidt kompliceret..)
\NewEnviron{split.enviro}{%
\begin{equation}\begin{split}
  \BODY
\end{split}\end{equation}
}

%Begin equation split: Begin equation split = bes
\newcommand{\bes}{\begin{split.enviro}}
\newcommand{\ees}{\end{split.enviro}}
But when i instead of \begin{} use \bes it fails, it looks like it doesn't find the end of the environment (I do end the area with the \ees command)


Thx
Post Reply