lervag / vimtex

VimTeX: A modern Vim and neovim filetype plugin for LaTeX files.
MIT License
5.29k stars 386 forks source link

An option to deal with dot when toggling inline and displaymath with `ts$` #2957

Closed gaoqiangks closed 1 month ago

gaoqiangks commented 1 month ago

Is your feature request related to a problem? Please describe it. For example, I have a inline equation like the following.

The Euler equation is $e^{i\theta}= \cos(\theta)+ i \sin(\theta)$.

If I change it to display mode with ts$, it will looks like

The Euler equation is
\begin{equation}
e^{i\theta}= \cos(\theta)+ i \sin(\theta)
\end{equation}
.

The dot is outside equation environment. However, it should in this environment.

Describe the solution you'd like

Could you add an option such that when an inline equation is followed by a dot, then if it is changed to display mode, the dot is automatically put into the equation environment?

Describe alternatives you've considered A clear and short description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

lervag commented 1 month ago

Finally, please remove any boilerplate template content that is not relevant!

I removed the boilerplate content from the top of your post. ;)

The dot is outside equation environment. However, it should in this environment.

I think the complexity of supporting this behaviour is really way too high compared to the convenience factor it brings. If you keep the dot inside the inline math delimiters, then it will already more or less work as expected.

To be clear: I agree that what you ask for makes sense. But implementing it is far from straightforward, and I don't really have a lot of time on my hands. I think the inconvenience of adjusting the punctuation manually is relatively small, as I find it is really quie few cases where this particular issue is relevant.