summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/luamml/luamml.sty
blob: 2753343211497c09e203e5ba8e17ad5679a5103c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
%%
%% This is file `luamml.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% luamml.dtx  (with options: `package,luatex')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from luamml.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file luamml.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% Copyright (C) 2020-2024 by Marcel Krueger
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. The latest version of this license is in:
%%
%% http://www.latex-project.org/lppl.txt
%%
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
\ProvidesExplPackage {luamml} {2024-08-14} {0.1.0}
  {Automatically generate presentational MathML from LuaTeX math expressions}
\int_new:N \l__luamml_flag_int
\int_new:N \l__luamml_pretty_int
\tl_new:N \l__luamml_filename_tl
\tl_new:N \l__luamml_root_tl
\tl_set:Nn \l__luamml_root_tl { mrow }
\tl_new:N \l__luamml_label_tl
\int_new:N \tracingmathml

\int_set:Nn \l__luamml_pretty_int { 1 }
\lua_now:n { require'luamml-tex' }
\hook_new_with_args:nn { luamml / converted } { 1 }

\cs_new_protected:Npn \__luamml_output_hook:n {
  \hook_use:nnw { luamml / converted } { 1 }
}
\__luamml_register_output_hook:N \__luamml_output_hook:n

\cs_new_protected:Npn \luamml_flag_process: {
  \tl_set:Nn \l__luamml_label_tl {}
  \int_set:Nn \l__luamml_flag_int { 3 }
}
\cs_new:Npn \__luamml_maybe_structelem: {
  (
    8 * \int_mod:nn {
      \int_div_truncate:nn { \l__luamml_flag_int } {8}
    } {2}
  ) +
}
\cs_new:Npn \__luamml_style_to_num:N #1 {
  32 * #1
}
\cs_new_protected:Npn \luamml_flag_save:n #1 {
  \tl_set:Nn \l__luamml_label_tl {#1}
  \int_set:Nn \l__luamml_flag_int { \__luamml_maybe_structelem: 1 }
}
\cs_new_protected:Npn \luamml_flag_save:nN #1#2 {
  \tl_set:Nn \l__luamml_label_tl {#1}
  \int_set:Nn \l__luamml_flag_int { \__luamml_maybe_structelem: 17 + \__luamml_style_to_num:N #2 }
}
\cs_new_protected:Npn \luamml_flag_save:nn #1 {
  \tl_set:Nn \l__luamml_label_tl {#1}
  \int_set:Nn \l__luamml_flag_int { \__luamml_maybe_structelem: 5 }
  \tl_set:Nn \l__luamml_root_tl
}
\cs_new_protected:Npn \luamml_flag_save:nNn #1#2 {
  \tl_set:Nn \l__luamml_label_tl {#1}
  \int_set:Nn \l__luamml_flag_int { \__luamml_maybe_structelem: 21 + \__luamml_style_to_num:N #2 }
  \tl_set:Nn \l__luamml_root_tl
}
\cs_new_protected:Npn \luamml_flag_ignore: {
  \int_set:Nn \l__luamml_flag_int { 0 }
}
\cs_new_protected:Npn \luamml_flag_structelem: {
  \tl_set:Nn \l__luamml_label_tl {}
  \int_set:Nn \l__luamml_flag_int { 11 }
}
\cs_new_protected:Npn \luamml_set_filename:n {
  \tl_set:Nn \l__luamml_filename_tl
}
\luamml_flag_process:
\cs_new_protected:Npn \luamml_annotate:nen #1#2#3 {
  \__luamml_annotate_begin:
    #3
  \__luamml_annotate_end:we \tex_numexpr:D #1 \scan_stop: {#2}
}

\cs_new_protected:Npn \luamml_annotate:en #1#2 {
  \__luamml_annotate_begin:
    #2
  \__luamml_annotate_end:e {#1}
}

\cs_new_eq:NN \luamml_pdf_write: \scan_stop:
\cs_new_protected:Npn \__luamml_patch_package:nn #1 #2 {
  \@ifpackageloaded {#1} {#2} {
    \hook_gput_code:nnn {package/#1/after} {luamml} {#2}
  }
}
\cs_new_protected:Npn \__luamml_patch_package:n #1 {
  \__luamml_patch_package:nn {#1} {
    \RequirePackage { luamml-patches-#1 }
  }
}
\RequirePackage { luamml-patches-kernel }
\__luamml_patch_package:n {amstext}
\__luamml_patch_package:n {amsmath}
\__luamml_patch_package:n {array}

\endinput
%%
%% End of file `luamml.sty'.