Vim snipMate LaTeX 模板

发布于 2024-12-08 00:36:34 字数 728 浏览 0 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

做个ˇ局外人 2024-12-15 00:36:34

SnipMate 在这些方面有一些已知的问题,嵌套的解析
大括号根本不起作用。也许有人知道如何做到这一点,但在
同时,我建议您创建两个片段,一个用于 \title,另一个用于
\texttt — 只是为了稍微简化一下。

snippet \ti
        \title{${1:My name}}

snippet \te
        \texttt{${1:[email protected]}}

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]}}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文