1 Creating Slide Presentations

▼ |  | Slideshow: Figure and Presentation Tools

1 | Creating Slide Presentations
2 | Making Slides
3 | Fullscreen vs. Widescreen Aspect Ratio
4 | Typesetting Racket Code in Slideshow
5 | Animations
6 | Legacy Libraries
| Bibliography
| Index

► | 1 | Creating Slide Presentations

1.1 | Slide Basics
1.2 | Staging Slides
1.3 | Display Size and Font Selection
1.4 | Command-line Options
1.5 | Printing

On this page:

1.1`` Slide Basics
1.2`` Staging Slides
1.3`` Display Size and Font Selection
1.4`` Command-line Options
1.5`` Printing

top ← prev up next →

### 1`` Creating Slide Presentations

The slideshow module acts as a language that includes:

- all of racket except for printable<%>;

- pict-creating functions from pict; and

- slide-composing functions from slideshow/base.

The slideshow and slideshow/base module initialization also check the current-command-line-arguments parameter to configure the slide mode (e.g., printing).

The rest of this section repeats information that is presented by the tutorial slideshow, which can be viewed by running the slideshow executable and clicking the Run Tutorial link.

#### 1.1`` Slide Basics

The main Slideshow function is slide, which adds a slide to the presentation with a given content. For example, the “Hello World” presentation can be defined by the following module:

> #lang slideshow ; or slideshow/widescreen
> (slide
> #:title "How to Say Hello"
> (t "Hello World!"))

The t function in this example creates a pict containing the given text using the default font and style.

Executing the above module pops up a slide-presentation window. Type Alt-q (or Meta-q) to end the slides. Here are more controls:

| Alt-q, Meta-q, or Cmd-q | : | end slide show
| Esc | : | if confirmed, end show
| Right/Down arrow, Space, f, n, or click | : | next slide
| Left/Up arrow, Backspace, Delete, or b | : | previous slide
| g | : | last slide
| 1 | : | first slide
| s | : | next slide with a different title/name
| a | : | previous slide starting different title/name
| Alt-g, Cmd-g, or Meta-g | : | select a slide
| Alt-p, Cmd-p, or Meta-p | : | show/hide slide number
| Alt-c, Cmd-c, or Meta-c | : | show/hide commentary
| Alt-d, Cmd-d, or Meta-d | : | show/hide preview
| Alt-m, Cmd-m, or Meta-m | : | show/hide mouse cursor
| Alt-l, Cmd-l, or Meta-l | : | show/hide “spotlight”
| Shift with arrow | : | move window 1 pixel
| Alt, Meta, or Cmd with arrow | : | move window 10 pixels

The slide function accepts any number of arguments. Each argument is a pict to be centered on the slide. The picts are stacked vertically with (current-gap-size) separation between each pict, and the total result is centered (as long as there’s a gap of at least (* 2 (current-gap-size)) between the title and content).

> #lang slideshow
> (slide
> #:title "How to Say Hello"
> (t "Hello World!")
> (t "Goodbye Dlrow!"))

Various functions format paragraphs and generate bulleted items for lists. For example, item creates a bulleted paragraph that spans (by default) the middle 2/3 of the slide:

> #lang slideshow
> (slide
> #:title "How to Say Hello"
> (item "If you want to create an example, you"
> "can always do something with" (bt "Hello World!"))
> (item "It's a bit silly, but a follow-up example"
> "could be" (bt "Goodbye Dlrow!")))

As the example illustrates, the item function accepts a mixture of strings and picts, and it formats them as a paragraph.

Changed in version 1.4: Added support for unmodified Up and Down arrow keys to behave like Left and Right arrow keys.

#### 1.2`` Staging Slides

The slide function creates a slide as a side effect. It can be put inside a function to abstract over a slide:

> #lang slideshow
> (define (slide-n n)
> (slide
> #:title "How to Generalize Slides"
> (item "This is slide number" (number->string n))))
> (slide-n 1)
> (slide-n 2)
> (slide-n 3)

The slide function also has built-in support for some common multi-slide patterns. Each element argument to slide is usually a pict, but there are a few other possibilities:

- If an element is 'next, then a slide is generated containing only the preceding elements, and then the elements are re-processed without the 'next. Multiple 'next elements generate multiple slides.

- If an element is 'alts, then the next element must be a list of element lists. Each list up to the last one is appended to the elements before 'alts and the resulting list of elements is processed. The last list is appended to the preceding elements along with the remaining elements (after the list of lists) and the result is re-processed.

- A 'nothing element is ignored (useful as a result of a branching expression).

- A 'next! element is like 'next, except that it is preserved when condensing (via the --condense flag).

- A 'alts~ element is like 'alts, except that it is not preserved when condensing.

- A comment produced by comment is ignored, except when commentary is displayed.

Here’s an example to illustrate how 'next and 'alts work:

> #lang slideshow
> (slide
> #:title "Example"
> (item "First step")
> 'next
> (item "Second step")
> 'next
> 'alts
> (list (list (item "Tentative third step")
> 'next
> (item "This isn't working... back up"))
> (list (item "Third step that works")))
> 'next
> (item "Fourth step"))

#### 1.3`` Display Size and Font Selection

Slideshow is configured for generating slides in either 1024 by 768 for fullscreen (4:3) mode or 1360 by 766 for widescreen (16:9) mode. When the current display has a different size as Slideshow is started, the Slideshow display still occupies the entire screen, and pictures are scaled just before they are displayed. Thus, one picture unit reliably corresponds to a “pixel” that occupies 1/1024 by 1/768 of the screen or 1/1360 by 1/766 of the screen.

Fullscreen versus widescreen mode is a property of an individual slide that can be selected using the #:aspect argument to slide, but the default is to adapt to a mode that the user selects with --widescreen or --fullscreen. See Fullscreen vs. Widescreen Aspect Ratio for more information.

Beware that different font sets on different platforms can change the way a slide is rendered. For example, the tt font on one platform might be slightly wider than on another, causing different line breaks, and so on. Beware also of using bitmaps in slides when the presentation screen’s pixels do not exactly match the slide’s drawing units. In that case, consider using size-in-pixels (with the caveat that the resulting picture will take up different amounts of the slide on different displays).

Finally, beware that the text form for generating text pictures attempts to take into account any expected scaling for the display when measuring text. (All Slideshow text functions, such as t and item are built on text.) On some devices, scaling the picture potentially causes a different font size to be used for drawing the slide—rather than bitmap-scaling the original font—and changing the font size by a factor of k does not necessarily scale all text dimensions equally by a factor of k. Modern displays and drawing libraries make this scaling compensation a smaller effect than it used to be, but using current-expected-text-scale parameter can sometimes improve text scaling.

#### 1.4`` Command-line Options

(require slideshow/start) | package: slideshow-exe

The slideshow executable instantiates the slideshow/start module, which inspects the command line as reported by current-command-line-arguments to get another module to require for the slide content.The slideshow/start module also initializes variables like printing? and condense? based on flags supplied on the command line.

Thus, if the above example is in "multi-step.rkt", then the command

slideshow multi-step.rkt

runs the slides.

If the module given to slideshow has a slideshow submodule, then slideshow/start requires the slideshow submodule after requireing the module. If the module has no slideshow but has a main submodule, then the main submodule is required.

The slideshow executable accepts a number of command-line flags. Use the --help flag to obtain a list of other flags.

#### 1.5`` Printing

The -p or --print command-line flag causes Slideshow to print slides instead of showing them on the screen using the current platform’s printing system. The -P or --ps generates PostScript directly, while -D or --pdf generates PDF directly. By default, PS or PDF output is configured for paper output; use -e or --not-paper to produce output where each page’s bounding box matches the slide bounds.

PS-to-PDF converters vary on how well they handle landscape mode. Here’s a Ghostscript command that converts slides reliably (when you replace "src.ps" and "dest.pdf" with your file names):

gs -q -dAutoRotatePages=/None -dSAFER -dNOPAUSE -dBATCH -sOutputFile=dest.pdf -sDEVICE=pdfwrite -c .setpdfwrite -c "<</Orientation 3>> setpagedevice" -f src.ps

top ← prev up next →