LaTeX-auto-activating-snippets icon indicating copy to clipboard operation
LaTeX-auto-activating-snippets copied to clipboard

Maximum two characters in exponent auto curly wrap

Open Exr0n opened this issue 3 years ago • 2 comments

Expected Behavior

  • a^123 -> a^{123
  • a^123 -> a^{123}
  • a^-33x -> a^{-33x}

Should the power include non-numeric characters (ex. variable names, ;)? That runs the risk of consuming too much, but I vote that the exponent should be considered incomplete until a whitespace character is typed.

Current Behavior

  • a^123 -> a^{12}3
  • a^123 -> a^{12}3
  • a^-33x -> a^{-3}3x

(tested in org-mode)

Exr0n avatar Mar 08 '21 03:03 Exr0n

Just tested, cannot reproduce, and I don't see a snipped here for ^.

tecosaur avatar Mar 08 '21 03:03 tecosaur

Should the power include non-numeric characters (ex. variable names, ;)? That runs the risk of consuming too much, but I vote that the exponent should be considered incomplete until a whitespace character is typed.

Theortically I'm OK with having a variable to switch between these two behaviors. However, I don't think we can add the general-case of a^{12}X => a^{12X} without binding a snippet for each and every letter x, with a condition would check for sub/superscripts on each keypress. The easier way to do it is with another post-self-insert-hook, but that's beyond the bounds of aas and laas.

...Meanwhile I'm fine with expanding the 1-9 and ii/jj snippets to check script bounds more thoroughly, and would accept a PR.

Just tested, cannot reproduce, and I don't see a snipped here for ^. laas-subscript-snippets is the snippet list in question.

ymarco avatar Mar 08 '21 07:03 ymarco

Closing because of staleness, I'd still accept a PR for a_{12}3a_{123}

ymarco avatar Sep 30 '22 02:09 ymarco