From 3628ceec480c3d8fa9673f80f781eb1153fb9e1f Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Wed, 8 Nov 2017 08:44:00 +0100 Subject: [PATCH] Fix #10778 (issue with CJK and language nesting) When using CJK, don't try to close a language that was never opened before, such as when it is the main language. --- src/Paragraph.cpp | 1 + src/output_latex.cpp | 8 ++++++++ src/output_latex.h | 7 +++++++ status.22x | 2 ++ 4 files changed, 18 insertions(+) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 48d0e1737f..3a9dd6ee27 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -2486,6 +2486,7 @@ void Paragraph::latex(BufferParams const & bparams, bool const using_begin_end = runparams.use_polyglossia || !lang_end_command.empty(); if (!running_lang.empty() && + (!using_begin_end || running_lang == openLanguageName()) && font.language()->encoding()->package() == Encoding::CJK) { string end_tag = subst(lang_end_command, "$$lang", diff --git a/src/output_latex.cpp b/src/output_latex.cpp index eac0a93f52..5e49456929 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -527,6 +527,14 @@ void popLanguageName() } +string const & openLanguageName() +{ + OutputState * state = getOutputState(); + + return openLanguageName(state); +} + + void latexArgInsets(Paragraph const & par, otexstream & os, OutputParams const & runparams, Layout::LaTeXArgMap const & latexargs, string const & prefix) { diff --git a/src/output_latex.h b/src/output_latex.h index 61a9354f6c..fd3e805fe0 100644 --- a/src/output_latex.h +++ b/src/output_latex.h @@ -39,6 +39,13 @@ void pushLanguageName(std::string const & lang, bool localswitch = false); */ void popLanguageName(); +/** Return a reference to the last active language opened with + polyglossia or when using begin/end commands. If none or when + using babel with only a begin command, return a reference to + an empty string. + */ +std::string const & openLanguageName(); + /** Export optional and required arguments of the paragraph \p par. Non-existing required arguments are output empty: {}. */ diff --git a/status.22x b/status.22x index 0f1e6e5668..a25c7cfb80 100644 --- a/status.22x +++ b/status.22x @@ -71,6 +71,8 @@ What's new (2013ff.) instead of vietnam.ldf that was shipped with vntex previously (bug 10743). +- Fix issue with language nesting when using Asian languages (bug 10778). + * LYX2LYX