new Context()private
This class contains the rendering context of the current parse level.
It also holds information about the parent context to handle scaling adjustments.
When a new scope is entered, a clone of the context is created with .clone()
or .cloneWith() so that any further changes remain local to the scope.
Other functions creating a clone include mathstyle(), fontFamily(), sup(),
sub(), cramp(), etc...
A scope is defined by:
- an explicit group enclosed in braces
{...} - a semi-simple group enclosed in
\bgroup...\endgroup - an environment delimited by
\begin{<envname>}...\end{<envname>}
Properties
mathstyle
string
'text' (aka 'inline'), 'display',
'script' or 'scriptscript'
color
string
backgroundcolor
string
size
number
phantom
boolean
font
string
generateID
boolean
If true, unique IDs should be generated for each span so they can be tracked by to an atom
isSelected
boolean
If true, items rendered in this context should be rendered in a selected state
parentMathstyle
string
parentSize
number
macros
object
A macros dictionary
Methods
cloneWith(property: string, value: *) → Contextprivate
Create a new context, identical to this object, except for the given property/value pair.
property
string
value
*
getBackgroundColor() → stringprivate
Gets the CSS background color in effect
An hexadecimal color string, e.g. "#cd0030", or 'transparent'
getColor() → stringprivate
Gets the CSS (foreground) color in effect
An hexadecimal color string, e.g. "#cd0030", or 'transparent'
setMathstyle(value: string)private
Change the mathstyle of this context
value
string
'auto' to indicate that the mathstyle should in
fact not be changed. This is used when specifying the mathstyle for some
environments.
withMathstyle(value: string)private
Return a clone context with the specified mathstyle
value
string
