I used a different color on sections and subsections in my rmarkdown document, but in the reader the names in sections (bookmarks) pane are now blank.
\textcolor{mycolor}{My section}
It looks like even if I revert mycolor
to black ({RGB}{0,0,0}
), the issue persists, so I assume I'm incorrectly using the \textcolor{mycolor}{Section text to color}
.
Is there another way? Also, is there a way to apply the same color to all sections/subsections?
Here is an arguably better approach to accomplish your goal of colored section headings:
---
title: "Untitled"
output: pdf_document
header-includes:
- \usepackage{sectsty}
- \sectionfont{\color{red}}
- \subsectionfont{\color{green}}
- \subsubsectionfont{\color{blue}}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Section
This section header should be red.
## Subsection
This subsection header should be green.
### Subsubsection
This subsubsection header should be blue.