From: Yen Lee Loh on
A warning to people who are trying to write packages: Cut and paste may
corrupt formulas, especially if they use complicated typesetting. (My
version: Mathematica 7.0.1.0, Linux x86-64)

Example: Open a notebook in Mathematica (e.g., a .nb file) and type

-1
f[x_] := x -----;
2

This is interpreted as "negative half x". Now, open a new package and paste
in that definition. The formatting is preserved. Save the package as an .m
file. Reload it. Now you have

f[x_]:=x -1/2;

which is interpreted as "x minus half". Not good.

I didn't see any of the usual warnings about "converting to
TraditionalForm/StandardForm/paste literally" etc.

Maybe I am doing something wrong. Anyway, I have to try to find a
workaround. -YLL






--
Yen Lee Loh
Postdoctoral Associate, The Ohio State University
Home: 544 Stinchcomb Dr Apt 10, Columbus OH 43202-1728, USA
Office: 2043 Physics Research Building, 191 W Woodruff Ave, Columbus OH
43210-1117, USA
Office phone: +1 614 247 4772
Mobile phone: +1 765 532 9457
Email: yloh(a)mps.ohio-state.edu
Web: http://www.physics.ohio-state.edu/~yloh/


From: John Fultz on
You are correct, this is a bug. The correct behavior isn't to produce a
warning, but to produce correct output. The problem will occur with any
fraction that has a prefix '+' or '-' in the numerator, and which is part of an
implicit multiplication (i.e., one designated by whitespace as opposed to an
asterisk). That means you can work around the problem by denoting the
multiplication explicitly with an asterisk.

The problem will be resolved in the next major release of Mathematica.

Sincerely,

John Fultz
jfultz(a)wolfram.com
User Interface Group
Wolfram Research, Inc.

On Thu, 27 May 2010 06:46:21 -0400 (EDT), Yen Lee Loh wrote:
> A warning to people who are trying to write packages: Cut and paste may
> corrupt formulas, especially if they use complicated typesetting. (My
> version: Mathematica 7.0.1.0, Linux x86-64)
>
> Example: Open a notebook in Mathematica (e.g., a .nb file) and type
>
> -1
> f[x_] :== x -----;
> 2
>
> This is interpreted as "negative half x". Now, open a new package and
> paste
> in that definition. The formatting is preserved. Save the package as an
> .m
> file. Reload it. Now you have
>
> f[x_]:==x -1/2;
>
> which is interpreted as "x minus half". Not good.
>
> I didn't see any of the usual warnings about "converting to
> TraditionalForm/StandardForm/paste literally" etc.
>
> Maybe I am doing something wrong. Anyway, I have to try to find a
> workaround. -YLL