[gtksourceview/wip/latex: 1/2] latex.lang: math environments



commit 8bc5dd43458337cf1a959eaf7ca58a0e3ce4854d
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Nov 28 18:13:31 2013 +0100

    latex.lang: math environments

 data/language-specs/latex.lang |   54 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 51 insertions(+), 3 deletions(-)
---
diff --git a/data/language-specs/latex.lang b/data/language-specs/latex.lang
index e4845c5..7450ac2 100644
--- a/data/language-specs/latex.lang
+++ b/data/language-specs/latex.lang
@@ -346,11 +346,46 @@
 
     <!-- math -->
 
+    <!-- Commands exclusive to math mode -->
+    <context id="math-command" class="no-spell-check" style-ref="common-commands">
+      <match extended="true">
+        \\(
+          frac | sqrt | sum | (co)?prod | o?int |           #-Functions
+          infty | (c|d|v)dots | nonumber |                  #-special in math mode
+          mathnormal | math(rm|sf|tt|it|bf|cal) |           #-Math font commands
+          (display|text|script(script)?)style |             #-Math size commands
+          alpha | beta | (g|G)amma | (d|D)elta |            #-Greek letters
+          (var)?epsilon | zeta | eta | ((vart)|t|T)heta |   ##
+          iota | kappa | (l|L)ambda | mu | nu | (x|X)i |    ##
+          ((varp)|p|P)i | (var)?rho | ((vars)|s|S)igma |    ##
+          tau | (u|U)psilon | ((varp)|p|P)hi | chi |        ##
+          (p|P)si | (o|O)mega |                             ##
+          pm | mp | times | div | cdot | ast | star |       #-Binary operators
+          dd?agger | amalg | (sq)?c(a|u)p | uplus | vee |   ##
+          wedge | o(plus|minus|times) | (big)?circ |        ##
+          bullet | (d|D)iamond | (un)?(l|r)hd |             ##
+          o(slash|dot) | Box | bigtriangle(up|down) |       ##
+          triangle(left|right) | setminus | wr |            ##
+          gets | to | ((u|U)p(down)? | (d|D)own)arrow |     #-Arrows and pointers
+          ((l|L)eft(right)?|(r|R)ight)arrow | (long)mapsto |##
+          hook(left|right)arrow | (ne|se|sw|nw)arrow |      ##
+          (left|right)harpoon(up|down) | rightleftharpoons |##
+          (l|L)ong(left(right)?|right)arrow |               ##
+          (wide)hat | check | dd?ot | breve | acute |       #-Accents in math mode
+          grave | bar | vec | (wide)tilde | mathring |      ##
+          (over|under)(line|brace) | (i|j)math |            ##i, j  dots removed
+          (arc)?(cosh?|sinh?|tanh?) | arg | coth? | csc |   #-Function names
+          deg | det | dim | exp | gcd | hom | inf | ker |   ##
+          lg | lim(inf|sup)? | ln | log | max | min | Pr |  ##
+          sec | sup                                         ##
+        )(?=\b)
+      </match>
+    </context>
+
     <context id="in-math" class="no-spell-check">
       <include>
-        <context ref="common-commands"/>
-        <context ref="special-char"/>
-        <context ref="generic-command"/>
+        <context ref="math-command"/>
+        <!-- more to come -->
       </include>
     </context>
 
@@ -374,6 +409,18 @@
       </include>
     </context>
 
+    <context id="math-env" style-ref="math" class="no-spell-check">
+      <start>(\\begin)\{(math|displaymath|equation\*?|align\*?|eqnarray\*?)\}</start>
+      <end>(\\end)\{(\%{2 start})\}</end>
+      <include>
+        <context sub-pattern="1" where="start" style-ref="common-commands"/>
+        <context sub-pattern="2" where="start" style-ref="name"/>
+        <context sub-pattern="1" where="end" style-ref="common-commands"/>
+        <context sub-pattern="2" where="end" style-ref="name"/>
+        <context ref="in-math"/>
+      </include>
+    </context>
+
     <context id="inline-math-1" style-ref="inline-math" class="no-spell-check">
       <start>\$</start>
       <end>\$</end>
@@ -398,6 +445,7 @@
       <include>
         <context ref="math-1"/>
         <context ref="math-2"/>
+        <context ref="math-env"/>
         <context ref="inline-math-1"/>
         <context ref="inline-math-2"/>
       </include>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]