From ef6be5f49929993cd3529920846676b8c5be687b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Wed, 14 Jan 2009 09:26:13 +0000 Subject: [PATCH] * load CJKutf8 package, if available, for CJK documents in utf8 encoding (first part of fix to bug 5386) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28142 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/chkconfig.ltx | 1 + lib/doc/LaTeXConfig.lyx | 38 ++++++++++++++++++++++++++++++++++++-- src/BufferParams.cpp | 12 ++++++++++-- 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/lib/chkconfig.ltx b/lib/chkconfig.ltx index 19b62e53c4..fcac24b89c 100644 --- a/lib/chkconfig.ltx +++ b/lib/chkconfig.ltx @@ -234,6 +234,7 @@ \TestPackage{bm} \TestPackage{booktabs} \TestPackage{braille} +\TestPackage{CJKutf8} \TestPackage{color} % this one should be there if graphics.sty is there. \TestPackage{covington} \TestPackage{csquotes} diff --git a/lib/doc/LaTeXConfig.lyx b/lib/doc/LaTeXConfig.lyx index e6f4e71c82..18fcf661d2 100644 --- a/lib/doc/LaTeXConfig.lyx +++ b/lib/doc/LaTeXConfig.lyx @@ -1,5 +1,5 @@ -#LyX 1.6.2svn created this file. For more info see http://www.lyx.org/ -\lyxformat 345 +#LyX 2.0.0svn created this file. For more info see http://www.lyx.org/ +\lyxformat 347 \begin_document \begin_header \textclass article @@ -3949,6 +3949,40 @@ bibtopic is used to split BibTeX created bibliographies into sections. \end_layout +\begin_layout Subsection +CJKutf8 +\end_layout + +\begin_layout Description +Found: +\begin_inset Info +type "package" +arg "CJKutf8" +\end_inset + + +\end_layout + +\begin_layout Description +CTAN: +\family typewriter +language/chinese/CJK/ +\end_layout + +\begin_layout Description +Notes: The package +\family sans +CJKutf8 +\family default + (part of the +\family sans + CJK +\family default + bundle) merges base LaTeX's and CJK's UTF-8 support. + It is needed to produce proper output with the combination of CJK, utf-8 + encoding, and hyperref. +\end_layout + \begin_layout Subsection dvipost \end_layout diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 08b07c3ba5..4d52968de7 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -2168,7 +2168,11 @@ void BufferParams::writeEncodingPreamble(odocstream & os, texrow.newline(); } if (package == Encoding::CJK || features.mustProvide("CJK")) { - os << "\\usepackage{CJK}\n"; + if (language->encoding()->name() == "utf8-cjk" + && features.isAvailable("CJKutf8")) + os << "\\usepackage{CJKutf8}\n"; + else + os << "\\usepackage{CJK}\n"; texrow.newline(); } } else if (inputenc != "default") { @@ -2185,7 +2189,11 @@ void BufferParams::writeEncodingPreamble(odocstream & os, texrow.newline(); break; case Encoding::CJK: - os << "\\usepackage{CJK}\n"; + if (encoding().name() == "utf8-cjk" + && features.isAvailable("CJKutf8")) + os << "\\usepackage{CJKutf8}\n"; + else + os << "\\usepackage{CJK}\n"; texrow.newline(); break; }