@@ -170,6 +170,12 @@ =head1 DESCRIPTION
170170index into the choice array or not. If set to 1, then the number is treated as
171171the literal correct answer, not an index to it. Default: 0
172172
173+ =item C<S<< showInStatic => 0 or 1 >>>
174+ In static output, such as PDF or PTX, this controls whether or not
175+ the list of answer options is displayed. (The text preceding the list
176+ of answer options might make printing the answer option list
177+ unnecessary in a static output format.) Default: 1
178+
173179=back
174180
175181To insert the checkboxes into the problem text use
@@ -244,6 +250,7 @@ sub new {
244250 noindex => 0,
245251 checkedI => [],
246252 localLabels => 0,
253+ showInStatic => 1,
247254 @inputs
248255 );
249256 $options {originalLabels } = $options {labels };
@@ -570,37 +577,43 @@ sub CHECKS {
570577 }
571578
572579 if ($main::displayMode eq ' TeX' ) {
573- $checks [0] = " \n\\ begin{itemize}\n " . $checks [0];
574- $checks [-1] .= " \n\\ end{itemize}\n " ;
580+ if ($self -> {showInStatic }) {
581+ $checks [0] = " \n\\ begin{itemize}\n " . $checks [0];
582+ $checks [-1] .= " \n\\ end{itemize}\n " ;
583+ } else {
584+ @checks = ();
585+ }
575586 } elsif ($main::displayMode eq ' PTX' ) {
587+ if ($self -> {showInStatic }) {
588+ # Do we want an ol, ul, or dl?
589+ my $list_type = ' ul' ;
590+ my $subtype = ' ' ;
591+ my $originalLabels = $self -> {originalLabels };
592+ if ($originalLabels =~ m / ^(123|abc|roman)$ / i ) {
593+ my $marker = ' ' ;
594+ $marker = " 1" if $originalLabels eq ' 123' ;
595+ $marker = " a" if $originalLabels eq ' abc' ;
596+ $marker = " A" if uc ($originalLabels ) eq ' ABC' && $originalLabels ne ' abc' ;
597+ $marker = " i" if $originalLabels eq ' roman' ;
598+ $marker = " I" if uc ($originalLabels ) eq ' ROMAN' && $originalLabels ne ' roman' ;
599+
600+ $list_type = ' ol' ;
601+ $subtype = qq( marker="$marker ") ;
602+ } elsif ($self -> {localLabels } || ref $originalLabels eq ' ARRAY' ) {
603+ $list_type = ' dl' ;
604+ $subtype = ' width = "narrow"' ;
605+ my %checks_to_labels = map { $checks [$_ ] => $self -> {labels }[$_ ] } (0 .. $# { $self -> {orderedChoices } });
606+ map { $_ =~ s / ^(<li.*?>)/ $1 <title>$checks_to_labels {$_ }<\/ title>/ gr } @checks ;
607+ }
608+ $checks [0] = qq{ <$list_type$subtype name="$name ">\n $checks [0]} ;
609+ $checks [-1] .= " </$list_type >" ;
576610
577- # Do we want an ol, ul, or dl?
578- my $list_type = ' ul' ;
579- my $subtype = ' ' ;
580- my $originalLabels = $self -> {originalLabels };
581- if ($originalLabels =~ m / ^(123|abc|roman)$ / i ) {
582- my $marker = ' ' ;
583- $marker = " 1" if $originalLabels eq ' 123' ;
584- $marker = " a" if $originalLabels eq ' abc' ;
585- $marker = " A" if uc ($originalLabels ) eq ' ABC' && $originalLabels ne ' abc' ;
586- $marker = " i" if $originalLabels eq ' roman' ;
587- $marker = " I" if uc ($originalLabels ) eq ' ROMAN' && $originalLabels ne ' roman' ;
588-
589- $list_type = ' ol' ;
590- $subtype = qq( marker="$marker ") ;
591- $close_list = ' ol' ;
592- } elsif ($self -> {localLabels } || ref $originalLabels eq ' ARRAY' ) {
593- $list_type = ' dl' ;
594- $subtype = ' width = "narrow"' ;
595- my %checks_to_labels = map { $checks [$_ ] => $self -> {labels }[$_ ] } (0 .. $# { $self -> {orderedChoices } });
596- map { $_ =~ s / ^(<li.*?>)/ $1 <title>$checks_to_labels {$_ }<\/ title>/ gr } @checks ;
611+ # Change math delimiters
612+ @checks = map { $_ =~ s /\\\( / <m>/ gr } @checks ;
613+ @checks = map { $_ =~ s /\\\) / <\/ m>/ gr } @checks ;
614+ } else {
615+ @checks = ();
597616 }
598- $checks [0] = qq{ <$list_type$subtype name="$name ">\n $checks [0]} ;
599- $checks [-1] .= " </$list_type >" ;
600-
601- # Change math delimiters
602- @checks = map { $_ =~ s /\\\( / <m>/ gr } @checks ;
603- @checks = map { $_ =~ s /\\\) / <\/ m>/ gr } @checks ;
604617 } else {
605618 $checks [0] =
606619 qq{ <div class="checkboxes-container" }
0 commit comments