diff --git a/src/addons/math-ml.ts b/src/addons/math-ml.ts index 8d2f1d8c0..d387da1cb 100644 --- a/src/addons/math-ml.ts +++ b/src/addons/math-ml.ts @@ -372,8 +372,12 @@ function scanOperator(stream: MathMLStream, final: number, options) { '\\vert': '|', '\\Vert': '\u2225', '\\mid': '\u2223', + '\\{': '{', + '\\}': '}', '\\lbrace': '{', '\\rbrace': '}', + '\\lbrack': '[', + '\\rbrack': ']', '\\lparen': '(', '\\rparen': ')', '\\langle': '\u27E8', diff --git a/src/editor/atom-to-ascii-math.ts b/src/editor/atom-to-ascii-math.ts index a643805b1..f0e852da6 100644 --- a/src/editor/atom-to-ascii-math.ts +++ b/src/editor/atom-to-ascii-math.ts @@ -68,6 +68,8 @@ const SPECIAL_OPERATORS = { '\\vert': '|', '\\Vert': '||', '\\mid': '|', + '\\lbrack': '[', + '\\rbrack': ']', '\\lbrace': '{', '\\rbrace': '}', '\\lparen': '(', diff --git a/src/public/core-types.ts b/src/public/core-types.ts index f3646e2c3..aab85b054 100644 --- a/src/public/core-types.ts +++ b/src/public/core-types.ts @@ -40,9 +40,8 @@ export type Token = string; export type ParseMode = 'math' | 'text' | 'latex'; /** - * Error code passed to the [[`ErrorListener`]] function. + * Error codes returned by the `mf.errors` property. * - * See [[`MathfieldOptions`]], [[`convertLatexToMarkup`]] * * | | | @@ -89,10 +88,6 @@ export type LatexSyntaxError = { after?: string; }; -export type ErrorListener = ( - err: LatexSyntaxError -) => void; - /** * Variants indicate a stylistic alternate for some characters. * diff --git a/src/public/mathfield-element.ts b/src/public/mathfield-element.ts index 505604a74..7101f316d 100644 --- a/src/public/mathfield-element.ts +++ b/src/public/mathfield-element.ts @@ -1297,6 +1297,7 @@ import 'https://unpkg.com/@cortex-js/compute-engine?module'; } /** + * Return an array of LaTeX syntax errors, if any. * @category Accessing and changing the content */ get errors(): LatexSyntaxError[] { diff --git a/src/public/mathlive-ssr.ts b/src/public/mathlive-ssr.ts index 9be4351f5..d5314f132 100644 --- a/src/public/mathlive-ssr.ts +++ b/src/public/mathlive-ssr.ts @@ -139,8 +139,6 @@ export function validateLatex(s: string): LatexSyntaxError[] { * @param options.generateId If true, add an `"extid"` attribute * to the MathML nodes with a value matching the `atomID`. This can be used * to map items on the screen with their MathML representation or vice-versa. - * @param options.onError Callback invoked when an error is encountered while - * parsing the input string. * * @category Converting */ diff --git a/src/public/virtual-keyboard.ts b/src/public/virtual-keyboard.ts index 50abef2c3..c64d93be8 100644 --- a/src/public/virtual-keyboard.ts +++ b/src/public/virtual-keyboard.ts @@ -51,7 +51,7 @@ export interface VirtualKeyboardKeycap { * CSS classes to apply to the keycap. * * - `tex`: use the TeX font for its label. - * Using the tex class is not necessary if using the latex property to + * Using the tex class is not necessary if using the `latex` property to * define the label. * - `shift`: a shift key * - `small`: display the label in a smaller size diff --git a/src/virtual-keyboard/data.ts b/src/virtual-keyboard/data.ts index 221ee3e18..9124c2ca4 100644 --- a/src/virtual-keyboard/data.ts +++ b/src/virtual-keyboard/data.ts @@ -115,7 +115,7 @@ export const LAYOUTS: Partial< { latex: '\\iiint', class: 'small' }, { latex: '\\oint', class: 'small' }, '\\mathrm{d}x', - { latex: '\\dfrac{\\rd}{\\rd x}', class: 'small' }, + { latex: '\\dfrac{\\mathrm{d}}{\\mathrm{d} x}', class: 'small' }, { latex: '\\frac{\\partial}{\\partial x}', class: 'small' }, '\\partial', @@ -607,7 +607,7 @@ export const LAYOUTS: Partial< variants: [ '\\mathrm{d}x', - { latex: '\\dfrac{\\rd}{\\rd x}', class: 'small' }, + { latex: '\\dfrac{\\mathrm{d}}{\\mathrm{d} x}', class: 'small' }, { latex: '\\frac{\\partial}{\\partial x}', class: 'small' }, '\\partial',