Monday, July 23, 2012

Inserting a comma after first of two authors with apalike citation in Lyx

Using apalike style, when there are only two authors Lyx does not put a comma after the first author's initials (before the "and"), to fix this, I had to edit the .bst file:
cd /usr/share/texmf-texlive/bibtex/bst/apalike
sudo gedit apalike.bst

save as apalike2.bst
change lines 214-222
 { namesleft #1 >
     { ", " * t * }
     { numnames #2 >
  { "," * }
  'skip$
       if$
       t "others" =
  { " et~al." * }
  { " and " * t * }
to
 { namesleft #1 >
     { ", " * t * }
     { t "others" =
  { " et~al." * }
  { ", and " * t * }
After this we might need to run the command
 sudo texhash
In Lyx, click on bibliography, browse to new (apalike2.bst) style file.

No comments: