sillybun / zyt-snippet

81 stars 17 forks source link

Add a solution for bmat pmat and several minor fixes #9

Closed ChasingZenith closed 3 years ago

ChasingZenith commented 3 years ago
  1. bmat pmat: all you need is to separate each element with space or tab. Select in visual mode
    1 0 9 2 \mu
    9 8 3 0 7

    press bmat<tab> it will turn to

    \begin{bmatrix}
    1   &   0   &   9   &   2   &   \mu \\
    9   &   8   &   3   &   0   &   7
    \end{bmatrix}

Now, anything that is separated by a space will be seen as different elements. This may lead to some inconvenience, for example, inserting \mu a. Here is some direction to solve this problem:

  1. only use tab but not space to separate elements, but this is not perfect because some vim users will use softtab.
  2. Use tab and 2+ spaces to separate elements. Anything separated by only one space will be seen as one element.
  3. surround the content with space in it with (...) to indicate that it is an element.

Do you have any other ideas?

  1. Fix modeline vim -> vim:, snippet -> snippets.
  2. Consistent tab: use tab now.
ChasingZenith commented 3 years ago

output

sillybun commented 3 years ago

how about:

  1. If all elements are separated by one space, they are seen as different element
  2. If some elements are separated by >=2 spaces or tab and some are separated by one space, the formers are seen as matrix elements boundaries and 1 space is not