How do I format this equation in LaTeX?

This cannot be solved with the standard cases environment provided by amsmath, but you can use array:

\begin{equation*}
\left\lbrace
\begin{array}{@{} l c c @{}}
p & \text{fuego}    & p_{R}>R_{T}, p_{G}>G_{T}, p_{B}>B_{T} \\
p & \text{no-fuego} & \text{resto}
\end{array}
\right.
\end{equation*}

For \text you need \usepackage{amsmath}.


If you don't need the items centered you could use the cases environment.

If you do need them centered then using array as per egreg's solution is the simplest in this case, but you could also:

  1. Add some manual spacing with \hspace, or
  2. Use a \makebox with a specified width that looks good, or
  3. Use \widthof (requires the calc package) to obtain precise lengths for the \makebox macro:

Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{calc}

\begin{document}
Using \verb|\cases|:
\begin{equation*}
\begin{cases}
p \quad\text{fuego}    &p_{R}>R_{T}, p_{G}>G_{T}, p_{B}>B_{T} \\
p \quad\text{no-fuego} &\text{resto}
\end{cases}
\end{equation*}

\verb|\cases| with \verb|\hspace|:
\begin{equation*}
\begin{cases}
p \quad\text{\hspace{0.5em}fuego}    &p_{R}>R_{T}, p_{G}>G_{T}, p_{B}>B_{T} \\
p \quad\text{no-fuego} &\hspace{5.0em}\text{resto}
\end{cases}
\end{equation*}

\verb|\cases| with \verb|\makebox|:
\begin{equation*}
\begin{cases}
p \quad\makebox[1.3cm][c]{fuego}    &\makebox[4.4cm][c]{$p_{R}>R_{T}, p_{G}>G_{T}, p_{B}>B_{T}$} \\
p \quad\makebox[1.3cm][c]{no-fuego} &\makebox[4.4cm][c]{resto}
\end{cases}
\end{equation*}

\verb|\cases| with \verb|\makebox| with measured amounts:
\newcommand{\WidestColumnA}{no-fuego}
\newcommand{\WidestColumnB}{$p_{R}>R_{T}, p_{G}>G_{T}, p_{B}>B_{T}$}
\newcommand{\CenterColumnA}[1]{\makebox[\widthof{\WidestColumnA}][c]{#1}}
\newcommand{\CenterColumnB}[1]{\makebox[\widthof{\WidestColumnB}][c]{#1}}

\begin{equation*}
\begin{cases}
p \quad\CenterColumnA{fuego}    &\CenterColumnB{\WidestColumnB} \\
p \quad\CenterColumnA{no-fuego} &\CenterColumnB{resto}
\end{cases}
\end{equation*}
\end{document}

Tags:

Equations