From WeBWorK
Jump to: navigation, search

Prep Main Page > Web Conference 1 > Intro to WeBWorK Problems


What a WeBWorK Problem Is

A WeBWorK problem consists of two related things: database metadata, that indicate the characteristics of the problem in the WeBWorK problem set (things like the number of attempts, problem weight, etc.), which exist in the WeBWorK database, and a source file which is a text file that defines what text students see, the solution text for the problem, and the algorithmic definition of the mathematics in the problem.

Database Metadata

Database metadata are defined within WeBWorK, usually through the Set Detail editing page in the Instructor Tools in the WeBWorK interface. These data may also be imported from a set definition file to create the parameters of the set and problems in it en masse.

Source File

The source file for a WeBWorK problem is a text file written using the PG (Problem Generation) language, which is based in the scripting language Perl and allows use of TeX to typeset mathematics in the text that the student sees. A very simple example of the text of a source file for a problem is this simple problem.

We will learn what the parts of the problem are through another set of documentation.

Creating Problem Source Files

From the preceding, we note that to write our own problems we have to create the problem source text files. This is no different than editing a web page or an e-mail message: in either case there may be mark-up that determines the formatting on the page, which is equivalent to the PG code and mark-up that determine the problem and how it apears to the student. We can edit the source file for a problem on our own computer by editing it with our favorite editor (e.g., emacs, vi, Word, OpenOffice, etc.--being sure to save it as a text file with a .pg extension), or by editing it on-line in our web browser with WeBWorK's problem editor. You can get to the WeBWorK problem editor by looking at an existing problem in the Library Browser or in an existing problem set, and then clicking the "Edit" link that appears by the problem. You can also use this editor to create new problems: edit a problem, and create a copy of it to use for your new problem.

Where to Put Problem Source Files

To have a problem that you've created available for your course, it has to be in the templates directory of your course. If you create a copy of a WeBWorK problem using the problem editor, this is the location that it will be created (the [TMPL]/ prefix in the "save as" option indicates the templates directory.

If you edit a problem with an editor on your computer, the WeBWorK File Manager will allow you to add it to the templates directory of your course.

follow us