Skip to content

Commit ec71bc3

Browse files
committed
Add option to set size for which parserPopUp prints an inline string.
In hardcopy output, allow the size (number of characters) that an inline string [A/B/C] vs a bullet list is printed to be configurable via a new option inlineSize.
1 parent cd49bc1 commit ec71bc3

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

macros/parsers/parserPopUp.pl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ =head1 DESCRIPTION
137137
unnecessary in a static output format.) Default: 1, except 0 for
138138
DropDownTF.
139139
140+
=item C<S<< inlineSize => number >>>
141+
142+
In PDF output, this controls break point between printing the list of
143+
options as an inline list [A/B/C] or multiline bullet list. If the total
144+
number of characters (of all items combined) is greater than this setting,
145+
or an item contains a '[', '/', or ']' character, then the list of options
146+
is printed as a bullet list, otherwise an inline list is used. Default: 25
147+
140148
=back
141149
142150
To insert the drop-down into the problem text when using PGML:
@@ -231,6 +239,7 @@ sub new {
231239
choices => $choices,
232240
placeholder => $options{placeholder} // '',
233241
showInStatic => $options{showInStatic} // 1,
242+
inlineSize => $options{inlineSize} // 25,
234243
values => $options{values} // [],
235244
noindex => $options{noindex} // 0
236245
}, $class;
@@ -437,15 +446,13 @@ sub MENU {
437446
$menu = qq(<fillin name="$name"/>);
438447
}
439448
} elsif ($main::displayMode eq "TeX" && $self->{showInStatic}) {
440-
# if the total number of characters is not more than
441-
# 30 and not containing / or ] then we print out
449+
# Unless the total number of characters is more than the inlineSize
450+
# setting (default 25), or contains [, ], or / then we print out
442451
# the select as a string: [A/B/C]
443-
if (length(join('', @list)) < 25
444-
&& !grep(/(\/|\[|\])/, @list))
445-
{
452+
unless (length(join('', @list)) > $self->{inlineSize} || grep(/(\/|\[|\])/, @list)) {
446453
$menu = '[' . join('/', map { $self->quoteTeX($_) } @list) . ']';
447454
} else {
448-
#otherwise we print a bulleted list
455+
# Otherwise we print a bulleted list.
449456
$menu = '\par\vtop{\def\bitem{\hbox\bgroup\indent\strut\textbullet\ \ignorespaces}\let\eitem=\egroup';
450457
$menu = "\n" . $menu . "\n";
451458
foreach my $option (@list) {

0 commit comments

Comments
 (0)