Jos*_*erg 5 html markdown r knitr r-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)
```
Run Code Online (Sandbox Code Playgroud)
虽然我没有方便的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
Run Code Online (Sandbox Code Playgroud)
编辑:这是一个可重现的示例:
---
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)
```
Run Code Online (Sandbox Code Playgroud)
bca*_*ers 13
根据https://community.rstudio.com/t/floating-table-of-contents-and-plots-produce-extra-whitespace-at-bottom/12606/8,您可以toc_float通过插入来保留和删除额外的空白.Rmd 文件底部的以下 html 代码:
<div class="tocify-extend-page" data-unique="tocify-extend-page" style="height: 0;"></div>
Run Code Online (Sandbox Code Playgroud)
为我工作!