Re: Support alt text in LaTeX output

David Carlisle <[email protected]> Fri, 24 Jul 2026 23:05:05 +0100
Newsgroups gmane.comp.tex.texinfo.bugs
Message-ID <CAEW6iOgcFsvQH5Df=s9yFqoC17vhMkCzi8vBua06mOw5pen5SQ@mail.gmail.com>
--00000000000072fb0e065762915d
Content-Type: text/plain; charset="UTF-8"

>  From what I understood from the input shown by David (`@center
@image{./flowchartdemo,www,hhh,a flowchart}` ), I think that the
`actualtext`  option would be difficult to use as the input doesn't make
the distinction. But it would be good if an existing non-empty alternative
text is at least added as `alt={text}`, and if an empty or missing
alternative text is mapped to the key `artifact`.


I think that texi2any can always add the alt text if it is there. If you
want to support older latex use

\usepackage{graphicx}
\makeatletter
\define@key{Gin}{alt}{}
\makeatother

I tested this on overleaf back to a 2014 release
https://www.overleaf.com/read/zpjhtwqxdwtt#76f551

although actually it would work back to 1993 (it's my code:-)

I don't think that a missing alternative text in the texinfo source should
be mapped to artifact, that would cause the image to be completely
omitted from screen readings and derived html etc.

If the author hasn't added alternative text for the image just don't use
alt at all. LaTeX, if tagging is enabled, will use the filename as alt text
and warn the user, which might encourage them to add a better image
description, but that's the author's choice, not something fixable in the
texinfo or latex processing.

As I commented on github I think perhaps that's _all_ you need to do. If
you start to add options to add
\DocumentMetadata{} and other tagging related declarations you may end up
needing multiple options to control exactly what gets added and in practice
anyone processing the generated latex can add these as needed anyway.

David
hopefully moving this to the bug-texinfo list without cross linking to the
latex github.

--00000000000072fb0e065762915d
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><br></div><div>&gt;=C2=A0
From what I understood from the input shown by David (`@center=20
@image{./flowchartdemo,www,hhh,a flowchart}` ), I think that the=20
`actualtext` =C2=A0option would be difficult to use as the input doesn&#39;=
t make
 the distinction. But it would be good if an existing non-empty=20
alternative text is at least added as `alt=3D{text}`, and if an empty or=20
missing alternative text is mapped to the key `artifact`.</div><div><br></d=
iv><div><br></div><div>I think that texi2any can always add the alt text if=
 it is there. If you want to support older latex use</div><div><br></div><d=
iv>\usepackage{graphicx}<br>\makeatletter<br>\define@key{Gin}{alt}{}<br>\ma=
keatother</div><div><br></div><div>I tested this on overleaf back to a 2014=
 release</div><div><a href=3D"https://www.overleaf.com/read/zpjhtwqxdwtt#76=
f551">https://www.overleaf.com/read/zpjhtwqxdwtt#76f551</a></div><div><br><=
/div><div>although actually it would work back to 1993 (it&#39;s my code:-)=
</div><div><br></div><div>I don&#39;t think that a missing alternative text=
 in the texinfo source should be mapped to artifact, that would cause the i=
mage to be completely omitted=C2=A0from screen readings and derived html et=
c.</div><div><br></div><div>If the author hasn&#39;t added alternative=C2=
=A0text for the image just don&#39;t use alt at all. LaTeX, if tagging is e=
nabled, will use the filename as alt text and warn the user, which might en=
courage them to add a better image description, but that&#39;s the author&#=
39;s choice, not something fixable in=C2=A0the texinfo or latex processing.=
</div><div><br></div><div>As I commented on github I think perhaps that&#39=
;s _all_ you need to do. If you start to add options to add</div><div>\Docu=
mentMetadata{} and other tagging related declarations=C2=A0you may end up n=
eeding multiple options to control exactly what gets added and in practice =
anyone processing the generated latex can add these as needed anyway.</div>=
<div><br></div><div>David</div><div>hopefully moving this to the bug-texinf=
o list without cross linking to the latex github.</div><div><br></div></div=
>

--00000000000072fb0e065762915d--