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 have case environments that breaks into the other column when used in two column.

enter image description here

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}
share|improve this question

2 Answers 2

up vote 4 down vote accepted

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}

enter image description here

share|improve this answer

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.

enter image description here

\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}
share|improve this answer

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.