When I include the macros \packageAuthor, \packageDescription, \packageTitle, \packageMaintainer in a XX-package.Rd file, R CMD Rd2pdf fails with $ R CMD Rd2pdf mpra Hmm ... looks like a package Converting Rd files to LaTeX Error : mpra/man/mpra-package.Rd:6: file './DESCRIPTION' does not exist This does not happen if I comment out 4 occurrences of these 4 macros in mpra-package.Rd. This is with R Under development (unstable) (2017-09-26 r73351) -- "Unsuffered Consequences" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin16.7.0 (64-bit) or R version 3.4.2 RC (2017-09-26 r73351) -- "Short Summer" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin16.7.0 (64-bit) and MacTex 2017. Best, Kasper
possible bug in R CMD Rd2pdf
5 messages · Peter Dalgaard, Kasper Daniel Hansen, Duncan Murdoch
If it is looking for ./DESCRIPTION, perhaps it matters which directory you invoke it from? -pd
On 27 Sep 2017, at 04:27 , Kasper Daniel Hansen <kasperdanielhansen at gmail.com> wrote: When I include the macros \packageAuthor, \packageDescription, \packageTitle, \packageMaintainer in a XX-package.Rd file, R CMD Rd2pdf fails with $ R CMD Rd2pdf mpra Hmm ... looks like a package Converting Rd files to LaTeX Error : mpra/man/mpra-package.Rd:6: file './DESCRIPTION' does not exist This does not happen if I comment out 4 occurrences of these 4 macros in mpra-package.Rd. This is with R Under development (unstable) (2017-09-26 r73351) -- "Unsuffered Consequences" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin16.7.0 (64-bit) or R version 3.4.2 RC (2017-09-26 r73351) -- "Short Summer" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin16.7.0 (64-bit) and MacTex 2017. Best, Kasper [[alternative HTML version deleted]]
______________________________________________ R-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
On 26/09/2017 10:27 PM, Kasper Daniel Hansen wrote:
When I include the macros \packageAuthor, \packageDescription, \packageTitle, \packageMaintainer in a XX-package.Rd file, R CMD Rd2pdf fails with $ R CMD Rd2pdf mpra Hmm ... looks like a package Converting Rd files to LaTeX Error : mpra/man/mpra-package.Rd:6: file './DESCRIPTION' does not exist This does not happen if I comment out 4 occurrences of these 4 macros in mpra-package.Rd. This is with R Under development (unstable) (2017-09-26 r73351) -- "Unsuffered Consequences" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin16.7.0 (64-bit) or R version 3.4.2 RC (2017-09-26 r73351) -- "Short Summer" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin16.7.0 (64-bit) and MacTex 2017.
Those errors are coming from tools:::Rd_package_author and related
functions, because the system-defined macros call them. Current
definition of the \packageAuthor macro is
\newcommand{\packageAuthor}{\Sexpr[results=rd,stage=build]{tools:::Rd_package_author("#1")}}
and the function is defined as
function (pkg, dir = ".")
{
desc <- .read_description(file.path(dir, "DESCRIPTION"))
if (pkg != desc["Package"])
stop(gettextf("DESCRIPTION file is for package '%s', not '%s'",
desc["Package"], pkg))
desc["Author"]
}
So Peter is right, this would likely work if the current working
directory was the top level directory of the package, but it can't work
in general.
The easiest fix would probably be to change the code underlying R CMD
Rd2pdf so that it works from the top level directory; another
possibility might be to come up with a better default for the "dir"
parameter.
Duncan Murdoch
Sorry for the noise. I assumed I could run this in the same directory as R CMD check. If I cd into the package dir, and run it like R CMD Rd2pdf man it works. I was a bit sleep deprived yesterday. The fact that the output starts by Hmm ... looks like a package threw me off. That output suggests it should work, I think. So I would suggests either 1) handling both package and man directories 2) check that the input dir is a collection of man pages with a DESCRIPTION file in the same directory Best, Kasper On Wed, Sep 27, 2017 at 7:03 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
On 26/09/2017 10:27 PM, Kasper Daniel Hansen wrote:
When I include the macros \packageAuthor, \packageDescription, \packageTitle, \packageMaintainer in a XX-package.Rd file, R CMD Rd2pdf fails with $ R CMD Rd2pdf mpra Hmm ... looks like a package Converting Rd files to LaTeX Error : mpra/man/mpra-package.Rd:6: file './DESCRIPTION' does not exist This does not happen if I comment out 4 occurrences of these 4 macros in mpra-package.Rd. This is with R Under development (unstable) (2017-09-26 r73351) -- "Unsuffered Consequences" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin16.7.0 (64-bit) or R version 3.4.2 RC (2017-09-26 r73351) -- "Short Summer" Copyright (C) 2017 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin16.7.0 (64-bit) and MacTex 2017.
Those errors are coming from tools:::Rd_package_author and related
functions, because the system-defined macros call them. Current definition
of the \packageAuthor macro is
\newcommand{\packageAuthor}{\Sexpr[results=rd,stage=build]{t
ools:::Rd_package_author("#1")}}
and the function is defined as
function (pkg, dir = ".")
{
desc <- .read_description(file.path(dir, "DESCRIPTION"))
if (pkg != desc["Package"])
stop(gettextf("DESCRIPTION file is for package '%s', not '%s'",
desc["Package"], pkg))
desc["Author"]
}
So Peter is right, this would likely work if the current working directory
was the top level directory of the package, but it can't work in general.
The easiest fix would probably be to change the code underlying R CMD
Rd2pdf so that it works from the top level directory; another possibility
might be to come up with a better default for the "dir" parameter.
Duncan Murdoch
On 27/09/2017 1:57 PM, Kasper Daniel Hansen wrote:
Sorry for the noise.
I wouldn't call this noise, it's a bug that happens to have a fairly easy workaround. The tools functions are mainly for use by R utilities, so they sometimes make strong assumptions about the context in which they are used; this is a case where something that was thought of as internal leaked out into user-land.
I assumed I could run this in the same directory as R CMD check. If I cd into the package dir, and run it like ? R CMD Rd2pdf man it works. I was a bit sleep deprived yesterday.
You could also use R CMD Rd2pdf . while in that directory. Duncan Murdoch
The fact that the output starts by
Hmm ... looks like a package
threw me off. That output suggests it should work, I think. So I would
suggests either
? 1) handling both package and man directories
? 2) check that the input dir is a collection of man pages with a
DESCRIPTION file in the same directory
Best,
Kasper
On Wed, Sep 27, 2017 at 7:03 AM, Duncan Murdoch
<murdoch.duncan at gmail.com <mailto:murdoch.duncan at gmail.com>> wrote:
On 26/09/2017 10:27 PM, Kasper Daniel Hansen wrote:
When I include the macros \packageAuthor, \packageDescription,
\packageTitle, \packageMaintainer in a XX-package.Rd file, R CMD
Rd2pdf
fails with
$ R CMD Rd2pdf mpra
Hmm ... looks like a package
Converting Rd files to LaTeX Error : mpra/man/mpra-package.Rd:6:
file
'./DESCRIPTION' does not exist
This does not happen if I comment out 4 occurrences of these 4
macros in
mpra-package.Rd.
This is with
R Under development (unstable) (2017-09-26 r73351) -- "Unsuffered
Consequences"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin16.7.0 (64-bit)
or
R version 3.4.2 RC (2017-09-26 r73351) -- "Short Summer"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin16.7.0 (64-bit)
and MacTex 2017.
Those errors are coming from tools:::Rd_package_author and related
functions, because the system-defined macros call them.? Current
definition of the \packageAuthor macro is
\newcommand{\packageAuthor}{\Sexpr[results=rd,stage=build]{tools:::Rd_package_author("#1")}}
and the function is defined as
function (pkg, dir = ".")
{
? ? desc <- .read_description(file.path(dir, "DESCRIPTION"))
? ? if (pkg != desc["Package"])
? ? ? ? stop(gettextf("DESCRIPTION file is for package '%s', not '%s'",
? ? ? ? ? ? desc["Package"], pkg))
? ? desc["Author"]
}
So Peter is right, this would likely work if the current working
directory was the top level directory of the package, but it can't
work in general.
The easiest fix would probably be to change the code underlying R
CMD Rd2pdf so that it works from the top level directory; another
possibility might be to come up with a better default for the "dir"
parameter.
Duncan Murdoch