SourceForge logo
SourceForge logo
Menu

matplotlib-devel

From: Manuel M. <mm...@as...> - 2008年12月12日 09:52:27
 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
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
From: Manuel M. <mm...@as...> - 2008年12月12日 14:09:08
Michael Droettboom wrote:
> 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
In that case I suggest to note this somewhere in the docs (and User
Guide) with three exclamation marks (or is it ???).
Manuel
> 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
From: Michael D. <md...@st...> - 2008年12月12日 14:46:08
Manuel Metz wrote:
> Michael Droettboom wrote:
> 
>> 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
>> 
>
> In that case I suggest to note this somewhere in the docs (and User
> Guide) with three exclamation marks (or is it ???).
> 
So there's really two sub-bugs here:
1) '\8ドル' gives '\8ドル' in mathtext (well, actually it gets sent verbatim 
to the non-math text renderer, which is a bug). This, IMHO, is a 
"must-fix".
2) '8ドル' gives '8ドル' in mathtext and an error in usetex. This could be 
solved in two ways:
a) document the difference
b) make '8ドル' give '8ドル' in usetex as well
I realise b) is technically making usetex accept a string that is not 
normally valid TeX -- but it's not like a user would ever enter '8ドル' and 
*want* to get a TeX error back. And usetex strings aren't perfectly TeX 
anyway.
Personally, I'm leaning toward b), because it requires less mental 
effort for the user turning usetex on/off. And it doesn't force us to 
backtrack on the idea of supporting "100ドル.00" easily.
But before I commit -- any feedback?
Mike
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Manuel M. <mm...@as...> - 2008年12月12日 14:56:45
Michael Droettboom wrote:
> Manuel Metz wrote:
>> Michael Droettboom wrote:
>> 
>>> 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
>>> 
>>
>> In that case I suggest to note this somewhere in the docs (and User
>> Guide) with three exclamation marks (or is it ???).
>> 
> So there's really two sub-bugs here:
> 
> 1) '\8ドル' gives '\8ドル' in mathtext (well, actually it gets sent verbatim
> to the non-math text renderer, which is a bug). This, IMHO, is a
> "must-fix".
> 
> 2) '8ドル' gives '8ドル' in mathtext and an error in usetex. This could be
> solved in two ways:
> 
> a) document the difference
> b) make '8ドル' give '8ドル' in usetex as well
> 
> I realise b) is technically making usetex accept a string that is not
> normally valid TeX -- but it's not like a user would ever enter '8ドル' and
> *want* to get a TeX error back. And usetex strings aren't perfectly TeX
> anyway.
> 
> Personally, I'm leaning toward b), because it requires less mental
> effort for the user turning usetex on/off. And it doesn't force us to
> backtrack on the idea of supporting "100ドル.00" easily.
+1 + docs of this behavior
> But before I commit -- any feedback?
> 
> Mike
> 
From: Darren D. <dsd...@gm...> - 2008年12月12日 16:49:54
On Fri, Dec 12, 2008 at 9:46 AM, Michael Droettboom <md...@st...> wrote:
> Manuel Metz wrote:
> > Michael Droettboom wrote:
> >
> >> 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
> >>
> >
> > In that case I suggest to note this somewhere in the docs (and User
> > Guide) with three exclamation marks (or is it ???).
> >
> So there's really two sub-bugs here:
>
> 1) '\8ドル' gives '\8ドル' in mathtext (well, actually it gets sent verbatim
> to the non-math text renderer, which is a bug). This, IMHO, is a
> "must-fix".
>
> 2) '8ドル' gives '8ドル' in mathtext and an error in usetex. This could be
> solved in two ways:
>
> a) document the difference
> b) make '8ドル' give '8ドル' in usetex as well
>
> I realise b) is technically making usetex accept a string that is not
> normally valid TeX -- but it's not like a user would ever enter '8ドル' and
> *want* to get a TeX error back. And usetex strings aren't perfectly TeX
> anyway.
>
> Personally, I'm leaning toward b), because it requires less mental
> effort for the user turning usetex on/off. And it doesn't force us to
> backtrack on the idea of supporting "100ドル.00" easily.
>
> But before I commit -- any feedback?
>
I opposed to b). If we go that route, we can look forward to advertising
usetex as "a latex backend, with familiar, standard latex markup, except
when it isnt."
Darren
From: Michael D. <md...@st...> - 2008年12月12日 18:06:32
Darren Dale wrote:
> On Fri, Dec 12, 2008 at 9:46 AM, Michael Droettboom <md...@st... 
> <mailto:md...@st...>> wrote:
>
> Manuel Metz wrote:
> > Michael Droettboom wrote:
> >
> >> 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
> >>
> >
> > In that case I suggest to note this somewhere in the docs (and User
> > Guide) with three exclamation marks (or is it ???).
> >
> So there's really two sub-bugs here:
>
> 1) '\8ドル' gives '\8ドル' in mathtext (well, actually it gets sent verbatim
> to the non-math text renderer, which is a bug). This, IMHO, is a
> "must-fix".
>
> 2) '8ドル' gives '8ドル' in mathtext and an error in usetex. This could be
> solved in two ways:
>
> a) document the difference
> b) make '8ドル' give '8ドル' in usetex as well
>
> I realise b) is technically making usetex accept a string that is not
> normally valid TeX -- but it's not like a user would ever enter
> '8ドル' and
> *want* to get a TeX error back. And usetex strings aren't
> perfectly TeX
> anyway.
>
> Personally, I'm leaning toward b), because it requires less mental
> effort for the user turning usetex on/off. And it doesn't force us to
> backtrack on the idea of supporting "100ドル.00" easily.
>
> But before I commit -- any feedback?
>
> 
> I opposed to b). If we go that route, we can look forward to 
> advertising usetex as "a latex backend, with familiar, standard latex 
> markup, except when it isnt."
It's not as bad as that. '\8ドル' will still work as in LaTeX as it always 
has and as a LaTeX expert would expect it to. All I'm proposing is that 
'8ドル', which is currently a LaTeX syntax error, will behave as it does 
when usetex is turned off. So it's not breaking anything that's already 
valid.
It's a question of which pain is worse, I guess.
The deeper question is -- should usetex even strive to have any 
compatibility with standard text? If not, then I can see your point.
Mike
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Darren D. <dsd...@gm...> - 2008年12月12日 18:38:26
On Fri, Dec 12, 2008 at 1:06 PM, Michael Droettboom <md...@st...> wrote:
> Darren Dale wrote:
>
> On Fri, Dec 12, 2008 at 9:46 AM, Michael Droettboom <md...@st...<mailto:
>> md...@st...>> wrote:
>>
>> Manuel Metz wrote:
>> > Michael Droettboom wrote:
>> >
>> >> 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
>> >>
>> >
>> > In that case I suggest to note this somewhere in the docs (and User
>> > Guide) with three exclamation marks (or is it ???).
>> >
>> So there's really two sub-bugs here:
>>
>> 1) '\8ドル' gives '\8ドル' in mathtext (well, actually it gets sent verbatim
>> to the non-math text renderer, which is a bug). This, IMHO, is a
>> "must-fix".
>>
>> 2) '8ドル' gives '8ドル' in mathtext and an error in usetex. This could be
>> solved in two ways:
>>
>> a) document the difference
>> b) make '8ドル' give '8ドル' in usetex as well
>>
>> I realise b) is technically making usetex accept a string that is not
>> normally valid TeX -- but it's not like a user would ever enter
>> '8ドル' and
>> *want* to get a TeX error back. And usetex strings aren't
>> perfectly TeX
>> anyway.
>>
>> Personally, I'm leaning toward b), because it requires less mental
>> effort for the user turning usetex on/off. And it doesn't force us to
>> backtrack on the idea of supporting "100ドル.00" easily.
>>
>> But before I commit -- any feedback?
>>
>> I opposed to b). If we go that route, we can look forward to advertising
>> usetex as "a latex backend, with familiar, standard latex markup, except
>> when it isnt."
>>
> It's not as bad as that. '\8ドル' will still work as in LaTeX as it always
> has and as a LaTeX expert would expect it to. All I'm proposing is that
> '8ドル', which is currently a LaTeX syntax error, will behave as it does when
> usetex is turned off. So it's not breaking anything that's already valid.
>
> It's a question of which pain is worse, I guess.
>
> The deeper question is -- should usetex even strive to have any
> compatibility with standard text? If not, then I can see your point.
>
http://matplotlib.sourceforge.net/users/mathtext.html advertises \$ as
markup for $. I think it was unwise to accept $ for $ in mathtext in the
first place, since mathtext uses tex markup anyway.
If we went with b), how sure are you that you can identify when a dollar
sign is intended and when mathmode is intended? Does "$A-100ドル+B*200ドル$" mean
$(A-100+200B) or A-100+200 or ..., I know this is an unlikely example, I'm
just trying to think of the unintended consequences of circumventing one of
the least buggy pieces of software in existence (I mean tex, not latex).
From: Michael D. <md...@st...> - 2008年12月12日 19:22:28
Darren Dale wrote:
> On Fri, Dec 12, 2008 at 1:06 PM, Michael Droettboom <md...@st... 
> <mailto:md...@st...>> wrote:
>
> Darren Dale wrote:
>
> On Fri, Dec 12, 2008 at 9:46 AM, Michael Droettboom
> <md...@st... <mailto:md...@st...>
> <mailto:md...@st... <mailto:md...@st...>>> wrote:
>
> Manuel Metz wrote:
> > Michael Droettboom wrote:
> >
> >> 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
> >>
> >
> > In that case I suggest to note this somewhere in the docs
> (and User
> > Guide) with three exclamation marks (or is it ???).
> >
> So there's really two sub-bugs here:
>
> 1) '\8ドル' gives '\8ドル' in mathtext (well, actually it gets
> sent verbatim
> to the non-math text renderer, which is a bug). This,
> IMHO, is a
> "must-fix".
>
> 2) '8ドル' gives '8ドル' in mathtext and an error in usetex.
> This could be
> solved in two ways:
>
> a) document the difference
> b) make '8ドル' give '8ドル' in usetex as well
>
> I realise b) is technically making usetex accept a string
> that is not
> normally valid TeX -- but it's not like a user would ever enter
> '8ドル' and
> *want* to get a TeX error back. And usetex strings aren't
> perfectly TeX
> anyway.
>
> Personally, I'm leaning toward b), because it requires less
> mental
> effort for the user turning usetex on/off. And it doesn't
> force us to
> backtrack on the idea of supporting "100ドル.00" easily.
>
> But before I commit -- any feedback?
>
> I opposed to b). If we go that route, we can look forward to
> advertising usetex as "a latex backend, with familiar,
> standard latex markup, except when it isnt."
>
> It's not as bad as that. '\8ドル' will still work as in LaTeX as it
> always has and as a LaTeX expert would expect it to. All I'm
> proposing is that '8ドル', which is currently a LaTeX syntax error,
> will behave as it does when usetex is turned off. So it's not
> breaking anything that's already valid.
>
> It's a question of which pain is worse, I guess.
>
> The deeper question is -- should usetex even strive to have any
> compatibility with standard text? If not, then I can see your point.
>
>
> http://matplotlib.sourceforge.net/users/mathtext.html advertises \$ as 
> markup for $.
That's always worked and still worked -- that's not the bug at hand. 
> I think it was unwise to accept $ for $ in mathtext in the first 
> place, since mathtext uses tex markup anyway.
I'm not proposing that at all. I think we're running into a 
misunderstanding about what I mean by "mathtext" and the scope of the 
proposed change. By mathtext, I mean "the text between a pair of $ $ 
when usetex is off". mathtext aims to be TeX-compatible (for a 
subset). Regular text does not (and in fact has no markup whatsoever). 
That last point, I believe, is the root of this problem and why 
reconciling usetex with non-usetex may be a losing battle, as you're 
starting to convince me. usetex is simply not the same thing as regular 
matplotlib text.
I'll clarify anyway -- but I'm starting to think that unless there is 
someone doing financial plots with usetex that is dying for this 
feature, I'll just leave it.
The bug at hand deals with regular text, not math text. There has been 
a test in the non-usetex code path for a long time to determine if there 
is any math in the string (by looking for an even number of non-escaped 
$) and allow the simple monetary case to work without needing to escape 
the $. It used to be impossible to interleave math and regular text in 
the same string and I needed a way to add support for interleaving 
without breaking existing usage, and without requiring an explicit flag 
saying "my string has math". It's not perfect -- if you want to have 
math *and* use a dollar sign, you still have to know what you're doing 
and do some sort of escaping. But it's served well for over a year.
The question, then, is whether to bring those smarts over to usetex, and 
whether any sort of usetex/non-usetex consistency is a goal.
>
> If we went with b), how sure are you that you can identify when a 
> dollar sign is intended and when mathmode is intended? Does 
> "$A-100ドル+B*200ドル$" mean $(A-100+200B) or A-100+200 or ..., I know this 
> is an unlikely example, I'm just trying to think of the unintended 
> consequences of circumventing one of the least buggy pieces of 
> software in existence (I mean tex, not latex).
>
It means [A-]100+B*[200] (where the contents in brackets is math, 
otherwise text), just like in TeX. An example where there is ambiguity 
is when you have an odd number, such as "$A-100ドル+B$". In TeX, that's a 
syntax error, but with my proposed change (and in non-usetex already) it 
would render as "$A-100ドル+B$". So at best, it's a "does the right 
thing", and at worst is a "silent fail", depending on your perspective.
Hope that clears things up.
Mike
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Darren D. <dsd...@gm...> - 2008年12月12日 20:42:03
On Fri, Dec 12, 2008 at 2:22 PM, Michael Droettboom <md...@st...> wrote:
> Darren Dale wrote:
>
>> On Fri, Dec 12, 2008 at 1:06 PM, Michael Droettboom <md...@st...<mailto:
>> md...@st...>> wrote:
>>
>> Darren Dale wrote:
>>
>> On Fri, Dec 12, 2008 at 9:46 AM, Michael Droettboom
>> <md...@st... <mailto:md...@st...>
>> <mailto:md...@st... <mailto:md...@st...>>> wrote:
>>
>> Manuel Metz wrote:
>> > Michael Droettboom wrote:
>> >
>> >> 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
>> >>
>> >
>> > In that case I suggest to note this somewhere in the docs
>> (and User
>> > Guide) with three exclamation marks (or is it ???).
>> >
>> So there's really two sub-bugs here:
>>
>> 1) '\8ドル' gives '\8ドル' in mathtext (well, actually it gets
>> sent verbatim
>> to the non-math text renderer, which is a bug). This,
>> IMHO, is a
>> "must-fix".
>>
>> 2) '8ドル' gives '8ドル' in mathtext and an error in usetex.
>> This could be
>> solved in two ways:
>>
>> a) document the difference
>> b) make '8ドル' give '8ドル' in usetex as well
>>
>> I realise b) is technically making usetex accept a string
>> that is not
>> normally valid TeX -- but it's not like a user would ever enter
>> '8ドル' and
>> *want* to get a TeX error back. And usetex strings aren't
>> perfectly TeX
>> anyway.
>>
>> Personally, I'm leaning toward b), because it requires less
>> mental
>> effort for the user turning usetex on/off. And it doesn't
>> force us to
>> backtrack on the idea of supporting "100ドル.00" easily.
>>
>> But before I commit -- any feedback?
>>
>> I opposed to b). If we go that route, we can look forward to
>> advertising usetex as "a latex backend, with familiar,
>> standard latex markup, except when it isnt."
>>
>> It's not as bad as that. '\8ドル' will still work as in LaTeX as it
>> always has and as a LaTeX expert would expect it to. All I'm
>> proposing is that '8ドル', which is currently a LaTeX syntax error,
>> will behave as it does when usetex is turned off. So it's not
>> breaking anything that's already valid.
>>
>> It's a question of which pain is worse, I guess.
>>
>> The deeper question is -- should usetex even strive to have any
>> compatibility with standard text? If not, then I can see your point.
>>
>>
>> http://matplotlib.sourceforge.net/users/mathtext.html advertises \$ as
>> markup for $.
>>
> That's always worked and still worked -- that's not the bug at hand.
>
>> I think it was unwise to accept $ for $ in mathtext in the first place,
>> since mathtext uses tex markup anyway.
>>
> I'm not proposing that at all. I think we're running into a
> misunderstanding about what I mean by "mathtext" and the scope of the
> proposed change. By mathtext, I mean "the text between a pair of $ $ when
> usetex is off". mathtext aims to be TeX-compatible (for a subset). Regular
> text does not (and in fact has no markup whatsoever). That last point, I
> believe, is the root of this problem and why reconciling usetex with
> non-usetex may be a losing battle, as you're starting to convince me.
> usetex is simply not the same thing as regular matplotlib text.
>
> I'll clarify anyway -- but I'm starting to think that unless there is
> someone doing financial plots with usetex that is dying for this feature,
> I'll just leave it.
>
> The bug at hand deals with regular text, not math text. There has been a
> test in the non-usetex code path for a long time to determine if there is
> any math in the string (by looking for an even number of non-escaped $) and
> allow the simple monetary case to work without needing to escape the $.
Right. I'm not criticizing the work you did on mathtext, which I think is
amazing and could not have done myself. And I forgot that because mathtext
used to be an all-or-nothing enterprise, there was no reason to escape the $
in regular text. Once you made it possible to embed mathtext in a regular
string, I think it would have been better in the long run to require \,ドル but
the powerful financial interests and their fat-cat lobbyists won the day.
> It used to be impossible to interleave math and regular text in the same
> string and I needed a way to add support for interleaving without breaking
> existing usage, and without requiring an explicit flag saying "my string has
> math". It's not perfect -- if you want to have math *and* use a dollar
> sign, you still have to know what you're doing and do some sort of escaping.
> But it's served well for over a year.
>
Thanks for reminding me, I forgot the context.
>
> The question, then, is whether to bring those smarts over to usetex, and
> whether any sort of usetex/non-usetex consistency is a goal.
>
>>
>> If we went with b), how sure are you that you can identify when a dollar
>> sign is intended and when mathmode is intended? Does "$A-100ドル+B*200ドル$" mean
>> $(A-100+200B) or A-100+200 or ..., I know this is an unlikely example, I'm
>> just trying to think of the unintended consequences of circumventing one of
>> the least buggy pieces of software in existence (I mean tex, not latex).
>>
>> It means [A-]100+B*[200] (where the contents in brackets is math,
> otherwise text), just like in TeX. An example where there is ambiguity is
> when you have an odd number, such as "$A-100ドル+B$". In TeX, that's a syntax
> error, but with my proposed change (and in non-usetex already) it would
> render as "$A-100ドル+B$". So at best, it's a "does the right thing", and at
> worst is a "silent fail", depending on your perspective.
>
> Hope that clears things up.
>
What I would prefer is to raise a deprecation warning when an odd number of
dollar signs are encountered, giving people time to learn to escape their $
and modify their code. I wonder how disruptive this would be to people using
mpl for finance? If that is unacceptable, I guess the best solution is as
you propose, but maybe usetex should issue a warning that it has modified
the string rather than strictly interpret it.
Do you know if there are any other inconsistencies between the text/mathtext
markup and latex?
From: John H. <jd...@gm...> - 2008年12月12日 20:49:08
On Fri, Dec 12, 2008 at 2:41 PM, Darren Dale <dsd...@gm...> wrote:
> What I would prefer is to raise a deprecation warning when an odd number of
> dollar signs are encountered, giving people time to learn to escape their $
> and modify their code. I wonder how disruptive this would be to people using
> mpl for finance?
Well, we used to need lots of dollar signs, but with the market crash
and credit crunch, we will probably get by with fewer going forward
<wink>
This is fine with me -- I suspect it is a very rare corner case.
JDH
From: Michael D. <md...@st...> - 2008年12月12日 20:55:36
<snip>
Darren Dale wrote:
>
> And I forgot that because mathtext used to be an all-or-nothing 
> enterprise, there was no reason to escape the $ in regular text. Once 
> you made it possible to embed mathtext in a regular string, I think it 
> would have been better in the long run to require \,ドル but the powerful 
> financial interests and their fat-cat lobbyists won the day.
lol ... I'm ready for my payout now... :)
> 
>
> What I would prefer is to raise a deprecation warning when an odd 
> number of dollar signs are encountered, giving people time to learn to 
> escape their $ and modify their code. I wonder how disruptive this 
> would be to people using mpl for finance? If that is unacceptable, I 
> guess the best solution is as you propose, but maybe usetex should 
> issue a warning that it has modified the string rather than strictly 
> interpret it.
That sounds like a good solution going forward.
>
> Do you know if there are any other inconsistencies between the 
> text/mathtext markup and latex?
>
Doh! That's actually a very illuminating question... One which, had I 
thought of it earlier, I might have never thought of dealing with $ at 
all... ;)
Basically anything that is meaningful markup in TeX would have to be 
escaped for usetex, but not for regular text. In that sense, $ is just 
one of many. Think of "{brackets}", for instance. You get "{brackets}" 
with regular text, and "brackets" with usetex. I'm sure the list of 
these things is fairly long. We don't want to start implicitly escaping 
those for usetex. All this supports the theory that perhaps the gap 
between regular text and usetex is too wide to reasonably bridge.
While originally this morning thought "let's just fix the 
inconsistencies", I'm now leaning to just adding a note to the docs that 
"regular text and usetex is fundamentally incompatible in a lot of ways" 
and leaving it at that.
Mike
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Darren D. <dsd...@gm...> - 2008年12月12日 22:01:52
On Fri, Dec 12, 2008 at 3:55 PM, Michael Droettboom <md...@st...> wrote:
> <snip>
>
> Darren Dale wrote:
>
>>
>> And I forgot that because mathtext used to be an all-or-nothing
>> enterprise, there was no reason to escape the $ in regular text. Once you
>> made it possible to embed mathtext in a regular string, I think it would
>> have been better in the long run to require \,ドル but the powerful financial
>> interests and their fat-cat lobbyists won the day.
>>
> lol ... I'm ready for my payout now... :)
>
>>
>> What I would prefer is to raise a deprecation warning when an odd number
>> of dollar signs are encountered, giving people time to learn to escape their
>> $ and modify their code. I wonder how disruptive this would be to people
>> using mpl for finance? If that is unacceptable, I guess the best solution is
>> as you propose, but maybe usetex should issue a warning that it has modified
>> the string rather than strictly interpret it.
>>
> That sounds like a good solution going forward.
>
>>
>> Do you know if there are any other inconsistencies between the
>> text/mathtext markup and latex?
>>
>> Doh! That's actually a very illuminating question... One which, had I
> thought of it earlier, I might have never thought of dealing with $ at
> all... ;)
>
> Basically anything that is meaningful markup in TeX would have to be
> escaped for usetex, but not for regular text. In that sense, $ is just one
> of many. Think of "{brackets}", for instance. You get "{brackets}" with
> regular text, and "brackets" with usetex. I'm sure the list of these things
> is fairly long.
What else is there that is likely to cause problems going from mpltext to
usetex? math: \( \). displaymath (which is not supported in mathtext and
strongly discouraged in usetex): \[ \], $$ $$ . \( \) are probably so rarely
used in regular text that they could be made to mean the same thing in
mathtext as they do in usetex. displaymath could raise an error in both
usetex and mathtext. ^ and _ render in regular text but raises an error
outside of mathmode with usetex (my installation of texlive actually
attempts to do the right thing and insert the missing mathmode characters in
the case of ^ and _.) %. ~ (nonbreaking space). #. Unicode? Ugh.
> We don't want to start implicitly escaping those for usetex. All this
> supports the theory that perhaps the gap between regular text and usetex is
> too wide to reasonably bridge.
>
> While originally this morning thought "let's just fix the inconsistencies",
> I'm now leaning to just adding a note to the docs that "regular text and
> usetex is fundamentally incompatible in a lot of ways" and leaving it at
> that.
>
I think it would be worth stating in the docs that # $ % & ~ _ ^ \ { } \( \)
\[ \] have special meaning in latex but not in regular mpl text, so buyer
beware. It might be nice if mpl regular text rendered the escaped version of
all these characters the same way latex does, that would make it easier to
go from text to usetex.
Speaking of implicitly doing the right thing, last night I was in the middle
of working through a difficult bug when Windows Vista *kicked me out without
asking or issuing a warning*, installed updates, and rebooted. I'm still
mumbling under my breath about it. Friggin jerks.
From: Michael D. <md...@st...> - 2008年12月15日 17:52:02
Darren Dale wrote:
>
> I think it would be worth stating in the docs that # $ % & ~ _ ^ \ { } 
> \( \) \[ \] have special meaning in latex but not in regular mpl text, 
> so buyer beware. It might be nice if mpl regular text rendered the 
> escaped version of all these characters the same way latex does, that 
> would make it easier to go from text to usetex.
For now, I'll just resolve the one straightforward bug (that \$ does not 
work in regular text with usetex off), and document these special 
characters as you suggest -- just so the fix will be in the next 
0.98.6. I'm going to hold off on these other issues of compatibility 
until they have clearer answers.
>
> Speaking of implicitly doing the right thing, last night I was in the 
> middle of working through a difficult bug when Windows Vista *kicked 
> me out without asking or issuing a warning*, installed updates, and 
> rebooted. I'm still mumbling under my breath about it. Friggin jerks.
I feel your pain. I've been there.
Mike
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /