Difference between revisions of "Header Files and Snippets"
Line 54: | Line 54: | ||
:Variable: <code>$webworkFiles{hardcopySnippets}{postamble}</code> |
:Variable: <code>$webworkFiles{hardcopySnippets}{postamble}</code> |
||
:Default file: <code>conf/snippets/hardcopyPostamble.tex</code> |
:Default file: <code>conf/snippets/hardcopyPostamble.tex</code> |
||
+ | |||
+ | == Snippets for the "images" display mode == |
||
+ | |||
+ | The "images" display mode uses <code>dvipng</code> to generate images of mathematics. We use LaTeX to generate the DVI file that <code>dvipng</code> converts. There are two constants in <code>lib/WeBWorK/Constants.pm</code> that define the header and footer of the TeX file. |
||
+ | |||
+ | The TexPreamble goes at the beginning: |
||
+ | |||
+ | $WeBWorK::PG::ImageGenerator::TexPreamble = <<'EOF'; |
||
+ | \documentclass[12pt]{article} |
||
+ | \nonstopmode |
||
+ | \usepackage{amsmath,amsfonts,amssymb} |
||
+ | \def\gt{>} |
||
+ | \def\lt{<} |
||
+ | \usepackage[active,textmath,displaymath]{preview} |
||
+ | \begin{document} |
||
+ | EOF |
||
+ | |||
+ | and the TexPostamble goes at the end: |
||
+ | |||
+ | $WeBWorK::PG::ImageGenerator::TexPostamble = <<'EOF'; |
||
+ | \end{document} |
||
+ | EOF |
||
+ | |||
+ | If you change either of these values, you must restart Apache for changes to take effect. Use <code>apachectl graceful</code> or <code>apache2ctl graceful</code>. You cannot customize these settings on a per-course basis. |
||
[[Category:Instructors]] |
[[Category:Instructors]] |
Revision as of 23:45, 29 February 2008
WeBWorK uses several header files and other snippets in certain situations.
Header files
There are two PG header files, the set header and the hardcopy header. 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.
In current versions of WeBWorK the same file is used 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).
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.
Other snippets
Hardcopy generation also uses the following snippets, small TeX files which are included in the TeX file between dynamically-generated content. One snippet, the setFooter, is a PG file. These are set in global.conf
and can be customized there or overridden in an individual course's course.conf
file.
- preamble
- The preamble is the first thing in the TeX file.
- Variable:
$webworkFiles{hardcopySnippets}{preamble}
- Default file:
conf/snippets/hardcopyPreamble.tex
- problemDivider
- The problem divider goes between problems.
- Variable:
$webworkFiles{hardcopySnippets}{problemDivider}
- Default file:
conf/snippets/hardcopyProblemDivider.tex
- setFooter
- The set footer goes after each set. Is is a PG file.
- Variable:
$webworkFiles{hardcopySnippets}{setFooter}
- Default file:
conf/snippets/hardcopySetFooter.pg
- setDivider
- The set divider goes between sets (in multiset output).
- Variable:
$webworkFiles{hardcopySnippets}{setDivider}
- Default file:
$webworkDirs{conf}/snippets/hardcopySetDivider.tex
- userDivider
- The user divider does between users (in multiuser output).
- Variable:
$webworkFiles{hardcopySnippets}{userDivider}
- Default file:
conf/snippets/hardcopyUserDivider.tex
- postamble
- The postamble is the last thing in the TeX file.
- Variable:
$webworkFiles{hardcopySnippets}{postamble}
- Default file:
conf/snippets/hardcopyPostamble.tex
Snippets for the "images" display mode
The "images" display mode uses dvipng
to generate images of mathematics. We use LaTeX to generate the DVI file that dvipng
converts. There are two constants in lib/WeBWorK/Constants.pm
that define the header and footer of the TeX file.
The TexPreamble goes at the beginning:
$WeBWorK::PG::ImageGenerator::TexPreamble = <<'EOF'; \documentclass[12pt]{article} \nonstopmode \usepackage{amsmath,amsfonts,amssymb} \def\gt{>} \def\lt{<} \usepackage[active,textmath,displaymath]{preview} \begin{document} EOF
and the TexPostamble goes at the end:
$WeBWorK::PG::ImageGenerator::TexPostamble = <<'EOF'; \end{document} EOF
If you change either of these values, you must restart Apache for changes to take effect. Use apachectl graceful
or apache2ctl graceful
. You cannot customize these settings on a per-course basis.