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'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.

share|improve this question
1  
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
add comment

1 Answer

up vote 5 down vote accepted

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}
  • \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)
share|improve this answer
add comment

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.