我已经使用颜色标记了表格中的某些单元格,但最后一个单元格(右侧、底部)似乎“溢出”。
\documentclass[nols,notitlepage,openany,12pt,table,xcdraw]{tufte-handout}
\usepackage{geometry}
\geometry{a4paper,bottom=1.5in}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text,Numbers=OldStyle]{Minion Pro}
\setsansfont[Mapping=tex-text,Numbers=OldStyle]{Gill Sans}
\usepackage{booktabs}
\usepackage{enumitem}
% \setlist{nolistsep} % or \setlist{noitemsep} to leave space around whole list
\setlist{noitemsep}
\usepackage{adjustbox}
\begin{document}
\begin{table}[h!]
\begin{tabular}{@{}lllll@{}}
2020 & 2021 & 2022 & 2023-25 & 2025-2030 \\ \midrule
\multicolumn{5}{l}{\cellcolor[HTML]{EFEFEF}Individuella ansökningar} \\
& \multicolumn{4}{l}{\cellcolor[HTML]{EFEFEF}Gemensamma ansökningar} \\
& & \cellcolor[HTML]{EFEFEF}Strategisk publicering & \cellcolor[HTML]{EFEFEF}Programansökan & \\
& & & & \cellcolor[HTML]{EFEFEF}Lansering av institut
\end{tabular}
\end{table}
\end{document}
输出:
通过在最后一个单元格中少写一些内容并不能解决这个问题。
答案1
使用<{\kern-\tabcolsep}
,在多列中也是必要的,并添加\\
到最后一行。如果你有p/m/b
-columns,你必须采取特殊步骤,请参阅这个问题及其答案:
\documentclass[12pt,table,xcdraw]{article}
\usepackage{geometry}
\geometry{a4paper,bottom=1.5in}
\usepackage{booktabs, xcolor}
\begin{document}
\begin{table}
\begin{tabular}{>{\kern-\tabcolsep}lllll<{\kern-\tabcolsep}}
2020 & 2021 & 2022 & 2023-25 & 2025-2030 \\ \midrule
\multicolumn{5}{>{\kern-\tabcolsep}l<{\kern-\tabcolsep}}{\cellcolor[HTML]{EFEFEF}Individuella ansökningar} \\
& \multicolumn{4}{l<{\kern-\tabcolsep}}{\cellcolor[HTML]{EFEFEF}Gemensamma ansökningar} \\
& & \cellcolor[HTML]{EFEFEF}Strategisk publicering & \cellcolor[HTML]{EFEFEF}Programansökan & \\
& & & & \cellcolor[HTML]{EFEFEF}Lansering av institut\\
\end{tabular}
\end{table}
\end{document}