I am working on a LaTeX class for a schedule planner, and I want to scale a few rows in a table to fill the remainder of the page (evenly distributed), while leaving alone the previous rows of the table and the heading above the table. Here is an MWE for my current situation:


% https://en.wikibooks.org/w/index.php?title=LaTeX/Tables&stableid=3532613


\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}

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

% https://tex.stackexchange.com/a/309837/


\makelist{days}{Monday, Tuesday, Wednesday, Thursday, Friday}
  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}


{\Large\bfseries Title}


{\large Subtitle}


 {\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}}{&} \\



MWE screenshot

Here is a mockup of the desired result, created by providing 80pt as an optional argument to \\ as per this answer to Increase LaTeX table row height:

Mockup screenshot

I want a solution that is neutral to the number of rows that will fill the remainder of the page, as the number of categories may change depending on circumstances.

Similar, but not duplicates: Table to fill page with x number of rows, How to vertically stretch single row within table for table to fill rest of page?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.