1

I messed up my latex code; I need to replace \cite[42]{source}. with .\cite[42]{source} and \cite{source}. with .\cite{source}. I tried \\cite\(.*\)\}\. -> .\\cite\1\} but I got an error: Invalid use of '\' in replacement text. How do I fix this?

2

You don't backslash the curly brace } in the replacement text. This works, when entered at the query-replace-regexp prompt:

FROM: \\cite\(.+\)}\.

TO: .\\cite\1}

  • Why did you use + instead of *? – Elliot Gorokhovsky Feb 1 '15 at 5:24
  • + says "one or more characters after \cite and before the closing brace" which means that \cite} will not be matched. It's not a big deal, but I thought it was cleaner. – Ted Zlatanov Feb 2 '15 at 11:33

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.