WeBWorK Problems

old string answer format

old string answer format

by Robert Molzon -
Number of replies: 1
I am having trouble with old style string answers. Below is the code from the MAATutorial example


Complete the sentence: $PAR
\{ ans_rule(20) \} world!

ANS( str_cmp( "Hello" ) ); # here is the answer, a string.


When I try the problem (ww2 version 2.4.1 Firefox 3.08 on Ubuntu 8.04), ww grades the answer correct but in the preview answer box I get the error message

Unknown control sequence '\verb'

This occurs with jsMath selected as the viewing mode. I get similar errors with the other viewing methods selected. The only way I can eliminate the error message is to deselect all viewing methods.

I checked the bug fixes but did not see this mentioned - sorry if I missed it. If there is a simple way to fix this without rewriting the problems it would be a big help.

In reply to Robert Molzon

Re: old string answer format

by Michael Gage -
This is a TeX error (\verb is used to display symbols verbatim). For jsMath the most likely problem is that your jsMath code in WeBWorK needs to updated to the latest jsMath version. I do remember that the ability to handle \verb was added to jsMath some time ago, but I don't remember exactly when.

I suspect the newer versions of str_cmp use \verb to better display the answer entered by the student -- for example ordinary text won't be italicized, spaces are preserved and so forth.

I'm not sure why "image" mode using dvipng would not work for you. The texpreamble file in webwork2/conf/snippets should pull in TeX code that can process \verb. One thing to remember is that the images are cached -- so if there is a mistake and you think you have fixed it you will need to clear the equations cache to make sure that you see the fix.

I tried your problem on hosted2.webwork.rochester.edu and the preview correctly handled \verb in both the image and jsMath preview.

There are maa10x courses at http://hosted2.webwork.rochester.edu/webwork2 where you can test this problem yourself -- use profa/profa as login and password.

Hope this helps with the trouble shooting.