Revision: 3615
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3615&view=rev
Author:   mdboom
Date:     2007-07-26 06:26:26 -0700 (Thu, 26 Jul 2007)

Log Message:
-----------
Important bugfix (many expressions were silently failing)

Modified Paths:
--------------
    branches/mathtext_mgd/examples/mathtext_examples.py
    branches/mathtext_mgd/lib/matplotlib/_mathtext_data.py
    branches/mathtext_mgd/lib/matplotlib/mathtext.py

Modified: branches/mathtext_mgd/examples/mathtext_examples.py
===================================================================
--- branches/mathtext_mgd/examples/mathtext_examples.py 2007-07-25 20:19:25 UTC 
(rev 3614)
+++ branches/mathtext_mgd/examples/mathtext_examples.py 2007-07-26 13:26:26 UTC 
(rev 3615)
@@ -52,7 +52,7 @@
     os.system("pdflatex mathtext_examples.ltx")
 else:
     for i, s in enumerate(stests):
-        print s
+        print "%02d: %s" % (i, s)
         plot([1,2,3], 'r')
         x = arange(0.0, 3.0, 0.1)
 

Modified: branches/mathtext_mgd/lib/matplotlib/_mathtext_data.py
===================================================================
--- branches/mathtext_mgd/lib/matplotlib/_mathtext_data.py      2007-07-25 
20:19:25 UTC (rev 3614)
+++ branches/mathtext_mgd/lib/matplotlib/_mathtext_data.py      2007-07-26 
13:26:26 UTC (rev 3615)
@@ -38,8 +38,10 @@
     r'\SQRT'                : ('cmex10',  53),
     r'\leftbrace'           : ('cmex10',  92),
     r'{'                    : ('cmex10',  92),
+    r'\{'                   : ('cmex10',  92),
     r'\rightbrace'          : ('cmex10', 130),
     r'}'                    : ('cmex10', 130),
+    r'\}'                   : ('cmex10', 130),
     r'\leftangle'           : ('cmex10',  97),
     r'\rightangle'          : ('cmex10',  64),
     r'\Leftparen'           : ('cmex10', 112),

Modified: branches/mathtext_mgd/lib/matplotlib/mathtext.py
===================================================================
--- branches/mathtext_mgd/lib/matplotlib/mathtext.py    2007-07-25 20:19:25 UTC 
(rev 3614)
+++ branches/mathtext_mgd/lib/matplotlib/mathtext.py    2007-07-26 13:26:26 UTC 
(rev 3615)
@@ -59,17 +59,10 @@
            ^
         use raw strings
 
-  The $ symbols must be the first and last symbols in the string.  Eg,
-  you cannot do
+  Math and non-math can be interpresed in the same string.  E.g.,
 
     r'My label $x_i$'.
 
-  but you can change fonts, as in
-
-    r'$\rm{My label} x_i$'
-
-  to achieve the same effect.
-
   A large set of the TeX symbols are provided.  Subscripting and
   superscripting are supported, as well as the over/under style of
   subscripting with \sum, \int, etc.
@@ -1714,7 +1707,7 @@
 
     _spaced_symbols = _binary_operators | _relation_symbols | _arrow_symbols
 
-    _punctuation_symbols = Set(r', ; . !'.split())
+    _punctuation_symbols = Set(r', ; . ! \ldotp \cdotp'.split())
     
     def __init__(self):
         # All forward declarations are here
@@ -1769,15 +1762,14 @@
 
         symbol       = Regex("(" + ")|(".join(
                        [
-                         r"\\(?!right)(?!left)[a-zA-Z0-9]+(?!{)",
+                         r"\\(?!left[^a-z])(?!right[^a-z])[a-zA-Z0-9]+(?!{)",
                          r"[a-zA-Z0-9 ]",
                          r"[+\-*/]",
                          r"[<>=]",
                          r"[:,.;!]",
                          r"[EMAIL PROTECTED]&]",
                          r"[[\]()]",
-                         r"\\\$",
-                         r"\\\%"
+                         r"\\[$%{}]",
                        ])
                      + ")"
                      ).setParseAction(self.symbol).leaveWhitespace()
@@ -1828,7 +1820,7 @@
                      )   
 
         subsuper    << Group(
-                         ( placeable
+                         ( Optional(placeable)
                          + OneOrMore(
                              subsuperop
                            + placeable
@@ -1837,7 +1829,9 @@
                        | placeable
                      )
 
-        ambiDelim    = oneOf(r"| \| / \backslash \uparrow \downarrow 
\updownarrow \Uparrow \Downarrow \Updownarrow")
+        ambiDelim    = oneOf(r"""| \| / \backslash \uparrow \downarrow
+                                 \updownarrow \Uparrow \Downarrow
+                                 \Updownarrow""")
         leftDelim    = oneOf(r"( [ { \lfloor \langle \lceil")
         rightDelim   = oneOf(r") ] } \rfloot \rangle \rceil")
 
@@ -1861,9 +1855,9 @@
         non_math     = Regex(r"(?:[^$]|(?:\\\$))*"
                      
).setParseAction(self.non_math).setName("non_math").leaveWhitespace()
 
-        self._expression  <<(
+        self._expression <<(
                          non_math
-                       + ZeroOrMore(
+                       + OneOrMore(
                            Suppress(math_delim)
                          + math
                          + Suppress(math_delim)
@@ -1908,6 +1902,7 @@
         return [self._expr]
         
     def math(self, s, loc, toks):
+        #~ print "math", toks
         hlist = Hlist(toks)
         self.pop_state()
         return [hlist]
@@ -2164,6 +2159,7 @@
         return [hlist]
 
     def auto_sized_delimiter(self, s, loc, toks):
+        #~ print "auto_sized_delimiter", toks
         front, middle, back = toks
         state = self.get_state()
         height = max([x.height for x in middle])


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to