Re: Close Evaluation Cell in Version 6.0
- To: mathgroup at smc.vnet.net
- Subject: [mg76304] Re: [mg76213] Close Evaluation Cell in Version 6.0
- From: "" <ggroup at sarj.ca>
- Date: Sat, 19 May 2007 04:42:01 -0400 (EDT)
- References: <200705181001.GAA12547@smc.vnet.net> <ba40711f0705180834w9b01cd6xb408b10d5eb1f95f@mail.gmail.com>
Thanks Lev. That's an interesting method. It appears that you can actually
collapse a group while displaying multiple cells. So I have a method that
will display all the output cells while "hiding" the input cell:
hideCode[] := (
SelectionMove[EvaluationNotebook[], All, GeneratedCell,
AutoScroll -> False];
FrontEndTokenExecute["OpenCloseGroup"]
)
I just call hideCode[] at the end of the input cell I want hidden. It seems
to work reasonably well.
Thanks very much,
Januk
On Fri, 18 May 2007 11:34:55 -0400, Lev Bishop wrote
> On 5/18/07, Januk wrote:
> > In the new version, I really like the ability to close a group of
> > cells while displaying whichever cell you like from that group (just
> > double-click the bracket for that cell). For me, this means that I
> > can hide the code which creates some nice output. Unfortunately, if
> > you re-evaluate that cell-group, the group opens up showing the code.
> >
> > I wasn't able to find it, but is there a function or short set of
> > commands that I could use to automatically collapse a group of cells
> > while displaying say the last cell in the group? The closest I could
> > find is:
>
> You can make a style for your cells which supplies the following options:
> CellProlog :> Module[{nb = EvaluationNotebook[]},
> SelectionMove[nb, All, EvaluationCell];
> SelectionMove[nb, All, CellGroup];
> SaveGrouping`save =
> Replace[NotebookRead[nb], {Cell[CellGroupData[___, cg_], ___] :>
> cg, Blank[] -> None}]]
>
> CellEpilog:> Module[{nb = EvaluationNotebook[]},
> If[SaveGouping`save =!= None,
> SelectionMove[nb, All, EvaluationCell];
> SelectionMove[nb, All, CellGroup];
> NotebookWrite[nb, Replace[NotebookRead[nb],
> Cell[CellGroupData[a___, _], b___] :>
> Cell[CellGroupData[a, SaveGrouping`save], b]]]]]
>
> This will make it so that mathematica remembers the current grouping
> of a cell when you start evaluating it, and restores that grouping
> after the evaluation is complete.
>
> Lev
- References:
- Close Evaluation Cell in Version 6.0
- From: Januk <ggroup@sarj.ca>
- Close Evaluation Cell in Version 6.0