Header Files More Information
There are two PG header files, the set header and the hardcopy header which give information about each individual assignment. The set header is displayed on the homework set screen to the right of the problem list. The hardcopy header is included in hardcopy output at the start of the problem set.
See Site Info, Login Info, Course Info for information on the somewhat related customizable files which are used to display information for the whole WeBWorK site, on a course login page and on a course front page.
In current versions of WeBWorK the default is to use the same file for both headers, webwork2/conf/snippets/setHeader.pg
. This file is designed so that is renders in both HTML-based display modes (when used onscreen) and TeX mode (when used in hardcopy). However, some people prefer to use separate files since the information given, while often similar, is usually different (e.g. you probably want to list the Student Name on the hardcopy output, but not onscreen) and the output formats are different. Also while some people are happy using the default headers that come with the WeBWorK system, most will want to write either a default header to use with all their assignments or to write different headers for each assignment. We explain these options below.
Contents
Simple Sample Header Files
In the templates directory of each course the are three sample header files, ASimpleCombinedHeaderFile.pg, ASimpleHardCopyHeaderFile.pg and ASimpleScreenHeaderFile.pg. The default file webwork2/conf/snippets/setHeader.pg
is similar to, but not identical, to ASimpleCombinedHeaderFile.pg. These are usable as is and hopefully it is clear from their names what they are used for. In addition there are header files for the Orientation set and other sets. All these files can be used as samples when creating your own. To see and edit them, go to the Hmwk Set Editor and click the number of problems to the right of the homework set name (or alternately, click the pencil and then click the set name under Edit All Set Data). The first item in the listing of possible header files is Use Default Header File. This is the header file which will be used if no other header file is selected
Default Header File
The Default Header Files are defined in the global.conf
file. Usually global.conf
is found in the /opt/webwork/webwork2/conf
directory. This file is only editable by a WeBWorK administrator. The relevant pieces of code in global.conf
are:
# The setHeader preceeds each set in hardcopy output. It is a PG file. # This is the default file which is used if a specific files is not selected $webworkFiles{hardcopySnippets}{setHeader} = "$webworkDirs{conf}/snippets/setHeader.pg"; # hardcopySetHeader.pg", #$webworkFiles{hardcopySnippets}{setHeader} = "$courseDirs{templates}/ASimpleHardCopyHeaderFile.pg"; # An alternate default header file
and
# The set header is displayed on the problem set page. It is a PG file. # This is the default file which is used if a specific files is not selected $webworkFiles{screenSnippets}{setHeader} = "$webworkDirs{conf}/snippets/setHeader.pg"; # screenSetHeader.pg" #$webworkFiles{screenSnippets}{setHeader} = "$courseDirs{templates}/ASimpleScreenHeaderFile.pg"; # An alternate default header file
If your WeBWorK administrator wants to make it relatively easy for all instructors to create their own default header files, all he or she has to do is to comment out the third lines above and uncomment the forth lines. If they prefer to do this, but make ASimpleCombinedHeaderFile.pg the default, they should comment out the third lines above and then add the lines
$webworkFiles{hardcopySnippets}{setHeader} = "$courseDirs{templates}/ASimpleCombinedHeaderFile.pg"; $webworkFiles{screenSnippets}{setHeader} = "$courseDirs{templates}/ASimpleCombinedHeaderFile.pg";
in the appropriate locations. If your WeBWorK administrator does not want to make this change, instructors can do the equivalent thing for their own course by editing the course.conf
file.
Editing the course.conf File
To edit the course.conf
file, go to the File Manager, click the "^" at the top to move up one level in the directory structure from the templates directory to your course directory, then select course.conf
and click Edit. At the bottom of the file add the two lines
$webworkFiles{hardcopySnippets}{setHeader} = "$courseDirs{templates}/ASimpleHardCopyHeaderFile.pg"; $webworkFiles{screenSnippets}{setHeader} = "$courseDirs{templates}/ASimpleScreenHeaderFile.pg";
or, if you want to use the same file for both headers,
$webworkFiles{hardcopySnippets}{setHeader} = "$courseDirs{templates}/ASimpleCombinedHeaderFile.pg"; $webworkFiles{screenSnippets}{setHeader} = "$courseDirs{templates}/ASimpleCombinedHeaderFile.pg";
Then click 'Save'.
Editing the sample default header files
There are several ways to edit the default header files. To edit ASimpleHardCopyHeaderFile.pg
, you can use the File Manager as above, or
Either header file can be overridden on a per-homework set basis. To do so, go to the Hmwk Set Editor and click the number of problems to the right of the homework set name.
These two configuration variables control the site-wide defaults:
- hardcopy header
- Variable:
$webworkFiles{hardcopySnippets}{setHeader}
- Default file:
conf/snippets/setHeader.pg
- set header
- Variable:
$webworkFiles{screenSnippets}{setHeader}
- Default file:
conf/snippets/setHeader.pg
You can change the values of these variables in global.conf
or override them in course.conf
for a particular course.