英文:
Coloring paragraph section headers
问题
这是要翻译的代码部分:
---
title: "number_sections"
output:
pdf_document:
number_sections: yes
toc_depth: 4
toc: true
header-includes:
-\usepackage{color}
- \usepackage{sectsty}
- \allsectionsfont{\color{red}}
---
请注意,这是一个YAML配置文件,包括了一些设置,用于生成PDF文档。这部分不需要翻译。
英文:
I am trying to color my paragraph section headers but the is not working. Could someone point out why this is not coloring my sections? Consider the example below:
---
title: "number_sections"
output:
pdf_document:
number_sections: yes
toc_depth: 4
toc: true
header-includes:
-\usepackage{color}
- \usepackage{sectsty}
- \allsectionsfont{\color{red}}
---
# Main Section
The above section and the ones below should be red
## 2nd Level
### 3rd Level
# Second Section
## another section
### yet another
#### and the last one please
答案1
得分: 0
header-includes
should be at the left (not indented), and a missing space before \usepackage
:
---
title: "number_sections"
output:
pdf_document:
number_sections: yes
toc_depth: 4
toc: true
header-includes:
- \usepackage{color}
- \usepackage{sectsty}
- \allsectionsfont{\color{red}}
---
英文:
Your code is pretty much correct, it's just the indentation in the YAML header that's slightly off:
---
title: "number_sections"
output:
pdf_document:
number_sections: yes
toc_depth: 4
toc: true
header-includes:
- \usepackage{color}
- \usepackage{sectsty}
- \allsectionsfont{\color{red}}
---
header-includes
should be at the left (not indented), and a missing space before \usepackage
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论