## WeBWorK Problems

### Re: Problems not rendering after upgrade to 2.17

by Glenn Rice -
Number of replies: 11

You should also note that the unionInclude.pg macro is deprecated, and will cease to function with the next version of webwork2 and pg.  Instead use includePGproblem.  The macro to load to use that method is PGstandard.pl.  To use that to obtain a random problem use

DOCUMENT();

@choices = ('DerivateEasy/enkelt1.pg', 'DerivateEasy/enkelt3.pg', 'DerivateEasy/enkelt4.pg', 'DerivateEasy/enkelt5.pg');
includePGproblem(list_random(@choices));

ENDDOCUMENT;

You should check the paths of those files though.  Are those relative to the courses templates directory?  If they are not that won't work for either the unionInclude.pg macro or with the includePGproblem method.

### Re: Problems not rendering after upgrade to 2.17

by Glenn Rice -
I just put in a pull request to fix the macro so it will continue to work with the next release of webwork and pg. However, it still should not be used. The macro is deprecated. Everything it does can be obtained using core functionality.

### Re: Problems not rendering after upgrade to 2.17

by Lukas Fredriksson -

Thank you both for your responses! I've restarted apache but have not tried to change the deprecated macro and yes, the path is correct.

The strange thing is that some of those random problems work while some doesn't. Will change the macro and come back if I still have issues!

### Re: Problems not rendering after upgrade to 2.17

by Glenn Rice -
I don't think this is an issue with the macro. On webwork version 2.17 the macro still works fine.

This looks like a module issue, based on your errors.

What do you get when you run check_modules.pl?

### Re: Problems not rendering after upgrade to 2.17

by Glenn Rice -
I just noticed the copyright symbol in your file. That may be the problem considering that Encode is having issues. Change that to © instead, and see if that helps.

By the way, what version of WeBWorK did you upgrade from?

### Re: Problems not rendering after upgrade to 2.17

by Lukas Fredriksson -
check_modules.pl says everything is found and loaded.

I included two different problems here, still being randomized using the code we had in my example above. This first one is NOT working:

DOCUMENT(); # Load whatever macros you need for the problem loadMacros("PGstandard.pl",            "MathObjects.pl",           ); ## Do NOT show partial correct answers $showPartialCorrectAnswers = 0; TEXT(beginproblem());$A = random(1,9,1); BEGIN_TEXT Bestäm derivatan till funktionen $$f(x) = \ln(x^2+{A})$$ $PAR$PAR $$f'(x) =$$ \{ans_rule(20) \} $PAR END_TEXT$ans = Compute("2*x/(x**2+${A})"); ANS($ans->cmp); ENDDOCUMENT(); 

And this second one is working just fine:

DOCUMENT();# Load whatever macros you need for the problemloadMacros("PGstandard.pl",           "MathObjects.pl",          );## Do NOT show partial correct answers$showPartialCorrectAnswers = 0;TEXT(beginproblem());$A = random(2,5,1);$B = random(1,5,1);BEGIN_TEXTBestäm derivatan till funktionen $$f(x) = \sin({A} x-{B})$$$PAR$PAR$$f'(x) =$$ \{ans_rule(20) \}$PAREND_TEXT$ans = Compute("${A}*cos(${A}*x-${B})");ANS(\$ans->cmp);ENDDOCUMENT();

### Re: Problems not rendering after upgrade to 2.17

by Glenn Rice -

Both problems seems to work fine for me.  Even if included via includeRandomProblem of unionInclude.pg.

I don't think it is the problems or the macro.  Except possible the copyright symbol.  Does one of those have the copyright symbol in the top part of the file and the other not?  Your first post included the following

# Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net
If not there is something else going on with your setup here.

### Re: Problems not rendering after upgrade to 2.17

by Lukas Fredriksson -
Yes they both include the copyright symbol. I upgraded from 2.15 to 2.17, doing all the steps in the guide to upgrade from 2.15 to 2.16 as well.
The only issue encountered during our upgrade was that webwork complained about TikZImage.pg not being found, so I downloaded it from 2.16. We don't use TikZ though.

### Re: Problems not rendering after upgrade to 2.17

by Glenn Rice -

Did you try changing that copyright symbol to &copy; to see if that helps anyway?  I would be surprised if it didn't cause an issue.

### Re: Problems not rendering after upgrade to 2.17

by Lukas Fredriksson -
So I did some testing, both writing the problem directly without randomizing and copying one of the working files and changing the text so that it matched one of the non-working. Both of these methods worked.

That made me think that there had to be some problem with the encoding, and sure enough the problems that didn't work had CRLF line terminators while the working problems didn't.

So after changing encoding to just UTF-8 Unicode text the other problems also work!

Have to try this on our production server as well but it seems like this solves the issue.

Thank you for all the help!

### Re: Problems not rendering after upgrade to 2.17

by Lukas Fredriksson -
This problem with the line endings, is this a common issue as well? Should this even be an issue or could there be something else broken with my installation?