Difference between revisions of "Header Files and Snippets"
Alex Jordan (talk | contribs) |
|||
(8 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
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. |
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. |
||
+ | |||
+ | See [[Site Info, Login Info, Course Info]] for information on 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 same file is used for both headers, <code>webwork2/conf/snippets/setHeader.pg</code>. This file is designed so that is renders in both HTML-based display modes (when used onscreen) and TeX mode (when used in hardcopy). |
In current versions of WeBWorK the same file is used for both headers, <code>webwork2/conf/snippets/setHeader.pg</code>. This file is designed so that is renders in both HTML-based display modes (when used onscreen) and TeX mode (when used in hardcopy). |
||
Line 11: | Line 14: | ||
These two configuration variables control the site-wide defaults: |
These two configuration variables control the site-wide defaults: |
||
− | * <code>$webworkFiles{hardcopySnippets}{setHeader}</code> |
||
+ | ;hardcopy header |
||
− | + | :Variable: <code>$webworkFiles{hardcopySnippets}{setHeader}</code> |
|
+ | :Default file: <code>conf/snippets/setHeader.pg</code> |
||
+ | |||
+ | ;set header |
||
+ | :Variable: <code>$webworkFiles{screenSnippets}{setHeader}</code> |
||
+ | :Default file: <code>conf/snippets/setHeader.pg</code> |
||
You can change the values of these variables in <code>global.conf</code> or override them in <code>course.conf</code> for a particular course. |
You can change the values of these variables in <code>global.conf</code> or override them in <code>course.conf</code> for a particular course. |
||
− | == Other snippets == |
||
+ | For more information of header files, see [[Header Files More Information]]. |
||
+ | |||
+ | == Hardcopy snippets == |
||
+ | |||
+ | The information below pertains to WeBWorK 2.17 and some earlier versions. For 2.18 (and beyond), see [[Hardcopy Themes]]. |
||
+ | |||
+ | 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 <code>global.conf</code> and can be customized there or overridden in an individual course's <code>course.conf</code> file. |
||
+ | |||
+ | ;preamble |
||
+ | :The preamble is the first thing in the TeX file. |
||
+ | :Variable: <code>$webworkFiles{hardcopySnippets}{preamble}</code> |
||
+ | :Default file: <code>conf/snippets/hardcopyPreamble.tex</code> |
||
+ | |||
+ | ;problemDivider |
||
+ | :The problem divider goes between problems. |
||
+ | :Variable: <code>$webworkFiles{hardcopySnippets}{problemDivider}</code> |
||
+ | :Default file: <code>conf/snippets/hardcopyProblemDivider.tex</code> |
||
+ | |||
+ | ;setFooter |
||
+ | :The set footer goes after each set. Is is a PG file. |
||
+ | :Variable: <code>$webworkFiles{hardcopySnippets}{setFooter}</code> |
||
+ | :Default file: <code>conf/snippets/hardcopySetFooter.pg</code> |
||
+ | |||
+ | ;setDivider |
||
+ | :The set divider goes between sets (in multiset output). |
||
+ | :Variable: <code>$webworkFiles{hardcopySnippets}{setDivider}</code> |
||
+ | :Default file: <code>$webworkDirs{conf}/snippets/hardcopySetDivider.tex</code> |
||
+ | |||
+ | ;userDivider |
||
+ | :The user divider does between users (in multiuser output). |
||
+ | :Variable: <code>$webworkFiles{hardcopySnippets}{userDivider}</code> |
||
+ | :Default file: <code>conf/snippets/hardcopyUserDivider.tex</code> |
||
+ | |||
+ | ;postamble |
||
+ | :The postamble is the last thing in the TeX file. |
||
+ | :Variable: <code>$webworkFiles{hardcopySnippets}{postamble}</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: |
||
− | 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. |
||
+ | $WeBWorK::PG::ImageGenerator::TexPostamble = <<'EOF'; |
||
+ | \end{document} |
||
+ | EOF |
||
− | {|border="1" |
||
+ | 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. |
||
− | ! Name |
||
− | ! Description |
||
− | |- |
||
− | !colspan="2"| Default in <code>global.conf</code> |
||
− | |- |
||
− | | preamble |
||
− | | The preamble is the first thing in the TeX file. |
||
− | |- |
||
− | |colspan="2"| $webworkFiles{hardcopySnippets}{preamble} = "$webworkDirs{conf}/snippets/hardcopyPreamble.tex"; |
||
− | |- |
||
− | | problemDivider |
||
− | | The problem divider goes between problems. |
||
− | |- |
||
− | |colspan="2"| $webworkFiles{hardcopySnippets}{problemDivider} = "$webworkDirs{conf}/snippets/hardcopyProblemDivider.tex"; |
||
− | |- |
||
− | | setFooter |
||
− | | The set footer goes after each set. Is is a PG file. |
||
− | |- |
||
− | |colspan="2"| $webworkFiles{hardcopySnippets}{setFooter} = "$webworkDirs{conf}/snippets/hardcopySetFooter.pg"; |
||
− | |- |
||
− | | setDivider |
||
− | | The set divider goes between sets (in multiset output). |
||
− | |- |
||
− | |colspan="2"| $webworkFiles{hardcopySnippets}{setDivider} = "$webworkDirs{conf}/snippets/hardcopySetDivider.tex"; |
||
− | |- |
||
− | | userDivider |
||
− | | The user divider does between users (in multiuser output). |
||
− | |- |
||
− | |colspan="2"| $webworkFiles{hardcopySnippets}{userDivider} = "$webworkDirs{conf}/snippets/hardcopyUserDivider.tex"; |
||
− | |- |
||
− | | postamble |
||
− | | The postabmle is the last thing in the TeX file. |
||
− | |- |
||
− | |colspan="2"| |
||
− | $webworkFiles{hardcopySnippets}{postamble} = "$webworkDirs{conf}/snippets/hardcopyPostamble.tex"; |
||
− | |} |
||
[[Category:Instructors]] |
[[Category:Instructors]] |
Latest revision as of 03:44, 18 August 2023
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.
See Site Info, Login Info, Course Info for information on 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 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.
For more information of header files, see Header Files More Information.
Hardcopy snippets
The information below pertains to WeBWorK 2.17 and some earlier versions. For 2.18 (and beyond), see Hardcopy Themes.
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.