1

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)?

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

enter image description here

3
  • 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.
    – daleif
    Dec 5, 2019 at 10:16
  • 1
    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.
    – daleif
    Dec 5, 2019 at 10:17
  • @campa nope, had others things to do
    – daleif
    Dec 5, 2019 at 11:35

1 Answer 1

3

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}

enter image description here

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}

enter image description here

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!

2
  • 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?
    – Mo Farouk
    Dec 5, 2019 at 10:26
  • 1
    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.
    – Fintan
    Dec 5, 2019 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.