You're right.  It's a bug.  The parser (when it was re-written) was 
changed to not accept '[' as a literal symbol, since it is meaningful in 
certain situations.  This turned out to be overly cautious.  This is 
fixed in svn r4854.

Manuel Metz wrote:
> Michael Droettboom wrote:
>> You need to escape the [:
>>
>>    mpl_pp.xlabel(r"$\[$")
>>
>> [] and {} have special meanings in math syntax, so to use them 
>> "literally", they need to be escaped.
> 
> Really? Note that Matthias had text.usetex=False.
> I tried various configurations:
> 
> text.usetex=True
> 
>   xlabel( "$[$")     okay
>   xlabel(r"$\[$")    okay
>   xlabel( "$\[$")    no error, but also no label displayed

I'm surprised by this.  Those last two strings should be identical. 
Maybe Python 2.5 works differently from whatever you're running.

> text.usetex=False
> 
>   xlabel("$[$")      failed with
>       Expected end of text (at char 0), (line:1, col:1)
> 
>   xlabel(r"$\[$")
>   xlabel( "$\[$")    no error, but displays a star symbol
> 
> In the last two cases I got a warning
> 
> mathtext.py:722: MathTextWarning: Unrecognized symbol '\['. Substituting 
> with a dummy symbol.
>   % sym.encode('ascii', 'backslashreplace'), MathTextWarning)

Cheers,
Mike

>> Matthias Michler wrote:
>>> Hello list,
>>>
>>> the little example below leads to an error on my system (output is 
>>> attached).
>>> I used this some time ago and it worked. Now I'm using the release 
>>> 0.91.2.
>>> Is there a reason to use rectangular brackets not in mathtext?
>>> (same problem occur with '{' for me.)
>>>
>>> best regards and thanks in advance for any help,
>>> Matthias
>>> -------------------------------------------------------------------------------------------------
>>>  
>>>
>>> import matplotlib.pyplot as mpl_pp
>>> mpl_pp.axes()
>>> mpl_pp.xlabel("$[$")
>>> mpl_pp.show()
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> ------------------------------------------------------------------------- 
>>>
>>> Check out the new SourceForge.net Marketplace.
>>> It's the best place to buy or sell services for
>>> just about anything Open Source.
>>> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
>>>  
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
> 
> 

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to