On this page:
46.1 Complete source
46.2 How the program is organized
46.3 Render the movie
46.4 Try one change
9.3

46 Algebra across layouts🔗ℹ

One mathematical derivation continues while its figure moves into a new layout. The program subtracts five from both sides of 3x+5=17, cancels the opposite addends, and evaluates the right-hand side. It ends at 3x=12; it does not yet carry out the division that would give x=4.

Requirements: Animate Math and Slides; the formula toolchain for pictures; FFmpeg for MP4 output.

2 s — first checkpoint2 s — first checkpoint3 s — subtract on both sides3 s — subtract on both sides4 s — continue the authored step4 s — continue the authored step5 s — simplify5 s — simplify6 s — final checkpoint6 s — final checkpoint

Reviewed semantic-math gallery captures of this checkpoint interval and layout; source and shot IDs differ from the standalone program.

46.1 Complete source🔗ℹ

scribblings/examples/math-checkpoints.rkt

#lang racket/base
(require animate/math animate/slides animate/slides/math)
(provide problem working plan equation before-card after-card film)
 
;; doc: problem begin
(define problem
  (math '(= (+ (* 3 x) 5) 17) #:id 'problem
        #:context (math-context #:real '(x))))
;; doc: problem end
 
;; doc: derive begin
(define working
  (derive problem
    [subtract-five (both-sides 'subtract 5)]
    [cancel-five (cancel-addends #:at (lhs))]
    [evaluate-rhs (evaluate #:at (rhs))]))
;; doc: derive end
 
;; doc: plan begin
(define plan
  (present working #:style classroom
           #:groups '((subtract-five cancel-five evaluate-rhs))))
(define equation (math-content plan))
 
;; doc: plan end
 
;; doc: before begin
(define before-card
  (slide #:layout 'title+figure
    [title "Keep the algebra, change the layout"]
    [figure #:key 'work
     (content-state equation #:at '(subtract-five start)
                    #:viewport '(12 7))]))
;; doc: before end
 
;; doc: after begin
(define after-card
  (slide #:layout 'title+figure
    [title "Keep the algebra, change the layout"]
    [body "Subtract five on both sides. Cancel the opposites. Evaluate the right side."]
    [figure #:key 'work
     (content-state equation #:at '(evaluate-rhs end)
                    #:viewport '(12 7))]))
 
;; doc: after end
 
;; doc: match begin
(define film
  (storyboard #:id 'math-checkpoints #:theme lecture-dark
    (storyboard-shot 'before (hold-slide before-card #:duration 2))
    (slide-transition #:effect 'match #:keys '(work)
                      #:depth 'semantic #:duration 4 #:easing 'smooth)
    (storyboard-shot 'after (hold-slide after-card #:duration 3))))
 
;; doc: match end
 

46.2 How the program is organized🔗ℹ

The first definitions describe the held problem, the three named algebraic steps, and their presentation plan. equation wraps that plan as slide content. Constructing these descriptions is separate from typesetting a picture.

The two cards use checkpoints from that same content value. Both keep a 12-by-7 local viewport, even though the surrounding slide layout changes. The 'work continuity key connects them.

During each held shot the checkpoint is still. The four-second semantic transition advances the known interval between the checkpoints while moving the figure. It does not invent algebra by comparing two rendered formulas. The two holds make the complete storyboard nine seconds long.

46.3 Render the movie🔗ℹ

racket slides/render-example.rkt --workers 10 \

  --output slides-output/complete-examples/algebra-checkpoints \

  scribblings/examples/math-checkpoints.rkt

Uses the existing shared-worker slide runner. Add –frames to write PNGs without encoding an MP4.
Expected output: "slides-output/complete-examples/algebra-checkpoints/math-checkpoints.mp4".

This command prepares mathematical content and therefore needs the formula toolchain. Building the pages in this part only reads this source and its stored illustrations; it does not run that typesetting step.

46.4 Try one change🔗ℹ

Change the transition duration to give viewers more time for the same algebra. Keep both checkpoints attached to the same plan. To teach another algebraic step, add it to the derivation and choose its named checkpoint, rather than writing unrelated before and after formulas.

See A mathematical explanation has its own plan and Keep parts connected across slides.