Латекс возвышенный фрагмент

Я использую фрагмент Sublime для создания шаблона конечного автомата Latex. Однако он ничего не делает (когда я набираю «stmach» и нажимаю вкладку, 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>

Note that the Latex code works without any error or warning.


person Nakrule    schedule 08.11.2016    source источник


Ответы (1)


Символ $ имеет особое значение во фрагментах 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, к сожалению, не предлагает никакой обратной связи, как вы видели: неверный фрагмент

Как это выглядит после экранирования: допустимый фрагмент

person Keith Hall    schedule 08.11.2016