diff --git a/doc/NEWS.Rd b/doc/NEWS.Rd index 036fb375b1..b1a50df55d 100644 --- a/doc/NEWS.Rd +++ b/doc/NEWS.Rd @@ -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. } } } diff --git a/src/library/tools/R/Rd2pdf.R b/src/library/tools/R/Rd2pdf.R index 56ab8c85eb..81d9e95d9c 100644 --- a/src/library/tools/R/Rd2pdf.R +++ b/src/library/tools/R/Rd2pdf.R @@ -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 @@ -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)