vscode-drawio icon indicating copy to clipboard operation
vscode-drawio copied to clipboard

Mathematical Typesetting Exporting Issue

Open xz348 opened this issue 5 years ago • 12 comments

When the "Mathematical Typesetting" is enabled, the exported images (both .svg and .png) are not correctly formatted. All the texts are shown in plain text (like "$$f(x)$$") but not the stylized way.

xz348 avatar Nov 12 '20 04:11 xz348

This is the explanation for this:

  1. You create/update a math-formatted text in Draw.io.
  2. Draw.io only renders the plain text for now.
  3. Immediately after that, the Draw.io webview sends the current diagram source to VS Code
  4. VS Code keeps that diagram source in an internal buffer
  5. Some time after that, Draw.io renders the text as math-formula.
  6. If you press save, the internal buffer that still has the plain-text rendering is persisted to disk.

Result: VS Code only persists a diagram where the created/updated text is not rendered yet as plain text.

  1. If you change something unrelated to the math-formatted text in the diagram, the Draw.io webview will send the current diagram source to VS Code again - this time however, with the formatted text.

Result: The text in the persisted diagram is rendered as math formula.

This seems like a bug in Draw.io when used in embed-mode. I hope this workaround helps.

I'm unsure how to fix this. The Draw.io export command should wait until all images are rendered.

hediet avatar Nov 12 '20 11:11 hediet

Hello! I am also experiencing this!
I didn't understand the workaround though? I changed something unrelated to the formulas and the exported file is still broken.
BTW this extension is awesome, thank you :)

hedwigz avatar Dec 28 '20 18:12 hedwigz

The workaround is: Change something unrelated in your diagram (like add a node and then remove it). Then save.

hediet avatar Jul 12 '21 16:07 hediet

@hediet Sorry for my ignorance. What's the meaning of a node? After writing some latex math code, i.e. $$ something$$, I add some elements, e.g. a circle, then save the file, and export to .png or .svg file. I still cannot get the right math output.

dualer avatar Jul 12 '21 17:07 dualer

Then the workaround no longer works 😞

hediet avatar Jul 12 '21 18:07 hediet

Then the workaround no longer works 😞

Oh, it's frustrating. Looking forward to other solutions. (☆▽☆)

dualer avatar Jul 13 '21 01:07 dualer

Any news about this?

silviu-oprea avatar Jan 15 '22 00:01 silviu-oprea

+1

nxphi47 avatar Jan 16 '22 16:01 nxphi47

no news here, maybe I will have some time to look into it when I have to go to quarantine/isolation, which I guess will happen soon here :D

hediet avatar Jan 17 '22 10:01 hediet

@hediet Is there an update on this? I have the same problem right now and I wonder if there is a workaround yet?

vieanderes avatar Aug 09 '22 17:08 vieanderes

Not that I know of. I'll try to investigate as soon as I find some time.

hediet avatar Aug 09 '22 18:08 hediet

So why not consider to release a new version?

happyTonakai avatar Dec 14 '22 07:12 happyTonakai