GithubHelp home page GithubHelp logo

Comments (8)

apizer avatar apizer commented on July 20, 2024

This is not an old issue. It is new to WW2.18. It breaks one of the oldest WW problems (Problem 2 in Set 0) but I thought the problem was corrupted and fixed it by accident. Another problem actually was corrupted (missing ;) I could not get the minimal problem above to work, but the following (please forgive my old technique) works in WW2.17 but fails in WW2.18.

DOCUMENT();
loadMacros("PGstandard.pl");
BEGIN_TEXT
Enter 1:
$BR{ ans_rule(1) }

END_TEXT
$ans =1;
ANS(std_num_cmp($ans));

ENDDOCUMENT();

Note that in the installation guide I said:
Note that most of these sets date from the early days of WeBWorK in the 1990's and the problems they contain, while they still work, are not examples of current good programing practices. For current programing methods, look at e.g. https://webwork.maa.org/wiki/Category:PGM. Further, Problem 12 in setMAAtutorial (file htmllinksexample.pg) contains a simple error which is typical of errors you might make in authoring your own problems. WeBWorK tries to tell you what the error is and you can use the Edit button to edit and save the problem. Problem 2 in set0 (file prob1a.pg) contains more subtle errors. The Open Problem Library (OPL) contains over 37,000 problems the vast majority of which are error free.

from pg.

drgrice1 avatar drgrice1 commented on July 20, 2024

This seems to be due to #863. If you add a space in the TeX string on line 319 of PGbasicmacros.pl, then hardcopy generation succeeds. However, it also adds a space in the output which is not desired. This seems to be another case of EV3P parsing something in an odd way.

from pg.

Alex-Jordan avatar Alex-Jordan commented on July 20, 2024

Quick note that my MWE was missing MathObjects.pl.

DOCUMENT();
loadMacros("PGstandard.pl", "MathObjects.pl");
BEGIN_TEXT

$DOLLAR\{ ans_rule(1) \}

END_TEXT
ANS(Real(1)->cmp);
ENDDOCUMENT();

from pg.

drgrice1 avatar drgrice1 commented on July 20, 2024

So what is happening is that "<<END_OF_EVALUATION_STRING\n$DOLLAR{\\answerRule[AnSwEr0001]{3}}\nEND_OF_EVALUATION_STRING\n" is being passed to PG_restricted_eval by the EV3P method. So that is the perl code

<<END_OF_EVALUATION_STRING
$DOLLAR{\\answerRule[AnSwEr0001]{3}}
END_OF_EVALUATION_STRING

Perl is interpreting that to mean the hash key of the %DOLLAR hash indexed by \\answerRule[AnSwEr0001]{3}. Since the %DOLLAR hash is not defined, it is an error.

from pg.

drgrice1 avatar drgrice1 commented on July 20, 2024

Yeah, I added MathObjects.pl.

from pg.

drgrice1 avatar drgrice1 commented on July 20, 2024

It seems that if you change line 319 to TeX => "\\mbox{\\answerRule[$name]{$tcol}}" it fixes the problem. This seems like it should work. Do you see any problems with that? Note that all of the answer rule methods that add this \\answerRule in this way will need to be fixed.

from pg.

drgrice1 avatar drgrice1 commented on July 20, 2024

Note that the \\mbox addition also works with Library/Indiana/Indiana_setSeries5IntegralTest/ur_sr_5_11.pg (the problem @pstaabp mentioned in #863 that results in the answer rule output being placed inside the option brackets of an \item.

from pg.

Alex-Jordan avatar Alex-Jordan commented on July 20, 2024

I'm not getting this to happen on develop. #915 and related PRs for develop fixed this.

from pg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.