[latex3-commits] [latex3/latex2e] UF-latex-lab-math-options: adapt key for luamml writing (7bd0856cd)
github at latex-project.org
github at latex-project.org
Fri Oct 25 01:13:06 CEST 2024
Repository : https://github.com/latex3/latex2e
On branch : UF-latex-lab-math-options
Link : https://github.com/latex3/latex2e/commit/7bd0856cdce1534d20e2cfc4a43938cf2e78e425
>---------------------------------------------------------------
commit 7bd0856cdce1534d20e2cfc4a43938cf2e78e425
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Fri Oct 25 01:13:06 2024 +0200
adapt key for luamml writing
>---------------------------------------------------------------
7bd0856cdce1534d20e2cfc4a43938cf2e78e425
required/latex-lab/latex-lab-math.dtx | 151 +++++++++++++++++++---------------
1 file changed, 83 insertions(+), 68 deletions(-)
diff --git a/required/latex-lab/latex-lab-math.dtx b/required/latex-lab/latex-lab-math.dtx
index 5697fe22b..c0239b7f2 100644
--- a/required/latex-lab/latex-lab-math.dtx
+++ b/required/latex-lab/latex-lab-math.dtx
@@ -415,27 +415,28 @@
% of the \pkg{luamml} package.
%
% \item[mathml-AF] A mathml representation of the equation can be attached
-% to the structure. The keys control three different
+% to the structure. The keys have to control three different
% tasks: The generation of the mathml,
% the reading and embedding of the mathml, and
% the attaching of a mathml to a specific equation.
%
-% With pdflatex mathml files can not be generated automatically,
-% but a dummy will be written if the key
-% \verb+\tagpdfsetup{math/mathml/write-dummy}+ is issued.
-%
-% With lualatex mathml files can be created automatically with
-% the help of \pkg{luamml}.
-%
-% By default the code will read and embed
-% mathml from |\jobname-mathml.html| and |\jobname-luamml-mathml.html|.
-% The list of sources can be changed with the key
-% |math/mathml/sources|, setting that to an empty value suppresses
-% the loading mathml associated files completely.
-%
-%
-% With lualatex, if
-%
+% \begin{description}
+% \item[generation]
+% With pdflatex mathml files can not be generated automatically,
+% but a dummy will be written if the key
+% \verb+\tagpdfsetup{math/mathml/write-dummy}+ is issued.
+%
+% With lualatex mathml files can be created automatically with
+% the help of \pkg{luamml}.
+% \item[reading]
+% By default the code will read and embed
+% mathml from |\jobname-mathml.html| and |\jobname-luamml-mathml.html|.
+% The list of sources can be changed with the key
+% |math/mathml/sources|, setting that to an empty value suppresses
+% the loading mathml associated files completely.
+%
+% \item[attaching]
+% \end{description}
%
% \item[mathml structure elements]
% Mathml structure elements can be used in PDF 2.0 directly.
@@ -1030,8 +1031,6 @@
\AddToHook{begindocument/end}
{
\@@_luamml_activate_write:
- \msg_note:nnnn { tag }
- { luamml-status }{ enabled }{ create }
}
}
{-1 } {
@@ -1050,8 +1049,6 @@
\AddToHook{begindocument/end}
{
\@@_luamml_activate_write:
- \msg_note:nnnn { tag }
- { luamml-status }{ enabled }{ create }
}
}
{ \msg_warning:nn { tag }{ unicode-math-missing } }
@@ -1080,42 +1077,47 @@
}
\cs_new_protected:Npn \@@_luamml_activate_write:
{
+ \bool_if:NT \g_@@_luamml_write_bool
+ {
% \end{macrocode}
% to avoid that nothing is written in the first run, we must activate the sockets:
% \begin{macrocode}
- \bool_gset_true:N\g__tag_math_mathml_AF_bool
- \AssignSocketPlug{tagsupport/math/struct/begin}{mathml-AF}
- \AssignSocketPlug{tagsupport/math/struct/end}{mathml-AF}
- \AssignSocketPlug{tagsupport/math/substruct/begin}{single}
- \AssignSocketPlug{tagsupport/math/substruct/end}{single}
- \int_set:Nn \l__luamml_pretty_int { 5 }
- \RegisterFamilyMapping\symsymbols{oms}
- \RegisterFamilyMapping\symletters{oml}
- \AssignSocketPlug{tagsupport/math/mathml/write/prepare}{On}
- \iow_new:N \g_@@_luamml_iow
- \iow_open:Nn \g_@@_luamml_iow {\c_sys_jobname_str-luamml-mathml.html}
- \iow_now:Ne \g_@@_luamml_iow { \c_@@_mathml_write_init_tl }
- \cs_new:Npn \@@_luamml_output_hook:n ##1
- {
- \tl_if_empty:NF \l_@@_mathml_write_before_tl
+ \bool_gset_true:N\g__tag_math_mathml_AF_bool
+ \AssignSocketPlug{tagsupport/math/struct/begin}{mathml-AF}
+ \AssignSocketPlug{tagsupport/math/struct/end}{mathml-AF}
+ \AssignSocketPlug{tagsupport/math/substruct/begin}{single}
+ \AssignSocketPlug{tagsupport/math/substruct/end}{single}
+ \int_set:Nn \l__luamml_pretty_int { 7 }
+ \RegisterFamilyMapping\symsymbols{oms}
+ \RegisterFamilyMapping\symletters{oml}
+ \AssignSocketPlug{tagsupport/math/mathml/write/prepare}{On}
+ \iow_new:N \g_@@_luamml_iow
+ \iow_open:Nn \g_@@_luamml_iow {\c_sys_jobname_str-luamml-mathml.html}
+ \iow_now:Ne \g_@@_luamml_iow { \c_@@_mathml_write_init_tl }
+ \cs_new:Npn \@@_luamml_output_hook:n ##1
{
- \iow_now:Ne \g_@@_luamml_iow
- {
- \l_@@_mathml_write_before_tl
- ##1
- \c_@@_mathml_write_after_tl
- }
+ \tl_if_empty:NF \l_@@_mathml_write_before_tl
+ {
+ \iow_now:Ne \g_@@_luamml_iow
+ {
+ \l_@@_mathml_write_before_tl
+ ##1
+ \c_@@_mathml_write_after_tl
+ }
+ }
}
- }
- \__luamml_register_output_hook:N \@@_luamml_output_hook:n
+ \__luamml_register_output_hook:N \@@_luamml_output_hook:n
% \end{macrocode}
% At the end of the document we must finish and close the file:
% \begin{macrocode}
- \AddToHook{enddocument/afterlastpage}
- {
- \iow_now:Ne \g_@@_luamml_iow
- { \c_@@_mathml_write_final_tl }
- \iow_close:N \g_@@_luamml_iow
+ \AddToHook{enddocument/afterlastpage}
+ {
+ \iow_now:Ne \g_@@_luamml_iow
+ { \c_@@_mathml_write_final_tl }
+ \iow_close:N \g_@@_luamml_iow
+ }
+ \msg_note:nnnn { tag }
+ { luamml-status }{ enabled }{ create }
}
}
% \end{macrocode}
@@ -1128,7 +1130,15 @@
\tl_set:Nn \g_@@_luamml_load_tl {0}
% \end{macrocode}
% \end{variable}
-%
+% \begin{variable}{\g_@@_luamml_write_bool}
+% This variable decides if luamml writes a mathml
+% altogether.
+% \begin{macrocode}
+\bool_new:N \g_@@_luamml_write_bool
+\bool_gset_true:N \g_@@_luamml_write_bool
+% \end{macrocode}
+% \end{variable}
+
% \begin{macrocode}
\keys_define:nn { __tag / setup }
{
@@ -1149,10 +1159,12 @@
% \end{macrocode}
%
% \begin{macrocode}
- math/mathml/luamml .choice: ,
- math/mathml/luamml/true .code:n = {\tl_gset:Nn \g__tag_math_luamml_tl{1}},
- math/mathml/luamml/false .code:n = {\tl_gset:Nn \g__tag_math_luamml_tl{-1}},
- math/mathml/luamml .default:n = true,
+ math/mathml/luamml/write .bool_gset:N = \g_@@_luamml_write_bool,
+ math/mathml/luamml/write .usage:n=preamble,
+% \end{macrocode}
+% alia keys for compatibility
+% \begin{macrocode}
+ math/mathml/luamml .bool_gset:N = \g_@@_luamml_write_bool,
math/mathml/luamml .usage:n=preamble
}
% \end{macrocode}
@@ -1641,20 +1653,23 @@
% debugging option. TODO: hide in debug key.
% \begin{macrocode}
\tl_if_exist:cTF { g_@@_mathml_ \l_@@_content_hash_tl _tl }
- {
- \int_gincr:N\g_@@_mathml_AF_found_int
- \bool_if:NTF \l__tag_math_mathml_AF_bool
- {
- \int_gincr:N\g_@@_mathml_AF_attached_int
- \typeout {Inserting~mathml~with~Hash~\l_@@_content_hash_tl}
- }
- {
- \typeout {Ignoring~mathml~with~Hash~\l_@@_content_hash_tl}
- }
- }
- {
- \typeout{WARNING:~mathml~missing~for~hash~\l_@@_content_hash_tl}
- }
+ {
+ \int_gincr:N\g_@@_mathml_AF_found_int
+ \bool_if:NTF \l__tag_math_mathml_AF_bool
+ {
+ \int_gincr:N\g_@@_mathml_AF_attached_int
+ \typeout {Inserting~mathml~with~Hash~\l_@@_content_hash_tl}
+ }
+ {
+ \typeout {Ignoring~mathml~with~Hash~\l_@@_content_hash_tl}
+ }
+ }
+ {
+ \bool_if:NT \l__tag_math_mathml_AF_bool
+ {
+ \typeout {WARNING:~mathml~missing~for~hash~\l_@@_content_hash_tl}
+ }
+ }
\socket_use:n {tagsupport/math/mathml/write/prepare}
\socket_use:n {tagsupport/math/mathml/write} % write hash if request
\bool_if:NTF\l__tag_math_texsource_AF_bool
More information about the latex3-commits
mailing list.