benetech / MathShare

MIT License
9 stars 3 forks source link

applying ">-" using keyboard generates a weird symbol #29

Closed sueannma closed 6 years ago

sueannma commented 6 years ago

bug in current editor creates weird symbol

NSoiffer commented 6 years ago

This is part of mathlive's design, and not a bug. mathlive has a long list of keyboard shortcuts (some taken from ASCIIMath). We have two options to change this behavior:

  1. We can override any problematic shortcut.
  2. We can provide our own list of shortcuts.

After discussion with Sue-Ann, we will go with option 1 for now and override "<-" and ">-".

For completeness, here is the list of mathive shortcuts:

const INLINE_SHORTCUTS = {
    '>=':                   '\\geqslant',
    '≥':                    '\\ge',
    '<=':                   '\\leqslant',
    '≤':                    '\\le',
    '!=':                   '\\ne',
    '≈':                    '\\approx',
    '~~':                   '\\approx',             // ASCIIMath
    '÷':                    '\\div',
    '-:':                   '\\div',                // ASCIIMath
    '¬':                    '\\neg',
    '+-':                   '\\pm',                 // ASCIIMath
    '-=':                   '\\equiv',                 // ASCIIMath
    '\u2212=':              '\\equiv',                 // ASCIIMath
    '~=':                   '\\cong',               // ASCIIMath
    ':=':                   '\\coloneq',
    '::':                   '\\Colon',
    '(:':                   '\\langle',
    ':)':                   '\\rangle',
    '-<':                   '\\preq',                // ASCIIMath
    '\u2212<':              '\\preq',                // ASCIIMath
    '>-':                   '\\succ',               // ASCIIMath
    'prop':                 '\\propto',              // ASCIIMath
    ':.':                   '\\therefore',          // ASCIIMath
    '**':                   '\\ast',                // ASCIIMath
    // '\u2217*':              '\\ast',             // ASCIIMath
    '\u2217*':              '\\star',               // ASCIIMath
    'xx':                   '\\times',              // ASCIIMath
    '@':                    '\\circ',               // ASCIIMath
    'diamond':              '\\diamond',            // ASCIIMath
    'square':               '\\square',            // ASCIIMath
    'iff':                  '\\iff',            // ASCIIMath

    'alpha':                '\\alpha',            // ASCIIMath
    'beta':                 '\\beta',            // ASCIIMath
    'gamma':                '\\gamma',            // ASCIIMath
    'Gamma':                '\\Gamma',            // ASCIIMath
    'delta':                '\\delta',            // ASCIIMath
    'Delta':                '\\Delta',            // ASCIIMath
    'chi':                  '\\chi',            // ASCIIMath
    'epsilon':              '\\epsilon',            // ASCIIMath
    'varepsilon':           '\\varepsilon',            // ASCIIMath
    'eta':                  '\\eta',            // ASCIIMath
    'iota':                 '\\iota',            // ASCIIMath
    'kappa':                '\\kappa',            // ASCIIMath
    'lambda':               '\\lambda',            // ASCIIMath
    'Lambda':               '\\Lambda',            // ASCIIMath
    'mu':                   '\\mu',            // ASCIIMath
    'µ':                    '\\mu',        // @TODO: or micro?
    'nu':                   '\\nu',            // ASCIIMath
    'pi':                   '\\pi',
    'π':                    '\\pi',
    'Pi':                   '\\Pi',
    'phi':                  '\\phi',
    'Phi':                  '\\Phi',
    'varphi':               '\\varphi',
    'psi':                  '\\psi',
    'Psi':                  '\\Psi',
    'rho':                  '\\rho',
    'tau':                  '\\tau',
    'sigma':                '\\sigma',
    'Sigma':                '\\Sigma',
    'theta':                '\\theta',
    'Theta':                '\\Theta',
    'vartheta':             '\\vartheta',
    'upsilon':              '\\upsilon',
    'xi':                   '\\xi',
    'Xi':                   '\\Xi',
    'zeta':                 '\\zeta',
    'omega':                '\\omega',
    'Ω':                    '\\omega',     // @TODO: or ohm?

    'ii':                   '\\imaginaryI',
    'jj':                   '\\imaginaryJ',
    'ee':                   '\\exponentialE',
    'nabla':                '\\nabla',

    'oo':                   '\\infty',       // ASCIIMath
    '∞':                    '\\infty',         // @TODO: doesn't work
    // '&infin;': '\\infty',
    // '&#8734;': '\\infty',

    '∑':                    '\\sum',
    'sum':                  '\\sum_{#?}^{#?}',       // ASCIIMath
    'prod':                 '\\prod_{#?}^{#?}',       // ASCIIMath
    '∆':                    '\\diffd',     // @TODO: most common?
    'grad':                 '\\nabla',       // ASCIIMath
    '∂':                    '\\differentialD',
    'del':                  '\\partial',       // ASCIIMath
    '√':                    '\\sqrt',
    'sqrt':                 '\\sqrt',
    '∫':                    '\\int',
    'aleph':                '\\aleph',       // ASCIIMath

    'nn':                   '\\cap',            // ASCIIMath
    'nnn':                  '\\bigcap',         // ASCIIMath
    '\u2229n':              '\\bigcap',         // ASCIIMath
    'uu':                   '\\cup',            // ASCIIMath
    'uuu':                  '\\bigcup',         // ASCIIMath
    '\u222au':              '\\bigcup',         // ASCIIMath

    // 'arg': '\\arg',
    'sin':                  '\\sin',
    'cos':                  '\\cos',
    'tan':                  '\\tan',
    'log':                  '\\log',
    'ln':                   '\\ln',
    'exp':                  '\\exp',
    'lim':                  '\\lim',
    'det':                  '\\det',
    'mod':                  '\\mod',
    'max':                  '\\max',
    'min':                  '\\min',

    'NN':                   '\\N',        // Natural numbers
    'ZZ':                   '\\Z',        // Integers
    'QQ':                   '\\Q',        // Rational numbers
    'RR':                   '\\R',        // Real numbers
    'CC':                   '\\C',        // Complex numbers
    'PP':                   '\\P',        // Prime numbers

    'forall':               '\\forall',
    'AA':                   '\\forall',
    '!exists':              '\\nexists', // TODO: conflicts with 'exists'
    'exists':               '\\exists',
    'EE':                   '\\exists',
    '!EE':                  '\\nexists',
    'in':                   '\\in',
    '!in':                  '\\notin',
    'sub':                  '\\subset',     // ASCIIMath
    'sup':                  '\\supset',     // ASCIIMath
    'sube':                 '\\subseteq',     // ASCIIMath
    '\u2282e':              '\\subseteq',     // ASCIIMath
    'supe':                 '\\supseteq',     // ASCIIMath
    '\u2283e':              '\\supseteq',     // ASCIIMath

    '&&':                   '\\land',
    '||':                   '\\lor',
    '+...':                 '+\\cdots',
    '\u2212...':            '-\\cdots',
    '\u2192...':            '\to\\cdots',
    '...':                  '\\ldots',

    '->':                   '\\to',
    '\u2212>':              '\\to',      // minus sign + >
    '∣−>':                  '\\mapsto',
    '-->':                  '\\longrightarrow',
    '\u2212\u2212>':        '\\longrightarrow',
    '<-':                   '\\leftarrow',
    '<--':                  '\\longleftarrow',
    '←-':                   '\\longleftarrow',
    '=>':                   '\\Rightarrow',
    '==>':                  '\\Longrightarrow',
// '<=': '\\Leftarrow',     // CONFLICTS WITH LESS THAN OR EQUAL
    '<=>':                  '\\Leftrightarrow',
    '⩽>':                   '\\Leftrightarrow',
    '<->':                  '\\leftrightarrow',
    '←>':                   '\\leftrightarrow',
    '<<':                   '\\ll',
    '>>':                   '\\gg',
    'uarr':                  '\\uparrow',            // ASCIIMath
    'darr':                  '\\downarrow',            // ASCIIMath
    'rarr':                  '\\rightarrow',            // ASCIIMath
    'rArr':                  '\\Rightarrow',            // ASCIIMath
    'larr':                  '\\leftarrow',            // ASCIIMath
    'lArr':                  '\\Leftarrow',            // ASCIIMath
    'harr':                  '\\leftrightarrow',            // ASCIIMath
    'hArr':                  '\\Leftrightarrow',            // ASCIIMath

    '(.)':                  '\\odot',
    'o.':                   '\\odot',                // ASCIIMath
    '(+)':                  '\\oplus',      
    'o+':                   '\\oplus',                 // ASCIIMath
    // '(/)':                  '\\oslash',
    '(\u2217)':             '\\otimes',
    'ox':                   '\\otimes',            // ASCIIMath

    '(–)':                  '\\ominus',
    '(\u2212)':             '\\circleddash',
    '(-)':                  '\\circleddash',
};