]> git.lyx.org Git - features.git/commitdiff
Output package options before loading any package.
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 21 Dec 2014 11:10:06 +0000 (12:10 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 21 Dec 2014 11:10:06 +0000 (12:10 +0100)
Fixes: #9355
src/BufferParams.cpp
src/LaTeXFeatures.cpp
src/LaTeXFeatures.h

index d94600fb0f303b8511f4a05b3f6eb681e37322ef..f28d26d469a18e53078255f901fe0daea9794dc3 100644 (file)
@@ -1776,6 +1776,9 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                        lyxpreamble += "\\synctex=-1\n";
        }
 
+       // The package options (via \PassOptionsToPackage)
+       lyxpreamble += from_ascii(features.getPackageOptions());
+
        // due to interferences with babel and hyperref, the color package has to
        // be loaded (when it is not already loaded) before babel when hyperref
        // is used with the colorlinks option, see
index 630cc4c30ee4c59e71f3f073805bed83da3fa759..4d6a54922847b062cb696830a4cd656788e9b8d2 100644 (file)
@@ -815,6 +815,22 @@ string const LaTeXFeatures::getColorOptions() const
 }
 
 
+string const LaTeXFeatures::getPackageOptions() const
+{
+       ostringstream packageopts;
+       // Output all the package option stuff we have been asked to do.
+       map<string, string>::const_iterator it =
+               params_.documentClass().packageOptions().begin();
+       map<string, string>::const_iterator en =
+               params_.documentClass().packageOptions().end();
+       for (; it != en; ++it)
+               if (mustProvide(it->first))
+                       packageopts << "\\PassOptionsToPackage{" << it->second << "}"
+                                << "{" << it->first << "}\n";
+       return packageopts.str();
+}
+
+
 string const LaTeXFeatures::getPackages() const
 {
        ostringstream packages;
@@ -825,16 +841,6 @@ string const LaTeXFeatures::getPackages() const
        // also unknown packages can be requested. They are silently
        // swallowed now. We should change this eventually.
 
-       // Output all the package option stuff we have been asked to do.
-       map<string, string>::const_iterator it =
-           params_.documentClass().packageOptions().begin();
-       map<string, string>::const_iterator en =
-           params_.documentClass().packageOptions().end();
-       for (; it != en; ++it)
-               if (mustProvide(it->first))
-                       packages << "\\PassOptionsToPackage{" << it->second << "}"
-                                << "{" << it->first << "}\n";
-
        //  These are all the 'simple' includes.  i.e
        //  packages which we just \usepackage{package}
        for (int i = 0; i < nb_simplefeatures; ++i) {
index be00847f7e80f60b2c5b6755281a588b20d7dea0..097fe4cf8c425ed9d6abd3d78291cc85fe8f44b5 100644 (file)
@@ -55,6 +55,8 @@ public:
                      OutputParams const &);
        /// The color packages
        std::string const getColorOptions() const;
+       /// The requested package options
+       std::string const getPackageOptions() const;
        /// The packages needed by the document
        std::string const getPackages() const;
        /// The macros definitions needed by the document