[英]Is conditional math mode tab autocompletion possible in Sublime Text 3?
I'd like to define, say, a snippet that will 我想定义一个片段,例如
$$
to create a math mode expression if completion occurs outside of math mode, and 如果自动完成功能发生在数学模式之外,则使用$$
选项卡自动完成以创建数学模式表达式,并且 $$
if completion occurs within math mode. 如果在数学模式下发生自动完成,则没有 $$
自动完成。 For example, I'd like to define a completion for bb
such that 例如,我想为bb
定义一个bb
1) bb
expands to $\\mathbb{ }$
1) bb
扩展为$\\mathbb{ }$
2) $bb$
expands to $\\mathbb{ }$
and not $$\\mathbb{ }$$
. 2) $bb$
扩展为$\\mathbb{ }$
而不是 $$\\mathbb{ }$$
。
Is this possible? 这可能吗?
Create two files in your Packages/User
directory (select Preferences > Browse Packages...
and open the User folder) 在Packages/User
目录中创建两个文件(选择Preferences > Browse Packages...
并打开User文件夹)
LaTeX.sublime-completions
with the content: LaTeX.sublime-completions
的内容:
{
"scope": "text.tex.latex - meta.environment.math",
"completions": [
{ "trigger": "bb\t\\\\mathbb{...}", "contents": "\\$\\\\mathbb{$1}\\$$0"},
{ "trigger": "bf\t\\\\mathbf{...}", "contents": "\\$\\\\mathbf{$1}\\$$0"}
]
}
LaTeX math.sublime-completions
with the content: LaTeX math.sublime-completions
的内容:
{
"scope": "text.tex.latex meta.environment.math",
"completions": [
{ "trigger": "bb\t\\\\mathbb{...}", "contents": "\\\\mathbb{$1}$0"},
{ "trigger": "bf\t\\\\mathbf{...}", "contents": "\\\\mathbf{$1}$0"}
]
}
Now you can add other commands in a similar style. 现在,您可以添加其他类似样式的命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.