MathGroup Archive 2007

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

Search the Archive

Re: Initialization cell appearance

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74253] Re: Initialization cell appearance
  • From: "David Reiss" <dbreiss at gmail.com>
  • Date: Thu, 15 Mar 2007 19:08:20 -0500 (EST)
  • References: <etb5c3$k2f$1@smc.vnet.net>

This is a bit of a tricky enterprise.  One way, as you mention, is
simply to define a new cell style in the Style Sheet for the notebook
with the properties that you want.  Then, however, if you choose to
change style sheets, that information might be lost.

Another approach is to parse the whole notebook and, through pattern
matching, find those cells that are Initialization cells and 1) change
their properties such as the cell bracket color, or background  or 2)
tag them so that you can find all cells with the give call tag.  The
problem with this is that, if the cells are defined to be so at the
Style Sheet level, rather than the cell level, you will need to know
which styles those are, and again, if you change style sheets you may
run into problems.

The only option that NotebookFind can act on is the CellTags.  It
would be nice if NotebookFind could use information from other cell
options, but I believe that that is not so.  The cached data at the
end of a notebook file does contain at least some of this cell option
information, but it is not made use of by any functions as far as I
can see (even at the level of the FrontEnd`* context and at the level
of any context of the form *`* or *`*`*).

One other approach is to explicitly define cells to be initialization
cells with a button that also gives those cells a tag and use that tag
to find them all.  Again, one would have to consider things at the
level of the style sheets as well to be sure that you have caught them
all.  Also, if you take a cell that is an intiialization cell and
change it so that it is not an initialization cell, you would need to
do it through a button interface so that its recognizable property is
removed.

Anyone else have any thoughts on this (especially from WRI)?  This
would be a nice feature for me to add to A WorkLife FrameWork (http://
scientificarts.com/worklife), but to do so it would need to be tighter
than the possibilities above.


On Mar 15, 5:58 am, "John Jowett" <John.Jow... at cern.ch> wrote:
> Initialization cells in a notebook are identified visually by a little line
> attached to the cell bracket.   Sometimes this is not enough.  Often in
> large notebooks, I find myself manually formatting the Initialization cells
> to make them easier to spot (e.g. by changing their background colour to
> yellow).
>
> Is there any way to do this automatically ?   I.e., have something like the
> background colour of an Input cell change when it is marked as an
> Initialization cell.
>
> I realise that one could always define a new cell style but I am not
> entirely sure whether the other features of initialization cells would
> continue to work.
>
> In my opinion, it would be good to have this in some of the standard
> notebook style sheets.
>
> Thanks for any suggestions,
> John Jowett




  • Prev by Date: Re: Multiple regressions
  • Next by Date: Re: Triangular Distribution in Mathematica
  • Previous by thread: Re: Initialization cell appearance
  • Next by thread: Re: Initialization cell appearance