r - Rmd 笔记本中节号后的尾随句点

标签 r rstudio r-markdown knitr rnotebook

我有一个如下所示的 R 笔记本:

---
title: "R Notebook"
output: 
  html_notebook:
    number_sections: true
    toc: true
---
# First section   
## Subsection
Some text

# Second section

在 RStudio 中呈现给预览笔记本时,它会生成带编号的部分标题,例如 1 First section1.1 Subsection 等。如果我想让它在数字的结尾,即产生 1。第一部分1.1。小节等?

最佳答案

您可以使用 CSS 来设置这些数字的样式。

例如,这些笔记本在您想要的标题编号之后有点:

---
title: "R Notebook"
output: 
  html_notebook:
    number_sections: true
    toc: true
---

```{css, echo=FALSE}
.header-section-number::after {
  content: ".";
}
```

# First section   
## Subsection
Some text

# Second section

关于r - Rmd 笔记本中节号后的尾随句点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56606970/

相关文章:

cursor - R 工作室 : Change cursor color

RStudio 不显示任何 Pane

python - 无法在 rmarkdown 中导入 python 模块

r - R : Variable not found in data. 框架中的多元回归

html - R Shiny : use HTML within functions (like textInput, checkboxGroupInput)

r - R:更改数据框中列的字符编码

r - 在 RMarkdown 文档中使用引用书目时,如何在 RStudio 中使用 --citeproc 而不是 pandoc-citeproc?

css - 如何使用 rvest 从搜索结果 url 中提取 id 名称? (CSS 选择器不起作用)

r - 使用键盘输入中断循环 (R)

latex - 通过 rmarkdown 交叉引用章节编号或名称