Olivier Grimard
Olivier Grimard

Reputation: 77

Creating a diagram with LaTeX equations in R (Quarto)

I am completing an assignment in Quarto and need to create a diagram that looks like this.

(created with Mathcha)

enter image description here

As you can see there are some formatting done to the text. Subscript. But I might have to add another type of formatting as well. Overall, I would like to use what I normally use to write those: $N_t$.

I do not understand how I can do this. I have tried Graphviz, Mermaid, and Tikz. And only managed to make it work for Tikz but I do not find it very intuitive. The others give me errors or simply puts all of the symbols into the diagram.

From what I could understand, it seems impossible in Mermaid. I can do it with Tikz but it is very complex typing it from my head (so I use Mathcha). And I can't seem to pull it off in Graphviz.

Is there any way to do this? I would rather do it all in Quarto. But I know that I could just create a picture and put that in.

Thank you

Upvotes: 0

Views: 264

Answers (1)

sroush
sroush

Reputation: 6791

Can't speak for the other systems, but in Graphviz you can subscript using "html-like label text" (see https://www.graphviz.org/doc/info/shapes.html#html)

digraph sub {

  A [label = <N<sub>t</sub>> ]
  B [label = <N<sub>3,t</sub>> ]

  A->B
}

Giving:
enter image description here

Upvotes: 1

Related Questions