WeBWorK Problems

Image Captions not displaying

Image Captions not displaying

by tim Payer -
Number of replies: 2
Hello,

I am writing solutions for a number of problems using traditional pg code.
In a few of the problems I am using images. While the image displays nicely, the image's associated caption is not displaying.

This is code segment in question:

\{ image( "LeaningLadder1.png", width=>432, height=>224,  
tex_size=>700, extra_html_tags=>'alt="The leaning ladder forms a right triangle." ' ) \}  

Any suggestions as to why i am not getting an image caption?
Or is that display only for the pdf version of the problem.

Thank you..
In reply to tim Payer

Re: Image Captions not displaying

by Alex Jordan -
The alt attribute is not for a caption. It's text that will display if for some reason the image is unavailable. Originally, this was useful when slow download speeds meant you would have to wait while images downloaded, so this text occupied the place where the image would be in the meantime.

Today, one of the most helpful uses of alt text is for users with visual disabilities. They can still read the words in web sites using assistive technology. Having alt text gives the assistive technology something to communicate to users like this, since the technology is not advanced enough to actually take the picture and describe it.

Since that's the main purpose of alt text for an image like this in a WeBWorK problem, the alt text should give a more literal description of what is in the picture. Close your eyes and imagine what someone would have to say to you to make you "see" the picture, or at least the important elements of it. And since this is in the context of a math problem, you also have to be careful to describe what is there, but without handing people any "answers" that they are supposed to deduce from the picture. Doing all this with WeBWorK problems is demanding, but vigilance on these kinds of things give WeBWorK high marks for web accessibility.

There isn't any way to put caption text in extra_html_tags that I know of. In the html, the caption is a separate tag from the image. The closest thing you can do that I know of is to use the title attribute. So:

extra_html_tags=>'title="The leaning ladder forms a right triangle." alt="<put some good alt text here>" '

would make it so that hovering over the image revealed this text.

But if your caption is important, then you want it to show up all the time, including when you aren't hovering and in hard copies. So some macro that does different things for HTML and TEX output modes is needed to enclose an image and put a caption under it.

This is a hack, but you could try using niceTables.pl, making a LayoutTable that is one column with two rows, putting the image in the top and the caption in the bottom. Or you could make a 1x1 DataTable, and use the macro's caption argument. Neither of these are great from a web accessibility standpoint, but perhaps better than nothing.
In reply to Alex Jordan

Re: Image Captions not displaying

by tim Payer -
Thank you Alex!

I will incorporate the nice.Tables.pl solution. I have used tables in other problems. Thanks for giving the the full description of how and why.

Tim