WeBWorK Problems

ans_array and student response storage

ans_array and student response storage

by Andrew Parker -
Number of replies: 1


I may be running into an issue related to the one described in the linked topic.

Assign yourself the problem given below, and then answer it (configure problem set so that your response will be stored). Then generate a PDF with student answers and see that only the _first entry_ of your submitted answer is given in the PDF.

Minimal working example attached.

In reply to Andrew Parker

Re: ans_array and student response storage

by Glenn Rice -

This is quite different in the code than what was happening in Gateway Quizzes with extended answers.  Although it applies to all of the same types of answers.  Any extended answer in hardcopy only prints the first part of the answer.  This applies to answers that use ans_array, as well as answers that use a MultiAnswer with the singleResult option.  The reason for this is that Hardcopy.pm uses the original_student_ans inside a LaTeX verbatim environment.  The original_student_ans for an extended answer only contains the first part of the extended answer that you see.  The preview_text_string won't work in the verbatim environment, because in many cases it contains html.

I personally think that the student answers (and correct answers) in the hardcopy should not use the verbatim environment, and instead print the preview_latex_string (and correct_ans_latex_string).  It is LaTeX already, and looks better.  Of course, I understand the philosophy that the preview is not what the student entered with the default way that most use WeBWorK.  That is with the html text inputs.  I use the MathQuill answer boxes and hide the preview_text_string (Entered column) in the results table.  So the preview_latex_string is what the students see.  That generally is the same as what the students see in the MathQuill answer box.