WeBWorK Problems

How to color text red

How to color text red

by Arnold Pizer -
Number of replies: 0
I'm posting an excellent private response by Jason on how to color text red.

Note that readers will find all of WeBWorK's standard macros of this type in .../webwork/pg/macros/PGbasicmacros.pl

Note also in Jason's example TeX and HTML are the two modes that are used since these are pretty much the only output modes that WeBWorK uses currently.  However older macros use other deprecated modes and in the future it would be easy to add a new mode by editing PGbasicmacros.pl and then all of WeBWorK's 25,000+ could be output in the new mode.


Here is Jason's email:

Hi Yoav,

I'm writing to follow up on some questions you had on the #webwork irc chat today.  (I'm aubreyja on IRC.)

Here's an example macro file that would allow you to color text red:


The main idea is that you need to specify what to do for both latex and html output, then it's easy to do with one caveat: when specifying the latex markup you have to use \\  instead of \ since backslashes have special meanings in both perl and latex.

There is a lot of documentation on the wiki, but of course you are absolutely correct that it is difficult for new people to find what they are looking for.  In general, the two best collections for problem authroing documentation are 

the index of problem techniques: http://webwork.maa.org/wiki/Category:Problem_Techniques

and the subject area templates: http://webwork.maa.org/wiki/SubjectAreaTemplates

Hope this helps!