[Tex/LaTex] Boxed and align


Remark: The examples in this post are not the real cases, the real one is a web page using MathJax. It seems MathJax has some restrictions about the packages that can be used. In particular, mathtools seems to not be supported.

The following document fails with errors "Missing }"

\usepackage[x11names, rgb]{xcolor}

  \boxed{ 2x+y & = 11 } \\
  3x & = 19 - 2y


The problem seems to be the usage of \boxed (if it is removed, the error disappears) inside an align block.

Any solution of this issue or other way to enclose an equation or some terms of an equation when using align blocks?

Note the following doesn't causes any error:

 \boxed{ 2x+y } & = 11 \\
  3x & = 19 - 2y

Best Answer

Here's a workaround that works with MathJax, but it's not pretty and might need additional tweaking depending on the MathJax implementation you're working with:

2x+y &= 11 \\ 
3x &= 19 - 2y 
\; \llap{\mathrel{\boxed{\phantom{3x = 19 - 2y}}}}

Here's what this would look like on math.stackexchange.com:

enter image description here

Edit: I boxed the wrong line by mistake, but one can accomplish the same thing for any line within an align block.

Related Question