Skip to content

Commit

Permalink
add a helper function ctan_mirrors()
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Mar 13, 2024
1 parent c556ca6 commit bc8fda0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ License: MIT + file LICENSE
URL: https://github.com/rstudio/tinytex
BugReports: https://github.com/rstudio/tinytex/issues
Encoding: UTF-8
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
10 changes: 9 additions & 1 deletion R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
#' \code{'http://mirrors.tuna.tsinghua.edu.cn/CTAN/'}, or
#' \code{'https://mirror.las.iastate.edu/tex-archive/'}. In theory, this
#' argument should end with the path \file{/systems/texlive/tlnet}, and if it
#' does not, the path will be automatically appended.
#' does not, the path will be automatically appended. You can get a full list
#' of CTAN mirrors via \code{tinytex:::ctan_mirrors()}.
#' @param extra_packages A character vector of extra LaTeX packages to be
#' installed. By default, a vector of all currently installed LaTeX packages
#' if an existing installation of TinyTeX is found. If you want a fresh
Expand Down Expand Up @@ -211,6 +212,13 @@ auto_repo = function() {
if (length(x) == 1) x else 'ctan'
}

# retrieve all CTAN (https) mirrors
ctan_mirrors = function() {
x = readLines('https://ctan.org/mirrors/mirmon')
u = xfun::grep_sub('.*<TD ALIGN=RIGHT><A HREF="(https://[^"]+)".*', '\\1', x)
xfun::raw_string(u)
}

# use %APPDATA%/TinyTeX if it exists or doesn't contain spaces or non-ASCII
# chars, otherwise use %ProgramData%, because TeX Live doesn't work when the
# installation path contains non-ASCII chars
Expand Down
3 changes: 2 additions & 1 deletion man/install_tinytex.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bc8fda0

Please sign in to comment.