# Integrating WeBWorK into Textbooks: Sample Exercises

## Section1.8Graphics in Exercises

It is natural for exercises to have graphics. For example, an exercise might produce a graph of some kind, and ask the reader to extract some information from that graph.
If your WeBWorK server is version 2.16 or later, WeBWorK problems can process <latex-image> code. Here is an example.

### Checkpoint1.8.1.A static <latex-image> graph.

This image is a visual proof that $$\sum_{k=1}^{n}k$$ equals what?
$$\mathop{\rm C}\nolimits\!\left(n+1,2\right)\hbox{ or }\frac{\left(n+1\right)n}{2}$$

### Checkpoint1.8.2.A randomized <latex-image> graph.

These images may depend on the random seed. In this problem, the height and width of the rectangle are randomized.
Find the area of the rectangle.
$$48\ {\rm cm^{2}}$$

### Checkpoint1.8.3.A <latex-image> graph affected by <latex-image-preamble>.

This sample chapterâ€™s <docinfo> has a <latex-image-preamble>. This exercise has graph styling that is affected by that.
What are the roots of this polynomial?
$$-3, 0, 3$$

### Checkpoint1.8.4.Special characters.

This exercise is to test that special characters behave.
The code below has a printed dollar sign, a printed percent sign, a printed at sign, and a percent sign used as a comment marker.
An older mechanism for creating images is supported and demonstrated here.

### Checkpoint1.8.5.Solve using a graph.

The graph below is a graph of $$y=f(x)\text{.}$$ Use the graph to solve the equation $$f(x)=1\text{.}$$
$$\left\{1\right\}$$
Solution.
The graph reveals that the solution set to $$f(x)=1$$ is $${\left\{1\right\}}\text{.}$$

### ExercisesExercises

#### Exercise Group.

This exercisegroup has a <latex-image> image in its introduction. In standalone versions of the exercise, this image should be repeated.
##### 1.
Find $$D$$ when $$L=4$$ and $$W=3\text{.}$$
$$5$$
Find $$D$$ when $$L=12$$ and $$W=5\text{.}$$
$$13$$