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 try to rebuild a fairly complicated math-table, and I'm almost satisfied with the result. The MWE actually compiles to the table I want, but with error messages. When I include the table in my real (big) document, I get the error messages too, but in that case the document doesn't compile anymore.

I spent quite some time experimenting with and checking the $, but cannot find the error, and would be grateful for any tip.



theorem={Algebra}{texercise}{(Vereinfachter) Datentyp 'Liste'}{myMarker}]{}

 \textbf{algebra}  &  $list_1$  &  &  \\
 \textbf{sorts}    & \multicolumn{3}{l}{$list$, $elem$ \{$bool$ ist im folgenden immer implizit dabei\}}  \\
 \textbf{ops}      &  $empty$   &  $:$      &  $\to list$   \\
                   &  $first$   &  $:list$  &  $\to elem$   \\
                   &  $append$    &  $:list$  &  $\to list$   \\
                   &  $concat$    &  $:list \times elem$  &  $\to list$   \\
                   &  $isempty$    &  $:list \times list$  &  $\to bool$   \\
\textbf{sets}      &  $list$  & \multicolumn{2}{l}{$= \{ <a_1,\dots,a_n> \mid n \ge 0, a_i \in elem$\}}\\
\textbf{functions} & & & \\
                  &   $empty$ & \multicolumn{2}{l}{ $ = \Diamond$}\\
                  &   \multicolumn{3}{l}{
                     $first(a_1 \dots a_n) =$
                         $a_1$ & \text{falls $n>0$} \\
                         undefiniert & \text{sonst}
                     \end{equation*}}  \\
\textbf{end} $list_1$ & & & \\


Here is the error message:

ERROR: Missing $ inserted.

--- TeX said ---
<inserted text> 
l.36                      \end{equation*}}
--- HELP ---
TeX probably found a command that can be used only in math mode when
it wasn't in math mode....

And here is the result:

MWE result

share|improve this question
up vote 3 down vote accepted

There is no need for equation* in order to use the cases environment. Just use the following definition:

& \multicolumn{3}{l}{%
  $first(a_1 \dots a_n) =
      a_1 & \text{falls $n>0$} \\
      \text{undefiniert} & \text{sonst}
    \end{cases}$} \\

enter image description here

In part, the problem was that you're using equation* and then initiating math mode using $...$. An equation* already initiates math mode, so the use of $ is not needed.

You may also wish to use \langle...\rangle instead of <...> for your list notation.

share|improve this answer
It took me a while to check that out, but if I follow your example exactly, both the MWE and the real document compile - thanks a lot. What caused a lot of confusion on my side was the fact, that the way you positioned the '$` resulted in a (completely) wrong fontification in my Emacs buffer, but it works. Putting more '$' in the formula restores the correct fontification, but results in LaTeX errors. – user17106 Dec 4 '12 at 22:11
@user17106: Yes, some editors rely on the use of explicit math environments or switches (like $) in order to display the correct syntax highlighting. Mixing these in odd locations (like an equation* environment inside a tabular, say) causes the engine to not pick up on it properly, I guess. Perhaps advisable to submit a bug report to the editor programmers. It may be that the syntax parser has a number of exclusions in it for ad-hoc - yet completely appropriate in LaTeX terms - configurations. I don't know much about it, but have seen that in other editors. – Werner Dec 4 '12 at 22:20
Including the \begin{cases} and \end{cases} inside $...$ doesn't seem right at first sight, and thus Emacs puts the whole part in math-font. But if I exclude the begin and end expressions by setting more $, there are LaTeX errors, strangely enough. But anyway, it works fine now, thanks. – user17106 Dec 4 '12 at 22:26

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.