[Date Index]
[Thread Index]
[Author Index]
Re: Hiding Input Cells
*To*: mathgroup at smc.vnet.net
*Subject*: [mg82247] Re: Hiding Input Cells
*From*: David Reiss <dbreiss at gmail.com>
*Date*: Tue, 16 Oct 2007 03:26:38 -0400 (EDT)
*References*: <fepq5p$dfs$1@smc.vnet.net><200710141018.GAA25879@smc.vnet.net>
I agree Murray, that it is not effficient to use what I wrote as a
general solution.
Had I a bit more time I would have woven it into a palette (using
InputNotebook rather than EvaluationNotebook in the functions).
I thought though that folks would enjoy seeing an example of some of
the tricks that I have learned to use.
The problem with any of these solutions is that closing a cell often
still leaves an indication of the cell in its place. Certainly it
leaves vertical white space that might not be wanted. ANd if the cell
has a background color then a stripe of that will still appear, as
well as its cell bracket if that is not hidden, and so on...
The better approach is to select all the cells that are not input
cells and create a new notebook with just those in it for theputpose
of printing.
Now, this requires a slight bit of trickery because whereas
NotebookFind can give you the selection of cells with a given
property, it can't give you the selection of cells what are the
complement of those cells. And this is what is needed for theproblem
at hand. However, using tagging you can do this. The general
approach that I use in A WorkLife FrameWork's TaggingPalette for this
is
1) select the whole notebook
2) tag all of the cells with a fixed unique tag
3) select the cells that you want the complement of using NotebookFind
4) remove that unique tag that was applied in step 2 from this
selection
5) finally find the cells with the unique tag: this, of course is the
complement
6) Now to pop up a notebook with this just use NotebookRead and
NotebookPut on a notebook expression that contains what was read along
with the optoins from the original notebook
The resulting notebook is more "printable" with regard to bits and
pieces of closed cells that might be visible in any of our other
methods that we've shown in this thread...
--David
On Oct 15, 1:22 am, Murray Eisenberg <mur... at math.umass.edu> wrote:
> Nice! But...is it really more efficient to copy and evaluate these
> definitions in the notebook and evaluate them than to do the equivalent
> thing manually (by selecting all Input cells with a simple key
> combination, then use the menu)?
>
>
>
> David Reiss wrote:
> > Much of the functionality that you are looking for is contained in the
> > Tagging palette in A WorkLife FrameWork
> > (http://scientificarts.com/worklife/). But here is a pair of quick
> > and dirty functions that will do what you are looking for by
> > evaluating them in the desired notebook.
>
> > This is a function that will do what you want (evaluate it in the
> > notebook whose input cells you are wating to evaluate).
>
> > ClearAll[EvaluateAndHideInputCells];
>
> > EvaluateAndHideInputCells[] :=
> > Module[{nb},
>
> > nb = EvaluationNotebook[];
> > NotebookFind[nb, "Input", All, CellStyle];
> > MathLink`CallFrontEnd[FrontEnd`SelectionAddCellTags[nb,
> > {"toevaluate"}]];
>
> > SelectionMove[nb, All, EvaluationCell];
> > MathLink`CallFrontEnd[
> > FrontEnd`SelectionRemoveCellTags[nb, {"toevaluate"}]];
>
> > NotebookFind[nb, "toevaluate", All, CellTags];
>
> > FrontEndExecute[FrontEndToken[nb, "EvaluateCells"]];
>
> > NotebookFind[nb, "toevaluate", All, CellTags];
> > MathLink`CallFrontEnd[
> > FrontEnd`SelectionRemoveCellTags[nb, {"toevaluate"}]];
> > SetOptions[NotebookSelection[nb], Editable -> True, CellOpen ->
> > False,
> > ShowCellBracket -> False]
>
> > ];
>
> > And this one will re-show the input cells to see them onece again.
> > Again evaluate it in the desired notebook.
>
> > ClearAll[ReopenInputCells];
>
> > ReopenInputCells[] :=
> > Module[{nb},
>
> > nb = EvaluationNotebook[];
> > NotebookFind[nb, "Input", All, CellStyle];
> > SetOptions[NotebookSelection[nb], Editable -> True, CellOpen ->
> > True,
> > ShowCellBracket -> True]
>
> > ]
>
> > I hope this helps...
>
> > --David
> >http://scientificarts.com/worklife
> > A WorkLife FrameWork
> > E x t e n d i n g MATHEMATICA's Reach...
>
> > On Oct 13, 2:55 am, "Harvey P. Dale" <h... at nyu.edu> wrote:
> >> Is it possible to hide input cells following notebook
> >> evaluation? I would like to have the output cells visible, but hide the
> >> input cells, so I can print the output without printing the input cells.
> >> I'd like this to happen automatically, so I don't have to delete the
> >> input cells one by one each time.
>
> >> Thank you.
>
> >> Sincerely,
>
> >> Harvey P. Dale
>
> --
> Murray Eisenberg mur... at math.umass.edu
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower phone 413 549-1020 (H)
> University of Massachusetts 413 545-2859 (W)
> 710 North Pleasant Street fax 413 545-1801
> Amherst, MA 01003-9305
Prev by Date:
**Re: Re: Manipulator Import in Powerpoint**
Next by Date:
**Re: format mixed integers & floats with text styling (see )**
Previous by thread:
**Re: Re: Hiding Input Cells**
Next by thread:
**Re: Hiding Input Cells**
| |