<?xml version="1.0"?>
<!DOCTYPE hrc PUBLIC "-//Cail Lomecb//DTD Colorer HRC take5//EN"
  "http://colorer.sf.net/2003/hrc.dtd">
<hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd">
   <type name="TeX">

      <annotation><documentation>
        TeX definitions
      </documentation>
      <contributors><![CDATA[
        Vasiliy Bublik <bublik@itam.nsc.ru>
        Sergei Remizov <remizov@mail.cplire.ru>
        Mike Golub     <golub@aha.ru>
        Sergiy Zuban <sezal@ukr.net>
      ]]></contributors>
      </annotation>

      <import type="def"/>

      <region name="Formula" parent="Insertion"/>
      <region name="Comment" parent="Comment"/>
      <region name="Symb" parent="Symbol"/>
      <region name="Word" parent="Keyword"/>
      <region name="Numb" parent="Number"/>
      <region name="Bracket"/>
      <region name="LargeBracket" parent="Label"/>


      <scheme name="Symbols">
         <keywords region="Symb">
            <symb name="\"/>
            <symb name="#"/>
            <symb name="$"/>
            <symb name="&amp;"/>
            <symb name="{"/>
            <symb name="}"/>
            <symb name="_"/>
            <symb name="^"/>
            <symb name="~"/>
         </keywords>
      </scheme>

      <scheme name="eqn">
<!-- cail: nothing difficult :)) -->
         <block start="/(\\(begin)\s*\{((math))\})/" end="/(\\(end)\s*\{((math))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((displaymath))\})/" end="/(\\(end)\s*\{((displaymath))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((equation))\})/" end="/(\\(end)\s*\{((equation))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((equation\*))\})/" end="/(\\(end)\s*\{((equation\*))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((gather))\})/" end="/(\\(end)\s*\{((gather))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((gather\*))\})/" end="/(\\(end)\s*\{((gather\*))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((multline))\})/" end="/(\\(end)\s*\{((multline))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((multline\*))\})/" end="/(\\(end)\s*\{((multline\*))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((align))\})/" end="/(\\(end)\s*\{((align))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((align\*))\})/" end="/(\\(end)\s*\{((align\*))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((flalign))\})/" end="/(\\(end)\s*\{((flalign))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((flalign\*))\})/" end="/(\\(end)\s*\{((flalign\*))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((alignat))\})/" end="/(\\(end)\s*\{((alignat))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((alignat\*))\})/" end="/(\\(end)\s*\{((alignat\*))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((eqnarray))\})/" end="/(\\(end)\s*\{((eqnarray))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/(\\(begin)\s*\{((eqnarray\*))\})/" end="/(\\(end)\s*\{((eqnarray\*))\})/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region02="Word" region03="Bracket" region11="Symb" region12="Word" region13="Bracket"/>
         <block start="/\\\[/" end="/\\\]/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd"/>
         <block start="/\\\(/" end="/\\\)/x" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd"/>
      </scheme>

      <scheme name="quoters">
<!-- TeX commands -->
         <regexp match="/(\\)([A-Za-z@]+)/" region1="Symb" region2="Word" priority="low"/>
<!-- \% is not a comment! \$ is not a math shift! -->
         <regexp match="/(\\\$)/" region="Symb"/>
         <regexp match="/(\\\%)/" region="Symb"/>
<!-- comment -->
         <regexp match="/(\%.*$)/" region="Comment"/>
<!-- numbers -->
         <regexp match="/(\-?\d*\.?\d+)/" region="Numb"/>
      </scheme>

      <scheme name="Formula">
         <inherit scheme="eqn"/>
         <block start="/\\left[\s]*              ((\\\{)|(\\lfloor)|(\\\})|(\\rfloor)|(\\lceil)|(\\rceil)               |(\\langle)|(\\rangle)|(\\backslash)|(\\\|)               |(\\uparrow)|(\\downarrow)|(\\updownarrow)               |(\\Uparrow)|(\\Downarrow)|(\\Updownarrow)               |[\.\(\[\/\|\)\]]{0,1})/x" end="/\\right[\s]*            ((\\\{)|(\\lfloor)|(\\\})|(\\rfloor)|(\\lceil)|(\\rceil)             |(\\langle)|(\\rangle)|(\\backslash)|(\\\|)             |(\\uparrow)|(\\downarrow)|(\\updownarrow)             |(\\Uparrow)|(\\Downarrow)|(\\Updownarrow)             |[\.\(\[\/\|\)\]]{0,1})/x" scheme="Formula" region="LargeBracket" region00="PairStart" region10="PairEnd"/>
         <inherit scheme="quoters"/>
         <inherit scheme="Symbols"/>
      </scheme>

      <scheme name="TeX">
         <inherit scheme="eqn"/>

         <regexp match="/(\\)(verb\*?)([^\sa-zA-Z])(.*?)(\3)/" region1="Symb" 
                 region2="Word" region3="Symb" region4="BooleanConstant" region5="Symb"/>  
         <regexp match="/\M\\(?{Function}(label|(sub){0,2}section|(sub)?paragraph|appendix|part|chapter).*)/x"/>

         <block  start="/\\begin\{comment\}/" end="/\\end\{comment\}/" scheme="Comment"
                 region="Comment" region00="PairStart" region10="PairEnd"/>
         
         <block start="/((\\(begin)\s*\{(lstlisting)\})).*?(\{.*\})/" end="/(\\(end)\s*\{(lstlisting)\})/x"
                scheme="empty" region="BooleanConstant"
                region01="PairStart" region10="PairEnd"
                region02="Word" region03="Word" region04="Label" 
                region05="Text"
                region11="Word" region12="Word" region13="Label"/>

         <block start="/(\\begin\s*\{)([\w]+)(\})/" end="/(\\end\s*\{)(\y2)(\})/x" scheme="TeX" region="Bracket" region00="PairStart" region10="PairEnd" region01="Word" region11="Word" region02="LargeBracket" region12="LargeBracket" region03="Word" region13="Word"/>
         <inherit scheme="quoters"/>
         <block start="/(\$\$)/" end="/(\$\$)/" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region11="Symb"/>
         <block start="/(\$)/" end="/(\$)/" scheme="Formula" region="Formula" region00="PairStart" region10="PairEnd" region01="Symb" region11="Symb"/>
         <block start="/(\\\\\[)/" end="/(\])/x" scheme="TeX" region="Bracket" region00="PairStart" region10="PairEnd" region01="Symb" region11="Symb"/>
         <block start="/(\{)/" end="/(\})/" scheme="TeX" region="Bracket" region00="PairStart" region10="PairEnd" region01="Symb" region11="Symb"/>
         <block start="/(\[)/" end="/(\])/" scheme="TeX" region="Bracket" region00="PairStart" region10="PairEnd" region01="Symb" region11="Symb"/>
         <inherit scheme="Symbols"/>
      </scheme>

   </type>
</hrc>
