diff --git a/doc/NEWS.Rd b/doc/NEWS.Rd index 01666c9689..babab53615 100644 --- a/doc/NEWS.Rd +++ b/doc/NEWS.Rd @@ -425,6 +425,10 @@ 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}. + + \item \code{tools::Rd2latex()} no longer outputs an + \samp{\\inputencoding{utf8}} line by default; + such a declaration is obsolete since \LaTeX 2018-04-01. } } diff --git a/src/library/tools/R/Rd2latex.R b/src/library/tools/R/Rd2latex.R index 97607c512b..fcdbd8bdb2 100644 --- a/src/library/tools/R/Rd2latex.R +++ b/src/library/tools/R/Rd2latex.R @@ -61,7 +61,7 @@ latex_canonical_encoding <- function(encoding) Rd2latex <- function(Rd, out = "", defines = .Platform$OS.type, stages = "render", outputEncoding = "UTF-8", fragment = FALSE, ..., - writeEncoding = TRUE, + writeEncoding = outputEncoding != "UTF-8", concordance = FALSE) { encode_warn <- FALSE diff --git a/src/library/tools/man/Rd2HTML.Rd b/src/library/tools/man/Rd2HTML.Rd index 215175ee81..29a087e273 100644 --- a/src/library/tools/man/Rd2HTML.Rd +++ b/src/library/tools/man/Rd2HTML.Rd @@ -1,6 +1,6 @@ % File src/library/tools/man/Rd2HTML.Rd % Part of the R package, https://www.R-project.org -% Copyright 2008-2022 R Core Team +% Copyright 2008-2025 R Core Team % Distributed under GPL 2 or later \name{Rd2HTML} @@ -34,7 +34,7 @@ Rd2txt(Rd, out = "", package = "", defines = .Platform$OS.type, Rd2latex(Rd, out = "", defines = .Platform$OS.type, stages = "render", outputEncoding = "UTF-8", - fragment = FALSE, ..., writeEncoding = TRUE, + fragment = FALSE, ..., writeEncoding = outputEncoding != "UTF-8", concordance = FALSE) Rd2ex(Rd, out = "", defines = .Platform$OS.type, @@ -75,7 +75,7 @@ Rd2ex(Rd, out = "", defines = .Platform$OS.type, standalone HTML file. If \code{FALSE}, the header and footer are omitted, so that the output can be combined with other fragments. } - \item{hooks}{A list of functions controlling details of + \item{hooks}{a list of functions controlling details of output. Currently the only component used is \code{pkg_href}, which is used by \code{pkg2HTML} to determine the output HTML file path given a package name as input. } @@ -86,15 +86,16 @@ Rd2ex(Rd, out = "", defines = .Platform$OS.type, examples section is wrapped inside a \code{rcode} block. } \item{Links, Links2}{\code{NULL} or a named (by topics) character vector of links, as returned by \code{\link{findHTMLlinks}}.} - \item{options}{An optional named list of options to pass to + \item{options}{an optional named list of options to pass to \code{\link{Rd2txt_options}}.} \item{...}{ additional parameters to pass to \code{\link{parse_Rd}} when \code{Rd} is a filename. } - \item{writeEncoding}{should \verb{\inputencoding} lines be written in - the file for non-ASCII encodings?} - \item{commentDontrun}{should \verb{\dontrun} sections be commented + \item{writeEncoding}{logical: should an \verb{\inputencoding} line be written + for non-ASCII encodings? \LaTeX release 2018-04-01 and later + default to UTF-8; the declaration is obsolete in that case.} + \item{commentDontrun}{logical: should \verb{\dontrun} sections be commented out?} - \item{commentDonttest}{should \verb{\donttest} sections be commented out?} + \item{commentDonttest}{logical: should \verb{\donttest} sections be commented out?} } \details{ These functions convert help documents: \code{Rd2HTML} produces HTML, diff --git a/tests/testit.tex.save b/tests/testit.tex.save index 88c3e74d84..e57d90b441 100644 --- a/tests/testit.tex.save +++ b/tests/testit.tex.save @@ -1,4 +1,3 @@ -\inputencoding{utf8} \HeaderA{testit}{An Rd Regression Test}{testit} \aliasB{\{}{testit}{.Rlbrace.} % diff --git a/tests/ver20.tex.save b/tests/ver20.tex.save index 96e1327fe2..84fbeefe90 100644 --- a/tests/ver20.tex.save +++ b/tests/ver20.tex.save @@ -1,4 +1,3 @@ -\inputencoding{utf8} \HeaderA{ver20}{Johnson \& Johnson, \$ \_ \#\#\# \textasciicircum{} \textasciitilde{}}{ver20} % \begin{Description}