I have a custom palette that I use constantly (code below). I would like it to open automatically when I first open Mathematica (13.0.1.0 for MacOS). Is this possible, and if so, how?
I did look at the answer here about init.m files, but TBH I found the discussion a bit baffling - especially since there is zero 'how to' documentation in the help, just a description of what an init.m file is (nothing on methodology). It's also slightly unnerving since one user reported that his original init.m file got wiped.
In short, I need more hand-holding than you might expect! I'd be really grateful for help.
The palette code:
styleButtons =
(Button[Style[#1, 14, FontFamily -> "Calibri"],
FrontEndTokenExecute[InputNotebook[], "Style",
#1], Appearance -> "Palette",
ImageSize -> 250] & ) /@ {"", "Item",
"ItemNumbered", "ItemParagraph", "", "Subitem",
"SubitemNumbered", "SubitemParagraph", "",
"DisplayFormula", "DisplayFormulaNumbered",
""};
gapButton = Button[Style["", 14, FontFamily ->
"Calibri"], "", Appearance -> "Palette"];
align = Button[Style["Align", 14, FontFamily ->
"Calibri"], NotebookWrite[InputNotebook[],
"\[AlignmentMarker]"]; SelectionMove[InputNotebook[], All,
Cell]; SetOptions[NotebookSelection[
InputNotebook[]], TextAlignment ->
AlignmentMarker], Appearance -> "Palette"];
turnOffAlignment = Button[Style["Un-Align", 14,
FontFamily -> "Calibri"],
SelectionMove[InputNotebook[], All, Cell];
SetOptions[NotebookSelection[InputNotebook[]],
TextAlignment -> Inherited],
Appearance -> "Palette"];
copyCellRef = Button[Style["Copy Reference", 14,
FontFamily -> "Calibri"],
Module[{cell, tags, tag, createTag},
cell = First[Cells[NotebookSelection[
InputNotebook[]], CellStyle ->
"DisplayFormulaNumbered"],
MessageDialog["Select an equation cell!"];
Return[]]; tags = Replace[CurrentValue[
cell, CellTags], t:Except[_List] :> {t}];
createTag := With[{newTag = CreateUUID[
"eqnID-"]}, SetOptions[cell,
CellTags -> Append[Select[tags,
Not @* StringMatchQ["eqnID-*"]],
newTag]]; newTag];
tag = SelectFirst[tags, StringMatchQ[
"eqnID-*"], createTag];
If[Length[Cells[InputNotebook[],
CellTags -> tag]] > 1,
MessageDialog["Multiple cells with same tag \
found!\n Tag of current cell will be \
regenerated."]; tag = createTag]; With[{tag = tag},
CopyToClipboard[Button[
Row[{"(", Dynamic[CurrentValue[
First[Cells[CellTags -> tag], $Failed],
{"CounterValue",
"DisplayFormulaNumbered"}]], ")"}],
Appearance -> None]]]], Appearance ->
"Palette"];
pasteCellRef = Button[Style["Paste Reference", 14,
FontFamily -> "Calibri"], Paste[],
Appearance -> "Palette"];
CreatePalette[Column[Join[styleButtons,
{align, turnOffAlignment, gapButton,
copyCellRef, pasteCellRef, gapButton}],
Spacings -> 0, Alignment -> Center],
Saveable -> False, WindowTitle ->
"Cell Styles & Cell Ref"];
Install Palettedoesn't behave as expected, there is something fundamentally wrong with your installation (or you don't use it correctly). I suggest to try to follow http://reference.wolfram.com/language/tutorial/CreatingPalettes.html literally and/or re-install your system from scratch, if possible. – Victor K. Feb 01 '23 at 16:49