[英]Vim snipMate LaTeX template
I am using Vim to write my LaTeX files, and figured I'd make a few snippets to help me along. 我正在使用Vim编写LaTeX文件,并认为我会做一些摘要来帮助我。 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: 编写简单的代码片段(例如一个用于
begin
,一个用于figure
等)没问题,但是然后当我尝试设置一个代码片段(默认值包括一些大括号( {
和}
)时,我遇到了这个问题我的代码段的目标是创建以下文本:
\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. 我希望最外面的大括号(属于
title
)内的所有文本都占位。 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似乎仅使用名称和电子邮件(忽略
texttt
命令的右括号)作为占位符。
SnipMate has some known problems with these things, the parsing for nested braces just doesn't work. SnipMate在这些方面有一些已知的问题,嵌套括号的解析只是行不通。 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. 也许有人知道如何执行此操作,但与此同时,我建议您创建两个代码段,一个用于
\\title
,另一个用于\\texttt
只是为了简化一点。
snippet \ti
\title{${1:My name}}
snippet \te
\texttt{${1:me@email.com}}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.