From 54ce65a04d6693822bbfdb0e88c46139a79aea81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Sun, 4 Jul 2021 03:17:18 +0200 Subject: [PATCH] Add luamml-pdf-demo --- luamml-demo.sty | 16 +++++++++------ luamml-pdf-demo.sty | 50 +++++++++++++++++++++++++++++++++++++++++++++ test_pdf.tex | 22 ++------------------ 3 files changed, 62 insertions(+), 26 deletions(-) create mode 100644 luamml-pdf-demo.sty diff --git a/luamml-demo.sty b/luamml-demo.sty index 77215ac..c68620c 100644 --- a/luamml-demo.sty +++ b/luamml-demo.sty @@ -1,5 +1,13 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{luamml-demo}[2021-06-16 Reasonable default definitions for luamml] +\ProvidesExplPackage{luamml-demo}{2021-06-16}{v0.0.1}{Reasonable default definitions for luamml} + +\sys_if_engine_luatex:F { + \msg_new:nnn {luamml-demo} {pdftex-option-ignored} {Option~`#1'~is~being~ignored~in~pdfTeX~mode.} + \DeclareOption*{\msg_warning:nnx {luamml-demo} {pdftex-option-ignored} {\CurrentOption}} + \ProcessOptions\relax + \RequirePackage{luamml-pdf-demo} + \endinput +} \RequirePackage{luamml}% Loading luamml is pretty much the point \RequirePackage{amsmath,array}% These are more or less expected in luamml especially for advanced constructs @@ -12,8 +20,6 @@ } } -\ExplSyntaxOn - \bool_new:N \l__luamml_demo_structelem_bool \DeclareOption{tracing}{ @@ -65,6 +71,4 @@ }{#2}{#3} } -\ExplSyntaxOff - -\endinput +\cs_set_eq:NN \WriteoutFormula \luamml_pdf_write: diff --git a/luamml-pdf-demo.sty b/luamml-pdf-demo.sty new file mode 100644 index 0000000..0cd981d --- /dev/null +++ b/luamml-pdf-demo.sty @@ -0,0 +1,50 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesExplPackage{luamml-pdf-demo}{2021-06-16}{v0.0.1}{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: diff --git a/test_pdf.tex b/test_pdf.tex index be80b1c..c125b4e 100644 --- a/test_pdf.tex +++ b/test_pdf.tex @@ -1,24 +1,6 @@ \documentclass{article} -\usepackage{luamml-pdf} - -\RegisterFamilyMapping\symsymbols{oms} -\RegisterFamilyMapping\symletters{oml} -\RegisterFamilyMapping\symlargesymbols{omx} - -\ExplSyntaxOn -\cs_set_eq:NN \WriteoutFormula \luamml_pdf_write: -\NewDocumentCommand\AnnotateFormula{ o m m }{% - \IfValueTF{#1}{% - \luamml_annotate:nen{#1}% - }{ - \luamml_annotate:en - }{#2}{#3} -} -\ExplSyntaxOff - -\protected\edef\models{\AnnotateFormula{% - nucleus = true, core = {[0] = 'mi', '\noexpand\string\noexpand\u{22a7}'}, - }{\unexpanded\expandafter{\models}}} +\usepackage{amsmath} +\usepackage[files]{luamml-demo} \begin{document} \[