Use Attribute NameSpace and add missing test files

This commit is contained in:
Marcel Fabian Krüger 2021-10-31 23:12:42 +01:00
parent d1ef3292ee
commit c6a180cd1a
5 changed files with 2100 additions and 4 deletions

View File

@ -25,10 +25,10 @@ local attributes = setmetatable({}, {__index = function(t, k)
local attr_name = string.format('luamml_attr_%i', attribute_counter)
t[k] = attr_name
tex.runtoks(function()
-- tex.sprint(string.format('\\tagpdfsetup{newattribute={%s}{/O/NSO/NS %i 0 R',
-- attr_name, mathml_ns_obj or get_mathml_ns_obj()))
tex.sprint(string.format('\\tagpdfsetup{newattribute={%s}{/O/MathML-3',
attr_name))
tex.sprint(string.format('\\tagpdfsetup{newattribute={%s}{/O/NSO/NS %i 0 R',
attr_name, mathml_ns_obj or get_mathml_ns_obj()))
-- tex.sprint(string.format('\\tagpdfsetup{newattribute={%s}{/O/MathML-3',
-- attr_name))
tex.cprint(12, k)
tex.sprint'}}'
end)

View File

@ -0,0 +1,56 @@
\ExplSyntaxOn
\sys_gset_rand_seed:n{1000}
\ExplSyntaxOff
\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{
uncompress,
pdfversion = 2.0,
}
\documentclass{article}
\usepackage{tagpdf}
\usepackage[structelem]{luamml-demo}
\tagpdfsetup{
activate-all,
interwordspace=true,
}
\usepackage{unicode-math}
\begin{document}
\tagstructbegin{tag=Document}
\LuaMMLTagAF{} {
\[
\begin{pmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{pmatrix}
=
\begin{cases}
1 & $if $a=b\\
2 & $else$
\end{cases}
\]
}
\LuaMMLTagAF{} {
\[
x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}.
\]
}
\LuaMMLTagAF{} {
\[
\sum_a\underline c\dot bc'
\]
}
\LuaMMLTagAF{} {
\begin{align}
abc&=def & e^{\mathrm{i}\pi}&=-1\\
\Big(1+2&=3\Big)\\
5
\end{align}
}
Es gilt \LuaMMLTagAF{}{$\sin(x)-\sin(x+2\pi)=0$}.
\tagstructend
\end{document}

File diff suppressed because it is too large Load Diff

229
testfiles-lua/test_xml.mlr Normal file
View File

@ -0,0 +1,229 @@
<math xmlns:tex="http://typesetting.eu/2021/LuaMathML" xmlns="http://www.w3.org/1998/Math/MathML">
<mspace width="9.963pt" />
<mi intent="@ignore" />
</math>
<math xmlns:tex="http://typesetting.eu/2021/LuaMathML" xmlns="http://www.w3.org/1998/Math/MathML">
<mspace width="9.963pt" />
<mi intent="@ignore" />
</math>
<math display="block" xmlns:tex="http://typesetting.eu/2021/LuaMathML" xmlns="http://www.w3.org/1998/Math/MathML">
<mrow tex:class="inner">
<mo fence="true" lspace="0" rspace="0" symmetric="true">(</mo>
<mspace width="-4.981pt" />
<mpadded lspace="+4.981pt" width="+9.963pt">
<mtable>
<mtr>
<mtd>
<mn>1</mn>
</mtd>
<mtd>
<mn>0</mn>
</mtd>
<mtd>
<mn>0</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>0</mn>
</mtd>
<mtd>
<mn>1</mn>
</mtd>
<mtd>
<mn>0</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>0</mn>
</mtd>
<mtd>
<mn>0</mn>
</mtd>
<mtd>
<mn>1</mn>
</mtd>
</mtr>
</mtable>
</mpadded>
<mspace width="-4.981pt" />
<mo fence="true" lspace="0" rspace="0" symmetric="true">)</mo>
</mrow>
<mo lspace="0.278em" rspace="0.278em" tex:class="rel">=</mo>
<mrow tex:class="inner">
<mo fence="true" lspace="0" rspace="0" symmetric="true">{</mo>
<mpadded lspace="+4.981pt" width="+9.963pt">
<mtable>
<mtr>
<mtd columnalign="left">
<mn>1</mn>
</mtd>
<mtd columnalign="left">
<mtext>if&#160;
<mtd>
<mi>𝑎</mi>
<mo lspace="0.278em" rspace="0.278em" tex:class="rel">=</mo>
<mi>𝑏</mi>
</mtd></mtext>
</mtd>
</mtr>
<mtr>
<mtd columnalign="left">
<mn>2</mn>
</mtd>
<mtd columnalign="left">
<mtext>else</mtext>
</mtd>
</mtr>
</mtable>
</mpadded>
<mspace width="1.196pt" />
</mrow>
</math>
<math display="block" xmlns:tex="http://typesetting.eu/2021/LuaMathML" xmlns="http://www.w3.org/1998/Math/MathML">
<mi>𝑥</mi>
<mo lspace="0.278em" rspace="0.278em" tex:class="rel">=</mo>
<mfrac>
<mrow>
<mo lspace="0" rspace="0.222em" tex:class="bin"></mo>
<mi>𝑏</mi>
<mo lspace="0.222em" rspace="0.222em" tex:class="bin">±</mo>
<msqrt>
<mrow>
<msup>
<mi>𝑏</mi>
<mn>2</mn>
</msup>
<mo lspace="0.222em" rspace="0.222em" tex:class="bin"></mo>
<mn>4</mn>
<mi>𝑎</mi>
<mi>𝑐</mi>
</mrow>
</msqrt>
</mrow>
<mrow>
<mn>2</mn>
<mi>𝑎</mi>
</mrow>
</mfrac>
<mo lspace="0" rspace="0" tex:class="ord">.</mo>
</math>
<math display="block" xmlns:tex="http://typesetting.eu/2021/LuaMathML" xmlns="http://www.w3.org/1998/Math/MathML">
<munder>
<mo lspace="0" movablelimits="true" rspace="0.167em" tex:class="opdisplaylimits">∑</mo>
<mi>𝑎</mi>
</munder>
<munder>
<mi>𝑐</mi>
<mo>_</mo>
</munder>
<mover>
<mi>𝑏</mi>
<mo stretchy="true">.</mo>
</mover>
<msup>
<mi>𝑐</mi>
<mi mathvariant="normal"></mi>
</msup>
</math>
<math display="block" xmlns:tex="http://typesetting.eu/2021/LuaMathML" xmlns="http://www.w3.org/1998/Math/MathML">
<mtable columnalign="right left right left" columnspacing="0 .8em 0" displaystyle="true">
<mlabeledtr>
<mtd>
<mtext>(1)</mtext>
</mtd>
<mtd>
<mi>𝑎</mi>
<mi>𝑏</mi>
<mi>𝑐</mi>
</mtd>
<mtd>
<mi intent="@ignore" />
<mo lspace="0.278em" rspace="0.278em" tex:class="rel">=</mo>
<mi>𝑑</mi>
<mi>𝑒</mi>
<mi>𝑓</mi>
</mtd>
<mtd>
<msup>
<mi>𝑒</mi>
<mrow>
<mi mathvariant="normal" tex:family="4">i</mi>
<mi>𝜋</mi>
</mrow>
</msup>
</mtd>
<mtd>
<mi intent="@ignore" />
<mo lspace="0.278em" rspace="0" tex:class="rel">=</mo>
<mo lspace="0.278em" rspace="0" tex:class="ord"></mo>
<mn>1</mn>
</mtd>
</mlabeledtr>
<mlabeledtr>
<mtd>
<mtext>(2)</mtext>
</mtd>
<mtd>
<mo fence="true" lspace="0" maxsize="17.861pt" minsize="17.861pt" rspace="0" symmetric="true">(</mo>
<mn>1</mn>
<mo lspace="0.222em" rspace="0.222em" tex:class="bin">+</mo>
<mn>2</mn>
</mtd>
<mtd>
<mi intent="@ignore" />
<mo lspace="0.278em" rspace="0.278em" tex:class="rel">=</mo>
<mn>3</mn>
<mo fence="true" lspace="0" maxsize="17.861pt" minsize="17.861pt" rspace="0" symmetric="true">)</mo>
</mtd>
<mtd>
<mi intent="@ignore" />
</mtd>
<mtd>
<mi intent="@ignore" />
</mtd>
</mlabeledtr>
<mlabeledtr>
<mtd>
<mtext>(3)</mtext>
</mtd>
<mtd>
<mn>5</mn>
</mtd>
<mtd>
<mi intent="@ignore" />
</mtd>
<mtd>
<mi intent="@ignore" />
</mtd>
<mtd>
<mi intent="@ignore" />
</mtd>
</mlabeledtr>
</mtable>
</math>
<math xmlns:tex="http://typesetting.eu/2021/LuaMathML" xmlns="http://www.w3.org/1998/Math/MathML">
<mrow tex:class="opnolimits">
<mi mathvariant="normal" tex:family="4">s</mi>
<mi mathvariant="normal" tex:family="4">i</mi>
<mi mathvariant="normal" tex:family="4">n</mi>
</mrow>
<mo lspace="0" rspace="0" stretchy="false" tex:class="open">(</mo>
<mi>𝑥</mi>
<mo lspace="0" rspace="0" stretchy="false" tex:class="close">)</mo>
<mo lspace="0.222em" rspace="0.222em" tex:class="bin"></mo>
<mrow tex:class="opnolimits">
<mi mathvariant="normal" tex:family="4">s</mi>
<mi mathvariant="normal" tex:family="4">i</mi>
<mi mathvariant="normal" tex:family="4">n</mi>
</mrow>
<mo lspace="0" rspace="0" stretchy="false" tex:class="open">(</mo>
<mi>𝑥</mi>
<mo lspace="0.222em" rspace="0.222em" tex:class="bin">+</mo>
<mn>2</mn>
<mi>𝜋</mi>
<mo lspace="0" rspace="0" stretchy="false" tex:class="close">)</mo>
<mo lspace="0.278em" rspace="0.278em" tex:class="rel">=</mo>
<mn>0</mn>
</math>

View File

@ -0,0 +1,53 @@
\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{
uncompress,
pdfversion = 2.0,
}
\documentclass{article}
\usepackage[l3build]{luamml-demo}
\usepackage{tagpdf}
\tagpdfsetup{
activate-all,
interwordspace=true,
}
\usepackage{unicode-math}
\begin{document}
\tagstructbegin{tag=Document}
\LuaMMLTagAF{} {
\[
\begin{pmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{pmatrix}
=
\begin{cases}
1 & $if $a=b\\
2 & $else$
\end{cases}
\]
}
\LuaMMLTagAF{} {
\[
x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}.
\]
}
\LuaMMLTagAF{} {
\[
\sum_a\underline c\dot bc'
\]
}
\LuaMMLTagAF{} {
\begin{align}
abc&=def & e^{\mathrm{i}\pi}&=-1\\
\Big(1+2&=3\Big)\\
5
\end{align}
}
Es gilt \LuaMMLTagAF{}{$\sin(x)-\sin(x+2\pi)=0$}.
\tagstructend
\end{document}