着色段落标题部分

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

Coloring paragraph section headers

问题

这是要翻译的代码部分:

  1. ---
  2. title: "number_sections"
  3. output:
  4. pdf_document:
  5. number_sections: yes
  6. toc_depth: 4
  7. toc: true
  8. header-includes:
  9. -\usepackage{color}
  10. - \usepackage{sectsty}
  11. - \allsectionsfont{\color{red}}
  12. ---

请注意,这是一个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:

  1. ---
  2. title: "number_sections"
  3. output:
  4. pdf_document:
  5. number_sections: yes
  6. toc_depth: 4
  7. toc: true
  8. header-includes:
  9. -\usepackage{color}
  10. - \usepackage{sectsty}
  11. - \allsectionsfont{\color{red}}
  12. ---
  13. # Main Section
  14. The above section and the ones below should be red
  15. ## 2nd Level
  16. ### 3rd Level
  17. # Second Section
  18. ## another section
  19. ### yet another
  20. #### and the last one please

答案1

得分: 0

header-includes should be at the left (not indented), and a missing space before \usepackage:

  1. ---
  2. title: "number_sections"
  3. output:
  4. pdf_document:
  5. number_sections: yes
  6. toc_depth: 4
  7. toc: true
  8. header-includes:
  9. - \usepackage{color}
  10. - \usepackage{sectsty}
  11. - \allsectionsfont{\color{red}}
  12. ---
英文:

Your code is pretty much correct, it's just the indentation in the YAML header that's slightly off:

  1. ---
  2. title: "number_sections"
  3. output:
  4. pdf_document:
  5. number_sections: yes
  6. toc_depth: 4
  7. toc: true
  8. header-includes:
  9. - \usepackage{color}
  10. - \usepackage{sectsty}
  11. - \allsectionsfont{\color{red}}
  12. ---

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:

确定