我想定义以下集合,但其描述太长。如何将其分成两部分?
$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).