Sublime Forum

Expand snippets that are inputs to snippets troubles

#1

Hello,
I’m trying to do something that should be easy but is giving me problems. In LaTeX, fractions are entered as $\frac{numerator}{denominator}$. Often these fractions will contain other fractions (complex fractions) or other complicated expressions (various roots, derivative symbols, integral symbols, etc…). For example, you might have something like:

\frac{ \frac{a}{b} + c }{ d - \frac{e}{f} }

I tried creating a snippet (which I named “frac.sublime-snippet” and put in the User/LaTeX subdirectory of the snippets directory) for this LaTeX command that looks like this:

\fr text.tex.latex

When I try to create the structure in my example above, the first expansion works fine and I get \frac{|}{}, with the cursor in the first pair of {}, but if I enter “fr” and hit tab again, I get \frac{fr}{|} with the cursor in the second pair of {} and the frac command unexpanded in the first pair of {}.

How do I fix my snippet to get the behavior I expect? It seems like this should be a simple thing to do.

Thanks much,
Gary

0 Likes