# Line breaks for cases environment in two column

I have case environments that breaks into the other column when used in two column.

How can I break the cases to prevent the intrusion? This is the source code.

\documentclass[11pt, twocolumn]{article}

\usepackage{amsmath}
\usepackage{lipsum}
\begin{document}

\begin{itemize}
\item $range(type)$ returns the value range of $type$.
\item $related(key, type)$ returns a set of tuple ($key$, $type$) that is
related to the input $key$ and $type$.
\item $type(key)$ returns a $type$ of an input $key$.

\item zero detection function $z(key)$
$z(key) = \begin{cases} true, & \text{if}\ \forall i \in hash(key), table(i) = 0\\ false, & \text{otherwise} \\ \end{cases}$
\item $retrieve(key)$
$retrieve(key) = \begin{cases} \perp_{s}, & \text{if z(key) is true}\\ mask(key) \oplus \bigoplus_{i \in hash(key)} table[i], & \text{otherwise} \\ \end{cases}$
\end{itemize}

\lipsum

\end{document}

-

Crampy, but with such equations in two column, you don't have options.

\documentclass[11pt, twocolumn]{article}

\usepackage{amsmath}
\usepackage{lipsum}
\begin{document}

\begin{itemize}
\item $range(type)$ returns the value range of $type$.
\item $related(key, type)$ returns a set of tuple ($key$, $type$) that is
related to the input $key$ and $type$.
\item $type(key)$ returns a $type$ of an input $key$.

\item zero detection function $z(key)$
$z(key) = \begin{cases} true, & \begin{array}{@{}l@{}}\text{if}\ \forall i \in hash(key),\\ table(i) = 0\end{array}\\ false, & \text{otherwise} \\ \end{cases}$
\item $retrieve(key)$
$\begin{array}{@{}c@{}} retrieve\\ (key) \end{array} = \begin{cases} \perp_{s}, & \mkern-13mu\begin{array}{@{}l@{}}\text{if z(key)}\\ \text{is true}\end{array}\\ \begin{array}{@{}l@{}} mask(key) \oplus \\ \bigoplus_{i \in hash(key)} table[i], \end{array} & \mkern-13mu\text{otherwise} \\ \end{cases}$
\end{itemize}

\lipsum

\end{document}


-

This is still a bit overfull but more or less fits, adjust to taste. Note you should never use the math italic font for multi-letter identifiers, the font is specifically designed so that adjacent letters look like separate variables and not a word.

\documentclass[11pt, twocolumn]{article}

\usepackage{amsmath}
\usepackage{lipsum}
\begin{document}

\begin{itemize}
\item $range(type)$ returns the value range of $type$.
\item $related(key, type)$ returns a set of tuple ($key$, $type$) that is
related to the input $key$ and $type$.
\item $type(key)$ returns a $type$ of an input $key$.

\item zero detection function $z(key)$
$z(\mathit{key}) = \begin{cases} \mathit{true}, & \parbox[t]{4cm}{\raggedright if \forall i \in \mathit{hash}(\mathit{key}), \mathit{table}(i) = 0}\\ \mathit{false}, & \text{otherwise} \\ \end{cases}$
\item $\mathit{retrieve}(\mathit{key})$
\begin{multline}
\mathit{retrieve}(\mathit{key}) \\
{}=\begin{cases}
\perp_{s}, & \parbox[t]{3cm}{\raggedright
if $z(\mathit{key})$ is true}\\
\parbox[c]{3cm}{$\mathit{mask}(\mathit{key}) \oplus \bigoplus_{i \in \mathit{hash}(\mathit{key})} \mathit{table}[i],$}& \text{otherwise} \\
\end{cases}
\end{multline}
\end{itemize}

\lipsum

\end{document}

-