[Rd] possible bug in R CMD Rd2pdf

Kasper Daniel Hansen kasperdanielhansen at gmail.com
Wed Sep 27 19:57:05 CEST 2017


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
>

	[[alternative HTML version deleted]]



More information about the R-devel mailing list