On Fri, Mar 02, 2007 at 04:13:14AM +0100, Juergen Spitzmueller wrote: > José Matos wrote: > > > What is Jürgen's opinion on the subject? > > Without having a closer look at the patch, my opinion is that Martin's > approach is good (and necessary) in general. However, it should enclose > numerical citations in one way or another. > > Jürgen
That would be like the attached... but note that I don't think that is right. I agree that numeric should be handled, but what happens here is that, also when natbib is pre-loaded by the document class, the _user_ is allowed to choose between numeric and author-year. I don't think that is right. What about committing this with a FIXME? - Martin
Index: src/insets/insetcite.C =================================================================== --- src/insets/insetcite.C (revision 17353) +++ src/insets/insetcite.C (working copy) @@ -424,7 +424,13 @@ int InsetCitation::latex(Buffer const & buffer, odocstream & os, OutputParams const &) const { - biblio::CiteEngine const cite_engine = buffer.params().cite_engine; + BufferParams const & p = buffer.params(); + biblio::CiteEngine cite_engine; + if (p.getLyXTextClass().provides(LyXTextClass::natbib) + && p.cite_engine != biblio::ENGINE_NATBIB_NUMERICAL) + cite_engine = biblio::ENGINE_NATBIB_AUTHORYEAR; + else + cite_engine = p.cite_engine; // FIXME UNICODE docstring const cite_str = from_utf8( biblio::asValidLatexCommand(getCmdName(), cite_engine)); @@ -451,7 +457,8 @@ break; case biblio::ENGINE_NATBIB_AUTHORYEAR: case biblio::ENGINE_NATBIB_NUMERICAL: - features.require("natbib"); + if (!features.bufferParams().getLyXTextClass().provides(LyXTextClass::natbib)) + features.require("natbib"); break; case biblio::ENGINE_JURABIB: features.require("jurabib"); Index: src/frontends/controllers/biblio.C =================================================================== --- src/frontends/controllers/biblio.C (revision 17353) +++ src/frontends/controllers/biblio.C (working copy) @@ -690,7 +690,11 @@ CiteEngine_enum getEngine(Buffer const & buffer) { - return buffer.params().cite_engine; + BufferParams const & p = buffer.params(); + if (p.getLyXTextClass().provides(LyXTextClass::natbib) + && p.cite_engine != biblio::ENGINE_NATBIB_NUMERICAL) + return ENGINE_NATBIB_AUTHORYEAR; + return p.cite_engine; } Index: lib/layouts/egs.layout =================================================================== --- lib/layouts/egs.layout (revision 17353) +++ lib/layouts/egs.layout (working copy) @@ -12,6 +12,7 @@ Columns 2 Sides 1 PageStyle Plain +ProvidesNatbib 1 Style Standard
pgpgekfe4eh7C.pgp
Description: PGP signature