【发布时间】:2019-02-07 14:43:28
【问题描述】:
在常规的书本格式中,每一章都以粗体开头:
第 1 章
章节标题
我正在尝试将“第 1 章”的颜色更改为深灰色,而不是黑色。我对 LaTeX 完全陌生,但根据其他 Stackoverflow 问题拼凑了一些代码,以自定义颜色。我创建了一个mystyles.sty 文件,其中包括:
\usepackage{titlesec}
\usepackage{xcolor}
\definecolor{battleshipgrey}{rgb}{0.52, 0.52, 0.51}
\titleformat{\thechapter}
{\color{battleshipgrey}\normalfont\Large\bfseries}
{\color{battleshipgrey}\chapter}{1em}{}
我的 YAML 标头是:
title: "My Title"
author: "Me"
date: ""
output: pdf_document
bibliography: [bib.bib]
documentclass: book
geometry: left=4cm, right=3cm, top=2.5cm, bottom=2.5cm
link-citations: yes
classoption: openany
biblio-style: apalike
subparagraph: true
我有一个带有以下代码的 _output.yml:
bookdown::pdf_book:
includes:
in_header: mystyles.sty
latex_engine: xelatex
citation_package: natbib
keep_tex: no
mainfont: Bookman
我在我的mystyles.sty 文档中指定了哪些错误?目前,颜色没有任何变化。我试过指定:
\titleformat{\chapter}
{\color{battleshipgrey}\normalfont\Large\bfseries}
{\color{battleshipgrey}\thechapter}{1em}{}
但这会将章节编号和标题着色为灰色,但章节标题的格式更改为:
1 章节标题
【问题讨论】:
标签: r latex r-markdown bookdown