3

I just want to box my last equation, but \Aboxed isn't aligning properly. Here's my MWE:

\documentclass{article}
\usepackage{amsmath,mathtools}
\begin{document}
\begin{align*}
  e &= mc^2 \\
  \Aboxed{&= 42}
\end{align*}
\end{document}

And here's what it gives me:

badly aligned equations

As you can see, it is not properly aligned.

1
  • of topic: mathtols load amsmath, so it is enoug to load only mathtools ...
    – Zarko
    Aug 31, 2016 at 23:22

1 Answer 1

6

\Aboxed needs an expression on both side of ampersand:

\documentclass{article}
\usepackage{mathtools}
\begin{document}

\begin{align*}
         e  & = mc^2 \\
\Aboxed{ {} & = 42}
\end{align*}
\end{document}

enter image description here

3
  • ugh why can't latex packages ever make sense Aug 31, 2016 at 23:32
  • How to write that box and the equation in blue?
    – pzorba75
    Sep 1, 2016 at 9:36
  • for \Aboxed I don't know, but try if instead it it you use \documentclass{article} \usepackage{mathtools} \usepackage{xcolor} \begin{document} \begin{align*} e & = mc^2 \\ & = \color{blue}\boxed{42} \end{align*} \end{document} gives acceptable result.
    – Zarko
    Sep 1, 2016 at 10:11

You must log in to answer this question.

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