# MathLive Changelog

## 0.73.0 (2022-05-23)

### Breaking Changes

• The following attributes of the <math-field> element that were previously boolean attributes are now enumerated attributes.

A boolean attribute has a value of true if present and false if absent (it’s an HTML standard thing).

An enumerated attribute has an explicit value, usually a string.

As a result of this change the default value of some mathfield attributes have changed from false to true.

• keypress-vibration: "on" | "off" | "" (default "on")
• remove-extraneous-parentheses: "on" | "off" | "" (default "on")
• smart-fence: "on" | "off" | "" (default "on")
• smart-superscript: "on" | "off" | "" (default "on")
• smart-mode: "on" | "off" | "" (default"off")

If you previously used:

<math-field></math-field>


in order to preserve the same settings, you would now use:

<math-field
keypress-vibration="off"
remove-extraneous-parentheses="off"
smart-fence="off"
smart-superscript="off"
></math-field>

• The commands \mleft and \mright are no longer generated automatically.

Previously, when using smart-fence mode, () or \left(...\right), could be replaced with a \mleft(...\mright) command. This was done to ensure the proper spacing of delimiters after a function, e.g. \sin(x). Without it, there is excessive space between the function and the delimiter.

Now the \left...\right command automatically adjust its left spacing based on the symbol to its left. If the symbol to its left is a function, the spacing will be tighter. Therefore, \mleft...\mright are no longer required, although they are still recognized as valid commands.

This change was made because not every LaTeX environment recognize the \mleft...\mright commands, and this caused interoperability issues.

## New Features

• Comma , as a decimal separator

The options.decimalSeparator option can be set to . or ,. The default value is . which corresponds to the current behavior.

When set to ,, pressing the , key on the keyboard will insert a {,} LaTeX string, if in math mode and if before a digit. The LaTeX sequence {,} is traditionally used to correctly typeset the comma and ensure the correct amount of space around it. Without the {}, the , is interpreted as a delimiter and has excessive amount of space around it.

The virtual keyboard is also changed so that the . key is , instead and also contextually insert a {,} when appropriate.

A new command insertDecimalSeparator has also been added, which inserts either {,} if in math mode, right after a digit, and when decimalSeparator is set to ",". Otherwise, it inserts a “.”

• Multi character symbols

The onMulticharSymbol() hook provides an opportunity to recognize multi character symbols and wrap them in an appropriate command.

For example typing speed [\ \to ] \mathrm{speed}

While conventionally \mathrm{} is frequently used to denote multicharacter symbols in LaTeX, in some contexts \mathit can also be used, for example using \mathrm to indicate multicharacter function names, but \mathit for multicharacter variable names.

By default, the hook does nothing and multicharacter symbols are not recognized.

• Support for the \mathnormal{} command, which displays text in italic and includes italic correction. As opposed to \mathit{} which displays text in italic, but without italic correction.

• Correctly handle double-clicking words styled with \mathrm or \mathit

• The appearance of the placeholder symbol has changed to stand out more. Also, the LaTeX generated for the default placeholder is now simply \placeholder{}. The argument of \placeholder{} was always optional, and is still supported. Only the default serialization of the \placeholder{} has changed.

### Improvements

• The MathJSON which is exported to the clipboard during copy/cut operations now include the verbatim LaTeX from the mathfield.

### Bug Fixes

• When extending the selection backwards over a captureSelection group, do not extend more than necessary
• #1354 Correctly render {,}, which is used for French decimal point. Also correctly handle navigating with the keyboard, that is, handle it as a single character, not a group. Also correctly render it to MathML (as a .).
• The “contains highlight” and selection rectangles would not always account for the children of the expression, for example with \sqrt{\frac12}
• The LaTeX output of subscript or superscripts was incorrect when no value for the superscript/subscript was provided. For example, typing x, ^, right arrow, 2, would incorrectly serialize x^2. It now serializes x^{}2
• Improved parsing and layout of functions with arguments, i.e. \sin\left(x\right). Previously, there would be an excessive amount of white space beween the \sin and (. The expression is now correctly interpreted as a function.
• #1459 When using a non-QWERTY physical keyboard layout, creating multiple mathfields could result in the keyboard layout being erroneously reset to QWERTY. This would manifest itself for example by the / keybinding no longer inserting a fraction.
• #1462 When copying and pasting an expression that could not be parsed with the Compute Engine, the resulting pasted content was displayed as an error.

## 0.72.2 (2022-04-30)

### Bug Fixes

• #1427 An issue introduced in the previous release: the serialization to LaTeX of some functions (e.g. \log) failed.
• Serialization to MathML of subscripts/superscripts was incorrect in some cases
• In Chrome, setting the readonly attribute on mathfield caused the content of the mathfield to be set to empty.
• #1431 AutoRender of static math expressions would not render correctly when using <script type='math/tex; mode=text'>. Auto-render could also fail catastrophically in some cases.
• Cortexjs.io #15 When loading the fonts (and sounds), the origin of the library needs to be resolved to determine the relative location of those files. This was done with a http GET for each font file, which caused the entire library to be redownloaded multiple times. The base URL resolution is now only done once, and with a HEAD request to avoid the download. As a result, getting the MathLive library ready, especially when using a CDN and a slow network, is an order of magnitude faster.

## 0.72.0 (2022-04-18)

### Bug Fixes

• #1017 Display tooltip over buttons of virtual keyboard button bar
• #1356 In inline mode, the fraction bar appeared too close to the numerator
• #1222, #1024 When multiple \ne commands were entered, older ones would disappear.
• #1013 Cutting the content of the matfield would not work in some cases
• #1149 Improved placement of the horizontal bar above square roots = #1070 The \mod command (and \pmod and \bmod) no longer captures the cursor or allow its content to be selected
• When navigating with the arrow keys backward, if landing on a group atom (e.g. a macro), allow the cursor to be positioned right after the atom.
• In some rare cases (if no keys but keybinding were entered in a mathfield), some keybindings would stop functioning
• #1327 Selecting the expression under a square root also selected the squared root.
• Extending the selection forward when including some atoms such as \operatorname jumped to the end of the expression.
• #1422 Turning off macros would still fallback to default macros.
• #1037 Correctly serialize \mathord, \mathbin, etc…
• #1425 Using the up/down keys to navigate could produce an error in some cases

### Improvements

• Use more standard \mathbb{N}, etc… for NN shortcut
• Improved display of command popover when editing raw LaTeX

## 0.71.0 (2022-04-12)

### Breaking Changes

• Removed the find and replace methods. These methods were difficult to use, since they were based on LaTeX serialization and the mapping from atom to LaTeX is not always intuitive. To replace them it is recommended to extract the MathJSON representation of the value, and manipulate it using the CortexJS Compute Engine.

### New Features

• "math-json" can be used as a format for setValue()

### Improvements

• #1415 Atoms inside parentheses are now considered as implicit arguments, for example when inserting a fraction.
• #1389 Keyboard navigation inside tabular data (matrices, etc…)
• Documentation: some of the data structures were not publicly exported and did not appear in the documentation (https://cortexjs.io/docs/mathlive/)
• When pasting content that included a double-backslash (e.g. as a row separator) immediately followed by a character, all double-backslash would be interpreted as a single backslash (this allowed pasting LaTeX that had been escaped in JavaScript). However, this caused some legitimate LaTeX to not be interpreted correctly. The double-backslash are no longer “simplified”.

### Bug Fixes

• A style applied to a an atom using applyStyle() was not propagated to its children
• #1387 A matrix with an empty cell would result in error messages in the console in some cases

## 0.70.0 (2022-04-05)

### Features

• Uses new version of Compute Engine for serialization to MathJSON and parsing of LaTeX from MathJSON.

### Bug Fixes

• #934 Improved display of the root horizontal bar in some browsers
• #1385 Typing & is correctly interpreted as \\& (and not &)
• #1363 Commands in the \overrightarrow{} family can be deleted
• #1375 Inserting a smartfence which was not followed by some content would trigger some asserts
• Correctly handle deletion of the closing fence of a smartfence
• #1412 Correctly handle insertion of custom macros with executeCommand
• On Windows/Linux with an AZERTY keyboard, the ² (supersript 2) is now handled correctly
• #1362 and #726 Correctly handle backspacing over a multi-character operator, e.g. <=.
• #1366 pointerup events in a mathfield would not bubble
• In Dark Mode, correctly display SVG shapes, such as \overrightarrow{ABC}.

### Improvements

• #934 Improved layout of aligned environment by adding missing gap between columns
• Added macros to the command popover
• Improved visual appearance when using dark mode. Also, added more CSS variables to customize the apperance of the mathfield.

## 0.69.10 (2022-02-23)

### Bug Fixes

• #1024 \ne and \neq render correctly (fix contributed by @AceGentile)
• Changes to the read-only attribute are now properly detected (fix contributed by @LuisMesa)
• Boxes in \enclose command render correctly (fix contributed by @Zahara-Nour
• #1357 Alternate (shifted) layers described in the virtual keyboard defined with an object literal would not trigger.

# Features

• Support for the \htmlStyle command (feature contributed by @neokazemi)
• Pressing the \ key after a trigonometric function will not include the function in the numerator of the fraction.

## 0.69.9 (2022-01-06)

### Features

• Support for Vue 3.x

### Bug Fixes

• #1240 After a Select All (or other selection adjusting commands), inserting characters in Latex mode may result in unresponsive input.
• The z-index of the virtual keyboard --keyboard-zindex would not always be applied to the keyboard, resulting in some elements overlaping the virtual keyboard in some situations.

## 0.69.8 (2021-11-08)

### Bug Fixes

• #1146 When the pointer was over a mathfield, using the scrollwheel or scroll gesture to scroll the page was not possible
• #1201 In some cases, the scrim layer (used to display alternate keys in the virtual keyboard) was at the wrong depth
• #951 Fixed production of sup/sub in MathML
• #1174 The virtual-keyboard-toggle event was not dispatched
• #1087 When using the virtual keyboard, the mathfield would not scroll when necessary

### Improvements

• Added sounds-directory as list of valid attributes (contributed by @bengolds)
• Improvements to handling of nested mathfields (“fill-in-the-blank”) (contributed by @caleb-flores)
• Use serve-http instead of http-serve for improved Linux compatibility (contributed by @AceGentile)

## 0.69.7 (2021-09-13)

### New Feature

• #1138 PR#163 “Fill in the blank”

## 0.69.6 (2021-08-31)

### Improvements

• vue-cli does not support optional chaining (see https://github.com/vuejs/vue-loader/issues/1697) There are workarounds for this, but debugging and fixing this is too difficult for many users. Therefore, sadly, this release rolls back emitting code including optional chaining, despite the fact it’s supported in every targeted browser, until the vue toolchain gets its act together. To be clear MathLive does not use or depend on Vue, but some users are integrating MathLive in projects that do use it, and this is sufficient to break MathLive. It appears that this isse affects also the React toolchain.

• #1125 don’t enable switching to Latex mode for read-only mathfields

### Bug Fixes

• #1124 when setting the inlineShortcuts options to empty, don’t fallback to the default shortcuts
• #1119 \overarc and the AccentAtom family would not display their accent
• #1115 Clicking in the mathfield when virtual keyboard is displayed closed the keyboard
• #1117 and #1118 Replacing a subset of a mathfield with a pattern that contains the target led to an infinite loop

## 0.69.5 (2021-08-05)

### Improvements

• When using keybindings or virtual keyboard keys, insert the content in the current math style, rather than forcing display style.

• Updated localization strings

## 0.69.4 (2021-06-22)

### Improvements

• Updated to ComputeEngine 0.4.2 for better parsing of Latex.
• When copying or cutting to the clipboard, if the MathJSON parsing fails, ignore the MathJSON and fallback to Latex. Previously, if there was a failure during parsing an empty MathJSON expression would be put on the clipboard, which result in subsequent attempts at pasting the content into a mathfield to fail.
• Updated various localizations (contributed by @physedo).

## 0.69.3 (2021-06-10)

### Improvements

• Added localization for Irish (contributed by @physedo).

### Bug Fixes

• #1000 When serializing subscripts and superscripts, serialize the subscript first: \int_0^{\infty} instead of \int^{\infty}_0.
• In some page layouts, the virtual keyboard could be displayed at an incorrect location, or scroll with the page.

## 0.69.1 (2021-06-09)

### Improvements

• Attempt to fix installation of the npm package on some Windows configurations

## 0.69.0 (2021-06-09)

### Breaking Changes

• This release requires TypeScript 4.3 or later (the API uses assymetric getters/setters). If you are using VSCode, you may need to change the version of TypeScript used by the editor for language services (syntax checking). To do so, with a TypeScript file open, click the Typescript version in the bottom bar, then choose “Select TypeScript Version”, then “Use Workspace Version” (see https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-newer-typescript-versions)

• All the default imports have been removed. Instead of

import MathLive from 'mathlive';
MathLive.renderMathInDocument();


use:

import { renderMathInDocument } from 'mathlive';
renderMathInDocument();


If you are not calling a specific Mathlive function and just need to use the <math-field> tag, use:

import from 'mathlive';

• The following deprecated functions have been removed: latexToMathML()convertLatexToMathMl(), latexToSpeakableTextconvertLatexToSpeakableText, latexToMarkup()convertLatexToMarkup(),
• The deprecated revertToOriginalContent functionality has been removed.
• The deprecated overrideDefaultInlineShortcuts property has been removed. Instead, use:
mf.setConfig('inlineShortcuts', {
...mf.getConfig('inlineShortcuts'),
...newShortcuts,
});

• The following Mathfield functions have been removed: $setConfig()setOptions(), getConfig()getOptions(), $perform()executeCommand(), $text()getValue(), $selectedText()getValue(), $selectionIsCollapsed(), $selectionDepth(), $selectionAtStart(), $selectionAtEnd(), $latex()getValue()andsetValue(), $el, $insert()insert(), $hasFocus()hasFocus(), $focus()focus(), $blur()blur(), $select()select(), $clearSelection()executeCommand('delete-backward'), $applyStyle()applyStyle(), $keystroke(), $typedText() • The makeMathField() function has been removed. Use new MathfieldElement() or the <math-field> tag instead: // Before let mf = MathLive.makeMathField(document.createElement('div'), { virtualKeyboardMode: 'manual', }); mf.$latex('f(x) = \\sin x');
• When pasting content that begins/ends with $ or $$, assume LaTeX format • Fix keyboard shortcuts, e.g. “alt+(” or “alt+v” • Fix #354: The argument of \operatorname is of type ‘math’, not ‘text’. This means that using the ‘\text’ command inside the argument is valid and that spaces should be ignored by default (but the ~ character can be used to insert a space in that context). • Fix #282: Some keys from the virtual keyboards (‘e’, ‘i’) produce an incorrect input. • Fix #227: An operator (\sin) following some text is incorrectly considered to be part of the text. ### Features / Improvements • Documented suppressChangeNotifications options for $insert()
• Document config.smartMode (#312)
• The ‘surd’ (root) and ‘leftright’ (fences) elements now change color when the caret is inside their body. This helps distinguish the case where the caret position may be ambiguous, for example when it is either after the last element of the body of a ‘surd’ or the first element after the ‘surd’.

The current mode can also be changed using mf.$perform(['switch-mode', {mode: 'math'}]) without affecting the selection. To indicate the current mode, a (slightly) different cursor is used (it’s thinner in text mode). The text zones are also displayed on a light gray background when the field is focused. A notification is invoked when the mode changes: config.onModeChange(mf, mode) with mode either "text", "math" or "command". #### Smart Mode If config.smartMode = true, during text input the field will switch automatically between ‘math’ and ‘text’ mode depending on what is typed and the context of the formula. If necessary, what was previously typed will be ‘fixed’ to account for the new info. For example, when typing “if x >0”: • “i” → math mode, imaginary unit • “if” → text mode, english word “if” • “if x” → all in text mode, maybe the next word is xylophone? • “if x >” → “if” stays in text mode, but now “x >” is in math mode • “if x > 0” → “if” in text mode, “x > 0” in math mode Smart Mode is off by default. Manually switching mode (by typing alt/option+=) will temporarily turn off smart mode. Examples • slope = rise/run • If x > 0, then f(x) = sin(x) • x^2 + sin (x) when x > 0 • When x<0, x^{2n+1}<0 • Graph x^2 -x+3 =0 for 0<=x<=5 • Divide by x-3 and then add x^2-1 to both sides • Given g(x) = 4x – 3, when does g(x)=0? • Let D be the set • \int_{the unit square} f(x,y) dx dy • For all n in NN #### Styling It is now possible to apply styling: font family, bold, italic, color and background color. This information is rendered correctly across math and text mode, and preserved in the LaTeX output. The key to control styling is the $applyStyle(style) method:

If there is a selection, the style is applied to the selection.

If the selection already has this style, it will be removed from it. If the selection has the style partially applied, i.e. only on some portions of the selection), it is removed from those sections, and applied to the entire selection.

If there is no selection, the style will apply to the next character typed.

• style an object with the following properties. All the properties are optional, but they can be combined.
• style.mode - Either 'math', 'text' or 'command'
• style.color - The text/fill color, as a CSS RGB value or a string for some ‘well-known’ colors, e.g. ‘red’, ‘#f00’, etc…
• style.backgroundColor - The background color.
• style.fontFamily - The font family used to render text. This value can the name of a locally available font, or a CSS font stack, e.g. “Avenir”, “Georgia, Times, serif”, etc… This can also be one of the following TeX-specific values: - 'cmr': Computer Modern Roman, serif - 'cmss': Computer Modern Sans-serif, latin characters only - 'cmtt': Typewriter, slab, latin characters only - 'cal': Calligraphic style, uppercase latin letters and digits only - 'frak': Fraktur, gothic, uppercase, lowercase and digits - 'bb': Blackboard bold, uppercase only - 'scr': Script style, uppercase only
• style.fontSeries - The font ‘series’, i.e. weight and stretch (“series” is TeX terminology). The following values can be combined, for example: “ebc”: extra-bold, condensed. These attributes may not have visible effect if the font family does not support this style: - 'ul' ultra-light weight
• 'el': extra-light - 'l': light - 'sl': semi-light - 'm': medium (default) - 'sb': semi-bold - 'b': bold - 'eb': extra-bold - 'ub': ultra-bold - 'uc': ultra-condensed - 'ec': extra-condensed - 'c': condensed - 'sc': semi-condensed - 'n': normal (default) - 'sx': semi-expanded - 'x': expanded - 'ex': extra-expanded - 'ux': ultra-expanded
• style.fontShape - The font ‘shape’ (again, TeX terminology), i.e. italic or condensed.
• 'it': italic
• 'sl': slanted or oblique (often the same as italic)
• 'sc': small caps
• 'ol': outline

#### Contextual Inline Shortcuts

Previously, some shortcuts would get triggered too frequently, for example when typing “find”, the “\in” shortcut would get triggered.

Now, a shortcut can be defined with some pre-conditions. It is still possible to define a shortcut unconditionally, and thus if you are using custom inline shortcuts, they do not need to be updated:

config.inlineShortcuts = {
in: '\\in',
};


However, a shortcut can now be specified with an object:

config.inlineShortcuts = {
in: {
mode: 'math',
after: 'space+letter+digit+symbol+fence',
value: '\\in',
},
};


The value key is required an indicate the shortcut substitution.

The mode key, if present, indicate in which mode this shortcut should apply, either 'math' or 'text'. If the key is not present the shortcut apply in both modes.

The 'after' key, if present, indicate in what context the shortcut should apply. One or more values can be specified, separated by a ‘+’ sign. If any of the values match, the shortcut will be applicable. Possible values are:

• 'space' A spacing command, such as \quad
• 'nothing' The begining of a group
• 'surd' A square root or n-th root
• 'frac' A fraction
• 'function' A function such as \sin or f
• 'letter' A letter, such as x or n
• 'digit' 0 through 9
• 'binop' A binary operator, such as +
• 'relop' A relational operator, such as =
• 'punct' A punctuation mark, such as ,
• 'array' An array, such as a matrix or cases statement
• 'openfence' An opening fence, such as (
• 'closefence' A closing fence such as }
• 'text' Some plain text

#### Other Features

• Arrays, matrices and cases can now be edited. To create a a matrix, after a ( or a [, type some content then [RETURN]: a second row will be added to the matrix. Similarly, typing [RETURN] after a { will create a cases statements.
• To insert a new row, type [RETURN]
• To insert a new column, type alt/option+, (comma), the Excel shortcut for this operation.
• Support for \emph (emphasis) command, which can be used to (semantically) highlight an element. This command works both in text and math mode (it only works in text mode in TeX). For example:
\text{In the formula}\emph{x}+1=0\text{x is the \emph{unknown}}

• Support for \cssId and \class commands. These are non-standard TeX commands which are supported by MathJax.
• \cssId{id}{content} Attaches an id attribute with value id to the output associated with content when it is included in the HTML page. This allows your CSS to style the element, or your javascript to locate it on the page.
• \class{name}{content} Attaches the CSS class name to the output associated with content when it is included in the HTML page. This allows your CSS to style the element.
• config.removeExtraneousParentheses (true by default) extra parentheses, for example around a numerator or denominator are removed automatically. Particularly useful when pasting content.
• Improvements to clipboard handling, pasting and copying. Now supports pasting of ASCIIMath and UnicodeMath (from MS Word) and LaTeX.
• Support for output of ASCIIMath using mf.$text('ASCIIMath') and mf.$selectedText('ASCIIMath')
• config.smartSuperscript If true (default), when a digit is entered in an empty superscript, the cursor leaps automatically out of the superscript. This makes entry of common polynomials easier and faster.
• config.scriptDepth Controls how many levels of subscript/superscript can be entered. By restricting, this can help avoid unwanted entry of superscript and subscript. By default, there are no restrictions.
• #156: localization support, including French, Italian, Spanish, Polish and Russian.
• New visual appearance for selected elements.

### Other Improvements

• When in command mode (after pressing the '' or ‘ESC’ key), pressing these keys will have the indicated effect:
• [ESC]: discards entry and return to math mode
• [TAB]: accept suggestion and enter it
• [RETURN]: enter characters typed so far, ignoring any suggestion.
• #132: Support for smart fence with {}, and \langle.
• Pressing the spacebar next to a closing smartFence will close it. Useful for semi-open fences.
• Improved rendering performance by 8%
• Updated SRE support
• Improvements to undo/redo support. Fix #137, #139 and #140.
• Significant improvements to the Abstract Syntax Tree generation (MASTON/MathJSON), including #147
• Keyboard shortcuts that override inline shortcuts and Smart Fence: option/alt+|, option/alt+\. Also available are option/alt+( and option/alt+)

### Bug Fixes

• #155: A cases statement (or a matrix) can now be deleted. The rows and columns inside a cases statement (or a matrix) can also be deleted.
• #133: Clicking on a placeholder selects it.
• Fixed issue with positioning of Popover panel.
• Correctly render \ulcorner, \urcorner, \llcorner and \rrcorner
• #141: Improved interaction of placeholders and smart fences
• #136: Close open smart fence with moveAfterParent only when at the closing of a smart fence
• #142: MathML output: supports sup/sub applied to a function
• Improved handling of shortcuts.
• #149: Fix handling of \prime and \doubleprime
• #111: Fix issue where a subscript followed a superscript and were not properly combined.
• #118. Improved navigating out of inferior limits
• Improve visual blinking when selecting with the mouse to the left

## 0.26 (2019-02-04)

• Public method now start with $. This convention is also used, for example, by the Vue.js project. For now, aliases exist that begin with ‘_’ (the previous convention), however you are encourage to migrate as soon as possible. The function that are affected are: _el(), _insert(), _keystroke(), _latex(), _perform(), _revertToOriginalContent(), _selectedText(), _selectionAtEnd(), _selectionAtStart(), _selectionDepth(), _selectionIsCollapsed(), _setConfig(), _text(), _typedText() (this was initially implemented in 0.25) ### Major New Features • Support for dark mode. Triggered automatically by the browser or by setting theme="dark" on the <body> tag. • New implementation for inline shortcuts. Now support complex inline shortcuts including _, ( and other keys. • Virtual Keyboards can now be described using a JSON data structure. Contribution from @rpdiss. Thanks! • New MathLive.toSpeakableText() function • New config.onAnnounce handler ### Other Improvements • The $perform() function now accepts selector both in camelCase or kebab-case.
• Improved display of some keys in the keyboard caption panel
• New logo!
• Improved documentation, including adding pages for keyboard shortcuts, examples, macros, selectors and config options.
• Better support for IE11 via transpiling (thanks @synergycodes!)

### Bug fixes

• #103 - Fixed issues where the math path could become invalid. Also made the code more resilient to invalid paths.
• #128 - Properly cleanup event handlers on destruction

### Codebase Health and Performance

• Some minor optimizations and performance improvements, including lazy loading of sounds and some other resources.
• Moved some modules to classes.

## 0.25 (2018-12-29)

### Major New Features

• A Vue.js wrapper and example is available in examples/vue

### Bug fixes

• #104 - Numeric keypard “/” was ignored.
• #91 - Handling of ‘~’ as an operator and a shortcut.

## 0.24 (2018-12-16)

### Breaking Changes

• Several handlers had some inconsistent signatures, or in some cases passed invalid values as their arguments. This has been fixed, but it required changing the signature of some handlers. For consistency, the first argument of the handlers now refers to the mathfield to which it applies.
MathLive.makeMathField('input', {
onContentDidChange: (mf) => {
document.getElementById('output').innerHTML = mf.latex();
},
});


Keep in mind that arrow functions lexically bind their context, so this actually refers to the originating context (not to the mathfield).

The affected handlers are:

• onFocus
• onBlur
• onKeystroke
• onMoveOutOf
• onTabOutOf
• onContentWillChange
• onContentDidChange
• onSelectionWillChange
• onSelectionDidChange
• onUndoStateWillChange
• onUndoStateDidChange
• onVirtualKeyboardToggle
• onReadAloudStatus

It is recommended that you check if you use any of those handlers and validate their signatures.

### Major New Features

• Support for native JavaScript modules, contributed by Jason Boxman (https://github.com/jboxman). Thanks, Jason!

The previous method, using a <script> tag, is still supported:

<script src="../../dist/mathlive.js"></script>


but it is recommended to use native JavaScript modules:

<script type="module">
import MathLive from '../../dist/mathlive.mjs';
</script>


(note the .mjs extension indicating this is a JavaScript module).

A few caveats about using modules:

• JavaScript modules are automatically in strict mode
• To use JavaScript modules you need to be in your own module. With a <script> tag, this is indicated by adding the type='module' attribute. The code inside a module is not leaked to the global scope, the module has its own scope. As a result, functions defined inside the module (inside your <script> tag) will not be visible outside the module. You will need to either attach them to a global object (such as window) or in the case of even handlers, attach them to the relevant element, using addEventListener.

See examples/basic/index.esm.html for a complete example.

If you were previously loading the non-minified version, that is the raw sources, which can be useful to debug issues, you need to use modules to load them, while you may have used requirejs previously. The sources are now included in the distribution for this purpose.

    define(['mathlive/src/mathlive'], function(MathLive) {
MathLive.makeMathField(/*...*/);
}


use:

import MathLive from '../../dist/src/mathlive.js';
MathLive.makeMathField(/*...*/);

• Support for SRE (Speech Rule Engine) from Volker Sorge. Optional, and needs to be installed separately.
• Improved text to speech support, including karaoke mode (read aloud with synchronized highlighting)
• New configuration setting to control the spacing between elements, horizontalSpacingScale. Supplying a value > 1.0 can improve readability for some users.
• Added notifications when undo state change, onUndoStateWillChange and onUndoStateDidChange
• Added support for correctly inserting rows and columns in arrays.

### Other Improvements

• Fixes in MASTON
• Improved cross-browser accessibility support
• Fix MathML output for superscripts
• Fix issue #75 (autoconvert would fail in some cases)
• Fix issue #114. Incorrect selection when shift-select at the end.
• Fix issue #78. Cross-out positioning issue

## 0.22 (2018-04-11)

### Major New Features

• Support for styling in the virtual keyboard UI: the text and highlight color can be adjusted to emphasize a portion of a formula
• Smart Fences. When a fence (“(”, “{”, etc…) is inserted, a matching closing fence is automatically inserted, displayed as a greyed out placeholder.
The Latex code inserted will vary depending on the context where the insertion is made, either standalone characters (() or \left...\right. This feature is on by default and can be turned off with config.smartFence.
Option-9 and Option-0, as well as $$ and $$ will override the setting and insert a plain old parenthesis.
• \mleft...\mright. Similar to \left...\right (i.e. grow in height depending on its content) but with vertical spacing before and after similar to \mathopen and \mathclose. Used automatically by smart fences after a function such as \sin or f.
• Haptic and audio feedback for the virtual keyboard.
Haptic feedback is available on Android only.
Two new config options to control it. config.keypressVibration, which is on by default, control the haptic feedback. config.keypressSound control the audio feedback (off by default). Specify the URL to a sound file to be played when a key on the virtual keyboard is pressed, or an object with a delete, return, spacebar and default (required) keys to specify different sounds for those keys.

### Other New Features

• When a fraction is inserted, for example by pressing ‘/’, the items before the insertion point are considered as potential numerator. This now include parenthesized expressions and roots. In the case of parenthesized expressions, the parentheses are removed before being adoped for the numerator.
• MASTON: Use Unicode to represent math-variant letters (e.g. ℂ)
• Convert math-variant letters encoded in Unicode to Latex when pasting (e.g. ℂ becomes \C, 𝕰 becomes \mathord{\mathbf{\mathfrak{E}}}
• MASTON: Commutativity support. a + b + c → add(a, b, c)
• MASTON: Right and left-associativity support (‘=’ and ‘=>’ are right associative)
• Improvements to the delete behavior: when to the right of a \left...\right deletes remove the closing fence, not the whole expression. Same for root, fractions, and other groups. When at the beginning of a denominator, pressing delete will remove the fraction, but keep numerator and denominator, etc…
• When using the command virtual keyboard, switch to command mode as necessary.
• Added MathAtom.skipBoundary. When true, navigating into/out of the atom the last/first element will be skipped. For example, with \textcolor{} this implements a behavior similar to word processors.

### Bug fixes

• Fixed #63: improved displayed of \enclose over stacked atoms such as fractions and \overset
• Fixed issue with selecting sparse arrays
• Make \bigl et al. properly selectable

### Code Maintenance and Performance

• Moved operator precedence and canonical names from Definitions to MASTON.
• Improved rendering performance by eliminating hotspots through profiling.

## 0.21 (2018-03-30)

### Major New Features

• Basic support for Latex macros. Macros can be defined with MathField.$setConfig({macros:'...') • Display alternate keys when a key on the virtual keyboard is held down. • Support for AZERTY, QWERTZ, Dvorak and Colemak virtual keyboards. Can be setup with MathField.$setConfig({virtualKeyboardLayout:'...'). Also, shift clicking on the keyboard icon toggles between layouts.

### Other New Features

• Toggle the virtual keyboard layer when the shift key is pressed
• New onVirtualKeyboardToogle handler will get called when the visibility of the virtual keyboard changes. Useful to scroll into view important content that might be obscured by the keyboard.
• Some common functions added as inline shortcuts: limsup, liminf, argmin, argmax, bessel, mean, median, fft.
• Added \rd command (synonym with \differentialD and used by Proof Wiki)
• Added a format option (latex-expanded) to MathField.text() and MathField.selectedText() to return Latex with macros expanded.
• Removed restrictions on charset in text
• Support shift + arrows to extend the selection with the virtual keyboard

### Bug Fixes

• More accurate operator precedence. Follow the MathML recommendation, except for arrows that are given a way too high priority in MathML.
• Correctly output to Latex the \unicode command
• When undoing, correctly restore the selection
• Improved behavior when inserting superscript and subscript on a selected item
• Fixed handling of unbalanced \left\right sequences
• Correctly output the minus sign to Latex (as U+002D not as U+2212)
• Fixed some cases where the layout would shift by a couple of pixels as you navigated into the expression

### Code Maintenance and Performance

• Use .test() instead of .match() whenever possible
• Eliminated .value and .children in Math Atoms. It’s only .body now.
• Avoid unnecessary rendering while tracking the pointer
• Refactored the Popover code into Popover.js
• Moved some content from Definitions.js and into Popover.js

## 0.20 (2018-03-24)

### Major New Features

• Virtual keyboards with multi-touch support
• BREAKING CHANGE: the command bar is no longer supported. Use virtual keyboards instead.

### Other New Features

• Added support for wide layouts to virtual keyboard. If space is available, up to four more columns of keys can be displayed.
• Added Copy button to virtual keyboard
• Allow ‘space’ in command mode
• MASTON: improved parsing of numbers
• Handle Unicode pseudo-superscript characters as exponents

## 0.19 (2018-03-19)

### Major New Features

• MASTON: first implementation
• Support selecting cells in arrays

### Other New Features

• MASTON: handle complex numbers and modulo
• Added option for styling of keyboard glyph
• Improved output to Latex for arrays
• Additional trig and long functions (\lb, \arsinh, \arcosh, \artanh, \arcsech, \arccsh, \arcsec, \arccsc)
• MathML: more robust handling of complex <mo>
• MathML: improved handling of fences
• Improved Latex output

### Bug Fixes

• Correctly handle latex output for the \char command
• Correctly handle invalid Unicode code points in the \char command
• Correctly output MathML for extended Unicode characters and \char command
• Correctly handle selection in sparse arrays
• Correct spacing issue of selected items
• Fixed #17: correctly extend the selection when the anchor is at the end of the selection
• The caret would not blink in empty supsub
• The last character of the selection would not be copied on the clipboard
• MathML: don’t insert &invisibleTimes; for factorial, but do insert it before a fence.
• Going up from a numerator longer than the denominator could hang.
• MathML and Latex output: better handling of \Big (etc…) delimiters
• MathML: do not render \text as <mi>
• Latex output: handle the \math... (\mathop, \mathbin…) family of functions
• Properly parse custom operators
• Commands with multiple keyboard shortcuts would not display correctly in the Popover panel

### Code Maintenance and Performance

• Reduce the amount of markup generated, avoid generating markup for empty spans.
• Updated fonts from KaTeX

## 0.18 (2018-03-04)

### Bug Fixes

• Fixed issue where \underset annotation was not selectable

### Code Maintenance and Performance

• Reverted back to WebPack 3
• Simplified CSS and streamlined markup for vlist spans.

## 0.0.17 (2018-02-27)

### New Features

• Improved accessibility support (major contribution from Neil Soiffer)
• Support for MathML output and Latex to MathML conversion.

### Bug Fixes

• #26 Fixed issue with Chrome 62 where fraction lines and other thin lines would intermittently not render.
• #20, #51. Ensure that a placeholder is always present for numerator, denominator.
• #21. Do not allow sub-elements of an enclose element to be selected.
• Font-size will now respect font-size specified by the parent element. As a result of this non-backward compatible change, the size of the equation may now be different than it was. To ensure that the size remains the same as before, specify a font-size property on the parent element with a value of 16px.
• #29. Correctly handle $and @ as inlineShortcuts • Improved handling of undo. • New implementation of \enclose notations. ## 0.0.16 (2017-09-13) ### Deprecated Features • MathField.write() has been deprecated. Use MathField.insert() instead. ### New Features • Added MathField.selectedText() which returns the textual content of the selection. ### Bug Fixes • Perform a snapshot with the undo manager when invoking MathField.insert(). • Documentation improvements. ## 0.0.15 (2017-07-01) ### New Features • Properly exported public API, including renderMathInDocument() and renderMathInElement() • Added \enclose command, implementing the MathML equivalent. • Added \cancel, \bcancel and \xcancel commands • Added preserveOriginalContent option to MathLive.renderMathIn...() • Made \backslash work in text mode, for example when an argument of \rlap{} • Added MathField.revertToOriginalContent() when a math field is no longer needed for an element • Added customization of the command bar. See MathField.$setConfig() and config.commands
• Added MathLive.revertToOriginalContent() and MathLive.getOriginalContent()
• Added optional namespacing of data- attributes
• Added onContentWillChange and onContentDidChange handlers in the math field config object.
• Added tutorials and improved documentation

### Bug Fixes

• Fixed #5: AZERTY keyboard input was misbehaving, particularly for the ^ key
• Dead keys (´, ^, ¨, ˜ and others on some keyboards) were not properly handled
• Complex emojis (emojis made of multiple codepoints, such as emojis with skin tone modifiers, or emojis with a ZERO WIDTH JOINER, such as the David Bowie emoji) would be incorrectly recognized as multiple symbols
• Fixed the \color command
• Properly roundtrip to LaTeX \rlap, \color` and many other commands. Now, copying content using these commands in a math field will result in the correct LaTeX code to be generated.