On Sat, 25 Jul 2026 at 17:19, Patrice Dumas <[email protected]> wrote:

> On Sat, Jul 25, 2026 at 02:08:47PM +0100, David Carlisle wrote:
> > Not sure if you want to document this, or perhaps only for your own
> > information, if alt was passed through the following would be enough to
> > generate tagged pdf usable for a screen reader
> >
> > texi2any --latex -I . -o asymptote.tex asymptote.texi
> >
> > to get asymptote.tex then run lualatex through a file say
> > asymptote-tagged.tex that contains just
> >
> >
> > \DocumentMetadata{tagging=on,
> >   pdfstandard=UA-2
> > }
> > \AtBeginDocument{\hypersetup{pdftitle=asymptote manual}}
> > \RequirePackage{unicode-math}
> > \input{asymptote}
>
> We could output that kind of code based on a customization variable too.
>

Ok I leave the architecture for the texi2any interface to you.

There are other options, I showed the simplest default DocumentMetadata,
that produces PDF 2.0 with PDF/UA-2  accessibility standard.

You could however have

\DocumentMetadata{tagging=on,
  pdfstandard={UA-2,A-4f},
  tagging-setup={math/setup=mathml-SE}
}

which also asserts conformance to the PDF/A (long term archival) standard
as well as UA-2
and uses MathML Structure elements rather than MathML Associated files for
Math. That last
ought to be an implementation detail of the internal pdf encoding but some
systems support one better than the other.

despite being a standard for almost a decade PDF 2 isn't universally
supported so some people may want to make PDF 1.7 (and its PDF/UA-1
standard which is not as good especially for mathematical documents) but

\DocumentMetadata{
pdfversion=1.7,
pdfstandard=ua-1
}

which is why I thought perhaps you wouldn't want to generate this and just
tell people what they need to do,  but as I say
that is up to you, it probably helps if you can generate the main PDF2,
PDF/UA-2 declaration.




similarly in the main generated preamble it's generating

\documentclass{book}

I'd typically want

\documentclass[a4paper]{book}

to get A4 paper size

(perhaps you already have that configuration, sorry it's been a while (er
30 years I think) since I really used texinfo:-)







> Should \usepackage{unicode-math} replace \usepackage{amsmath} or should
> it be there in addition?


unicode-math internally inputs amsmath first, changes things for unicode
then prevents it being re-loaded
so technically the document can have both in either order  and it's
equivalent to just having unicode-math
but just having one or the other is perhaps clearer.


And is \usepackage{amsfonts} needed/useful if
> \usepackage{unicode-math} is in the header?
>

No not needed and not useful (but not uncommon of course when updating
documents so unicode-math can cope)


>
> > If texinfo has the document title to hand it could probably add that by
> > default as well but as you see if it doesn't it's not too bad I just need
> > AtBeginDocument here so the setting is delayed until hyperref package is
> > loaded.
>
> We should add it by default, as we have ways to get a title that should
> make sense, using @settitle or other possibilities as we do for HTML
> output.
>
>
That would be good



> We cannot know if there are characters that would be problematic, both
> in alt= for images and in the pdftitle=.  Which characters should be
> escaped and how?  Is that described somewhere that could be used for all
> the graphicx/hyperref options?
>

the pdftitle and  alt text in includegraphics in the end have to be a PDF
encoded string with no markup, so
over the years latex has got better at "cleaning up text" basically now any
unicode text should work, the only characters that you need to quote are %
{ }  as for instance

\includegraphics[alt={something about % increase}]{some image}

would comment out everything after the % unless you use \% but that is
nothing specific to this key it is general tex syntax.

Note the {} used here as in alt={...}  are not normally required but allow
[ and ] to be used without closing the overall [] optional argument.

\includegraphics[alt=text with ], width=3cm]{image}

will not parse correctly

\includegraphics[alt={text with ]}, width=3cm]{image}

"hides" the ] so it does not terminate the argument.

The current code also makes a "best attempt" to make a plain text string if
there is latex markup such as font changes that can be silently ignored,
but that will fail if you push it too far, best to document that these
should be plain text (especially as you'll want the same texinfo source to
cleanly convert to html alt attributes with overlapping requirements)



> --
> Pat
>

David

Reply via email to