3
$\begingroup$

What is the proper way to open a Demonstration in Mathematica so that the code is visible and can be evaluated from the Evaluation menu, as though I had created it myself?

Explanation: When I download a demonstration's .nb file and open it in Mathematica, I typically find myself looking at some elementary instructions for authors. I find this puzzling, because at that particular moment, I am trying to be a viewer or user of the demonstration, not one of its authors.

With the .nb file open, I can usually get the demonstration to function, but I usually cannot see the code. In the past I have managed to experiment with various menu commands to eventually reveal the code, but in a recent attempt I was unsuccessful, specifically in dealing with a file called TurtleGraphics-author.nb.

Using another approach, in the past I have clicked a link on the demonstration's web page to "preview" the author code. I then see some code, but exactly what "preview" subset it may be I am not sure. At that point I can click another screen button to show the initialization code, but again I'm not clear whether I am then seeing all of the code or still only some of it.

Whatever code I do see in this "preview" is shown in a small font which lacks both contrast and resolution. The code cannot be selected or copied, except as an image.

All this confuses me. In trying to reuse the author's demonstration code, am I doing something prohibited?

$\endgroup$
  • 1
    $\begingroup$ Try the menu command Cell > Grouping > Open All Subgroups $\endgroup$ – Michael E2 Jul 2 '15 at 4:44
  • $\begingroup$ Michael E2, your suggestion worked, but only after I selected all the code with the Select All menu command. Could you please create an answer from your comment? Thank you. $\endgroup$ – Ralph Dratman Jul 2 '15 at 23:30
  • $\begingroup$ Thanks, you're welcome, and my answer is posted.. $\endgroup$ – Michael E2 Jul 5 '15 at 17:04
2
$\begingroup$

Here is a simple way to open the cells:

  1. Open a downloaded Demonstration notebook.
  2. From the menu, Edit > Select All (Ctrl+A or Cmd+A).
  3. From the menu, Cell > Grouping > Open All Subgroups (Ctrl+{ or Shift+Cmd+{).
| improve this answer | |
$\endgroup$
  • $\begingroup$ That worked perfectly, so the question is answered. Thank you Michael E2. Now it would be desirable for Wolfram and the user community to spread the word to others who might be perplexed by this. Next up, there are other aspects of demonstrations that ought to be updated to fit with Wolfram's evident and praiseworthy new focus on user friendliness. $\endgroup$ – Ralph Dratman Jul 6 '15 at 17:23
4
$\begingroup$

The thing to look for is at the right-hand side of the notebook... with the TurtleGraphics demo, there are two kinds of brackets that indicate where to double-click in order to open up the hidden code. These look like

enter image description here

with the little down arrow, or like

enter image description here

with the little up arrow. In either case, double clicking reveals the code.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Bill, thank you. I found clicking on those little thingies (which have neither general nor specific names) difficult. Also, as far as I can see, it would have to be done for each hidden code block. But I am not aware of a way to know that there is hidden code in every block, and there are a good number of blocks. So, no, that is not yet a useful answer. $\endgroup$ – Ralph Dratman Jul 2 '15 at 23:20
  • $\begingroup$ In the demonstrations, there are only two segments of code: the initialization and the Manipulate function. The notebook format for demonstrations is tightly constrained. $\endgroup$ – bill s Jul 3 '15 at 1:20
  • $\begingroup$ I was hoping to find a simple answer that would enable new users, who naturally lack special knowledge about, for example, the constraints involved in building demonstrations, to make use of such demonstrations in a straightforward way. New users are among those who might particularly benefit from studying well-written demonstration code. I am no longer a new user: I have been using Mathematica for 4 years, including using it essentially full time during the first year. Nevertheless, when I posed my question a few days ago I had not yet figured out how to access demonstration code reliably. $\endgroup$ – Ralph Dratman Jul 5 '15 at 2:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.