0

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?

5
  • It's wrong to use align* inside equation. Just remove \begin{align*}, \end{align*} and also the &.
    – egreg
    Commented Aug 7, 2020 at 15:56
  • @egreg I did that, the cases are left-aligned, but the whole thing is in the center. Commented Aug 7, 2020 at 15:58
  • 1
    That's where it should be, unless you left align all equations.
    – egreg
    Commented Aug 7, 2020 at 15:59
  • @egreg I get it. It is not possible to left-align only one equation. Commented Aug 7, 2020 at 16:04
  • 2
    Yes, but why? I see no reason to. If you really want it, change equation into flalign, add & in front of \begin{cases}` and && after \end{cases}. But don't.
    – egreg
    Commented Aug 7, 2020 at 16:10

1 Answer 1

2

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

You must log in to answer this question.

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