Boxed and align
\boxed
cannot contain alignment points. Load mathtools
(needless to load amsmath
in this case) and use \Aboxed
:
\documentclass{article}
\usepackage[x11names, rgb]{xcolor}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\begin{document}
\begin{align}
\Aboxed{ 2x+y & = 11 } \\
3x & = 19 - 2y
\end{align}
\end{document}
You can use tikz
to create frame
\documentclass{article}
\usepackage[x11names, rgb]{xcolor}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\def\tikzmark#1{\tikz[remember picture,overlay]\node[inner ysep=0pt,anchor=base](#1){\strut};}
\begin{document}
\begin{align}
\tikzmark{A}2x+y & = 11 \tikzmark{B} \\
3x & = 19 - 2y
\end{align}
\tikz[remember picture,overlay]\draw(A.south west)rectangle(B.north east);
\end{document}
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:
$$
\begin{align*}
2x+y &= 11 \\
3x &= 19 - 2y
\; \llap{\mathrel{\boxed{\phantom{3x = 19 - 2y}}}}
\end{align*}
$$
Here's what this would look like on math.stackexchange.com:
Edit: I boxed the wrong line by mistake, but one can accomplish the same thing for any line within an align
block.