Ch'*_*eng 5 keyboard-shortcuts sublimetext
我刚刚创建了XeLaTeX
一个以XeLaTeX.sublime-build
在User
Sublime Text目录中创建的文件命名的构建系统,其内容为:
{
"cmd": ["xelatex.exe","-synctex=1","-interaction=nonstopmode","$file_base_name"]
}
Run Code Online (Sandbox Code Playgroud)
如果我想将我的F1密钥绑定到这个特定的构建系统,我该怎么办?
注意:Ctrl + B不应影响默认的构建系统.也就是说,我可以使用Ctrl + B默认值,而F1新系统也可以同时使用.
也许有另一种方法来实现这一目标.添加以下文本Default(Windows).sublime-keymap
将执行命令:
{"keys": ["f1"], "command": "exec", "args": {"cmd": ["xelatex.exe","-synctex=1","-interaction=nonstopmode","$file_base_name"]}},
Run Code Online (Sandbox Code Playgroud)
但是,$file_base_name
这里没有定义.有没有方法可以将当前文件(base_)名称传递给exec
?
我自己钉了它。
AFAIK,没有这样的方法可以通过键绑定传递当前文件名,并且不可能使用键绑定来指定某个构建系统。因此,编写Python脚本是很有必要的。
只有三个步骤。
1.将以下内容保存到/Data/Package/User/compile_with_xelatex.py
:
import sublime, sublime_plugin
class CompileWithXelatexCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.window().run_command('exec', {'cmd': ["xelatex.exe","-synctex=1","-interaction=nonstopmode", self.view.file_name()[:-4]]})
Run Code Online (Sandbox Code Playgroud)
2.添加一行/Data/Packages/User/Default(<your-plat>).sublime-keymap
{"keys": ["f1"], "command": "compile_with_xelatex"},
Run Code Online (Sandbox Code Playgroud)
3.使用 Sublime Text 打开 LaTeX 源文件,然后按F1使用 XeLaTeX 进行编译。
确实,这有点棘手,但对我来说就像一个魅力。
归档时间: |
|
查看次数: |
4483 次 |
最近记录: |