Skip to content

Commit

Permalink
Merge pull request #2413 from drgrice1/bugfix/hardcopy-fallback
Browse files Browse the repository at this point in the history
The fallback original_student_ans can not be in math mode text in hardcopy.
  • Loading branch information
pstaabp committed May 15, 2024
2 parents 2062a7f + 3ebc0f1 commit d6413cb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/WeBWorK/ContentGenerator/Hardcopy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1313,15 +1313,18 @@ async sub write_problem_tex ($c, $FH, $TargetUser, $MergedSet, $themeTree, $prob
if (defined $pg->{answers}{$ansName}{preview_latex_string}
&& $pg->{answers}{$ansName}{preview_latex_string} ne '')
{
$stuAns = $pg->{answers}{$ansName}{preview_latex_string};
$stuAns = "\$\\displaystyle $pg->{answers}{$ansName}{preview_latex_string}\$";
} elsif (defined $pg->{answers}{$ansName}{original_student_ans}
&& $pg->{answers}{$ansName}{original_student_ans} ne '')
{
$stuAns = "\\text{" . $pg->{answers}{$ansName}{original_student_ans} . "}";
$stuAns =
"\\begin{verbatim}"
. ($pg->{answers}{$ansName}{original_student_ans} =~ s/\\end\{verbatim\}//gr)
. "\\end{verbatim}";
} else {
$stuAns = "\\text{no response}";
$stuAns = "no response";
}
$stuAnswers .= "\\item\n\$\\displaystyle $stuAns\$\n";
$stuAnswers .= "\\item\n$stuAns\n";
}
$stuAnswers .= "\\end{itemize}}$corrMsg\\par\n";
print $FH $stuAnswers;
Expand Down

0 comments on commit d6413cb

Please sign in to comment.