Fix spacing in forceLTR for classic latex

This commit is contained in:
Juergen Spitzmueller 2023-04-10 08:37:04 +02:00
parent e9c8b10c1d
commit 767f3e5b81

View File

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