This module contains the definitions of all the symbols and commands, for
example \alpha, \sin, \mathrm.
There are a few exceptions with some "built-in" commands that require
special parsing such as \char.
Methods
defineEnvironment(names: string,Array.<string>, params: string, options: Object, parser: function)privatestatic
Define one or more environments to be used with
\begin{
names
string
|
Array.<string>
params
string
The number and type of required and optional parameters.
options
Object
-
parser
function
defineFunction(names: string,Array.<string>, params: string, options: Object, handler: function)privatestatic
Define one of more functions.
names
string
|
Array.<string>
params
string
The number and type of required and optional parameters. For example: '{}' defines a single mandatory parameter '[index=2]{indicand}' defines two params, one optional, one required
options
Object
- infix
- allowedInText
handler
function
defineSymbol(latexName: string, mode: string,Array.<string>, fontFamily: string, type: string, value: string, frequencyopt: number,string)privatestatic
latexName
string
The common LaTeX command for this symbol
mode
string
|
Array.<string>
fontFamily
string
type
string
value
string
frequency
number
|
string
optional
defineSymbolRange(from: number, to: number, mode: string, fontFamily: string, type: string, frequencyopt: string,number)privatestatic
Define a set of single-character symbols as a range of Unicode codepoints
from
number
First Unicode codepoint
to
number
Last Unicode codepoint
mode
string
fontFamily
string
type
string
frequency
string
|
number
optional
defineSymbols(string: string, mode: string, fontFamily: string, type: string, frequencyopt: string,number)privatestatic
Define a set of single-character symbols and all their attributes. The value associated with the symbol is the symbol itself.
string
string
a string of single character symbols
mode
string
fontFamily
string
type
string
frequency
string
|
number
optional
frequency(value: string,number, …symbols: ?)privatestatic
Set the frequency of the specified symbol. Default frequency is UNCOMMON The argument list is a frequency value, followed by one or more symbol strings For example: frequency(COMMON , '\sin', '\cos')
value
string
|
number
The frequency as a string constant, or a numeric value [0...2000]
symbols
?
repeatable
getInfo(symbol: string, parseMode: string, macros: object) → anyprivatestatic
symbol
string
A command (e.g. '\alpha') or a character (e.g. 'a')
parseMode
string
One of 'math', 'text', 'string', 'color', 'dimen', etc...
macros
object
A macros dictionary
An info structure about the symbol, or null
matchCodepoint(s: string) → stringprivatestatic
Given a character, return a LaTeX expression matching its Unicode codepoint. The return string is in the ASCII range. If there is a matching symbol (e.g. \alpha) it is returned. If there is no matching symbol and it is outside the ASCII range, an expression with \char is returned.
s
string
parseParamTemplateArgument(argTemplate: string, isOptional: boolean)privatestatic
An argument template has the following syntax:
where
is a string whose value is displayed when the argument is missing is one of 'string', 'color', 'dimen', 'auto', 'text', 'math' is the default value if none is provided for an optional parameter
argTemplate
string
isOptional
boolean
suggest(s: string) → Array.<string>privatestatic
Return an array of suggestion for completing string 's'. For example, for 'si', it could return ['sin', 'sinh', 'sim', 'simeq', 'sigma'] Infix operators are excluded, since they are deprecated commands.
s
string
