WeBWorK Problems

Having trouble using template problems from Wiki

Having trouble using template problems from Wiki

by Jim Fischer -
Number of replies: 2
Im sure Im doing something wrong, just cant figure out what the issue is this morning.

I am trying to create essay problems. I started by using the problems posted at the wiki. For example, the following problem is found doing a search on the Wiki for essay problems.

http://webwork.maa.org/wiki/EssayAnswer1#.Uj235MXft0w

I tried copying this problem into a text editor and then uploaded to a course to access via "local problems" using the browser.

I have tried several problems and I keep getting the same error:

 Problem1 ERROR caught by Translator while processing problem file:WWprobs/Essay2.pg **************** Unrecognized character \xEF; marked by <-- HERE after ExPr__; <-- HERE near column 17 at line 1 of (eval 1915)


Here is the file I made that produces the above error:

DOCUMENT();

loadMacros("PG.pl","PGbasicmacros.pl","PGanswermacros.pl","MathObjects.pl");
#Load the Essay Macros
loadMacros("PGessaymacros.pl");

$m = random(2,5);
$b = random(20,30);
Context("Numeric");
Context()->variables->add(D => 'Real');
$F = Formula("$m D + $b");
$y1 = $F->eval(D=>1);
$y2 = $F->eval(D=>2);

BEGIN_TEXT
The cost to download data using your phone is a linear function of the amount of data downloaded. Suppose it costs $y1 dollars to download 1 gigabyte of data and $y2 dollars to download 2 gigabytes of data.
$PAR
Find a formula for the cost C in terms of the amount downloaded D. $BR
C=\{ans_rule()\}
$PAR
What do the slope and y-intercept of this function represent? $BR
\{#Put an Essay Box where ever you want a essay type answer\}
\{essay_box()\}
END_TEXT

ANS($F->cmp());
#Essay Boxs use the essay_cmp evaluator.
ANS(essay_cmp());
ENDDOCUMENT();



In reply to Jim Fischer

Re: Having trouble using template problems from Wiki

by Jim Fischer -
I found how to find the Wiki template problems in the NPL using the browser. The location is posted at the top of the example (not sure how I missed that)

However, I would still like to know why the above pg file wont work. I copied and pasted from the wiki to a text editor and then saved as a text file. Then uploaded to course and viewed in the local area using the browser. I think the problem has to do with how I am saving the text file, but I dont recall having issues before. It looks fine when viewing with the editor in file manager. The above file was copied to this forum directly from the file manager editor.

Thanks!


In reply to Jim Fischer

Re: Having trouble using template problems from Wiki

by Jim Fischer -
DOH!

I forgot to put the header in the file. Moderator, please feel free to delete this thread.