I want to write some mulitple choice problems, and I was hoping that PGML would make everything simple, but apparently not. In particular it seems that PGML can't do latex on multiple choice answers. That's discouraging.
Should I just stick with plain vanilla PG?
I'm not the best person to answer this, but I'll make a stab at it. Because one can frame multiple choice questions in several different ways in WeBWorK, I think this is possible in a couple of different ways. Here's one:
loadMacros( "parserPopUp.pl", "PGML.pl" ); ... @options = ( '\(\sin(x)\)', '\(\cos(x)\)', '\(\tan(x)\)' ); $i = random(0,2,1); $pop = PopUp( [ @options ], $options[$i] ); BEGIN_PGML The [$i] entry in the array ([@ join(", ", @options) @]*) is [__]{$pop} END_PGML ...
There a number of samples that do similar things in the Subject Area Templates page of the wiki: most of those have both standard PG and updated PGML example templates.
The second question is whether it is possible to embed LaTeX in multiple choice problems. I believe the above example does this. The checkbox_multiple_choice and similar macros from the old PGchoicemacros.pl file also support LaTeX. For example, the following will work in PGML, though it doesn't take advantage of PGML's careful linking of questions and answers:
loadMacros( "PGchoicemacros.pl", "PGML.pl" ); ... $mc->qa( 'Enter one of \(\sin(x)\), \(cos(x)\)', '\(\sin(x)\)','\(\cos(x)\)' ); $mc->extra( '\(\tan(x)\)' ); BEGIN_PGML [@ $mc->print_q() @]* [@ $mc->print_a() @]* END_PGML ANS( checkbox_cmp( $mc->correct_ans() ) ); ...
This is also shown in the subject area templates.
Gavin
Gavin
Checkboxes and other items don't have that limitation.
DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGML.pl",
"PGchoicemacros.pl"
);
TEXT(beginproblem);
@rowForms = ( '\(B_R(N) = N\)',
'\(B_R(N) = D\)',
'\(B_R(D) = N\)',
'\(B_R(D) = D\)' );
$mcRow = new_checkbox_multiple_choice();
$mcRow -> qa( "What is the best response function for the row player?",
$rowForms[0], $rowForms[2] );
$mcRow -> extra( $rowForms[1], $rowForms[3] );
BEGIN_PGML
[@ $mcRow -> print_q() @]*
[@ $mcRow -> print_a() @]*
END_PGML
##############################
$showPartialCorrectAnswers = 0;
ANS( checkbox_cmp( $mcRow->correct_ans() ) );
##############################
ENDDOCUMENT();
This produces no errors, but the question is displayed like this (attached).
\(...\)
when it is in the page, MathJax processes the math when the page is loaded, even though PGML didn't process it.
OK, found it, I think. Is this the one?
PGML.pl | 9 months ago |
from
https://github.com/openwebwork/pg/tree/master/macros?
@Paul, sorry, I didn't see you had already answered it.
[@...@]***
with three stars. See Workshop2-PM-PGML problem 19 for details.
What is the best response function for the row player?*** <BR><INPUT TYPE=CHECKBOX NAME="AnSwEr0001" id="AnSwEr0001" VALUE="A" ><B> A. </B> \(B_R(N) = D\) <BR><INPUT TYPE=CHECKBOX NAME="AnSwEr0001" id="AnSwEr0001" VALUE="B" ><B> B. </B> \(B_R(N) = N\) <BR><INPUT TYPE=CHECKBOX NAME="AnSwEr0001" id="AnSwEr0001" VALUE="C" ><B> C. </B> \(B_R(D) = D\) <BR><INPUT TYPE=CHECKBOX NAME="AnSwEr0001" id="AnSwEr0001" VALUE="D" ><B> D. </B> \(B_R(D) = N\)<BR> ***
What version of webwork do I need?
A google search on "webwork Workshop2-PM-PGML" returns nothing. Do you have the link?
Or did you mean "Workshop-2PM-PGML"?
You need an updated copy of PGML.pl (not yet even in the develop branch). I've attached it here. Put it in your course's templates/macros folder.
For future reference:
How am I supposed to find out things like the *** syntax? I don't see it anywhere at http://webwork.maa.org/wiki/Category:PGML
What repository do you use? I just tried github's Webwork2, but that version of PGML.pl apparently wasn't new enough. Is the version you attached from a dev branch?
I'm surprised to hear that now is the first time PGML has been used extensively in a workshop; I thought PGML had been the standard for the last several years.
BEGIN_TEXT/END_TEXT
. This time we used PGML as the primary method of writing the problems, and I think it has worked much better, but we did find some problems that needed to be addressed. I'm sure others who have been using PGML have run into them in the past, but few people report the problems. Having the class working with it and having immediate feedback about what doesn't work, as well as trying to convert all our course materials to use PGML, has meant that we have made some important improvements to PGML over the past few weeks.
would randomize the order of "Red","Blue","Green" and put "None of these" at the end. I think that now, this would make them all be printed in the given order, not randomized. But now there is syntax like:
will randomize the order of the first three. You can even do things like:
forcing "Red" to be first, and other such complications.
I find it nicer to specify the correct answer by its index, which I did not know was possible for a long time. So you can do:
where the "1" is the index (sort of) of "Blue".