我正在嘗試創建一個看起來像這樣的項目清單:
但我不知道如何正確定位支架。這是我目前擁有的,減去大括號(我將其編輯到螢幕截圖中):
\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
帶有 * 變體的命令)和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}