title: AvalonEdit XSHD-Ruleset (for tex)
body: <p>I'm using the AvalonEdit control in and I have a small problem with the xshd-ruleset (for tex):</p>
  
  <p>There is a section in the original file 'syntaxdefinition for TeX document 2001 by Mike Krueger (gleaned from Jedit)' about special keywords and I'm wondering how to use them right.</p>
  
  <pre><code>  &lt;!-- some commands must be handled specially --&gt;
    &lt;KeyWords name = "Keyword1" bold = "false" italic = "false" color = "Blue"&gt;
      &lt;Key word = "\$" /&gt;
      &lt;Key word = "\\" /&gt;
      &lt;Key word = "\%" /&gt;
    &lt;/KeyWords&gt;
  </code></pre>
  
  <p>I though that keywords will be colored blue and are handled only by this, but other rules are handling parts these keywords, too. e.g.</p>
  
  <pre><code>  &lt;Span name = "LineComment" color = "SlateGray" stopateol = "true"&gt;
      &lt;Begin&gt;%&lt;/Begin&gt;
    &lt;/Span&gt;
  </code></pre>
  
  <p>So if you have "\%" in your text everything beyond the '\' will be colored gray...</p>
  
  <p>It would be very nice, if that keywords forbid the rules e.g. for '$' and '%' if there is a '\' before. </p>
  
  <p>What I have to do? Or didn't I understand the rulesets...</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>"\\" is handled by the keyword1 entry. The &lt; MarkFollowing ... is not used for "\\" but the &lt; Span ... are still doing its highlighting for "\$" and "\%".</p>
  
  <p>I found</p>
  
  <pre><code>  escapecharacter="\"
  </code></pre>
  
  <p>but it's not working.</p>
  
  <p><strong>EDIT2</strong>:</p>
  
  <p>With the new syntax highlighting definition the problem is the same I think. I compared my tex highlighting with the c# highlighting. In c# we have:</p>
  
  <pre><code>&lt;Span color="String"&gt;
      &lt;Begin&gt;"&lt;/Begin&gt;
      &lt;End&gt;"&lt;/End&gt;
      &lt;RuleSet&gt;
           &lt;!-- span for escape sequences --&gt;
           &lt;Span begin="\\" end="."/&gt;
      &lt;/RuleSet&gt;
  &lt;/Span&gt;
  </code></pre>
  
  <p>I don't use sharpdevelop, but I think it's working, that the highlighting doesn't fail, if I'm escaping characters like ". So in my file it's similar to that, like</p>
  
  <pre><code>&lt;Span foreground="#FF708090" fontWeight="normal" fontStyle="italic"&gt;
      &lt;Begin&gt;%&lt;/Begin&gt;
      &lt;RuleSet&gt;
          &lt;Span begin="\\" end="." /&gt;
      &lt;/RuleSet&gt;
  &lt;/Span&gt;
  </code></pre>
  
  <p>but it's not working... Maybe there is a problem, because the escape-character is a &lt; Rule > ?</p>