[Tex/LaTex] way to change the appearance of LyX output with change tracking (or alter the commands in LaTeX)

lyxpdf

I tend to use LyX for composing scientific papers, but a journal wants me to have changed text marked in specific ways that don't happen to be the way that LyX translates tracked changes into PS/PDF.

Is there a way to modify not just the color but also the underlining of changed text when it's converted to PS or PDF? I suppose I'd have to do something with the \lyxadded and/or \lyxdeleted commands?

LyX seems to always generate commands that look like \lyxadded{My Name,,,}{2011 blah blah date}{my text}, so if there's a good way to intercept this and add my own formatting to the {my text} part, that would probably work if there's no more elegant way.

Best Answer

As long as you don't want to get fancy with detecting whether changed text should be viewed on the output or not, it's actually quite simple. LyX writes the \lyxadded command into its own preamble in the generated .tex file:

\newcommand{\lyxadded}[3]{{\color{lyxadded}{}#3}}

and this preamble occurs before the one it gives to you under Document / Settings ... / LaTeX Preamble. So all you have to do is redefine the command:

\renewcommand{\lyxadded}[3]{{\color{lyxadded}\uline{#3}}}

Since LyX already uses the ulem package for striking out changes, \uline is available without any additional usepackageing.

If you go this route, you're probably best off leaving the "show changes" on every time you export, and just renew the \lyxadded and \lyxdeleted commands as appropriate when you don't want to see them.

Related Question