Created
April 8, 2020 22:22
-
-
Save joelnitta/9add18962798c90cb6ec4d44252044b0 to your computer and use it in GitHub Desktop.
Extract latex package names from tlmgr log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
# Find the names of latex packages installed by tlmgr | |
# (https://www.tug.org/texlive/tlmgr.html) | |
# The main reason to do this is so they can be pre-installed to a docker image. | |
# | |
# The latex package install output from tlmgr tends to look like this: | |
# | |
# ``` | |
# tlmgr search --file --global '/multirow.sty' | |
# TeX Live 2016 is frozen forever and will no | |
# longer be updated. This happens in preparation for a new release. | |
# | |
# If you're interested in helping to pretest the new release (when | |
# pretests are available), please read http://tug.org/texlive/pretest.html. | |
# Otherwise, just wait, and the new release will be ready in due time. | |
# Trying to automatically install missing LaTeX packages... | |
# tlmgr install multirow | |
# TeX Live 2016 is frozen forever and will no | |
# longer be updated. This happens in preparation for a new release. | |
# ``` | |
# | |
# This script identifies the package names from such output | |
# Change path as needed | |
latex_log_path <- "temp/latex_package_install_log.txt" | |
read_lines(latex_log_path) %>% | |
magrittr::extract(str_detect(., "tlmgr install")) %>% | |
unique %>% | |
magrittr::extract(!str_detect(., "package already present")) %>% | |
map_chr(~str_remove_all(., "tlmgr install ")) %>% | |
sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment