[R-pkg-devel] CRAN note about \href{https://doi.org/...}{label} in Rd files
Duncan Murdoch
murdoch@dunc@n @end|ng |rom gm@||@com
Tue Mar 30 18:46:45 CEST 2021
On 30/03/2021 12:36 p.m., Duncan Murdoch wrote:
> On 30/03/2021 10:39 a.m., Floris Vanderhaeghe wrote:
>>>> I just tried \doi{10.5281/zenodo.2611233} and it worked.
>>
>> Sure, but what about making a hyperlink to
>> https://doi.org/10.5281/zenodo.2611233 while showing "text" in the
>> documentation, as in \href{wwwaddress}{text}. I assume the CRAN note
>> appears because it wants literal DOI strings in the documentation to be
>> specified with \doi{}. However with \href{} the DOI string remains hidden.
>>
>> href{\doi{10.5281/zenodo.2611233}}{text} is a non-functional link while
>> \href{https://doi.org/10.5281/zenodo.2611233}{text} is functional.
>>
>
> No, I don't think there's currently any way to do that. Your choices
> are probably to link to whatever the DOI links to, e.g.
> \href{https://zenodo.org/record/2682323}{text} and live with the fact
> that the URL might change tomorrow, or show the DOI.
One other suggestion: define your own \doi{} macro. The current
definition (from R_HOME/share/Rd/macros/system.Rd) is
\newcommand{\doi}{\Sexpr[results=rd,stage=build]{tools:::Rd_expr_doi("#1")}}
You could make a two-argument variant on this. You could even submit it
as a patch on Bugzilla if you think others would like it.
Duncan Murdoch
More information about the R-package-devel
mailing list