我正在使用knitr和pandoc将报告写入单词(我们需要能够使用跟踪更改来传播评论等)。
到目前为止它工作得非常好,但我发现这些情节都是底部带有字幕的,我不想要字幕。虽然我可以在单词doc中删除它们,但如果我可以阻止它们在代码中显示它会更好。
因此,对于markdown中的以下代码:
Test test test
```{r}
summary(cars)
```
You can also embed plots, for example:
```{r fig.width=7, fig.height=6}
plot(cars)
```
然后我在R中运行以下代码:
library("knitr")
# Stackoverflow table test 1.html
knit2html("captiontest.rmd")
FILE <- "captiontest"
system(paste0("pandoc -o ", FILE, ".docx ", FILE, ".md"))
而word文档中的图形标题为“chunk unnamed-chunk-2”
我知道我可以改变这个标题,例如 {r fig.width=7, fig.height=6, fig.cap='hello'}
,但我想到了 fig.cap=NULL
会让它隐藏起来。相反,它似乎使整个情节消失。
情节是否需要有标题 - 我是否只需要浏览每个单词doc并手动删除它们?或者有办法隐藏它们吗?
一种肮脏的伎俩,但是:
你可以设置 fig.cap=""
在有问题的块上:
Test test test
```{r}
summary(cars)
```
You can also embed plots, for example:
```{r fig.width=7, fig.height=6, fig.cap=""}
plot(cars)
```
或者,你可以设置 fig.cap=""
对于Rmd文档开头的初始化块中的所有块一次:
Test test test
```{r options-chunk}
opts_chunk$set(fig.cap="")
```
```{r}
summary(cars)
```
You can also embed plots, for example:
```{r fig.width=7, fig.height=6}
plot(cars)
```
一种肮脏的伎俩,但是:
你可以设置 fig.cap=""
在有问题的块上:
Test test test
```{r}
summary(cars)
```
You can also embed plots, for example:
```{r fig.width=7, fig.height=6, fig.cap=""}
plot(cars)
```
或者,你可以设置 fig.cap=""
对于Rmd文档开头的初始化块中的所有块一次:
Test test test
```{r options-chunk}
opts_chunk$set(fig.cap="")
```
```{r}
summary(cars)
```
You can also embed plots, for example:
```{r fig.width=7, fig.height=6}
plot(cars)
```