Rmarkdown theme not applied in vignette using R CMD build
我正在尝试制作一个带有特定主题的html包小插图,例如prettydoc(`https://github.com/yixuan/prettydoc/blob/master/vignettes/hpstr.Rmd)的hpstr主题。
如果我手动构建小插图:
主题已正确应用。 但是,当我使用标准的构建过程时,例如:
1 2 3 4 | git clone https://github.com/yixuan/prettydoc.git cd prettydoc R CMD build . R CMD INSTALL prettydoc_0.2.1.tar.gz |
然后在R中:
1 2 | > library('prettydoc') > vignette('hpstr') |
主题根本不呈现,看起来像常规的
小插图顶部的yml如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | --- title:"Creating Pretty Documents from R Markdown" subtitle:"The HPSTR Theme" author:"Yixuan Qiu" date:"`r Sys.Date()`" output: prettydoc::html_pretty: theme: hpstr highlight: github vignette: > %\\VignetteIndexEntry{Creating Pretty Documents from R Markdown - The HPSTR Theme} %\\VignetteEngine{knitr::rmarkdown} %\\VignetteEncoding{UTF-8} --- |
在
1 | VignetteBuilder: knitr, rmarkdown |
因此,看起来小插图生成器不是
如何使用
如果未在系统级别安装pandoc或将其旧版本安装,而RStudio附带了自己的pandoc版本,则可能会发生这种情况。 因此,RStudio中的渲染成功,而
- 在系统级别安装或更新Pandoc
- 使RStudio附带的pandoc在系统级别可用
- 在RStudio中构建软件包(由@YihuiXie建议)