簡體   English   中英

乳膠崇高片段

[英]Latex Sublime snippet

我正在使用Sublime片段來創建Latex狀態機模板。 但是,它什么也不做(當我鍵入“ stmach”並按tab時, stmach消失,但不包含Latex代碼)。 我不明白為什么,因為我所有其他代碼段都運行正常。

如果我刪除了代碼段中的某些行,就可以了,但是我需要整個代碼塊:/

<snippet>
<content><![CDATA[
    \begin{center}
        \begin{tikzpicture}[shorten >=1pt,node distance=4.5cm,on grid,auto]

        \tikzstyle{every state}=[draw=blue!50,very thick,fill=blue!20] % Node color

        \node[state,initial,initial text=reset, initial where=below] (configuration) {$conf$}; % Node name and position
        \node[state] (init) [below right=of configuration] {$init$};

        \path[->] % Arrow
        (configuration)
            edge  [bend left]                 node {finishConfiguration=1} (init)

        (init)
            edge  [bend left]                 node {} (configuration);

        \end{tikzpicture}
    \end{center}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>stmach</tabTrigger> 
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.tex</scope>

請注意,Latex代碼可以正常運行,而不會出現任何錯誤或警告。

$字符在Sublime Text片段中具有特殊含義,因此需要轉義以使其有效。

您可以使用前面的反斜杠將其轉義,如文檔所示

<snippet>
<content><![CDATA[
    \begin{center}
        \begin{tikzpicture}[shorten >=1pt,node distance=4.5cm,on grid,auto]

        \tikzstyle{every state}=[draw=blue!50,very thick,fill=blue!20] % Node color

        \node[state,initial,initial text=reset, initial where=below] (configuration) {\$conf\$}; % Node name and position
        \node[state] (init) [below right=of configuration] {\$init\$};

        \path[->] % Arrow
        (configuration)
            edge  [bend left]                 node {finishConfiguration=1} (init)

        (init)
            edge  [bend left]                 node {} (configuration);

        \end{tikzpicture}
    \end{center}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>stmach</tabTrigger> 
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.tex</scope>
</snippet>

使用https://github.com/sublimehq/Packages/pull/576中突出顯示的語法可以使問題更加清楚,因為不幸的是,ST並未提供任何反饋,如您所見: 無效的代碼段

轉義后的外觀: 有效片段

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM