Opened 8 weeks ago
Last modified 8 weeks ago
#64310 new defect (bug)
Math component Problem with matrix
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 7.0 | Priority: | normal |
| Severity: | normal | Version: | 6.9 |
| Component: | Editor | Keywords: | reporter-feedback has-patch |
| Focuses: | ui, tests | Cc: |
Description
I tested new WP 6.9 and their component Math, and found that it has problem with work with matrixes in LaTeX
Multiplication of three matrices
\[
\begin{pmatrix}
1 & 0 \\
0 & 1
\end{pmatrix}
\cdot
\begin{pmatrix}
2 & 3 \\
4 & 5
\end{pmatrix}
\cdot
\begin{pmatrix}
x \\
y
\end{pmatrix}
=
\begin{pmatrix}
2x + 3y \\
4x + 5y
\end{pmatrix}
\]
shoude convert to
(1001)⋅(2435)⋅(xy)=(2x+3y4x+5y)
but I see problem -> Can't use function '\]' in math mode at position 69: …rix} = ad - bc \̲]̲
also the same -> Matrix with determinant
\[
\det(A) =
\begin{vmatrix}
a & b \\
c & d
\end{vmatrix}
= ad - bc
\]
shoude be -> `det(A)=
acbd
=ad−bc`
Don't work. Please fix
Attachments (1)
Change History (9)
#2
@
8 weeks ago
Yes, it works, but if this formula is imported from other sources, it will be a problem.
Maybe you shoude add description that symbols need to be corrected to \begin{equation} and \end{equation}
#3
@
8 weeks ago
You already had \begin{pmatrix} etc., you just needed to remove the other brackets. Could you elaborate on the importing? How are you importing this math text?
#4
@
8 weeks ago
- Milestone changed from Awaiting Review to 6.9
Just to be safe, change the milestone to 6.9.
@
8 weeks ago
Documentation update: clarify that \[ \] and $$ $$ must not be used inside Math block.
#5
@
8 weeks ago
- Keywords has-patch added
The attached patch updates inline comments describing math calculations in the targeted area of core. The existing comments were either misleading or incomplete. This patch standardizes terminology, clarifies formula behavior, and aligns the documentation with the actual implementation logic.
This improves maintainability and developer clarity. No code behavior or output is modified.
#6
@
8 weeks ago
@blackstar1991 could you let me know how you were entering the LaTeX? I think we can make some improvements in the editor by stripping those common delimiter used for full LaTeX documents on paste.
But I think it would be better suited for a point release.
#7
@
8 weeks ago
I used plugins for it: https://wordpress.org/plugins/search/LaTeX/
I tested this component just out of curiosity, because when I was a student I often used LaTeX to communicate with teachers on forums.
*If you need real testing of this component, you can simply ask an AI model to generate 50–100 physics or mathematics formulas and then convert them to LaTeX and check results in WP.
#8
@
8 weeks ago
- Milestone changed from 6.9 to 7.0
Well, thank you for testing! I also frequently use this, so I totally get your problem. What we accept is LaTeX math mode, so just the code used to input math, but not all layout/document level LaTeX. Those brackets are used to delimit the math mode from the other syntax, even outside of LaTeX (like Markdown or HTML documents), to parse/detect the LaTeX math mode code. In the visual editor however, we don't need those delimiters. Even in popular libraries like KaTeX https://katex.org, this would error, and as a result also in editors such as Notion.
Let's address this in the next release, 7.0, to be a bit more forgiving. I don't think it's a critical issue. Happy to consider it in point release if we get more reports.
Can you try removing
\[? The code should not be wrapped in\[\]\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} \cdot \begin{pmatrix} 2 & 3 \\ 4 & 5 \end{pmatrix} \cdot \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 2x + 3y \\ 4x + 5y \end{pmatrix}