summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/luamml/luamml-pdf-demo.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/latex/luamml/luamml-pdf-demo.sty')
-rw-r--r--macros/luatex/latex/luamml/luamml-pdf-demo.sty50
1 files changed, 50 insertions, 0 deletions
diff --git a/macros/luatex/latex/luamml/luamml-pdf-demo.sty b/macros/luatex/latex/luamml/luamml-pdf-demo.sty
new file mode 100644
index 0000000000..fe63814d05
--- /dev/null
+++ b/macros/luatex/latex/luamml/luamml-pdf-demo.sty
@@ -0,0 +1,50 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesExplPackage{luamml-pdf-demo}{2024-08-14}{v0.1.0}{Reasonable default definitions for luamml-pdf}
+
+\RequirePackage{luamml-pdf}% Loading luamml-pdf is pretty much the point
+% \RequirePackage{amsmath,array}% May come back if the patches get ported
+
+% Delay family mappings to allow for replacements
+\AddToHook{begindocument/before}{%
+ \@ifpackageloaded{unicode-math}{}{%
+ \RegisterFamilyMapping\symsymbols{oms}%
+ \RegisterFamilyMapping\symletters{oml}%
+ \RegisterFamilyMapping\symlargesymbols{omx}%
+ }
+}
+
+\cs_new_protected:Npn \LuaMMLSetFilename #1 {}
+
+% TODO.
+% \cs_generate_variant:Nn \pdffile_filespec:nnn {ene}
+% \int_new:N \g__luamml_demo_af_int
+% \cs_new_protected:Npn \LuaMMLTagAF #1#2 {
+% \int_gincr:N \g__luamml_demo_af_int
+% \exp_args:Ne \pdf_object_new:nn{__luamml_demo_\int_use:N \g__luamml_demo_af_int}{dict}
+% \exp_args:Ne \tagstructbegin{tag=Formula,AF=__luamml_demo_\int_use:N \g__luamml_demo_af_int,#1}
+% \bool_if:NF \l__luamml_demo_structelem_bool {
+% \tagmcbegin{tag=Formula}
+% }
+% #2
+% \group_begin:
+% \pdfdict_put:nnn {l_pdffile/Filespec} {AFRelationship}{/Supplement}
+% \pdffile_filespec:ene
+% { __luamml_demo_ \int_use:N \g__luamml_demo_af_int }
+% { test.xml }
+% { \luamml_get_last_mathml_stream:e{}\c_space_tl 0~R}
+% \group_end:
+% \bool_if:NF \l__luamml_demo_structelem_bool {
+% \tagmcend
+% }
+% \tagstructend
+% }
+
+\NewDocumentCommand\AnnotateFormula{ o m m }{%
+ \IfValueTF{#1}{%
+ \luamml_annotate:nen{#1}%
+ }{
+ \luamml_annotate:en
+ }{#2}{#3}
+}
+
+\cs_set_eq:NN \WriteoutFormula \luamml_pdf_write: