tags:

views:

103

answers:

3

Hi,

Does anyone know how to modify the following string in order to display the two-lines bracket?

str = '$$c_i =\{\begin{array}{l l} 1  \quad L\left(Q_i\right) < 0 \\ 0 \quad L\left(Q_i\right) \geq 0 \\ \end{array}$$';

The current output is the following:

alt text

The sign '{' has to embrace both rows (1 and 0).

+1  A: 

Try add '\left' before '{' and '\rigth.' at the end.

It should look like

$$\alpha_t = \left { {{\sqrt{\frac1N},\; t = 0 } \atop {\sqrt{\frac2N},\; t \ne 0 } } \right.$$

or

$$ \left{\begin{tabular}{l} \textbf{Y} = 0,299\textbf{R} + 0,587\textbf{G} + 0,114\textbf{B} \ \textbf{Cb} = 128 + 0,5\textbf{R} - 0,418688\textbf{G} - 0,081312\textbf{B} \ \textbf{Cr} = 128 - 0,168736\textbf{R} - 0,331264\textbf{G} - 0,53\textbf{B} \end{tabular} \right.

$$

edit: It's eating \ before { :(

NWKJ
+6  A: 

$$c_i =\begin{cases} 1 & L\left(Q_i\right) < 0 \ 0 & L\left(Q_i\right) \geq 0 \end{cases}$$ alt text

The tex file should have "\usepackage{amsmath}" in the preamble.

Niall Murphy
I have tried to use the suggested string but it doesn't work. I am using it in Matlab text() function btw but I think it's not the case of Matlab.
niko
Your document must have \usepackage{amsmath} in the preamble to use cases. I thought array was in amsmath also (its not), so i didn't mention it.Output should look like this:http://quicklatex.com/cache/ql_35c820f1064bb80a3d501080c0e8eec3.gif
Niall Murphy
If you can't get that to work, try putting `\left\{` before the array, and `\right.` afterwards. The `\left` and `\right` commands size delimiters appropriately for what's in the middle, and the `.` is an invisible delimiter.
Antal S-Z
A: 

This is derived from Niall Murphy's answer, "tidied up" a bit:

$$
c_i =
\begin{cases} 
1 & L (Q_i) < 0 \\ 
0 & L (Q_i) \geq 0 
\end{cases}
$$ 

Note that the "\" becomes "\\", and I've removed the \left and \right parenthesis modifiers, which introduce unwanted (I think) space between L and (.

Brent.Longborough