From b3a8abffc760e24dea3a1a18a96f776529bb186a Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sun, 1 Dec 2013 10:57:13 +0100 Subject: [PATCH] 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. --- src/BufferParams.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 55c2fa1c98..cc18ce1e69 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"; + } } }