It is possible to preview this LaTeX code on just by saving it as HTML and opening it on Firefox. In other words, I want the notepad ++ to "read/render" the code just as other browsers do. What do I need to do to make this possible? I researched, but all I found was some batch function that calls sumatraPDF.
I asume that as firefox is able to render the code, then the "HTML preview" extension would be also able, is that right?
Here is a simple code with some equations:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<title>tex texample</title>
</head>
<body>
<p>$$\frac{1}{a} < \frac{1}{b}$$</p>
<p>$$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$</p>
</body>
</html>
All i get is a equation. I wish i could get that preview on Notepad++ preview HTML extension. Is it possible? Thank you.
Edit: actually I found this guy approach to deal with this, he wrote that using "doxygen" is possible to make it, however I didn't manage to make the Jscript and Cscript part.
http://csholmq.se/blog/notepadpp
I appreciate other kind of solutions, or some other that could give some understanding on what is needed to do there.
Time has moved on and now it would be fairly easy to script previewing the HTML in IExplorer with print to PDF preview.
I would now suggest avoid the browser approach (IE was replaced by Edge) as now simpler to use Chrome-headless-shell. See update below.
We can do similar with MS Edge
start msedge.exe file:///C:/Users/your/Documents/SomeMath.html
And I tried to script print it --headless to PDF but did not succeed
Thus I suggest the best native method in windows is in notepad++ use a script opening the html in IE / Edge or FF, then a second script call the CTRL+P function to print to PDF.
so a vbs script something like this should do
DIM shell
SET shell = WScript.CreateObject("WScript.Shell")
Shell.Run "cmd /c start msedge.exe file:///C:/Users/wherever/Documents/SomeMath.html"
WScript.Sleep(5000)
Shell.SendKeys "^P"
Today we can use Chrome Headless Shell as simpler so the following command will work for updated HTML.
Condensed HTML with current CDN
<!DOCTYPE html> <html> <head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-mml-chtml.min.js"></script>
<title>tex texample</title> </head> <body>
<p>$$\frac{1}{a} < \frac{1}{b}$$</p>
<p>$$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$</p>
</body> </html>
Command
chrome-headless-shell.exe --run-all-compositor-stages-before-draw --virtual-time-budget=10000 --no-pdf-header-footer --print-to-pdf="%cd%\mathjax.pdf" "file://%cd%\mathjax.html"
Result
10544 bytes written to file C:\Users\K\Downloads\mathjax.pdf