Section 15 Interactive Elements, Server
When outputting Web page versions, it is possible to embed a variety of dynamic interactive elements. In a LaTeX/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
www.geogebra.org/materials/ 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
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
Note that materials hosted at
geogebra.org 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 LaTeX 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.
Note that Desmos has extensive Terms of Service which include restrictions on commercial uses.
Subsection 15.3 CalcPlot3D
To use it, start at the online app version 1 . Create a plot and adjust the image to a viewpoint and scale if you like. Then, click the menu/hamburger 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
& (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. The Help Manual for CalcPlot3D is also available off the menu/hamburger icon in the upper-left.
In Figure 15.3 grab the image with your mouse and rotate it in various directions. Then while the image has focus, press the
3 key (short for “3-D”), to get a 3D view, which will require some red-blue 3D glasses to fully appreciate. Press the key again to return to a regular view.
When using a version with controls (e.g. Figure 15.4), or the full application (e.g. Figure 15.5), specify an aspect ratio that is wider than it is tall. Start with
aspect="3:2", and perhaps fine-tune from there.
Subsection 15.4 IFrames from Servers
iFrame versions of interactives can point to a network location, presuming the endpoint is reasonably well-behaved. If you are using this sytematically, let us know and perhpas it should become a more dedicated PreTeXt construction. See Subsection 14.9 for the local file version.