--- title: "Building usepackage TeX commands" author: "Jonathan Sidi" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Building usepackage TeX commands} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r} 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`. ## Usage ### usepackage ```{r} build_usepackage(pkg = 'xcolor') ``` ### usepackage with options ```{r} build_usepackage(pkg = 'xcolor',options = 'usenames') ``` ### vectorized usepackage ```{r} geom.opts=c('paperwidth=35cm','paperheight=35cm','left=2.5cm','top=2.5cm') use.opts="\\usetikzlibrary{mindmap,backgrounds}" m <- mapply( FUN = build_usepackage, pkg = list('times','geometry','tikz'), options = list(NULL ,geom.opts ,NULL), uselibrary = list(NULL ,NULL ,use.opts) ) unlist(m) ```