Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Cell Brackets and recurring cells

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

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 (http://www.ordinate.de), 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] := ( 
SetDirectory[sourcedir];
If[FileNames[newdir]==={},CreateDirectory@newdir];
Thread[NotebookSave[
NotebookPut/@Replace[(Get/@#), Notebook[c_List, o__] :> 
Notebook[Prepend[c,s],o],1],
Function[y,newdir<>$PathnameSeparator<>y]/@#]]&@FileNames["*.nb"] );

PrependCell[Cell["test","Text"], Directory[], 
Directory[]<>$PathnameSeparator<>"newdir"]


============
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 
Notebook[].

Rolf Mertig
Mertig Consulting
http://www.mertig.com
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