MathGroup Archive 2002

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

Search the Archive

Re: Cell Brackets and recurring cells

  • To: mathgroup at
  • Subject: [mg34868] Re: [mg34686] Cell Brackets and recurring cells
  • From: Rolf Mertig <rolf at>
  • Date: Tue, 11 Jun 2002 05:00:33 -0400 (EDT)
  • Organization: Mertig Consulting
  • Sender: owner-wri-mathgroup at

You could write your own stylesheet with specific ShowCellBracket settings, 
but I doubt that it would be very useful...

As for adding copyright cells to a bunch of notebooks: there are of course
several possiblities and one would be to just do this by loading the notebooks 
into the Mathematica kernel and write them out again with the Cell added, but
in the past I had trouble with this kind of Kernel-only-manipulations of 
notebooks. Maybe things are better now, but still, one wants to have not just 
the "bare-bone" Notebook[] expressions saved, but a full normal .nb file.
So, one possibility would be to evaluate the following straightforward code 
(which you could have written yourself if you would have visited our 
(organized by mathemas ordinate (, delivered by
Jens-Peer Kuska and myself) Mathematica course at the Fraunhofer Institute 
in St. Augustin last month -:) ) in a notebook: (I have only tested this on 
Linux, it should work on Windows, it might or might not work on the various
Mac OS's):

PrependCell::usage="PrependCell[ Cell[OpenSource, Text], sourcedir, savedir]  
prepends its first argument to all
notebooks in the directory sourcedir and save them into savedir.";

PrependCell[s_Cell, sourcedir_String, newdir_String] := ( 
NotebookPut/@Replace[(Get/@#), Notebook[c_List, o__] :> 
Function[y,newdir<>$PathnameSeparator<>y]/@#]]&@FileNames["*.nb"] );

PrependCell[Cell["test","Text"], Directory[], 

It is left as an exercise for you to extend the function such that the cell is 
inserted at a different, choosable, position...
Notice that in general it is necessary to use Replace here instead of 
ReplaceAll since there might be Notebook expression inside the outer 

Rolf Mertig
Mertig Consulting
Mathematica consulting, programming, training

  • Prev by Date: RE: Re: Using Mathgroup Effectively -- cutting and pasting expressions
  • Next by Date: Re: puzzling difference in speed
  • Previous by thread: Cell Brackets and recurring cells
  • Next by thread: RE: QUESTION