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 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

enter image description here

I tried it with

 \begin{pmatrix}
\end{pmatrix}

Though this also gives a bracket at the end.

Would anyone be able to help me ?

share|improve this question
8  
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ß). –  cgnieder 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
add comment

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

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.

1 Answer

up vote 7 down vote accepted

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:

enter image description here

share|improve this answer
    
@{}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 ;) –  tohecz 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
add comment

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