我想在三行文本周围添加两组花括号,一组在另一组下方,左侧中间有一条短线。希望这足够清楚。抱歉图片太差。
答案1
这就是你想获得的东西吗?
\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{center}
Some text on the left
$\begin{array}{@{}l@{}c@{}}
\quad&\left\{
\begin{tabular}{@{}l@{}}
A line \\
A longer line \\
Another
\end{tabular}
\right\}
\\
\cmidrule{1-1}
&\left\{
\begin{tabular}{@{}l@{}}
A line \\
A longer line \\
Another
\end{tabular}
\right\}
\end{array}$
\end{center}
\end{document}
更好的实现(但使用低级命令),即使两个部分的行数不同也不会出现问题。
\documentclass{article}
\newcommand{\topbottombraced}[2]{%
\raise.5ex\vtop{
\vbox{%
\hbox{$\left\{\begin{tabular}{@{}l@{}}#1\end{tabular}\right\}$}
\vskip1pt
}
\vbox{%
\vskip1pt
\hbox{$\left\{\begin{tabular}{@{}l@{}}#2\end{tabular}\right\}$}
}
}%
}
\begin{document}
Some text on the left
\topbottombraced{
A line \\
A longer line \\
And another
}{
A line \\
A longer line \\
Another
}
\topbottombraced{
A line \\
A longer line \\
A longer line \\
A longer line \\
And another
}{
A line \\
A longer line \\
Another
}
\topbottombraced{
A line \\
A longer line \\
And another
}{
A line \\
A longer line \\
A longer line \\
A longer line \\
Another
}
\end{document}
答案2
使用以下软件包的解决方案blkarray
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{blkarray}%
\usepackage{xcolor}
\begin{document}
\renewcommand{\arraystretch}{1.3}
\[
\text{
\raisebox{3ex}{Shakespeare wrote}\quad
\begin{blockarray}{l}
\begin{block}{\{>{\enspace}l<{\,}\}}
Shall I compare thee to a summer's day?\\
Thou art more lovely and more temperate.\\
Rough winds do shake the darling buds of May,\\
And summer’s lease hath all too short a date.\\
Sometime too hot the eye of heaven shines,\\
And often is his gold complexion dimmed;\\
And every fair from fair sometime declines,\\
\end{block}
\begin{block}{\{>{\enspace}l<{\,}\}}
By chance, or nature’s changing course, untrimmed;\\
But thy eternal summer shall not fade,\\
Nor lose possession of that fair thou ow’st,\\
Nor shall death brag thou wand’rest in his shade,\\
When in eternal lines to Time thou grow’st.\\
So long as men can breathe, or eyes can see,\\
So long lives this, and this gives life to thee.\\
\end{block}\\
\end{blockarray}}
\]
\end{document}
答案3
如果您需要括号内的数学模式:
\def\bmatrix#1{\left\{\matrix{#1}\right\}}
$$
a + b + \cdots + f = \matrix{\bmatrix{a\cr b\cr c}\cr\bmatrix{d\cr e\cr f}}
$$
如果您需要括号内的文本模式:
\def\btext#1{\left\{\vcenter{\halign{##\strut\hfil\cr#1\crcr}}\right\}}
$$
a + b + \cdots + f = \matrix{\btext{aha\cr be\cr cc}\cr \btext{dee\cr e\cr ef\cr}}
$$
如果需要将两个用不同的行括起来的文本居中:
\def\centertwo#1#2{\raise\fontdimen22\textfont2\vtop{\vbox{\hbox{$#1$}\kern0pt}\hbox{$#2$}}}
$$
a + b + \cdots + f = \centertwo {\btext{aha\cr be}} {\btext{dee\cr e\cr ef}}
$$
\bye
注意。您的问题没有提到 LaTeX 作为所需的宏包。我的宏在纯 TeX 中工作。
答案4
这使用堆栈,并且如果上半部分和下半部分的条目数不同,则完全没有问题。
\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\begin{document}
This is baseline text
\strutlongstacks{T}%
\renewcommand\stackalignment{l}%
\stackunder[0pt]{\stackon[5pt]{}%
{$\left\{\setstackgap{L}{12pt}\Centerstack{%
first line\\second line\\third line}\right\}$}
}%
{$\left\{\setstackgap{L}{12pt}\Centerstack{%
first line\\second line of text\\third line\\fourth line}\right\}$}
\end{document}
在后续评论中,OP 询问了 中堆栈的使用情况tabular
。这样做只会出现 2 个怪癖:1)tabular
重新定义\baselineskip
,因此必须将长堆栈间隙设置为显式值,如\setstackgap{L}{12pt}
;2) 我使用\addstackgap{}
来在堆栈上方/下方提供垂直缓冲区。
\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\setstackgap{L}{12pt}
\begin{document}
\begin{tabular}{|c|c|}
\hline
\Centerstack{This is split\\ baseline text}
\strutlongstacks{T}%
\renewcommand\stackalignment{l}%
\addstackgap{%
\stackunder[-1pt]{\stackon[6pt]{}%
{$\left\{\setstackgap{L}{12pt}\Centerstack{%
first line\\second line\\third line}\right\}$}
}%
{$\left\{\setstackgap{L}{12pt}\Centerstack{%
first line\\second line of text\\third line\\fourth line}\right\}$}}
& blah blah\\
\hline
\end{tabular}
\end{document}