|
From: Michael D. <md...@st...> - 2008-12-12 12:43:10
|
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
|