Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Silly question on how to insert sections, subsections and etc. on a notebook

118 views
Skip to first unread message

Eduardo M. A. M. Mendes

unread,
May 23, 2013, 3:55:38 AM5/23/13
to
Hello

I wonder whether it would be possible to write a notebook with the following structure:

Section 1

Text and Mathematica commands

subsection 1.1

Text and Mathematica commands

subsection 1.2

Text and Mathematica commands

Text and Mathematica commands (note that part is not inside subsection 1.2 but it is inside Section 1)

Section 2

.....


I could not figure out how to have "Text and Mathematica commands" after subsection 1.2 but still inside Section 1.

Many thanks

Ed


Murray Eisenberg

unread,
May 24, 2013, 5:22:58 AM5/24/13
to
You could use the Cell menu item Grouping to change from the default
Automatic Grouping to Manual Grouping.

I often used to do that. My sad experience, though, is that sooner or
later this will get you into some sort of trouble, and you'd be much
better off structuring your notebook so as not to have any such
"dangling" cells inside a section but outside any subsection.
---
Murray Eisenberg mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2838 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305






djmpark

unread,
May 24, 2013, 5:27:46 AM5/24/13
to
It is not a silly question at all. The object is that you are writing a
notebook and discussing some topic in a section and then you want to include
a subsidiary discussion in a Subsection that would normally be closed and
then continue on with the main discussion. Another example is that you have
certain definitions that need to be initialized in the Section and for some
reason you want the user to initialize them but not have to look at them.
You could put them in a Subsection at the end of the Section but then the
user might miss seeing them. If you put them in a Subsection at the
beginning then with regular Mathematica you can't get back to the Section.

In the Presentations Application I've made provision for this. It's done
through the Presentation style sheets and you could provide your own similar
style sheet. I've added new Cell styles: ResetSection, ResetSubsection,
ResetSubsubsection and Reset Subsubsubsection. These insert extremely thin
invisible cells at the given level. Essentially ResetSubsection creates a
new Subsection that looks like it is just a continuation of the Section.
There is also an optional SectionEndLine Cell style that inserts a bold
horizontal line to signal the end of a Subsection - when the Susbsection is
open. Also the Presentation style sheets put group openers on all the
section level groupings but not on anything else.

So your notebook structure would look like the following:

Section 1
Text and Mathematica commands

subsection 1.1
Text and Mathematica commands
SectionEndLine

subsection 1.2
Text and Mathematica commands
SectionEndLine

ResetSubsection
Text and Mathematica commands (note that this part is not inside subsection
1.2 but it is inside Section 1)
(This is actually in a new unlabeled Subsection that looks like a
continuation of the Section.)

Section 2

Presentations also has another method for inserting side discussions called
a Sidebar notebook. A Sidebar notebook is embedded in the mother notebook
but the contents are hidden. There are commands MakeSidebar, SaveSidebar and
SidebarButton. A SidebarButton could be placed in a Text cell and used to
launch a particular Sidebar notebook in a separate window.


David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/index.html



From: Eduardo M. A. M. Mendes [mailto:emamm...@gmail.com]

Hello

I wonder whether it would be possible to write a notebook with the following
structure:

Section 1

Text and Mathematica commands

subsection 1.1

Text and Mathematica commands

subsection 1.2

Text and Mathematica commands

Text and Mathematica commands (note that part is not inside subsection 1.2
but it is inside Section 1)

Section 2

.....


I could not figure out how to have "Text and Mathematica commands" after
subsection 1.2 but still inside Section 1.

Many thanks

Ed



Eduardo M. A. M. Mendes

unread,
May 24, 2013, 5:28:07 AM5/24/13
to
Many thanks.

Suppose I want to modify the structure of an already-written notebook.
How to structure it as listed in my previous email? That is, part of it
goes to a section that it is divided in subsection 1, subsection 2 and
dangling cells. I want to select what set of cells go to subsection 1,
subsection 2 and dangling section.

Cheers

Ed

On May 23, 2013, at 11:44 AM, Murray Eisenberg <mur...@math.umass.edu> wrote:

> You could use the Cell menu item Grouping to change from the default Automatic Grouping to Manual Grouping.
>
> I often used to do that. My sad experience, though, is that sooner or later this will get you into some sort of trouble, and you'd be much better off structuring your notebook so as not to have any such "dangling" cells inside a section but outside any subsection.
>
> On May 23, 2013, at 4:10 AM, Eduardo M. A. M. Mendes <emamm...@gmail.com> wrote:
>
>> I wonder whether it would be possible to write a notebook with the following structure:
>>
>> Section 1
>>
>> Text and Mathematica commands
>>
>> subsection 1.1
>>
>> Text and Mathematica commands
>>
>> subsection 1.2
>>
>> Text and Mathematica commands
>>
>> Text and Mathematica commands (note that part is not inside subsection 1.2 but it is inside Section 1)
>>
>> Section 2
>>
>> .....
>>
>>
>> I could not figure out how to have "Text and Mathematica commands" after subsection 1.2 but still inside Section 1.
>

Murray Eisenberg

unread,
May 24, 2013, 5:29:30 AM5/24/13
to
After change to Manual Grouping . . .

Select and cut the cell(s) to be "dangled" (at the end of the Section
but outside any Subsection), then paste them below the Section cell.

Next, close the Section group.

Now select the bracket of the closed Section cell along with the
now-separate cell(s) that you moved below the section.

From the Cell menu's Grouping item, select Group Cells/Group Together.

Eduardo M. A. M. Mendes

unread,
May 24, 2013, 5:23:59 AM5/24/13
to
Many many thanks

Ed

Murray Eisenberg

unread,
May 25, 2013, 5:34:16 AM5/25/13
to
Correction to what I wrote:

"structuring your notebook so as not to have any such "dangling" cells
inside a section but outside any subsection -- EXCEPT cells immediately
after the Section cell but before any Subsection cell."

albert...@gmail.com

unread,
May 28, 2013, 3:45:37 AM5/28/13
to
Hi Eduardo,

Others have shown you how to achieve what you want. I would like to emphasize that it is relatively simple to achieve this without the need to switch to manual grouping (which isn't exactly comfortable) or Davids excellent package. You just would have to add the following option to the (first) text cell which is meant to not be part of the subsection anymore:

CellGroupingRules->{"SectionGrouping", 30}

To do so you might need to look at the internals and e.g. use "Cell" -> "Show Expression" from the menu and then edit the raw cell expression. You could also use the option editor but I doubt that this will make it much easier.

Of course you have to adjust the number (30) if you want need this for other grouping levels than Section/Subsection. You can find the corresponding values in the Default.nb-Stylesheet.

hth,

albert

0 new messages