如何创建标签式Mathematica笔记本

有没有办法在标签界面中创建和编辑笔记本(单元序列)? 可以使用TabView或其他工具TabView这样的界面吗? 如果我从头开始创建前端,我认为这将是可能的,但是在标准的Wolfram前端中有没有办法?


有两件事激励我问这个问题。 首先,我想用Mathematica笔记本创建Microsoft Office OneNote的替代品。 其次,当我在Mathematica工作时,我发现自己想知道一个选项卡式接口是否会比打开多个单独的窗口更好。


虽然Mathematica不直接支持标签式笔记本窗口,但可以使用DockedCells重现某些效果。 Virtual Book / Function Navigator界面(来自帮助菜单)是这样做的......它基本上是一个幻灯片演示,包含两个幻灯片,一个保存VB,另一个包含FN,带有由NotebookFind驱动的DockedCells导航界面,看起来有点儿像标签。

以下是你如何可以自己制作这样的笔记本的要点。 对不起,这里有一些先进的概念......如果你想了解更多关于这个解决方案的任何部分,也许你可以分解更多的问题。

(* 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"}]

编辑:更改NotebookFind[ButtonNotebook[],tag,All,CellTags] ,似乎并不总是正确地向幻灯片显示滚动到NotebookLocate[tag] 。 请参阅评论中的讨论。 理论上这两个代码应该是等价的,但Mathematica 8中的一个错误似乎有时会使它们的行为有所不同。

链接地址: http://www.djcxy.com/p/35591.html

上一篇: How to create tabbed Mathematica notebooks

下一篇: How to write a long function in Mathematica? Using Notebook as function?