Skip to content

Always load PGbasicmacros.pl and PGauxiliaryFunctions.pl. - #1537

Draft
drgrice1 wants to merge 2 commits into
openwebwork:developfrom
drgrice1:always-load-basic
Draft

drgrice1 wants to merge 2 commits into
openwebwork:developfrom
drgrice1:always-load-basic

Conversation

@drgrice1

@drgrice1 drgrice1 commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

This is done at the end of the DOCUMENT method in PG.pl. This means that problems no longer need to load PGstandard.pl. The basic functionality that is needed is always there.

This does NOT load PGanswermacros.pl. That is because that is entirely deprecated functionality. Problems that use it already load what is needed, and must continue to do so. Newly written problems should not use it.

This could also load customizeLaTeX.pl, but I held off on that. That is an antiquated approach to customization of notation that the rest of PG never followed up on.

Edit: Also remove PGstandard.pl from the loadMacros calls in most sample problems.

There is one problem in which PGstandard.pl was replaced with PGanswermacros.pl for now. That is the problem Misc/Matching.pg. The problem was using unionTables.pl to layout the multiple choice questions and answers. That was replaced with a niceTables.pl layout table via its PGML syntax. However, it uses the PGchoicemacros.pl match list which is the one case that we still have not created a modern equivalent of. That needs the str_cmp method. Note that this problem is replaced in #1541.

@drgrice1

Copy link
Copy Markdown
Member Author

As discussed, loading PGML.pl by default is troublesome because it loads MathObjects.pl which breaks lib/Matrix.pm and any macro that depends on it. The PGmorematrixmacros.pl is one of these, and many problems in the OPL load this macro. Note that many of those problems do not actually use the macro, they just load it. However, that is enough to break the problem if MathObjects.pl is already loaded. Generally that macro, and more generally lib/Matrix.pm, is entirely incompatible with MathObjects.pl.

@Alex-Jordan

Alex-Jordan commented Sep 16, 2026 via email

Copy link
Copy Markdown
Contributor

@drgrice1

Copy link
Copy Markdown
Member Author

So this is just starting to feel out where we want to go with this. This is the most basic approach that resists going further with loading PGML.pl by default as well. I also have an approach that sort of handles loading PGcourse.pl by default, although, it is a hack. @dlglin has suggested going so far as removing the need for even the DOCUMENT(); and ENDDOCUMENT(); calls at the beginning and end of the file.

But yes, if this is where we stop, then all of the sample problems should be updated accordingly.

@somiaj somiaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start.

@drgrice1

Copy link
Copy Markdown
Member Author

I went ahead and removed PGstandard.pl from most sample problems. See the edited initial comment for this pull request.

@somiaj

somiaj commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Seems there could be more work done to remove use of PGstandard.pl if this is the route we are going (which I think is good).

  • WeBWorK::PG::ConvertToPGML should probably not include it anymore.
  • PGbasicmacros.pl POD for helpLink suggest loading PGstandard.pl.
  • Various macros load PGstandard.pl but may not need to. I suspect some of those macros could have PGstandard.pl removed, though most are older/deprecated macros that may require it.

@somiaj

somiaj commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Also left out, many tests load PGstandard, maybe update those tests too, for which it is appropriate.

@drgrice1

Copy link
Copy Markdown
Member Author

Yes, there will be more work needed. One of the reasons I proceeded with removing it in the sample problems was to see that it works well with those. The result is that it does for all but those two problems, and it reveals the issues there. One is a macro that is yet needed (a math object match list macro), and one is a current macro with a bad dependency.

If we decide that this is the way to go, and that it goes far enough (i.e., that, at least for now, we don't want to go to loading PGML by default, or include the PGcourse.pl loading hack, or go on to removing the need to call DOCUMENT and ENDDOCUMENT), then I will take it the rest of the way.

@drgrice1
drgrice1 force-pushed the always-load-basic branch 10 times, most recently from 55747d3 to 5eacb71 Compare September 27, 2026 15:53
@drgrice1
drgrice1 marked this pull request as draft September 28, 2026 11:38
@drgrice1

Copy link
Copy Markdown
Member Author

I made this a draft for now until we can figure out what we really want to do with this.

This is done at the end of the `DOCUMENT` method in `PG.pl`. This means
that problems no longer need to load `PGstandard.pl`.  The basic
functionality that is needed is always there.

This does NOT load `PGanswermacros.pl`.  That is because that is
entirely deprecated functionality. Problems that use it already load
what is needed, and must continue to do so.  Newly written problems
should not use it.

This could also load `customizeLaTeX.pl`, but I held off on that. That
is an antiquated approach to customization of notation that the rest of
PG never followed up on.
…blems.

There is one problem in which `PGstandard.pl` was replaced with
`PGanswermacros.pl` for now.  That is the problem `Misc/Matching.pg`.
The problem was using `unionTables.pl` to layout the multiple choice
questions and answers.  That was replaced with a `niceTables.pl` layout
table via its PGML syntax.  However, it uses the `PGchoicemacros.pl`
match list which is the one case that we still have not created a modern
equivalent of. That needs the `str_cmp` method.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants