elong0527 / r4csr

R for Clinical Study Report and Submission
https://r4csr.org/
Other
70 stars 33 forks source link

Fix undefined control sequence `\cellcolor` error #123

Closed nanxstats closed 8 months ago

nanxstats commented 8 months ago

Problem

This error about undefined \cellcolor comes from xelatex when building the PDF book:

ERROR:
compilation failed- error
Undefined control sequence.
l.3630 fmt\_ci & 3 & Alice & \cellcolor
                                       [HTML]{00ff00}{C} & Alice & \cellcolo...

The table is generated by kableExtra and will surely need some refactor since it has not been rendered properly in PDF ever (too wide, with HTML tags, ...).

Solution

As suggested by StackOverflow, the simple solution is to add the table option when using xcolor:

\usepackage[table]{xcolor}

I checked the existing .tex output. It has only \usepackage{xcolor}. Making this change solved the issue.

Previously, this hasn't been a problem. So I think something upstream might have changed and now we need to use this option explicitly.


This PR also updates the GitHub Actions workflow to keep in sync with upstream.