diff --git a/package-lock.json b/package-lock.json index 073ea3be..1d852aa8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "idb-keyval": "^6.2.0", "mathjax": "^3.2.2", "mathjs": "^11.8.2", - "mathlive": "github:mgreminger/mathlive#23492aab778bf75b87b6b6f40c9fbe694757ec7e", + "mathlive": "github:mgreminger/mathlive#29b14918088a7f0ad9f8204f982447a7dbc6c8df", "plotly.js-basic-dist": "github:mgreminger/plotly.js#dist-basic-for-ep", "quick-lru": "^6.1.1", "quill": "^1.3.7", @@ -5274,8 +5274,8 @@ }, "node_modules/mathlive": { "version": "0.98.6", - "resolved": "git+ssh://git@github.com/mgreminger/mathlive.git#23492aab778bf75b87b6b6f40c9fbe694757ec7e", - "integrity": "sha512-pBQTdGt+L0UsSggnrDGzY1lvroNPYtS0BsXIzsHXzfSa09JVchruq6ob6MIU2FDbtz9aoDk12MfzDFEmv0y0SQ==", + "resolved": "git+ssh://git@github.com/mgreminger/mathlive.git#29b14918088a7f0ad9f8204f982447a7dbc6c8df", + "integrity": "sha512-TWC1iRy9bi9VQPk/5eRAPwm39SvvETm01KAY/wj+Nnzf7agSUbclRMRI530Mc3Gaz2ehbNZEzVmIsVhJQk/aZg==", "license": "MIT", "dependencies": { "@cortex-js/compute-engine": "0.23.1" @@ -11720,9 +11720,9 @@ } }, "mathlive": { - "version": "git+ssh://git@github.com/mgreminger/mathlive.git#23492aab778bf75b87b6b6f40c9fbe694757ec7e", - "integrity": "sha512-pBQTdGt+L0UsSggnrDGzY1lvroNPYtS0BsXIzsHXzfSa09JVchruq6ob6MIU2FDbtz9aoDk12MfzDFEmv0y0SQ==", - "from": "mathlive@github:mgreminger/mathlive#23492aab778bf75b87b6b6f40c9fbe694757ec7e", + "version": "git+ssh://git@github.com/mgreminger/mathlive.git#29b14918088a7f0ad9f8204f982447a7dbc6c8df", + "integrity": "sha512-TWC1iRy9bi9VQPk/5eRAPwm39SvvETm01KAY/wj+Nnzf7agSUbclRMRI530Mc3Gaz2ehbNZEzVmIsVhJQk/aZg==", + "from": "mathlive@github:mgreminger/mathlive#29b14918088a7f0ad9f8204f982447a7dbc6c8df", "requires": { "@cortex-js/compute-engine": "0.23.1" } diff --git a/package.json b/package.json index 24a7fe4b..a6c4608e 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "idb-keyval": "^6.2.0", "mathjax": "^3.2.2", "mathjs": "^11.8.2", - "mathlive": "github:mgreminger/mathlive#23492aab778bf75b87b6b6f40c9fbe694757ec7e", + "mathlive": "github:mgreminger/mathlive#29b14918088a7f0ad9f8204f982447a7dbc6c8df", "plotly.js-basic-dist": "github:mgreminger/plotly.js#dist-basic-for-ep", "quick-lru": "^6.1.1", "quill": "^1.3.7", diff --git a/src/App.svelte b/src/App.svelte index 4de08b1b..7a3baac1 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -90,7 +90,7 @@ const apiUrl = window.location.origin; - const currentVersion = 20240406; + const currentVersion = 20240418; const tutorialHash = "fFjTsnFoSQMLwcvteVoNtL"; const termsVersion = 20240110; diff --git a/src/CustomMatrixModal.svelte b/src/CustomMatrixModal.svelte index 8cf6a78a..e1b3bad7 100644 --- a/src/CustomMatrixModal.svelte +++ b/src/CustomMatrixModal.svelte @@ -1,5 +1,6 @@ @@ -44,7 +44,6 @@
@@ -53,7 +52,7 @@
diff --git a/src/MathField.svelte b/src/MathField.svelte index 565821f5..42281f62 100644 --- a/src/MathField.svelte +++ b/src/MathField.svelte @@ -4,7 +4,7 @@ import type { MathField } from "./cells/MathField"; import type { MathfieldElement } from "mathlive"; - import { INLINE_SHORTCUTS } from "./constants"; + import { INLINE_SHORTCUTS, MAX_MATRIX_COLS } from "./constants"; export let latex = ""; export let mathField: MathField | null = null; @@ -287,6 +287,7 @@ +April 18, 2024 +

Maximum Matrix Columns Limit Increased

+

+ The maximum number of columns allowed in a matrix has been increased to 50. + The previous limit was 10. The number of rows allowed is unlimited, however, + performance may become sluggish with large matrices. +

+ +
+ April 6, 2024

Drag to Reorder Cells Improvements

diff --git a/src/constants.ts b/src/constants.ts index 32ec9ba2..ed8898fc 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -10,4 +10,6 @@ export const INLINE_SHORTCUTS = { '$doubleprime': '\\frac{\\mathrm{d}^{2}}{\\mathrm{d}\\left(#?\\right)^{2}}\\left(#?\\right)', '$tripleprime': '\\frac{\\mathrm{d}^{3}}{\\mathrm{d}\\left(#?\\right)^{3}}\\left(#?\\right)', 'log_': '\\log_{#?}(#?)', -}; \ No newline at end of file +}; + +export const MAX_MATRIX_COLS = 50; diff --git a/src/parser/LatexToSympy.ts b/src/parser/LatexToSympy.ts index 858705b9..3b84901d 100644 --- a/src/parser/LatexToSympy.ts +++ b/src/parser/LatexToSympy.ts @@ -13,6 +13,7 @@ import type { FieldTypes, Statement, QueryStatement, RangeQueryStatement, UserFu ScatterXValuesQueryStatement, ScatterYValuesQueryStatement} from "./types"; import { RESERVED, GREEK_CHARS, UNASSIGNABLE, COMPARISON_MAP, UNITS_WITH_OFFSET, TYPE_PARSING_ERRORS, BUILTIN_FUNCTION_MAP } from "./constants.js"; +import { MAX_MATRIX_COLS } from "../constants"; import { type GuessContext, type Guess_listContext, IdContext, type Id_listContext, type StatementContext, type QueryContext, type AssignContext, type EqualityContext, type PiExprContext, @@ -1733,6 +1734,7 @@ export class LatexToSympy extends LatexParserVisitor MAX_MATRIX_COLS) { + this.addParsingErrorMessage(`Matrices are limited to ${MAX_MATRIX_COLS} columns. The number of rows is unlimited`); + error = true; + continue; } const blankMatrixLatex = getBlankMatrixLatex(numRows, numColumns); @@ -1777,8 +1787,6 @@ export class LatexToSympy extends LatexParserVisitor { expect(content).toBe(String.raw`\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}`); }); -test('Matrix inverse keyboard entry for two blank matrices', async () => { +test('Matrix keyboard entry for two blank matrices', async () => { await page.locator('#cell-0 >> math-field.editable').type('([1,2]@[2,1])_1,1'); await page.locator('#cell-0 >> math-field.editable').press('Tab'); await page.locator('#cell-0 >> math-field.editable').type('='); @@ -95,3 +95,35 @@ test('Matrix virtual keyboard entry', async () => { let content = await page.textContent(`#result-value-0`); expect(content).toBe(String.raw`\begin{bmatrix} a c + b d \end{bmatrix}`); }); + +test('Matrix with more than 10 columns', async () => { + await page.locator('#cell-0 >> math-field.editable').type('[1,11]'); + await page.locator('#cell-0 >> math-field.editable').type('='); + await page.locator('#cell-0 >> math-field.editable').press('Enter'); + await page.locator('#cell-0 >> math-field.editable').type('a'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('b'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('c'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('d'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('e0'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('f'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('g'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('h'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('i0'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('j'); + await page.locator('#cell-0 >> math-field.editable').press('Tab'); + await page.locator('#cell-0 >> math-field.editable').type('k'); + + await page.waitForSelector('text=Updating...', {state: 'detached'}); + + let content = await page.textContent(`#result-value-0`); + expect(content).toBe(String.raw`\begin{bmatrix} a & b & c & d & e_{0} & f & g & h & i_{0} & j & k \end{bmatrix}`); +}); \ No newline at end of file