Re: Using hyperlinks to move to computations and back to text
- To: mathgroup at smc.vnet.net
- Subject: [mg129670] Re: Using hyperlinks to move to computations and back to text
- From: "djmpark" <djmpark at comcast.net>
- Date: Sun, 3 Feb 2013 20:20:36 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <7896164.23504.1359878559815.JavaMail.root@m06>
David, This is a very interesting question. Are you trying to do this "live" and therefore time constrained, or at some leisure? In any case, the notebook would have to be "prepared" with previous material and you just want to be able to get at key portions quickly and conveniently. One approach is to use CellTags and Hyperlinks. You can add CellTags (with the context menu) to cells. Then in your Text cell add a hyperlink to the CellTag in the current notebook. Then use Menu, Window, ShowToolbar to dock the toolbar at the top of your notebook. Then when you use the hyperlink to go to the CellTag the Go Back button on the toolbar will be activated. You can use this to return to the location of the hyperlink. However, you asked for a better approach and I believe there is one. The hyperlink approach violates the maxim: "Don't jerk the reader around." If you jump back and forth you seldom see the existing material in conjunction with the new material. Rather than jumping to another part of a notebook, it is better to bring the material to the reader where he is using it. In the Presentations Application I've provided some facilities that make it easy to do that. One of these is the WindowPresentation command. It just displays the output in a window. You can fairly easily implement it yourself, but WindowPresentation has all of the convenient options built-in. So, as an example, we might use the definitions: plotOfSin := WindowPresentation[Plot[Sin[x], {x, 0, 2 \[Pi]}]] plotOfCos := WindowPresentation[Plot[Cos[x], {x, 0, 2 \[Pi]}]] Of course, we might actually use this for much more complicated output such as DynamicModules or formatted derivations. A second method, that takes more effort to implement, is the use of Sidebars. A Sidebar is a notebook that is entirely embedded in the mother notebook and the contents hidden. A button can be created that will launch the notebook, in a separate window of course. We create a Sidebar with, say: MakeSidebar["Quantum Gravity Derivation"] That creates the notebook and you can type anything you want into the notebook, just like a regular notebook. Then you use: SaveSidebar["Quantum Gravity Derivation"] That creates an Initialization cell: SidebarContents["Quantum Gravity Derivation"] = <<Quantum Gravity Derivation>>; The notebook can be closed and the cell evaluated. Then a button to launch the sidebar notebook can be created with: SidebarButton["Quantum Gravity Derivation"] You could paste the above statement into an InlineCell in a Text cell and evaluate it in place to obtain the button, or just copy the button into the Text cell. If the various items of key material were defined within an Initialization section of the notebook, then you could also create a palette (and initialize it) to get at all of the material: CreatePalette[ {Button["Sin Plot", plotOfSin], Button["Cos Plot", plotOfCos], SidebarButton["Quantum Gravity Derivation"]}, WindowMargins -> Automatic, Saveable -> False, WindowTitle -> "QG Course Notes"]; If you add new initialized key material sections to the notebook you can also just add buttons for them to the palette. All the material is instantly accessible. No jumping around. David Park djmpark at comcast.net http://home.comcast.net/~djmpark/index.html From: David Latin [mailto:d.latin at gmail.com] Hello, I am using M9 to take notes from an online course, writing into a Text cell, but occasionally I want to be able to use a hyperlink at a place in the text to jump to some illustrative computation code in the same notebook. At the end of that code there should be another hyperlink to jump back to the original text position. I can do this procedure manually (tediously) of course, but has anyone formulated some more automated procedure for this please? It would be really efficient if a "button" can be clicked to input the label for the hyperlink that jumps to the computation code, while dividing the current text cell just below the cursor and inserting a new cell, in order to assign a tag to this new cell for returning from the computation code. Another "button" would create a new hyperlink after the code, in order to jump back to the text. Or is there a better solution for effectively typing-up a textbook with hyperlinks for illustrative example detours? Any help would be much appreciated. David