Search code examples
javascriptrnomnoml

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

  • 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)
    ```