3

I am working with the changes package. Modifying the color of the changed passages works well with \colorlet command. Is it possible to create colorboxes (with yellow color) only around the changes (without the \colorbox command)?

Thanks for your answer... Philipp

  • 1
    Welcome to TeX.SX! Can you show some minimal code? – egreg Mar 5 '15 at 9:47
4

You can control the appearance of added and deleted text through the commands \setaddedmarkup and \setdeletedmarkup, respectively.

So you can define, for example:

\setaddedmarkup{\colorbox{yellow}{#1}}
\setdeletedmarkup{\colorbox{red}{\sout{#1}}}

With the following code

\documentclass{article}

\usepackage{changes}

\definechangesauthor[name={Philipp}]{P}

\setaddedmarkup{\colorbox{yellow}{#1}}
\setdeletedmarkup{\colorbox{red}{\sout{#1}}}

\begin{document}
This is \added[id=P]{new} text.

This is \deleted[id=P]{bad} text.

This is \replaced[id=P]{nice}{bad} text.
\end{document} 

you get

enter image description here

This doesn't obviously support line breaks.

If you don't need particular formatting apart from coloring, you can load the soul package (once loaded by changes), and define, for example:

\setaddedmarkup{\sethlcolor{yellow}\hl{#1}}
\setdeletedmarkup{\sethlcolor{red}\hl{#1}}

MWE

\documentclass{article}

\usepackage{changes}
\usepackage{soul}

\definechangesauthor[name={Philipp}]{P}

\setaddedmarkup{\sethlcolor{yellow}\hl{#1}}
\setdeletedmarkup{\sethlcolor{red}\hl{#1}}

\begin{document}
This is \added[id=P]{new} text.

This is \deleted[id=P]{bad} text.

This is \replaced[id=P]{nice}{bad} text.
\end{document} 

Output:

enter image description here

Otherwise, have a look at this thread for more highlighting possibilities: Cool Text Highlighting in LaTeX

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.