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: [mg129720] Re: Using hyperlinks to move to computations and back to text
  • From: "djmpark" <djmpark at>
  • Date: Wed, 6 Feb 2013 21:29:24 -0500 (EST)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • References: <27483315.36808.1360148266675.JavaMail.root@m06>

I find it interesting that you resort to Manual Grouping because that has
the disadvantage of ungrouping and rather disorganizing the rest of the
notebook, unless you do it all manually. I find the automatic sectional
grouping of Mathematica notebooks extremely useful in organizing work.

The Presentations Application and especially its style sheets has a number
of features that I believe provide more convenient methods for this problem.
First, the style sheets have built-in group openers on all of the Sectional
groupings (but not on title or Input/Output groupings.) Most readers find
the openers much more intuitive than the cell brackets, which these days are
mostly hidden. I don't know why WRI doesn't provide Sectional openers in the
Default style sheet.  (You can easily add the openers to Sectional heading
by exposing the underlying expression and adding the ShowGroupOpener

One of the few problems with the sectional groupings is that, once your
insert a lower level grouping, all subsequent Input or Text cells are
captured into that lower level. That means you can't insert a subsection in
the middle of a section with additional Text and Input cells after it. This
forces you to put all such grouping at the end of the higher level section -
or result to manual grouping, which is what you have done. The style sheets
with the latest release of Presentations have new cell types: ResetSection,
ResetSubsection, etc., which allows you to have Subsections with openers and
then continue on as if you were in the Section level. This allows you to
group your calculation with an opener without resorting to manual grouping
or diverting from the higher level flow of discussion. There is also a
SectionEndLine cell type that inserts a thick line to mark the end of the
opened Subsection.

There is another convenience feature added in the latest release. Closing
Input cells (Menu, Cell, Properties, Open, or Alt+CPO) is a very nice method
to hide Input cells. This is useful if the Input cell contains a great deal
of "boilerplate specifications" that might not interest the intended
readers. The problem is that the reader might not notice the closed cell or
know what to do. And it's not that easy to select the bracket to evaluate.
So Presentations provides an EvaluateBelowButton, with an explanatory
tooltip, that can be inserted in a preceding Text cell to give notice and
evaluate the Input cell. The PresentationsToolbar style sheet also has a
button to open and close the Input cell - just a slight shortcut. If you're
writing the notebook you will probably be opening and closing it quite

It's not necessary to use the style sheets that come with Presentations to
use the Application (but then you lose the style sheet features) and many of
the items are "convenience features" that most experienced Mathematica users
could implement for themselves. But there are a lot of them and other
commands and another convenience feature is having them all accessible in
one place.

David Park
djmpark at 

From: Alexei Boulbitch [mailto:Alexei.Boulbitch at] 

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 is 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: Mathematica and Lisp
  • Previous by thread: Re: Using hyperlinks to move to computations and back to text
  • Next by thread: Any way to get gradient lines as well as contour lines?