From ae1d0776b22f238b7c048e3734b0fd7e90f879fb Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnter=20Milde?= Date: Mon, 28 Jan 2019 23:02:33 +0100 Subject: [PATCH] Fix CJK environment nesting issue. If the last paragraph is nested in an environment, we'll have to \end that first. --- development/autotests/invertedTests | 3 --- src/output_latex.cpp | 9 +++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/development/autotests/invertedTests b/development/autotests/invertedTests index e9ade78ac8..b421b1a88e 100644 --- a/development/autotests/invertedTests +++ b/development/autotests/invertedTests @@ -91,9 +91,6 @@ export/examples/ja/multilingual_.*_systemF # but that is not so easy if the main language does not require CJK: export/export/latex/CJK/en-de-el-ru-.*_utf8_pdf2 # -# CJK environment closes too early when the final paragraph is nested: -export/export/latex/CJK/final-paragraph-nested_utf8-cjk_pdf2 -# # "language default" legacy encodings fail (missing fonts) export/export/latex/CJK/ko_default_pdf2 export/export/latex/CJK/zh_CN_default_pdf2 diff --git a/src/output_latex.cpp b/src/output_latex.cpp index f360c15e21..370b1c3089 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -1272,9 +1272,10 @@ void TeXOnePar(Buffer const & buf, } // If this is the last paragraph, close the CJK environment - // if necessary. If it's an environment, we'll have to \end that first. - // FIXME: don't close if the paragraph is nested in an environment - if (runparams.isLastPar && !style.isEnvironment()) { + // if necessary. If it's an environment or nested in an environment, + // we'll have to \end that first. + if (runparams.isLastPar && !style.isEnvironment() + && par.params().depth() < 1) { switch (state->open_encoding_) { case CJK: { // do nothing at the end of child documents @@ -1631,7 +1632,7 @@ pair switchEncoding(odocstream & os, BufferParams const & bparams, if (oldEnc.package() == Encoding::none || newEnc.package() == Encoding::none) return make_pair(false, 0); - // change encoding (not required for CJK with UTF8) + // change encoding (not required with UTF8) if (bparams.encoding().iconvName() != "UTF-8") { LYXERR(Debug::LATEX, "Changing LaTeX encoding from " << oldEnc.name() << " to " << newEnc.name()); -- 2.39.5