TransWikia.com

How to left-align cases inside an equation?

TeX - LaTeX Asked by Hadi GhahremanNezhad on November 9, 2020

I am trying to left-align a cases inside an equation, like this:

enter image description here

and I need it to be inside equation because of the number (16).
When I try this:

begin{equation} label{eq:evaluate_metrics}
begin{align*}
    &begin{cases}
        TPR=T_P/(T_P+F_N)
        FPR=F_P/(F_P+T_N)
        ACC=(T_P+T_N)/(T_P+F_N+F_P+T_N)
        PRE=T_P/(T_P+F_P)
    end{cases}
end{align*}
end{equation}

gives me an error:

Package amsmath Error: Erroneous nesting of equation
structures;(amsmath) trying to recover with `aligned’. end{align*}

How can I make it look like the picture while including the equation number?

One Answer

You can obtain locally left-aligned equations nesting them inside a fleqn environment from nccmath. This environment can take the distance from the text left margin at which it starts as an optional argument:

documentclass{article}
usepackage{amsmath, nccmath}
 usepackage[upright]{fourier} 
usepackage[reset, showframe]{geometry}

begin{document}

begin{fleqn}
begin{equation} label{eq:evaluate_metrics}
    begin{cases}
        TPR=T_P/(T_P+F_N)
        FPR=F_P/(F_P+T_N)
        ACC=(T_P+T_N)/(T_P+F_N+F_P+T_N)
        PRE=T_P/(T_P+F_P)
    end{cases}
end{equation}
end{fleqn}

begin{fleqn}[1em]
begin{equation} label{eq:evaluate_metrics}
    begin{cases}
        TPR=T_P/(T_P+F_N)
        FPR=F_P/(F_P+T_N)
        ACC=(T_P+T_N)/(T_P+F_N+F_P+T_N)
        PRE=T_P/(T_P+F_P)
    end{cases}
end{equation}
end{fleqn}

end{document} enter image description here

Correct answer by Bernard on November 9, 2020

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