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

I realise this sounds like a daft question, but I have a lot of missing symbols coming up in my work, but they are there!

One such example is

\begin{equation} \label{eq:rgbtohsb}
$Hue = \left\{\begin{array}{ccc}
\frac{g - b}{max(r,g,b)- min(r,g,b)} & \quad \text{if } & max(r,g,b) =  r\\
\frac{b-r}{max(r,g,b)- min(r,g,b)} & \quad \text{if } & max(r,g,b) = g \\
\frac{r-g}{max(r,g,b)- min(r,g,b)} & \quad \text{if } & max(r,g,b) = b \\

Saturation = \left \{ \begin{array}{ccc}
0 & \text{if } & r = g = b\\
\frac{max(r,g,b)}{V} & \quad \text{ otherwise} \\
\end{array} $

$Value = max(r,g,b)$

$Lightness = \frac{1}{2}(max(r,g,b) + min(r,g,b)) $

As you can see I do indeed have all of the $. Also I have the \begin{center} and \end{center}

Another error, is that it says \begin{document} ended by \end{equation}

Here is the header I am using

{\tiny }

I do have an \end{document}

Thanks for your help!

share|improve this question
You can't change in math-mode (started by \begin{equation} to inline-math-mode ($) as far as I know. Also i don't think you can use center in an equation, but I didn't test it. – Juri Robl Aug 30 '12 at 13:14
The problem has nothing to do with TeXstudio. – Guido Aug 30 '12 at 13:40
up vote 3 down vote accepted

There are four mistakes in your example.

  • You don't need \begin/end{center} for displayed equations; they are centred by default.

  • You don't need dollar signs inside an equation environment; you are in maths mode already.

  • You can't have \left without a matching \right, though you can use \right. if you don't want the right delimiter.

  • You can't have empty lines inside an equation environment.

A corrected version (with unnecessary material removed) is as follows. If you don't want the equations to be numbered, you can use equation* in place of equation, and you can abbreviate\begin{equation*} and \end{equation*} to \[ and \]. Finally, note that there are predefined commands \max and \min which produce better results than just typing 'max' and 'min'.

\begin{equation} \label{eq:rgbtohsb}
\text{Hue} = \left\{
\frac{g - b}{max(r,g,b)- \min(r,g,b)} & \quad \text{if } & \max(r,g,b) =  r\\
\frac{b-r}{max(r,g,b)- \min(r,g,b)} & \quad \text{if } & \max(r,g,b) = g \\
\frac{r-g}{max(r,g,b)- \min(r,g,b)} & \quad \text{if } & \max(r,g,b) = b \\
\text{Saturation} = \left \{ \begin{array}{ccc}
0 & \text{if } & r = g = b\\
\frac{\max(r,g,b)}{V} & \quad \text{ otherwise} \\
\text{Value} = \max(r,g,b)
\text{Lightness} = \frac{1}{2}(\max(r,g,b) + \min(r,g,b))

The amsmath package (which is automatically loaded when you load mathtools) provides lots of other environments for formatting mathematics, some of which (e.g. gather) may be better than equation, depending on the structure of your actual document. You might also find it useful to read the Not so Short Introduction to LaTeX.

share|improve this answer
\[ \] is unnumbered, equation is numbered. It could appear that the OP wished a single number for everything, in which case one could replace center with gathered. Last suggestion, perhaps use \max and \min? – Torbjørn T. Aug 30 '12 at 13:35
@Guido --- Indeed. I was thinking of equation*. – Ian Thompson Aug 30 '12 at 13:35
Sorry for nagging, but one more thing: I think one generally should not have several equations in sequence, but rather use a gather. – Torbjørn T. Aug 30 '12 at 13:41
@TorbjørnT. --- I wasn't sure exactly what result the OP wanted, so I just fixed the errors. However, I have added a link to the amsmath documentation. – Ian Thompson Aug 30 '12 at 13:55

Your Answer


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.