[latex3-commits] [latex3/latex2e] UF-latex-lab-math-options: enable alt for ua-1, docu, typo (aa1311afa)
github at latex-project.org
github at latex-project.org
Fri Oct 25 13:21:30 CEST 2024
Repository : https://github.com/latex3/latex2e
On branch : UF-latex-lab-math-options
Link : https://github.com/latex3/latex2e/commit/aa1311afa34cebc0214dd5ea76465918b30240c7
>---------------------------------------------------------------
commit aa1311afa34cebc0214dd5ea76465918b30240c7
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Fri Oct 25 13:21:30 2024 +0200
enable alt for ua-1, docu, typo
>---------------------------------------------------------------
aa1311afa34cebc0214dd5ea76465918b30240c7
required/latex-lab/latex-lab-math.dtx | 88 ++++++++++++++++------
.../testfiles-math/mathcapture-tag-001.pvt | 2 +-
.../minipage-006-gh723.luatex.tpf | 71 ++++++++---------
.../testfiles-minipage/minipage-006-gh723.tpf | 79 +++++++++----------
.../latex-lab/testfiles-table-luatex/table-005.lvt | 2 +-
.../latex-lab/testfiles-table-luatex/table-005.tlg | 3 +-
6 files changed, 144 insertions(+), 101 deletions(-)
diff --git a/required/latex-lab/latex-lab-math.dtx b/required/latex-lab/latex-lab-math.dtx
index c0239b7f2..b47f0dc8b 100644
--- a/required/latex-lab/latex-lab-math.dtx
+++ b/required/latex-lab/latex-lab-math.dtx
@@ -333,12 +333,13 @@
% and if the package \texttt{luamml} is found
% then it will automatically generate the file |\jobname-luamml-mathml.html|
% with mathml representations of all math formulas.
-% The generation of the file can be suppressed with |math/mathml/luamml=false|.
-% If \texttt{unicode-math} is not used,
-% the generation of the file can be forced
-% with |math/mathml/luamml=true| or |math/mathml/luamml| but be aware that
-% it is then probable that various symbols are mapped to the wrong unicode code
-% points.
+% The generation of the file can be suppressed (in the preamble)
+% with |math/mathml/luamml/write=false|.
+% If \texttt{unicode-math} is not used, \pkg{luamml} is not loaded by default,
+% the loading and so also the generation of the file can then be forced
+% with |math/mathml/luamml/load=true| or |math/mathml/luamml/write=true|
+% but be aware that it is then possible that various symbols
+% are mapped to the wrong unicode code points.
% The package is still quite experimental and the output should be checked.
% The |\jobname-luamml-mathml.html| file may be previewed in a browser although
% you may need to add additional css or javascript declarations
@@ -383,7 +384,9 @@
% which views math formulas as illustrations, mandates the key
% also for \texttt{Formula} structure elements.
% \begin{description}
-% \item[enabled by default?] false (this will reconsidered when it is clear, that
+% \item[enabled by default?] false unless PDF/UA-1 is detected,
+% then it is enable in the begindocument/end hook
+% (this will reconsidered when it is clear, that
% the use of \texttt{Alt} does not shadow mathml). It can be enabled for
% all engines and PDF versions.
% \item[enable/disable] \verb+\tagpdfsetup{math/alt/use}+ (local boolean,
@@ -400,7 +403,7 @@
% be attached as an associated file with mime-type
% application/Fx-tex. The \texttt{AFRelationship} is \texttt{Source}.
% The source is embedded without expansion. This means that targets of
-% references and current values of macros are not resolved.
+% references and macros are not resolved.
%
% \begin{description}
% \item[enabled by default?] true for all engines and PDF versions
@@ -411,23 +414,29 @@
% use of it: if there is no mathml it passes the source to mathjax.
% \end{description}
%
-% \item[luamml] The following option make with lualatex use
-% of the \pkg{luamml} package.
+% \item[luamml] The following options make (with lualatex) use
+% of the \pkg{luamml} package. \pkg{luamml} is currently automatically
+% loaded (at the end of the preamble) if \pkg{unicode-math} has been detected.
+% The loading can be forced or suppressed
+% with \verb+\tagpdfsetup{math/mathm/luamml/load=true/false}+
%
% \item[mathml-AF] A mathml representation of the equation can be attached
-% 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.
+% to the structure. The options are rather complex as the
+% keys have to control three different tasks:
+% The \emph{generation} of the file with the mathml fragments,
+% the \emph{reading} and \emph{embedding} of the mathml fragments,
+% and the \emph{association} of a mathml fragment to a specific equation.
+%
%
% \begin{description}
% \item[generation]
-% With pdflatex mathml files can not be generated automatically,
-% but a dummy will be written if the key
+% With pdf\LaTeX{} mathml fragments can not be generated automatically,
+% but a file with dummy fragments for every equation will be written if
% \verb+\tagpdfsetup{math/mathml/write-dummy}+ is issued.
%
-% With lualatex mathml files can be created automatically with
-% the help of \pkg{luamml}.
+% With lua\LaTeX{} a file with mathml fragments will be created automatically
+% if the package \pkg{luamml} has been loaded (see above).
+%
% \item[reading]
% By default the code will read and embed
% mathml from |\jobname-mathml.html| and |\jobname-luamml-mathml.html|.
@@ -1071,9 +1080,9 @@
luamml~will~not~create~an~MathML~file.\\
To~avoid~this~warning~load~unicode-math~\\
or~disable~luamml~with~\\
- \tl_to_str:n{\tagpdfsetup{math/mathml/luamml=false}}\\
+ \tl_to_str:n{\tagpdfsetup{math/mathml/luamml/load=false}}\\
or~force~luamml~with~\\
- \tl_to_str:n{\tagpdfsetup{math/mathml/luamml=true}}
+ \tl_to_str:n{\tagpdfsetup{math/mathml/luamml/load=true}}
}
\cs_new_protected:Npn \@@_luamml_activate_write:
{
@@ -1127,7 +1136,7 @@
% altogether.
% \begin{macrocode}
\tl_new:N \g_@@_luamml_load_tl
-\tl_set:Nn \g_@@_luamml_load_tl {0}
+\tl_gset:Nn \g_@@_luamml_load_tl {0}
% \end{macrocode}
% \end{variable}
% \begin{variable}{\g_@@_luamml_write_bool}
@@ -1159,10 +1168,20 @@
% \end{macrocode}
%
% \begin{macrocode}
- math/mathml/luamml/write .bool_gset:N = \g_@@_luamml_write_bool,
+ math/mathml/luamml/write .choice:,
+ math/mathml/luamml/write/true .code:n =
+ {
+ \tl_gset:Nn \g_@@_luamml_load_tl{1}
+ \bool_gset_true:N \g_@@_luamml_write_bool
+ },
+ math/mathml/luamml/write/false .code:n =
+ {
+ \bool_gset_false:N \g_@@_luamml_write_bool
+ },
+ math/mathml/luamml/write .default:n = true,
math/mathml/luamml/write .usage:n=preamble,
% \end{macrocode}
-% alia keys for compatibility
+% alias keys for compatibility
% \begin{macrocode}
math/mathml/luamml .bool_gset:N = \g_@@_luamml_write_bool,
math/mathml/luamml .usage:n=preamble
@@ -1319,7 +1338,7 @@
\keys_define:nn { __tag / setup }
{
math/mathml/sources .clist_set:N = \l__tag_math_mathml_files_clist,
- math/alt/use .bool_set:N = \l__tag_math_alt_bool,
+ math/alt/use .bool_set:N = \l__tag_math_alt_bool,
viewer/pane/mathml .bool_set:N = \l__tag_math_mathml_pane_bool,
viewer/pane/mathml .initial:n = true,
viewer/pane/mathsource .bool_set:N = \l__tag_math_texsource_pane_bool,
@@ -1329,6 +1348,27 @@
math/tex/AF .initial:n = true
}
% \end{macrocode}
+% alt is required for pdf/UA-1.
+% TODO: l3pdfmeta should support this test.
+% \begin{macrocode}
+\AddToHook{begindocument/end}
+ {
+ \str_if_eq:eeT
+ {1}
+ {
+ \exp_last_unbraced:Ne\use_i:nn
+ {\GetDocumentProperties{document/pdfstandard-UA}}
+ \c_empty_tl\c_empty_tl
+ }
+ {
+ \bool_if:NF \l__tag_math_alt_bool
+ {
+ \typeout{PDF/UA-1~detected.~Enabling~alt~text~on~Formula}
+ }
+ \bool_set_true:N\l__tag_math_alt_bool
+ }
+ }
+% \end{macrocode}
%
% \subsection{Sockets}
% \subsubsection{Main inline math sockets}
diff --git a/required/latex-lab/testfiles-math/mathcapture-tag-001.pvt b/required/latex-lab/testfiles-math/mathcapture-tag-001.pvt
index cde6bedac..85ff8ecfc 100644
--- a/required/latex-lab/testfiles-math/mathcapture-tag-001.pvt
+++ b/required/latex-lab/testfiles-math/mathcapture-tag-001.pvt
@@ -32,7 +32,7 @@
\tag_mc_begin_pop:n{}
}
\ExplSyntaxOff
-
+\tagpdfsetup{math/alt/use}
\begin{document}
\START\showoutput some text
\begin{align}
diff --git a/required/latex-lab/testfiles-minipage/minipage-006-gh723.luatex.tpf b/required/latex-lab/testfiles-minipage/minipage-006-gh723.luatex.tpf
index 8bdd772fc..316971eee 100644
--- a/required/latex-lab/testfiles-minipage/minipage-006-gh723.luatex.tpf
+++ b/required/latex-lab/testfiles-minipage/minipage-006-gh723.luatex.tpf
@@ -116,6 +116,7 @@ endobj
endobj
33 0 obj
<< /justify <</O/Layout/TextAlign/Justify>>
+/display <</O/Layout/Placement/Block>>
>>
endobj
9 0 obj
@@ -134,7 +135,7 @@ endobj
<< /Type /StructElem /C /justify /S /text /P 12 0 R /K <</Type /MCR /Pg 24 0 R /MCID 0>> /ID (ID.006) >>
endobj
14 0 obj
-<< /Type /StructElem /AF [16 0 R] /T <FEFF006500710075006100740069006F006E> /Alt <FEFF004C006100540065005800200066006F0072006D0075006C006100200073007400610072007400730020005C0062006500670069006E0020007B006500710075006100740069006F006E007D00200061003D00620020005C00710075006100640020005C0062006500670069006E0020007B006D0069006E00690070006100670065007D007B00340063006D007D00200069006E00200064006500720020006D0069006E006900700061006700650020005C0065006E006400670072006100660020006D00690074002000650069006E006500720020007A00770065006900740065006E0020005A00650069006C00650020005C0065006E00640020007B006D0069006E00690070006100670065007D0020005C0065006E00640020007B006500710075006100740069006F006E007D0020004C006100540065005800200066006F0072006D0075006C006100200065006E006400730020> /S /Formula /P 12 0 R /K [<</Type /MCR /Pg 24 0 R /MCID 1>> 17 0 R 22 0 R ] /ID (ID.007) >>
+<< /Type /StructElem /C /display /AF [16 0 R] /T <FEFF006500710075006100740069006F006E> /S /Formula /P 12 0 R /K [<</Type /MCR /Pg 24 0 R /MCID 1>> 17 0 R 22 0 R ] /ID (ID.007) >>
endobj
17 0 obj
<< /Type /StructElem /S /Div /P 14 0 R /K [18 0 R 20 0 R] /ID (ID.008) >>
@@ -478,53 +479,53 @@ xref
0000000003 00000 f
0000000004 00000 f
0000000008 00000 f
-0000005287 00000 n
+0000004638 00000 n
0000002320 00000 n
0000002678 00000 n
0000000000 00000 f
-0000003321 00000 n
-0000003406 00000 n
-0000003482 00000 n
-0000003558 00000 n
-0000003654 00000 n
-0000003777 00000 n
+0000003360 00000 n
+0000003445 00000 n
+0000003521 00000 n
+0000003597 00000 n
+0000003693 00000 n
+0000003816 00000 n
0000000020 00000 n
0000000292 00000 n
-0000004664 00000 n
-0000004755 00000 n
-0000004843 00000 n
-0000004966 00000 n
-0000005054 00000 n
-0000005177 00000 n
+0000004015 00000 n
+0000004106 00000 n
+0000004194 00000 n
+0000004317 00000 n
+0000004405 00000 n
+0000004528 00000 n
0000002126 00000 n
0000001991 00000 n
0000000492 00000 n
-0000033473 00000 n
-0000007119 00000 n
-0000031531 00000 n
-0000033631 00000 n
+0000032824 00000 n
+0000006470 00000 n
+0000030882 00000 n
+0000032982 00000 n
0000002284 00000 n
0000002391 00000 n
0000002641 00000 n
0000003257 00000 n
-0000005405 00000 n
-0000005436 00000 n
-0000006131 00000 n
-0000005468 00000 n
-0000005541 00000 n
-0000006367 00000 n
-0000007273 00000 n
-0000007473 00000 n
-0000015532 00000 n
-0000007740 00000 n
-0000029638 00000 n
-0000015757 00000 n
-0000029946 00000 n
-0000031689 00000 n
-0000033693 00000 n
-0000033792 00000 n
+0000004756 00000 n
+0000004787 00000 n
+0000005482 00000 n
+0000004819 00000 n
+0000004892 00000 n
+0000005718 00000 n
+0000006624 00000 n
+0000006824 00000 n
+0000014883 00000 n
+0000007091 00000 n
+0000028989 00000 n
+0000015108 00000 n
+0000029297 00000 n
+0000031040 00000 n
+0000033044 00000 n
+0000033143 00000 n
trailer
<< /Size 50 /Root 48 0 R /Info 49 0 R /ID [ <2350CAD05F8A7AF0AA4058486855344F> <2350CAD05F8A7AF0AA4058486855344F> ] >>
startxref
-33926
+33277
%%EOF
diff --git a/required/latex-lab/testfiles-minipage/minipage-006-gh723.tpf b/required/latex-lab/testfiles-minipage/minipage-006-gh723.tpf
index bc97fcbd7..1122a7724 100644
--- a/required/latex-lab/testfiles-minipage/minipage-006-gh723.tpf
+++ b/required/latex-lab/testfiles-minipage/minipage-006-gh723.tpf
@@ -94,6 +94,7 @@ endobj
endobj
34 0 obj
<< /justify <</O/Layout/TextAlign/Justify>>
+/display <</O/Layout/Placement/Block>>
>>
endobj
9 0 obj
@@ -112,7 +113,7 @@ endobj
<< /Type /StructElem /C /justify /S /text /P 12 0 R /K <</Type /MCR /Pg 14 0 R/MCID 0>> /ID (ID.006) >>
endobj
15 0 obj
-<< /Type /StructElem /AF [17 0 R] /T <FEFF006500710075006100740069006F006E> /Alt <FEFF004C006100540065005800200066006F0072006D0075006C006100200073007400610072007400730020005C0062006500670069006E0020007B006500710075006100740069006F006E007D00200061003D00620020005C00710075006100640020005C0062006500670069006E0020007B006D0069006E00690070006100670065007D007B00340063006D007D00200069006E00200064006500720020006D0069006E006900700061006700650020005C0065006E006400670072006100660020006D00690074002000650069006E006500720020007A00770065006900740065006E0020005A00650069006C00650020005C0065006E00640020007B006D0069006E00690070006100670065007D0020005C0065006E00640020007B006500710075006100740069006F006E007D0020004C006100540065005800200066006F0072006D0075006C006100200065006E006400730020> /S /Formula /P 12 0 R /K [<</Type /MCR /Pg 14 0 R/MCID 1>> 18 0 R <</Type /MCR /Pg 14 0 R/MCID 4>> 23 0 R <</Type /MCR /Pg 14 0 R/MCID 6>>] /ID (ID.007) >>
+<< /Type /StructElem /C /display /AF [17 0 R] /T <FEFF006500710075006100740069006F006E> /S /Formula /P 12 0 R /K [<</Type /MCR /Pg 14 0 R/MCID 1>> 18 0 R <</Type /MCR /Pg 14 0 R/MCID 4>> 23 0 R <</Type /MCR /Pg 14 0 R/MCID 6>>] /ID (ID.007) >>
endobj
18 0 obj
<< /Type /StructElem /S /Div /P 15 0 R /K [19 0 R 21 0 R] /ID (ID.008) >>
@@ -744,60 +745,60 @@ xref
0000000003 00000 f
0000000004 00000 f
0000000008 00000 f
-0000004940 00000 n
+0000004291 00000 n
0000001905 00000 n
0000002277 00000 n
0000000000 00000 f
-0000002920 00000 n
-0000003005 00000 n
-0000003081 00000 n
-0000003157 00000 n
-0000003253 00000 n
+0000002959 00000 n
+0000003044 00000 n
+0000003120 00000 n
+0000003196 00000 n
+0000003292 00000 n
0000001563 00000 n
-0000003374 00000 n
+0000003413 00000 n
0000000015 00000 n
0000000286 00000 n
-0000004323 00000 n
-0000004414 00000 n
-0000004502 00000 n
-0000004623 00000 n
-0000004711 00000 n
-0000004832 00000 n
+0000003674 00000 n
+0000003765 00000 n
+0000003853 00000 n
+0000003974 00000 n
+0000004062 00000 n
+0000004183 00000 n
0000001698 00000 n
0000000486 00000 n
-0000043439 00000 n
-0000044330 00000 n
-0000039252 00000 n
-0000041193 00000 n
-0000044494 00000 n
+0000042790 00000 n
+0000043681 00000 n
+0000038603 00000 n
+0000040544 00000 n
+0000043845 00000 n
0000001869 00000 n
0000001990 00000 n
0000002240 00000 n
0000002856 00000 n
-0000005058 00000 n
-0000005082 00000 n
-0000005112 00000 n
-0000037448 00000 n
-0000005134 00000 n
-0000005639 00000 n
-0000013408 00000 n
-0000013630 00000 n
-0000021001 00000 n
-0000021222 00000 n
-0000023886 00000 n
-0000024104 00000 n
-0000037166 00000 n
-0000037610 00000 n
-0000039410 00000 n
-0000041350 00000 n
-0000043617 00000 n
-0000044553 00000 n
-0000044652 00000 n
+0000004409 00000 n
+0000004433 00000 n
+0000004463 00000 n
+0000036799 00000 n
+0000004485 00000 n
+0000004990 00000 n
+0000012759 00000 n
+0000012981 00000 n
+0000020352 00000 n
+0000020573 00000 n
+0000023237 00000 n
+0000023455 00000 n
+0000036517 00000 n
+0000036961 00000 n
+0000038761 00000 n
+0000040701 00000 n
+0000042968 00000 n
+0000043904 00000 n
+0000044003 00000 n
trailer
<< /Size 54
/Root 52 0 R
/Info 53 0 R
/ID [<9BD18DF3359C1216B83ADB4AA401CC9A> <9BD18DF3359C1216B83ADB4AA401CC9A>] >>
startxref
-44786
+44137
%%EOF
diff --git a/required/latex-lab/testfiles-table-luatex/table-005.lvt b/required/latex-lab/testfiles-table-luatex/table-005.lvt
index fa0b5f9e7..caee05925 100644
--- a/required/latex-lab/testfiles-table-luatex/table-005.lvt
+++ b/required/latex-lab/testfiles-table-luatex/table-005.lvt
@@ -8,7 +8,7 @@
\DebugSocketsOn
\DebugTablesOn
-
+\tagpdfsetup{math/alt/use}
\begin{document}
\START \showoutput
$
diff --git a/required/latex-lab/testfiles-table-luatex/table-005.tlg b/required/latex-lab/testfiles-table-luatex/table-005.tlg
index e628ea4e2..37fc0f4f5 100644
--- a/required/latex-lab/testfiles-table-luatex/table-005.tlg
+++ b/required/latex-lab/testfiles-table-luatex/table-005.tlg
@@ -34,7 +34,7 @@ Package tagpdf Info: text has been pushed to the mc stack
Package tagpdf Info: Parent-Child 'P' --> 'Formula'.
(tagpdf) Relation is 1 (='0..n')
(tagpdf) Rolemapped from: 'P' --> 'Formula' on line ...
-tagpdf DEBUG Info: Struct 7 begin inserted with options: tag=Formula,texsource=\l__math_content_AF_source_tmpa_tl ,title-o=\g__math_grabbed_env_tl ,actualtext=\l__math_content_actual_tl ,alt=\l__math_content_alt_tl
+tagpdf DEBUG Info: Struct 7 begin inserted with options: tag=Formula,attribute-class=\l__math_attribute_class_tl ,texsource=\l__math_content_AF_source_tmpa_tl ,title-o=\g__math_grabbed_env_tl ,actualtext=\l__math_content_actual_tl ,alt=\l__math_content_alt_tl
(tagpdf DEBUG) [on line ...]
The sequence \g__tag_struct_tag_stack_seq contains the items (without outer braces):
> {{Formula}{Formula}}
@@ -315,6 +315,7 @@ The structure has the following kids:
=========================
The structure 7 contains:
> Type => /StructElem
+> C => /inline
> AF => [16 0 R]
> T => <FEFF006D006100740068>
> Alt => <FEFF004C006100540065005800200066006F0072006D0075006C006100200073007400610072007400730020005C0062006500670069006E0020007B006D006100740068007D0020005C0062006500670069006E0020007B00610072007200610079007D007B006C007D0061005C0065006E00640020007B00610072007200610079007D0020005C0065006E00640020007B006D006100740068007D0020004C006100540065005800200066006F0072006D0075006C006100200065006E006400730020>
More information about the latex3-commits
mailing list.