[LyX/master] update RTL tabular code
Udi Fogiel
ufogiel at lyx.org
Mon Jul 6 00:26:58 UTC 2026
commit c32b83f0edb5a0d26e16130592ed29ec5f739dce
Author: Udi Fogiel <ufogiel at lyx.org>
Date: Sun Jul 5 20:56:39 2026 +0300
update RTL tabular code
The LaTeX kernel don't use math in tabulars anymore,
so currently tabulars are typset with RTL columns in
RTL context, in all engines. There is also no need to wrap
the cell content with a direction command.
---
src/insets/InsetTabular.cpp | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index 51df839cde..5af1525b45 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -3485,12 +3485,16 @@ void Tabular::TeXRow(otexstream & os, row_type row,
bool const row_colored = row_info[row].color != "default"
&& lcolor.isKnownLyXName(row_info[row].color);
- // The bidi package (loaded by polyglossia with XeTeX) reverses RTL table columns
- // Luabibdi (used by LuaTeX) behaves like classic
+ // As of the June 2026 LaTeX release, the kernel no longer uses math
+ // mode in tabulars, so RTL table columns are always reversed.
+ // Before that, only the bidi package (loaded by polyglossia with
+ // XeTeX) reversed RTL table columns; Luabidi (used by LuaTeX)
+ // behaved like classic.
bool const bidi_rtl =
runparams.local_font
&& runparams.local_font->isRightToLeft()
- && buffer().params().useBidiPackage(runparams);
+ && (LaTeXFeatures::isAvailableAtLeastFrom("LaTeX", 2026, 6)
+ || buffer().params().useBidiPackage(runparams));
bool const ct = !buffer().params().output_changes;
idx_type lastcell =
bidi_rtl ? getFirstCellInRow(row, ct) : getLastCellInRow(row, ct);
@@ -3566,7 +3570,8 @@ void Tabular::TeXRow(otexstream & os, row_type row,
os.texrow().forceStart(par.id(), 0);
- bool rtl = par.isRTL(buffer().params())
+ bool rtl = !LaTeXFeatures::isAvailableAtLeastFrom("LaTeX", 2026, 6)
+ && par.isRTL(buffer().params())
&& !par.empty()
&& getPWidth(cell).zero()
&& !runparams.isFullUnicode();
@@ -3712,12 +3717,15 @@ void Tabular::latex(otexstream & os, OutputParams const & runparams) const
os << "\\begin{turn}{" << convert<string>(rotate) << "}\n";
}
- // The bidi package (loaded by polyglossia with XeTeX) swaps the column
- // order for RTL (#9686). Thus we use this list.
+ // As of the June 2026 LaTeX release, RTL table columns are always
+ // reversed. Before that, only the bidi package (loaded by polyglossia
+ // with XeTeX) swapped the column order for RTL (#9686). Thus we use
+ // this list.
bool const bidi_rtl =
runparams.local_font
&& runparams.local_font->isRightToLeft()
- && buffer().params().useBidiPackage(runparams);
+ && (LaTeXFeatures::isAvailableAtLeastFrom("LaTeX", 2026, 6)
+ || buffer().params().useBidiPackage(runparams));
list<col_type> columns;
list<col_type> logical_columns;
for (col_type cl = 0; cl < ncols(); ++cl) {
More information about the lyx-cvs
mailing list