R在R manual hyperref中包含“#”

时间:2013-05-31 17:12:44

标签: r devtools roxygen2

我试图在rep文件中使用roxygen2和devtools在R文档中包含一个hyperref链接。 Here's a dummy version

#' Test
#' 
#' Test 2
#' 
#' @param x An object
#' @section Suggestion: Looky here: 
#' \enumerate{ 
#'   \item{\bold{Item 1} - Foo}
#'   \item{\bold{Item 2} - Bar:  
#'   \href{https://github.com/hakimel/reveal.js/#installation}{click me}}   
#' }
#' @export 
test <- function(x = "test") {
    print(x)
}

我跑

library(roxygen2)
roxygenize("C:/Users/trinker/GitHub/dummy")

然后在R studio中使用check and out弹出这个错误:

* checking PDF version of manual ... WARNING
LaTeX errors when creating PDF version.
This typically indicates Rd problems.
LaTeX errors found:
! Illegal parameter number in definition of \Hy@tempa.
<to be read again> 
                   i
l.61 me}

! Illegal parameter number in definition of \Hy@tempa.
<to be read again> 
                   i
l.61 me}

! Illegal parameter number in definition of \Hy@tempa.
<to be read again> 
                   i
l.61 me}

* checking PDF version of manual without hyperrefs or index ... ERROR

Exited with status 1.




Files
Plots
Help




New Folder


Delete


Rename


More




C:  Users   trinker GitHub  dummy   R


Name
Size    Modified

..


dummy-package.R
109 bytes
May 31, 2013, 12:51 PM


test.R
324 bytes
May 31, 2013, 12:56 PM


ConsoleC:/Users/trinker/GitHub/dummy/

所以我逃离了#并且它跑了:

#' Test
#' 
#' Test 2
#' 
#' @param x An object
#' @section Suggestion: Looky here: 
#' \enumerate{ 
#'   \item{\bold{Item 1} - Foo}
#'   \item{\bold{Item 2} - Bar:  
#'   \href{https://github.com/hakimel/reveal.js/\#installation}{click me}}   
#' }
#' @export 
test <- function(x = "test") {
    print(x)
}

PDF looks good和hypref有效。但是如果我这样做的话:

library(dummy)
?dummy::test

hyperef click me被打破并导致:

https://github.com/hakimel/reveal.js//#installation

而不是:

https://github.com/hakimel/reveal.js/#installation

由pdf(LaTeX链接)制作。

如何正确地避开井号(#),以便pdf和html文档的链接工作?

我把devtools和roxygen2标签打开了,但我不认为它们与这个问题有关。

要求的会话信息:

> sessionInfo()
R version 3.0.0 (2013-04-03)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] dummy_0.1.0

loaded via a namespace (and not attached):
[1] tools_3.0.0

0 个答案:

没有答案