Consider PackageOptions with parskip

This commit is contained in:
Juergen Spitzmueller 2023-10-30 12:54:29 +01:00
parent 6c5dc39cd5
commit 07c99393be
2 changed files with 24 additions and 3 deletions

View 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

View 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;