Fork me on GitHub



INLINE_SHORTCUTS →[string]:stringprivateconstant

These shortcut strings are replaced with the corresponding LaTeX expression without requiring an escape sequence or command.

  • : [string]:string

KEYBOARD_SHORTCUTS →[string]:stringprivateconstant

The index of this array is a keystroke combination as returned by the key field of a JavaScript keyboard event as documented here: except for:

  • EscapeEsc
  • LeftArrow... → Left/Right/Up/Down
  • DeleteDel
  • EscapeEsc
  • ' ' → Spacebar

The modifiers are specified before the main key, in the following order:

  1. Ctrl
  2. Meta: Command key on Mac OS. On Windows this is the Windows key, but the system intercepts those key combinations so they are never received
  3. Alt: Option key on Mac OS
  4. Shift

The keys can be preceded by a context to restrict when the shortcut is applicable. For example, "math:Ctrl-KeyA" will restrict this shortcut to only apply in the "math" context (parseMode). Other valid context include "text" and "command".

The value of the entries represent the command to perform. This can be either a single selector, or an array of a selector followed by its arguments. Selectors uses the following naming conventions:

  • a 'char' is a math atom (a letter, digit, symbol or compound atom)
  • a 'word' is a sequence of math atoms of the same type
  • a 'group' is a sequence of sibling atoms, for example a numerator or a superscript
  • the 'MathField' is the entire expression being edited
  • a 'placeholder' is either an actual placeholder atom or an empty child list, for example an empty numerator
  • 'move' changes the position of the insertion point (and collapses the selection range if necessary)
  • 'extend' keeps the anchor of the selection, but moves the focus (extends, or shrinks, the range of selected items)
  • : [string]:string

REVERSE_KEYBOARD_SHORTCUTS →[string]:stringprivateconstant

Most commands can be associated to their keyboard shortcuts from the KEYBOARD_SHORTCUTS table above, for example 'speakSelection' -> 'Ctrl-KeyR' However, those that contain complex commands are more ambiguous. For example, '\sqrt' -> 'math:Alt-KeyV'. This table provides the reverse mapping for those more complex commands. It is used when displaying keyboard shortcuts for specific commands in the popover.

  • : [string]:string


startsWithString(s: string, config: object): string[]private

Return an array of potential shortcuts

s : string
config : object
: string[]   

validateShortcut(mode: string, siblings: object[], shortcut: string)private

mode : string
siblings : object[]

atoms preceding this potential shortcut

shortcut : string

Type Definitions

MathFieldCallback(mathfield: MathField): void

mathfield : MathField
: void   


  • : Object
locale? : string
strings? : object.<string, string>
horizontalSpacingScale? : number
namespace? : string
substituteTextArea? : function
defaultMode? : "math" | "text"
onFocus? : MathFieldCallback
onBlur? : MathFieldCallback
onKeystroke? : function
onAnnounce? : function
overrideDefaultInlineShortcuts? : boolean
inlineShortcuts? : object.<string, string>
inlineShortcutTimeout? : number
macros? : object.<string, string>
smartFence? : boolean
smartSuperscript? : boolean
scriptDepth? : number
removeExtraneousParentheses? : boolean
ignoreSpacebarInMathMode? : boolean
virtualKeyboardToggleGlyph? : string
virtualKeyboardMode? : "manual" | "onfocus" | "off"
virtualKeyboards? : "all" | "numeric" | "roman" | "greek" | "functions" | "command" | string
virtualKeyboardRomanLayout? : "qwerty" | "azerty" | "qwertz" | "dvorak" | "colemak"
customVirtualKeyboardLayers? : object.<string, string>
customVirtualKeyboards? : object.<string, object>
virtualKeyboardTheme? : "material" | "apple" | ""
keypressVibration? : boolean
keypressSound? : string
plonkSound? : string
textToSpeechRules? : "mathlive" | "sre"
textToSpeechMarkup? : "ssml" | "mac"
textToSpeechRulesOptions? : object
speechEngine? : "local" | "amazon"
speechEngineVoice? : string
speechEngineRate? : string
onMoveOutOf? : function
onTabOutOf? : function
onContentWillChange? : MathFieldCallback
onContentDidChange? : MathFieldCallback
onSelectionWillChange? : MathFieldCallback
onSelectionDidChange? : MathFieldCallback
onUndoStateWillChange? : function
onUndoStateDidChange? : function
onModeChange? : function
onVirtualKeyboardToggle? : function
onReadAloudStatus? : function
handleSpeak? : function
handleReadAloud? : function