【发布时间】:2019-03-26 18:28:57
【问题描述】:
markdown 结尾处的空白是否存在共同的罪魁祸首?这是我的 HTML 输出的结尾。还有我的选择:
```
{r }
knitr::opts_chunk$set(fig.width=6, fig.asp=.618, fig.align="center",
fig.path='Figs/', warning=FALSE, message=FALSE, cache=TRUE)
```
虽然我手头没有 reprex,但我确实尝试了几次重新运行,发现 YAML 导致了空白,特别是 toc_float: true。
date: "`r format(Sys.time(), '%B, %d %Y')`"
output:
html_document:
theme: united
highlight: textmate
code_folding: show
toc: true
toc_float: true
editor_options:
chunk_output_type: inline
always_allow_html: yes
编辑:这是一个可重现的示例:
---
date: "`r format(Sys.time(), '%B, %d %Y')`"
output:
html_document:
theme: united
highlight: textmate
code_folding: show
toc: true
toc_float: true
editor_options:
chunk_output_type: inline
always_allow_html: yes
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars}
summary(cars)
```
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
```
【问题讨论】:
-
@tarleb 我通常用我的问题来做代表。这个问题似乎有点不同,因为它是用 knitr 渲染 HTML。我试图提供回答这个问题可能需要的东西。我会看看我是否可以制作一个最小的 rmarkdown 示例。谢谢。
-
谢谢!我能够重现它并四处寻找。似乎是由浮动目录引起的。我已经添加了答案。
标签: html r markdown r-markdown knitr