문제

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{me@email.com}}

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{me@email.com}}}${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:me@email.com}}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top