Citations

Each journal has a different style for citing references in the body of the article. Some prefer inline citations in brackets, preceeding all punctuation symbols. Others use superscript citations directly behind the punctation symbol. If a manuscript is submitted to a journal of the former type, rejected there and subsequently resubmitted to a journal of the second type, all citations have to be touched to read

rhabarber.\cite{jones_prl_1970}

instead of the previous

rhabarber \cite{jones_prl_1970}.

The following command replaces all of the latter with the former, including those bound with a comma or a colon. The changes are written back to the manuscript at once.

sed 's/ \(\\\cite{.\+}\)\([,.:]\)/\2\1/' -i manuscript.tex

PS: In some cases, an easier solution is available. In REVTeX 4.1, for example, the proper position and spacing of the citations is automatically taken care of by the class option 'citeautoscript'. For classes compatible with the 'cite' package, the option 'super' will achieve the desired effect. In all other cases, the above one-liner will have to do.