';
+ if ($Apache::lonhomework::type eq 'exam') {
+ $result .= ''.($Apache::lonxml::counter+$increment). ') | ';
+ } else {
+ $result .= 'Answer for Part:'.$Apache::inputtags::part.' | ';
+ }
+ $result .= "\n";
+ }
+ return $result;
+}
+
+sub answer_part {
+ my ($type,$answer) = @_;
+ my $result;
+ if ($env{'form.answer_output_mode'} eq 'tex') {
+ my $to_use='|';
+ foreach my $value (32..126) {
+ my $char=pack('c',$value);
+ if ($answer !~ /\Q$char\E/) {
+ $to_use=$char;
+ last;
+ }
+ }
+ if ($answer ne '') {
+ push(@answer_bits,'\verb'.$to_use.$answer.$to_use);
+ }
+ } else {
+ $result = ''.$answer.' | ';
+ }
+ return $result;
+}
+
+sub answer_footer {
+ my ($type) = @_;
+ my $result;
+ if ($env{'form.answer_output_mode'} eq 'tex') {
+ my $columns = scalar(@answer_bits);
+ $result = ' \vskip 0 mm \noindent \begin{tabular}{|'.'c|'x$columns.'}\hline ';
+ $result .= join(' & ',@answer_bits);
+ $result .= ' \\\\ \\hline \end{tabular} \vskip 0 mm ';
+ } else {
+ $result = '