Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Improved matrix editing UI #600

Closed
zwz opened this issue Aug 28, 2020 · 12 comments
Closed

[FEATURE] Improved matrix editing UI #600

zwz opened this issue Aug 28, 2020 · 12 comments
Assignees
Labels
feature Request for a new feature or functionality, as opposed to a defect in an existing feature.

Comments

@zwz
Copy link

zwz commented Aug 28, 2020

I am quite new to mathlive.
And I find it not intuitive and user-friendly to do matrix editing, such as

  1. adding a column (I get it done by memorizing the keyboard shortcuts)
  2. adding a new row for a multi-column matrix only gets one-column row
  3. very hard to tell how many columns are there already when most columns are blank

So I suggest

  1. add buttons of "new column/row (before/after)" and "remove current column/row" in the virtual keyboard
  2. when a new row is added, it spans into multi-column row
  3. each blank spot shows (DOTTED SQUARE) as a placeholder. This will not only make it easy to tell the column-size, but also help user to locate and fill the spot to make a sparse matrix on a mobile device.
@stefnotch
Copy link
Contributor

I agree that the current handling of matrices could use some improvements.

For what it's worth, here is how some other editors handle this
Swiftcalcs (which I think uses a modified version of MathQuill)

  • Add row ,
  • Add column ;
  • Shows placeholders

Mathcha (uses a really good, custom, closed source math editor)

  • Add row and add column Enter and then choosing
    image
  • Shows placeholders

Mathcad (expensive desktop application)

  • Add row Shift+Space
  • Add column Shift+Enter
  • Shows placeholders

@NSoiffer
Copy link
Collaborator

Adding more systems:
Mathematica

  • add column after: ctrl+,
  • add row after: ctrl+enter/return (windows/mac)

Also menu entries for them along with a way to span and split them.

Word
Not really any keyboard shortcuts (tab adds a row at the bottom in some cases).
However, it has several menu entries and ribbon entries to add one or more rows/cols above and below current selection.

Options for merging and splitting

@arnog
Copy link
Owner

arnog commented Aug 29, 2020

To clarify, MathLive by default uses the same shortcuts as Mathematica (Ctrl+, and return to add a column/row). I don't think this issue is about what the shortcuts should be or that MathLive is lacking shortcuts for basic matrix editing.

Note also that it is possible to define a custom virtual keyboard with commands to add/remove columns/rows. If someone wants to submit one, I'd be happy to review it.

The point about having a placeholder visible for empty cells is a good one.

The behavior when inserting a new row could be changed so that a new row has as many columns as the previous one, but note that Latex matrixes are sparse and could have variable number of cells per row. But perhaps that could be not supported when creating a new matrix with MathLive (but still supported if the matrix was pasted into MathLive).

@stefnotch
Copy link
Contributor

I personally would make new rows have as many columns as the previous one, because I don't think that non-square matrices are very common and I also don't think that there should be a distinction between empty (doesn't exist) and empty (placeholder).

@zwz
Copy link
Author

zwz commented Aug 29, 2020

@arnog I agree with you that it is not an issue about the shortcuts.
IMO, mathlive aims to be picked up quickly for a general new user (no experience on Mathematics)
without (much) learning/memorizing.
That is why I think the row/column editing buttons should be in the virtual keyboard by default.

@arnog
Copy link
Owner

arnog commented Aug 30, 2020

After further thoughts, while adding some commands in a virtual keyboard panel is a potential solution, it does have the drawback that the virtual keyboard is not always available (it can be turned off on desktop, for example). So, I don't think having the default matrix editing commands in the default virtual keyboard is the best option. Instead, I would suggest a floating editing bar (similar to the pop-over in command mode), which would appear when the caret is inside a matrix and would look something like this:

Screen Shot 2020-08-30 at 9 59 40 AM

The (+) buttons would allow the insertion of a column/row and the (-) buttons would allow the deletion of a row/column, while the other buttons would allow the selection of the "style" of the matrix.

@Khazuar
Copy link
Contributor

Khazuar commented Sep 3, 2020

I would really love to have something like this, we're currently struggling with enabling good matrix support for our application (via mathlive). Having this built in would make things much easier. I also love the idea to have placeholders for all empty spots when inserting a new row / column via mathlive.

@arnog
Copy link
Owner

arnog commented Sep 3, 2020

Another option would be to have a contextual menu. On mobile, this could be a floating widget that would show the menu when tapped.

@stefnotch
Copy link
Contributor

Relevant issue #225

@arnog arnog changed the title Matrix editing improvement suggestions Feature: Improved matrix editing UI Oct 11, 2020
@arnog arnog added the feature Request for a new feature or functionality, as opposed to a defect in an existing feature. label Oct 11, 2020
@arnog arnog self-assigned this Nov 19, 2020
@arnog arnog pinned this issue Nov 19, 2020
@arnog arnog changed the title Feature: Improved matrix editing UI [FEATURE] Improved matrix editing UI Jun 24, 2022
@WildYellowfin
Copy link
Collaborator

Working on this this WE. This is what I have - tentatively:

IMG_0387.MOV

I still need to make some array move commands, as well as options for changing delimiters.

@arnog
Copy link
Owner

arnog commented Apr 9, 2023

Excellent! Coincidentally, I'm working on improving the keyboard shortcuts for matrix editing (and creation).

So, you're implementing the UI as a custom keyboard layout?

@WildYellowfin
Copy link
Collaborator

It is basically part of the keyboard, but it shows up as a popover. I’ve modified the updateToolbar to show the popover if in math mode and inside a matrix. The proxy passes the field DOMRect to position the popover, and the environment name is also passed.

A slight annoyance is that I’m using the same scrim as the variants panel, so opening variants closes the matrix popover, but I could work around that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Request for a new feature or functionality, as opposed to a defect in an existing feature.
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

6 participants