http://bugzilla.lyx.org/show_bug.cgi?id=5385

Problem: 
- We enclose the main text of CJK documents in \begin{CJK}...\end{CJK}
- This is also done in child documents, which triggers a LaTeX error due to 
invalid nesting (of the CJK environment)

Solution:
- Do not start a new CJK environment at the beginning of a document if it is a 
child document.

OK to commit?

Jürgen
Index: src/output_latex.cpp
===================================================================
--- src/output_latex.cpp	(Revision 27012)
+++ src/output_latex.cpp	(Arbeitskopie)
@@ -764,7 +764,9 @@
 
 	// 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 && buf.masterBuffer() == &buf
+	    && bparams.encoding().package() == Encoding::CJK) {
 		os << "\\begin{CJK}{" << from_ascii(bparams.encoding().latexName())
 		<< "}{" << from_ascii(bparams.fontsCJK) << "}%\n";
 		texrow.newline();

Reply via email to