1
votes

What is the easiest way to convert a string of Latex (e.g. "Consider the polynomial $x^2$") into a pdf within a Python web app? Ideally, this wouldn't require the creation of intermediate files that I would have to store in a database.

I tried downloading Texcaller (http://vog.github.io/texcaller/) but I could not get it to work. In particular, the key file python/texcaller.py has the line "import _texcaller" which gives the error "No module named _texcaller."

I'm thinking that there must be some way to do it because the Texer resource at AoPS (http://www.artofproblemsolving.com/Resources/texer.php) renders Tex as PDF almost instantaneously.

Thank you very much in advance!

1
Not to be a naysayer, but I wouldn't say that Texer generates PDFs "almost instantaneously." AFAIK, there is no way to get around creating .tex files and rendering with (pdf)latex to get PDFs. You don't necessarily have to store it in a database though - you could create a cache where the PDFs are generated and scratch it when you are done. Mathjax is pretty slick if you can live without a PDF.mrKelley
Yeah, the files could be deleted immediately after running the program.Monkeyanator

1 Answers

1
votes

I've recently written a library for the purpose of generating LaTeX code using python. It supports tables, plots, matrices and more. https://github.com/JelteF/PyLaTeX