# Missing $error in equation > cases environment I'm getting a missing$ in equation environment, but only when in cases environment. Of the two examples below only the equation that implements the cases environment is giving me troubles:

\documentclass[11pt,fleqn]{book} % Default font size and left-justified equations
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\usepackage{pgfplotstable}
\usepgfplotslibrary{polar}
\usepgflibrary{shapes.geometric}
\usetikzlibrary{calc}
\usepackage{tikz}
\usepackage{booktabs}
\usepackage{fancyhdr}
\usepackage{array}
\usepackage{colortbl}
\usepackage{xcolor} % Required for specifying colors by name
\definecolor{ocre}{RGB}{52,177,201} % Define the orange color used for highlighting throughout the book
% Font Settings
\usepackage{avant} % Use the Avantgarde font for headings
\usepackage{times} % Use the Times font for headings
\usepackage{mathptmx} % Use the Adobe Times Roman as the default text font together with math symbols from the Symbol, Chancery and Computer Modern fonts
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{amsthm}
%\usepackage{amsmath}
\usepackage{mathtools}
\DeclarePairedDelimiter\Floor\lfloor\rfloor
\DeclarePairedDelimiter\Ceil\lceil\rceil
% Bibliography
\usepackage[style=alphabetic,sorting=nyt,sortcites=true,autopunct=true,babel=hyphen,hyperref=true,abbreviate=false,backref=true,backend=biber]{biblatex}

%\input{structure} % Insert the commands.tex file which contains the majority of the structure behind the template

%----------------------------------------------------------------------------------------
%   Definitions of new commands
%----------------------------------------------------------------------------------------
\def\R{\mathbb{R}}
\newcommand{\cvx}{convex}
% glossary
\begin{document}
$$\label{Rate of exchange for Giver: ROEG} ROE (\frac{\epsilon}{n},\iota ,b) = (1-\frac{\epsilon}{n})*\iota ^n b$$
This is the giver's model. It will be extended to include situations where a person gives more than
$(1-\frac{\epsilon}{n})$.

$$\label{Rate of exchange for Reciever: ROER} ROE (\frac{\epsilon}{n},\iota) = \begin{cases} (1-\frac{\epsilon}{n})*\iota^n & \text{if\frac{\epsilon}{n}>1} \\ (\frac{\epsilon}{n}-1)*\iota^n & \text{if\frac{\epsilon}{n}<1} \\ \end{cases}$$
\end{document}

• Remove the blank line between \end{cases} and . – Bernard May 12 at 14:40
• Also, \text starts text mode, so \text{\frac{}{}} is an error because \frac requires math mode. – Torbjørn T. May 12 at 14:41

Some comments and suggestions. As @Bernard and @TorbjørnT. have already pointed out, you must

• remove the blank line between \end{cases} and , and
• change \text{if\frac{\epsilon}{n}>1} to \text{if }\frac{\epsilon}{n}>1, and similarly for the second case.

In addition, you should also consider replacing all three instances of * with \cdot (or omitting * entirely), typesetting the variable names using upright Roman letters, and -- this is optional -- replacing all cases of \frac{\epsilon}{n} with \epsilon/n, i.e., using inline-fraction notation.

Incidentally, there's no need to load the times package (which is obsolete anyway) since you also load mathptmx. Oh, and don't load the colortbl and xcolor packages independently; instead, run \usepackage[table]{xcolor}.

\documentclass[11pt,fleqn]{book}
%%%\usepackage{colortbl}
%%%\usepackage{xcolor} % Required for specifying colors by name
\usepackage[table]{xcolor}
\definecolor{ocre}{RGB}{52,177,201} % Define the orange color used for highlighting throughout the book

% Font Settings
\usepackage{avant} % Use the Avantgarde font for headings
%%%%\usepackage{times} % Use the Times font for headings
\usepackage{mathptmx} % Use the Adobe Times Roman as the default text font together with math symbols from the Symbol, Chancery and Computer Modern fonts
\usepackage{microtype} % Slightly tweak font spacing for aesthetics

\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs

\usepackage{amsthm}
%\usepackage{amsmath} % is loaded automatically by 'mathtools'
\usepackage{mathtools}
\DeclarePairedDelimiter\Floor\lfloor\rfloor
\DeclarePairedDelimiter\Ceil\lceil\rceil

% New user commands
\def\R{\mathbb{R}}
\newcommand{\cvx}{convex}
\newcommand\vn[1]{\mathrm{#1}}

% glossary

\begin{document}
$$\label{Rate of exchange for Giver: ROEG} \vn{ROE}(\epsilon/n,\iota,b) = (1-\epsilon/n)\cdot\iota^n b$$
This is the giver's model. It will be extended to include situations
where a person gives more than $1-\epsilon/n$.
$$\label{Rate of exchange for Receiver: ROER} \vn{ROE} (\epsilon/n,\iota) = \begin{cases} (1-\epsilon/n)\cdot\iota^n & \text{if }\epsilon/n>1 \\ (\epsilon/n-1)\cdot\iota^n & \text{if }\epsilon/n<1 \end{cases}$$
\end{document}

• Thank you for this useful advice! – Michael Perdue May 12 at 16:13