Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5367 > unrolled thread

CreateDocument with nested CellGroup problem.

Started bySyd Geraghty <sydgeraghty@me.com>
First post2011-10-04 05:38 +0000
Last post2011-10-04 05:38 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  CreateDocument with nested CellGroup problem. Syd Geraghty <sydgeraghty@me.com> - 2011-10-04 05:38 +0000

#5367 — CreateDocument with nested CellGroup problem.

FromSyd Geraghty <sydgeraghty@me.com>
Date2011-10-04 05:38 +0000
SubjectCreateDocument with nested CellGroup problem.
Message-ID<j6e657$kda$1@smc.vnet.net>
Hi all,

CreateDocument[
 CellGroup[{TextCell[CountryData[#, "Name"], "Section"], 
     ExpressionCell[
      GraphicsRow[{CountryData[#, "Shape"], 
        Quiet[DateListPlot[CountryData[#, {{"Population"}, {1970, 2005}}]]]}, 
       Frame -> All, ImageSize -> 600], "Output"]}, Closed] & /@ 
  CountryData["Africa"], WindowTitle -> "Africa", 
 StyleDefinitions -> "Creative/PastelColor.nb"]

outputs a document with select information about all the countries in Africa.

I wanted to extend it to take any of the continents as an argument but got stuck at trying to make a very simple extension to nest the original cell groups under the title cell "Africa" .

After an embarrassing amount of time spent trying many alternatives based on the documentation for nested cells in CellGroup and examples in CreateDocument I could not get the desired result.

The code below does not work and it seems that the pure function is not wrapped properly

So this is the closest I got:

CreateDocument[
 CellGroup[{TextCell["Africa", "Title"], 
     CellGroup[{TextCell[CountryData[#, "Name"], "Section"], 
       ExpressionCell[
        GraphicsRow[{CountryData[#, "Shape"], 
          Quiet[
           DateListPlot[CountryData[#, {{"Population"}, {1970, 2005}}]]]}, 
         Frame -> All, ImageSize -> 600], "Output"]}, Closed]}] & /@ 
  CountryData["Africa"], CellGrouping -> Manual, WindowTitle -> "Africa", 
 StyleDefinitions -> "Creative/PastelColor.nb"]


The "Title" cell is repeated for every country instead of nesting all the countries. A solution would be greatly appreciated.

Cheers .... Syd

Syd Geraghty B.Sc, M.Sc.

sydgeraghty@mac.com

Mathematica 8.0 for Mac OS X x86 (64-bit) (February 23, 2011)
ReleaseID:    8.0.1.0 (2063982, 2063639)
MacOS X V 10.7.1 Lion 
MacBook Pro 2.33 GHz Intel Core 2 Duo  3GB RAM

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web