Skip to content

njtierney/chaletex

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
R
 
 
 
 
 
 
man
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

chaletex

Lifecycle: experimental Travis build status AppVeyor build status

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.

It is entirely possible that this functionality already exists, somewhere, perhaps in tinytex, but we could not find it easily. This package was co-written with grep-master Claire Miller.

Installation

You can install the released version of chaletex from GitHub with

# install.packages("remotes")
remotes::install_github("njtierney/chaletex")

Example usage

The primary use it to extract a list of packages out of a .tex file string:

library(chaletex)
tex_extract_pkgs(tex_example)
#>  [1] "geometry"   "amsmath"    "amssymb"    "changepage" "inputenc"  
#>  [6] "textcomp"   "marvosym"   "cite"       "nameref"    "hyperref"  
#> [11] "lineno"     "microtype"  "xcolor"     "array"      "setspace"  
#> [16] "caption"    "lastpage"   "fancyhdr"   "graphicx"   "epstopdf"

You can also extract only the preamble, the part before \begin{document}, if you want to cut down on your string processing:

# read in example tex file
tex_extract_preamble(tex_example) %>%
  tex_extract_pkgs()
#>  [1] "geometry"   "amsmath"    "amssymb"    "changepage" "inputenc"  
#>  [6] "textcomp"   "marvosym"   "cite"       "nameref"    "hyperref"  
#> [11] "lineno"     "microtype"  "xcolor"     "array"      "setspace"  
#> [16] "caption"    "lastpage"   "fancyhdr"   "graphicx"   "epstopdf"

You can also read in a tex file into a string using read_tex:

tex_string <- read_tex("path/to/file.tex")

And you can install tex files using tex_install_pkgs(), which is a wrapper around the amazing tinytex::tlmgr_install() (not run, but example shown).

read_tex("path/to/file.tex") %>%
  tex_extract_preamble() %>%
  tex_extract_pkgs() %>%
  tex_install_pkgs()

Please note that the ‘chaletex’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

About

Tools to extract latex packages from a .tex file and install them

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published