TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


Though this also gives a bracket at the end.

Would anyone be able to help me ?

share|improve this question

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.

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
up vote 7 down vote accepted

Try this:


% Defining new math operators


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

% With the cases environment now
&\text{if }\src(x,y)>\text{thresh}\\

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 ;) – 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

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