I was trying to use unionLists for number problems, but on our server I always get numbers when I expect a numeration with letters. See the attached image for what I see.
On the PREP course, the question behaves as expected. It seems that WebWork on our server doesn't have the same macros (?). This is probably related to a problem that John Travis has been working on with our system administrator (who is now on vacation until July 14th).
But if the problem is something I can address, please let me know.
## DESCRIPTION
## Complex Variables
## ENDDESCRIPTION
## KEYWORDS('Complex')
## Tagged by mewaggoner
## Date('3Jul2014')
## Author('Murphy Waggoner')
## Institution('Simpson')
DOCUMENT(); # This should be the first executable line in the problem.
######################################
# Preamble
#"PGchoicemacros.pl",
#"PGanswermacros.pl",
loadMacros(
"PG.pl",
"PGbasicmacros.pl",
"MathObjects.pl",
"PGauxiliaryFunctions.pl",
"PGcomplexmacros.pl",
"contextLimitedComplex.pl",
"unionLists.pl"
);
TEXT(beginproblem());
######################################
# Setup
# if I use Context("LimitedComplex"); here the question won't compile
Context("Complex");
# create four complex numbers
$a = Complex( non_zero_random( -5, 5, 1 ), random( 1, 10, 1 ));
$b = Complex( non_zero_random( -5, 5, 1 ), random( -10, -1, 1 ));
$c = Complex( 0, non_zero_random( -5, 5, 1 ));
$d = Complex( non_zero_random( -5, 5, 1 ), 0);
# Create four real numbers
$e = Real(non_zero_random(-5, 5, 1));
$f = Real(random(3, 7, 2));
$g = Real(non_zero_random(-5, 5, 1));
$h = Real(random(0, 9, 1));
# Create a list with the answers for checking later
$answer[0] = Complex("conj($a)");
$answer[1] = Complex("conj($b)");
$answer[2] = Complex("conj($c)");
$answer[3] = Complex("conj($d)");
$answer[4] = Complex("conj($e + (1 - sqrt($f) ) i)");
$answer[5] = Complex("conj($g* i + $h)");
$num_ans = @answer;
# If I put Context("LimitedComplex"); here the student can still
# get the answer right by entering conj(a + bi)
Context()->texStrings;
BEGIN_TEXT
The complex conjugate of a number \(z = a + bi\) is written with a bar over it and is \(\overline{z} = \overline{a + bi} = a - bi\).
$PAR
Find the complex conjugate of each of these numbers. $BR
\{ BeginList('OL', type=>'A') \}
$ITEM \( \overline{$a} = \) \{ans_rule(20)\}
$ITEMSEP
$ITEM \( \overline{$b} = \) \{ans_rule(20)\}
$ITEMSEP
$ITEM \( \overline{$c} = \) \{ans_rule(20)\}
$ITEMSEP
$ITEM \( \overline{$d} = \) \{ans_rule(20)\}
$ITEMSEP
$ITEM \( \overline{ $e + \left(1 - \sqrt{$f}\right)i} = \) \{ans_rule(20)\}
$ITEMSEP
$ITEM \( \overline{$g i + $h} = \) \{ans_rule(20)\}
\{ EndList('OL') \}
END_TEXT
######################################
# End game
# Don't let the students enter complex functions
# Context()->functions->disable('conj');
#Checking solutions
for ( $n = 0; $n <= $num_ans-1; $n++ )
{
ANS($answer[$n]->cmp);
}
#Show the students which answers were correct (...= 1)
$showPartialCorrectAnswers = 1;
######################################
# Done
ENDDOCUMENT(); # This should be the last executable line in the problem.
Hi Murphy,
The source code for the unionLists.pl macro at
https://github.com/openwebwork/pg/blob/master/macros/unionLists.pl
shows that changes were made in January 2013 by Davide
https://github.com/openwebwork/pg/commit/45d5cea655e202b952cbdc0c75911bdbc325d168
But, after examining the BeginList subroutine and the changes made to it, it does not appear that his changes should have caused the unexpected behavior you're reporting. You could try running the unionLists.pl macro locally by copying the source code
https://github.com/openwebwork/pg/blob/master/macros/unionLists.pl
into the location [course]/templates/macros/unionLists.pl in your course via the File Manager in webwork. If this does not fix the problem on your system, then something is fishy...
Best regards,
Paul Pearson
I went
https://github.com/openwebwork/pg/blob/master/macros/unionLists.pl
copied the code and in the File Manager created a file. See image below for where I put the file to see if I got it in the right place.
Do I have to do anything else? Nothing seems to have changed. I opened the .pg file and saved it again - nothing changed. Then I got out of WebWork and back in and nothing changed.
Thanks for the suggestion. Thoughts on what I have done wrong?
https://github.com/openwebwork/pg/blob/master/macros/unionLists.pl
copied the code and in the File Manager created a file. See image below for where I put the file to see if I got it in the right place.
Do I have to do anything else? Nothing seems to have changed. I opened the .pg file and saved it again - nothing changed. Then I got out of WebWork and back in and nothing changed.
Thanks for the suggestion. Thoughts on what I have done wrong?
What version of WeBWorK and PG are you using? In some earlier versions (I think it was around 2.7) the math4 theme included CSS that interfered with the layout of the problem. It is possible that that CSS altered the list numbering (that can be controlled by CSS), and that that is what you are seeing. I don't think it has to do with
unionLists.pl
specifically. I think the CSS was corrected in 2.8 or 2.9. You could try the math3 theme and see if it works there. If so, then you know it is the theme issue, and you will need to update WeBWorK in order to resolve it.