[Tugindia] alt text for figures

Ambika Vanchinathan ambikav at yahoo.com
Wed Apr 28 14:41:24 CEST 2010


Hi,
I inserted the macro in the TeX file, inserted alttext command with a text
for figure and compiled using pdflatex.  When I checked the pdf in Acrobat
Pro--Advanced--Accessibility--Touch up reading order--figure, I get "no
alternate text exists" on selecting a figure. Am I missing something? Is there any
other way to check the alternative text given in the file? Kindly suggest.

Regards,
Ambika




________________________________
From: Radhakrishnan CV <cvr at river-valley.org>
To: TUGIndia Mailing List <tugindia at tug.org>
Sent: Tue, April 27, 2010 1:08:55 PM
Subject: Re: [Tugindia] alt text for figures

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:

\makeatletter

\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{%
          /Span<<%
           /Lang(en-us) 
           /Alt \alttext at alt
%           /ActualText \alttext at alt
          >>%
         }%
    \alttext at bdc
    \alttext at space
      #2
    \alttext at emc}

\makeatother

The usage can be of the form:

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

If you make 

\pdfcompresslevel=0
\pdfobjcompresslevel=0

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
-- 
Radhakrishnan
Before I knew the best part of my life had come, it had gone.
_______________________________________________
Home:        http://www.tug.org.in/
TeX FAQ:     http://www.tex.ac.uk/faq
unsubscribe: http://tug.org/mailman/listinfo/tugindia



      


More information about the tugindia mailing list