I'm trying to redefine \[ and \] so that they behave as \begin{gather*} and end{gather*}. I've been doing this using \DeclareRobustCommmand; however, when I try to compile the following minimal program:
\documentclass[10pt,oneside,a4paper]{article}
\usepackage[english]{babel}
\usepackage{amsmath}
\let\equation\gather
\let\endequation\endgather
\DeclareRobustCommand{\[}{\begin{gather*}}
\DeclareRobustCommand{\]}{\end{gather*}}
\begin{document}
\[ 2+2=4 \]
\end{document}
I get this error:
! LaTeX Error: \begin{gather*} on input line 9 ended by \end{document`.
This does not happen if I replace gather with equation. What is going on here?
\[...\]as a shorthand for the former and use the lenghtier\begin{equation}...\end{eqaution}for the latter. – Federico Poloni Dec 8 '11 at 8:25