'how to add greek letters to nomnoml diagram in R
I am using the nomnoml package to create diagrams in combination with rmarkdown. How can I add greek letters to my arrows?
I have naively tried the following
---
title: "Nomnoml Diagram"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(nomnoml)
```
```{nomnoml, svg=TRUE}
[a]-> \alpha [b]
[c]-> \u03be [d]
```
Both do not work.
Solution 1:[1]
It works if you just paste ? into RStudio, like this:
```{nomnoml, svg=TRUE}
[a]->?[b]
```
If you don't find ? on your keyboard you can write "\u03B1" in the console and copy the output.
Full working document:
---
title: "Untitled"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(nomnoml)
```
```{nomnoml, svg=TRUE}
[a]->?[b]
```
Solution 2:[2]
I think if you want to use Unicode escapes in the source, you will have to use an R code chunk instead of a nomnoml code chunk. For example,
---
title: "Untitled"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(nomnoml)
```
```{r echo=FALSE}
nomnoml("[a]->\u03B1[b]", svg = TRUE)
```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jpiversen |
| Solution 2 | user2554330 |
