On Sat, Jul 25, 2026 at 08:58:35AM +0100, David Carlisle wrote:
> Sorry, replying to myself
>
> \makeatletter
> \providecommand\KV@Gin@alt{}
> \makeatother
>
> would be preferable to
>
> \makeatletter
> \define@key{Gin}{alt}{}
> \makeatother
>
> so that it only does something if alt processing is not already defined
> (otherwise the user would need to remove this if adding \DeclareMetada)
>
> David
Thanks, it should be no problem to use this then and output the alt
information without any customization variable or option needing to be
added to texi2any.
I looked at the documentation of the "graphicx" package (link at
https://ctan.org/pkg/graphicx?lang=en) and the manual does not appear to
contain the strings "providecommand" or "KV" anywhere.
It would be good if we could reference some documentation explaining
why we use these commands. This could help people in the future coming
back to this code if they are wondering why it works.
(Rant: In my experience I do not like seeing comments in source code like
"Information from David Carlisle, bug-texinfo 2026-07-26" - with people's
names. (We attribute in git commit messages and ChangeLog entries, but
reading these should be considered optional for future readers of the
code.) It doesn't actually add much useful information and actually makes
the code harder to modify - future hackers may think "If I change this am
I deleting some important historical information, or making the comment
incorrect?")
I found references online to a "keyval" package. Would a comment like
the following be accurate?
"In the 'keyval' package, in "Gin" family, set "alt" to "", if not already
set. This is used to support output of the "alt" attribute for images in
older versions of graphicx."
That should give people enough pointers to research what keyval is and
how graphicx uses it.