From 79f5a4a39633f20ca54f091975b8a460de79ac9f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20St=C3=B6hr?= Date: Mon, 20 Dec 2010 02:47:58 +0000 Subject: [PATCH] tex2lyx/text.cpp: support \nocite{*} (since format 310) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36961 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/tex2lyx/text.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index 2a23a88304..4c15a85696 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -1308,7 +1308,9 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, Context & context) { Layout const * newlayout = 0; - // Store the latest bibliographystyle (needed for bibtex inset) + // Store the latest bibliographystyle and nocite{*} option + // (needed for bibtex inset) + string btprint; string bibliographystyle; bool const use_natbib = used_packages.find("natbib") != used_packages.end(); bool const use_jurabib = used_packages.find("jurabib") != used_packages.end(); @@ -2209,10 +2211,16 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, context.check_layout(os); // LyX cannot handle newlines in a latex command string after = subst(p.getOptContent(), "\n", " "); - begin_command_inset(os, "citation", t.cs()); - os << "after " << '"' << after << '"' << "\n"; - os << "key " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n"; - end_inset(os); + string key = subst(p.verbatim_item(), "\n", " "); + // store the case that it is "\nocite{*}" to use it later for + // the BibTeX inset + if (key != "*") { + begin_command_inset(os, "citation", t.cs()); + os << "after " << '"' << after << '"' << "\n"; + os << "key " << '"' << key << '"' << "\n"; + end_inset(os); + } else + btprint = key; } else if (t.cs() == "index") { @@ -2641,6 +2649,12 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, else if (t.cs() == "bibliography") { context.check_layout(os); begin_command_inset(os, "bibtex", "bibtex"); + if (!btprint.empty()) { + os << "btprint " << '"' << "btPrintAll" << '"' << "\n"; + // clear the string because the next BibTeX inset can be without the + // \nocite{*} option + btprint.clear(); + } os << "bibfiles " << '"' << p.verbatim_item() << '"' << "\n"; // Do we have a bibliographystyle set? if (!bibliographystyle.empty()) -- 2.39.2