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.
What are the features of Mathlifier2?
The following features are unified in Mathlifier and Mathlifier2.
Mathematical typesetting
-
math('x')
to produce${x}$
andmath('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 theequation*
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.