Embed compelling content in Ximera activities.

1 The graph command

The easiest way to include an interactive Desmos graph is to use the \graph command. Unfortunately, the \graph command doesn’t draw a graph in the PDF, rather, it states (in words) that a graph is produced. That is,

\[
  \graph{x^2,x^3}
\]

produces

\[ \graph {x^2,x^3} \]

in the PDF. Online, the command produces something like this:

There are a number of options concerning the function being graphed:

\graph{x^2,x^3}                     %% just x^2 and x^3
                                    %%
\graph{x^2                          %%
\left\{ 1 \leq x \leq 10 \right\}}  %% restricted domain
                                    %%
\graph{\sin(x) \left\{x<0\right\},  %%
2x \left\{ x>=0 \right\} }          %% piecewise
                                    %%
\graph{r=\theta}                    %% polar

While the code above modifies the function being graphed, there are also several options for the display of the graph.

Optional arguments for ∖graph

xmin, ymin, xmax, ymax

These set the size of the viewing window with \graph[xmin=-5,xmax=5,ymin=-5,ymax=5]{y=x^2}.

panel

Determines if the panel is shown with \graph[panel]{y=x^2}.

xAxisLabel, yAxisLabel

Gives the axes labels with \graph[xAxisLabel="time", yAxisLabel="distance"]{y=x^2}.

hideXAxis, hideYAxis

Hides the axes with \graph[hideXAxis=true, hideYAxis=true]{x^2}.

hideXAxisNumbers=true, hideYAxisNumbers=true

Hides the tick marks on the axes with \graph[hideXAxisNumbers=true, hideYAxisNumbers=true]{y=x^2}.

polar

Shows polar grid lines with \graph[polar]{y=x^2}.

\[ \graph {x^2 \left \{ 1 \leq x \leq 10 \right \}} \graph { \sin (x)\left \{x<0\right \}, 2x\left \{ x>=0 \right \} } \]

2 Desmos, Desmos 3D, and GeoGebra

If you require further features from Desmos, you can sign up for an account and include your worksheets using the syntax \desmos{ID}{width}{height}, where ID is the widget ID and width and height are the dimensions (in pixels) you want the embedded widget to have.

\begin{center}
\desmos{zwywds7med}{800}{600}
\end{center}

which renders as:

The syntax for Desmos 3D is similar. Use \desmosThreeD{ID}{width}{height}, where ID is the widget ID and width and height are the dimensions (in pixels) you want the embedded widget to have.

\begin{center}
\desmosThreeD{bb4exrhrl3}{800}{600}
\end{center}

Seen here:

You can also use GeoGebra. Embed the widget using the syntax \geogebra{ID}{width}{height}, where ID is the widget ID and width and height are the dimensions (in pixels) you want the embedded widget to have.

\begin{center}
\geogebra{XC3FXUdJ}{800}{600}
\end{center}

While we cannot get data from these sorts of interactives directly, the clever author can ask questions that use the interactive to find a solution.

2024-12-20 17:22:05