Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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...

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Kurt's reply is on spot. Just to improve upon it, 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.

share|improve this answer
    
It is the answer of @tallphil, not mine :-) I have only improved the formatting. –  Kurt Sep 14 '12 at 23:17
1  
+1 for reminding us that Linux terminal does not bite. –  Fran Sep 16 '12 at 20:03
    
@Kurt: I know, the "@" sign at the beginning was confusing. I edited it away. –  walkmanyi Sep 16 '12 at 20:48
    
I think Kurt meant that it was me who wrote the answer - he kindly edited the formatting to make it more clear to read. So it's tallphil's answer really :) –  tallphil Sep 18 '12 at 21:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.