]> git.lyx.org Git - features.git/commitdiff
Consider PackageOptions with parskip
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 30 Oct 2023 11:54:29 +0000 (12:54 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 30 Oct 2023 11:54:29 +0000 (12:54 +0100)
src/BufferParams.cpp
src/BufferParams.h

index 5ea6e15677e4f81ecfae54fac3e55259e88e1b50..0d1600c5cf201f4efa3acf4d1f4f62bbfcf0ce6c 100644 (file)
@@ -2187,10 +2187,20 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                                // in a class or package)
                                os << "\\parskip=.5\\baselineskip plus 2pt\\relax\n";
                } else {
-                       // load parskip package with required option
+                       // load parskip package with required options
+                       string psopts;
                        if (!psopt.empty())
-                               psopt = "[skip=" + psopt + "]";
-                       os << "\\usepackage" + psopt + "{parskip}\n";
+                               psopts = "skip=" + psopt;
+                       string const xpsopts = getPackageOptions("parskip");
+                       if (!xpsopts.empty()) {
+                               if (!psopts.empty())
+                                       psopts += ",";
+                               psopts += xpsopts;
+                       }
+                       os << "\\usepackage";
+                       if (!psopts.empty())
+                               os << "[" << psopts << "]";
+                       os << "{parskip}\n";
                }
        } else {
                // when separation by indentation
@@ -2971,6 +2981,15 @@ bool BufferParams::hasPackageOption(string const package, string const opt) cons
 }
 
 
+string BufferParams::getPackageOptions(string const package) const
+{
+       for (auto const & p : documentClass().packageOptions())
+               if (package == p.first)
+                       return p.second;
+       return string();
+}
+
+
 bool BufferParams::useBidiPackage(OutputParams const & rp) const
 {
        return (rp.use_polyglossia
index 34b44474aff774cdc9742062038f2724b099c4a4..489e0536868c65cf1289802e5b73b0ae82dafcc3 100644 (file)
@@ -197,6 +197,8 @@ public:
        bool isLiterate() const;
        /// Is this package option requested?
        bool hasPackageOption(std::string const package, std::string const opt) const;
+       /// Get the options requested for a given package
+       std::string getPackageOptions(std::string const package) const;
        /// Do we use the bidi package (which does some reordering and stuff)?
        bool useBidiPackage(OutputParams const & rp) const;