user2725109
user2725109

Reputation: 2376

Ruby on Rails code for converting TeX to PNG on the server side

I am creating a Ruby on Rails app very similar to Wikipedia. In Wikipedia you can add math equations to a page using TeX/LaTeX. Then when you preview the page these TeX equations are converted to PNG images on the server side and the images are embedded in the text. Are you aware of a code that I can use to do that in Rails? There is a gem rails-latex but that doesn't do it. As far as I know MathJax doesn't do that either.

Upvotes: 1

Views: 381

Answers (1)

StateOfTheArt89
StateOfTheArt89

Reputation: 138

MediaWiki uses Texvc to create png images from tex. see: http://www.mediawiki.org/wiki/Texvc

Texvc is an external program, so you have to start it via system() and save the result in a special folder. For example like this:

 system('texvc /home/wiki/tmp /home/wiki/math "y=x+2" iso-8859-1 "rgb 1.0 1.0 1.0"')

Upvotes: 2

Related Questions