I'm using the ulem
package to produce different kinds of underlining, and want each underline style to be in a different color (so that the difference is visible whether you're viewing the document in black and white or not). The package documentation gives an example for how to define a colored version of the basic \uline
command, which works just fine:
\newcommand\reduline{\bgroup\markoverwith{\textcolor{red}{\rule[-0.5ex]{2pt}{0.4pt}}}\ULon}
What I'm having trouble with is creating new commands to give the other types of underlining colors, namely \dashuline
, \dotuline
, and \uwave
, i.e. make one of them blue, one green, etc. The definition of these commands in ulem.sty
is more complex than I understand, and I'm not sure how to plug them into the above format. Other underlining packages would be theoretically fine, but I do need a variety of underline shapes, which aren't predefined in soul
for example, as far as I can tell.
Best Answer
This is actually a lot easier than you may think. As the documentation suggests, just look in
ulem.sty
and copy and modify the definitions (starting on line 211). Just insert a color changing command in the argument to\markoverwith
in the definition you want to modify and that's it.