r-markdown - 增加 rmarkdown 中目录的宽度

标签 r-markdown

有谁知道如何在 rmarkdown 中增加 float 目录的宽度,以便它可以在一行中显示所有标题而不会中断。 这是一个例子:

---
title: "Title"
author: "Author "
date: '`r format(Sys.Date(), "%B %d, %Y")`'
output:
  html_document:
    toc_float: true
    toc: true
    number_sections: true
    code_folding: show
theme: lumen
editor_options: 
  chunk_output_type: console
---

# A loooooooooooooooooooooooong title

谢谢

最佳答案

我的诀窍是更改 float 目录的 CSS 样式。您可以使用 CSS 代码块将 CSS 规则直接嵌入到您的 Rmd 文档中。例如,像这样:

title: "XY"
author: "XX"
date: '`r format(Sys.Date(), "%B %d, %Y")`'
output:
  html_document:
    toc: true
    theme: united 
    toc_depth: 4
    toc_float: true
.tocify .tocify-header {
    position: fixed;
    top: 50px;
    left: 50px;
    width: 500px;
    height: 200px;
}

或者您可以将其包含在自定义样式表中:

output:
  html_document:
    css: "style.css"

关于r-markdown - 增加 rmarkdown 中目录的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58391554/

相关文章:

css - 在 Flexdashboard 中更改激活页面的颜色

r - 如何在多列上拆分kable?

r - 如何让RStudio自动编译R Markdown Vignettes?

R flexdashboard 没有在标签集中显示我的所有数据表

数学符号 R Markdown 中的 R 代码

R Markdown 输出大小

rstudio - 如何在Github上的Rmd文件中显示数学

Markdown 。如何减少标题栏和正文开头之间的空间

r - 有没有办法从 RMarkdown 文件中引用 yaml frontmatter 部分?

r - [R] 中的 kableExtra 突然崩溃