Skip to content

Commit

Permalink
fix Rd2pdf for --latex installations with help figures
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@87661 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
smeyer committed Jan 28, 2025
1 parent 836c2a2 commit 8ca0379
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,9 @@
\item \code{tools::Rd2latex()} now removes leading and trailing
spaces from \verb{\alias} entries as documented, fixing indexing
and linking hiccups in some PDF manuals.
\item \command{R CMD Rd2pdf} can now render the package manual from
a \option{--latex} installation also when the help contains figures.
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/library/tools/R/Rd2pdf.R
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,9 @@
graphicspath <- file.path(mandir, "figures")
if (!silent) message(domain = NA)
}
} else {
graphicspath <- file.path(pkgdir, "help", "figures")
hasFigures <- dir.exists(graphicspath)
}

## There are some restrictions, but the former "[[:alnum:]]+\\.tex$" was
Expand All @@ -362,7 +365,7 @@
cat("\n\\chapter{The \\texttt{", basename(pkgdir), "} package}\n",
sep = "", file = outcon)

if (!is.null(graphicspath))
if (hasFigures && !is.null(graphicspath))
cat(.file_path_to_LaTeX_graphicspath(graphicspath), "\n",
sep = "", file = outcon)

Expand Down

0 comments on commit 8ca0379

Please sign in to comment.