# Defining an abbreviation for align [duplicate]

To save myself some keystrokes, I tried to define an abbreviation for \begin{align} and \end{align}

\documentclass[reqno, 11pt]{article}

\usepackage{amsmath, amsfonts, mathtools, amsthm}
\usepackage{fullpage}

\newcommand{\ba}{\begin{align*}}
\newcommand{\ea}{\end{align*}}

\title{Article Template}
\author{You}

\begin{document}
\maketitle

\section*{3}
\ba
e=mc^2
\ea
\end{document}


For some reason, the abbreviation for \begin{align} seems to work, but the abbreviation for \end{align} does not. I thought perhaps that \ea was already in use, but tweaking the name didn't change anything. Any ideas?

• You should definitely do that using your editor instead of TeX. TeX code is a markup and ba, ea don't carry any structural information. Many editors have a snippet or expansion function, so you can write ba<hotkey> to expand to \begin{align}. – Marco Sep 26 '13 at 11:40
• @Marco Thanks for the input. I use writelatex.com, which isn't a very sophisticated editor, so that might not be an option. – Eric Auld Sep 26 '13 at 11:41
• This is a documented feature of ams alignments, they need to grab the entire body of the environment as a macro so that it can be set twice (for measuring) so the code needs to find \end{align} to know when to stop the argument. It is possible (but discouraged) to work around that: see the amsmath documentation. – David Carlisle Sep 26 '13 at 11:44
• @DavidCarlisle OK, I guess I'll just have to make the extra keystrokes. :) – Eric Auld Sep 26 '13 at 11:55
• See also Defining a shorthand for amsmath's align environment (as commands), for example. Lots of possible 'main questions', just a question of which to pick for a dupe, I'm afraid. – Joseph Wright Sep 26 '13 at 15:13