1

I have a document which was originally written with a footnote based citation format in mind. As a result the citations generally follow punctuation as in This is a test sentence.\cite{Someone:2018} However, I'm now preparing pieces of that document for publication in an APS journal which makes use of a inline (bracket) citation style and thus the citations should proceed the punctuation. Is there some LaTeX trickery that can be done to accomplish this, or do I have to manually edit the source file.

MWE with citations in "wrong" place:

\documentclass[preprint]{revtex4-1}

\usepackage{natbib}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{Bli74,
  author = {Blinder, Alan S.},
  year = {1974},
  title = {The economics of brushing teeth},
  journal = {Journal of Political Economy},
  volume = {82},
  number = {4},
  pages = {887--891},
}
@book{Kop04,
  author = {Kopka, Helmut and Daly, Patrick W.},
  year = {2004},
  title = {Guide to \LaTeX},
  edition = {4},
  address = {Boston},
  publisher = {Addison-Wesley},
}
\end{filecontents}

\begin{document}

This is a test sentence.\cite{Bli74}  This is another, slightly more complicated,\cite{Kop04} test sentence.

\bibliography{\jobname}

\end{document}
4
  • 2
    Good question! IMHO, however, the time it would take for you to find this trickery is very likely way beyond than that of a CTRL+F search of \cite followed by manual adjustments. – Ruixi Zhang Oct 19 '18 at 2:08
  • 2
    This would be quite tricky. While LaTeX can look forward easily looking back is hard. So \cite can't move the punctuation. So I guess it would have to be the other way round: The . has to move the \cite. This would probably involve making the . active, getting it to grab the entire following \cite{...} seems very complicated. On the other hand, a short search for .\cite and ,\cite seems doable. If you have a RegExp you might be able to rack up a fully automatic search-and-replace. – moewe Oct 19 '18 at 6:15
  • 2
    BTW: This is the reason why biblatex always wants you to write \autocite{foo}. and allows you to activate an option to move the punctuation around. I think a few other packages can do similar things. – moewe Oct 19 '18 at 6:16
  • Hindsight is 20/20. If I have to deal with making punctuation active, then I guess I’ll bite the bullet and work on the search-and-replace process. – rpspringuel Oct 19 '18 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.