4

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}
10
  • Please make your code into a (non-)compilable document so we can all share your error. It is hard to help without code to reproduce the problem
    – cfr
    Commented Sep 12, 2017 at 2:52
  • What do you mean by 'boxed'? You seem to want to surround it with delimiters, but the code suggest you want to use cases.
    – cfr
    Commented Sep 12, 2017 at 2:55
  • Sorry for not being clearer. I mean I want to be able to add a \boxed{} around the entire equation.
    – Nukesub
    Commented Sep 12, 2017 at 2:58
  • Small update. I thought I had found a solution when I discovered \Aboxed{} from the mathtools package but that does not appear to work either.
    – Nukesub
    Commented Sep 12, 2017 at 3:08
  • Oh. Sorry. I only figured out how to be large brackets around it \left( ... \right) (with or without cases). But I guess that's not what you meant.
    – cfr
    Commented Sep 12, 2017 at 3:09

1 Answer 1

5

I believe I have determined a workaround.

You can use \Aboxed{} from the mathtools package to wrap an entire equation in an align environment. You can use \Aboxed{} with \begin{cases} as well but you have to surround the \begin{cases}\end{cases} with a pair of {} as shown below. Source (How can I \Aboxed a Matrix?)

\documentclass[11pt,letterpaper]{article}
\usepackage{amsmath}
\usepackage{mathtools}

\begin{document}
\begin{align*}
a &= b + c\\
d_{ij} &= e + f_{ij}\\
\Aboxed{ 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}

enter image description here

You must log in to answer this question.

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