Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Deleting parts of notebooks programmatically

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89214] Deleting parts of notebooks programmatically
  • From: "J. McKenzie Alexander" <jalex at lse.ac.uk>
  • Date: Thu, 29 May 2008 07:06:07 -0400 (EDT)

Suppose that I have a part specification (as returned by Position) for  
a component of the current InputNotebook[] that I would like to  
delete, and that this part specification was determined  
programmatically.  As a first guess I would try to use the function  
NotebookDelete - except that only deletes the current *selection* in  
the specified notebook, and there doesn't seem to be any easy way of  
using SelectionMove to set the current selection so as to correspond  
exactly to the region given by a part specification...

The only solution I've found is the following::

	nb = NotebookGet[ InputNotebook[] ];
	pos = Position[ nb, ..... ];
	NotebookPut[ Delete[nb, pos], InputNotebook[] ]

The problem is that this breaks any Manipulates appearing in the  
notebook (any displayed graphic appears greyed out and doesn't ever  
display correctly again until the notebook is closed and re-loaded).

In case anyone wants to see what motivates this, and an example  
showing the Manipulate bug, here's a simple notebook which implements  
endnotes in Mathematica (version 6 and higher).  Do keep in mind that  
it's a beta, and not very robust yet.

	http://evolve.lse.ac.uk/~jalex/files/Endnotes.nb

Cheers,

Jason

--
Dr J. McKenzie Alexander
Department of Philosophy, Logic and Scientific Method
London School of Economics and Political Science
Houghton Street, London WC2A 2AE




Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm


  • Prev by Date: Re: Plot3D crashes Mathematica 6.02
  • Next by Date: Re: how to select all graphics in a notebook?
  • Previous by thread: FindRoot with vector domain
  • Next by thread: Re: Deleting parts of notebooks programmatically