Skip to content

Releases: arnog/mathlive

v0.32.1

30 Jul 23:33
Compare
Choose a tag to compare

Features / Improvements

  • Added Typescript type definition

0.32

18 Jul 18:41
Compare
Choose a tag to compare

Same as 0.30.
Created due to some issues publishing to npmjs.

0.30

18 Jul 01:47
Compare
Choose a tag to compare

Non-backward compatible changes

  • #157: Public APIs that don't start with $ have been removed. If your code
    used any of these APIs, add a $ in front of their name. See #157 for the
    complete list.

Features / Improvements

  • #231: smartMode now supports Greek (the language). Also, Greek localization.
  • Don't display i-beam cursor over non-interactive content
  • Use CSS class .ML__smart-fence__close to style closing smart fence
  • Added speech support for text mode and units (contributed by @NSoiffer)

Bug Fixes

  • Fixed an issue where clicking past the end of the equation would select the
    numerator or denominator if the last element was a fraction, instead of place
    the cursor after the fraction (regression)
  • Removed dependency on open-cli
  • #220 Fixed an issue where tabbing out of a mathfield would break command mode and some functions
  • #209, #214, #211 et. al. Improvements to SSML support and karaoke mode contributed by @NSoiffer
  • #217 Fixed an issue with parentheses in numerator of fractions
  • #212: Fix round-tripping of \mathbb
  • #194: When using the virtual keyboard, interpolate #@
  • Fixed an issue where "(" was incorrectly gobbled as argument to a fraction
  • Fixed an issue where smartFence off was ignored
  • #202: use numeric character references instead of named entities in MathML output

0.29.1

20 May 02:06
Compare
Choose a tag to compare
  • #201: the popover button was not responsive
  • #195: (partial fix) improve support for Edge (still requires Babelization)
  • Fixed an issue while dragging to select across elements of different depths
  • Fixed issue with smartMode for expressions including "x^2", "xyz" and "\pi"
  • Fixed an issue with styling, where the Latex output could sometimes include the non-existent \mathup command. The correct command is \upshape
  • Fixed issues with enclose layout
  • Avoid triggering spurious notifications while inserting an inline shortcut

0.29

10 May 19:13
Compare
Choose a tag to compare

Major New Features

  • Scrollable mathfield. The mathfield now behaves like a text area: the content
    that does not fit withing the bounds of the mathfield will not overflow
    but will be scrollable. The scrolling can be done using the mouse wheel or
    trackpad gestures, or by dragging while selecting. The AP

Improvements

  • When smartFence is on, and a new smart fence is inserted (by typing
    ( for example), the closing 'phantom' fence would be displayed immediately
    after the opening fence. The closing fence will now be inserted after
    the end of the expression.
  • The heuristics for determining implicit arguments, for example the implicit
    numerator when typing / have been improved. For example, typing / after
    3 + 2sin x will result in 3 + (2sin x)/(...) instead of 3 + sin (x)/(...).
  • When config.removeExtraneousParentheses is true (default), if a frac is
    inserted inside parentheses, the parens will be removed. So, if a / is typed
    after 1 in (1) it will become 1/(...).
  • When smartMode is on, textual operators are eligible for conversion to text.
    Previously, if an inline shortcuts for rad was defined to \operatorname{rad}
    and 'radius' was typed, only ius would be turned to text.
  • Smartmode is now applied when there is a selection. That is, if some text is
    selected and the / is pressed the selection will become the numerator. Previously
    the selection was deleted and replaced with an empty fraction
  • Improved layout of surds, particularly when the surd is empty
  • Made \mathbb{} et al. apply to the argument only, and not affect the style
    of following characters. Previously, if a \mathbb{R} was inserted, the following
    typed character would also be in Blackboard style.
  • Improved build system on Windows. That is, it now works.
  • Merge speak and readAloud APIs into one (contribution from Neil. Thanks Neil!)
  • Switched to using npm ci for CI builds. Even for local builds,
    it is recommended to use npm ci to ensure the correct version of the dependencies
    are installed.
  • In smartMode, the currency symbols are handled better. "One apple is $3.14"
    will result in the "$" being in math mode.
  • Switching to/from command mode will not suppress smart mode.

Bug fixes

  • Fixed a crash when using smartFence with sin(x^2/
  • Fixed alt+= keyboard shortcut on Windows.
  • Fixed some layout issues with box and enclose
  • Smart Fences will now work when invoked from the virtual keyboard.
  • Fixed #177: custom localization strings are now handled correctly.
  • Fixed some issues toggling style when selection is empty.

0.28

22 Apr 21:13
Compare
Choose a tag to compare

This release contains some small bug fixes and improvements.

  • Reduced Node version required (for dev builds) to Node LTS
  • Fixed some issues with focus state of mathfields, particularly with multiple mathfields on a page
  • Fixed an issue with some keys (such as /) on international keyboards (such as QWERTZ)
  • Made moveToOpposite correctly select the opposite superscript/subscript
  • Use the correct font for \operatorname, even for single character operators
  • Send content change notifications when array cells are created
  • Fixed a layout issue with upsized (\huge) content in fractions
  • More accurate layout for box atoms (with \bbox, \colorbox, \boxed and \fcolorbox)
  • Fixed an issue where units after an exponent were not recognized
  • Fixed an issue displaying virtual keyboard on narrow Android phones

New Features

  • Added support for applying size to the selection with applyStyle({size:'size9'}) (default size is size5, smallest is size1, largest is size10).
  • Added support for npm run start which will start a local web server for ease of debugging (some features, such as using JavaScript native modules, require a local server)

0.27.4

12 Apr 21:35
Compare
Choose a tag to compare

This release fixes an issue with virtual keyboards when using the 'onfocus' mode.

0.27.3

12 Apr 18:21
Compare
Choose a tag to compare

This build addresses an issue where the focus/blur events were not properly handled. This resulted in having multiple active selections (blinking caret) when multiple math fields were on the same page. This also fixes an issue with tabbing in and out of mathfields.


While you're here, I have a small favor to ask. Pleas go through the MathLive issues marked Feature and Roadmap and vote/comment on them. This will help insure future changes will not disrupt your project.

0.27.1

09 Apr 19:26
abd6caa
Compare
Choose a tag to compare
  • Downgraded the required version of node to LTS (10.0)
  • Fixed an issue calculating the correct mathstyle (display, script, scriptscript).

0.27

08 Apr 18:44
Compare
Choose a tag to compare

Breaking Changes

  • The syntax that MathJSON/MASTON can recognized has been significantly expanded. It also has been made more consistent, and in some cases it may be different than what was previously returned.
  • Future breaking change: the selector enterCommandMode will be deprecated and replaced by the more general switchMode('command'). The selector switchMode('command') is available in this release, and enterCommandMode is supported as well but it will be removed in a future release and you should migrate to switchMode() as soon as possible.

Major New Features

Text Mode (#153)

It was previously possible to enter text in an equation using the \text{} command and its family using the command mode. However, this feature was only suitable for advanced users, and had many limitations (text could not include spaces, for example).

MathLive now fully support a dedicated text mode.

To switch between math and text mode, use the alt/option+= keyboard shortcut, or programmatically using mf.$perform(['apply-style', {mode: 'math'}]).
If there is a selection it will be converted to the specified mode (math is converted to ASCII Math). If there's no selection, the next user input will be considered to be in the specified mode.

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 {(x,y)|0<=x<=1 and 0<=y<=x}
  • \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 render...
Read more