2

Having monkeyed around with the recommended solutions of Add inline image in Rmarkdown as applied to the problem of wanting to display an inline R logo, (for example https://images.app.goo.gl/4C57fs4D6AtS3D9D6) I found that while the recommended solutions didn't work for me for some reason, I could get an approximate solution to my problem using the command ![](R_logo.png){#id .class width=auto height=16px}.

Being an avid user of LaTeX, though rather newly introduced to R Markdown I thought it prudent to try to define the inclusion of the image as a command in a LaTeX-like fashion as recommended by R Markdown similar feature to "newcommand" in LaTex?, as I might be using it from time to time.

R Markdown seemed rather ambivalent to this approach however, having defined the command with \newcommand{\Rlogo}{![](R_logo.png){#id .class width=auto height=16px}}.

Do you have any recommendations as to what I'm doing wrong, and how/If I might define such a command within R markdown?

1 Answers1

1

The icon package works really well to insert icons.

Here is an example, extracted from the package's page:

---
title: "Untitled"
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(icon)
```

# Icon package

The `ìcon` package works really well:

`r icon::fontawesome("r-project", style = "brands")`

For a bigger icon:

```{r icon-style}
icon_style(fontawesome("r-project", style = "brands"), scale = 4)
```

-output

enter image description here

bttomio
  • 2,206
  • 1
  • 6
  • 17