Math & ScienceA problem with \newcommand and align evironment

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
randall
Posts: 6
Joined: Wed Jul 16, 2008 7:01 am

A problem with \newcommand and align evironment

Post by randall »

Hi,

I'm trying to use shortcuts with different math environments. I managed to do this easily with equation environment. But when I tried the same with align environment, a bunch of errors occurred.

Following MWE demonstrates the behaviour

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\newcommand{\bal}{\begin{align}}
\newcommand{\eal}{\end{align}}
\begin{document}
\bal 2x_1 + x_2 &= 2 \\ x_1 - x_2 &= 1 \eal
\end{document}
What is wrong with this example? If I replace my new command \eal after the typed equation with \end{align} it works perfectly.
Last edited by randall on Tue Sep 28, 2010 7:18 pm, edited 1 time in total.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

A problem with \newcommand and align evironment

Post by localghost »

The environments of AMS-LaTeX can not be used this way in new commands. At the moment I'm not aware of a workaround.

As soon as the problem is solved, please act exactly according to Section 3 of the Board Rules.


Best regards
Thorsten
randall
Posts: 6
Joined: Wed Jul 16, 2008 7:01 am

Re: A problem with \newcommand and align evironment

Post by randall »

Thanks for letting me know that it is just not possible. Case is closed.
Post Reply