Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

Topic: Stylesheet for input side by side with output
Replies: 5   Last Post: Oct 3, 2012 3:14 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
David Reiss

Posts: 603
Registered: 2/24/06
Re: Stylesheet for input side by side with output
Posted: Oct 3, 2012 3:12 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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...@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...@gmail.com> wrote:
>

> > Thank you for the suggestions :)
>
> > On Wed, Sep 26, 2012 at 1:12 AM, christopher arthur <
> > chris.arth...@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.





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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.