6

Why does [X] does not display? X would appear if I removed the brackets. Is that a bug?

\begin{equation}
\begin{aligned}
 [X] &= 1\\
 [Y] &= 2,
\end{aligned}
\end{equation}

enter image description here

1
5

Another solution is to load the mathtools package. The mathtools package is a (very significant!) superset of the amsmath package which also fixes a couple of de facto bugs -- such as mis-interpreting [X] as the optional argument of \begin{aligned} -- of the amsmath package. For more about this bug, see section 2.1 of the user guide of the mathtools package.

To wit,

\documentclass[leqno]{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
\begin{aligned}
   [X] &= 1\\
   [Y] &= 2,
\end{aligned}
\end{equation}
\end{document}

works exactly as expected:

enter image description here

A nice aspect of this solution is that you needn't remember to insert {} after \begin{aligned} if the next line begins with an object -- such as [X] -- that's encased in square brackets.

7

aligned takes an optional argument and so it is mistakening [X] for that option. The way to overcome is to place something innocuous after the {aligned}, but before the [X]. Here I place an empty group {}.

Note that the option, when employed, is a vertical-alignment positioning specification, such as [t] or [b].

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{aligned}{}
 [X] &= 1\\
 [Y] &= 2,
\end{aligned}
\end{equation}
\end{document}

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.