【问题标题】:How to format DOI in Rmd vignette so that correct in Rd?如何在 Rmd 小插图中格式化 DOI 以便在 Rd 中正确?
【发布时间】:2022-07-13 23:20:28
【问题描述】:

当我使用 devtools::check_rhub() 在 rhub 上检查我的包时,我注意到在小插曲中存在格式不正确的 DOI,例如

网址:doi:10.1029/2002GL016612 来自:inst/doc/introduction-to-sedproxy.html 消息:无效的 URI 方案(在 Rd 标记中使用 \doi 表示 DOI)

我正在从 rmarkdown (.Rmd) 文件生成小插图。如何在 Rmd 中格式化 DOI,以便它们在 Rd 中正确?

【问题讨论】:

标签: r-markdown r-package


【解决方案1】:

来自https://cran.r-project.org/doc/manuals/r-devel/R-exts.html 中的2.1.1 Documenting functions 部分:

A section with references to the literature. Use \url{} or \href{}{} for web pointers, and \doi{} for DOIs (this needs R >= 3.3, see User-defined macros for more info).

因此,建议您也使用它作为参考(即使它直接在没有 \doi{} 的情况下通过在其前面加上 https://doi.org/ 前缀):

\doi{10.1029/2002GL016612}

这不应该提示使用--as-cran 运行R CMD check。 vignettes / R markdown 似乎也是这种情况,而不仅仅是 Rd 文件。

【讨论】:

    【解决方案2】:

    我为此苦苦挣扎,发现使用 Rmarkdown 插入链接以这种形式添加了它

    [Pui](https://doi.org/10.1080/02786828708959166)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-22
      • 1970-01-01
      • 2016-07-09
      • 2010-11-08
      • 2020-10-11
      • 2012-12-29
      • 2016-09-12
      • 2018-02-18
      相关资源
      最近更新 更多