Type Alias InlineShortcutsOptions

InlineShortcutsOptions: {
    inlineShortcuts: InlineShortcutDefinitions;
    inlineShortcutTimeout: number;
}

Type declaration

  • inlineShortcuts: InlineShortcutDefinitions

    An inline shortcut can be specified as a simple string or as an object literal with additional options:

        config.inlineShortcuts = {
    half: '\\frac{1}{2}',
    in: {
    after: 'space+letter+digit+symbol+fence',
    value: '\\in',
    },
    };

    When using a string, the shortcut applies regardless of the characters surrounding it.

    When using an object literal the value key is required an indicate the shortcut substitution.

    The "after" key, if present, indicate in what context (preceding characters) the shortcut will apply. One or more values can be specified, separated by a '|' character. If any of the values match, the shortcut is 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
  • inlineShortcutTimeout: number

    Maximum time, in milliseconds, between consecutive characters for them to be considered part of the same shortcut sequence.

    A value of 0 is the same as infinity: any consecutive character will be candidate for an inline shortcut, regardless of the interval between this character and the previous one.

    A value of 750 will indicate that the maximum interval between two characters to be considered part of the same inline shortcut sequence is 3/4 of a second.

    This is useful to enter "+-" as a sequence of two characters, while also supporting the "±" shortcut with the same sequence.

    The first result can be entered by pausing slightly between the first and second character if this option is set to a value of 250 or so.

    Note that some operations, such as clicking to change the selection, or losing the focus on the mathfield, will automatically timeout the shortcuts.