Skip to content

Conversation

@Alex-Jordan
Copy link
Contributor

I think I never got around to helping make parserRadioMultiAnswer work well for PreTeXt. These changes do that with my testing.

  1. For the static PTX output, the wrapper around everything should be a ul. And the attributes being used here make PTX understand the ul is for answering something.
  2. No need to have anything in between one button and the next.
  3. The static PTX output looks bad to have a button, and then immediately the label like "A", "B", etc. I made the call to remove the "tag" there. The correct answer will still say things like "B", even though now the radio buttons are not labeled A, B, etc. But I think this is still understandable. And this is all for static PTX output where we don't really need the labels.

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.

Thanks for doing this. Hopefully this means that usage of this macro is starting to take hold!

@Alex-Jordan Alex-Jordan marked this pull request as draft December 28, 2025 20:12
@Alex-Jordan
Copy link
Contributor Author

There is some more to do here, so I converted to draft.

@Alex-Jordan Alex-Jordan marked this pull request as ready for review December 28, 2025 21:19
@Alex-Jordan
Copy link
Contributor Author

OK, this can be reviewed again.

  • The POD example had a missing comma, and used t as a variable instead of x. I added the comma and changed the variable to x so the example is ready to copy/paste and work.
  • I added the showInStatic option that other multiple choice macros have.
  • I mirrored what PTX does with parserRadioButtons for labels. If labels are not shown, the PTX output will use ul. If they are shown and are "regular" like 'ABC' or '123', then PTX output will use ol with the the appropriate marker attribute. If they are user defined, then PTX output will use dl with a title element in each li.

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.

I think this looks good still other than a few suggestions.

@Alex-Jordan
Copy link
Contributor Author

Since I added things, I need to update the POD...

@drgrice1
Copy link
Member

Yeah, I noticed the showInStatic option is not documented.

@Alex-Jordan
Copy link
Contributor Author

OK, I think all that's been discussed has been addressed now.

@Alex-Jordan
Copy link
Contributor Author

Hopefully this means that usage of this macro is starting to take hold!

Well, I made use of it a lot over the last year in a linear algebra course, and then in a differential equations course. Any situation where maybe something can't be done, or maybe it can, but if it can then go ahead and do it. That was all direct PG problem writing though, not with PTX.

So I set out to add an example of using this in the PTX sample docs, and that led to this PR.

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.

There is another problem that I forgot to check on before. This seems to be a common problem that you have to watch for with the showInStatic option. You have to ensure that you don't just bail on the ans_rule method before the answer is recorded. Otherwise there are problems. For example, in hardcopy if you want to show student answers, then the answers for the radio multi answer either won't be shown, or if there are answers after it, then it will be but the later answers won't be. That is a problem with this implementation. It is going to be tricky to get this right for this macro. I will see what I can work up, unless you get to it first. The important things are that that lines 771 and 772 are executed for all parts and that the named_ans_array_extension and named_ans_rule_extension methods are called on lines 673 and 689.

sub ans_rule {
my ($self, $size, @options) = @_;

return '' if !$self->{showInStatic} && ($main::displayMode eq 'TeX' || $main::displayMode eq 'PTX');
Copy link
Member

Choose a reason for hiding this comment

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

To ensure that the answer is recorded, this line will need to be moved to after the for loop that begins at line 661 below. Then another copy of this line will need to be added at line 773 in the begin_radio method. Also add next if !$self->{showInStatic} && ($main::displayMode eq 'TeX' || $main::displayMode eq 'PTX'); after line 663 in the for loop below (the named_ans_array_extension and named_ans_rule_extension methods do not need to be called contrary to what I said before).

Copy link
Member

Choose a reason for hiding this comment

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

Actually, scratch the next ... that I said to add on line 663 in the for loop. The named_ans_array_extension and named_ans_rule_extension methods do need to be called. So just remove the existing line 652, and copy it to the other two locations I gave before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for working that out. I made those changes and force pushed.

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.

Looks good now.

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