From: <md...@us...> - 2008-01-31 15:21:14
|
Revision: 4911 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4911&view=rev Author: mdboom Date: 2008-01-31 07:21:10 -0800 (Thu, 31 Jan 2008) Log Message: ----------- Fix \sqrt with a numeric radical. Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/examples/mathtext_examples.py branches/v0_91_maint/lib/matplotlib/mathtext.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-01-31 15:10:16 UTC (rev 4910) +++ branches/v0_91_maint/CHANGELOG 2008-01-31 15:21:10 UTC (rev 4911) @@ -1,3 +1,6 @@ +2008-01-31 Fix \sqrt with radical number (broken by making [ and ] + work below) - MGD + 2008-01-10 Fix bug displaying [ and ] in mathtext - MGD 2008-01-10 Fix bug when displaying a tick value offset with scientific Modified: branches/v0_91_maint/examples/mathtext_examples.py =================================================================== --- branches/v0_91_maint/examples/mathtext_examples.py 2008-01-31 15:10:16 UTC (rev 4910) +++ branches/v0_91_maint/examples/mathtext_examples.py 2008-01-31 15:21:10 UTC (rev 4911) @@ -40,7 +40,7 @@ r"$f^'$", r'$\frac{x_2888}{y}$', r"$\sqrt[3]{\frac{X_2}{Y}}=5$", - r"$\sqrt[5x\pi]{\prod^\frac{x}{2\pi^2}_\infty}$", + r"$\sqrt[5]{\prod^\frac{x}{2\pi^2}_\infty}$", r"$\sqrt[3]{x}=5$", r'$\frac{X}{\frac{X}{Y}}$', # From UTR #25 @@ -56,7 +56,7 @@ def doall(): tests = stests - + figure(figsize=(8, (len(tests) * 1) + 2)) plot([0, 0], 'r') grid(False) @@ -69,7 +69,7 @@ savefig('mathtext_examples') #close('all') show() - + if '--latex' in sys.argv: fd = open("mathtext_examples.ltx", "w") fd.write("\\documentclass{article}\n") Modified: branches/v0_91_maint/lib/matplotlib/mathtext.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/mathtext.py 2008-01-31 15:10:16 UTC (rev 4910) +++ branches/v0_91_maint/lib/matplotlib/mathtext.py 2008-01-31 15:21:10 UTC (rev 4911) @@ -2109,12 +2109,7 @@ ) + Optional( Suppress(Literal("[")) - + Group( - OneOrMore( - (c_over_c | symbol) - ^ font - ) - ) + + Regex("[0-9]+") + Suppress(Literal("]")), default = None ) @@ -2607,11 +2602,7 @@ if root is None: root = Box(0., 0., 0.) else: - if not isinstance(root, ParseResults): - raise ParseFatalException( - "Can not parse root of radical. " - "Only simple symbols are allowed in the root.") - root = Hlist(root.asList()) + root = Hlist([Char(x, state) for x in root]) root.shrink() root.shrink() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |