New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Including more than a single raw svg doesn't work #19
Comments
Thanks for the detailed report. This is a slightly incorrect use of After looking closely, it seems your issue also occurs in your first example (use It is not straightforward to embed one SVG in another. You need to remove the Can I point you to latextools? It has different dependencies than latex2svg but I've integrated it with drawSvg (using drawSvg's |
Thanks a lot @cduck for the explanation and for providing the solution, I'm really glad to have it worked out but it is also good to know why it was messing up. Just for the sake of future readers of this issue, here is the working source-code based on latextools library. import latextools
import drawSvg as draw # pip3 install drawSvg
# Render latex
latex_eq_1 = latextools.render_snippet(
r'$\sqrt{X}$',
commands=[latextools.cmd.all_math])
svg_eq_1 = latex_eq_1.as_svg()
latex_eq_2 = latextools.render_snippet(
r'$\sqrt{X^\dag}$',
commands=[latextools.cmd.all_math])
svg_eq_2 = latex_eq_2.as_svg()
# Use the rendered latex in a vector drawing
d = draw.Drawing(100, 100, origin='center', displayInline=False)
d.draw(svg_eq_1, x=-10, y=10, center=True, scale=2.5)
d.draw(svg_eq_2, x=10, y=-30, center=True, scale=2.5)
d.setPixelScale(4)
d.saveSvg('latextest.svg')
d.savePng('latextest.png') Output |
Hi all,
I discovered a following problem which can be reproduced as follows.
it is rather hard to say but output seems ok
now let us translate second SVG so that they are not on top of each other
the second SVG gets messed up!
let's see what happens when we still perform the translation but lets do not include first SVG
now the second SVG is perfectly fine even after performing the translation
I noticed the larger the translation the more messed up figure gets but it only occurs if multiple raw SVGs are added and the first one appended to the Drawing is always perfectly fine.
Here are the included SVGs (I purposely changed the extension from to .txt because otherwise GitHub won't let me include them, .svg is not a supported attachment extension).
latex_1.txt
latex_2.txt
Those svg files are generated using https://github.com/tuxu/latex2svg
The text was updated successfully, but these errors were encountered: