build_usepackage {texPreview}R Documentation

Build usepackage command for TeX document

Description

input TeX package name and optional package functions to create usepackage call

Usage

build_usepackage(pkg, options = NULL, uselibrary = NULL, chk.inst = FALSE)

Arguments

pkg

character, name of TeX package

options

character, name(s) of options to use in the package

uselibrary

character, part of document preamble to specify a uselibrary call related to package

chk.inst

logical, invokes a check to see if pkg is currently installed on system (default FALSE)

Details

if options and uselibrary are NULL (default) then only the call for the package is returned. See the TeX wikibook for more information https://en.wikibooks.org/wiki/LaTeX/Document_Structure#Packages on the usepackage command. If chk.inst finds that the package is not installed on system function returns NULL.

Value

character

Examples

build_usepackage(pkg = 'xcolor')
build_usepackage(pkg = 'xcolor',options = 'usenames')

#build many at once using mapply

geom.opts=c('paperwidth=35cm','paperheight=35cm','left=2.5cm','top=2.5cm')
use.opts="\\usetikzlibrary{mindmap,backgrounds}"

unlist(mapply(build_usepackage,
pkg =        list('times','geometry','tikz'),
options=     list(NULL   ,geom.opts ,NULL),
uselibrary = list(NULL   ,NULL      ,use.opts)
))

[Package texPreview version 2.1.0 Index]