I have revised a manuscript in LyX, and as requested by the journal editor, coloured the new text in red.

Once I completed the revision I exported to LaTeX to do the final tweaking of the manuscript.

I now have a revised manuscript in pdf format with all changes marked up in red text.

The problem is that I also need a unmarked up version (with red text removed). I can remove the red coloring in the LyX file, but then need to re-export and re-tweak the entire document whenever I make a small change.

Because the color text was added in LyX I have \textcolor{red}{Words and more words} scattered all throughout the document.

Can someone give me a clue to an efficient way to strip out the \textcolor{red} tags and the corresponding {} throughout the Latex file?

I've tried searching online but have not managed to find an answer yet.

  • 5
    You could probably make red equivalent to black, or just make \textcolor a no-op (\renewcommand{\textcolor}[2]{#2}). However, that will still leave it in the code...
    – Werner
    Nov 26, 2013 at 7:21
  • 1
    Welcome to the site! You could use something like Most efficient method to strip all of the LaTeX code from a document?
    – cmhughes
    Nov 26, 2013 at 19:57
  • @cmhughes Thanks for that link. I don't think I will use that option now, but the perl script will come in very hand in the future Nov 27, 2013 at 3:24
  • @Werner Thanks. This is probably going to be the easiest way to do this for the current document. In the future I will make the most of Lyx's track changes function Nov 27, 2013 at 3:26
  • 1
    @user2885462 yeah it sounds like you have both a short-term and long-term solution that work so no need to get fancy. But just remember that if a similar situation comes up and you are motivated to learn more, the term to search for is "regular expression". You can find/replace almost anything with it and many different programming languages and programs (e.g. Vim) have support for it.
    – scottkosty
    Nov 27, 2013 at 18:22

3 Answers 3


This does not solve your current problem (David's answer should work fine in this respect).

However, next time you need to highlight changes for your editor, remember that LyX has a pretty good built-in change tracking system: Just do your edits in change-tracking mode and you are done:

Lyx with change tracking

It's possible to have mark-ups for the changes in the PDF output, however, this is optional, so you could always also generate a plain PDF:

PDF with change tracking

Once you are finished, or if you editor has already approved some of your edits, you can make them "permanent" by accepting the respective change in LyX.

I have used this process in for a couple of journal and shepherded conference papers. The respective editors were always extremely happy with the highlighting

  • I had not thought that the track changes from LyX would carry over into the Latex code (stupid I know). I submit the raw Latex files, and the journal compiles them, but I suppose this is not a problem. Thanks so much! To late now, but very useful for the future! Nov 27, 2013 at 3:21

The option


was designed for that use.

  • Thanks David, this will be helpful. This will leave the \textcolor{} code in which looks quite messy. Too late now, but lesson learned. I'll take Daniel's advice for editing future manuscripts. Nov 27, 2013 at 3:24

Actually, you can follow the following two steps to remove the annoying \textcolor{red}{} code in latex file: 1. Select all texts in the lyx file and right click the mouse, choose Text Style-->Customized-->Color-->Reset, then apply (This actually reset the font color to default). 2. Export the lyx file to latex file. You will see that there is no \textcolor{}{} command appearing in the latex file. I hope that this helps.

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.