From 7018d3641f693967bb8bade86488a495cd2e976b Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Fri, 27 Apr 2018 18:27:21 +0200 Subject: [PATCH] Don't add localswitch if no language changes --- src/output_latex.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index dcf10a718d..c36ed2587b 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -838,9 +838,11 @@ void TeXOnePar(Buffer const & buf, lang_end_command = "}"; lang_command_termination.clear(); } + + bool const localswitch_needed = localswitch && par_lang != outer_lang; // localswitches need to be closed and reopened at each par - if ((par_lang != prev_lang || localswitch) + if ((par_lang != prev_lang || localswitch_needed) // check if we already put language command in TeXEnvironment() && !(style.isEnvironment() && (pit == 0 || (priorpar->layout() != par.layout() @@ -1115,7 +1117,7 @@ void TeXOnePar(Buffer const & buf, &&((nextpar && par_lang != nextpar_lang) || (runparams.isLastPar && par_lang != outer_lang)); - if (localswitch + if (localswitch_needed || (intitle_command && using_begin_end) || closing_rtl_ltr_environment || ((runparams.isLastPar || close_lang_switch)