WeBWorK Main Forum

Correct answer in hardcopy does not linebreak

Correct answer in hardcopy does not linebreak

by Björn Bergstrand -
Number of replies: 2
When generating a hardcopy with correct answers, if the answer is too long it will either spill over to the next column (and render the correct answer there unreadable) or simply dissapear over the right end of the page.

I've not looked much deeper into this, but maybe someone has a quick fix for this? Is this a known issue?

Regards
Björn
In reply to Björn Bergstrand

Re: Correct answer in hardcopy does not linebreak

by Arnold Pizer -
Hi,

LaTeX controls the line breaking, so finding a general solution is probably not that easy.

One easy thing to do would be to switch to one column mode for hardcopy output if these long lines are really a problem. If you want to do this for the whole WeBWorK system, edit the files hardcopyPreamble.tex and hardcopyPostamble.tex (in .../webwork2/conf/snippets/) commenting out \begin{multicols}{2} and \end{multicols}. If you only want to do this for one course, copy these fies, edit them, put them someplace (e.g. the course's templates directory) and then edit the course.conf file adding the correct analogue of the lines

$webworkFiles{hardcopySnippets}{preamble} = "$webworkDirs{conf}/snippets/hardcopyPreamble.tex";

and

$webworkFiles{hardcopySnippets}{postamble} = "$webworkDirs{conf}/snippets/hardcopyPostamble.tex";

An ugly way to do the same thing might be to edit the first problem in a set adding $BEGIN_ONE_COLUMN and editing the last problem adding $END_ONE_COLUMN (see http://webwork.maa.org/wiki/Display_Macros).

Others may have better ideas.

Arnie

In reply to Arnold Pizer

Re: Correct answer in hardcopy does not linebreak

by Paul Pearson -
Hi,

I'm guessing that the answers are typeset using \verb in latex. What if we used \texttt{} instead? Another possibility would be the listings package for latex. Here are even more possibilities:

http://stackoverflow.com/questions/510961/long-lines-in-latex
http://stackoverflow.com/questions/4768694/word-wrap-in-verbatim-environments

Best regards,

Paul Pearson