gmarus777 / Printed-Latex-Data-Generation

Python and JS tools to generate Printed LaTex formulas and images
MIT License
13 stars 3 forks source link

how to generate images of given latex for different fonts #2

Open limaopeng1 opened 11 months ago

limaopeng1 commented 11 months ago

I want to generate images of my maths latex, such that each image is rendered with a different font, so that model is more robustness, How can I do this with the current code ?

Thanks

gmarus777 commented 11 months ago

See line 163 in tex_to_svg.py where TeX formulas are rendered in SVG format. The script uses the command svg_generation_script_command = f"tex2svg \'{formula}\' > {name}.svg" command to make system calls to tex2svg module MathJax tex2svg.

MathJax tex2svg employs MathJax for rendering TeX images and seems to rely on a single hardcoded math font (via svg strokes) for rendering, and altering this appears to be unsupported. In theory it is possible to tweak MathJax tex2svg code to obtain different fonts.

Let me know if you have any questions.