Add README

This commit is contained in:
Marcel Fabian Krüger 2021-05-03 23:20:48 +02:00
parent 743d8f85c5
commit caf8f7ee1d
2 changed files with 35 additions and 10 deletions

14
README.md Normal file
View File

@ -0,0 +1,14 @@
# Automated LuaLaTeX math to MathML conversion
**Highly experimental! At this point all interfaces may change without prior warning and many features aren't implemented yet. It is not ready for anything beyond simple experiments.**
This is an attempt to implement automatic conversion of LuaLaTeX inline and display math expressions into MathML code to aid with tagging.
It works best with `unicode-math`, but it can also be used with traditional math fonts if mappings to Unicode are provided.
## Installation
Run `l3build install` to install `luamml` into your local `texmf` tree.
## Demo
Run `lualatex test_tex` to see all equations from [our example file](./text_tex.tex) converted into MathML.
To test it on your own files, add `\usepackage{luamml}` and `\tracingmathml=2` to your preamble.
Also see a [`tagpdf` experiment using this to tag PDF formulas](https://github.com/u-fischer/tagpdf/blob/develop/experiments/exp-mathml-lua.tex).

View File

@ -1,22 +1,34 @@
\documentclass{article}
% \usepackage{unicode-math}
\usepackage{amsmath}
\usepackage{luamml}
\RegisterFamilyMapping\symsymbols{oms}
\RegisterFamilyMapping\symletters{oml}
\RegisterFamilyMapping\symlargesymbols{omx}
\usepackage{amsmath,array}
\usepackage{unicode-math}
%% Uncomment the following lines when used without unicode-math
% \RegisterFamilyMapping\symsymbols{oms}
% \RegisterFamilyMapping\symletters{oml}
% \RegisterFamilyMapping\symlargesymbols{omx}
\ExplSyntaxOn
\tracingmathml2
\pdfvariable compresslevel0
\tracingmathml=2
\pdfvariable compresslevel=0
\cs_new_protected:Npn \ShowMathMLObj {
\message { \luamml_get_last_mathml_stream:e{}~0~R }
}
\ExplSyntaxOff
\begin{document}
\[
ax^2+bx+c=0
\begin{pmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{pmatrix}
=
\begin{cases}
1 & $if $a=b\\
2 & $else$
\end{cases}
\]
\ShowMathMLObj
\[
x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}.
\]
@ -29,7 +41,6 @@
1+2&=3\\
5
\end{align}
\ShowMathMLObj
Es gilt $\sin(x)-\sin(x+2\pi)=0$.
\end{document}