From 9c432a993523968f0bcca23422735e5b3a37db9f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Tue, 21 Oct 2008 17:03:49 +0000 Subject: [PATCH] * output_latex.cpp: - fix CJK nesting in child documents (bug 5358). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27014 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/output_latex.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index cc3475759d..90af09a5dc 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -674,6 +674,9 @@ TeXOnePar(Buffer const & buf, if (nextpit == paragraphs.end() && !style.isEnvironment()) { switch (open_encoding_) { case CJK: { + // do nothing at the end of child documents + if (maintext && buf.masterBuffer() != &buf) + break; // end of main text if (maintext) { os << '\n'; @@ -761,10 +764,13 @@ void latexParagraphs(Buffer const & buf, } bool const maintext = text.isMainText(buf); + bool const is_child = buf.masterBuffer() != &buf; // Open a CJK environment at the beginning of the main buffer // if the document's language is a CJK language - if (maintext && bparams.encoding().package() == Encoding::CJK) { + // (but not in child documents) + if (maintext && !is_child + && bparams.encoding().package() == Encoding::CJK) { os << "\\begin{CJK}{" << from_ascii(bparams.encoding().latexName()) << "}{" << from_ascii(bparams.fontsCJK) << "}%\n"; texrow.newline(); @@ -856,7 +862,7 @@ void latexParagraphs(Buffer const & buf, // If the last paragraph is an environment, we'll have to close // CJK at the very end to do proper nesting. - if (maintext && open_encoding_ == CJK) { + if (maintext && !is_child && open_encoding_ == CJK) { os << "\\end{CJK}\n"; texrow.newline(); open_encoding_ = none; -- 2.39.2