Package 'chaletex'

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-10-23 02:42:23 UTC
Source: https://github.com/njtierney/chaletex

Help Index


read tex file into R

Description

read tex file into R

Usage

read_tex(path, ...)

Arguments

path

file path

...

extra options to pass to readChar

Value

text string

Examples

## Not run: 
tex_chars <- read_tex("path/to/file.tex")

## End(Not run)

Example TeX template from PLoS ONE

Description

This is an example tex string from the PLoS ONE template: https://journals.plos.org/plosone/s/latex

Usage

tex_example

Format

An object of class character of length 1.

Examples

tex_preamble <- tex_extract_preamble(tex_example)

Extract packages from tex string

Description

Extract packages from tex string

Usage

tex_extract_pkgs(tex_string)

Arguments

tex_string

text string

Value

text string of package names

Examples

tex_preamble <- tex_extract_preamble(tex_example)
tex_extract_pkgs(tex_preamble)
tex_extract_pkgs(tex_example)

Extract preamble from tex string

Description

Extract preamble from tex string

Usage

tex_extract_preamble(tex_string)

Arguments

tex_string

tex string, could be read in with read_tex

Value

text string containing all text before '\begindocument'

Examples

## Not run: 
tex_preamble <- tex_extract_preamble(tex_example)

## End(Not run)

Install tex packages

Description

Install tex packages using 'tinytex::tlmgr_install()'

Usage

tex_install_pkgs(tex_pkg_string, ...)

Arguments

tex_pkg_string

string

...

extra options to pass to 'tinytex::tlmgr_install()' .

Value

nothing, this installs packages

Examples

## Not run: 
# in a pipeline
read_tex(tex_path) %>%
  tex_extract_preamble() %>%
  tex_extract_pkgs() %>%
  tex_install_pkgs()
  
## End(Not run)