# problem when writing an equation with latex: missing delimiter (. inserted)

I tried this and that, but could not solve this problem. Here is the code that produces this error:

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


The error is given on the line resides. Thanks.

-
Put a . after \right like \right. – Harish Kumar Feb 27 '14 at 13:21
Yes, this solved. But why the "."? – ozi Feb 27 '14 at 13:31
\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 '14 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 '14 at 13:50
Thanks guys each of your comments were useful. – ozi Feb 27 '14 at 13:56

\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}
$$o=g(h)=\left\{\begin{array}{rcl} 1 & if & h < 0 \\ 0 & if & h \le 0 \end{array}\right. %% <--here$$
\end{document}


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

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


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

-
\begin{numcases}{|x|=}
x, & for $x \geq 0$ \label{eq:4}
\\ -x, & for$x < 0$ \label{eq:5}
\end{numcases}


You have to use

\usepackage{cases}

-