[R-pkg-devel] Macros in Rd files.

Rolf Turner r.turner at auckland.ac.nz
Thu Nov 9 21:05:29 CET 2017


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")}}

Now that is a bit more subtle!  I don't understand what "written in Rd 
markup" really means, and I don't understand the "\Sexpr" construction.
I'd seen it when looking at the example macros in

    /usr/local/lib64/R/share/Rd/macros/system.Rd

but I figured if you know nothing about it, don't mess with it.

Is there anywhere that I could read up about writing "in Rd markup"?

Anyway, thanks for giving me the recipe, which is what I really need.

cheers,

Rolf

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-package-devel mailing list