3

I have searched through various threads orbiting questions of accessibility in Latex. I am not interested in the full glory of a fully structured/tagged document, the only thing that I need to do is to augment figures (and maybe later tables/equations) with alternate texts such that they can be read and modified by Adobe or other PDF viewers. My understanding is that the accessibility package could in principle do this, however it suffers from issues, like not supporting the fancyhdr which is a requirement for me. In a minimum example I set up (see below), that package creates text, but no alternate texts.

I have tried both accsupp and tagpdf, I also tried pdfcomment - none of them yield a PDF with the alternate texts readable with Adobe. The furthest I got with accsupp, as the reader seems to detect there is some alternate text provided, it just does not show it.

Are there any other solutions I have not looked at? Is there any post-processing hack or something like that? I am a little surprised, because even Word exports PDFs with alternate texts showing up. Adding the alternate texts manually in Acrobat is not an option, as the documents will be changed/compiled frequently.

UPDATE:

Here is an uncompressed PDF with a tag that Acrobat recognizes. The title of the image is "This is the title" and the description (alt text) reads "This is the description":

https://wetransfer.com/downloads/69b4ee447b173ce19e15fa13a03d930220210917073415/113847b5fb92830bf9b4c0c32f6a149320210917073501/ea8762

\documentclass [a4paper,parskip,11pt]{scrreprt}
\usepackage[tagged]{accessibility}
\usepackage{graphicx}

\usepackage{xcolor} \begin{document} \newcommand{\gray}[1]{{\color{gray}#1}}

\begin{figure} \centering \includegraphics[width=0.6\textwidth]{grafik} \alt{hello} \caption{caption} \label{fig:1}

\end{figure}

\end{document}

Some threads I checked: Need alt text for images in pdf for screen readers

What is the best package for accessibility tagging?

LaTeX accessibility

1 Answers1

5

Your document is a fully tagged pdf. You can get something similar like this (this assumes a current latex):

\RequirePackage{pdfmanagement-testphase}
\DeclareDocumentMetadata{testphase=tagpdf,activate=tagging,uncompress}
\documentclass[12pt]{article}
\usepackage{graphicx}
\begin{document}

\tagpdfparaOff

\tagstructbegin{tag=Figure,alttext=This is a description}\tagmcbegin{tag=Figure} \includegraphics{example-image.png} \tagmcend\tagstructend

\tagpdfparaOn

\end{document}

I can't show a screenshot, the tool tip doesn't show up, but i can assure you that the tool tip with the alternative text is there.

enter image description here

Ulrike Fischer
  • 327,261
  • I am interested not in how, but in why. Does it make sense to overload figure \caption and use such a trick in all my future documents? Or does it make sense only in images without captions? – Oleg Lobachev Sep 17 '21 at 23:00
  • Thank you very much for your efforts. I have some trouble concerning the Latex version that I have access to (not a current one, unfortunately), I will try to solve this and come back to you. – rugermini Sep 20 '21 at 07:07
  • Well tagpdf is part of the ongoing project to all LaTeX to create tagged pdf. https://www.latex-project.org/publications/indexbytopic/pdf/. If you want to benefit from the development in this area a current TeX system is required. – Ulrike Fischer Sep 20 '21 at 07:14
  • @OlegLobachev tagging only works correctly if you tag the full document. This is not easy, so first read the documentation of tagpdf first. Apart from this: yes, an alternate text should normally always be given, the pdf/UA standard requires that. And often it should be different from the caption as it should describe the graphics to someone who can't see it. – Ulrike Fischer Sep 20 '21 at 07:18
  • Thank you again for your effort, I could confirm that this works really well in my context. It is good to see that things are moving in this respect! – rugermini Sep 20 '21 at 09:49