Update tex2lyx to format 424.

The type of citation engine is determined by the citation package
being used and, in the case of natbib, its options.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40593 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Julien Rioux 2012-01-09 13:16:41 +00:00
parent e3f65fd088
commit a99960cc04
3 changed files with 8 additions and 3 deletions

View File

@ -401,6 +401,7 @@ Preamble::Preamble() : one_language(true)
//h_boxbgcolor;
h_biblio_style = "plain";
h_cite_engine = "basic";
h_cite_engine_type = "numerical";
h_defskip = "medskip";
//h_float_placement;
//h_fontcolor;
@ -739,7 +740,8 @@ void Preamble::handle_package(Parser &p, string const & name,
else if (name == "natbib") {
h_biblio_style = "plainnat";
h_cite_engine = "natbib_authoryear";
h_cite_engine = "natbib";
h_cite_engine_type = "authoryear";
vector<string>::iterator it =
find(options.begin(), options.end(), "authoryear");
if (it != options.end())
@ -747,7 +749,7 @@ void Preamble::handle_package(Parser &p, string const & name,
else {
it = find(options.begin(), options.end(), "numbers");
if (it != options.end()) {
h_cite_engine = "natbib_numerical";
h_cite_engine_type = "numerical";
options.erase(it);
}
}
@ -756,6 +758,7 @@ void Preamble::handle_package(Parser &p, string const & name,
else if (name == "jurabib") {
h_biblio_style = "jurabib";
h_cite_engine = "jurabib";
h_cite_engine_type = "authoryear";
}
else if (name == "hyperref")
@ -923,6 +926,7 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc)
it != h_use_packages.end(); it++)
os << "\\use_package " << it->first << ' ' << it->second << '\n';
os << "\\cite_engine " << h_cite_engine << '\n'
<< "\\cite_engine_type " << h_cite_engine_type << '\n'
<< "\\biblio_style " << h_biblio_style << "\n"
<< "\\use_bibtopic " << h_use_bibtopic << "\n"
<< "\\use_indices " << h_use_indices << "\n"

View File

@ -83,6 +83,7 @@ private:
std::string h_biblio_style;
std::string h_boxbgcolor;
std::string h_cite_engine;
std::string h_cite_engine_type;
std::string h_defskip;
std::string h_float_placement;
std::string h_fontcolor;

View File

@ -31,7 +31,7 @@ extern char const * const lyx_version_info;
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
#define LYX_FORMAT_LYX 424 // jrioux : \cite_engine_type (authoryear|numerical)
#define LYX_FORMAT_TEX2LYX 423
#define LYX_FORMAT_TEX2LYX 424 // jrioux : \cite_engine_type (authoryear|numerical)
#if LYX_FORMAT_FOR_TEX2LYX != LYX_FORMAT_FOR_LYX
#warning "tex2lyx produces an out of date file format."