I have this example here that renders MathJax in real-time. I would like to convert the output into pdf so I could read it later. What is the best way to do this? Show I just tweak the source a little and loop each element in Tex?
I have this example here that renders MathJax in real-time. I would like to convert the output into pdf so I could read it later. What is the best way to do this? Show I just tweak the source a little and loop each element in Tex?
Share Improve this question asked Nov 6, 2011 at 18:57 MarkMark 8,68815 gold badges62 silver badges85 bronze badges 4- 1 You should probably just print to PDF from your browser. – Eli Grey Commented Nov 11, 2011 at 4:41
- 1 @EliGrey: But that wouldn't look very nice right? – Mark Commented Nov 11, 2011 at 9:59
- what backend language do you use? – Manuel van Rijn Commented Nov 11, 2011 at 16:02
- @Mark it looks fine to me. Of course the typesetting isn't absolutely perfect, but it's good enough. – Eli Grey Commented Nov 11, 2011 at 20:18
3 Answers
Reset to default 3If you want fine-grained control, you'll probably need to roundtrip the data and let latex and pdflatex or latex and dvipng do the work. http://www.fauskes/nb/htmleqII/
Obviously, this will translate into higher server load, which may or may not be acceptable.
Printing via the browser will be less code, but only Chrome seems to have consistent cross-platform print-to-pdf functionality (Correct me if I'm wrong here). OSX and Linux clients won't have any problem getting the PDF, but on Windows...... You can't expect them to be able to save it in any accurate format, except maybe as a screenshot.
A PDF is best for printing later, but it might be good to offer .png downloads also, since it shouldn't add much extra work (dvipng call), and would cover all bases (PDF readers may not be installed on school puters, PDF isn't supported by most mobile devices, etc..)
I'd suggest offering both options to users, so they can save the data in the format their device supports best.
Would something like wkhtmltopdf work for you? Or do you want the PDF actually rendered client side?
See if this helps http://quaoar.us:8080/mathjax-xsl.html . It needs installation for AsciiDoc and few tweaks in them will give the required output.