mathlifier2
TypeScript icon, indicating that this package has built-in type declarations

1.3.5 • Public • Published

Mathlifier2

Mathlifier2, together with Mathlifier, provides a set of utilities to typeset Mathematics. Mathlifier converts code into HTML-ready KaTeX markup while Mathlifier2 converts code into LaTeX-ready markup ready to be inserted into a .tex document and compiled.

mathlifier2 npm version mathlifier2 minzip size


What are the features of Mathlifier2?

The following features are unified in Mathlifier and Mathlifier2.

Mathematical typesetting

  • math('x') to produce ${x}$ and math('x', {wrap: true}) to produce $x$
  • display('x') to produce $$x$$

Mathematical environments

  • equation('x=3') to produce \begin{equation} x=3 \end{equation}
  • equationStar('') for the equation* environment
  • align()
  • alignStar()
  • alignat('x&=2& \quad 'y&=3', 2)
  • alignatStar()
  • gather()
  • gatherStar()

General typesetting

  • linebreak
  • newline
  • bold(), strong()
  • emph(), em(),
  • newParagraph

Installing Mathlifier2

npm i mathlifier2

Using Mathlifier2

// import functions
import { math, display } from 'mathlifier2';
// example of using these functions
const inlineMath = math('ax^2+bx+c=0');
const displayedMath = display('x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}');

Subsequently, attach the string(s) to a TeX document.

Upcoming Mathlified framework

We are working on a SvelteKit + TeX framework (in the form of a Vite plugin) that uses Mathlifier and Mathlifier2 to generate a SvelteKit website/webapp along with TeX and pdf files all from the same codebase. Stay tuned.

Credits

KaTeX

License

MIT

Package Sidebar

Install

npm i mathlifier2

Weekly Downloads

1

Version

1.3.5

License

MIT

Unpacked Size

28 kB

Total Files

8

Last publish

Collaborators

  • kelvinsjk