【发布时间】:2017-11-06 23:49:34
【问题描述】:
所以,有一些关于 SO 的问题,但似乎没有解决这个特定问题。
我希望使用自定义 CSS 模板自定义从 RStudio 创建的 RMarkdown/Slidy 演示文稿。
- RStudio 已经允许使用内置的 Bootswatch 主题进行最少的自定义,因此可以访问
output: slidy presentation / theme: readable - 还有其他未内置的 Bootswatch 主题;具体来说,我可能想使用
Cyborg或Slate,它们有漂亮的深色背景(而不是白色)
以下是使用自定义文件覆盖 Slidy CSS 的直观解决方案:
```{css}
<link href="bootstrap-slate.css" rel="stylesheet">
```
但是,它失败了:
pandoc.exe: Could not fetch .\../fonts/glyphicons-halflings-regular.eot
.\../fonts/glyphicons-halflings-regular.eot: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 67
In addition: Warning message:
running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS segmentations.utf8.md --to slidy --from
markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --
output segmentations.html --smart --email-obfuscation none --self-contained --template "C:\Users\ME\Documents\R\R-3.3.3\library\rmarkdown\rmd\slidy\default.html" --include-in-header
"C:\Users\ME\AppData\Local\Temp\RtmpGYLCFf\rmarkdown-str378022cf50b0.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --highlight-style pygments' had status 67
Execution halted
欢迎提出任何建议。请注意,文档rMarkdown documentation 中的解决方案不起作用。解决方案复制到这里以供参考:
---
output:
slidy_presentation:
css: styles.css ##
---
Error in yaml::yaml.load(string, ...) :
Scanner error: mapping values are not allowed in this context at line 5, column 21
Calls: <Anonymous> ... parse_yaml_front_matter -> yaml_load_utf8 -> <Anonymous> -> .Call
Execution halted
【问题讨论】:
-
最后一个例子对我来说很好。确保您有正确的缩进(每行开头有 2 个空格),并且某处没有过时的空格或其他字符(如哈希)...
-
嗨,马丁,感谢您的回复。不幸的是我还在挣扎,你能告诉我你把css文件放在哪里吗?我将它与我的 rmd 文件放在同一目录中,即在工作目录中。 (所有空格都被适当地删除了,上面代码中的哈希仅作为路标)。
-
与 Rmd 文件在同一文件夹中。
-
谢谢马丁。再次尝试,这次出现了不同的问题,错误消息现在显示为:
pandoc: Could not fetch ./../fonts/glyphicons-halflings-regular.eot ./../fonts/glyphicons-halflings-regular.eot: openBinaryFile: does not exist (No such file or directory) Error: pandoc document conversion failed with error 67 Execution halted -
从错误信息的声音来看,也许css文件需要包含某些字体才能兼容?我正在使用来自
https://bootswatch.com/slate/bootstrap.css的主题
标签: r rstudio r-markdown pandoc slidy