Add missing empty line (par break) between pars with differing line spacing (#12638)

This commit is contained in:
Juergen Spitzmueller 2023-02-09 17:23:18 +01:00
parent c7b5d156a2
commit 8c6db95135

View File

@ -1174,7 +1174,7 @@ void TeXOnePar(Buffer const & buf,
&& (pit == 0 || !priorpar->hasSameLayout(par))) && (pit == 0 || !priorpar->hasSameLayout(par)))
{ {
os << from_ascii(par.params().spacing().writeEnvirBegin(useSetSpace)) os << from_ascii(par.params().spacing().writeEnvirBegin(useSetSpace))
<< '\n'; << '\n';
} }
if (style.isCommand()) { if (style.isCommand()) {
@ -1499,21 +1499,22 @@ void TeXOnePar(Buffer const & buf,
Layout const & next_layout = nextpar->layout(); Layout const & next_layout = nextpar->layout();
if (!next_layout.isCommand()) { if (!next_layout.isCommand()) {
// Here we now try to avoid spurious empty lines by // Here we now try to avoid spurious empty lines by
// outputting a paragraph break only if: (case 1) the // outputting a paragraph break only if:
// paragraph style allows parbreaks and no \begin, \end // (case 1) the paragraph style allows parbreaks and
// or \item tags are going to follow (i.e., if the next // no \begin, \end or \item tags are going to follow
// isn't the first or the current isn't the last // (i.e., if the next isn't the first or the current
// paragraph of an environment or itemize) and the // isn't the last paragraph of an environment or itemize)
// depth and alignment of the following paragraph is // and the depth and alignment of the following paragraph is
// unchanged, or (case 2) the following is a // unchanged, or
// non-environment paragraph whose depth is increased // (case 2) the following is a non-environment paragraph
// but whose alignment is unchanged, or (case 3) the // whose depth is increased but whose alignment is unchanged, or
// paragraph is not an environment and the next one is a // (case 3) the paragraph is not an environment and the next one
// non-itemize-like env at lower depth, or (case 4) the // is a non-itemize-like env at lower depth, or
// paragraph is a command not followed by an environment // (case 4) the paragraph is a command not followed by an
// and the alignment of the current and next paragraph // environment and the alignment of the current and next
// is unchanged, or (case 5) the current alignment is // paragraph is unchanged, or
// changed and a standard paragraph follows. // (case 5) the current alignment is changed and a
// standard paragraph follows.
DocumentClass const & tclass = bparams.documentClass(); DocumentClass const & tclass = bparams.documentClass();
if ((style == next_layout if ((style == next_layout
&& !style.parbreak_is_newline && !style.parbreak_is_newline
@ -1523,7 +1524,8 @@ void TeXOnePar(Buffer const & buf,
&& style.latextype != LATEX_LIST_ENVIRONMENT && style.latextype != LATEX_LIST_ENVIRONMENT
&& style.align == par.getAlign(bparams) && style.align == par.getAlign(bparams)
&& nextpar->getDepth() == par.getDepth() && nextpar->getDepth() == par.getDepth()
&& nextpar->getAlign(bparams) == par.getAlign(bparams)) && (nextpar->getAlign(bparams) == par.getAlign(bparams)
|| par.params().spacing() != nextpar->params().spacing()))
|| (!next_layout.isEnvironment() || (!next_layout.isEnvironment()
&& nextpar->getDepth() > par.getDepth() && nextpar->getDepth() > par.getDepth()
&& nextpar->getAlign(bparams) == next_layout.align) && nextpar->getAlign(bparams) == next_layout.align)