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

Faster numeric subscripts #14

Open
tecosaur opened this issue Mar 4, 2020 · 18 comments
Open

Faster numeric subscripts #14

tecosaur opened this issue Mar 4, 2020 · 18 comments

Comments

@tecosaur
Copy link

tecosaur commented Mar 4, 2020

Hello, me again :)

When trying to quickly write out some maths whenever I type a (latin/greek) letter followed by a numeral, 95% of the time I'm doing a subscript (e.g. x and 0 to make x_0). Something I have tried (in another editor) and found very convenient is having a numeral immediately following a letter/symbol automatically form a subscript, (i.e. x0x_0, and x11x_{11}).

If it would be possible to have this functionality in cdlatex that would be marvellous!

Thanks 😃

@cdominik
Copy link
Owner

cdominik commented Mar 5, 2020

Hi tecosaur,

I am not planning to implement that, it is too specific.

  • Carsten

@cdominik cdominik closed this as completed Mar 5, 2020
@Sinthoras7
Copy link

Sinthoras7 commented Sep 7, 2022

Hey Carsten,

to be honest, I don't think this is as niche as you think. I encountered this wish multiple times on the internet. (Probably one thing, that popularized this idea was this blogpost https://castel.dev/post/lecture-notes-1/). I myself switched from Vim to Emacs, and I am missing this feature indeed.

Because of this, I suggest that you reconsider this. Of course, you don't have to implement it, and I don't want to demand anything, as I am really grateful for your work and active communication!

@cdominik
Copy link
Owner

cdominik commented Sep 7, 2022

Hey,
I am not saying necessarily that it is rare. It really requires a different mechanism, I think. It requires adding a keybinding to all the digits, and some complicated correction mechanism when your type several digits.

More feasible would be to have a command that looks at what you have just typed make make the change.

For example x 1 1 C-c i

Is this really much better than

x _ 11 TAB

? I can see it would be faster if you just had to type

x 1

to get x_1. but wiht several digits that gets messy quickly.

I am not saying that what tecosuar proposes is not a good idea - I just think it might be better to have this as a separate minor mode.

@Sinthoras7
Copy link

Yeah, I see the point. I don't think the implementation - especially for just a single digit, which is enough 95% of the time - would be that hard, compared to other things in cdlatex (like the cdlatex-math-modify-method, or the overloaded tab key), but this automatic expanding is a different style and might really be more fitting in another minor mode.

@cdominik
Copy link
Owner

cdominik commented Sep 8, 2022 via email

@cdominik cdominik reopened this Sep 15, 2022
@cdominik
Copy link
Owner

Hi, I have reopened this issue. I tried to implement this feature and I do think I have a testable version. You need to switch to the "electricindex" branch. There you will find a file electricindex.el that implements a minor mode electricindex mode.

It does the following

x 1 turns into x_1
x 1 2 3 turns into x_{123}

etc. This mode uses texmathp to activate this functionality only in LaTeX math mode.

I am considering to distribute this minor mode with cdlatex, but as a separate file, electric index.el. I would be interested in comments and opinions.

Thanks. Carsten

@Sinthoras7
Copy link

Hi, that seems great. Is there a reason, for having those whitespaces in between? I mean, it is one keystroke more than letting x1 turn into x_1 and x123 into x_{123}.

@tecosaur
Copy link
Author

FYI this functionality (and more) currently exists in https://github.com/tecosaur/LaTeX-auto-activating-snippets.

@Sinthoras7
Copy link

By the way: I discovered this other package 1 which also contains this subscript functionality. Actually this is a whole snippet-engine and I abuse it just for the subscripts (through setting the variables, containing the snippet-lists to nil) and it works fine.

@cdominik
Copy link
Owner

cdominik commented Sep 16, 2022 via email

@tecosaur
Copy link
Author

I think so?

@Sinthoras7
Copy link

Hey,
I think it is not useless, since the other implementation is bound to a whole snippet engine, (and has still some small bugs) while this one is clean and short, but it's probably not worth the effort.

@cdominik
Copy link
Owner

cdominik commented Sep 16, 2022 via email

@Sinthoras7
Copy link

I don't really see a reason not to. The question is whether to turn it on by default, but I would probably not have it turned on by default, but let the user activate it themself.

@Sinthoras7
Copy link

Out of curiosity: Was there a reason for having the whitespace between the char and the number for the expansion to happen?

@cdominik
Copy link
Owner

cdominik commented Sep 16, 2022 via email

@cdominik
Copy link
Owner

cdominik commented Jul 8, 2023

Now the question is (to everyone reading this issue thread): Should I put this minor mode into cdlatex, or are these other packages you mention better or goon-enough? Opinions, please.

@Sinthoras7
Copy link

I think, you should put it in, since the other implementation is bound to a whole snippet engine which maybe not everyone wants to use and users of this other package could deactivate this functionality of cdlatex, if you implement a boolean variable for it.
Also thanks again :)

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

3 participants