1

Today I see a beautiful equation:
How Pretty This Equation Is
(Sorry for cannot put the pic directly, I'm new here.)
I don't know how to write it in Tex. I try my best to write like following:

\begin{equation}
\begin{aligned}
r_{t}=\left\{
\begin{array}{crl}
1+\dfrac{\bar{R}_{Q}(t+\Delta t)-R_{Q}(t)}{2\Delta t/T_{single}}\; &+0\qquad &if\,\bar{R}_{Q}(t+\Delta t)>0,\\
0 \; &-P\qquad &if\,R_{Q}(t)\neq 0\wedge R_{Q}(t+\Delta  t)=0,\\
0\; &+0\qquad &if\,R_{Q}(t)=0
\label{rforProtRwd}
\end{array}
\right.
\\
\underbrace{\hspace{10em}}_{=:r_{t}^{(1)}}\hspace{1em}\underbrace{\hspace{2em}}_{=:r_{t}^{(2)}}\hspace{17em}
\end{aligned}
\end{equation}

My Ugle Brace
It is obviously that the underbrace is a little far from the main part of the equation. And actually both the method I write and the result are ugle. So I wonder if there are some better ways to write it. Hoping someone can help.

Til
  • 5,150
  • 13
  • 26
  • 34
freshn
  • 11
  • 2
  • 1
    Can you provide the smallest compilant document? – Andronicus Feb 17 '19 at 06:49
  • Have a look at [**this**](https://stackoverflow.com/questions/4027363/two-statements-next-to-curly-brace-in-an-equation) and [**this too**](https://tex.stackexchange.com/questions/30090/how-can-i-get-text-underneath-an-underbrace) :) – MattAllegro Feb 17 '19 at 20:11

1 Answers1

2

Here is an accurate \underbrace that matches the content within a cases environment.

enter image description here

\documentclass{article}

\usepackage{mathtools,eqparbox}

\begin{document}

\begin{align}
  r_t = \begin{cases}
    \eqmakebox[LHS]{$1 + \dfrac{\bar{R}_Q(t + \Delta t) - R_Q(t)}{2 \Delta t / T_{\text{single}}}$}
      + 0 & \text{if $\bar{R}_Q(t + \Delta t) > 0$}, \\
    \eqmakebox[LHS]{$0$} 
      - P & \text{if $R_Q(t) \neq 0 \wedge R_Q(t + \Delta t) = 0$}, \\
    \eqmakebox[LHS]{$0$}
      + 0 & \text{if $R_Q(t) = 0$}
  \end{cases} \\[-1.2\normalbaselineskip]
  \underbrace{\eqmakebox[LHS]{\mathstrut}}_{=:r_t^{(1)}}
    \underbrace{\mathstrut\phantom{{} - P}}_{\mathclap{=:r_t^{(2)}}}
    \quad\phantom{\text{if $R_Q(t) \neq 0 \wedge R_Q(t + \Delta t) = 0$},} \nonumber
\end{align}

\end{document}
Werner
  • 14,324
  • 7
  • 55
  • 77