]> git.lyx.org Git - features.git/commitdiff
tex2lyx: consider options passed via \PassOptionsToPackage
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 4 Mar 2018 15:45:37 +0000 (16:45 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 4 Mar 2018 15:45:37 +0000 (16:45 +0100)
src/tex2lyx/Preamble.cpp
src/tex2lyx/Preamble.h

index 8aa9e64ca2468c74e8e03a0116e49b23737b7c1d..39796323ed7b5289452d37ebc0d4e1a0e3efded5 100644 (file)
@@ -418,6 +418,15 @@ void Preamble::add_package(string const & name, vector<string> & 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<string> eo = getVectorFromString(p.second);
+                       for (auto const & eoi : eo)
+                               options.push_back(eoi);
+               }
+
+       }
        vector<string> & 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();
 
index 5dcc6718d7b4bd79efd2f0fc2bb3600feeb026b6..288dd87bf681405e78c9c787d5d845dbca3c3346 100644 (file)
@@ -241,6 +241,8 @@ private:
        AuthorList authors_;
        /// special table column types
        std::map<char, int> special_columns_;
+       ///
+       std::map<std::string, std::string> extra_package_options_;
 };