mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Amend 9de9ec1e88
When setting halfline parskip with parskip provided, we still need to set this explicitly, as we don't know the current \parskip value. Also improve code readability.
This commit is contained in:
parent
9de9ec1e88
commit
6c5dc39cd5
@ -2153,6 +2153,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
||||
if (paragraph_separation) {
|
||||
// when skip separation
|
||||
string psopt;
|
||||
bool default_skip = false;
|
||||
switch (getDefSkip().kind()) {
|
||||
case VSpace::SMALLSKIP:
|
||||
psopt = "\\smallskipamount";
|
||||
@ -2165,6 +2166,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
||||
break;
|
||||
case VSpace::HALFLINE:
|
||||
// default (no option)
|
||||
default_skip = true;
|
||||
break;
|
||||
case VSpace::FULLLINE:
|
||||
psopt = "\\baselineskip";
|
||||
@ -2175,12 +2177,20 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (!features.isProvided("parskip")) {
|
||||
if (features.isProvided("parskip")) {
|
||||
// package already loaded (with arbitrary options)
|
||||
// change parskip value only
|
||||
if (!psopt.empty())
|
||||
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 {
|
||||
// load parskip package with required option
|
||||
if (!psopt.empty())
|
||||
psopt = "[skip=" + psopt + "]";
|
||||
os << "\\usepackage" + psopt + "{parskip}\n";
|
||||
} else if (!psopt.empty()) {
|
||||
os << "\\setlength{\\parskip}{" + psopt + "}\n";
|
||||
}
|
||||
} else {
|
||||
// when separation by indentation
|
||||
|
Loading…
Reference in New Issue
Block a user