WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: how to detect images having math expressions

for

From: Jukka K. Korpela
Date: Jun 4, 2008 3:50AM


Shrirang Prakash Sahasrabudhe wrote:

> Is there any programmatic way of detecting use of math expressions
> inside images?

Yes, but nothing practical for the purposes of accessibility testing.
There are programs that scan images for text in them, but math
expressions are very hard in this respect, partly because they contain
special symbols and are often two-dimensional. And how would you
distinguish, say, a short formula containing Greek letters from
non-mathematical text?

> How do existing accessibility checkers deal with it?

They don't.

> Something like looking at height and width?
> "This error is generated for all img elements that have a width and
> height greater than 100. "

That would be surely wrong. A large image can be just anything, and a
math expression can be very compact and fit into small space.

> http://checker.atrc.utoronto.ca/servlet/ShowCheck?check=135

It's about a guideline "All img elements with images containing math
expressions have equivalent MathML markup."

That's rather absurd, since adding MathML is of very little practical
value (for accessibility or otherwise) and takes quite a lot of work if
we count the initial labor needed to dig into MathML, and why shouldn't
we?

Moreover, the page really suggests the wild guess based on dimensions.
No wonder accessibility promotion has a bad reputation in some circles.
The "test process" would just throw images (except, arbitrarily, small
images) at a human tester and ask him to decide whether the image
contains a math expression, and the decision text is "Does this image
contain any math statements that are not described in the document?"
which is something quite different from guideline presented.

There's worse. The page says that an XHTML + MathML page (which is by
its format currently inaccessible to most users!) will pass the test
when it has

<img src="quadeqn.png" alt="solution to the quadratic equation"
width="179" height="63">

apparently because the MathML code is assumed to give the actual
solution. The alt="..." attribute is simply inadequate, since it is not
a _replacement_ for the image. It does not tell the solution. A correct
(though perhaps not optimal) alt attribute would be
alt="(-b&plusmn;sqrt(b&sup2;-4ac))/2"
or, equivalently,
alt="(-b±sqrt(b²-4ac))/2"
(You might consider appending " where sqrt means square root".)

Often, for complex formulas, there is no good solution to the
accessibility issue, since the formula cannot be easily presented in
plain text (in alt="...") or as HTML text. But it is better to face this
rather than require MathML and claim that a page passes accessibility
test when the most important content is not accessible without seeing
the image (except to very few people via MathML).

For further bogosity, the "passing" example isn't even well-formed XML,
so even Firefox refuses to display it. (Missing "/" in the <img> tag.)

Some notes of mine on presenting math formulas on web pages:
http://www.cs.tut.fi/~jkorpela/math/

Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/