For
reference here is the hack I came up with -- the grading portion of the
problem was not yet operational, but you've solved that.
-- Mike
DOCUMENT(); $inputs_ref->{myAnswer} =~ s/~~~~/~~~~~~~~/g; #hack to handle backslashes loadMacros( PG.pl, PGbasicmacros.pl, PGchoicemacros.pl, PGanswermacros.pl, PGauxiliaryFunctions.pl ); sub NAMED_TEX_BOX { my($name,$row,$col) = @_; my $essay_name = "${name}_ESSAY_BOX"; $row = 10 unless defined($row); $col = 80 unless defined($col); $essay_name = RECORD_FORM_LABEL($essay_name); my $len = 0.07*$col; my $height = .07*$row; my $answer_value = ''; $answer_value = $inputs_ref->{$essay_name} if defined( $inputs_ref->{$essay_name} ); $answer_value =~ tr/$@`//d; ## make sure student answers can not be interpolated by e.g. EV3 my $print_string = $answer_value ||''; $print_string =~ s/+/\/g; # prevent weirdness with backslashes $answer_value =~ s/+//g; my $out = M3( qq!vskip $height in hrulefillquad !, qq!begin{rawhtml}<TEXTAREA NAME="${essay_name}" ROWS="$row" COLS="$col" WRAP="VIRTUAL">$answer_valueend{rawhtml}!, qq!<TEXTAREA NAME="$essay_name" ROWS="$row" COLS="$col" WRAP="VIRTUAL">$answer_value! ); $out = "$HR Answer: $BR". $out; $out = $out. EV3($BR,"Typeset version of answer:", $BR,$print_string, $HR) if $print_string; $out.= NAMED_ANS_RULE($name, 10); $out; }
TEXT(beginproblem()); $showPartialCorrectAnswers = 0; BEGIN_TEXT $HR Let (R ) be a collection of subsets of (X) with the property that the intersection of any two elements (A) and (B) of (R) is the union of elements of (R). ( A cap B = cup I_alpha ) where (I_alphain R). $PAR
Statement: $PAR The collection of sets (S) which consists of all elements of (R) and all unions of elements of (R) is a topology.
Show that the statement is true, or supply a counter-example. You can also modify the statement if it's almost true.
END_TEXT
TEXT($PAR,NAMED_TEX_BOX('myAnswer',20, 80));
NAMED_ANS('myAnswer'=>num_cmp(10));
TEXT("$HR This statement is ",ans_radio_buttons(T=>'true',F=>'false',NT=>'nearly true','%d'=>"don't know yet")); ANS(radio_cmp('T'));
ENDDOCUMENT(); # This should be the last executable line in the problem.
<| Post or View Comments |>
|