2021-06-16 15:21:30 +02:00
|
|
|
\NeedsTeXFormat{LaTeX2e}
|
2024-08-14 20:10:21 +02:00
|
|
|
\ProvidesExplPackage{luamml-demo}{2024-08-14}{v0.1.0}{Reasonable default definitions for luamml}
|
2021-07-04 03:17:18 +02:00
|
|
|
|
|
|
|
\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
|
|
|
|
}
|
2021-06-16 15:21:30 +02:00
|
|
|
|
|
|
|
\RequirePackage{luamml}% Loading luamml is pretty much the point
|
2021-07-04 01:37:17 +02:00
|
|
|
\RequirePackage{amsmath,array}% These are more or less expected in luamml especially for advanced constructs
|
2021-06-16 15:21:30 +02:00
|
|
|
|
|
|
|
\AtBeginDocument{%
|
|
|
|
\@ifpackageloaded{unicode-math}{}{%
|
|
|
|
\RegisterFamilyMapping\symsymbols{oms}%
|
|
|
|
\RegisterFamilyMapping\symletters{oml}%
|
|
|
|
\RegisterFamilyMapping\symlargesymbols{omx}%
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-23 15:48:56 +02:00
|
|
|
\bool_new:N \l__luamml_demo_structelem_bool
|
|
|
|
|
2021-06-16 15:21:30 +02:00
|
|
|
\DeclareOption{tracing}{
|
|
|
|
\tracingmathml=2
|
|
|
|
}
|
|
|
|
\DeclareOption{structelem}{
|
2021-06-23 15:48:56 +02:00
|
|
|
\bool_set_true:N \l__luamml_demo_structelem_bool
|
2021-06-16 15:21:30 +02:00
|
|
|
\luamml_flag_structelem:
|
|
|
|
}
|
|
|
|
\DeclareOption{files}{
|
|
|
|
\int_new:N \g__luamml_demo_mathml_int
|
|
|
|
\luamml_set_filename:n {
|
|
|
|
\immediateassignment \int_gincr:N \g__luamml_demo_mathml_int
|
2021-06-16 17:02:47 +02:00
|
|
|
\jobname -formula- \int_use:N \g__luamml_demo_mathml_int .xml
|
2021-06-16 15:21:30 +02:00
|
|
|
}
|
|
|
|
}
|
2021-10-31 17:18:23 +01:00
|
|
|
\DeclareOption{l3build}{
|
|
|
|
\luamml_set_filename:n {
|
|
|
|
\jobname .mml
|
|
|
|
}
|
|
|
|
\luamml_begin_single_file:
|
|
|
|
}
|
2021-06-16 15:21:30 +02:00
|
|
|
\ProcessOptions\relax
|
|
|
|
|
|
|
|
\cs_new_eq:NN \LuaMMLSetFilename \luamml_set_filename:n
|
|
|
|
|
2021-06-17 13:29:32 +02:00
|
|
|
\cs_generate_variant:Nn \pdffile_filespec:nnn {ene}
|
2021-06-16 15:21:30 +02:00
|
|
|
\int_new:N \g__luamml_demo_af_int
|
|
|
|
\cs_new_protected:Npn \LuaMMLTagAF #1#2 {
|
2021-12-16 18:18:31 +01:00
|
|
|
\tag_mc_end_push:
|
2021-06-16 15:21:30 +02:00
|
|
|
\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}
|
2021-12-16 18:18:31 +01:00
|
|
|
\exp_args:Ne \tag_struct_begin:n{tag=Formula,AF=__luamml_demo_\int_use:N \g__luamml_demo_af_int,#1}
|
2021-06-23 15:48:56 +02:00
|
|
|
\bool_if:NF \l__luamml_demo_structelem_bool {
|
2021-12-16 18:18:31 +01:00
|
|
|
\tag_mc_begin:n{tag=Formula}
|
2021-06-23 15:48:56 +02:00
|
|
|
}
|
2021-06-16 15:21:30 +02:00
|
|
|
#2
|
|
|
|
\group_begin:
|
|
|
|
\pdfdict_put:nnn {l_pdffile/Filespec} {AFRelationship}{/Supplement}
|
2021-06-17 13:29:32 +02:00
|
|
|
\pdffile_filespec:ene
|
2021-06-16 15:21:30 +02:00
|
|
|
{ __luamml_demo_ \int_use:N \g__luamml_demo_af_int }
|
2021-06-16 17:02:47 +02:00
|
|
|
{ test.xml }
|
2021-06-16 15:21:30 +02:00
|
|
|
{ \luamml_get_last_mathml_stream:e{}\c_space_tl 0~R}
|
|
|
|
\group_end:
|
2021-06-23 15:48:56 +02:00
|
|
|
\bool_if:NF \l__luamml_demo_structelem_bool {
|
2021-12-16 18:18:31 +01:00
|
|
|
\tag_mc_end:
|
2021-06-23 15:48:56 +02:00
|
|
|
}
|
2021-12-16 18:18:31 +01:00
|
|
|
\tag_struct_end:
|
|
|
|
\tag_mc_begin_pop:n{}
|
2021-06-16 15:21:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
\NewDocumentCommand\AnnotateFormula{ o m m }{%
|
|
|
|
\IfValueTF{#1}{%
|
|
|
|
\luamml_annotate:nen{#1}%
|
|
|
|
}{
|
|
|
|
\luamml_annotate:en
|
|
|
|
}{#2}{#3}
|
|
|
|
}
|
|
|
|
|
2021-07-04 03:17:18 +02:00
|
|
|
\cs_set_eq:NN \WriteoutFormula \luamml_pdf_write:
|