1. What about a custom toolbar :
bTitle = Button["Title", FrontEndTokenExecute["Style", "Title"]];
bSection = Button["Section", FrontEndTokenExecute["Style", "Section"]];
To create a new notebook with an extra toolbar :
CreateWindow[DockedCells -> Cell[BoxData[ToBoxes[Grid[{{bTitle, bSection}}]]], "DockedCell"]];
Or, to display the toolbar in the same notebook you type in :
SetOptions[InputNotebook[], DockedCells -> Cell[BoxData[ToBoxes[Grid[{{bTitle, bSection}}]]], "DockedCell"]]
to make it disappear :
SetOptions[InputNotebook[], DockedCells -> {}]
Of course you can put anything you need in this extra toolbar (not only "text style" commands ...).
For some examples you can look at the doc.
To make this available for any notebook, an easy way is to write some custom functions in your init.m file (which is read at each new Mathematica session).
So for example, execute the following code in your notebook :
showETB := SetOptions[InputNotebook[],
DockedCells->Cell[BoxData[ToBoxes[Grid[{{bTitle, bSection}}]]], "DockedCell"]];
hideETB := SetOptions[InputNotebook[], DockedCells -> {}];
(* save that definitions in your personal init.m file :*)
initfile = FileNameJoin[{$UserBaseDirectory, "Kernel", "init.m"}];
Save[initfile, {showETB, hideETB}]
Just in case, you should maybe check/backup first your init.m file. The Save
command will actually append the definitions to the file.
(You can also write the definitions of showETB
, hideETB
, bTitle
, bSection
, ... in the file manually with any text editor).
Then restart Mathematica, open any notebook and enter in any Input cell showETB
to show the toolbar or hideETB
to hide it.
There are probably more elegant ways ... but it works.
2. What about a Palette
That could be even more useful for you and it is simpler to use :
CreatePalette[{"My Palette", bTitle, bSection}]
See the extensive doc about that. See the "install Palette" command to make this floating window available in any session from the main toolbar menu.