缩放多个表格行以填充页面的剩余部分

缩放多个表格行以填充页面的剩余部分

我正在为日程安排人员编写 LaTeX 类,我想缩放表格中的几行以填充页面的剩余部分(均匀分布),同时保留表格的前几行和表格上方的标题。以下是我当前情况的 MWE:

\documentclass{article}

\usepackage[letterpaper,margin=1in,landscape]{geometry}
\usepackage{tabularx,booktabs}
% https://en.wikibooks.org/w/index.php?title=LaTeX/Tables&stableid=3532613

\usepackage{xparse}

\ExplSyntaxOn
\DeclareExpandableDocumentCommand \repeatcommand {O{}mm} {
  % #1: delimiter
  % #2: number of times to repeat command
  % #3: command to repeat
  \int_compare:nT {#2 > 0} {
    #3 \prg_replicate:nn {#2 - 1} {#1 #3}
  }
}
% https://tex.stackexchange.com/a/300215/

\NewDocumentCommand \makelist {mm} {
  % #1: name of list
  % #2: contents of list (comma-delimited)
  \clist_new:c {l_my_ #1 _clist}
  \clist_set:cn {l_my_ #1 _clist} {#2}
}

\DeclareExpandableDocumentCommand \includelist {O{}m} {
  % #1: delimiter
  % #2: name of list to include
  \clist_use:cn {l_my_ #2 _clist} {#1}
}

% https://tex.stackexchange.com/a/382779/
% https://tex.stackexchange.com/a/422960/

\NewDocumentCommand \sizeoflist {m} {
  % #2: name of list
  \clist_count:c {l_my_ #1 _clist}
}

\ExplSyntaxOff
% http://www.texdoc.net/texmf-dist/doc/latex/l3kernel/interface3.pdf
% https://mirror.las.iastate.edu/tex-archive/macros/latex/contrib/l3packages/xparse.pdf

\newcommand\setrow[1]{\gdef\rowmac{#1}#1\ignorespaces}
\newcommand\clearrow{\global\let\rowmac\relax}
\clearrow
% https://tex.stackexchange.com/a/309837/

\begin{document}

\makelist{days}{Monday, Tuesday, Wednesday, Thursday, Friday}
\makelist{dates}{
  2 September 2019,
  3 September 2019,
  4 September 2019,
  5 September 2019,
  6 September 2019
}
\makelist{categories}{Category 1, Category 2, Category 3, Category 4}

\thispagestyle{empty}

{\Large\bfseries Title}

\vspace{0.25cm}

{\large Subtitle}

\vspace{1cm}

\begin{tabularx}
 {\textwidth}{ >{\bfseries}X *{\sizeoflist{days}}{|>{\rowmac\centering\arraybackslash}X} }

\setrow{\bfseries} & \includelist[&]{days} \clearrow\\

& \includelist[&]{dates} \\\midrule

\includelist[\repeatcommand{\sizeoflist{days}}{&} \\\midrule]{categories} \repeatcommand{\sizeoflist{days}}{&} \\

\end{tabularx}

\end{document}

MWE 截图

这是所需结果的模型,通过提供80pt可选参数来\\创建这个答案增加 LaTeX 表格行高

模型截图

我想要一个对填充页面剩余部分的行数保持中性的解决方案,因为类别的数量可能会根据情况而改变。

类似,但不重复:表格用 x 行填充页面如何垂直拉伸表格内的单行以使表格填充页面的其余部分?

相关内容