From 46aed6d2b90cafed93a6ee996ec72c09a6325f92 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Fri, 19 Jun 2015 19:02:35 +0200 Subject: [PATCH] Refine lang nesting fix --- src/output_latex.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index fdfe7f83e7..80cb990442 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -194,6 +194,8 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf, } if (style.isEnvironment()) { + if (par_lang != doc_lang) + state->open_polyglossia_lang_ = par_lang; os << "\\begin{" << from_ascii(style.latexname()) << '}'; if (!style.latexargs().empty()) { OutputParams rp = runparams; @@ -969,10 +971,8 @@ void TeXOnePar(Buffer const & buf, unskip_newline = !localswitch; } } else if (!par_lang.empty()) { - // If we are in an environment, we have to close the language afterwards - if (style.isEnvironment()) - state->open_polyglossia_lang_ = par_lang; - else { + // If we are in an environment, we have to close the "outer" language afterwards + if (!style.isEnvironment() || state->open_polyglossia_lang_ != par_lang) { os << from_ascii(subst( lang_end_command, "$$lang", -- 2.39.2