## WeBWorK Problems

### Problems with NAMED_ANS_RADIO in PGbasicmacros.pl

by Andrew Parker -
Number of replies: 1
I found an error in generating TeX code when using parserRadioButtons.pl

The problem arises when attempting to use answers that containing "$" - both from using contextCurrency.pl or by including$DOLLAR in the multiple choice responses. (The latter is not recommended, as the correct answer will still return incorrect to the student - which is a separate problematic issue, though fixed by using "Currency".)

When WeBWorK attempts to generate the TeX file for an assignment containing such a problem, the code for the multiple choice responses gets converted to a double-escaped "\\$" instead of "\$" as one would expect. I'm not sure where the extra escape character is coming from either.

I hacked the problem by inserting "$tag =~ s/\\\$/\$/; into the code for NAMED_ANS_RADIO and NAMED_ANS_RADIO_EXTENSION in PGbasicmacros.pl, which had the result of producing a properly functioning TeX file. I would have used s/\\\\\$/\\\$/; but this had no effect - suggesting that the additional escape character is being added further down the line somewhere? So, I suspect that this is an inappropriate place for this hack and perhaps some code elsewhere should be checking whether or not this "$" is already escaped...