Vim snipMate LaTeX 模板
我正在使用 Vim 编写 LaTeX 文件,并想制作一些片段来帮助我完成任务。编写简单的代码片段(例如用于 begin
的代码片段,用于 figure
等)是没有问题的,但是当我尝试制作一个代码片段来设置标题时(使用默认值)包括一些大括号({
和}
),我有这个问题我的代码片段的目标是它创建以下文本:
\title{My name\\\texttt{[email protected]}}
我希望所有文本都在最外面。大括号(属于title
)作为占位符,我尝试通过编写如下代码片段来实现此目的:
\title{${1:My name\\\texttt{[email protected]}}}${2}
但是,我的问题是 snipMate 似乎仅使用名称和电子邮件(省略了右括号)。 texttt
命令)作为占位符。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SnipMate 在这些方面有一些已知的问题,嵌套的解析
大括号根本不起作用。也许有人知道如何做到这一点,但在
同时,我建议您创建两个片段,一个用于
\title
,另一个用于\texttt
— 只是为了稍微简化一下。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.