Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: How do I stop Mathematica changing the format of fractions in Input cells?

164 views
Skip to first unread message

David Bailey

unread,
Apr 2, 2012, 4:32:00 AM4/2/12
to
On 31/03/2012 09:45, John Browne wrote:
> I am writing a notebook where I want to display some expressions in
> Input cells, in the 2-D fractional numerator-over-denominator format.
>
> However, I find that when I open the notebook again some time later,
> Mathematica has of its own accord decided to rewrite some of the
> fractions in the 1-D format using a "/". I have not been able to pin
> down precisely under what circumstances this happens, but it might be
> happening when the numerator and/or denominator gets over a certain
> length (or perhaps complexity). My trials have failed to find a reliable
> pattern of behaviour.
>
> The Input cells are not entered to create Output. They are just used for
> typesetting. Expressions copied from these Input cells into other Cell
> styles also show the same problem.
>
> Is there some option I can set for the affected cells (or the whole
> notebook) to tell Mathematica to leave them formatted just as I compose
> them?
>
> John
>
I suspect you need to produce a reproducible example for anyone to
explore this. One way might be to create a notebook programatically that
shows the change of format when it is saved - otherwise any notebook
that you produce will be morphed before someone can look at it.


David Bailey
http://www.dbaileyconsultancy.co.uk

James Stein

unread,
Apr 3, 2012, 4:46:22 AM4/3/12
to

Or it may be easier for the OP to put his notebook somewhere (e.g.,
DropBox) and provide a link to it.

John Fultz

unread,
Apr 3, 2012, 4:55:35 AM4/3/12
to
On Sat, 31 Mar 2012 03:44:21 -0500 (EST), John Browne wrote:
> I am writing a notebook where I want to display some expressions in
> Input cells, in the 2-D fractional numerator-over-denominator format.
>
> However, I find that when I open the notebook again some time later,
> Mathematica has of its own accord decided to rewrite some of the
> fractions in the 1-D format using a "/". I have not been able to pin
> down precisely under what circumstances this happens, but it might be
> happening when the numerator and/or denominator gets over a certain
> length (or perhaps complexity). My trials have failed to find a reliable
> pattern of behaviour.
>
> The Input cells are not entered to create Output. They are just used for
> typesetting. Expressions copied from these Input cells into other Cell
> styles also show the same problem.
>
> Is there some option I can set for the affected cells (or the whole
> notebook) to tell Mathematica to leave them formatted just as I compose
> them?
>
> John

Mathematica's line-breaking algorithm will break a fraction into a 1-dimensional
version if the 2D version was so long as to require scrolling to represent it.
Once the fraction is in 1D form, it doesn't automatically reconstruct the 2D
form again.

You can try to get it back by using the Cell->Convert To->StandardForm (or
TraditionalForm if that's what you're using), which will reinterpret and
re-canonicalize the entire cell. One of the side effects of that
re-canonicalization is that it will reconstruct 2D fractions and try once again
to see if they can be displayed without line-breaking.

So, one possibility that might be causing the problems you're seeing is that you
might be resizing the notebooks to such a narrow width that you inadvertently
trigger the behavior I'm describing. If that doesn't seem to explain it, then
I'd have to see one of the affected notebooks to comment further on what's going
on.

Sincerely,

John Fultz
jfu...@wolfram.com
User Interface Group
Wolfram Research, Inc.

0 new messages