diff --git a/macros/parsers/parserMultiAnswer.pl b/macros/parsers/parserMultiAnswer.pl index ca3317e05..299d7705d 100644 --- a/macros/parsers/parserMultiAnswer.pl +++ b/macros/parsers/parserMultiAnswer.pl @@ -13,7 +13,7 @@ # Artistic License for more details. ################################################################################ -loadMacros("MathObjects.pl"); +loadMacros('MathObjects.pl', 'PGbasicmacros.pl'); sub _parserMultiAnswer_init { main::PG_restricted_eval('sub MultiAnswer {parser::MultiAnswer->new(@_)}'); @@ -175,7 +175,12 @@ sub single_check { my $i = 0; my $nonblank = 0; if ($self->perform_check($ans)) { - push(@errors, '' . $self->{ans}[0]{ans_message} . ''); + push( + @errors, + main::tag( + 'tr', main::tag('td', style => 'text-align:center', colspan => '2', $self->{ans}[0]{ans_message}) + ) + ); $self->{ans}[0]{ans_message} = ""; } foreach my $result (@{ $self->{ans} }) { @@ -185,26 +190,34 @@ sub single_check { push(@text, check_string($result->{preview_text_string}, '__')); push(@student, check_string($result->{student_ans}, '__')); if ($result->{ans_message}) { - push(@errors, - '' - . "In answer $i: " - . '' - . $result->{ans_message} - . ''); + push( + @errors, + main::tag( + 'tr', + main::tag( + 'td', + style => 'text-align:right;white-space:nowrap;vertical-align:top', + main::tag('i', "In answer $i") . ': ' + ) + . main::tag('td', style => 'text-align:left', $result->{ans_message}) + ) + ); } $score += $result->{score}; } $ans->score($score / $self->length); $ans->{ans_message} = $ans->{error_message} = ""; if (scalar(@errors)) { - $ans->{ans_message} = $ans->{error_message} = - '' - . join('', @errors) - . '
'; + $ans->{ans_message} = $ans->{error_message} = main::tag( + 'table', + class => 'ArrayLayout', + style => 'margin-left:auto;margin-right:auto;', + join(main::tag('tr', style => 'height: 4px', main::tag('td')), @errors) + ); } if (@{ $self->{single_ans_messages} }) { $ans->{ans_message} = $ans->{error_message} = - '
' . join('
', @{ $self->{single_ans_messages} }) . '
' . $ans->{ans_message}; + join('', map { main::tag('div', $_) } @{ $self->{single_ans_messages} }); } if ($nonblank) { $ans->{preview_latex_string} = diff --git a/macros/parsers/parserRadioMultiAnswer.pl b/macros/parsers/parserRadioMultiAnswer.pl index 00b9e2513..267d52a9a 100644 --- a/macros/parsers/parserRadioMultiAnswer.pl +++ b/macros/parsers/parserRadioMultiAnswer.pl @@ -486,19 +486,19 @@ sub answer_evaluator { main::tag( 'tr', style => 'vertical-align:top', - main::tag('td', style => 'text-align:left', $result->{ans_message}) + main::tag('td', style => 'text-align:center', $result->{ans_message}) ) ); } } for (@{ $self->{errorMessages} }) { - push(@errors, main::tag('tr', style => 'vertical-align:top', main::tag('td', style => 'text-align:left', $_))); + push(@errors, main::tag('tr', style => 'vertical-align:top', main::tag('td', $_))); } $ans->{ans_message} = $ans->{error_message} = ''; if (@errors) { $ans->{ans_message} = $ans->{error_message} = main::tag( 'table', - style => 'border-collapse:collapse', + style => 'border-collapse:collapse; margin-left: auto; margin-right: auto;', class => 'ArrayLayout', join(main::tag('tr', main::tag('td', style => 'height:4px')), @errors) );