I was playing a bit with the stylesheets to make my own. In the process I have created and installed a few stylesheets but now I would like to remove some of them.

First, how do I remove an entry from the Format > Stylesheet menu?

Second, where are the stylesheet files kept? I have deleted the files from the $UserBaseDirectory/SystemFiles/FrontEnd/StyleSheets, reloaded Mathematica, even rebooted the computer, but my styles are still working! Apparently Mathematica keeps a copy of my files somewhere I don't know about.

  • $\begingroup$ You mean you want to remove the ones that come with your copy of Mathematica? If so, then check in $InstallationDirectory (the directory tree is the same) $\endgroup$ – rm -rf Oct 15 '12 at 22:12
  • $\begingroup$ How did you create and install these in the first place? $\endgroup$ – Mr.Wizard Oct 15 '12 at 22:18
  • $\begingroup$ No, I wanted to remove the stylesheet I created and installed. I did it by selecting Format/Edit Stylesheet, modifying the some styles and clicking the Install Stylesheet button. My new style appeared on the menu list and the corresponding nb file in the $UserBaseDirectory.... Removing the file from this directory does not remove the entry form the list and does not remove the style. For the solution see below $\endgroup$ – Marek Pfutzner Oct 16 '12 at 8:36
  • $\begingroup$ You may also need to restart Mathematica with a clean cache. See reference.wolfram.com/mathematica/tutorial/… (or its equivalent in the Documentation Center). $\endgroup$ – murray Jan 4 '13 at 1:32

To my knowledge just removing the stylesheet file should be enough. The places where Mathematica looks for stylesheets can be extracted using CurrentValue


The directory names with an underscore point to locations where several packages could be placed. Every package can have it's own FrontEnd directory, etc. IMO. The other paths are are fixed and you can extract all stylesheets there by using something like

 Cases[FileNameJoin @@@ CurrentValue["StyleSheetPath"], _String]]

How to find all stylesheets

As one can see the above output of CurrentValue contains paths with a _.


Here the _ stands for every possible directory. You can use a small function which transforms a single FrontEndFileName[..]into valid input forFileNames`

makeFileNamesInput[FrontEnd`FileName[cont_]] :=
 If[FreeQ[cont, Verbatim[_]],
  {"*.nb", {FileNameJoin[cont]}},
  cont /. {dir__, Verbatim[_], rest__} :> (FileNameJoin /@ {{"*", rest, "*.nb"}, {dir}})

And now you can search all possible directories for style-sheet notebooks

Flatten[FileNames[##, Infinity] & @@@ 
  makeFileNamesInput /@ CurrentValue["StyleSheetPath"]]

Better alternative

I don't now why I haven't used it when I wrote the answer, but there's a much faster alternative to find all stylesheets in all directories given by CurrentValue["StyleSheetPath"]. Although, ToFileName seems to be superseded by FileNameJoin, this function can transform all FrontEnd`FileName-directories returned by CurrentValue directly into valid path specifications. Therefore, when I haven't missed anything, you should find all stylesheets by

FileNames["*.nb", (ToFileName /@ CurrentValue["StyleSheetPath"]), Infinity]
| improve this answer | |
  • $\begingroup$ Thanks! The problem is solved but I still do not understand it. I run your second command to get the list of all stylesheets and I see that my own styles are sitting in the $\endgroup$ – Marek Pfutzner Oct 16 '12 at 8:40
  • $\begingroup$ sorry, my previous comment broke. I continue: I found my stylesheet files in the directory C:\ProgramData\Mathematica\SystemFiles\FrontEnd\StyleSheets. Removing these files removes the corresponding entries from the Format/StyleSheet menu - this is what I wanted! However, this ProgramData directory does not appear on the list generated by your first command!? $UserBaseDirectory, $BaseDirectory, and $InstallationDirectory point somewhere else. $\endgroup$ – Marek Pfutzner Oct 16 '12 at 8:54
  • $\begingroup$ @MarekPfutzner Can you join the chat here http://chat.stackexchange.com/rooms/6138/diskussion-between-halirutan-and-marek $\endgroup$ – halirutan Oct 16 '12 at 9:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.