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

Auto placement of "\\" and "&" on enter within the enabled shortcut blocks #68

Closed
fvcci opened this issue Sep 30, 2022 · 1 comment
Closed

Comments

@fvcci
Copy link

fvcci commented Sep 30, 2022

If I have the align, matrix, or cases shortcut blocks enabled I get the characters "\\" and "&" automatically placed on an enter while I am in the corresponding block:
image

As you can see on enter it places a "\\" on the current line then skips an indentation and places a "&" immediately after. But a lack of indentation is not my main complaint. It may be convenient to automatically place these characters on enter, but in many cases this may not be what a user wants.

On the first line I have an overly long line in the code, so I would want it to be in typed in separate lines. But when it is being displayed I want it to be in one line since it can fit in one line. Adding the "\\" on enter makes it so that a user would have to delete them every time their code is too long but when it is being displayed it would not be.

On the last line I want to display the variable again to show that I am square rooting both sides. This would be a common reason to display the left hand side to an equation, and with the auto placement of "&" it is inconvenient to do because it must be deleted to get the alignment correct.

There are many other reasons to why the auto placement is inconvenient other than these, which is why I think this feature should be removed or separated from the functionality of shortcut blocks because I think shortcut blocks are really useful and I would use them if it weren't for "\\" and "&".

@joeyuping
Copy link
Owner

joeyuping commented Oct 1, 2022

Hi @fvcci !

Thank you so much for the suggestion!
I did some modification to the functionality (see v2.4.0)

  • user can now set whether to use enter or shift-enter within align and cases block to automatically add next line symbols \. (see settings page) NOTE: the & symbol will no longer be automatically added after pressing enter, but an additional function for alignment is added (see next)
  • new function: when within align block, the plugin automatically add align symbol "&" before user-defined symbols (default: = > < \le \ge \neq \approx)
    e.g. x =(press "space" here), and "&" will be added before the = sign.
  • when at the end of the align, matrix or cases block, pressing "tab" once (for align) or twice (for matrix and cases block) will bring the cursor out of the block.
  • If next line is double dollar signs, press "tab" again will jump out of double dollar signs.

I hope the above changes would improve the workflow for the use case you mentioned above. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants