WeBWorK Problems

The 'less than' symbol disappears from answers if entered all by itself

The 'less than' symbol disappears from answers if entered all by itself

by Alexander Basyrov -
Number of replies: 2
We are using webwork 2.7, pg 2.7 and math4 theme.
There are a few problems that ask the student to enter the '<' sign in their answer, e.g., problem
Utah/Business_Algebra/set3_Inequalities_and_Linear_Programming/p01.pg

What happens, is that the symbol '<' disappears from student answer if it is entered by itself. If the answer is entered as '< ', then it stays in the answer field.

I traced the issue to the call to HTML::Scrubber in the Problem.pm file. The scrubber does not seem to like strings that consist of '<' symbol only.

What is the best way to fix the issue?

-- Alex

p.s. It appears that HTML::Scrubber is better suited for something that is known to be valid HTML, I don't think that it is reasonable to expect the student answers to be in valid HTML form. Maybe there is a better way to sanitize student answers?
In reply to Alexander Basyrov

Re: The 'less than' symbol disappears from answers if entered all by itself

by Alex Jordan -
This reply gets around your issue. With problems where the student should know a priori that the answer is one of a few options, like say '<', '>', '<=', '>=', '=', or '!=', I advocate using radio buttons or a popup/dropdown menu rather than asking the students to type these things in. If for no other reason, you then do not have to take any measures to address excess spacing as with ' <'.

I've had success getting LaTeX to behave with radio buttons. With popup menus, not so much. But you can save your .pg file using extended characters and put things like ≥ into those menus.
In reply to Alex Jordan

Re: The 'less than' symbol disappears from answers if entered all by itself

by Paul Pearson -
Hi all,

Using characters such as '<' and '>' in a popup does not work in the development version of webwork (approximately version 2.7.?) as I recently discovered. My temporary 'fix' was to replace '<' by 'less than' and '>' by 'greater than' in the popup. This temporary fix only works for pg problems which have been edited in this way, rather than working for all pg problems all at once. We should find a better global fix.

Best regards,

Paul Pearson