Members
(static) JMEifier
An object which can convert a JME tree into a string of JME code.
(static) jmeFunctions :function
Define how to render function in JME, for special cases when the normal rendering f(...)
isn't right.
Type:
Properties:
Name | Type | Description |
---|---|---|
dict |
function | |
fact |
function | |
listval |
function |
(static) specialNames :Object.<string>
Names with special renderings.
Type:
(static) texNameAnnotations
Dictionary of functions to convert specific name annotations to TeX.
Properties:
Name | Type | Description |
---|---|---|
verbatim |
||
op |
||
vector |
||
unit |
||
dot |
||
matrix |
||
diff |
||
degrees |
||
bb |
||
complex |
||
imaginary |
||
real |
||
positive |
||
nonnegative |
||
negative |
||
integer |
||
decimal |
||
rational |
||
nonone |
||
nonzero |
(static) texOps :function
Define how to texify each operation and function.
Type:
Properties:
(static) typeToJME
Dictionary of functions to turn Numbas.jme.types
objects into JME strings.
Properties:
Name | Type | Description |
---|---|---|
nothing |
||
integer |
||
rational |
||
decimal |
||
number |
||
name |
||
string |
||
html |
||
boolean |
||
range |
||
list |
||
keypair |
||
dict |
||
vector |
||
matrix |
||
function |
||
op |
||
set |
||
expression |
||
lambda |
(static) typeToTeX
Dictionary of functions to turn Numbas.jme.types
objects into TeX strings.
Properties:
Name | Type | Description |
---|---|---|
nothing |
||
integer |
||
rational |
||
decimal |
||
number |
||
string |
||
boolean |
||
range |
||
list |
||
keypair |
||
dict |
||
vector |
||
matrix |
||
name |
||
op |
||
function |
||
set |
||
expression |
||
lambda |
Methods
(static) exprToLaTeX(expr, ruleset, scope, parseropt) → {TeX}
Convert a JME expression to LaTeX.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
expr |
JME | |||
ruleset |
Array.<string> | Numbas.jme.rules.Ruleset | Can be anything accepted by |
||
scope |
Numbas.jme.Scope | |||
parser |
Numbas.jme.Parser |
<optional> |
Numbas.jme.standardParser |
Returns:
Type | Description |
---|---|
TeX |
(static) simplify(expr, ruleset, scope, parseropt) → {Numbas.jme.tree}
Simplify a JME expression string according to given ruleset and return it as a syntax tree.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
expr |
JME | |||
ruleset |
Array.<string> | Numbas.jme.rules.Ruleset | |||
scope |
Numbas.jme.Scope | |||
parser |
Numbas.jme.Parser |
<optional> |
Numbas.jme.standardParser |
Returns:
Type | Description |
---|---|
Numbas.jme.tree |
(static) simplifyExpression(expr, ruleset, scope) → {JME}
Simplify a JME expression string according to the given ruleset and return it as a JME string.
Parameters:
Name | Type | Description |
---|---|---|
expr |
JME | |
ruleset |
Array.<string> | Numbas.jme.rules.Ruleset | Can be anything accepted by |
scope |
Numbas.jme.Scope |
Returns:
Type | Description |
---|---|
JME |
(static) simplifyTree(exprTree, ruleset, scope, allowUnbound) → {Numbas.jme.tree}
Simplify a syntax tree according to the given ruleset.
Parameters:
Name | Type | Description |
---|---|---|
exprTree |
Numbas.jme.tree | |
ruleset |
Numbas.jme.rules.Ruleset | |
scope |
Numbas.jme.Scope | |
allowUnbound |
boolean |
Returns:
Type | Description |
---|---|
Numbas.jme.tree |
(static) subvars(expr, scope) → {Numbas.jme.tree}
Substitute values into a JME string, and return an expression tree.
Parameters:
Name | Type | Description |
---|---|---|
expr |
JME | |
scope |
Numbas.jme.Scope |
Returns:
Type | Description |
---|---|
Numbas.jme.tree |
(static) texName(tok, longNameMacroopt) → {TeX}
Convert a variable name to TeX.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
tok |
Numbas.jme.token | |||
longNameMacro |
function |
<optional> |
texttt | Function which returns TeX for a long name. |
Returns:
Type | Description |
---|---|
TeX |
(static) texify(tree, settings, scope) → {TeX}
Turn a syntax tree into a TeX string. Data types can be converted to TeX straightforwardly, but operations and functions need a bit more care.
The idea here is that each function and op has a function associated with it which takes a syntax tree with that op at the top and returns the appropriate TeX.
Parameters:
Name | Type | Description |
---|---|---|
tree |
Numbas.jme.tree | |
settings |
Numbas.jme.display.displayer_settings | |
scope |
Numbas.jme.Scope |
Returns:
Type | Description |
---|---|
TeX |
(static) treeToJME(tree, settings, scope) → {JME}
Turn a syntax tree back into a JME expression (used when an expression is simplified).
Parameters:
Name | Type | Description |
---|---|---|
tree |
Numbas.jme.tree | |
settings |
Numbas.jme.display.jme_display_settings | |
scope |
Numbas.jme.Scope |
Returns:
Type | Description |
---|---|
JME |
(static) treeToLaTeX(tree, ruleset, scope) → {TeX}
Convert a compiled JME expression to LaTeX.
Parameters:
Name | Type | Description |
---|---|---|
tree |
Numbas.jme.tree | |
ruleset |
Array.<string> | Numbas.jme.rules.Ruleset | Can be anything accepted by |
scope |
Numbas.jme.Scope |
Returns:
Type | Description |
---|---|
TeX |
Type Definitions
displayer_settings
A dictionary of settings for Numbas.jme.display.texify
.
Properties:
Name | Type | Description |
---|---|---|
fractionnumbers |
boolean | Show all numbers as fractions? |
rowvector |
boolean | Display vectors as a horizontal list of components? |
alwaystimes |
boolean | Always show the multiplication symbol between multiplicands? |
mixedfractions |
boolean | Show top-heavy fractions as mixed fractions, e.g. 3 3/4? |
flatfractions |
boolean | Display fractions horizontally? |
barematrices |
boolean | Render matrices without wrapping them in parentheses. |
nicenumber |
boolean | Run numbers through |
noscientificnumbers |
boolean | If true, don't write numbers in scientific notation. |
accuracy |
number | Accuracy to use when finding rational approximations to numbers. See |
timesdot |
boolean | Use a dot for the multiplication symbol instead of a cross? |
timesspace |
boolean | Use a space for the multiplication symbol instead of a cross? |
jme_display_settings
A dictionary of settings for Numbas.jme.display.treeToJME
.
Properties:
Name | Type | Description |
---|---|---|
fractionnumbers |
boolean | Show all numbers as fractions? |
niceNumber |
boolean | Run numbers through |
wrapexpressions |
boolean | Wrap TExpression tokens in |
store_precision |
boolean | Render numbers along with their precision metadata, if any? |
ignorestringattributes |
boolean | Don't wrap strings in functions for attributes like latex() and safe(). |
matrixcommas |
boolean | Put commas between cells in matrix rows? |
accuracy |
number | Accuracy to use when finding rational approximations to numbers. See |
special_number_definition
Definition of a number with a special name.
Properties:
Name | Type | Description |
---|---|---|
value |
number | |
tex |
TeX | The TeX code for this number. |
jme |
JME | The JME code for this number. |