两列中的案例环境换行符

两列中的案例环境换行符

我有案例环境,当在两列中使用时,它会分成另一列。

在此处输入图片描述

我该如何破解这些案件以防止入侵?这是源代码。

\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}

答案1

很尴尬,但是有了这样的两列方程,你就没有选择了。

\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}

在此处输入图片描述

答案2

这仍然有点太满,但或多或​​少适合,根据口味进行调整。请注意,您永远不应将数学斜体字体用于多字母标识符,该字体经过专门设计,以便相邻字母看起来像单独的变量,并且不是一个字。

在此处输入图片描述

\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}

相关内容