I'm using the latest version of gt (0.1.0) from this repo in a bookdown file. The latex packages attached by utils_render_latex.R from gt lead to duplicate amsmath in the tex file and fail to compile through xelatex. See the example following:
title: "Example"
output:
bookdown::pdf_document2:
fig_caption: yes
keep_tex: yes
toc: FALSE
{r}
library(dplyr)
library(gt)
mtcars[1:3, 1:3] %>% gt %>% as_latex
````
Given this case, it may be helpful if there could be an option for customizing the engaged packages---at least amsmath.
Thanks for submitting this issue and sorry that this has caused problems. I just read through all the comments in the gtsummary repo and I think I know what's going on. We will get to this soon.
Hi @rich-iannone, any follow-up on this issue? Right now, I have to manually change the latex file or replacing all my gt and gtsummary codes with other package::functions. I'll appreciate it so very much if this issue can be fixed soon. Thank you!
I run into this issue frequently as well. If it would be at all possible to provide an escape hatch around the packages declared in https://github.com/rstudio/gt/blob/876b862bb74f450991840946fde61face00c6cc4/R/utils_render_latex.R#L2-L5 I wouldn't mind having to manually declare gt's dependencies if I could avoid this issue. I frequently use xelatex with rmarkdown::pdf_document() and the amsmath issue breaks this workflow.
Btw, the change came in 876b862bb74f450991840946f so for the time being, when this issue is critical, I'm using gt at 51a812ba6a10769bd24.
Just ran into this as well. Installing at 51a812b works fine, but newer things like cell_fill() and cell_text() won't work for now, since they were added after (so temporarily going back to cells_styles())
I'm running into this issue with reference to bookdown and gt being used in conjunction. The additional amsmath package yields the error:
! Package mathspec Error:amsmath' must be loaded earlier than mathspec'.
Like others, installing at https://github.com/rstudio/gt/commit/51a812ba6a10769bd24e01c82a3e1b7de44a5a40 is a temporary workaround, but means I can't use cols_width() and the like.
Just ran into the same issue as described by @rlbarter. Are there any updates regarding progress on this?
Most helpful comment
Just ran into the same issue as described by @rlbarter. Are there any updates regarding progress on this?