X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Foutput_latex.cpp;h=4aa797b98b8c91ab7ce93a38e4a7cfb2ef4a22c5;hb=59e3ff27ffde4f7ac54cc4849c537f9f15dd3d8f;hp=18c87b101bbb1b4e6d66f353101f97a90d968b4e;hpb=6ed3eb6833ed1a723dc55962e643f58ec1ba2375;p=lyx.git diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 18c87b101b..4aa797b98b 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -434,6 +434,22 @@ void TeXEnvironment(Buffer const & buf, Text const & text, continue; } + // Do not output empty environments if the whole paragraph has + // been deleted with ct and changes are not output. + if (size_t(pit + 1) < paragraphs.size()) { + ParagraphList::const_iterator nextpar = paragraphs.constIterator(pit + 1); + Paragraph const & cpar = paragraphs.at(pit); + if ((par->layout() != nextpar->layout() + || par->params().depth() == nextpar->params().depth() + || par->params().leftIndent() == nextpar->params().leftIndent()) + && !runparams.for_search && cpar.size() > 0 + && cpar.isDeleted(0, cpar.size()) && !buf.params().output_changes) { + if (!buf.params().output_changes && !cpar.parEndChange().deleted()) + os << '\n' << '\n'; + continue; + } + } + // This is a new environment. TeXEnvironmentData const data = prepareEnvironment(buf, text, par, os, runparams); @@ -802,7 +818,8 @@ void TeXOnePar(Buffer const & buf, // Due to the moving argument, some fragile // commands (labels, index entries) // are output after this command (#2154) - runparams.postpone_fragile_stuff = true; + runparams.postpone_fragile_stuff = + bparams.postpone_fragile_content; if (intitle_command) os << '{'; @@ -916,7 +933,8 @@ void TeXOnePar(Buffer const & buf, // Due to the moving argument, some fragile // commands (labels, index entries) // are output after this command (#2154) - runparams.postpone_fragile_stuff = true; + runparams.postpone_fragile_stuff = + bparams.postpone_fragile_content; os << '{'; } @@ -1133,7 +1151,8 @@ void TeXOnePar(Buffer const & buf, // Due to the moving argument, some fragile // commands (labels, index entries) // are output after this command (#2154) - runparams.postpone_fragile_stuff = true; + runparams.postpone_fragile_stuff = + bparams.postpone_fragile_content; } Font const outerfont = text.outerFont(pit); @@ -1359,7 +1378,8 @@ void TeXOnePar(Buffer const & buf, if (nextpar && state->open_encoding_ == CJK && bparams.encoding().iconvName() != "UTF-8" && bparams.encoding().package() != Encoding::CJK - && (nextpar_language->encoding()->package() != Encoding::CJK + && ((nextpar_language && + nextpar_language->encoding()->package() != Encoding::CJK) || (nextpar->layout().isEnvironment() && nextpar->isMultiLingual(bparams))) // inbetween environments, CJK has to be closed later (nesting!) && (!style.isEnvironment() || !nextpar->layout().isEnvironment())) { @@ -1639,7 +1659,7 @@ void latexParagraphs(Buffer const & buf, // Do not output empty environments if the whole paragraph has // been deleted with ct and changes are not output. - if (pit < runparams.par_end) { + if (size_t(pit + 1) < paragraphs.size()) { ParagraphList::const_iterator nextpar = paragraphs.constIterator(pit + 1); Paragraph const & cpar = paragraphs.at(pit); if ((par->layout() != nextpar->layout()