-
-
Notifications
You must be signed in to change notification settings - Fork 166
refactor hardcopy themes #2099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
drgrice1
merged 20 commits into
openwebwork:WeBWorK-2.18
from
Alex-Jordan:hardcopy-themes
Jul 20, 2023
Merged
refactor hardcopy themes #2099
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
d52d593
refactor hardcopy themes
Alex-Jordan 3857daa
Merge branch 'WeBWorK-2.18' into hardcopy-themes
Alex-Jordan a7e0a0c
Merge branch 'WeBWorK-2.18' into hardcopy-themes
Alex-Jordan 82c4b4e
make all course harddcopy themes effectively enabled; enabling only a…
Alex-Jordan 8e671a0
Update conf/defaults.config
Alex-Jordan d92bb2f
changes suggested in PR#2099
Alex-Jordan 7101611
Update templates/ContentGenerator/Instructor/PGProblemEditor/hardcopy…
Alex-Jordan 52a7a7f
perltidy
Alex-Jordan 19e124f
Merge branch 'hardcopy-themes' of https://github.com/Alex-Jordan/webw…
Alex-Jordan 6ce9993
typo
Alex-Jordan 8efa759
initialize hardcopyLabels
001a777
Fix some issues that have cropped up if a user attempts to access the
drgrice1 4b8d45c
Merge pull request #19 from drgrice1/editor-no-permissions
Alex-Jordan 74cee19
use maketext
Alex-Jordan 2ff0434
change tex header content macro names
Alex-Jordan 0807e20
remove \webworkPageNumber
Alex-Jordan 233a732
make themes use \webwork(Left|Center|Right)Header and use '#' for emp…
Alex-Jordan 89f50d0
changes to hardcopy headers and footers
Alex-Jordan ab4ab92
Merge branch 'WeBWorK-2.18' into hardcopy-themes
Alex-Jordan b2430ce
move multicol into pg.sty
Alex-Jordan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,6 @@ logs/* | |
| conf/* | ||
| !conf/*.dist* | ||
| !conf/*.config | ||
| !conf/snippets | ||
|
|
||
| node_modules | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| # Hardcopy Themes | ||
|
|
||
| A hardcopy theme is an XML file with root `<theme>`. The `<theme>` element has an attirubute `label` that is used to | ||
| define a label for the theme, for example, `label="Empty"`. It has children: | ||
|
|
||
| * `<description>` | ||
| * `<preamble>` | ||
| * `<presetheader>` | ||
| * `<postsetheader>` | ||
| * `<problemheader>` | ||
| * `<problemfooter>` | ||
| * `<problemdivider>` | ||
| * `<setfooter>` | ||
| * `<setdivider>` | ||
| * `<userdivider>` | ||
| * `<postamble>` | ||
|
|
||
| The `<description>` element contains a simple text description of the theme. All other elements contain text snippets | ||
| that will be inserted into a `.tex` file. | ||
|
|
||
| The `<preamble>` and `<postamble>` wrap the file. Note that `webwork2` will write `\batchmode` to the `.tex` file even | ||
| before `<preamble>` is written. The `<preamble>` must include `\usepackage{webwork2}` to load `webwork2.sty` for many | ||
| things to work. | ||
|
|
||
| Next `webwork2` will loop through users (often just one) and loop through problem sets (often just one) and write TeX | ||
| for all combinations. `<userdivider>` and `<setdivider>` are snippets of TeX that are inserted when transitioning to a | ||
| new user or a new set. Typically these should just start a new page and reset page numbering. | ||
|
|
||
| When an individual user-set is being processed, first the `<presetheader>` snippet will be used. Then the PG header | ||
| file will be processed. Then the `<postsetheader>` snippet will be used. At the end of the set `webwork2` attempts to | ||
| make the last page display a copyright claim. Then the `<setfooter>` snippet is used. | ||
|
|
||
| Each problem is wrapped in `<problemheader>` and `<problemfooter>`, and `<problemdivider>` is used between adjacent | ||
| problems. | ||
|
|
||
| ## Packages | ||
|
|
||
| A theme preamble can load packages, but as soon as it loads `webwork2`, it is already loading `path`, `listings`, | ||
| `hyperref`, and `ifthen`. So you can use tools from these packages without loading them in your theme. | ||
|
|
||
| Also `webwork2` loads `pg.sty` from the `pg` distribution. This loads `amsmath`, `amsfonts`, `amssymb`, `booktabs`, | ||
| `tabularx`, `colortbl`, `caption`, `xcolor`, `multicol`, `mhchem`, and `graphicx`. So again you can use tools from | ||
| these packages without loading them in your theme. | ||
|
|
||
| ## Macros | ||
|
|
||
| The following macros are provided by the `webwork2` package. They may be empty, but `webwork2` should populate them | ||
| with appropriate values as the `.tex` file is built. So you can use these when building your theme. | ||
|
|
||
| * `\webworkCourseName` | ||
| * `\webworkCourseTitle` | ||
| * `\webworkCourseURL` | ||
| * `\webworkUserId` (the user's username) | ||
| * `\webworkStudentId` (the user's Student ID) | ||
| * `\webworkFirstName` | ||
| * `\webworkLastName` | ||
| * `\webworkEmailAddress` | ||
| * `\webworkSection` | ||
| * `\webworkRecitation` | ||
| * `\webworkSetId` (the actual name of the set which may have underscores) | ||
| * `\webworkPrettySetId` (a version where underscores have been converted to spaces) | ||
| * `\webworkDescription` | ||
| * `\webworkOpenDate` | ||
| * `\webworkReducedScoringDate` | ||
| * `\webworkDueDate` | ||
| * `\webworkAnswerDate` | ||
| * `\webworkProblemNumber` (the number of the problem in the set) | ||
| * `\webworkProblemId` (may differ from the problem number for a versioned test with randomized order) | ||
| * `\webworkProblemWeight` | ||
| * `\webworkLeftHeader` (a multiline expression with the set name and due date(s)) | ||
| * `\webworkCenterHeader` (empty by default) | ||
| * `\webworkRightHeader` (a multiline expression with the user's name, ID, section, and recitation) | ||
| * `\webworkLeftFooter` (a hyperlink to the course with text the course title) | ||
| * `\webworkCenterFooter` (empty by default) | ||
| * `\webworkRightFooter` (localized "Page" followed by the page number) | ||
|
|
||
| Words and phrases might be localized automatically by `webwork2` in the future, but a theme can override these. | ||
|
|
||
| * `\webworkLocalizeAssignment` | ||
| * `\webworkLocalizeSet` | ||
| * `\webworkLocalizeProblem` | ||
| * `\webworkLocalizeUsername` | ||
| * `\webworkLocalizeFullCreditBy` | ||
| * `\webworkLocalizeCloses` | ||
| * `\webworkLocalizeSection` | ||
| * `\webworkLocalizeRecitation` | ||
| * `\webworkLocalizePage` | ||
| * `\webworkLocalizePoint` | ||
|
|
||
| ## Config | ||
|
|
||
| Theme files belong in `webwork2/assets/hardcopyThemes` or in a course's `templates/hardcopyThemes` folder. Both of | ||
| these paths can be configured in `localOverrides.conf`, following the initialization in `defaults.config`. If a theme | ||
| in `templates/hardcopyThemes` has the same filename as a theme in `webwork2/assets/hardcopyThemes`, the one from | ||
| `templates/hardcopyThemes` will be used. | ||
|
|
||
Alex-Jordan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| A course will "see" all the theme files in these locations and make them available to be enabled in Course Config. | ||
| Only the enabled themes will be offered for use when producing a hardcopy. | ||
|
|
||
| In addition to enabling themes in Course Config, you can also set the default hardcopy theme for regular hardcopy | ||
| production, and separately set a default hardcopy theme for use by the PG Editor. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <theme label="Basic"> | ||
|
|
||
| <description> | ||
| This theme produces hardcopies with minimal page headers displaying the set | ||
| title and useername, and minimal problem numbering. | ||
| </description> | ||
|
|
||
| <preamble> | ||
| \documentclass{article} | ||
| \usepackage{webwork2} | ||
| \usepackage[text={6in,9in},centering]{geometry} | ||
| \usepackage{fancyhdr} | ||
| \renewcommand{\webworkLeftHeader}{% | ||
| \ifthenelse{\equal{\webworkPrettySetId}{}}{}{\ifthenelse{\thepage=1}{\large\scshape\webworkLocalizeSet: \webworkPrettySetId}{}}% | ||
| } | ||
| \renewcommand{\webworkRightHeader}{% | ||
| \ifthenelse{\equal{\webworkUserId}{}}{}{\ifthenelse{\thepage=1}{\bfseries\webworkLocalizeUsername: \webworkUserId}{}}% | ||
| } | ||
| \parindent=0pt | ||
| \pagestyle{fancy} | ||
| \begin{document} | ||
| </preamble> | ||
|
|
||
| <presetheader> | ||
| \renewcommand{\headrulewidth}{0pt} | ||
| \fancyhead[L]{\webworkLeftHeader} | ||
| \fancyhead[C]{\webworkCenterHeader} | ||
| \fancyhead[R]{\webworkRightHeader} | ||
| \fancyfoot[L]{\webworkLeftFooter} | ||
| \fancyfoot[C]{\webworkCenterFooter} | ||
| \fancyfoot[R]{\webworkRightFooter} | ||
| </presetheader> | ||
|
|
||
| <postsetheader> | ||
| \bigskip | ||
| </postsetheader> | ||
|
|
||
| <problemheader> | ||
| {\bfseries\webworkLocalizeProblem~\ifthenelse{\equal{\webworkProblemNumber}{}}{\#}{\webworkProblemNumber}} | ||
| \nobreak | ||
| \smallskip | ||
| </problemheader> | ||
|
|
||
| <problemfooter></problemfooter> | ||
|
|
||
| <problemdivider> | ||
| \vspace{2pc+6pc-1pc} | ||
| \goodbreak | ||
| </problemdivider> | ||
|
|
||
| <setfooter> | ||
| </setfooter> | ||
|
|
||
| <setdivider> | ||
| \newpage | ||
| \setcounter{page}{1} | ||
| </setdivider> | ||
|
|
||
| <userdivider> | ||
| \newpage | ||
| \setcounter{page}{1} | ||
| </userdivider> | ||
|
|
||
| <postamble> | ||
| \end{document} | ||
| </postamble> | ||
|
|
||
| </theme> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <theme label="Basic—Two Column"> | ||
|
|
||
| <description> | ||
| This theme produces hardcopies with minimal page headers displaying the set | ||
| title and useername, and minimal problem numbering. With two columns. | ||
| </description> | ||
|
|
||
| <preamble> | ||
| \documentclass{article} | ||
| \usepackage{webwork2} | ||
| \usepackage[text={6in,9in},centering]{geometry} | ||
| \setlength{\columnsep}{.25in} | ||
| \setlength{\columnseprule}{.4pt} | ||
| \usepackage{fancyhdr} | ||
| \renewcommand{\webworkLeftHeader}{% | ||
| \ifthenelse{\equal{\webworkPrettySetId}{}}{}{\ifthenelse{\thepage=1}{\large\scshape\webworkLocalizeSet: \webworkPrettySetId}{}}% | ||
| } | ||
| \renewcommand{\webworkRightHeader}{% | ||
| \ifthenelse{\equal{\webworkUserId}{}}{}{\ifthenelse{\thepage=1}{\bfseries\webworkLocalizeUsername: \webworkUserId}{}}% | ||
| } | ||
| \parindent=0pt | ||
| \pagestyle{fancy} | ||
| \begin{document} | ||
| </preamble> | ||
|
|
||
| <presetheader> | ||
| \renewcommand{\headrulewidth}{0pt} | ||
| \fancyhead[L]{\webworkLeftHeader} | ||
| \fancyhead[C]{\webworkCenterHeader} | ||
| \fancyhead[R]{\webworkRightHeader} | ||
| \fancyfoot[L]{\webworkLeftFooter} | ||
| \fancyfoot[C]{\webworkCenterFooter} | ||
| \fancyfoot[R]{\webworkRightFooter} | ||
| </presetheader> | ||
|
|
||
| <postsetheader> | ||
| \bigskip | ||
| \begin{multicols*}{2} | ||
| </postsetheader> | ||
|
|
||
| <problemheader> | ||
| {\bfseries\webworkLocalizeProblem~\ifthenelse{\equal{\webworkProblemNumber}{}}{\#}{\webworkProblemNumber}} | ||
| \nobreak | ||
| \smallskip | ||
| </problemheader> | ||
|
|
||
| <problemfooter></problemfooter> | ||
|
|
||
| <problemdivider> | ||
| \vspace{2pc+6pc-1pc} | ||
| \goodbreak | ||
| </problemdivider> | ||
|
|
||
| <setfooter> | ||
| \end{multicols*} | ||
| </setfooter> | ||
|
|
||
| <setdivider> | ||
| \newpage | ||
| \setcounter{page}{1} | ||
| </setdivider> | ||
|
|
||
| <userdivider> | ||
| \newpage | ||
| \setcounter{page}{1} | ||
| </userdivider> | ||
|
|
||
| <postamble> | ||
| \end{document} | ||
| </postamble> | ||
|
|
||
| </theme> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <theme label="Boxed"> | ||
|
|
||
| <description> | ||
| This theme uses the tcolorbox package to put each exercisee in a box. | ||
| </description> | ||
|
|
||
| <preamble> | ||
| \documentclass[11pt]{article} | ||
| \usepackage{webwork2} | ||
| \usepackage[text={7in,9in},centering]{geometry} | ||
| \usepackage{tcolorbox} | ||
| \tcbuselibrary{breakable, skins} | ||
| \newtcolorbox{webworkexercise}[2]{ | ||
| breakable, | ||
| enhanced jigsaw, | ||
| title={ | ||
| {\bfseries\webworkLocalizeProblem~\ifthenelse{\equal{#1}{}}{\#}{#1}}\hfill | ||
| (\ifthenelse{\equal{#2}{}}{\#}{#2}~\webworkLocalizePoint) | ||
| } | ||
| } | ||
| \usepackage{fancyhdr} | ||
| \parindent=0pt | ||
| \setlength{\parskip}{1pc} | ||
| \pagestyle{fancy} | ||
| \begin{document} | ||
| </preamble> | ||
|
|
||
| <presetheader> | ||
| \renewcommand{\headrulewidth}{0pt} | ||
| \fancyhead[L]{\webworkLeftHeader} | ||
| \fancyhead[C]{\webworkCenterHeader} | ||
| \fancyhead[R]{\webworkRightHeader} | ||
| \fancyfoot[L]{\webworkLeftFooter} | ||
| \fancyfoot[C]{\webworkCenterFooter} | ||
| \fancyfoot[R]{\webworkRightFooter} | ||
| </presetheader> | ||
|
|
||
| <postsetheader> | ||
| \medskip | ||
| </postsetheader> | ||
|
|
||
| <problemheader>% | ||
| \begin{webworkexercise}{\webworkProblemNumber}{\webworkProblemWeight}% | ||
| </problemheader> | ||
|
|
||
| <problemfooter>% | ||
| \end{webworkexercise}% | ||
| </problemfooter> | ||
|
|
||
| <problemdivider> | ||
| \smallskip | ||
| \goodbreak | ||
| </problemdivider> | ||
|
|
||
| <setfooter></setfooter> | ||
|
|
||
| <setdivider> | ||
| \newpage% | ||
| \setcounter{page}{1}% | ||
| </setdivider> | ||
|
|
||
| <userdivider> | ||
| \newpage% | ||
| \setcounter{page}{1}% | ||
| </userdivider> | ||
|
|
||
| <postamble> | ||
| \end{document} | ||
| </postamble> | ||
|
|
||
| </theme> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <theme label="Boxed—Rows"> | ||
|
|
||
| <description> | ||
| This theme uses the tcolorbox package to put each exercisee in a box. | ||
| Exercises progress row-major instead of the usual column-major, in two columns. | ||
| Exerecises in this theme will not break across pages, so this theme is better | ||
| suited for sets with short exercises. | ||
| </description> | ||
|
|
||
| <preamble> | ||
| \documentclass[10pt]{article} | ||
| \usepackage{webwork2} | ||
| \usepackage[text={7.5in,9in},centering]{geometry} | ||
| \usepackage{tcolorbox} | ||
| \tcbuselibrary{raster} | ||
| \newtcolorbox{webworkexercise}[2]{ | ||
| title={ | ||
| {\bfseries\webworkLocalizeProblem~\ifthenelse{\equal{#1}{}}{\#}{#1}}\hfill | ||
| (\ifthenelse{\equal{#2}{}}{\#}{#2}~\webworkLocalizePoint) | ||
| }, | ||
| } | ||
|
|
||
| \usepackage{fancyhdr} | ||
| \parindent=0pt | ||
| \setlength{\parskip}{1pc} | ||
| \pagestyle{fancy} | ||
| \begin{document} | ||
| </preamble> | ||
|
|
||
| <presetheader> | ||
| \renewcommand{\headrulewidth}{0pt} | ||
| \fancyhead[L]{\webworkLeftHeader} | ||
| \fancyhead[C]{\webworkCenterHeader} | ||
| \fancyhead[R]{\webworkRightHeader} | ||
| \fancyfoot[L]{\webworkLeftFooter} | ||
| \fancyfoot[C]{\webworkCenterFooter} | ||
| \fancyfoot[R]{\webworkRightFooter} | ||
| </presetheader> | ||
|
|
||
| <presetheader> | ||
| \bigskip | ||
| \begin{tcbraster}[raster columns=2, raster valign=top] | ||
| </presetheader> | ||
|
|
||
| <problemheader>\begin{webworkexercise}{\webworkProblemNumber}{\webworkProblemWeight}%</problemheader> | ||
|
|
||
| <problemfooter>\end{webworkexercise}</problemfooter> | ||
|
|
||
| <problemdivider></problemdivider> | ||
|
|
||
| <setfooter>\end{tcbraster}</setfooter> | ||
|
|
||
| <setdivider> | ||
| \newpage% | ||
| \setcounter{page}{1}% | ||
| </setdivider> | ||
|
|
||
| <userdivider> | ||
| \newpage% | ||
| \setcounter{page}{1}% | ||
| </userdivider> | ||
|
|
||
| <postamble> | ||
| \end{document} | ||
| </postamble> | ||
|
|
||
| </theme> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.