Skip to content

Conversation

drgrice1
Copy link
Member

The default "separator" is a $BR which is defined to be \\leavemode\\\\\\relax if the display mode is TeX. This doesn't work if the CheckboxList or RadioButtons happen to be in a table. Furthermore, the separator doesn't make sense in TeX display mode in any case. So this makes it so that the separator is just not used in the TeX display mode.

This is to address issue #1300.

@Alex-Jordan
Copy link
Contributor

Should the POD get into this? There's a place where it explains separator but not in a way that clarifies it will only be used in HTML.

@drgrice1
Copy link
Member Author

Good point. I will add a comment about this.

@drgrice1 drgrice1 force-pushed the checkbox-radio-ignore-separator branch from 89a55c9 to b8303b7 Compare September 7, 2025 11:06
@pstaabp
Copy link
Member

pstaabp commented Sep 9, 2025

I just tested this with the following MWE:

DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'parserCheckboxList.pl');
$checks = CheckboxList(['A', 'B', 'C'],[0,1]);

BEGIN_PGML
Select A and B

[# [.[_]{$checks} .] #]

END_PGML

ENDDOCUMENT();

and still see errors in the hardcopy. I'm getting a Not allowed in LR mode. error for the \item calls.

@pstaabp
Copy link
Member

pstaabp commented Sep 9, 2025

I think there's a general latex issue with itemize inside of tabular. There's a suggestion: https://tex.stackexchange.com/questions/150492/how-to-use-itemize-in-table-environment to using the p{} option in the column specifier. I switched the code to that and this did work.

@drgrice1
Copy link
Member Author

drgrice1 commented Sep 9, 2025

@pstaabp: Yes, to use a CheckboxList in a table you need to use p{}. I don't think there is any way to make niceTables automatically detect that you are putting a CheckboxList into a table cell, so the author will need to add that. You can do this with

DOCUMENT();

loadMacros('PGstandard.pl', 'PGML.pl', 'parserCheckboxList.pl');
$checks = CheckboxList(['First', 'Second', 'Third'], [0, 1]);

BEGIN_PGML
Select First and Third

[# [. [_]{$checks} .] #]*{ align => 'p{2in}' }
END_PGML

ENDDOCUMENT();

The problem also looks quite bad without that in HTML. I changed to "First", "Second", and "Third" to emphasize the point here. This is a screenshot of what you get without the p alignment:

checkboxs-in-table

@drgrice1 drgrice1 force-pushed the checkbox-radio-ignore-separator branch from b8303b7 to c4a02bc Compare September 9, 2025 20:54
…ns.pl in TeX display mode.

The default "separator" is a $BR which is defined to be
`\\leavemode\\\\\\relax` if the display mode is TeX.  This doesn't work
if the CheckboxList or RadioButtons happen to be in a table.
Furthermore, the separator doesn't make sense in TeX display mode in any
case.  So this makes it so that the separator is just not used in the
TeX display mode.

This is to address issue openwebwork#1300.
@drgrice1 drgrice1 force-pushed the checkbox-radio-ignore-separator branch from c4a02bc to 8c7b390 Compare September 9, 2025 21:16
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