#include "LaTeXFeatures.h"
#include "LaTeXFonts.h"
#include "Font.h"
-#include "Lexer.h"
#include "LyXRC.h"
#include "OutputParams.h"
#include "Spacing.h"
#include "support/filetools.h"
#include "support/gettext.h"
#include "support/Length.h"
+#include "support/Lexer.h"
#include "support/Messages.h"
#include "support/mutex.h"
#include "support/Package.h"
features.require(documentClass().required());
if (columns > 1 && language->rightToLeft()
- && !features.runparams().isFullUnicode())
+ && !features.runparams().isFullUnicode()
+ && language->babel() != "hebrew")
features.require("rtloutputdblcol");
if (output_changes) {
break;
}
+ if (paragraph_separation) {
+ if (!tclass.halfparskip().empty() && getDefSkip().kind() == VSpace::HALFLINE)
+ clsoptions << tclass.halfparskip() << ",";
+ if (!tclass.fullparskip().empty() && getDefSkip().kind() == VSpace::FULLLINE)
+ clsoptions << tclass.fullparskip() << ",";
+ }
+
// language should be a parameter to \documentclass
if (language->babel() == "hebrew"
&& default_language->babel() != "hebrew")
if (paragraph_separation) {
// when skip separation
string psopt;
+ bool default_skip = false;
+ bool by_class_option = false;
switch (getDefSkip().kind()) {
case VSpace::SMALLSKIP:
psopt = "\\smallskipamount";
break;
case VSpace::HALFLINE:
// default (no option)
+ default_skip = true;
+ by_class_option = !tclass.halfparskip().empty();
break;
case VSpace::FULLLINE:
psopt = "\\baselineskip";
+ by_class_option = !tclass.fullparskip().empty();
break;
case VSpace::LENGTH:
psopt = getDefSkip().length().asLatexString();
default:
break;
}
- if (!features.isProvided("parskip")) {
+ if (features.isProvided("parskip")) {
+ // package already loaded (with arbitrary options)
+ // change parskip value only
if (!psopt.empty())
- psopt = "[skip=" + psopt + "]";
- os << "\\usepackage" + psopt + "{parskip}\n";
- } else if (!psopt.empty()) {
- os << "\\setlength{\\parskip}{" + psopt + "}\n";
+ os << "\\setlength{\\parskip}{" + psopt + "}\n";
+ else if (default_skip)
+ // explicitly reset default (might have been changed
+ // in a class or package)
+ os << "\\parskip=.5\\baselineskip plus 2pt\\relax\n";
+ } else if (!by_class_option) {
+ // load parskip package with required options
+ string psopts;
+ if (!psopt.empty()) {
+ if (contains(psopt, ' '))
+ // glue length has spaces: embrace
+ psopts = "skip={" + psopt + "}";
+ else
+ 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
}
+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