Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

R Markdown Beamer: Change color of numbered list

Using Beamer in R Markdown (in R Studio, Windows 10), I am trying to change the color of a numbered list (enumerate) to have a custom color. I was successful in doing so for bullet points (itemize).

This post covers the process for itemize, but I can’t get it to work for enumerate.

I would prefer to keep using the theme and colortheme if possible.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

MRE

---
title: "test"
author: "author"
date: "date"
output: 
  beamer_presentation:
    theme: Berlin
    colortheme: beaver
    keep_tex: true
header-includes:
  - \usepackage{xcolor}
  - \definecolor{berlinred}{rgb}{0.64,0,0}
  - \setbeamercolor{itemize item}{fg=berlinred}
  - \setbeamercolor{itemize subitem}{fg=berlinred}
  - \setbeamercolor{enumerate item}{fg=berlinred}
  - \setbeamercolor{enumerate subitem}{fg=berlinred}
  - \setbeamercolor{enumerate subsubitem}{fg=berlinred}
---

## Slide with Bullets

- Bullet 1
- Bullet 2
- Bullet 3

## Slide with Numbered List

1. hi
2. hello
3. greetings

Current Output

default color for numbered list

Desired Output

Similar to current output, but instead of a blue square surrounding the numbers, use the color defined by \definecolor{berlinered}{rgb}{0.64,0,0} in the YAML section above.

Software Versions

I’m guessing the versions are not the problem, but I’m including them for completeness.

  • Knitr: 1.46
  • R: 4.3.2
  • Pandoc: 3.1.7
  • xcolor: 3.01
  • MikTex: 24.3

>Solution :

You can change the item projected colour:

---
title: "test"
author: "author"
date: "date"
output: 
  beamer_presentation:
    theme: Berlin
    colortheme: beaver
    keep_tex: true
header-includes:
  - \definecolor{berlinred}{rgb}{0.64,0,0}
  - \setbeamercolor{itemize item}{fg=berlinred}
  - \setbeamercolor{itemize subitem}{fg=berlinred}
  - \setbeamercolor{enumerate item}{fg=berlinred}
  - \setbeamercolor{enumerate subitem}{fg=berlinred}
  - \setbeamercolor{enumerate subsubitem}{fg=berlinred}
  - \setbeamercolor{item projected}{bg=berlinred}
---

## Slide with Bullets

- Bullet 1
- Bullet 2
- Bullet 3

## Slide with Numbered List

1. hi
2. hello
3. greetings

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading