mathlive
mathlive copied to clipboard
One dimensional vectors cause confusion
Describe the bug Pressing ENTER within parentheses converts them into a vector. Removing the newline again doesn't convert it back, so you're stuck with a one-dimensional vector.
To Reproduce [Steps to reproduce the behavior, for example:]
- mathlive.io and open the code section
- Insert
(,a - Hit ENTER
- Notice how your latex content in the code section shows
\begin{pmatrix}a \\ \end{pmatrix}now. - Hit BACKSPACE
- Notice your latext content now is
\begin{pmatrix}a\end{pmatrix}
Expected behavior I am not quite sure. I'd be great if a one-dimensional vector would be converted back to simple parentheses around the single entry. I am worried though I am asking to introduce lots of complications there. In older versions of mathlive there were no vectors, so I did not encounter the problem previously. I see us using the vectors at some point, too, though, so I'm happy to have that feature. It's just very undiscoverable for users when their parentheses have become matrix-markup and we cannot expect them to inspect the raw latex markup. The main problem there might be that these 1x1-matrices are not visually distinctive from simple parentheses.
I think it's reasonable that in this case once the "row" has been deleted, you get back "(a)" (i.e. no longer a vector).
I think this is the same problem I had with #225. I think the auto vector behaviour is a bit of a problem here. Is there some way to turn it off?
Similar editors avoid this in the first place by using [ ] for vectors and matrices instead of ( ). It's less ambiguous that way.
I have another problem with the vectors.
For expression in latex \begin{pmatrix}a & b & c\end{pmatrix} the ASCIIMath output is empty.
This problem is the same for vectors of all types and sizes.
@yorologo good catch! That sounds like a different issue, though. Do you want me to open a new issue or would you rather do it?
Issue #654 tracks the ASCIIMath problem