编辑 -
我不确定这些叫什么,但是如何在 LaTeX 中做这样的事情:
干杯
编辑#1
这部分有效 - 但效果不是很好
\documentclass{book}
\usepackage{amsmath}
\begin{document}
\[
\left.
\begin{minipage}{2cm}
\begin{itemize}
\item One
\item Two
\item Three
\end{itemize}
\end{minipage}
\right\} \text{Description}
\]
\[
\left.
\begin{minipage}{2cm}
\begin{itemize}
\item One
\item Two
\item Three
\end{itemize}
\end{minipage}
\right\} \text{Description}
\]
\end{document}
答案1
这里我通过 引入了逐项列表,\braceditems[width]{items}
并通过 引入了注释。可以通过和\mycomment[width]{commentary}
重新指定默认宽度。括号只是一个缩放的字形,宽度限制为 1.5ex,如可选参数中所述(请参阅附录以了解替代括号样式)。\leftwidth
\rightwidth
\}
\scalerel*
如果我对环境有更多的了解,我相信我可以自动化它,但是\addgap
在第一个列表之前需要一个\braceditems
。
\documentclass{article}
\usepackage{scalerel,lipsum}
\def\leftwidth{.6\textwidth}
\def\rightwidth{.35\textwidth}
\newsavebox\tmpbox
\newcommand\braceditems[2][\leftwidth]{%
\noindent\savebox{\tmpbox}{%
\begin{minipage}{#1}
\begin{itemize}
#2
\end{itemize}
\end{minipage}%
}%
\usebox{\tmpbox} \scalerel*[1.5ex]{\}}{\usebox{\tmpbox}}
}
\newcommand\mycomment[2][\rightwidth]{%
\parbox{#1}{\raggedright #2}\addgap%
}
\newcommand\addgap{\par\bigskip}
\begin{document}
\lipsum[3]
\addgap
\braceditems[2in]{
\item This is
\item just some text
\item that I'm
}
\mycomment[.15\textwidth]{talk a bit about those}
\braceditems[2in]{
\item using as an
\item example so that
\item people know what
}
\mycomment[.15\textwidth]{talk a bit about these ones as well}
\braceditems[2in]{
\item I mean as it
\item might be tricky
\item to describe
\item even when the region is larger than the OP specified.
}
\mycomment[.15\textwidth]{and talk about these}
\lipsum[4]
\end{document}
附录:
如果你碰巧想要 LaTeX 常见的可扩展括号,那么这个重新定义(需要包graphicx
)就足够了:
\usepackage{graphicx}
\newcommand\braceditems[2][\leftwidth]{%
\noindent\savebox{\tmpbox}{%
\begin{minipage}{#1}
\begin{itemize}
#2
\end{itemize}
\end{minipage}%
}%
\usebox{\tmpbox} \scalerel*[1.5ex]{%
\raisebox{2pt}{\rotatebox[origin=c]{90}{%
\makebox[\dimexpr\ht\tmpbox+\dp\tmpbox\relax]{\upbracefill}}}%
}{\usebox{\tmpbox}}
}
答案2
这里有两个变体,一个使用blkarray
和listliketab
包,enumitem
另一个使用环境itemize
。另一个变体仅模仿itemize
,并且设计用于单行“项目”:\documentclass[12pt, a4pape, leqno]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern}
\usepackage{blkarray}
\usepackage{enumitem}
\usepackage{listliketab}
\begin{document}
Some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text.
\storestyleof{itemize}
\begin{listliketab}
\begin{blockarray}{@{\hskip\parindent} >{ \arraybackslash}p{6cm}}%
\begin{block}{@{}l<{\enspace}\Right{\}\enspace}{\parbox{2.5cm}{\raggedright talk a bit about these}}}%
\parbox{4cm}{\raggedright\begin{itemize}[leftmargin=1.8em, itemsep = 0ex, topsep = 0pt]
\item this is
\item just some
\item text that I’m
\end{itemize}}\\[4ex]
\end{block}
%
\begin{block}{@{}l<{\enspace}\Right{\}\enspace}{\parbox{2.5cm}{\raggedright talk a bit about these ones as well}}}%
\parbox{4cm}{\raggedright\begin{itemize}[leftmargin=1.8em, itemsep = 0ex, topsep = 0pt]
\item using as an
\item example so that text text text text
\item people know what
\end{itemize}}\\[4ex]
\end{block}
%
\begin{block}{@{} >{}l<{\enspace}\Right{\}\enspace}{\parbox{2.5cm}{\raggedright and talk about these}}}%
\parbox{4cm}{\raggedright\begin{itemize}[leftmargin=1.8em, itemsep = 0ex, topsep = 0pt]
\item I mean as it
\item might be tricky
\item to describe
\end{itemize}}\\
\end{block}
\end{blockarray}
\end{listliketab}
\storestyleof{itemize}
\begin{listliketab}
\renewcommand\arraystretch{1.333}
\begin{blockarray}{@{}>{\arraybackslash}l}%
\begin{block}{@{\hskip0.3\parindent}>{\textbullet\hskip\labelsep}l<{\enspace}\Right{\}\enspace}{\parbox{2.5cm}{\raggedright talk a bit\\ about these}}}%
this is \\
just some \\
text that I’m \\
\end{block}
%
\begin{block}{@{}>{\hskip0.3\parindent\textbullet\hskip\labelsep}l<{\enspace}\Right{\}\enspace}{\parbox{2.5cm}{\raggedright talk a bit about these ones as well}}}%
using as an \\
example so that text text text text\\
people know what \\
\end{block}
%
\begin{block}{@{} >{\hskip0.3\parindent\textbullet\hskip\labelsep}l<{\enspace}\Right{\}\enspace}{\parbox{2.5cm}{\raggedright and talk about these}}}%
I mean as it \\
might be tricky \\
to describe\\
\end{block}
\end{blockarray}
\end{listliketab}
\end{document}
答案3
如果您不介意加载 TiKZ 所涉及的开销(或者如果您正在将其用于其他用途),您可以使用该tikzmark
库。以下代码定义了一个新环境,braced
它接受一个参数,该参数应该是您想要排版在项目列表右侧的描述。然后,您可以使用\item
来定义项目,就像在常规环境中一样itemize
。您将它放在\bracefirst
要包含在括号中的第一个项目之后、\bracelast
最后一个项目之后和\bracewidest
最宽的项目之后。这意味着,如果您愿意,您可以用括号括住列表中项目的子集:
\documentclass{book}
\usepackage{tikz,enumitem}
\usetikzlibrary{tikzmark,decorations.pathreplacing,calc}
\newlist{braceditems}{itemize}{1}
\setlist[braceditems,1]{%
label=\textbullet,
before={\stepcounter{braced}},
}
\newcounter{braced}
\setcounter{braced}{0}
\newcommand\bracefirst{\tikzmark{first braced \thebraced}}
\newcommand\bracelast{\tikzmark{last braced \thebraced}}
\newcommand\bracewidest{\tikzmark{widest braced \thebraced}}
\newenvironment{braced}[1]{%
\providecommand{\braceddescriptor}{#1}%
\begin{braceditems}%
}{%
\end{braceditems}%
\begin{tikzpicture}[overlay,remember picture]
\draw [decorate, decoration=brace, xshift=10pt] ($({pic cs:first braced \thebraced} -| {pic cs:widest braced \thebraced}) + (0,1em)$) -- ($({pic cs:last braced \thebraced} -| {pic cs:widest braced \thebraced}) - (0,.5em)$) node [right, midway, xshift=5pt] {\braceddescriptor} ;
\end{tikzpicture}
}
\begin{document}
\begin{braced}{Description 1}
\item One\bracefirst
\item Two
\item Three\bracelast\bracewidest
\end{braced}
\begin{braced}{Description 2}
\item One\bracefirst
\item Two and a bit\bracewidest
\item Three\bracelast
\end{braced}
\begin{braced}{Description 3}
\item Nought (an unbraced item)
\item One\bracefirst
\item Two and a bit\bracewidest
\item Three\bracelast
\item Final (outside the braces)
\end{braced}
\end{document}
答案4
我想到的一个快速解决方案是滥用案例环境:
\documentclass{minimal}
\usepackage{amsmath}
\begin{document}
$
\mbox{\begin{minipage}{3cm}some long description braking to next line\end{minipage}}
\begin{cases}
\mbox{item 1} \\
\mbox{item 2} \\
\mbox{item 3}
\end{cases}
$
\end{document}
得到如下结果(但是左侧有一个括号):
(当然,这不是案例环境想要做的事情……但它确实有效。)