我怎样才能创建这个对齐的括号内的东西?

我怎样才能创建这个对齐的括号内的东西?

我正在尝试创建一个如下所示的项目列表:

我想要的是

但我不知道如何正确定位括号。这是我目前所拥有的,减去括号(我将其编辑到屏幕截图中):

\documentclass{article}
\begin{document}
    \begin{tabular}{rcl}
        full-time & $\mapsto$ & $1$ \\
        \begin{tabular}{@{}r@{}}
            part-time \\
            not at all \\
            don't know
        \end{tabular} & $\mapsto$ & $0$ \\
        refused & $\mapsto$ & missing
    \end{tabular}
\end{document}

我知道有几种不同的解决方案可以利用\left. \right}数学模式,但我无法用这种方式对齐文本项。另一种解决方案bigdelim似乎不起作用。如果可以避免,我宁愿不使用 Tikz。

这是一个更扩展的示例,更类似于我在实际文档中所拥有的内容:

\documentclass{article}
\usepackage{multirow,bigdelim}
\begin{document}
Text goes here
    \begin{description}
        \item[\texttt{bigdelim}]
            \begin{itemize}
                \item[]
                \item[Sub-Thing:] Text goes here
                \item[Sub-Thing:]
                    \begin{tabular}{rcl}
                        full-time & $\mapsto$ & $1$ \\
                        part-time & & \\
                        not at all & & \\
                        don't know & $\rdelim){-3}{*}$ & \multirow{-3}{*}{$0$} \\  % rdelim} doesn't work anyway
                        refused & $\mapsto$ & missing
                    \end{tabular}
            \end{itemize}
        \item[\texttt{tabular}]
            \begin{itemize}
                \item[]
                \item[Sub-Thing:] Text goes here
                \item[Sub-Thing:]
                    \begin{tabular}{rcl}
                        full-time & $\mapsto$ & $1$ \\
                        \begin{tabular}{@{}r@{}}
                            part-time \\
                            not at all \\
                            don't know
                        \end{tabular} & $\mapsto$ & $0$ \\
                        refused & $\mapsto$ & missing
                    \end{tabular}
            \end{itemize}
    \end{description}
Text goes here
\end{document}

答案1

借助一些帮助xparse(可以轻松定义\source带有 *-variant 的命令)和array新的列类型:

\documentclass{article}

\usepackage{xparse,array}

\NewDocumentCommand{\source}{sm}{%
  \IfBooleanTF{#1}{\bracedsource{#2}}{#2 &}%
}
\NewDocumentCommand{\bracedsource}{m}{%
  \global\setbox9=\hbox{%
    \begin{tabular}{@{}r@{}}#1\end{tabular}%
  }%
  \copy9 & $\left.\hbox{\vphantom{\box9}}\right\rbrace$%
}

\newcolumntype{s}{r@{}c}

\begin{document}
\begin{tabular}{scl}
\source{full-time} & $\mapsto$ & $1$ \\
\source*{
  part-time \\
  not at all \\
  don't know
}                  & $\mapsto$ & $0$ \\
\source{refused}   & $\mapsto$ & missing
\end{tabular}
\end{document}

使用时\source*,参数可以包含\\,并且会产生适当大小的括号。请注意,包含源的列必须标记为(如果您还加载了抢占列类型的内容,s请更改该字符)。siunitx

在此处输入图片描述

答案2

干得好。

\documentclass{article}
\usepackage{multirow,bigdelim}
\begin{document}
Text goes here
    \begin{description}
        \item[\texttt{bigdelim}]
            \begin{itemize}
                \item[]
                \item[Sub-Thing:] Text goes here
                \item[Sub-Thing:]
                    \begin{tabular}{r@{}cl}
                        full-time &  & $\mapsto 1$ \\
                        part-time & & \\
                        not at all & & \\
                        don't know & $\rdelim\}{-3}{-0.1em}$ & \multirow{-3}{*}{$\mapsto 0$} \\  % rdelim} doesn't work anyway
                        refused &  & $\mapsto$ missing
                    \end{tabular}
            \end{itemize}
        \item[\texttt{tabular}]
            \begin{itemize}
                \item[]
                \item[Sub-Thing:] Text goes here
                \item[Sub-Thing:]
                    \begin{tabular}{rcl}
                        full-time & $\mapsto$ & $1$ \\
                        \hspace{\tabcolsep}$\left.\begin{tabular}{@{}r@{}}
                            part-time \\
                            not at all \\
                            don't know
                        \end{tabular}\right\}$\hspace{-\tabcolsep} & $\mapsto$ & $0$ \\
                        refused & $\mapsto$ & missing
                    \end{tabular}
            \end{itemize}
    \end{description}
Text goes here
\end{document}

在此处输入图片描述

rcases*这是使用或drcases*的版本mathtools

\documentclass{article}
\usepackage{mathtools}
\begin{document}
Text goes here
    \begin{description}
        \item[\texttt{rcases}]
            \begin{itemize}
                \item[]
                \item[Sub-Thing:] Text goes here
                \item[Sub-Thing:]
                    $\begin{aligned}
                        \text{full-time} &\mapsto 1 \\
                        \begin{drcases*}
                            & part-time \\
                            & not at all \\
                            & don't know
                        \end{drcases*} & \mapsto 0 \\
                        \text{refused} & \mapsto  \text{missing}
                    \end{aligned}$
            \end{itemize}
    \end{description}
Text goes here
\end{document}

在此处输入图片描述

答案3

另一种方法可能不太优雅:

\documentclass{article}
\usepackage{MnSymbol}
\usepackage{multirow}
\begin{document}
    \begin{tabular}{rcl}
        full-time & $\mapsto$ & $1$ \\
        \begin{tabular}{rl}
          part-time & \multirow{3}{*}{\Huge{$\rbrace$}} \\
          not at all & \\
          don't know & \\
        \end{tabular} & $\mapsto$ & $0$ \\
        refused & $\mapsto$ & missing
    \end{tabular}
\end{document}

对齐括号

相关内容