0

I've created a LaTeX (xelatex compiled) table with \cals package, specifically, using \calstable command. I'm using R's RMD file to compile LaTeX to PDF. However, I'm using two rows for a nested \thead{} command with an intermediate .tex similar to the following:

%example.tex file

\documentclass[]{article}

% package load
\usepackage{cals}
\usepackage{xcolor}

% initialize @ symbol
\makeatletter

\begin{document}

% begin custom commands
\newcommand\cellVtop[1]{
  \cell{#1}} 

\newcommand\cellVbot[1]{
  \cell{\vfill #1}}

\newcommand{\rrBoxGrantee}[1]{
  \parbox{2.5in}{\raggedright #1}}

\newcommand{\rrBoxFiveCol}[1]{
  \parbox{1in}{\raggedright #1}}

\newcommand{\rrBox}[1]{
  \parbox{0.875in}{\raggedright #1}}
% end custom commands    

\colwidths{{0.5in}{2.75in}{1.08333333333333in}{1.08333333333333in}{1.08333333333333in}}
\small
\begin{calstable}

\thead{
  \brow
    \nullcell{ltr}
    \spancontent{}
    \nullcell{ltr}
    \spancontent{}
    \nullcell{ltb}
    \nullcell{tb}
    \nullcell{trb}
    \alignC\spancontent{\vfill \textbf{Enrollees}}
  \erow
  \brow
    \alignC\cellVbot{\rrBox{\textbf{Rank}}}
    \alignL\cellVbot{\rrBox{\textbf{Grantee}}}
    \alignL\cellVbot{\rrBoxFiveCol{\textbf{Target}}}
    \alignL\cellVbot{\rrBoxFiveCol{\textbf{Actual}}}
    \alignL\cellVbot{\rrBoxFiveCol{\textbf{Percentage of Target}}}
\erow}

% begin multiple rows [...]
% repeat code for the below row until page break occurs (~30 rows)
\brow
  \alignL\cellVtop{0}
  \alignL\cellVtop{\rrBoxGrantee{Grantee A}}
  \alignL\cellVtop{0}
  \alignL\cellVtop{0}
  \alignL\cellVtop{0\%}
\erow
% end multiple rows [...]

\normalsize
\end{calstable}
\pagebreak

\end{document}

With, [...] representing excluded text for brevity.

However, when compiled, any table that runs to a next page is missing the header text of only the top-row of the \thead. The strange thing is that cell formatting is correct, just no text. It does seem that when there are no calls to \nullcell{} and \spancontent, that the columns are repeated as expected. However, I need the top header with "Enrollees" included to be merged as pictured below.

Am I missing a setting for printing both \thead rows or is this a bug? enter image description here

P.S. I've confirmed that the example.tex file, above, can be compiled to .pdf via the following command in command prompt: xelatex example.tex

5
  • This can't be compiled even adding a minimal preamble. For instance, \cellVbot is undefined. And there are errors anyway.
    – egreg
    Commented Jan 25, 2023 at 13:11
  • No, sorry. You lack a \documentclass declaration and [...] should either be expanded if they're useful to show the issue, or removed,.
    – egreg
    Commented Jan 25, 2023 at 17:18
  • Thanks again. I've addressed the issues that you've listed in edits to my question above. Please continue to inform me if there is an integral piece that I've left out that compilation requires. Note that I've placed the [...] so that the code for that row can be repeated until a page break is required. The page break is where the issue is occurring. Commented Jan 25, 2023 at 17:47
  • Sorry, I see just one page and no problem at all.
    – egreg
    Commented Jan 25, 2023 at 18:15
  • Thanks for trying. However, as stated in the code I've outlined, above, the middle rows surrounded by [...] need to be repeated at least 30 times to introduce a page break. imo, it doesn't make sense to expand 30 rows in sample code since this can be done manually before executing the code via copy and paste 30 times. Commented Jan 25, 2023 at 18:52

1 Answer 1

0

The text is not lost, it's just too far right off the page. Spanning setup is a complicated thing which can go wrong. For each span, there should be one and only one "spancontent", but your code has several. To fix:

\thead{
  \brow
    \nullcell{ltr}
    %\spancontent{}  % FIXED
    \nullcell{ltr}
    %\spancontent{}  % FIXED
    \nullcell{ltb}
    \nullcell{tb}
    \nullcell{trb}
    \alignC\spancontent{\vfill \textbf{Enrollees}}
  \erow
  \brow
    \alignC\cellVbot{\rrBox{\textbf{Rank}}}
    \alignL\cellVbot{\rrBox{\textbf{Grantee}}}
    \alignL\cellVbot{\rrBoxFiveCol{\textbf{Target}}}
    \alignL\cellVbot{\rrBoxFiveCol{\textbf{Actual}}}
    \alignL\cellVbot{\rrBoxFiveCol{\textbf{Percentage of Target}}}
\erow}

1
  • Thanks you! This fixed my issue and my PDF now looks as expected. I was definitely overusing the /spancontent{} command. It seems from your comment, the command is only needed when adding content to a /span equivalent such as nullcell{}. Commented Jan 26, 2023 at 20:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .