I essentially want to get my equation to look like this, but can't quite get it. I've used drcases but then the alignment is difficult. I've also tried empheq, but still having issues. Any ideas?
Asked
Active
Viewed 445 times
3 Answers
5
You can use aligned inside dcases from the mathtools package. This is how the picture aligned.
\documentclass[a4paper]{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
\begin{dcases}\left.
\begin{aligned}
\frac{dG(t)}{dt} &= G_{in} - \sigma_2G - a\left(c+\frac{mI}{n+I}\right)G + b \\
\frac{dI(t)}{dt} &= \frac{\sigma_1G^2}{\alpha_1^2+G^2} - d_iI(t)
\end{aligned} \right \}, \quad t \ne k_\tau, & \\
\left.
\begin{aligned}
G(t^+) &= G(t) \\
I(t^+) &= I(t) + \sigma
\end{aligned} \right \}, \quad t = k_\tau, &
\end{dcases}
\end{equation}
\end{document}
Update:
You can also align all the equation at the = sign like this:
\documentclass[a4paper]{article}
\usepackage{mathtools,calc}
\newlength{\lhs}
\settowidth{\lhs}{ $\frac{dG(t)}{dt}$ }
\newcommand{\lhsbox}[1]{\makebox[\lhs][r]{$\displaystyle#1$}}
\begin{document}
\begin{equation}
\begin{dcases}\left.
\begin{aligned}
\lhsbox{\frac{dG(t)}{dt}} &= G_{in} - \sigma_2G - a\left(c+\frac{mI}{n+I}\right)G + b \\
\lhsbox{\frac{dI(t)}{dt}} &= \frac{\sigma_1G^2}{\alpha_1^2+G^2} - d_iI(t)
\end{aligned} \right \}, \quad t \ne k_\tau, & \\
\left.
\begin{aligned}
\lhsbox{G(t^+)} &= G(t) \\
\lhsbox{I(t^+)} &= I(t) + \sigma
\end{aligned} \right \}, \quad t = k_\tau, &
\end{dcases}
\end{equation}
\end{document}
AboAmmar
- 46,352
- 4
- 58
- 127
-
That looks really good. Is there anyway one could make the equals sign aligned instead of just flush left? – C.Hegg Nov 26 '18 at 18:45
-
Yes, please see my update – AboAmmar Nov 26 '18 at 18:52
-
Of course, what I meant is that the equal signs are only lined up in each aligned environment separately, I know this isnt what I asked, but if one of the equations we had an extra term on the LHS, then all 4 equal signs would no longer be aligned. – C.Hegg Nov 26 '18 at 19:01
2
Here's a solution that employs nested array environments.
\documentclass{article}
\usepackage{array,booktabs}
\newcolumntype{L}{>{\displaystyle}l}
\begin{document}
\[
\renewcommand\arraystretch{1.33}
\setlength\arraycolsep{0pt}
\left\{
\begin{array}{L}
\left.
\begin{array}{L}
a = ldfjdl;kfsja ;kfja;ksdljfa\\
b = asjfl;a ;adjfl;asj ;adjfals
\end{array}
\right\}
,\quad t\ne kr\,. \\ \addlinespace
\left.
\begin{array}{L}
c = jfdals;jkf\\
d = dsalfjasl;fja
\end{array}
\right\}
,\quad t=kr\,.
\end{array}
\right.
\]
\end{document}
Mico
- 506,678
2
The following uses eqparbox's \eqmakebox[<tag>][<align>]{<stuff>} to ensure all <stuff> with the same <tag> is set in a box of maximum width with the appropriate <align>ment. This automates the process of aligning the equation left-hand sides:
\documentclass{article}
\usepackage{mathtools,eqparbox}
\begin{document}
\begin{equation}
\begin{dcases}
\left. \begin{aligned}
& \eqmakebox[LHS][r]{$\dfrac{\mathrm{d}G(t)}{\mathrm{d}t}$}
= G_{in} - \sigma_2 G - a \left(c + \frac{mI}{n + I} \right) G + b \\
& \eqmakebox[LHS][r]{$\dfrac{\mathrm{d}I(t)}{\mathrm{d}t}$}
= \frac{\sigma_1 G^2}{\alpha_1^2 + G^2} - d_i I(t)
\end{aligned} \right \} \quad t \neq k_\tau, \\
\left. \begin{aligned}
& \eqmakebox[LHS][r]{$G(t^+)$} = G(t) \\
& \eqmakebox[LHS][r]{$I(t^+)$} = I(t) + \sigma
\end{aligned} \right \} \quad t = k_\tau
\end{dcases}
\end{equation}
\end{document}
Werner
- 603,163




