长集描述

长集描述

我想定义以下集合,但其描述太长。如何将其分成两部分?

$L_4 =\lbrace{ w \mid w \text{ every } 1 \text{ in } w \text{ is either preceded or followed (not necessarily immediately) } \\ \text{by two (need not be consecutive) }  0's\rbrace} $

答案1

在显示的方程式中,tabular可以使用并增加括号和线:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\[
  L_4 =\left\lbrace w \;\middle|\;
  \begin{tabular}{@{}l@{}}
    every 1 in $w$ is either preceded or followed (not necessarily\\
    immediately) by two (need not be consecutive) 0's
   \end{tabular}
  \right\rbrace
\]
\end{document}

结果

替代方案是\parbox,参见 Barbara 的评论。以下示例使用环境varwidth,即修改的minipage,它会自动将宽度缩小到所需的量。

\documentclass{article}
\usepackage{amsmath}
\usepackage{varwidth}

\begin{document}
\begin{gather*}
  L_4 =\left\lbrace w \;\middle|\;
  \begin{varwidth}{\linewidth}
    every 1 in $w$ is either preceded or followed (not necessarily\\
    immediately) by two (need not be consecutive) 0's
   \end{varwidth}
  \right\rbrace
\\
  L_4 =\left\lbrace w \;\middle|\;
  \begin{varwidth}{.5\linewidth}
    every 1 in $w$ is either preceded or followed (not necessarily
    immediately) by two (need not be consecutive) 0's
   \end{varwidth}
  \right\rbrace
\end{gather*}
\end{document}

结果

变体为enumerate

\documentclass{article}
\usepackage{amsmath}
\usepackage{varwidth}

\begin{document}
\begin{enumerate}
\item
  $\displaystyle % simulate displayed equation
  L_4 =\left\lbrace w \;\middle|\;
  \begin{varwidth}{\linewidth}
    every 1 in $w$ is either preceded or followed (not necessarily\\
    immediately) by two (need not be consecutive) 0's
   \end{varwidth}
  \right\rbrace$
\end{enumerate}
\end{document}

枚举结果

答案2

不要对整个事情使用数学模式:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

This is the set we all love
$L_4 =\lbrace w \mid{}$every $1$~in~$w$ is either
preceded or followed (not necessarily immediately)
by two (need not be consecutive)~$0$'s$\rbrace$
and some other text follows.

\end{document}

(我删除了w之后\mid看起来不合适的内容)。

在此处输入图片描述

但是,读者可能很难找到结束括号。较长的描述应该用文字来表达:

We denote by $L_4$ the set of words~$w$ such that 
every $1$~in~$w$ is either preceded or followed 
(not necessarily immediately) by two~$0$'s (which
need not be consecutive).

相关内容