Presenter

Paul Wellin
seminars@wolfram.com

Online

(GMT: -7.`)

Wolfram Online Seminar Series

Overview

In this brief seminar, we will provide concrete examples to help you create and use presentations with Mathematica notebooks. Specifically, we will focus on the following:

Inline formulas

Interactive elements: hyperlinks, buttons, and other dynamic elements

Stylesheets: separating document formatting from content

Slideshows

Tips and tricks

Inline Formulas

Technical presentations often include mathematical formulas embedded in text. There are several ways of entering and working with traditional mathematical notation in Mathematica. We will look at each of the following:

entering special characters from palettes or the keyboard

creating typeset expressions

editing typeset expressions

inline cells

Inline Formulas  Entering special characters

Special characters such as π and ∫  can be entered using several different approaches.

Palettes

opened from the Palettes menu

for example, click the π button in the Basic Math Assistant palette

Keyboard aliases

entered using the Escape key Esc

for example, Esc p Esc displays as π

Character names

entered using \[characterName]

∖[Pi] displays as π.

See the SpecialCharacters reference page for a description of special characters and how to input them.

Character names and aliases are displayed as a tooltip on the Special Characters palette when you hover the mouse over any button.

Inline Formulas  Entering typeset expressions

Typeset structures (two-dimensional expressions) can be entered using either of the following:

palettes: click the (Sqrt[■]) button on the Basic Math Assistant palette to get a template for entering a square root.

the control key Ctrl: for example, Ctrl[2]x gives (Sqrt[x]).

See the examples on Mathematical Typesetting guide page or the set of tutorials on Input and Output in Notebooks.

Inline Formulas  Inline cells

You can include typeset input in text cells.

The result of (∑_(k=1)^∞)(1/(k^2)) is ((π^2)/6).

Use Ctrl[9] to start an inline cell and Ctrl[0] to end an inline cell

or, use the corresponding menu commands in the Typesetting submenu of the Insert menu

or, you can enter the expression using one of the palettes

To get evaluated results in your text cells: enter Mathematica input in your text cell and then use Evaluate in Place from the Evaluate menu.

For example, ∫(1/(1-(x^3)))dx=□.

Inline Formulas  Editing tips

Some useful typeset editing commands include:

double-clicking to expand a selection

Ctrl[.] to expand a selection

bracket matching

See the reference guide page for Menu Items (especially the Edit menu) for additional information.

Hyperlinks

Linking to other documents and to websites using hyperlinks to encapsulate some set of tasks are common features of most modern technical documents. In this section we will cover:

creating hyperlinks to URLs and other notebooks

linking to the Mathematica documentation

Hyperlinks  Basic examples

Mathematica provides a mechanism for linking to other documents and objects within a document through the use of hyperlinks. For example, clicking this hyperlink to Wolfram Research will cause your web browser to open to http://www.wolfram.com.

There are several ways to create hyperlinks in your notebooks. Perhaps the simplest is to use Hyperlink.

For example, this creates a hyperlink to www.wolfram.com.

Hyperlink["http://www.wolfram.com"]

You can add a label that will display instead of the explicit URL by giving Hyperlink two arguments.

Hyperlink["Wolfram Research","http://www.wolfram.com"]

Wrap the label in Style if you need to format it in any way.

Hyperlink[Style["Wolfram Research","Text"],"http://www.wolfram.com"]

The label of your button or hyperlink need not be text. Really, it can be anything!

Hyperlink[Plot[Sinc[x],{x,-2π,2π}],"http://mathworld.wolfram.com/SincFunction.html"]

Sometimes you will find yourself needing to create a hyperlink in the middle of a text cell similar to the Wolfram Research link above. To do this:

Highlight the word or phrase you wish to turn into a hyperlink.

From the Insert menu, select Hyperlink (alternately, right-click).

In the Create Hyperlink dialog box that appears, type in (or paste from your browser) the URL; click OK.

Note that you could also link to other Mathematica notebooks by browsing to a specific notebook on your computer from the Create Hyperlink dialog.

Linking to items in the Documentation Center requires creating a hyperlink of a certain style. It is easiest to simply highlight a symbol and right-click to bring up the context menu with Make Hyperlink. Type in paclet:ref/ParametricPlot say and click OK.

Example: here is text with a system symbol, ParametricPlot, that you can link to.

Slideshows

In this section we will discuss the following:

creating slide shows

editing slide shows

docked cells

environments

Sample notebook

Slideshows  Creating new slideshows

You can create slide show style presentations with Mathematica using new or previously created notebooks. Much of the work in creating a slide show is simplified through the use of the SlideShow palette (found under the Palettes menu).MouseOver

To create a new slide show notebook, click the New Template button on the SlideShow palette. This will open a new notebook containing three template slides.

Edit the slides, adding text and input cells as your normally would in any Mathematica notebook.

To add new slides, either click the New Slide button on the SlideShow palette or copy and paste an existing slide.

When you are ready to view the notebook as a slide show, either click the Slide Show button on the SlideShow palette or, from the menus, select Format ▶ Screen Environment ▶ SlideShow.

Basically you use the Working environment for editing your slide shows and use the SlideShow environment for viewing the slide show.

You should notice that the bottom of the SlideShow palette has a section called Extras that provides tools to let you paste individual elements into your notebook, change the underlying stylesheet, and set other properties of the notebook.

Slideshows  Tips

switching to full screen

Pagedown

Spacer cells at bottom

Stylesheets

In this section we discuss the following:

working with stylesheets

editing stylesheets

Stylesheets  What are stylesheets?

Mathematica, like many structured document systems, separates the style or formatting information about a notebook from the content. There are several advantages to this approach:

one edit to the stylesheet applies formatting information to all cells of that style

give notebooks a consistent design

easy to maintain styles for all notebooks that share a common stylesheet

The default styles of cells are set in the stylesheet for the notebook.

The stylesheet used by a notebook can be chosen from the Stylesheet submenu of the Format menu. Try selecting different stylesheets to apply to your notebook.

Style environments provide variations in the appearance of a style. Such variations allow you to use one stylesheet in several different ways without having to make several similar stylesheets. Try selecting different environments (Format ▶ Screen Environment) to see the effect on how your notebook is displayed.

Stylesheets  Editing

You can edit stylesheets to modify the appearance of any notebook that points at that stylesheet. To do this, select Format ▶ Edit Stylesheet.

Once the Style Definitions notebook opens, you can either edit individual cells styles using the pull-down menus, or you can edit the underlying stylesheet directly by clicking its hyperlink at the top of the Style Definitions notebook.

Tips & Tricks

In this last section, we will show you several useful tips and tricks for making presentations, including:

hiding code

initialization cells

save definitions in Manipulates

embedding stylesheets

group open/close icon

Tips & Tricks  Hiding code

There are several different ways you can hide input cells associated with output that you want to display.

double-click the Output cell bracket

set the Input cell option CellOpen->False: from the Cell menu, select CellProperties ▶ Open.

pts={{1,5},{2,0},{3,2},{4,5},{5,4},{6,4},{7,3},{8,1}};
Manipulate[
Show[Graphics[{
{Point[p],Green,Line[p]}}],
ParametricPlot[BSplineFunction[p][t],{t,0,1}]],
{{p,pts},Locator},
Initialization:>{pts={{1,5},{2,3},{3,2},{4,5},{5,4},{6,4},{7,3}}}]

Tips & Tricks  Initialization cells and groups

Using initialization cells, you can specify that particular input cells of a notebook should be evaluated first. This ensures that your code is evaluated in the correct order, such as defining functions before you might evaluate cells that use those definitions.

Needs["StatisticalPlots`"]

ParetoPlot[RandomInteger[4,{16}]]

If you have a lot of code in initialization cells, you might find it convenient to use an initialization group. Simply select the enclosing group cell and select Initialization Group from the Cell ▶ Cell Properties menu. All existing and new cells in the scope of this group cell will be initialization cells.

Tips & Tricks  SaveDefinitions

Here is some code to create a hypocycloid curve and animate it inside a Manipulate.

hypocycloid[{a_,b_},θ_]:={(a-b)Cos[θ]+b Cos[θ ((a-b)/b)],(a-b)Sin[θ]-b Sin[θ ((a-b)/b)]}

Manipulate[
Show[
ParametricPlot[hypocycloid[{1,b/a},t],{t,-0.001,i},PlotStyle->Red,Axes->None],
Graphics[{
{Blue,Circle[{0,0},1]},
{Red,PointSize[.025],Point[hypocycloid[{1,b/a},i]]},
{PointSize[.015],Point[RotationMatrix[i-π/2].{0,1-b/a}]},
{Circle[RotationMatrix[i-π/2].{0,1-b/a},b/a]},
{Thickness[.0065],Line[{RotationMatrix[i-π/2].{0,1-b/a},hypocycloid[{1,b/a},i]}]}
}],PlotRange->All],
{i,0+.001,12π,.1},{a,{3,4,5,6,7,8},Setter},{b,{1,2,3,4,5},Setter}]

If you were to start a new kernel session, the output above would not appear as the front end does not know about the definition for hypocycloid. By setting the option SaveDefinitions, the definition for Hypocycloid below will be saved with the output.

Hypocycloid[{a_,b_},θ_]:={(a-b)Cos[θ]+b Cos[θ ((a-b)/b)],(a-b)Sin[θ]-b Sin[θ ((a-b)/b)]}

Manipulate[
Show[
ParametricPlot[Hypocycloid[{1,b/a},t],{t,-0.001,i},PlotStyle->Red,Axes->None],
Graphics[{
{Blue,Circle[{0,0},1]},
{Red,PointSize[.025],Point[Hypocycloid[{1,b/a},i]]},
{PointSize[.015],Point[RotationMatrix[i-π/2].{0,1-b/a}]},
{Circle[RotationMatrix[i-π/2].{0,1-b/a},b/a]},
{Thickness[.0065],Line[{RotationMatrix[i-π/2].{0,1-b/a},Hypocycloid[{1,b/a},i]}]}
}],PlotRange->All],
{i,0+.001,12π,.1},{a,{3,4,5,6,7,8},Setter},{b,{1,2,3,4,5},Setter},
SaveDefinitions->True]

Alternatively, you could use the Initialization option but this would require you to evaluate the Manipulate. This construct simply makes these definitions evaluate before displaying the output of Manipulate.

Manipulate[
Show[
ParametricPlot[Hypocycloid[{1,b/a},t],{t,-0.001,i},PlotStyle->Red,Axes->None],
Graphics[{
{Blue,Circle[{0,0},1]},
{Red,PointSize[.025],Point[Hypocycloid[{1,b/a},i]]},
{PointSize[.015],Point[RotationMatrix[i-π/2].{0,1-b/a}]},
{Circle[RotationMatrix[i-π/2].{0,1-b/a},b/a]},
{Thickness[.0065],Line[{RotationMatrix[i-π/2].{0,1-b/a},Hypocycloid[{1,b/a},i]}]}
}],PlotRange->All],
{i,0+.001,12π,.1},{a,{3,4,5,6,7,8},Setter},{b,{1,2,3,4,5},Setter},
Initialization:>{
Hypocycloid[{a_,b_},θ_]:={(a-b)Cos[θ]+b Cos[θ ((a-b)/b)],(a-b)Sin[θ]-b Sin[θ ((a-b)/b)]}
}]

Tips & Tricks  Using the ShowGroupOpener icon

The ShowGroupOpener cell option is useful for hiding material and then exposing when you are ready. To create:

either copy existing cell that uses it and then change its style, or

open the Option Inspector (⇧-Ctrl-O) and set the option ShowGroupOpener->True

set ShowGroupOpener->True in your stylesheet to make it apply to all cells of a certain style

Note: you will likely need to pay attention to CellGroupingRules for the cells you are adding the group opener icon to. In general, cells with a lower value will group around cells with a higher value. From the documentation:

CellGroupingRules can also be set to {type,n}, where type is selected from a list and n is an integer that gives the precedence of the grouping relative to other cells of the same type.

Resources

Other available resources:

Tutorial: Notebooks as Documents

How to | Create a Slide Show

Screencasts: Notebooks and Documents

Initializations

Export[FileNameJoin[{NotebookDirectory[],"NbBanner.tiff"}],
,
"TIFF"]