library(texPreview)
texPreview comes with LaTeX
packages built in for each render, but the user can add any TeX
library that they have installed on the machine using build_usepackage
. This object can then be used in the usrPackages
parameter in tex_preview
.
build_usepackage(pkg = 'xcolor')
## [1] "\\usepackage{xcolor}"
build_usepackage(pkg = 'xcolor',options = 'usenames')
## [1] "\\usepackage[usenames]{xcolor}"
=c('paperwidth=35cm','paperheight=35cm','left=2.5cm','top=2.5cm')
geom.opts="\\usetikzlibrary{mindmap,backgrounds}"
use.opts
<- mapply(
m FUN = build_usepackage,
pkg = list('times','geometry','tikz'),
options = list(NULL ,geom.opts ,NULL),
uselibrary = list(NULL ,NULL ,use.opts)
)
unlist(m)
## [1] "\\usepackage{times}"
## [2] "\\usepackage[paperwidth=35cm,paperheight=35cm,left=2.5cm,top=2.5cm]{geometry}"
## [3] "\\usepackage{tikz}"
## [4] "\\usetikzlibrary{mindmap,backgrounds}"