Skip to content

Commit

Permalink
ensure R CMD Rd2pdf uses this R's Rd.sty
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@87675 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
smeyer committed Feb 2, 2025
1 parent e6d7a9a commit b898130
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions doc/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,9 @@

\item \code{tools::texi2pdf(..., texinputs=\var{paths})} now
\emph{pre}pends the specified \var{paths} to \env{TEXINPUTS}.
When building \R (\file{doc/NEWS.pdf} and base vignettes), this
now ensures that its own \file{Rd.sty} takes precedence over
When building \R itself (\file{doc/NEWS.pdf} and base vignettes)
or package manuals using \command{R CMD Rd2pdf}, it is ensured
that this \R's \file{Rd.sty} takes precedence over any other
(incompatible) versions in default \dQuote{texmf trees}.
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/library/tools/R/Rd2pdf.R
Original file line number Diff line number Diff line change
Expand Up @@ -917,9 +917,12 @@ function(pkgdir, outfile, title, silent = FALSE,
if (!quiet) cat("Creating", out_ext, "output from LaTeX ...\n")
setwd(build_dir)

res <- try(texi2pdf('Rd2.tex', quiet = quiet, index = index))
## R CMD _appends_ R's texmf tree to environmental TEXINPUTS, which could
## list another R version, so ensure Rd2pdf finds _this_ R's Rd.sty
texinputs <- file.path(R.home("share"), "texmf", "tex", "latex")
res <- try(texi2pdf('Rd2.tex', quiet = quiet, index = index, texinputs = texinputs))
if(inherits(res, "try-error")) {
res <- try(texi2pdf('Rd2.tex', quiet = quiet, index = index))
res <- try(texi2pdf('Rd2.tex', quiet = quiet, index = index, texinputs = texinputs))
if(inherits(res, "try-error")) {
message("Error in running tools::texi2pdf()")
do_cleanup()
Expand Down

0 comments on commit b898130

Please sign in to comment.