MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Using hyperlinks to move to computations and back to text

  • To: mathgroup at
  • Subject: [mg129710] Re: Using hyperlinks to move to computations and back to text
  • From: Alexei Boulbitch <Alexei.Boulbitch at>
  • Date: Wed, 6 Feb 2013 05:51:38 -0500 (EST)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:


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.

Hi, David,
In addition to the advices of David Park communicated  here I would like to
 add few things. I do the thing you are looking for on the everyday basis, 
since I for years keep my whole work documentation in the form of Mathematica notebooks. This includes all types of documents: drafts of calculations, memoirs for personal use and internal papers and presentations (that I do for the company I work in). The main reason for me to use Mathematica is the ability to keep the calculations and the code together with the text.

Most often I use a very quick and simple approach: I have the input and output cells with the code and results collapsed around the neighbour cell (typically with a formula which is obtained in these input-output cells, but also with any text). This is easily done. I usually from the very beginning put  Cell Grouping to Manual: Menu/Cell/Grouping/Manual Grouping. In the course of writing the notebook, as soon as I have such input-output cells that I need to collapse, I group them with the neighbour cell by marking them all and clicking Ctrl+G. Then make a double click on the bracket of the cell around which you wish to collapse the group which is at the right notebook margin. Like this you can keep all types of materials including formulas, text and any graphics in addition to input-output. The cells that you want to hide may also be defined as Closed. Go to Menu/Cell/Cell Properties and uncheck Open. This prevents such cells from occasional opening, in case such an opening i
 s strong
 ly undesired. This may be the case, if you, say, share the notebook with colleagues.

Further, a simple version of a sidebar, described in the answer of David Park may be easily done also without Presentations package. For example, evaluate this:

Button["Sinus plot",
    Plot[Sin[x], {x, 0, 2 \[Pi]}],
    Button[Style[" Close the window", 14, Blue], NotebookClose[]]
  WindowTitle -> "Sinus plot", WindowSize -> {500, 400}]

Evaluating this code results in a button. Its pressing opens a new notebook, a sidebar, showing a plot. You can now mark the button itself and copy-paste this button everywhere in the notebook, including any place inside a text cell. You only need now to put the cell with this Button statement in a separate cell in your notebook and declare it to be the Initialization cell (Menu/Cell/Cell Properties/Initialization Cell). You may then close it as I described above, or collapse.  

However, this button will only bring up the result of evaluation of the code Plot[Sin[x], {x, 0, 2 \[Pi]}], but not the code itself. If you need to show also the code, and/or occasionally to provide some text, the thing becomes more complex. It can also be done, but will require too much programming efforts in the place you generally expect to simply type a small text. In this case it is much faster to go to the Presentations package.

Have fun, Alexei

Alexei BOULBITCH, Dr., habil.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch at

  • Prev by Date: Re: Mathematica and Lisp
  • Next by Date: Re: Real time progress of NDSolve
  • Previous by thread: Re: Using hyperlinks to move to computations and back to text
  • Next by thread: Re: Using hyperlinks to move to computations and back to text