0

I want to have an equation array (the environment eqnarray) contained in a box. The only way I know is to use the \boxed command. This works for

\begin{eqnarray}
\boxed{1+1}&=&2
\end{eqnarray}

but fails for

\begin{eqnarray}
\boxed{1+1&=&2}
\end{eqnarray}

How should I box the whole thing?

1
  • 3
    (1) never use eqnarray it is broken in many ways (2) see the mathtools and empheq packages
    – daleif
    Commented Feb 11, 2020 at 11:46

2 Answers 2

3

eqnarray is an environment from the LaTeX kernel which does its job, but there is better on the market. You use the \boxed command, which means that you are already loading amsmath, so you should use its display alignment environments. This being said, it's true that \boxed doesn't work across cells. The package mathtools (an extension to amsmath) provides a macro \Aboxed which does.

\documentclass{article}

\usepackage{mathtools} % loads amsmath

\begin{document}

\begin{align}
\Aboxed{ a&=b } \\
c&= d
\end{align}

\end{document}

enter image description here

0

If you want to put multiple aligned equations in a box I'd recommend the empheq package. For example:

\documentclass{article}
\usepackage{amsmath,empheq}
\begin{document}

\begin{empheq}[box=\fbox]{align*}
a &= b \\
c &= d
\end{empheq}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .