-
Notifications
You must be signed in to change notification settings - Fork 391
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
vimtex-env-change-math and indenting #1858
Comments
I think this sounds like a pretty good idea. I'm quite busy at the moment, but I'll look into it when I get the time. |
Ok, so, summarized: The current behaviour is: text $math$ text
% ci$\[ ---->
text \[math\] text
text
\[
math
\]
text
% ci$$ --->
text
$
math
$
text You are proposing to change this to the following: text $math$ text
% ci$\[ ---->
text
\[
math
\]
text
text
\[
math
\]
text
% ci$$ --->
text $math$ text Am I right? This would also fit with my personal style, so I am generally positive to making this change. I'm curious if it should be updated with a new option, e.g. |
Yes, that is what I had in mind. There might be a small use case for indented |
Yes, but people can of course write exactly what they want, when they want. This kind of formatting features only work well if they provide the expected feature 99% of the time, and then it is not a problem if one has to manually tweak things sometimes.
Increased complexity for user customization. In general, the more options, the more likely it is that someone will not configure VimTeX optimally. Also, more options means more complexity in the code and more things to maintain (both in code and documentation). More work. More things that can go wrong. And VimTeX is already quite complex and it takes a lot of time to maintain it. However, I don't mean I can't or won't add new options. Just that I only do so after careful consideration. And in this case, I'm fealing that an option might not really be necessary, because I would expect this feature would be welcomed by everyone. But I'm not 100 % sure about that... |
Since this seems to be waiting for user opinions: I cannot speak for others, but the suggested change would be perfect in my case as well. Nothing urgent at all, but it would be a welcome enhancement. |
Thanks, @vneiger - I think I've waited for user opinions here, yes. And there's been a lot of other issues getting in the way (and life, work, in general). In any case, thanks for bumping. I'll implement the described behaviour in not too long. First without an option. Then I'll consider an option if there should be complaints afterwards. :) |
Yes, maybe unfortunately, in general it seems easier to get spontaneous user opinion from angry users than from the numerous happy ones. So the most efficient way to know if many people don't like the change might be to do the change, indeed... In any case my goal was not to add any pressure, this does not seem like an urgent change. Whenever you find the time. And thank you for the amazing work on vimtex! |
Thanks for the kind words! And don't worry - by commenting here you got my attention and I still believe this is a relatively easy thing to implement. So I'll just do it, as I think it will also improve my own writing workflow :) |
WIP: This implements cs$ -> $, it remains to implement cs$ -> \[. refer: #1858
I've implemented half of this now. Can you please test? I.e., |
Current behavior in the following situation
is to turn this into
arguably this has the wrong indentation. Maybe this should check whether the line above the math is empty and if so use the indentation of the line with It's also unclear whether it's desirable to remove the empty line between "indented text" and the displaymath (although the answer probably is yes). |
Thanks!
|
Now I've implemented the opposite direction and a new command
|
To muddy the waters even further, what I most often wish for is a shortcut for changing (Easily enough done using |
I agree - the indents should be corrected here and the empty line should not be deleted. The empty line indicates a paragraph separation, but a displayed math environment could be the start of the paragraph as well. I'll add this to the tests and figure it out.
Yes, I believe you are right. There is also
Perhaps |
Hmmm... I feel that those are orthogonal: inline vs. display and short form vs. long form. If anything, I'd include the
(so you can use it to remove -- but never add! -- "TeXisms" as well as toggle between the two valid LaTeX variants)? |
(Just brainstorming a bit, not saying your suggestion is bad!) |
I'm not sure that it is a good idea to add support for One thing about
From |
Note that my proposal never adds
But not back -- which wasn't my motivation, but easily could be someone else's. So I still think a toggle may be useful. |
Yes yes, which sounds better: never offer |
I believe we have multiple threads going now. So let's first finalize the original topic. I believe I've addressed the first feedback on it and that it should now work more or less as expected. Feedback is of course still welcome, though! Reg. The second topic is
As an alterantive, we could use a three-way toggle, but it could go to unstarred form |
Sorry for muddying the waters... Feel free to ignore this if it is too far off-topic here. But I should point out that your "three-way proposal" has a few inconsistencies; I'd prefer
And we already have |
You are discussing the |
I believe so; since the discussion had already touched both, I just thought it would be useful to bring up the additional use case in case it changes the options. |
I consider it easily enough done; my point was the other direction: |
Ok, sounds good. Then I would be happy if you could open a new issue and address the current behaviour of And yes: I agree that it would be convenient to improve |
I'm closing this issue as resolved, but please don't hesitate to continue the discussion if something does not work as expected! (Or open new issues.) |
It looks good now concerning the above discussed issues. However, concerning the change to Some people prefer |
To be maybe more clear, in short, I would expect:
whereas currently the behavior is
|
To be fair, I've seen the second variant more frequently among those who actually use the asymmetric form. (I don't, so don't take this as an actual vote for anything.) |
Ah, ok. I wouldn't have guessed it this way (I do not know many people who use |
It's unclear to me which is the most frequently used form. But for the sake of experimenting, I'll be glad to just adjust according to @vneiger's suggestion and consider a revert if there are complaints. The change is more or less trivial. |
I usually write inline math in my source, e.g.
When I use
\[
displaymath I usually write it in separate lines using indentation. Example:This is also the universal convention for
equation
,align
, etc.Describe the solution you'd like
+ the math, and
It would be useful if (the very useful command)
vimtex-env-change-math
(i.e.cs$
) would automatically adjust the formatting. That iscs$\[<CR>
on inline math inserts three new lines containing\[
,\]
respectively. Analogously it would be handy ifcs$$<CR>
on a displaymath expression such aswere to convert it to a single line$\Chi(\mathcal{L}) = 1 - g(X) + \langle c_1(L), [X], \rangle$ (though its not clear whether completely inlining it into the surrounding text is desirable).
It would probably be best to make the format-aware
cs$
optional. I was thinking that it could depend on the argument provided to the command, i.e.\[
is format-aware while\[
remains the same.Describe alternatives you've considered
An alternative solution to this problem (I'm not sure if this has been implemented already) would be to have a functionality that allows (de-)inlining math.
The text was updated successfully, but these errors were encountered: