From 2d4ac90fd20eac5a32b2d71e7de1d2c92ee2429e Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Fri, 24 Aug 2018 15:02:26 +0200 Subject: [PATCH] Fix text direction problem with polyglossia If an RTL language is set via environment in polyglossia, only a nested \\text command will reset the direction for LTR languages Fixes rest of # 10111. --- src/output_latex.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 0fd9d01e69..4172237ef6 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -845,9 +845,13 @@ void TeXOnePar(Buffer const & buf, os << '{'; } - // In some insets (such as Arguments), we cannot use \selectlanguage + // In some insets (such as Arguments), we cannot use \selectlanguage. + // Also, if an RTL language is set via environment in polyglossia, + // only a nested \\text command will reset the direction for LTR + // languages (see # 10111). bool const localswitch = text.inset().forceLocalFontSwitch() - || (using_begin_end && text.inset().forcePlainLayout()); + || (using_begin_end && text.inset().forcePlainLayout()) + || (use_polyglossia && outer_language->rightToLeft() && !par_language->rightToLeft()); if (localswitch) { lang_begin_command = use_polyglossia ? "\\text$$lang$$opts{" : lyxrc.language_command_local; -- 2.39.5