MathGroup Archive 2000

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

Search the Archive

Selecting a subsection cell

  • To: mathgroup at
  • Subject: [mg22849] Selecting a subsection cell
  • From: "Tom De Vries" <tdevries at>
  • Date: Sat, 1 Apr 2000 02:51:10 -0500 (EST)
  • Sender: owner-wri-mathgroup at

Hello All,

I am hoping someone can help me with this.  I am not understanding something
about how to select a group of cells under program control.

Here is what I would like to be able to do.

I have a notebook with many Section cells.  In each of these section cells
is also a subsection cell.

The application is a notebook with Math questions for a test.  Each question
is a section cell, and the answer is a subsection within the section cell. 
So each question is contained in its own section.

Question 1 (section heading)
What is 2 + 2?
Answer (subsection heading)

Question 2 (section heading)
What is 2 x 2?
Answer (subsection heading)

Question 3 (section heading)
What is 2 - 2?


I would like to be able to quickly delete all the answers.  I tried giving
each subsection heading cell a cell tag of answer.  Then I tried the
following (assuming the notebook I am working on can be referred to as fred)

NotebookFind  [fred, "answer", All, {CellTags}]

This works fine, all the answer subsection headings get selected (This can
also be done easily by simply option clicking on a cell that has a
subsection style)

Now, what I would really like to do is simply extend the selection so it
encompasses the subsection and then I can delete all the answers at the same

However,    SelectionMove[fred, All, CellGroup]      didn't do what I
thought it would, at least not for me.     For the first question in the
notebook it did work, it selected just the answer (the subsection) part of
the cell, but for all the other cells,  it selected the whole question. 

I am not sure if my message makes sense, but if so, can anyone offer any
suggestions or tell me what I am doing wrong?
Thanks for any assistance you might provide.


Tom De Vries
Edmonton, Alberta

  • Prev by Date: Re: Publishing in Scientific Journals with Mathematica
  • Next by Date: Re: Further question on "I have nested lists of ints....."
  • Previous by thread: Re: Cell background color?
  • Next by thread: Re: Further question on "I have nested lists of ints....."