Am Sonntag, dem 28.09.2025 um 10:37 +1300 schrieb Andrew Parsloe:
> I'm essentially a mono-lingual English speaker and the subtleties of 
> language treatment in LyX have passed me by, but from sometime in the
> LyX 2.4 series (I think -- perhaps it was earlier) I've found myself 
> caught out by the sudden presence of \selectlanguage{english}, 
> \foreignlanguage{english} commands appearing in documents after I've 
> used a verbatim environment.

The attached patch (against master) should fix this. Comments?

-- 
Jürgen
diff --git a/src/output_latex.cpp b/src/output_latex.cpp
index 8ae99ca38d..efdd606822 100644
--- a/src/output_latex.cpp
+++ b/src/output_latex.cpp
@@ -225,7 +225,9 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf,
 	// For polyglossia, switch language outside of environment, if possible.
 	// However, if we are at the start of an inset, do not close languages
 	// opened outside.
-	if (par_lang != prev_par_lang) {
+	// Pass_thru paragraphs have empty lang; they are ignored.
+	if ((!par_lang.empty() || !prev_par_lang.empty())
+	     && par_lang != prev_par_lang) {
 		if (!firstpar
 		    && (!using_begin_end || langOpenedAtThisLevel(state))
 		    && !lang_end_command.empty()
-- 
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to