Template – creating a DockedCell for a slideshow

Created by:
Michael Morrison
MouseOver

Stylesheet note

This notebook’s stylesheet contains a definition for slideshowheader. This cell style definition is required in order for the code in this notebook to render the DockedCell correctly. That means that if you want to create your own slideshow with a DockedCell, you can either write over the contents of this notebook (easy), or copy the slideshowheader cell style from this notebook’s stylesheet to your own notebook’s stylesheet (more complicated).

Code

Evaluate the below command to create a DockedCell with the selected graphic.

How to create a DockedCell

Evaluate this code; you should see that it creates a DockedCell at the top of the notebook. This DockedCell will remain even as you move from slide to slide.

graphic=;
SetOptions[EvaluationNotebook[],DockedCells->{FEPrivate`FrontEndResource["FEExpressions","SlideshowToolbar"],
First[ToBoxes[TextCell[graphic,"slideshowheader",TextAlignment->Left,CellMargins->{{0,-150},{0,0}},Background->White]]]
}]

Note that you could change the TextAlignment, CellMargins, or Background depending on the graphic you are using and how you want it to appear.

Tweaking a DockedCell

For example, evaluate the following code to change the background of the DockedCell to blue, alignment of the graphic to the center, and set the margins all to be 0.

graphic=;
SetOptions[EvaluationNotebook[],DockedCells->{FEPrivate`FrontEndResource["FEExpressions","SlideshowToolbar"],
First[ToBoxes[TextCell[graphic,"slideshowheader",TextAlignment->Center,CellMargins->{{0,0},{0,0}},Background->Blue]]]
}]

Removing a DockedCell

You can also remove a DockedCell from a slideshow by using this command:

SetOptions[EvaluationNotebook[],DockedCells->{FEPrivate`FrontEndResource["FEExpressions","SlideshowToolbar"]
}]