Liviu,
Liviu Andronic wrote:
Dear all
I have always failed to understand this behaviour in the citation
mechanism, and I would suspect that this is a bug. In my document I'm
using BibTeX with Natbib (plainnat). (Please check dummy examples
attached.)
Although I insert a random citation and keep the default formatting
choices, which in the citation dialogue and in LyX are displayed as
"Author (year)", the final .pdf document will feature a "Author
[year]" formatting. The latter seems very strange to me, and nothing
similar to anything that I've seen in papers. The issue is similar in
case I choose a "(Author, year)" formatting, which will get displayed
as "[Author, year]". Can someone suggest how to work around []
brackets and obtain () brackets in the final .pdf?
Round brackets are *supposed* to be the default in Natbib, and in fact
if you use Natbib with a non-Natbib bibliography style (e.g., plain
rather than plainnat), you do get round brackets. I suspect there's
something in plainnat.bst (and the other .bst files that come with
Natbib) that's overriding the default, although I did not find it in a
quick scan of plainnat.bst.
Anyway, the work-around is to add \setcitestyle{round} to your preamble.
An easier work-around is to add 'round' to the document class options
(it will be passed to Natbib).
A somewhat distinct issue, but still citation formatting related, is
when "Text before/after" is specified; say, a "(" "Author, year" ")"
formatting. For some reason, LyX (or LaTeX) will insert a space
between the "text before/after" and the main citation. Thus, instead
of "(Author, year)" the final result will be more similar to "(
Author, year )". Recently I also noticed that a comma is appended, so
that the actual result is "( Author, year, )".
The extra punctuation is the LaTeX default. You can override it by
putting a \bibpunct command in your preamble and supplying an optional
argument with the punctuation you want to replace the comma and space,
but you'll also have to supply the six mandatory arguments to bibpunct.
So, for instance, \bibpunct[]{(}{)}{;}{author-year}{}{,} removes both
the comma and the space (and keeps round brackets -- I'm not sure if the
other punctuation is to your taste). Adding a space between the square
brackets in that command removes the trailing comma but leaves in the
trailing space.
/Paul