gjtorikian / mathematical

Convert mathematical equations to SVGs, PNGs, or MathML. A general wrapper to Lasem and mtex2MML.
https://gjtorikian.github.io/mathematical/
MIT License
164 stars 31 forks source link

Generated images seem buggy #79

Closed lschmelzeisen closed 7 years ago

lschmelzeisen commented 7 years ago

Currently, the images generated by mathematical seem buggy.

For instance, the following programm

require 'mathematical'

options = {format: :png, ppi: 300.0}
renderer = Mathematical.new options
result = renderer.render '$\begin{array}{c} {x = \frac{{ - b \pm \sqrt {b^2 - 4ac} }}{{2a}}} & when & {ax^2 + bx + c = 0} \end{array}$'
::IO.write 'test.png', result[:data]

generates the output

test

which clearly has an incorrect square root. The LaTeX expression is from the mathematical homepage, so I guess it should work.

I used ruby version 2.4.2 and mathematical 1.6.11. Changing the format or ppi options does not fix this behaviour.

gjtorikian commented 7 years ago

Do you have the right fonts on your system? https://github.com/gjtorikian/mathematical#fonts-and-special-notices-for-mac-os-x

lschmelzeisen commented 7 years ago

Yes, this fixes it. I assumed having a LaTeX distribution installed was sufficient. Sorry for wasting time.