I have created my snippets in texmath.snippets as:

priority -50 

snippet \d "dot" Aw

snippet ^^ "superscript" A

snippet __ "subscript" A 

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


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

snippet __ "subscript" Ai

Your Answer

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

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