Qed right justified at the end of the last line of cases in display style

I'm trying to get a qed symbol at the right end of the last line of a cases environment, but when I try e.g.

\hfill$\displaystyle\begin{cases}a&b\\c&d\\e&f\end{cases}$ \qed


the symbol is centered. How do I get it still on the right side of the page but aligned with the last line?

• Does this answer your question? Pushing \qed to the right within a displayed formula – DG' Mar 11 at 0:02
• The linked question doesn't move the qed box to the last line of a cases statement. Please provide a small compilable example, so that we can see (1) what document class you're using, (2) whether this display is at the end of a proof, and (3) if in a proof, what theorem package you're using. – barbara beeton Mar 11 at 2:15
• @barbara I'll have to do this in the morning. Thanks. – Matt Samuel Mar 11 at 2:33

First, use a proper displayed equation if it is supposed to take the whole line!

Next, I'd use the {numcases} environment (cases.sty) along with \notag and \tag*.

But that makes me discover \tag* is not supported in {numcases}. Oops, sorry.

So from the beginning: Wait a few days for the updated cases.sty to propagate on CTAN, and download it or let it automatically update. Then, in your document head declare

\usepackage{amsmath,amssymb}
\usepackage{cases}


and in the body, use

\begin{numcases}{x =}
a& b \notag \\
c& d \notag \\
e& f \tag*{\Box}
\end{numcases}

• I do some of my editing on an android phone with verbtex. I'm worried the app won't pull the updated package. – Matt Samuel Mar 11 at 20:02
• If your TeX installation is hard to update, you can download the file from CTAN using a browser, and save it in the directory with your document. – Donald Arseneau Mar 11 at 21:59
• Thanks, this worked. It's a little confusing though that the numcases has to not be in displaymath, the left side is in math mode, and the right side is not. – Matt Samuel Mar 12 at 13:11
• Because it includes equation numbering, it has to be the whole display-math environment, like {eqnarray} or {align}, but distinct from {cases} or {aligned}. The far right "explanations" are in text mode following the original \cases from plain TeX (cases.sty predates amsmath), and the amsmath documentation recommends putting the entries inside \text{ }, but the difference/incompatability is indeed a problem. – Donald Arseneau Mar 14 at 1:17

You can do that with witharrows:

\documentclass{article}
\usepackage{witharrows}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}

\begin{DispWithArrows*}<x =>
a& b  \\
c& d  \\
e& f \tag*{$\Box$}
\end{DispWithArrows*}

\end{document}