MathGroup Archive 2008

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

Search the Archive

Re: Non Default stylesheet format and syntax coloring

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91489] Re: [mg91441] Non Default stylesheet format and syntax coloring
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Sat, 23 Aug 2008 01:43:52 -0400 (EDT)
  • Reply-to: jfultz at wolfram.com

On Fri, 22 Aug 2008 03:10:35 -0400 (EDT), guerom00 wrote:
> Hello everyone,
>
> When I open a new notebook, it has the =93NaturalColor=94 stylesheet
> format because I prefer it to the =93Default=94 format.
> In the Mathematica Preferences, I changed the font color for =93Global
> symbols that have no values assigned=94. Problem is that this new color
> for unassigned symbols shows up in a notebook that has the =93Default=94
> format but not the =93NaturalColor=94 one=85 I guess the
> =93NaturalColor=94
> format does not inherit the changes I make in the preferences=85
>
> Does anyone knows how do I solve this issue ?
>
> Thanks in advance. (Mathematica 6.0.2 on OSX 10.5.4)

The NaturalColor stylesheet sets a value for the "UndefinedSymbolStyle" option.  
That's the option which defines the style for symbols with no value assigned.  
Declarations in the stylesheet always override global settings, so that's why 
you're seeing the problem you're seeing.

The best way to solve it is to make a version of NaturalColor.nb which inherits 
from the system NaturalColor.nb but overrides this one setting.  Here's some
code which does this.

createNaturalColor[col_RGBColor] :=
 Module[{nb, 
   sspath = {$UserBaseDirectory, "SystemFiles", "Frontend", 
     "StyleSheets", "Creative"}},
  Quiet[CreateDirectory[ToFileName[sspath]]; 
   DeleteFile[ToFileName[sspath, "NaturalColor.nb"]]];
  nb = NotebookPut[
    Notebook[{Cell[
       StyleData[
        StyleDefinitions -> 
         FrontEnd`FileName[{"Creative"}, "NaturalColor.nb"]]], 
      Cell[StyleData["Notebook"], 
       AutoStyleOptions -> {"UndefinedSymbolStyle" -> col}]}]];
  NotebookSave[nb, ToFileName[sspath, "NaturalColor.nb"]];
  NotebookClose[nb]]

For example, try...
createNaturalColor[RGBColor[0, 0.5, 1]]

This should be run in a fresh front end, ideally with the default stylesheet
*not* set to NaturalColor (you can reset the default stylesheet after you've
selected the color you want).  Otherwise, you may run into file-locking issues 
which prevent the file from being properly created.

Sincerely,
 
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.




  • Prev by Date: Partial differential equation with evolving boundary conditions
  • Next by Date: Re: NDSolve[] with nested If[] and Piecewise[] usage
  • Previous by thread: Non Default stylesheet format and syntax coloring
  • Next by thread: Extending running memory of Mathematica