在参考部分使用 Roxygen2 模板标签

Use Roxygen2 template tags in references section

我对 Using Roxygen2 Template tags 的基础知识很有信心,它在替换对 @param 的调用时工作正常,但在使用模板将引用添加到参考部分时遇到问题。

我在 man-roxygen/refEstabrook1985.R 的模板显示为

#' \cite{Estabrook G.F., McMorris F.R., Meacham C.A. 1985. Comparison of undirected phylogenetic trees based on subtrees of four evolutionary units. Syst. Zool. 34:193--200.}

我已经尝试了几种方法来 link 将其添加到引用块中。

没有牙套

#' @references
#' @template refEstabrook1985

发出警告 Warning: @references [QuartetDistance.R#218]: requires a value 并且不呈现参考部分。

牙套,没有 spaces

#' @references {
#' @template refEstabrook1985
#' }

发出警告 Warning: @references [QuartetDistance.R#218]: mismatched braces or quotes Warning: @template [QuartetDistance.R#219]: mismatched braces or quotes 并且不呈现 .Rd 文件中的引用部分。

大括号和 spaces

#' @references {
#'  @template refEstabrook1985
#' }

(注意附加的 space)没有给出警告,但没有展开模板,因此手册页显示为 "References: @template refEstabrook1985"

我想我已经确定我想做的事是不可能的。 Roxygen manual 表示

Templates must be composed of complete tags - because all roxygen tags are current block tags, they can not be used for inline insertions.

另一种方法是使用 Rdpack:请参阅 Citing articles using roxygen2