enter image description here

how to write the following conditional equation by latex , I tried the following code but it not work

T_{P_i} = \begin{cases} 1 & \text{,T $\leq$ 1} \\
1+ \beta T & \text{,T$>$ 1} \end{cases}
in which T_{P_i} = \begin{cases} T_{now}-T_{last} & \text{,T_{last} $\neq$ NULL} \\
T_{now}-T_{update} & \text{,T_{last} = NULL}  \end{cases}

3 Answers 3


There are some errors that I see in your code. Mainly, the use of subscripts inside \text{}. And also some things that might look better written in a different way. This code produces something similar to your image.

T_{i} = \begin{cases}
1, & \text{T $\leq$ 1}\\
1+ \beta T, & \text{T$>$ 1} \end{cases},
\text{ in which } T = 
T_{now}-T_{last}, & T_{last} \neq NULL \\
T_{now}-T_{update}, & T_{last} = NULL

If you need it inside the align environment, you can change of course, the \begin{equation*} and \end{equation*} to \begin{align} and \end{align}.

If you want to know a bit more why your code does or doesn't work, or about my code, just let me know.


The following code produces the result you're after. I find it best not to try to make the various components line up in your tex editor as they would on the page because adjusting the zoom ruins it anyway.

T(i) = \begin{cases} 1, T \geq 1\\1 + \beta T, T > 1 
\end{cases}\emph{, in which } T = \begin{cases}T_{now}- 
T_{last}, T_{last} \neq NULL\\T_{now}-T_{update}, T_{last} 
\neq NULL\end{cases}

I more prefer the following result:

enter image description here

which is produced by


T_{i} = \begin{cases}
1       ,   & T \leq 1\\
1+ \beta T, & T > 1 
\text{ in which } 
T = \begin{cases}
T_{\mathrm{now}}-T_{\mathrm{last}},   & T_{\mathrm{last}} \neq \mathrm{NULL} \\
T_{\mathrm{now}}-T_{\mathrm{update}}, & T_{\mathrm{last}} = \mathrm{NULL}

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .