tex_opts$set() allows you to set lots of default options, but tex_preview() doesn't read usrPackages if it's set in tex_opts.
library(magrittr)
library(texPreview)
# Override the sans serif styling
knitr::kable(head(iris, 5), format = "latex") %>%
tex_preview(usrPackages = "\\renewcommand*\\familydefault{\\rmdefault}")
# usrPackages isn't included as one of the options
tex_opts$get()
# Try setting it here
tex_opts$set(
usrPackages = "\\renewcommand*\\familydefault{\\rmdefault}"
)
# It doesn't transfer to tex_preview() here
knitr::kable(head(iris, 5), format = "latex") %>%
tex_preview()
tex_opts$set()
allows you to set lots of default options, buttex_preview()
doesn't readusrPackages
if it's set intex_opts
.