5

I've found a couple of files called Default.nb under my Mathematica installation, but they don't seem to have any effect. At any rate, neither of them was changed when I edited 1 the so-called Default.nb stylesheet a few minutes ago. (They both still have modification time from the time I first installed Mathematica.)

I want to find the actual notebook so I can edit it using a text editor2.


1 To edit "Default.nb" I clicked on Format > Edit Stylesheet..., which brings up a "styles" notebook whose first cell says Inheriting base definitions from stylesheet "Default.nb" followed by a clickable link to Default.nb. Clicking on this link brings up a similar notebook titled Default.nb style definitions, but I can't determine where this notebook is stored.

2 The idea of editing this notebook using the Format menu is a joke in poor taste. Not only is it grossly inefficient timewise, it wouldn't be adequate even if one had infinite time. The Format menu is just too blunt a tool. One can't, for example, change a font family without also being forced to specify its font size, weight, etc. Customizations via the Format menu would be grossly over-specified.

kjo
  • 11,717
  • 1
  • 30
  • 89
  • 1
    Try FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrondEnd", "StyleSheets"}] – Michael E2 Apr 25 '16 at 00:38
  • 2
    Michael E2 has given you the location, but I say: never, never edit any file in that directory. Rather build a new style be deriving one from one the files in that directory. – m_goldberg Apr 25 '16 at 05:18
  • 1
    Here is an example how to edit Package stylesheet: http://mathematica.stackexchange.com/a/81016/5478 – Kuba Apr 25 '16 at 06:53
  • During the StyleSheet modification you cannot save the modified file by Menu/File/Save. You need to use Menu/File/SaveAs even if you have already saved it once. However, I join to m_goldenberg warning: never, never change Default.nb. Make better something like Default-modified.nb, as I did for myself. You will need to assign each new notebook to this style, but you will be on the safe side. – Alexei Boulbitch Apr 25 '16 at 07:40

2 Answers2

4

Citing the Documentation,

StyleSheetPath is a global option that specifies which directories the Wolfram System searches to find stylesheets.

The directories to be searched are specified using the FrontEnd`FileName function. Typical directories included in StyleSheetPath are FrontEnd`FileName[{$UserBaseDirectory,"SystemFiles","FrontEnd","StyleSheets"}] and FrontEnd`FileName[{$InstallationDirectory,"SystemFiles", "FrontEnd","StyleSheets"}].

In Mathematica 10.4.1 the value of this option itself is not very informative:

Options[$FrontEnd, StyleSheetPath]
{StyleSheetPath -> {ParentList, 
   FrontEnd`FileName[{"C:\\Program Files\\Wolfram \
Research\\Mathematica\\10.4\\SystemFiles\\Components\\MUnit\\FrontEnd", "StyleSheets"}, 
    "PacletManager" -> True]}}

Fortunately, AbsoluteOptions works here:

AbsoluteOptions[$FrontEnd, StyleSheetPath]

{StyleSheetPath -> {
   FrontEnd`FileName[{$UserBaseDirectory, "Autoload", _, "FrontEnd", "StyleSheets"}], 
   FrontEnd`FileName[{$UserBaseDirectory, "Applications", _, "FrontEnd", "StyleSheets"}], 
   FrontEnd`FileName[{$BaseDirectory, "Autoload", _, "FrontEnd", "StyleSheets"}], 
   FrontEnd`FileName[{$BaseDirectory, "Applications", _, "FrontEnd", "StyleSheets"}], 
   FrontEnd`FileName[{$InstallationDirectory, "AddOns", "Autoload", _, "FrontEnd", "StyleSheets"}], 
   FrontEnd`FileName[{$InstallationDirectory, "AddOns", "Applications", _, "FrontEnd", "StyleSheets"}], 
   FrontEnd`FileName[{$UserBaseDirectory, "SystemFiles", "FrontEnd", "StyleSheets"}], 
   FrontEnd`FileName[{$BaseDirectory, "SystemFiles", "FrontEnd", "StyleSheets"}], 
   FrontEnd`FileName[{$InstallationDirectory, "Configuration", "FrontEnd", "StyleSheets"}], 
   FrontEnd`FileName[{$InstallationDirectory, "SystemFiles", "Components", _, "FrontEnd", "StyleSheets"}], 
   FrontEnd`FileName[{$InstallationDirectory, "SystemFiles", "FrontEnd", "StyleSheets"}], 
   FrontEnd`FileName[{"C:\\Program Files\\Wolfram Research\\Mathematica\\10.4\\SystemFiles\\Components\\MUnit\\FrontEnd", "StyleSheets"}, 
                     "PacletManager" -> True]
         }}

The built-in stylesheets are located in the directory

FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrondEnd", "StyleSheets"}]

As m_goldberg correctly notes in the comment, it is strongly recommended do not edit the built-in stylesheets directly. The recommended way is to make a copy of the built-in stylesheet in the directory

FileNameJoin[{$UserBaseDirectory, "SystemFiles", "FrontEnd", "StyleSheets"}]

with another name, then remove the Saveable -> False option, and then edit it.

Alexey Popkov
  • 61,809
  • 7
  • 149
  • 368
3

You can also find things like these using the (undocumented and dangerous) FrontEnd`FindFileOnPath.

I implemented a safer wrapper for it here which can also spit out the path it found for it:

FEFindFileOnPath["Default.nb",
 "ReturnKey" -> True]

"StyleSheetPath" -> \
"/Applications/Mathematica.app/Contents/SystemFiles/FrontEnd/\
StyleSheets/Default.nb"
b3m2a1
  • 46,870
  • 3
  • 92
  • 239