Compose.jl icon indicating copy to clipboard operation
Compose.jl copied to clipboard

LaTeX string rendering in SVG?

Open dietercastel opened this issue 4 years ago • 2 comments

Hi,

I'm using GraphPlot.jl which uses Compose.jl for drawing SVGs. As far as I can see that library uses the text() function to draw those labels. I was now wondering whether it's possible to use LaTeX strings (e.g. some math formula surrounded by dollar signs) just like for PGFs as described here.

I can write some Julia but not familiar with the Compose.jl code-base (yet) so wondering where to start and/or whether it would be easy to implement.

kr, Dieter

dietercastel avatar Nov 16 '19 16:11 dietercastel

Since Gadfly uses Compose too, this has also come up there, see GiovineItalia/Gadfly.jl#1094. In Compose, supporting LaTeX strings could be done either by:

  1. Converting LaTeX strings to Julia unicode e.g. UnicodeFun.jl or LaTeX_Entities.jl (contains LaTeX→unicode maps) , or

  2. Investigating if Compose's other backends can support latex e.g. for SVG, can a latex equation be added as an SVG element? (google that). As you mentioned, the PGF backend natively supports latex.

Mattriks avatar Nov 16 '19 22:11 Mattriks

See #418 for an attempt to implement point 2. using mathjax with the SVG backend.

Mattriks avatar Feb 22 '21 11:02 Mattriks