
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
mathematical
Advanced tools
Quickly convert math equations into beautiful SVGs (or PNGs/MathML). A port of the Ruby Mathematical for Node.js.

npm install mathematical
The simplest way to do this is
Mathematical = require 'mathematical'
new Mathematical.render(string_with_math)
string_with_math should just be a string of math TeX inline ($..$) or display ($$..$$) style math.
The output will be a hash, with keys that depend on the format you want:
width: the width of the resulting imageheight: the height of the resulting imagesvg: the actual string of SVGwidth: the width of the resulting imageheight: the height of the resulting imagepng: the PNG datamathml: the MathML datanew Mathematical takes an optional object to define a few options:
ppi - A double determining the pixels per inch of the resulting SVG (default: 72.0).zoom - A double determining the zoom level of the resulting SVG (default: 1.0).base64 - A boolean determining whether Mathematical's output should be a base64-encoded SVG string (default: false).maxsize - A numeral indicating the MAXSIZE the output string can be. (default: unsigned long).format - A string indicating whether you want an "svg", "png", or "mathml" output. (default: svg).Pass these in like this:
opts = { ppi: 200.0, zoom: 5.0, base64: true }
renderer = new Mathematical(opts)
renderer.render('$a \ne b$')
Before building this gem, you must install the following programs and libraries:
You will also need fonts for cmr10, cmmi10, cmex10, and cmsy10.
To install these dependencies on a Mac, everything can be installed via Homebrew:
brew install glib gdk-pixbuf cairo pango libffi
Install the fonts with:
cd ~/Library/Fonts
curl -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmex10.ttf \
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmmi10.ttf \
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmr10.ttf \
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmsy10.ttf \
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/esint10.ttf \
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/eufm10.ttf \
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/msam10.ttf \
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/msbm10.ttf \
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmmi10.ttf
xml2 should already be on your machine.
To install these dependencies on a *nix machine, fetch the packages through your package manager. For example:
sudo apt-get -qq -y install libglib2.0-dev libxml2-dev libcairo2-dev libpango1.0-dev libffi ttf-lyx libgdk-pixbuf2.0-dev
On a Windows machine, I have no idea. Pull requests welcome!
After cloning the repo:
script/bootstrap
grunt test
If there were no errors, you're done! Otherwise, make sure to follow the dependency instructions.
FAQs
Quickly convert math equations into beautiful SVGs/PNGs/MathML.
We found that mathematical demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.