Reputation: 69
Unfortunately, I fail to knit an *.Rmd file in RStudio to PDF that includes fontawesome
-icons. However, when knitting to output: html_document
in renders perfectly.
Info:
The following example contains elements taken from RStudio's Github:
Icon renders in HTML:
---
title: "FontAwesome in R Markdown"
output: html_document
---
```{r load_packages, message=FALSE, warning=FALSE, include=FALSE}
library(fontawesome)
```
This is an R icon: `r fa("r-project", fill = "steelblue")`.
Icon is ignored for PDF output:
---
title: "FontAwesome in R Markdown"
output: pdf_document
---
```{r load_packages, message=FALSE, warning=FALSE, include=FALSE}
library(fontawesome)
```
This is an R icon: `r fa("r-project", fill = "steelblue")`.
Neither R nor Rmarkdown shows any errors when rendering to PDF. Does anyone have an idea why it does not work?
Thank you very much.
Cheers, Christian
Upvotes: 1
Views: 1039
Reputation: 38873
You can workaround the problem by using the fontawesome5
latex package:
---
title: "FontAwesome in R Markdown"
output:
pdf_document:
keep_tex: true
header-includes:
- \usepackage{fontawesome5}
---
This is an R icon: \faRProject
Upvotes: 4