I have noticed that I get errors when trying to box an entire equation in the align environment. I get similar errors if I try to put the entire equation inside big parenthesis using \left( and \right).
I know that the error is stemming from the fact that the alignment marker & is inside these equations (I am using the align environment after all). A possible workaround for the parenthesis case would be to use \Big( and \Big). I'm afraid that doesn't help if I want to box the entire equation.
Another alternative is to stick a separate environment like \begin{equation}\end{equation} where I need the boxed equation but if it is in the middle of an align environment then I have just split my align environment with no way to maintain the alignment marker position.
Does anyone have any experience with this error they'd like to share? Any other workarounds for the case of boxing an entire equation with an alignment marker?
Related to the MWE below, I am trying to box the entire definition of f_{ij} including the left hand side and equal sign. Error occurs because of the & at the first equal sign.
MWE
\documentclass[11pt,letterpaper]{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
a &= b + c\\
d_{ij} &= e + f_{ij}\\
\boxed{f_{ij} &= \begin{cases} % I want to box this entire equation
1 & \text{if} \quad i = j\\
0 & \text{if} \quad i \neq j\\
\end{cases}}\\
d_{ii} &= e + f_{ii} = e + 1
\end{align*}
\end{document}

cases. – cfr Sep 12 '17 at 02:55\boxed{}around the entire equation. – Nukesub Sep 12 '17 at 02:58\Aboxed{}from themathtoolspackage but that does not appear to work either. – Nukesub Sep 12 '17 at 03:08\left( ... \right)(with or withoutcases). But I guess that's not what you meant. – cfr Sep 12 '17 at 03:09casesenvironment, but that's not a problem, so you must mean something else. – cfr Sep 12 '17 at 03:12&inside thecasesenvironment e.g.0 \quad ... \\ 1 \quad ..., but your strategy lets you keep the alignment inside as you'd normally have it.) – cfr Sep 12 '17 at 03:28