WeBWorK Problems

equations in Pop-Up Lists

equations in Pop-Up Lists

by Manuele Santoprete -
Number of replies: 1
We would like to create some problems where equations are used in the pop-up lists.

Ideally we would like to be able to use latex code in it, and be able to view equations as images.
At the moment we found two workarounds 

1)  Use $$ equation $$ to introduce equations into pop-up lists, as in the example below:

\{ pop_up_list([' ','$$\vec{u}+\vec{v}=\vec{0}$$','B', 'C', 'D]') \}

This approach has two  disadvantages: A)it only works with  MathJax, B) it does not work for all browsers. More specifically, according to our tests,  it  works on Firefox and Safari, it doesn't work on Chrome and IE. 

2) Use unicode characters. In this way it  is possible to display most equations in a readable  way. However, this does't display properly on some browsers/computers. 

Is there a better way of introducing equations in pop-up lists? 




In reply to Manuele Santoprete

Re: equations in Pop-Up Lists

by Davide Cervone -
The pop-up menus are produced using the browser's implementation of <select>, which usually means use the OS menu system. In general, these do not let you include HTML, and that means you can't include math in menu items. It looks like recent versions of Safari and Firefox are the exceptions (I wasn't aware of that), but it is not something you can count on, as you have noted.

Because you can't really put HTML in the menus in general (and certainly couldn't when the pop-up code was written), the pop-up doesn't try to replace its entries with images when you are using image mode (it's only because MathJax processes the page after it is produced that it works with MathJax).

Unicode does work more universally, but not always, as it depends on having appropriate fonts available on the user's system, and some browsers (notably IE on Windows XP) don't always locate the fonts even when they are installed, so it is touch and go for that.

The only solution I can think of is to implement an HTML-based menu system instead so that the menu items can contain images or MathJax output. There are certainly menu libraries that could be used (indeed, MathJax has one of its own), but it would take some work to hook it into WeBWorK.

Davide