我正在尝试制作一个 2 列的表格(这是我整个文档中唯一一个有 2 列的部分)。由于有些行太长,我希望它们换行(这部分可以工作)。但是,这会导致行上出现空白行,而文本较短(例如第一行 - 左侧列只有 1 行,但右侧列有 2 行)。我该如何优雅地编辑它,使其换行并且空白消失。最坏的情况是手动拆分行并将它们放在单独的行上。下图显示了我想要向上移动的行的示例。
\documentclass[12pt, notitlepage]{article}
\usepackage[letterpaper, portrait, margin=1in]{geometry}
\usepackage{amsmath}
\begin{document}
\begin{tabular}{p{0.05\textwidth} p{0.4\textwidth} p{0.05\textwidth} p{0.05\textwidth} p{0.4\textwidth}}
\underline{\textbf{Sets}} &&& \underline{\textbf{Parameters}}\\
$\mathcal{V}$ & set of customers && $\delta_{trc}$ & Penalty for flow from scenario $t$ to scenario $r$ for cluster $c$\\
$\mathcal{S}_v$ & set of schedules for customer $v$ && $Q$ & Maximum capacity of vehicle\\
$\mathcal{T}_c$ & set of target demand scenarios for cluster $c$ && $\underline{q}{}_v$ & Minimum delivery quantity for customer $v$\\
$\mathcal{R}_c$ & set of demand scenarios for cluster $c$ && $D_v$ & Total demand of customer $v$ over all periods\\
$\mathcal{C}$ & set of clusters && $D^{CMI}$ & Total average daily CMI demand\\
$\mathcal{K}_c$ & set of customers in cluster $c$ && $\xi$ & Proportion of total average daily CMI demand to set aside in fleet\\
\underline{\textbf{Variables}} &&&$\underline{q}{}_{crv}$ & Lower bound of demand for customer $v$ in scenario $r$ of cluster $c$\\
$d_{vs}\in\{0,1\}$ & Customer $v$ served using schedule $s$ && $\overline{q}_{crv}$ & Upper bound of demand for customer $v$ in scenario $r$ of cluster $c$\\
$q_{vp}\in\{0,1\}$ & Delivered amount to customer $v$ on period $p$ && $\pi_{tc}$ & Target fraction of days of scenario $t$ for cluster $c$\\
$x_{vpk}\in\{0,1\}$ & Customer $v$ delivered in period $p$ using vehicle $k$\\
$y_{crp}\in\{0,1\}$ & Scenario $r$ of cluster $c$ occurs in period $p$\\
$f_{trc}\in\mathbb{R}$ & Optimal \emph{flow} from scenario $t$ to scenario $r$ for cluster $c$\\
$\Pi_{rc}\in\mathbb{R}$ & Fraction of days of serving scenario $s$ for cluster $c$\\
\\
\end{tabular}
\end{document}
答案1
我建议你使用两个并排的两列tabularx
环境,宽度分别为0.57\linewidth
和0.43\linewidth
。通过使左侧tabularx
环境比右侧环境宽,tabularx
可以使环境的总长度大致相等。
\documentclass[12pt]{article}
\usepackage[letterpaper,margin=1in]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{tabularx,ragged2e}
\newcolumntype{L}{>{\RaggedRight}X} % suspend full justification
\begin{document}
\begingroup % localize scope of next three instructions
\small % 10% linear reduction in font size
\setlength\tabcolsep{4pt} % default: 6pt
\setlength\extrarowheight{2pt} % default: 0pt
\noindent
\begin{tabularx}{0.57\linewidth}[t]{@{} >{$}l<{$} L }
\multicolumn{2}{@{}l}{\textbf{Sets}} \\
\mathcal{V} & set of customers \\
\mathcal{S}_v & set of schedules for customer $v$ \\
\mathcal{T}_c & set of target demand scenarios for cluster $c$ \\
\mathcal{R}_c & set of demand scenarios for cluster $c$ \\
\mathcal{C} & set of clusters \\
\mathcal{K}_c & set of customers in cluster $c$ \\[1ex]
\multicolumn{2}{@{}l}{\textbf{Variables}} \\
d_{vs}{\in}\{0,1\} & Customer $v$ served using schedule $s$ \\
q_{vp}{\in}\{0,1\} & Delivered amount to customer $v$ in period $p$ \\
x_{vpk}{\in}\{0,1\} & Customer $v$ delivered in period $p$ using vehicle $k$\\
y_{crp}{\in}\{0,1\} & Scenario $r$ of cluster $c$ occurs in period $p$\\
f_{trc}{\in}\mathbb{R} & Optimal \emph{flow} from scenario $t$ to scenario $r$ for cluster $c$\\
\Pi_{rc}{\in}\mathbb{R}& Fraction of days of serving scenario $s$ for cluster $c$\\
\end{tabularx}%
\begin{tabularx}{0.43\linewidth}[t]{ >{$}l<{$} L @{}}
\multicolumn{2}{l}{\textbf{Parameters}} \\
\delta_{trc} & Penalty for flow from scenario $t$ to scenario $r$ for cluster $c$\\
Q & Maximum capacity of vehicle\\
\underline{q}_v & Minimum delivery quantity for customer $v$\\
D_v & Total demand of customer $v$ over all periods\\
D^{\mathrm{CMI}} & Total average daily CMI demand\\
\xi & Proportion of total average daily CMI demand to set aside in fleet\\
\underline{q}_{crv}& Lower bound of demand for customer $v$ in scenario $r$ of cluster $c$\\
\overline{q}_{crv} & Upper bound of demand for customer $v$ in scenario $r$ of cluster $c$\\
\pi_{tc} & Target fraction of days of scenario $t$ for cluster $c$\\
\end{tabularx}
\endgroup
\end{document}