# Error with dcases*

I'm using LaTeX to write up my math notes and have been fairly successful implementing most of the styles I'm trying to figure out. I seem to be having trouble with the environment dcases* though.

Using the code

\item Let $g: \N \rightarrow \N$ be given by $n=$
\begin{dcases*}
$1$ & if $n=1$ \\
$n-1$ & if $n \not = 1$
\end{dcases*}


gives me an error saying that it can only be used in math mode. Then it gives me a bunch of errors surrounding missing deliminators, but there aren't any missing. The other weird thing is that it does display properly.

-
Welcome to TeX.sx! As new user without image posting privileges simply include the image as normal and remove the ! in front of it to turn it into a link. A moderator or another user with edit privileges can then reinsert the ! to turn it into an image again. –  Qrrbrbirlbel Feb 15 '13 at 1:27

Perhaps you meant something like the following, note that dcases must be in mathmode, and ideally in displayed mathmode such as

• $...$
• $$...$$
• \begin{equation*}...\end{equation*}

Here's a complete MWE:

% arara: pdflatex
\documentclass{article}
\usepackage{mathtools}

\begin{document}

Let $g: N \rightarrow N$ be given by
$n= \begin{dcases*} 1 & if n=1 \\ n-1 & if n \ne 1 \end{dcases*}$

\end{document}


For future reference, you can view pages 17 and 18 of the documentation which describe that

• dcases puts every column in mathmode
• dcases* puts only the first column in mathmode, and the second column in the normal roman font of the document (hence the need to step back into mathmode in the second column)
-