## WeBWorK Main Forum

### Using Latex packages

by Thomas Hagedorn -
Number of replies: 1

Is it possible to use Latex packages in Webwork? Specifically, I'd like to use the package "xy-pic" to draw figures in which randomized numbers appear. If the numbers weren't randomized, I could save the static figure as a .gif or .eps file. But to have randomized numbers, it appears that one needs to use the Latex code with the xy-pic package.

Thanks in advance,
Tom

In reply to Thomas Hagedorn

### Re: Using Latex packages

by Michael Gage -
For hardcopy output you can easily include other packages. This is done by modifying the files in webwork2/conf/snippets. e.g. hardcopyPreamble.tex
loads packages before the homework set is processed by TeX for hardcopy.

Usually TeX is only used to created formula for screen display, so you'll need
to extend some of WeBWorK's code in order to use TeX to draw the figures. You might want to see if the figures couldn't be drawn as easily or more easily (and more quickly) using WeBWorK's WWPlot module instead of xy-pic.

When WeBWorK processes forumulas in image mode it uses the packages defined in webwork2/lib/WeBWorK/Constants.pm (\$WeBWorK::PG::ImageGenerator::TexPreamble). If you start customizing this however there is a good chance that what works in image mode (dvipng) won't work in jsMath mode or the other viewing modes.