着色段落标题部分

huangapple go评论53阅读模式
英文:

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

huangapple
  • 本文由 发表于 2023年2月16日 08:08:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/75466611.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定