Here is a Mathematica expression in a meta-notebook, based on the
Wolfram-supplied "StandardReport" style, as an example that creates another
Notebook with all the styles set up the way I want them. I store this
meta-notebook in the same place I store all my other notebooks instead of in a
magical directory on my path, so it gets backed up and survives machine wipes.
It could be distributed to users in a similar way, say through a gist or a
Dropbox folder.
To adapt this to your own needs, just edit and evaluate the expression! A
good way to figure out how to change the expression is to create and style a notebook
in the usual way, through the GUI, open it up with an ordinary text editor
like vim or emacs, and find the bits that you want to copy over to your meta-notebook. I've endeavored to include samples of every element that has a style so that the newly created notebooks can be visually checked.
Much
easier (at least for me) than messing around with a GUI and magical directories.
Here is a gist https://gist.github.com/rebcabin/0b9ddf27e1354cbded215594d6f59056
Here is another gist with a functional refactoring (installs MMA symbols and has multiple expressions, but is a little more flexible; the gist above and the code below is just a single expression and installs only the symbol myNotebook
in the MMA context):
https://gist.github.com/rebcabin/6ba697716ea2bcbfbe9a3253be4d1a01
Module[{myNotebook, myCells, myStyles, myDemoIntegral, myDemoSolution,
myMathGroup, myItemGroup, myNumberedGroup, myCode, myProgramText,
myMeatyContentGroup, mySectionGroup, myDocumentGroup,
myFontFunction, myDefaultStyles, myNonDefaultStyles},
myDemoIntegral = RowBox[{
RowBox[{"\[Integral]",
RowBox[{"x", RowBox[{"\[DifferentialD]", "x"}]}]}],
"+", SqrtBox["z"]}];
myDemoSolution = RowBox[{
FractionBox[SuperscriptBox["x", "2"], "2"],
"+", SqrtBox["z"]}];
myMathGroup = CellGroupData[{
Cell[BoxData[myDemoIntegral], "Input"],
Cell[BoxData[myDemoSolution], "Output"]},
Open];
myItemGroup = CellGroupData[{
Cell["Item", "Item"],
Cell["ItemParagraph", "ItemParagraph"],
Cell[CellGroupData[{
Cell["Subitem", "Subitem"],
Cell["SubitemParagraph", "SubitemParagraph"],
Cell[CellGroupData[{
Cell["Subsubitem", "Subsubitem"],
Cell["SubsubitemParagraph", "SubsubitemParagraph"]},
Open]]},
Open]]},
Open];
myNumberedGroup = CellGroupData[{
Cell["ItemNumbered", "ItemNumbered"],
Cell["ItemParagraph", "ItemParagraph"],
Cell[CellGroupData[{
Cell["SubitemNumbered", "SubitemNumbered"],
Cell["SubitemParagraph", "SubitemParagraph"],
Cell[CellGroupData[{
Cell["SubsubitemNumbered", "SubsubitemNumbered"],
Cell["SubsubitemParagraph", "SubsubitemParagraph"]},
Open]]},
Open]]},
Open];
myCode = RowBox[{RowBox[{"fun", "[", "x_", "]"}], ":=", "1"}];
myProgramText =
"\<DLLEXPORT int fun(WolframLibraryData libData, mreal A1, mreal \
*Res)
{
mreal R0_0;
mreal R0_1;
R0_0 = A1;
R0_1 = R0_0 * R0_0;
*Res = R0_1;
funStructCompile->WolframLibraryData_cleanUp(libData, 1);
return 0;
}\>";
myMeatyContentGroup = CellGroupData[{
Cell["Subsubsection", "Subsubsection"],
Cell["Text", "Text"],
Cell[myMathGroup],
Cell[myItemGroup],
Cell[myNumberedGroup],
Cell["DisplayFormula", "Text"],
Cell[BoxData[FormBox[myDemoIntegral, TraditionalForm]],
"DisplayFormula"],
Cell[TextData[{
"InlineFormula: ",
Cell[BoxData[FormBox[myDemoSolution, TraditionalForm]]],
"."}],
"Text"],
Cell["NumberedDisplay", "Text"],
Cell[BoxData[FormBox[myDemoIntegral, TraditionalForm]],
"DisplayFormulaNumbered"],
Cell["Code", "Text"],
Cell[BoxData[myCode], "Code"],
Cell["Program", "Text"],
Cell[myProgramText, "Program"]},
Open];
mySectionGroup = CellGroupData[{
Cell["Section", "Section"],
Cell[CellGroupData[{
Cell["Subsection", "Subsection"],
Cell[myMeatyContentGroup]},
Open]]},
Open];
myDocumentGroup = CellGroupData[{
Cell["Title", "Title"],
Cell["Subtitle", "Subtitle"],
Cell["Subsubtitle", "Subsubtitle"],
Cell["Author", "Author"],
Cell["Department", "Department"],
Cell["Date", "Date"],
Cell["Chapter", "Chapter"],
Cell["Subchapter", "Subchapter"],
Cell[mySectionGroup]},
Open];
myCells = {Cell[myDocumentGroup]};
myFontFunction[siz_, fam_: "Candara", wgt_: "Plain",
slt_: "Plain"] := {FontFamily -> fam, FontSize -> siz,
FontWeight -> wgt, FontSlant -> slt};
myDefaultStyles = {
{"Title", 44}, {"Subtitle", 24}, {"Subsubtitle", 16},
{"Author", 14}, {"Department", 11}, {"Date", 11},
{"Chapter", 34}, {"Subchapter", 28},
{"Section", 28}, {"Subsection", 20}, {"Subsubsection", 19},
{"Text", 14},
{"Item", 15}, {"ItemParagraph", 14},
{"Subitem", 13.5}, {"SubitemParagraph", 13.5},
{"Subsubitem", 13}, {"SubsubitemParagraph", 13},
{"ItemNumbered", 15}, {"SubitemNumbered",
13.5}, {"SubsubitemNumbered", 13},
{"DisplayFormula", 14}, {"DisplayFormulaNumbered", 14}};
myNonDefaultStyles = {
{"InlineFormula", 12.6, "Palatino", "Plain"},
{"Code", 12, "Inconsolata", "Bold"},
{"Program", 12, "Courier", "Plain"},
{"Input", 13, "Inconsolata", "Bold"},
{"Output", 13, "Inconsolata", "Plain"}};
myStyles = {
Cell[StyleData[
StyleDefinitions ->
FrontEnd`FileName[{"Report"}, "StandardReport.nb",
CharacterEncoding -> "UTF-8"]]],
Sequence @@ MapThread[
Cell[StyleData[#1], myFontFunction[#2]] &,
Transpose[myDefaultStyles]],
Sequence @@ MapThread[
Cell[StyleData[#1], myFontFunction[#2, #3, #4]] &,
Transpose[myNonDefaultStyles]]};
CreateDocument[
myNotebook = Notebook[
myCells,
StyleDefinitions -> Notebook[
myStyles,
Visible -> False]]]];
Format / Stylesheet / Stylesheet Chooser...
. In this case"Standard Report"
. But I must admit I don't quite get your point. $\endgroup$