Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Stylesheet for input side by side with output

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128272] Re: Stylesheet for input side by side with output
  • From: David Reiss <dbreiss at gmail.com>
  • Date: Wed, 3 Oct 2012 03:08:49 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20120923070153.D9CA26877@smc.vnet.net> <k466qk$a8c$1@smc.vnet.net>

Ok, here ie the margin  :-) ....  but it is only a non-debugged sketch
of a start...  the rest does not fit in the margin....


Define the function SideBySideFunction,


ClearAll[SideBySideFunction];

SideBySideFunction[nb_] :=
  Catch@Module[{nbrInput, nbrOutput},


    SelectionMove[nb, All, EvaluationCell, AutoScroll -> False];

    nbrInput = NotebookRead[nb];

    SelectionMove[nb, Next, Cell, AutoScroll -> False];

    nbrOutput = NotebookRead[nb];

    If[nbrOutput[[2]] =!= "Output", Throw[Null]];

    NotebookDelete[nb];

    SelectionMove[nb, Previous, Cell, AutoScroll -> False];

    NotebookWrite[nb,
     ToBoxes@TextCell[
       Grid[{{RawBoxes[nbrInput], RawBoxes[nbrOutput]}}], "Text",
       StripOnInput -> True]]

    ];


SideBySideFunction[] := SideBySideFunction[EvaluationNotebook[]]



Then, in the notebook set the option at the Notebook level by:

SetOptions[EvaluationNotebook[], CellEpilog :> SideBySideFunction[]]


Or, to not depend on the function definition of SideBySideFunction
execute the following in the notebook:

SetOptions[EvaluationNotebook[],

 CellEpilog :>
  Catch@Module[{nb, nbrInput, nbrOutput},

    nb = EvaluationNotebook[];


    SelectionMove[nb, All, EvaluationCell, AutoScroll -> False];

    nbrInput = NotebookRead[nb];

    SelectionMove[nb, Next, Cell, AutoScroll -> False];

    nbrOutput = NotebookRead[nb];

    If[nbrOutput[[2]] =!= "Output", Throw[Null]];

    NotebookDelete[nb];

    SelectionMove[nb, Previous, Cell, AutoScroll -> False];

    NotebookWrite[nb,
     ToBoxes@TextCell[
       Grid[{{RawBoxes[nbrInput], RawBoxes[nbrOutput]}}], "Text",
       StripOnInput -> True]]

    ]

 ]


With apologies to Fermat....

--David

On Sep 29, 3:10 am, Brentt <brenttnew... at gmail.com> wrote:
> Thank you, I was thinking it could probably be done if I got down and dir=
ty
> with some notebook programming. As for the margins, I'm thinking it would
> work well for doing scratch calculations, as in those times I usually hav=
e
> a lot of real estate on the right and find myself wanting to look at
> results and input separately.
>
> Fermat was proven correct in two respects I suppose: the theorem is
> (apparently) correct, and there actually wasn't enough room in the margin=
s
> for the proof.
>
> Fermat was proved correct in two respects: that proof really couldn't hav=
e
> fit in the margins.
>
>
>
>
>
>
>
> On Thu, Sep 27, 2012 at 12:05 AM, Brentt <brenttnew... at gmail.com> wrote:
>
> > Thank you for the suggestions :)
>
> > On Wed, Sep 26, 2012 at 1:12 AM, christopher arthur <
> > chris.arth... at gmail.com
> > > wrote:
>
> > > You could use authortools "makebilateralcells"  afterwards...but it
> > > wouldn't be automatic.
>
> > > Brentt a =E9crit :
> > > > Hi, is there a way to make input on the left side of the screen, an=
d
> > then
> > > > output appear on the right side of the screen? For example instead =
of
> > the
> > > > default notebook style
>
> > > > Input[n]: foo
> > > > Output[m]: bar
>
> > > > have
>
> > > > Input[n]: foo                |           =
     Output[m]: bar
>
> > > > where there is some sort of split screen type divider. Seems to me =
like
> > > it
> > > > would be a nicer way to work.




  • Prev by Date: Re: Stylesheet for input side by side with output
  • Next by Date: Get Distribution from Interpolated Function
  • Previous by thread: Re: Stylesheet for input side by side with output
  • Next by thread: Get Distribution from Interpolated Function