5

I'm using LyX with the bibliography set to natbib > Author, Year in Document Settings and plainnat in the bibliography settings. So far, so good. This has the desired effect within the bibliography and the citations look good, with one exception - they are not surrounded with brackets, so they appear in the text as just Cited, 2006 rather than (Cited, 2006).

This seems to be because I was using the Default (numerical) setting until now, and changing to natbib has given the 'insert citation' dialogue multiple citation styles. Every one of my 250+ citations has now defaulted to the style without brackets.

So, question:

  • Is it possible to change all citation styles in one go?
  • Is it possible to change the natbib behaviour someway to put the brackets in (like the \bibpunct preamble or something?)

Any help much appreciated! Worst case scenario I'll go back to numerical citations...

3

Got it - I opened the .lyx file in a text editor (TextMate, but any would do) and did a find and replace to change the citation style of every citation.

  • Find: LatexCommand cite
  • Replace: LatexCommand citep

That extra p makes all of the difference! Probably worth a second find and replace to make sure there are no instances of citepp, and definitely worth doing a backup first.

1

If you are under *nix, or have cygwin installed, consider a script

 sed "s/LatexCommand\ cite/LatexCommand\ citep/g" yourfile.lyx > newfile.tex 

with obvious replacements for yourfile and newfile.

  • 1
    +1 for reminding us that Linux terminal does not bite. – Fran Sep 16 '12 at 20:03

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.