我正在將 Sublime Text3 與 Latex 一起使用,並且我搜尋以了解是否可以在編譯期間自動替換 Latex 的常規''mytext""
引用\enquote{}
這看起來很愚蠢,但是,a)如果我想顯示法語引號,而不是英語引號“”,我需要使用 csquote。 b)如果我使用 csquote 我需要寫\enquote{}
,因此,我失去了漂亮的突出顯示對於這個特定的語法''mytext""
所以我想在法語模式下保留 csquotes 包的漂亮亮點,你認為這可能嗎?
答案1
如果你查看一下,Preferences > Package Settings > LaTeXing > Keybindings - Default
你會發現這個鍵綁定:
{
"keys": ["\""],
"command": "insert_snippet", "args": {"contents": "``$0''"},
"context": [
{"key": "eol_selector", "match_all": true, "operand": "comment.line.percentage", "operator": "not_equal"},
{"key": "selection_empty", "match_all": true, "operand": true, "operator": "equal"},
{"key": "selector", "operand": "text.tex.latex", "operator": "equal"},
{"key": "selector", "operand": "source.r", "operator": "not_equal"},
{"key": "selector", "operand": "meta.block.parameters.knitr", "operator": "not_equal"},
{"key": "selector", "operand": "meta.block.parameters.knitr", "operator": "not_equal"},
{"key": "setting.auto_match_enabled", "operand": true, "operator": "equal"}
]
},
這是負責自動完成的人。
如果您輸入以下內容
{
"keys": ["\""],
"command": "insert_snippet", "args": {"contents": "\\enquote{$0}"},
"context": [
{"key": "eol_selector", "match_all": true, "operand": "comment.line.percentage", "operator": "not_equal"},
{"key": "selection_empty", "match_all": true, "operand": true, "operator": "equal"},
{"key": "selector", "operand": "text.tex.latex", "operator": "equal"},
{"key": "selector", "operand": "source.r", "operator": "not_equal"},
{"key": "selector", "operand": "meta.block.parameters.knitr", "operator": "not_equal"},
{"key": "selector", "operand": "meta.block.parameters.knitr", "operator": "not_equal"},
{"key": "setting.auto_match_enabled", "operand": true, "operator": "equal"}
]
},
在您的使用者鍵綁定(來自首選項)中,您可以獲得您所要求的內容。
至於語法高亮,可以做到,但是需要修改.tmLanguage
LaTeXing的文件,這比較複雜,並且可能會隨著套件的更新而中斷。這個想法是將string
範圍分配給 的參數\enquote
。