I am editing an article and I want to create a method to track changes. I have defined a command using newcommand to highlight everything written inside (I use it instead of newenvironment because I don't want newenvironment creating spaces between the text).
The code is the following:
\newcommand{\edited}[1]{%
\definecolor{hlcolor}{RGB}{255,255,0}\sethlcolor{hlcolor}%
\hl{#1}%
}
And I use it this way:
text text text text \edited{highlighted text highlighted text
highlighted text highlighted text highlighted text highlighted
text highlighted text highlighted text} text text text...
My problem is that when I try to citate something inside the macro...
text text text text \edited{highlighted text highlighted text
highlighted text \cite{Ref1} highlighted text highlighted
text highlighted text highlighted text} text text text...
I get the error:
! Argument of \@citex has an extra }.
<inserted text>
\par
l.225 ...ncy, reliability, and power consumption.}
?
How can I solve this problem? I was using newcommand because I want some kind of macro that can have a behaviour change when needed (for example, delete the highlight when the document is finished).
latexdiff, which can be integrated with git to show how versions have changed over time. It would certainly make the source code much cleaner. – oliversm Mar 04 '20 at 15:13