[Tex/LaTex] Smaller \lbrace than expected

bracesequations

Possible Duplicate:
How do I format this equation in LaTeX?

\begin{equation}
p_{GL}=
\lbrace
\begin{array}{@{} l c @{}}
0.59p_R+0.3p_G+0.11p_B & \text{p es un pixel del fuego}    \\
0 & \text{p no es pixel del fuego}
\end{array}
\label{eq4}
\end{equation}

That's the code of an equation but the \lbrace doesn't cover the two lines of equations.

Best Answer

Use it in the following way:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{equation}
  p_{GL}=\left\{
    \begin{array}{@{} l c @{}}
      0.59p_R+0.3p_G+0.11p_B & \text{$p$ es un pixel del fuego} \\
      0 & \text{$p$ no es pixel del fuego}
    \end{array}\right.
  \label{eq4}
\end{equation}
\end{document}

If the p contained within the descriptions (or conditions) on the right refers to the same p as in the equation, then use $p$ instead similar things should be formatted similarly.

amsmath also provides the cases environment which using a very similar layout by default:

\begin{equation}
  p_{GL}=\begin{cases}
      0.59p_R+0.3p_G+0.11p_B & \text{p es un pixel del fuego} \\
      0 & \text{p no es pixel del fuego}
    \end{cases}
  \label{eq4}
\end{equation}

In essence, it also typesets an array, but with a @{}l@{\quad}l@{} column alignment. This adds a little more space between the two columns (\quad), and typesets both left-aligned.

Related Question