
Dear All, Following the instructions in tagging.pdf, I tried \setupbackend[format=pdf/ua-2] \setuptagging[state=start] \enabledirectives [backend.usetags=crap] \registermathsymbol[default][en][ z ][the variable] \registermathsymbol[default][en][ k ][the index] \starttext \startformula \startalign \NC \left|(z_0+h)^n - z_0^n\right| \NC = \left|\sum_{k=1}^n \binom{n}{k}h^k z_0^{n-k}\right| \NR \NC \NC = \left |h \sum_{k=0}^{n-1} \binom{n}{k+1} h^k z_0^{n-1-k}\right| \NR \NC \NC = \left|h \sum_{k=0}^{n-1} \frac n {k+1} \binom{n-1}{k} h^k z_0^{n-1-k}\right| \NR \NC \NC \le n | h| \sum_{k=0}^{n-1} \binom{n-1}{k} |h|^k |z_0|^{n-1-k} \NR \NC \NC \le n | h| (|z_0|+|h|)^{n-1} \NR \stopalign \stopformula \stoptext This creates within the pdf the XML attachment below: This XML contains all the information from the formula. Wrapping it into \usemodule[mathml] \starttext \xmlprocessdata{}{ % content of XML file }{} \stoptext produces which is also what my Mac screen reads from the original PDF, but it is evidently not what I want. Does someone have a working example that shows how to do this right? Thanks, Matthias

Hi,
I don't know what you expect, but you can try
%%%
\setupbackend[format=pdf/ua-2]
\setuptagging[state=start]
\registermathsymbol[default][en]["1D467][the variable]
\registermathsymbol[default][en]["1D458][the index]
\enabletrackers[math.textblobs]
\setupnote
[mathnote]
[location=margin]
\starttext
\startformula
\abs {(z__0 + h)^n - z__0^n }
\alignhere
= \abs {\sum_{k = 1}^n \binom{n}{k} h^k z__0^{n - k} }
\breakhere
= \abs {h \sum_{k = 0}^{n - 1} \binom{n}{k + 1} h^k z__0^{n - 1 - k} }
\breakhere
= \abs {h \sum_{k = 0}^{n - 1} \frac {n}{k + 1} \binom{n - 1}{k} h^k
z__0^{n - 1 - k} }
\breakhere
\le n \abs{h} \sum_{k = 0}^{n - 1} \binom{n - 1}{k} \abs{h}^k
\abs{z__0}^{n - 1 - k}
\breakhere
\le n \abs{h} (\abs{z__0} + \abs{h})^{n - 1}
\stopformula
\placenotes[mathnote]
\registermathsymbol[default][en][lowercasebold][the vector]
\startformula
(\alpha + \beta) \mathbf{u} = \alpha \mathbf{u} + \beta \mathbf{u}
\stopformula
\placenotes[mathnote]
\stoptext
%%%
As you see in the text the z and k are now interpreted as variable and
index. The second example gives "the vector" for all lowercasebold.
I will not paste the mathml blob from the bigger formula, but the
smaller one looks like this:
<math>
<mrow>
<mo stretchy="false">(</mo>
<mi>𝛼</mi>
<mo>+</mo>
<mi>𝛽</mi>
<mo stretchy="false">)</mo>
<mi>𝐮</mi>
<mo>=</mo>
<mi>𝛼</mi>
<mi>𝐮</mi>
<mo>+</mo>
<mi>𝛽</mi>
<mi>𝐮</mi>
</mrow>
</math>
/Mikael
On Thu, Apr 10, 2025 at 7:58 PM Matthias Weber
Dear All,
Following the instructions in tagging.pdf,
I tried
\setupbackend[format=pdf/ua-2] \setuptagging[state=start]
\enabledirectives [backend.usetags=crap]
\registermathsymbol[default][en][ z ][the variable] \registermathsymbol[default][en][ k ][the index]
\starttext \startformula \startalign \NC \left|(z_0+h)^n - z_0^n\right| \NC = \left|\sum_{k=1}^n \binom{n}{k}h^k z_0^{n-k}\right| \NR \NC \NC = \left |h \sum_{k=0}^{n-1} \binom{n}{k+1} h^k z_0^{n-1-k}\right| \NR \NC \NC = \left|h \sum_{k=0}^{n-1} \frac n {k+1} \binom{n-1}{k} h^k z_0^{n-1-k}\right| \NR \NC \NC \le n | h| \sum_{k=0}^{n-1} \binom{n-1}{k} |h|^k |z_0|^{n-1-k} \NR \NC \NC \le n | h| (|z_0|+|h|)^{n-1} \NR \stopalign \stopformula \stoptext
This creates within the pdf the XML attachment below:
This XML contains all the information from the formula. Wrapping it into
\usemodule[mathml]
\starttext \xmlprocessdata{}{ % content of XML file }{} \stoptext
produces
which is also what my Mac screen reads from the original PDF, but it is evidently not what I want. Does someone have a working example that shows how to do this right?
Thanks,
Matthias
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________

Thank you Mikael, What I would like to to is to have what \placenotes[mathnote] produces added to the pdf as a tag so that a screen reader would be able to read the math. Right now, with your example, it reads the typeset math in an extremely garbled way (but the mathnotes at leats make sense). So the question is how to get the content of the mathnotes into the PDF tags… Matthias
On Apr 10, 2025, at 2:20 PM, Mikael Sundqvist
wrote: Hi,
I don't know what you expect, but you can try
%%% \setupbackend[format=pdf/ua-2]
\setuptagging[state=start]
\registermathsymbol[default][en]["1D467][the variable] \registermathsymbol[default][en]["1D458][the index]
\enabletrackers[math.textblobs]
\setupnote [mathnote] [location=margin]
\starttext \startformula \abs {(z__0 + h)^n - z__0^n } \alignhere = \abs {\sum_{k = 1}^n \binom{n}{k} h^k z__0^{n - k} } \breakhere = \abs {h \sum_{k = 0}^{n - 1} \binom{n}{k + 1} h^k z__0^{n - 1 - k} } \breakhere = \abs {h \sum_{k = 0}^{n - 1} \frac {n}{k + 1} \binom{n - 1}{k} h^k z__0^{n - 1 - k} } \breakhere \le n \abs{h} \sum_{k = 0}^{n - 1} \binom{n - 1}{k} \abs{h}^k \abs{z__0}^{n - 1 - k} \breakhere \le n \abs{h} (\abs{z__0} + \abs{h})^{n - 1} \stopformula
\placenotes[mathnote]
\registermathsymbol[default][en][lowercasebold][the vector]
\startformula (\alpha + \beta) \mathbf{u} = \alpha \mathbf{u} + \beta \mathbf{u} \stopformula
\placenotes[mathnote]
\stoptext %%%
As you see in the text the z and k are now interpreted as variable and index. The second example gives "the vector" for all lowercasebold.
I will not paste the mathml blob from the bigger formula, but the smaller one looks like this:
<math> <mrow> <mo stretchy="false">(</mo> <mi>𝛼</mi> <mo>+</mo> <mi>𝛽</mi> <mo stretchy="false">)</mo> <mi>𝐮</mi> <mo>=</mo> <mi>𝛼</mi> <mi>𝐮</mi> <mo>+</mo> <mi>𝛽</mi> <mi>𝐮</mi> </mrow> </math>
/Mikael
On Thu, Apr 10, 2025 at 7:58 PM Matthias Weber
wrote: Dear All,
Following the instructions in tagging.pdf,
I tried
\setupbackend[format=pdf/ua-2] \setuptagging[state=start]
\enabledirectives [backend.usetags=crap]
\registermathsymbol[default][en][ z ][the variable] \registermathsymbol[default][en][ k ][the index]
\starttext \startformula \startalign \NC \left|(z_0+h)^n - z_0^n\right| \NC = \left|\sum_{k=1}^n \binom{n}{k}h^k z_0^{n-k}\right| \NR \NC \NC = \left |h \sum_{k=0}^{n-1} \binom{n}{k+1} h^k z_0^{n-1-k}\right| \NR \NC \NC = \left|h \sum_{k=0}^{n-1} \frac n {k+1} \binom{n-1}{k} h^k z_0^{n-1-k}\right| \NR \NC \NC \le n | h| \sum_{k=0}^{n-1} \binom{n-1}{k} |h|^k |z_0|^{n-1-k} \NR \NC \NC \le n | h| (|z_0|+|h|)^{n-1} \NR \stopalign \stopformula \stoptext
This creates within the pdf the XML attachment below:
This XML contains all the information from the formula. Wrapping it into
\usemodule[mathml]
\starttext \xmlprocessdata{}{ % content of XML file }{} \stoptext
produces
which is also what my Mac screen reads from the original PDF, but it is evidently not what I want. Does someone have a working example that shows how to do this right?
Thanks,
Matthias
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________

Am Thu, 10 Apr 2025 15:02:53 -0400 schrieb Matthias Weber:
Thank you Mikael,
What I would like to to is to have what \placenotes[mathnote] produces added to the pdf as a tag so that a screen reader would be able to read the math.
The only reader that can currently make use of MathML embedded as associated file is Foxit together with a beta version of NVDA and a current MathCat. See https://latex3.github.io/tagging-project/documentation/wtpdf/fulldoc for some discussions. To find and use the associated MathML file Foxit requires that it is attached to a Formula element in the PDF 2.0 namespace: https://github.com/foxitsoftware/PDF_UA-2. context attaches the MathML to a `math` element declared in a context specific namespace and then rolemapped (like all other structure elements) to the NonStruct structure element (which as the name implies has no semantic meaning). This means that this MathML is not seen by any reader and useless. If some math is read then simply in the amount reader can extract math from untagged PDFs. -- Ulrike Fischer http://www.troubleshooting-tex.de/

Thanks Ulrike, This is helpful (and sad) information. Would it be possible to have ConTeXt produce two documents, one that shows the typeset formula as usual, and a second one that shows instead of the formula the text that Mikael’s example shows as a note? Then screen-reading the second output should be acceptable, at least as far as math is concerned? Thanks, Matthias
On Apr 11, 2025, at 6:53 AM, Ulrike Fischer
wrote: Am Thu, 10 Apr 2025 15:02:53 -0400 schrieb Matthias Weber:
Thank you Mikael,
What I would like to to is to have what \placenotes[mathnote] produces added to the pdf as a tag so that a screen reader would be able to read the math.
The only reader that can currently make use of MathML embedded as associated file is Foxit together with a beta version of NVDA and a current MathCat. See https://latex3.github.io/tagging-project/documentation/wtpdf/fulldoc for some discussions.
To find and use the associated MathML file Foxit requires that it is attached to a Formula element in the PDF 2.0 namespace: https://github.com/foxitsoftware/PDF_UA-2.
context attaches the MathML to a `math` element declared in a context specific namespace and then rolemapped (like all other structure elements) to the NonStruct structure element (which as the name implies has no semantic meaning). This means that this MathML is not seen by any reader and useless. If some math is read then simply in the amount reader can extract math from untagged PDFs.
-- Ulrike Fischer http://www.troubleshooting-tex.de/
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________

On 4/10/2025 9:02 PM, Matthias Weber wrote:
Thank you Mikael,
What I would like to to is to have what \placenotes[mathnote] produces added to the pdf as a tag so that a screen reader would be able to read the math. Right now, with your example, it reads the typeset math in an extremely garbled way (but the mathnotes at leats make sense).
So the question is how to get the content of the mathnotes into the PDF tags…
Last time we looked into this (over a year ago) we tested several variants with some viewers (Mikael and I use Sumatra (mupdf) and Okular) and did some tests with speech. We don't have acrobat installed and can't assume users have anyway, esp not on linux. We checked what is done with Alt and ActualText and such and decided that it made no sense to keep trial and erroring. Okular can show the embedded xml blob fine. So at that time we settled on adding the serialized formula as ActualText because that at least gave no errors in validators. We explicitly decided not to flag /math as Formula because that gave validating issues with complex formulas that have non-math inside. (We expect that by llm will be able to interpret a '/math' tag some day, why not.) So, from our perspective, we try to make sure something validates, add as much structure as possible / reasonable, then wait till the viewers that we use catch up (maybe they do when all that tagging dust has settled and standards are stable) and then pick up the thread when we know how to adapt. In the meantime users can finetune mapping as they like, but we don't want to be held responsbile for a mess. After all users know what they coded and want out of it. As said before, tagging is not that complex to support. The only condition it that we don't want to cripple context structure support by adapting to suboptimal situations. So patience is your friend. Hans ps. For decades we now use as test a math content base that covers a lot of dutch education and we had to go from content mathml (nice) to openmath (mess) to presentational mathml (dropped from browsers) to asciimath (insufficient) to again a mix of presentational mathml (back in browsers) and asciimath to ... so we know a bit what we're dealing with here: multiple output from the same source (web as well as properly made up teacher driven math). Everything web related keeps changing, often in an oscillating way. ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------

Thanks Hans, I agree and I am merely weighing my options. I don’t want anyone to waste their time on something useless just to satisfy some compliance mandate. Any document I want to make available to my students needs to be “compliant” by April 2026. Nobody knows what that exactly means or how this will be tested. I strongly support providing accessibility in addition to what I want my students to use. The best way(while waiting) seems to be to provide two documents, where the accessible version replaces all images with text that I write, and all formulas with the text that Mikael’s example produces. So my question is just this: how do I make that automatic: have all formulas replaced by a text that reads like a spoken formula? Matthias
On Apr 11, 2025, at 11:52, Hans Hagen via ntg-context
wrote: On 4/10/2025 9:02 PM, Matthias Weber wrote:
Thank you Mikael, What I would like to to is to have what \placenotes[mathnote] produces added to the pdf as a tag so that a screen reader would be able to read the math. Right now, with your example, it reads the typeset math in an extremely garbled way (but the mathnotes at leats make sense). So the question is how to get the content of the mathnotes into the PDF tags…
Last time we looked into this (over a year ago) we tested several variants with some viewers (Mikael and I use Sumatra (mupdf) and Okular) and did some tests with speech. We don't have acrobat installed and can't assume users have anyway, esp not on linux.
We checked what is done with Alt and ActualText and such and decided that it made no sense to keep trial and erroring. Okular can show the embedded xml blob fine.
So at that time we settled on adding the serialized formula as ActualText because that at least gave no errors in validators. We explicitly decided not to flag /math as Formula because that gave validating issues with complex formulas that have non-math inside. (We expect that by llm will be able to interpret a '/math' tag some day, why not.)
So, from our perspective, we try to make sure something validates, add as much structure as possible / reasonable, then wait till the viewers that we use catch up (maybe they do when all that tagging dust has settled and standards are stable) and then pick up the thread when we know how to adapt.
In the meantime users can finetune mapping as they like, but we don't want to be held responsbile for a mess. After all users know what they coded and want out of it. As said before, tagging is not that complex to support. The only condition it that we don't want to cripple context structure support by adapting to suboptimal situations.
So patience is your friend.
Hans
ps. For decades we now use as test a math content base that covers a lot of dutch education and we had to go from content mathml (nice) to openmath (mess) to presentational mathml (dropped from browsers) to asciimath (insufficient) to again a mix of presentational mathml (back in browsers) and asciimath to ... so we know a bit what we're dealing with here: multiple output from the same source (web as well as properly made up teacher driven math). Everything web related keeps changing, often in an oscillating way.
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________

On 4/11/2025 6:44 PM, Matthias Weber wrote:
Any document I want to make available to my students needs to be “compliant” by April 2026. Nobody knows what that exactly means or how this will be tested. I strongly support providing accessibility in addition to what I want my students to use.
ok, so we have some time to see how things evolve and adapt
The best way(while waiting) seems to be to provide two documents, where the accessible version replaces all images with text that I write, and all formulas with the text that Mikael’s example produces. So my question is just this: how do I make that automatic: have all formulas replaced by a text that reads like a spoken formula?
checking: you mean in the typeset text? concerning images, we can make some mechanism for that: adding more elaborate descriptions (alongside images, or in files) and some mode control Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------

Yes, no rush at all. I think the best and most consistent way to currently provide accessibility is to replace all math by what the tracker/placenote ‘magically’ produces. So at the end of the day there would be two documents, one with 1+1 =2 and one with one plus one equals two As for images, I can use modes to accomplish that. The accessible PDF would contain text only. There are other things to worry about at some point like indices, hyperlinks, tables. Matthias
On Apr 11, 2025, at 1:53 PM, Hans Hagen via ntg-context
wrote: On 4/11/2025 6:44 PM, Matthias Weber wrote:
Any document I want to make available to my students needs to be “compliant” by April 2026. Nobody knows what that exactly means or how this will be tested. I strongly support providing accessibility in addition to what I want my students to use.
ok, so we have some time to see how things evolve and adapt
The best way(while waiting) seems to be to provide two documents, where the accessible version replaces all images with text that I write, and all formulas with the text that Mikael’s example produces. So my question is just this: how do I make that automatic: have all formulas replaced by a text that reads like a spoken formula?
checking: you mean in the typeset text?
concerning images, we can make some mechanism for that: adding more elaborate descriptions (alongside images, or in files) and some mode control
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________

On Fri, 11 Apr 2025, Matthias Weber wrote:
Yes, no rush at all.
I think the best and most consistent way to currently provide accessibility is to replace all math by what the tracker/placenote ‘magically’ produces. So at the end of the day there would be two documents, one with
1+1 =2
and one with
one plus one equals two
As for images, I can use modes to accomplish that. The accessible PDF would contain text only. There are other things to worry about at some point like indices, hyperlinks, tables.
Have you considered exporting to XHTML/XML? That may be more reliably read by screen readers. Aditya

On 4/11/25 18:44, Matthias Weber wrote:
[...] The best way(while waiting) seems to be to provide two documents, where the accessible version replaces all images with text that I write, and all formulas with the text that Mikael’s example produces. So my question is just this: how do I make that automatic: have all formulas replaced by a text that reads like a spoken formula?
Sorry for the late comment, but I think an easier solution is adding label to provide alternative texts in formulas. This is required in PDF/UA-1 and afaIk not forbidden in PDF/UA-2. So, there would be no need to generate an accesible and non-accesible version of each document. Pablo

Thanks Pablo, I don’t understand how to do this. The following compiles, but I don’t think the label made it into the pdf. \enabledirectives [backend.usetags=crap] \setuptagging[state=start] \setupstructure[state=start] \setupbackend [format=PDF/A-3a, intent=sRGB IEC61966-2.1, level=0] \setupbackend[format=pdf/ua-1] \starttext \startformula[label=e to the power of parenthesis pi times i end parenthesis plus 1 equals 0] e^{\pi i}+1 =0 \stopformula \stoptext I would prefer not to have to type out the text of hundreds of formulas because ConTeXt does already a pretty good job of converting formulas into (machine) readable text. What I would like to work is something like \enabletrackers[math.textblobs] \setupnote [mathnote] [location=tag] \starttext \startformula e^{\pi i}+1 =0 \stopformula \stoptext so that the output of the tracker is used as a tag for the formula. Thanks, Matthias
On Apr 15, 2025, at 11:39 AM, Pablo Rodriguez via ntg-context
wrote: On 4/11/25 18:44, Matthias Weber wrote:
[...] The best way(while waiting) seems to be to provide two documents, where the accessible version replaces all images with text that I write, and all formulas with the text that Mikael’s example produces. So my question is just this: how do I make that automatic: have all formulas replaced by a text that reads like a spoken formula?
Sorry for the late comment, but I think an easier solution is adding label to provide alternative texts in formulas.
This is required in PDF/UA-1 and afaIk not forbidden in PDF/UA-2.
So, there would be no need to generate an accesible and non-accesible version of each document.
Pablo ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________

On 4/15/25 18:40, Matthias Weber wrote:
Thanks Pablo,
I don’t understand how to do this. [...] I would prefer not to have to type out the text of hundreds of formulas because ConTeXt does already a pretty good job of converting formulas into (machine) readable text.
Matthias, ConTeXt is doing it automatically, but the alternative text is placed in a different object as the one tagged as formula. As soon as the other thread (about alternate text for images) is solved, I think this would be settled for you. BTW, I will be away for almost a week, so no testing possible. I don’t know whether I could check this tomorrow soon. Many thanks for your patience, Pablo

Thanks Pablo, this is excellent news. There is no urgency, but I will be happy to try it out and use it. Matthias
On Apr 15, 2025, at 3:31 PM, Pablo Rodriguez via ntg-context
wrote: On 4/15/25 18:40, Matthias Weber wrote:
Thanks Pablo,
I don’t understand how to do this. [...] I would prefer not to have to type out the text of hundreds of formulas because ConTeXt does already a pretty good job of converting formulas into (machine) readable text.
Matthias,
ConTeXt is doing it automatically, but the alternative text is placed in a different object as the one tagged as formula.
As soon as the other thread (about alternate text for images) is solved, I think this would be settled for you.
BTW, I will be away for almost a week, so no testing possible. I don’t know whether I could check this tomorrow soon.
Many thanks for your patience,
Pablo
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________

On 4/16/25 00:50, Matthias Weber wrote:
Thanks Pablo, this is excellent news. There is no urgency, but I will be happy to try it out and use it.
Matthias, there is another approach with some cheating that may also work. The attached PDF document is the compilation from the source below. First you have to add math tagging in lpdf-tag-imp-testing.lmt (right after "-- no math here"): math = { pua = "ua1", pdf = "Formula" }, inlinemath = { pua = "ua1", pdf = "Formula" }, displaymath = { pua = "ua1", pdf = "Formula" }, Then you need to patch lpdf-tag.lmt: --- lpdf-tag.lmt 2025-04-15 19:44:55.157060209 +0200 +++ mkxl/lpdf-tag.lmt 2025-04-16 06:26:56.731391047 +0200 @@ -1062 +1062 @@ - -- Alt = alternate, + Alt = actualtext or nil, @@ -1064 +1064 @@ - ActualText = actualtext or nil, + -- ActualText = actualtext or nil, @@ -1090 +1090 @@ - -- Alt = alternate, + Alt = actualtext or nil, @@ -1092 +1092 @@ - ActualText = actualtext or nil, + -- ActualText = actualtext or nil, @@ -1141 +1141 @@ - Alt = pdfunicode(label ~= "" and label or "image"), + -- Alt = pdfunicode(label ~= "" and label or "image"), @@ -1142,0 +1143 @@ + parent.dict.Alt = pdfunicode(label ~= "" and label or "image") And it should work for PDF/UA-1. Please, don’t forget that I don’t use math in ConTeXt at all (only for these testings). Source for the attached PDF document: \enabledirectives [backend.usetags=testing] \setupstructure[state=start] \setupbackend [format=PDF/A-3a, intent=sRGB IEC61966-2.1, level=0] \setupbackend[format=pdf/ua-1] \setuptagging[state=start] \registermathsymbol[default][en]["1D467][the variable] \registermathsymbol[default][en]["1D458][the index] \starttext \startformula \abs {(z__0 + h)^n - z__0^n } \alignhere = \abs {\sum_{k = 1}^n \binom{n}{k} h^k z__0^{n - k} } \breakhere = \abs {h \sum_{k = 0}^{n - 1} \binom{n}{k + 1} h^k z__0^{n - 1 - k} } \breakhere = \abs {h \sum_{k = 0}^{n - 1} \frac {n}{k + 1} \binom{n - 1}{k} h^k z__0^{n - 1 - k} } \breakhere \le n \abs{h} \sum_{k = 0}^{n - 1} \binom{n - 1}{k} \abs{h}^k \abs{z__0}^{n - 1 - k} \breakhere \le n \abs{h} (\abs{z__0} + \abs{h})^{n - 1} \stopformula \registermathsymbol[default][en][lowercasebold][the vector] \startformula (\alpha + \beta) \mathbf{u} = \alpha \mathbf{u} + \beta \mathbf{u} \stopformula \stoptext I hope it helps, Pablo

Thanks Pablo, I managed to patch the files (I don’t have lpdf-tag-imp-testing.lmt but patched lpdf-tag-imp-mkiv.lmt instead, as well as lpdf-tag.lmt), and Acrobat finds the tags and is able to read the math. This will need some work, in order to have variables and symbols to be read properly, but it is a very promising beginning. Matthias
On Apr 16, 2025, at 12:32 AM, Pablo Rodriguez via ntg-context
wrote: On 4/16/25 00:50, Matthias Weber wrote:
Thanks Pablo, this is excellent news. There is no urgency, but I will be happy to try it out and use it.
Matthias,
there is another approach with some cheating that may also work.
The attached PDF document is the compilation from the source below.
First you have to add math tagging in lpdf-tag-imp-testing.lmt (right after "-- no math here"):
math = { pua = "ua1", pdf = "Formula" }, inlinemath = { pua = "ua1", pdf = "Formula" }, displaymath = { pua = "ua1", pdf = "Formula" },
Then you need to patch lpdf-tag.lmt:
--- lpdf-tag.lmt 2025-04-15 19:44:55.157060209 +0200 +++ mkxl/lpdf-tag.lmt 2025-04-16 06:26:56.731391047 +0200 @@ -1062 +1062 @@ - -- Alt = alternate, + Alt = actualtext or nil, @@ -1064 +1064 @@ - ActualText = actualtext or nil, + -- ActualText = actualtext or nil, @@ -1090 +1090 @@ - -- Alt = alternate, + Alt = actualtext or nil, @@ -1092 +1092 @@ - ActualText = actualtext or nil, + -- ActualText = actualtext or nil, @@ -1141 +1141 @@ - Alt = pdfunicode(label ~= "" and label or "image"), + -- Alt = pdfunicode(label ~= "" and label or "image"), @@ -1142,0 +1143 @@ + parent.dict.Alt = pdfunicode(label ~= "" and label or "image")
And it should work for PDF/UA-1. Please, don’t forget that I don’t use math in ConTeXt at all (only for these testings).
Source for the attached PDF document:
\enabledirectives [backend.usetags=testing] \setupstructure[state=start] \setupbackend [format=PDF/A-3a, intent=sRGB IEC61966-2.1, level=0] \setupbackend[format=pdf/ua-1]
\setuptagging[state=start]
\registermathsymbol[default][en]["1D467][the variable] \registermathsymbol[default][en]["1D458][the index]
\starttext \startformula \abs {(z__0 + h)^n - z__0^n } \alignhere = \abs {\sum_{k = 1}^n \binom{n}{k} h^k z__0^{n - k} } \breakhere = \abs {h \sum_{k = 0}^{n - 1} \binom{n}{k + 1} h^k z__0^{n - 1 - k} } \breakhere = \abs {h \sum_{k = 0}^{n - 1} \frac {n}{k + 1} \binom{n - 1}{k} h^k z__0^{n - 1 - k} } \breakhere \le n \abs{h} \sum_{k = 0}^{n - 1} \binom{n - 1}{k} \abs{h}^k \abs{z__0}^{n - 1 - k} \breakhere \le n \abs{h} (\abs{z__0} + \abs{h})^{n - 1} \stopformula
\registermathsymbol[default][en][lowercasebold][the vector]
\startformula (\alpha + \beta) \mathbf{u} = \alpha \mathbf{u} + \beta \mathbf{u} \stopformula
\stoptext
I hope it helps,
Pablo
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________

On 4/17/25 00:59, Matthias Weber wrote:
Thanks Pablo,
Hi Matthias,
I managed to patch the files (I don’t have lpdf-tag-imp-testing.lmt
I attached it to the other thread (about alternate text for images, https://mailman.ntg.nl/archives/list/ntg-context@ntg.nl/message/YEWPKPJSPTGL...).
but patched lpdf-tag-imp-mkiv.lmt instead, as well as lpdf-tag.lmt), and Acrobat finds the tags and is able to read the math.
Do as you see it fits, but it might be better to have a testing file, to avoid modifying (and having issues with) the distribution files.
This will need some work, in order to have variables and symbols to be read properly, but it is a very promising beginning.
I’m afraid I cannot help there. Math is all Greek to me. Pablo

Am Wed, 16 Apr 2025 18:59:42 -0400 schrieb Matthias Weber:
Thanks Pablo,
I managed to patch the files (I don’t have lpdf-tag-imp-testing.lmt but patched lpdf-tag-imp-mkiv.lmt instead, as well as lpdf-tag.lmt), and Acrobat finds the tags and is able to read the math. This will need some work, in order to have variables and symbols to be read properly, but it is a very promising beginning.
You should be aware that while alt is better than nothing, it has lots of problems. E.g. for braille displays it is typically much too verbose. There is nice presentation from Neil Soiffer here that demonstrate the benefits of mathml: https://www.youtube.com/watch?v=ja7gjDCN8n8&t=1201s -- Ulrike Fischer http://www.troubleshooting-tex.de/

On 4/23/25 20:06, Ulrike Fischer wrote:
[...] You should be aware that while alt is better than nothing, it has lots of problems. E.g. for braille displays it is typically much too verbose.
Many thanks for your comment, Ulrike. I thought that PDF/UA-1 didn’t allow (or at least, require) mathml.
There is nice presentation from Neil Soiffer here that demonstrate the benefits of mathml:
Interesting to know that Adobe funded PDF accessibility in LaTeX (https://youtubenuker.lol/watch?v=ja7gjDCN8n8&t=1600). Many thanks for your help, Pablo
participants (6)
-
Aditya Mahajan
-
Hans Hagen
-
Matthias Weber
-
Mikael Sundqvist
-
Pablo Rodriguez
-
Ulrike Fischer