# Formula in LaTeX [duplicate]

Possible Duplicate:
How I can typeset this equation with LaTeX?

This'll probably be a too specific question, but I do think this forum has the most knowledge to help me with it.

I would like to write this equation in latex

I tried it with

 \begin{pmatrix}
\end{pmatrix}


Though this also gives a bracket at the end.

Would anyone be able to help me ?

-

## marked as duplicate by Kurt, Heiko Oberdiek, lockstep, Guido, barbara beetonDec 7 '12 at 14:01

Try the cases environment from the amsmath package. –  Ian Thompson Dec 6 '12 at 21:31
You might be interested in reading Math Mode (by Herbert Voß). –  clemens Dec 6 '12 at 21:33
In this concrete case I would use cases*, since it has text on the right and I find more intuitive that way. –  Manuel Dec 6 '12 at 21:34

Try this:

\documentclass{article}
\usepackage{amsmath}

% Defining new math operators
\DeclareMathOperator{\src}{src}
\DeclareMathOperator{\dst}{dst}

\begin{document}

\begin{equation*}
\dst(x,y) = \left\{
\begin{array}{@{}ll@{}} % edit as suggested by Qrrbrbirlbel
\text{maxVal} & \text{if }\src(x,y)>\text{thresh}\\
0 & \text{otherwise }\\
\end{array} \right.
\end{equation*}

% With the cases environment now
$\dst(x,y)= \begin{cases} \text{maxVal} &\text{if }\src(x,y)>\text{thresh}\\ 0 &\text{otherwise} \end{cases}$
\end{document


This results in:

-
@{}ll@{} and you get rid of additional space between the delimiters and the array. –  Qrrbrbirlbel Dec 6 '12 at 21:41
and I would prefer \operatorname{src}, or even better putting \DeclareMathOperator{\src}{src} in the preamble, and then \src in the text ;) –  yo' Dec 6 '12 at 22:32
@tohecz Agreed, will update answer. –  azetina Dec 6 '12 at 22:37
if use use mathtools and the cases* env, then you are already back into text mode in the second column –  daleif Dec 7 '12 at 10:39