且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

RStudio Knitr无法将Rmd转换为PDF(Windows 7)

更新时间:2022-05-23 09:15:42

您必须包含软件包color,然后它才能工作.我不知道为什么它只在其中带有R块的情况下起作用.但是此解决方案将解决此问题:

You have to include the package color, then it works. I don't know why this works just with an R chunk in it. But this solution will solve this problem:

---
title: "test"
output: pdf_document
header-includes: \usepackage{color}
---


Roses are \textcolor{red}{red}, violets are \textcolor{blue}{blue}.

如果要将颜色编织为HTML,则必须使用以下代码:

If you want to knit colors to HTML, you have to use this code:

---
title: "test"
output: html_document
---

Roses are <span style="color:red">red</span>, 
violets are <span style="color:blue">blue</span>.