To my knowledge just removing the stylesheet file should be enough. The places where Mathematica looks for stylesheets can be extracted using CurrentValue
CurrentValue["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,FrontEnd,StyleSheets}]}
*)
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
FileNames["*.nb",
Cases[FileNameJoin @@@ CurrentValue["StyleSheetPath"], _String]]
How to find all stylesheets
As one can see the above output of CurrentValue
contains paths with a _
.
FrontEnd`FileName[{$UserBaseDirectory,Autoload,_,FrontEnd,StyleSheets}]
Here the _
stands for every possible directory. You can use a small function which transforms a single FrontEnd
FileName[..]into valid input for
FileNames`
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]
$InstallationDirectory
(the directory tree is the same) $\endgroup$