From: Sam H. v. a. <we...@ma...> - 2005-10-10 22:34:41
|
Log Message: ----------- make sure there are answer blanks before printing \begin{itemize}. fixes bug #859. Modified Files: -------------- webwork2/lib/WeBWorK/ContentGenerator: Hardcopy.pm Revision Data ------------- Index: Hardcopy.pm =================================================================== RCS file: /webwork/cvs/system/webwork2/lib/WeBWorK/ContentGenerator/Hardcopy.pm,v retrieving revision 1.66 retrieving revision 1.67 diff -Llib/WeBWorK/ContentGenerator/Hardcopy.pm -Llib/WeBWorK/ContentGenerator/Hardcopy.pm -u -r1.66 -r1.67 --- lib/WeBWorK/ContentGenerator/Hardcopy.pm +++ lib/WeBWorK/ContentGenerator/Hardcopy.pm @@ -813,11 +813,12 @@ print $FH $pg->{body_text}; # write the list of correct answers is appropriate - if ($showCorrectAnswers && $MergedProblem->problem_id != 0) { + my @ans_entry_order = @{$pg->{flags}->{ANSWER_ENTRY_ORDER}}; + if ($showCorrectAnswers && $MergedProblem->problem_id != 0 && @ans_entry_order) { my $correctTeX = "\\par{\\small{\\it Correct Answers:}\n" . "\\vspace{-\\parskip}\\begin{itemize}\n"; - foreach my $ansName (@{$pg->{flags}->{ANSWER_ENTRY_ORDER}}) { + foreach my $ansName (@ans_entry_order) { my $correctAnswer = $pg->{answers}->{$ansName}->{correct_ans}; $correctTeX .= "\\item\\begin{verbatim}$correctAnswer\\end{verbatim}\n"; # FIXME: What about vectors (where TeX will complain about < and > outside of math mode)? |