Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pg.sty #863

Merged
merged 7 commits into from
Jun 28, 2023
Merged

pg.sty #863

merged 7 commits into from
Jun 28, 2023

Conversation

Alex-Jordan
Copy link
Contributor

This introduces a latex sty file for PG macros. For getting started, it has one macro, \answerRule{} which takes a numerical argument and makes a rule so many ex wide. I sunk it 3pt lower from what answer rules have always been in PGbasicmacros.pl.

This pairs with openwebwork/webwork2#2081.

To test, get on both branches. Have a problem with answer rules, preferably that includes an answer rule array. First visit the problem editor. Test that you can build the PDF (and see if the sunken underline is in effect.) Then test that you can download the tex and build it locally.

Then put the problem in a set. See if you can generate the PDF hardcopy. And see if you download the tex bundle if you can build the set.

@pstaabp
Copy link
Member

pstaabp commented Jun 24, 2023

This all works well. As mentioned earlier, I would recommend having the default be an empty box instead of a line. If we do that, we should switch the essay_box over to a box as well.

@Alex-Jordan
Copy link
Contributor Author

Alex-Jordan commented Jun 24, 2023 via email

@drdrew42
Copy link
Member

Is there any way to label these answer rules without affecting the output? I'm thinking of ways to post-process the output (once the answers are processed) to insert the correct answers... in HTML the inputs are labeled with an ID, can we do something similar here?

@Alex-Jordan
Copy link
Contributor Author

Alex-Jordan commented Jun 24, 2023 via email

@Alex-Jordan
Copy link
Contributor Author

I changed it so that the .tex file has like \answerRule[AnSwEr0001]{10}. This is a start to what I think @drdrew42 commented on.

Copy link
Member

@drgrice1 drgrice1 left a comment

Choose a reason for hiding this comment

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

This looks good. Just a question on the \ProvidesFile usage.

assets/tex/pg.sty Outdated Show resolved Hide resolved
@drgrice1
Copy link
Member

By the way, here is more information on the ProvidesPackage and ProvidesFile commands.

@pstaabp
Copy link
Member

pstaabp commented Jun 27, 2023

After doing some more testing, I included a problem with a PGchoicemacros.pl and it seems to be if the match_questions_list is used for this, then I get an error when generating the hardcopy. Here's an example:
Library/Indiana/Indiana_setSeries5IntegralTest/ur_sr_5_11.pg. (This problem has some error, but runs on the current PG-2.18 branch).

Here's one of the tex errors:

! Argument of \\answerRule has an extra }.
<inserted text> 
                \par 
l.40 \item[\answerRule[AnSwEr0002]
                                  {5}2.] \(\displaystyle \sum_{n=1}^\infty \...
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

@drgrice1
Copy link
Member

The problem with this and the match_questions_list and match_questions_list_varbox (which that problem actually uses) is that those methods put the answer rule inside the option brackets for a enumerate item. So you get \item[\answerRule[AnSwEr0001]{5}1.] with this pull request. LaTeX always has problems with nested option brackets. To fix this you could wrap the answer rule in braces so that this would become \item[{\answerRule[AnSwEr0001]{5}}1.]. That works, and shouldn't cause any issues elsewhere.

@Alex-Jordan
Copy link
Contributor Author

I made that change and pushed, but I still get a compilation error. I'm looking into it.

@Alex-Jordan
Copy link
Contributor Author

Eh, I just didn't have the corresponding webwork2 branch going. Working for me now.

Copy link
Member

@pstaabp pstaabp left a comment

Choose a reason for hiding this comment

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

Looks good now. @drgrice1 do you want to look at this anymore or else we can merge.

@drgrice1
Copy link
Member

This is good.

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.

4 participants