# Nested cases, alignment and numbering

I have tried all different sorts of solutions including align, aligned, cases and equation to have the result I get with this code except that I want numbering for the three lines in the aligned subenvironment. Do you have a solution or better way of representing this?

\left\{ \begin{aligned} \partial_t u(\vec{x},t) - \alpha \Delta u(\vec{x},t) &= f(\vec{x}), &&(\vec{x},t) \in \Omega \times J, \\ % u(\vec{x},t) &= 0, &&(\vec{x},t) \in \partial \Omega \times J, \\ % u(\vec{x},0) &= \begin{cases} \rho, &\vec{x} \in T \\ 0, &\vec{x} \in B \textbackslash T \end{cases} &&\vec{x} \in B \end{aligned} \right.


With the use of the empheq package:

\documentclass{article}

\usepackage{empheq}
\begin{document}
\begin{empheq}[left=\empheqlbrace]{align}
\partial_t u(\vec{x},t) - \alpha \Delta u(\vec{x},t)
&= f(\vec{x}), &&(\vec{x},t) \in \Omega \times J, \\
%
u(\vec{x},t) &= 0, &&(\vec{x},t) \in \partial \Omega \times J, \\
%
u(\vec{x},0)
& = \begin{cases}
\rho,   &\vec{x} \in T \\
0,      &\vec{x} \in B \setminus T
\end{cases}
&&\vec{x} \in B
\end{empheq}
\end{document}


• Don't use \textbackslash. Use \setminus instead. – Mico Dec 10 '18 at 19:24
• @Mico, ups, i didn't check used symbols :-(. corrected now. thank you very much! – Zarko Dec 10 '18 at 19:46
• @Mico, do you have an short explanation of why to use \setminus instead of \textbackslash? – Robin Hellmers Dec 10 '18 at 19:51
• @RobinHellmers - \textbackslash is a text-mode command. In contrast, \setminus is a math-mode command. In your screenshot, note that the spacing around the backslash character is too tight, when compared to the screenshots posted by Zarko and myself. – Mico Dec 10 '18 at 20:58

I don't think that much is gained by aligning the three equations on their respective = symbols. I'd left-align the expressions, using a numcases environment.

\documentclass{article}
\usepackage{newtxtext,newtxmath,mathrsfs} % optional
\usepackage{cases} % for 'numcases' env.
\begin{document}
\begin{numcases}{}
\partial_t u(\vec{x},t) - \alpha\Delta u(\vec{x},t) = f(\vec{x}),
&$(\vec{x},t)\in\Omega\times J$, \\
u(\vec{x},t) = 0,
&$(\vec{x},t)\in\partial\Omega\times J$, \\
u(\vec{x},0) =
\left\{\begin{array}{@{}ll@{}}
\rho,   &\vec{x} \in\mathscr{T} \\
0,      &\vec{x} \in\mathscr{B}\setminus \mathscr{T}
\end{array}\right.
&$\vec{x} \in\mathscr{B}$
\end{numcases}
\end{document}