There was a discussion on this list around a year ago about this. The
concern was that not rendering $ as $ would break (matplotlib) backward
compatibility with scripts that don't care about math at all but use a
lot of dollar signs (e.g. financial plots). This is one of the few
places where we deliberately broke usetex compatibility in favour of
matplotlib compatibility.
That said, it's probably a bug that the escaped dollar sign in non-math
context is not rendered as a dollar sign.
As a workaround "$\$%1.2f$" works with usetex on or off, with the
proviso that it uses math- rather than text-rendering for the numbers.
Mike
Manuel Metz wrote:
> I just noted that mathtext and LaTeX rendering behave differently
> when using a single "$" character in a text string. This happened to
> me when looking at the dollar_ticks example from the docs because I
> use LaTeX rendering by default. The problem is here:
>
> formatter = ticker.FormatStrFormatter('$%1.2f')
>
> MathText interprets this as a single "$" character, whereas LaTeX
> interprets this as starting character of a math expression (and I get
> an error), i.e. I have to write "\$1.2f" instead, which then, however,
> is interpreted by MathText as "\$" ... :-(
>
> Shouldn't these two behave equally here?
>
> mm
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel