Is it possible to redefine \[ ... \] to be equivalent to \begin{align} ... \end{align}?

(I seldom use anything but the align environment, and \[ ... \] is faster and looks cleaner.)

  • What would be a motivation?
    – egreg
    Aug 1 '16 at 21:59
  • (@egreg: See edit.)
    – user66081
    Aug 1 '16 at 22:03
  • 1
    You shouldn't substitute equation with align, which should only be used with multiline displays.
    – egreg
    Aug 1 '16 at 22:04
  • @egreg: In this case, this new \[ ... \] could choose automatically...
    – user66081
    Aug 1 '16 at 22:06

The align environment is special in the sense, that it needs the end tag \end{align} to be present and not hidden inside macros. The environment internally catches the contents of the environment. Then it can measure the widths, before setting the equations. Therefore the following redefinition only redefines \[ and uses \] to limit the parameter with the contents and passes it to \begin{align} and \end{align}:


(\long\def would be needed, when it can happen that there are empty lines in the parameter #1. However, environment align does not like long arguments, thus the definition without \long is better here, see user66081's comment.)

Example file:

  a &= b\\
  c &= d


  • 2
    It won't digest empty lines because align doesn't. It is better w/o \long because the error message (in case of empty lines) makes reference to \[ instead of align
    – user66081
    Aug 1 '16 at 22:13
  • 1
    (This is great.)
    – user66081
    Aug 1 '16 at 23:32
  • @user66081 You are right, the original \[ ... \] (without amsmath) allows empty lines, but align of amsmath does not. Aug 1 '16 at 23:43
  • 1
    Better (IMO) to define \protected\def\[#1\]{\begin{equation*}\begin{split}#1\end{split}\end{equation*}} (or with aligned rather than split may be.
    – Manuel
    Aug 2 '16 at 0:15
  • @Manuel My interpretation of the question is that \[...\] should be just a shortcut for \begin{align}...\end{align}, because align is the main equation type for the document. Unnumbered equation types still remain available (displaymath, equation*). Aug 2 '16 at 5:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.