Title: | Extract LaTeX packages from TeX files and Install Them |
---|---|
Description: | Trying to compile LaTeX files can be frustrating when you need to stop at every attempted compile and install the missing packages. The goal of chaletex is to make it easy to extract packages you need to install from LaTeX. It is named `chaletex` as we want this to be like walking into a Chalet after a big day - a nice, friendly, cozy place for your TeX problems. |
Authors: | Nicholas Tierney [aut, cre] , Claire Miller [aut] |
Maintainer: | Nicholas Tierney <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-12-22 02:46:52 UTC |
Source: | https://github.com/njtierney/chaletex |
read tex file into R
read_tex(path, ...)
read_tex(path, ...)
path |
file path |
... |
extra options to pass to readChar |
text string
## Not run: tex_chars <- read_tex("path/to/file.tex") ## End(Not run)
## Not run: tex_chars <- read_tex("path/to/file.tex") ## End(Not run)
This is an example tex string from the PLoS ONE template: https://journals.plos.org/plosone/s/latex
tex_example
tex_example
An object of class character
of length 1.
tex_preamble <- tex_extract_preamble(tex_example)
tex_preamble <- tex_extract_preamble(tex_example)
Extract packages from tex string
tex_extract_pkgs(tex_string)
tex_extract_pkgs(tex_string)
tex_string |
text string |
text string of package names
tex_preamble <- tex_extract_preamble(tex_example) tex_extract_pkgs(tex_preamble) tex_extract_pkgs(tex_example)
tex_preamble <- tex_extract_preamble(tex_example) tex_extract_pkgs(tex_preamble) tex_extract_pkgs(tex_example)
Extract preamble from tex string
tex_extract_preamble(tex_string)
tex_extract_preamble(tex_string)
tex_string |
tex string, could be read in with read_tex |
text string containing all text before '\begindocument'
## Not run: tex_preamble <- tex_extract_preamble(tex_example) ## End(Not run)
## Not run: tex_preamble <- tex_extract_preamble(tex_example) ## End(Not run)
Install tex packages using 'tinytex::tlmgr_install()'
tex_install_pkgs(tex_pkg_string, ...)
tex_install_pkgs(tex_pkg_string, ...)
tex_pkg_string |
string |
... |
extra options to pass to 'tinytex::tlmgr_install()' . |
nothing, this installs packages
## Not run: # in a pipeline read_tex(tex_path) %>% tex_extract_preamble() %>% tex_extract_pkgs() %>% tex_install_pkgs() ## End(Not run)
## Not run: # in a pipeline read_tex(tex_path) %>% tex_extract_preamble() %>% tex_extract_pkgs() %>% tex_install_pkgs() ## End(Not run)