[texhax] Adding Color to Text Effortlessly

Susan Dittmar Susan.Dittmar at gmx.de
Wed May 25 09:50:25 CEST 2011

Quoting Boris Veytsman (borisv at lk.net):
> IK> From: Iraj Kalantari <I-Kalantari at wiu.edu>
> IK> Date: Tue, 24 May 2011 17:02:42 -0500
> IK> Experts,
> IK> Say I am co-authoring a paper with someone.
> IK> Say I get a draft of the work but I want to add revisions.
> IK> Is there a way for me to add my revisions *in the source file* and 
> IK> have the changes to appear in color in the pdf file, without adding the command of 
> IK> \color{blue}  {... changes' ...} \color{black},
> IK> so that my co-author would spot them quickly?
> Take a look at latexdiff (http://www.ctan.org/pkg/latexdiff)

latexdiff can do a lot more than the suggestion I'm about to make. You will
need perl though. If you only want to mark changes by hand, perhaps
something like


%%%%%%%%%%%%%%%%% markup changes: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% "StandardColor" is just a color name so you can use this system within
%%% colored text if you re-define StandardColor within this colored block
%%% aswell:
%%% change markers (I use date codes):
%%% those same change markers, use those for the final version:
%%% mark change: \CHANGE{change identifier}{text}

With this, you could put changes inside \CHANGE{marker}{text}. By changing
the color definitions in the header, you can easily decide which changes
you want highlighted.

I did not test this code. So I do not know if 2011-05-25 is acceptable as
color name. If not, you will have to either restrict yourself to change
markers acceptable to color definitions, or make the color choice within
the \CHANGE macro via \ifthenelse constructs.

This still needs balanced braces/groups inside the \CHANGE command, which
made me refrain from using it when I last considered it. I'll have a look
at latexdiff someday soon, perhaps that's a good alternative for me, at
least on my linux box.

Hope this helps,


More information about the texhax mailing list