You and Jaimos are correct that this comes from the hadParens
property. It is possible to remove this programmatically, if your problems include PGcourse.pl
as the final macro file being loaded, you could add
$context{Fraction}{parser}{Value} = 'my::context::Frac::Parser::Value' if defined $context{Fraction}; package my::context::Frac::Parser::Value; our @ISA = ('context::Fraction::Parser::Value'); sub string { my $self = shift; delete $self->{hadParens} if $self->{value}->classMatch('Fraction'); $self->SUPER::string(@_); } sub TeX { my $self = shift; delete $self->{hadParens} if $self->{value}->classMatch('Fraction'); $self->SUPER::TeX(@_); } package main;This overrides the object class that is inserting the parentheses and subclasses it, replacing the
string
and TeX
methods to clear the hadParens
property.
Alternatively, you could make a separate macro file that contains these lines and use loadMacros()
to load it in all the problems you are wanting to modify.
Or you could put a copy of contextFraction.pl
in your course's templates/macros
directory and edit it to remove the two references to hadParens
.
Any of those should work.