itutor-mathlive
Version:
Beautifully typeset math made easy
502 lines (485 loc) • 66.9 kB
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"><title>MASTON - MathLive Docs</title><meta name="description" content="Beautifully typeset math made easy"><meta name="keywords" content="latex, tex, math, typesetting, documentation, docs">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700|Source+Sans+Pro:400,400i,700,900" rel="stylesheet">
<style>pre.prettyprint{background: #35434e;}</style>
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow-night.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
<link type="text/css" rel="stylesheet" href="styles/custom.css">
</head>
<body>
<div class="forkme"><a href="https://github.com/arnog/mathlive"><img style="position: absolute; top: 0; right: 0; border: 0; z-index:1;" src="https://camo.githubusercontent.com/52760788cde945287fbb584134c4cbc2bc36f904/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f77686974655f6666666666662e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"></a></div>
<section role="navigation">
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav id="nav">
<h3 class="group-title home"><a href="index.html">MathLive Docs</a></h3><input class="search" placeholder="Search" type="text"><div class="list"><h3 class="group-title">Tutorials</h3><ul><li><a href="tutorial-CONTRIBUTOR_GUIDE.html">Contributor Guide</a></li><li><a href="tutorial-MASTON.html">MASTON</a></li><li><a href="tutorial-USAGE_GUIDE.html">Usage Guide</a></li></ul><h3 class="group-title">Classes</h3><ul><li class="private"><a href="Context.html" class="className">Context</a><ul class='methods private'><li data-type='method' class='private'><a href="Context.html#clone" class="methodName">clone</a></li><li data-type='method' class='private'><a href="Context.html#cloneWith" class="methodName">cloneWith</a></li><li data-type='method' class='private'><a href="Context.html#getBackgroundColor" class="methodName">getBackgroundColor</a></li><li data-type='method' class='private'><a href="Context.html#getColor" class="methodName">getColor</a></li><li data-type='method' class='private'><a href="Context.html#setMathstyle" class="methodName">setMathstyle</a></li><li data-type='method' class='private'><a href="Context.html#withMathstyle" class="methodName">withMathstyle</a></li></ul></li><li><a href="EditableMathlist.html" class="className">EditableMathlist</a><ul class='methods'><li data-type='method'><a href="EditableMathlist.html#_addCell" class="methodName">_addCell</a></li><li data-type='method'><a href="EditableMathlist.html#_deleteAtoms" class="methodName">_deleteAtoms</a></li><li data-type='method'><a href="EditableMathlist.html#addColumnAfter_" class="methodName">addColumnAfter_</a></li><li data-type='method'><a href="EditableMathlist.html#addColumnBefore_" class="methodName">addColumnBefore_</a></li><li data-type='method'><a href="EditableMathlist.html#addRowAfter_" class="methodName">addRowAfter_</a></li><li data-type='method'><a href="EditableMathlist.html#addRowBefore_" class="methodName">addRowBefore_</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#ancestor" class="methodName">ancestor</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#anchor" class="methodName">anchor</a></li><li data-type='method'><a href="EditableMathlist.html#applyStyle" class="methodName">applyStyle</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#commandOffsets" class="methodName">commandOffsets</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#commitCommandStringBeforeInsertionPoint" class="methodName">commitCommandStringBeforeInsertionPoint</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#contains" class="methodName">contains</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#decorateCommandStringAroundInsertionPoint" class="methodName">decorateCommandStringAroundInsertionPoint</a></li><li data-type='method'><a href="EditableMathlist.html#delete" class="methodName">delete</a></li><li data-type='method'><a href="EditableMathlist.html#delete_" class="methodName">delete_</a></li><li data-type='method'><a href="EditableMathlist.html#deleteAll_" class="methodName">deleteAll_</a></li><li data-type='method'><a href="EditableMathlist.html#deleteNextChar_" class="methodName">deleteNextChar_</a></li><li data-type='method'><a href="EditableMathlist.html#deleteNextWord_" class="methodName">deleteNextWord_</a></li><li data-type='method'><a href="EditableMathlist.html#deletePreviousChar_" class="methodName">deletePreviousChar_</a></li><li data-type='method'><a href="EditableMathlist.html#deletePreviousWord_" class="methodName">deletePreviousWord_</a></li><li data-type='method'><a href="EditableMathlist.html#deleteToGroupEnd_" class="methodName">deleteToGroupEnd_</a></li><li data-type='method'><a href="EditableMathlist.html#deleteToGroupStart_" class="methodName">deleteToGroupStart_</a></li><li data-type='method'><a href="EditableMathlist.html#deleteToMathFieldEnd_" class="methodName">deleteToMathFieldEnd_</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#endOffset" class="methodName">endOffset</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#extend" class="methodName">extend</a></li><li data-type='method'><a href="EditableMathlist.html#extendDown_" class="methodName">extendDown_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToGroupEnd_" class="methodName">extendToGroupEnd_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToGroupStart_" class="methodName">extendToGroupStart_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToMathFieldEnd_" class="methodName">extendToMathFieldEnd_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToMathFieldStart_" class="methodName">extendToMathFieldStart_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToNextBoundary_" class="methodName">extendToNextBoundary_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToNextChar_" class="methodName">extendToNextChar_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToNextWord_" class="methodName">extendToNextWord_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToPreviousBoundary_" class="methodName">extendToPreviousBoundary_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToPreviousChar_" class="methodName">extendToPreviousChar_</a></li><li data-type='method'><a href="EditableMathlist.html#extendToPreviousWord_" class="methodName">extendToPreviousWord_</a></li><li data-type='method'><a href="EditableMathlist.html#extendUp_" class="methodName">extendUp_</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#extractCharactersBeforeInsertionPoint" class="methodName">extractCharactersBeforeInsertionPoint</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#extractCommandStringAroundInsertionPoint" class="methodName">extractCommandStringAroundInsertionPoint</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#extractContents" class="methodName">extractContents</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#extractContentsOrdInGroupBeforeInsertionPoint" class="methodName">extractContentsOrdInGroupBeforeInsertionPoint</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#filter" class="methodName">filter</a></li><li data-type='method'><a href="EditableMathlist.html#insert" class="methodName">insert</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#insertFirstAtom" class="methodName">insertFirstAtom</a></li><li data-type='method'><a href="EditableMathlist.html#isCollapsed" class="methodName">isCollapsed</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#jump" class="methodName">jump</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#leap" class="methodName">leap</a></li><li data-type='method'><a href="EditableMathlist.html#moveAfterParent_" class="methodName">moveAfterParent_</a></li><li data-type='method'><a href="EditableMathlist.html#moveBeforeParent_" class="methodName">moveBeforeParent_</a></li><li data-type='method'><a href="EditableMathlist.html#moveDown_" class="methodName">moveDown_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToGroupEnd_" class="methodName">moveToGroupEnd_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToGroupStart_" class="methodName">moveToGroupStart_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToMathFieldEnd_" class="methodName">moveToMathFieldEnd_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToMathFieldStart_" class="methodName">moveToMathFieldStart_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToNextChar_" class="methodName">moveToNextChar_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToNextPlaceholder_" class="methodName">moveToNextPlaceholder_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToNextWord_" class="methodName">moveToNextWord_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToOpposite_" class="methodName">moveToOpposite_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToPreviousChar_" class="methodName">moveToPreviousChar_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToPreviousPlaceholder_" class="methodName">moveToPreviousPlaceholder_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToPreviousWord_" class="methodName">moveToPreviousWord_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToSubscript_" class="methodName">moveToSubscript_</a></li><li data-type='method'><a href="EditableMathlist.html#moveToSuperscript_" class="methodName">moveToSuperscript_</a></li><li data-type='method'><a href="EditableMathlist.html#moveUp_" class="methodName">moveUp_</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#next" class="methodName">next</a></li><li data-type='method'><a href="EditableMathlist.html#selectAll_" class="methodName">selectAll_</a></li><li data-type='method'><a href="EditableMathlist.html#selectGroup_" class="methodName">selectGroup_</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#setExtent" class="methodName">setExtent</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#setRange" class="methodName">setRange</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#setSelection" class="methodName">setSelection</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#sibling" class="methodName">sibling</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#siblings" class="methodName">siblings</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#skip" class="methodName">skip</a></li><li data-type='method'><a href="EditableMathlist.html#speakAll_" class="methodName">speakAll_</a></li><li data-type='method'><a href="EditableMathlist.html#speakAllWithSynchronizedHighlighting_" class="methodName">speakAllWithSynchronizedHighlighting_</a></li><li data-type='method'><a href="EditableMathlist.html#speakGroup_" class="methodName">speakGroup_</a></li><li data-type='method'><a href="EditableMathlist.html#speakLeftSibling_" class="methodName">speakLeftSibling_</a></li><li data-type='method'><a href="EditableMathlist.html#speakParent_" class="methodName">speakParent_</a></li><li data-type='method'><a href="EditableMathlist.html#speakRightSibling_" class="methodName">speakRightSibling_</a></li><li data-type='method'><a href="EditableMathlist.html#speakSelection_" class="methodName">speakSelection_</a></li><li data-type='method'><a href="EditableMathlist.html#speakSelectionWithSynchronizedHighlighting_" class="methodName">speakSelectionWithSynchronizedHighlighting_</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#startOffset" class="methodName">startOffset</a></li><li data-type='method' class='private'><a href="EditableMathlist.html#toString" class="methodName">toString</a></li><li data-type='method'><a href="EditableMathlist.html#transpose_" class="methodName">transpose_</a></li></ul></li><li class="private"><a href="Lexer.html" class="className">Lexer</a><ul class='methods private'><li data-type='method' class='private'><a href="Lexer.html#end" class="methodName">end</a></li><li data-type='method' class='private'><a href="Lexer.html#get" class="methodName">get</a></li><li data-type='method' class='private'><a href="Lexer.html#isWhiteSpace" class="methodName">isWhiteSpace</a></li><li data-type='method' class='private'><a href="Lexer.html#makeToken" class="methodName">makeToken</a></li><li data-type='method' class='private'><a href="Lexer.html#peek" class="methodName">peek</a></li><li data-type='method' class='private'><a href="Lexer.html#scan" class="methodName">scan</a></li></ul></li><li class="private"><a href="MathAtom.html" class="className">MathAtom</a><ul class='methods private'><li data-type='method' class='private'><a href="MathAtom.html#.toSpeakableText" class="methodName">toSpeakableText</a></li><li data-type='method' class='private'><a href="MathAtom.html#bind" class="methodName">bind</a></li><li data-type='method' class='private'><a href="MathAtom.html#decompose" class="methodName">decompose</a></li><li data-type='method' class='private'><a href="MathAtom.html#decomposeGenfrac" class="methodName">decomposeGenfrac</a></li><li data-type='method' class='private'><a href="MathAtom.html#decomposeLeftright" class="methodName">decomposeLeftright</a></li><li data-type='method' class='private'><a href="MathAtom.html#decomposeLine" class="methodName">decomposeLine</a></li><li data-type='method' class='private'><a href="MathAtom.html#decomposeRule" class="methodName">decomposeRule</a></li><li data-type='method' class='private'><a href="MathAtom.html#filter" class="methodName">filter</a></li><li data-type='method' class='private'><a href="MathAtom.html#makeSpan" class="methodName">makeSpan</a></li></ul></li><li><a href="MathField.html" class="className">MathField</a><ul class='methods'><li data-type='method' class='private'><a href="MathField.html#_getCaretPosition" class="methodName">_getCaretPosition</a></li><li data-type='method' class='private'><a href="MathField.html#_onKeystroke" class="methodName">_onKeystroke</a></li><li data-type='method' class='private'><a href="MathField.html#complete_" class="methodName">complete_</a></li><li data-type='method'><a href="MathField.html#el" class="methodName">el</a></li><li data-type='method' class='private'><a href="MathField.html#enterCommandMode_" class="methodName">enterCommandMode_</a></li><li data-type='method'><a href="MathField.html#insert" class="methodName">insert</a></li><li data-type='method'><a href="MathField.html#keystroke" class="methodName">keystroke</a></li><li data-type='method'><a href="MathField.html#latex" class="methodName">latex</a></li><li data-type='method'><a href="MathField.html#perform" class="methodName">perform</a></li><li data-type='method'><a href="MathField.html#perform" class="methodName">perform</a></li><li data-type='method' class='private'><a href="MathField.html#render" class="methodName">render</a></li><li data-type='method'><a href="MathField.html#revertToOriginalContent" class="methodName">revertToOriginalContent</a></li><li data-type='method'><a href="MathField.html#selectedText" class="methodName">selectedText</a></li><li data-type='method'><a href="MathField.html#selectionAtEnd" class="methodName">selectionAtEnd</a></li><li data-type='method'><a href="MathField.html#selectionAtStart" class="methodName">selectionAtStart</a></li><li data-type='method'><a href="MathField.html#selectionDepth" class="methodName">selectionDepth</a></li><li data-type='method'><a href="MathField.html#selectionIsCollapsed" class="methodName">selectionIsCollapsed</a></li><li data-type='method'><a href="MathField.html#setConfig" class="methodName">setConfig</a></li><li data-type='method'><a href="MathField.html#text" class="methodName">text</a></li><li data-type='method'><a href="MathField.html#typedText" class="methodName">typedText</a></li></ul></li><li class="private"><a href="module-mathstyle.Mathstyle.html" class="className">Mathstyle</a></li><li class="private"><a href="Parser.html" class="className">Parser</a><ul class='methods private'><li data-type='method' class='private'><a href="Parser.html#end" class="methodName">end</a></li><li data-type='method' class='private'><a href="Parser.html#hasLiteral" class="methodName">hasLiteral</a></li><li data-type='method' class='private'><a href="Parser.html#hasLiteralPattern" class="methodName">hasLiteralPattern</a></li><li data-type='method' class='private'><a href="Parser.html#hasToken" class="methodName">hasToken</a></li><li data-type='method' class='private'><a href="Parser.html#lastMathAtom" class="methodName">lastMathAtom</a></li><li data-type='method' class='private'><a href="Parser.html#parseAtom" class="methodName">parseAtom</a></li><li data-type='method' class='private'><a href="Parser.html#parseKeyword" class="methodName">parseKeyword</a></li><li data-type='method' class='private'><a href="Parser.html#parseLimits" class="methodName">parseLimits</a></li><li data-type='method' class='private'><a href="Parser.html#parseSupSub" class="methodName">parseSupSub</a></li><li data-type='method' class='private'><a href="Parser.html#parseToken" class="methodName">parseToken</a></li><li data-type='method' class='private'><a href="Parser.html#scanArg" class="methodName">scanArg</a></li><li data-type='method' class='private'><a href="Parser.html#scanColor" class="methodName">scanColor</a></li><li data-type='method' class='private'><a href="Parser.html#scanDelim" class="methodName">scanDelim</a></li><li data-type='method' class='private'><a href="Parser.html#scanDimen" class="methodName">scanDimen</a></li><li data-type='method' class='private'><a href="Parser.html#scanEnvironment" class="methodName">scanEnvironment</a></li><li data-type='method' class='private'><a href="Parser.html#scanGroup" class="methodName">scanGroup</a></li><li data-type='method' class='private'><a href="Parser.html#scanImplicitGroup" class="methodName">scanImplicitGroup</a></li><li data-type='method' class='private'><a href="Parser.html#scanLeftRight" class="methodName">scanLeftRight</a></li><li data-type='method' class='private'><a href="Parser.html#scanModeSet" class="methodName">scanModeSet</a></li><li data-type='method' class='private'><a href="Parser.html#scanModeShift" class="methodName">scanModeShift</a></li><li data-type='method' class='private'><a href="Parser.html#scanNumber" class="methodName">scanNumber</a></li><li data-type='method' class='private'><a href="Parser.html#scanString" class="methodName">scanString</a></li><li data-type='method' class='private'><a href="Parser.html#scanToken" class="methodName">scanToken</a></li></ul></li><li class="private"><a href="Span.html" class="className">Span</a></li><li class="private"><a href="Token.html" class="className">Token</a></li><li class="private"><a href="UndoManager.html" class="className">UndoManager</a><ul class='methods private'><li data-type='method' class='private'><a href="UndoManager.html#canRedo" class="methodName">canRedo</a></li><li data-type='method' class='private'><a href="UndoManager.html#canUndo" class="methodName">canUndo</a></li><li data-type='method' class='private'><a href="UndoManager.html#redo" class="methodName">redo</a></li><li data-type='method' class='private'><a href="UndoManager.html#snapshot" class="methodName">snapshot</a></li><li data-type='method' class='private'><a href="UndoManager.html#undo" class="methodName">undo</a></li></ul></li></ul><h3 class="group-title">Modules</h3><ul><li class="private"><a href="module-color.html" class="className">color</a><ul class='methods private'><li data-type='method' class='private'><a href="module-color.html#.stringToColor" class="methodName">stringToColor</a></li></ul></li><li class="private"><a href="module-definitions.html" class="className">definitions</a><ul class='methods private'><li data-type='method' class='private'><a href="module-definitions.html#.defineEnvironment" class="methodName">defineEnvironment</a></li><li data-type='method' class='private'><a href="module-definitions.html#.defineFunction" class="methodName">defineFunction</a></li><li data-type='method' class='private'><a href="module-definitions.html#.defineSymbol" class="methodName">defineSymbol</a></li><li data-type='method' class='private'><a href="module-definitions.html#.defineSymbolRange" class="methodName">defineSymbolRange</a></li><li data-type='method' class='private'><a href="module-definitions.html#.defineSymbols" class="methodName">defineSymbols</a></li><li data-type='method' class='private'><a href="module-definitions.html#.frequency" class="methodName">frequency</a></li><li data-type='method' class='private'><a href="module-definitions.html#.getInfo" class="methodName">getInfo</a></li><li data-type='method' class='private'><a href="module-definitions.html#.matchCodepoint" class="methodName">matchCodepoint</a></li><li data-type='method' class='private'><a href="module-definitions.html#.matchFunction" class="methodName">matchFunction</a></li><li data-type='method' class='private'><a href="module-definitions.html#.parseParamTemplateArgument" class="methodName">parseParamTemplateArgument</a></li><li data-type='method' class='private'><a href="module-definitions.html#.suggest" class="methodName">suggest</a></li></ul></li><li class="private"><a href="module-delimiters.html" class="className">delimiters</a><ul class='methods private'><li data-type='method' class='private'><a href="module-delimiters.html#.makeCustomSizedDelim" class="methodName">makeCustomSizedDelim</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.makeInner" class="methodName">makeInner</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.makeLargeDelim" class="methodName">makeLargeDelim</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.makeLeftRightDelim" class="methodName">makeLeftRightDelim</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.makeNullFence" class="methodName">makeNullFence</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.makeSizedDelim" class="methodName">makeSizedDelim</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.makeSmallDelim" class="methodName">makeSmallDelim</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.makeStackedDelim" class="methodName">makeStackedDelim</a></li><li data-type='method' class='private'><a href="module-delimiters.html#.traverseSequence" class="methodName">traverseSequence</a></li></ul></li><li class="private"><a href="module-editor_editableMathlist.html" class="className">editor/editableMathlist</a><ul class='methods private'><li data-type='method' class='private'><a href="module-editor_editableMathlist.html#~atomContains" class="methodName">atomContains</a></li></ul></li><li class="private"><a href="module-editor_keyboard.html" class="className">editor/keyboard</a><ul class='methods private'><li data-type='method' class='private'><a href="module-editor_keyboard.html#.delegateKeyboardEvents" class="methodName">delegateKeyboardEvents</a></li><li data-type='method' class='private'><a href="module-editor_keyboard.html#.keyboardEventToString" class="methodName">keyboardEventToString</a></li></ul></li><li class="private"><a href="module-editor_mathfield.html" class="className">editor/mathfield</a><ul class='methods private'><li data-type='method' class='private'><a href="module-editor_mathfield.html#nearestElementFromPoint" class="methodName">nearestElementFromPoint</a></li></ul></li><li class="private"><a href="module-editor_mathpath.html" class="className">editor/mathpath</a><ul class='methods private'><li data-type='method' class='private'><a href="module-editor_mathpath.html#.pathCommonAncestor" class="methodName">pathCommonAncestor</a></li><li data-type='method' class='private'><a href="module-editor_mathpath.html#.pathDistance" class="methodName">pathDistance</a></li><li data-type='method' class='private'><a href="module-editor_mathpath.html#.pathFromString" class="methodName">pathFromString</a></li><li data-type='method' class='private'><a href="module-editor_mathpath.html#.pathToString" class="methodName">pathToString</a></li></ul></li><li class="private"><a href="module-editor_shortcuts.html" class="className">editor/shortcuts</a><ul class='methods private'><li data-type='method' class='private'><a href="module-editor_shortcuts.html#.match" class="methodName">match</a></li><li data-type='method' class='private'><a href="module-editor_shortcuts.html#.matchKeystroke" class="methodName">matchKeystroke</a></li><li data-type='method' class='private'><a href="module-editor_shortcuts.html#.platform" class="methodName">platform</a></li><li data-type='method' class='private'><a href="module-editor_shortcuts.html#.stringify" class="methodName">stringify</a></li></ul></li><li class="private"><a href="module-fontMetrics.html" class="className">fontMetrics</a><ul class='methods private'><li data-type='method' class='private'><a href="module-fontMetrics.html#.getCharacterMetrics" class="methodName">getCharacterMetrics</a></li></ul></li><li class="private"><a href="module-lexer.html" class="className">lexer</a><ul class='methods private'><li data-type='method' class='private'><a href="module-lexer.html#.tokenize" class="methodName">tokenize</a></li></ul></li><li class="private"><a href="module-mathAtom.html" class="className">mathAtom</a><ul class='methods private'><li data-type='method' class='private'><a href="module-mathAtom.html#.decompose" class="methodName">decompose</a></li><li data-type='method' class='private'><a href="module-mathAtom.html#.getFontName" class="methodName">getFontName</a></li><li data-type='method' class='private'><a href="module-mathAtom.html#.makeColGap" class="methodName">makeColGap</a></li><li data-type='method' class='private'><a href="module-mathAtom.html#.makeColOfRepeatingElements" class="methodName">makeColOfRepeatingElements</a></li><li data-type='method' class='private'><a href="module-mathAtom.html#.makeStack" class="methodName">makeStack</a></li></ul></li><li><a href="module-mathlive.html" class="className">mathlive</a><ul class='methods'><li data-type='method'><a href="module-mathlive.html#latexToAST" class="methodName">latexToAST</a></li><li data-type='method'><a href="module-mathlive.html#latexToMarkup" class="methodName">latexToMarkup</a></li><li data-type='method'><a href="module-mathlive.html#latexToMathML" class="methodName">latexToMathML</a></li><li data-type='method'><a href="module-mathlive.html#latexToSpeakableText" class="methodName">latexToSpeakableText</a></li><li data-type='method'><a href="module-mathlive.html#makeMathField" class="methodName">makeMathField</a></li><li data-type='method'><a href="module-mathlive.html#pauseReadAloud" class="methodName">pauseReadAloud</a></li><li data-type='method'><a href="module-mathlive.html#playReadAloud" class="methodName">playReadAloud</a></li><li data-type='method'><a href="module-mathlive.html#readAloud" class="methodName">readAloud</a></li><li data-type='method'><a href="module-mathlive.html#readAloudStatus" class="methodName">readAloudStatus</a></li><li data-type='method'><a href="module-mathlive.html#renderMathInDocument" class="methodName">renderMathInDocument</a></li><li data-type='method'><a href="module-mathlive.html#renderMathInElement" class="methodName">renderMathInElement</a></li><li data-type='method'><a href="module-mathlive.html#resumeReadAloud" class="methodName">resumeReadAloud</a></li><li data-type='method'><a href="module-mathlive.html#revertToOriginalContent" class="methodName">revertToOriginalContent</a></li><li data-type='method'><a href="module-mathlive.html#revertToOriginalContent" class="methodName">revertToOriginalContent</a></li></ul></li><li class="private"><a href="module-mathstyle.html" class="className">mathstyle</a><ul class='methods private'><li data-type='method' class='private'><a href="module-mathstyle.html#.toMathstyle" class="methodName">toMathstyle</a></li></ul></li><li class="private"><a href="module-span.html" class="className">span</a><ul class='methods private'><li data-type='method' class='private'><a href="module-span.html#.coalesce" class="methodName">coalesce</a></li><li data-type='method' class='private'><a href="module-span.html#.makeFontSizer" class="methodName">makeFontSizer</a></li><li data-type='method' class='private'><a href="module-span.html#.makeHlist" class="methodName">makeHlist</a></li><li data-type='method' class='private'><a href="module-span.html#.makeSpan" class="methodName">makeSpan</a></li><li data-type='method' class='private'><a href="module-span.html#.makeSpanOfType" class="methodName">makeSpanOfType</a></li><li data-type='method' class='private'><a href="module-span.html#.makeSymbol" class="methodName">makeSymbol</a></li><li data-type='method' class='private'><a href="module-span.html#.makeVlist" class="methodName">makeVlist</a></li><li data-type='method' class='private'><a href="module-span.html#.toString" class="methodName">toString</a></li></ul></li></ul><label class="checkbox"><input id="toggle-private" type="checkbox" onclick="
if (!document.getElementById('toggle-private').checked) {
document.documentElement.classList.add('no-private')
writeCookie('symbol-access', 'no-private')
} else {
document.documentElement.classList.remove('no-private')
writeCookie('symbol-access', 'private')
}
">Include Private Symbols</input></label></div>
<footer role="contentInfo">
Made with <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>.
</footer>
</nav>
</section>
<main id="main">
<h1 class="page-title">MASTON</h1>
<section>
<header>
</header>
<article>
<h1 id="the-maston-format">The MASTON Format</h1>
<p>The <strong>Math Abstract Syntax Tree Object Notation</strong> is a lightweight data
interchange format for mathematical notation.</p>
<p>It is human-readable, while being easy for machines to generate and parse.</p>
<p>It is built on the JSON [1] format. Its focus is on interoperability between
software programs to facilitate the exchange of mathematical data, as well as
the building of complex software through the integration of software components communicating with
a common format.</p>
<p>It is not suitable as a visual representation of arbitrary mathematical
notations, and as such is not a replacement for LaTeX or MathML.</p>
<h2 id="examples">Examples</h2>
<h3 id="euler-s-identity">Euler's Identity</h3>
<p>In TeX</p>
<pre class="prettyprint source lang-tex"><code>e^{\imaginaryI \pi }+1=0</code></pre><p>In MASTON:</p>
<pre class="prettyprint source lang-JSON"><code> {
"fn":"=",
"arg":[{
"fn":"+",
"arg":[
{
"sym":"e",
"sup":{
"fn":"*",
"arg":["ⅈ","π"]
}
},
1
]
},
0]
}</code></pre><h3 id="an-approximation-of-pi">An approximation of Pi</h3>
<pre class="prettyprint source lang-tex"><code>\frac {63}{25}\times \frac {17+15\sqrt{5}}{7+15\sqrt{5}}</code></pre><pre class="prettyprint source lang-JSON"><code>{"fn":"*","arg":[{"fn":"/","arg":[63,25]},{"fn":"/","arg":[{"fn":"+","arg":[17,{"fn":"*","arg":[15,{"fn":"sqrt","arg":5}]}]},{"fn":"+","arg":[7,{"fn":"*","arg":[15,{"fn":"sqrt","arg":5}]}]}]}]}</code></pre><h2 id="design-goals">Design Goals</h2>
<h3 id="definitions">Definitions</h3>
<ul>
<li><strong>producer</strong> software that generates a MASTON data structure</li>
<li><strong>consumer</strong> software that parses and acts on a MASTON data structure</li>
</ul>
<h3 id="goals">Goals</h3>
<ul>
<li>Easy to consume, even if that's at the expense of complexity to generate.</li>
<li>Extensibility. It should be possible to add information to the data structure
that can help its interpretation or its rendition. This information should be
optional and can be ignored by any consumer.</li>
</ul>
<h3 id="non-goals">Non-goals</h3>
<ul>
<li>Be suitable as an internal data structure</li>
<li>Be suitable as a display format</li>
<li>Capture complete semantic information with no ambiguity and in a self-sufficient manner.</li>
</ul>
<h2 id="encoding">Encoding</h2>
<p>A MASTON expression is an <a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree">abstract syntax tree</a>
encoded as a JSON object. </p>
<p>The root element is an ⟨expression⟩, with child nodes according
to the grammar below.</p>
<h3 id="native-numbers">Native Numbers</h3>
<p>A native number is encoded following the JSON grammar, with two extensions:</p>
<ul>
<li>support for arbitrary precision numbers. The number of digits included may be
more than supported by consuming software. The software can handle this
situation by either reading only as many digits as can be supported internally
or by treating it as an error.</li>
<li>support for <code>NaN</code> and <code>infinity</code></li>
</ul>
<p>⟨native-number⟩ := <code>'"NaN"'</code> | ⟨native-infinity⟩ |
[<code>'-'</code>] ⟨native-int⟩ [ ⟨native-frac⟩] [ ⟨native-exp⟩ ]</p>
<p>⟨native-infinity⟩ := <code>'"'</code> [<code>'+'</code> | <code>'-'</code>] <code>'infinity'</code> <code>'"'</code></p>
<p>⟨native-int⟩ := <code>'0'</code> | [ <code>'1'</code> - <code>'9'</code> ]*</p>
<p>⟨native-frac⟩ := <code>'.'</code> (<code>'0'</code> - <code>'9'</code>)*</p>
<p>⟨native-exp⟩ := [<code>'e'</code> | <code>'E'</code>] [<code>'+'</code> | <code>'-'</code>] (<code>'0'</code> - <code>'9'</code> )*</p>
<h3 id="native-strings">Native Strings</h3>
<p>Native strings are a sequence of Unicode characters.</p>
<p>As per JSON, any Unicode character may be escaped using a <code>\u</code> escape sequence.</p>
<p>MATSON producing software should not generate character entities in
strings.</p>
<p>Whenever applicable, a specific Unicode symbol should be used.</p>
<p>For example, the set of complex numbers should be represented with U+2102 ℂ,
not with U+0043 C and a math variant styling attribute.</p>
<p>See <a href="http://www.unicode.org/versions/Unicode10.0.0/ch22.pdf">Unicode Chapter 22 - Symbols</a></p>
<blockquote>
<p>When used with markup languages—for example, with Mathematical Markup Language
(MathML)—the characters are expected to be used directly, instead of indirectly via
entity references or by composing them from base letters and style markup.</p>
</blockquote>
<h3 id="optional-keys">Optional keys</h3>
<p>All elements may have the following keys:</p>
<ul>
<li><code>comment</code>: A human readable string to annotate an expression, since JSON does not allow comments in its encoding</li>
<li><code>error</code>: A human readable string that can be used to indicate a syntax error or other problem when parsing or evaluating an expression.</li>
<li><code>latex</code>: A visual representation in LaTeX of the expression. This can be useful to preserve non-semantic details, for example parentheses in an expression.</li>
<li><code>mathml</code>: A visual representation in MathML of the expression.</li>
<li><code>class</code>: A CSS class to be associated with a representation of this element</li>
<li><code>id</code>: A CSS id to be associated with a representation of this element</li>
<li><code>style</code>: A CSS style string</li>
<li><code>wikidata</code>: A short string indicating an entry in a wikibase. For example,
<code>"Q2111"</code></li>
<li><code>wikibase</code>: A base URL for the wikidata key. A full URL can be produced
by concatenating this key with the wikidata key. This key applies to
this element and all its children. The default value is "https://www.wikidata.org/wiki/"</li>
<li><code>openmathcd</code>: A base URL for an OpenMath content dictionary. This key applies to
this element and all its children. The default value is "http://www.openmath.org/cd".</li>
<li><code>openmathsymbol</code>: A short string indicating an entry in an OpenMath Content
Dictionary. For example: <code>arith1/#abs</code>.</li>
</ul>
<h3 id="key-order">Key order</h3>
<p>The order of the keys in an element is not significant. That is, all these
expressions are equivalent:</p>
<pre class="prettyprint source lang-JSON"><code> {"fn":"+", "arg":[1, 2]}
{"arg":[1, 2], "fn":"+"}</code></pre><p>Howeve, the order of the elements in an array <em>is</em> significant. These two
expressions are <em>not</em> equivalent:</p>
<pre class="prettyprint source lang-JSON"><code> {"fn":"-", "arg":[3, 1]}
{"fn":"-", "arg":[1, 3]}</code></pre><h2 id="grammar">Grammar</h2>
<p>⟨expression⟩ := ⟨num⟩ |
⟨complex⟩ |
⟨symbol⟩ |
⟨function⟩ |
⟨group⟩ |
⟨range⟩ |
⟨array⟩ |
⟨dictionary⟩ |
⟨text⟩ |
⟨block⟩</p>
<p>An expression is an Abstract Syntax Tree. As such, there is no need to introduce parentheses or to resort to operator precedence in order to parse the expression correctly.</p>
<h3 id="-langle-num-rangle-">⟨num⟩</h3>
<p>A native number or an object with the following key</p>
<ul>
<li><code>num</code>: ⟨native-number⟩ or ⟨native-string⟩</li>
</ul>
<p><strong>Note:</strong> When only the <code>num</code> key is present a shortcut may be used by
replacing the element with the number. That is, both representations are equivalent:</p>
<pre class="prettyprint source lang-JSON"><code> {"fn":"+", "arg":[{"num":1}, {"num":2}]}
{"fn":"+", "arg":[1, 2]}</code></pre><h3 id="-langle-complex-rangle-">⟨complex⟩</h3>
<ul>
<li><code>re</code>: ⟨native-number⟩, 0 by default.</li>
<li><code>im</code>: ⟨native-number⟩, 0 by default.</li>
</ul>
<p>One of the keys <code>re</code> or <code>im</code> must be present.</p>
<p>Note that <code>{re:1}</code> is a complex number with a null imaginary part.</p>
<h3 id="-langle-symbol-rangle-">⟨symbol⟩</h3>
<p>A string or an object with the following keys</p>
<ul>
<li><code>sym</code>: ⟨native-string⟩</li>
<li><code>type</code>: the data type of the symbol, as a string. See table below.</li>
<li><code>index</code>: A 0-based index into a vector or array. An index can be a number or an array of numbers.</li>
<li><code>accent</code>: ⟨string⟩, a single unicode character representing the accent to display over the symbol.</li>
</ul>
<h3 id="type">Type</h3>
<p>The data type of a symbol can be used to refine the interpretation of operations performed upon it.</p>
<table>
<thead>
<tr>
<th>Data Type</th>
<th style="text-align:left">Value</th>
<th style="text-align:left">Meanings</th>
</tr>
</thead>
<tbody>
<tr>
<td> Scalar</td>
<td style="text-align:left"><code>scalar</code></td>
<td style="text-align:left">scalar number</td>
</tr>
<tr>
<td> Complex</td>
<td style="text-align:left"><code>complex</code></td>
<td style="text-align:left">complex number</td>
</tr>
<tr>
<td> Vector</td>
<td style="text-align:left"><code>vector</code></td>
<td style="text-align:left">an element composed of n scalars or complex numbers</td>
</tr>
<tr>
<td> Matrix</td>
<td style="text-align:left"><code>matrix</code></td>
<td style="text-align:left">an element composed of n vectors</td>
</tr>
<tr>
<td> Function</td>
<td style="text-align:left"><code>function</code></td>
</tr>
<tr>
<td> String</td>
<td style="text-align:left"><code>string</code></td>
<td style="text-align:left">an array of characters</td>
</tr>
<tr>
<td> Dictionary</td>
<td style="text-align:left"><code>dictionary</code></td>
<td style="text-align:left">a collection of key/value pairs</td>
</tr>
<tr>
<td> Boolean</td>
<td style="text-align:left"><code>boolean</code></td>
<td style="text-align:left">true or false</td>
</tr>
<tr>
<td> Table</td>
<td style="text-align:left"><code>table</code></td>
<td style="text-align:left">a two-dimensional array of cells. Each cell can be of a different type.</td>
</tr>
<tr>
<td> Date</td>
<td style="text-align:left"><code>date</code></td>
<td style="text-align:left"></td>
</tr>
<tr>
<td> Duration</td>
<td style="text-align:left"><code>duration</code></td>
<td style="text-align:left"></td>
</tr>
</tbody>
</table>
<h3 id="accent">Accent</h3>
<p>An accent is a decoration over a symbol that provides the proper context to interpret the symbol or modifies it in some way. For example, an accent can indicate that a symbol is a vector, or to represent the mean, complex conjugate or complement of the symbol.</p>
<p>The following values are recommended:</p>
<table>
<thead>
<tr>
<th>Accent</th>
<th style="text-align:center">Value</th>
<th style="text-align:right">Unicode</th>
<th>Possible Meanings</th>
</tr>
</thead>
<tbody>
<tr>
<td> Vector</td>
<td style="text-align:center">◌⃗</td>
<td style="text-align:right">U+20d7</td>
<td></td>
</tr>
<tr>
<td> Bar</td>
<td style="text-align:center">◌¯</td>
<td style="text-align:right">U+00af</td>
<td>Mean, complex conjugate, set complement.</td>
</tr>
<tr>
<td> Hat</td>
<td style="text-align:center">◌^</td>
<td style="text-align:right">U+005e</td>
<td>Unit vector, estimator</td>
</tr>
<tr>
<td> Dot</td>
<td style="text-align:center">◌˙</td>
<td style="text-align:right">U+02d9</td>
<td>Derivative with respect to time</td>
</tr>
<tr>
<td> Double dot</td>
<td style="text-align:center">◌¨</td>
<td style="text-align:right">U+00a8</td>
<td>Second derivative with respect to time.</td>
</tr>
<tr>
<td> Acute</td>
<td style="text-align:center">◌´</td>
<td style="text-align:right">U+00b4</td>
<td></td>
</tr>
<tr>
<td> Grave</td>
<td style="text-align:center">◌`</td>
<td style="text-align:right">U+0060</td>
<td></td>
</tr>
<tr>
<td> Tilde</td>
<td style="text-align:center">◌~</td>
<td style="text-align:right">U+007e</td>
<td></td>
</tr>
<tr>
<td> Breve</td>
<td style="text-align:center">◌˘</td>
<td style="text-align:right">U+02d8</td>
<td></td>
</tr>
<tr>
<td> Check</td>
<td style="text-align:center">◌ˇ</td>
<td style="text-align:right">U+02c7</td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="-langle-function-rangle-">⟨function⟩</h3>
<ul>
<li><code>fn</code>: ⟨native-string⟩, the name of the function.</li>
<li><code>arg</code>: ⟨expression⟩ | array of ⟨expression⟩, the arguments to the function. If there's a single argument, it should be represented as an expression. If there's more than one, they should be represented as an array of expressions.</li>
<li><code>fence</code>: ⟨string⟩, one to three characters indicating the delimiters used for the expression. The first character is the opening delimiter, the second character, if present, is the closing delimiter. The third character, if present, is the delimiters separating the arguments. If no value is provided for this key, the default value <code>(),</code> is used. The character <code>.</code> can be used to indicate the absence of a delimiter, for example <code>..;</code>.</li>
<li><code>sub</code>: ⟨expression⟩</li>
<li><code>sup</code>: ⟨expression⟩</li>
<li><code>accent</code>: ⟨native-string⟩, a single unicode character representing the accent to display over the function. See the SYMBOL section for more details.</li>
</ul>
<p>The <code>fn</code> key is the only required key.</p>
<p>When using common functions, the following values are recommended:</p>
<table>
<thead>
<tr>
<th>Name (and common synonyms)</th>
<th style="text-align:left">Value</th>
<th style="text-align:left">Arity</th>
<th style="text-align:left">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td> Addition</td>
<td style="text-align:left"><code>+</code></td>
<td style="text-align:left">2</td>
<td style="text-align:left"></td>
</tr>
<tr>
<td> Signum</td>
<td style="text-align:left"><code>*</code></td>
<td style="text-align:left">1</td>
<td style="text-align:left">-1 if the argument is negative, 0 if it is zero, 1 if it is positive; more generally, the intersection of the unit circle with the line from the origin through the argument in the complex plane</td>
</tr>
<tr>
<td> Multiplication</td>
<td style="text-align:left"><code>*</code></td>
<td style="text-align:left">2</td>
<td style="text-align:left"></td>
</tr>
<tr>
<td> Reciprocal</td>
<td style="text-align:left"><code>/</code></td>
<td style="text-align:left">1</td>
<td style="text-align:left">The reciprocal of the argument</td>
</tr>
<tr>
<td> Division</td>
<td style="text-align:left"><code>/</code></td>
<td style="text-align:left">2</td>
<td style="text-align:left">The first argument divided by the second argument</td>
</tr>
<tr>
<td> Negate</td>
<td style="text-align:left"><code>-</code></td>
<td style="text-align:left">1</td>
<td style="text-align:left">Negate the argument</td>
</tr>
<tr>
<td> Substraction</td>
<td style="text-align:left"><code>-</code></td>
<td style="text-align:left">2</td>
<td style="text-align:left">Substract the second from the first.</td>
</tr>
<tr>
<td> Exponential</td>
<td style="text-align:left"><code>^</code></td>
<td style="text-align:left">1</td>
<td style="text-align:left">e to the power of the argument.</td>
</tr>
<tr>
<td> Power</td>
<td style="text-align:left"><code>^</code></td>
<td style="text-align:left">2</td>
<td style="text-align:left">The first argument to the power of the second argument</td>
</tr>
<tr>
<td> Square Root</td>
<td style="text-align:left"><code>root</code></td>
<td style="text-align:left">1</td>
<td style="text-align:left"></td>
</tr>
<tr>
<td> Root</td>
<td style="text-align:left"><code>root</code></td>
<td style="text-align:left">2</td>
<td style="text-align:left">The second argument is the degree of the root</td>
</tr>
<tr>
<td> Natural log</td>
<td style="text-align:left"><code>ln</code></td>
<td style="text-align:left">1</td>
<td style="text-align:left"></td>
</tr>
<tr>
<td> Logarithm</td>
<td style="text-align:left"><code>ln</code></td>
<td style="text-align:left">2</td>
<td style="text-align:left">The second argument is the base.</td>
</tr>
<tr>
<td> List</td>
<td style="text-align:left"><code>list</code></td>
<td style="text-align:left">n</td>
<td style="text-align:left">comma separated list</td>
</tr>
<tr>
<td> List</td>
<td style="text-align:left"><code>list2</code></td>
<td style="text-align:left">n</td>
<td style="text-align:left">semi-colon separated list</td>
</tr>
<tr>
<td> Absolute value</td>
<td style="text-align:left"><code>abs</code></td>
<td style="text-align:left"></td>
<td style="text-align:left"></td>
</tr>
<tr>
<td> Floor</td>
<td style="text-align:left"><code>floor</code></td>
<td style="text-align:left">1</td>
<td style="text-align:left">The largest integer less than or equal to the argument</td>
</tr>
<tr>
<td> Minimum</td>
<td style="text-align:left"><code>min</code></td>
<td style="text-align:left">2, n</td>
<td style="text-align:left">The smallest of the arguments</td>
</tr>
<tr>
<td> Ceiling</td>
<td style="text-align:left"><code>ceiling</code></td>
<td style="text-align:left">1</td>
<td style="text-align:left">The smallest integer greater than or equal to the argument</td>
</tr>
<tr>
<td> Maximum</td>
<td style="text-align:left"><code>max</code></td>
<td style="text-align:left">2, n</td>
<td style="text-align:left">The largest of the arguments</td>
</tr>
<tr>
<td> Greatest Common Divisor</td>
<td style="text-align:left"><code>gcd</code></td>
<td style="text-align:left">2</td>
<td style="text-align:left"></td>
</tr>
<tr>
<td> Least Common Multiple</td>
<td style="text-align:left"><code>lcm</code></td>
<td style="text-align:left">2</td>
<td style="text-align:left"></td