CST
CST

Reputation: 207

R Markdown: How to use icons

I would like to inlcude Icons at the beginning of my titles in an R markdown script. I found a CV template of a girl that does so, but this does not work for me:

https://github.com/loreabad6/R-CV/blob/master/CV.Rmd

'library(fontawesome)'

\faIcon{university}

I also tried: In `rmarkdown`, how to add icon in sentence?

`r icons::fontawesome("markdown")`

What do I need to do instead?

Upvotes: 3

Views: 1197

Answers (1)

Quinten
Quinten

Reputation: 41377

HTML

You can use the following code to add icons:

---
title: "Untitled"
author: "Author"
date: "2022-08-15"
output: html_document
---

```{r setup, include=FALSE}
remotes::install_github("mitchelloharawild/icons")
icons::download_fontawesome()
```

# This is my title `r icons::fontawesome("markdown")`

Output:

enter image description here

PDF

You can use the latex package fontawesome5. I had to install the package rsvg (just in console) before running the following code:

---
title: "Untitled"
author: "Author"
date: "2022-08-15"
output: 
  pdf_document:
    keep_tex: true
header-includes:
  - \usepackage{fontawesome5}
---

# This is my title `r icons::fontawesome("markdown")`

Output:

enter image description here

Upvotes: 4

Related Questions