Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

marked as duplicate by Marco Daniel, qubyte, lockstep, Peter Grill, Paulo Cereda Jan 1 '12 at 9:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

5  
\left\lbrace before the array, and \right. after it. That's how I've written in the previous answer to a question of yours. Please, consider deleting this question. Inside \text, write $p$, not simply p, as it's a math variable. –  egreg Dec 31 '11 at 16:37
    
The linked document is the same –  Marco Daniel Dec 31 '11 at 17:24
    
I'm in Japan, and post new year celebrations, the question @MarcoDaniel links to still badly hurts my brain. I had to alter the title. Perhaps it's just new year cheer that powers me, but I'm going to mark this one down. –  qubyte Dec 31 '11 at 18:54
    
@MarkS.Everitt: I voted to close ;) and I am in 2011 ;-) –  Marco Daniel Dec 31 '11 at 19:00
    
@MarcoDaniel: I voted to close, from the future! –  qubyte Dec 31 '11 at 19:29

2 Answers 2

up vote 6 down vote accepted

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.

share|improve this answer
    
Thanks for the advice –  Jorge Vega Sánchez Dec 31 '11 at 16:43
    
@Werner: Why not use {cases} which is exactly for this kind of thing? –  Philippe Goutet Dec 31 '11 at 17:17
    
Thanks @PhilippeGoutet. I've added it, and mentioned the differences in alignment from what the OP used. –  Werner Dec 31 '11 at 17:23

this can also be done in the following way:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\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}
\end{document}

enter image description here

share|improve this answer
    
+1, but because I'm picky, could you please add an image of the output of this code? –  qubyte Dec 31 '11 at 19:01
1  
@CounterTerrorist -- thanks. there's no faq for how to do this; i've been looking for half an hour for directions, and the only ones i've found say post from a url, but i don't have access to an outgoing url (behind a rather well regulated firewall). someday i'll figure it out. –  barbara beeton Dec 31 '11 at 19:51
    
Are you having trouble uploading an image that you have, or creating the image that you want to upload? Perhaps How do you crop an attached pdf? is of interest. –  Werner Jan 3 '12 at 18:41
1  
@Werner -- the problem is in finding instructions for uploading the image. i've just posted a question to the meta list asking that this information be put in the faq. –  barbara beeton Jan 3 '12 at 20:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.