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.

I am trying to render the following discontinuous function definition

enter image description here

with the LaTeX code:

\begin{equation}
 f(x) = \left\{
     \begin{array}{lr}
       0,5x & \text{for x} \in [0, 10] \\
       0,55x + 5 & \text{for x} \in (10, 30] \\
       0,1x + 25 & \text{for x} \in (30, 40] \\
       0,6x + 10 & \text{for x} \in (40, +\infty)
     \end{array}.
   \right
\end{equation}

At Texify and other online LaTeX equation editors, this code renders fine (as you can see), but if I use this code in my document at the compilation time I get errors:

Missing delimeter (. insterted)
Missing $ inserted
Display math should end with $$
Bad math environment delimenter. \end{equation}
You can't use '\egno' in vertical mode \end{equation}
Missing $ inserted \end{equation}
Display math should end with $$ \end{equation}

I have used LaTeX for rendering equations for two weeks so sorry for my poor knowledge (probably it will be something obvious for most of you).

share|improve this question
    
You should put the x outside \text{...}, as it's math, not text. Also, you may consider using \text{for $x \in (10, 30]$} which makes copy/pasting/reusing from or in other parts of the document easier. –  Philippe Goutet Aug 20 '11 at 16:00

1 Answer 1

up vote 5 down vote accepted

Write \right. instead of just \right, the dot is required for a phantom delimiter.

output

However, you could use the cases environment of amsmath instead of this array.

\begin{equation}
 f(x) = \begin{cases}
       0,5x & \text{for x} \in [0, 10] \\
       0,55x + 5 & \text{for x} \in (10, 30] \\
       0,1x + 25 & \text{for x} \in (30, 40] \\
       0,6x + 10 & \text{for x} \in (40, +\infty)
     \end{cases}
\end{equation}

cases example

You don't need to write \left\{ and \right.. Note, the text is left aligned here, which could be more desirable.

share|improve this answer
    
That's it! Thank you very much. What i noticed, is that the left bracket (in both cases) looks like it was crossed by some horizontal (white) lines. If I change the zoom, there is more or less of these lines and they appear in different places - so I assume that's a reader application issue (or my monitor:)) and these lines will not be visible in the output document? –  Piotrek De Aug 20 '11 at 12:54
2  
@Piotrek: yes it's a displaying issue (not of your monitor) of the composed symbol. It should be fine in print because of the higher resolution. –  Stefan Kottwitz Aug 20 '11 at 13:03
2  
@Stefan: x should be outside \text{...}. In fact, it's often better to write \text{for $x \in (10, 30]$} as it makes copy/pasting/reusing from or in other parts of the document easier. Also, note that unless you use \begin{array}{@{}lr}, the solution with {array} will have too much space between the brace and the equations. –  Philippe Goutet Aug 20 '11 at 15:41
    
@Philippe: that's correct, as can bee seen in the output images, good addition. It would be good to address your comment to Piotrek, as it may help him. –  Stefan Kottwitz Aug 20 '11 at 15:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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