WeBWorK Problems

global config file + overriding two-column in hard copies

global config file + overriding two-column in hard copies

by Siman Wong -
Number of replies: 1
My student and I are developing problem sets for an undergraduate-level abstract algebra course (e.g. groups, rings, fields). While preparing these problems for submission to the NPL we run into
two issues, concerning
(1) creating a local config file for (tex) notations, and
(2) overriding the two-column format for hard copies.
We appreciate you advice on how to resolve them.

(1) Different instructors/texts have their own notations for e.g.
finite cycle groups of order n: some use Z_n, others use C_n. We
want to allow instructors who choose their own notations globally for
the entire course (i.e. as oppose to making changes one problem at a
time). We have in mind a TeX header file that defines a command

\newcommand{ \cyclicgroup }[ 1 ]{ \mathbb{ Z }_{ #1 } }

and our webwork problems would import the header file and use this command
to display the cyclic groups, and instructors can edit this to use their
own notation for all the problems. What is the best/correct way to do
such a TeX header so that it will be compatible with the NPL?

(2) Some of our problems have tables (e.g. multiplication tables for
groups of order 12) that are too wide for the standard two-column hard copy
format; when printed, the tables run off the edge of the column. It's
possible to force these problems to print in one-column mode by using the
$BEGIN_ONE_COLUMN and $END_ONE_COLUMN commands. However, the mix of
one-column and two-column problems in one pdf is kind of awkward, and they
don't fit together well on a page.

Instead, we edited the snippets files (e.g. setHeader.pg,
hardcopyProblemDivider.tex) to have the entire hardcopy document be printed
in one-column format for all sets. We have created a folder containing the
modified snippets and edited the course.conf file to point to these snippets
instead of the default ones. Is this a reasonable way to solve this issue,
or does it greatly complicate the process of adding these problems to the
NPL? Some kind of solution is necessary because the tables are just too
wide, but perhaps there's a better/simpler/more compatible way to do it than
using modified snippets.

Thanks very much for reading/responding.

In reply to Siman Wong

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

by John Jones -
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