commit b3a8abffc760e24dea3a1a18a96f776529bb186a
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Sun Dec 1 10:57:13 2013 +0100

    Load the CJK package if requested
    
    The package was not loaded if a the main language was not CJK, the main 
encoding was non-default and the document had a secondary CJK language.

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 55c2fa1..cc18ce1 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -2847,6 +2847,15 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
                                os << "\\usepackage{CJK}\n";
                        break;
                }
+               // Load the CJK package if needed by a secondary language.
+               // If the main encoding is some variant of UTF8, use CJKutf8.
+               if (encoding().package() != Encoding::CJK && 
features.mustProvide("CJK")) {
+                       if (encoding().iconvName() == "UTF-8"
+                           && LaTeXFeatures::isAvailable("CJKutf8"))
+                               os << "\\usepackage{CJKutf8}\n";
+                       else
+                               os << "\\usepackage{CJK}\n";
+               }
        }
 }
 

Reply via email to