jgm / pandoc-tex2svg Goto Github PK
View Code? Open in Web Editor NEWPandoc filter to convert math to SVG using MathJax-node's tex2svg
License: BSD 3-Clause "New" or "Revised" License
Pandoc filter to convert math to SVG using MathJax-node's tex2svg
License: BSD 3-Clause "New" or "Revised" License
I am running pandoc 2.1.1 and have installed mathjax-node and the pandoc-tex2svg filter.
I have also installed mathjax-node-cli and have tex2svg available from my Path. It is located here:
/c/Users/~/AppData/Roaming/npm/tex2svg
When running the pandoc command
pandoc math-samples.md --filter pandoc-tex2svg -s -t html5 -o math-samples2.html
I get the following error:
The tex2svg program was not found in the path.
Install MathJax-node (https://github.com/mathjax/MathJax-node)
and ensure that tex2svg is in your path.
Error running filter pandoc-tex2svg:
Filter returned error status 1
Markdown:
\begin{equation}
E = mc^2
\end{equation}
\begin{equation}
E = pc
\end{equation}
Command:
pandoc --mathjax -F pandoc-tex2svg
The resultant HTML is untouched by MathJax-node.
And by the way, the same test can be used to test AMS equation numbering. Because it is rendered by mj-single.js
, I expect it not able to increment the numbering. I'm not sure what's the solution though (besides using mj-page.js
which is supposed to work on HTML5 output. But obviously the one need this most is ePub output. I'm now thinking if it is possible to throw in the whole HTML file before combining it to ePub. However, I don't know the pandoc ePub build process so I don't know if it is possible.) I should have thought about this point before suggesting passing each equation to tex2svg
rather than page2svg
. I thought this is more robust, but now we lost AMS-numbering... Sorry!
I tried running it on a large file (book-size), and there's a lot of error message, a sample is like this:
Error: TypeError: math.replace is not a function
at StartQueue (/usr/local/lib/node_modules/mathjax-node/lib/mj-single.js:668:17)
at Function.execute (file:///usr/local/lib/node_modules/mathjax-node/node_modules/mathjax/unpacked/MathJax.js:243:26)
at cb (file:///usr/local/lib/node_modules/mathjax-node/node_modules/mathjax/unpacked/MathJax.js:225:59)
at Object.Process (file:///usr/local/lib/node_modules/mathjax-node/node_modules/mathjax/unpacked/MathJax.js:495:38)
at Object.call (file:///usr/local/lib/node_modules/mathjax-node/node_modules/mathjax/unpacked/MathJax.js:508:37)
at Function.WAITEXECUTE (file:///usr/local/lib/node_modules/mathjax-node/node_modules/mathjax/unpacked/MathJax.js:348:50)
at cb (file:///usr/local/lib/node_modules/mathjax-node/node_modules/mathjax/unpacked/MathJax.js:225:59)
at Object.Process (file:///usr/local/lib/node_modules/mathjax-node/node_modules/mathjax/unpacked/MathJax.js:495:38)
at Object.call (file:///usr/local/lib/node_modules/mathjax-node/node_modules/mathjax/unpacked/MathJax.js:508:37)
at Function.WAITEXECUTE (file:///usr/local/lib/node_modules/mathjax-node/node_modules/mathjax/unpacked/MathJax.js:348:50)
Probably it is some syntax it is complaining about (I also configure the MathJax manually), but unlike MathJax that will show the wrong syntax in red, MathJax-node will just choke and complain. So it would be helpful by showing some error message. Perhaps if there's an error, print the Math sent into MathJax-node?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.