我认为大多数人都会同意,下方表格单元格的垂直对齐方式并不理想——尤其是当我想删除它\cmidrule
以更符合公认的表格“最佳实践”时。
我想要的是:对于表格下两行中的每个单元格,内容应与单元格顶部齐平。(可能的例外:我不完全相信这对最左边的列是正确的。)标题 E1|C 等应保持垂直居中。
重要提示:理想情况下,除最左边的列之外的所有列的宽度都应自动确定。我更希望不必指定 aparbox
或类似值的宽度(尽管如果您可以使用它们来解决问题,那仍然比我迄今为止能做到的要好)。
我确信这个问题的解决方案就存在于相关问题的迷宫中的某个地方,但是......嗯......相关问题就像一个迷宫,我无法找到我想要的东西。
以下是此示例的代码:
\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs,array}
\newcommand*{\sheaf}[1]{\mathcal{#1}}
\begin{document}
\begin{tabular}{@{}>{\raggedright}m{10.5em} l l l l@{}}
\toprule
Rational curve: \\$[t,s] \mapsto$ & $\sheaf E_{1} |_C$ & $\sheaf E_{3} |_C$ & $\sheaf E_{4} |_C$ & $\sheaf E_{5} |_C$
\\ \midrule
$[-s t^{8}+2s^{8} t+2s^{9},\linebreak[0]-s^{4} t^{5},\linebreak[0]s^{5} t^{4}-s^{9},\linebreak[0]2t^{9}-s^{9}]$
& $\begin{aligned}&\sheaf O(-3)^{3}\end{aligned}$
& $\begin{aligned}&\sheaf O(-2)^{8}\\ &\oplus \sheaf O(-1)^{11}\end{aligned}$
& $\begin{aligned}&\sheaf O(-2)^{3}\\ &\oplus \sheaf O(-1)^{30}\\ &\oplus \sheaf O\end{aligned}$
& $\begin{aligned}&\sheaf O(-1)^{45}\\ &\oplus \sheaf O^{10}\end{aligned}$
%
\\
\cmidrule(l){2-5}
%
$[s t^{8}-s^{2} t^{7},\linebreak[0]2t^{9}-s^{8} t,\linebreak[0]-s^{9},\linebreak[0]t^{9}]$
& $\begin{aligned}&\sheaf O(-6)\\ &\oplus \sheaf O(-2)\\ &\oplus \sheaf O(-1)\end{aligned}$
& $\begin{aligned}&\sheaf O(-4)\\ &\oplus \sheaf O(-3)\\ &\oplus \sheaf O(-2)^{4}\\ &\oplus \sheaf O(-1)^{12}\\ &\oplus \sheaf O\end{aligned}$
& $\begin{aligned}&\sheaf O(-3)\\ &\oplus \sheaf O(-2)^{4}\\ &\oplus \sheaf O(-1)^{25}\\ &\oplus \sheaf O^{4}\end{aligned}$
& $\begin{aligned}&\sheaf O(-2)^{3}\\ &\oplus \sheaf O(-1)^{39}\\ &\oplus \sheaf O^{13}\end{aligned}$
\\ \bottomrule
\end{tabular}
\end{document}
答案1
您可以使用t
可选参数来aligned
获取顶部对齐;我还将第一列更改为类型p{...}
:
\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs,array}
\newcommand*{\sheaf}[1]{\mathcal{#1}}
\begin{document}
\noindent\begin{tabular}{@{}>{\raggedright}p{10.5em} l l l l@{}}
\toprule
Rational curve: \\$[t,s] \mapsto$ & $\sheaf E_{1} |_C$ & $\sheaf E_{3} |_C$ & $\sheaf E_{4} |_C$ & $\sheaf E_{5} |_C$
\\ \midrule
$[-s t^{8}+2s^{8} t+2s^{9},\linebreak[0]-s^{4} t^{5},\linebreak[0]s^{5} t^{4}-s^{9},\linebreak[0]2t^{9}-s^{9}]$
& $\begin{aligned}[t]&\sheaf O(-3)^{3}\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-2)^{8}\\ &\oplus \sheaf O(-1)^{11}\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-2)^{3}\\ &\oplus \sheaf O(-1)^{30}\\ &\oplus \sheaf O\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-1)^{45}\\ &\oplus \sheaf O^{10}\end{aligned}$
%
\\
\cmidrule(l){2-5}
%
$[s t^{8}-s^{2} t^{7},\linebreak[0]2t^{9}-s^{8} t,\linebreak[0]-s^{9},\linebreak[0]t^{9}]$
& $\begin{aligned}[t]&\sheaf O(-6)\\ &\oplus \sheaf O(-2)\\ &\oplus \sheaf O(-1)\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-4)\\ &\oplus \sheaf O(-3)\\ &\oplus \sheaf O(-2)^{4}\\ &\oplus \sheaf O(-1)^{12}\\ &\oplus \sheaf O\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-3)\\ &\oplus \sheaf O(-2)^{4}\\ &\oplus \sheaf O(-1)^{25}\\ &\oplus \sheaf O^{4}\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-2)^{3}\\ &\oplus \sheaf O(-1)^{39}\\ &\oplus \sheaf O^{13}\end{aligned}$
\\ \bottomrule
\end{tabular}
\end{document}
使用 a\parbox
作为第一行的第一个条目,给出该行垂直居中的条目:
\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs,array}
\newcommand*{\sheaf}[1]{\mathcal{#1}}
\begin{document}
\noindent\begin{tabular}{@{}>{\raggedright}p{10.5em} l l l l@{}}
\toprule
\parbox{10.5em}{Rational curve: \\$[t,s] \mapsto$} & $\sheaf E_{1} |_C$ & $\sheaf E_{3} |_C$ & $\sheaf E_{4} |_C$ & $\sheaf E_{5} |_C$
\\ \midrule
$[-s t^{8}+2s^{8} t+2s^{9},\linebreak[0]-s^{4} t^{5},\linebreak[0]s^{5} t^{4}-s^{9},\linebreak[0]2t^{9}-s^{9}]$
& $\begin{aligned}[t]&\sheaf O(-3)^{3}\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-2)^{8}\\ &\oplus \sheaf O(-1)^{11}\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-2)^{3}\\ &\oplus \sheaf O(-1)^{30}\\ &\oplus \sheaf O\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-1)^{45}\\ &\oplus \sheaf O^{10}\end{aligned}$
%
\\
\cmidrule(l){2-5}
%
$[s t^{8}-s^{2} t^{7},\linebreak[0]2t^{9}-s^{8} t,\linebreak[0]-s^{9},\linebreak[0]t^{9}]$
& $\begin{aligned}[t]&\sheaf O(-6)\\ &\oplus \sheaf O(-2)\\ &\oplus \sheaf O(-1)\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-4)\\ &\oplus \sheaf O(-3)\\ &\oplus \sheaf O(-2)^{4}\\ &\oplus \sheaf O(-1)^{12}\\ &\oplus \sheaf O\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-3)\\ &\oplus \sheaf O(-2)^{4}\\ &\oplus \sheaf O(-1)^{25}\\ &\oplus \sheaf O^{4}\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-2)^{3}\\ &\oplus \sheaf O(-1)^{39}\\ &\oplus \sheaf O^{13}\end{aligned}$
\\ \bottomrule
\end{tabular}
\end{document}
就我个人而言,我会选择第一个选项(所有内容顶部对齐)。
也许您也可以在第一列上使用对齐环境,以便在连续的行之间获得更多的间距?
\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs,array}
\newcommand*{\sheaf}[1]{\mathcal{#1}}
\begin{document}
\noindent\begin{tabular}{@{}>{\raggedright}p{10.5em} l l l l@{}}
\toprule
Rational curve: \\$[t,s] \mapsto$ & $\sheaf E_{1} |_C$ & $\sheaf E_{3} |_C$ & $\sheaf E_{4} |_C$ & $\sheaf E_{5} |_C$
\\ \midrule
$\begin{aligned}[t]
&[-s t^{8}+2s^{8} t+2s^{9},\\[-0.65ex]
&-s^{4} t^{5}, s^{5} t^{4}-s^{9}, \\[-0.65ex]
&2t^{9}-s^{9}]
\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-3)^{3}\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-2)^{8}\\ &\oplus \sheaf O(-1)^{11}\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-2)^{3}\\ &\oplus \sheaf O(-1)^{30}\\ &\oplus \sheaf O\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-1)^{45}\\ &\oplus \sheaf O^{10}\end{aligned}$
%
\\
\cmidrule(l){2-5}
%
$\begin{aligned}[t]
&[s t^{8}-s^{2} t^{7},2t^{9}-s^{8} t, \\[-0.65ex]
& -s^{9}, t^{9}]
\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-6)\\ &\oplus \sheaf O(-2)\\ &\oplus \sheaf O(-1)\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-4)\\ &\oplus \sheaf O(-3)\\ &\oplus \sheaf O(-2)^{4}\\ &\oplus \sheaf O(-1)^{12}\\ &\oplus \sheaf O\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-3)\\ &\oplus \sheaf O(-2)^{4}\\ &\oplus \sheaf O(-1)^{25}\\ &\oplus \sheaf O^{4}\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-2)^{3}\\ &\oplus \sheaf O(-1)^{39}\\ &\oplus \sheaf O^{13}\end{aligned}$
\\ \bottomrule
\end{tabular}
\end{document}
使用该tabularx
包,您可以避免猜测第一列的正确宽度:
\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs,array,tabularx}
\newcommand*{\sheaf}[1]{\mathcal{#1}}
\begin{document}
\noindent\begin{tabularx}{\textwidth}{@{}>{\raggedright}X l l l l@{}}
\toprule
Rational curve: \\$[t,s] \mapsto$ & $\sheaf E_{1} |_C$ & $\sheaf E_{3} |_C$ & $\sheaf E_{4} |_C$ & $\sheaf E_{5} |_C$
\\ \midrule
$[-s t^{8}+2s^{8} t+2s^{9},\linebreak[0]-s^{4} t^{5},\linebreak[0]s^{5} t^{4}-s^{9},\linebreak[0]2t^{9}-s^{9}]$
& $\begin{aligned}[t]&\sheaf O(-3)^{3}\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-2)^{8}\\ &\oplus \sheaf O(-1)^{11}\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-2)^{3}\\ &\oplus \sheaf O(-1)^{30}\\ &\oplus \sheaf O\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-1)^{45}\\ &\oplus \sheaf O^{10}\end{aligned}$
%
\\
\cmidrule(l){2-5}
%
$[s t^{8}-s^{2} t^{7},\linebreak[0]2t^{9}-s^{8} t,\linebreak[0]-s^{9},\linebreak[0]t^{9}]$
& $\begin{aligned}[t]&\sheaf O(-6)\\ &\oplus \sheaf O(-2)\\ &\oplus \sheaf O(-1)\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-4)\\ &\oplus \sheaf O(-3)\\ &\oplus \sheaf O(-2)^{4}\\ &\oplus \sheaf O(-1)^{12}\\ &\oplus \sheaf O\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-3)\\ &\oplus \sheaf O(-2)^{4}\\ &\oplus \sheaf O(-1)^{25}\\ &\oplus \sheaf O^{4}\end{aligned}$
& $\begin{aligned}[t]&\sheaf O(-2)^{3}\\ &\oplus \sheaf O(-1)^{39}\\ &\oplus \sheaf O^{13}\end{aligned}$
\\ \bottomrule
\end{tabularx}
\end{document}