[Tugindia] alt text for figures

Radhakrishnan CV cvr at river-valley.org
Tue Apr 27 09:38:55 CEST 2010

On 26-Apr-2010, at 8:45 PM, Ambika Vanchinathan wrote:

> Hi,
> Is there any option in LaTeX/PdfLaTeX to get the alternative text for figures in the pdf? Kindly suggest.

Here is one way of doing it with pdfLaTeX:


\let\alttext at space\space
\def\alttext at bdc{%
  \pdfliteral page{\alttext at span BDC}}
\def\alttext at emc{\pdfliteral direct{EMC}}
\def\alttext#1#2{\def\alttext at alt{(#1)}%
     \edef\alttext at span{%
           /Alt \alttext at alt
%           /ActualText \alttext at alt
    \alttext at bdc
    \alttext at space
    \alttext at emc}


The usage can be of the form:

 \alttext{This is a figure}{\includegraphics{<figure file name>}}

If you make 


you can look into the pdf file for the correctness of the inserted literals and check if it agrees with PDF specifications.  In my test, it created correct code, but not sure if it can meet your requirements.

Best regards
Before I knew the best part of my life had come, it had gone.

More information about the tugindia mailing list