Forum archive 2000-2006

Arnold K. Pizer - Hints on using typeset mode

Arnold K. Pizer - Hints on using typeset mode

by Arnold Pizer -
Number of replies: 0
inactiveTopicHints on using typeset mode topic started 3/30/2001; 4:56:33 PM
last post 3/30/2001; 4:56:33 PM
userArnold K. Pizer - Hints on using typeset mode  blueArrow
3/30/2001; 4:56:33 PM (reads: 911, responses: 0)
Hints on using typeset mode. These are especially applicable for larger courses.

First here is some background information.

You can set the default mode for your system in and/or override the system default for a single course in the course's file. For example, $htmlModeDefault = 'Latex2HTML'; sets the default to typeset mode. The other viable option is 'HTML_tth' which gives formatted text mode. You will find that 80% or 90% or your student will use the default mode.

Typeset mode uses latex2html (l2h for short) to generate images. Since l2h is a very slow program (taking maybe 5 seconds per student per problem on average) WeBWorK caches the images and html output for a problem in a special directory. This means that the first time a student views a problem there will be a 5 second or longer delay, but whenever the student accesses the same problem again, the response will be fast. We recommend that you pre create the images which will eliminate this initial delay (see below). What really happens is that when a student accesses a problem, WeBWorK looks for the directory with the cached images. If this directory does not exist or if it is older than the modification date of the problem's .pg file (which means the .pg file was edited after the cached images were created), WeBWorK deletes the directory if it exists, calls l2h to create the images, and then creates a new directory and caches the images there. Otherwise it just uses the html output and images it finds in the directory. These directories are under l2h in the tmp directory. By default this is e.g.


but we suggest you put this in a separate file system e.g /home/htdocs/tmp and then you would have /home/htdocs/tmp/mth161/l2h. See Trouble with latex2html - bad images for details on how these directories work and Hint on tmp file system setup for putting these in a separate file system. Any large course, say with over a 100 students, should consider using a separate file system.

With a large course, in the hours before an assignment is due, you will probably have a lot of students viewing problems for the first time. The five second per problem per student delay may really slow your server down. Therefore we recommend that you pre create the typeset images. This requires you to run the script ( can also be used in special circumstances). First the version of these scripts contained in the WeBWorK distribution conatin a memory leak. You may not notice this unless you have a large class, but if you have a class of several hundred, you should definitely apply the patch contributed by Bill Wheeler. Look at the fourth entry under memory leak and for details on this.

Here is what I do to run In the templates directory for a course I run e.g.

nice /ww/webwork/system/scripts/ mth161 set2.def >& set2.log &

(this runs the job niced in the background and outputs info to a log file. The only reason I run this in the templates directory is that then the log file is put in templates/). You can log off and the job will continue running. See running for a little more info. If you run without any parameters, it will show you the required syntax and all available options. In particular if instead of mth161 set2.def

you enter mth161 set2.def 1 55000

you will pre create images for all students with psvn's from 1 to 55000. By default WeBWorK uses 5 digit psvn's (this can be changed in ranging from 10000 to 99999 so that the above range covers (with high probability) about half the students. If you have a dual processor machine, durring a slow period (e.g. 6am to 11am) you could run two processes

nice /ww/webwork/system/scripts/ mth161 set2.def 1 55000>& set2a.log & nice /ww/webwork/system/scripts/ mth161 set2.def 55000 99999>& set2b.log &

and complete the run twice as fast (fix the memory leak first). If you are lucky enought to have a quad processor, you could run four simultaneous jobs. is smart enought so that it will not create the images if they already exist. However, it has to do quite a bit of processing on a problem before it gets to the point where it looks to see if the images have already been created, so if you know the images for all students in a certain range have already been created , it is quite a bit faster to just avoid that range.

Similarily, if say after pre creating the images for all problems in a set, you edit say problem 3, then you could just run again. However, it would be faster to run say

nice /ww/webwork/system/scripts/ mth161 set2.def 3 >& set2-3.log &

which will only pre create images for problem 3 in set 2. Run without any parameters to see the required syntax and all available options.

<| Post or View Comments |>