New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

texsvg

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

texsvg

Converts TeX to SVG.

latest
Source
npmnpm
Version
3.0.3
Version published
Weekly downloads
377
13.55%
Maintainers
1
Weekly downloads
 
Created
Source

texsvg

NPM

NPM version build codecov

Convert TeX to SVG using MathJax and SVGO:

texsvg(string)

Quick Start

CLI:

npx texsvg '\frac{a}{b}' fraction.svg

Script:

const texsvg = require('texsvg');

texsvg('\\frac{a}{b}').then((svg) => console.log(svg));

Installation

Module

NPM:

npm install texsvg

Yarn:

yarn add texsvg

CLI

NPM:

npm install --global texsvg

Yarn:

yarn global add texsvg

NPX:

npx texsvg

Usage

Module

Import with ES Modules:

import texsvg from 'texsvg';

Or require with CommonJS:

const texsvg = require('texsvg');

Convert TeX to SVG using async-await:

const quadraticFormula = 'x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}';

(async () => {
  try {
    const svg = await texsvg(quadraticFormula);
    console.log(svg);
  } catch (err) {
    console.error(err);
  }
})();

Convert TeX to SVG using Promise:

const quadraticFormula = 'x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}';

texsvg(quadraticFormula)
  .then((svg) => console.log(svg))
  .catch((err) => console.error(err));

Convert TeX to SVG without optimization:

texsvg('8', { optimize: false });

CLI

Usage:

texsvg <tex> <file>

Convert TeX to SVG and log result to console:

texsvg '\frac{a}{b}'

Convert TeX to SVG without optimization:

texsvg '\frac{a}{b}' --optimize=false

Convert TeX to SVG and save result to file:

texsvg '\frac{a}{b}' fraction.svg

Testing

Run tests with coverage:

npm test

Run tests in watch mode:

npm run test:watch

Lint files:

npm run lint
npm run lint:tsc

Fix lint errors:

npm run lint:fix

Examples

Release

Release is automated with Release Please.

License

MIT

Keywords

tex

FAQs

Package last updated on 27 Mar 2026

Did you know?

Socket

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.

Install

Related posts