joeyuping / quick_latex_obsidian

MIT License
326 stars 21 forks source link

Feature Request: Optional expansion for shorthands after backslash #50

Closed mayurankv closed 2 years ago

mayurankv commented 2 years ago

Hi Joe, once again thank you so much for this plugin! I was wondering whether it would be possible to implement an option in settings which allows for expanding shorthands after the backslash "\" character. i.e. typing '\al' then a space would expand to '\alpha' just as 'al' would. This should be an option in my opinion as some people might set have shorthands that correspond to real latex commands and this would interfere with that, though I think implementing this is reasonable since it is rather bad practice to do that. I don't think this would be a difficult idea to implement.

The reason I want this to be implemented is not every command i use is tied to a shorthand so I still often type the '\' character. Then sometimes I recall I have indeed tied a shorthand or even just type out something like \vec and would like it to expand to \vec{} with the cursor inside the brackets.

I'm aware this is my personal opinion and this may itself be bad practice so if you or any others have objections to this, please leave a comment! Thank you!

joeyuping commented 2 years ago

Hi @mayurankv !

First of all, really sorry for the late reply!

I am not sure if I understand what you mean completely... right now, a shortcut of "al" that expand to "\alpha" will also work by typing "\al". The plugin will notice that the expansion contains a backslash, and so if the user type as backslash before the shorthand, the plugin will automatically take the backslash into consideration and expand the shorthand in a way that will not result in two backslashes.

Is this what you mean?

mayurankv commented 2 years ago

Hi Joe, sorry for the late reply. This is indeed working as expected now. Not 100% sure what my issue was then but all great now!