Difference between revisions of "How to list Context flags"

From WeBWorK_wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
There is an explanation of the purpose of many of these flags at [[ContextFlags]]
 
There is an explanation of the purpose of many of these flags at [[ContextFlags]]
   
  +
== Listing Context Flags using PGLabs ==
 
You can obtain a complete list of contextFlags from one of the current contexts using the [[PGLabs]] and this code snippet:
 
You can obtain a complete list of contextFlags from one of the current contexts using the [[PGLabs]] and this code snippet:
   
Line 421: Line 422:
 
</table>
 
</table>
 
</center>
 
</center>
  +
  +
== Listing Context Flags in an existing WeBWorK question ==
  +
  +
* In loadMacros(...); make sure you load &quot;PGinfo.pl&quot;, e.g.
  +
loadMacros(
  +
&quot;PGstandard.pl&quot;,
  +
&quot;PGcourse.pl&quot;,
  +
&quot;~MathObjects.pl&quot;,
  +
&quot;PG.pl&quot;
  +
&quot;PGinfo.pl&quot;,
  +
);
  +
  +
* Set your Context, e.g.
  +
Context(&quot;Your Context Here&quot;); or don't do anything to see flags from the current context
  +
  +
* Enter the text
  +
TEXT(
  +
pp(Context()-&gt;{flags})
  +
);
  +
  +
* View the problem
  +
  +
  +
===See also===
 
[[Category:AIMWeBWorK Working Groups]]
 
[[Category:AIMWeBWorK Working Groups]]
 
[[Category:Contexts]]
 
[[Category:Contexts]]

Revision as of 13:31, 16 June 2008

There is an explanation of the purpose of many of these flags at ContextFlags

Listing Context Flags using PGLabs

You can obtain a complete list of contextFlags from one of the current contexts using the PGLabs and this code snippet:

Context("Vector");
TEXT(Context()->{name}, $BR);
TEXT(pretty_print( Context()->{flags} ));

You could also load in one of the customized contexts such as contextCurrency.pl

loadMacros("contextCurrency.pl");
Context("Currency");
Context()->flags->set(trimTrailingZeros=>1);
TEXT(Context()->{name}, $BR);
TEXT(pretty_print( Context()->{flags} ));

which will produce the output below. Notice that the trimTrailingZeros flag has been set to 1 (the default is 0 ).


Currency
HASH(0xc8c1988)

allowBadFunctionInputs

=>

 0

allowBadOperands

=>

 0

allowEmptyStrings

=>

 1

allowMissingFunctionInputs

=>

 0

allowMissingOperands

=>

 0

allowWrongArgCount

=>

 0

checkUndefinedPoints

=>

 0

forceCommas

=>

 0

forceDecimals

=>

 0

formatStudentAnswer

=>

 evaluated

granularity

=>

 1000

ignoreEndpointTypes

=>

 0

ijk

=>

 0

ijkAnyDimension

=>

 1

infiniteWord

=>

 infinity

limits

=>

 ( -2 , 2 , )

max_adapt

=>

 100000000

max_undefined

=>

 

noExtraDecimals

=>

 1

num_points

=>

 5

promoteReals

=>

 1

reduceConstantFunctions

=>

 1

reduceConstants

=>

 1

reduceSets

=>

 1

reduceSetsForComparison

=>

 1

reduceUnions

=>

 1

reduceUnionsForComparison

=>

 1

resolution

=>

 

showExtraParens

=>

 1

tolType

=>

 absolute

tolerance

=>

 0.005

trimTrailingZeros

=>

 0

useBaseTenLog

=>

 0

useFuzzyReals

=>

 1

zeroLevel

=>

 1e-14

zeroLevelTol

=>

 1e-12

Listing Context Flags in an existing WeBWorK question

  • In loadMacros(...); make sure you load "PGinfo.pl", e.g.
loadMacros(
   "PGstandard.pl",
   "PGcourse.pl",
   "~MathObjects.pl",
   "PG.pl"
   "PGinfo.pl",
);

  • Set your Context, e.g.
Context("Your Context Here"); or don't do anything to see flags from the current context
  • Enter the text
TEXT(
    pp(Context()->{flags})

);

  • View the problem


See also