Closed hjuerges closed 4 months ago
Thanks for the report. I believe this is due to this upstream bug: https://github.com/rstudio/rmarkdown/issues/2478
It prevents tinytable::usepackage_latex()
from adding the proper entries in the LaTeX preable. Here's a workaround.
First, install the development version of tinytable
:
library(remotes)
install_github("vincentarelbundock/tinytable")
Second, save this LaTeX code as preamble.tex
:
\RequirePackage{tabularray}
\RequirePackage{booktabs}
\RequirePackage{float}
\usepackage[normalem]{ulem}
\usepackage{graphicx}
\UseTblrLibrary{booktabs}
\UseTblrLibrary{siunitx}
\NewTableCommand{\tinytableDefineColor}[3]{\definecolor{#1}{#2}{#3}}
\newcommand{\tinytableTabularrayUnderline}[1]{\underline{#1}}
\newcommand{\tinytableTabularrayStrikeout}[1]{\sout{#1}}
Finally, load the preamble in your YAML header:
---
output:
beamer_presentation:
includes:
in_header: preamble.tex
---
With these changes, the table appears with colors as expected.
Many thanks for the quick response. I wish I could say that your workaround helped, but it didn't, at least on my machine. The tex-file contains the above commands from preamble.tex
, but the table environment is still longtable
.
Did you install the latest from GitHub and restart your R session?
Oops wait, looks like I didn't push the commit. I'll let you know when it's done.
OK, please try again with version 0.2.1.15
Success! Thank you very much. I am glad I can use tinytable now with beamer, because that's where I need it most (for teaching). Best, Hendrik
Thanks again for raising this issue. I have added the workaround to the FAQ page.
Not sure whether this is a tinytable issue.
Style formatting in style_tt() does not work with beamer presentation (at least on my computers). Minimal example below. I checked the tex-files and noted that if formatted as
beamer_presentation
instead ofpdf_document
, the table is formatted as "longtable" instead of "table" with "tblr".