[latex3-commits] [latex3/latex2e] latex-lab/uf-review-05: embed mathml-xml-files if they exist (92b08dbf)
github at latex-project.org
github at latex-project.org
Tue Jan 9 00:30:18 CET 2024
Repository : https://github.com/latex3/latex2e
On branch : latex-lab/uf-review-05
Link : https://github.com/latex3/latex2e/commit/92b08dbf4481105e6a2ba4ab1d6cba668a9c43f3
>---------------------------------------------------------------
commit 92b08dbf4481105e6a2ba4ab1d6cba668a9c43f3
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Tue Jan 9 00:30:18 2024 +0100
embed mathml-xml-files if they exist
>---------------------------------------------------------------
92b08dbf4481105e6a2ba4ab1d6cba668a9c43f3
required/latex-lab/latex-lab-math.dtx | 41 ++++++++++++++++++++++++++++++-----
1 file changed, 35 insertions(+), 6 deletions(-)
diff --git a/required/latex-lab/latex-lab-math.dtx b/required/latex-lab/latex-lab-math.dtx
index 5a437534..d58d90b0 100644
--- a/required/latex-lab/latex-lab-math.dtx
+++ b/required/latex-lab/latex-lab-math.dtx
@@ -267,7 +267,7 @@
% the snippets are one after the other in the PDF).
%
% The MathML-AF can be suppressed for the equations in a group with |mathml/AF=false|, or
-% completly by setting |mathml/filelist=| in the preamble.
+% completly by setting |mathml/setfiles=| in the preamble.
%
% Files embedded in a PDF can be listed in the attachments panel of a PDF viewer.
% This is probably not so useful for lots of small files (but one could create
@@ -551,15 +551,16 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{variable}{\l__tag_math_mathml_filelist_clist}
+% \begin{variable}{\l__tag_math_mathml_files_clist}
% A sequence to store the file list for the mathml.
% \begin{macrocode}
-\clist_new:N\l__tag_math_mathml_filelist_clist
-\clist_put_right:Nn\l__tag_math_mathml_filelist_clist {\c_sys_jobname_str-mathml}
+\clist_new:N\l__tag_math_mathml_files_clist
+\clist_put_right:Ne\l__tag_math_mathml_files_clist {\c_sys_jobname_str-mathml}
% \end{macrocode}
% \end{variable}
% This is the internal variant of the \cs{mml} command
+% \begin{macro}{\@@_AF_mml:nnnn}
% \begin{macrocode}
\cs_new_protected:Npn \@@_AF_mml:nnnn #1 #2 #3 #4
%#1 number, #2 tex source for debugging, #3 hash, #4 mathml
@@ -578,13 +579,41 @@
% not strictly necessary but makes the files visible in the file attachment
% page
% \begin{macrocode}
- \bool_if:NT \__tag_math_mathml_panel_bool
+ \bool_if:NT \l__tag_math_mathml_panel_bool
{\pdfmanagement_add:nne {Catalog/Names}{EmbeddedFiles}{\l_tmpa_tl}}
\tl_new:c{g_@@_mathml_#3_tl}
\tl_gset_eq:cN{g_@@_mathml_#3_tl}\l_tmpa_tl
}
}
% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_AF_process_mathml_files:}
+% \begin{macrocode}
+\box_new:N\l_@@_tmpa_box
+\cs_new_protected:Npn \@@_AF_process_mathml_files:
+ {
+ \hbox_set:Nn \l_@@_tmpa_box
+ {
+ \pdfdict_put:nnn { l_pdffile/Filespec }{AFRelationship} { /Supplement }
+ \pdfdict_put:nne
+ { l_pdffile }{Subtype}
+ { \pdf_name_from_unicode_e:n{application/mathml+xml} }
+ \char_set_catcode_other:N \#
+ \cs_set_eq:NN\mml \@@_AF_mml:nnnn
+ \clist_map_inline:Nn \l__tag_math_mathml_files_clist
+ {
+ \file_if_exist_input:nF {##1.xml}
+ {
+ \typeout{mathml~file~##1~does~not~exist}%info message
+ }
+ }
+ }
+ }
+\AddToHook{begindocument}{\@@_AF_process_mathml_files:}
+% \end{macrocode}
+% \end{macro}
+%
%
% \subsection{Tagging options}
% \begin{macrocode}
@@ -594,7 +623,7 @@
}
\keys_define:nn { math / tagging }
{
- mathml/setfiles .clist_set:N = \l__tag_math_mathml_filelist_clist,
+ mathml/setfiles .clist_set:N = \l__tag_math_mathml_files_clist,
mathml/panel .bool_set:N = \l__tag_math_mathml_panel_bool,
mathml/panel .initial:n = true,
texsource/panel .bool_set:N = \l__tag_math_texsource_panel_bool,
More information about the latex3-commits
mailing list.