Pergunta

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.

Foi útil?

Solução

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"')
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top