Hi. I have struggled with aligning with cases environment The minimal example of the above thing is the following:
\documentclass{article}
\usepackage{mathtools}
\makeatletter
\newcases{PDEcases}{\quad}{%
\hfil$\m@th\displaystyle{##}$}{{##}\hfil}{\lbrace}{.}
\makeatother
\begin{document}
\[
\begin{PDEcases}
-\triangle u +u \cdot \nabla u +\nabla p =f&in $\Omega$\\
\mathrm{div}\, u =0& in $\Omega$\\
u=0& on $\partial \Omega$,
\end{PDEcases}
\]
Alignment inside cases
\[
\begin{dcases*}
-\triangle u +\nabla p =-w\cdot \nabla w +f&in $\Omega$\\
\hspace{2.75em}\mathrm{div}\, u =0& in $\Omega$\\
\hspace{4.2em}u=0& on $\partial \Omega$,
\end{dcases*}
\]
\end{document}
For the first case, using \newcases
, I can easily make a custom environment on cases. But I want to make an equation like second form. But I failed to make an equation with cases environment. I manually adjust it by using \hspace
.
How can I make it more smarter way?
One possible solution of mine is to use the alignedat enviornment. But it is not a case environment.
Here is a code:
\[
\left\{
\begin{alignedat}{2}
-\triangle u +\nabla p &=-w\cdot \nabla w +f&&\qquad \mbox{in $\Omega$},\\
\mathrm{div}\, u &=0&&\qquad \mbox{in $\Omega$},\\
u&=0 &&\qquad \mbox{on $\partial \Omega$},
\end{alignedat} \right.
\]
I'm unsatisfied with \quad
part and \left\{ \right.
Is there anyway to make it using cases stuff?
Thanks in advances
Best Answer
Here is a solution with
cases
. I've added another solution, which has a better vertical spacing, in my opinion, and a shorter code, with theempheq
package (which loadsmathtools
).Also I replaced
\triangle
with the more correctDelta
, and defineddiv
as a Math Operator: