joeyuping / quick_latex_obsidian

MIT License
326 stars 21 forks source link

Request: Is there a way to auto add \, when you press space while inside $$ ? #90

Closed Eneswar closed 1 year ago

joeyuping commented 1 year ago

Hi! @Eneswar

sorry I wasnt really able to imagine a scenario for such a functionality.. would you kindly describe the use case that you are after?

Eneswar commented 1 year ago

Sure thing, very random but when I do for example $500 meters$ it comes out as 500meters, and for me personally I prefer if there was a space between, so I have to do $500\,meters$ instead. I tried to put the "meters" part outside the $$ but I dont think it looks good.

Maybe there is a way for me to add it under custom shorthand? I just dont know how to add "spacebar".

joeyuping commented 1 year ago

Hi @Eneswar !

I see I see... for such a use case, some might use $text{500 meters}$ instead. But as you suggest, putting a slash works too. I am not so sure which one would be more common though. I could try to make an adjustment to the custom shorthand, so that it allows "space" as the shorthand for "\ ". That way, one can press space bar twice to create a "\ ". Might this work for you?

Eneswar commented 1 year ago

Pressing space twice would be a very good solution, I would appreciate that very much. This will only work inside the $$ tag right, and not outside, or outside too?

joeyuping commented 1 year ago

Hi!

please update to v2.6.2, and add the following custom shorthand to the setting:

:::\ ; (note the first space, then 3 colons, a slash, a space, finally a semicolon) This way, within the $$ tag, you can press space twice (if right after text, then press space 3 times), the slash with space will be inserted. Hope this helps improve your workflow~

linuswalter commented 1 year ago

@joeyuping very nice implementation! I am using now the shortcut as :::\,; to receive \,. Super cool, thanks a lot! :heart:

linuswalter commented 1 year ago

Sorry for just coming back to this @joeyuping, but actually I just realized that the standard custom shorthand commands do not work anymore when putting either :::\ ; or :::\,; into the list of custom shorthands. Can you reproduce this issue or is it only in my setup?

joeyuping commented 1 year ago

@linuswalter Hi!

because there was a change of syntax after certain version before, the original shorthands on your side might be in the old syntax? that is, al:\alpha with only one colon?

if thats the case, could you use the old syntax instead, and add ' :\,;' to the shorthand?

linuswalter commented 1 year ago

Ah, I understand! I switched to the new syntax now and it works perfectly. Thank you @joeyuping :pray: