diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp index 8aa9e64ca2..39796323ed 100644 --- a/src/tex2lyx/Preamble.cpp +++ b/src/tex2lyx/Preamble.cpp @@ -418,6 +418,15 @@ void Preamble::add_package(string const & name, vector & options) if (used_packages.find(name) == used_packages.end()) used_packages[name] = split_options(h_options); + // Insert options passed via PassOptionsToPackage + for (auto const & p : extra_package_options_) { + if (p.first == name) { + vector eo = getVectorFromString(p.second); + for (auto const & eoi : eo) + options.push_back(eoi); + } + + } vector & v = used_packages[name]; v.insert(v.end(), options.begin(), options.end()); if (name == "jurabib") { @@ -1033,6 +1042,8 @@ void Preamble::handle_package(Parser &p, string const & name, options.erase(it); } } + if (!options.empty()) + h_biblio_options = join(options, ","); } else if (name == "jurabib") { @@ -1407,6 +1418,12 @@ void Preamble::parse(Parser & p, string const & forceclass, h_preamble << t.asInput(); } + else if (t.cs() == "PassOptionsToPackage") { + string const poptions = p.getArg('{', '}'); + string const package = p.verbatim_item(); + extra_package_options_.insert(make_pair(package, poptions)); + } + else if (t.cs() == "pagestyle") h_paperpagestyle = p.verbatim_item(); diff --git a/src/tex2lyx/Preamble.h b/src/tex2lyx/Preamble.h index 5dcc6718d7..288dd87bf6 100644 --- a/src/tex2lyx/Preamble.h +++ b/src/tex2lyx/Preamble.h @@ -241,6 +241,8 @@ private: AuthorList authors_; /// special table column types std::map special_columns_; + /// + std::map extra_package_options_; };