Jump to navigation

Namespace: display

Numbas.jme.display

Members

(static) jme.display.specialNumbers :Array.<Numbas.jme.display.special_number_definition>

List of numbers with special names

Type:
Source:

(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
Source:

(static) specialNames :Object.<String>

Names with special renderings

Type:
Source:

(static) texName

Convert a variable name to TeX

Source:

(static) texNameAnnotations

Dictionary of functions to convert specific name annotations to TeX

Properties:
Name Type Description
verbatim
op
vector
unit
dot
matrix
complex
real
positive
nonnegative
negative
integer
decimal
Source:

(static) texOps :function

Define how to texify each operation and function

Type:
Properties:
Name Type Description
"#" function
not function
"+u" function
"-u" function
"^" function
"*" function
"/" function
"+" function
"-" function
dot function
cross function
transpose function
".." function
except function
"<" function
">" function
"<=" function
">=" function
"<>" function
"=" function
and function
or function
xor function
implies function
in function
"|" function
decimal function
abs function
sqrt function
exp function
fact function
ceil function
floor function
int function
defint function
diff function
partialdiff function
sub function
sup function
limit function
mod function
perm function
comb function
root function
if function
switch function
gcd function
lcm function
trunc function
fract function
degrees function
radians function
round function
sign function
random function
max function
min function
precround function
siground function
award function
hour24 function
hour function
ampm function
minute function
second function
msecond function
dayofweek function
sin function
cos function
tan function
sec function
cot function
cosec function
arccos function
arcsin function
arctan function
cosh function
sinh function
tanh function
coth function
cosech function
sech function
arcsinh function
arccosh function
arctanh function
ln function
log function
vector function
rowvector function
matrix function
listval function
verbatim function
set function
"`+-" function
"`*/" function
"`|" function
"`&" function
"`!" function
"`where" function
"`@" function
"`?" function
"`*" function
"`+" function
"`:" function
";" function
";=" function
m_uses function
m_type function
m_exactly function
m_commutative function
m_noncommutative function
m_associative function
m_nonassociative function
m_strictplus function
m_gather function
m_nogather function
m_func function
m_op function
m_numeric function
Source:

(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
Source:

(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
special
conc
op
function
set
Source:

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 Numbas.jme.display.collectRuleset

scope Numbas.jme.Scope
parser Numbas.jme.Parser <optional>
Numbas.jme.standardParser
Returns:
Type Description
TeX
Source:

(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
Source:
See:

(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 Numbas.jme.display.collectRuleset

scope Numbas.jme.Scope
Returns:
Type Description
JME
Source:
See:

(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
Source:
See:

(static) texify(thing, settings) → {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
thing Numbas.jme.tree
settings Numbas.jme.display.texify_settings
Returns:
Type Description
TeX
Source:

(static) treeToJME(tree, settings) → {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
Returns:
Type Description
JME
Source:

Type Definitions

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 Numbas.math.niceNumber?

wrapexpressions Boolean

Wrap TExpression tokens in expression("")?

ignorestringattributes Boolean

don't wrap strings in functions for attributes like latex() and safe()

accuracy Number

Accuracy to use when finding rational approximations to numbers. See Numbas.math.rationalApproximation.

Source:

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

Source:

texify_settings

A dictionary of settings for Numbas.jme.display.texify.

Properties:
Name Type Description
fractionnumbers Boolean

Show all numbers as fractions?

nicenumber Boolean

Run numbers through Numbas.math.niceNumber?

accuracy Number

Accuracy to use when finding rational approximations to numbers. See Numbas.math.rationalApproximation.

rowvector Boolean

Display vectors as a horizontal list of components?

Source: