MathGroup Archive 2007

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

Search the Archive

Re: Help notebook style in Mathematica 6.0

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81888] Re: Help notebook style in Mathematica 6.0
  • From: David Reiss <dbreiss at gmail.com>
  • Date: Sat, 6 Oct 2007 04:32:07 -0400 (EDT)
  • References: <fe4t9p$36$1@smc.vnet.net>

Hi Jens,

I think that the absence of the Reference.nb from the Format/
Stylesheet menu is certainly purposeful on WRI's part. It is mainly
intended for the Documents in the Documentation Center.  But, that
said, you can create a button to make this the assigned Stylesheet for
a notebook in the following way. (Of course you can add the formatting
that you like to this button, but this is the bare bones
implementation):



Button["Assign Reference Style",
SetOptions[InputNotebook[],

StyleDefinitions ->
 Notebook[{Cell[
    StyleData[
     StyleDefinitions ->
      FrontEnd`FileName[{"Wolfram"}, "Reference.nb"]]],
   Cell[StyleData["Input"], CellContext -> "Global`"],
   Cell[StyleData["Output"], CellContext -> "Global`"]},
  Visible -> False, StyleDefinitions -> "Default.nb"]

  ]


  or as a Palette:


CreateWindow@
 PaletteNotebook[
  Button["Assign Reference Style",
   SetOptions[InputNotebook[],
    StyleDefinitions ->
     Notebook[{Cell[
        StyleData[
         StyleDefinitions ->
          FrontEnd`FileName[{"Wolfram"}, "Reference.nb"]]],
       Cell[StyleData["Input"], CellContext -> "Global`"],
       Cell[StyleData["Output"], CellContext -> "Global`"]},
      Visible -> False, StyleDefinitions -> "Default.nb"]]]
  ]

  Now another thing that you might want to do with the resulting
notebook is to remove the default DockedCell that contains the search
field.

You can do this by this revised version:


CreateWindow@PaletteNotebook[
  Button["Assign Reference Style",
   With[{nb = InputNotebook[]},
    SetOptions[nb,
     StyleDefinitions ->
      Notebook[{Cell[
         StyleData[
          StyleDefinitions ->
           FrontEnd`FileName[{"Wolfram"}, "Reference.nb"]]],
        Cell[StyleData["Input"], CellContext -> "Global`"],
        Cell[StyleData["Output"], CellContext -> "Global`"]},
       Visible -> False, StyleDefinitions -> "Default.nb"];
     SetOptions[nb, DockedCells -> {}]]
    ]
   ]
  ]


The reason for the extra "Private" styles in this is so that the Input
and output Cells in the notebook will know about the loaded contexts.
The default behavior of these cells in the Reference.nb Stylsheet is
to only evaluate these cells in a private context of the cell.


In A WorkLife FrameWork's StyleSheets Palette, the Referece.nb styles
does show up (I harvest all of the style sheets from sensible
locations).

In A WorkLife FrameWork's NotebookStyles Palette, all of the styles
from the Referece.nb styles are listed including all hidden styles(I
harvest all of the styles from the stylesheet itself).

With regard to CellID: that is an undocumented feature.  It assigns a
"unique" identifier to a cell so that it can be accessed via this
identifier.  It is used, for example, by WRI to create paclet urls
that go to particular positions in documentation notebooks.  It is
heavilly incorporated into the system, so I expect that it will not go
away.  And, in fact, NotebookFind can work using CellIDs.  The
Notebook Option that tells a notebook to automatically create CellIDs
for new cells is

System`CreateCellID

Note that there is a bug currently that will put CreateCellID in the
Global context if you just execute it like that (without the explicit
System`).  I am sure that this will get fixed in a later release of
Mathematica (I have reported it to bugs).

I will be giving a talk at the upcoming Wolfram Technology conference
next week on things like this and, if you wish and remind me after the
conference, I can send you the notebook of my talk.

Hope that this helps,

--David
http://scientificarts.com/worklife
A WorkLife FrameWork
E x t e n d i n g MATHEMATICA's Reach...





On Oct 5, 4:40 am, Jens-Peer Kuska <ku... at informatik.uni-leipzig.de>
wrote:
> Hi,
>
> when I try to set the style sheet for help notebooks
> in Mathematica 6.0 the Frontend has no corresponding
> menu entry. But the stylesheet is there
>
> $TopDirectory\SystemFiles\FrontEnd\StyleSheets\Wolfram\Reference.nb
>
> more over, when I create a notebook with that style from the kernel
> the Format|Style menu does not offer styles like "Text", "Input" ...
> it is total empty.
>
> a) Does anyone know how to modify the FrontEnd (no MenuSetup.tr does not
> help) that the style sheet can be used from the FrontEnd.
>
> b) is there a palette to set the defined styles manual, I can
> make my own but if it exist somwhere ...
>
> and the last question. When I looked into the Help notebooks,
> every Cell[] has a CellID option. Needless to say, that this
> is not documented. For what is it good for and is the CellID
> used by the Help System in any way ?
>
> Thanks in advance
>    Jens




  • Prev by Date: Re: Re: Can Integrate[expr, {x, a, b}] give an
  • Next by Date: Re: Re: Can Integrate[expr,{x,a,b}] give an incorrect result?
  • Previous by thread: Help notebook style in Mathematica 6.0
  • Next by thread: FrameLabel in v6.0