Which is the best way of formatting system of differential equations ? Is there a special package maybe ?
I'm actually using the environment
\begin{cases} ... \end{cases}
But I'am having trouble to align all the boundary condition to the right ? Do you have any suggestion here a sample of the code
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{physics}
\begin{document}
\begin{equation}
\begin{cases}
\displaystyle
\chi \bigg[ C_{m} \frac{\partial v}{\partial t} + I_{ion}\big( v,\mathbf{w},\mathbf{c} \big) \bigg] = \div \big( \mathbf{D_{M}} \div v \big) + I_{app} \qquad & \Omega_{0}^{s} \times \big(0,T\big]\\[20pt]
\displaystyle
\frac{\partial \mathbf{w}}{\partial t} = \mathbf{R}(v,\mathbf{w},\mathbf{c} \big) \qquad & \Omega_{0}^{s} \times \big(0,T\big] \\[20pt]
\displaystyle
\frac{\partial \mathbf{w} }{ \partial t} = \mathbf{S} \big(v,\mathbf{w},\mathbf{c} \big) \qquad & \Omega_{0}^{s} \times \big(0,T\big] \\[20pt]
\displaystyle
\big( \mathbf{D_M} \nabla v ) \cdot \mathbf{N_S} = 0 \qquad & \partial \Omega_{0}^{s} \times \big(0,T\big] \\[20pt]
\displaystyle
v = v_{0} \quad \mathbf{w} = \mathbf{w_{0}} \quad \mathbf{c} = \mathbf{c_{0}} & \partial \Omega_{0}^{s} \times \{ 0 \} \\[20pt]
\end{cases}
\end{equation}
\end{document}
In the picture the boundary condition are aligned on the left side instead I would like to align them on the right ( as the red line )
Best Answer
You might find some of the environments in
mathtools
useful for this. In particular,dcases
is like cases, but each line is in display mode, andspreadlines
changes the line spacing of aligned environments. I also usedaligned
, fromamsmath
, to add more alignment points.I also took the liberty of defining a
\vectorsym
macro, for readability and so you can change the formatting of all your vectors in one place.This MWE uses LuaLaTeX, but the body should work fine with your own preamble (You can use
isomath
for\vectorsym
in PDFTeX, should you need to.)i also declared some of your paired delimiters with a
\DeclarePairedDelimiter
command, which takes an optional size argument.Also,
physics
(which I’m not too familiar with) seems to redefine\div
to mean\nabla\cdot
, but in standard LaTeX, that means ÷. I’m editing now because that tripped me up, and I’d recommend you not use ambiguous code like this.