# changes package for peer reviewed journal: hide authors and convert 'replaced' to 'added'

I'm using the changes package to keep track of any changes I ( and my co-authors ) made for a peer reviewed journal. Meaning, in response to each of the reviewers' comments, we are using a new author id from the changes package to make it easier (for us) and the reviewer to find our additions and changes to a specific comment. But moreover, we also use a special author id to keep track of linguistic/grammar corrections we made.

1. But now, when submitting the revised journal, we would like to hide all linguistic/grammar corrections we made ( just show the 'final' state ) to avoid too much different colors and confusion. How I can 'toggle' the 'final' command for specific author id or achieve something similar?

2. Also I would like to replace all \replaced commands by \added to hide the crossed out text. How can I do this?

\documentclass{article}

\usepackage{changes}
\definechangesauthor[name={Reviewer 1. Comment 1}, color=red]{r11}
\definechangesauthor[name={Reviewer 1. Comment 2}, color=red]{r12}
\definechangesauthor[name={Language/Grammar}, color=black!50!green]{lang}

\begin{document}

\end{document}


In principle all you have to do is redefine what the macros \added and \replaced does:

1. For this we create \finalstate that redefines \added and \replaced to be so-called "no-op"s. That is, they literally just gobble their arguments and spit out them out again.

2. Here we define \convertreplaced to transform \replaced to be equivalent to \added, dropping the replaced text.

You can issue the above commands anywhere in the document (or preamble), and subsequent setting of content will be updated accordingly. To that end, a "final state" document will be achieved when you issue \finalstate in the preamble (before \begin{document}).

\documentclass{article}

\usepackage{changes}
\definechangesauthor[name={Reviewer 1. Comment 1}, color=red]{r11}
\definechangesauthor[name={Reviewer 1. Comment 2}, color=red]{r12}
\definechangesauthor[name={Language/Grammar}, color=black!50!green]{lang}

\newcommand{\finalstate}[1][]{%
\renewcommand{\replaced}[3][]{##2}}%
\newcommand{\convertreplaced}{%

\begin{document}

\convertreplaced

\finalstate

\end{document}


The following update adds functionality to manage a list of so-called "final state IDs":

\documentclass{article}

\usepackage{changes,etoolbox,xparse}

\definechangesauthor[name={Reviewer 1. Comment 1}, color=red]{r11}
\definechangesauthor[name={Reviewer 1. Comment 2}, color=red]{r12}
\definechangesauthor[name={Language/Grammar}, color=black!50!green]{lang}

\makeatletter
\ifallfinal
#2%
\else
#2%
}{%
\Changes@output%
{#2}%
{#2}%
}%
\fi
}
\renewcommand{\deleted}[2][\@empty]{%
\setkeys{Changes@deleted}{#1}%
\ifallfinal\else% or \ifallfinal\unskip\else
\xifinlist{\Changes@deleted@id}{\finalstateids}{}{% or \xifinlist{\Changes@deleted@id}{\finalstateids}{\unskip}{
\Changes@output%
{\Changes@Markup@Deleted{#2}}%
{\@bsphack \expandafter \@esphack}%
{\Changes@deleted@id}%
{\Changes@deleted@remark}%
{#2}%
{\changesdeletename}%
}%
\fi
\stepcounter{Changes@DeleteCount\Changes@deleted@id}%
}
\renewcommand{\replaced}[3][\@empty]{%
\setkeys{Changes@replaced}{#1}%
\ifallfinal
#2%
\else
\xifinlist{\Changes@replaced@id}{\finalstateids}{%
#2%
}{%
\Changes@output
{#2}
{\Changes@replaced@id}
{\Changes@replaced@remark}%
{#2}%
{\changesreplacename}%
}%
\fi
\stepcounter{Changes@ReplaceCount\Changes@replaced@id}%
}
\makeatother

\newcommand{\finalstateids}{}
\newif\ifallfinal
\NewDocumentCommand{\finalstate}{o}{%
\IfNoValueTF{#1}
{\allfinaltrue}% All ids are in final state
\docsvlist{#1}}% Process list
}

\begin{document}

\bigskip\verb|\finalstate[lang]|:\finalstate[lang]

\bigskip\verb|\finalstate[r12]|:\finalstate[r12]

\bigskip\verb|\clearfinalstateids\finalstate[r11,r12]|:\clearfinalstateids\finalstate[r11,r12]

\bigskip\verb|\finalstate[lang,r11]|:\finalstate[lang,r11]

\bigskip\verb|\clearfinalstateids|:\clearfinalstateids


As a side-point, consider updating the \deleted macro to use \unskip rather than just printing nothing, as it will also attempt to remove the preceding space (see the comments above for placement).
• Thanks for this! One question: the finalstate is now applied to all author ids, right? Is it possible to make it only for specific ones? e.g. r11 in the example above?. Also it seems that the finalstate is actually reverting the old state, right? I was thinking of something like the \usepackage[final]{changes} switch for specific author ids. – bonanza Nov 28 '14 at 7:25
• @bonanza: Yes (I'll update this tomorrow). So you're interested in something like \finalstate (for all author ids), but \finalstate[r11] which will keep all other author ids' content in visible, but remove/finalize only author id r11's content. I guess next thing you'll reach for the starts and want to enter something like \finalstate[r11,r12,...] where you supply a list of "finalized author ids". ;) – Werner Nov 28 '14 at 7:31