Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate HTML from MathJax code in a batch script

Tags:

mathjax

I know how to use MathJax to convert TeX commands in a web page to mathematical formulae. The MathJax scripts would search the page for TeX commands and convert them inline to HTML statements.

Is there a way to do this as a form of pre-processing? In other words, I have some text or HTML files on my harddisk that contain raw TeX commands. I'd like to use MathJax to convert them to HTML, so that they can be viewed without having the MathJax scripts.

The reason I need this is that these pages are very long and contain many, many TeX statements. MathJax is fast, but it's not fast enough for such huge pages, so I need to preprocess them.

Thanks for any hints.

like image 981
Bass Avatar asked May 29 '26 16:05

Bass


1 Answers

MathJax-node provides APIs for using MathJax in nodejs, thus enabling this kind of preprocess. There are examples in the repository for handling HTML fragments.

The SVG output can be used this way but the HTML-CSS output cannot because it is very client dependent.

However, the new CommomHTML output -- which has been completed in MathJax v2.6, currently in beta -- will be usable this way. It will be integrated into mathjax-node once v2.6 is out of beta.

like image 129
Peter Krautzberger Avatar answered Jun 02 '26 21:06

Peter Krautzberger