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 tried this and that, but could not solve this problem. Here is the code that produces this error:

\begin{equation}
o=g(h)=\left\{\begin{array}{rcl}
    1 & if & h <   0 \\
    0 & if & h \le 0 
\end{array}\right
\end{equation}

The error is given on the line \end{equation} resides. Thanks.

share|improve this question
4  
Put a . after \right like \right. –  Harish Kumar Feb 27 at 13:21
    
Yes, this solved. But why the "."? –  ozi Feb 27 at 13:31
1  
\right requires a following token to say what delimiter to stretch, or . to specify a null delimiter. But your setting is wrong if is a multi letter word so should not be using the math italic font use \mathrm{if} or (much) better use the cases environment from the amsmath package. –  David Carlisle Feb 27 at 13:32
    
BTW, if h < 0, then g(h) has two values 1 and 0? And g(h) is undefined for h > 0? –  Heiko Oberdiek Feb 27 at 13:50
    
Thanks guys each of your comments were useful. –  ozi Feb 27 at 13:56

1 Answer 1

up vote 7 down vote accepted

\left\{ must be balanced by a \right\} in the same line. Since you don't want the right delimiter, and since the closing pair is needed, you have to put a null delimiter by \right.

\documentclass{article}
\begin{document}
  \begin{equation}
    o=g(h)=\left\{\begin{array}{rcl}
                     1 & if & h <   0 \\
                     0 & if & h \le 0
\end{array}\right.  %% <--here
\end{equation}
\end{document}

enter image description here

But for this amsmath provides cases environment. I suggest you to use this. A sample will be:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
  \begin{equation}
    o=g(h)=\begin{cases}
              1 & \text{if $ h < 0 $}\\
              0 & \text{if $ h \le 0$}
\end{cases}
\end{equation}
\end{document}

enter image description here

Note the use of \text macro which is also provided by amsmath.

share|improve this answer

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.