[R-pkg-devel] Macros in Rd files --- supplementary question.
Georgi Boshnakov
georgi.boshnakov at manchester.ac.uk
Sat Nov 11 20:08:29 CET 2017
It is more subtle than that.
\Sexpr triggers the creation of "partial Rd database" which becomes part of the built package (the tar.gz file), although what exactly happens may also depend on 'stage' options of the \Sexpr's.
> ... However when I do the "R CMD build" thing, when it comes to the
> "* building the PDF package manual"
> step it says "Hmm ... looks like a package" (no shit, Sherlock!) and
> emits a huge amount of verbose LaTeX diagnostics.
I have never seen "* building the PDF package manual" from 'R CMD build', see below for a sample console output on Windows from a package which contains Rd macros and vignettes. The messages you show seem to come from 'Rd2pdf'. Is it possible that you have some custom script that builds the manual, as well? Also some environment variable may be the culprit.
Best regards,
Georgi Boshnakov
C:\Users\mcbssgb2\Az\Rdevel\bitbucket\countr_project>R CMD build XXX
* checking for file 'XXX/DESCRIPTION' ... OK
* preparing 'XXX':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* installing the package to process help pages
* saving partial Rd database
* creating vignettes ... OK
* cleaning src
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'XXX_3.4.1.tar.gz'
-----Original Message-----
From: R-package-devel [mailto:r-package-devel-bounces at r-project.org] On Behalf Of Rolf Turner
Sent: 10 November 2017 20:01
To: Duncan Murdoch
Cc: r-package-devel at r-project.org
Subject: Re: [R-pkg-devel] Macros in Rd files --- supplementary question.
On 10/11/17 09:29, Rolf Turner wrote:
> On 09/11/17 23:40, Duncan Murdoch wrote:
>> On 09/11/2017 5:06 AM, Uwe Ligges wrote:
>>> Note the % may be a comment?
>>>
>>
>> Yes, and the body should be written in Rd markup, not R. Working out
>> the appropriate number of escapes is painful; I recommend trial and
>> error.
>>
>> This worked for me:
>>
>> \newcommand{\today}{\Sexpr{format(Sys.Date(),"\\\%d/\\\%m/\\\%Y")}}
>
> Did that, and it worked like a charm. However when I do the "R CMD
> build" thing, when it comes to the "* building the PDF package manual"
> step it says "Hmm ... looks like a package" (no shit, Sherlock!) and
> emits a huge amount of verbose LaTeX diagnostics.
>
> "Normally" one just gets the line "* building the PDF package manual"
> and nothing else, and "R CMD build" just carries on cruising.
>
> Evidently defining a macro in the *.Rd file triggers the extra elaboration.
>
> It's no big deal of course, but I just thought I'd ask:
>
> (a) Is there anything to worry about in this respect?
>
> (b) Is there anything different that I should be doing?
>
> (c) Is there anyway of suppressing the (ever-so-slightly annoying)
> extra screen output?
>
> I guess that's really three supplementary questions ....
Following up a suggestion that I got from Adrian Baddeley I did
R CMD build --help
(I guess this is a case of RTFM) and I got:
> Usage: R CMD build [options] pkgdirs
>
> Build R packages from package sources in the directories specified by
> ‘pkgdirs’
>
> Options:
> -h, --help print short help message and exit
> -v, --version print version info and exit
>
> --force force removal of INDEX file
> --keep-empty-dirs do not remove empty dirs
> --no-build-vignettes do not (re)build package vignettes
> --no-manual do not build the PDF manual even if \Sexprs are present
> ...
> ...
> ...
So: What's triggering the building of the manual is the presence of \Sexpr in my macro, and I can suppress this and get rid of all the unwanted LaTeX bumff by using the --no-manual flag.
I must say that I don't see why the presence of a \Sexpr (WTF ever that
is) should trigger the building of the manual.
May I humbly suggest to R Core that this behaviour be modified; perhaps there could be a --manual flag asking that the manual be built (whether or not there are \Sexpr expressions in the *.Rd files).
cheers,
Rolf
--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
______________________________________________
R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
More information about the R-package-devel
mailing list