joeyuping / quick_latex_obsidian

MIT License
327 stars 21 forks source link

Add optional ordered tabs #117

Closed pokir closed 8 months ago

pokir commented 8 months ago

I found that it was impossible to create custom shorthands that can tab in any order, so I added a way to define the order to go through the #tabs.

For example: \left#cursor #tab \right#tab would always tab to the middle instead of the second tab, which is annoying and does not make sense for this custom shorthand.

To fix this, I added a way to optionally define the order of the tabs like this: \left#cursor #tab2 \right#tab1 This will first tab to #tab1 and then to #tab2.

Other example: \binom{#tab45}{#cursor}#tab12#tab999 would go to #cursor, then to #tab12, then to #tab45, and finally to #tab999 (the numbers are chosen in increasing order).

The normal #tabs still work for backwards compatibility, the only difference being that they are now searched from the start of the current line instead of after the cursor's position (which shouldn't be a problem since all previous custom shorthands had to have the #tabs after the #cursor.

The description for the custom shorthand parameters in the settings was also updated to explain this addition.

joeyuping commented 8 months ago

@pokir Thank you so much!!! That's a really great addition! Will publish this merge in the immediate version update.