Is there a way to create and edit notebooks (sequences of cells) in a tabbed interface? Could such an interface be made with TabView
or some other tool? I assume this would be possible if I made a front-end from scratch, but is there a way within the standard Wolfram front-end?
Two things motivate me to ask this. First, I would like to create a replacement for Microsoft Office OneNote with Mathematica notebooks. Second, when I'm working in Mathematica I find myself wondering whether a tabbed interface would work better than having numerous separate windows open.
While Mathematica doesn't support tabbed notebook windows directly, it is possible to reproduce something of the effect using DockedCells
. The Virtual Book/Function Navigator interface (from the help menu) does this...it's essentially a slide show with two slides, one holding the VB and the other containing the FN, with a DockedCells
navigation interface driven by NotebookFind
that looks a bit like tabs.
Here's the gist of how you might go about making such a notebook on your own. Sorry, there are some kind of advanced concepts here...if there's any parts of this solution which you want to learn more about, maybe you can spin off more questions.
(* make a single page of the notebook *)
page[tag_String] :=
Cell@CellGroupData[{Cell["", "SlideShowNavigationBar",
CellTags -> {tag}], Cell[tag, "Title"]}];
(* make a single tab-like button which selects the page *)
button[tag_String] :=
Button[Dynamic[
Setter[Dynamic[
CurrentValue[EvaluationNotebook[], {TaggingRules, "page"},
tag]], tag]],
CurrentValue[EvaluationNotebook[], {TaggingRules, "page"}] = tag;
NotebookLocate[tag],
Appearance -> None];
(* make a notebook based upon a list of strings which are names of tabs *)
makeTabbedNotebook[nameList_List] :=
NotebookPut@Notebook[page /@ nameList,
DockedCells ->
ToBoxes[ExpressionCell[Row[button /@ nameList],
"DockedCell"]][[1]],
ScreenStyleEnvironment -> "SlideShow"];
makeTabbedNotebook[{"First", "Second", "Third"}]
Edit: changed NotebookFind[ButtonNotebook[],tag,All,CellTags]
, which appears to not always scroll the slideshow correctly, to NotebookLocate[tag]
. See discussion in comments. The two bits of code should, in theory, be equivalent, but a bug in Mathematica 8 appears to make them behave differently sometimes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With