0

I have this string in my preamble:

\def\bala#1\eala{\begin{align*}#1\end{align*}}

and I tried to rewrite it as:

\def\bala{\begin{align*}}
\def\eala{\end{align*}}

or as:

\newcommand{\bala}{\begin{align*}}
\newcommand{\eala}{\end{align*}}

but I noticed that it doesn't work for the align ambient (starred or not). It works for others math ambients like eqnarray, equation etc.

This is a Minimal NOT working Example:

\documentclass[11pt]{article}
\usepackage{amsmath}

\newcommand{\bala}{\begin{align}}

\newcommand{\eala}{\end{align}}

\begin{document}
My aligned equations
\bala
1+1&=2\\
2+2&=4
\eala

\end{document}

But the next one works:

\documentclass[11pt]{article}
\usepackage{amsmath}

\newcommand{\bala}{\begin{eqnarray}}

\newcommand{\eala}{\end{eqnarray}}

\begin{document}
My aligned equations
\bala
1+1&=&2\\
2+2&=&4
\eala

\end{document}
Gabriele
  • 1,815
  • @campa Ok. I didn't know about this issue. I searched for it on StackExchange but I wasn't able to find it. If you like you can write an answer to my question and I'll accept it. – Gabriele Dec 12 '17 at 10:21
  • Plus this have been discussed many times on this site. It makes the code much harder to read, so it is often better to figure out how to make your editor insert \begin/end{align} for you. – daleif Dec 12 '17 at 10:22
  • @daleif Indeed it is not my code. I'got a script that expands this kind of abbreviations but it doesn't works (yet) for strings like \def\bala#1\eala{\begin{align*}#1\end{align*}}. – Gabriele Dec 12 '17 at 10:25

0 Answers0