roniemartinez / Latex2mathml
Licence: mit
Pure Python library for LaTeX to MathML conversion
Stars: ✭ 65
Programming Languages
Labels
Projects that are alternatives of or similar to Latex2mathml
Latex Project Report Template
LaTeX based template for college project reports
Stars: ✭ 58 (-10.77%)
Mutual labels: latex
Paredit Cheatsheet
A new, scalable source document for the Paredit Cheatsheet available as a png on the Emacs wiki
Stars: ✭ 48 (-26.15%)
Mutual labels: latex
Pandoc Plantuml Filter
Pandoc filter for PlantUML code blocks
Stars: ✭ 51 (-21.54%)
Mutual labels: latex
Bachelor Diploma
Дипломная работа бакалавра в LaTeX, оформленная в соответствии с нормоконтролем Севастопольского государственного университета в 2015 году
Stars: ✭ 52 (-20%)
Mutual labels: latex
Bmc
My bespoke, multipurpose class; designed for general use in LaTeX documents.
Stars: ✭ 44 (-32.31%)
Mutual labels: latex
Mathjax
Beautiful and accessible math in all browsers
Stars: ✭ 8,551 (+13055.38%)
Mutual labels: latex
Ltx2any
Yet another LaTeX build wrapper, with one or two nifty features
Stars: ✭ 48 (-26.15%)
Mutual labels: latex
Matlab2tikz
This program converts MATLAB®/Octave figures to TikZ/pgfplots figures for smooth integration into LaTeX.
Stars: ✭ 1,041 (+1501.54%)
Mutual labels: latex
Latexcv
👔 A collection of cv and resume templates written in LaTeX. Leave an issue if your language is not supported!
Stars: ✭ 1,027 (+1480%)
Mutual labels: latex
Docker Texlive
A docker container containing an installation of texlive as well as several useful scripts.
Stars: ✭ 52 (-20%)
Mutual labels: latex
Atom Latex
The only LaTeX package you need for typesetting with Atom.
Stars: ✭ 60 (-7.69%)
Mutual labels: latex
Software Resume Template
A simple LaTeX template for software engineering resumes.
Stars: ✭ 57 (-12.31%)
Mutual labels: latex
latex2mathml
Pure Python library for LaTeX to MathML conversion
License | Version | ||
Travis CI | Coverage | ||
Supported versions | Wheel | ||
Status | Downloads |
Support
If you like latex2mathml
or if it is useful to you, show your support by buying me a coffee.
Installation
pip install latex2mathml
Usage
Python
import latex2mathml.converter
latex_input = "<your_latex_string>"
mathml_output = latex2mathml.converter.convert(latex_input)
Command-line
% latex2mathml -h
usage: l2m [-h] [-V] [-t TEXT | -f FILE]
Pure Python library for LaTeX to MathML conversion
optional arguments:
-h, --help show this help message and exit
-V, --version Show version
required arguments:
-t TEXT, --text TEXT Text
-f FILE, --file FILE File
Examples
Identifiers, Numbers and Operators
LaTeX Input | MathML Output |
---|---|
x |
<math>
<mrow>
<mi>x</mi>
</mrow>
</math>
|
xyz |
<math>
<mrow>
<mi>x</mi>
<mi>y</mi>
<mi>z</mi>
</mrow>
</math>
|
3 |
<math>
<mrow>
<mn>3</mn>
</mrow>
</math>
|
444 |
<math>
<mrow>
<mn>444</mn>
</mrow>
</math>
|
12.34 |
<math>
<mrow>
<mn>12.34</mn>
</mrow>
</math>
|
12x |
<math>
<mrow>
<mn>12</mn>
<mi>x</mi>
</mrow>
</math>
|
3-2 |
<math>
<mrow>
<mn>3</mn>
<mo>−</mo>
<mn>2</mn>
</mrow>
</math>
|
Subscripts and Superscripts
LaTeX Input | MathML Output |
---|---|
a_b |
<math>
<mrow>
<msub>
<mi>a</mi>
<mi>b</mi>
</msub>
</mrow>
</math>
|
a^b |
<math>
<mrow>
<msup>
<mi>a</mi>
<mi>b</mi>
</msup>
</mrow>
</math>
|
a_b^c |
<math>
<mrow>
<msubsup>
<mi>a</mi>
<mi>b</mi>
<mi>c</mi>
</msubsup>
</mrow>
</math>
|
Fractions
LaTeX Input | MathML Output |
---|---|
\frac{1}{2} |
<math>
<mrow>
<mfrac>
<mrow>
<mn>1</mn>
</mrow>
<mrow>
<mn>2</mn>
</mrow>
</mfrac>
</mrow>
</math>
|
Roots
LaTeX Input | MathML Output |
---|---|
\sqrt{2} |
<math>
<mrow>
<msqrt>
<mrow>
<mn>2</mn>
</mrow>
</msqrt>
</mrow>
</math>
|
\sqrt[3]{2} |
<math>
<mrow>
<mroot>
<mrow>
<mn>2</mn>
</mrow>
<mrow>
<mn>3</mn>
</mrow>
</mroot>
</mrow>
</math>
|
Matrices
LaTeX Input | MathML Output |
---|---|
\begin{matrix}a & b \\ c & d \end{matrix} |
<math>
<mrow>
<mtable>
<mtr>
<mtd>
<mi>a</mi>
</mtd>
<mtd>
<mi>b</mi>
</mtd>
</mtr>
<mtr>
<mtd>
<mi>c</mi>
</mtd>
<mtd>
<mi>d</mi>
</mtd>
</mtr>
</mtable>
</mrow>
</math>
|
\begin{matrix*}[r]a & b \\ c & d \end{matrix*} |
<math>
<mrow>
<mtable>
<mtr>
<mtd columnalign='right'>
<mi>a</mi>
</mtd>
<mtd columnalign='right'>
<mi>b</mi>
</mtd>
</mtr>
<mtr>
<mtd columnalign='right'>
<mi>c</mi>
</mtd>
<mtd columnalign='right'>
<mi>d</mi>
</mtd>
</mtr>
</mtable>
</mrow>
</math>
|
A_{m,n} =
\begin{bmatrix}
a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\
a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m,1} & a_{m,2} & \cdots & a_{m,n}
\end{bmatrix}
|
<math>
<mrow>
<msub>
<mi>A</mi>
<mrow>
<mi>m</mi>
<mi>,</mi>
<mi>n</mi>
</mrow>
</msub>
<mo>=</mo>
<mo>[</mo>
<mtable>
<mtr>
<mtd>
<msub>
<mi>a</mi>
<mrow>
<mn>1</mn>
<mi>,</mi>
<mn>1</mn>
</mrow>
</msub>
</mtd>
<mtd>
<msub>
<mi>a</mi>
<mrow>
<mn>1</mn>
<mi>,</mi>
<mn>2</mn>
</mrow>
</msub>
</mtd>
<mtd>
<mo>⋯</mo>
</mtd>
<mtd>
<msub>
<mi>a</mi>
<mrow>
<mn>1</mn>
<mi>,</mi>
<mi>n</mi>
</mrow>
</msub>
</mtd>
</mtr>
<mtr>
<mtd>
<msub>
<mi>a</mi>
<mrow>
<mn>2</mn>
<mi>,</mi>
<mn>1</mn>
</mrow>
</msub>
</mtd>
<mtd>
<msub>
<mi>a</mi>
<mrow>
<mn>2</mn>
<mi>,</mi>
<mn>2</mn>
</mrow>
</msub>
</mtd>
<mtd>
<mo>⋯</mo>
</mtd>
<mtd>
<msub>
<mi>a</mi>
<mrow>
<mn>2</mn>
<mi>,</mi>
<mi>n</mi>
</mrow>
</msub>
</mtd>
</mtr>
<mtr>
<mtd>
<mo>⋮</mo>
</mtd>
<mtd>
<mo>⋮</mo>
</mtd>
<mtd>
<mo>⋱</mo>
</mtd>
<mtd>
<mo>⋮</mo>
</mtd>
</mtr>
<mtr>
<mtd>
<msub>
<mi>a</mi>
<mrow>
<mi>m</mi>
<mi>,</mi>
<mn>1</mn>
</mrow>
</msub>
</mtd>
<mtd>
<msub>
<mi>a</mi>
<mrow>
<mi>m</mi>
<mi>,</mi>
<mn>2</mn>
</mrow>
</msub>
</mtd>
<mtd>
<mo>⋯</mo>
</mtd>
<mtd>
<msub>
<mi>a</mi>
<mrow>
<mi>m</mi>
<mi>,</mi>
<mi>n</mi>
</mrow>
</msub>
</mtd>
</mtr>
</mtable>
<mo>]</mo>
</mrow>
</math>
|
References
LaTeX
- https://en.wikibooks.org/wiki/LaTeX/Mathematics
- http://artofproblemsolving.com/wiki/index.php?title=Main_Page
- http://milde.users.sourceforge.net/LUCR/Math/
- http://www.forkosh.com/mimetextutorial.html
- https://math-linux.com/latex-26/faq/latex-faq/article/latex-derivatives-limits-sums-products-and-integrals
MathML
Author
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].