WeBWorK Problems

TeX in popup

TeX in popup

by Bruce Yoshiwara -
Number of replies: 1
How do we include math expressions (say \leq, a nonstrict inequality symbol) within a popup list?

Can we include more elaborate expressions, like \red{x=\frac{-b\pm\sqrt{b^2-4ac}}{2a} }?

Thanks.
In reply to Bruce Yoshiwara

Re: TeX in popup

by Davide Cervone -
There is no easy way to do either of these things. The popup lists (i.e., pulldown menus) are implemented through the HTML <SELECT> tag, and it is not possible to insert mathematics within the menu items using the standard WeBWorK mechanisms. Indeed, the only way I can think of would be to use the Unicode character points for the symbols you want to insert. For example, the less-than-or-equal-to symbol is "&#x2264;", and you can probably get that into a popup menu. But it is a hack, and you will not be able to accomplish everything this way. For example, the fraction you are requesting could not be handled that way. Also, this requires the student to have fonts that include the proper math symbols, and there is no guarantee that that will be the case. Finally, there are browser compatibility issues: some browsers will font the font automatically, others require the font-family to be specified explicitly (this has been my experience with MSIE, at least).

It would be possible to implement one of the javascript-based pulldown menu approaches, which would allow arbitrary HTML within the menu items, including images or jsMath versions of mathematics. That is not for the feint of heart, however.

Your best choice may be to enter the mathematics in the "algebra" notation that students need to type in for their answers. For example, "[-b +- sqrt(b^2-2ac)]/(2a)" or something similar.

Davide