* src/output_latex.cpp:

- handle CJK nesting correctly with nested insets (bug 4913).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@25102 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2008-06-03 13:47:02 +00:00
parent 06a7a6d032
commit 9033b5a646
2 changed files with 13 additions and 8 deletions

View File

@ -51,7 +51,7 @@ enum OpenEncoding {
};
static int open_encoding_ = none;
static bool cjk_inherited_ = false;
static int cjk_inherited_ = 0;
ParagraphList::const_iterator
@ -299,9 +299,11 @@ TeXOnePar(Buffer const & buf,
OutputParams runparams = runparams_in;
runparams.moving_arg |= style->needprotect;
// we are at the beginning of an inset and CJK is already open.
if (pit == paragraphs.begin() && !maintext && open_encoding_ == CJK) {
cjk_inherited_ = true;
// we are at the beginning of an inset and CJK is already open;
// we count inheritation levels to get the inset nesting right.
if (pit == paragraphs.begin() && !maintext
&& (cjk_inherited_ > 0 || open_encoding_ == CJK)) {
cjk_inherited_ += 1;
open_encoding_ = none;
}
@ -432,7 +434,7 @@ TeXOnePar(Buffer const & buf,
// the following is necessary after a CJK environment in a multilingual
// context (nesting issue).
if (par_language->encoding()->package() == Encoding::CJK &&
open_encoding_ != CJK && !cjk_inherited_) {
open_encoding_ != CJK && cjk_inherited_ == 0) {
os << "\\begin{CJK}{" << from_ascii(par_language->encoding()->latexName())
<< "}{}%\n";
open_encoding_ = CJK;
@ -851,9 +853,10 @@ void latexParagraphs(Buffer const & buf,
open_encoding_ = none;
}
// reset inherited encoding
if (cjk_inherited_) {
open_encoding_ = CJK;
cjk_inherited_ = false;
if (cjk_inherited_ > 0) {
cjk_inherited_ -= 1;
if (cjk_inherited_ == 0)
open_encoding_ = CJK;
}
}

View File

@ -35,6 +35,8 @@ What's new
* DOCUMENT INPUT/OUTPUT
- Fix a LaTeX error with nested insets in CJK documents (bug 4913).
- New layout and template files for the Journal of Statistical Software (JSS).
- The importer for comma separated value (*.csv) files has been rewritten.