WeBWorK Problems

global config file + overriding two-column in hard copies

Re: global config file + overriding two-column in hard copies

by John Jones -
Number of replies: 0
Hi,

I do not know of a way of having a header file which is read in for latex for both web page generation and hardcopy.  I could imagine creating such a thing, but there is a mechanism in webwork which would effectively do the same thing.

In each file where this comes into play (or possibly just all of the problems you are creating), add a line like "cyclicgroup.pl" to the loadMacros section.  Then, create the file cyclicgroup.pl which defines not a pg macro, like

$C = "C_";

Of course, you could call it $cyclicgroup instead.  I am just a lazy typist.

You could have alternatives commented out, like

# $C = "\\mathbb{Z}_";
# $C = "Z_";

and even

$Cn = "$C n"; #note the space on the RHS

Then, in the problems (in math mode), $C 5, $C {55} and $Cn should do what you want (admittedly, I have not tested this), and change based on what lines are commented/uncommented in the macro file.

When problems to into the OPL, they can have a corresponding macros directory for defining macros they use.  A site (or a course) can override them by making a copy in their course (or site) directory with whichever customization they want.

The main disadvantage of doing it through a pg macro instead of a latex macro is that it may seem awkward.  In latex, \C5 (without a space) would work (because digits are not allowed in tex macro names), but $C5 is a legal perl variable name, so you need a space or braces to separate the C from the 5.

I haven't tested this, but on wide problems, what if you put the $BEGIN_ONE_COLUMN and $END_ONE_COLUMN commands in the problem, and use your tex header files.  If it comes out as you like, then the best approach is to put the BEGIN/END_ONE_COLUMN commands in.  It would then allow you to get hardcopy the way you like, but if others don't mind the one/two column switch, they can just use your problems without worrying about special header files.

John