TransWikia.com

code for NLP formula in latex

TeX - LaTeX Asked on January 12, 2021

enter image description here

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

begin{align}
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}
end{align}

3 Answers

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.

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

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.

Answered by Luis Sibaja on January 12, 2021

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.

begin{document}
begin{equation}
T(i) = begin{cases} 1, T geq 11 + beta T, T > 1 
end{cases}emph{, in which } T = begin{cases}T_{now}- 
T_{last}, T_{last} neq NULLT_{now}-T_{update}, T_{last} 
neq NULLend{cases}
end{equation}
end{document}

Answered by Will on January 12, 2021

I more prefer the following result:

enter image description here

which is produced by

documentclass{article}
usepackage{amsmath}

begin{document}
    [
T_{i} = begin{cases}
1       ,   & T leq 1
1+ beta T, & T > 1 
        end{cases},
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}
    end{cases}
    ]
end{document}

Answered by Zarko on January 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP