The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: making a Module or Column that will print lines interspersed
Replies: 1   Last Post: Feb 3, 2013 8:20 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
Albert Retey

Posts: 688
Registered: 7/15/08
Re: making a Module or Column that will print lines interspersed
Posted: Feb 3, 2013 8:20 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Am 03.02.2013 08:51, schrieb Bruce Shore:
> I run Mathematica 7. I have some legacy notebooks, from Mathematica 5, in which there were Modules such as
> macro :=Module[{j},
> Print["something"];
> plota;
> Print["something else"];
> plotb
> ];
> where plota and plotb were plots. Now with Mathematica 7 the semicolons prevent the plots from showing up. Show[plota]; has the same problem. The semicolons, which are needed in a Module, prevent the plotting. I have tried using a Column or a Graphics column,
> macro:=Column[{
> Print["something"],
> plota,
> Print["something else"],
> plotb
> }]
> and this does the printing and the plotting, but all the printing comes at the beginning and all the plots come after that. I really want the printing to come in between the plots, in the order that I show them. How can I do this?

I would suggest to use a Print for each of the plots, e.g.:

macro :=Module[{j},
Print["something else"];

this will not only be much easier to change but also reflect the
original code better: it makes the display of the plot a side effect as
it always was before version 5.

For new code, it of course it's of course better to take advantage of
the fact that graphics-expressions that are return values now are
rendered nicely in the frontend...



PS: you'll of course find similar questions and answers many times if
you search the archive for messages from the time when version 6 came out...

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.