Convert LaTeX hardcopy to use the exam document class#1878
Conversation
6dcef44 to
9b4a317
Compare
|
Also, R.I.P. hardcopySetHeader.pg in the theme directories -- you had a good 20-year run, but no one can even use you at this point. |
|
Out of the box, I'm getting the following error: I don't understand this error, because line 10 of |
| }{}{ | ||
| {\large \bf \{protect_underbar($courseName)\} \\ {} } | ||
| } | ||
| \ifdefined\nocolumns\firstpageheadrule\fi |
There was a problem hiding this comment.
The addition of \firstpageheadrule here seems to cause the first page to have two head rules when using the single column theme.
drgrice1
left a comment
There was a problem hiding this comment.
This pull request looks good. Just noting some changes and suggestions.
One change that I notice is that previously with the two column theme, the footer was displayed at the end of the last page. Now it is displayed in the column at the end of the last problem.
Perhaps the copyright statement should be moved into the runningfooter in the header file, and the hardcopySetFooter.pg file deprecated. This would make it so that instructors can customize that, instead of having it hardcoded. Is it really correct to have this copyright in the hardcopy as it is? The content of the exam might not really be webwork's content. It could be that the problems were created by someone else. It makes sense in html, because then you can claim ownership of the page (but necessarily all content). In hardcopy, this is not so true.
| if (defined($problemValue)) { | ||
| my $points = $problemValue == 1 ? $c->maketext('point') : $c->maketext('points'); | ||
| print $FH " {\\bf\\footnotesize($problemValue $points)}"; | ||
| print $FH "\\titledquestion{$id}[$problemValue]\n"; |
There was a problem hiding this comment.
One problem with this is that previously point amd points were translated. Now this will require foreign languages to use a custom hardcopy header file. Although there were untranslated strings in the previous header files, so that was probably already done.
There was a problem hiding this comment.
Although there were untranslated strings in the previous header files, so that was probably already done.
My thoughts exactly.
| $id = join('.', jitar_id_to_seq($id)); | ||
| } elsif ($id != 0 && $versioned) { | ||
| $id = $versioned; # this cannot be right? |
There was a problem hiding this comment.
This approach has the same translation issue as the points. Now the only way for the Problem text to be translated is via a custom hardcopy header file.
There was a problem hiding this comment.
Yeah, I couldn't make sense of this... but it still worked when creating versioned hardcopies ¯_(ツ)_/¯
I guess I should delete the comment.
|
By the way, I am not getting the option clash for the graphicx package that @pstaabp saw. |
|
I just noticed one change that I don't like. You added Edit: Note this has always occurred with the two column theme, but I don't usually use that. Edit 2: Also, this is not a big issue. I just need to override this in the problems to unset the columnseprule temporarily. That should be done anyway to make the one column and two column the same for this. |
|
Do you know why the one column theme uses an 11 point font, and the two column theme uses a 10 point font? It seems that those should be the same. This is not a change in this pull request, I have noticed this before, and wondered why it is that way. |
Yes, this is one of the minor changes that I could not quite resolve nicely. I ended up throwing in the towel on maintaining consistency. I am also on the same page with your suggestion that perhaps this is could be put in the default footer... there's a config for headers/footers to identify being on the last page. Putting it in the footer has the advantage of allowing for modification by any problem set.
That was an oversight. I was testing how similar I could get the oneColumn and twoColumn preambles... I didn't end up testing with any problems that made use of the multicols envir. This is definitely unnecessary for the oneColumn format.
Nope, but I'm sure there's a historical justification. Perhaps related to fitting problems into narrow columns? IDK, but we could standardize them to use the same font. |
|
I'm still having those same troubles. Even saving the hardcopy.tex files (as well as packages.tex, CAPA.tex, PGML.tex), removing the first line @drdrew42 you also mentioned about not using different sets of templates for one and two column formats. Can we leverage the |
|
The comment regarding the As to the onecolumn versus twocolumn issue, changing to using the geometry package ... well @drdrew42 has already done that in this pull request (well technically the paired pg pull request). @drdrew42: There is another thing that is needed for this pull request though. I noticed that you didn't update the other themes (the XeXLaTeX themes). Those will also need to be updated for this. Also, I think there are some changes to |
|
Actually, what @drdrew42 does in pg is not using the geometry package twocolumn option, but is what the geometry twocolumn option does internally. Well essentially. The geometry twocolumn option sets the \twocolumn switch for the entire document which is actually not what we want. We don't want it for the header. So @drdrew42 turns it off for that, and then back on again after the header. |
|
Precisely, it has the same effect whether or not twocolumn is set in the geometry I'll copy over the changes into the XeTeX files and make sure they work, and then tackle the check_latex script. |
|
The thing is that we need a flag to tell the tex compiler to use two column mode or not. So the twocolumn option of the geometry package doesn't change anything in regards to having the separate onecolumn and twocolumn themes. To merge the two themes we would have to inject the option into the tex output via perl code. That could be done. However, I am not sure it would go with the webwork hardcopy theming setup. The current theming setup allows much more than just changing the number of columns. Injecting the flag via code would have to be determined by a separate option, and could mess with the true theme selection capability. |
|
I successfully have this running. I had another
I'm assuming we are supporting XeTeX for the unicode/different font support. It seems like luatex/lualatex is a bit better at this now. I use lualatex a lot for doing scripting inside of latex documents. We could look into that--just to add something else to do. :) |
|
@pstaab From what I can see lualatex supports Polyglossia, https://github.com/reutenauer/polyglossia/ and it also supports babel, so I think it seems quite reasonable to assume that many/most foreign languages will work well with lualatex instead of xelatex. Both support Unicode, system fonts, etc. I would say that supporting either one to some basic extend to get some reasonable hardcopy support for Unicode characters suffices. In recent versions of WW, problem text can contain UTF-8 characters, such as special symbols and characters from non-latin languages, so it would be good if files with such characters ran smoothly for hardcopy generation. There is a thread on lualatex vs xelatex at https://www.reddit.com/r/LaTeX/comments/x9acv3/which_would_you_recommend_xelatex_or_lualatex/ and my impression is that the recommendation there is to use lualatex. I suspect that the best thing is to use by default whichever option works well for English with reasonable support for Unicode characters, and to leave sites to do fine tuning based on the option which best serves the needs of that site. If you are changing things, I would suggest dropping any attempt to support Hebrew in the standard files provided with webwork2, and just target reasonable support for Unicode characters. The xelatex support and headers were more or less proofs of concept added in #977 as we wanted to provide samples of how UTF-8 latex files could be handled. The Hebrew support was only functional to the extent that both Hebrew text, English text, and math were being typeset. Support to get the direction of each type of material to be correct was not working automatically, and at the time, I had expected problem code to manually add extra LaTeX code whenever directions changes in the hardcopy were needed. Warning: bidi support for polyglossia apparently works well only in xelatex, as the bidi package it depends really only supports xelatex. However, the "modern" babel package apparently handles bidi well with lualatex on its own. Unfortunately, hardcopy for Hebrew problems still requires "extra work" as the manual spans and divs used to get directions to work as needed in HTML will need to be matched by forcing LaTeX to swap text directions also. The main issue is handling the interleaving of input boxes and math expressions, which needs to be forced into LTR in Hebrew questions. The |
|
Note that I am seeing the same issues with two column mode. One solution is to do as I suggested and remove the exam class indentation. This can be done by adding the following to the hardcopyPreamble.tex files for the hardcopy themes. I found this at https://tex.stackexchange.com/questions/568225/changing-indentation-in-exam-class. I haven't tested it extensively, but it seems to work well with what I have tested. |
9b4a317 to
709838a
Compare
|
@drdrew42: I rebased this onto the develop branch. So make sure that you update your local clone. I am going to try to work on updating the other themes, and it helps to have the branch up to date with develop. |
Also remove the columnsep settings from one column mode, and remove the indentation for questions in all.
|
@drdrew42: I put a pull request in to your branch for this pull request that updates the XeLaTeX files, and a few other minor changes. |
…opyThemes. Also put the point message into an LTR (English) inline, so it displays properly.
taniwallach
left a comment
There was a problem hiding this comment.
I tested mainly that the xelatex option works reasonably well after the changes in drdrew42#5 and things seem OK in the Hebrew formats with those changes. I made a PR to @drgrice1 branch to make some minor fixes for the Hebrew output. With our without my small changes, I think @drgrice1's changes should be merged and then this PR should be ready to merge.
…ntinued-hebrew1 Use a Hebrew work for Problem in \qformat in the XeLaTeX-Hebrew hardcopyThemes
|
@taniwallach: I merged your pull request into mine. |
Feature/latex exam class continued
taniwallach
left a comment
There was a problem hiding this comment.
Did not test again. About points and translations - it will need to be handled by custom header files. Eventually I'll do that for Hebrew.
|
This PR removed |




Note: there is a small change required in PG paired with this PR
Description
In an attempt to further clean up and enhance the hardcopy generation feature in WeBWorK, it makes sense to use the 'exam' document class in LaTeX. I believe that there is more that can be done in terms of including solutions or incorporating student responses more clearly than is currently done -- but this initial conversion at least allows for the following:
The new defaults in
ASimpleCombinedHeaderFile.pgshould be visually consistent with the current default in WeBWorK. I have also tested to make sure that old versions of the file still compile and haven't substantively changed with regards to PDF output. Confirmation is requested.Caveats for those familiar with the exam class
This specific implementation of the exam class relies on
\titledquestionand\qformat, which does not support any iteration of\pointsinmargin. It is necessary to take this approach in order to maintain the existing functionality of sets with problem numbers that are non-sequential (either by deleting without re-sequencing, or in the case of nested problems in J-I-T sets).Unresolved Issues
The exam class makes the command
\gradetableavailable, which (when used) requirespdflatexto be run three times (something to do with building and processing the hardcopy.aux file) in order to render the table. This can be accomplished by wrapping Hardcopy.pm:L749-76 in a for-loop, but there is probably a better approach.Not an "issue" per se, but with this PR, the only difference between twoColumn and oneColumn formats is the declaration of
\newcommand{\nocolumns}{}. Do we need to continue having separate folders for one/two column formats if they differ by only one line of code?And building off of the previous point, the use of the
\gradetablewill likely need to happen in the hardcopySetFooter, which would require its own theme directory. I don't know if there's interest in building out additional hardcopy configurations options that are not folder-based.Finally, I did not address the XeLaTeX formats, though I would expect the necessary changes to be very similar.
Documentation Needs
When updating to the next release of WeBWorK, the modelCourse ought be updated with the new versions of
ASimpleCombinedHeaderFile.pgandASimpleHardcopyHeaderFile.pg, though this is not mandatory. Old header files should continue to work as is.