opencollab / jlatexmath

A Java API to render LaTeX
Other
513 stars 109 forks source link

Retain the variable names of formula in the svg image? #67

Closed balajivignesh258 closed 3 years ago

balajivignesh258 commented 4 years ago

Very nice work! I am using this to print formulas and it works very well.

I need some help. I'm in need of retaining the variable names in the exported svg image.

When using the constructor of SVGGraphics2D there is an option to use font instead of shapes in the resulting svg image. But using font instead of shapes, does not paint the mathematical formula nicely.

SVGGraphics2D g2 = new SVGGraphics2D(ctx, fontAsShapes);

I require the variables names for post processing the svg image to embed hyperlinks. Thanks!

This is the result I get passing fontAsShape as false font This is the result I get passing fontAsShape as true 1598963872683_shape

So in the above formula is it possible to group the entire variable End_fD in a single svg text group?

murkle commented 4 years ago

Maybe you can use SVG groups and add the variable name in a comment. See here for how to do that:

https://github.com/geogebra/geogebra/blob/master/desktop/src/main/java/org/geogebra/desktop/export/SVGExtensions.java

balajivignesh258 commented 4 years ago

Thank you for the quick reply. I have updated the question with some example for reference. Like in the example, is it possible to group the entire variable name as selectable text?

murkle commented 4 years ago

Only if you split the formula into 2 I think