2016-11-08 3 views
1

Ich benutze ein Sublime Snippet, um eine Latex State Machine Vorlage zu erstellen. Allerdings tut es nichts (wenn ich "stmach" und drücken Sie die Tab, stmach verschwindet aber der Latex-Code ist nicht enthalten). Ich verstehe nicht warum, denn alle anderen Snippets funktionieren gut.Latex Sublime Snippet

Wenn ich entfernen Sie einige Zeilen in dem Code-Schnipsel, es funktioniert, aber ich brauche den ganzen Block:/

<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> 

Beachten Sie, dass die Latex-Code ohne Fehler oder Warnung funktioniert.

Antwort

2

Das Zeichen $ hat eine besondere Bedeutung in Sublime Text-Snippets und muss deshalb maskiert werden, damit es gültig ist.

Sie können sie mit einem vorangestellten Backslash als documentation shows:

<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> 

die Syntax von https://github.com/sublimehq/Packages/pull/576 Hervorhebung Verwendung macht das Problem klarer, als ST leider keine Rückmeldung bietet, wie Sie haben gesehen: invalid snippet

Wie es aussieht, wenn entkommen: valid snippet

+0

Danke, arbeite wie ein Charme :) – Nakrule