Skip to main content

The PreTeXt Guide

Section 3.18 Interactives

We strive to make it simple for authors to incorporate interactive demonstrations in the online output of their projects. Of course, this prompts the question of what to do with this content in less-capable formats like PDF or braille.
The <interactive> element provides a consistent way to specify these demonstrations. There are many possibilities, but perhaps they can be grouped mostly into three broad classes.
Server Hosted
Interactive demonstrations hosted at external sites, such as those from GeoGebra or Desmos, can be included simply by providing the appropriate identifying information, much like the way you would specify a YouTube video (Subsection 4.30.4).
Source Code
Some interactives can be described by source code that you include in your PreTeXt source. Examples include JessieCode, CircuitJS, and Sage Interacts. We also support GeoGebra this way. This is similar to how we employ Sage Cells, but without as much specialization.
Roll Your Own
If you know HTML, CSS, and Javascript, you can provide your own routines and libraries to incorporate any sort of demonstration you can imagine and can code.
See Section 4.22 for details.
For output formats where executing an <interactive> would be impossible, we manufacture a static version. This includes a screenshot of the demonstration (automatically generated, or supplied by the author) and a Quick Response (QR) code that will point to a standalone HTML page that contains the interactive. Again, see Section 4.22 for details.