Refine lang nesting fix

This commit is contained in:
Juergen Spitzmueller 2015-06-19 19:02:35 +02:00
parent b2e4989212
commit 46aed6d2b9

View File

@ -194,6 +194,8 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf,
} }
if (style.isEnvironment()) { if (style.isEnvironment()) {
if (par_lang != doc_lang)
state->open_polyglossia_lang_ = par_lang;
os << "\\begin{" << from_ascii(style.latexname()) << '}'; os << "\\begin{" << from_ascii(style.latexname()) << '}';
if (!style.latexargs().empty()) { if (!style.latexargs().empty()) {
OutputParams rp = runparams; OutputParams rp = runparams;
@ -969,10 +971,8 @@ void TeXOnePar(Buffer const & buf,
unskip_newline = !localswitch; unskip_newline = !localswitch;
} }
} else if (!par_lang.empty()) { } else if (!par_lang.empty()) {
// If we are in an environment, we have to close the language afterwards // If we are in an environment, we have to close the "outer" language afterwards
if (style.isEnvironment()) if (!style.isEnvironment() || state->open_polyglossia_lang_ != par_lang) {
state->open_polyglossia_lang_ = par_lang;
else {
os << from_ascii(subst( os << from_ascii(subst(
lang_end_command, lang_end_command,
"$$lang", "$$lang",