Put forceLTR (display) environments in LRE environment rather than command

This fixes whitespace issues.
This commit is contained in:
Juergen Spitzmueller 2023-04-10 08:10:51 +02:00
parent 1dc666082e
commit f058442be9

View File

@ -1090,7 +1090,8 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
running_change = Change(Change::UNCHANGED); running_change = Change(Change::UNCHANGED);
} }
bool close = false; bool close_brace = false;
string close_env;
odocstream::pos_type const len = os.os().tellp(); odocstream::pos_type const len = os.os().tellp();
if (inset->forceLTR(runparams) if (inset->forceLTR(runparams)
@ -1101,16 +1102,25 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
// ERT is an exception, it should be output with no // ERT is an exception, it should be output with no
// decorations at all // decorations at all
&& inset->lyxCode() != ERT_CODE) { && inset->lyxCode() != ERT_CODE) {
if (runparams.use_polyglossia) if (runparams.use_polyglossia) {
// (lua)bidi // (lua)bidi
// Displayed environments go in an LTR environment
if (inset->isEnvironment() && inset->getLayout().isDisplay()) {
os << "\\begin{LTR}";
close_env = "LTR";
} else {
os << "\\LRE{"; os << "\\LRE{";
else if (running_font.language()->lang() == "farsi" close_brace = true;
|| running_font.language()->lang() == "arabic_arabi") }
} else if (running_font.language()->lang() == "farsi"
|| running_font.language()->lang() == "arabic_arabi") {
os << "\\textLR{" << termcmd; os << "\\textLR{" << termcmd;
else close_brace = true;
} else {
// babel classic // babel classic
os << "\\L{"; os << "\\L{";
close = true; close_brace = true;
}
} }
if (open_font && fontswitch_inset) { if (open_font && fontswitch_inset) {
@ -1187,7 +1197,10 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
throw; throw;
} }
if (close) if (!close_env.empty())
os << "\\end{" << close_env << "}";
if (close_brace)
os << '}'; os << '}';
if (os.texrow().rows() > previous_row_count) { if (os.texrow().rows() > previous_row_count) {