Skip to main content

Section 15 Interactive Elements, Server

When outputting Web page versions, it is possible to embed a variety of dynamic interactive elements. In a /PDF version, these will necessarily need to be replaced by some static substitute, such as a screenshot. See Section 3 for the specifics of embedding instances of the Sage Cell Server, which is more elaborate, and not entirely similar.

Interactives in this section have code that lives on a server somewhere (in the “cloud”). So maybe you uploaded an interactive demonstration, or maybe somebody else did. In this sense, these are easier to create or use. But pay attention, the code may come with restrictive licenses, even if you are the author originally. See Section 14 for more interactives that can be free as in “freedom” or liberté. CalcPlot3D is the notable exception here.

(2018-06-22) Almost everything in this section is under active development and not stable yet. Feel free to experiment and make suggestions and requests. This page takes a while to completely load, so be patient.

Subsection 15.1 GeoGebra

A Geogebra material is something you might use in a class. It could also be called an interactive demonstration. Go browsing at and find something appropriate for your project. Or make an account and create your own.

Once you find a material that looks instructive, it will be at a URL such as

and you want to pick off the identifier on the end, in this case KGn2d4Qd. Then author

<interactive geogebra="KGn2d4Qd" />

At this writing (2018-02-04) you will want to place this inside a figure, with a caption, as we do right now with material KGn2d4Qd.

The shape of the material will be fixed, so guess (or measure with an on-screen ruler), the aspect ratio and use that in the <interactive> element.

Figure 15.1 Right Triangle Paradox

Note that materials hosted at have a non-standard, non-commercial license you must agree to before you can download them as source code. Perhaps you must forfeit your copyright when you upload a material? We have not investigated this thoroughly.

Subsection 15.2 Desmos Graphs

Desmos provides interactive graphing applications. The following example was created by Ann Cary and made available via the “Share” function of Desmos. You can make your own Desmos graph, choose the “Share” icon, and the “Embed” option, to get a URL such as

You want to pick off the identifier on the end, in this case ttox1bvxku, then author

<interactive desmos="ttox1bvxku" width="60%" aspect="2:3" />

as we have done here.

The static image employed in the version of this article was obtained by viewing the graph at the Desmos site (i.e., not the embedded version in the PreTeXt HTML version), and using the Share button to export a PNG image. In this case, we used a “Medium Rectangle” and “Thick” lines.

Figure 15.2 Graph of \(ln(x^2+5)-3\)

Note that Desmos has extensive Terms of Service which include restrictions on commercial uses.

Subsection 15.3 CalcPlot3D

CalcPlot3D is a Javascript application for creating, visualizing, and understanding plots of 3D surfaces. So it would be an ideal companion to a book on multivariate calculus, but should be useful in other courses of study.

To use it, find find the online app version at

Create a plot and adjust the image to a viewpoint and scale you like. Then, click the menu icon in the upper-left and choose File. From here you can save a PNG image for the static version, but you also want to select Encode View in URL. Now your browser address bar is filled with a query string (all the stuff after the question-mark) that has all the information necessary to reproduce your plot (and view). Copy everything after the first question-mark to the interactive/code element. Be sure to replace any ampersands by &amp; (see the Author's Guide for more about certain characters in URLs). Examine the source for the examples below to see how they are authored.

Figure 15.3 Intersection of two planes (minimal embedding)
Figure 15.4 Probability wavefunction with contours (includes controls)
Figure 15.5 Plot of \(f(x,y)=\dfrac{1}{y-x^2}\) on \([-2,2]\times[-2,2] (full application)\)

Subsection 15.4 Wolfram CDF

You can embed interactive demonstrations created in Wolfram's Computable Document Format so that they will be played with the Wolfram CDF Player™. Once you create and save a demonstration, you want to determine the UUID that is the identifier of your demonstration. For example, Figure 15.7 is identified by 9fa2acff-c809-4b7f-a73b-c59ace36affc. This identifier is enough to create the PreTeXt to embed the demonstration. See for information about creating your demonstration. explains hosting CDF files at the Wolfram Cloud, and is the source of Figure 15.7. You can learn about powering your CDF with Wolfram Cloud Credits at CDF is a public format, and the FreeCDF™ license is a variant of a Creative Commons BY-SA license, see

The first example here (Figure 15.6) was developed by Itai Seggev, a Senior Kernel Developer at Wolfram.

(2018-04-02) These behave as expected in Chrome, but perhaps not in Firefox. Testing welcome.

Figure 15.6 Variable Sine Curve
Figure 15.7 Cellular Automata