Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Using hyperlinks to move to computations and back to text
Replies: 2   Last Post: Feb 6, 2013 5:51 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
David Park

Posts: 1,557
Registered: 5/19/07
Re: Using hyperlinks to move to computations and back to text
Posted: Feb 3, 2013 8:19 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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@comcast.net
http://home.comcast.net/~djmpark/index.html




From: David Latin [mailto:d.latin@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





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.