I am using Vim to write my LaTeX files, and figured I'd make a few snippets to help me along. It's been no problem writing simple snippets (like one for begin
, one for figure
etc.), but then when I tried making one to set the title (with a default value including some curly brackets ({
and }
), I have this problem. The goal of my snippet is that it creates the following text:
\title{My name\\\texttt{[email protected]}}
I want all the text inside the outmost curly brackets (the ones belonging to title
) to be a placeholder. I try to accomplish this by writing the snippet as follows:
\title{${1:My name\\\texttt{[email protected]}}}${2}
My problem, however, is that snipMate seems to use only the name and the email (omitting the closing bracket for the texttt
command) as a placeholder.
SnipMate has some known problems with these things, the parsing for nested
braces just doesn't work. Maybe someone knows how to do this, but in the
meantime I suggest you creating two snippets, one for \title
and another for
\texttt
— just to simplify things a bit.
snippet \ti
\title{${1:My name}}
snippet \te
\texttt{${1:[email protected]}}