Over the years I have learned how to bend PG, Contexts, and Math Objects to my will. As an aside, thank you to the team that built these.
I see more and more use of PGML in questions on this forum, and I have not looked into much if at all.
Is the only reason to use PGML to make the code more intuitive? Or will using PGML be good for other reasons I do not know about? As I set forth to code a large batch of statistics problems this year, is there a reason I should use PGML, given that I am already familiar with pre-PGML PG?
In reply to Alex Jordan
Re: Should I learn PGML and start writing probems with it?
by Christian Seberino -
Alex
I did non-PGML for a little while and after seeing PGML I never looked back. It is much nicer. A lot of stuff is done automatically for you or in simpler ways.
Regarding whether you should use it "just" because it is easier is up to you.
I doubt you'll find anything that can't be done either way.
There really isn't hardly any investment to learn the PGML way....
Just see the wonderful examples here:
https://courses.webwork.maa.org/webwork2/cervone_course/PGML-examples/?login_practice_user=true
cs
I did non-PGML for a little while and after seeing PGML I never looked back. It is much nicer. A lot of stuff is done automatically for you or in simpler ways.
Regarding whether you should use it "just" because it is easier is up to you.
I doubt you'll find anything that can't be done either way.
There really isn't hardly any investment to learn the PGML way....
Just see the wonderful examples here:
https://courses.webwork.maa.org/webwork2/cervone_course/PGML-examples/?login_practice_user=true
cs
In reply to Alex Jordan
Re: Should I learn PGML and start writing probems with it?
by Davide Cervone -
The purpose of PGML was to try to simplify two aspects of the PG programming experience: first, to make the handling of layout in the text of the problem more natural, and second, to make the connection between answer blanks and their answers more direct.
I always found using things like
PGML was supposed to make all this much easier. It handles paragraph breaking, line breaking, bold, italics, centering, bullet lists, headings, and so on without the Perl variables (using a Markdown-style syntax). The idea is that the text within the problem file should look as much as possible like the output the student sees.
PGML also takes care of telling the MathObjects if their output is to be used in TeX mode or not, so that they can produce TeX strings or algebra strings automatically. That avoids the ugly
The second feature of PGML is to tie the answer checkers more closely to the answer blanks. In this way, you can see the correct answer right next to the answer blank in the text of the problem rather than having to hunt around for it above of below that. I tried to make it as flexible as possible about how you provide the answers, so you can just use a string (which is passed to
Since PGML is really about the text of the problem, you can continue to leverage your PG skills for the remainder of the problem, and use PGML for the layout of the text. I think that would be a pretty efficient use of PGML, if you wanted to give it a try.
Of course, there is no documentation to speak of. The examples Christian points to are one source of information, and the PGML interactive lab linked from the Wiki is another. I'm happy to help as well.
Davide
I always found using things like
$PAR
and so on to be cumbersome and not easy to read. And you had to be careful about other special characters like %
, #
, <
, and so on because they might work on screen, but not in hardcopy. The handling of TeX output versus string output for MathObejcts was also sub-optimal. Finally, how much additional processing was done on the contents of variables or commands that where inserted into the text was hard to understand.PGML was supposed to make all this much easier. It handles paragraph breaking, line breaking, bold, italics, centering, bullet lists, headings, and so on without the Perl variables (using a Markdown-style syntax). The idea is that the text within the problem file should look as much as possible like the output the student sees.
PGML also takes care of telling the MathObjects if their output is to be used in TeX mode or not, so that they can produce TeX strings or algebra strings automatically. That avoids the ugly
Context()->texStrings;
stuff that you usually have to do around text blocks. PGML knows how to properly quite the special characters (like %
and $
) so that they will work in all output modes (hardcopy and screen) without special handling. And it gives you the ability to indicate whether the result of a command or variable substitution will be further processed by PGML or not, avoiding the need for extra quoting of special characters in some circumstances.The second feature of PGML is to tie the answer checkers more closely to the answer blanks. In this way, you can see the correct answer right next to the answer blank in the text of the problem rather than having to hunt around for it above of below that. I tried to make it as flexible as possible about how you provide the answers, so you can just use a string (which is passed to
Compute()
to produce the answer), or a MathObject, or an AnswerEvaluator object, so you can continue to use your MathObject and PG experience to generate answer checkers outside of PGML and pass them in to it.Since PGML is really about the text of the problem, you can continue to leverage your PG skills for the remainder of the problem, and use PGML for the layout of the text. I think that would be a pretty efficient use of PGML, if you wanted to give it a try.
Of course, there is no documentation to speak of. The examples Christian points to are one source of information, and the PGML interactive lab linked from the Wiki is another. I'm happy to help as well.
Davide
In reply to Davide Cervone
Re: Should I learn PGML and start writing probems with it?
by Christian Seberino -
> The second feature of PGML is to tie the answer checkers more closely to the
> answer blanks.
Davide
Speaking of answer blanks....is it possible to have answer blanks that span
multiple lines like HTML textarea elements?
(I need a big box to allow multiple line answers that are snippets of computer programs.)
cs
> answer blanks.
Davide
Speaking of answer blanks....is it possible to have answer blanks that span
multiple lines like HTML textarea elements?
(I need a big box to allow multiple line answers that are snippets of computer programs.)
cs