]> git.lyx.org Git - lyx.git/blobdiff - src/output_latex.cpp
Fix bug 4441. GuiRef: Ok button must be default.
[lyx.git] / src / output_latex.cpp
index 2a896ab7518c88df6988436ccd3594fa2cc16cae..c9538ca9a66d723a8b9dc32fd5f238a233e0f156 100644 (file)
@@ -180,8 +180,9 @@ TeXEnvironment(Buffer const & buf,
        bool cjk_nested = false;
        if (par_language->encoding()->package() == Encoding::CJK &&
            open_encoding_ != CJK && pit->isMultiLingual(bparams)) {
-               os << "\\begin{CJK}{" << from_ascii(par_language->encoding()->latexName())
-                  << "}{" << from_ascii(bparams.fontsCJK) << "}%\n";
+               if (prev_par_language->encoding()->package() == Encoding::CJK)
+                       os << "\\begin{CJK}{" << from_ascii(par_language->encoding()->latexName())
+                          << "}{" << from_ascii(bparams.fontsCJK) << "}%\n";
                open_encoding_ = CJK;
                cjk_nested = true;
                texrow.newline();
@@ -441,11 +442,8 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
                        // With CJK, only add switch if we have CJK content at the beginning
                        // of the paragraph
                        if (encoding->package() != Encoding::CJK || i == 0) {
-                               OutputParams tmp_rp = runparams;
-                               runparams.moving_arg = false;
                                pair<bool, int> enc_switch = switchEncoding(os, bparams, runparams,
                                        *encoding);
-                               runparams = tmp_rp;
                                // the following is necessary after a CJK environment in a multilingual
                                // context (nesting issue).
                                if (par_language->encoding()->package() == Encoding::CJK &&
@@ -579,7 +577,7 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
                        break;
        }
 
-               // fall through possible
+       // fall through possible
        default:
                // we don't need it for the last paragraph!!!
                if (nextpit != paragraphs.end())
@@ -657,9 +655,9 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf,
        // also if the next paragraph is a multilingual environment (because of nesting)
        if (nextpit != paragraphs.end() && open_encoding_ == CJK &&
            (nextpit->getParLanguage(bparams)->encoding()->package() != Encoding::CJK ||
-            nextpit->layout().isEnvironment() && nextpit->isMultiLingual(bparams))
-            // in environments, CJK has to be closed later (nesting!)
-            && !style.isEnvironment()) {
+            (nextpit->layout().isEnvironment() && nextpit->isMultiLingual(bparams)))
+            // inbetween environments, CJK has to be closed later (nesting!)
+            && (!style.isEnvironment() || !nextpit->layout().isEnvironment())) {
                os << "\\end{CJK}\n";
                open_encoding_ = none;
        }
@@ -797,8 +795,7 @@ void latexParagraphs(Buffer const & buf,
                // FIXME This check should not be needed. We should
                // perhaps issue an error if it is.
                Layout const & layout = par->forcePlainLayout() ?
-                               tclass.plainLayout() :
-                               par->layout();
+                               tclass.plainLayout() : par->layout();
 
                if (layout.intitle) {
                        if (already_title) {