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

9
  • Marginally related, insofar as equation accessibility: tex.stackexchange.com/questions/454944/… Sep 16, 2021 at 18:18
  • 1
    Alt text can be added in various places, I would need an example, uncompressed pdf with a working alt text of the type you want to add to be able to tell you if and how you can do it with latex. Sep 16, 2021 at 22:02
  • What happened when you tried \pdftooltip{} from the PDFcomment package? There's an approach described here. It used to work, but I have not tried it for a while. Sep 17, 2021 at 5:51
  • @AndyClifton unfortunately, I do not have access to Adobe Pro which I think is necessary for using that path.
    – rugermini
    Sep 17, 2021 at 7:25
  • 2
    that is a tagged pdf, and you can do this with tagpdf. Sep 17, 2021 at 18:41

1 Answer 1

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

5
  • 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? Sep 17, 2021 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, 2021 at 7:07
  • Well tagpdf is part of the ongoing project to all LaTeX to create tagged pdf. latex-project.org/publications/indexbytopic/pdf. If you want to benefit from the development in this area a current TeX system is required. Sep 20, 2021 at 7: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. Sep 20, 2021 at 7: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, 2021 at 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.