4

I have created my snippets in texmath.snippets as:

priority -50 

snippet \d "dot" Aw
\dot{$1}
endsnippet

snippet ^^ "superscript" A
^{$1}
endsnippet

snippet __ "subscript" A 
_{$1}
endsnippet

The problem is, ^^ and __ works only when preceeded by a space, like w options in Ultisnips. But, as you can see, there is no w, so this should not be in word limit.

But, still, in latex, $H__$ doesn't expands to $H_{}$, while $H __$ does properly.

What I am doing wrong here?

I am using Ultisnips as snippet engine. This texmath.snippets structure is following honza/snippets

1 Answer 1

5

You have to use the i option. This is in the help page:

   i   In-word expansion - By default a snippet is expanded only if the tab
       trigger is the first word on the line or is preceded by one or more
       whitespace characters. A snippet with this option is expanded
       regardless of the preceding character. In other words, the snippet can
       be triggered in the middle of a word.

So it should look like that in the end:

snippet ^^ "superscript" Ai
^{$1}
endsnippet

snippet __ "subscript" Ai
_{$1}
endsnippet

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.