在 xaringan

问题描述

我想使用 CSS 为 xaringan 幻灯片中的不同单词着色。

我创建了一个名为 stuff.css 的文件,其中包含:

.red {
color: red;  
}

我的 rmarkdown 文件有这个:

---
title: "test"
output:
  xaringan::moon_reader:
    css: ["stuff.css"]
    lib_dir: libs
---

blah .red[<command]

blah .red[command>]

blah .red[<command>]

前两行按我的预期显示[ ] 内的文本为红色),但第三行只显示废话。为什么会这样?如何让第三行在尖括号中显示 blah 后跟 word 命令?

解决方法

编辑

这应该可以解决问题。将这些添加到您的 function DirectedGraph() { this.edges = {}; } DirectedGraph.prototype.addVertex = function(vertex) { this.edges[vertex] = {}; } DirectedGraph.prototype.addEdge = function(origVertex,destVertex,weight=0) { this.edges[origVertex][destVertex] = weight; } 文件中:

css

然后,只需调用 .red { color: red; } .red:before { content: '\003C'; } .red:after { content: '\003E'; } 。特殊字符 .red[command]< 将分别添加在 > 之前和之后,red:before

,

您可以在 Rmarkdown 中以多种方式使用 CSS 来控制输出中的彩色单词。整体主体颜色为 red,而我可以使用内嵌 CSS 代码覆盖颜色。

---
title: "test"
output:
  xaringan::moon_reader:
    lib_dir: libs
---

```{css,echo = FALSE}
body{
  color: red;
}
```

red

<span style="color:black">black</span>

<span style="color:green">green</span>

enter image description here

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...