[LyX/master] Fix spacing in forceLTR for classic latex

Juergen Spitzmueller spitz at lyx.org
Mon Apr 10 05:32:04 UTC 2023


commit 767f3e5b819079deecbcbc938a3bbcea1227437f
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Mon Apr 10 08:37:04 2023 +0200

    Fix spacing in forceLTR for classic latex
---
 src/Paragraph.cpp |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 5944aa6..c332ab0 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -1091,6 +1091,8 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
 	}
 
 	bool close_brace = false;
+	bool const disp_env = (inset->isEnvironment() && inset->getLayout().isDisplay())
+			|| runparams.inDisplayMath;
 	string close_env;
 	odocstream::pos_type const len = os.os().tellp();
 
@@ -1105,7 +1107,7 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
 		if (runparams.use_polyglossia) {
 			// (lua)bidi
 			// Displayed environments go in an LTR environment
-			if (inset->isEnvironment() && inset->getLayout().isDisplay()) {
+			if (disp_env) {
 				os << "\\begin{LTR}";
 				close_env = "LTR";
 			} else {
@@ -1119,6 +1121,8 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
 		} else {
 			// babel classic
 			os << "\\L{";
+			if (disp_env)
+				os << safebreakln;
 			close_brace = true;
 		}
 	}
@@ -1200,8 +1204,11 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
 	if (!close_env.empty())
 		os << "\\end{" << close_env << "}";
 
-	if (close_brace)
+	if (close_brace) {
 		os << '}';
+		if (disp_env)
+			os << safebreakln;
+	}
 
 	if (os.texrow().rows() > previous_row_count) {
 		os.texrow().start(owner_->id(), i + 1);


More information about the lyx-cvs mailing list