yonicd / texPreview

Efficiently iterate, refine and share snippets of LaTeX in R with ease
https://yonicd.github.io/texPreview/
Other
52 stars 7 forks source link

`usrPackages` not available in `tex_opts` #20

Closed andrewheiss closed 5 years ago

andrewheiss commented 5 years ago

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}")
image
# 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()
image
yonicd commented 5 years ago

Sorry.

I missed this issue.

That is right.

It isn't on the opts list.

You can PR it if you want. I can see how that can be useful.

You can add it here

https://github.com/metrumresearchgroup/texPreview/blob/cb76ab3610c72b3d4c1db3b0c6eef8cdb66dfa88/R/opts.R#L64_L76

yonicd commented 5 years ago

added in https://github.com/metrumresearchgroup/texPreview/commit/56d148dc8c27c6022397ef799707cecd71c5dcb4