#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"
shell_escape = false;
output_sync = false;
use_refstyle = true;
+ use_formatted_ref = false;
use_minted = false;
use_lineno = false;
lex >> output_sync_macro;
} else if (token == "\\use_refstyle") {
lex >> use_refstyle;
+ } else if (token == "\\use_formatted_ref") {
+ lex >> use_formatted_ref;
} else if (token == "\\use_minted") {
lex >> use_minted;
} else if (token == "\\use_lineno") {
<< "\n\\suppress_date " << convert<string>(suppress_date)
<< "\n\\justification " << convert<string>(justification)
<< "\n\\use_refstyle " << use_refstyle
+ << "\n\\use_formatted_ref " << use_formatted_ref
<< "\n\\use_minted " << use_minted
<< "\n\\use_lineno " << use_lineno
<< '\n';
{
features.require(documentClass().required());
- if (columns > 1 && language->rightToLeft())
+ if (columns > 1 && language->rightToLeft()
+ && !features.runparams().isFullUnicode())
features.require("rtloutputdblcol");
if (output_changes) {
features.require("ulem");
features.require("xcolor");
// improves color handling in PDF output
- features.require("pdfcolmk");
} else {
features.require("ct-none");
}
if (paragraph_separation) {
// when skip separation
string psopt;
+ bool default_skip = false;
switch (getDefSkip().kind()) {
case VSpace::SMALLSKIP:
psopt = "\\smallskipamount";
break;
case VSpace::HALFLINE:
// default (no option)
+ default_skip = true;
break;
case VSpace::FULLLINE:
psopt = "\\baselineskip";
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";
+ 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 {
- os << "\\setlength{\\parskip}{" + psopt + "}\n";
+ // load parskip package with required options
+ string psopts;
+ if (!psopt.empty())
+ 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
}
+bool BufferParams::hasPackageOption(string const package, string const opt) const
+{
+ for (auto const & p : documentClass().packageOptions())
+ if (package == p.first && opt == p.second)
+ return true;
+ return false;
+}
+
+
+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
+ // as of babel 3.29, bidi=bidi-* is supported by babel
+ // So we check whether we use a respective version and
+ // whethert bidi-r or bidi-l have been requested either via class
+ // or package options
+ || (rp.use_babel
+ && LaTeXFeatures::isAvailableAtLeastFrom("babel", 2019, 4, 3)
+ && (hasPackageOption("babel", "bidi-r")
+ || hasPackageOption("babel", "bidi-l")
+ || contains(options, "bidi-r")
+ || contains(options, "bidi-l")))
+ )
+ && rp.flavor == Flavor::XeTeX;
+}
+
+
void BufferParams::readPreamble(Lexer & lex)
{
if (lex.getString() != "\\begin_preamble")