WeBWorK Problems

typeset math in multiple choice items

Re: "graphs" in multiple choice items

by Hedley Pinsent -
Number of replies: 0
This is what I do.
The biggest downside is that the checkboxes are aligned with the bottom of the images.
Perhaps, some day, checkbox_multiple_choice will be generalized to accommodate graph (and perhaps other?) objects.

DOCUMENT();


loadMacros(
"PGstandard.pl",
"PGnauGraphtheory.pl",
"PGunion.pl",
"imageChoice.pl",
);
$showPartialCorrectAnswers = 1;

TEXT(beginproblem());

$correctG = init_graph(-1,-1,11,11,
axes=>[0,0], grid=>[12,12],
size=>[400,400]); # or pixels=>[400,400]
$correctG->lb( new Label(5,5,'correct graph','black','left','top'));

$extra1G = init_graph(-1,-1,11,11,
axes=>[0,0], grid=>[12,12],
size=>[400,400]); # or pixels=>[400,400]
$extra1G->lb( new Label(5,5,'extra #1','black','left','top'));

$extra2G = init_graph(-1,-1,11,11,
axes=>[0,0], grid=>[12,12],
size=>[400,400]); # or pixels=>[400,400]
$extra2G->lb( new Label(5,5,'extra #2','black','left','top'));

$extra3G = init_graph(-1,-1,11,11,
axes=>[0,0], grid=>[12,12],
size=>[400,400]); # or pixels=>[400,400]
$extra3G->lb( new Label(5,5,'extra #3','black','left','top'));

$cmc = new_checkbox_multiple_choice();

$cmc->qa("choose the correct graph",
image( insertGraph($correctG),
width=>400,height=>400,tex_size=>800 ));

$cmc->extra(
image( insertGraph($extra1G),
width=>400,height=>400,tex_size=>800 ),
image( insertGraph($extra2G),
width=>400,height=>400,tex_size=>800 ),
image( insertGraph($extra3G),
width=>400,height=>400,tex_size=>800 ));

BEGIN_TEXT

\{$cmc->print_q\}$BR
\{$cmc->print_a\}
END_TEXT


ANS(checkbox_cmp($cmc->correct_ans));