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

Toggle between equation and align #2488

Closed
cnut1648 opened this issue Sep 16, 2022 · 2 comments
Closed

Toggle between equation and align #2488

cnut1648 opened this issue Sep 16, 2022 · 2 comments

Comments

@cnut1648
Copy link

Is your feature request related to a problem? Please describe it.
When typing for math formula in \[ \] I find myself often need to switch to align due to the formula getting too long and I need to split it into several lines. Currently ts$ can toggle between inline math mode, display math mode, and equation environment. I think it will be useful if we can have even more environments to toggle, in particular, makes equation jump to align.

Additional context
A similar topic is raised in #2310, and we have vimtex_env_toggle_math_map. But I found it not able to recognize the environment name, I have the following in my config but it seems that it still fallback to default $ every time when I toggle in equation mode.

let g:vimtex_env_toggle_math_map = {
      \ '$': '\[',
      \ '\[': 'equation',
      \ 'equation': 'align',
      \ 'align': 'gather',
      \}

Thank you!

@lervag
Copy link
Owner

lervag commented Sep 16, 2022

When typing for math formula in \[ \] I find myself often need to switch to align due to the formula getting too long and I need to split it into several lines.

Actually, you should not use align in this case. Instead, you should use \begin{multline*} ... \end{multline*} or \[ \begin{split} ... \end{split} \] or something similar. align is more useful for multiple equations.

I have the following in my config but it seems that it still fallback to default $ every time when I toggle in equation mode.

let g:vimtex_env_toggle_math_map = {
      \ '$': '\[',
      \ '\[': 'equation',
      \ 'equation': 'align',
      \ 'align': 'gather',
      \}

That's definitely a bug. I've pushed a fix now. Thanks for noticing and reporting!

lervag added a commit that referenced this issue Sep 16, 2022
@lervag lervag closed this as completed Sep 16, 2022
@cnut1648
Copy link
Author

@lervag Thanks for the suggestion!

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

No branches or pull requests

2 participants