Skip to content

Commit

Permalink
Prefix the {\\answerRule...} in TeX output with \\relax`.
Browse files Browse the repository at this point in the history
This fixes issue openwebwork#912.  See the discussion there.
  • Loading branch information
drgrice1 committed Aug 22, 2023
1 parent 350657e commit fa833e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions macros/core/PGbasicmacros.pl
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ sub NAMED_ANS_RULE {
$tcol = $tcol < 40 ? $tcol : 40; ## get min

MODES(
TeX => "{\\answerRule[$name]{$tcol}}",
TeX => "\\relax{\\answerRule[$name]{$tcol}}",
Latex2HTML => qq!\\begin{rawhtml}<input type=text size=$col name="$name" value="">\\end{rawhtml}!,

# Note: codeshard is used in the css to identify input elements that come from pg
Expand Down Expand Up @@ -360,7 +360,7 @@ sub NAMED_HIDDEN_ANS_RULE {
$tcol = $tcol < 40 ? $tcol : 40; ## get min

MODES(
TeX => "{\\answerRule[$name]{$tcol}}",
TeX => "\\relax{\\answerRule[$name]{$tcol}}",
Latex2HTML => qq!\\begin{rawhtml}<input type=text name="$name" value="">\\end{rawhtml}!,
HTML => qq!<input type=hidden name="$name" id="$name" value="$answer_value">!
. qq!<input type=hidden name="previous_$name" id="previous_$name" value="$answer_value">!,
Expand Down Expand Up @@ -413,7 +413,7 @@ sub NAMED_ANS_RULE_EXTENSION {
my $tcol = $col / 2 > 3 ? $col / 2 : 3; ## get max
$tcol = $tcol < 40 ? $tcol : 40; ## get min
MODES(
TeX => "{\\answerRule[$name]{$tcol}}",
TeX => "\\relax{\\answerRule[$name]{$tcol}}",
Latex2HTML =>
qq!\\begin{rawhtml}\n<input type=text size=$col name="$name" id="$name" value="">\n\\end{rawhtml}\n!,
HTML => qq!<input type=text class="codeshard" size=$col name="$name" id="$name" aria-label="$label" !
Expand Down Expand Up @@ -1079,7 +1079,7 @@ sub NAMED_ANS_ARRAY_EXTENSION {
$tcol = $tcol < 40 ? $tcol : 40; ## get min

MODES(
TeX => "{\\answerRule[$name]{$tcol}}",
TeX => "\\relax{\\answerRule[$name]{$tcol}}",
Latex2HTML =>
qq!\\begin{rawhtml}\n<input type=text size=$col name="$name" id="$name" value="">\n\\end{rawhtml}\n!,
HTML => qq!<input type=text size=$col name="$name" id="$name" class="codeshard" aria-label="$label" !
Expand Down

0 comments on commit fa833e6

Please sign in to comment.