Rendering LaTeX in mermaid flowchart #10851
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 25 replies
-
I think I figured this out. According to the release notes, quarto has been upgraded to natively work with mermaid 10.2.0, but this version does not seem to support latex in flow diagrams. I have managed to get this working as intended by including the following script:
|
Beta Was this translation helpful? Give feedback.
-
I am using quarto 1.6.33 to create a flowchat with math inside a box using mermaid with the following code in a file called n.qmd: ---
format:
html:
theme: default
pdf:
documentclass: article
keep-tex: true
---
```{mermaid}
graph LR
A("$$x+y+z \leq 5$$")
A -- "$$x=1$$" --> A1
A -- "$$x=2$$" --> A2
A -- "$$x=3$$" --> A3
``` Once I issued the command However, the n.html file generated using mermaid.js shows an empty box for A: <div class="cell" data-layout-align="default">
<div class="cell-output-display">
<div>
<p></p><figure class="figure"><p></p>
<div>
<pre class="mermaid mermaid-js">graph LR
A("$$x+y+z \leq 5$$")
A -- "$$x=1$$" --> A1
A -- "$$x=2$$" --> A2
A -- "$$x=3$$" --> A3
</pre>
</div>
<p></p></figure><p></p>
</div>
</div>
</div> This the screen shot of n.html in Firefox 132.01: How do I make the n.html display the math properly? > quarto check
Quarto 1.6.33
[>] Checking environment information...
Quarto cache location: C:\Users\ynots\AppData\Local\quarto
[>] Checking versions of quarto binary dependencies...
Pandoc version 3.4.0: OK
Dart Sass version 1.70.0: OK
Deno version 1.46.3: OK
Typst version 0.11.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
Version: 1.6.33
Path: C:\Users\ynots\AppData\Local\Programs\Quarto\bin
CodePage: 1252
[>] Checking tools....................OK
TinyTeX: v2024.11
Chromium: (not installed)
[>] Checking LaTeX....................OK
Using: TinyTex
Path: C:\Users\ynots\AppData\Roaming\TinyTeX\bin\windows\
Version: 2024
[>] Checking basic markdown render....OK
[>] Checking Python 3 installation....(None)
Unable to locate an installed version of Python 3.
Install Python 3 from https://www.python.org/downloads/
[>] Checking R installation...........(None)
Unable to locate an installed version of R.
Install R from https://cloud.r-project.org/
|
Beta Was this translation helpful? Give feedback.
Thank you for the tip @cscheid ! It looks like that it's not working in Firefox! I opened a Chrome and it did displayed correctly.