# How to move equation number to the end using cases tag

Using this equation with \cases tag put the equation number in the right middle (aligned with second equation). There is anyway to put it in the right bottom (aligned with the third equation)?

$$\label{myeq} u = \begin{cases} u_1 & x \: \text{inside} \: C \\ u_2 & x \: \text{outside} \: C \\ 0 & \: \text{otherwise} \\ \end{cases}$$

• As always on this site, please post a full minimal example, not just sniplts, that makes it a lot easier for others to test your code. Dec 5, 2019 at 10:16
• As an answer you'll probably need to use empheq to make a cases construction where all the lines have an equation number and then hide the first two. Unless you have a very specific reason to number just the last part then I don't think it is worth messing with. Dec 5, 2019 at 10:17
• @campa nope, had others things to do Dec 5, 2019 at 11:35

You could use the empheq package (which loads mathtools, which loads amsmath) and suppress the equation numbering for the first two cases.

\documentclass{article}
\usepackage{empheq}
\begin{document}

\begin{empheq}[left={u=\empheqlbrace}]{alignat=2}
&u_1 &\quad& \text{$x$ inside $C$} \nonumber \\
&u_2 && \text{$x$ outside $C$} \nonumber \\
&0\mathstrut   && \text{otherwise}
\end{empheq}

\end{document}

To be honest, this looks somewhat strange to me. I'd understand numbering all equations singularly, but why only the last one? If the equation number refers to the whole system, the centred tag looks more natural to me. Opinion, of course.

EDIT With the following horrible, dirty hacking I define an environment bcases (b for bottom) whose bottom baseline is aligned with the baseline of the current formula.

\documentclass{article}

\usepackage{amsmath}

\makeatletter
\newenvironment{bcases}[1][]
{%
\vbox\bgroup
\hbox\bgroup
$\displaystyle#1 \def\arraystretch{1.2}% as in amsmath's cases \left\lbrace \array{@{}l@{\quad}l@{}}% } {% \endarray\right.$%
\egroup
\kern-1.2\dp\strutbox
\egroup
}
\makeatother

\begin{document}

$foobarbaz \begin{bcases}[u=] u_1 & \text{x inside C} \\ u_2 & \text{x outside C} \\ 0 & \text{otherwise} \end{bcases}$

\begin{align}
&
\begin{bcases}
u_1 & \text{$x$ inside $C$} \\
u_2 & \text{$x$ outside $C$} \\
0   & \text{otherwise}
\end{bcases}
\\
&
\begin{bcases}
u_1 & \text{$x$ inside $C$} \\
u_2 & \text{$x$ outside $C$} \\
0   & \text{otherwise}
\end{bcases}
\end{align}

\end{document}

Stuff which must be aligned with the center of the brace can be given as optional argument. It was an interesting exercise to think about but I can't say I have a good feeling: comments on the code would be really appreciated!

• I appreciate telling me your opinion about that. I am using many equation with 10 lines or more, and I usually place the equation number next to the last line in order to not confuse the reader. I have 5 equations using cases tag, and I thought to make the equation numbers consistent along the whole document, that's why I want to to place the number aligned with last line only. What do you think? Dec 5, 2019 at 10:26
• I'd agree with campa that the equation number placement at the bottom is more likely to mislead the reader. It reads as though you are referring only to the last line. Dec 5, 2019 at 16:17